File: /var/www/vhosts/uyarreklam.com.tr/.cagefs/tmp/phpLN4kFG
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (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 */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
setup: () => (/* binding */ setup),
speak: () => (/* binding */ speak)
});
;// CONCATENATED MODULE: external ["wp","domReady"]
const external_wp_domReady_namespaceObject = window["wp"]["domReady"];
var external_wp_domReady_default = /*#__PURE__*/__webpack_require__.n(external_wp_domReady_namespaceObject);
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-intro-text.js
/**
* WordPress dependencies
*/
/**
* Build the explanatory text to be placed before the aria live regions.
*
* This text is initially hidden from assistive technologies by using a `hidden`
* HTML attribute which is then removed once a message fills the aria-live regions.
*
* @return {HTMLParagraphElement} The explanatory text HTML element.
*/
function addIntroText() {
const introText = document.createElement('p');
introText.id = 'a11y-speak-intro-text';
introText.className = 'a11y-speak-intro-text';
introText.textContent = (0,external_wp_i18n_namespaceObject.__)('Notifications');
introText.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;');
introText.setAttribute('hidden', 'hidden');
const {
body
} = document;
if (body) {
body.appendChild(introText);
}
return introText;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-container.js
/**
* Build the live regions markup.
*
* @param {string} [ariaLive] Value for the 'aria-live' attribute; default: 'polite'.
*
* @return {HTMLDivElement} The ARIA live region HTML element.
*/
function addContainer(ariaLive = 'polite') {
const container = document.createElement('div');
container.id = `a11y-speak-${ariaLive}`;
container.className = 'a11y-speak-region';
container.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;');
container.setAttribute('aria-live', ariaLive);
container.setAttribute('aria-relevant', 'additions text');
container.setAttribute('aria-atomic', 'true');
const {
body
} = document;
if (body) {
body.appendChild(container);
}
return container;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/clear.js
/**
* Clears the a11y-speak-region elements and hides the explanatory text.
*/
function clear() {
const regions = document.getElementsByClassName('a11y-speak-region');
const introText = document.getElementById('a11y-speak-intro-text');
for (let i = 0; i < regions.length; i++) {
regions[i].textContent = '';
}
// Make sure the explanatory text is hidden from assistive technologies.
if (introText) {
introText.setAttribute('hidden', 'hidden');
}
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/filter-message.js
let previousMessage = '';
/**
* Filter the message to be announced to the screenreader.
*
* @param {string} message The message to be announced.
*
* @return {string} The filtered message.
*/
function filterMessage(message) {
/*
* Strip HTML tags (if any) from the message string. Ideally, messages should
* be simple strings, carefully crafted for specific use with A11ySpeak.
* When re-using already existing strings this will ensure simple HTML to be
* stripped out and replaced with a space. Browsers will collapse multiple
* spaces natively.
*/
message = message.replace(/<[^<>]+>/g, ' ');
/*
* Safari + VoiceOver don't announce repeated, identical strings. We use
* a `no-break space` to force them to think identical strings are different.
*/
if (previousMessage === message) {
message += '\u00A0';
}
previousMessage = message;
return message;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Create the live regions.
*/
function setup() {
const introText = document.getElementById('a11y-speak-intro-text');
const containerAssertive = document.getElementById('a11y-speak-assertive');
const containerPolite = document.getElementById('a11y-speak-polite');
if (introText === null) {
addIntroText();
}
if (containerAssertive === null) {
addContainer('assertive');
}
if (containerPolite === null) {
addContainer('polite');
}
}
/**
* Run setup on domReady.
*/
external_wp_domReady_default()(setup);
/**
* Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions.
* This module is inspired by the `speak` function in `wp-a11y.js`.
*
* @param {string} message The message to be announced by assistive technologies.
* @param {string} [ariaLive] The politeness level for aria-live; default: 'polite'.
*
* @example
* ```js
* import { speak } from '@wordpress/a11y';
*
* // For polite messages that shouldn't interrupt what screen readers are currently announcing.
* speak( 'The message you want to send to the ARIA live region' );
*
* // For assertive messages that should interrupt what screen readers are currently announcing.
* speak( 'The message you want to send to the ARIA live region', 'assertive' );
* ```
*/
function speak(message, ariaLive) {
/*
* Clear previous messages to allow repeated strings being read out and hide
* the explanatory text from assistive technologies.
*/
clear();
message = filterMessage(message);
const introText = document.getElementById('a11y-speak-intro-text');
const containerAssertive = document.getElementById('a11y-speak-assertive');
const containerPolite = document.getElementById('a11y-speak-polite');
if (containerAssertive && ariaLive === 'assertive') {
containerAssertive.textContent = message;
} else if (containerPolite) {
containerPolite.textContent = message;
}
/*
* Make the explanatory text available to assistive technologies by removing
* the 'hidden' HTML attribute.
*/
if (introText) {
introText.removeAttribute('hidden');
}
}
(window.wp = window.wp || {}).a11y = __webpack_exports__;
/******/ })()
;/*! This file is auto-generated */
(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{setup:()=>d,speak:()=>p});const n=window.wp.domReady;var o=e.n(n);const i=window.wp.i18n;function a(e="polite"){const t=document.createElement("div");t.id=`a11y-speak-${e}`,t.className="a11y-speak-region",t.setAttribute("style","position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;"),t.setAttribute("aria-live",e),t.setAttribute("aria-relevant","additions text"),t.setAttribute("aria-atomic","true");const{body:n}=document;return n&&n.appendChild(t),t}let r="";function d(){const e=document.getElementById("a11y-speak-intro-text"),t=document.getElementById("a11y-speak-assertive"),n=document.getElementById("a11y-speak-polite");null===e&&function(){const e=document.createElement("p");e.id="a11y-speak-intro-text",e.className="a11y-speak-intro-text",e.textContent=(0,i.__)("Notifications"),e.setAttribute("style","position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;"),e.setAttribute("hidden","hidden");const{body:t}=document;t&&t.appendChild(e)}(),null===t&&a("assertive"),null===n&&a("polite")}function p(e,t){!function(){const e=document.getElementsByClassName("a11y-speak-region"),t=document.getElementById("a11y-speak-intro-text");for(let t=0;t<e.length;t++)e[t].textContent="";t&&t.setAttribute("hidden","hidden")}(),e=function(e){return e=e.replace(/<[^<>]+>/g," "),r===e&&(e+=" "),r=e,e}(e);const n=document.getElementById("a11y-speak-intro-text"),o=document.getElementById("a11y-speak-assertive"),i=document.getElementById("a11y-speak-polite");o&&"assertive"===t?o.textContent=e:i&&(i.textContent=e),n&&n.removeAttribute("hidden")}o()(d),(window.wp=window.wp||{}).a11y=t})();/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (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 */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
store: () => (/* reexport */ store)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/annotations/build-module/store/selectors.js
var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject);
__webpack_require__.d(selectors_namespaceObject, {
__experimentalGetAllAnnotationsForBlock: () => (__experimentalGetAllAnnotationsForBlock),
__experimentalGetAnnotations: () => (__experimentalGetAnnotations),
__experimentalGetAnnotationsForBlock: () => (__experimentalGetAnnotationsForBlock),
__experimentalGetAnnotationsForRichText: () => (__experimentalGetAnnotationsForRichText)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/annotations/build-module/store/actions.js
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, {
__experimentalAddAnnotation: () => (__experimentalAddAnnotation),
__experimentalRemoveAnnotation: () => (__experimentalRemoveAnnotation),
__experimentalRemoveAnnotationsBySource: () => (__experimentalRemoveAnnotationsBySource),
__experimentalUpdateAnnotationRange: () => (__experimentalUpdateAnnotationRange)
});
;// CONCATENATED MODULE: external ["wp","richText"]
const external_wp_richText_namespaceObject = window["wp"]["richText"];
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/constants.js
/**
* The identifier for the data store.
*
* @type {string}
*/
const STORE_NAME = 'core/annotations';
;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/format/annotation.js
/**
* WordPress dependencies
*/
const FORMAT_NAME = 'core/annotation';
const ANNOTATION_ATTRIBUTE_PREFIX = 'annotation-text-';
/**
* Internal dependencies
*/
/**
* Applies given annotations to the given record.
*
* @param {Object} record The record to apply annotations to.
* @param {Array} annotations The annotation to apply.
* @return {Object} A record with the annotations applied.
*/
function applyAnnotations(record, annotations = []) {
annotations.forEach(annotation => {
let {
start,
end
} = annotation;
if (start > record.text.length) {
start = record.text.length;
}
if (end > record.text.length) {
end = record.text.length;
}
const className = ANNOTATION_ATTRIBUTE_PREFIX + annotation.source;
const id = ANNOTATION_ATTRIBUTE_PREFIX + annotation.id;
record = (0,external_wp_richText_namespaceObject.applyFormat)(record, {
type: FORMAT_NAME,
attributes: {
className,
id
}
}, start, end);
});
return record;
}
/**
* Removes annotations from the given record.
*
* @param {Object} record Record to remove annotations from.
* @return {Object} The cleaned record.
*/
function removeAnnotations(record) {
return removeFormat(record, 'core/annotation', 0, record.text.length);
}
/**
* Retrieves the positions of annotations inside an array of formats.
*
* @param {Array} formats Formats with annotations in there.
* @return {Object} ID keyed positions of annotations.
*/
function retrieveAnnotationPositions(formats) {
const positions = {};
formats.forEach((characterFormats, i) => {
characterFormats = characterFormats || [];
characterFormats = characterFormats.filter(format => format.type === FORMAT_NAME);
characterFormats.forEach(format => {
let {
id
} = format.attributes;
id = id.replace(ANNOTATION_ATTRIBUTE_PREFIX, '');
if (!positions.hasOwnProperty(id)) {
positions[id] = {
start: i
};
}
// Annotations refer to positions between characters.
// Formats refer to the character themselves.
// So we need to adjust for that here.
positions[id].end = i + 1;
});
});
return positions;
}
/**
* Updates annotations in the state based on positions retrieved from RichText.
*
* @param {Array} annotations The annotations that are currently applied.
* @param {Array} positions The current positions of the given annotations.
* @param {Object} actions
* @param {Function} actions.removeAnnotation Function to remove an annotation from the state.
* @param {Function} actions.updateAnnotationRange Function to update an annotation range in the state.
*/
function updateAnnotationsWithPositions(annotations, positions, {
removeAnnotation,
updateAnnotationRange
}) {
annotations.forEach(currentAnnotation => {
const position = positions[currentAnnotation.id];
// If we cannot find an annotation, delete it.
if (!position) {
// Apparently the annotation has been removed, so remove it from the state:
// Remove...
removeAnnotation(currentAnnotation.id);
return;
}
const {
start,
end
} = currentAnnotation;
if (start !== position.start || end !== position.end) {
updateAnnotationRange(currentAnnotation.id, position.start, position.end);
}
});
}
const annotation = {
name: FORMAT_NAME,
title: (0,external_wp_i18n_namespaceObject.__)('Annotation'),
tagName: 'mark',
className: 'annotation-text',
attributes: {
className: 'class',
id: 'id'
},
edit() {
return null;
},
__experimentalGetPropsForEditableTreePreparation(select, {
richTextIdentifier,
blockClientId
}) {
return {
annotations: select(STORE_NAME).__experimentalGetAnnotationsForRichText(blockClientId, richTextIdentifier)
};
},
__experimentalCreatePrepareEditableTree({
annotations
}) {
return (formats, text) => {
if (annotations.length === 0) {
return formats;
}
let record = {
formats,
text
};
record = applyAnnotations(record, annotations);
return record.formats;
};
},
__experimentalGetPropsForEditableTreeChangeHandler(dispatch) {
return {
removeAnnotation: dispatch(STORE_NAME).__experimentalRemoveAnnotation,
updateAnnotationRange: dispatch(STORE_NAME).__experimentalUpdateAnnotationRange
};
},
__experimentalCreateOnChangeEditableValue(props) {
return formats => {
const positions = retrieveAnnotationPositions(formats);
const {
removeAnnotation,
updateAnnotationRange,
annotations
} = props;
updateAnnotationsWithPositions(annotations, positions, {
removeAnnotation,
updateAnnotationRange
});
};
}
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/format/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
name: format_name,
...settings
} = annotation;
(0,external_wp_richText_namespaceObject.registerFormatType)(format_name, settings);
;// CONCATENATED MODULE: external ["wp","hooks"]
const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
;// CONCATENATED MODULE: external ["wp","data"]
const external_wp_data_namespaceObject = window["wp"]["data"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/block/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Adds annotation className to the block-list-block component.
*
* @param {Object} OriginalComponent The original BlockListBlock component.
* @return {Object} The enhanced component.
*/
const addAnnotationClassName = OriginalComponent => {
return (0,external_wp_data_namespaceObject.withSelect)((select, {
clientId,
className
}) => {
const annotations = select(STORE_NAME).__experimentalGetAnnotationsForBlock(clientId);
return {
className: annotations.map(annotation => {
return 'is-annotated-by-' + annotation.source;
}).concat(className).filter(Boolean).join(' ')
};
})(OriginalComponent);
};
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/annotations', addAnnotationClassName);
;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/reducer.js
/**
* Filters an array based on the predicate, but keeps the reference the same if
* the array hasn't changed.
*
* @param {Array} collection The collection to filter.
* @param {Function} predicate Function that determines if the item should stay
* in the array.
* @return {Array} Filtered array.
*/
function filterWithReference(collection, predicate) {
const filteredCollection = collection.filter(predicate);
return collection.length === filteredCollection.length ? collection : filteredCollection;
}
/**
* Creates a new object with the same keys, but with `callback()` called as
* a transformer function on each of the values.
*
* @param {Object} obj The object to transform.
* @param {Function} callback The function to transform each object value.
* @return {Array} Transformed object.
*/
const mapValues = (obj, callback) => Object.entries(obj).reduce((acc, [key, value]) => ({
...acc,
[key]: callback(value)
}), {});
/**
* Verifies whether the given annotations is a valid annotation.
*
* @param {Object} annotation The annotation to verify.
* @return {boolean} Whether the given annotation is valid.
*/
function isValidAnnotationRange(annotation) {
return typeof annotation.start === 'number' && typeof annotation.end === 'number' && annotation.start <= annotation.end;
}
/**
* Reducer managing annotations.
*
* @param {Object} state The annotations currently shown in the editor.
* @param {Object} action Dispatched action.
*
* @return {Array} Updated state.
*/
function annotations(state = {}, action) {
var _state$blockClientId;
switch (action.type) {
case 'ANNOTATION_ADD':
const blockClientId = action.blockClientId;
const newAnnotation = {
id: action.id,
blockClientId,
richTextIdentifier: action.richTextIdentifier,
source: action.source,
selector: action.selector,
range: action.range
};
if (newAnnotation.selector === 'range' && !isValidAnnotationRange(newAnnotation.range)) {
return state;
}
const previousAnnotationsForBlock = (_state$blockClientId = state?.[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : [];
return {
...state,
[blockClientId]: [...previousAnnotationsForBlock, newAnnotation]
};
case 'ANNOTATION_REMOVE':
return mapValues(state, annotationsForBlock => {
return filterWithReference(annotationsForBlock, annotation => {
return annotation.id !== action.annotationId;
});
});
case 'ANNOTATION_UPDATE_RANGE':
return mapValues(state, annotationsForBlock => {
let hasChangedRange = false;
const newAnnotations = annotationsForBlock.map(annotation => {
if (annotation.id === action.annotationId) {
hasChangedRange = true;
return {
...annotation,
range: {
start: action.start,
end: action.end
}
};
}
return annotation;
});
return hasChangedRange ? newAnnotations : annotationsForBlock;
});
case 'ANNOTATION_REMOVE_SOURCE':
return mapValues(state, annotationsForBlock => {
return filterWithReference(annotationsForBlock, annotation => {
return annotation.source !== action.source;
});
});
}
return state;
}
/* harmony default export */ const reducer = (annotations);
;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js
/** @typedef {(...args: any[]) => *[]} GetDependants */
/** @typedef {() => void} Clear */
/**
* @typedef {{
* getDependants: GetDependants,
* clear: Clear
* }} EnhancedSelector
*/
/**
* Internal cache entry.
*
* @typedef CacheNode
*
* @property {?CacheNode|undefined} [prev] Previous node.
* @property {?CacheNode|undefined} [next] Next node.
* @property {*[]} args Function arguments for cache entry.
* @property {*} val Function result.
*/
/**
* @typedef Cache
*
* @property {Clear} clear Function to clear cache.
* @property {boolean} [isUniqueByDependants] Whether dependants are valid in
* considering cache uniqueness. A cache is unique if dependents are all arrays
* or objects.
* @property {CacheNode?} [head] Cache head.
* @property {*[]} [lastDependants] Dependants from previous invocation.
*/
/**
* Arbitrary value used as key for referencing cache object in WeakMap tree.
*
* @type {{}}
*/
var LEAF_KEY = {};
/**
* Returns the first argument as the sole entry in an array.
*
* @template T
*
* @param {T} value Value to return.
*
* @return {[T]} 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 {Cache} Cache object.
*/
function createCache() {
/** @type {Cache} */
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 {*[]} a First array.
* @param {*[]} 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.
*
* @template {(...args: *[]) => *} S
*
* @param {S} selector Selector function.
* @param {GetDependants=} getDependants Dependant getter returning an array of
* references used in cache bust consideration.
*/
/* harmony default export */ function rememo(selector, getDependants) {
/** @type {WeakMap<*,*>} */
var rootCache;
/** @type {GetDependants} */
var normalizedGetDependants = getDependants ? getDependants : arrayOf;
/**
* 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 {*[]} dependants Selector dependants.
*
* @return {Cache} Cache object.
*/
function getCache(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);
}
/**
* Resets root memoization cache.
*/
function clear() {
rootCache = new WeakMap();
}
/* eslint-disable jsdoc/check-param-names */
/**
* The augmented selector call, considering first whether dependants have
* changed before passing it to underlying memoize function.
*
* @param {*} source Source object for derivation.
* @param {...*} extraArgs Additional arguments to pass to selector.
*
* @return {*} Selector result.
*/
/* eslint-enable jsdoc/check-param-names */
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 = normalizedGetDependants.apply(null, args);
cache = getCache(dependants);
// If not guaranteed uniqueness by dependants (primitive type), 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.
/** @type {CacheNode} */ (node.prev).next = node.next;
if (node.next) {
node.next.prev = node.prev;
}
node.next = cache.head;
node.prev = null;
/** @type {CacheNode} */ (cache.head).prev = node;
cache.head = node;
}
// Return immediately
return node.val;
}
// No cached value found. Continue to insertion phase:
node = /** @type {CacheNode} */ ({
// 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 = normalizedGetDependants;
callSelector.clear = clear;
clear();
return /** @type {S & EnhancedSelector} */ (callSelector);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/selectors.js
/**
* External dependencies
*/
/**
* Shared reference to an empty array for cases where it is important to avoid
* returning a new array reference on every invocation, as in a connected or
* other pure component which performs `shouldComponentUpdate` check on props.
* This should be used as a last resort, since the normalized data should be
* maintained by the reducer result in state.
*
* @type {Array}
*/
const EMPTY_ARRAY = [];
/**
* Returns the annotations for a specific client ID.
*
* @param {Object} state Editor state.
* @param {string} clientId The ID of the block to get the annotations for.
*
* @return {Array} The annotations applicable to this block.
*/
const __experimentalGetAnnotationsForBlock = rememo((state, blockClientId) => {
var _state$blockClientId;
return ((_state$blockClientId = state?.[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : []).filter(annotation => {
return annotation.selector === 'block';
});
}, (state, blockClientId) => {
var _state$blockClientId2;
return [(_state$blockClientId2 = state?.[blockClientId]) !== null && _state$blockClientId2 !== void 0 ? _state$blockClientId2 : EMPTY_ARRAY];
});
function __experimentalGetAllAnnotationsForBlock(state, blockClientId) {
var _state$blockClientId3;
return (_state$blockClientId3 = state?.[blockClientId]) !== null && _state$blockClientId3 !== void 0 ? _state$blockClientId3 : EMPTY_ARRAY;
}
/**
* Returns the annotations that apply to the given RichText instance.
*
* Both a blockClientId and a richTextIdentifier are required. This is because
* a block might have multiple `RichText` components. This does mean that every
* block needs to implement annotations itself.
*
* @param {Object} state Editor state.
* @param {string} blockClientId The client ID for the block.
* @param {string} richTextIdentifier Unique identifier that identifies the given RichText.
* @return {Array} All the annotations relevant for the `RichText`.
*/
const __experimentalGetAnnotationsForRichText = rememo((state, blockClientId, richTextIdentifier) => {
var _state$blockClientId4;
return ((_state$blockClientId4 = state?.[blockClientId]) !== null && _state$blockClientId4 !== void 0 ? _state$blockClientId4 : []).filter(annotation => {
return annotation.selector === 'range' && richTextIdentifier === annotation.richTextIdentifier;
}).map(annotation => {
const {
range,
...other
} = annotation;
return {
...range,
...other
};
});
}, (state, blockClientId) => {
var _state$blockClientId5;
return [(_state$blockClientId5 = state?.[blockClientId]) !== null && _state$blockClientId5 !== void 0 ? _state$blockClientId5 : EMPTY_ARRAY];
});
/**
* Returns all annotations in the editor state.
*
* @param {Object} state Editor state.
* @return {Array} All annotations currently applied.
*/
function __experimentalGetAnnotations(state) {
return Object.values(state).flat();
}
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/native.js
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
/* harmony default export */ const esm_browser_native = ({
randomUUID
});
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js
// Unique ID creation requires a high quality random # generator. In the browser we therefore
// require the crypto API and do not support built-in fallback to lower quality random number
// generators (like Math.random()).
let getRandomValues;
const rnds8 = new Uint8Array(16);
function rng() {
// lazy load so that environments that need to polyfill have a chance to do so
if (!getRandomValues) {
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
if (!getRandomValues) {
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
}
}
return getRandomValues(rnds8);
}
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js
/**
* Convert array of 16 byte values to UUID string format of the form:
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
*/
const byteToHex = [];
for (let i = 0; i < 256; ++i) {
byteToHex.push((i + 0x100).toString(16).slice(1));
}
function unsafeStringify(arr, offset = 0) {
// Note: Be careful editing this code! It's been tuned for performance
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
}
function stringify(arr, offset = 0) {
const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
// of the following:
// - One or more input array values don't map to a hex octet (leading to
// "undefined" in the uuid)
// - Invalid input values for the RFC `version` or `variant` fields
if (!validate(uuid)) {
throw TypeError('Stringified UUID is invalid');
}
return uuid;
}
/* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify)));
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js
function v4(options, buf, offset) {
if (esm_browser_native.randomUUID && !buf && !options) {
return esm_browser_native.randomUUID();
}
options = options || {};
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
rnds[6] = rnds[6] & 0x0f | 0x40;
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
if (buf) {
offset = offset || 0;
for (let i = 0; i < 16; ++i) {
buf[offset + i] = rnds[i];
}
return buf;
}
return unsafeStringify(rnds);
}
/* harmony default export */ const esm_browser_v4 = (v4);
;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/actions.js
/**
* External dependencies
*/
/**
* @typedef WPAnnotationRange
*
* @property {number} start The offset where the annotation should start.
* @property {number} end The offset where the annotation should end.
*/
/**
* Adds an annotation to a block.
*
* The `block` attribute refers to a block ID that needs to be annotated.
* `isBlockAnnotation` controls whether or not the annotation is a block
* annotation. The `source` is the source of the annotation, this will be used
* to identity groups of annotations.
*
* The `range` property is only relevant if the selector is 'range'.
*
* @param {Object} annotation The annotation to add.
* @param {string} annotation.blockClientId The blockClientId to add the annotation to.
* @param {string} annotation.richTextIdentifier Identifier for the RichText instance the annotation applies to.
* @param {WPAnnotationRange} annotation.range The range at which to apply this annotation.
* @param {string} [annotation.selector="range"] The way to apply this annotation.
* @param {string} [annotation.source="default"] The source that added the annotation.
* @param {string} [annotation.id] The ID the annotation should have. Generates a UUID by default.
*
* @return {Object} Action object.
*/
function __experimentalAddAnnotation({
blockClientId,
richTextIdentifier = null,
range = null,
selector = 'range',
source = 'default',
id = esm_browser_v4()
}) {
const action = {
type: 'ANNOTATION_ADD',
id,
blockClientId,
richTextIdentifier,
source,
selector
};
if (selector === 'range') {
action.range = range;
}
return action;
}
/**
* Removes an annotation with a specific ID.
*
* @param {string} annotationId The annotation to remove.
*
* @return {Object} Action object.
*/
function __experimentalRemoveAnnotation(annotationId) {
return {
type: 'ANNOTATION_REMOVE',
annotationId
};
}
/**
* Updates the range of an annotation.
*
* @param {string} annotationId ID of the annotation to update.
* @param {number} start The start of the new range.
* @param {number} end The end of the new range.
*
* @return {Object} Action object.
*/
function __experimentalUpdateAnnotationRange(annotationId, start, end) {
return {
type: 'ANNOTATION_UPDATE_RANGE',
annotationId,
start,
end
};
}
/**
* Removes all annotations of a specific source.
*
* @param {string} source The source to remove.
*
* @return {Object} Action object.
*/
function __experimentalRemoveAnnotationsBySource(source) {
return {
type: 'ANNOTATION_REMOVE_SOURCE',
source
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module Constants
*/
/**
* Store definition for the annotations namespace.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*
* @type {Object}
*/
const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
reducer: reducer,
selectors: selectors_namespaceObject,
actions: actions_namespaceObject
});
(0,external_wp_data_namespaceObject.register)(store);
;// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/index.js
/**
* Internal dependencies
*/
(window.wp = window.wp || {}).annotations = __webpack_exports__;
/******/ })()
;/*! This file is auto-generated */
(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{store:()=>G});var n={};e.r(n),e.d(n,{__experimentalGetAllAnnotationsForBlock:()=>N,__experimentalGetAnnotations:()=>O,__experimentalGetAnnotationsForBlock:()=>T,__experimentalGetAnnotationsForRichText:()=>b});var r={};e.r(r),e.d(r,{__experimentalAddAnnotation:()=>S,__experimentalRemoveAnnotation:()=>C,__experimentalRemoveAnnotationsBySource:()=>F,__experimentalUpdateAnnotationRange:()=>P});const o=window.wp.richText,a=window.wp.i18n,i="core/annotations",l="core/annotation",c="annotation-text-";const s={name:l,title:(0,a.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit:()=>null,__experimentalGetPropsForEditableTreePreparation:(e,{richTextIdentifier:t,blockClientId:n})=>({annotations:e(i).__experimentalGetAnnotationsForRichText(n,t)}),__experimentalCreatePrepareEditableTree:({annotations:e})=>(t,n)=>{if(0===e.length)return t;let r={formats:t,text:n};return r=function(e,t=[]){return t.forEach((t=>{let{start:n,end:r}=t;n>e.text.length&&(n=e.text.length),r>e.text.length&&(r=e.text.length);const a=c+t.source,i=c+t.id;e=(0,o.applyFormat)(e,{type:l,attributes:{className:a,id:i}},n,r)})),e}(r,e),r.formats},__experimentalGetPropsForEditableTreeChangeHandler:e=>({removeAnnotation:e(i).__experimentalRemoveAnnotation,updateAnnotationRange:e(i).__experimentalUpdateAnnotationRange}),__experimentalCreateOnChangeEditableValue:e=>t=>{const n=function(e){const t={};return e.forEach(((e,n)=>{(e=(e=e||[]).filter((e=>e.type===l))).forEach((e=>{let{id:r}=e.attributes;r=r.replace(c,""),t.hasOwnProperty(r)||(t[r]={start:n}),t[r].end=n+1}))})),t}(t),{removeAnnotation:r,updateAnnotationRange:o,annotations:a}=e;!function(e,t,{removeAnnotation:n,updateAnnotationRange:r}){e.forEach((e=>{const o=t[e.id];if(!o)return void n(e.id);const{start:a,end:i}=e;a===o.start&&i===o.end||r(e.id,o.start,o.end)}))}(a,n,{removeAnnotation:r,updateAnnotationRange:o})}},{name:u,...d}=s;(0,o.registerFormatType)(u,d);const p=window.wp.hooks,f=window.wp.data;function m(e,t){const n=e.filter(t);return e.length===n.length?e:n}(0,p.addFilter)("editor.BlockListBlock","core/annotations",(e=>(0,f.withSelect)(((e,{clientId:t,className:n})=>({className:e(i).__experimentalGetAnnotationsForBlock(t).map((e=>"is-annotated-by-"+e.source)).concat(n).filter(Boolean).join(" ")})))(e)));const g=(e,t)=>Object.entries(e).reduce(((e,[n,r])=>({...e,[n]:t(r)})),{});const h=function(e={},t){var n;switch(t.type){case"ANNOTATION_ADD":const r=t.blockClientId,o={id:t.id,blockClientId:r,richTextIdentifier:t.richTextIdentifier,source:t.source,selector:t.selector,range:t.range};if("range"===o.selector&&!function(e){return"number"==typeof e.start&&"number"==typeof e.end&&e.start<=e.end}(o.range))return e;const a=null!==(n=e?.[r])&&void 0!==n?n:[];return{...e,[r]:[...a,o]};case"ANNOTATION_REMOVE":return g(e,(e=>m(e,(e=>e.id!==t.annotationId))));case"ANNOTATION_UPDATE_RANGE":return g(e,(e=>{let n=!1;const r=e.map((e=>e.id===t.annotationId?(n=!0,{...e,range:{start:t.start,end:t.end}}):e));return n?r:e}));case"ANNOTATION_REMOVE_SOURCE":return g(e,(e=>m(e,(e=>e.source!==t.source))))}return e};var _={};function A(e){return[e]}function v(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function y(e,t){var n,r=t||A;function o(){n=new WeakMap}function a(){var t,o,a,i,l,c=arguments.length;for(i=new Array(c),a=0;a<c;a++)i[a]=arguments[a];for(t=function(e){var t,r,o,a,i,l=n,c=!0;for(t=0;t<e.length;t++){if(!(i=r=e[t])||"object"!=typeof i){c=!1;break}l.has(r)?l=l.get(r):(o=new WeakMap,l.set(r,o),l=o)}return l.has(_)||((a=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=c,l.set(_,a)),l.get(_)}(l=r.apply(null,i)),t.isUniqueByDependants||(t.lastDependants&&!v(l,t.lastDependants,0)&&t.clear(),t.lastDependants=l),o=t.head;o;){if(v(o.args,i,1))return o!==t.head&&(o.prev.next=o.next,o.next&&(o.next.prev=o.prev),o.next=t.head,o.prev=null,t.head.prev=o,t.head=o),o.val;o=o.next}return o={val:e.apply(null,i)},i[0]=null,o.args=i,t.head&&(t.head.prev=o,o.next=t.head),t.head=o,o.val}return a.getDependants=r,a.clear=o,o(),a}const x=[],T=y(((e,t)=>{var n;return(null!==(n=e?.[t])&&void 0!==n?n:[]).filter((e=>"block"===e.selector))}),((e,t)=>{var n;return[null!==(n=e?.[t])&&void 0!==n?n:x]}));function N(e,t){var n;return null!==(n=e?.[t])&&void 0!==n?n:x}const b=y(((e,t,n)=>{var r;return(null!==(r=e?.[t])&&void 0!==r?r:[]).filter((e=>"range"===e.selector&&n===e.richTextIdentifier)).map((e=>{const{range:t,...n}=e;return{...t,...n}}))}),((e,t)=>{var n;return[null!==(n=e?.[t])&&void 0!==n?n:x]}));function O(e){return Object.values(e).flat()}const I={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let w;const E=new Uint8Array(16);function R(){if(!w&&(w="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!w))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return w(E)}const U=[];for(let e=0;e<256;++e)U.push((e+256).toString(16).slice(1));function D(e,t=0){return U[e[t+0]]+U[e[t+1]]+U[e[t+2]]+U[e[t+3]]+"-"+U[e[t+4]]+U[e[t+5]]+"-"+U[e[t+6]]+U[e[t+7]]+"-"+U[e[t+8]]+U[e[t+9]]+"-"+U[e[t+10]]+U[e[t+11]]+U[e[t+12]]+U[e[t+13]]+U[e[t+14]]+U[e[t+15]]}const k=function(e,t,n){if(I.randomUUID&&!t&&!e)return I.randomUUID();const r=(e=e||{}).random||(e.rng||R)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return D(r)};function S({blockClientId:e,richTextIdentifier:t=null,range:n=null,selector:r="range",source:o="default",id:a=k()}){const i={type:"ANNOTATION_ADD",id:a,blockClientId:e,richTextIdentifier:t,source:o,selector:r};return"range"===r&&(i.range=n),i}function C(e){return{type:"ANNOTATION_REMOVE",annotationId:e}}function P(e,t,n){return{type:"ANNOTATION_UPDATE_RANGE",annotationId:e,start:t,end:n}}function F(e){return{type:"ANNOTATION_REMOVE_SOURCE",source:e}}const G=(0,f.createReduxStore)(i,{reducer:h,selectors:n,actions:r});(0,f.register)(G),(window.wp=window.wp||{}).annotations=t})();/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (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 */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": () => (/* binding */ build_module)
});
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/nonce.js
/**
* @param {string} nonce
* @return {import('../types').APIFetchMiddleware & { nonce: string }} A middleware to enhance a request with a nonce.
*/
function createNonceMiddleware(nonce) {
/**
* @type {import('../types').APIFetchMiddleware & { nonce: string }}
*/
const middleware = (options, next) => {
const {
headers = {}
} = options;
// If an 'X-WP-Nonce' header (or any case-insensitive variation
// thereof) was specified, no need to add a nonce header.
for (const headerName in headers) {
if (headerName.toLowerCase() === 'x-wp-nonce' && headers[headerName] === middleware.nonce) {
return next(options);
}
}
return next({
...options,
headers: {
...headers,
'X-WP-Nonce': middleware.nonce
}
});
};
middleware.nonce = nonce;
return middleware;
}
/* harmony default export */ const nonce = (createNonceMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/namespace-endpoint.js
/**
* @type {import('../types').APIFetchMiddleware}
*/
const namespaceAndEndpointMiddleware = (options, next) => {
let path = options.path;
let namespaceTrimmed, endpointTrimmed;
if (typeof options.namespace === 'string' && typeof options.endpoint === 'string') {
namespaceTrimmed = options.namespace.replace(/^\/|\/$/g, '');
endpointTrimmed = options.endpoint.replace(/^\//, '');
if (endpointTrimmed) {
path = namespaceTrimmed + '/' + endpointTrimmed;
} else {
path = namespaceTrimmed;
}
}
delete options.namespace;
delete options.endpoint;
return next({
...options,
path
});
};
/* harmony default export */ const namespace_endpoint = (namespaceAndEndpointMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/root-url.js
/**
* Internal dependencies
*/
/**
* @param {string} rootURL
* @return {import('../types').APIFetchMiddleware} Root URL middleware.
*/
const createRootURLMiddleware = rootURL => (options, next) => {
return namespace_endpoint(options, optionsWithPath => {
let url = optionsWithPath.url;
let path = optionsWithPath.path;
let apiRoot;
if (typeof path === 'string') {
apiRoot = rootURL;
if (-1 !== rootURL.indexOf('?')) {
path = path.replace('?', '&');
}
path = path.replace(/^\//, '');
// API root may already include query parameter prefix if site is
// configured to use plain permalinks.
if ('string' === typeof apiRoot && -1 !== apiRoot.indexOf('?')) {
path = path.replace('?', '&');
}
url = apiRoot + path;
}
return next({
...optionsWithPath,
url
});
});
};
/* harmony default export */ const root_url = (createRootURLMiddleware);
;// CONCATENATED MODULE: external ["wp","url"]
const external_wp_url_namespaceObject = window["wp"]["url"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/preloading.js
/**
* WordPress dependencies
*/
/**
* @param {Record<string, any>} preloadedData
* @return {import('../types').APIFetchMiddleware} Preloading middleware.
*/
function createPreloadingMiddleware(preloadedData) {
const cache = Object.fromEntries(Object.entries(preloadedData).map(([path, data]) => [(0,external_wp_url_namespaceObject.normalizePath)(path), data]));
return (options, next) => {
const {
parse = true
} = options;
/** @type {string | void} */
let rawPath = options.path;
if (!rawPath && options.url) {
const {
rest_route: pathFromQuery,
...queryArgs
} = (0,external_wp_url_namespaceObject.getQueryArgs)(options.url);
if (typeof pathFromQuery === 'string') {
rawPath = (0,external_wp_url_namespaceObject.addQueryArgs)(pathFromQuery, queryArgs);
}
}
if (typeof rawPath !== 'string') {
return next(options);
}
const method = options.method || 'GET';
const path = (0,external_wp_url_namespaceObject.normalizePath)(rawPath);
if ('GET' === method && cache[path]) {
const cacheData = cache[path];
// Unsetting the cache key ensures that the data is only used a single time.
delete cache[path];
return prepareResponse(cacheData, !!parse);
} else if ('OPTIONS' === method && cache[method] && cache[method][path]) {
const cacheData = cache[method][path];
// Unsetting the cache key ensures that the data is only used a single time.
delete cache[method][path];
return prepareResponse(cacheData, !!parse);
}
return next(options);
};
}
/**
* This is a helper function that sends a success response.
*
* @param {Record<string, any>} responseData
* @param {boolean} parse
* @return {Promise<any>} Promise with the response.
*/
function prepareResponse(responseData, parse) {
return Promise.resolve(parse ? responseData.body : new window.Response(JSON.stringify(responseData.body), {
status: 200,
statusText: 'OK',
headers: responseData.headers
}));
}
/* harmony default export */ const preloading = (createPreloadingMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/fetch-all-middleware.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Apply query arguments to both URL and Path, whichever is present.
*
* @param {import('../types').APIFetchOptions} props
* @param {Record<string, string | number>} queryArgs
* @return {import('../types').APIFetchOptions} The request with the modified query args
*/
const modifyQuery = ({
path,
url,
...options
}, queryArgs) => ({
...options,
url: url && (0,external_wp_url_namespaceObject.addQueryArgs)(url, queryArgs),
path: path && (0,external_wp_url_namespaceObject.addQueryArgs)(path, queryArgs)
});
/**
* Duplicates parsing functionality from apiFetch.
*
* @param {Response} response
* @return {Promise<any>} Parsed response json.
*/
const parseResponse = response => response.json ? response.json() : Promise.reject(response);
/**
* @param {string | null} linkHeader
* @return {{ next?: string }} The parsed link header.
*/
const parseLinkHeader = linkHeader => {
if (!linkHeader) {
return {};
}
const match = linkHeader.match(/<([^>]+)>; rel="next"/);
return match ? {
next: match[1]
} : {};
};
/**
* @param {Response} response
* @return {string | undefined} The next page URL.
*/
const getNextPageUrl = response => {
const {
next
} = parseLinkHeader(response.headers.get('link'));
return next;
};
/**
* @param {import('../types').APIFetchOptions} options
* @return {boolean} True if the request contains an unbounded query.
*/
const requestContainsUnboundedQuery = options => {
const pathIsUnbounded = !!options.path && options.path.indexOf('per_page=-1') !== -1;
const urlIsUnbounded = !!options.url && options.url.indexOf('per_page=-1') !== -1;
return pathIsUnbounded || urlIsUnbounded;
};
/**
* The REST API enforces an upper limit on the per_page option. To handle large
* collections, apiFetch consumers can pass `per_page=-1`; this middleware will
* then recursively assemble a full response array from all available pages.
*
* @type {import('../types').APIFetchMiddleware}
*/
const fetchAllMiddleware = async (options, next) => {
if (options.parse === false) {
// If a consumer has opted out of parsing, do not apply middleware.
return next(options);
}
if (!requestContainsUnboundedQuery(options)) {
// If neither url nor path is requesting all items, do not apply middleware.
return next(options);
}
// Retrieve requested page of results.
const response = await build_module({
...modifyQuery(options, {
per_page: 100
}),
// Ensure headers are returned for page 1.
parse: false
});
const results = await parseResponse(response);
if (!Array.isArray(results)) {
// We have no reliable way of merging non-array results.
return results;
}
let nextPage = getNextPageUrl(response);
if (!nextPage) {
// There are no further pages to request.
return results;
}
// Iteratively fetch all remaining pages until no "next" header is found.
let mergedResults = /** @type {any[]} */[].concat(results);
while (nextPage) {
const nextResponse = await build_module({
...options,
// Ensure the URL for the next page is used instead of any provided path.
path: undefined,
url: nextPage,
// Ensure we still get headers so we can identify the next page.
parse: false
});
const nextResults = await parseResponse(nextResponse);
mergedResults = mergedResults.concat(nextResults);
nextPage = getNextPageUrl(nextResponse);
}
return mergedResults;
};
/* harmony default export */ const fetch_all_middleware = (fetchAllMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/http-v1.js
/**
* Set of HTTP methods which are eligible to be overridden.
*
* @type {Set<string>}
*/
const OVERRIDE_METHODS = new Set(['PATCH', 'PUT', 'DELETE']);
/**
* Default request method.
*
* "A request has an associated method (a method). Unless stated otherwise it
* is `GET`."
*
* @see https://fetch.spec.whatwg.org/#requests
*
* @type {string}
*/
const DEFAULT_METHOD = 'GET';
/**
* API Fetch middleware which overrides the request method for HTTP v1
* compatibility leveraging the REST API X-HTTP-Method-Override header.
*
* @type {import('../types').APIFetchMiddleware}
*/
const httpV1Middleware = (options, next) => {
const {
method = DEFAULT_METHOD
} = options;
if (OVERRIDE_METHODS.has(method.toUpperCase())) {
options = {
...options,
headers: {
...options.headers,
'X-HTTP-Method-Override': method,
'Content-Type': 'application/json'
},
method: 'POST'
};
}
return next(options);
};
/* harmony default export */ const http_v1 = (httpV1Middleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/user-locale.js
/**
* WordPress dependencies
*/
/**
* @type {import('../types').APIFetchMiddleware}
*/
const userLocaleMiddleware = (options, next) => {
if (typeof options.url === 'string' && !(0,external_wp_url_namespaceObject.hasQueryArg)(options.url, '_locale')) {
options.url = (0,external_wp_url_namespaceObject.addQueryArgs)(options.url, {
_locale: 'user'
});
}
if (typeof options.path === 'string' && !(0,external_wp_url_namespaceObject.hasQueryArg)(options.path, '_locale')) {
options.path = (0,external_wp_url_namespaceObject.addQueryArgs)(options.path, {
_locale: 'user'
});
}
return next(options);
};
/* harmony default export */ const user_locale = (userLocaleMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/utils/response.js
/**
* WordPress dependencies
*/
/**
* Parses the apiFetch response.
*
* @param {Response} response
* @param {boolean} shouldParseResponse
*
* @return {Promise<any> | null | Response} Parsed response.
*/
const response_parseResponse = (response, shouldParseResponse = true) => {
if (shouldParseResponse) {
if (response.status === 204) {
return null;
}
return response.json ? response.json() : Promise.reject(response);
}
return response;
};
/**
* Calls the `json` function on the Response, throwing an error if the response
* doesn't have a json function or if parsing the json itself fails.
*
* @param {Response} response
* @return {Promise<any>} Parsed response.
*/
const parseJsonAndNormalizeError = response => {
const invalidJsonError = {
code: 'invalid_json',
message: (0,external_wp_i18n_namespaceObject.__)('The response is not a valid JSON response.')
};
if (!response || !response.json) {
throw invalidJsonError;
}
return response.json().catch(() => {
throw invalidJsonError;
});
};
/**
* Parses the apiFetch response properly and normalize response errors.
*
* @param {Response} response
* @param {boolean} shouldParseResponse
*
* @return {Promise<any>} Parsed response.
*/
const parseResponseAndNormalizeError = (response, shouldParseResponse = true) => {
return Promise.resolve(response_parseResponse(response, shouldParseResponse)).catch(res => parseAndThrowError(res, shouldParseResponse));
};
/**
* Parses a response, throwing an error if parsing the response fails.
*
* @param {Response} response
* @param {boolean} shouldParseResponse
* @return {Promise<any>} Parsed response.
*/
function parseAndThrowError(response, shouldParseResponse = true) {
if (!shouldParseResponse) {
throw response;
}
return parseJsonAndNormalizeError(response).then(error => {
const unknownError = {
code: 'unknown_error',
message: (0,external_wp_i18n_namespaceObject.__)('An unknown error occurred.')
};
throw error || unknownError;
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/media-upload.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @param {import('../types').APIFetchOptions} options
* @return {boolean} True if the request is for media upload.
*/
function isMediaUploadRequest(options) {
const isCreateMethod = !!options.method && options.method === 'POST';
const isMediaEndpoint = !!options.path && options.path.indexOf('/wp/v2/media') !== -1 || !!options.url && options.url.indexOf('/wp/v2/media') !== -1;
return isMediaEndpoint && isCreateMethod;
}
/**
* Middleware handling media upload failures and retries.
*
* @type {import('../types').APIFetchMiddleware}
*/
const mediaUploadMiddleware = (options, next) => {
if (!isMediaUploadRequest(options)) {
return next(options);
}
let retries = 0;
const maxRetries = 5;
/**
* @param {string} attachmentId
* @return {Promise<any>} Processed post response.
*/
const postProcess = attachmentId => {
retries++;
return next({
path: `/wp/v2/media/${attachmentId}/post-process`,
method: 'POST',
data: {
action: 'create-image-subsizes'
},
parse: false
}).catch(() => {
if (retries < maxRetries) {
return postProcess(attachmentId);
}
next({
path: `/wp/v2/media/${attachmentId}?force=true`,
method: 'DELETE'
});
return Promise.reject();
});
};
return next({
...options,
parse: false
}).catch(response => {
const attachmentId = response.headers.get('x-wp-upload-attachment-id');
if (response.status >= 500 && response.status < 600 && attachmentId) {
return postProcess(attachmentId).catch(() => {
if (options.parse !== false) {
return Promise.reject({
code: 'post_process',
message: (0,external_wp_i18n_namespaceObject.__)('Media upload failed. If this is a photo or a large image, please scale it down and try again.')
});
}
return Promise.reject(response);
});
}
return parseAndThrowError(response, options.parse);
}).then(response => parseResponseAndNormalizeError(response, options.parse));
};
/* harmony default export */ const media_upload = (mediaUploadMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/theme-preview.js
/**
* WordPress dependencies
*/
/**
* This appends a `wp_theme_preview` parameter to the REST API request URL if
* the admin URL contains a `theme` GET parameter.
*
* If the REST API request URL has contained the `wp_theme_preview` parameter as `''`,
* then bypass this middleware.
*
* @param {Record<string, any>} themePath
* @return {import('../types').APIFetchMiddleware} Preloading middleware.
*/
const createThemePreviewMiddleware = themePath => (options, next) => {
if (typeof options.url === 'string') {
const wpThemePreview = (0,external_wp_url_namespaceObject.getQueryArg)(options.url, 'wp_theme_preview');
if (wpThemePreview === undefined) {
options.url = (0,external_wp_url_namespaceObject.addQueryArgs)(options.url, {
wp_theme_preview: themePath
});
} else if (wpThemePreview === '') {
options.url = (0,external_wp_url_namespaceObject.removeQueryArgs)(options.url, 'wp_theme_preview');
}
}
if (typeof options.path === 'string') {
const wpThemePreview = (0,external_wp_url_namespaceObject.getQueryArg)(options.path, 'wp_theme_preview');
if (wpThemePreview === undefined) {
options.path = (0,external_wp_url_namespaceObject.addQueryArgs)(options.path, {
wp_theme_preview: themePath
});
} else if (wpThemePreview === '') {
options.path = (0,external_wp_url_namespaceObject.removeQueryArgs)(options.path, 'wp_theme_preview');
}
}
return next(options);
};
/* harmony default export */ const theme_preview = (createThemePreviewMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Default set of header values which should be sent with every request unless
* explicitly provided through apiFetch options.
*
* @type {Record<string, string>}
*/
const DEFAULT_HEADERS = {
// The backend uses the Accept header as a condition for considering an
// incoming request as a REST request.
//
// See: https://core.trac.wordpress.org/ticket/44534
Accept: 'application/json, */*;q=0.1'
};
/**
* Default set of fetch option values which should be sent with every request
* unless explicitly provided through apiFetch options.
*
* @type {Object}
*/
const DEFAULT_OPTIONS = {
credentials: 'include'
};
/** @typedef {import('./types').APIFetchMiddleware} APIFetchMiddleware */
/** @typedef {import('./types').APIFetchOptions} APIFetchOptions */
/**
* @type {import('./types').APIFetchMiddleware[]}
*/
const middlewares = [user_locale, namespace_endpoint, http_v1, fetch_all_middleware];
/**
* Register a middleware
*
* @param {import('./types').APIFetchMiddleware} middleware
*/
function registerMiddleware(middleware) {
middlewares.unshift(middleware);
}
/**
* Checks the status of a response, throwing the Response as an error if
* it is outside the 200 range.
*
* @param {Response} response
* @return {Response} The response if the status is in the 200 range.
*/
const checkStatus = response => {
if (response.status >= 200 && response.status < 300) {
return response;
}
throw response;
};
/** @typedef {(options: import('./types').APIFetchOptions) => Promise<any>} FetchHandler*/
/**
* @type {FetchHandler}
*/
const defaultFetchHandler = nextOptions => {
const {
url,
path,
data,
parse = true,
...remainingOptions
} = nextOptions;
let {
body,
headers
} = nextOptions;
// Merge explicitly-provided headers with default values.
headers = {
...DEFAULT_HEADERS,
...headers
};
// The `data` property is a shorthand for sending a JSON body.
if (data) {
body = JSON.stringify(data);
headers['Content-Type'] = 'application/json';
}
const responsePromise = window.fetch(
// Fall back to explicitly passing `window.location` which is the behavior if `undefined` is passed.
url || path || window.location.href, {
...DEFAULT_OPTIONS,
...remainingOptions,
body,
headers
});
return responsePromise.then(value => Promise.resolve(value).then(checkStatus).catch(response => parseAndThrowError(response, parse)).then(response => parseResponseAndNormalizeError(response, parse)), err => {
// Re-throw AbortError for the users to handle it themselves.
if (err && err.name === 'AbortError') {
throw err;
}
// Otherwise, there is most likely no network connection.
// Unfortunately the message might depend on the browser.
throw {
code: 'fetch_error',
message: (0,external_wp_i18n_namespaceObject.__)('You are probably offline.')
};
});
};
/** @type {FetchHandler} */
let fetchHandler = defaultFetchHandler;
/**
* Defines a custom fetch handler for making the requests that will override
* the default one using window.fetch
*
* @param {FetchHandler} newFetchHandler The new fetch handler
*/
function setFetchHandler(newFetchHandler) {
fetchHandler = newFetchHandler;
}
/**
* @template T
* @param {import('./types').APIFetchOptions} options
* @return {Promise<T>} A promise representing the request processed via the registered middlewares.
*/
function apiFetch(options) {
// creates a nested function chain that calls all middlewares and finally the `fetchHandler`,
// converting `middlewares = [ m1, m2, m3 ]` into:
// ```
// opts1 => m1( opts1, opts2 => m2( opts2, opts3 => m3( opts3, fetchHandler ) ) );
// ```
const enhancedHandler = middlewares.reduceRight(( /** @type {FetchHandler} */next, middleware) => {
return workingOptions => middleware(workingOptions, next);
}, fetchHandler);
return enhancedHandler(options).catch(error => {
if (error.code !== 'rest_cookie_invalid_nonce') {
return Promise.reject(error);
}
// If the nonce is invalid, refresh it and try again.
return window
// @ts-ignore
.fetch(apiFetch.nonceEndpoint).then(checkStatus).then(data => data.text()).then(text => {
// @ts-ignore
apiFetch.nonceMiddleware.nonce = text;
return apiFetch(options);
});
});
}
apiFetch.use = registerMiddleware;
apiFetch.setFetchHandler = setFetchHandler;
apiFetch.createNonceMiddleware = nonce;
apiFetch.createPreloadingMiddleware = preloading;
apiFetch.createRootURLMiddleware = root_url;
apiFetch.fetchAllMiddleware = fetch_all_middleware;
apiFetch.mediaUploadMiddleware = media_upload;
apiFetch.createThemePreviewMiddleware = theme_preview;
/* harmony default export */ const build_module = (apiFetch);
(window.wp = window.wp || {}).apiFetch = __webpack_exports__["default"];
/******/ })()
;/*! This file is auto-generated */
(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{default:()=>T});const r=window.wp.i18n;const n=function(e){const t=(e,r)=>{const{headers:n={}}=e;for(const o in n)if("x-wp-nonce"===o.toLowerCase()&&n[o]===t.nonce)return r(e);return r({...e,headers:{...n,"X-WP-Nonce":t.nonce}})};return t.nonce=e,t},o=(e,t)=>{let r,n,o=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(r=e.namespace.replace(/^\/|\/$/g,""),n=e.endpoint.replace(/^\//,""),o=n?r+"/"+n:r),delete e.namespace,delete e.endpoint,t({...e,path:o})},a=e=>(t,r)=>o(t,(t=>{let n,o=t.url,a=t.path;return"string"==typeof a&&(n=e,-1!==e.indexOf("?")&&(a=a.replace("?","&")),a=a.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(a=a.replace("?","&")),o=n+a),r({...t,url:o})})),s=window.wp.url;function i(e,t){return Promise.resolve(t?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}const c=function(e){const t=Object.fromEntries(Object.entries(e).map((([e,t])=>[(0,s.normalizePath)(e),t])));return(e,r)=>{const{parse:n=!0}=e;let o=e.path;if(!o&&e.url){const{rest_route:t,...r}=(0,s.getQueryArgs)(e.url);"string"==typeof t&&(o=(0,s.addQueryArgs)(t,r))}if("string"!=typeof o)return r(e);const a=e.method||"GET",c=(0,s.normalizePath)(o);if("GET"===a&&t[c]){const e=t[c];return delete t[c],i(e,!!n)}if("OPTIONS"===a&&t[a]&&t[a][c]){const e=t[a][c];return delete t[a][c],i(e,!!n)}return r(e)}},p=({path:e,url:t,...r},n)=>({...r,url:t&&(0,s.addQueryArgs)(t,n),path:e&&(0,s.addQueryArgs)(e,n)}),d=e=>e.json?e.json():Promise.reject(e),u=e=>{const{next:t}=(e=>{if(!e)return{};const t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}})(e.headers.get("link"));return t},h=async(e,t)=>{if(!1===e.parse)return t(e);if(!(e=>{const t=!!e.path&&-1!==e.path.indexOf("per_page=-1"),r=!!e.url&&-1!==e.url.indexOf("per_page=-1");return t||r})(e))return t(e);const r=await T({...p(e,{per_page:100}),parse:!1}),n=await d(r);if(!Array.isArray(n))return n;let o=u(r);if(!o)return n;let a=[].concat(n);for(;o;){const t=await T({...e,path:void 0,url:o,parse:!1}),r=await d(t);a=a.concat(r),o=u(t)}return a},l=new Set(["PATCH","PUT","DELETE"]),w="GET",f=(e,t=!0)=>Promise.resolve(((e,t=!0)=>t?204===e.status?null:e.json?e.json():Promise.reject(e):e)(e,t)).catch((e=>m(e,t)));function m(e,t=!0){if(!t)throw e;return(e=>{const t={code:"invalid_json",message:(0,r.__)("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch((()=>{throw t}))})(e).then((e=>{const t={code:"unknown_error",message:(0,r.__)("An unknown error occurred.")};throw e||t}))}const g=(e,t)=>{if(!function(e){const t=!!e.method&&"POST"===e.method;return(!!e.path&&-1!==e.path.indexOf("/wp/v2/media")||!!e.url&&-1!==e.url.indexOf("/wp/v2/media"))&&t}(e))return t(e);let n=0;const o=e=>(n++,t({path:`/wp/v2/media/${e}/post-process`,method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((()=>n<5?o(e):(t({path:`/wp/v2/media/${e}?force=true`,method:"DELETE"}),Promise.reject()))));return t({...e,parse:!1}).catch((t=>{const n=t.headers.get("x-wp-upload-attachment-id");return t.status>=500&&t.status<600&&n?o(n).catch((()=>!1!==e.parse?Promise.reject({code:"post_process",message:(0,r.__)("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(t))):m(t,e.parse)})).then((t=>f(t,e.parse)))},y=e=>(t,r)=>{if("string"==typeof t.url){const r=(0,s.getQueryArg)(t.url,"wp_theme_preview");void 0===r?t.url=(0,s.addQueryArgs)(t.url,{wp_theme_preview:e}):""===r&&(t.url=(0,s.removeQueryArgs)(t.url,"wp_theme_preview"))}if("string"==typeof t.path){const r=(0,s.getQueryArg)(t.path,"wp_theme_preview");void 0===r?t.path=(0,s.addQueryArgs)(t.path,{wp_theme_preview:e}):""===r&&(t.path=(0,s.removeQueryArgs)(t.path,"wp_theme_preview"))}return r(t)},_={Accept:"application/json, */*;q=0.1"},v={credentials:"include"},P=[(e,t)=>("string"!=typeof e.url||(0,s.hasQueryArg)(e.url,"_locale")||(e.url=(0,s.addQueryArgs)(e.url,{_locale:"user"})),"string"!=typeof e.path||(0,s.hasQueryArg)(e.path,"_locale")||(e.path=(0,s.addQueryArgs)(e.path,{_locale:"user"})),t(e)),o,(e,t)=>{const{method:r=w}=e;return l.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},h];const A=e=>{if(e.status>=200&&e.status<300)return e;throw e};let O=e=>{const{url:t,path:n,data:o,parse:a=!0,...s}=e;let{body:i,headers:c}=e;c={..._,...c},o&&(i=JSON.stringify(o),c["Content-Type"]="application/json");return window.fetch(t||n||window.location.href,{...v,...s,body:i,headers:c}).then((e=>Promise.resolve(e).then(A).catch((e=>m(e,a))).then((e=>f(e,a)))),(e=>{if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:(0,r.__)("You are probably offline.")}}))};function j(e){return P.reduceRight(((e,t)=>r=>t(r,e)),O)(e).catch((t=>"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(j.nonceEndpoint).then(A).then((e=>e.text())).then((t=>(j.nonceMiddleware.nonce=t,j(e))))))}j.use=function(e){P.unshift(e)},j.setFetchHandler=function(e){O=e},j.createNonceMiddleware=n,j.createPreloadingMiddleware=c,j.createRootURLMiddleware=a,j.fetchAllMiddleware=h,j.mediaUploadMiddleware=g,j.createThemePreviewMiddleware=y;const T=j;(window.wp=window.wp||{}).apiFetch=t.default})();/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (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 */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ autop: () => (/* binding */ autop),
/* harmony export */ removep: () => (/* binding */ removep)
/* harmony export */ });
/**
* The regular expression for an HTML element.
*
* @type {RegExp}
*/
const htmlSplitRegex = (() => {
/* eslint-disable no-multi-spaces */
const comments = '!' +
// Start of comment, after the <.
'(?:' +
// Unroll the loop: Consume everything until --> is found.
'-(?!->)' +
// Dash not followed by end of comment.
'[^\\-]*' +
// Consume non-dashes.
')*' +
// Loop possessively.
'(?:-->)?'; // End of comment. If not found, match all input.
const cdata = '!\\[CDATA\\[' +
// Start of comment, after the <.
'[^\\]]*' +
// Consume non-].
'(?:' +
// Unroll the loop: Consume everything until ]]> is found.
'](?!]>)' +
// One ] not followed by end of comment.
'[^\\]]*' +
// Consume non-].
')*?' +
// Loop possessively.
'(?:]]>)?'; // End of comment. If not found, match all input.
const escaped = '(?=' +
// Is the element escaped?
'!--' + '|' + '!\\[CDATA\\[' + ')' + '((?=!-)' +
// If yes, which type?
comments + '|' + cdata + ')';
const regex = '(' +
// Capture the entire match.
'<' +
// Find start of element.
'(' +
// Conditional expression follows.
escaped +
// Find end of escaped element.
'|' +
// ... else ...
'[^>]*>?' +
// Find end of normal element.
')' + ')';
return new RegExp(regex);
/* eslint-enable no-multi-spaces */
})();
/**
* Separate HTML elements and comments from the text.
*
* @param {string} input The text which has to be formatted.
*
* @return {string[]} The formatted text.
*/
function htmlSplit(input) {
const parts = [];
let workingInput = input;
let match;
while (match = workingInput.match(htmlSplitRegex)) {
// The `match` result, when invoked on a RegExp with the `g` flag (`/foo/g`) will not include `index`.
// If the `g` flag is omitted, `index` is included.
// `htmlSplitRegex` does not have the `g` flag so we can assert it will have an index number.
// Assert `match.index` is a number.
const index = /** @type {number} */match.index;
parts.push(workingInput.slice(0, index));
parts.push(match[0]);
workingInput = workingInput.slice(index + match[0].length);
}
if (workingInput.length) {
parts.push(workingInput);
}
return parts;
}
/**
* Replace characters or phrases within HTML elements only.
*
* @param {string} haystack The text which has to be formatted.
* @param {Record<string,string>} replacePairs In the form {from: 'to', …}.
*
* @return {string} The formatted text.
*/
function replaceInHtmlTags(haystack, replacePairs) {
// Find all elements.
const textArr = htmlSplit(haystack);
let changed = false;
// Extract all needles.
const needles = Object.keys(replacePairs);
// Loop through delimiters (elements) only.
for (let i = 1; i < textArr.length; i += 2) {
for (let j = 0; j < needles.length; j++) {
const needle = needles[j];
if (-1 !== textArr[i].indexOf(needle)) {
textArr[i] = textArr[i].replace(new RegExp(needle, 'g'), replacePairs[needle]);
changed = true;
// After one strtr() break out of the foreach loop and look at next element.
break;
}
}
}
if (changed) {
haystack = textArr.join('');
}
return haystack;
}
/**
* Replaces double line-breaks with paragraph elements.
*
* A group of regex replaces used to identify text formatted with newlines and
* replace double line-breaks with HTML paragraph tags. The remaining line-
* breaks after conversion become `<br />` tags, unless br is set to 'false'.
*
* @param {string} text The text which has to be formatted.
* @param {boolean} br Optional. If set, will convert all remaining line-
* breaks after paragraphing. Default true.
*
* @example
*```js
* import { autop } from '@wordpress/autop';
* autop( 'my text' ); // "<p>my text</p>"
* ```
*
* @return {string} Text which has been converted into paragraph tags.
*/
function autop(text, br = true) {
const preTags = [];
if (text.trim() === '') {
return '';
}
// Just to make things a little easier, pad the end.
text = text + '\n';
/*
* Pre tags shouldn't be touched by autop.
* Replace pre tags with placeholders and bring them back after autop.
*/
if (text.indexOf('<pre') !== -1) {
const textParts = text.split('</pre>');
const lastText = textParts.pop();
text = '';
for (let i = 0; i < textParts.length; i++) {
const textPart = textParts[i];
const start = textPart.indexOf('<pre');
// Malformed html?
if (start === -1) {
text += textPart;
continue;
}
const name = '<pre wp-pre-tag-' + i + '></pre>';
preTags.push([name, textPart.substr(start) + '</pre>']);
text += textPart.substr(0, start) + name;
}
text += lastText;
}
// Change multiple <br>s into two line breaks, which will turn into paragraphs.
text = text.replace(/<br\s*\/?>\s*<br\s*\/?>/g, '\n\n');
const allBlocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';
// Add a double line break above block-level opening tags.
text = text.replace(new RegExp('(<' + allBlocks + '[\\s/>])', 'g'), '\n\n$1');
// Add a double line break below block-level closing tags.
text = text.replace(new RegExp('(</' + allBlocks + '>)', 'g'), '$1\n\n');
// Standardize newline characters to "\n".
text = text.replace(/\r\n|\r/g, '\n');
// Find newlines in all elements and add placeholders.
text = replaceInHtmlTags(text, {
'\n': ' <!-- wpnl --> '
});
// Collapse line breaks before and after <option> elements so they don't get autop'd.
if (text.indexOf('<option') !== -1) {
text = text.replace(/\s*<option/g, '<option');
text = text.replace(/<\/option>\s*/g, '</option>');
}
/*
* Collapse line breaks inside <object> elements, before <param> and <embed> elements
* so they don't get autop'd.
*/
if (text.indexOf('</object>') !== -1) {
text = text.replace(/(<object[^>]*>)\s*/g, '$1');
text = text.replace(/\s*<\/object>/g, '</object>');
text = text.replace(/\s*(<\/?(?:param|embed)[^>]*>)\s*/g, '$1');
}
/*
* Collapse line breaks inside <audio> and <video> elements,
* before and after <source> and <track> elements.
*/
if (text.indexOf('<source') !== -1 || text.indexOf('<track') !== -1) {
text = text.replace(/([<\[](?:audio|video)[^>\]]*[>\]])\s*/g, '$1');
text = text.replace(/\s*([<\[]\/(?:audio|video)[>\]])/g, '$1');
text = text.replace(/\s*(<(?:source|track)[^>]*>)\s*/g, '$1');
}
// Collapse line breaks before and after <figcaption> elements.
if (text.indexOf('<figcaption') !== -1) {
text = text.replace(/\s*(<figcaption[^>]*>)/, '$1');
text = text.replace(/<\/figcaption>\s*/, '</figcaption>');
}
// Remove more than two contiguous line breaks.
text = text.replace(/\n\n+/g, '\n\n');
// Split up the contents into an array of strings, separated by double line breaks.
const texts = text.split(/\n\s*\n/).filter(Boolean);
// Reset text prior to rebuilding.
text = '';
// Rebuild the content as a string, wrapping every bit with a <p>.
texts.forEach(textPiece => {
text += '<p>' + textPiece.replace(/^\n*|\n*$/g, '') + '</p>\n';
});
// Under certain strange conditions it could create a P of entirely whitespace.
text = text.replace(/<p>\s*<\/p>/g, '');
// Add a closing <p> inside <div>, <address>, or <form> tag if missing.
text = text.replace(/<p>([^<]+)<\/(div|address|form)>/g, '<p>$1</p></$2>');
// If an opening or closing block element tag is wrapped in a <p>, unwrap it.
text = text.replace(new RegExp('<p>\\s*(</?' + allBlocks + '[^>]*>)\\s*</p>', 'g'), '$1');
// In some cases <li> may get wrapped in <p>, fix them.
text = text.replace(/<p>(<li.+?)<\/p>/g, '$1');
// If a <blockquote> is wrapped with a <p>, move it inside the <blockquote>.
text = text.replace(/<p><blockquote([^>]*)>/gi, '<blockquote$1><p>');
text = text.replace(/<\/blockquote><\/p>/g, '</p></blockquote>');
// If an opening or closing block element tag is preceded by an opening <p> tag, remove it.
text = text.replace(new RegExp('<p>\\s*(</?' + allBlocks + '[^>]*>)', 'g'), '$1');
// If an opening or closing block element tag is followed by a closing <p> tag, remove it.
text = text.replace(new RegExp('(</?' + allBlocks + '[^>]*>)\\s*</p>', 'g'), '$1');
// Optionally insert line breaks.
if (br) {
// Replace newlines that shouldn't be touched with a placeholder.
text = text.replace(/<(script|style).*?<\/\\1>/g, match => match[0].replace(/\n/g, '<WPPreserveNewline />'));
// Normalize <br>
text = text.replace(/<br>|<br\/>/g, '<br />');
// Replace any new line characters that aren't preceded by a <br /> with a <br />.
text = text.replace(/(<br \/>)?\s*\n/g, (a, b) => b ? a : '<br />\n');
// Replace newline placeholders with newlines.
text = text.replace(/<WPPreserveNewline \/>/g, '\n');
}
// If a <br /> tag is after an opening or closing block tag, remove it.
text = text.replace(new RegExp('(</?' + allBlocks + '[^>]*>)\\s*<br />', 'g'), '$1');
// If a <br /> tag is before a subset of opening or closing block tags, remove it.
text = text.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g, '$1');
text = text.replace(/\n<\/p>$/g, '</p>');
// Replace placeholder <pre> tags with their original content.
preTags.forEach(preTag => {
const [name, original] = preTag;
text = text.replace(name, original);
});
// Restore newlines in all elements.
if (-1 !== text.indexOf('<!-- wpnl -->')) {
text = text.replace(/\s?<!-- wpnl -->\s?/g, '\n');
}
return text;
}
/**
* Replaces `<p>` tags with two line breaks. "Opposite" of autop().
*
* Replaces `<p>` tags with two line breaks except where the `<p>` has attributes.
* Unifies whitespace. Indents `<li>`, `<dt>` and `<dd>` for better readability.
*
* @param {string} html The content from the editor.
*
* @example
* ```js
* import { removep } from '@wordpress/autop';
* removep( '<p>my text</p>' ); // "my text"
* ```
*
* @return {string} The content with stripped paragraph tags.
*/
function removep(html) {
const blocklist = 'blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure';
const blocklist1 = blocklist + '|div|p';
const blocklist2 = blocklist + '|pre';
/** @type {string[]} */
const preserve = [];
let preserveLinebreaks = false;
let preserveBr = false;
if (!html) {
return '';
}
// Protect script and style tags.
if (html.indexOf('<script') !== -1 || html.indexOf('<style') !== -1) {
html = html.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g, match => {
preserve.push(match);
return '<wp-preserve>';
});
}
// Protect pre tags.
if (html.indexOf('<pre') !== -1) {
preserveLinebreaks = true;
html = html.replace(/<pre[^>]*>[\s\S]+?<\/pre>/g, a => {
a = a.replace(/<br ?\/?>(\r\n|\n)?/g, '<wp-line-break>');
a = a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g, '<wp-line-break>');
return a.replace(/\r?\n/g, '<wp-line-break>');
});
}
// Remove line breaks but keep <br> tags inside image captions.
if (html.indexOf('[caption') !== -1) {
preserveBr = true;
html = html.replace(/\[caption[\s\S]+?\[\/caption\]/g, a => {
return a.replace(/<br([^>]*)>/g, '<wp-temp-br$1>').replace(/[\r\n\t]+/, '');
});
}
// Normalize white space characters before and after block tags.
html = html.replace(new RegExp('\\s*</(' + blocklist1 + ')>\\s*', 'g'), '</$1>\n');
html = html.replace(new RegExp('\\s*<((?:' + blocklist1 + ')(?: [^>]*)?)>', 'g'), '\n<$1>');
// Mark </p> if it has any attributes.
html = html.replace(/(<p [^>]+>[\s\S]*?)<\/p>/g, '$1</p#>');
// Preserve the first <p> inside a <div>.
html = html.replace(/<div( [^>]*)?>\s*<p>/gi, '<div$1>\n\n');
// Remove paragraph tags.
html = html.replace(/\s*<p>/gi, '');
html = html.replace(/\s*<\/p>\s*/gi, '\n\n');
// Normalize white space chars and remove multiple line breaks.
html = html.replace(/\n[\s\u00a0]+\n/g, '\n\n');
// Replace <br> tags with line breaks.
html = html.replace(/(\s*)<br ?\/?>\s*/gi, (_, space) => {
if (space && space.indexOf('\n') !== -1) {
return '\n\n';
}
return '\n';
});
// Fix line breaks around <div>.
html = html.replace(/\s*<div/g, '\n<div');
html = html.replace(/<\/div>\s*/g, '</div>\n');
// Fix line breaks around caption shortcodes.
html = html.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi, '\n\n[caption$1[/caption]\n\n');
html = html.replace(/caption\]\n\n+\[caption/g, 'caption]\n\n[caption');
// Pad block elements tags with a line break.
html = html.replace(new RegExp('\\s*<((?:' + blocklist2 + ')(?: [^>]*)?)\\s*>', 'g'), '\n<$1>');
html = html.replace(new RegExp('\\s*</(' + blocklist2 + ')>\\s*', 'g'), '</$1>\n');
// Indent <li>, <dt> and <dd> tags.
html = html.replace(/<((li|dt|dd)[^>]*)>/g, ' \t<$1>');
// Fix line breaks around <select> and <option>.
if (html.indexOf('<option') !== -1) {
html = html.replace(/\s*<option/g, '\n<option');
html = html.replace(/\s*<\/select>/g, '\n</select>');
}
// Pad <hr> with two line breaks.
if (html.indexOf('<hr') !== -1) {
html = html.replace(/\s*<hr( [^>]*)?>\s*/g, '\n\n<hr$1>\n\n');
}
// Remove line breaks in <object> tags.
if (html.indexOf('<object') !== -1) {
html = html.replace(/<object[\s\S]+?<\/object>/g, a => {
return a.replace(/[\r\n]+/g, '');
});
}
// Unmark special paragraph closing tags.
html = html.replace(/<\/p#>/g, '</p>\n');
// Pad remaining <p> tags whit a line break.
html = html.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g, '\n$1');
// Trim.
html = html.replace(/^\s+/, '');
html = html.replace(/[\s\u00a0]+$/, '');
if (preserveLinebreaks) {
html = html.replace(/<wp-line-break>/g, '\n');
}
if (preserveBr) {
html = html.replace(/<wp-temp-br([^>]*)>/g, '<br$1>');
}
// Restore preserved tags.
if (preserve.length) {
html = html.replace(/<wp-preserve>/g, () => {
return /** @type {string} */preserve.shift();
});
}
return html;
}
(window.wp = window.wp || {}).autop = __webpack_exports__;
/******/ })()
;/*! This file is auto-generated */
(()=>{"use strict";var e={d:(p,n)=>{for(var r in n)e.o(n,r)&&!e.o(p,r)&&Object.defineProperty(p,r,{enumerable:!0,get:n[r]})},o:(e,p)=>Object.prototype.hasOwnProperty.call(e,p),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},p={};e.r(p),e.d(p,{autop:()=>t,removep:()=>c});const n=new RegExp("(<((?=!--|!\\[CDATA\\[)((?=!-)!(?:-(?!->)[^\\-]*)*(?:--\x3e)?|!\\[CDATA\\[[^\\]]*(?:](?!]>)[^\\]]*)*?(?:]]>)?)|[^>]*>?))");function r(e,p){const r=function(e){const p=[];let r,t=e;for(;r=t.match(n);){const e=r.index;p.push(t.slice(0,e)),p.push(r[0]),t=t.slice(e+r[0].length)}return t.length&&p.push(t),p}(e);let t=!1;const c=Object.keys(p);for(let e=1;e<r.length;e+=2)for(let n=0;n<c.length;n++){const l=c[n];if(-1!==r[e].indexOf(l)){r[e]=r[e].replace(new RegExp(l,"g"),p[l]),t=!0;break}}return t&&(e=r.join("")),e}function t(e,p=!0){const n=[];if(""===e.trim())return"";if(-1!==(e+="\n").indexOf("<pre")){const p=e.split("</pre>"),r=p.pop();e="";for(let r=0;r<p.length;r++){const t=p[r],c=t.indexOf("<pre");if(-1===c){e+=t;continue}const l="<pre wp-pre-tag-"+r+"></pre>";n.push([l,t.substr(c)+"</pre>"]),e+=t.substr(0,c)+l}e+=r}const t="(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)";-1!==(e=r(e=(e=(e=(e=e.replace(/<br\s*\/?>\s*<br\s*\/?>/g,"\n\n")).replace(new RegExp("(<"+t+"[\\s/>])","g"),"\n\n$1")).replace(new RegExp("(</"+t+">)","g"),"$1\n\n")).replace(/\r\n|\r/g,"\n"),{"\n":" \x3c!-- wpnl --\x3e "})).indexOf("<option")&&(e=(e=e.replace(/\s*<option/g,"<option")).replace(/<\/option>\s*/g,"</option>")),-1!==e.indexOf("</object>")&&(e=(e=(e=e.replace(/(<object[^>]*>)\s*/g,"$1")).replace(/\s*<\/object>/g,"</object>")).replace(/\s*(<\/?(?:param|embed)[^>]*>)\s*/g,"$1")),-1===e.indexOf("<source")&&-1===e.indexOf("<track")||(e=(e=(e=e.replace(/([<\[](?:audio|video)[^>\]]*[>\]])\s*/g,"$1")).replace(/\s*([<\[]\/(?:audio|video)[>\]])/g,"$1")).replace(/\s*(<(?:source|track)[^>]*>)\s*/g,"$1")),-1!==e.indexOf("<figcaption")&&(e=(e=e.replace(/\s*(<figcaption[^>]*>)/,"$1")).replace(/<\/figcaption>\s*/,"</figcaption>"));const c=(e=e.replace(/\n\n+/g,"\n\n")).split(/\n\s*\n/).filter(Boolean);return e="",c.forEach((p=>{e+="<p>"+p.replace(/^\n*|\n*$/g,"")+"</p>\n"})),e=(e=(e=(e=(e=(e=(e=(e=e.replace(/<p>\s*<\/p>/g,"")).replace(/<p>([^<]+)<\/(div|address|form)>/g,"<p>$1</p></$2>")).replace(new RegExp("<p>\\s*(</?"+t+"[^>]*>)\\s*</p>","g"),"$1")).replace(/<p>(<li.+?)<\/p>/g,"$1")).replace(/<p><blockquote([^>]*)>/gi,"<blockquote$1><p>")).replace(/<\/blockquote><\/p>/g,"</p></blockquote>")).replace(new RegExp("<p>\\s*(</?"+t+"[^>]*>)","g"),"$1")).replace(new RegExp("(</?"+t+"[^>]*>)\\s*</p>","g"),"$1"),p&&(e=(e=(e=(e=e.replace(/<(script|style).*?<\/\\1>/g,(e=>e[0].replace(/\n/g,"<WPPreserveNewline />")))).replace(/<br>|<br\/>/g,"<br />")).replace(/(<br \/>)?\s*\n/g,((e,p)=>p?e:"<br />\n"))).replace(/<WPPreserveNewline \/>/g,"\n")),e=(e=(e=e.replace(new RegExp("(</?"+t+"[^>]*>)\\s*<br />","g"),"$1")).replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g,"$1")).replace(/\n<\/p>$/g,"</p>"),n.forEach((p=>{const[n,r]=p;e=e.replace(n,r)})),-1!==e.indexOf("\x3c!-- wpnl --\x3e")&&(e=e.replace(/\s?<!-- wpnl -->\s?/g,"\n")),e}function c(e){const p="blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure",n=p+"|div|p",r=p+"|pre",t=[];let c=!1,l=!1;return e?(-1===e.indexOf("<script")&&-1===e.indexOf("<style")||(e=e.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g,(e=>(t.push(e),"<wp-preserve>")))),-1!==e.indexOf("<pre")&&(c=!0,e=e.replace(/<pre[^>]*>[\s\S]+?<\/pre>/g,(e=>(e=(e=e.replace(/<br ?\/?>(\r\n|\n)?/g,"<wp-line-break>")).replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,"<wp-line-break>")).replace(/\r?\n/g,"<wp-line-break>")))),-1!==e.indexOf("[caption")&&(l=!0,e=e.replace(/\[caption[\s\S]+?\[\/caption\]/g,(e=>e.replace(/<br([^>]*)>/g,"<wp-temp-br$1>").replace(/[\r\n\t]+/,"")))),-1!==(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(new RegExp("\\s*</("+n+")>\\s*","g"),"</$1>\n")).replace(new RegExp("\\s*<((?:"+n+")(?: [^>]*)?)>","g"),"\n<$1>")).replace(/(<p [^>]+>[\s\S]*?)<\/p>/g,"$1</p#>")).replace(/<div( [^>]*)?>\s*<p>/gi,"<div$1>\n\n")).replace(/\s*<p>/gi,"")).replace(/\s*<\/p>\s*/gi,"\n\n")).replace(/\n[\s\u00a0]+\n/g,"\n\n")).replace(/(\s*)<br ?\/?>\s*/gi,((e,p)=>p&&-1!==p.indexOf("\n")?"\n\n":"\n"))).replace(/\s*<div/g,"\n<div")).replace(/<\/div>\s*/g,"</div>\n")).replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,"\n\n[caption$1[/caption]\n\n")).replace(/caption\]\n\n+\[caption/g,"caption]\n\n[caption")).replace(new RegExp("\\s*<((?:"+r+")(?: [^>]*)?)\\s*>","g"),"\n<$1>")).replace(new RegExp("\\s*</("+r+")>\\s*","g"),"</$1>\n")).replace(/<((li|dt|dd)[^>]*)>/g," \t<$1>")).indexOf("<option")&&(e=(e=e.replace(/\s*<option/g,"\n<option")).replace(/\s*<\/select>/g,"\n</select>")),-1!==e.indexOf("<hr")&&(e=e.replace(/\s*<hr( [^>]*)?>\s*/g,"\n\n<hr$1>\n\n")),-1!==e.indexOf("<object")&&(e=e.replace(/<object[\s\S]+?<\/object>/g,(e=>e.replace(/[\r\n]+/g,"")))),e=(e=(e=(e=e.replace(/<\/p#>/g,"</p>\n")).replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g,"\n$1")).replace(/^\s+/,"")).replace(/[\s\u00a0]+$/,""),c&&(e=e.replace(/<wp-line-break>/g,"\n")),l&&(e=e.replace(/<wp-temp-br([^>]*)>/g,"<br$1>")),t.length&&(e=e.replace(/<wp-preserve>/g,(()=>t.shift()))),e):""}(window.wp=window.wp||{}).autop=p})();/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (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 */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ createBlobURL: () => (/* binding */ createBlobURL),
/* harmony export */ downloadBlob: () => (/* binding */ downloadBlob),
/* harmony export */ getBlobByURL: () => (/* binding */ getBlobByURL),
/* harmony export */ getBlobTypeByURL: () => (/* binding */ getBlobTypeByURL),
/* harmony export */ isBlobURL: () => (/* binding */ isBlobURL),
/* harmony export */ revokeBlobURL: () => (/* binding */ revokeBlobURL)
/* harmony export */ });
/**
* @type {Record<string, File|undefined>}
*/
const cache = {};
/**
* Create a blob URL from a file.
*
* @param {File} file The file to create a blob URL for.
*
* @return {string} The blob URL.
*/
function createBlobURL(file) {
const url = window.URL.createObjectURL(file);
cache[url] = file;
return url;
}
/**
* Retrieve a file based on a blob URL. The file must have been created by
* `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return
* `undefined`.
*
* @param {string} url The blob URL.
*
* @return {File|undefined} The file for the blob URL.
*/
function getBlobByURL(url) {
return cache[url];
}
/**
* Retrieve a blob type based on URL. The file must have been created by
* `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return
* `undefined`.
*
* @param {string} url The blob URL.
*
* @return {string|undefined} The blob type.
*/
function getBlobTypeByURL(url) {
return getBlobByURL(url)?.type.split('/')[0]; // 0: media type , 1: file extension eg ( type: 'image/jpeg' ).
}
/**
* Remove the resource and file cache from memory.
*
* @param {string} url The blob URL.
*/
function revokeBlobURL(url) {
if (cache[url]) {
window.URL.revokeObjectURL(url);
}
delete cache[url];
}
/**
* Check whether a url is a blob url.
*
* @param {string|undefined} url The URL.
*
* @return {boolean} Is the url a blob url?
*/
function isBlobURL(url) {
if (!url || !url.indexOf) {
return false;
}
return url.indexOf('blob:') === 0;
}
/**
* Downloads a file, e.g., a text or readable stream, in the browser.
* Appropriate for downloading smaller file sizes, e.g., < 5 MB.
*
* Example usage:
*
* ```js
* const fileContent = JSON.stringify(
* {
* "title": "My Post",
* },
* null,
* 2
* );
* const filename = 'file.json';
*
* downloadBlob( filename, fileContent, 'application/json' );
* ```
*
* @param {string} filename File name.
* @param {BlobPart} content File content (BufferSource | Blob | string).
* @param {string} contentType (Optional) File mime type. Default is `''`.
*/
function downloadBlob(filename, content, contentType = '') {
if (!filename || !content) {
return;
}
const file = new window.Blob([content], {
type: contentType
});
const url = window.URL.createObjectURL(file);
const anchorElement = document.createElement('a');
anchorElement.href = url;
anchorElement.download = filename;
anchorElement.style.display = 'none';
document.body.appendChild(anchorElement);
anchorElement.click();
document.body.removeChild(anchorElement);
window.URL.revokeObjectURL(url);
}
(window.wp = window.wp || {}).blob = __webpack_exports__;
/******/ })()
;/*! This file is auto-generated */
(()=>{"use strict";var e={d:(o,t)=>{for(var n in t)e.o(t,n)&&!e.o(o,n)&&Object.defineProperty(o,n,{enumerable:!0,get:t[n]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{createBlobURL:()=>n,downloadBlob:()=>c,getBlobByURL:()=>r,getBlobTypeByURL:()=>d,isBlobURL:()=>l,revokeBlobURL:()=>i});const t={};function n(e){const o=window.URL.createObjectURL(e);return t[o]=e,o}function r(e){return t[e]}function d(e){return r(e)?.type.split("/")[0]}function i(e){t[e]&&window.URL.revokeObjectURL(e),delete t[e]}function l(e){return!(!e||!e.indexOf)&&0===e.indexOf("blob:")}function c(e,o,t=""){if(!e||!o)return;const n=new window.Blob([o],{type:t}),r=window.URL.createObjectURL(n),d=document.createElement("a");d.href=r,d.download=e,d.style.display="none",document.body.appendChild(d),d.click(),document.body.removeChild(d),window.URL.revokeObjectURL(r)}(window.wp=window.wp||{}).blob=o})();/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (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 */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
store: () => (/* reexport */ store)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/selectors.js
var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject);
__webpack_require__.d(selectors_namespaceObject, {
getDownloadableBlocks: () => (getDownloadableBlocks),
getErrorNoticeForBlock: () => (getErrorNoticeForBlock),
getErrorNotices: () => (getErrorNotices),
getInstalledBlockTypes: () => (getInstalledBlockTypes),
getNewBlockTypes: () => (getNewBlockTypes),
getUnusedBlockTypes: () => (getUnusedBlockTypes),
isInstalling: () => (isInstalling),
isRequestingDownloadableBlocks: () => (isRequestingDownloadableBlocks)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/actions.js
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, {
addInstalledBlockType: () => (addInstalledBlockType),
clearErrorNotice: () => (clearErrorNotice),
fetchDownloadableBlocks: () => (fetchDownloadableBlocks),
installBlockType: () => (installBlockType),
receiveDownloadableBlocks: () => (receiveDownloadableBlocks),
removeInstalledBlockType: () => (removeInstalledBlockType),
setErrorNotice: () => (setErrorNotice),
setIsInstalling: () => (setIsInstalling),
uninstallBlockType: () => (uninstallBlockType)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js
var resolvers_namespaceObject = {};
__webpack_require__.r(resolvers_namespaceObject);
__webpack_require__.d(resolvers_namespaceObject, {
getDownloadableBlocks: () => (resolvers_getDownloadableBlocks)
});
;// CONCATENATED MODULE: external "React"
const external_React_namespaceObject = window["React"];
;// CONCATENATED MODULE: external ["wp","plugins"]
const external_wp_plugins_namespaceObject = window["wp"]["plugins"];
;// CONCATENATED MODULE: external ["wp","hooks"]
const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
;// CONCATENATED MODULE: external ["wp","blocks"]
const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
;// CONCATENATED MODULE: external ["wp","data"]
const external_wp_data_namespaceObject = window["wp"]["data"];
;// CONCATENATED MODULE: external ["wp","element"]
const external_wp_element_namespaceObject = window["wp"]["element"];
;// CONCATENATED MODULE: external ["wp","editor"]
const external_wp_editor_namespaceObject = window["wp"]["editor"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/reducer.js
/**
* WordPress dependencies
*/
/**
* Reducer returning an array of downloadable blocks.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
const downloadableBlocks = (state = {}, action) => {
switch (action.type) {
case 'FETCH_DOWNLOADABLE_BLOCKS':
return {
...state,
[action.filterValue]: {
isRequesting: true
}
};
case 'RECEIVE_DOWNLOADABLE_BLOCKS':
return {
...state,
[action.filterValue]: {
results: action.downloadableBlocks,
isRequesting: false
}
};
}
return state;
};
/**
* Reducer managing the installation and deletion of blocks.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
const blockManagement = (state = {
installedBlockTypes: [],
isInstalling: {}
}, action) => {
switch (action.type) {
case 'ADD_INSTALLED_BLOCK_TYPE':
return {
...state,
installedBlockTypes: [...state.installedBlockTypes, action.item]
};
case 'REMOVE_INSTALLED_BLOCK_TYPE':
return {
...state,
installedBlockTypes: state.installedBlockTypes.filter(blockType => blockType.name !== action.item.name)
};
case 'SET_INSTALLING_BLOCK':
return {
...state,
isInstalling: {
...state.isInstalling,
[action.blockId]: action.isInstalling
}
};
}
return state;
};
/**
* Reducer returning an object of error notices.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
const errorNotices = (state = {}, action) => {
switch (action.type) {
case 'SET_ERROR_NOTICE':
return {
...state,
[action.blockId]: {
message: action.message,
isFatal: action.isFatal
}
};
case 'CLEAR_ERROR_NOTICE':
const {
[action.blockId]: blockId,
...restState
} = state;
return restState;
}
return state;
};
/* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
downloadableBlocks,
blockManagement,
errorNotices
}));
;// CONCATENATED MODULE: external ["wp","blockEditor"]
const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/utils/has-block-type.js
/**
* Check if a block list contains a specific block type. Recursively searches
* through `innerBlocks` if they exist.
*
* @param {Object} blockType A block object to search for.
* @param {Object[]} blocks The list of blocks to look through.
*
* @return {boolean} Whether the blockType is found.
*/
function hasBlockType(blockType, blocks = []) {
if (!blocks.length) {
return false;
}
if (blocks.some(({
name
}) => name === blockType.name)) {
return true;
}
for (let i = 0; i < blocks.length; i++) {
if (hasBlockType(blockType, blocks[i].innerBlocks)) {
return true;
}
}
return false;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/selectors.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns true if application is requesting for downloadable blocks.
*
* @param {Object} state Global application state.
* @param {string} filterValue Search string.
*
* @return {boolean} Whether a request is in progress for the blocks list.
*/
function isRequestingDownloadableBlocks(state, filterValue) {
var _state$downloadableBl;
return (_state$downloadableBl = state.downloadableBlocks[filterValue]?.isRequesting) !== null && _state$downloadableBl !== void 0 ? _state$downloadableBl : false;
}
/**
* Returns the available uninstalled blocks.
*
* @param {Object} state Global application state.
* @param {string} filterValue Search string.
*
* @return {Array} Downloadable blocks.
*/
function getDownloadableBlocks(state, filterValue) {
var _state$downloadableBl2;
return (_state$downloadableBl2 = state.downloadableBlocks[filterValue]?.results) !== null && _state$downloadableBl2 !== void 0 ? _state$downloadableBl2 : [];
}
/**
* Returns the block types that have been installed on the server in this
* session.
*
* @param {Object} state Global application state.
*
* @return {Array} Block type items
*/
function getInstalledBlockTypes(state) {
return state.blockManagement.installedBlockTypes;
}
/**
* Returns block types that have been installed on the server and used in the
* current post.
*
* @param {Object} state Global application state.
*
* @return {Array} Block type items.
*/
const getNewBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
const usedBlockTree = select(external_wp_blockEditor_namespaceObject.store).getBlocks();
const installedBlockTypes = getInstalledBlockTypes(state);
return installedBlockTypes.filter(blockType => hasBlockType(blockType, usedBlockTree));
});
/**
* Returns the block types that have been installed on the server but are not
* used in the current post.
*
* @param {Object} state Global application state.
*
* @return {Array} Block type items.
*/
const getUnusedBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
const usedBlockTree = select(external_wp_blockEditor_namespaceObject.store).getBlocks();
const installedBlockTypes = getInstalledBlockTypes(state);
return installedBlockTypes.filter(blockType => !hasBlockType(blockType, usedBlockTree));
});
/**
* Returns true if a block plugin install is in progress.
*
* @param {Object} state Global application state.
* @param {string} blockId Id of the block.
*
* @return {boolean} Whether this block is currently being installed.
*/
function isInstalling(state, blockId) {
return state.blockManagement.isInstalling[blockId] || false;
}
/**
* Returns all block error notices.
*
* @param {Object} state Global application state.
*
* @return {Object} Object with error notices.
*/
function getErrorNotices(state) {
return state.errorNotices;
}
/**
* Returns the error notice for a given block.
*
* @param {Object} state Global application state.
* @param {string} blockId The ID of the block plugin. eg: my-block
*
* @return {string|boolean} The error text, or false if no error.
*/
function getErrorNoticeForBlock(state, blockId) {
return state.errorNotices[blockId];
}
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// CONCATENATED MODULE: external ["wp","apiFetch"]
const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
;// CONCATENATED MODULE: external ["wp","notices"]
const external_wp_notices_namespaceObject = window["wp"]["notices"];
;// CONCATENATED MODULE: external ["wp","url"]
const external_wp_url_namespaceObject = window["wp"]["url"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/load-assets.js
/**
* WordPress dependencies
*/
/**
* Load an asset for a block.
*
* This function returns a Promise that will resolve once the asset is loaded,
* or in the case of Stylesheets and Inline JavaScript, will resolve immediately.
*
* @param {HTMLElement} el A HTML Element asset to inject.
*
* @return {Promise} Promise which will resolve when the asset is loaded.
*/
const loadAsset = el => {
return new Promise((resolve, reject) => {
/*
* Reconstruct the passed element, this is required as inserting the Node directly
* won't always fire the required onload events, even if the asset wasn't already loaded.
*/
const newNode = document.createElement(el.nodeName);
['id', 'rel', 'src', 'href', 'type'].forEach(attr => {
if (el[attr]) {
newNode[attr] = el[attr];
}
});
// Append inline <script> contents.
if (el.innerHTML) {
newNode.appendChild(document.createTextNode(el.innerHTML));
}
newNode.onload = () => resolve(true);
newNode.onerror = () => reject(new Error('Error loading asset.'));
document.body.appendChild(newNode);
// Resolve Stylesheets and Inline JavaScript immediately.
if ('link' === newNode.nodeName.toLowerCase() || 'script' === newNode.nodeName.toLowerCase() && !newNode.src) {
resolve();
}
});
};
/**
* Load the asset files for a block
*/
async function loadAssets() {
/*
* Fetch the current URL (post-new.php, or post.php?post=1&action=edit) and compare the
* JavaScript and CSS assets loaded between the pages. This imports the required assets
* for the block into the current page while not requiring that we know them up-front.
* In the future this can be improved by reliance upon block.json and/or a script-loader
* dependency API.
*/
const response = await external_wp_apiFetch_default()({
url: document.location.href,
parse: false
});
const data = await response.text();
const doc = new window.DOMParser().parseFromString(data, 'text/html');
const newAssets = Array.from(doc.querySelectorAll('link[rel="stylesheet"],script')).filter(asset => asset.id && !document.getElementById(asset.id));
/*
* Load each asset in order, as they may depend upon an earlier loaded script.
* Stylesheets and Inline Scripts will resolve immediately upon insertion.
*/
for (const newAsset of newAssets) {
await loadAsset(newAsset);
}
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/utils/get-plugin-url.js
/**
* Get the plugin's direct API link out of a block-directory response.
*
* @param {Object} block The block object
*
* @return {string} The plugin URL, if exists.
*/
function getPluginUrl(block) {
if (!block) {
return false;
}
const link = block.links['wp:plugin'] || block.links.self;
if (link && link.length) {
return link[0].href;
}
return false;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/actions.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns an action object used in signalling that the downloadable blocks
* have been requested and are loading.
*
* @param {string} filterValue Search string.
*
* @return {Object} Action object.
*/
function fetchDownloadableBlocks(filterValue) {
return {
type: 'FETCH_DOWNLOADABLE_BLOCKS',
filterValue
};
}
/**
* Returns an action object used in signalling that the downloadable blocks
* have been updated.
*
* @param {Array} downloadableBlocks Downloadable blocks.
* @param {string} filterValue Search string.
*
* @return {Object} Action object.
*/
function receiveDownloadableBlocks(downloadableBlocks, filterValue) {
return {
type: 'RECEIVE_DOWNLOADABLE_BLOCKS',
downloadableBlocks,
filterValue
};
}
/**
* Action triggered to install a block plugin.
*
* @param {Object} block The block item returned by search.
*
* @return {boolean} Whether the block was successfully installed & loaded.
*/
const installBlockType = block => async ({
registry,
dispatch
}) => {
const {
id,
name
} = block;
let success = false;
dispatch.clearErrorNotice(id);
try {
dispatch.setIsInstalling(id, true);
// If we have a wp:plugin link, the plugin is installed but inactive.
const url = getPluginUrl(block);
let links = {};
if (url) {
await external_wp_apiFetch_default()({
method: 'PUT',
url,
data: {
status: 'active'
}
});
} else {
const response = await external_wp_apiFetch_default()({
method: 'POST',
path: 'wp/v2/plugins',
data: {
slug: id,
status: 'active'
}
});
// Add the `self` link for newly-installed blocks.
links = response._links;
}
dispatch.addInstalledBlockType({
...block,
links: {
...block.links,
...links
}
});
// Ensures that the block metadata is propagated to the editor when registered on the server.
const metadataFields = ['api_version', 'title', 'category', 'parent', 'icon', 'description', 'keywords', 'attributes', 'provides_context', 'uses_context', 'supports', 'styles', 'example', 'variations'];
await external_wp_apiFetch_default()({
path: (0,external_wp_url_namespaceObject.addQueryArgs)(`/wp/v2/block-types/${name}`, {
_fields: metadataFields
})
})
// Ignore when the block is not registered on the server.
.catch(() => {}).then(response => {
if (!response) {
return;
}
(0,external_wp_blocks_namespaceObject.unstable__bootstrapServerSideBlockDefinitions)({
[name]: Object.fromEntries(Object.entries(response).filter(([key]) => metadataFields.includes(key)))
});
});
await loadAssets();
const registeredBlocks = registry.select(external_wp_blocks_namespaceObject.store).getBlockTypes();
if (!registeredBlocks.some(i => i.name === name)) {
throw new Error((0,external_wp_i18n_namespaceObject.__)('Error registering block. Try reloading the page.'));
}
registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice((0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s is the block title.
(0,external_wp_i18n_namespaceObject.__)('Block %s installed and added.'), block.title), {
speak: true,
type: 'snackbar'
});
success = true;
} catch (error) {
let message = error.message || (0,external_wp_i18n_namespaceObject.__)('An error occurred.');
// Errors we throw are fatal.
let isFatal = error instanceof Error;
// Specific API errors that are fatal.
const fatalAPIErrors = {
folder_exists: (0,external_wp_i18n_namespaceObject.__)('This block is already installed. Try reloading the page.'),
unable_to_connect_to_filesystem: (0,external_wp_i18n_namespaceObject.__)('Error installing block. You can reload the page and try again.')
};
if (fatalAPIErrors[error.code]) {
isFatal = true;
message = fatalAPIErrors[error.code];
}
dispatch.setErrorNotice(id, message, isFatal);
registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(message, {
speak: true,
isDismissible: true
});
}
dispatch.setIsInstalling(id, false);
return success;
};
/**
* Action triggered to uninstall a block plugin.
*
* @param {Object} block The blockType object.
*/
const uninstallBlockType = block => async ({
registry,
dispatch
}) => {
try {
const url = getPluginUrl(block);
await external_wp_apiFetch_default()({
method: 'PUT',
url,
data: {
status: 'inactive'
}
});
await external_wp_apiFetch_default()({
method: 'DELETE',
url
});
dispatch.removeInstalledBlockType(block);
} catch (error) {
registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(error.message || (0,external_wp_i18n_namespaceObject.__)('An error occurred.'));
}
};
/**
* Returns an action object used to add a block type to the "newly installed"
* tracking list.
*
* @param {Object} item The block item with the block id and name.
*
* @return {Object} Action object.
*/
function addInstalledBlockType(item) {
return {
type: 'ADD_INSTALLED_BLOCK_TYPE',
item
};
}
/**
* Returns an action object used to remove a block type from the "newly installed"
* tracking list.
*
* @param {string} item The block item with the block id and name.
*
* @return {Object} Action object.
*/
function removeInstalledBlockType(item) {
return {
type: 'REMOVE_INSTALLED_BLOCK_TYPE',
item
};
}
/**
* Returns an action object used to indicate install in progress.
*
* @param {string} blockId
* @param {boolean} isInstalling
*
* @return {Object} Action object.
*/
function setIsInstalling(blockId, isInstalling) {
return {
type: 'SET_INSTALLING_BLOCK',
blockId,
isInstalling
};
}
/**
* Sets an error notice to be displayed to the user for a given block.
*
* @param {string} blockId The ID of the block plugin. eg: my-block
* @param {string} message The message shown in the notice.
* @param {boolean} isFatal Whether the user can recover from the error.
*
* @return {Object} Action object.
*/
function setErrorNotice(blockId, message, isFatal = false) {
return {
type: 'SET_ERROR_NOTICE',
blockId,
message,
isFatal
};
}
/**
* Sets the error notice to empty for specific block.
*
* @param {string} blockId The ID of the block plugin. eg: my-block
*
* @return {Object} Action object.
*/
function clearErrorNotice(blockId) {
return {
type: 'CLEAR_ERROR_NOTICE',
blockId
};
}
;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
/******************************************************************************
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, SuppressedError, Symbol */
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) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
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 __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
};
function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
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 (g && (g = 0, op[0] && (_ = 0)), _) 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;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (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;
}
/** @deprecated */
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
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 __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
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: false } : 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, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
function next() {
while (env.stack.length) {
var rec = env.stack.pop();
try {
var result = rec.dispose && rec.dispose.call(rec.value);
if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
catch (e) {
fail(e);
}
}
if (env.hasError) throw env.error;
}
return next();
}
/* harmony default export */ const tslib_es6 = ({
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__createBinding,
__exportStar,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
});
;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
/**
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
*/
var SUPPORTED_LOCALE = {
tr: {
regexp: /\u0130|\u0049|\u0049\u0307/g,
map: {
İ: "\u0069",
I: "\u0131",
İ: "\u0069",
},
},
az: {
regexp: /\u0130/g,
map: {
İ: "\u0069",
I: "\u0131",
İ: "\u0069",
},
},
lt: {
regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
map: {
I: "\u0069\u0307",
J: "\u006A\u0307",
Į: "\u012F\u0307",
Ì: "\u0069\u0307\u0300",
Í: "\u0069\u0307\u0301",
Ĩ: "\u0069\u0307\u0303",
},
},
};
/**
* Localized lower case.
*/
function localeLowerCase(str, locale) {
var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
if (lang)
return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
return lowerCase(str);
}
/**
* Lower case as a function.
*/
function lowerCase(str) {
return str.toLowerCase();
}
;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
// Remove all non-word characters.
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
/**
* Normalize the string into something other libraries can manipulate easier.
*/
function noCase(input, options) {
if (options === void 0) { options = {}; }
var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
var start = 0;
var end = result.length;
// Trim the delimiter from around the output string.
while (result.charAt(start) === "\0")
start++;
while (result.charAt(end - 1) === "\0")
end--;
// Transform each token independently.
return result.slice(start, end).split("\0").map(transform).join(delimiter);
}
/**
* Replace `re` in the input string with the replacement value.
*/
function replace(input, re, value) {
if (re instanceof RegExp)
return input.replace(re, value);
return re.reduce(function (input, re) { return input.replace(re, value); }, input);
}
;// CONCATENATED MODULE: ./node_modules/pascal-case/dist.es2015/index.js
function pascalCaseTransform(input, index) {
var firstChar = input.charAt(0);
var lowerChars = input.substr(1).toLowerCase();
if (index > 0 && firstChar >= "0" && firstChar <= "9") {
return "_" + firstChar + lowerChars;
}
return "" + firstChar.toUpperCase() + lowerChars;
}
function dist_es2015_pascalCaseTransformMerge(input) {
return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();
}
function pascalCase(input, options) {
if (options === void 0) { options = {}; }
return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options));
}
;// CONCATENATED MODULE: ./node_modules/camel-case/dist.es2015/index.js
function camelCaseTransform(input, index) {
if (index === 0)
return input.toLowerCase();
return pascalCaseTransform(input, index);
}
function camelCaseTransformMerge(input, index) {
if (index === 0)
return input.toLowerCase();
return pascalCaseTransformMerge(input);
}
function camelCase(input, options) {
if (options === void 0) { options = {}; }
return pascalCase(input, __assign({ transform: camelCaseTransform }, options));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/resolvers.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const resolvers_getDownloadableBlocks = filterValue => async ({
dispatch
}) => {
if (!filterValue) {
return;
}
try {
dispatch(fetchDownloadableBlocks(filterValue));
const results = await external_wp_apiFetch_default()({
path: `wp/v2/block-directory/search?term=${filterValue}`
});
const blocks = results.map(result => Object.fromEntries(Object.entries(result).map(([key, value]) => [camelCase(key), value])));
dispatch(receiveDownloadableBlocks(blocks, filterValue));
} catch {}
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/store/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module Constants
*/
const STORE_NAME = 'core/block-directory';
/**
* Block editor data store configuration.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
*
* @type {Object}
*/
const storeConfig = {
reducer: reducer,
selectors: selectors_namespaceObject,
actions: actions_namespaceObject,
resolvers: resolvers_namespaceObject
};
/**
* Store definition for the block directory namespace.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*
* @type {Object}
*/
const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig);
(0,external_wp_data_namespaceObject.register)(store);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/auto-block-uninstaller/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function AutoBlockUninstaller() {
const {
uninstallBlockType
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const shouldRemoveBlockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
isAutosavingPost,
isSavingPost
} = select(external_wp_editor_namespaceObject.store);
return isSavingPost() && !isAutosavingPost();
}, []);
const unusedBlockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getUnusedBlockTypes(), []);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (shouldRemoveBlockTypes && unusedBlockTypes.length) {
unusedBlockTypes.forEach(blockType => {
uninstallBlockType(blockType);
(0,external_wp_blocks_namespaceObject.unregisterBlockType)(blockType.name);
});
}
}, [shouldRemoveBlockTypes]);
return null;
}
;// CONCATENATED MODULE: external ["wp","compose"]
const external_wp_compose_namespaceObject = window["wp"]["compose"];
;// CONCATENATED MODULE: external ["wp","components"]
const external_wp_components_namespaceObject = window["wp"]["components"];
;// CONCATENATED MODULE: external ["wp","coreData"]
const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
;// CONCATENATED MODULE: external ["wp","htmlEntities"]
const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
;// 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
* @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element.
*
* @return {JSX.Element} Icon component
*/
function Icon({
icon,
size = 24,
...props
}, ref) {
return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
width: size,
height: size,
...props,
ref
});
}
/* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon));
;// CONCATENATED MODULE: external ["wp","primitives"]
const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js
/**
* WordPress dependencies
*/
const starFilled = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"
}));
/* harmony default export */ const star_filled = (starFilled);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-half.js
/**
* WordPress dependencies
*/
const starHalf = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39v7.143z"
}));
/* harmony default export */ const star_half = (starHalf);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js
/**
* WordPress dependencies
*/
const starEmpty = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",
clipRule: "evenodd"
}));
/* harmony default export */ const star_empty = (starEmpty);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/stars.js
/**
* WordPress dependencies
*/
function Stars({
rating
}) {
const stars = Math.round(rating / 0.5) * 0.5;
const fullStarCount = Math.floor(rating);
const halfStarCount = Math.ceil(rating - fullStarCount);
const emptyStarCount = 5 - (fullStarCount + halfStarCount);
return (0,external_React_namespaceObject.createElement)("span", {
"aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: number of stars. */
(0,external_wp_i18n_namespaceObject.__)('%s out of 5 stars'), stars)
}, Array.from({
length: fullStarCount
}).map((_, i) => (0,external_React_namespaceObject.createElement)(icon, {
key: `full_stars_${i}`,
className: "block-directory-block-ratings__star-full",
icon: star_filled,
size: 16
})), Array.from({
length: halfStarCount
}).map((_, i) => (0,external_React_namespaceObject.createElement)(icon, {
key: `half_stars_${i}`,
className: "block-directory-block-ratings__star-half-full",
icon: star_half,
size: 16
})), Array.from({
length: emptyStarCount
}).map((_, i) => (0,external_React_namespaceObject.createElement)(icon, {
key: `empty_stars_${i}`,
className: "block-directory-block-ratings__star-empty",
icon: star_empty,
size: 16
})));
}
/* harmony default export */ const stars = (Stars);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/block-ratings/index.js
/**
* Internal dependencies
*/
const BlockRatings = ({
rating
}) => (0,external_React_namespaceObject.createElement)("span", {
className: "block-directory-block-ratings"
}, (0,external_React_namespaceObject.createElement)(stars, {
rating: rating
}));
/* harmony default export */ const block_ratings = (BlockRatings);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-icon/index.js
/**
* WordPress dependencies
*/
function DownloadableBlockIcon({
icon
}) {
const className = 'block-directory-downloadable-block-icon';
return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? (0,external_React_namespaceObject.createElement)("img", {
className: className,
src: icon,
alt: ""
}) : (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
className: className,
icon: icon,
showColors: true
});
}
/* harmony default export */ const downloadable_block_icon = (DownloadableBlockIcon);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-notice/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DownloadableBlockNotice = ({
block
}) => {
const errorNotice = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getErrorNoticeForBlock(block.id), [block]);
if (!errorNotice) {
return null;
}
return (0,external_React_namespaceObject.createElement)("div", {
className: "block-directory-downloadable-block-notice"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "block-directory-downloadable-block-notice__content"
}, errorNotice.message, errorNotice.isFatal ? ' ' + (0,external_wp_i18n_namespaceObject.__)('Try reloading the page.') : null));
};
/* harmony default export */ const downloadable_block_notice = (DownloadableBlockNotice);
;// CONCATENATED MODULE: external ["wp","privateApis"]
const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/lock-unlock.js
/**
* WordPress dependencies
*/
const {
lock,
unlock
} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/block-directory');
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-block-list-item/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
CompositeItemV2: CompositeItem
} = unlock(external_wp_components_namespaceObject.privateApis);
// Return the appropriate block item label, given the block data and status.
function getDownloadableBlockLabel({
title,
rating,
ratingCount
}, {
hasNotice,
isInstalled,
isInstalling
}) {
const stars = Math.round(rating / 0.5) * 0.5;
if (!isInstalled && hasNotice) {
/* translators: %1$s: block title */
return (0,external_wp_i18n_namespaceObject.sprintf)('Retry installing %s.', (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title));
}
if (isInstalled) {
/* translators: %1$s: block title */
return (0,external_wp_i18n_namespaceObject.sprintf)('Add %s.', (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title));
}
if (isInstalling) {
/* translators: %1$s: block title */
return (0,external_wp_i18n_namespaceObject.sprintf)('Installing %s.', (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title));
}
// No ratings yet, just use the title.
if (ratingCount < 1) {
/* translators: %1$s: block title */
return (0,external_wp_i18n_namespaceObject.sprintf)('Install %s.', (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title));
}
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */
(0,external_wp_i18n_namespaceObject._n)('Install %1$s. %2$s stars with %3$s review.', 'Install %1$s. %2$s stars with %3$s reviews.', ratingCount), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), stars, ratingCount);
}
function DownloadableBlockListItem({
composite,
item,
onClick
}) {
const {
author,
description,
icon,
rating,
title
} = item;
// getBlockType returns a block object if this block exists, or null if not.
const isInstalled = !!(0,external_wp_blocks_namespaceObject.getBlockType)(item.name);
const {
hasNotice,
isInstalling,
isInstallable
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getErrorNoticeForBlock,
isInstalling: isBlockInstalling
} = select(store);
const notice = getErrorNoticeForBlock(item.id);
const hasFatal = notice && notice.isFatal;
return {
hasNotice: !!notice,
isInstalling: isBlockInstalling(item.id),
isInstallable: !hasFatal
};
}, [item]);
let statusText = '';
if (isInstalled) {
statusText = (0,external_wp_i18n_namespaceObject.__)('Installed!');
} else if (isInstalling) {
statusText = (0,external_wp_i18n_namespaceObject.__)('Installing…');
}
return (0,external_React_namespaceObject.createElement)(CompositeItem, {
render: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
__experimentalIsFocusable: true,
type: "button",
role: "option",
className: "block-directory-downloadable-block-list-item",
isBusy: isInstalling,
onClick: event => {
event.preventDefault();
onClick();
},
label: getDownloadableBlockLabel(item, {
hasNotice,
isInstalled,
isInstalling
}),
showTooltip: true,
tooltipPosition: "top center"
}),
store: composite,
disabled: isInstalling || !isInstallable
}, (0,external_React_namespaceObject.createElement)("div", {
className: "block-directory-downloadable-block-list-item__icon"
}, (0,external_React_namespaceObject.createElement)(downloadable_block_icon, {
icon: icon,
title: title
}), isInstalling ? (0,external_React_namespaceObject.createElement)("span", {
className: "block-directory-downloadable-block-list-item__spinner"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)) : (0,external_React_namespaceObject.createElement)(block_ratings, {
rating: rating
})), (0,external_React_namespaceObject.createElement)("span", {
className: "block-directory-downloadable-block-list-item__details"
}, (0,external_React_namespaceObject.createElement)("span", {
className: "block-directory-downloadable-block-list-item__title"
}, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %1$s: block title, %2$s: author name. */
(0,external_wp_i18n_namespaceObject.__)('%1$s <span>by %2$s</span>'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), author), {
span: (0,external_React_namespaceObject.createElement)("span", {
className: "block-directory-downloadable-block-list-item__author"
})
})), hasNotice ? (0,external_React_namespaceObject.createElement)(downloadable_block_notice, {
block: item
}) : (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("span", {
className: "block-directory-downloadable-block-list-item__desc"
}, !!statusText ? statusText : (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(description)), isInstallable && !(isInstalled || isInstalling) && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Install block')))));
}
/* harmony default export */ const downloadable_block_list_item = (DownloadableBlockListItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-list/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
CompositeV2: Composite,
useCompositeStoreV2: useCompositeStore
} = unlock(external_wp_components_namespaceObject.privateApis);
const noop = () => {};
function DownloadableBlocksList({
items,
onHover = noop,
onSelect
}) {
const composite = useCompositeStore();
const {
installBlockType
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
if (!items.length) {
return null;
}
return (0,external_React_namespaceObject.createElement)(Composite, {
store: composite,
role: "listbox",
className: "block-directory-downloadable-blocks-list",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Blocks available for install')
}, items.map(item => {
return (0,external_React_namespaceObject.createElement)(downloadable_block_list_item, {
key: item.id,
composite: composite,
onClick: () => {
// Check if the block is registered (`getBlockType`
// will return an object). If so, insert the block.
// This prevents installing existing plugins.
if ((0,external_wp_blocks_namespaceObject.getBlockType)(item.name)) {
onSelect(item);
} else {
installBlockType(item).then(success => {
if (success) {
onSelect(item);
}
});
}
onHover(null);
},
onHover: onHover,
item: item
});
}));
}
/* harmony default export */ const downloadable_blocks_list = (DownloadableBlocksList);
;// CONCATENATED MODULE: external ["wp","a11y"]
const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/inserter-panel.js
/**
* WordPress dependencies
*/
function DownloadableBlocksInserterPanel({
children,
downloadableItems,
hasLocalBlocks
}) {
const count = downloadableItems.length;
(0,external_wp_element_namespaceObject.useEffect)(() => {
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of available blocks. */
(0,external_wp_i18n_namespaceObject._n)('%d additional block is available to install.', '%d additional blocks are available to install.', count), count));
}, [count]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !hasLocalBlocks && (0,external_React_namespaceObject.createElement)("p", {
className: "block-directory-downloadable-blocks-panel__no-local"
}, (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.')), (0,external_React_namespaceObject.createElement)("div", {
className: "block-editor-inserter__quick-inserter-separator"
}), (0,external_React_namespaceObject.createElement)("div", {
className: "block-directory-downloadable-blocks-panel"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "block-directory-downloadable-blocks-panel__header"
}, (0,external_React_namespaceObject.createElement)("h2", {
className: "block-directory-downloadable-blocks-panel__title"
}, (0,external_wp_i18n_namespaceObject.__)('Available to install')), (0,external_React_namespaceObject.createElement)("p", {
className: "block-directory-downloadable-blocks-panel__description"
}, (0,external_wp_i18n_namespaceObject.__)('Select a block to install and add it to your post.'))), children));
}
/* harmony default export */ const inserter_panel = (DownloadableBlocksInserterPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js
/**
* WordPress dependencies
*/
const blockDefault = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_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 */ const block_default = (blockDefault);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/no-results.js
/**
* WordPress dependencies
*/
function DownloadableBlocksNoResults() {
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", {
className: "block-editor-inserter__no-results"
}, (0,external_React_namespaceObject.createElement)(icon, {
className: "block-editor-inserter__no-results-icon",
icon: block_default
}), (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No results found.'))), (0,external_React_namespaceObject.createElement)("div", {
className: "block-editor-inserter__tips"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Tip, null, (0,external_wp_i18n_namespaceObject.__)('Interested in creating your own block?'), (0,external_React_namespaceObject.createElement)("br", null), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
href: "https://developer.wordpress.org/block-editor/"
}, (0,external_wp_i18n_namespaceObject.__)('Get started here'), "."))));
}
/* harmony default export */ const no_results = (DownloadableBlocksNoResults);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/downloadable-blocks-panel/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const EMPTY_ARRAY = [];
const useDownloadableBlocks = filterValue => (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getDownloadableBlocks,
isRequestingDownloadableBlocks,
getInstalledBlockTypes
} = select(store);
const hasPermission = select(external_wp_coreData_namespaceObject.store).canUser('read', 'block-directory/search');
let downloadableBlocks = EMPTY_ARRAY;
if (hasPermission) {
downloadableBlocks = getDownloadableBlocks(filterValue);
// Filter out blocks that are already installed.
const installedBlockTypes = getInstalledBlockTypes();
const installableBlocks = downloadableBlocks.filter(({
name
}) => {
// Check if the block has just been installed, in which case it
// should still show in the list to avoid suddenly disappearing.
// `installedBlockTypes` only returns blocks stored in state
// immediately after installation, not all installed blocks.
const isJustInstalled = installedBlockTypes.some(blockType => blockType.name === name);
const isPreviouslyInstalled = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
return isJustInstalled || !isPreviouslyInstalled;
});
// Keep identity of the `downloadableBlocks` array if nothing was filtered out
if (installableBlocks.length !== downloadableBlocks.length) {
downloadableBlocks = installableBlocks;
}
// Return identical empty array when there are no blocks
if (downloadableBlocks.length === 0) {
downloadableBlocks = EMPTY_ARRAY;
}
}
return {
hasPermission,
downloadableBlocks,
isLoading: isRequestingDownloadableBlocks(filterValue)
};
}, [filterValue]);
function DownloadableBlocksPanel({
onSelect,
onHover,
hasLocalBlocks,
isTyping,
filterValue
}) {
const {
hasPermission,
downloadableBlocks,
isLoading
} = useDownloadableBlocks(filterValue);
if (hasPermission === undefined || isLoading || isTyping) {
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, hasPermission && !hasLocalBlocks && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("p", {
className: "block-directory-downloadable-blocks-panel__no-local"
}, (0,external_wp_i18n_namespaceObject.__)('No results available from your installed blocks.')), (0,external_React_namespaceObject.createElement)("div", {
className: "block-editor-inserter__quick-inserter-separator"
})), (0,external_React_namespaceObject.createElement)("div", {
className: "block-directory-downloadable-blocks-panel has-blocks-loading"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)));
}
if (false === hasPermission) {
if (!hasLocalBlocks) {
return (0,external_React_namespaceObject.createElement)(no_results, null);
}
return null;
}
if (downloadableBlocks.length === 0) {
return hasLocalBlocks ? null : (0,external_React_namespaceObject.createElement)(no_results, null);
}
return (0,external_React_namespaceObject.createElement)(inserter_panel, {
downloadableItems: downloadableBlocks,
hasLocalBlocks: hasLocalBlocks
}, (0,external_React_namespaceObject.createElement)(downloadable_blocks_list, {
items: downloadableBlocks,
onSelect: onSelect,
onHover: onHover
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function InserterMenuDownloadableBlocksPanel() {
const [debouncedFilterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
const debouncedSetFilterValue = (0,external_wp_compose_namespaceObject.debounce)(setFilterValue, 400);
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableInserterMenuExtension, null, ({
onSelect,
onHover,
filterValue,
hasItems
}) => {
if (debouncedFilterValue !== filterValue) {
debouncedSetFilterValue(filterValue);
}
if (!debouncedFilterValue) {
return null;
}
return (0,external_React_namespaceObject.createElement)(DownloadableBlocksPanel, {
onSelect: onSelect,
onHover: onHover,
filterValue: debouncedFilterValue,
hasLocalBlocks: hasItems,
isTyping: filterValue !== debouncedFilterValue
});
});
}
/* harmony default export */ const inserter_menu_downloadable_blocks_panel = (InserterMenuDownloadableBlocksPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/components/compact-list/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function CompactList({
items
}) {
if (!items.length) {
return null;
}
return (0,external_React_namespaceObject.createElement)("ul", {
className: "block-directory-compact-list"
}, items.map(({
icon,
id,
title,
author
}) => (0,external_React_namespaceObject.createElement)("li", {
key: id,
className: "block-directory-compact-list__item"
}, (0,external_React_namespaceObject.createElement)(downloadable_block_icon, {
icon: icon,
title: title
}), (0,external_React_namespaceObject.createElement)("div", {
className: "block-directory-compact-list__item-details"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "block-directory-compact-list__item-title"
}, title), (0,external_React_namespaceObject.createElement)("div", {
className: "block-directory-compact-list__item-author"
}, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Name of the block author. */
(0,external_wp_i18n_namespaceObject.__)('By %s'), author))))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/installed-blocks-pre-publish-panel/index.js
var _window$wp$editPost;
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// We shouldn't import the edit-post package directly
// because it would include the wp-edit-post in all pages loading the block-directory script.
const {
PluginPrePublishPanel
} = (_window$wp$editPost = window?.wp?.editPost) !== null && _window$wp$editPost !== void 0 ? _window$wp$editPost : {};
function InstalledBlocksPrePublishPanel() {
const newBlockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getNewBlockTypes(), []);
if (!newBlockTypes.length) {
return null;
}
return (0,external_React_namespaceObject.createElement)(PluginPrePublishPanel, {
icon: block_default,
title: (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %d: number of blocks (number).
(0,external_wp_i18n_namespaceObject._n)('Added: %d block', 'Added: %d blocks', newBlockTypes.length), newBlockTypes.length),
initialOpen: true
}, (0,external_React_namespaceObject.createElement)("p", {
className: "installed-blocks-pre-publish-panel__copy"
}, (0,external_wp_i18n_namespaceObject._n)('The following block has been added to your site.', 'The following blocks have been added to your site.', newBlockTypes.length)), (0,external_React_namespaceObject.createElement)(CompactList, {
items: newBlockTypes
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/get-install-missing/install-button.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function InstallButton({
attributes,
block,
clientId
}) {
const isInstallingBlock = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isInstalling(block.id), [block.id]);
const {
installBlockType
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const {
replaceBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
onClick: () => installBlockType(block).then(success => {
if (success) {
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name);
const [originalBlock] = (0,external_wp_blocks_namespaceObject.parse)(attributes.originalContent);
if (originalBlock && blockType) {
replaceBlock(clientId, (0,external_wp_blocks_namespaceObject.createBlock)(blockType.name, originalBlock.attributes, originalBlock.innerBlocks));
}
}
}),
disabled: isInstallingBlock,
isBusy: isInstallingBlock,
variant: "primary"
}, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */
(0,external_wp_i18n_namespaceObject.__)('Install %s'), block.title));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/get-install-missing/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const getInstallMissing = OriginalComponent => props => {
const {
originalName
} = props.attributes;
// Disable reason: This is a valid component, but it's mistaken for a callback.
// eslint-disable-next-line react-hooks/rules-of-hooks
const {
block,
hasPermission
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getDownloadableBlocks
} = select(store);
const blocks = getDownloadableBlocks('block:' + originalName).filter(({
name
}) => originalName === name);
return {
hasPermission: select(external_wp_coreData_namespaceObject.store).canUser('read', 'block-directory/search'),
block: blocks.length && blocks[0]
};
}, [originalName]);
// The user can't install blocks, or the block isn't available for download.
if (!hasPermission || !block) {
return (0,external_React_namespaceObject.createElement)(OriginalComponent, {
...props
});
}
return (0,external_React_namespaceObject.createElement)(ModifiedWarning, {
...props,
originalBlock: block
});
};
const ModifiedWarning = ({
originalBlock,
...props
}) => {
const {
originalName,
originalUndelimitedContent,
clientId
} = props.attributes;
const {
replaceBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const convertToHTML = () => {
replaceBlock(props.clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/html', {
content: originalUndelimitedContent
}));
};
const hasContent = !!originalUndelimitedContent;
const hasHTMLBlock = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canInsertBlockType,
getBlockRootClientId
} = select(external_wp_blockEditor_namespaceObject.store);
return canInsertBlockType('core/html', getBlockRootClientId(clientId));
}, [clientId]);
let messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */
(0,external_wp_i18n_namespaceObject.__)('Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'), originalBlock.title || originalName);
const actions = [(0,external_React_namespaceObject.createElement)(InstallButton, {
key: "install",
block: originalBlock,
attributes: props.attributes,
clientId: props.clientId
})];
if (hasContent && hasHTMLBlock) {
messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */
(0,external_wp_i18n_namespaceObject.__)('Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'), originalBlock.title || originalName);
actions.push((0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
key: "convert",
onClick: convertToHTML,
variant: "tertiary"
}, (0,external_wp_i18n_namespaceObject.__)('Keep as HTML')));
}
return (0,external_React_namespaceObject.createElement)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)()
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
actions: actions
}, messageHTML), (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, originalUndelimitedContent));
};
/* harmony default export */ const get_install_missing = (getInstallMissing);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/plugins/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
(0,external_wp_plugins_namespaceObject.registerPlugin)('block-directory', {
render() {
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(AutoBlockUninstaller, null), (0,external_React_namespaceObject.createElement)(inserter_menu_downloadable_blocks_panel, null), (0,external_React_namespaceObject.createElement)(InstalledBlocksPrePublishPanel, null));
}
});
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'block-directory/fallback', (settings, name) => {
if (name !== 'core/missing') {
return settings;
}
settings.edit = get_install_missing(settings.edit);
return settings;
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-directory/build-module/index.js
/**
* Internal dependencies
*/
(window.wp = window.wp || {}).blockDirectory = __webpack_exports__;
/******/ })()
;/*! This file is auto-generated */
(()=>{"use strict";var e={n:t=>{var l=t&&t.__esModule?()=>t.default:()=>t;return e.d(l,{a:l}),l},d:(t,l)=>{for(var n in l)e.o(l,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:l[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{store:()=>W});var l={};e.r(l),e.d(l,{getDownloadableBlocks:()=>g,getErrorNoticeForBlock:()=>h,getErrorNotices:()=>f,getInstalledBlockTypes:()=>w,getNewBlockTypes:()=>_,getUnusedBlockTypes:()=>E,isInstalling:()=>y,isRequestingDownloadableBlocks:()=>b});var n={};e.r(n),e.d(n,{addInstalledBlockType:()=>D,clearErrorNotice:()=>F,fetchDownloadableBlocks:()=>O,installBlockType:()=>A,receiveDownloadableBlocks:()=>C,removeInstalledBlockType:()=>P,setErrorNotice:()=>x,setIsInstalling:()=>M,uninstallBlockType:()=>R});var o={};e.r(o),e.d(o,{getDownloadableBlocks:()=>q});const r=window.React,a=window.wp.plugins,s=window.wp.hooks,c=window.wp.blocks,i=window.wp.data,d=window.wp.element,u=window.wp.editor,m=(0,i.combineReducers)({downloadableBlocks:(e={},t)=>{switch(t.type){case"FETCH_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{isRequesting:!0}};case"RECEIVE_DOWNLOADABLE_BLOCKS":return{...e,[t.filterValue]:{results:t.downloadableBlocks,isRequesting:!1}}}return e},blockManagement:(e={installedBlockTypes:[],isInstalling:{}},t)=>{switch(t.type){case"ADD_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:[...e.installedBlockTypes,t.item]};case"REMOVE_INSTALLED_BLOCK_TYPE":return{...e,installedBlockTypes:e.installedBlockTypes.filter((e=>e.name!==t.item.name))};case"SET_INSTALLING_BLOCK":return{...e,isInstalling:{...e.isInstalling,[t.blockId]:t.isInstalling}}}return e},errorNotices:(e={},t)=>{switch(t.type){case"SET_ERROR_NOTICE":return{...e,[t.blockId]:{message:t.message,isFatal:t.isFatal}};case"CLEAR_ERROR_NOTICE":const{[t.blockId]:l,...n}=e;return n}return e}}),p=window.wp.blockEditor;function k(e,t=[]){if(!t.length)return!1;if(t.some((({name:t})=>t===e.name)))return!0;for(let l=0;l<t.length;l++)if(k(e,t[l].innerBlocks))return!0;return!1}function b(e,t){var l;return null!==(l=e.downloadableBlocks[t]?.isRequesting)&&void 0!==l&&l}function g(e,t){var l;return null!==(l=e.downloadableBlocks[t]?.results)&&void 0!==l?l:[]}function w(e){return e.blockManagement.installedBlockTypes}const _=(0,i.createRegistrySelector)((e=>t=>{const l=e(p.store).getBlocks();return w(t).filter((e=>k(e,l)))})),E=(0,i.createRegistrySelector)((e=>t=>{const l=e(p.store).getBlocks();return w(t).filter((e=>!k(e,l)))}));function y(e,t){return e.blockManagement.isInstalling[t]||!1}function f(e){return e.errorNotices}function h(e,t){return e.errorNotices[t]}const v=window.wp.i18n,B=window.wp.apiFetch;var N=e.n(B);const I=window.wp.notices,T=window.wp.url,L=e=>new Promise(((t,l)=>{const n=document.createElement(e.nodeName);["id","rel","src","href","type"].forEach((t=>{e[t]&&(n[t]=e[t])})),e.innerHTML&&n.appendChild(document.createTextNode(e.innerHTML)),n.onload=()=>t(!0),n.onerror=()=>l(new Error("Error loading asset.")),document.body.appendChild(n),("link"===n.nodeName.toLowerCase()||"script"===n.nodeName.toLowerCase()&&!n.src)&&t()}));function S(e){if(!e)return!1;const t=e.links["wp:plugin"]||e.links.self;return!(!t||!t.length)&&t[0].href}function O(e){return{type:"FETCH_DOWNLOADABLE_BLOCKS",filterValue:e}}function C(e,t){return{type:"RECEIVE_DOWNLOADABLE_BLOCKS",downloadableBlocks:e,filterValue:t}}const A=e=>async({registry:t,dispatch:l})=>{const{id:n,name:o}=e;let r=!1;l.clearErrorNotice(n);try{l.setIsInstalling(n,!0);const a=S(e);let s={};if(a)await N()({method:"PUT",url:a,data:{status:"active"}});else{s=(await N()({method:"POST",path:"wp/v2/plugins",data:{slug:n,status:"active"}}))._links}l.addInstalledBlockType({...e,links:{...e.links,...s}});const i=["api_version","title","category","parent","icon","description","keywords","attributes","provides_context","uses_context","supports","styles","example","variations"];await N()({path:(0,T.addQueryArgs)(`/wp/v2/block-types/${o}`,{_fields:i})}).catch((()=>{})).then((e=>{e&&(0,c.unstable__bootstrapServerSideBlockDefinitions)({[o]:Object.fromEntries(Object.entries(e).filter((([e])=>i.includes(e))))})})),await async function(){const e=await N()({url:document.location.href,parse:!1}),t=await e.text(),l=(new window.DOMParser).parseFromString(t,"text/html"),n=Array.from(l.querySelectorAll('link[rel="stylesheet"],script')).filter((e=>e.id&&!document.getElementById(e.id)));for(const e of n)await L(e)}();if(!t.select(c.store).getBlockTypes().some((e=>e.name===o)))throw new Error((0,v.__)("Error registering block. Try reloading the page."));t.dispatch(I.store).createInfoNotice((0,v.sprintf)((0,v.__)("Block %s installed and added."),e.title),{speak:!0,type:"snackbar"}),r=!0}catch(e){let o=e.message||(0,v.__)("An error occurred."),r=e instanceof Error;const a={folder_exists:(0,v.__)("This block is already installed. Try reloading the page."),unable_to_connect_to_filesystem:(0,v.__)("Error installing block. You can reload the page and try again.")};a[e.code]&&(r=!0,o=a[e.code]),l.setErrorNotice(n,o,r),t.dispatch(I.store).createErrorNotice(o,{speak:!0,isDismissible:!0})}return l.setIsInstalling(n,!1),r},R=e=>async({registry:t,dispatch:l})=>{try{const t=S(e);await N()({method:"PUT",url:t,data:{status:"inactive"}}),await N()({method:"DELETE",url:t}),l.removeInstalledBlockType(e)}catch(e){t.dispatch(I.store).createErrorNotice(e.message||(0,v.__)("An error occurred."))}};function D(e){return{type:"ADD_INSTALLED_BLOCK_TYPE",item:e}}function P(e){return{type:"REMOVE_INSTALLED_BLOCK_TYPE",item:e}}function M(e,t){return{type:"SET_INSTALLING_BLOCK",blockId:e,isInstalling:t}}function x(e,t,l=!1){return{type:"SET_ERROR_NOTICE",blockId:e,message:t,isFatal:l}}function F(e){return{type:"CLEAR_ERROR_NOTICE",blockId:e}}var V=function(){return V=Object.assign||function(e){for(var t,l=1,n=arguments.length;l<n;l++)for(var o in t=arguments[l])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},V.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function H(e){return e.toLowerCase()}var $=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],j=/[^A-Z0-9]+/gi;function z(e,t,l){return t instanceof RegExp?e.replace(t,l):t.reduce((function(e,t){return e.replace(t,l)}),e)}function K(e,t){var l=e.charAt(0),n=e.substr(1).toLowerCase();return t>0&&l>="0"&&l<="9"?"_"+l+n:""+l.toUpperCase()+n}function U(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var l=t.splitRegexp,n=void 0===l?$:l,o=t.stripRegexp,r=void 0===o?j:o,a=t.transform,s=void 0===a?H:a,c=t.delimiter,i=void 0===c?" ":c,d=z(z(e,n,"$1\0$2"),r,"\0"),u=0,m=d.length;"\0"===d.charAt(u);)u++;for(;"\0"===d.charAt(m-1);)m--;return d.slice(u,m).split("\0").map(s).join(i)}(e,V({delimiter:"",transform:K},t))}function Y(e,t){return 0===t?e.toLowerCase():K(e,t)}const q=e=>async({dispatch:t})=>{if(e)try{t(O(e));const l=await N()({path:`wp/v2/block-directory/search?term=${e}`});t(C(l.map((e=>Object.fromEntries(Object.entries(e).map((([e,t])=>{return[(l=e,void 0===n&&(n={}),U(l,V({transform:Y},n))),t];var l,n}))))),e))}catch{}},G={reducer:m,selectors:l,actions:n,resolvers:o},W=(0,i.createReduxStore)("core/block-directory",G);function Z(){const{uninstallBlockType:e}=(0,i.useDispatch)(W),t=(0,i.useSelect)((e=>{const{isAutosavingPost:t,isSavingPost:l}=e(u.store);return l()&&!t()}),[]),l=(0,i.useSelect)((e=>e(W).getUnusedBlockTypes()),[]);return(0,d.useEffect)((()=>{t&&l.length&&l.forEach((t=>{e(t),(0,c.unregisterBlockType)(t.name)}))}),[t]),null}(0,i.register)(W);const Q=window.wp.compose,J=window.wp.components,X=window.wp.coreData,ee=window.wp.htmlEntities;const te=(0,d.forwardRef)((function({icon:e,size:t=24,...l},n){return(0,d.cloneElement)(e,{width:t,height:t,...l,ref:n})})),le=window.wp.primitives,ne=(0,r.createElement)(le.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(le.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"})),oe=(0,r.createElement)(le.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(le.Path,{d:"M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39v7.143z"})),re=(0,r.createElement)(le.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(le.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"}));const ae=function({rating:e}){const t=.5*Math.round(e/.5),l=Math.floor(e),n=Math.ceil(e-l),o=5-(l+n);return(0,r.createElement)("span",{"aria-label":(0,v.sprintf)((0,v.__)("%s out of 5 stars"),t)},Array.from({length:l}).map(((e,t)=>(0,r.createElement)(te,{key:`full_stars_${t}`,className:"block-directory-block-ratings__star-full",icon:ne,size:16}))),Array.from({length:n}).map(((e,t)=>(0,r.createElement)(te,{key:`half_stars_${t}`,className:"block-directory-block-ratings__star-half-full",icon:oe,size:16}))),Array.from({length:o}).map(((e,t)=>(0,r.createElement)(te,{key:`empty_stars_${t}`,className:"block-directory-block-ratings__star-empty",icon:re,size:16}))))},se=({rating:e})=>(0,r.createElement)("span",{className:"block-directory-block-ratings"},(0,r.createElement)(ae,{rating:e}));const ce=function({icon:e}){const t="block-directory-downloadable-block-icon";return null!==e.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/)?(0,r.createElement)("img",{className:t,src:e,alt:""}):(0,r.createElement)(p.BlockIcon,{className:t,icon:e,showColors:!0})},ie=({block:e})=>{const t=(0,i.useSelect)((t=>t(W).getErrorNoticeForBlock(e.id)),[e]);return t?(0,r.createElement)("div",{className:"block-directory-downloadable-block-notice"},(0,r.createElement)("div",{className:"block-directory-downloadable-block-notice__content"},t.message,t.isFatal?" "+(0,v.__)("Try reloading the page."):null)):null},de=window.wp.privateApis,{lock:ue,unlock:me}=(0,de.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/block-directory"),{CompositeItemV2:pe}=me(J.privateApis);function ke({title:e,rating:t,ratingCount:l},{hasNotice:n,isInstalled:o,isInstalling:r}){const a=.5*Math.round(t/.5);return!o&&n?(0,v.sprintf)("Retry installing %s.",(0,ee.decodeEntities)(e)):o?(0,v.sprintf)("Add %s.",(0,ee.decodeEntities)(e)):r?(0,v.sprintf)("Installing %s.",(0,ee.decodeEntities)(e)):l<1?(0,v.sprintf)("Install %s.",(0,ee.decodeEntities)(e)):(0,v.sprintf)((0,v._n)("Install %1$s. %2$s stars with %3$s review.","Install %1$s. %2$s stars with %3$s reviews.",l),(0,ee.decodeEntities)(e),a,l)}const be=function({composite:e,item:t,onClick:l}){const{author:n,description:o,icon:a,rating:s,title:u}=t,m=!!(0,c.getBlockType)(t.name),{hasNotice:p,isInstalling:k,isInstallable:b}=(0,i.useSelect)((e=>{const{getErrorNoticeForBlock:l,isInstalling:n}=e(W),o=l(t.id),r=o&&o.isFatal;return{hasNotice:!!o,isInstalling:n(t.id),isInstallable:!r}}),[t]);let g="";return m?g=(0,v.__)("Installed!"):k&&(g=(0,v.__)("Installing…")),(0,r.createElement)(pe,{render:(0,r.createElement)(J.Button,{__experimentalIsFocusable:!0,type:"button",role:"option",className:"block-directory-downloadable-block-list-item",isBusy:k,onClick:e=>{e.preventDefault(),l()},label:ke(t,{hasNotice:p,isInstalled:m,isInstalling:k}),showTooltip:!0,tooltipPosition:"top center"}),store:e,disabled:k||!b},(0,r.createElement)("div",{className:"block-directory-downloadable-block-list-item__icon"},(0,r.createElement)(ce,{icon:a,title:u}),k?(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__spinner"},(0,r.createElement)(J.Spinner,null)):(0,r.createElement)(se,{rating:s})),(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__details"},(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__title"},(0,d.createInterpolateElement)((0,v.sprintf)((0,v.__)("%1$s <span>by %2$s</span>"),(0,ee.decodeEntities)(u),n),{span:(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__author"})})),p?(0,r.createElement)(ie,{block:t}):(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"block-directory-downloadable-block-list-item__desc"},g||(0,ee.decodeEntities)(o)),b&&!(m||k)&&(0,r.createElement)(J.VisuallyHidden,null,(0,v.__)("Install block")))))},{CompositeV2:ge,useCompositeStoreV2:we}=me(J.privateApis),_e=()=>{};const Ee=function({items:e,onHover:t=_e,onSelect:l}){const n=we(),{installBlockType:o}=(0,i.useDispatch)(W);return e.length?(0,r.createElement)(ge,{store:n,role:"listbox",className:"block-directory-downloadable-blocks-list","aria-label":(0,v.__)("Blocks available for install")},e.map((e=>(0,r.createElement)(be,{key:e.id,composite:n,onClick:()=>{(0,c.getBlockType)(e.name)?l(e):o(e).then((t=>{t&&l(e)})),t(null)},onHover:t,item:e})))):null},ye=window.wp.a11y;const fe=function({children:e,downloadableItems:t,hasLocalBlocks:l}){const n=t.length;return(0,d.useEffect)((()=>{(0,ye.speak)((0,v.sprintf)((0,v._n)("%d additional block is available to install.","%d additional blocks are available to install.",n),n))}),[n]),(0,r.createElement)(r.Fragment,null,!l&&(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,r.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"}),(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel"},(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel__header"},(0,r.createElement)("h2",{className:"block-directory-downloadable-blocks-panel__title"},(0,v.__)("Available to install")),(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__description"},(0,v.__)("Select a block to install and add it to your post."))),e))},he=(0,r.createElement)(le.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(le.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"}));const ve=function(){return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:"block-editor-inserter__no-results"},(0,r.createElement)(te,{className:"block-editor-inserter__no-results-icon",icon:he}),(0,r.createElement)("p",null,(0,v.__)("No results found."))),(0,r.createElement)("div",{className:"block-editor-inserter__tips"},(0,r.createElement)(J.Tip,null,(0,v.__)("Interested in creating your own block?"),(0,r.createElement)("br",null),(0,r.createElement)(J.ExternalLink,{href:"https://developer.wordpress.org/block-editor/"},(0,v.__)("Get started here"),"."))))},Be=[],Ne=e=>(0,i.useSelect)((t=>{const{getDownloadableBlocks:l,isRequestingDownloadableBlocks:n,getInstalledBlockTypes:o}=t(W),r=t(X.store).canUser("read","block-directory/search");let a=Be;if(r){a=l(e);const t=o(),n=a.filter((({name:e})=>{const l=t.some((t=>t.name===e)),n=(0,c.getBlockType)(e);return l||!n}));n.length!==a.length&&(a=n),0===a.length&&(a=Be)}return{hasPermission:r,downloadableBlocks:a,isLoading:n(e)}}),[e]);function Ie({onSelect:e,onHover:t,hasLocalBlocks:l,isTyping:n,filterValue:o}){const{hasPermission:a,downloadableBlocks:s,isLoading:c}=Ne(o);return void 0===a||c||n?(0,r.createElement)(r.Fragment,null,a&&!l&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,r.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"})),(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel has-blocks-loading"},(0,r.createElement)(J.Spinner,null))):!1===a||0===s.length?l?null:(0,r.createElement)(ve,null):(0,r.createElement)(fe,{downloadableItems:s,hasLocalBlocks:l},(0,r.createElement)(Ee,{items:s,onSelect:e,onHover:t}))}const Te=function(){const[e,t]=(0,d.useState)(""),l=(0,Q.debounce)(t,400);return(0,r.createElement)(p.__unstableInserterMenuExtension,null,(({onSelect:t,onHover:n,filterValue:o,hasItems:a})=>(e!==o&&l(o),e?(0,r.createElement)(Ie,{onSelect:t,onHover:n,filterValue:e,hasLocalBlocks:a,isTyping:o!==e}):null)))};function Le({items:e}){return e.length?(0,r.createElement)("ul",{className:"block-directory-compact-list"},e.map((({icon:e,id:t,title:l,author:n})=>(0,r.createElement)("li",{key:t,className:"block-directory-compact-list__item"},(0,r.createElement)(ce,{icon:e,title:l}),(0,r.createElement)("div",{className:"block-directory-compact-list__item-details"},(0,r.createElement)("div",{className:"block-directory-compact-list__item-title"},l),(0,r.createElement)("div",{className:"block-directory-compact-list__item-author"},(0,v.sprintf)((0,v.__)("By %s"),n))))))):null}var Se;const{PluginPrePublishPanel:Oe}=null!==(Se=window?.wp?.editPost)&&void 0!==Se?Se:{};function Ce(){const e=(0,i.useSelect)((e=>e(W).getNewBlockTypes()),[]);return e.length?(0,r.createElement)(Oe,{icon:he,title:(0,v.sprintf)((0,v._n)("Added: %d block","Added: %d blocks",e.length),e.length),initialOpen:!0},(0,r.createElement)("p",{className:"installed-blocks-pre-publish-panel__copy"},(0,v._n)("The following block has been added to your site.","The following blocks have been added to your site.",e.length)),(0,r.createElement)(Le,{items:e})):null}function Ae({attributes:e,block:t,clientId:l}){const n=(0,i.useSelect)((e=>e(W).isInstalling(t.id)),[t.id]),{installBlockType:o}=(0,i.useDispatch)(W),{replaceBlock:a}=(0,i.useDispatch)(p.store);return(0,r.createElement)(J.Button,{onClick:()=>o(t).then((n=>{if(n){const n=(0,c.getBlockType)(t.name),[o]=(0,c.parse)(e.originalContent);o&&n&&a(l,(0,c.createBlock)(n.name,o.attributes,o.innerBlocks))}})),disabled:n,isBusy:n,variant:"primary"},(0,v.sprintf)((0,v.__)("Install %s"),t.title))}const Re=({originalBlock:e,...t})=>{const{originalName:l,originalUndelimitedContent:n,clientId:o}=t.attributes,{replaceBlock:a}=(0,i.useDispatch)(p.store),s=()=>{a(t.clientId,(0,c.createBlock)("core/html",{content:n}))},u=!!n,m=(0,i.useSelect)((e=>{const{canInsertBlockType:t,getBlockRootClientId:l}=e(p.store);return t("core/html",l(o))}),[o]);let k=(0,v.sprintf)((0,v.__)("Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely."),e.title||l);const b=[(0,r.createElement)(Ae,{key:"install",block:e,attributes:t.attributes,clientId:t.clientId})];return u&&m&&(k=(0,v.sprintf)((0,v.__)("Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."),e.title||l),b.push((0,r.createElement)(J.Button,{key:"convert",onClick:s,variant:"tertiary"},(0,v.__)("Keep as HTML")))),(0,r.createElement)("div",{...(0,p.useBlockProps)()},(0,r.createElement)(p.Warning,{actions:b},k),(0,r.createElement)(d.RawHTML,null,n))},De=e=>t=>{const{originalName:l}=t.attributes,{block:n,hasPermission:o}=(0,i.useSelect)((e=>{const{getDownloadableBlocks:t}=e(W),n=t("block:"+l).filter((({name:e})=>l===e));return{hasPermission:e(X.store).canUser("read","block-directory/search"),block:n.length&&n[0]}}),[l]);return o&&n?(0,r.createElement)(Re,{...t,originalBlock:n}):(0,r.createElement)(e,{...t})};(0,a.registerPlugin)("block-directory",{render:()=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)(Z,null),(0,r.createElement)(Te,null),(0,r.createElement)(Ce,null))}),(0,s.addFilter)("blocks.registerBlockType","block-directory/fallback",((e,t)=>("core/missing"!==t||(e.edit=De(e.edit)),e))),(window.wp=window.wp||{}).blockDirectory=t})();/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 4306:
/***/ (function(module, exports) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
autosize 4.0.4
license: MIT
http://www.jacklmoore.com/autosize
*/
(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function (module, exports) {
'use strict';
var map = typeof Map === "function" ? new Map() : function () {
var keys = [];
var values = [];
return {
has: function has(key) {
return keys.indexOf(key) > -1;
},
get: function get(key) {
return values[keys.indexOf(key)];
},
set: function set(key, value) {
if (keys.indexOf(key) === -1) {
keys.push(key);
values.push(value);
}
},
delete: function _delete(key) {
var index = keys.indexOf(key);
if (index > -1) {
keys.splice(index, 1);
values.splice(index, 1);
}
}
};
}();
var createEvent = function createEvent(name) {
return new Event(name, { bubbles: true });
};
try {
new Event('test');
} catch (e) {
// IE does not support `new Event()`
createEvent = function createEvent(name) {
var evt = document.createEvent('Event');
evt.initEvent(name, true, false);
return evt;
};
}
function assign(ta) {
if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
var heightOffset = null;
var clientWidth = null;
var cachedHeight = null;
function init() {
var style = window.getComputedStyle(ta, null);
if (style.resize === 'vertical') {
ta.style.resize = 'none';
} else if (style.resize === 'both') {
ta.style.resize = 'horizontal';
}
if (style.boxSizing === 'content-box') {
heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
} else {
heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
}
// Fix when a textarea is not on document body and heightOffset is Not a Number
if (isNaN(heightOffset)) {
heightOffset = 0;
}
update();
}
function changeOverflow(value) {
{
// Chrome/Safari-specific fix:
// When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
// made available by removing the scrollbar. The following forces the necessary text reflow.
var width = ta.style.width;
ta.style.width = '0px';
// Force reflow:
/* jshint ignore:start */
ta.offsetWidth;
/* jshint ignore:end */
ta.style.width = width;
}
ta.style.overflowY = value;
}
function getParentOverflows(el) {
var arr = [];
while (el && el.parentNode && el.parentNode instanceof Element) {
if (el.parentNode.scrollTop) {
arr.push({
node: el.parentNode,
scrollTop: el.parentNode.scrollTop
});
}
el = el.parentNode;
}
return arr;
}
function resize() {
if (ta.scrollHeight === 0) {
// If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
return;
}
var overflows = getParentOverflows(ta);
var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
ta.style.height = '';
ta.style.height = ta.scrollHeight + heightOffset + 'px';
// used to check if an update is actually necessary on window.resize
clientWidth = ta.clientWidth;
// prevents scroll-position jumping
overflows.forEach(function (el) {
el.node.scrollTop = el.scrollTop;
});
if (docTop) {
document.documentElement.scrollTop = docTop;
}
}
function update() {
resize();
var styleHeight = Math.round(parseFloat(ta.style.height));
var computed = window.getComputedStyle(ta, null);
// Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
// The actual height not matching the style height (set via the resize method) indicates that
// the max-height has been exceeded, in which case the overflow should be allowed.
if (actualHeight < styleHeight) {
if (computed.overflowY === 'hidden') {
changeOverflow('scroll');
resize();
actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
}
} else {
// Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
if (computed.overflowY !== 'hidden') {
changeOverflow('hidden');
resize();
actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
}
}
if (cachedHeight !== actualHeight) {
cachedHeight = actualHeight;
var evt = createEvent('autosize:resized');
try {
ta.dispatchEvent(evt);
} catch (err) {
// Firefox will throw an error on dispatchEvent for a detached element
// https://bugzilla.mozilla.org/show_bug.cgi?id=889376
}
}
}
var pageResize = function pageResize() {
if (ta.clientWidth !== clientWidth) {
update();
}
};
var destroy = function (style) {
window.removeEventListener('resize', pageResize, false);
ta.removeEventListener('input', update, false);
ta.removeEventListener('keyup', update, false);
ta.removeEventListener('autosize:destroy', destroy, false);
ta.removeEventListener('autosize:update', update, false);
Object.keys(style).forEach(function (key) {
ta.style[key] = style[key];
});
map.delete(ta);
}.bind(ta, {
height: ta.style.height,
resize: ta.style.resize,
overflowY: ta.style.overflowY,
overflowX: ta.style.overflowX,
wordWrap: ta.style.wordWrap
});
ta.addEventListener('autosize:destroy', destroy, false);
// IE9 does not fire onpropertychange or oninput for deletions,
// so binding to onkeyup to catch most of those events.
// There is no way that I know of to detect something like 'cut' in IE9.
if ('onpropertychange' in ta && 'oninput' in ta) {
ta.addEventListener('keyup', update, false);
}
window.addEventListener('resize', pageResize, false);
ta.addEventListener('input', update, false);
ta.addEventListener('autosize:update', update, false);
ta.style.overflowX = 'hidden';
ta.style.wordWrap = 'break-word';
map.set(ta, {
destroy: destroy,
update: update
});
init();
}
function destroy(ta) {
var methods = map.get(ta);
if (methods) {
methods.destroy();
}
}
function update(ta) {
var methods = map.get(ta);
if (methods) {
methods.update();
}
}
var autosize = null;
// Do nothing in Node.js environment and IE8 (or lower)
if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
autosize = function autosize(el) {
return el;
};
autosize.destroy = function (el) {
return el;
};
autosize.update = function (el) {
return el;
};
} else {
autosize = function autosize(el, options) {
if (el) {
Array.prototype.forEach.call(el.length ? el : [el], function (x) {
return assign(x, options);
});
}
return el;
};
autosize.destroy = function (el) {
if (el) {
Array.prototype.forEach.call(el.length ? el : [el], destroy);
}
return el;
};
autosize.update = function (el) {
if (el) {
Array.prototype.forEach.call(el.length ? el : [el], update);
}
return el;
};
}
exports.default = autosize;
module.exports = exports['default'];
});
/***/ }),
/***/ 5755:
/***/ ((module, exports) => {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
var nativeCodeString = '[native code]';
function classNames() {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
if (arg.length) {
var inner = classNames.apply(null, arg);
if (inner) {
classes.push(inner);
}
}
} else if (argType === 'object') {
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
classes.push(arg.toString());
continue;
}
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if ( true && module.exports) {
classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}());
/***/ }),
/***/ 6109:
/***/ ((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
var computedStyle = function (el, prop, getComputedStyle) {
getComputedStyle = window.getComputedStyle;
// In one fell swoop
return (
// If we have getComputedStyle
getComputedStyle ?
// Query it
// TODO: From CSS-Query notes, we might need (node, null) for FF
getComputedStyle(el) :
// Otherwise, we are in IE and use currentStyle
el.currentStyle
)[
// Switch to camelCase for CSSOM
// DEV: Grabbed from jQuery
// https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
// https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
prop.replace(/-(\w)/gi, function (word, letter) {
return letter.toUpperCase();
})
];
};
module.exports = computedStyle;
/***/ }),
/***/ 5417:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/*istanbul ignore start*/
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = Diff;
/*istanbul ignore end*/
function Diff() {}
Diff.prototype = {
/*istanbul ignore start*/
/*istanbul ignore end*/
diff: function diff(oldString, newString) {
/*istanbul ignore start*/
var
/*istanbul ignore end*/
options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var callback = options.callback;
if (typeof options === 'function') {
callback = options;
options = {};
}
this.options = options;
var self = this;
function done(value) {
if (callback) {
setTimeout(function () {
callback(undefined, value);
}, 0);
return true;
} else {
return value;
}
} // Allow subclasses to massage the input prior to running
oldString = this.castInput(oldString);
newString = this.castInput(newString);
oldString = this.removeEmpty(this.tokenize(oldString));
newString = this.removeEmpty(this.tokenize(newString));
var newLen = newString.length,
oldLen = oldString.length;
var editLength = 1;
var maxEditLength = newLen + oldLen;
var bestPath = [{
newPos: -1,
components: []
}]; // Seed editLength = 0, i.e. the content starts with the same values
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
// Identity per the equality and tokenizer
return done([{
value: this.join(newString),
count: newString.length
}]);
} // Main worker method. checks all permutations of a given edit length for acceptance.
function execEditLength() {
for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
var basePath =
/*istanbul ignore start*/
void 0
/*istanbul ignore end*/
;
var addPath = bestPath[diagonalPath - 1],
removePath = bestPath[diagonalPath + 1],
_oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
if (addPath) {
// No one else is going to attempt to use this value, clear it
bestPath[diagonalPath - 1] = undefined;
}
var canAdd = addPath && addPath.newPos + 1 < newLen,
canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
if (!canAdd && !canRemove) {
// If this path is a terminal then prune
bestPath[diagonalPath] = undefined;
continue;
} // Select the diagonal that we want to branch from. We select the prior
// path whose position in the new string is the farthest from the origin
// and does not pass the bounds of the diff graph
if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
basePath = clonePath(removePath);
self.pushComponent(basePath.components, undefined, true);
} else {
basePath = addPath; // No need to clone, we've pulled it from the list
basePath.newPos++;
self.pushComponent(basePath.components, true, undefined);
}
_oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
} else {
// Otherwise track this path as a potential candidate and continue.
bestPath[diagonalPath] = basePath;
}
}
editLength++;
} // Performs the length of edit iteration. Is a bit fugly as this has to support the
// sync and async mode which is never fun. Loops over execEditLength until a value
// is produced.
if (callback) {
(function exec() {
setTimeout(function () {
// This should not happen, but we want to be safe.
/* istanbul ignore next */
if (editLength > maxEditLength) {
return callback();
}
if (!execEditLength()) {
exec();
}
}, 0);
})();
} else {
while (editLength <= maxEditLength) {
var ret = execEditLength();
if (ret) {
return ret;
}
}
}
},
/*istanbul ignore start*/
/*istanbul ignore end*/
pushComponent: function pushComponent(components, added, removed) {
var last = components[components.length - 1];
if (last && last.added === added && last.removed === removed) {
// We need to clone here as the component clone operation is just
// as shallow array clone
components[components.length - 1] = {
count: last.count + 1,
added: added,
removed: removed
};
} else {
components.push({
count: 1,
added: added,
removed: removed
});
}
},
/*istanbul ignore start*/
/*istanbul ignore end*/
extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
var newLen = newString.length,
oldLen = oldString.length,
newPos = basePath.newPos,
oldPos = newPos - diagonalPath,
commonCount = 0;
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
newPos++;
oldPos++;
commonCount++;
}
if (commonCount) {
basePath.components.push({
count: commonCount
});
}
basePath.newPos = newPos;
return oldPos;
},
/*istanbul ignore start*/
/*istanbul ignore end*/
equals: function equals(left, right) {
if (this.options.comparator) {
return this.options.comparator(left, right);
} else {
return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
}
},
/*istanbul ignore start*/
/*istanbul ignore end*/
removeEmpty: function removeEmpty(array) {
var ret = [];
for (var i = 0; i < array.length; i++) {
if (array[i]) {
ret.push(array[i]);
}
}
return ret;
},
/*istanbul ignore start*/
/*istanbul ignore end*/
castInput: function castInput(value) {
return value;
},
/*istanbul ignore start*/
/*istanbul ignore end*/
tokenize: function tokenize(value) {
return value.split('');
},
/*istanbul ignore start*/
/*istanbul ignore end*/
join: function join(chars) {
return chars.join('');
}
};
function buildValues(diff, components, newString, oldString, useLongestToken) {
var componentPos = 0,
componentLen = components.length,
newPos = 0,
oldPos = 0;
for (; componentPos < componentLen; componentPos++) {
var component = components[componentPos];
if (!component.removed) {
if (!component.added && useLongestToken) {
var value = newString.slice(newPos, newPos + component.count);
value = value.map(function (value, i) {
var oldValue = oldString[oldPos + i];
return oldValue.length > value.length ? oldValue : value;
});
component.value = diff.join(value);
} else {
component.value = diff.join(newString.slice(newPos, newPos + component.count));
}
newPos += component.count; // Common case
if (!component.added) {
oldPos += component.count;
}
} else {
component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
oldPos += component.count; // Reverse add and remove so removes are output first to match common convention
// The diffing algorithm is tied to add then remove output and this is the simplest
// route to get the desired output with minimal overhead.
if (componentPos && components[componentPos - 1].added) {
var tmp = components[componentPos - 1];
components[componentPos - 1] = components[componentPos];
components[componentPos] = tmp;
}
}
} // Special case handle for when one terminal is ignored (i.e. whitespace).
// For this case we merge the terminal into the prior string and drop the change.
// This is only available for string mode.
var lastComponent = components[componentLen - 1];
if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
components[componentLen - 2].value += lastComponent.value;
components.pop();
}
return components;
}
function clonePath(path) {
return {
newPos: path.newPos,
components: path.components.slice(0)
};
}
/***/ }),
/***/ 8021:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var __webpack_unused_export__;
/*istanbul ignore start*/
__webpack_unused_export__ = ({
value: true
});
exports.JJ = diffChars;
__webpack_unused_export__ = void 0;
/*istanbul ignore end*/
var
/*istanbul ignore start*/
_base = _interopRequireDefault(__webpack_require__(5417))
/*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);
}
/***/ }),
/***/ 1637:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var util = __webpack_require__(3062);
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;
/***/ }),
/***/ 5428:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
module.exports = __webpack_require__(1637);
/***/ }),
/***/ 3062:
/***/ ((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);
/***/ }),
/***/ 7734:
/***/ ((module) => {
"use strict";
// do not edit .js files directly - edit src/index.jst
var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
module.exports = function equal(a, b) {
if (a === b) return true;
if (a && b && typeof a == 'object' && typeof b == 'object') {
if (a.constructor !== b.constructor) return false;
var length, i, keys;
if (Array.isArray(a)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (!equal(a[i], b[i])) return false;
return true;
}
if ((a instanceof Map) && (b instanceof Map)) {
if (a.size !== b.size) return false;
for (i of a.entries())
if (!b.has(i[0])) return false;
for (i of a.entries())
if (!equal(i[1], b.get(i[0]))) return false;
return true;
}
if ((a instanceof Set) && (b instanceof Set)) {
if (a.size !== b.size) return false;
for (i of a.entries())
if (!b.has(i[0])) return false;
return true;
}
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (a[i] !== b[i]) return false;
return true;
}
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) return false;
for (i = length; i-- !== 0;)
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
for (i = length; i-- !== 0;) {
var key = keys[i];
if (!equal(a[key], b[key])) return false;
}
return true;
}
// true if both NaN, false otherwise
return a!==a && b!==b;
};
/***/ }),
/***/ 5215:
/***/ ((module) => {
"use strict";
// do not edit .js files directly - edit src/index.jst
module.exports = function equal(a, b) {
if (a === b) return true;
if (a && b && typeof a == 'object' && typeof b == 'object') {
if (a.constructor !== b.constructor) return false;
var length, i, keys;
if (Array.isArray(a)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (!equal(a[i], b[i])) return false;
return true;
}
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) return false;
for (i = length; i-- !== 0;)
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
for (i = length; i-- !== 0;) {
var key = keys[i];
if (!equal(a[key], b[key])) return false;
}
return true;
}
// true if both NaN, false otherwise
return a!==a && b!==b;
};
/***/ }),
/***/ 461:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
// Load in dependencies
var computedStyle = __webpack_require__(6109);
/**
* 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;
/***/ }),
/***/ 7520:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
module.exports = __webpack_require__(7191);
/***/ }),
/***/ 8202:
/***/ ((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;
/***/ }),
/***/ 2213:
/***/ ((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;
/***/ }),
/***/ 1087:
/***/ ((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__(8202);
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;
/***/ }),
/***/ 7191:
/***/ ((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__(2213);
var isEventSupported = __webpack_require__(1087);
// 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;
/***/ }),
/***/ 2775:
/***/ ((module) => {
var x=String;
var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x}};
module.exports=create();
module.exports.createColors = create;
/***/ }),
/***/ 4465:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
/***/ }),
/***/ 8036:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
__webpack_require__(4465);
const postcss_1 = __importDefault(__webpack_require__(4529));
const PostCSSPlugin_1 = __importDefault(__webpack_require__(3576));
module.exports = (0, PostCSSPlugin_1.default)(postcss_1.default);
/***/ }),
/***/ 5525:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.prefixWrapCSSSelector = exports.prefixWrapCSSRule = void 0;
const CSSSelector_1 = __webpack_require__(3467);
const prefixWrapCSSRule = (cssRule, nested, ignoredSelectors, prefixSelector, prefixRootTags) => {
// Check each rule to see if it exactly matches our prefix selector, when
// this happens, don't try to prefix that selector.
const rules = cssRule.selector
.split(",")
.filter((selector) => !(0, CSSSelector_1.cssRuleMatchesPrefixSelector)({ selector: selector }, prefixSelector));
if (rules.length === 0) {
return;
}
cssRule.selector = rules
.map((cssSelector) => (0, exports.prefixWrapCSSSelector)(cssSelector, cssRule, nested, ignoredSelectors, prefixSelector, prefixRootTags))
.filter(CSSSelector_1.isValidCSSSelector)
.join(", ");
};
exports.prefixWrapCSSRule = prefixWrapCSSRule;
const prefixWrapCSSSelector = (cssSelector, cssRule, nested, ignoredSelectors, prefixSelector, prefixRootTags) => {
const cleanedSelector = (0, CSSSelector_1.cleanSelector)(cssSelector);
if (cleanedSelector === "") {
return null;
}
// Don't prefix nested selected.
if (nested !== null && cleanedSelector.startsWith(nested, 0)) {
return cleanedSelector;
}
// Do not prefix keyframes rules.
if ((0, CSSSelector_1.isKeyframes)(cssRule)) {
return cleanedSelector;
}
// Check for matching ignored selectors
if (ignoredSelectors.some((currentValue) => cleanedSelector.match(currentValue))) {
return cleanedSelector;
}
// Anything other than a root tag is always prefixed.
if ((0, CSSSelector_1.isNotRootTag)(cleanedSelector)) {
return prefixSelector + " " + cleanedSelector;
}
// Handle special case where root tags should be converted into classes
// rather than being replaced.
if (prefixRootTags) {
return prefixSelector + " ." + cleanedSelector;
}
// HTML and Body elements cannot be contained within our container so lets
// extract their styles.
return cleanedSelector.replace(/^(body|html|:root)/, prefixSelector);
};
exports.prefixWrapCSSSelector = prefixWrapCSSSelector;
/***/ }),
/***/ 3467:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.cssRuleMatchesPrefixSelector = exports.isNotRootTag = exports.isKeyframes = exports.cleanSelector = exports.isValidCSSSelector = void 0;
const ANY_WHITESPACE_AT_BEGINNING_OR_END = /(^\s*|\s*$)/g;
const IS_ROOT_TAG = /^(body|html|:root).*$/;
const isValidCSSSelector = (cssSelector) => {
return cssSelector !== null;
};
exports.isValidCSSSelector = isValidCSSSelector;
const cleanSelector = (cssSelector) => {
return cssSelector.replace(ANY_WHITESPACE_AT_BEGINNING_OR_END, "");
};
exports.cleanSelector = cleanSelector;
const isKeyframes = (cssRule) => {
const { parent } = cssRule;
const parentReal = parent;
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule
return (parent !== undefined &&
parentReal.type === "atrule" &&
parentReal.name !== undefined &&
parentReal.name.match(/keyframes$/) !== null);
};
exports.isKeyframes = isKeyframes;
const isNotRootTag = (cleanSelector) => {
return !cleanSelector.match(IS_ROOT_TAG);
};
exports.isNotRootTag = isNotRootTag;
const cssRuleMatchesPrefixSelector = (cssRule, prefixSelector) => {
const escapedPrefixSelector = prefixSelector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
// eslint-disable-next-line security-node/non-literal-reg-expr
const isPrefixSelector = new RegExp(`^${escapedPrefixSelector}$`);
return isPrefixSelector.test(cssRule.selector);
};
exports.cssRuleMatchesPrefixSelector = cssRuleMatchesPrefixSelector;
/***/ }),
/***/ 9411:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.shouldIncludeFilePath = void 0;
const shouldIncludeFilePath = (filePath, whitelist, blacklist) => {
// If whitelist exists, check if rule is contained within it.
if (whitelist.length > 0) {
return (filePath != undefined &&
whitelist.some((currentValue) => filePath.match(currentValue)));
}
// If blacklist exists, check if rule is not contained within it.
if (blacklist.length > 0) {
return !(filePath != undefined &&
blacklist.some((currentValue) => filePath.match(currentValue)));
}
// In all other cases, presume rule should be prefixed.
return true;
};
exports.shouldIncludeFilePath = shouldIncludeFilePath;
/***/ }),
/***/ 8061:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (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;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.asPostCSSv7PluginGenerator = void 0;
const PostCSSPrefixWrap_1 = __importStar(__webpack_require__(1311));
const asPostCSSv7PluginGenerator = (postcss) => {
return postcss.plugin(PostCSSPrefixWrap_1.PLUGIN_NAME, (prefixSelector, options) => {
return new PostCSSPrefixWrap_1.default(prefixSelector, options).prefix();
});
};
exports.asPostCSSv7PluginGenerator = asPostCSSv7PluginGenerator;
/***/ }),
/***/ 2888:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (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;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.asPostCSSv8PluginGenerator = exports.isPostCSSv8 = void 0;
const PostCSSPrefixWrap_1 = __importStar(__webpack_require__(1311));
const isPostCSSv8 = (postcss) => postcss.Root !== undefined;
exports.isPostCSSv8 = isPostCSSv8;
const asPostCSSv8PluginGenerator = () => {
return (prefixSelector, options) => {
const plugin = new PostCSSPrefixWrap_1.default(prefixSelector, options);
return {
postcssPlugin: PostCSSPrefixWrap_1.PLUGIN_NAME,
Once(root) {
plugin.prefixRoot(root);
},
};
};
};
exports.asPostCSSv8PluginGenerator = asPostCSSv8PluginGenerator;
/***/ }),
/***/ 3576:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
const PostCSS8Plugin_1 = __webpack_require__(2888);
const PostCSS7Plugin_1 = __webpack_require__(8061);
module.exports = (postcss) => {
if ((0, PostCSS8Plugin_1.isPostCSSv8)(postcss)) {
return (0, PostCSS8Plugin_1.asPostCSSv8PluginGenerator)();
}
else {
return (0, PostCSS7Plugin_1.asPostCSSv7PluginGenerator)(postcss);
}
};
/***/ }),
/***/ 1311:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PLUGIN_NAME = void 0;
const CSSRuleWrapper_1 = __webpack_require__(5525);
const FileIncludeList_1 = __webpack_require__(9411);
exports.PLUGIN_NAME = "postcss-prefixwrap";
class PostCSSPrefixWrap {
blacklist;
ignoredSelectors;
isPrefixSelector;
prefixRootTags;
prefixSelector;
whitelist;
nested;
constructor(prefixSelector, options = {}) {
this.blacklist = options.blacklist ?? [];
this.ignoredSelectors = options.ignoredSelectors ?? [];
this.isPrefixSelector = new RegExp(
// eslint-disable-next-line security-node/non-literal-reg-expr
`^${prefixSelector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`);
this.prefixRootTags = options.prefixRootTags ?? false;
this.prefixSelector = prefixSelector;
this.whitelist = options.whitelist ?? [];
this.nested = options.nested ?? null;
}
prefixRoot(css) {
if ((0, FileIncludeList_1.shouldIncludeFilePath)(css.source?.input?.file, this.whitelist, this.blacklist)) {
css.walkRules((cssRule) => {
(0, CSSRuleWrapper_1.prefixWrapCSSRule)(cssRule, this.nested, this.ignoredSelectors, this.prefixSelector, this.prefixRootTags);
});
}
}
prefix() {
return (css) => {
this.prefixRoot(css);
};
}
}
exports["default"] = PostCSSPrefixWrap;
/***/ }),
/***/ 5404:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
const CSSValueParser = __webpack_require__(1544)
/**
* @type {import('postcss').PluginCreator}
*/
module.exports = (opts) => {
const DEFAULTS = {
skipHostRelativeUrls: true,
}
const config = Object.assign(DEFAULTS, opts)
return {
postcssPlugin: 'rebaseUrl',
Declaration(decl) {
// The faster way to find Declaration node
const parsedValue = CSSValueParser(decl.value)
let valueChanged = false
parsedValue.walk(node => {
if (node.type !== 'function' || node.value !== 'url') {
return
}
const urlVal = node.nodes[0].value
// bases relative URLs with rootUrl
const basedUrl = new URL(urlVal, opts.rootUrl)
// skip host-relative, already normalized URLs (e.g. `/images/image.jpg`, without `..`s)
if ((basedUrl.pathname === urlVal) && config.skipHostRelativeUrls) {
return false // skip this value
}
node.nodes[0].value = basedUrl.toString()
valueChanged = true
return false // do not walk deeper
})
if (valueChanged) {
decl.value = CSSValueParser.stringify(parsedValue)
}
}
}
}
module.exports.postcss = true
/***/ }),
/***/ 1544:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var parse = __webpack_require__(8491);
var walk = __webpack_require__(3815);
var stringify = __webpack_require__(4725);
function ValueParser(value) {
if (this instanceof ValueParser) {
this.nodes = parse(value);
return this;
}
return new ValueParser(value);
}
ValueParser.prototype.toString = function() {
return Array.isArray(this.nodes) ? stringify(this.nodes) : "";
};
ValueParser.prototype.walk = function(cb, bubble) {
walk(this.nodes, cb, bubble);
return this;
};
ValueParser.unit = __webpack_require__(1524);
ValueParser.walk = walk;
ValueParser.stringify = stringify;
module.exports = ValueParser;
/***/ }),
/***/ 8491:
/***/ ((module) => {
var openParentheses = "(".charCodeAt(0);
var closeParentheses = ")".charCodeAt(0);
var singleQuote = "'".charCodeAt(0);
var doubleQuote = '"'.charCodeAt(0);
var backslash = "\\".charCodeAt(0);
var slash = "/".charCodeAt(0);
var comma = ",".charCodeAt(0);
var colon = ":".charCodeAt(0);
var star = "*".charCodeAt(0);
var uLower = "u".charCodeAt(0);
var uUpper = "U".charCodeAt(0);
var plus = "+".charCodeAt(0);
var isUnicodeRange = /^[a-f0-9?-]+$/i;
module.exports = function(input) {
var tokens = [];
var value = input;
var next,
quote,
prev,
token,
escape,
escapePos,
whitespacePos,
parenthesesOpenPos;
var pos = 0;
var code = value.charCodeAt(pos);
var max = value.length;
var stack = [{ nodes: tokens }];
var balanced = 0;
var parent;
var name = "";
var before = "";
var after = "";
while (pos < max) {
// Whitespaces
if (code <= 32) {
next = pos;
do {
next += 1;
code = value.charCodeAt(next);
} while (code <= 32);
token = value.slice(pos, next);
prev = tokens[tokens.length - 1];
if (code === closeParentheses && balanced) {
after = token;
} else if (prev && prev.type === "div") {
prev.after = token;
prev.sourceEndIndex += token.length;
} else if (
code === comma ||
code === colon ||
(code === slash &&
value.charCodeAt(next + 1) !== star &&
(!parent ||
(parent && parent.type === "function" && parent.value !== "calc")))
) {
before = token;
} else {
tokens.push({
type: "space",
sourceIndex: pos,
sourceEndIndex: next,
value: token
});
}
pos = next;
// Quotes
} else if (code === singleQuote || code === doubleQuote) {
next = pos;
quote = code === singleQuote ? "'" : '"';
token = {
type: "string",
sourceIndex: pos,
quote: quote
};
do {
escape = false;
next = value.indexOf(quote, next + 1);
if (~next) {
escapePos = next;
while (value.charCodeAt(escapePos - 1) === backslash) {
escapePos -= 1;
escape = !escape;
}
} else {
value += quote;
next = value.length - 1;
token.unclosed = true;
}
} while (escape);
token.value = value.slice(pos + 1, next);
token.sourceEndIndex = token.unclosed ? next : next + 1;
tokens.push(token);
pos = next + 1;
code = value.charCodeAt(pos);
// Comments
} else if (code === slash && value.charCodeAt(pos + 1) === star) {
next = value.indexOf("*/", pos);
token = {
type: "comment",
sourceIndex: pos,
sourceEndIndex: next + 2
};
if (next === -1) {
token.unclosed = true;
next = value.length;
token.sourceEndIndex = next;
}
token.value = value.slice(pos + 2, next);
tokens.push(token);
pos = next + 2;
code = value.charCodeAt(pos);
// Operation within calc
} else if (
(code === slash || code === star) &&
parent &&
parent.type === "function" &&
parent.value === "calc"
) {
token = value[pos];
tokens.push({
type: "word",
sourceIndex: pos - before.length,
sourceEndIndex: pos + token.length,
value: token
});
pos += 1;
code = value.charCodeAt(pos);
// Dividers
} else if (code === slash || code === comma || code === colon) {
token = value[pos];
tokens.push({
type: "div",
sourceIndex: pos - before.length,
sourceEndIndex: pos + token.length,
value: token,
before: before,
after: ""
});
before = "";
pos += 1;
code = value.charCodeAt(pos);
// Open parentheses
} else if (openParentheses === code) {
// Whitespaces after open parentheses
next = pos;
do {
next += 1;
code = value.charCodeAt(next);
} while (code <= 32);
parenthesesOpenPos = pos;
token = {
type: "function",
sourceIndex: pos - name.length,
value: name,
before: value.slice(parenthesesOpenPos + 1, next)
};
pos = next;
if (name === "url" && code !== singleQuote && code !== doubleQuote) {
next -= 1;
do {
escape = false;
next = value.indexOf(")", next + 1);
if (~next) {
escapePos = next;
while (value.charCodeAt(escapePos - 1) === backslash) {
escapePos -= 1;
escape = !escape;
}
} else {
value += ")";
next = value.length - 1;
token.unclosed = true;
}
} while (escape);
// Whitespaces before closed
whitespacePos = next;
do {
whitespacePos -= 1;
code = value.charCodeAt(whitespacePos);
} while (code <= 32);
if (parenthesesOpenPos < whitespacePos) {
if (pos !== whitespacePos + 1) {
token.nodes = [
{
type: "word",
sourceIndex: pos,
sourceEndIndex: whitespacePos + 1,
value: value.slice(pos, whitespacePos + 1)
}
];
} else {
token.nodes = [];
}
if (token.unclosed && whitespacePos + 1 !== next) {
token.after = "";
token.nodes.push({
type: "space",
sourceIndex: whitespacePos + 1,
sourceEndIndex: next,
value: value.slice(whitespacePos + 1, next)
});
} else {
token.after = value.slice(whitespacePos + 1, next);
token.sourceEndIndex = next;
}
} else {
token.after = "";
token.nodes = [];
}
pos = next + 1;
token.sourceEndIndex = token.unclosed ? next : pos;
code = value.charCodeAt(pos);
tokens.push(token);
} else {
balanced += 1;
token.after = "";
token.sourceEndIndex = pos + 1;
tokens.push(token);
stack.push(token);
tokens = token.nodes = [];
parent = token;
}
name = "";
// Close parentheses
} else if (closeParentheses === code && balanced) {
pos += 1;
code = value.charCodeAt(pos);
parent.after = after;
parent.sourceEndIndex += after.length;
after = "";
balanced -= 1;
stack[stack.length - 1].sourceEndIndex = pos;
stack.pop();
parent = stack[balanced];
tokens = parent.nodes;
// Words
} else {
next = pos;
do {
if (code === backslash) {
next += 1;
}
next += 1;
code = value.charCodeAt(next);
} while (
next < max &&
!(
code <= 32 ||
code === singleQuote ||
code === doubleQuote ||
code === comma ||
code === colon ||
code === slash ||
code === openParentheses ||
(code === star &&
parent &&
parent.type === "function" &&
parent.value === "calc") ||
(code === slash &&
parent.type === "function" &&
parent.value === "calc") ||
(code === closeParentheses && balanced)
)
);
token = value.slice(pos, next);
if (openParentheses === code) {
name = token;
} else if (
(uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) &&
plus === token.charCodeAt(1) &&
isUnicodeRange.test(token.slice(2))
) {
tokens.push({
type: "unicode-range",
sourceIndex: pos,
sourceEndIndex: next,
value: token
});
} else {
tokens.push({
type: "word",
sourceIndex: pos,
sourceEndIndex: next,
value: token
});
}
pos = next;
}
}
for (pos = stack.length - 1; pos; pos -= 1) {
stack[pos].unclosed = true;
stack[pos].sourceEndIndex = value.length;
}
return stack[0].nodes;
};
/***/ }),
/***/ 4725:
/***/ ((module) => {
function stringifyNode(node, custom) {
var type = node.type;
var value = node.value;
var buf;
var customResult;
if (custom && (customResult = custom(node)) !== undefined) {
return customResult;
} else if (type === "word" || type === "space") {
return value;
} else if (type === "string") {
buf = node.quote || "";
return buf + value + (node.unclosed ? "" : buf);
} else if (type === "comment") {
return "/*" + value + (node.unclosed ? "" : "*/");
} else if (type === "div") {
return (node.before || "") + value + (node.after || "");
} else if (Array.isArray(node.nodes)) {
buf = stringify(node.nodes, custom);
if (type !== "function") {
return buf;
}
return (
value +
"(" +
(node.before || "") +
buf +
(node.after || "") +
(node.unclosed ? "" : ")")
);
}
return value;
}
function stringify(nodes, custom) {
var result, i;
if (Array.isArray(nodes)) {
result = "";
for (i = nodes.length - 1; ~i; i -= 1) {
result = stringifyNode(nodes[i], custom) + result;
}
return result;
}
return stringifyNode(nodes, custom);
}
module.exports = stringify;
/***/ }),
/***/ 1524:
/***/ ((module) => {
var minus = "-".charCodeAt(0);
var plus = "+".charCodeAt(0);
var dot = ".".charCodeAt(0);
var exp = "e".charCodeAt(0);
var EXP = "E".charCodeAt(0);
// Check if three code points would start a number
// https://www.w3.org/TR/css-syntax-3/#starts-with-a-number
function likeNumber(value) {
var code = value.charCodeAt(0);
var nextCode;
if (code === plus || code === minus) {
nextCode = value.charCodeAt(1);
if (nextCode >= 48 && nextCode <= 57) {
return true;
}
var nextNextCode = value.charCodeAt(2);
if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) {
return true;
}
return false;
}
if (code === dot) {
nextCode = value.charCodeAt(1);
if (nextCode >= 48 && nextCode <= 57) {
return true;
}
return false;
}
if (code >= 48 && code <= 57) {
return true;
}
return false;
}
// Consume a number
// https://www.w3.org/TR/css-syntax-3/#consume-number
module.exports = function(value) {
var pos = 0;
var length = value.length;
var code;
var nextCode;
var nextNextCode;
if (length === 0 || !likeNumber(value)) {
return false;
}
code = value.charCodeAt(pos);
if (code === plus || code === minus) {
pos++;
}
while (pos < length) {
code = value.charCodeAt(pos);
if (code < 48 || code > 57) {
break;
}
pos += 1;
}
code = value.charCodeAt(pos);
nextCode = value.charCodeAt(pos + 1);
if (code === dot && nextCode >= 48 && nextCode <= 57) {
pos += 2;
while (pos < length) {
code = value.charCodeAt(pos);
if (code < 48 || code > 57) {
break;
}
pos += 1;
}
}
code = value.charCodeAt(pos);
nextCode = value.charCodeAt(pos + 1);
nextNextCode = value.charCodeAt(pos + 2);
if (
(code === exp || code === EXP) &&
((nextCode >= 48 && nextCode <= 57) ||
((nextCode === plus || nextCode === minus) &&
nextNextCode >= 48 &&
nextNextCode <= 57))
) {
pos += nextCode === plus || nextCode === minus ? 3 : 2;
while (pos < length) {
code = value.charCodeAt(pos);
if (code < 48 || code > 57) {
break;
}
pos += 1;
}
}
return {
number: value.slice(0, pos),
unit: value.slice(pos)
};
};
/***/ }),
/***/ 3815:
/***/ ((module) => {
module.exports = function walk(nodes, cb, bubble) {
var i, max, node, result;
for (i = 0, max = nodes.length; i < max; i += 1) {
node = nodes[i];
if (!bubble) {
result = cb(node, i, nodes);
}
if (
result !== false &&
node.type === "function" &&
Array.isArray(node.nodes)
) {
walk(node.nodes, cb, bubble);
}
if (bubble) {
cb(node, i, nodes);
}
}
};
/***/ }),
/***/ 1326:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let Container = __webpack_require__(683)
class AtRule extends Container {
constructor(defaults) {
super(defaults)
this.type = 'atrule'
}
append(...children) {
if (!this.proxyOf.nodes) this.nodes = []
return super.append(...children)
}
prepend(...children) {
if (!this.proxyOf.nodes) this.nodes = []
return super.prepend(...children)
}
}
module.exports = AtRule
AtRule.default = AtRule
Container.registerAtRule(AtRule)
/***/ }),
/***/ 6589:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let Node = __webpack_require__(7490)
class Comment extends Node {
constructor(defaults) {
super(defaults)
this.type = 'comment'
}
}
module.exports = Comment
Comment.default = Comment
/***/ }),
/***/ 683:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let { isClean, my } = __webpack_require__(1381)
let Declaration = __webpack_require__(1516)
let Comment = __webpack_require__(6589)
let Node = __webpack_require__(7490)
let parse, Rule, AtRule, Root
function cleanSource(nodes) {
return nodes.map(i => {
if (i.nodes) i.nodes = cleanSource(i.nodes)
delete i.source
return i
})
}
function markDirtyUp(node) {
node[isClean] = false
if (node.proxyOf.nodes) {
for (let i of node.proxyOf.nodes) {
markDirtyUp(i)
}
}
}
class Container extends Node {
append(...children) {
for (let child of children) {
let nodes = this.normalize(child, this.last)
for (let node of nodes) this.proxyOf.nodes.push(node)
}
this.markDirty()
return this
}
cleanRaws(keepBetween) {
super.cleanRaws(keepBetween)
if (this.nodes) {
for (let node of this.nodes) node.cleanRaws(keepBetween)
}
}
each(callback) {
if (!this.proxyOf.nodes) return undefined
let iterator = this.getIterator()
let index, result
while (this.indexes[iterator] < this.proxyOf.nodes.length) {
index = this.indexes[iterator]
result = callback(this.proxyOf.nodes[index], index)
if (result === false) break
this.indexes[iterator] += 1
}
delete this.indexes[iterator]
return result
}
every(condition) {
return this.nodes.every(condition)
}
getIterator() {
if (!this.lastEach) this.lastEach = 0
if (!this.indexes) this.indexes = {}
this.lastEach += 1
let iterator = this.lastEach
this.indexes[iterator] = 0
return iterator
}
getProxyProcessor() {
return {
get(node, prop) {
if (prop === 'proxyOf') {
return node
} else if (!node[prop]) {
return node[prop]
} else if (
prop === 'each' ||
(typeof prop === 'string' && prop.startsWith('walk'))
) {
return (...args) => {
return node[prop](
...args.map(i => {
if (typeof i === 'function') {
return (child, index) => i(child.toProxy(), index)
} else {
return i
}
})
)
}
} else if (prop === 'every' || prop === 'some') {
return cb => {
return node[prop]((child, ...other) =>
cb(child.toProxy(), ...other)
)
}
} else if (prop === 'root') {
return () => node.root().toProxy()
} else if (prop === 'nodes') {
return node.nodes.map(i => i.toProxy())
} else if (prop === 'first' || prop === 'last') {
return node[prop].toProxy()
} else {
return node[prop]
}
},
set(node, prop, value) {
if (node[prop] === value) return true
node[prop] = value
if (prop === 'name' || prop === 'params' || prop === 'selector') {
node.markDirty()
}
return true
}
}
}
index(child) {
if (typeof child === 'number') return child
if (child.proxyOf) child = child.proxyOf
return this.proxyOf.nodes.indexOf(child)
}
insertAfter(exist, add) {
let existIndex = this.index(exist)
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse()
existIndex = this.index(exist)
for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node)
let index
for (let id in this.indexes) {
index = this.indexes[id]
if (existIndex < index) {
this.indexes[id] = index + nodes.length
}
}
this.markDirty()
return this
}
insertBefore(exist, add) {
let existIndex = this.index(exist)
let type = existIndex === 0 ? 'prepend' : false
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse()
existIndex = this.index(exist)
for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node)
let index
for (let id in this.indexes) {
index = this.indexes[id]
if (existIndex <= index) {
this.indexes[id] = index + nodes.length
}
}
this.markDirty()
return this
}
normalize(nodes, sample) {
if (typeof nodes === 'string') {
nodes = cleanSource(parse(nodes).nodes)
} else if (typeof nodes === 'undefined') {
nodes = []
} else if (Array.isArray(nodes)) {
nodes = nodes.slice(0)
for (let i of nodes) {
if (i.parent) i.parent.removeChild(i, 'ignore')
}
} else if (nodes.type === 'root' && this.type !== 'document') {
nodes = nodes.nodes.slice(0)
for (let i of nodes) {
if (i.parent) i.parent.removeChild(i, 'ignore')
}
} else if (nodes.type) {
nodes = [nodes]
} else if (nodes.prop) {
if (typeof nodes.value === 'undefined') {
throw new Error('Value field is missed in node creation')
} else if (typeof nodes.value !== 'string') {
nodes.value = String(nodes.value)
}
nodes = [new Declaration(nodes)]
} else if (nodes.selector) {
nodes = [new Rule(nodes)]
} else if (nodes.name) {
nodes = [new AtRule(nodes)]
} else if (nodes.text) {
nodes = [new Comment(nodes)]
} else {
throw new Error('Unknown node type in node creation')
}
let processed = nodes.map(i => {
/* c8 ignore next */
if (!i[my]) Container.rebuild(i)
i = i.proxyOf
if (i.parent) i.parent.removeChild(i)
if (i[isClean]) markDirtyUp(i)
if (typeof i.raws.before === 'undefined') {
if (sample && typeof sample.raws.before !== 'undefined') {
i.raws.before = sample.raws.before.replace(/\S/g, '')
}
}
i.parent = this.proxyOf
return i
})
return processed
}
prepend(...children) {
children = children.reverse()
for (let child of children) {
let nodes = this.normalize(child, this.first, 'prepend').reverse()
for (let node of nodes) this.proxyOf.nodes.unshift(node)
for (let id in this.indexes) {
this.indexes[id] = this.indexes[id] + nodes.length
}
}
this.markDirty()
return this
}
push(child) {
child.parent = this
this.proxyOf.nodes.push(child)
return this
}
removeAll() {
for (let node of this.proxyOf.nodes) node.parent = undefined
this.proxyOf.nodes = []
this.markDirty()
return this
}
removeChild(child) {
child = this.index(child)
this.proxyOf.nodes[child].parent = undefined
this.proxyOf.nodes.splice(child, 1)
let index
for (let id in this.indexes) {
index = this.indexes[id]
if (index >= child) {
this.indexes[id] = index - 1
}
}
this.markDirty()
return this
}
replaceValues(pattern, opts, callback) {
if (!callback) {
callback = opts
opts = {}
}
this.walkDecls(decl => {
if (opts.props && !opts.props.includes(decl.prop)) return
if (opts.fast && !decl.value.includes(opts.fast)) return
decl.value = decl.value.replace(pattern, callback)
})
this.markDirty()
return this
}
some(condition) {
return this.nodes.some(condition)
}
walk(callback) {
return this.each((child, i) => {
let result
try {
result = callback(child, i)
} catch (e) {
throw child.addToError(e)
}
if (result !== false && child.walk) {
result = child.walk(callback)
}
return result
})
}
walkAtRules(name, callback) {
if (!callback) {
callback = name
return this.walk((child, i) => {
if (child.type === 'atrule') {
return callback(child, i)
}
})
}
if (name instanceof RegExp) {
return this.walk((child, i) => {
if (child.type === 'atrule' && name.test(child.name)) {
return callback(child, i)
}
})
}
return this.walk((child, i) => {
if (child.type === 'atrule' && child.name === name) {
return callback(child, i)
}
})
}
walkComments(callback) {
return this.walk((child, i) => {
if (child.type === 'comment') {
return callback(child, i)
}
})
}
walkDecls(prop, callback) {
if (!callback) {
callback = prop
return this.walk((child, i) => {
if (child.type === 'decl') {
return callback(child, i)
}
})
}
if (prop instanceof RegExp) {
return this.walk((child, i) => {
if (child.type === 'decl' && prop.test(child.prop)) {
return callback(child, i)
}
})
}
return this.walk((child, i) => {
if (child.type === 'decl' && child.prop === prop) {
return callback(child, i)
}
})
}
walkRules(selector, callback) {
if (!callback) {
callback = selector
return this.walk((child, i) => {
if (child.type === 'rule') {
return callback(child, i)
}
})
}
if (selector instanceof RegExp) {
return this.walk((child, i) => {
if (child.type === 'rule' && selector.test(child.selector)) {
return callback(child, i)
}
})
}
return this.walk((child, i) => {
if (child.type === 'rule' && child.selector === selector) {
return callback(child, i)
}
})
}
get first() {
if (!this.proxyOf.nodes) return undefined
return this.proxyOf.nodes[0]
}
get last() {
if (!this.proxyOf.nodes) return undefined
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]
}
}
Container.registerParse = dependant => {
parse = dependant
}
Container.registerRule = dependant => {
Rule = dependant
}
Container.registerAtRule = dependant => {
AtRule = dependant
}
Container.registerRoot = dependant => {
Root = dependant
}
module.exports = Container
Container.default = Container
/* c8 ignore start */
Container.rebuild = node => {
if (node.type === 'atrule') {
Object.setPrototypeOf(node, AtRule.prototype)
} else if (node.type === 'rule') {
Object.setPrototypeOf(node, Rule.prototype)
} else if (node.type === 'decl') {
Object.setPrototypeOf(node, Declaration.prototype)
} else if (node.type === 'comment') {
Object.setPrototypeOf(node, Comment.prototype)
} else if (node.type === 'root') {
Object.setPrototypeOf(node, Root.prototype)
}
node[my] = true
if (node.nodes) {
node.nodes.forEach(child => {
Container.rebuild(child)
})
}
}
/* c8 ignore stop */
/***/ }),
/***/ 356:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let pico = __webpack_require__(2775)
let terminalHighlight = __webpack_require__(9746)
class CssSyntaxError extends Error {
constructor(message, line, column, source, file, plugin) {
super(message)
this.name = 'CssSyntaxError'
this.reason = message
if (file) {
this.file = file
}
if (source) {
this.source = source
}
if (plugin) {
this.plugin = plugin
}
if (typeof line !== 'undefined' && typeof column !== 'undefined') {
if (typeof line === 'number') {
this.line = line
this.column = column
} else {
this.line = line.line
this.column = line.column
this.endLine = column.line
this.endColumn = column.column
}
}
this.setMessage()
if (Error.captureStackTrace) {
Error.captureStackTrace(this, CssSyntaxError)
}
}
setMessage() {
this.message = this.plugin ? this.plugin + ': ' : ''
this.message += this.file ? this.file : '<css input>'
if (typeof this.line !== 'undefined') {
this.message += ':' + this.line + ':' + this.column
}
this.message += ': ' + this.reason
}
showSourceCode(color) {
if (!this.source) return ''
let css = this.source
if (color == null) color = pico.isColorSupported
if (terminalHighlight) {
if (color) css = terminalHighlight(css)
}
let lines = css.split(/\r?\n/)
let start = Math.max(this.line - 3, 0)
let end = Math.min(this.line + 2, lines.length)
let maxWidth = String(end).length
let mark, aside
if (color) {
let { bold, gray, red } = pico.createColors(true)
mark = text => bold(red(text))
aside = text => gray(text)
} else {
mark = aside = str => str
}
return lines
.slice(start, end)
.map((line, index) => {
let number = start + 1 + index
let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | '
if (number === this.line) {
let spacing =
aside(gutter.replace(/\d/g, ' ')) +
line.slice(0, this.column - 1).replace(/[^\t]/g, ' ')
return mark('>') + aside(gutter) + line + '\n ' + spacing + mark('^')
}
return ' ' + aside(gutter) + line
})
.join('\n')
}
toString() {
let code = this.showSourceCode()
if (code) {
code = '\n\n' + code + '\n'
}
return this.name + ': ' + this.message + code
}
}
module.exports = CssSyntaxError
CssSyntaxError.default = CssSyntaxError
/***/ }),
/***/ 1516:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let Node = __webpack_require__(7490)
class Declaration extends Node {
constructor(defaults) {
if (
defaults &&
typeof defaults.value !== 'undefined' &&
typeof defaults.value !== 'string'
) {
defaults = { ...defaults, value: String(defaults.value) }
}
super(defaults)
this.type = 'decl'
}
get variable() {
return this.prop.startsWith('--') || this.prop[0] === '$'
}
}
module.exports = Declaration
Declaration.default = Declaration
/***/ }),
/***/ 271:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let Container = __webpack_require__(683)
let LazyResult, Processor
class Document extends Container {
constructor(defaults) {
// type needs to be passed to super, otherwise child roots won't be normalized correctly
super({ type: 'document', ...defaults })
if (!this.nodes) {
this.nodes = []
}
}
toResult(opts = {}) {
let lazy = new LazyResult(new Processor(), this, opts)
return lazy.stringify()
}
}
Document.registerLazyResult = dependant => {
LazyResult = dependant
}
Document.registerProcessor = dependant => {
Processor = dependant
}
module.exports = Document
Document.default = Document
/***/ }),
/***/ 8940:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let Declaration = __webpack_require__(1516)
let PreviousMap = __webpack_require__(5696)
let Comment = __webpack_require__(6589)
let AtRule = __webpack_require__(1326)
let Input = __webpack_require__(5380)
let Root = __webpack_require__(9434)
let Rule = __webpack_require__(4092)
function fromJSON(json, inputs) {
if (Array.isArray(json)) return json.map(n => fromJSON(n))
let { inputs: ownInputs, ...defaults } = json
if (ownInputs) {
inputs = []
for (let input of ownInputs) {
let inputHydrated = { ...input, __proto__: Input.prototype }
if (inputHydrated.map) {
inputHydrated.map = {
...inputHydrated.map,
__proto__: PreviousMap.prototype
}
}
inputs.push(inputHydrated)
}
}
if (defaults.nodes) {
defaults.nodes = json.nodes.map(n => fromJSON(n, inputs))
}
if (defaults.source) {
let { inputId, ...source } = defaults.source
defaults.source = source
if (inputId != null) {
defaults.source.input = inputs[inputId]
}
}
if (defaults.type === 'root') {
return new Root(defaults)
} else if (defaults.type === 'decl') {
return new Declaration(defaults)
} else if (defaults.type === 'rule') {
return new Rule(defaults)
} else if (defaults.type === 'comment') {
return new Comment(defaults)
} else if (defaults.type === 'atrule') {
return new AtRule(defaults)
} else {
throw new Error('Unknown node type: ' + json.type)
}
}
module.exports = fromJSON
fromJSON.default = fromJSON
/***/ }),
/***/ 5380:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866)
let { fileURLToPath, pathToFileURL } = __webpack_require__(2739)
let { isAbsolute, resolve } = __webpack_require__(197)
let { nanoid } = __webpack_require__(5042)
let terminalHighlight = __webpack_require__(9746)
let CssSyntaxError = __webpack_require__(356)
let PreviousMap = __webpack_require__(5696)
let fromOffsetCache = Symbol('fromOffsetCache')
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator)
let pathAvailable = Boolean(resolve && isAbsolute)
class Input {
constructor(css, opts = {}) {
if (
css === null ||
typeof css === 'undefined' ||
(typeof css === 'object' && !css.toString)
) {
throw new Error(`PostCSS received ${css} instead of CSS string`)
}
this.css = css.toString()
if (this.css[0] === '\uFEFF' || this.css[0] === '\uFFFE') {
this.hasBOM = true
this.css = this.css.slice(1)
} else {
this.hasBOM = false
}
if (opts.from) {
if (
!pathAvailable ||
/^\w+:\/\//.test(opts.from) ||
isAbsolute(opts.from)
) {
this.file = opts.from
} else {
this.file = resolve(opts.from)
}
}
if (pathAvailable && sourceMapAvailable) {
let map = new PreviousMap(this.css, opts)
if (map.text) {
this.map = map
let file = map.consumer().file
if (!this.file && file) this.file = this.mapResolve(file)
}
}
if (!this.file) {
this.id = '<input css ' + nanoid(6) + '>'
}
if (this.map) this.map.file = this.from
}
error(message, line, column, opts = {}) {
let result, endLine, endColumn
if (line && typeof line === 'object') {
let start = line
let end = column
if (typeof start.offset === 'number') {
let pos = this.fromOffset(start.offset)
line = pos.line
column = pos.col
} else {
line = start.line
column = start.column
}
if (typeof end.offset === 'number') {
let pos = this.fromOffset(end.offset)
endLine = pos.line
endColumn = pos.col
} else {
endLine = end.line
endColumn = end.column
}
} else if (!column) {
let pos = this.fromOffset(line)
line = pos.line
column = pos.col
}
let origin = this.origin(line, column, endLine, endColumn)
if (origin) {
result = new CssSyntaxError(
message,
origin.endLine === undefined
? origin.line
: { column: origin.column, line: origin.line },
origin.endLine === undefined
? origin.column
: { column: origin.endColumn, line: origin.endLine },
origin.source,
origin.file,
opts.plugin
)
} else {
result = new CssSyntaxError(
message,
endLine === undefined ? line : { column, line },
endLine === undefined ? column : { column: endColumn, line: endLine },
this.css,
this.file,
opts.plugin
)
}
result.input = { column, endColumn, endLine, line, source: this.css }
if (this.file) {
if (pathToFileURL) {
result.input.url = pathToFileURL(this.file).toString()
}
result.input.file = this.file
}
return result
}
fromOffset(offset) {
let lastLine, lineToIndex
if (!this[fromOffsetCache]) {
let lines = this.css.split('\n')
lineToIndex = new Array(lines.length)
let prevIndex = 0
for (let i = 0, l = lines.length; i < l; i++) {
lineToIndex[i] = prevIndex
prevIndex += lines[i].length + 1
}
this[fromOffsetCache] = lineToIndex
} else {
lineToIndex = this[fromOffsetCache]
}
lastLine = lineToIndex[lineToIndex.length - 1]
let min = 0
if (offset >= lastLine) {
min = lineToIndex.length - 1
} else {
let max = lineToIndex.length - 2
let mid
while (min < max) {
mid = min + ((max - min) >> 1)
if (offset < lineToIndex[mid]) {
max = mid - 1
} else if (offset >= lineToIndex[mid + 1]) {
min = mid + 1
} else {
min = mid
break
}
}
}
return {
col: offset - lineToIndex[min] + 1,
line: min + 1
}
}
mapResolve(file) {
if (/^\w+:\/\//.test(file)) {
return file
}
return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file)
}
origin(line, column, endLine, endColumn) {
if (!this.map) return false
let consumer = this.map.consumer()
let from = consumer.originalPositionFor({ column, line })
if (!from.source) return false
let to
if (typeof endLine === 'number') {
to = consumer.originalPositionFor({ column: endColumn, line: endLine })
}
let fromUrl
if (isAbsolute(from.source)) {
fromUrl = pathToFileURL(from.source)
} else {
fromUrl = new URL(
from.source,
this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile)
)
}
let result = {
column: from.column,
endColumn: to && to.column,
endLine: to && to.line,
line: from.line,
url: fromUrl.toString()
}
if (fromUrl.protocol === 'file:') {
if (fileURLToPath) {
result.file = fileURLToPath(fromUrl)
} else {
/* c8 ignore next 2 */
throw new Error(`file: protocol is not available in this PostCSS build`)
}
}
let source = consumer.sourceContentFor(from.source)
if (source) result.source = source
return result
}
toJSON() {
let json = {}
for (let name of ['hasBOM', 'css', 'file', 'id']) {
if (this[name] != null) {
json[name] = this[name]
}
}
if (this.map) {
json.map = { ...this.map }
if (json.map.consumerCache) {
json.map.consumerCache = undefined
}
}
return json
}
get from() {
return this.file || this.id
}
}
module.exports = Input
Input.default = Input
if (terminalHighlight && terminalHighlight.registerInput) {
terminalHighlight.registerInput(Input)
}
/***/ }),
/***/ 448:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let { isClean, my } = __webpack_require__(1381)
let MapGenerator = __webpack_require__(1670)
let stringify = __webpack_require__(633)
let Container = __webpack_require__(683)
let Document = __webpack_require__(271)
let warnOnce = __webpack_require__(3122)
let Result = __webpack_require__(9055)
let parse = __webpack_require__(4295)
let Root = __webpack_require__(9434)
const TYPE_TO_CLASS_NAME = {
atrule: 'AtRule',
comment: 'Comment',
decl: 'Declaration',
document: 'Document',
root: 'Root',
rule: 'Rule'
}
const PLUGIN_PROPS = {
AtRule: true,
AtRuleExit: true,
Comment: true,
CommentExit: true,
Declaration: true,
DeclarationExit: true,
Document: true,
DocumentExit: true,
Once: true,
OnceExit: true,
postcssPlugin: true,
prepare: true,
Root: true,
RootExit: true,
Rule: true,
RuleExit: true
}
const NOT_VISITORS = {
Once: true,
postcssPlugin: true,
prepare: true
}
const CHILDREN = 0
function isPromise(obj) {
return typeof obj === 'object' && typeof obj.then === 'function'
}
function getEvents(node) {
let key = false
let type = TYPE_TO_CLASS_NAME[node.type]
if (node.type === 'decl') {
key = node.prop.toLowerCase()
} else if (node.type === 'atrule') {
key = node.name.toLowerCase()
}
if (key && node.append) {
return [
type,
type + '-' + key,
CHILDREN,
type + 'Exit',
type + 'Exit-' + key
]
} else if (key) {
return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key]
} else if (node.append) {
return [type, CHILDREN, type + 'Exit']
} else {
return [type, type + 'Exit']
}
}
function toStack(node) {
let events
if (node.type === 'document') {
events = ['Document', CHILDREN, 'DocumentExit']
} else if (node.type === 'root') {
events = ['Root', CHILDREN, 'RootExit']
} else {
events = getEvents(node)
}
return {
eventIndex: 0,
events,
iterator: 0,
node,
visitorIndex: 0,
visitors: []
}
}
function cleanMarks(node) {
node[isClean] = false
if (node.nodes) node.nodes.forEach(i => cleanMarks(i))
return node
}
let postcss = {}
class LazyResult {
constructor(processor, css, opts) {
this.stringified = false
this.processed = false
let root
if (
typeof css === 'object' &&
css !== null &&
(css.type === 'root' || css.type === 'document')
) {
root = cleanMarks(css)
} else if (css instanceof LazyResult || css instanceof Result) {
root = cleanMarks(css.root)
if (css.map) {
if (typeof opts.map === 'undefined') opts.map = {}
if (!opts.map.inline) opts.map.inline = false
opts.map.prev = css.map
}
} else {
let parser = parse
if (opts.syntax) parser = opts.syntax.parse
if (opts.parser) parser = opts.parser
if (parser.parse) parser = parser.parse
try {
root = parser(css, opts)
} catch (error) {
this.processed = true
this.error = error
}
if (root && !root[my]) {
/* c8 ignore next 2 */
Container.rebuild(root)
}
}
this.result = new Result(processor, root, opts)
this.helpers = { ...postcss, postcss, result: this.result }
this.plugins = this.processor.plugins.map(plugin => {
if (typeof plugin === 'object' && plugin.prepare) {
return { ...plugin, ...plugin.prepare(this.result) }
} else {
return plugin
}
})
}
async() {
if (this.error) return Promise.reject(this.error)
if (this.processed) return Promise.resolve(this.result)
if (!this.processing) {
this.processing = this.runAsync()
}
return this.processing
}
catch(onRejected) {
return this.async().catch(onRejected)
}
finally(onFinally) {
return this.async().then(onFinally, onFinally)
}
getAsyncError() {
throw new Error('Use process(css).then(cb) to work with async plugins')
}
handleError(error, node) {
let plugin = this.result.lastPlugin
try {
if (node) node.addToError(error)
this.error = error
if (error.name === 'CssSyntaxError' && !error.plugin) {
error.plugin = plugin.postcssPlugin
error.setMessage()
} else if (plugin.postcssVersion) {
if (false) {}
}
} catch (err) {
/* c8 ignore next 3 */
// eslint-disable-next-line no-console
if (console && console.error) console.error(err)
}
return error
}
prepareVisitors() {
this.listeners = {}
let add = (plugin, type, cb) => {
if (!this.listeners[type]) this.listeners[type] = []
this.listeners[type].push([plugin, cb])
}
for (let plugin of this.plugins) {
if (typeof plugin === 'object') {
for (let event in plugin) {
if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
throw new Error(
`Unknown event ${event} in ${plugin.postcssPlugin}. ` +
`Try to update PostCSS (${this.processor.version} now).`
)
}
if (!NOT_VISITORS[event]) {
if (typeof plugin[event] === 'object') {
for (let filter in plugin[event]) {
if (filter === '*') {
add(plugin, event, plugin[event][filter])
} else {
add(
plugin,
event + '-' + filter.toLowerCase(),
plugin[event][filter]
)
}
}
} else if (typeof plugin[event] === 'function') {
add(plugin, event, plugin[event])
}
}
}
}
}
this.hasListener = Object.keys(this.listeners).length > 0
}
async runAsync() {
this.plugin = 0
for (let i = 0; i < this.plugins.length; i++) {
let plugin = this.plugins[i]
let promise = this.runOnRoot(plugin)
if (isPromise(promise)) {
try {
await promise
} catch (error) {
throw this.handleError(error)
}
}
}
this.prepareVisitors()
if (this.hasListener) {
let root = this.result.root
while (!root[isClean]) {
root[isClean] = true
let stack = [toStack(root)]
while (stack.length > 0) {
let promise = this.visitTick(stack)
if (isPromise(promise)) {
try {
await promise
} catch (e) {
let node = stack[stack.length - 1].node
throw this.handleError(e, node)
}
}
}
}
if (this.listeners.OnceExit) {
for (let [plugin, visitor] of this.listeners.OnceExit) {
this.result.lastPlugin = plugin
try {
if (root.type === 'document') {
let roots = root.nodes.map(subRoot =>
visitor(subRoot, this.helpers)
)
await Promise.all(roots)
} else {
await visitor(root, this.helpers)
}
} catch (e) {
throw this.handleError(e)
}
}
}
}
this.processed = true
return this.stringify()
}
runOnRoot(plugin) {
this.result.lastPlugin = plugin
try {
if (typeof plugin === 'object' && plugin.Once) {
if (this.result.root.type === 'document') {
let roots = this.result.root.nodes.map(root =>
plugin.Once(root, this.helpers)
)
if (isPromise(roots[0])) {
return Promise.all(roots)
}
return roots
}
return plugin.Once(this.result.root, this.helpers)
} else if (typeof plugin === 'function') {
return plugin(this.result.root, this.result)
}
} catch (error) {
throw this.handleError(error)
}
}
stringify() {
if (this.error) throw this.error
if (this.stringified) return this.result
this.stringified = true
this.sync()
let opts = this.result.opts
let str = stringify
if (opts.syntax) str = opts.syntax.stringify
if (opts.stringifier) str = opts.stringifier
if (str.stringify) str = str.stringify
let map = new MapGenerator(str, this.result.root, this.result.opts)
let data = map.generate()
this.result.css = data[0]
this.result.map = data[1]
return this.result
}
sync() {
if (this.error) throw this.error
if (this.processed) return this.result
this.processed = true
if (this.processing) {
throw this.getAsyncError()
}
for (let plugin of this.plugins) {
let promise = this.runOnRoot(plugin)
if (isPromise(promise)) {
throw this.getAsyncError()
}
}
this.prepareVisitors()
if (this.hasListener) {
let root = this.result.root
while (!root[isClean]) {
root[isClean] = true
this.walkSync(root)
}
if (this.listeners.OnceExit) {
if (root.type === 'document') {
for (let subRoot of root.nodes) {
this.visitSync(this.listeners.OnceExit, subRoot)
}
} else {
this.visitSync(this.listeners.OnceExit, root)
}
}
}
return this.result
}
then(onFulfilled, onRejected) {
if (false) {}
return this.async().then(onFulfilled, onRejected)
}
toString() {
return this.css
}
visitSync(visitors, node) {
for (let [plugin, visitor] of visitors) {
this.result.lastPlugin = plugin
let promise
try {
promise = visitor(node, this.helpers)
} catch (e) {
throw this.handleError(e, node.proxyOf)
}
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
return true
}
if (isPromise(promise)) {
throw this.getAsyncError()
}
}
}
visitTick(stack) {
let visit = stack[stack.length - 1]
let { node, visitors } = visit
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
stack.pop()
return
}
if (visitors.length > 0 && visit.visitorIndex < visitors.length) {
let [plugin, visitor] = visitors[visit.visitorIndex]
visit.visitorIndex += 1
if (visit.visitorIndex === visitors.length) {
visit.visitors = []
visit.visitorIndex = 0
}
this.result.lastPlugin = plugin
try {
return visitor(node.toProxy(), this.helpers)
} catch (e) {
throw this.handleError(e, node)
}
}
if (visit.iterator !== 0) {
let iterator = visit.iterator
let child
while ((child = node.nodes[node.indexes[iterator]])) {
node.indexes[iterator] += 1
if (!child[isClean]) {
child[isClean] = true
stack.push(toStack(child))
return
}
}
visit.iterator = 0
delete node.indexes[iterator]
}
let events = visit.events
while (visit.eventIndex < events.length) {
let event = events[visit.eventIndex]
visit.eventIndex += 1
if (event === CHILDREN) {
if (node.nodes && node.nodes.length) {
node[isClean] = true
visit.iterator = node.getIterator()
}
return
} else if (this.listeners[event]) {
visit.visitors = this.listeners[event]
return
}
}
stack.pop()
}
walkSync(node) {
node[isClean] = true
let events = getEvents(node)
for (let event of events) {
if (event === CHILDREN) {
if (node.nodes) {
node.each(child => {
if (!child[isClean]) this.walkSync(child)
})
}
} else {
let visitors = this.listeners[event]
if (visitors) {
if (this.visitSync(visitors, node.toProxy())) return
}
}
}
}
warnings() {
return this.sync().warnings()
}
get content() {
return this.stringify().content
}
get css() {
return this.stringify().css
}
get map() {
return this.stringify().map
}
get messages() {
return this.sync().messages
}
get opts() {
return this.result.opts
}
get processor() {
return this.result.processor
}
get root() {
return this.sync().root
}
get [Symbol.toStringTag]() {
return 'LazyResult'
}
}
LazyResult.registerPostcss = dependant => {
postcss = dependant
}
module.exports = LazyResult
LazyResult.default = LazyResult
Root.registerLazyResult(LazyResult)
Document.registerLazyResult(LazyResult)
/***/ }),
/***/ 7374:
/***/ ((module) => {
"use strict";
let list = {
comma(string) {
return list.split(string, [','], true)
},
space(string) {
let spaces = [' ', '\n', '\t']
return list.split(string, spaces)
},
split(string, separators, last) {
let array = []
let current = ''
let split = false
let func = 0
let inQuote = false
let prevQuote = ''
let escape = false
for (let letter of string) {
if (escape) {
escape = false
} else if (letter === '\\') {
escape = true
} else if (inQuote) {
if (letter === prevQuote) {
inQuote = false
}
} else if (letter === '"' || letter === "'") {
inQuote = true
prevQuote = letter
} else if (letter === '(') {
func += 1
} else if (letter === ')') {
if (func > 0) func -= 1
} else if (func === 0) {
if (separators.includes(letter)) split = true
}
if (split) {
if (current !== '') array.push(current.trim())
current = ''
split = false
} else {
current += letter
}
}
if (last || current !== '') array.push(current.trim())
return array
}
}
module.exports = list
list.default = list
/***/ }),
/***/ 1670:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866)
let { dirname, relative, resolve, sep } = __webpack_require__(197)
let { pathToFileURL } = __webpack_require__(2739)
let Input = __webpack_require__(5380)
let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator)
let pathAvailable = Boolean(dirname && resolve && relative && sep)
class MapGenerator {
constructor(stringify, root, opts, cssString) {
this.stringify = stringify
this.mapOpts = opts.map || {}
this.root = root
this.opts = opts
this.css = cssString
this.originalCSS = cssString
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute
this.memoizedFileURLs = new Map()
this.memoizedPaths = new Map()
this.memoizedURLs = new Map()
}
addAnnotation() {
let content
if (this.isInline()) {
content =
'data:application/json;base64,' + this.toBase64(this.map.toString())
} else if (typeof this.mapOpts.annotation === 'string') {
content = this.mapOpts.annotation
} else if (typeof this.mapOpts.annotation === 'function') {
content = this.mapOpts.annotation(this.opts.to, this.root)
} else {
content = this.outputFile() + '.map'
}
let eol = '\n'
if (this.css.includes('\r\n')) eol = '\r\n'
this.css += eol + '/*# sourceMappingURL=' + content + ' */'
}
applyPrevMaps() {
for (let prev of this.previous()) {
let from = this.toUrl(this.path(prev.file))
let root = prev.root || dirname(prev.file)
let map
if (this.mapOpts.sourcesContent === false) {
map = new SourceMapConsumer(prev.text)
if (map.sourcesContent) {
map.sourcesContent = null
}
} else {
map = prev.consumer()
}
this.map.applySourceMap(map, from, this.toUrl(this.path(root)))
}
}
clearAnnotation() {
if (this.mapOpts.annotation === false) return
if (this.root) {
let node
for (let i = this.root.nodes.length - 1; i >= 0; i--) {
node = this.root.nodes[i]
if (node.type !== 'comment') continue
if (node.text.indexOf('# sourceMappingURL=') === 0) {
this.root.removeChild(i)
}
}
} else if (this.css) {
this.css = this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm, '')
}
}
generate() {
this.clearAnnotation()
if (pathAvailable && sourceMapAvailable && this.isMap()) {
return this.generateMap()
} else {
let result = ''
this.stringify(this.root, i => {
result += i
})
return [result]
}
}
generateMap() {
if (this.root) {
this.generateString()
} else if (this.previous().length === 1) {
let prev = this.previous()[0].consumer()
prev.file = this.outputFile()
this.map = SourceMapGenerator.fromSourceMap(prev)
} else {
this.map = new SourceMapGenerator({ file: this.outputFile() })
this.map.addMapping({
generated: { column: 0, line: 1 },
original: { column: 0, line: 1 },
source: this.opts.from
? this.toUrl(this.path(this.opts.from))
: '<no source>'
})
}
if (this.isSourcesContent()) this.setSourcesContent()
if (this.root && this.previous().length > 0) this.applyPrevMaps()
if (this.isAnnotation()) this.addAnnotation()
if (this.isInline()) {
return [this.css]
} else {
return [this.css, this.map]
}
}
generateString() {
this.css = ''
this.map = new SourceMapGenerator({ file: this.outputFile() })
let line = 1
let column = 1
let noSource = '<no source>'
let mapping = {
generated: { column: 0, line: 0 },
original: { column: 0, line: 0 },
source: ''
}
let lines, last
this.stringify(this.root, (str, node, type) => {
this.css += str
if (node && type !== 'end') {
mapping.generated.line = line
mapping.generated.column = column - 1
if (node.source && node.source.start) {
mapping.source = this.sourcePath(node)
mapping.original.line = node.source.start.line
mapping.original.column = node.source.start.column - 1
this.map.addMapping(mapping)
} else {
mapping.source = noSource
mapping.original.line = 1
mapping.original.column = 0
this.map.addMapping(mapping)
}
}
lines = str.match(/\n/g)
if (lines) {
line += lines.length
last = str.lastIndexOf('\n')
column = str.length - last
} else {
column += str.length
}
if (node && type !== 'start') {
let p = node.parent || { raws: {} }
let childless =
node.type === 'decl' || (node.type === 'atrule' && !node.nodes)
if (!childless || node !== p.last || p.raws.semicolon) {
if (node.source && node.source.end) {
mapping.source = this.sourcePath(node)
mapping.original.line = node.source.end.line
mapping.original.column = node.source.end.column - 1
mapping.generated.line = line
mapping.generated.column = column - 2
this.map.addMapping(mapping)
} else {
mapping.source = noSource
mapping.original.line = 1
mapping.original.column = 0
mapping.generated.line = line
mapping.generated.column = column - 1
this.map.addMapping(mapping)
}
}
}
})
}
isAnnotation() {
if (this.isInline()) {
return true
}
if (typeof this.mapOpts.annotation !== 'undefined') {
return this.mapOpts.annotation
}
if (this.previous().length) {
return this.previous().some(i => i.annotation)
}
return true
}
isInline() {
if (typeof this.mapOpts.inline !== 'undefined') {
return this.mapOpts.inline
}
let annotation = this.mapOpts.annotation
if (typeof annotation !== 'undefined' && annotation !== true) {
return false
}
if (this.previous().length) {
return this.previous().some(i => i.inline)
}
return true
}
isMap() {
if (typeof this.opts.map !== 'undefined') {
return !!this.opts.map
}
return this.previous().length > 0
}
isSourcesContent() {
if (typeof this.mapOpts.sourcesContent !== 'undefined') {
return this.mapOpts.sourcesContent
}
if (this.previous().length) {
return this.previous().some(i => i.withContent())
}
return true
}
outputFile() {
if (this.opts.to) {
return this.path(this.opts.to)
} else if (this.opts.from) {
return this.path(this.opts.from)
} else {
return 'to.css'
}
}
path(file) {
if (this.mapOpts.absolute) return file
if (file.charCodeAt(0) === 60 /* `<` */) return file
if (/^\w+:\/\//.test(file)) return file
let cached = this.memoizedPaths.get(file)
if (cached) return cached
let from = this.opts.to ? dirname(this.opts.to) : '.'
if (typeof this.mapOpts.annotation === 'string') {
from = dirname(resolve(from, this.mapOpts.annotation))
}
let path = relative(from, file)
this.memoizedPaths.set(file, path)
return path
}
previous() {
if (!this.previousMaps) {
this.previousMaps = []
if (this.root) {
this.root.walk(node => {
if (node.source && node.source.input.map) {
let map = node.source.input.map
if (!this.previousMaps.includes(map)) {
this.previousMaps.push(map)
}
}
})
} else {
let input = new Input(this.originalCSS, this.opts)
if (input.map) this.previousMaps.push(input.map)
}
}
return this.previousMaps
}
setSourcesContent() {
let already = {}
if (this.root) {
this.root.walk(node => {
if (node.source) {
let from = node.source.input.from
if (from && !already[from]) {
already[from] = true
let fromUrl = this.usesFileUrls
? this.toFileUrl(from)
: this.toUrl(this.path(from))
this.map.setSourceContent(fromUrl, node.source.input.css)
}
}
})
} else if (this.css) {
let from = this.opts.from
? this.toUrl(this.path(this.opts.from))
: '<no source>'
this.map.setSourceContent(from, this.css)
}
}
sourcePath(node) {
if (this.mapOpts.from) {
return this.toUrl(this.mapOpts.from)
} else if (this.usesFileUrls) {
return this.toFileUrl(node.source.input.from)
} else {
return this.toUrl(this.path(node.source.input.from))
}
}
toBase64(str) {
if (Buffer) {
return Buffer.from(str).toString('base64')
} else {
return window.btoa(unescape(encodeURIComponent(str)))
}
}
toFileUrl(path) {
let cached = this.memoizedFileURLs.get(path)
if (cached) return cached
if (pathToFileURL) {
let fileURL = pathToFileURL(path).toString()
this.memoizedFileURLs.set(path, fileURL)
return fileURL
} else {
throw new Error(
'`map.absolute` option is not available in this PostCSS build'
)
}
}
toUrl(path) {
let cached = this.memoizedURLs.get(path)
if (cached) return cached
if (sep === '\\') {
path = path.replace(/\\/g, '/')
}
let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent)
this.memoizedURLs.set(path, url)
return url
}
}
module.exports = MapGenerator
/***/ }),
/***/ 7661:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let MapGenerator = __webpack_require__(1670)
let stringify = __webpack_require__(633)
let warnOnce = __webpack_require__(3122)
let parse = __webpack_require__(4295)
const Result = __webpack_require__(9055)
class NoWorkResult {
constructor(processor, css, opts) {
css = css.toString()
this.stringified = false
this._processor = processor
this._css = css
this._opts = opts
this._map = undefined
let root
let str = stringify
this.result = new Result(this._processor, root, this._opts)
this.result.css = css
let self = this
Object.defineProperty(this.result, 'root', {
get() {
return self.root
}
})
let map = new MapGenerator(str, root, this._opts, css)
if (map.isMap()) {
let [generatedCSS, generatedMap] = map.generate()
if (generatedCSS) {
this.result.css = generatedCSS
}
if (generatedMap) {
this.result.map = generatedMap
}
} else {
map.clearAnnotation()
this.result.css = map.css
}
}
async() {
if (this.error) return Promise.reject(this.error)
return Promise.resolve(this.result)
}
catch(onRejected) {
return this.async().catch(onRejected)
}
finally(onFinally) {
return this.async().then(onFinally, onFinally)
}
sync() {
if (this.error) throw this.error
return this.result
}
then(onFulfilled, onRejected) {
if (false) {}
return this.async().then(onFulfilled, onRejected)
}
toString() {
return this._css
}
warnings() {
return []
}
get content() {
return this.result.css
}
get css() {
return this.result.css
}
get map() {
return this.result.map
}
get messages() {
return []
}
get opts() {
return this.result.opts
}
get processor() {
return this.result.processor
}
get root() {
if (this._root) {
return this._root
}
let root
let parser = parse
try {
root = parser(this._css, this._opts)
} catch (error) {
this.error = error
}
if (this.error) {
throw this.error
} else {
this._root = root
return root
}
}
get [Symbol.toStringTag]() {
return 'NoWorkResult'
}
}
module.exports = NoWorkResult
NoWorkResult.default = NoWorkResult
/***/ }),
/***/ 7490:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let { isClean, my } = __webpack_require__(1381)
let CssSyntaxError = __webpack_require__(356)
let Stringifier = __webpack_require__(346)
let stringify = __webpack_require__(633)
function cloneNode(obj, parent) {
let cloned = new obj.constructor()
for (let i in obj) {
if (!Object.prototype.hasOwnProperty.call(obj, i)) {
/* c8 ignore next 2 */
continue
}
if (i === 'proxyCache') continue
let value = obj[i]
let type = typeof value
if (i === 'parent' && type === 'object') {
if (parent) cloned[i] = parent
} else if (i === 'source') {
cloned[i] = value
} else if (Array.isArray(value)) {
cloned[i] = value.map(j => cloneNode(j, cloned))
} else {
if (type === 'object' && value !== null) value = cloneNode(value)
cloned[i] = value
}
}
return cloned
}
class Node {
constructor(defaults = {}) {
this.raws = {}
this[isClean] = false
this[my] = true
for (let name in defaults) {
if (name === 'nodes') {
this.nodes = []
for (let node of defaults[name]) {
if (typeof node.clone === 'function') {
this.append(node.clone())
} else {
this.append(node)
}
}
} else {
this[name] = defaults[name]
}
}
}
addToError(error) {
error.postcssNode = this
if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) {
let s = this.source
error.stack = error.stack.replace(
/\n\s{4}at /,
`$&${s.input.from}:${s.start.line}:${s.start.column}$&`
)
}
return error
}
after(add) {
this.parent.insertAfter(this, add)
return this
}
assign(overrides = {}) {
for (let name in overrides) {
this[name] = overrides[name]
}
return this
}
before(add) {
this.parent.insertBefore(this, add)
return this
}
cleanRaws(keepBetween) {
delete this.raws.before
delete this.raws.after
if (!keepBetween) delete this.raws.between
}
clone(overrides = {}) {
let cloned = cloneNode(this)
for (let name in overrides) {
cloned[name] = overrides[name]
}
return cloned
}
cloneAfter(overrides = {}) {
let cloned = this.clone(overrides)
this.parent.insertAfter(this, cloned)
return cloned
}
cloneBefore(overrides = {}) {
let cloned = this.clone(overrides)
this.parent.insertBefore(this, cloned)
return cloned
}
error(message, opts = {}) {
if (this.source) {
let { end, start } = this.rangeBy(opts)
return this.source.input.error(
message,
{ column: start.column, line: start.line },
{ column: end.column, line: end.line },
opts
)
}
return new CssSyntaxError(message)
}
getProxyProcessor() {
return {
get(node, prop) {
if (prop === 'proxyOf') {
return node
} else if (prop === 'root') {
return () => node.root().toProxy()
} else {
return node[prop]
}
},
set(node, prop, value) {
if (node[prop] === value) return true
node[prop] = value
if (
prop === 'prop' ||
prop === 'value' ||
prop === 'name' ||
prop === 'params' ||
prop === 'important' ||
/* c8 ignore next */
prop === 'text'
) {
node.markDirty()
}
return true
}
}
}
markDirty() {
if (this[isClean]) {
this[isClean] = false
let next = this
while ((next = next.parent)) {
next[isClean] = false
}
}
}
next() {
if (!this.parent) return undefined
let index = this.parent.index(this)
return this.parent.nodes[index + 1]
}
positionBy(opts, stringRepresentation) {
let pos = this.source.start
if (opts.index) {
pos = this.positionInside(opts.index, stringRepresentation)
} else if (opts.word) {
stringRepresentation = this.toString()
let index = stringRepresentation.indexOf(opts.word)
if (index !== -1) pos = this.positionInside(index, stringRepresentation)
}
return pos
}
positionInside(index, stringRepresentation) {
let string = stringRepresentation || this.toString()
let column = this.source.start.column
let line = this.source.start.line
for (let i = 0; i < index; i++) {
if (string[i] === '\n') {
column = 1
line += 1
} else {
column += 1
}
}
return { column, line }
}
prev() {
if (!this.parent) return undefined
let index = this.parent.index(this)
return this.parent.nodes[index - 1]
}
rangeBy(opts) {
let start = {
column: this.source.start.column,
line: this.source.start.line
}
let end = this.source.end
? {
column: this.source.end.column + 1,
line: this.source.end.line
}
: {
column: start.column + 1,
line: start.line
}
if (opts.word) {
let stringRepresentation = this.toString()
let index = stringRepresentation.indexOf(opts.word)
if (index !== -1) {
start = this.positionInside(index, stringRepresentation)
end = this.positionInside(index + opts.word.length, stringRepresentation)
}
} else {
if (opts.start) {
start = {
column: opts.start.column,
line: opts.start.line
}
} else if (opts.index) {
start = this.positionInside(opts.index)
}
if (opts.end) {
end = {
column: opts.end.column,
line: opts.end.line
}
} else if (opts.endIndex) {
end = this.positionInside(opts.endIndex)
} else if (opts.index) {
end = this.positionInside(opts.index + 1)
}
}
if (
end.line < start.line ||
(end.line === start.line && end.column <= start.column)
) {
end = { column: start.column + 1, line: start.line }
}
return { end, start }
}
raw(prop, defaultType) {
let str = new Stringifier()
return str.raw(this, prop, defaultType)
}
remove() {
if (this.parent) {
this.parent.removeChild(this)
}
this.parent = undefined
return this
}
replaceWith(...nodes) {
if (this.parent) {
let bookmark = this
let foundSelf = false
for (let node of nodes) {
if (node === this) {
foundSelf = true
} else if (foundSelf) {
this.parent.insertAfter(bookmark, node)
bookmark = node
} else {
this.parent.insertBefore(bookmark, node)
}
}
if (!foundSelf) {
this.remove()
}
}
return this
}
root() {
let result = this
while (result.parent && result.parent.type !== 'document') {
result = result.parent
}
return result
}
toJSON(_, inputs) {
let fixed = {}
let emitInputs = inputs == null
inputs = inputs || new Map()
let inputsNextIndex = 0
for (let name in this) {
if (!Object.prototype.hasOwnProperty.call(this, name)) {
/* c8 ignore next 2 */
continue
}
if (name === 'parent' || name === 'proxyCache') continue
let value = this[name]
if (Array.isArray(value)) {
fixed[name] = value.map(i => {
if (typeof i === 'object' && i.toJSON) {
return i.toJSON(null, inputs)
} else {
return i
}
})
} else if (typeof value === 'object' && value.toJSON) {
fixed[name] = value.toJSON(null, inputs)
} else if (name === 'source') {
let inputId = inputs.get(value.input)
if (inputId == null) {
inputId = inputsNextIndex
inputs.set(value.input, inputsNextIndex)
inputsNextIndex++
}
fixed[name] = {
end: value.end,
inputId,
start: value.start
}
} else {
fixed[name] = value
}
}
if (emitInputs) {
fixed.inputs = [...inputs.keys()].map(input => input.toJSON())
}
return fixed
}
toProxy() {
if (!this.proxyCache) {
this.proxyCache = new Proxy(this, this.getProxyProcessor())
}
return this.proxyCache
}
toString(stringifier = stringify) {
if (stringifier.stringify) stringifier = stringifier.stringify
let result = ''
stringifier(this, i => {
result += i
})
return result
}
warn(result, text, opts) {
let data = { node: this }
for (let i in opts) data[i] = opts[i]
return result.warn(text, data)
}
get proxyOf() {
return this
}
}
module.exports = Node
Node.default = Node
/***/ }),
/***/ 4295:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let Container = __webpack_require__(683)
let Parser = __webpack_require__(3937)
let Input = __webpack_require__(5380)
function parse(css, opts) {
let input = new Input(css, opts)
let parser = new Parser(input)
try {
parser.parse()
} catch (e) {
if (false) {}
throw e
}
return parser.root
}
module.exports = parse
parse.default = parse
Container.registerParse(parse)
/***/ }),
/***/ 3937:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let Declaration = __webpack_require__(1516)
let tokenizer = __webpack_require__(2327)
let Comment = __webpack_require__(6589)
let AtRule = __webpack_require__(1326)
let Root = __webpack_require__(9434)
let Rule = __webpack_require__(4092)
const SAFE_COMMENT_NEIGHBOR = {
empty: true,
space: true
}
function findLastWithPosition(tokens) {
for (let i = tokens.length - 1; i >= 0; i--) {
let token = tokens[i]
let pos = token[3] || token[2]
if (pos) return pos
}
}
class Parser {
constructor(input) {
this.input = input
this.root = new Root()
this.current = this.root
this.spaces = ''
this.semicolon = false
this.createTokenizer()
this.root.source = { input, start: { column: 1, line: 1, offset: 0 } }
}
atrule(token) {
let node = new AtRule()
node.name = token[1].slice(1)
if (node.name === '') {
this.unnamedAtrule(node, token)
}
this.init(node, token[2])
let type
let prev
let shift
let last = false
let open = false
let params = []
let brackets = []
while (!this.tokenizer.endOfFile()) {
token = this.tokenizer.nextToken()
type = token[0]
if (type === '(' || type === '[') {
brackets.push(type === '(' ? ')' : ']')
} else if (type === '{' && brackets.length > 0) {
brackets.push('}')
} else if (type === brackets[brackets.length - 1]) {
brackets.pop()
}
if (brackets.length === 0) {
if (type === ';') {
node.source.end = this.getPosition(token[2])
node.source.end.offset++
this.semicolon = true
break
} else if (type === '{') {
open = true
break
} else if (type === '}') {
if (params.length > 0) {
shift = params.length - 1
prev = params[shift]
while (prev && prev[0] === 'space') {
prev = params[--shift]
}
if (prev) {
node.source.end = this.getPosition(prev[3] || prev[2])
node.source.end.offset++
}
}
this.end(token)
break
} else {
params.push(token)
}
} else {
params.push(token)
}
if (this.tokenizer.endOfFile()) {
last = true
break
}
}
node.raws.between = this.spacesAndCommentsFromEnd(params)
if (params.length) {
node.raws.afterName = this.spacesAndCommentsFromStart(params)
this.raw(node, 'params', params)
if (last) {
token = params[params.length - 1]
node.source.end = this.getPosition(token[3] || token[2])
node.source.end.offset++
this.spaces = node.raws.between
node.raws.between = ''
}
} else {
node.raws.afterName = ''
node.params = ''
}
if (open) {
node.nodes = []
this.current = node
}
}
checkMissedSemicolon(tokens) {
let colon = this.colon(tokens)
if (colon === false) return
let founded = 0
let token
for (let j = colon - 1; j >= 0; j--) {
token = tokens[j]
if (token[0] !== 'space') {
founded += 1
if (founded === 2) break
}
}
// If the token is a word, e.g. `!important`, `red` or any other valid property's value.
// Then we need to return the colon after that word token. [3] is the "end" colon of that word.
// And because we need it after that one we do +1 to get the next one.
throw this.input.error(
'Missed semicolon',
token[0] === 'word' ? token[3] + 1 : token[2]
)
}
colon(tokens) {
let brackets = 0
let token, type, prev
for (let [i, element] of tokens.entries()) {
token = element
type = token[0]
if (type === '(') {
brackets += 1
}
if (type === ')') {
brackets -= 1
}
if (brackets === 0 && type === ':') {
if (!prev) {
this.doubleColon(token)
} else if (prev[0] === 'word' && prev[1] === 'progid') {
continue
} else {
return i
}
}
prev = token
}
return false
}
comment(token) {
let node = new Comment()
this.init(node, token[2])
node.source.end = this.getPosition(token[3] || token[2])
node.source.end.offset++
let text = token[1].slice(2, -2)
if (/^\s*$/.test(text)) {
node.text = ''
node.raws.left = text
node.raws.right = ''
} else {
let match = text.match(/^(\s*)([^]*\S)(\s*)$/)
node.text = match[2]
node.raws.left = match[1]
node.raws.right = match[3]
}
}
createTokenizer() {
this.tokenizer = tokenizer(this.input)
}
decl(tokens, customProperty) {
let node = new Declaration()
this.init(node, tokens[0][2])
let last = tokens[tokens.length - 1]
if (last[0] === ';') {
this.semicolon = true
tokens.pop()
}
node.source.end = this.getPosition(
last[3] || last[2] || findLastWithPosition(tokens)
)
node.source.end.offset++
while (tokens[0][0] !== 'word') {
if (tokens.length === 1) this.unknownWord(tokens)
node.raws.before += tokens.shift()[1]
}
node.source.start = this.getPosition(tokens[0][2])
node.prop = ''
while (tokens.length) {
let type = tokens[0][0]
if (type === ':' || type === 'space' || type === 'comment') {
break
}
node.prop += tokens.shift()[1]
}
node.raws.between = ''
let token
while (tokens.length) {
token = tokens.shift()
if (token[0] === ':') {
node.raws.between += token[1]
break
} else {
if (token[0] === 'word' && /\w/.test(token[1])) {
this.unknownWord([token])
}
node.raws.between += token[1]
}
}
if (node.prop[0] === '_' || node.prop[0] === '*') {
node.raws.before += node.prop[0]
node.prop = node.prop.slice(1)
}
let firstSpaces = []
let next
while (tokens.length) {
next = tokens[0][0]
if (next !== 'space' && next !== 'comment') break
firstSpaces.push(tokens.shift())
}
this.precheckMissedSemicolon(tokens)
for (let i = tokens.length - 1; i >= 0; i--) {
token = tokens[i]
if (token[1].toLowerCase() === '!important') {
node.important = true
let string = this.stringFrom(tokens, i)
string = this.spacesFromEnd(tokens) + string
if (string !== ' !important') node.raws.important = string
break
} else if (token[1].toLowerCase() === 'important') {
let cache = tokens.slice(0)
let str = ''
for (let j = i; j > 0; j--) {
let type = cache[j][0]
if (str.trim().indexOf('!') === 0 && type !== 'space') {
break
}
str = cache.pop()[1] + str
}
if (str.trim().indexOf('!') === 0) {
node.important = true
node.raws.important = str
tokens = cache
}
}
if (token[0] !== 'space' && token[0] !== 'comment') {
break
}
}
let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment')
if (hasWord) {
node.raws.between += firstSpaces.map(i => i[1]).join('')
firstSpaces = []
}
this.raw(node, 'value', firstSpaces.concat(tokens), customProperty)
if (node.value.includes(':') && !customProperty) {
this.checkMissedSemicolon(tokens)
}
}
doubleColon(token) {
throw this.input.error(
'Double colon',
{ offset: token[2] },
{ offset: token[2] + token[1].length }
)
}
emptyRule(token) {
let node = new Rule()
this.init(node, token[2])
node.selector = ''
node.raws.between = ''
this.current = node
}
end(token) {
if (this.current.nodes && this.current.nodes.length) {
this.current.raws.semicolon = this.semicolon
}
this.semicolon = false
this.current.raws.after = (this.current.raws.after || '') + this.spaces
this.spaces = ''
if (this.current.parent) {
this.current.source.end = this.getPosition(token[2])
this.current.source.end.offset++
this.current = this.current.parent
} else {
this.unexpectedClose(token)
}
}
endFile() {
if (this.current.parent) this.unclosedBlock()
if (this.current.nodes && this.current.nodes.length) {
this.current.raws.semicolon = this.semicolon
}
this.current.raws.after = (this.current.raws.after || '') + this.spaces
this.root.source.end = this.getPosition(this.tokenizer.position())
}
freeSemicolon(token) {
this.spaces += token[1]
if (this.current.nodes) {
let prev = this.current.nodes[this.current.nodes.length - 1]
if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) {
prev.raws.ownSemicolon = this.spaces
this.spaces = ''
}
}
}
// Helpers
getPosition(offset) {
let pos = this.input.fromOffset(offset)
return {
column: pos.col,
line: pos.line,
offset
}
}
init(node, offset) {
this.current.push(node)
node.source = {
input: this.input,
start: this.getPosition(offset)
}
node.raws.before = this.spaces
this.spaces = ''
if (node.type !== 'comment') this.semicolon = false
}
other(start) {
let end = false
let type = null
let colon = false
let bracket = null
let brackets = []
let customProperty = start[1].startsWith('--')
let tokens = []
let token = start
while (token) {
type = token[0]
tokens.push(token)
if (type === '(' || type === '[') {
if (!bracket) bracket = token
brackets.push(type === '(' ? ')' : ']')
} else if (customProperty && colon && type === '{') {
if (!bracket) bracket = token
brackets.push('}')
} else if (brackets.length === 0) {
if (type === ';') {
if (colon) {
this.decl(tokens, customProperty)
return
} else {
break
}
} else if (type === '{') {
this.rule(tokens)
return
} else if (type === '}') {
this.tokenizer.back(tokens.pop())
end = true
break
} else if (type === ':') {
colon = true
}
} else if (type === brackets[brackets.length - 1]) {
brackets.pop()
if (brackets.length === 0) bracket = null
}
token = this.tokenizer.nextToken()
}
if (this.tokenizer.endOfFile()) end = true
if (brackets.length > 0) this.unclosedBracket(bracket)
if (end && colon) {
if (!customProperty) {
while (tokens.length) {
token = tokens[tokens.length - 1][0]
if (token !== 'space' && token !== 'comment') break
this.tokenizer.back(tokens.pop())
}
}
this.decl(tokens, customProperty)
} else {
this.unknownWord(tokens)
}
}
parse() {
let token
while (!this.tokenizer.endOfFile()) {
token = this.tokenizer.nextToken()
switch (token[0]) {
case 'space':
this.spaces += token[1]
break
case ';':
this.freeSemicolon(token)
break
case '}':
this.end(token)
break
case 'comment':
this.comment(token)
break
case 'at-word':
this.atrule(token)
break
case '{':
this.emptyRule(token)
break
default:
this.other(token)
break
}
}
this.endFile()
}
precheckMissedSemicolon(/* tokens */) {
// Hook for Safe Parser
}
raw(node, prop, tokens, customProperty) {
let token, type
let length = tokens.length
let value = ''
let clean = true
let next, prev
for (let i = 0; i < length; i += 1) {
token = tokens[i]
type = token[0]
if (type === 'space' && i === length - 1 && !customProperty) {
clean = false
} else if (type === 'comment') {
prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty'
next = tokens[i + 1] ? tokens[i + 1][0] : 'empty'
if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {
if (value.slice(-1) === ',') {
clean = false
} else {
value += token[1]
}
} else {
clean = false
}
} else {
value += token[1]
}
}
if (!clean) {
let raw = tokens.reduce((all, i) => all + i[1], '')
node.raws[prop] = { raw, value }
}
node[prop] = value
}
rule(tokens) {
tokens.pop()
let node = new Rule()
this.init(node, tokens[0][2])
node.raws.between = this.spacesAndCommentsFromEnd(tokens)
this.raw(node, 'selector', tokens)
this.current = node
}
spacesAndCommentsFromEnd(tokens) {
let lastTokenType
let spaces = ''
while (tokens.length) {
lastTokenType = tokens[tokens.length - 1][0]
if (lastTokenType !== 'space' && lastTokenType !== 'comment') break
spaces = tokens.pop()[1] + spaces
}
return spaces
}
// Errors
spacesAndCommentsFromStart(tokens) {
let next
let spaces = ''
while (tokens.length) {
next = tokens[0][0]
if (next !== 'space' && next !== 'comment') break
spaces += tokens.shift()[1]
}
return spaces
}
spacesFromEnd(tokens) {
let lastTokenType
let spaces = ''
while (tokens.length) {
lastTokenType = tokens[tokens.length - 1][0]
if (lastTokenType !== 'space') break
spaces = tokens.pop()[1] + spaces
}
return spaces
}
stringFrom(tokens, from) {
let result = ''
for (let i = from; i < tokens.length; i++) {
result += tokens[i][1]
}
tokens.splice(from, tokens.length - from)
return result
}
unclosedBlock() {
let pos = this.current.source.start
throw this.input.error('Unclosed block', pos.line, pos.column)
}
unclosedBracket(bracket) {
throw this.input.error(
'Unclosed bracket',
{ offset: bracket[2] },
{ offset: bracket[2] + 1 }
)
}
unexpectedClose(token) {
throw this.input.error(
'Unexpected }',
{ offset: token[2] },
{ offset: token[2] + 1 }
)
}
unknownWord(tokens) {
throw this.input.error(
'Unknown word',
{ offset: tokens[0][2] },
{ offset: tokens[0][2] + tokens[0][1].length }
)
}
unnamedAtrule(node, token) {
throw this.input.error(
'At-rule without name',
{ offset: token[2] },
{ offset: token[2] + token[1].length }
)
}
}
module.exports = Parser
/***/ }),
/***/ 4529:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let CssSyntaxError = __webpack_require__(356)
let Declaration = __webpack_require__(1516)
let LazyResult = __webpack_require__(448)
let Container = __webpack_require__(683)
let Processor = __webpack_require__(9656)
let stringify = __webpack_require__(633)
let fromJSON = __webpack_require__(8940)
let Document = __webpack_require__(271)
let Warning = __webpack_require__(5776)
let Comment = __webpack_require__(6589)
let AtRule = __webpack_require__(1326)
let Result = __webpack_require__(9055)
let Input = __webpack_require__(5380)
let parse = __webpack_require__(4295)
let list = __webpack_require__(7374)
let Rule = __webpack_require__(4092)
let Root = __webpack_require__(9434)
let Node = __webpack_require__(7490)
function postcss(...plugins) {
if (plugins.length === 1 && Array.isArray(plugins[0])) {
plugins = plugins[0]
}
return new Processor(plugins)
}
postcss.plugin = function plugin(name, initializer) {
let warningPrinted = false
function creator(...args) {
// eslint-disable-next-line no-console
if (console && console.warn && !warningPrinted) {
warningPrinted = true
// eslint-disable-next-line no-console
console.warn(
name +
': postcss.plugin was deprecated. Migration guide:\n' +
'https://evilmartians.com/chronicles/postcss-8-plugin-migration'
)
if (process.env.LANG && process.env.LANG.startsWith('cn')) {
/* c8 ignore next 7 */
// eslint-disable-next-line no-console
console.warn(
name +
': 里面 postcss.plugin 被弃用. 迁移指南:\n' +
'https://www.w3ctech.com/topic/2226'
)
}
}
let transformer = initializer(...args)
transformer.postcssPlugin = name
transformer.postcssVersion = new Processor().version
return transformer
}
let cache
Object.defineProperty(creator, 'postcss', {
get() {
if (!cache) cache = creator()
return cache
}
})
creator.process = function (css, processOpts, pluginOpts) {
return postcss([creator(pluginOpts)]).process(css, processOpts)
}
return creator
}
postcss.stringify = stringify
postcss.parse = parse
postcss.fromJSON = fromJSON
postcss.list = list
postcss.comment = defaults => new Comment(defaults)
postcss.atRule = defaults => new AtRule(defaults)
postcss.decl = defaults => new Declaration(defaults)
postcss.rule = defaults => new Rule(defaults)
postcss.root = defaults => new Root(defaults)
postcss.document = defaults => new Document(defaults)
postcss.CssSyntaxError = CssSyntaxError
postcss.Declaration = Declaration
postcss.Container = Container
postcss.Processor = Processor
postcss.Document = Document
postcss.Comment = Comment
postcss.Warning = Warning
postcss.AtRule = AtRule
postcss.Result = Result
postcss.Input = Input
postcss.Rule = Rule
postcss.Root = Root
postcss.Node = Node
LazyResult.registerPostcss(postcss)
module.exports = postcss
postcss.default = postcss
/***/ }),
/***/ 5696:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let { SourceMapConsumer, SourceMapGenerator } = __webpack_require__(1866)
let { existsSync, readFileSync } = __webpack_require__(9977)
let { dirname, join } = __webpack_require__(197)
function fromBase64(str) {
if (Buffer) {
return Buffer.from(str, 'base64').toString()
} else {
/* c8 ignore next 2 */
return window.atob(str)
}
}
class PreviousMap {
constructor(css, opts) {
if (opts.map === false) return
this.loadAnnotation(css)
this.inline = this.startWith(this.annotation, 'data:')
let prev = opts.map ? opts.map.prev : undefined
let text = this.loadMap(opts.from, prev)
if (!this.mapFile && opts.from) {
this.mapFile = opts.from
}
if (this.mapFile) this.root = dirname(this.mapFile)
if (text) this.text = text
}
consumer() {
if (!this.consumerCache) {
this.consumerCache = new SourceMapConsumer(this.text)
}
return this.consumerCache
}
decodeInline(text) {
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/
let baseUri = /^data:application\/json;base64,/
let charsetUri = /^data:application\/json;charset=utf-?8,/
let uri = /^data:application\/json,/
if (charsetUri.test(text) || uri.test(text)) {
return decodeURIComponent(text.substr(RegExp.lastMatch.length))
}
if (baseCharsetUri.test(text) || baseUri.test(text)) {
return fromBase64(text.substr(RegExp.lastMatch.length))
}
let encoding = text.match(/data:application\/json;([^,]+),/)[1]
throw new Error('Unsupported source map encoding ' + encoding)
}
getAnnotationURL(sourceMapString) {
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim()
}
isMap(map) {
if (typeof map !== 'object') return false
return (
typeof map.mappings === 'string' ||
typeof map._mappings === 'string' ||
Array.isArray(map.sections)
)
}
loadAnnotation(css) {
let comments = css.match(/\/\*\s*# sourceMappingURL=/gm)
if (!comments) return
// sourceMappingURLs from comments, strings, etc.
let start = css.lastIndexOf(comments.pop())
let end = css.indexOf('*/', start)
if (start > -1 && end > -1) {
// Locate the last sourceMappingURL to avoid pickin
this.annotation = this.getAnnotationURL(css.substring(start, end))
}
}
loadFile(path) {
this.root = dirname(path)
if (existsSync(path)) {
this.mapFile = path
return readFileSync(path, 'utf-8').toString().trim()
}
}
loadMap(file, prev) {
if (prev === false) return false
if (prev) {
if (typeof prev === 'string') {
return prev
} else if (typeof prev === 'function') {
let prevPath = prev(file)
if (prevPath) {
let map = this.loadFile(prevPath)
if (!map) {
throw new Error(
'Unable to load previous source map: ' + prevPath.toString()
)
}
return map
}
} else if (prev instanceof SourceMapConsumer) {
return SourceMapGenerator.fromSourceMap(prev).toString()
} else if (prev instanceof SourceMapGenerator) {
return prev.toString()
} else if (this.isMap(prev)) {
return JSON.stringify(prev)
} else {
throw new Error(
'Unsupported previous source map format: ' + prev.toString()
)
}
} else if (this.inline) {
return this.decodeInline(this.annotation)
} else if (this.annotation) {
let map = this.annotation
if (file) map = join(dirname(file), map)
return this.loadFile(map)
}
}
startWith(string, start) {
if (!string) return false
return string.substr(0, start.length) === start
}
withContent() {
return !!(
this.consumer().sourcesContent &&
this.consumer().sourcesContent.length > 0
)
}
}
module.exports = PreviousMap
PreviousMap.default = PreviousMap
/***/ }),
/***/ 9656:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let NoWorkResult = __webpack_require__(7661)
let LazyResult = __webpack_require__(448)
let Document = __webpack_require__(271)
let Root = __webpack_require__(9434)
class Processor {
constructor(plugins = []) {
this.version = '8.4.35'
this.plugins = this.normalize(plugins)
}
normalize(plugins) {
let normalized = []
for (let i of plugins) {
if (i.postcss === true) {
i = i()
} else if (i.postcss) {
i = i.postcss
}
if (typeof i === 'object' && Array.isArray(i.plugins)) {
normalized = normalized.concat(i.plugins)
} else if (typeof i === 'object' && i.postcssPlugin) {
normalized.push(i)
} else if (typeof i === 'function') {
normalized.push(i)
} else if (typeof i === 'object' && (i.parse || i.stringify)) {
if (false) {}
} else {
throw new Error(i + ' is not a PostCSS plugin')
}
}
return normalized
}
process(css, opts = {}) {
if (
!this.plugins.length &&
!opts.parser &&
!opts.stringifier &&
!opts.syntax
) {
return new NoWorkResult(this, css, opts)
} else {
return new LazyResult(this, css, opts)
}
}
use(plugin) {
this.plugins = this.plugins.concat(this.normalize([plugin]))
return this
}
}
module.exports = Processor
Processor.default = Processor
Root.registerProcessor(Processor)
Document.registerProcessor(Processor)
/***/ }),
/***/ 9055:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let Warning = __webpack_require__(5776)
class Result {
constructor(processor, root, opts) {
this.processor = processor
this.messages = []
this.root = root
this.opts = opts
this.css = undefined
this.map = undefined
}
toString() {
return this.css
}
warn(text, opts = {}) {
if (!opts.plugin) {
if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
opts.plugin = this.lastPlugin.postcssPlugin
}
}
let warning = new Warning(text, opts)
this.messages.push(warning)
return warning
}
warnings() {
return this.messages.filter(i => i.type === 'warning')
}
get content() {
return this.css
}
}
module.exports = Result
Result.default = Result
/***/ }),
/***/ 9434:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let Container = __webpack_require__(683)
let LazyResult, Processor
class Root extends Container {
constructor(defaults) {
super(defaults)
this.type = 'root'
if (!this.nodes) this.nodes = []
}
normalize(child, sample, type) {
let nodes = super.normalize(child)
if (sample) {
if (type === 'prepend') {
if (this.nodes.length > 1) {
sample.raws.before = this.nodes[1].raws.before
} else {
delete sample.raws.before
}
} else if (this.first !== sample) {
for (let node of nodes) {
node.raws.before = sample.raws.before
}
}
}
return nodes
}
removeChild(child, ignore) {
let index = this.index(child)
if (!ignore && index === 0 && this.nodes.length > 1) {
this.nodes[1].raws.before = this.nodes[index].raws.before
}
return super.removeChild(child)
}
toResult(opts = {}) {
let lazy = new LazyResult(new Processor(), this, opts)
return lazy.stringify()
}
}
Root.registerLazyResult = dependant => {
LazyResult = dependant
}
Root.registerProcessor = dependant => {
Processor = dependant
}
module.exports = Root
Root.default = Root
Container.registerRoot(Root)
/***/ }),
/***/ 4092:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let Container = __webpack_require__(683)
let list = __webpack_require__(7374)
class Rule extends Container {
constructor(defaults) {
super(defaults)
this.type = 'rule'
if (!this.nodes) this.nodes = []
}
get selectors() {
return list.comma(this.selector)
}
set selectors(values) {
let match = this.selector ? this.selector.match(/,\s*/) : null
let sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen')
this.selector = values.join(sep)
}
}
module.exports = Rule
Rule.default = Rule
Container.registerRule(Rule)
/***/ }),
/***/ 346:
/***/ ((module) => {
"use strict";
const DEFAULT_RAW = {
after: '\n',
beforeClose: '\n',
beforeComment: '\n',
beforeDecl: '\n',
beforeOpen: ' ',
beforeRule: '\n',
colon: ': ',
commentLeft: ' ',
commentRight: ' ',
emptyBody: '',
indent: ' ',
semicolon: false
}
function capitalize(str) {
return str[0].toUpperCase() + str.slice(1)
}
class Stringifier {
constructor(builder) {
this.builder = builder
}
atrule(node, semicolon) {
let name = '@' + node.name
let params = node.params ? this.rawValue(node, 'params') : ''
if (typeof node.raws.afterName !== 'undefined') {
name += node.raws.afterName
} else if (params) {
name += ' '
}
if (node.nodes) {
this.block(node, name + params)
} else {
let end = (node.raws.between || '') + (semicolon ? ';' : '')
this.builder(name + params + end, node)
}
}
beforeAfter(node, detect) {
let value
if (node.type === 'decl') {
value = this.raw(node, null, 'beforeDecl')
} else if (node.type === 'comment') {
value = this.raw(node, null, 'beforeComment')
} else if (detect === 'before') {
value = this.raw(node, null, 'beforeRule')
} else {
value = this.raw(node, null, 'beforeClose')
}
let buf = node.parent
let depth = 0
while (buf && buf.type !== 'root') {
depth += 1
buf = buf.parent
}
if (value.includes('\n')) {
let indent = this.raw(node, null, 'indent')
if (indent.length) {
for (let step = 0; step < depth; step++) value += indent
}
}
return value
}
block(node, start) {
let between = this.raw(node, 'between', 'beforeOpen')
this.builder(start + between + '{', node, 'start')
let after
if (node.nodes && node.nodes.length) {
this.body(node)
after = this.raw(node, 'after')
} else {
after = this.raw(node, 'after', 'emptyBody')
}
if (after) this.builder(after)
this.builder('}', node, 'end')
}
body(node) {
let last = node.nodes.length - 1
while (last > 0) {
if (node.nodes[last].type !== 'comment') break
last -= 1
}
let semicolon = this.raw(node, 'semicolon')
for (let i = 0; i < node.nodes.length; i++) {
let child = node.nodes[i]
let before = this.raw(child, 'before')
if (before) this.builder(before)
this.stringify(child, last !== i || semicolon)
}
}
comment(node) {
let left = this.raw(node, 'left', 'commentLeft')
let right = this.raw(node, 'right', 'commentRight')
this.builder('/*' + left + node.text + right + '*/', node)
}
decl(node, semicolon) {
let between = this.raw(node, 'between', 'colon')
let string = node.prop + between + this.rawValue(node, 'value')
if (node.important) {
string += node.raws.important || ' !important'
}
if (semicolon) string += ';'
this.builder(string, node)
}
document(node) {
this.body(node)
}
raw(node, own, detect) {
let value
if (!detect) detect = own
// Already had
if (own) {
value = node.raws[own]
if (typeof value !== 'undefined') return value
}
let parent = node.parent
if (detect === 'before') {
// Hack for first rule in CSS
if (!parent || (parent.type === 'root' && parent.first === node)) {
return ''
}
// `root` nodes in `document` should use only their own raws
if (parent && parent.type === 'document') {
return ''
}
}
// Floating child without parent
if (!parent) return DEFAULT_RAW[detect]
// Detect style by other nodes
let root = node.root()
if (!root.rawCache) root.rawCache = {}
if (typeof root.rawCache[detect] !== 'undefined') {
return root.rawCache[detect]
}
if (detect === 'before' || detect === 'after') {
return this.beforeAfter(node, detect)
} else {
let method = 'raw' + capitalize(detect)
if (this[method]) {
value = this[method](root, node)
} else {
root.walk(i => {
value = i.raws[own]
if (typeof value !== 'undefined') return false
})
}
}
if (typeof value === 'undefined') value = DEFAULT_RAW[detect]
root.rawCache[detect] = value
return value
}
rawBeforeClose(root) {
let value
root.walk(i => {
if (i.nodes && i.nodes.length > 0) {
if (typeof i.raws.after !== 'undefined') {
value = i.raws.after
if (value.includes('\n')) {
value = value.replace(/[^\n]+$/, '')
}
return false
}
}
})
if (value) value = value.replace(/\S/g, '')
return value
}
rawBeforeComment(root, node) {
let value
root.walkComments(i => {
if (typeof i.raws.before !== 'undefined') {
value = i.raws.before
if (value.includes('\n')) {
value = value.replace(/[^\n]+$/, '')
}
return false
}
})
if (typeof value === 'undefined') {
value = this.raw(node, null, 'beforeDecl')
} else if (value) {
value = value.replace(/\S/g, '')
}
return value
}
rawBeforeDecl(root, node) {
let value
root.walkDecls(i => {
if (typeof i.raws.before !== 'undefined') {
value = i.raws.before
if (value.includes('\n')) {
value = value.replace(/[^\n]+$/, '')
}
return false
}
})
if (typeof value === 'undefined') {
value = this.raw(node, null, 'beforeRule')
} else if (value) {
value = value.replace(/\S/g, '')
}
return value
}
rawBeforeOpen(root) {
let value
root.walk(i => {
if (i.type !== 'decl') {
value = i.raws.between
if (typeof value !== 'undefined') return false
}
})
return value
}
rawBeforeRule(root) {
let value
root.walk(i => {
if (i.nodes && (i.parent !== root || root.first !== i)) {
if (typeof i.raws.before !== 'undefined') {
value = i.raws.before
if (value.includes('\n')) {
value = value.replace(/[^\n]+$/, '')
}
return false
}
}
})
if (value) value = value.replace(/\S/g, '')
return value
}
rawColon(root) {
let value
root.walkDecls(i => {
if (typeof i.raws.between !== 'undefined') {
value = i.raws.between.replace(/[^\s:]/g, '')
return false
}
})
return value
}
rawEmptyBody(root) {
let value
root.walk(i => {
if (i.nodes && i.nodes.length === 0) {
value = i.raws.after
if (typeof value !== 'undefined') return false
}
})
return value
}
rawIndent(root) {
if (root.raws.indent) return root.raws.indent
let value
root.walk(i => {
let p = i.parent
if (p && p !== root && p.parent && p.parent === root) {
if (typeof i.raws.before !== 'undefined') {
let parts = i.raws.before.split('\n')
value = parts[parts.length - 1]
value = value.replace(/\S/g, '')
return false
}
}
})
return value
}
rawSemicolon(root) {
let value
root.walk(i => {
if (i.nodes && i.nodes.length && i.last.type === 'decl') {
value = i.raws.semicolon
if (typeof value !== 'undefined') return false
}
})
return value
}
rawValue(node, prop) {
let value = node[prop]
let raw = node.raws[prop]
if (raw && raw.value === value) {
return raw.raw
}
return value
}
root(node) {
this.body(node)
if (node.raws.after) this.builder(node.raws.after)
}
rule(node) {
this.block(node, this.rawValue(node, 'selector'))
if (node.raws.ownSemicolon) {
this.builder(node.raws.ownSemicolon, node, 'end')
}
}
stringify(node, semicolon) {
/* c8 ignore start */
if (!this[node.type]) {
throw new Error(
'Unknown AST node type ' +
node.type +
'. ' +
'Maybe you need to change PostCSS stringifier.'
)
}
/* c8 ignore stop */
this[node.type](node, semicolon)
}
}
module.exports = Stringifier
Stringifier.default = Stringifier
/***/ }),
/***/ 633:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
let Stringifier = __webpack_require__(346)
function stringify(node, builder) {
let str = new Stringifier(builder)
str.stringify(node)
}
module.exports = stringify
stringify.default = stringify
/***/ }),
/***/ 1381:
/***/ ((module) => {
"use strict";
module.exports.isClean = Symbol('isClean')
module.exports.my = Symbol('my')
/***/ }),
/***/ 2327:
/***/ ((module) => {
"use strict";
const SINGLE_QUOTE = "'".charCodeAt(0)
const DOUBLE_QUOTE = '"'.charCodeAt(0)
const BACKSLASH = '\\'.charCodeAt(0)
const SLASH = '/'.charCodeAt(0)
const NEWLINE = '\n'.charCodeAt(0)
const SPACE = ' '.charCodeAt(0)
const FEED = '\f'.charCodeAt(0)
const TAB = '\t'.charCodeAt(0)
const CR = '\r'.charCodeAt(0)
const OPEN_SQUARE = '['.charCodeAt(0)
const CLOSE_SQUARE = ']'.charCodeAt(0)
const OPEN_PARENTHESES = '('.charCodeAt(0)
const CLOSE_PARENTHESES = ')'.charCodeAt(0)
const OPEN_CURLY = '{'.charCodeAt(0)
const CLOSE_CURLY = '}'.charCodeAt(0)
const SEMICOLON = ';'.charCodeAt(0)
const ASTERISK = '*'.charCodeAt(0)
const COLON = ':'.charCodeAt(0)
const AT = '@'.charCodeAt(0)
const RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g
const RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g
const RE_BAD_BRACKET = /.[\r\n"'(/\\]/
const RE_HEX_ESCAPE = /[\da-f]/i
module.exports = function tokenizer(input, options = {}) {
let css = input.css.valueOf()
let ignore = options.ignoreErrors
let code, next, quote, content, escape
let escaped, escapePos, prev, n, currentToken
let length = css.length
let pos = 0
let buffer = []
let returned = []
function position() {
return pos
}
function unclosed(what) {
throw input.error('Unclosed ' + what, pos)
}
function endOfFile() {
return returned.length === 0 && pos >= length
}
function nextToken(opts) {
if (returned.length) return returned.pop()
if (pos >= length) return
let ignoreUnclosed = opts ? opts.ignoreUnclosed : false
code = css.charCodeAt(pos)
switch (code) {
case NEWLINE:
case SPACE:
case TAB:
case CR:
case FEED: {
next = pos
do {
next += 1
code = css.charCodeAt(next)
} while (
code === SPACE ||
code === NEWLINE ||
code === TAB ||
code === CR ||
code === FEED
)
currentToken = ['space', css.slice(pos, next)]
pos = next - 1
break
}
case OPEN_SQUARE:
case CLOSE_SQUARE:
case OPEN_CURLY:
case CLOSE_CURLY:
case COLON:
case SEMICOLON:
case CLOSE_PARENTHESES: {
let controlChar = String.fromCharCode(code)
currentToken = [controlChar, controlChar, pos]
break
}
case OPEN_PARENTHESES: {
prev = buffer.length ? buffer.pop()[1] : ''
n = css.charCodeAt(pos + 1)
if (
prev === 'url' &&
n !== SINGLE_QUOTE &&
n !== DOUBLE_QUOTE &&
n !== SPACE &&
n !== NEWLINE &&
n !== TAB &&
n !== FEED &&
n !== CR
) {
next = pos
do {
escaped = false
next = css.indexOf(')', next + 1)
if (next === -1) {
if (ignore || ignoreUnclosed) {
next = pos
break
} else {
unclosed('bracket')
}
}
escapePos = next
while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
escapePos -= 1
escaped = !escaped
}
} while (escaped)
currentToken = ['brackets', css.slice(pos, next + 1), pos, next]
pos = next
} else {
next = css.indexOf(')', pos + 1)
content = css.slice(pos, next + 1)
if (next === -1 || RE_BAD_BRACKET.test(content)) {
currentToken = ['(', '(', pos]
} else {
currentToken = ['brackets', content, pos, next]
pos = next
}
}
break
}
case SINGLE_QUOTE:
case DOUBLE_QUOTE: {
quote = code === SINGLE_QUOTE ? "'" : '"'
next = pos
do {
escaped = false
next = css.indexOf(quote, next + 1)
if (next === -1) {
if (ignore || ignoreUnclosed) {
next = pos + 1
break
} else {
unclosed('string')
}
}
escapePos = next
while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
escapePos -= 1
escaped = !escaped
}
} while (escaped)
currentToken = ['string', css.slice(pos, next + 1), pos, next]
pos = next
break
}
case AT: {
RE_AT_END.lastIndex = pos + 1
RE_AT_END.test(css)
if (RE_AT_END.lastIndex === 0) {
next = css.length - 1
} else {
next = RE_AT_END.lastIndex - 2
}
currentToken = ['at-word', css.slice(pos, next + 1), pos, next]
pos = next
break
}
case BACKSLASH: {
next = pos
escape = true
while (css.charCodeAt(next + 1) === BACKSLASH) {
next += 1
escape = !escape
}
code = css.charCodeAt(next + 1)
if (
escape &&
code !== SLASH &&
code !== SPACE &&
code !== NEWLINE &&
code !== TAB &&
code !== CR &&
code !== FEED
) {
next += 1
if (RE_HEX_ESCAPE.test(css.charAt(next))) {
while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {
next += 1
}
if (css.charCodeAt(next + 1) === SPACE) {
next += 1
}
}
}
currentToken = ['word', css.slice(pos, next + 1), pos, next]
pos = next
break
}
default: {
if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {
next = css.indexOf('*/', pos + 2) + 1
if (next === 0) {
if (ignore || ignoreUnclosed) {
next = css.length
} else {
unclosed('comment')
}
}
currentToken = ['comment', css.slice(pos, next + 1), pos, next]
pos = next
} else {
RE_WORD_END.lastIndex = pos + 1
RE_WORD_END.test(css)
if (RE_WORD_END.lastIndex === 0) {
next = css.length - 1
} else {
next = RE_WORD_END.lastIndex - 2
}
currentToken = ['word', css.slice(pos, next + 1), pos, next]
buffer.push(currentToken)
pos = next
}
break
}
}
pos++
return currentToken
}
function back(token) {
returned.push(token)
}
return {
back,
endOfFile,
nextToken,
position
}
}
/***/ }),
/***/ 3122:
/***/ ((module) => {
"use strict";
/* eslint-disable no-console */
let printed = {}
module.exports = function warnOnce(message) {
if (printed[message]) return
printed[message] = true
if (typeof console !== 'undefined' && console.warn) {
console.warn(message)
}
}
/***/ }),
/***/ 5776:
/***/ ((module) => {
"use strict";
class Warning {
constructor(text, opts = {}) {
this.type = 'warning'
this.text = text
if (opts.node && opts.node.source) {
let range = opts.node.rangeBy(opts)
this.line = range.start.line
this.column = range.start.column
this.endLine = range.end.line
this.endColumn = range.end.column
}
for (let opt in opts) this[opt] = opts[opt]
}
toString() {
if (this.node) {
return this.node.error(this.text, {
index: this.index,
plugin: this.plugin,
word: this.word
}).message
}
if (this.plugin) {
return this.plugin + ': ' + this.text
}
return this.text
}
}
module.exports = Warning
Warning.default = Warning
/***/ }),
/***/ 628:
/***/ ((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__(4067);
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;
};
/***/ }),
/***/ 5826:
/***/ ((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__(628)();
}
/***/ }),
/***/ 4067:
/***/ ((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;
/***/ }),
/***/ 4462:
/***/ (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__(1609);
var PropTypes = __webpack_require__(5826);
var autosize = __webpack_require__(4306);
var _getLineHeight = __webpack_require__(461);
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 }));
});
/***/ }),
/***/ 4132:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var __webpack_unused_export__;
__webpack_unused_export__ = true;
var TextareaAutosize_1 = __webpack_require__(4462);
exports.A = TextareaAutosize_1.TextareaAutosize;
/***/ }),
/***/ 9681:
/***/ ((module) => {
var characterMap = {
"À": "A",
"Á": "A",
"Â": "A",
"Ã": "A",
"Ä": "A",
"Å": "A",
"Ấ": "A",
"Ắ": "A",
"Ẳ": "A",
"Ẵ": "A",
"Ặ": "A",
"Æ": "AE",
"Ầ": "A",
"Ằ": "A",
"Ȃ": "A",
"Ả": "A",
"Ạ": "A",
"Ẩ": "A",
"Ẫ": "A",
"Ậ": "A",
"Ç": "C",
"Ḉ": "C",
"È": "E",
"É": "E",
"Ê": "E",
"Ë": "E",
"Ế": "E",
"Ḗ": "E",
"Ề": "E",
"Ḕ": "E",
"Ḝ": "E",
"Ȇ": "E",
"Ẻ": "E",
"Ẽ": "E",
"Ẹ": "E",
"Ể": "E",
"Ễ": "E",
"Ệ": "E",
"Ì": "I",
"Í": "I",
"Î": "I",
"Ï": "I",
"Ḯ": "I",
"Ȋ": "I",
"Ỉ": "I",
"Ị": "I",
"Ð": "D",
"Ñ": "N",
"Ò": "O",
"Ó": "O",
"Ô": "O",
"Õ": "O",
"Ö": "O",
"Ø": "O",
"Ố": "O",
"Ṍ": "O",
"Ṓ": "O",
"Ȏ": "O",
"Ỏ": "O",
"Ọ": "O",
"Ổ": "O",
"Ỗ": "O",
"Ộ": "O",
"Ờ": "O",
"Ở": "O",
"Ỡ": "O",
"Ớ": "O",
"Ợ": "O",
"Ù": "U",
"Ú": "U",
"Û": "U",
"Ü": "U",
"Ủ": "U",
"Ụ": "U",
"Ử": "U",
"Ữ": "U",
"Ự": "U",
"Ý": "Y",
"à": "a",
"á": "a",
"â": "a",
"ã": "a",
"ä": "a",
"å": "a",
"ấ": "a",
"ắ": "a",
"ẳ": "a",
"ẵ": "a",
"ặ": "a",
"æ": "ae",
"ầ": "a",
"ằ": "a",
"ȃ": "a",
"ả": "a",
"ạ": "a",
"ẩ": "a",
"ẫ": "a",
"ậ": "a",
"ç": "c",
"ḉ": "c",
"è": "e",
"é": "e",
"ê": "e",
"ë": "e",
"ế": "e",
"ḗ": "e",
"ề": "e",
"ḕ": "e",
"ḝ": "e",
"ȇ": "e",
"ẻ": "e",
"ẽ": "e",
"ẹ": "e",
"ể": "e",
"ễ": "e",
"ệ": "e",
"ì": "i",
"í": "i",
"î": "i",
"ï": "i",
"ḯ": "i",
"ȋ": "i",
"ỉ": "i",
"ị": "i",
"ð": "d",
"ñ": "n",
"ò": "o",
"ó": "o",
"ô": "o",
"õ": "o",
"ö": "o",
"ø": "o",
"ố": "o",
"ṍ": "o",
"ṓ": "o",
"ȏ": "o",
"ỏ": "o",
"ọ": "o",
"ổ": "o",
"ỗ": "o",
"ộ": "o",
"ờ": "o",
"ở": "o",
"ỡ": "o",
"ớ": "o",
"ợ": "o",
"ù": "u",
"ú": "u",
"û": "u",
"ü": "u",
"ủ": "u",
"ụ": "u",
"ử": "u",
"ữ": "u",
"ự": "u",
"ý": "y",
"ÿ": "y",
"Ā": "A",
"ā": "a",
"Ă": "A",
"ă": "a",
"Ą": "A",
"ą": "a",
"Ć": "C",
"ć": "c",
"Ĉ": "C",
"ĉ": "c",
"Ċ": "C",
"ċ": "c",
"Č": "C",
"č": "c",
"C̆": "C",
"c̆": "c",
"Ď": "D",
"ď": "d",
"Đ": "D",
"đ": "d",
"Ē": "E",
"ē": "e",
"Ĕ": "E",
"ĕ": "e",
"Ė": "E",
"ė": "e",
"Ę": "E",
"ę": "e",
"Ě": "E",
"ě": "e",
"Ĝ": "G",
"Ǵ": "G",
"ĝ": "g",
"ǵ": "g",
"Ğ": "G",
"ğ": "g",
"Ġ": "G",
"ġ": "g",
"Ģ": "G",
"ģ": "g",
"Ĥ": "H",
"ĥ": "h",
"Ħ": "H",
"ħ": "h",
"Ḫ": "H",
"ḫ": "h",
"Ĩ": "I",
"ĩ": "i",
"Ī": "I",
"ī": "i",
"Ĭ": "I",
"ĭ": "i",
"Į": "I",
"į": "i",
"İ": "I",
"ı": "i",
"IJ": "IJ",
"ij": "ij",
"Ĵ": "J",
"ĵ": "j",
"Ķ": "K",
"ķ": "k",
"Ḱ": "K",
"ḱ": "k",
"K̆": "K",
"k̆": "k",
"Ĺ": "L",
"ĺ": "l",
"Ļ": "L",
"ļ": "l",
"Ľ": "L",
"ľ": "l",
"Ŀ": "L",
"ŀ": "l",
"Ł": "l",
"ł": "l",
"Ḿ": "M",
"ḿ": "m",
"M̆": "M",
"m̆": "m",
"Ń": "N",
"ń": "n",
"Ņ": "N",
"ņ": "n",
"Ň": "N",
"ň": "n",
"ʼn": "n",
"N̆": "N",
"n̆": "n",
"Ō": "O",
"ō": "o",
"Ŏ": "O",
"ŏ": "o",
"Ő": "O",
"ő": "o",
"Œ": "OE",
"œ": "oe",
"P̆": "P",
"p̆": "p",
"Ŕ": "R",
"ŕ": "r",
"Ŗ": "R",
"ŗ": "r",
"Ř": "R",
"ř": "r",
"R̆": "R",
"r̆": "r",
"Ȓ": "R",
"ȓ": "r",
"Ś": "S",
"ś": "s",
"Ŝ": "S",
"ŝ": "s",
"Ş": "S",
"Ș": "S",
"ș": "s",
"ş": "s",
"Š": "S",
"š": "s",
"Ţ": "T",
"ţ": "t",
"ț": "t",
"Ț": "T",
"Ť": "T",
"ť": "t",
"Ŧ": "T",
"ŧ": "t",
"T̆": "T",
"t̆": "t",
"Ũ": "U",
"ũ": "u",
"Ū": "U",
"ū": "u",
"Ŭ": "U",
"ŭ": "u",
"Ů": "U",
"ů": "u",
"Ű": "U",
"ű": "u",
"Ų": "U",
"ų": "u",
"Ȗ": "U",
"ȗ": "u",
"V̆": "V",
"v̆": "v",
"Ŵ": "W",
"ŵ": "w",
"Ẃ": "W",
"ẃ": "w",
"X̆": "X",
"x̆": "x",
"Ŷ": "Y",
"ŷ": "y",
"Ÿ": "Y",
"Y̆": "Y",
"y̆": "y",
"Ź": "Z",
"ź": "z",
"Ż": "Z",
"ż": "z",
"Ž": "Z",
"ž": "z",
"ſ": "s",
"ƒ": "f",
"Ơ": "O",
"ơ": "o",
"Ư": "U",
"ư": "u",
"Ǎ": "A",
"ǎ": "a",
"Ǐ": "I",
"ǐ": "i",
"Ǒ": "O",
"ǒ": "o",
"Ǔ": "U",
"ǔ": "u",
"Ǖ": "U",
"ǖ": "u",
"Ǘ": "U",
"ǘ": "u",
"Ǚ": "U",
"ǚ": "u",
"Ǜ": "U",
"ǜ": "u",
"Ứ": "U",
"ứ": "u",
"Ṹ": "U",
"ṹ": "u",
"Ǻ": "A",
"ǻ": "a",
"Ǽ": "AE",
"ǽ": "ae",
"Ǿ": "O",
"ǿ": "o",
"Þ": "TH",
"þ": "th",
"Ṕ": "P",
"ṕ": "p",
"Ṥ": "S",
"ṥ": "s",
"X́": "X",
"x́": "x",
"Ѓ": "Г",
"ѓ": "г",
"Ќ": "К",
"ќ": "к",
"A̋": "A",
"a̋": "a",
"E̋": "E",
"e̋": "e",
"I̋": "I",
"i̋": "i",
"Ǹ": "N",
"ǹ": "n",
"Ồ": "O",
"ồ": "o",
"Ṑ": "O",
"ṑ": "o",
"Ừ": "U",
"ừ": "u",
"Ẁ": "W",
"ẁ": "w",
"Ỳ": "Y",
"ỳ": "y",
"Ȁ": "A",
"ȁ": "a",
"Ȅ": "E",
"ȅ": "e",
"Ȉ": "I",
"ȉ": "i",
"Ȍ": "O",
"ȍ": "o",
"Ȑ": "R",
"ȑ": "r",
"Ȕ": "U",
"ȕ": "u",
"B̌": "B",
"b̌": "b",
"Č̣": "C",
"č̣": "c",
"Ê̌": "E",
"ê̌": "e",
"F̌": "F",
"f̌": "f",
"Ǧ": "G",
"ǧ": "g",
"Ȟ": "H",
"ȟ": "h",
"J̌": "J",
"ǰ": "j",
"Ǩ": "K",
"ǩ": "k",
"M̌": "M",
"m̌": "m",
"P̌": "P",
"p̌": "p",
"Q̌": "Q",
"q̌": "q",
"Ř̩": "R",
"ř̩": "r",
"Ṧ": "S",
"ṧ": "s",
"V̌": "V",
"v̌": "v",
"W̌": "W",
"w̌": "w",
"X̌": "X",
"x̌": "x",
"Y̌": "Y",
"y̌": "y",
"A̧": "A",
"a̧": "a",
"B̧": "B",
"b̧": "b",
"Ḑ": "D",
"ḑ": "d",
"Ȩ": "E",
"ȩ": "e",
"Ɛ̧": "E",
"ɛ̧": "e",
"Ḩ": "H",
"ḩ": "h",
"I̧": "I",
"i̧": "i",
"Ɨ̧": "I",
"ɨ̧": "i",
"M̧": "M",
"m̧": "m",
"O̧": "O",
"o̧": "o",
"Q̧": "Q",
"q̧": "q",
"U̧": "U",
"u̧": "u",
"X̧": "X",
"x̧": "x",
"Z̧": "Z",
"z̧": "z",
"й":"и",
"Й":"И",
"ё":"е",
"Ё":"Е",
};
var chars = Object.keys(characterMap).join('|');
var allAccents = new RegExp(chars, 'g');
var firstAccent = new RegExp(chars, '');
function matcher(match) {
return characterMap[match];
}
var removeAccents = function(string) {
return string.replace(allAccents, matcher);
};
var hasAccents = function(string) {
return !!string.match(firstAccent);
};
module.exports = removeAccents;
module.exports.has = hasAccents;
module.exports.remove = removeAccents;
/***/ }),
/***/ 1609:
/***/ ((module) => {
"use strict";
module.exports = window["React"];
/***/ }),
/***/ 9746:
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ 9977:
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ 197:
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ 1866:
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ 2739:
/***/ (() => {
/* (ignored) */
/***/ }),
/***/ 5042:
/***/ ((module) => {
let urlAlphabet =
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
let customAlphabet = (alphabet, defaultSize = 21) => {
return (size = defaultSize) => {
let id = ''
let i = size
while (i--) {
id += alphabet[(Math.random() * alphabet.length) | 0]
}
return id
}
}
let nanoid = (size = 21) => {
let id = ''
let i = size
while (i--) {
id += urlAlphabet[(Math.random() * 64) | 0]
}
return id
}
module.exports = { nanoid, customAlphabet }
/***/ })
/******/ });
/************************************************************************/
/******/ // 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 */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (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 */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (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.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
AlignmentControl: () => (/* reexport */ AlignmentControl),
AlignmentToolbar: () => (/* reexport */ AlignmentToolbar),
Autocomplete: () => (/* reexport */ autocomplete),
BlockAlignmentControl: () => (/* reexport */ BlockAlignmentControl),
BlockAlignmentToolbar: () => (/* reexport */ BlockAlignmentToolbar),
BlockBreadcrumb: () => (/* reexport */ block_breadcrumb),
BlockCanvas: () => (/* reexport */ block_canvas),
BlockColorsStyleSelector: () => (/* reexport */ color_style_selector),
BlockContextProvider: () => (/* reexport */ BlockContextProvider),
BlockControls: () => (/* reexport */ block_controls),
BlockEdit: () => (/* reexport */ BlockEdit),
BlockEditorKeyboardShortcuts: () => (/* reexport */ keyboard_shortcuts),
BlockEditorProvider: () => (/* reexport */ provider),
BlockFormatControls: () => (/* reexport */ BlockFormatControls),
BlockIcon: () => (/* reexport */ block_icon),
BlockInspector: () => (/* reexport */ block_inspector),
BlockList: () => (/* reexport */ BlockList),
BlockMover: () => (/* reexport */ block_mover),
BlockNavigationDropdown: () => (/* reexport */ dropdown),
BlockPreview: () => (/* reexport */ block_preview),
BlockSelectionClearer: () => (/* reexport */ BlockSelectionClearer),
BlockSettingsMenu: () => (/* reexport */ block_settings_menu),
BlockSettingsMenuControls: () => (/* reexport */ block_settings_menu_controls),
BlockStyles: () => (/* reexport */ block_styles),
BlockTitle: () => (/* reexport */ BlockTitle),
BlockToolbar: () => (/* reexport */ BlockToolbar),
BlockTools: () => (/* reexport */ BlockTools),
BlockVerticalAlignmentControl: () => (/* reexport */ BlockVerticalAlignmentControl),
BlockVerticalAlignmentToolbar: () => (/* reexport */ BlockVerticalAlignmentToolbar),
ButtonBlockAppender: () => (/* reexport */ button_block_appender),
ButtonBlockerAppender: () => (/* reexport */ ButtonBlockerAppender),
ColorPalette: () => (/* reexport */ color_palette),
ColorPaletteControl: () => (/* reexport */ ColorPaletteControl),
ContrastChecker: () => (/* reexport */ contrast_checker),
CopyHandler: () => (/* reexport */ CopyHandler),
DefaultBlockAppender: () => (/* reexport */ DefaultBlockAppender),
FontSizePicker: () => (/* reexport */ font_size_picker),
HeadingLevelDropdown: () => (/* reexport */ HeadingLevelDropdown),
HeightControl: () => (/* reexport */ HeightControl),
InnerBlocks: () => (/* reexport */ inner_blocks),
Inserter: () => (/* reexport */ inserter),
InspectorAdvancedControls: () => (/* reexport */ InspectorAdvancedControls),
InspectorControls: () => (/* reexport */ inspector_controls),
JustifyContentControl: () => (/* reexport */ JustifyContentControl),
JustifyToolbar: () => (/* reexport */ JustifyToolbar),
LineHeightControl: () => (/* reexport */ line_height_control),
MediaPlaceholder: () => (/* reexport */ media_placeholder),
MediaReplaceFlow: () => (/* reexport */ media_replace_flow),
MediaUpload: () => (/* reexport */ media_upload),
MediaUploadCheck: () => (/* reexport */ check),
MultiSelectScrollIntoView: () => (/* reexport */ MultiSelectScrollIntoView),
NavigableToolbar: () => (/* reexport */ NavigableToolbar),
ObserveTyping: () => (/* reexport */ observe_typing),
PanelColorSettings: () => (/* reexport */ panel_color_settings),
PlainText: () => (/* reexport */ plain_text),
RecursionProvider: () => (/* reexport */ RecursionProvider),
ReusableBlocksRenameHint: () => (/* reexport */ ReusableBlocksRenameHint),
RichText: () => (/* reexport */ rich_text),
RichTextShortcut: () => (/* reexport */ RichTextShortcut),
RichTextToolbarButton: () => (/* reexport */ RichTextToolbarButton),
SETTINGS_DEFAULTS: () => (/* reexport */ SETTINGS_DEFAULTS),
SkipToSelectedBlock: () => (/* reexport */ skip_to_selected_block),
ToolSelector: () => (/* reexport */ tool_selector),
Typewriter: () => (/* reexport */ typewriter),
URLInput: () => (/* reexport */ url_input),
URLInputButton: () => (/* reexport */ url_input_button),
URLPopover: () => (/* reexport */ url_popover),
Warning: () => (/* reexport */ warning),
WritingFlow: () => (/* reexport */ writing_flow),
__experimentalBlockAlignmentMatrixControl: () => (/* reexport */ block_alignment_matrix_control),
__experimentalBlockFullHeightAligmentControl: () => (/* reexport */ block_full_height_alignment_control),
__experimentalBlockPatternSetup: () => (/* reexport */ block_pattern_setup),
__experimentalBlockPatternsList: () => (/* reexport */ block_patterns_list),
__experimentalBlockVariationPicker: () => (/* reexport */ block_variation_picker),
__experimentalBlockVariationTransforms: () => (/* reexport */ block_variation_transforms),
__experimentalBorderRadiusControl: () => (/* reexport */ BorderRadiusControl),
__experimentalColorGradientControl: () => (/* reexport */ control),
__experimentalColorGradientSettingsDropdown: () => (/* reexport */ ColorGradientSettingsDropdown),
__experimentalDateFormatPicker: () => (/* reexport */ DateFormatPicker),
__experimentalDuotoneControl: () => (/* reexport */ duotone_control),
__experimentalFontAppearanceControl: () => (/* reexport */ FontAppearanceControl),
__experimentalFontFamilyControl: () => (/* reexport */ FontFamilyControl),
__experimentalGetBorderClassesAndStyles: () => (/* reexport */ getBorderClassesAndStyles),
__experimentalGetColorClassesAndStyles: () => (/* reexport */ getColorClassesAndStyles),
__experimentalGetElementClassName: () => (/* reexport */ __experimentalGetElementClassName),
__experimentalGetGapCSSValue: () => (/* reexport */ getGapCSSValue),
__experimentalGetGradientClass: () => (/* reexport */ __experimentalGetGradientClass),
__experimentalGetGradientObjectByGradientValue: () => (/* reexport */ __experimentalGetGradientObjectByGradientValue),
__experimentalGetShadowClassesAndStyles: () => (/* reexport */ getShadowClassesAndStyles),
__experimentalGetSpacingClassesAndStyles: () => (/* reexport */ getSpacingClassesAndStyles),
__experimentalImageEditor: () => (/* reexport */ ImageEditor),
__experimentalImageSizeControl: () => (/* reexport */ ImageSizeControl),
__experimentalImageURLInputUI: () => (/* reexport */ ImageURLInputUI),
__experimentalInspectorPopoverHeader: () => (/* reexport */ InspectorPopoverHeader),
__experimentalLetterSpacingControl: () => (/* reexport */ LetterSpacingControl),
__experimentalLibrary: () => (/* reexport */ library),
__experimentalLinkControl: () => (/* reexport */ link_control),
__experimentalLinkControlSearchInput: () => (/* reexport */ search_input),
__experimentalLinkControlSearchItem: () => (/* reexport */ search_item),
__experimentalLinkControlSearchResults: () => (/* reexport */ LinkControlSearchResults),
__experimentalListView: () => (/* reexport */ components_list_view),
__experimentalPanelColorGradientSettings: () => (/* reexport */ panel_color_gradient_settings),
__experimentalPreviewOptions: () => (/* reexport */ PreviewOptions),
__experimentalPublishDateTimePicker: () => (/* reexport */ publish_date_time_picker),
__experimentalRecursionProvider: () => (/* reexport */ DeprecatedExperimentalRecursionProvider),
__experimentalResponsiveBlockControl: () => (/* reexport */ responsive_block_control),
__experimentalSpacingSizesControl: () => (/* reexport */ SpacingSizesControl),
__experimentalTextDecorationControl: () => (/* reexport */ TextDecorationControl),
__experimentalTextTransformControl: () => (/* reexport */ TextTransformControl),
__experimentalUnitControl: () => (/* reexport */ UnitControl),
__experimentalUseBlockOverlayActive: () => (/* reexport */ useBlockOverlayActive),
__experimentalUseBlockPreview: () => (/* reexport */ useBlockPreview),
__experimentalUseBorderProps: () => (/* reexport */ useBorderProps),
__experimentalUseColorProps: () => (/* reexport */ useColorProps),
__experimentalUseCustomSides: () => (/* reexport */ useCustomSides),
__experimentalUseGradient: () => (/* reexport */ __experimentalUseGradient),
__experimentalUseHasRecursion: () => (/* reexport */ DeprecatedExperimentalUseHasRecursion),
__experimentalUseMultipleOriginColorsAndGradients: () => (/* reexport */ useMultipleOriginColorsAndGradients),
__experimentalUseResizeCanvas: () => (/* reexport */ useResizeCanvas),
__experimentalWritingModeControl: () => (/* reexport */ WritingModeControl),
__unstableBlockNameContext: () => (/* reexport */ block_name_context),
__unstableBlockSettingsMenuFirstItem: () => (/* reexport */ block_settings_menu_first_item),
__unstableBlockToolbarLastItem: () => (/* reexport */ block_toolbar_last_item),
__unstableEditorStyles: () => (/* reexport */ EditorStyles),
__unstableIframe: () => (/* reexport */ iframe),
__unstableInserterMenuExtension: () => (/* reexport */ inserter_menu_extension),
__unstableRichTextInputEvent: () => (/* reexport */ __unstableRichTextInputEvent),
__unstableUseBlockSelectionClearer: () => (/* reexport */ useBlockSelectionClearer),
__unstableUseClipboardHandler: () => (/* reexport */ __unstableUseClipboardHandler),
__unstableUseMouseMoveTypingReset: () => (/* reexport */ useMouseMoveTypingReset),
__unstableUseTypewriter: () => (/* reexport */ useTypewriter),
__unstableUseTypingObserver: () => (/* reexport */ useTypingObserver),
createCustomColorsHOC: () => (/* reexport */ createCustomColorsHOC),
getColorClassName: () => (/* reexport */ getColorClassName),
getColorObjectByAttributeValues: () => (/* reexport */ getColorObjectByAttributeValues),
getColorObjectByColorValue: () => (/* reexport */ getColorObjectByColorValue),
getComputedFluidTypographyValue: () => (/* reexport */ getComputedFluidTypographyValue),
getCustomValueFromPreset: () => (/* reexport */ getCustomValueFromPreset),
getFontSize: () => (/* reexport */ utils_getFontSize),
getFontSizeClass: () => (/* reexport */ getFontSizeClass),
getFontSizeObjectByValue: () => (/* reexport */ utils_getFontSizeObjectByValue),
getGradientSlugByValue: () => (/* reexport */ getGradientSlugByValue),
getGradientValueBySlug: () => (/* reexport */ getGradientValueBySlug),
getPxFromCssUnit: () => (/* reexport */ get_px_from_css_unit),
getSpacingPresetCssVar: () => (/* reexport */ getSpacingPresetCssVar),
getTypographyClassesAndStyles: () => (/* reexport */ getTypographyClassesAndStyles),
isValueSpacingPreset: () => (/* reexport */ isValueSpacingPreset),
privateApis: () => (/* reexport */ privateApis),
store: () => (/* reexport */ store),
storeConfig: () => (/* reexport */ storeConfig),
transformStyles: () => (/* reexport */ transform_styles),
useBlockCommands: () => (/* reexport */ useBlockCommands),
useBlockDisplayInformation: () => (/* reexport */ useBlockDisplayInformation),
useBlockEditContext: () => (/* reexport */ useBlockEditContext),
useBlockEditingMode: () => (/* reexport */ useBlockEditingMode),
useBlockProps: () => (/* reexport */ use_block_props_useBlockProps),
useCachedTruthy: () => (/* reexport */ useCachedTruthy),
useHasRecursion: () => (/* reexport */ useHasRecursion),
useInnerBlocksProps: () => (/* reexport */ useInnerBlocksProps),
useSetting: () => (/* reexport */ useSetting),
useSettings: () => (/* reexport */ use_settings_useSettings),
withColorContext: () => (/* reexport */ with_color_context),
withColors: () => (/* reexport */ withColors),
withFontSizes: () => (/* 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, {
__experimentalGetActiveBlockIdByBlockNames: () => (__experimentalGetActiveBlockIdByBlockNames),
__experimentalGetAllowedBlocks: () => (__experimentalGetAllowedBlocks),
__experimentalGetAllowedPatterns: () => (__experimentalGetAllowedPatterns),
__experimentalGetBlockListSettingsForBlocks: () => (__experimentalGetBlockListSettingsForBlocks),
__experimentalGetDirectInsertBlock: () => (__experimentalGetDirectInsertBlock),
__experimentalGetGlobalBlocksByName: () => (__experimentalGetGlobalBlocksByName),
__experimentalGetLastBlockAttributeChanges: () => (__experimentalGetLastBlockAttributeChanges),
__experimentalGetParsedPattern: () => (__experimentalGetParsedPattern),
__experimentalGetPatternTransformItems: () => (__experimentalGetPatternTransformItems),
__experimentalGetPatternsByBlockTypes: () => (__experimentalGetPatternsByBlockTypes),
__experimentalGetReusableBlockTitle: () => (__experimentalGetReusableBlockTitle),
__unstableGetBlockWithoutInnerBlocks: () => (__unstableGetBlockWithoutInnerBlocks),
__unstableGetClientIdWithClientIdsTree: () => (__unstableGetClientIdWithClientIdsTree),
__unstableGetClientIdsTree: () => (__unstableGetClientIdsTree),
__unstableGetContentLockingParent: () => (__unstableGetContentLockingParent),
__unstableGetEditorMode: () => (__unstableGetEditorMode),
__unstableGetSelectedBlocksWithPartialSelection: () => (__unstableGetSelectedBlocksWithPartialSelection),
__unstableGetTemporarilyEditingAsBlocks: () => (__unstableGetTemporarilyEditingAsBlocks),
__unstableGetTemporarilyEditingFocusModeToRevert: () => (__unstableGetTemporarilyEditingFocusModeToRevert),
__unstableGetVisibleBlocks: () => (__unstableGetVisibleBlocks),
__unstableHasActiveBlockOverlayActive: () => (__unstableHasActiveBlockOverlayActive),
__unstableIsFullySelected: () => (__unstableIsFullySelected),
__unstableIsLastBlockChangeIgnored: () => (__unstableIsLastBlockChangeIgnored),
__unstableIsSelectionCollapsed: () => (__unstableIsSelectionCollapsed),
__unstableIsSelectionMergeable: () => (__unstableIsSelectionMergeable),
__unstableIsWithinBlockOverlay: () => (__unstableIsWithinBlockOverlay),
__unstableSelectionHasUnmergeableBlock: () => (__unstableSelectionHasUnmergeableBlock),
areInnerBlocksControlled: () => (areInnerBlocksControlled),
canEditBlock: () => (canEditBlock),
canInsertBlockType: () => (canInsertBlockType),
canInsertBlocks: () => (canInsertBlocks),
canLockBlockType: () => (canLockBlockType),
canMoveBlock: () => (canMoveBlock),
canMoveBlocks: () => (canMoveBlocks),
canRemoveBlock: () => (canRemoveBlock),
canRemoveBlocks: () => (canRemoveBlocks),
didAutomaticChange: () => (didAutomaticChange),
getAdjacentBlockClientId: () => (getAdjacentBlockClientId),
getAllowedBlocks: () => (getAllowedBlocks),
getBlock: () => (getBlock),
getBlockAttributes: () => (getBlockAttributes),
getBlockCount: () => (getBlockCount),
getBlockEditingMode: () => (getBlockEditingMode),
getBlockHierarchyRootClientId: () => (getBlockHierarchyRootClientId),
getBlockIndex: () => (getBlockIndex),
getBlockInsertionPoint: () => (getBlockInsertionPoint),
getBlockListSettings: () => (getBlockListSettings),
getBlockMode: () => (getBlockMode),
getBlockName: () => (getBlockName),
getBlockNamesByClientId: () => (getBlockNamesByClientId),
getBlockOrder: () => (getBlockOrder),
getBlockParents: () => (getBlockParents),
getBlockParentsByBlockName: () => (getBlockParentsByBlockName),
getBlockRootClientId: () => (getBlockRootClientId),
getBlockSelectionEnd: () => (getBlockSelectionEnd),
getBlockSelectionStart: () => (getBlockSelectionStart),
getBlockTransformItems: () => (getBlockTransformItems),
getBlocks: () => (getBlocks),
getBlocksByClientId: () => (getBlocksByClientId),
getBlocksByName: () => (getBlocksByName),
getClientIdsOfDescendants: () => (getClientIdsOfDescendants),
getClientIdsWithDescendants: () => (getClientIdsWithDescendants),
getDirectInsertBlock: () => (getDirectInsertBlock),
getDraggedBlockClientIds: () => (getDraggedBlockClientIds),
getFirstMultiSelectedBlockClientId: () => (getFirstMultiSelectedBlockClientId),
getGlobalBlockCount: () => (getGlobalBlockCount),
getInserterItems: () => (getInserterItems),
getLastMultiSelectedBlockClientId: () => (getLastMultiSelectedBlockClientId),
getLowestCommonAncestorWithSelectedBlock: () => (getLowestCommonAncestorWithSelectedBlock),
getMultiSelectedBlockClientIds: () => (getMultiSelectedBlockClientIds),
getMultiSelectedBlocks: () => (getMultiSelectedBlocks),
getMultiSelectedBlocksEndClientId: () => (getMultiSelectedBlocksEndClientId),
getMultiSelectedBlocksStartClientId: () => (getMultiSelectedBlocksStartClientId),
getNextBlockClientId: () => (getNextBlockClientId),
getPatternsByBlockTypes: () => (getPatternsByBlockTypes),
getPreviousBlockClientId: () => (getPreviousBlockClientId),
getSelectedBlock: () => (getSelectedBlock),
getSelectedBlockClientId: () => (getSelectedBlockClientId),
getSelectedBlockClientIds: () => (getSelectedBlockClientIds),
getSelectedBlockCount: () => (getSelectedBlockCount),
getSelectedBlocksInitialCaretPosition: () => (getSelectedBlocksInitialCaretPosition),
getSelectionEnd: () => (getSelectionEnd),
getSelectionStart: () => (getSelectionStart),
getSettings: () => (getSettings),
getTemplate: () => (getTemplate),
getTemplateLock: () => (getTemplateLock),
hasBlockMovingClientId: () => (selectors_hasBlockMovingClientId),
hasDraggedInnerBlock: () => (hasDraggedInnerBlock),
hasInserterItems: () => (hasInserterItems),
hasMultiSelection: () => (hasMultiSelection),
hasSelectedBlock: () => (hasSelectedBlock),
hasSelectedInnerBlock: () => (hasSelectedInnerBlock),
isAncestorBeingDragged: () => (isAncestorBeingDragged),
isAncestorMultiSelected: () => (isAncestorMultiSelected),
isBlockBeingDragged: () => (isBlockBeingDragged),
isBlockHighlighted: () => (isBlockHighlighted),
isBlockInsertionPointVisible: () => (isBlockInsertionPointVisible),
isBlockMultiSelected: () => (isBlockMultiSelected),
isBlockSelected: () => (isBlockSelected),
isBlockValid: () => (isBlockValid),
isBlockVisible: () => (isBlockVisible),
isBlockWithinSelection: () => (isBlockWithinSelection),
isCaretWithinFormattedText: () => (isCaretWithinFormattedText),
isDraggingBlocks: () => (isDraggingBlocks),
isFirstMultiSelectedBlock: () => (isFirstMultiSelectedBlock),
isGroupable: () => (isGroupable),
isLastBlockChangePersistent: () => (isLastBlockChangePersistent),
isMultiSelecting: () => (selectors_isMultiSelecting),
isNavigationMode: () => (isNavigationMode),
isSelectionEnabled: () => (selectors_isSelectionEnabled),
isTyping: () => (selectors_isTyping),
isUngroupable: () => (isUngroupable),
isValidTemplate: () => (isValidTemplate),
wasBlockJustInserted: () => (wasBlockJustInserted)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/private-actions.js
var private_actions_namespaceObject = {};
__webpack_require__.r(private_actions_namespaceObject);
__webpack_require__.d(private_actions_namespaceObject, {
__experimentalUpdateSettings: () => (__experimentalUpdateSettings),
clearBlockRemovalPrompt: () => (clearBlockRemovalPrompt),
deleteStyleOverride: () => (deleteStyleOverride),
ensureDefaultBlock: () => (ensureDefaultBlock),
hideBlockInterface: () => (hideBlockInterface),
privateRemoveBlocks: () => (privateRemoveBlocks),
setBlockRemovalRules: () => (setBlockRemovalRules),
setLastFocus: () => (setLastFocus),
setOpenedBlockSettingsMenu: () => (setOpenedBlockSettingsMenu),
setStyleOverride: () => (setStyleOverride),
showBlockInterface: () => (showBlockInterface),
startDragging: () => (startDragging),
stopDragging: () => (stopDragging),
stopEditingAsBlocks: () => (stopEditingAsBlocks),
syncDerivedUpdates: () => (syncDerivedUpdates)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js
var private_selectors_namespaceObject = {};
__webpack_require__.r(private_selectors_namespaceObject);
__webpack_require__.d(private_selectors_namespaceObject, {
getAllPatterns: () => (getAllPatterns),
getBlockRemovalRules: () => (getBlockRemovalRules),
getBlockSettings: () => (getBlockSettings),
getBlockWithoutAttributes: () => (getBlockWithoutAttributes),
getEnabledBlockParents: () => (getEnabledBlockParents),
getEnabledClientIdsTree: () => (getEnabledClientIdsTree),
getInserterMediaCategories: () => (getInserterMediaCategories),
getLastFocus: () => (getLastFocus),
getLastInsertedBlocksClientIds: () => (getLastInsertedBlocksClientIds),
getOpenedBlockSettingsMenu: () => (getOpenedBlockSettingsMenu),
getRegisteredInserterMediaCategories: () => (getRegisteredInserterMediaCategories),
getRemovalPromptData: () => (getRemovalPromptData),
getStyleOverrides: () => (getStyleOverrides),
hasAllowedPatterns: () => (hasAllowedPatterns),
isBlockInterfaceHidden: () => (private_selectors_isBlockInterfaceHidden),
isBlockSubtreeDisabled: () => (isBlockSubtreeDisabled),
isDragging: () => (private_selectors_isDragging)
});
// 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, {
__unstableDeleteSelection: () => (__unstableDeleteSelection),
__unstableExpandSelection: () => (__unstableExpandSelection),
__unstableMarkAutomaticChange: () => (__unstableMarkAutomaticChange),
__unstableMarkLastChangeAsPersistent: () => (__unstableMarkLastChangeAsPersistent),
__unstableMarkNextChangeAsNotPersistent: () => (__unstableMarkNextChangeAsNotPersistent),
__unstableSaveReusableBlock: () => (__unstableSaveReusableBlock),
__unstableSetEditorMode: () => (__unstableSetEditorMode),
__unstableSetTemporarilyEditingAsBlocks: () => (__unstableSetTemporarilyEditingAsBlocks),
__unstableSplitSelection: () => (__unstableSplitSelection),
clearSelectedBlock: () => (clearSelectedBlock),
duplicateBlocks: () => (duplicateBlocks),
enterFormattedText: () => (enterFormattedText),
exitFormattedText: () => (exitFormattedText),
flashBlock: () => (flashBlock),
hideInsertionPoint: () => (hideInsertionPoint),
insertAfterBlock: () => (insertAfterBlock),
insertBeforeBlock: () => (insertBeforeBlock),
insertBlock: () => (insertBlock),
insertBlocks: () => (insertBlocks),
insertDefaultBlock: () => (insertDefaultBlock),
mergeBlocks: () => (mergeBlocks),
moveBlockToPosition: () => (moveBlockToPosition),
moveBlocksDown: () => (moveBlocksDown),
moveBlocksToPosition: () => (moveBlocksToPosition),
moveBlocksUp: () => (moveBlocksUp),
multiSelect: () => (multiSelect),
receiveBlocks: () => (receiveBlocks),
registerInserterMediaCategory: () => (registerInserterMediaCategory),
removeBlock: () => (removeBlock),
removeBlocks: () => (removeBlocks),
replaceBlock: () => (replaceBlock),
replaceBlocks: () => (replaceBlocks),
replaceInnerBlocks: () => (replaceInnerBlocks),
resetBlocks: () => (resetBlocks),
resetSelection: () => (resetSelection),
selectBlock: () => (selectBlock),
selectNextBlock: () => (selectNextBlock),
selectPreviousBlock: () => (selectPreviousBlock),
selectionChange: () => (selectionChange),
setBlockEditingMode: () => (setBlockEditingMode),
setBlockMovingClientId: () => (setBlockMovingClientId),
setBlockVisibility: () => (setBlockVisibility),
setHasControlledInnerBlocks: () => (setHasControlledInnerBlocks),
setNavigationMode: () => (setNavigationMode),
setTemplateValidity: () => (setTemplateValidity),
showInsertionPoint: () => (showInsertionPoint),
startDraggingBlocks: () => (startDraggingBlocks),
startMultiSelect: () => (startMultiSelect),
startTyping: () => (startTyping),
stopDraggingBlocks: () => (stopDraggingBlocks),
stopMultiSelect: () => (stopMultiSelect),
stopTyping: () => (stopTyping),
synchronizeTemplate: () => (synchronizeTemplate),
toggleBlockHighlight: () => (toggleBlockHighlight),
toggleBlockMode: () => (toggleBlockMode),
toggleSelection: () => (toggleSelection),
unsetBlockEditingMode: () => (unsetBlockEditingMode),
updateBlock: () => (updateBlock),
updateBlockAttributes: () => (updateBlockAttributes),
updateBlockListSettings: () => (updateBlockListSettings),
updateSettings: () => (updateSettings),
validateBlocksToTemplate: () => (validateBlocksToTemplate)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/index.js
var global_styles_namespaceObject = {};
__webpack_require__.r(global_styles_namespaceObject);
__webpack_require__.d(global_styles_namespaceObject, {
AdvancedPanel: () => (AdvancedPanel),
BorderPanel: () => (BorderPanel),
ColorPanel: () => (ColorPanel),
DimensionsPanel: () => (DimensionsPanel),
FiltersPanel: () => (FiltersPanel),
GlobalStylesContext: () => (GlobalStylesContext),
ImageSettingsPanel: () => (ImageSettingsPanel),
TypographyPanel: () => (TypographyPanel),
areGlobalStyleConfigsEqual: () => (areGlobalStyleConfigsEqual),
getBlockCSSSelector: () => (getBlockCSSSelector),
getGlobalStylesChanges: () => (getGlobalStylesChanges),
getLayoutStyles: () => (getLayoutStyles),
useGlobalSetting: () => (useGlobalSetting),
useGlobalStyle: () => (useGlobalStyle),
useGlobalStylesOutput: () => (useGlobalStylesOutput),
useGlobalStylesOutputWithConfig: () => (useGlobalStylesOutputWithConfig),
useGlobalStylesReset: () => (useGlobalStylesReset),
useHasBorderPanel: () => (useHasBorderPanel),
useHasBorderPanelControls: () => (useHasBorderPanelControls),
useHasColorPanel: () => (useHasColorPanel),
useHasDimensionsPanel: () => (useHasDimensionsPanel),
useHasFiltersPanel: () => (useHasFiltersPanel),
useHasImageSettingsPanel: () => (useHasImageSettingsPanel),
useHasTypographyPanel: () => (useHasTypographyPanel),
useSettingsForBlockElement: () => (useSettingsForBlockElement)
});
// EXTERNAL MODULE: external "React"
var external_React_ = __webpack_require__(1609);
var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_);
;// CONCATENATED MODULE: external ["wp","blocks"]
const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
;// CONCATENATED MODULE: external ["wp","element"]
const external_wp_element_namespaceObject = window["wp"]["element"];
;// CONCATENATED MODULE: external ["wp","data"]
const external_wp_data_namespaceObject = window["wp"]["data"];
;// CONCATENATED MODULE: external ["wp","compose"]
const external_wp_compose_namespaceObject = window["wp"]["compose"];
;// CONCATENATED MODULE: external ["wp","hooks"]
const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/context.js
/**
* WordPress dependencies
*/
const mayDisplayControlsKey = Symbol('mayDisplayControls');
const mayDisplayParentControlsKey = Symbol('mayDisplayParentControls');
const blockEditingModeKey = Symbol('blockEditingMode');
const blockBindingsKey = Symbol('blockBindings');
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: external ["wp","deprecated"]
const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
// EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js
var es6 = __webpack_require__(7734);
var es6_default = /*#__PURE__*/__webpack_require__.n(es6);
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/defaults.js
/**
* WordPress dependencies
*/
const PREFERENCES_DEFAULTS = {
insertUsage: {}
};
/**
* 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} distractionFree Whether or not the editor UI is distraction free
* @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} enableOpenverseMediaCategory Enable/Disable the Openverse media category in the inserter.
* @property {boolean} clearBlockSelection Whether the block editor should clear selection on mousedown when a block is not clicked.
* @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 = {
alignWide: false,
supportsLayout: true,
// 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: (0,external_wp_i18n_namespaceObject.__)('Black'),
slug: 'black',
color: '#000000'
}, {
name: (0,external_wp_i18n_namespaceObject.__)('Cyan bluish gray'),
slug: 'cyan-bluish-gray',
color: '#abb8c3'
}, {
name: (0,external_wp_i18n_namespaceObject.__)('White'),
slug: 'white',
color: '#ffffff'
}, {
name: (0,external_wp_i18n_namespaceObject.__)('Pale pink'),
slug: 'pale-pink',
color: '#f78da7'
}, {
name: (0,external_wp_i18n_namespaceObject.__)('Vivid red'),
slug: 'vivid-red',
color: '#cf2e2e'
}, {
name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid orange'),
slug: 'luminous-vivid-orange',
color: '#ff6900'
}, {
name: (0,external_wp_i18n_namespaceObject.__)('Luminous vivid amber'),
slug: 'luminous-vivid-amber',
color: '#fcb900'
}, {
name: (0,external_wp_i18n_namespaceObject.__)('Light green cyan'),
slug: 'light-green-cyan',
color: '#7bdcb5'
}, {
name: (0,external_wp_i18n_namespaceObject.__)('Vivid green cyan'),
slug: 'vivid-green-cyan',
color: '#00d084'
}, {
name: (0,external_wp_i18n_namespaceObject.__)('Pale cyan blue'),
slug: 'pale-cyan-blue',
color: '#8ed1fc'
}, {
name: (0,external_wp_i18n_namespaceObject.__)('Vivid cyan blue'),
slug: 'vivid-cyan-blue',
color: '#0693e3'
}, {
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: (0,external_wp_i18n_namespaceObject._x)('Small', 'font size name'),
size: 13,
slug: 'small'
}, {
name: (0,external_wp_i18n_namespaceObject._x)('Normal', 'font size name'),
size: 16,
slug: 'normal'
}, {
name: (0,external_wp_i18n_namespaceObject._x)('Medium', 'font size name'),
size: 20,
slug: 'medium'
}, {
name: (0,external_wp_i18n_namespaceObject._x)('Large', 'font size name'),
size: 36,
slug: 'large'
}, {
name: (0,external_wp_i18n_namespaceObject._x)('Huge', 'font size name'),
size: 42,
slug: 'huge'
}],
// Image default size slug.
imageDefaultSize: 'large',
imageSizes: [{
slug: 'thumbnail',
name: (0,external_wp_i18n_namespaceObject.__)('Thumbnail')
}, {
slug: 'medium',
name: (0,external_wp_i18n_namespaceObject.__)('Medium')
}, {
slug: 'large',
name: (0,external_wp_i18n_namespaceObject.__)('Large')
}, {
slug: 'full',
name: (0,external_wp_i18n_namespaceObject.__)('Full Size')
}],
// 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
maxWidth: 580,
// Allowed block types for the editor, defaulting to true (all supported).
allowedBlockTypes: true,
// Maximum upload size in bytes allowed for the site.
maxUploadFileSize: 0,
// List of allowed mime types and file extensions.
allowedMimeTypes: null,
// Allows to disable block locking interface.
canLockBlocks: true,
// Allows to disable Openverse media category in the inserter.
enableOpenverseMediaCategory: true,
clearBlockSelection: true,
__experimentalCanUserUseUnfilteredHTML: false,
__experimentalBlockDirectory: false,
__mobileEnablePageTemplates: false,
__experimentalBlockPatterns: [],
__experimentalBlockPatternCategories: [],
__unstableGalleryWithImageBlocks: false,
__unstableIsPreviewMode: false,
// These settings will be completely revamped in the future.
// The goal is to evolve this into an API which will instruct
// the block inspector to animate transitions between what it
// displays based on the relationship between the selected block
// and its parent, and only enable it if the parent is controlling
// its children blocks.
blockInspectorAnimation: {
animationParent: 'core/navigation',
'core/navigation': {
enterDirection: 'leftToRight'
},
'core/navigation-submenu': {
enterDirection: 'rightToLeft'
},
'core/navigation-link': {
enterDirection: 'rightToLeft'
},
'core/search': {
enterDirection: 'rightToLeft'
},
'core/social-links': {
enterDirection: 'rightToLeft'
},
'core/page-list': {
enterDirection: 'rightToLeft'
},
'core/spacer': {
enterDirection: 'rightToLeft'
},
'core/home-link': {
enterDirection: 'rightToLeft'
},
'core/site-title': {
enterDirection: 'rightToLeft'
},
'core/site-logo': {
enterDirection: 'rightToLeft'
}
},
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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (0,external_wp_i18n_namespaceObject.__)('Midnight'),
gradient: 'linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)',
slug: 'midnight'
}],
__unstableResolvedAssets: {
styles: [],
scripts: []
}
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/array.js
/**
* Insert one or multiple elements into a given position of an array.
*
* @param {Array} array Source array.
* @param {*} elements Elements to insert.
* @param {number} index Insert Position.
*
* @return {Array} Result.
*/
function insertAt(array, elements, index) {
return [...array.slice(0, index), ...(Array.isArray(elements) ? elements : [elements]), ...array.slice(index)];
}
/**
* Moves an element in an array.
*
* @param {Array} array Source array.
* @param {number} from Source index.
* @param {number} to Destination index.
* @param {number} count Number of elements to move.
*
* @return {Array} Result.
*/
function moveTo(array, from, to, count = 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
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const identity = x => x;
/**
* Given an array of blocks, returns an object where each key is a nesting
* context, the value of which is an array of block client IDs existing within
* that nesting context.
*
* @param {Array} blocks Blocks to map.
* @param {?string} rootClientId Assumed root client ID.
*
* @return {Object} Block order map object.
*/
function mapBlockOrder(blocks, rootClientId = '') {
const result = new Map();
const current = [];
result.set(rootClientId, current);
blocks.forEach(block => {
const {
clientId,
innerBlocks
} = block;
current.push(clientId);
mapBlockOrder(innerBlocks, clientId).forEach((order, subClientId) => {
result.set(subClientId, order);
});
});
return result;
}
/**
* Given an array of blocks, returns an object where each key contains
* the clientId of the block and the value is the parent of the block.
*
* @param {Array} blocks Blocks to map.
* @param {?string} rootClientId Assumed root client ID.
*
* @return {Object} Block order map object.
*/
function mapBlockParents(blocks, rootClientId = '') {
const result = [];
const stack = [[rootClientId, blocks]];
while (stack.length) {
const [parent, currentBlocks] = stack.shift();
currentBlocks.forEach(({
innerBlocks,
...block
}) => {
result.push([block.clientId, parent]);
if (innerBlocks?.length) {
stack.push([block.clientId, innerBlocks]);
}
});
}
return result;
}
/**
* Helper method to iterate through all blocks, recursing into inner blocks,
* applying a transformation function to each one.
* Returns a flattened object with the transformed blocks.
*
* @param {Array} blocks Blocks to flatten.
* @param {Function} transform Transforming function to be applied to each block.
*
* @return {Array} Flattened object.
*/
function flattenBlocks(blocks, transform = identity) {
const result = [];
const stack = [...blocks];
while (stack.length) {
const {
innerBlocks,
...block
} = stack.shift();
stack.push(...innerBlocks);
result.push([block.clientId, transform(block)]);
}
return result;
}
function getFlattenedClientIds(blocks) {
const result = {};
const stack = [...blocks];
while (stack.length) {
const {
innerBlocks,
...block
} = stack.shift();
stack.push(...innerBlocks);
result[block.clientId] = true;
}
return result;
}
/**
* Given an array of blocks, returns an object containing all blocks, without
* attributes, recursing into inner blocks. Keys correspond to the block client
* ID, the value of which is the attributes object.
*
* @param {Array} blocks Blocks to flatten.
*
* @return {Array} Flattened block attributes object.
*/
function getFlattenedBlocksWithoutAttributes(blocks) {
return flattenBlocks(blocks, block => {
const {
attributes,
...restBlock
} = block;
return restBlock;
});
}
/**
* Given an array of blocks, returns an object containing all block attributes,
* recursing into inner blocks. Keys correspond to the block client ID, the
* value of which is the attributes object.
*
* @param {Array} blocks Blocks to flatten.
*
* @return {Array} Flattened block attributes object.
*/
function getFlattenedBlockAttributes(blocks) {
return flattenBlocks(blocks, block => block.attributes);
}
/**
* Returns true if the two object arguments have the same keys, or false
* otherwise.
*
* @param {Object} a First object.
* @param {Object} b Second object.
*
* @return {boolean} Whether the two objects have the same keys.
*/
function hasSameKeys(a, b) {
return es6_default()(Object.keys(a), Object.keys(b));
}
/**
* Returns true if, given the currently dispatching action and the previously
* dispatched action, the two actions are updating the same block attribute, or
* false otherwise.
*
* @param {Object} action Currently dispatching action.
* @param {Object} lastAction Previously dispatched action.
*
* @return {boolean} Whether actions are updating the same block attribute.
*/
function isUpdatingSameBlockAttribute(action, lastAction) {
return action.type === 'UPDATE_BLOCK_ATTRIBUTES' && lastAction !== undefined && lastAction.type === 'UPDATE_BLOCK_ATTRIBUTES' && es6_default()(action.clientIds, lastAction.clientIds) && hasSameKeys(action.attributes, lastAction.attributes);
}
function updateBlockTreeForBlocks(state, blocks) {
const treeToUpdate = state.tree;
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) {
treeToUpdate.set(block.clientId, {});
}
for (const block of flattenedBlocks) {
treeToUpdate.set(block.clientId, Object.assign(treeToUpdate.get(block.clientId), {
...state.byClientId.get(block.clientId),
attributes: state.attributes.get(block.clientId),
innerBlocks: block.innerBlocks.map(subBlock => treeToUpdate.get(subBlock.clientId))
}));
}
}
function updateParentInnerBlocksInTree(state, updatedClientIds, updateChildrenOfUpdatedClientIds = false) {
const treeToUpdate = state.tree;
const uncontrolledParents = new Set([]);
const controlledParents = new Set();
for (const clientId of updatedClientIds) {
let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents.get(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.get(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) {
treeToUpdate.set(clientId, {
...treeToUpdate.get(clientId)
});
}
for (const clientId of uncontrolledParents) {
treeToUpdate.get(clientId).innerBlocks = (state.order.get(clientId) || []).map(subClientId => treeToUpdate.get(subClientId));
}
// Controlled parent blocks, need a dedicated key for their inner blocks
// to be used when doing getBlocks( controlledBlockClientId ).
for (const clientId of controlledParents) {
treeToUpdate.set('controlled||' + clientId, {
innerBlocks: (state.order.get(clientId) || []).map(subClientId => treeToUpdate.get(subClientId))
});
}
}
/**
* 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.
*
* @return {Function} Enhanced reducer function.
*/
const withBlockTree = reducer => (state = {}, action) => {
const newState = reducer(state, action);
if (newState === state) {
return state;
}
newState.tree = state.tree ? state.tree : new Map();
switch (action.type) {
case 'RECEIVE_BLOCKS':
case 'INSERT_BLOCKS':
{
newState.tree = new Map(newState.tree);
updateBlockTreeForBlocks(newState, action.blocks);
updateParentInnerBlocksInTree(newState, action.rootClientId ? [action.rootClientId] : [''], true);
break;
}
case 'UPDATE_BLOCK':
newState.tree = new Map(newState.tree);
newState.tree.set(action.clientId, {
...newState.tree.get(action.clientId),
...newState.byClientId.get(action.clientId),
attributes: newState.attributes.get(action.clientId)
});
updateParentInnerBlocksInTree(newState, [action.clientId], false);
break;
case 'SYNC_DERIVED_BLOCK_ATTRIBUTES':
case 'UPDATE_BLOCK_ATTRIBUTES':
{
newState.tree = new Map(newState.tree);
action.clientIds.forEach(clientId => {
newState.tree.set(clientId, {
...newState.tree.get(clientId),
attributes: newState.attributes.get(clientId)
});
});
updateParentInnerBlocksInTree(newState, action.clientIds, false);
break;
}
case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
{
const inserterClientIds = getFlattenedClientIds(action.blocks);
newState.tree = new Map(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 => !inserterClientIds[clientId]).map(clientId => 'controlled||' + clientId)).forEach(key => {
newState.tree.delete(key);
});
updateBlockTreeForBlocks(newState, action.blocks);
updateParentInnerBlocksInTree(newState, 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.get(clientId) !== undefined && (state.parents.get(clientId) === '' || newState.byClientId.get(state.parents.get(clientId)))) {
parentsOfRemovedBlocks.push(state.parents.get(clientId));
}
}
updateParentInnerBlocksInTree(newState, parentsOfRemovedBlocks, true);
break;
}
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
const parentsOfRemovedBlocks = [];
for (const clientId of action.clientIds) {
if (state.parents.get(clientId) !== undefined && (state.parents.get(clientId) === '' || newState.byClientId.get(state.parents.get(clientId)))) {
parentsOfRemovedBlocks.push(state.parents.get(clientId));
}
}
newState.tree = new Map(newState.tree);
action.removedClientIds.concat(action.removedClientIds.map(clientId => 'controlled||' + clientId)).forEach(key => {
newState.tree.delete(key);
});
updateParentInnerBlocksInTree(newState, parentsOfRemovedBlocks, true);
break;
case 'MOVE_BLOCKS_TO_POSITION':
{
const updatedBlockUids = [];
if (action.fromRootClientId) {
updatedBlockUids.push(action.fromRootClientId);
} else {
updatedBlockUids.push('');
}
if (action.toRootClientId) {
updatedBlockUids.push(action.toRootClientId);
}
newState.tree = new Map(newState.tree);
updateParentInnerBlocksInTree(newState, updatedBlockUids, true);
break;
}
case 'MOVE_BLOCKS_UP':
case 'MOVE_BLOCKS_DOWN':
{
const updatedBlockUids = [action.rootClientId ? action.rootClientId : ''];
newState.tree = new Map(newState.tree);
updateParentInnerBlocksInTree(newState, updatedBlockUids, true);
break;
}
case 'SAVE_REUSABLE_BLOCK_SUCCESS':
{
const updatedBlockUids = [];
newState.attributes.forEach((attributes, clientId) => {
if (newState.byClientId.get(clientId).name === 'core/block' && attributes.ref === action.updatedId) {
updatedBlockUids.push(clientId);
}
});
newState.tree = new Map(newState.tree);
updatedBlockUids.forEach(clientId => {
newState.tree.set(clientId, {
...newState.byClientId.get(clientId),
attributes: newState.attributes.get(clientId),
innerBlocks: newState.tree.get(clientId).innerBlocks
});
});
updateParentInnerBlocksInTree(newState, updatedBlockUids, false);
}
}
return newState;
};
/**
* Higher-order reducer intended to augment the blocks reducer, assigning an
* `isPersistentChange` property value corresponding to whether a change in
* state can be considered as persistent. All changes are considered persistent
* except when updating the same block attribute as in the previous action.
*
* @param {Function} reducer Original reducer function.
*
* @return {Function} Enhanced reducer function.
*/
function withPersistentBlockChange(reducer) {
let lastAction;
let markNextChangeAsNotPersistent = false;
let explicitPersistent;
return (state, action) => {
let nextState = reducer(state, action);
let nextIsPersistentChange;
if (action.type === 'SET_EXPLICIT_PERSISTENT') {
var _state$isPersistentCh;
explicitPersistent = action.isPersistentChange;
nextIsPersistentChange = (_state$isPersistentCh = state.isPersistentChange) !== null && _state$isPersistentCh !== void 0 ? _state$isPersistentCh : true;
}
if (explicitPersistent !== undefined) {
nextIsPersistentChange = explicitPersistent;
return nextIsPersistentChange === nextState.isPersistentChange ? nextState : {
...nextState,
isPersistentChange: nextIsPersistentChange
};
}
const isExplicitPersistentChange = action.type === 'MARK_LAST_CHANGE_AS_PERSISTENT' || markNextChangeAsNotPersistent;
// Defer to previous state value (or default) unless changing or
// explicitly marking as persistent.
if (state === nextState && !isExplicitPersistentChange) {
var _state$isPersistentCh2;
markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT';
nextIsPersistentChange = (_state$isPersistentCh2 = state?.isPersistentChange) !== null && _state$isPersistentCh2 !== void 0 ? _state$isPersistentCh2 : true;
if (state.isPersistentChange === nextIsPersistentChange) {
return state;
}
return {
...nextState,
isPersistentChange: nextIsPersistentChange
};
}
nextState = {
...nextState,
isPersistentChange: isExplicitPersistentChange ? !markNextChangeAsNotPersistent : !isUpdatingSameBlockAttribute(action, lastAction)
};
// In comparing against the previous action, consider only those which
// would have qualified as one which would have been ignored or not
// have resulted in a changed state.
lastAction = action;
markNextChangeAsNotPersistent = action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT';
return nextState;
};
}
/**
* Higher-order reducer intended to augment the blocks reducer, assigning an
* `isIgnoredChange` property value corresponding to whether a change in state
* can be considered as ignored. A change is considered ignored when the result
* of an action not incurred by direct user interaction.
*
* @param {Function} reducer Original reducer function.
*
* @return {Function} Enhanced reducer function.
*/
function withIgnoredBlockChange(reducer) {
/**
* Set of action types for which a blocks state change should be ignored.
*
* @type {Set}
*/
const IGNORED_ACTION_TYPES = new Set(['RECEIVE_BLOCKS']);
return (state, action) => {
const nextState = reducer(state, action);
if (nextState !== state) {
nextState.isIgnoredChange = IGNORED_ACTION_TYPES.has(action.type);
}
return nextState;
};
}
/**
* Higher-order reducer targeting the combined blocks reducer, augmenting
* block client IDs in remove action to include cascade of inner blocks.
*
* @param {Function} reducer Original reducer function.
*
* @return {Function} Enhanced reducer function.
*/
const withInnerBlocksRemoveCascade = reducer => (state, action) => {
// Gets all children which need to be removed.
const getAllChildren = clientIds => {
let result = clientIds;
for (let i = 0; i < result.length; i++) {
if (!state.order.get(result[i]) || action.keepControlledInnerBlocks && action.keepControlledInnerBlocks[result[i]]) {
continue;
}
if (result === clientIds) {
result = [...result];
}
result.push(...state.order.get(result[i]));
}
return result;
};
if (state) {
switch (action.type) {
case 'REMOVE_BLOCKS':
action = {
...action,
type: 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN',
removedClientIds: getAllChildren(action.clientIds)
};
break;
case 'REPLACE_BLOCKS':
action = {
...action,
type: 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN',
replacedClientIds: getAllChildren(action.clientIds)
};
break;
}
}
return reducer(state, action);
};
/**
* Higher-order reducer which targets the combined blocks reducer and handles
* the `RESET_BLOCKS` action. When dispatched, this action will replace all
* blocks that exist in the post, leaving blocks that exist only in state (e.g.
* reusable blocks and blocks controlled by inner blocks controllers) alone.
*
* @param {Function} reducer Original reducer function.
*
* @return {Function} Enhanced reducer function.
*/
const withBlockReset = reducer => (state, action) => {
if (action.type === 'RESET_BLOCKS') {
const newState = {
...state,
byClientId: new Map(getFlattenedBlocksWithoutAttributes(action.blocks)),
attributes: new Map(getFlattenedBlockAttributes(action.blocks)),
order: mapBlockOrder(action.blocks),
parents: new Map(mapBlockParents(action.blocks)),
controlledInnerBlocks: {}
};
newState.tree = new Map(state?.tree);
updateBlockTreeForBlocks(newState, action.blocks);
newState.tree.set('', {
innerBlocks: action.blocks.map(subBlock => newState.tree.get(subBlock.clientId))
});
return newState;
}
return reducer(state, action);
};
/**
* Higher-order reducer which targets the combined blocks reducer and handles
* the `REPLACE_INNER_BLOCKS` action. When dispatched, this action the state
* should become equivalent to the execution of a `REMOVE_BLOCKS` action
* containing all the child's of the root block followed by the execution of
* `INSERT_BLOCKS` with the new blocks.
*
* @param {Function} reducer Original reducer function.
*
* @return {Function} Enhanced reducer function.
*/
const withReplaceInnerBlocks = reducer => (state, action) => {
if (action.type !== 'REPLACE_INNER_BLOCKS') {
return reducer(state, action);
}
// Finds every nested inner block controller. We must check the action blocks
// and not just the block parent state because some inner block controllers
// should be deleted if specified, whereas others should not be deleted. If
// a controlled should not be deleted, then we need to avoid deleting its
// inner blocks from the block state because its inner blocks will not be
// attached to the block in the action.
const nestedControllers = {};
if (Object.keys(state.controlledInnerBlocks).length) {
const stack = [...action.blocks];
while (stack.length) {
const {
innerBlocks,
...block
} = stack.shift();
stack.push(...innerBlocks);
if (!!state.controlledInnerBlocks[block.clientId]) {
nestedControllers[block.clientId] = true;
}
}
}
// The `keepControlledInnerBlocks` prop will keep the inner blocks of the
// marked block in the block state so that they can be reattached to the
// marked block when we re-insert everything a few lines below.
let stateAfterBlocksRemoval = state;
if (state.order.get(action.rootClientId)) {
stateAfterBlocksRemoval = reducer(stateAfterBlocksRemoval, {
type: 'REMOVE_BLOCKS',
keepControlledInnerBlocks: nestedControllers,
clientIds: state.order.get(action.rootClientId)
});
}
let stateAfterInsert = stateAfterBlocksRemoval;
if (action.blocks.length) {
stateAfterInsert = reducer(stateAfterInsert, {
...action,
type: 'INSERT_BLOCKS',
index: 0
});
// We need to re-attach the controlled inner blocks to the blocks tree and
// preserve their block order. Otherwise, an inner block controller's blocks
// will be deleted entirely from its entity.
const stateAfterInsertOrder = new Map(stateAfterInsert.order);
Object.keys(nestedControllers).forEach(key => {
if (state.order.get(key)) {
stateAfterInsertOrder.set(key, state.order.get(key));
}
});
stateAfterInsert.order = stateAfterInsertOrder;
stateAfterInsert.tree = new Map(stateAfterInsert.tree);
Object.keys(nestedControllers).forEach(_key => {
const key = `controlled||${_key}`;
if (state.tree.has(key)) {
stateAfterInsert.tree.set(key, state.tree.get(key));
}
});
}
return stateAfterInsert;
};
/**
* Higher-order reducer which targets the combined blocks reducer and handles
* the `SAVE_REUSABLE_BLOCK_SUCCESS` action. This action can't be handled by
* regular reducers and needs a higher-order reducer since it needs access to
* both `byClientId` and `attributes` simultaneously.
*
* @param {Function} reducer Original reducer function.
*
* @return {Function} Enhanced reducer function.
*/
const withSaveReusableBlock = reducer => (state, action) => {
if (state && action.type === 'SAVE_REUSABLE_BLOCK_SUCCESS') {
const {
id,
updatedId
} = action;
// If a temporary reusable block is saved, we swap the temporary id with the final one.
if (id === updatedId) {
return state;
}
state = {
...state
};
state.attributes = new Map(state.attributes);
state.attributes.forEach((attributes, clientId) => {
const {
name
} = state.byClientId.get(clientId);
if (name === 'core/block' && attributes.ref === id) {
state.attributes.set(clientId, {
...attributes,
ref: updatedId
});
}
});
}
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.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
const blocks = (0,external_wp_compose_namespaceObject.pipe)(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)({
// The state is using a Map instead of a plain object for performance reasons.
// You can run the "./test/performance.js" unit test to check the impact
// code changes can have on this reducer.
byClientId(state = new Map(), action) {
switch (action.type) {
case 'RECEIVE_BLOCKS':
case 'INSERT_BLOCKS':
{
const newState = new Map(state);
getFlattenedBlocksWithoutAttributes(action.blocks).forEach(([key, value]) => {
newState.set(key, value);
});
return newState;
}
case 'UPDATE_BLOCK':
{
// Ignore updates if block isn't known.
if (!state.has(action.clientId)) {
return state;
}
// Do nothing if only attributes change.
const {
attributes,
...changes
} = action.updates;
if (Object.values(changes).length === 0) {
return state;
}
const newState = new Map(state);
newState.set(action.clientId, {
...state.get(action.clientId),
...changes
});
return newState;
}
case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
{
if (!action.blocks) {
return state;
}
const newState = new Map(state);
action.replacedClientIds.forEach(clientId => {
newState.delete(clientId);
});
getFlattenedBlocksWithoutAttributes(action.blocks).forEach(([key, value]) => {
newState.set(key, value);
});
return newState;
}
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
{
const newState = new Map(state);
action.removedClientIds.forEach(clientId => {
newState.delete(clientId);
});
return newState;
}
}
return state;
},
// The state is using a Map instead of a plain object for performance reasons.
// You can run the "./test/performance.js" unit test to check the impact
// code changes can have on this reducer.
attributes(state = new Map(), action) {
switch (action.type) {
case 'RECEIVE_BLOCKS':
case 'INSERT_BLOCKS':
{
const newState = new Map(state);
getFlattenedBlockAttributes(action.blocks).forEach(([key, value]) => {
newState.set(key, value);
});
return newState;
}
case 'UPDATE_BLOCK':
{
// Ignore updates if block isn't known or there are no attribute changes.
if (!state.get(action.clientId) || !action.updates.attributes) {
return state;
}
const newState = new Map(state);
newState.set(action.clientId, {
...state.get(action.clientId),
...action.updates.attributes
});
return newState;
}
case 'SYNC_DERIVED_BLOCK_ATTRIBUTES':
case 'UPDATE_BLOCK_ATTRIBUTES':
{
// Avoid a state change if none of the block IDs are known.
if (action.clientIds.every(id => !state.get(id))) {
return state;
}
let hasChange = false;
const newState = new Map(state);
for (const clientId of action.clientIds) {
var _action$attributes;
const updatedAttributeEntries = Object.entries(action.uniqueByBlock ? action.attributes[clientId] : (_action$attributes = action.attributes) !== null && _action$attributes !== void 0 ? _action$attributes : {});
if (updatedAttributeEntries.length === 0) {
continue;
}
let hasUpdatedAttributes = false;
const existingAttributes = state.get(clientId);
const newAttributes = {};
updatedAttributeEntries.forEach(([key, value]) => {
if (existingAttributes[key] !== value) {
hasUpdatedAttributes = true;
newAttributes[key] = value;
}
});
hasChange = hasChange || hasUpdatedAttributes;
if (hasUpdatedAttributes) {
newState.set(clientId, {
...existingAttributes,
...newAttributes
});
}
}
return hasChange ? newState : state;
}
case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
{
if (!action.blocks) {
return state;
}
const newState = new Map(state);
action.replacedClientIds.forEach(clientId => {
newState.delete(clientId);
});
getFlattenedBlockAttributes(action.blocks).forEach(([key, value]) => {
newState.set(key, value);
});
return newState;
}
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
{
const newState = new Map(state);
action.removedClientIds.forEach(clientId => {
newState.delete(clientId);
});
return newState;
}
}
return state;
},
// The state is using a Map instead of a plain object for performance reasons.
// You can run the "./test/performance.js" unit test to check the impact
// code changes can have on this reducer.
order(state = new Map(), action) {
switch (action.type) {
case 'RECEIVE_BLOCKS':
{
var _state$get;
const blockOrder = mapBlockOrder(action.blocks);
const newState = new Map(state);
blockOrder.forEach((order, clientId) => {
if (clientId !== '') {
newState.set(clientId, order);
}
});
newState.set('', ((_state$get = state.get('')) !== null && _state$get !== void 0 ? _state$get : []).concat(blockOrder['']));
return newState;
}
case 'INSERT_BLOCKS':
{
const {
rootClientId = ''
} = action;
const subState = state.get(rootClientId) || [];
const mappedBlocks = mapBlockOrder(action.blocks, rootClientId);
const {
index = subState.length
} = action;
const newState = new Map(state);
mappedBlocks.forEach((order, clientId) => {
newState.set(clientId, order);
});
newState.set(rootClientId, insertAt(subState, mappedBlocks.get(rootClientId), index));
return newState;
}
case 'MOVE_BLOCKS_TO_POSITION':
{
var _state$get$filter;
const {
fromRootClientId = '',
toRootClientId = '',
clientIds
} = action;
const {
index = state.get(toRootClientId).length
} = action;
// Moving inside the same parent block.
if (fromRootClientId === toRootClientId) {
const subState = state.get(toRootClientId);
const fromIndex = subState.indexOf(clientIds[0]);
const newState = new Map(state);
newState.set(toRootClientId, moveTo(state.get(toRootClientId), fromIndex, index, clientIds.length));
return newState;
}
// Moving from a parent block to another.
const newState = new Map(state);
newState.set(fromRootClientId, (_state$get$filter = state.get(fromRootClientId)?.filter(id => !clientIds.includes(id))) !== null && _state$get$filter !== void 0 ? _state$get$filter : []);
newState.set(toRootClientId, insertAt(state.get(toRootClientId), clientIds, index));
return newState;
}
case 'MOVE_BLOCKS_UP':
{
const {
clientIds,
rootClientId = ''
} = action;
const firstClientId = clientIds[0];
const subState = state.get(rootClientId);
if (!subState.length || firstClientId === subState[0]) {
return state;
}
const firstIndex = subState.indexOf(firstClientId);
const newState = new Map(state);
newState.set(rootClientId, moveTo(subState, firstIndex, firstIndex - 1, clientIds.length));
return newState;
}
case 'MOVE_BLOCKS_DOWN':
{
const {
clientIds,
rootClientId = ''
} = action;
const firstClientId = clientIds[0];
const lastClientId = clientIds[clientIds.length - 1];
const subState = state.get(rootClientId);
if (!subState.length || lastClientId === subState[subState.length - 1]) {
return state;
}
const firstIndex = subState.indexOf(firstClientId);
const newState = new Map(state);
newState.set(rootClientId, moveTo(subState, firstIndex, firstIndex + 1, clientIds.length));
return newState;
}
case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
{
const {
clientIds
} = action;
if (!action.blocks) {
return state;
}
const mappedBlocks = mapBlockOrder(action.blocks);
const newState = new Map(state);
action.replacedClientIds.forEach(clientId => {
newState.delete(clientId);
});
mappedBlocks.forEach((order, clientId) => {
if (clientId !== '') {
newState.set(clientId, order);
}
});
newState.forEach((order, clientId) => {
const newSubOrder = Object.values(order).reduce((result, subClientId) => {
if (subClientId === clientIds[0]) {
return [...result, ...mappedBlocks.get('')];
}
if (clientIds.indexOf(subClientId) === -1) {
result.push(subClientId);
}
return result;
}, []);
newState.set(clientId, newSubOrder);
});
return newState;
}
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
{
const newState = new Map(state);
// Remove inner block ordering for removed blocks.
action.removedClientIds.forEach(clientId => {
newState.delete(clientId);
});
newState.forEach((order, clientId) => {
var _order$filter;
const newSubOrder = (_order$filter = order?.filter(id => !action.removedClientIds.includes(id))) !== null && _order$filter !== void 0 ? _order$filter : [];
if (newSubOrder.length !== order.length) {
newState.set(clientId, newSubOrder);
}
});
return newState;
}
}
return state;
},
// 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 = new Map(), action) {
switch (action.type) {
case 'RECEIVE_BLOCKS':
{
const newState = new Map(state);
mapBlockParents(action.blocks).forEach(([key, value]) => {
newState.set(key, value);
});
return newState;
}
case 'INSERT_BLOCKS':
{
const newState = new Map(state);
mapBlockParents(action.blocks, action.rootClientId || '').forEach(([key, value]) => {
newState.set(key, value);
});
return newState;
}
case 'MOVE_BLOCKS_TO_POSITION':
{
const newState = new Map(state);
action.clientIds.forEach(id => {
newState.set(id, action.toRootClientId || '');
});
return newState;
}
case 'REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN':
{
const newState = new Map(state);
action.replacedClientIds.forEach(clientId => {
newState.delete(clientId);
});
mapBlockParents(action.blocks, state.get(action.clientIds[0])).forEach(([key, value]) => {
newState.set(key, value);
});
return newState;
}
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
{
const newState = new Map(state);
action.removedClientIds.forEach(clientId => {
newState.delete(clientId);
});
return newState;
}
}
return state;
},
controlledInnerBlocks(state = {}, {
type,
clientId,
hasControlledInnerBlocks
}) {
if (type === 'SET_HAS_CONTROLLED_INNER_BLOCKS') {
return {
...state,
[clientId]: hasControlledInnerBlocks
};
}
return state;
}
});
/**
* Reducer returning visibility status of block interface.
*
* @param {boolean} state Current state.
* @param {Object} action Dispatched action.
*
* @return {boolean} Updated state.
*/
function isBlockInterfaceHidden(state = false, action) {
switch (action.type) {
case 'HIDE_BLOCK_INTERFACE':
return true;
case 'SHOW_BLOCK_INTERFACE':
return false;
}
return state;
}
/**
* Reducer returning typing state.
*
* @param {boolean} state Current state.
* @param {Object} action Dispatched action.
*
* @return {boolean} Updated state.
*/
function isTyping(state = false, action) {
switch (action.type) {
case 'START_TYPING':
return true;
case 'STOP_TYPING':
return false;
}
return state;
}
/**
* Reducer returning dragging state. It is possible for a user to be dragging
* data from outside of the editor, so this state is separate from `draggedBlocks`.
*
* @param {boolean} state Current state.
* @param {Object} action Dispatched action.
*
* @return {boolean} Updated state.
*/
function isDragging(state = false, action) {
switch (action.type) {
case 'START_DRAGGING':
return true;
case 'STOP_DRAGGING':
return false;
}
return state;
}
/**
* Reducer returning dragged block client id.
*
* @param {string[]} state Current state.
* @param {Object} action Dispatched action.
*
* @return {string[]} Updated state.
*/
function draggedBlocks(state = [], action) {
switch (action.type) {
case 'START_DRAGGING_BLOCKS':
return action.clientIds;
case 'STOP_DRAGGING_BLOCKS':
return [];
}
return state;
}
/**
* Reducer tracking the visible blocks.
*
* @param {Record<string,boolean>} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Record<string,boolean>} Block visibility.
*/
function blockVisibility(state = {}, action) {
if (action.type === 'SET_BLOCK_VISIBILITY') {
return {
...state,
...action.updates
};
}
return state;
}
/**
* Internal helper reducer for selectionStart and selectionEnd. Can hold a block
* selection, represented by an object with property clientId.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function selectionHelper(state = {}, action) {
switch (action.type) {
case 'CLEAR_SELECTED_BLOCK':
{
if (state.clientId) {
return {};
}
return state;
}
case 'SELECT_BLOCK':
if (action.clientId === state.clientId) {
return state;
}
return {
clientId: action.clientId
};
case 'REPLACE_INNER_BLOCKS':
case 'INSERT_BLOCKS':
{
if (!action.updateSelection || !action.blocks.length) {
return state;
}
return {
clientId: action.blocks[0].clientId
};
}
case 'REMOVE_BLOCKS':
if (!action.clientIds || !action.clientIds.length || action.clientIds.indexOf(state.clientId) === -1) {
return state;
}
return {};
case 'REPLACE_BLOCKS':
{
if (action.clientIds.indexOf(state.clientId) === -1) {
return state;
}
const blockToSelect = action.blocks[action.indexToSelect] || action.blocks[action.blocks.length - 1];
if (!blockToSelect) {
return {};
}
if (blockToSelect.clientId === state.clientId) {
return state;
}
return {
clientId: blockToSelect.clientId
};
}
}
return state;
}
/**
* Reducer returning the selection state.
*
* @param {boolean} state Current state.
* @param {Object} action Dispatched action.
*
* @return {boolean} Updated state.
*/
function selection(state = {}, action) {
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: action.start || state.selectionStart,
selectionEnd: action.end || state.selectionEnd
};
case 'RESET_SELECTION':
const {
selectionStart,
selectionEnd
} = action;
return {
selectionStart,
selectionEnd
};
case 'MULTI_SELECT':
const {
start,
end
} = action;
if (start === state.selectionStart?.clientId && end === state.selectionEnd?.clientId) {
return state;
}
return {
selectionStart: {
clientId: start
},
selectionEnd: {
clientId: end
}
};
case 'RESET_BLOCKS':
const startClientId = state?.selectionStart?.clientId;
const endClientId = state?.selectionEnd?.clientId;
// Do nothing if there's no selected block.
if (!startClientId && !endClientId) {
return state;
}
// If the start of the selection won't exist after reset, remove selection.
if (!action.blocks.some(block => block.clientId === startClientId)) {
return {
selectionStart: {},
selectionEnd: {}
};
}
// If the end of the selection won't exist after reset, collapse selection.
if (!action.blocks.some(block => block.clientId === endClientId)) {
return {
...state,
selectionEnd: state.selectionStart
};
}
}
const selectionStart = selectionHelper(state.selectionStart, action);
const selectionEnd = selectionHelper(state.selectionEnd, action);
if (selectionStart === state.selectionStart && selectionEnd === state.selectionEnd) {
return state;
}
return {
selectionStart,
selectionEnd
};
}
/**
* Reducer returning whether the user is multi-selecting.
*
* @param {boolean} state Current state.
* @param {Object} action Dispatched action.
*
* @return {boolean} Updated state.
*/
function isMultiSelecting(state = false, action) {
switch (action.type) {
case 'START_MULTI_SELECT':
return true;
case 'STOP_MULTI_SELECT':
return false;
}
return state;
}
/**
* Reducer returning whether selection is enabled.
*
* @param {boolean} state Current state.
* @param {Object} action Dispatched action.
*
* @return {boolean} Updated state.
*/
function isSelectionEnabled(state = true, action) {
switch (action.type) {
case 'TOGGLE_SELECTION':
return action.isSelectionEnabled;
}
return state;
}
/**
* Reducer returning the data needed to display a prompt when certain blocks
* are removed, or `false` if no such prompt is requested.
*
* @param {boolean} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object|false} Data for removal prompt display, if any.
*/
function removalPromptData(state = false, action) {
switch (action.type) {
case 'DISPLAY_BLOCK_REMOVAL_PROMPT':
const {
clientIds,
selectPrevious,
blockNamesForPrompt,
messageType
} = action;
return {
clientIds,
selectPrevious,
blockNamesForPrompt,
messageType
};
case 'CLEAR_BLOCK_REMOVAL_PROMPT':
return false;
}
return state;
}
/**
* Reducer returning any rules that a block editor may provide in order to
* prevent a user from accidentally removing certain blocks. These rules are
* then used to display a confirmation prompt to the user. For instance, in the
* Site Editor, the Query Loop block is important enough to warrant such
* confirmation.
*
* The data is a record whose keys are block types (e.g. 'core/query') and
* whose values are the explanation to be shown to users (e.g. 'Query Loop
* displays a list of posts or pages.').
*
* @param {boolean} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Record<string,string>} Updated state.
*/
function blockRemovalRules(state = false, action) {
switch (action.type) {
case 'SET_BLOCK_REMOVAL_RULES':
return action.rules;
}
return state;
}
/**
* 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
* selection directly.
*
* @param {boolean} state Current state.
* @param {Object} action Dispatched action.
*
* @return {number|null} Initial position: 0, -1 or null.
*/
function initialPosition(state = null, action) {
if (action.type === 'REPLACE_BLOCKS' && action.initialPosition !== undefined) {
return action.initialPosition;
} 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) {
if (action.type === 'TOGGLE_BLOCK_MODE') {
const {
clientId
} = action;
return {
...state,
[clientId]: state[clientId] && state[clientId] === 'html' ? 'visual' : 'html'
};
}
return state;
}
/**
* Reducer returning the block insertion point visibility, either null if there
* is not an explicit insertion point assigned, or an object of its `index` and
* `rootClientId`.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function insertionPoint(state = null, action) {
switch (action.type) {
case 'SHOW_INSERTION_POINT':
{
const {
rootClientId,
index,
__unstableWithInserter,
operation,
nearestSide
} = action;
const nextState = {
rootClientId,
index,
__unstableWithInserter,
operation,
nearestSide
};
// Bail out updates if the states are the same.
return es6_default()(state, nextState) ? state : nextState;
}
case 'HIDE_INSERTION_POINT':
return null;
}
return state;
}
/**
* Reducer returning whether the post blocks match the defined template or not.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {boolean} Updated state.
*/
function template(state = {
isValid: true
}, action) {
switch (action.type) {
case 'SET_TEMPLATE_VALIDITY':
return {
...state,
isValid: action.isValid
};
}
return state;
}
/**
* Reducer returning the editor setting.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function settings(state = SETTINGS_DEFAULTS, action) {
switch (action.type) {
case 'UPDATE_SETTINGS':
if (action.reset) {
return {
...SETTINGS_DEFAULTS,
...action.settings
};
}
return {
...state,
...action.settings
};
}
return state;
}
/**
* Reducer returning the user preferences.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {string} Updated state.
*/
function preferences(state = PREFERENCES_DEFAULTS, action) {
switch (action.type) {
case 'INSERT_BLOCKS':
case 'REPLACE_BLOCKS':
return action.blocks.reduce((prevState, block) => {
const {
attributes,
name: blockName
} = block;
let id = blockName;
// 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`).
const match = (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getActiveBlockVariation(blockName, attributes);
if (match?.name) {
id += '/' + match.name;
}
if (blockName === 'core/block') {
id += '/' + attributes.ref;
}
return {
...prevState,
insertUsage: {
...prevState.insertUsage,
[id]: {
time: action.time,
count: prevState.insertUsage[id] ? prevState.insertUsage[id].count + 1 : 1
}
}
};
}, state);
}
return state;
}
/**
* Reducer returning an object where each key is a block client ID, its value
* representing the settings for its nested blocks.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
const blockListSettings = (state = {}, action) => {
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.fromEntries(Object.entries(state).filter(([id]) => !action.clientIds.includes(id)));
}
case 'UPDATE_BLOCK_LIST_SETTINGS':
{
const {
clientId
} = action;
if (!action.settings) {
if (state.hasOwnProperty(clientId)) {
const {
[clientId]: removedBlock,
...restBlocks
} = state;
return restBlocks;
}
return state;
}
if (es6_default()(state[clientId], action.settings)) {
return state;
}
return {
...state,
[clientId]: action.settings
};
}
}
return state;
};
/**
* Reducer returning which mode is enabled.
*
* @param {string} state Current state.
* @param {Object} action Dispatched action.
*
* @return {string} Updated state.
*/
function editorMode(state = 'edit', action) {
// Let inserting block in navigation mode always trigger Edit mode.
if (action.type === 'INSERT_BLOCKS' && state === 'navigation') {
return 'edit';
}
if (action.type === 'SET_EDITOR_MODE') {
return action.mode;
}
return state;
}
/**
* Reducer returning whether the block moving mode is enabled or not.
*
* @param {string|null} state Current state.
* @param {Object} action Dispatched action.
*
* @return {string|null} Updated state.
*/
function hasBlockMovingClientId(state = null, action) {
if (action.type === 'SET_BLOCK_MOVING_MODE') {
return action.hasBlockMovingClientId;
}
if (action.type === 'SET_EDITOR_MODE') {
return null;
}
return state;
}
/**
* Reducer return an updated state representing the most recent block attribute
* update. The state is structured as an object where the keys represent the
* client IDs of blocks, the values a subset of attributes from the most recent
* block update. The state is always reset to null if the last action is
* anything other than an attributes update.
*
* @param {Object<string,Object>} state Current state.
* @param {Object} action Action object.
*
* @return {[string,Object]} Updated state.
*/
function lastBlockAttributesChange(state = null, action) {
switch (action.type) {
case 'UPDATE_BLOCK':
if (!action.updates.attributes) {
break;
}
return {
[action.clientId]: action.updates.attributes
};
case 'UPDATE_BLOCK_ATTRIBUTES':
return action.clientIds.reduce((accumulator, id) => ({
...accumulator,
[id]: action.uniqueByBlock ? action.attributes[id] : action.attributes
}), {});
}
return state;
}
/**
* Reducer returning current highlighted block.
*
* @param {boolean} state Current highlighted block.
* @param {Object} action Dispatched action.
*
* @return {string} Updated state.
*/
function highlightedBlock(state, action) {
switch (action.type) {
case 'TOGGLE_BLOCK_HIGHLIGHT':
const {
clientId,
isHighlighted
} = action;
if (isHighlighted) {
return clientId;
} else if (state === clientId) {
return null;
}
return state;
case 'SELECT_BLOCK':
if (action.clientId !== state) {
return null;
}
}
return state;
}
/**
* Reducer returning the block insertion event list state.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function lastBlockInserted(state = {}, action) {
switch (action.type) {
case 'INSERT_BLOCKS':
case 'REPLACE_BLOCKS':
if (!action.blocks.length) {
return state;
}
const clientIds = action.blocks.map(block => {
return block.clientId;
});
const source = action.meta?.source;
return {
clientIds,
source
};
case 'RESET_BLOCKS':
return {};
}
return state;
}
/**
* Reducer returning the block that is eding temporarily edited as blocks.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function temporarilyEditingAsBlocks(state = '', action) {
if (action.type === 'SET_TEMPORARILY_EDITING_AS_BLOCKS') {
return action.temporarilyEditingAsBlocks;
}
return state;
}
/**
* Reducer returning the focus mode that should be used when temporarily edit as blocks finishes.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function temporarilyEditingFocusModeRevert(state = '', action) {
if (action.type === 'SET_TEMPORARILY_EDITING_AS_BLOCKS') {
return action.focusModeToRevert;
}
return state;
}
/**
* Reducer returning a map of block client IDs to block editing modes.
*
* @param {Map} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Map} Updated state.
*/
function blockEditingModes(state = new Map(), action) {
switch (action.type) {
case 'SET_BLOCK_EDITING_MODE':
return new Map(state).set(action.clientId, action.mode);
case 'UNSET_BLOCK_EDITING_MODE':
{
const newState = new Map(state);
newState.delete(action.clientId);
return newState;
}
case 'RESET_BLOCKS':
{
return state.has('') ? new Map().set('', state.get('')) : state;
}
}
return state;
}
/**
* Reducer returning the clientId of the block settings menu that is currently open.
*
* @param {string|null} state Current state.
* @param {Object} action Dispatched action.
*
* @return {string|null} Updated state.
*/
function openedBlockSettingsMenu(state = null, action) {
if ('SET_OPENED_BLOCK_SETTINGS_MENU' === action.type) {
var _action$clientId;
return (_action$clientId = action?.clientId) !== null && _action$clientId !== void 0 ? _action$clientId : null;
}
return state;
}
/**
* Reducer returning a map of style IDs to style overrides.
*
* @param {Map} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Map} Updated state.
*/
function styleOverrides(state = new Map(), action) {
switch (action.type) {
case 'SET_STYLE_OVERRIDE':
return new Map(state).set(action.id, action.style);
case 'DELETE_STYLE_OVERRIDE':
{
const newState = new Map(state);
newState.delete(action.id);
return newState;
}
}
return state;
}
/**
* Reducer returning a map of the registered inserter media categories.
*
* @param {Array} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Array} Updated state.
*/
function registeredInserterMediaCategories(state = [], action) {
switch (action.type) {
case 'REGISTER_INSERTER_MEDIA_CATEGORY':
return [...state, action.category];
}
return state;
}
/**
* Reducer setting last focused element
*
* @param {boolean} state Current state.
* @param {Object} action Dispatched action.
*
* @return {boolean} Updated state.
*/
function lastFocus(state = false, action) {
switch (action.type) {
case 'LAST_FOCUS':
return action.lastFocus;
}
return state;
}
const combinedReducers = (0,external_wp_data_namespaceObject.combineReducers)({
blocks,
isDragging,
isTyping,
isBlockInterfaceHidden,
draggedBlocks,
selection,
isMultiSelecting,
isSelectionEnabled,
initialPosition,
blocksMode,
blockListSettings,
insertionPoint,
template,
settings,
preferences,
lastBlockAttributesChange,
lastFocus,
editorMode,
hasBlockMovingClientId,
highlightedBlock,
lastBlockInserted,
temporarilyEditingAsBlocks,
temporarilyEditingFocusModeRevert,
blockVisibility,
blockEditingModes,
styleOverrides,
removalPromptData,
blockRemovalRules,
openedBlockSettingsMenu,
registeredInserterMediaCategories
});
function withAutomaticChangeReset(reducer) {
return (state, action) => {
const nextState = reducer(state, action);
if (!state) {
return nextState;
}
// Take over the last value without creating a new reference.
nextState.automaticChangeStatus = state.automaticChangeStatus;
if (action.type === 'MARK_AUTOMATIC_CHANGE') {
return {
...nextState,
automaticChangeStatus: 'pending'
};
}
if (action.type === 'MARK_AUTOMATIC_CHANGE_FINAL' && state.automaticChangeStatus === 'pending') {
return {
...nextState,
automaticChangeStatus: 'final'
};
}
// If there's a change that doesn't affect blocks or selection, maintain
// the current status.
if (nextState.blocks === state.blocks && nextState.selection === state.selection) {
return nextState;
}
// As long as the state is not final, ignore any selection changes.
if (nextState.automaticChangeStatus !== 'final' && nextState.selection !== state.selection) {
return nextState;
}
// Reset the status if blocks change or selection changes (when status is final).
return {
...nextState,
automaticChangeStatus: undefined
};
};
}
/* harmony default export */ const reducer = (withAutomaticChangeReset(combinedReducers));
;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js
/** @typedef {(...args: any[]) => *[]} GetDependants */
/** @typedef {() => void} Clear */
/**
* @typedef {{
* getDependants: GetDependants,
* clear: Clear
* }} EnhancedSelector
*/
/**
* Internal cache entry.
*
* @typedef CacheNode
*
* @property {?CacheNode|undefined} [prev] Previous node.
* @property {?CacheNode|undefined} [next] Next node.
* @property {*[]} args Function arguments for cache entry.
* @property {*} val Function result.
*/
/**
* @typedef Cache
*
* @property {Clear} clear Function to clear cache.
* @property {boolean} [isUniqueByDependants] Whether dependants are valid in
* considering cache uniqueness. A cache is unique if dependents are all arrays
* or objects.
* @property {CacheNode?} [head] Cache head.
* @property {*[]} [lastDependants] Dependants from previous invocation.
*/
/**
* Arbitrary value used as key for referencing cache object in WeakMap tree.
*
* @type {{}}
*/
var LEAF_KEY = {};
/**
* Returns the first argument as the sole entry in an array.
*
* @template T
*
* @param {T} value Value to return.
*
* @return {[T]} 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 {Cache} Cache object.
*/
function createCache() {
/** @type {Cache} */
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 {*[]} a First array.
* @param {*[]} 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.
*
* @template {(...args: *[]) => *} S
*
* @param {S} selector Selector function.
* @param {GetDependants=} getDependants Dependant getter returning an array of
* references used in cache bust consideration.
*/
/* harmony default export */ function rememo(selector, getDependants) {
/** @type {WeakMap<*,*>} */
var rootCache;
/** @type {GetDependants} */
var normalizedGetDependants = getDependants ? getDependants : arrayOf;
/**
* 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 {*[]} dependants Selector dependants.
*
* @return {Cache} Cache object.
*/
function getCache(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);
}
/**
* Resets root memoization cache.
*/
function clear() {
rootCache = new WeakMap();
}
/* eslint-disable jsdoc/check-param-names */
/**
* The augmented selector call, considering first whether dependants have
* changed before passing it to underlying memoize function.
*
* @param {*} source Source object for derivation.
* @param {...*} extraArgs Additional arguments to pass to selector.
*
* @return {*} Selector result.
*/
/* eslint-enable jsdoc/check-param-names */
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 = normalizedGetDependants.apply(null, args);
cache = getCache(dependants);
// If not guaranteed uniqueness by dependants (primitive type), 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.
/** @type {CacheNode} */ (node.prev).next = node.next;
if (node.next) {
node.next.prev = node.prev;
}
node.next = cache.head;
node.prev = null;
/** @type {CacheNode} */ (cache.head).prev = node;
cache.head = node;
}
// Return immediately
return node.val;
}
// No cached value found. Continue to insertion phase:
node = /** @type {CacheNode} */ ({
// 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 = normalizedGetDependants;
callSelector.clear = clear;
clear();
return /** @type {S & EnhancedSelector} */ (callSelector);
}
;// CONCATENATED MODULE: external ["wp","primitives"]
const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js
/**
* WordPress dependencies
*/
const symbol = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const library_symbol = (symbol);
;// CONCATENATED MODULE: external ["wp","richText"]
const external_wp_richText_namespaceObject = window["wp"]["richText"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/private-keys.js
const selectBlockPatternsKey = Symbol('selectBlockPatternsKey');
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/utils.js
/**
* Internal dependencies
*/
const checkAllowList = (list, item, defaultResult = null) => {
if (typeof list === 'boolean') {
return list;
}
if (Array.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 )
if (list.includes('core/post-content') && item === null) {
return true;
}
return list.includes(item);
}
return defaultResult;
};
const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
if (typeof allowedBlockTypes === 'boolean') {
return allowedBlockTypes;
}
const blocksQueue = [...blocks];
while (blocksQueue.length > 0) {
const block = blocksQueue.shift();
const isAllowed = checkAllowList(allowedBlockTypes, block.name || block.blockName, true);
if (!isAllowed) {
return false;
}
block.innerBlocks?.forEach(innerBlock => {
blocksQueue.push(innerBlock);
});
}
return true;
};
const getAllPatternsDependants = select => state => {
return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings[selectBlockPatternsKey]?.(select), state.blockPatterns];
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/sorting.js
/**
* Recursive stable sorting comparator function.
*
* @param {string|Function} field Field to sort by.
* @param {Array} items Items to sort.
* @param {string} order Order, 'asc' or 'desc'.
* @return {Function} Comparison function to be used in a `.sort()`.
*/
const comparator = (field, items, order) => {
return (a, b) => {
let cmpA, cmpB;
if (typeof field === 'function') {
cmpA = field(a);
cmpB = field(b);
} else {
cmpA = a[field];
cmpB = b[field];
}
if (cmpA > cmpB) {
return order === 'asc' ? 1 : -1;
} else if (cmpB > cmpA) {
return order === 'asc' ? -1 : 1;
}
const orderA = items.findIndex(item => item === a);
const orderB = items.findIndex(item => item === b);
// Stable sort: maintaining original array order
if (orderA > orderB) {
return 1;
} else if (orderB > orderA) {
return -1;
}
return 0;
};
};
/**
* Order items by a certain key.
* Supports decorator functions that allow complex picking of a comparison field.
* Sorts in ascending order by default, but supports descending as well.
* Stable sort - maintains original order of equal items.
*
* @param {Array} items Items to order.
* @param {string|Function} field Field to order by.
* @param {string} order Sorting order, `asc` or `desc`.
* @return {Array} Sorted items.
*/
function orderBy(items, field, order = 'asc') {
return items.concat().sort(comparator(field, items, order));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/constants.js
const STORE_NAME = 'core/block-editor';
;// CONCATENATED MODULE: external ["wp","privateApis"]
const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/lock-unlock.js
/**
* WordPress dependencies
*/
const {
lock,
unlock
} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/block-editor');
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/selectors.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* A block selection object.
*
* @typedef {Object} WPBlockSelection
*
* @property {string} clientId A block client ID.
* @property {string} attributeKey A block attribute key.
* @property {number} offset An attribute value offset, based on the rich
* text value. See `wp.richText.create`.
*/
// Module constants.
const MILLISECONDS_PER_HOUR = 3600 * 1000;
const MILLISECONDS_PER_DAY = 24 * 3600 * 1000;
const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000;
/**
* Shared reference to an empty array for cases where it is important to avoid
* returning a new array reference on every invocation, as in a connected or
* other pure component which performs `shouldComponentUpdate` check on props.
* This should be used as a last resort, since the normalized data should be
* maintained by the reducer result in state.
*
* @type {Array}
*/
const EMPTY_ARRAY = [];
/**
* Shared reference to an empty Set for cases where it is important to avoid
* returning a new Set reference on every invocation, as in a connected or
* other pure component which performs `shouldComponentUpdate` check on props.
* This should be used as a last resort, since the normalized data should be
* maintained by the reducer result in state.
*
* @type {Set}
*/
const EMPTY_SET = new Set();
/**
* Returns a block's name given its client ID, or null if no block exists with
* the client ID.
*
* @param {Object} state Editor state.
* @param {string} clientId Block client ID.
*
* @return {string} Block name.
*/
function getBlockName(state, clientId) {
const block = state.blocks.byClientId.get(clientId);
const socialLinkName = 'core/social-link';
if (external_wp_element_namespaceObject.Platform.OS !== 'web' && block?.name === socialLinkName) {
const attributes = state.blocks.attributes.get(clientId);
const {
service
} = attributes !== null && attributes !== void 0 ? attributes : {};
return service ? `${socialLinkName}-${service}` : socialLinkName;
}
return block ? block.name : null;
}
/**
* Returns whether a block is valid or not.
*
* @param {Object} state Editor state.
* @param {string} clientId Block client ID.
*
* @return {boolean} Is Valid.
*/
function isBlockValid(state, clientId) {
const block = state.blocks.byClientId.get(clientId);
return !!block && block.isValid;
}
/**
* Returns a block's attributes given its client ID, or null if no block exists with
* the client ID.
*
* @param {Object} state Editor state.
* @param {string} clientId Block client ID.
*
* @return {Object?} Block attributes.
*/
function getBlockAttributes(state, clientId) {
const block = state.blocks.byClientId.get(clientId);
if (!block) {
return null;
}
return state.blocks.attributes.get(clientId);
}
/**
* Returns a block given its client ID. This is a parsed copy of the block,
* containing its `blockName`, `clientId`, and current `attributes` state. This
* is not the block's registration settings, which must be retrieved from the
* blocks module registration store.
*
* getBlock recurses through its inner blocks until all its children blocks have
* been retrieved. Note that getBlock will not return the child inner blocks of
* an inner block controller. This is because an inner block controller syncs
* itself with its own entity, and should therefore not be included with the
* blocks of a different entity. For example, say you call `getBlocks( TP )` to
* get the blocks of a template part. If another template part is a child of TP,
* then the nested template part's child blocks will not be returned. This way,
* the template block itself is considered part of the parent, but the children
* are not.
*
* @param {Object} state Editor state.
* @param {string} clientId Block client ID.
*
* @return {Object} Parsed block object.
*/
function getBlock(state, clientId) {
if (!state.blocks.byClientId.has(clientId)) {
return null;
}
return state.blocks.tree.get(clientId);
}
const __unstableGetBlockWithoutInnerBlocks = rememo((state, clientId) => {
const block = state.blocks.byClientId.get(clientId);
if (!block) {
return null;
}
return {
...block,
attributes: getBlockAttributes(state, clientId)
};
}, (state, clientId) => [state.blocks.byClientId.get(clientId), state.blocks.attributes.get(clientId)]);
/**
* Returns all block objects for the current post being edited as an array in
* the order they appear in the post. Note that this will exclude child blocks
* of nested inner block controllers.
*
* @param {Object} state Editor state.
* @param {?string} rootClientId Optional root client ID of block list.
*
* @return {Object[]} Post blocks.
*/
function getBlocks(state, rootClientId) {
const treeKey = !rootClientId || !areInnerBlocksControlled(state, rootClientId) ? rootClientId || '' : 'controlled||' + rootClientId;
return state.blocks.tree.get(treeKey)?.innerBlocks || EMPTY_ARRAY;
}
/**
* Returns a stripped down block object containing only its client ID,
* and its inner blocks' client IDs.
*
* @deprecated
*
* @param {Object} state Editor state.
* @param {string} clientId Client ID of the block to get.
*
* @return {Object} Client IDs of the post blocks.
*/
const __unstableGetClientIdWithClientIdsTree = rememo((state, clientId) => {
external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__unstableGetClientIdWithClientIdsTree", {
since: '6.3',
version: '6.5'
});
return {
clientId,
innerBlocks: __unstableGetClientIdsTree(state, clientId)
};
}, state => [state.blocks.order]);
/**
* Returns the block tree represented in the block-editor store from the
* given root, consisting of stripped down block objects containing only
* their client IDs, and their inner blocks' client IDs.
*
* @deprecated
*
* @param {Object} state Editor state.
* @param {?string} rootClientId Optional root client ID of block list.
*
* @return {Object[]} Client IDs of the post blocks.
*/
const __unstableGetClientIdsTree = rememo((state, rootClientId = '') => {
external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__unstableGetClientIdsTree", {
since: '6.3',
version: '6.5'
});
return getBlockOrder(state, rootClientId).map(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 {string|string[]} rootIds Client ID(s) for which descendant blocks are to be returned.
*
* @return {Array} Client IDs of descendants.
*/
const getClientIdsOfDescendants = rememo((state, rootIds) => {
rootIds = Array.isArray(rootIds) ? [...rootIds] : [rootIds];
const ids = [];
// Add the descendants of the root blocks first.
for (const rootId of rootIds) {
const order = state.blocks.order.get(rootId);
if (order) {
ids.push(...order);
}
}
let index = 0;
// Add the descendants of the descendants, recursively.
while (index < ids.length) {
const id = ids[index];
const order = state.blocks.order.get(id);
if (order) {
ids.splice(index + 1, 0, ...order);
}
index++;
}
return ids;
}, 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 = state => getClientIdsOfDescendants(state, '');
/**
* Returns the total number of blocks, or the total number of blocks with a specific name in a post.
* The number returned includes nested blocks.
*
* @param {Object} state Global application state.
* @param {?string} blockName Optional block name, if specified only blocks of that type will be counted.
*
* @return {number} Number of blocks in the post, or number of blocks with name equal to blockName.
*/
const getGlobalBlockCount = rememo((state, blockName) => {
const clientIds = getClientIdsWithDescendants(state);
if (!blockName) {
return clientIds.length;
}
let count = 0;
for (const clientId of clientIds) {
const block = state.blocks.byClientId.get(clientId);
if (block.name === blockName) {
count++;
}
}
return count;
}, state => [state.blocks.order, state.blocks.byClientId]);
/**
* Returns all 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 getBlocksByName = rememo((state, blockName) => {
if (!blockName) {
return EMPTY_ARRAY;
}
const blockNames = Array.isArray(blockName) ? blockName : [blockName];
const clientIds = getClientIdsWithDescendants(state);
const foundBlocks = clientIds.filter(clientId => {
const block = state.blocks.byClientId.get(clientId);
return blockNames.includes(block.name);
});
return foundBlocks.length > 0 ? foundBlocks : EMPTY_ARRAY;
}, state => [state.blocks.order, state.blocks.byClientId]);
/**
* Returns all global blocks that match a blockName. Results include nested blocks.
*
* @deprecated
*
* @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.
*/
function __experimentalGetGlobalBlocksByName(state, blockName) {
external_wp_deprecated_default()("wp.data.select( 'core/block-editor' ).__experimentalGetGlobalBlocksByName", {
since: '6.5',
alternative: `wp.data.select( 'core/block-editor' ).getBlocksByName`
});
return getBlocksByName(state, blockName);
}
/**
* Given an array of block client IDs, returns the corresponding array of block
* objects.
*
* @param {Object} state Editor state.
* @param {string[]} clientIds Client IDs for which blocks are to be returned.
*
* @return {WPBlock[]} Block objects.
*/
const getBlocksByClientId = rememo((state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map(clientId => getBlock(state, clientId)), (state, clientIds) => (Array.isArray(clientIds) ? clientIds : [clientIds]).map(clientId => state.blocks.tree.get(clientId)));
/**
* Given an array of block client IDs, returns the corresponding array of block
* names.
*
* @param {Object} state Editor state.
* @param {string[]} clientIds Client IDs for which block names are to be returned.
*
* @return {string[]} Block names.
*/
const getBlockNamesByClientId = rememo((state, clientIds) => getBlocksByClientId(state, clientIds).filter(Boolean).map(block => block.name), (state, clientIds) => getBlocksByClientId(state, clientIds));
/**
* Returns the number of blocks currently present in the post.
*
* @param {Object} state Editor state.
* @param {?string} rootClientId Optional root client ID of block list.
*
* @return {number} Number of blocks in the post.
*/
function getBlockCount(state, rootClientId) {
return getBlockOrder(state, rootClientId).length;
}
/**
* Returns the current selection start block client ID, attribute key and text
* offset.
*
* @param {Object} state Block editor state.
*
* @return {WPBlockSelection} Selection start information.
*/
function getSelectionStart(state) {
return state.selection.selectionStart;
}
/**
* Returns the current selection end block client ID, attribute key and text
* offset.
*
* @param {Object} state Block editor state.
*
* @return {WPBlockSelection} Selection end information.
*/
function getSelectionEnd(state) {
return state.selection.selectionEnd;
}
/**
* Returns the current block selection start. This value may be null, and it
* may represent either a singular block selection or multi-selection start.
* A selection is singular if its start and end match.
*
* @param {Object} state Global application state.
*
* @return {?string} Client ID of block selection start.
*/
function getBlockSelectionStart(state) {
return state.selection.selectionStart.clientId;
}
/**
* Returns the current block selection end. This value may be null, and it
* may represent either a singular block selection or multi-selection end.
* A selection is singular if its start and end match.
*
* @param {Object} state Global application state.
*
* @return {?string} Client ID of block selection end.
*/
function getBlockSelectionEnd(state) {
return state.selection.selectionEnd.clientId;
}
/**
* Returns the number of blocks currently selected in the post.
*
* @param {Object} state Global application state.
*
* @return {number} Number of blocks selected in the post.
*/
function getSelectedBlockCount(state) {
const multiSelectedBlockCount = getMultiSelectedBlockClientIds(state).length;
if (multiSelectedBlockCount) {
return multiSelectedBlockCount;
}
return state.selection.selectionStart.clientId ? 1 : 0;
}
/**
* Returns true if there is a single selected block, or false otherwise.
*
* @param {Object} state Editor state.
*
* @return {boolean} Whether a single block is selected.
*/
function hasSelectedBlock(state) {
const {
selectionStart,
selectionEnd
} = state.selection;
return !!selectionStart.clientId && selectionStart.clientId === selectionEnd.clientId;
}
/**
* Returns the currently selected block client ID, or null if there is no
* selected block.
*
* @param {Object} state Editor state.
*
* @return {?string} Selected block client ID.
*/
function getSelectedBlockClientId(state) {
const {
selectionStart,
selectionEnd
} = state.selection;
const {
clientId
} = selectionStart;
if (!clientId || clientId !== selectionEnd.clientId) {
return null;
}
return clientId;
}
/**
* Returns the currently selected block, or null if there is no selected block.
*
* @param {Object} state Global application state.
*
* @return {?Object} Selected block.
*/
function getSelectedBlock(state) {
const clientId = getSelectedBlockClientId(state);
return clientId ? getBlock(state, clientId) : null;
}
/**
* Given a block client ID, returns the root block from which the block is
* nested, an empty string for top-level blocks, or null if the block does not
* exist.
*
* @param {Object} state Editor state.
* @param {string} clientId Block from which to find root client ID.
*
* @return {?string} Root client ID, if exists
*/
function getBlockRootClientId(state, clientId) {
var _state$blocks$parents;
return (_state$blocks$parents = state.blocks.parents.get(clientId)) !== null && _state$blocks$parents !== void 0 ? _state$blocks$parents : 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 {boolean} ascending Order results from bottom to top (true) or top to bottom (false).
*
* @return {Array} ClientIDs of the parent blocks.
*/
const getBlockParents = rememo((state, clientId, ascending = false) => {
const parents = [];
let current = clientId;
while (current = state.blocks.parents.get(current)) {
parents.push(current);
}
if (!parents.length) {
return EMPTY_ARRAY;
}
return ascending ? parents : parents.reverse();
}, state => [state.blocks.parents]);
/**
* Given a block client ID and a block name, returns the list of all its parents
* from top to bottom, filtered by the given name(s). For example, if passed
* 'core/group' as the blockName, it will only return parents which are group
* blocks. If passed `[ 'core/group', 'core/cover']`, as the blockName, it will
* return parents which are group blocks and parents which are cover blocks.
*
* @param {Object} state Editor state.
* @param {string} clientId Block from which to find root client ID.
* @param {string|string[]} blockName Block name(s) to filter.
* @param {boolean} ascending Order results from bottom to top (true) or top to bottom (false).
*
* @return {Array} ClientIDs of the parent blocks.
*/
const getBlockParentsByBlockName = rememo((state, clientId, blockName, ascending = false) => {
const parents = getBlockParents(state, clientId, ascending);
const hasName = Array.isArray(blockName) ? name => blockName.includes(name) : name => blockName === name;
return parents.filter(id => hasName(getBlockName(state, 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.
*
* @param {Object} state Editor state.
* @param {string} clientId Block from which to find root client ID.
*
* @return {string} Root client ID
*/
function getBlockHierarchyRootClientId(state, clientId) {
let current = clientId;
let parent;
do {
parent = current;
current = state.blocks.parents.get(current);
} while (current);
return parent;
}
/**
* Given a block client ID, returns the lowest common ancestor with selected client ID.
*
* @param {Object} state Editor state.
* @param {string} clientId Block from which to find common ancestor client ID.
*
* @return {string} Common ancestor client ID or undefined
*/
function getLowestCommonAncestorWithSelectedBlock(state, clientId) {
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);
for (let index = 0; index < maxDepth; index++) {
if (clientParents[index] === selectedParents[index]) {
lowestCommonAncestor = clientParents[index];
} else {
break;
}
}
return lowestCommonAncestor;
}
/**
* Returns the client ID of the block adjacent one at the given reference
* startClientId and modifier directionality. Defaults start startClientId to
* the selected block, and direction as next block. Returns null if there is no
* adjacent block.
*
* @param {Object} state Editor state.
* @param {?string} startClientId Optional client ID of block from which to
* search.
* @param {?number} modifier Directionality multiplier (1 next, -1
* previous).
*
* @return {?string} Return the client ID of the block, or null if none exists.
*/
function getAdjacentBlockClientId(state, startClientId, modifier = 1) {
// Default to selected block.
if (startClientId === undefined) {
startClientId = getSelectedBlockClientId(state);
}
// Try multi-selection starting at extent based on modifier.
if (startClientId === undefined) {
if (modifier < 0) {
startClientId = getFirstMultiSelectedBlockClientId(state);
} else {
startClientId = getLastMultiSelectedBlockClientId(state);
}
}
// Validate working start client ID.
if (!startClientId) {
return null;
}
// Retrieve start block root client ID, being careful to allow the falsey
// empty string top-level root by explicitly testing against null.
const rootClientId = getBlockRootClientId(state, startClientId);
if (rootClientId === null) {
return null;
}
const {
order
} = state.blocks;
const orderSet = order.get(rootClientId);
const index = orderSet.indexOf(startClientId);
const nextIndex = index + 1 * modifier;
// Block was first in set and we're attempting to get previous.
if (nextIndex < 0) {
return null;
}
// Block was last in set and we're attempting to get next.
if (nextIndex === orderSet.length) {
return null;
}
// Assume incremented index is within the set.
return orderSet[nextIndex];
}
/**
* Returns the previous block's client ID from the given reference start ID.
* Defaults start to the selected block. Returns null if there is no previous
* block.
*
* @param {Object} state Editor state.
* @param {?string} startClientId Optional client ID of block from which to
* search.
*
* @return {?string} Adjacent block's client ID, or null if none exists.
*/
function getPreviousBlockClientId(state, startClientId) {
return getAdjacentBlockClientId(state, startClientId, -1);
}
/**
* Returns the next block's client ID from the given reference start ID.
* Defaults start to the selected block. Returns null if there is no next
* block.
*
* @param {Object} state Editor state.
* @param {?string} startClientId Optional client ID of block from which to
* search.
*
* @return {?string} Adjacent block's client ID, or null if none exists.
*/
function getNextBlockClientId(state, startClientId) {
return getAdjacentBlockClientId(state, startClientId, 1);
}
/* 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.
* If the current block is not a RichText, having initial position set to 0 means "focus block"
*
* @param {Object} state Global application state.
*
* @return {0|-1|null} Initial position.
*/
function getSelectedBlocksInitialCaretPosition(state) {
/* eslint-enable jsdoc/valid-types */
return state.initialPosition;
}
/**
* Returns the current selection set of block client IDs (multiselection or single selection).
*
* @param {Object} state Editor state.
*
* @return {Array} Multi-selected block client IDs.
*/
const getSelectedBlockClientIds = rememo(state => {
const {
selectionStart,
selectionEnd
} = state.selection;
if (!selectionStart.clientId || !selectionEnd.clientId) {
return EMPTY_ARRAY;
}
if (selectionStart.clientId === selectionEnd.clientId) {
return [selectionStart.clientId];
}
// Retrieve root client ID to aid in retrieving relevant nested block
// order, being careful to allow the falsey empty string top-level root
// by explicitly testing against null.
const rootClientId = getBlockRootClientId(state, selectionStart.clientId);
if (rootClientId === null) {
return EMPTY_ARRAY;
}
const blockOrder = getBlockOrder(state, rootClientId);
const startIndex = blockOrder.indexOf(selectionStart.clientId);
const endIndex = blockOrder.indexOf(selectionEnd.clientId);
if (startIndex > endIndex) {
return blockOrder.slice(endIndex, startIndex + 1);
}
return blockOrder.slice(startIndex, endIndex + 1);
}, state => [state.blocks.order, state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId]);
/**
* Returns the current multi-selection set of block client IDs, or an empty
* array if there is no multi-selection.
*
* @param {Object} state Editor state.
*
* @return {Array} Multi-selected block client IDs.
*/
function getMultiSelectedBlockClientIds(state) {
const {
selectionStart,
selectionEnd
} = state.selection;
if (selectionStart.clientId === selectionEnd.clientId) {
return EMPTY_ARRAY;
}
return getSelectedBlockClientIds(state);
}
/**
* Returns the current multi-selection set of blocks, or an empty array if
* there is no multi-selection.
*
* @param {Object} state Editor state.
*
* @return {Array} Multi-selected block objects.
*/
const getMultiSelectedBlocks = rememo(state => {
const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds(state);
if (!multiSelectedBlockClientIds.length) {
return EMPTY_ARRAY;
}
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.
*
* @param {Object} state Editor state.
*
* @return {?string} First block client ID in the multi-selection set.
*/
function getFirstMultiSelectedBlockClientId(state) {
return getMultiSelectedBlockClientIds(state)[0] || null;
}
/**
* Returns the client ID of the last block in the multi-selection set, or null
* if there is no multi-selection.
*
* @param {Object} state Editor state.
*
* @return {?string} Last block client ID in the multi-selection set.
*/
function getLastMultiSelectedBlockClientId(state) {
const selectedClientIds = getMultiSelectedBlockClientIds(state);
return selectedClientIds[selectedClientIds.length - 1] || null;
}
/**
* Returns true if a multi-selection exists, and the block corresponding to the
* specified client ID is the first block of the multi-selection set, or false
* otherwise.
*
* @param {Object} state Editor state.
* @param {string} clientId Block client ID.
*
* @return {boolean} Whether block is first in multi-selection.
*/
function isFirstMultiSelectedBlock(state, clientId) {
return getFirstMultiSelectedBlockClientId(state) === clientId;
}
/**
* Returns true if the client ID occurs within the block multi-selection, or
* false otherwise.
*
* @param {Object} state Editor state.
* @param {string} clientId Block client ID.
*
* @return {boolean} Whether block is in multi-selection set.
*/
function isBlockMultiSelected(state, clientId) {
return getMultiSelectedBlockClientIds(state).indexOf(clientId) !== -1;
}
/**
* Returns true if an ancestor of the block is multi-selected, or false
* otherwise.
*
* @param {Object} state Editor state.
* @param {string} clientId Block client ID.
*
* @return {boolean} Whether an ancestor of the block is in multi-selection
* set.
*/
const isAncestorMultiSelected = rememo((state, clientId) => {
let ancestorClientId = clientId;
let isMultiSelected = false;
while (ancestorClientId && !isMultiSelected) {
ancestorClientId = getBlockRootClientId(state, ancestorClientId);
isMultiSelected = isBlockMultiSelected(state, ancestorClientId);
}
return isMultiSelected;
}, state => [state.blocks.order, state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId]);
/**
* Returns the client ID of the block which begins the multi-selection set, or
* null if there is no multi-selection.
*
* This is not necessarily the first client ID in the selection.
*
* @see getFirstMultiSelectedBlockClientId
*
* @param {Object} state Editor state.
*
* @return {?string} Client ID of block beginning multi-selection.
*/
function getMultiSelectedBlocksStartClientId(state) {
const {
selectionStart,
selectionEnd
} = state.selection;
if (selectionStart.clientId === selectionEnd.clientId) {
return null;
}
return selectionStart.clientId || null;
}
/**
* Returns the client ID of the block which ends the multi-selection set, or
* null if there is no multi-selection.
*
* This is not necessarily the last client ID in the selection.
*
* @see getLastMultiSelectedBlockClientId
*
* @param {Object} state Editor state.
*
* @return {?string} Client ID of block ending multi-selection.
*/
function getMultiSelectedBlocksEndClientId(state) {
const {
selectionStart,
selectionEnd
} = state.selection;
if (selectionStart.clientId === selectionEnd.clientId) {
return null;
}
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;
}
function __unstableSelectionHasUnmergeableBlock(state) {
return getSelectedBlockClientIds(state).some(clientId => {
const blockName = getBlockName(state, clientId);
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
return !blockType.merge;
});
}
/**
* 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 targetBlockName = getBlockName(state, targetBlockClientId);
const targetBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlockName);
if (!targetBlockType.merge) return false;
const blockToMerge = getBlock(state, blockToMergeClientId);
// It's mergeable if the blocks are of the same type.
if (blockToMerge.name === targetBlockName) 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, targetBlockName);
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 blockB = getBlock(state, selectionEnd.clientId);
const htmlA = blockA.attributes[selectionStart.attributeKey];
const htmlB = blockB.attributes[selectionEnd.attributeKey];
let valueA = (0,external_wp_richText_namespaceObject.create)({
html: htmlA
});
let valueB = (0,external_wp_richText_namespaceObject.create)({
html: htmlB
});
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
})
}
}, {
...blockB,
attributes: {
...blockB.attributes,
[selectionEnd.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({
value: valueB
})
}
}];
};
/**
* Returns an array containing all block client IDs in the editor in the order
* they appear. Optionally accepts a root client ID of the block list for which
* the order should be returned, defaulting to the top-level block order.
*
* @param {Object} state Editor state.
* @param {?string} rootClientId Optional root client ID of block list.
*
* @return {Array} Ordered client IDs of editor blocks.
*/
function getBlockOrder(state, rootClientId) {
return state.blocks.order.get(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.
*
* @return {number} Index at which block exists in order.
*/
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
* currently selected and no multi-selection exists, or false otherwise.
*
* @param {Object} state Editor state.
* @param {string} clientId Block client ID.
*
* @return {boolean} Whether block is selected and multi-selection exists.
*/
function isBlockSelected(state, clientId) {
const {
selectionStart,
selectionEnd
} = state.selection;
if (selectionStart.clientId !== selectionEnd.clientId) {
return false;
}
return selectionStart.clientId === clientId;
}
/**
* Returns true if one of the block's inner blocks is selected.
*
* @param {Object} state Editor state.
* @param {string} clientId Block client ID.
* @param {boolean} deep Perform a deep check.
*
* @return {boolean} Whether the block has an inner block selected
*/
function hasSelectedInnerBlock(state, clientId, deep = false) {
return getBlockOrder(state, clientId).some(innerClientId => isBlockSelected(state, innerClientId) || isBlockMultiSelected(state, innerClientId) || deep && hasSelectedInnerBlock(state, innerClientId, deep));
}
/**
* Returns true if one of the block's inner blocks is dragged.
*
* @param {Object} state Editor state.
* @param {string} clientId Block client ID.
* @param {boolean} deep Perform a deep check.
*
* @return {boolean} Whether the block has an inner block dragged
*/
function hasDraggedInnerBlock(state, clientId, deep = false) {
return getBlockOrder(state, clientId).some(innerClientId => isBlockBeingDragged(state, innerClientId) || deep && hasDraggedInnerBlock(state, innerClientId, deep));
}
/**
* Returns true if the block corresponding to the specified client ID is
* currently selected but isn't the last of the selected blocks. Here "last"
* refers to the block sequence in the document, _not_ the sequence of
* multi-selection, which is why `state.selectionEnd` isn't used.
*
* @param {Object} state Editor state.
* @param {string} clientId Block client ID.
*
* @return {boolean} Whether block is selected and not the last in the
* selection.
*/
function isBlockWithinSelection(state, clientId) {
if (!clientId) {
return false;
}
const clientIds = getMultiSelectedBlockClientIds(state);
const index = clientIds.indexOf(clientId);
return index > -1 && index < clientIds.length - 1;
}
/**
* Returns true if a multi-selection has been made, or false otherwise.
*
* @param {Object} state Editor state.
*
* @return {boolean} Whether multi-selection has been made.
*/
function hasMultiSelection(state) {
const {
selectionStart,
selectionEnd
} = state.selection;
return selectionStart.clientId !== selectionEnd.clientId;
}
/**
* Whether in the process of multi-selecting or not. This flag is only true
* while the multi-selection is being selected (by mouse move), and is false
* once the multi-selection has been settled.
*
* @see hasMultiSelection
*
* @param {Object} state Global application state.
*
* @return {boolean} True if multi-selecting, false if not.
*/
function selectors_isMultiSelecting(state) {
return state.isMultiSelecting;
}
/**
* Selector that returns if multi-selection is enabled or not.
*
* @param {Object} state Global application state.
*
* @return {boolean} True if it should be possible to multi-select blocks, false if multi-selection is disabled.
*/
function selectors_isSelectionEnabled(state) {
return state.isSelectionEnabled;
}
/**
* Returns the block's editing mode, defaulting to "visual" if not explicitly
* assigned.
*
* @param {Object} state Editor state.
* @param {string} clientId Block client ID.
*
* @return {Object} Block editing mode.
*/
function getBlockMode(state, clientId) {
return state.blocksMode[clientId] || 'visual';
}
/**
* Returns true if the user is typing, or false otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether user is typing.
*/
function selectors_isTyping(state) {
return state.isTyping;
}
/**
* Returns true if the user is dragging blocks, or false otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether user is dragging blocks.
*/
function isDraggingBlocks(state) {
return !!state.draggedBlocks.length;
}
/**
* Returns the client ids of any blocks being directly dragged.
*
* This does not include children of a parent being dragged.
*
* @param {Object} state Global application state.
*
* @return {string[]} Array of dragged block client ids.
*/
function getDraggedBlockClientIds(state) {
return state.draggedBlocks;
}
/**
* Returns whether the block is being dragged.
*
* Only returns true if the block is being directly dragged,
* not if the block is a child of a parent being dragged.
* See `isAncestorBeingDragged` for child blocks.
*
* @param {Object} state Global application state.
* @param {string} clientId Client id for block to check.
*
* @return {boolean} Whether the block is being dragged.
*/
function isBlockBeingDragged(state, clientId) {
return state.draggedBlocks.includes(clientId);
}
/**
* Returns whether a parent/ancestor of the block is being dragged.
*
* @param {Object} state Global application state.
* @param {string} clientId Client id for block to check.
*
* @return {boolean} Whether the block's ancestor is being dragged.
*/
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 = getBlockParents(state, clientId);
return parents.some(parentClientId => isBlockBeingDragged(state, parentClientId));
}
/**
* Returns true if the caret is within formatted text, or false otherwise.
*
* @deprecated
*
* @return {boolean} Whether the caret is within formatted text.
*/
function isCaretWithinFormattedText() {
external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).isCaretWithinFormattedText', {
since: '6.1',
version: '6.3'
});
return false;
}
/**
* Returns the insertion point, the index at which the new inserted block would
* be placed. Defaults to the last index.
*
* @param {Object} state Editor state.
*
* @return {Object} Insertion point object with `rootClientId`, `index`.
*/
const getBlockInsertionPoint = rememo(state => {
let rootClientId, index;
const {
insertionPoint,
selection: {
selectionEnd
}
} = state;
if (insertionPoint !== null) {
return insertionPoint;
}
const {
clientId
} = selectionEnd;
if (clientId) {
rootClientId = getBlockRootClientId(state, clientId) || undefined;
index = getBlockIndex(state, selectionEnd.clientId) + 1;
} else {
index = getBlockOrder(state).length;
}
return {
rootClientId,
index
};
}, state => [state.insertionPoint, state.selection.selectionEnd.clientId, state.blocks.parents, state.blocks.order]);
/**
* Returns true if we should show the block insertion point.
*
* @param {Object} state Global application state.
*
* @return {?boolean} Whether the insertion point is visible or not.
*/
function isBlockInsertionPointVisible(state) {
return state.insertionPoint !== null;
}
/**
* Returns whether the blocks matches the template or not.
*
* @param {boolean} state
* @return {?boolean} Whether the template is valid or not.
*/
function isValidTemplate(state) {
return state.template.isValid;
}
/**
* Returns the defined block template
*
* @param {boolean} state
*
* @return {?Array} Block Template.
*/
function getTemplate(state) {
return state.settings.template;
}
/**
* Returns the defined block template lock. Optionally accepts a root block
* client ID as context, otherwise defaulting to the global context.
*
* @param {Object} state Editor state.
* @param {?string} rootClientId Optional block root client ID.
*
* @return {string|false} Block Template Lock
*/
function getTemplateLock(state, rootClientId) {
var _getBlockListSettings;
if (!rootClientId) {
var _state$settings$templ;
return (_state$settings$templ = state.settings.templateLock) !== null && _state$settings$templ !== void 0 ? _state$settings$templ : false;
}
return (_getBlockListSettings = getBlockListSettings(state, rootClientId)?.templateLock) !== null && _getBlockListSettings !== void 0 ? _getBlockListSettings : false;
}
/**
* Determines if the given block type is allowed to be inserted into the block list.
* This function is not exported and not memoized because using a memoized selector
* inside another memoized selector is just a waste of time.
*
* @param {Object} state Editor state.
* @param {string|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) => {
let blockType;
if (blockName && 'object' === typeof blockName) {
blockType = blockName;
blockName = blockType.name;
} else {
blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
}
if (!blockType) {
return false;
}
const {
allowedBlockTypes
} = getSettings(state);
const isBlockAllowedInEditor = checkAllowList(allowedBlockTypes, blockName, true);
if (!isBlockAllowedInEditor) {
return false;
}
const isLocked = !!getTemplateLock(state, rootClientId);
if (isLocked) {
return false;
}
if (getBlockEditingMode(state, rootClientId !== null && rootClientId !== void 0 ? rootClientId : '') === 'disabled') {
return false;
}
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) {
return false;
}
const parentName = getBlockName(state, rootClientId);
const parentBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(parentName);
// Look at the `blockType.allowedBlocks` field to determine whether this is an allowed child block.
const parentAllowedChildBlocks = parentBlockType?.allowedBlocks;
let hasParentAllowedBlock = checkAllowList(parentAllowedChildBlocks, blockName);
// The `allowedBlocks` block list setting can further limit which blocks are allowed children.
if (hasParentAllowedBlock !== false) {
const parentAllowedBlocks = parentBlockListSettings?.allowedBlocks;
const hasParentListAllowedBlock = checkAllowList(parentAllowedBlocks, blockName);
// Never downgrade the result from `true` to `null`
if (hasParentListAllowedBlock !== null) {
hasParentAllowedBlock = hasParentListAllowedBlock;
}
}
const blockAllowedParentBlocks = blockType.parent;
const hasBlockAllowedParent = checkAllowList(blockAllowedParentBlocks, parentName);
let hasBlockAllowedAncestor = true;
const blockAllowedAncestorBlocks = blockType.ancestor;
if (blockAllowedAncestorBlocks) {
const ancestors = [rootClientId, ...getBlockParents(state, rootClientId)];
hasBlockAllowedAncestor = ancestors.some(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.
*
* @param {Object} state Editor state.
* @param {string} blockName The name of the block type, e.g.' core/paragraph'.
* @param {?string} rootClientId Optional root client ID of block list.
*
* @return {boolean} Whether the given block type is allowed to be inserted.
*/
const canInsertBlockType = rememo(canInsertBlockTypeUnmemoized, (state, blockName, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockEditingModes]);
/**
* Determines if the given blocks are allowed to be inserted into the block
* list.
*
* @param {Object} state Editor state.
* @param {string} clientIds The block client IDs to be inserted.
* @param {?string} rootClientId Optional root client ID of block list.
*
* @return {boolean} Whether the given blocks are allowed to be inserted.
*/
function canInsertBlocks(state, clientIds, rootClientId = 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, rootClientId = null) {
const attributes = getBlockAttributes(state, clientId);
if (attributes === null) {
return true;
}
if (attributes.lock?.remove !== undefined) {
return !attributes.lock.remove;
}
if (getTemplateLock(state, rootClientId)) {
return false;
}
return getBlockEditingMode(state, rootClientId) !== 'disabled';
}
/**
* 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, rootClientId = 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 | undefined} Whether the given block is allowed to be moved.
*/
function canMoveBlock(state, clientId, rootClientId = null) {
const attributes = getBlockAttributes(state, clientId);
if (attributes === null) {
return true;
}
if (attributes.lock?.move !== undefined) {
return !attributes.lock.move;
}
if (getTemplateLock(state, rootClientId) === 'all') {
return false;
}
return getBlockEditingMode(state, rootClientId) !== 'disabled';
}
/**
* 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, rootClientId = null) {
return clientIds.every(clientId => canMoveBlock(state, clientId, rootClientId));
}
/**
* Determines if the given block is allowed to be edited.
*
* @param {Object} state Editor state.
* @param {string} clientId The block client Id.
*
* @return {boolean} Whether the given block is allowed to be edited.
*/
function canEditBlock(state, clientId) {
const attributes = getBlockAttributes(state, clientId);
if (attributes === null) {
return true;
}
const {
lock
} = attributes;
// When the edit is true, we cannot edit the block.
return !lock?.edit;
}
/**
* 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) {
if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, 'lock', true)) {
return false;
}
// Use block editor settings as the default value.
return !!state.settings?.canLockBlocks;
}
/**
* Returns information about how recently and frequently a block has been inserted.
*
* @param {Object} state Global application state.
* @param {string} id A string which identifies the insert, e.g. 'core/block/12'
*
* @return {?{ time: number, count: number }} An object containing `time` which is when the last
* insert occurred as a UNIX epoch, and `count` which is
* the number of inserts that have occurred.
*/
function getInsertUsage(state, id) {
var _state$preferences$in;
return (_state$preferences$in = state.preferences.insertUsage?.[id]) !== null && _state$preferences$in !== void 0 ? _state$preferences$in : null;
}
/**
* Returns whether we can show a block type in the inserter
*
* @param {Object} state Global State
* @param {Object} blockType BlockType
* @param {?string} rootClientId Optional root client ID of block list.
*
* @return {boolean} Whether the given block type is allowed to be shown in the inserter.
*/
const canIncludeBlockTypeInInserter = (state, blockType, rootClientId) => {
if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'inserter', true)) {
return false;
}
return canInsertBlockTypeUnmemoized(state, blockType.name, rootClientId);
};
/**
* 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
* @return {Function} Function to transform a block variation to inserter item
*/
const getItemFromVariation = (state, item) => variation => {
const variationId = `${item.id}/${variation.name}`;
const {
time,
count = 0
} = getInsertUsage(state, variationId) || {};
return {
...item,
id: variationId,
icon: variation.icon || item.icon,
title: variation.title || item.title,
description: variation.description || item.description,
category: variation.category || item.category,
// If `example` is explicitly undefined for the variation, the preview will not be shown.
example: variation.hasOwnProperty('example') ? variation.example : item.example,
initialAttributes: {
...item.initialAttributes,
...variation.attributes
},
innerBlocks: variation.innerBlocks,
keywords: variation.keywords || item.keywords,
frecency: calculateFrecency(time, count)
};
};
/**
* Returns the calculated frecency.
*
* '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} count The number of inserts that have occurred.
*
* @return {number} The calculated frecency.
*/
const calculateFrecency = (time, count) => {
if (!time) {
return count;
}
// The selector is cached, which means Date.now() is the last time that the
// relevant state changed. This suits our needs.
const duration = Date.now() - time;
switch (true) {
case duration < MILLISECONDS_PER_HOUR:
return count * 4;
case duration < MILLISECONDS_PER_DAY:
return count * 2;
case duration < MILLISECONDS_PER_WEEK:
return count / 2;
default:
return count / 4;
}
};
/**
* Returns a function that accepts a block type and builds an item to be shown
* 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 {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 (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType.name, 'multiple', true)) {
isDisabled = getBlocksByClientId(state, getClientIdsWithDescendants(state)).some(({
name
}) => 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.
};
};
/**
* Determines the items that appear in the inserter. Includes both static
* items (e.g. a regular block type) and dynamic items (e.g. a reusable block).
*
* Each item object contains what's necessary to display a button in the
* inserter and handle its selection.
*
* The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency)
* that combines block usage frequenty and recency.
*
* Items are returned ordered descendingly by their 'utility' and 'frecency'.
*
* @param {Object} state Editor state.
* @param {?string} rootClientId Optional root client ID of block list.
*
* @return {WPEditorInserterItem[]} Items that appear in inserter.
*
* @typedef {Object} WPEditorInserterItem
* @property {string} id Unique identifier for the item.
* @property {string} name The type of block to create.
* @property {Object} initialAttributes Attributes to pass to the newly created block.
* @property {string} title Title of the item, as it appears in the inserter.
* @property {string} icon Dashicon for the item, as it appears in the inserter.
* @property {string} category Block category that the item is associated with.
* @property {string[]} keywords Keywords that can be searched to find this item.
* @property {boolean} isDisabled Whether or not the user should be prevented from inserting
* this item.
* @property {number} frecency Heuristic that combines frequency and recency.
*/
const getInserterItems = rememo((state, rootClientId = null) => {
const buildReusableBlockInserterItem = reusableBlock => {
const icon = !reusableBlock.wp_pattern_sync_status ? {
src: library_symbol,
foreground: 'var(--wp-block-synced-color)'
} : library_symbol;
const id = `core/block/${reusableBlock.id}`;
const {
time,
count = 0
} = getInsertUsage(state, id) || {};
const frecency = calculateFrecency(time, count);
return {
id,
name: 'core/block',
initialAttributes: {
ref: reusableBlock.id
},
title: reusableBlock.title?.raw,
icon,
category: 'reusable',
keywords: ['reusable'],
isDisabled: false,
utility: 1,
// Deprecated.
frecency,
content: reusableBlock.content?.raw,
syncStatus: reusableBlock.wp_pattern_sync_status
};
};
const syncedPatternInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).map(buildReusableBlockInserterItem) : [];
const buildBlockTypeInserterItem = buildBlockTypeItem(state, {
buildScope: 'inserter'
});
const blockTypeInserterItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeInserterItem);
const items = blockTypeInserterItems.reduce((accumulator, item) => {
const {
variations = []
} = item;
// Exclude any block type item that is to be replaced by a default variation.
if (!variations.some(({
isDefault
}) => isDefault)) {
accumulator.push(item);
}
if (variations.length) {
const variationMapper = getItemFromVariation(state, item);
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 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, ...syncedPatternInserterItems];
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), 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.
*
* Each item object contains what's necessary to display a menu item in the
* transform list and handle its selection.
*
* The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency)
* that combines block usage frequenty and recency.
*
* Items are returned ordered descendingly by their 'frecency'.
*
* @param {Object} state Editor state.
* @param {Object|Object[]} blocks Block object or array objects.
* @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 getBlockTransformItems = rememo((state, blocks, rootClientId = null) => {
const normalizedBlocks = Array.isArray(blocks) ? blocks : [blocks];
const buildBlockTypeTransformItem = buildBlockTypeItem(state, {
buildScope: 'transform'
});
const blockTypeTransformItems = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeTransformItem);
const itemsByName = Object.fromEntries(Object.entries(blockTypeTransformItems).map(([, value]) => [value.name, value]));
const possibleTransforms = (0,external_wp_blocks_namespaceObject.getPossibleBlockTransformations)(normalizedBlocks).reduce((accumulator, block) => {
if (itemsByName[block?.name]) {
accumulator.push(itemsByName[block.name]);
}
return accumulator;
}, []);
return orderBy(possibleTransforms, block => itemsByName[block.name].frecency, 'desc');
}, (state, blocks, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), 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.
*
* @param {Object} state Editor state.
* @param {?string} rootClientId Optional root client ID of block list.
*
* @return {boolean} Items that appear in inserter.
*/
const hasInserterItems = rememo((state, rootClientId = null) => {
const hasBlockType = (0,external_wp_blocks_namespaceObject.getBlockTypes)().some(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId));
if (hasBlockType) {
return true;
}
const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && getReusableBlocks(state).length > 0;
return hasReusableBlock;
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), 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.
*
* @param {Object} state Editor state.
* @param {?string} rootClientId Optional root client ID of block list.
*
* @return {Array?} The list of allowed block types.
*/
const getAllowedBlocks = rememo((state, rootClientId = null) => {
if (!rootClientId) {
return;
}
const blockTypes = (0,external_wp_blocks_namespaceObject.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId));
const hasReusableBlock = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) && getReusableBlocks(state).length > 0;
if (hasReusableBlock) {
blockTypes.push('core/block');
}
return blockTypes;
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), (0,external_wp_blocks_namespaceObject.getBlockTypes)()]);
const __experimentalGetAllowedBlocks = rememo((state, rootClientId = null) => {
external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).__experimentalGetAllowedBlocks', {
alternative: 'wp.data.select( "core/block-editor" ).getAllowedBlocks',
since: '6.2',
version: '6.4'
});
return getAllowedBlocks(state, rootClientId);
}, (state, rootClientId) => [...getAllowedBlocks.getDependants(state, rootClientId)]);
/**
* 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<string>} attributesToCopy Attributes to be copied from adjecent blocks when inserted.
*/
const getDirectInsertBlock = rememo((state, rootClientId = null) => {
if (!rootClientId) {
return;
}
const defaultBlock = state.blockListSettings[rootClientId]?.defaultBlock;
const directInsert = state.blockListSettings[rootClientId]?.directInsert;
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.get(rootClientId)]);
const __experimentalGetDirectInsertBlock = rememo((state, rootClientId = null) => {
external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).__experimentalGetDirectInsertBlock', {
alternative: 'wp.data.select( "core/block-editor" ).getDirectInsertBlock',
since: '6.3',
version: '6.4'
});
return getDirectInsertBlock(state, rootClientId);
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.tree.get(rootClientId)]);
const __experimentalGetParsedPattern = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => rememo((state, patternName) => {
const {
getAllPatterns
} = unlock(select(STORE_NAME));
const patterns = getAllPatterns();
const pattern = patterns.find(({
name
}) => name === patternName);
if (!pattern) {
return null;
}
return {
...pattern,
blocks: (0,external_wp_blocks_namespaceObject.parse)(pattern.content, {
__unstableSkipMigrationLogs: true
})
};
}, getAllPatternsDependants(select)));
const getAllowedPatternsDependants = select => (state, rootClientId) => {
return [...getAllPatternsDependants(select)(state), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId)];
};
/**
* Returns the list of allowed patterns for inner blocks children.
*
* @param {Object} state Editor state.
* @param {?string} rootClientId Optional target root client ID.
*
* @return {Array?} The list of allowed patterns.
*/
const __experimentalGetAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => {
return rememo((state, rootClientId = null) => {
const {
getAllPatterns,
__experimentalGetParsedPattern: getParsedPattern
} = unlock(select(STORE_NAME));
const patterns = getAllPatterns();
const {
allowedBlockTypes
} = getSettings(state);
const parsedPatterns = patterns.filter(({
inserter = true
}) => !!inserter).map(({
name
}) => getParsedPattern(name));
const availableParsedPatterns = parsedPatterns.filter(({
blocks
}) => checkAllowListRecursive(blocks, allowedBlockTypes));
const patternsAllowed = availableParsedPatterns.filter(({
blocks
}) => blocks.every(({
name
}) => canInsertBlockType(state, name, rootClientId)));
return patternsAllowed;
}, getAllowedPatternsDependants(select));
});
/**
* Returns the list of patterns based on their declared `blockTypes`
* and a block's name.
* Patterns can use `blockTypes` to integrate in work flows like
* 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.
*
* @return {Array} The list of matched block patterns based on declared `blockTypes` and block name.
*/
const getPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => rememo((state, blockNames, rootClientId = null) => {
if (!blockNames) return EMPTY_ARRAY;
const patterns = select(STORE_NAME).__experimentalGetAllowedPatterns(rootClientId);
const normalizedBlockNames = Array.isArray(blockNames) ? blockNames : [blockNames];
const filteredPatterns = patterns.filter(pattern => pattern?.blockTypes?.some?.(blockName => normalizedBlockNames.includes(blockName)));
if (filteredPatterns.length === 0) {
return EMPTY_ARRAY;
}
return filteredPatterns;
}, (state, blockNames, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId)));
const __experimentalGetPatternsByBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => {
external_wp_deprecated_default()('wp.data.select( "core/block-editor" ).__experimentalGetPatternsByBlockTypes', {
alternative: 'wp.data.select( "core/block-editor" ).getPatternsByBlockTypes',
since: '6.2',
version: '6.4'
});
return select(STORE_NAME).getPatternsByBlockTypes;
});
/**
* Determines the items that appear in the available pattern transforms list.
*
* For now we only handle blocks without InnerBlocks and take into account
* the `__experimentalRole` property of blocks' attributes for the transformation.
*
* We return the first set of possible eligible block patterns,
* by checking the `blockTypes` property. We still have to recurse through
* 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.
*
* @return {WPBlockPattern[]} Items that are eligible for a pattern transformation.
*/
const __experimentalGetPatternTransformItems = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => rememo((state, blocks, rootClientId = null) => {
if (!blocks) return EMPTY_ARRAY;
/**
* For now we only handle blocks without InnerBlocks and take into account
* the `__experimentalRole` property of blocks' attributes for the transformation.
* Note that the blocks have been retrieved through `getBlock`, which doesn't
* return the inner blocks of an inner block controller, so we still need
* to check for this case too.
*/
if (blocks.some(({
clientId,
innerBlocks
}) => 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)));
/**
* Here we will return first set of possible eligible block patterns,
* by checking the `blockTypes` property. We still have to recurse through
* 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.
*/
return select(STORE_NAME).getPatternsByBlockTypes(selectedBlockNames, rootClientId);
}, (state, blocks, rootClientId) => getAllowedPatternsDependants(select)(state, rootClientId)));
/**
* Returns the Block List settings of a block, if any exist.
*
* @param {Object} state Editor state.
* @param {?string} clientId Block client ID.
*
* @return {?Object} Block settings of the block if set.
*/
function getBlockListSettings(state, clientId) {
return state.blockListSettings[clientId];
}
/**
* Returns the editor settings.
*
* @param {Object} state Editor state.
*
* @return {Object} The editor settings object.
*/
function getSettings(state) {
return state.settings;
}
/**
* Returns true if the most recent block change is be considered persistent, or
* false otherwise. A persistent change is one committed by BlockEditorProvider
* via its `onChange` callback, in addition to `onInput`.
*
* @param {Object} state Block editor state.
*
* @return {boolean} Whether the most recent block change was persistent.
*/
function isLastBlockChangePersistent(state) {
return state.blocks.isPersistentChange;
}
/**
* Returns the block list settings for an array of blocks, if any exist.
*
* @param {Object} state Editor state.
* @param {Array} clientIds Block client IDs.
*
* @return {Object} An object where the keys are client ids and the values are
* a block list setting object.
*/
const __experimentalGetBlockListSettingsForBlocks = rememo((state, clientIds = []) => {
return clientIds.reduce((blockListSettingsForBlocks, clientId) => {
if (!state.blockListSettings[clientId]) {
return blockListSettingsForBlocks;
}
return {
...blockListSettingsForBlocks,
[clientId]: state.blockListSettings[clientId]
};
}, {});
}, state => [state.blockListSettings]);
/**
* Returns the title of a given reusable block
*
* @param {Object} state Global application state.
* @param {number|string} ref The shared block's ID.
*
* @return {string} The reusable block saved title.
*/
const __experimentalGetReusableBlockTitle = rememo((state, ref) => {
const reusableBlock = getReusableBlocks(state).find(block => block.id === ref);
if (!reusableBlock) {
return null;
}
return reusableBlock.title?.raw;
}, state => [getReusableBlocks(state)]);
/**
* Returns true if the most recent block change is be considered ignored, or
* false otherwise. An ignored change is one not to be committed by
* BlockEditorProvider, neither via `onChange` nor `onInput`.
*
* @param {Object} state Block editor state.
*
* @return {boolean} Whether the most recent block change was ignored.
*/
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
// accounted for in the refactoring of reusable blocks as occurring within
// their own separate block editor / state (#7119).
return state.blocks.isIgnoredChange;
}
/**
* Returns the block attributes changed as a result of the last dispatched
* action.
*
* @param {Object} state Block editor state.
*
* @return {Object<string,Object>} Subsets of block attributes changed, keyed
* by block client ID.
*/
function __experimentalGetLastBlockAttributeChanges(state) {
return state.lastBlockAttributesChange;
}
/**
* Returns the available reusable blocks
*
* @param {Object} state Global application state.
*
* @return {Array} Reusable blocks
*/
function getReusableBlocks(state) {
var _state$settings$__exp;
return (_state$settings$__exp = state.settings.__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.
*/
function isNavigationMode(state) {
return state.editorMode === 'navigation';
}
/**
* Returns the current editor mode.
*
* @param {Object} state Editor state.
*
* @return {string} the editor mode.
*/
function __unstableGetEditorMode(state) {
return state.editorMode;
}
/**
* Returns whether block moving mode is enabled.
*
* @param {Object} state Editor state.
*
* @return {string} Client Id of moving block.
*/
function selectors_hasBlockMovingClientId(state) {
return state.hasBlockMovingClientId;
}
/**
* Returns true if the last change was an automatic change, false otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the last change was automatic.
*/
function didAutomaticChange(state) {
return !!state.automaticChangeStatus;
}
/**
* Returns true if the current highlighted block matches the block clientId.
*
* @param {Object} state Global application state.
* @param {string} clientId The block to check.
*
* @return {boolean} Whether the block is currently highlighted.
*/
function isBlockHighlighted(state, clientId) {
return state.highlightedBlock === clientId;
}
/**
* Checks if a given block has controlled inner blocks.
*
* @param {Object} state Global application state.
* @param {string} clientId The block to check.
*
* @return {boolean} True if the block has controlled inner blocks.
*/
function areInnerBlocksControlled(state, clientId) {
return !!state.blocks.controlledInnerBlocks[clientId];
}
/**
* Returns the clientId for the first 'active' block of a given array of block names.
* 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 {string[]} validBlocksNames The names of block types to check for.
*
* @return {string} The matching block's clientId.
*/
const __experimentalGetActiveBlockIdByBlockNames = rememo((state, validBlockNames) => {
if (!validBlockNames.length) {
return null;
}
// Check if selected block is a valid entity area.
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 = getMultiSelectedBlockClientIds(state);
const entityAreaParents = getBlockParentsByBlockName(state, selectedBlockClientId || multiSelectedBlockClientIds[0], validBlockNames);
if (entityAreaParents) {
// Last parent closest/most interior.
return entityAreaParents[entityAreaParents.length - 1];
}
return null;
}, (state, validBlockNames) => [state.selection.selectionStart.clientId, state.selection.selectionEnd.clientId, validBlockNames]);
/**
* 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.
* @return {boolean} True if the block matches the last block inserted from the specified source.
*/
function wasBlockJustInserted(state, clientId, source) {
const {
lastBlockInserted
} = state;
return lastBlockInserted.clientIds?.includes(clientId) && lastBlockInserted.source === source;
}
/**
* Tells if the block is visible on the canvas or not.
*
* @param {Object} state Global application state.
* @param {Object} clientId Client Id of the block.
* @return {boolean} True if the block is visible.
*/
function isBlockVisible(state, clientId) {
var _state$blockVisibilit;
return (_state$blockVisibilit = state.blockVisibility?.[clientId]) !== null && _state$blockVisibilit !== void 0 ? _state$blockVisibilit : true;
}
/**
* Returns the list of all hidden blocks.
*
* @param {Object} state Global application state.
* @return {[string]} List of hidden blocks.
*/
const __unstableGetVisibleBlocks = rememo(state => {
const visibleBlocks = new Set(Object.keys(state.blockVisibility).filter(key => state.blockVisibility[key]));
if (visibleBlocks.size === 0) {
return EMPTY_SET;
}
return visibleBlocks;
}, state => [state.blockVisibility]);
/**
* DO-NOT-USE in production.
* This selector is created for internal/experimental only usage and may be
* removed anytime without any warning, causing breakage on any plugin or theme invoking it.
*/
const __unstableGetContentLockingParent = rememo((state, clientId) => {
let current = clientId;
let result;
while (current = state.blocks.parents.get(current)) {
if (getBlockName(state, current) === 'core/block' || getTemplateLock(state, current) === 'contentOnly') {
result = current;
}
}
return result;
}, state => [state.blocks.parents, state.blockListSettings]);
/**
* DO-NOT-USE in production.
* This selector is created for internal/experimental only usage and may be
* removed anytime without any warning, causing breakage on any plugin or theme invoking it.
*
* @param {Object} state Global application state.
*/
function __unstableGetTemporarilyEditingAsBlocks(state) {
return state.temporarilyEditingAsBlocks;
}
/**
* DO-NOT-USE in production.
* This selector is created for internal/experimental only usage and may be
* removed anytime without any warning, causing breakage on any plugin or theme invoking it.
*
* @param {Object} state Global application state.
*/
function __unstableGetTemporarilyEditingFocusModeToRevert(state) {
return state.temporarilyEditingFocusModeRevert;
}
function __unstableHasActiveBlockOverlayActive(state, clientId) {
// Prevent overlay on blocks with a non-default editing mode. If the mdoe is
// 'disabled' then the overlay is redundant since the block can't be
// selected. If the mode is 'contentOnly' then the overlay is redundant
// since there will be no controls to interact with once selected.
if (getBlockEditingMode(state, clientId) !== 'default') {
return false;
}
// If the block editing is locked, the block overlay is always active.
if (!canEditBlock(state, clientId)) {
return true;
}
const editorMode = __unstableGetEditorMode(state);
// In zoom-out mode, the block overlay is always active for top level blocks.
if (editorMode === 'zoom-out' && clientId && !getBlockRootClientId(state, clientId)) {
return true;
}
// In navigation mode, the block overlay is active when the block is not
// selected (and doesn't contain a selected child). The same behavior is
// also enabled in all modes for blocks that have controlled children
// (reusable block, template part, navigation), unless explicitly disabled
// with `supports.__experimentalDisableBlockOverlay`.
const blockSupportDisable = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(getBlockName(state, clientId), '__experimentalDisableBlockOverlay', false);
const shouldEnableIfUnselected = editorMode === 'navigation' || (blockSupportDisable ? false : areInnerBlocksControlled(state, clientId));
return shouldEnableIfUnselected && !isBlockSelected(state, clientId) && !hasSelectedInnerBlock(state, clientId, true);
}
function __unstableIsWithinBlockOverlay(state, clientId) {
let parent = state.blocks.parents.get(clientId);
while (!!parent) {
if (__unstableHasActiveBlockOverlayActive(state, parent)) {
return true;
}
parent = state.blocks.parents.get(parent);
}
return false;
}
/**
* @typedef {import('../components/block-editing-mode').BlockEditingMode} BlockEditingMode
*/
/**
* Returns the block editing mode for a given block.
*
* The mode can be one of three options:
*
* - `'disabled'`: Prevents editing the block entirely, i.e. it cannot be
* selected.
* - `'contentOnly'`: Hides all non-content UI, e.g. auxiliary controls in the
* toolbar, the block movers, block settings.
* - `'default'`: Allows editing the block as normal.
*
* Blocks can set a mode using the `useBlockEditingMode` hook.
*
* The mode is inherited by all of the block's inner blocks, unless they have
* their own mode.
*
* A template lock can also set a mode. If the template lock is `'contentOnly'`,
* the block's mode is overridden to `'contentOnly'` if the block has a content
* role attribute, or `'disabled'` otherwise.
*
* @see useBlockEditingMode
*
* @param {Object} state Global application state.
* @param {string} clientId The block client ID, or `''` for the root container.
*
* @return {BlockEditingMode} The block editing mode. One of `'disabled'`,
* `'contentOnly'`, or `'default'`.
*/
const getBlockEditingMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, clientId = '') => {
const blockEditingMode = state.blockEditingModes.get(clientId);
if (blockEditingMode) {
return blockEditingMode;
}
if (!clientId) {
return 'default';
}
const rootClientId = getBlockRootClientId(state, clientId);
const templateLock = getTemplateLock(state, rootClientId);
if (templateLock === 'contentOnly') {
const name = getBlockName(state, clientId);
const isContent = select(external_wp_blocks_namespaceObject.store).__experimentalHasContentRoleAttribute(name);
return isContent ? 'contentOnly' : 'disabled';
}
const parentMode = getBlockEditingMode(state, rootClientId);
return parentMode === 'contentOnly' ? 'default' : parentMode;
});
/**
* Indicates if a block is ungroupable.
* A block is ungroupable if it is a single grouping block with inner blocks.
* If a block has an `ungroup` transform, it is also ungroupable, without the
* requirement of being the default grouping block.
* Additionally a block can only be ungrouped if it has inner blocks and can
* be removed.
*
* @param {Object} state Global application state.
* @param {string} clientId Client Id of the block. If not passed the selected block's client id will be used.
* @return {boolean} True if the block is ungroupable.
*/
const isUngroupable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, clientId = '') => {
const _clientId = clientId || getSelectedBlockClientId(state);
if (!_clientId) {
return false;
}
const {
getGroupingBlockName
} = select(external_wp_blocks_namespaceObject.store);
const block = getBlock(state, _clientId);
const groupingBlockName = getGroupingBlockName();
const _isUngroupable = block && (block.name === groupingBlockName || (0,external_wp_blocks_namespaceObject.getBlockType)(block.name)?.transforms?.ungroup) && !!block.innerBlocks.length;
return _isUngroupable && canRemoveBlock(state, _clientId);
});
/**
* Indicates if the provided blocks(by client ids) are groupable.
* We need to have at least one block, have a grouping block name set and
* be able to remove these blocks.
*
* @param {Object} state Global application state.
* @param {string[]} clientIds Block client ids. If not passed the selected blocks client ids will be used.
* @return {boolean} True if the blocks are groupable.
*/
const isGroupable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, clientIds = EMPTY_ARRAY) => {
const {
getGroupingBlockName
} = select(external_wp_blocks_namespaceObject.store);
const groupingBlockName = getGroupingBlockName();
const _clientIds = clientIds?.length ? clientIds : getSelectedBlockClientIds(state);
const rootClientId = _clientIds?.length ? getBlockRootClientId(state, _clientIds[0]) : undefined;
const groupingBlockAvailable = canInsertBlockType(state, groupingBlockName, rootClientId);
const _isGroupable = groupingBlockAvailable && _clientIds.length;
return _isGroupable && canRemoveBlocks(state, _clientIds, rootClientId);
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/undo-ignore.js
// Keep track of the blocks that should not be pushing an additional
// undo stack when editing the entity.
// See the implementation of `syncDerivedUpdates` and `useBlockSync`.
const undoIgnoreBlocks = new WeakSet();
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/private-actions.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const castArray = maybeArray => Array.isArray(maybeArray) ? maybeArray : [maybeArray];
/**
* A list of private/experimental block editor settings that
* should not become a part of the WordPress public API.
* BlockEditorProvider will remove these settings from the
* settings object it receives.
*
* @see https://github.com/WordPress/gutenberg/pull/46131
*/
const privateSettings = ['inserterMediaCategories', 'blockInspectorAnimation'];
/**
* Action that updates the block editor settings and
* conditionally preserves the experimental ones.
*
* @param {Object} settings Updated settings
* @param {Object} options Options object.
* @param {boolean} options.stripExperimentalSettings Whether to strip experimental settings.
* @param {boolean} options.reset Whether to reset the settings.
* @return {Object} Action object
*/
function __experimentalUpdateSettings(settings, {
stripExperimentalSettings = false,
reset = false
} = {}) {
let cleanSettings = settings;
// There are no plugins in the mobile apps, so there is no
// need to strip the experimental settings:
if (stripExperimentalSettings && external_wp_element_namespaceObject.Platform.OS === 'web') {
cleanSettings = {};
for (const key in settings) {
if (!privateSettings.includes(key)) {
cleanSettings[key] = settings[key];
}
}
}
return {
type: 'UPDATE_SETTINGS',
settings: cleanSettings,
reset
};
}
/**
* Hides the block interface (eg. toolbar, outline, etc.)
*
* @return {Object} Action object.
*/
function hideBlockInterface() {
return {
type: 'HIDE_BLOCK_INTERFACE'
};
}
/**
* Shows the block interface (eg. toolbar, outline, etc.)
*
* @return {Object} Action object.
*/
function showBlockInterface() {
return {
type: 'SHOW_BLOCK_INTERFACE'
};
}
/**
* Yields action objects used in signalling that the blocks corresponding to
* the set of specified client IDs are to be removed.
*
* Compared to `removeBlocks`, this private interface exposes an additional
* parameter; see `forceRemove`.
*
* @param {string|string[]} clientIds Client IDs of blocks to remove.
* @param {boolean} selectPrevious True if the previous block
* or the immediate parent
* (if no previous block exists)
* should be selected
* when a block is removed.
* @param {boolean} forceRemove Whether to force the operation,
* bypassing any checks for certain
* block types.
*/
const privateRemoveBlocks = (clientIds, selectPrevious = true, forceRemove = false) => ({
select,
dispatch,
registry
}) => {
if (!clientIds || !clientIds.length) {
return;
}
clientIds = castArray(clientIds);
const rootClientId = select.getBlockRootClientId(clientIds[0]);
const canRemoveBlocks = select.canRemoveBlocks(clientIds, rootClientId);
if (!canRemoveBlocks) {
return;
}
// In certain editing contexts, we'd like to prevent accidental removal
// of important blocks. For example, in the site editor, the Query Loop
// block is deemed important. In such cases, we'll ask the user for
// confirmation that they intended to remove such block(s). However,
// the editor instance is responsible for presenting those confirmation
// prompts to the user. Any instance opting into removal prompts must
// register using `setBlockRemovalRules()`.
//
// @see https://github.com/WordPress/gutenberg/pull/51145
const rules = !forceRemove && select.getBlockRemovalRules();
if (rules) {
const blockNamesForPrompt = new Set();
// Given a list of client IDs of blocks that the user intended to
// remove, perform a tree search (BFS) to find all block names
// corresponding to "important" blocks, i.e. blocks that require a
// removal prompt.
const queue = [...clientIds];
let messageType = 'templates';
while (queue.length) {
const clientId = queue.shift();
const blockName = select.getBlockName(clientId);
if (rules[blockName]) {
blockNamesForPrompt.add(blockName);
}
if (rules['bindings/core/pattern-overrides']) {
const parentPatternBlocks = select.getBlockParentsByBlockName(clientId, 'core/block');
// We only need to run this check when editing the original pattern, not pattern instances.
if (parentPatternBlocks?.length > 0) {
continue;
}
const blockAttributes = select.getBlockAttributes(clientId);
if (blockAttributes?.metadata?.bindings && JSON.stringify(blockAttributes.metadata.bindings).includes('core/pattern-overrides')) {
blockNamesForPrompt.add(blockName);
messageType = 'patternOverrides';
}
}
const innerBlocks = select.getBlockOrder(clientId);
queue.push(...innerBlocks);
}
// If any such blocks were found, trigger the removal prompt and
// skip any other steps (thus postponing actual removal).
if (blockNamesForPrompt.size) {
dispatch(displayBlockRemovalPrompt(clientIds, selectPrevious, Array.from(blockNamesForPrompt), messageType));
return;
}
}
if (selectPrevious) {
dispatch.selectPreviousBlock(clientIds[0], selectPrevious);
}
// We're batching these two actions because an extra `undo/redo` step can
// be created, based on whether we insert a default block or not.
registry.batch(() => {
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());
});
};
/**
* 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).
*/
const ensureDefaultBlock = () => ({
select,
dispatch
}) => {
// 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 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();
};
/**
* Returns an action object used in signalling that a block removal prompt must
* be displayed.
*
* Contrast with `setBlockRemovalRules`.
*
* @param {string|string[]} clientIds Client IDs of blocks to remove.
* @param {boolean} selectPrevious True if the previous block
* or the immediate parent
* (if no previous block exists)
* should be selected
* when a block is removed.
* @param {string[]} blockNamesForPrompt Names of the blocks that
* triggered the need for
* confirmation before removal.
* @param {string} messageType The type of message to display.
*
* @return {Object} Action object.
*/
function displayBlockRemovalPrompt(clientIds, selectPrevious, blockNamesForPrompt, messageType) {
return {
type: 'DISPLAY_BLOCK_REMOVAL_PROMPT',
clientIds,
selectPrevious,
blockNamesForPrompt,
messageType
};
}
/**
* Returns an action object used in signalling that a block removal prompt must
* be cleared, either be cause the user has confirmed or canceled the request
* for removal.
*
* @return {Object} Action object.
*/
function clearBlockRemovalPrompt() {
return {
type: 'CLEAR_BLOCK_REMOVAL_PROMPT'
};
}
/**
* Returns an action object used to set up any rules that a block editor may
* provide in order to prevent a user from accidentally removing certain
* blocks. These rules are then used to display a confirmation prompt to the
* user. For instance, in the Site Editor, the Query Loop block is important
* enough to warrant such confirmation.
*
* IMPORTANT: Registering rules implicitly signals to the `privateRemoveBlocks`
* action that the editor will be responsible for displaying block removal
* prompts and confirming deletions. This action is meant to be used by
* component `BlockRemovalWarningModal` only.
*
* The data is a record whose keys are block types (e.g. 'core/query') and
* whose values are the explanation to be shown to users (e.g. 'Query Loop
* displays a list of posts or pages.').
*
* Contrast with `displayBlockRemovalPrompt`.
*
* @param {Record<string,string>|false} rules Block removal rules.
* @return {Object} Action object.
*/
function setBlockRemovalRules(rules = false) {
return {
type: 'SET_BLOCK_REMOVAL_RULES',
rules
};
}
/**
* Sets the client ID of the block settings menu that is currently open.
*
* @param {?string} clientId The block client ID.
* @return {Object} Action object.
*/
function setOpenedBlockSettingsMenu(clientId) {
return {
type: 'SET_OPENED_BLOCK_SETTINGS_MENU',
clientId
};
}
function setStyleOverride(id, style) {
return {
type: 'SET_STYLE_OVERRIDE',
id,
style
};
}
function deleteStyleOverride(id) {
return {
type: 'DELETE_STYLE_OVERRIDE',
id
};
}
/**
* A higher-order action that mark every change inside a callback as "non-persistent"
* and ignore pushing to the undo history stack. It's primarily used for synchronized
* derived updates from the block editor without affecting the undo history.
*
* @param {() => void} callback The synchronous callback to derive updates.
*/
function syncDerivedUpdates(callback) {
return ({
dispatch,
select,
registry
}) => {
registry.batch(() => {
// Mark every change in the `callback` as non-persistent.
dispatch({
type: 'SET_EXPLICIT_PERSISTENT',
isPersistentChange: false
});
callback();
dispatch({
type: 'SET_EXPLICIT_PERSISTENT',
isPersistentChange: undefined
});
// Ignore pushing undo stack for the updated blocks.
const updatedBlocks = select.getBlocks();
undoIgnoreBlocks.add(updatedBlocks);
});
};
}
/**
* Action that sets the element that had focus when focus leaves the editor canvas.
*
* @param {Object} lastFocus The last focused element.
*
*
* @return {Object} Action object.
*/
function setLastFocus(lastFocus = null) {
return {
type: 'LAST_FOCUS',
lastFocus
};
}
/**
* Action that stops temporarily editing as blocks.
*
* @param {string} clientId The block's clientId.
*/
function stopEditingAsBlocks(clientId) {
return ({
select,
dispatch
}) => {
const focusModeToRevert = select.__unstableGetTemporarilyEditingFocusModeToRevert();
dispatch.__unstableMarkNextChangeAsNotPersistent();
dispatch.updateBlockAttributes(clientId, {
templateLock: 'contentOnly'
});
dispatch.updateBlockListSettings(clientId, {
...select.getBlockListSettings(clientId),
templateLock: 'contentOnly'
});
dispatch.updateSettings({
focusMode: focusModeToRevert
});
dispatch.__unstableSetTemporarilyEditingAsBlocks();
};
}
/**
* Returns an action object used in signalling that the user has begun to drag.
*
* @return {Object} Action object.
*/
function startDragging() {
return {
type: 'START_DRAGGING'
};
}
/**
* Returns an action object used in signalling that the user has stopped dragging.
*
* @return {Object} Action object.
*/
function stopDragging() {
return {
type: 'STOP_DRAGGING'
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/utils.js
/**
* WordPress dependencies
*/
const INSERTER_PATTERN_TYPES = {
user: 'user',
theme: 'theme',
directory: 'directory'
};
const INSERTER_SYNC_TYPES = {
full: 'fully',
unsynced: 'unsynced'
};
const allPatternsCategory = {
name: 'allPatterns',
label: (0,external_wp_i18n_namespaceObject._x)('All', 'patterns')
};
const myPatternsCategory = {
name: 'myPatterns',
label: (0,external_wp_i18n_namespaceObject.__)('My patterns')
};
function isPatternFiltered(pattern, sourceFilter, syncFilter) {
const isUserPattern = pattern.name.startsWith('core/block');
const isDirectoryPattern = pattern.source === 'core' || pattern.source?.startsWith('pattern-directory');
// If theme source selected, filter out user created patterns and those from
// the core patterns directory.
if (sourceFilter === INSERTER_PATTERN_TYPES.theme && (isUserPattern || isDirectoryPattern)) {
return true;
}
// If the directory source is selected, filter out user created patterns
// and those bundled with the theme.
if (sourceFilter === INSERTER_PATTERN_TYPES.directory && (isUserPattern || !isDirectoryPattern)) {
return true;
}
// If user source selected, filter out theme patterns.
if (sourceFilter === INSERTER_PATTERN_TYPES.user && pattern.type !== INSERTER_PATTERN_TYPES.user) {
return true;
}
// Filter by sync status.
if (syncFilter === INSERTER_SYNC_TYPES.full && pattern.syncStatus !== '') {
return true;
}
if (syncFilter === INSERTER_SYNC_TYPES.unsynced && pattern.syncStatus !== 'unsynced' && isUserPattern) {
return true;
}
return false;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/object.js
/**
* Immutably sets a value inside an object. Like `lodash#set`, but returning a
* new object. Treats nullish initial values as empty objects. Clones any
* nested objects. Supports arrays, too.
*
* @param {Object} object Object to set a value in.
* @param {number|string|Array} path Path in the object to modify.
* @param {*} value New value to set.
* @return {Object} Cloned object with the new value set.
*/
function setImmutably(object, path, value) {
// Normalize path
path = Array.isArray(path) ? [...path] : [path];
// Shallowly clone the base of the object
object = Array.isArray(object) ? [...object] : {
...object
};
const leaf = path.pop();
// Traverse object from root to leaf, shallowly cloning at each level
let prev = object;
for (const key of path) {
const lvl = prev[key];
prev = prev[key] = Array.isArray(lvl) ? [...lvl] : {
...lvl
};
}
prev[leaf] = value;
return object;
}
/**
* Helper util to return a value from a certain path of the object.
* Path is specified as either:
* - a string of properties, separated by dots, for example: "x.y".
* - an array of properties, for example `[ 'x', 'y' ]`.
* You can also specify a default value in case the result is nullish.
*
* @param {Object} object Input object.
* @param {string|Array} path Path to the object property.
* @param {*} defaultValue Default value if the value at the specified path is nullish.
* @return {*} Value of the object property at the specified path.
*/
const getValueFromObjectPath = (object, path, defaultValue) => {
var _value;
const arrayPath = Array.isArray(path) ? path : path.split('.');
let value = object;
arrayPath.forEach(fieldName => {
value = value?.[fieldName];
});
return (_value = value) !== null && _value !== void 0 ? _value : defaultValue;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/get-block-settings.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const blockedPaths = ['color', 'border', 'dimensions', 'typography', 'spacing'];
const deprecatedFlags = {
'color.palette': settings => settings.colors,
'color.gradients': settings => 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,
'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;
};
/**
* For settings like `color.palette`, which have a value that is an object
* with `default`, `theme`, `custom`, with field values that are arrays of
* items, merge these three arrays into one and return it. The calculation
* is memoized so that identical input values produce identical output.
* @param {Object} value Object to merge
* @return {Array} Array of merged items
*/
function mergeOrigins(value) {
let result = mergeCache.get(value);
if (!result) {
result = ['default', 'theme', 'custom'].flatMap(key => {
var _value$key;
return (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : [];
});
mergeCache.set(value, result);
}
return result;
}
const mergeCache = new WeakMap();
/**
* For settings like `color.palette`, which have a value that is an object
* with `default`, `theme`, `custom`, with field values that are arrays of
* items, returns the one with the highest priority among these three arrays.
* @param {Object} value Object to extract from
* @return {Array} Array of items extracted from the three origins
*/
function overrideOrigins(value) {
var _ref, _value$custom;
return (_ref = (_value$custom = value.custom) !== null && _value$custom !== void 0 ? _value$custom : value.theme) !== null && _ref !== void 0 ? _ref : value.default;
}
/**
* For settings like `color.palette`, which have a value that is an object
* with `default`, `theme`, `custom`, with field values that are arrays of
* items, see if any of the three origins have values.
*
* @param {Object} value Object to check
* @return {boolean} Whether the object has values in any of the three origins
*/
function hasOriginValue(value) {
return ['default', 'theme', 'custom'].some(key => value?.[key]?.length);
}
function getBlockSettings(state, clientId, ...paths) {
const blockName = getBlockName(state, clientId);
const candidates = [];
if (clientId) {
let id = clientId;
do {
const name = getBlockName(state, id);
if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, '__experimentalSettings', false)) {
candidates.push(id);
}
} while (id = state.blocks.parents.get(id));
}
return paths.map(path => {
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;
}
// 0. Allow third parties to filter the block's settings at runtime.
let result = (0,external_wp_hooks_namespaceObject.applyFilters)('blockEditor.useSetting.before', undefined, path, clientId, blockName);
if (undefined !== result) {
return result;
}
const normalizedPath = removeCustomPrefixes(path);
// 1. Take settings from the block instance or its ancestors.
// Start from the current block and work our way up the ancestors.
for (const candidateClientId of candidates) {
var _getValueFromObjectPa;
const candidateAtts = getBlockAttributes(state, candidateClientId);
result = (_getValueFromObjectPa = getValueFromObjectPath(candidateAtts.settings?.blocks?.[blockName], normalizedPath)) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : getValueFromObjectPath(candidateAtts.settings, normalizedPath);
if (result !== undefined) {
// Stop the search for more distant ancestors and move on.
break;
}
}
// 2. Fall back to the settings from the block editor store (__experimentalFeatures).
const settings = getSettings(state);
if (result === undefined && blockName) {
result = getValueFromObjectPath(settings.__experimentalFeatures?.blocks?.[blockName], normalizedPath);
}
if (result === undefined) {
result = getValueFromObjectPath(settings.__experimentalFeatures, normalizedPath);
}
// Return if the setting was found in either the block instance or the store.
if (result !== undefined) {
if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_OVERRIDE[normalizedPath]) {
return overrideOrigins(result);
}
return result;
}
// 3. Otherwise, use deprecated settings.
const deprecatedSettingsValue = deprecatedFlags[normalizedPath]?.(settings);
if (deprecatedSettingsValue !== undefined) {
return deprecatedSettingsValue;
}
// 4. Fallback 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;
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns true if the block interface is hidden, or false otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether the block toolbar is hidden.
*/
function private_selectors_isBlockInterfaceHidden(state) {
return state.isBlockInterfaceHidden;
}
/**
* Gets the client ids of the last inserted blocks.
*
* @param {Object} state Global application state.
* @return {Array|undefined} Client Ids of the last inserted block(s).
*/
function getLastInsertedBlocksClientIds(state) {
return state?.lastBlockInserted?.clientIds;
}
function getBlockWithoutAttributes(state, clientId) {
return state.blocks.byClientId.get(clientId);
}
/**
* Returns true if all of the descendants of a block with the given client ID
* have an editing mode of 'disabled', or false otherwise.
*
* @param {Object} state Global application state.
* @param {string} clientId The block client ID.
*
* @return {boolean} Whether the block descendants are disabled.
*/
const isBlockSubtreeDisabled = (state, clientId) => {
const isChildSubtreeDisabled = childClientId => {
return getBlockEditingMode(state, childClientId) === 'disabled' && getBlockOrder(state, childClientId).every(isChildSubtreeDisabled);
};
return getBlockOrder(state, clientId).every(isChildSubtreeDisabled);
};
function getEnabledClientIdsTreeUnmemoized(state, rootClientId) {
const blockOrder = getBlockOrder(state, rootClientId);
const result = [];
for (const clientId of blockOrder) {
const innerBlocks = getEnabledClientIdsTreeUnmemoized(state, clientId);
if (getBlockEditingMode(state, clientId) !== 'disabled') {
result.push({
clientId,
innerBlocks
});
} else {
result.push(...innerBlocks);
}
}
return result;
}
/**
* Returns a tree of block objects with only clientID and innerBlocks set.
* Blocks with a 'disabled' editing mode are not included.
*
* @param {Object} state Global application state.
* @param {?string} rootClientId Optional root client ID of block list.
*
* @return {Object[]} Tree of block objects with only clientID and innerBlocks set.
*/
const getEnabledClientIdsTree = rememo(getEnabledClientIdsTreeUnmemoized, state => [state.blocks.order, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]);
/**
* Returns a list of a given block's ancestors, from top to bottom. Blocks with
* a 'disabled' editing mode are excluded.
*
* @see getBlockParents
*
* @param {Object} state Global application state.
* @param {string} clientId The block client ID.
* @param {boolean} ascending Order results from bottom to top (true) or top
* to bottom (false).
*/
const getEnabledBlockParents = rememo((state, clientId, ascending = false) => {
return getBlockParents(state, clientId, ascending).filter(parent => getBlockEditingMode(state, parent) !== 'disabled');
}, state => [state.blocks.parents, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]);
/**
* Selector that returns the data needed to display a prompt when certain
* blocks are removed, or `false` if no such prompt is requested.
*
* @param {Object} state Global application state.
*
* @return {Object|false} Data for removal prompt display, if any.
*/
function getRemovalPromptData(state) {
return state.removalPromptData;
}
/**
* Returns true if removal prompt exists, or false otherwise.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether removal prompt exists.
*/
function getBlockRemovalRules(state) {
return state.blockRemovalRules;
}
/**
* Returns the client ID of the block settings menu that is currently open.
*
* @param {Object} state Global application state.
* @return {string|null} The client ID of the block menu that is currently open.
*/
function getOpenedBlockSettingsMenu(state) {
return state.openedBlockSettingsMenu;
}
/**
* Returns all style overrides, intended to be merged with global editor styles.
*
* @param {Object} state Global application state.
*
* @return {Map} A map of style IDs to style overrides.
*/
function getStyleOverrides(state) {
return state.styleOverrides;
}
/** @typedef {import('./actions').InserterMediaCategory} InserterMediaCategory */
/**
* Returns the registered inserter media categories through the public API.
*
* @param {Object} state Editor state.
*
* @return {InserterMediaCategory[]} Inserter media categories.
*/
function getRegisteredInserterMediaCategories(state) {
return state.registeredInserterMediaCategories;
}
/**
* Returns an array containing the allowed inserter media categories.
* It merges the registered media categories from extenders with the
* core ones. It also takes into account the allowed `mime_types`, which
* can be altered by `upload_mimes` filter and restrict some of them.
*
* @param {Object} state Global application state.
*
* @return {InserterMediaCategory[]} Client IDs of descendants.
*/
const getInserterMediaCategories = rememo(state => {
const {
settings: {
inserterMediaCategories,
allowedMimeTypes,
enableOpenverseMediaCategory
},
registeredInserterMediaCategories
} = state;
// The allowed `mime_types` can be altered by `upload_mimes` filter and restrict
// some of them. In this case we shouldn't add the category to the available media
// categories list in the inserter.
if (!inserterMediaCategories && !registeredInserterMediaCategories.length || !allowedMimeTypes) {
return;
}
const coreInserterMediaCategoriesNames = inserterMediaCategories?.map(({
name
}) => name) || [];
const mergedCategories = [...(inserterMediaCategories || []), ...(registeredInserterMediaCategories || []).filter(({
name
}) => !coreInserterMediaCategoriesNames.includes(name))];
return mergedCategories.filter(category => {
// Check if Openverse category is enabled.
if (!enableOpenverseMediaCategory && category.name === 'openverse') {
return false;
}
return Object.values(allowedMimeTypes).some(mimeType => mimeType.startsWith(`${category.mediaType}/`));
});
}, state => [state.settings.inserterMediaCategories, state.settings.allowedMimeTypes, state.settings.enableOpenverseMediaCategory, state.registeredInserterMediaCategories]);
/**
* Returns whether there is at least one allowed pattern for inner blocks children.
* This is useful for deferring the parsing of all patterns until needed.
*
* @param {Object} state Editor state.
* @param {string} [rootClientId=null] Target root client ID.
*
* @return {boolean} If there is at least one allowed pattern.
*/
const hasAllowedPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => rememo((state, rootClientId = null) => {
const {
getAllPatterns,
__experimentalGetParsedPattern
} = unlock(select(STORE_NAME));
const patterns = getAllPatterns();
const {
allowedBlockTypes
} = getSettings(state);
return patterns.some(({
name,
inserter = true
}) => {
if (!inserter) {
return false;
}
const {
blocks
} = __experimentalGetParsedPattern(name);
return checkAllowListRecursive(blocks, allowedBlockTypes) && blocks.every(({
name: blockName
}) => canInsertBlockType(state, blockName, rootClientId));
});
}, (state, rootClientId) => [getAllPatternsDependants(select)(state), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId)]));
const getAllPatterns = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => rememo(state => {
var _state$settings$selec;
// This setting is left for back compat.
const {
__experimentalBlockPatterns = [],
__experimentalUserPatternCategories = [],
__experimentalReusableBlocks = []
} = state.settings;
const userPatterns = (__experimentalReusableBlocks !== null && __experimentalReusableBlocks !== void 0 ? __experimentalReusableBlocks : []).map(userPattern => {
return {
name: `core/block/${userPattern.id}`,
id: userPattern.id,
type: INSERTER_PATTERN_TYPES.user,
title: userPattern.title.raw,
categories: userPattern.wp_pattern_category.map(catId => {
const category = (__experimentalUserPatternCategories !== null && __experimentalUserPatternCategories !== void 0 ? __experimentalUserPatternCategories : []).find(({
id
}) => id === catId);
return category ? category.slug : catId;
}),
content: userPattern.content.raw,
syncStatus: userPattern.wp_pattern_sync_status
};
});
return [...userPatterns, ...__experimentalBlockPatterns, ...((_state$settings$selec = state.settings[selectBlockPatternsKey]?.(select)) !== null && _state$settings$selec !== void 0 ? _state$settings$selec : [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name));
}, getAllPatternsDependants(select)));
/**
* Returns the element of the last element that had focus when focus left the editor canvas.
*
* @param {Object} state Block editor state.
*
* @return {Object} Element.
*/
function getLastFocus(state) {
return state.lastFocus;
}
/**
* Returns true if the user is dragging anything, or false otherwise. It is possible for a
* user to be dragging data from outside of the editor, so this selector is separate from
* the `isDraggingBlocks` selector which only returns true if the user is dragging blocks.
*
* @param {Object} state Global application state.
*
* @return {boolean} Whether user is dragging.
*/
function private_selectors_isDragging(state) {
return state.isDragging;
}
;// CONCATENATED MODULE: external ["wp","a11y"]
const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/selection.js
/**
* WordPress 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';
/**
* Retrieve the block attribute that contains the selection position.
*
* @param {Object} blockAttributes Block attributes.
* @return {string|void} The name of the block attribute that was previously selected.
*/
function retrieveSelectedAttribute(blockAttributes) {
if (!blockAttributes) {
return;
}
return Object.keys(blockAttributes).find(name => {
const value = blockAttributes[name];
return (typeof value === 'string' || value instanceof external_wp_richText_namespaceObject.RichTextData) &&
// To do: refactor this to use rich text's selection instead, so we
// no longer have to use on this hack inserting a special character.
value.toString().indexOf(START_OF_SELECTED_AREA) !== -1;
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/actions.js
/* eslint no-console: [ 'error', { allow: [ 'error', 'warn' ] } ] */
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('../components/use-on-block-drop/types').WPDropOperation} WPDropOperation */
const actions_castArray = maybeArray => Array.isArray(maybeArray) ? maybeArray : [maybeArray];
/**
* 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.
*/
const resetBlocks = blocks => ({
dispatch
}) => {
dispatch({
type: 'RESET_BLOCKS',
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
* across distinct parts of state, it is implemented here as a side
* effect of the block reset action.
*
* @param {Array} blocks Array of blocks.
*/
const validateBlocksToTemplate = blocks => ({
select,
dispatch
}) => {
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' || (0,external_wp_blocks_namespaceObject.doBlocksMatchTemplate)(blocks, template);
// Update if validity has changed.
const isValidTemplate = select.isValidTemplate();
if (isBlocksValidToTemplate !== isValidTemplate) {
dispatch.setTemplateValidity(isBlocksValidToTemplate);
return isBlocksValidToTemplate;
}
};
/**
* A block selection object.
*
* @typedef {Object} WPBlockSelection
*
* @property {string} clientId A block client ID.
* @property {string} attributeKey A block attribute key.
* @property {number} offset An attribute value offset, based on the rich
* text value. See `wp.richText.create`.
*/
/**
* 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.
*
* @param {WPBlockSelection} selectionStart The selection start.
* @param {WPBlockSelection} selectionEnd The selection end.
* @param {0|-1|null} initialPosition Initial block position.
*
* @return {Object} Action object.
*/
function resetSelection(selectionStart, selectionEnd, initialPosition) {
/* eslint-enable jsdoc/valid-types */
return {
type: 'RESET_SELECTION',
selectionStart,
selectionEnd,
initialPosition
};
}
/**
* Returns an action object used in signalling that blocks have been received.
* Unlike resetBlocks, these should be appended to the existing known set, not
* replacing.
*
* @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
};
}
/**
* 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 updateBlockAttributes(clientIds, attributes, uniqueByBlock = false) {
return {
type: 'UPDATE_BLOCK_ATTRIBUTES',
clientIds: actions_castArray(clientIds),
attributes,
uniqueByBlock
};
}
/**
* Action that updates the block with the specified client ID.
*
* @param {string} clientId Block client ID.
* @param {Object} updates Block attributes to be merged.
*
* @return {Object} Action object.
*/
function updateBlock(clientId, updates) {
return {
type: 'UPDATE_BLOCK',
clientId,
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
* value reflecting its selection directionality. An initialPosition of -1
* reflects a reverse selection.
*
* @param {string} clientId Block client ID.
* @param {0|-1|null} initialPosition Optional initial position. Pass as -1 to
* reflect reverse selection.
*
* @return {Object} Action object.
*/
function selectBlock(clientId, initialPosition = 0) {
/* eslint-enable jsdoc/valid-types */
return {
type: 'SELECT_BLOCK',
initialPosition,
clientId
};
}
/**
* Yields action objects used in signalling that the block preceding the given
* clientId (or optionally, its first parent from bottom to top)
* should be selected.
*
* @param {string} clientId Block client ID.
* @param {boolean} fallbackToParent If true, select the first parent if there is no previous block.
*/
const selectPreviousBlock = (clientId, fallbackToParent = false) => ({
select,
dispatch
}) => {
const previousBlockClientId = select.getPreviousBlockClientId(clientId);
if (previousBlockClientId) {
dispatch.selectBlock(previousBlockClientId, -1);
} else if (fallbackToParent) {
const firstParentClientId = select.getBlockRootClientId(clientId);
if (firstParentClientId) {
dispatch.selectBlock(firstParentClientId, -1);
}
}
};
/**
* Yields action objects used in signalling that the block following the given
* clientId should be selected.
*
* @param {string} clientId Block client ID.
*/
const selectNextBlock = clientId => ({
select,
dispatch
}) => {
const nextBlockClientId = select.getNextBlockClientId(clientId);
if (nextBlockClientId) {
dispatch.selectBlock(nextBlockClientId);
}
};
/**
* Action that starts block multi-selection.
*
* @return {Object} Action object.
*/
function startMultiSelect() {
return {
type: 'START_MULTI_SELECT'
};
}
/**
* Action that stops block multi-selection.
*
* @return {Object} Action object.
*/
function stopMultiSelect() {
return {
type: 'STOP_MULTI_SELECT'
};
}
/**
* 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 = (start, end, __experimentalInitialPosition = 0) => ({
select,
dispatch
}) => {
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 clearSelectedBlock() {
return {
type: 'CLEAR_SELECTED_BLOCK'
};
}
/**
* Action that enables or disables block selection.
*
* @param {boolean} [isSelectionEnabled=true] Whether block selection should
* be enabled.
*
* @return {Object} Action object.
*/
function toggleSelection(isSelectionEnabled = true) {
return {
type: 'TOGGLE_SELECTION',
isSelectionEnabled
};
}
function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) {
var _blockEditorSettings$;
const preferredStyleVariations = (_blockEditorSettings$ = blockEditorSettings?.__experimentalPreferredStyleVariations?.value) !== null && _blockEditorSettings$ !== void 0 ? _blockEditorSettings$ : {};
return blocks.map(block => {
const blockName = block.name;
if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'defaultStylePicker', true)) {
return block;
}
if (!preferredStyleVariations[blockName]) {
return block;
}
const className = block.attributes?.className;
if (className?.includes('is-style-')) {
return block;
}
const {
attributes = {}
} = block;
const blockStyle = preferredStyleVariations[blockName];
return {
...block,
attributes: {
...attributes,
className: `${className || ''} is-style-${blockStyle}`.trim()
}
};
});
}
/* 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).
* @param {number} indexToSelect Index of replacement block to select.
* @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.
*
* @return {Object} Action object.
*/
const replaceBlocks = (clientIds, blocks, indexToSelect, initialPosition = 0, meta) => ({
select,
dispatch,
registry
}) => {
/* eslint-enable jsdoc/valid-types */
clientIds = actions_castArray(clientIds);
blocks = getBlocksWithDefaultStylesApplied(actions_castArray(blocks), select.getSettings());
const rootClientId = select.getBlockRootClientId(clientIds[0]);
// 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;
}
}
// We're batching these two actions because an extra `undo/redo` step can
// be created, based on whether we insert a default block or not.
registry.batch(() => {
dispatch({
type: 'REPLACE_BLOCKS',
clientIds,
blocks,
time: Date.now(),
indexToSelect,
initialPosition,
meta
});
// 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();
});
};
/**
* 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).
*
* @return {Object} Action object.
*/
function replaceBlock(clientId, block) {
return replaceBlocks(clientId, block);
}
/**
* Higher-order action creator which, given the action type to dispatch creates
* an action creator for managing block movement.
*
* @param {string} type Action type to dispatch.
*
* @return {Function} Action creator.
*/
const createOnMove = type => (clientIds, rootClientId) => ({
select,
dispatch
}) => {
// 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;
}
dispatch({
type,
clientIds: actions_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 = (clientIds, fromRootClientId = '', toRootClientId = '', index) => ({
select,
dispatch
}) => {
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, fromRootClientId = '', toRootClientId = '', index) {
return moveBlocksToPosition([clientId], fromRootClientId, toRootClientId, index);
}
/**
* Action that inserts a single block, optionally at a specific index respective a root block list.
*
* Only allowed blocks are inserted. The action may fail silently for blocks that are not allowed or if
* a templateLock is active on the 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.
*
* @return {Object} Action object.
*/
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.
*
* Only allowed blocks are inserted. The action may fail silently for blocks that are not allowed or if
* a templateLock is active on the block list.
*
* @param {Object[]} blocks Block objects 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 {0|-1|null} initialPosition Initial focus position. Setting it to null prevent focusing the inserted block.
* @param {?Object} meta Optional Meta values to be passed to the action object.
*
* @return {Object} Action object.
*/
const insertBlocks = (blocks, index, rootClientId, updateSelection = true, initialPosition = 0, meta) => ({
select,
dispatch
}) => {
/* eslint-enable jsdoc/valid-types */
if (initialPosition !== null && typeof initialPosition === 'object') {
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(actions_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 Additional options.
* @property {boolean} __unstableWithInserter Whether or not to show an inserter button.
* @property {WPDropOperation} operation The operation to perform when applied,
* either 'insert' or 'replace' for now.
*
* @return {Object} Action object.
*/
function showInsertionPoint(rootClientId, index, __unstableOptions = {}) {
const {
__unstableWithInserter,
operation,
nearestSide
} = __unstableOptions;
return {
type: 'SHOW_INSERTION_POINT',
rootClientId,
index,
__unstableWithInserter,
operation,
nearestSide
};
}
/**
* Action that hides the insertion point.
*/
const hideInsertionPoint = () => ({
select,
dispatch
}) => {
if (!select.isBlockInsertionPointVisible()) {
return;
}
dispatch({
type: 'HIDE_INSERTION_POINT'
});
};
/**
* Action that resets the template validity.
*
* @param {boolean} isValid template validity flag.
*
* @return {Object} Action object.
*/
function setTemplateValidity(isValid) {
return {
type: 'SET_TEMPLATE_VALIDITY',
isValid
};
}
/**
* Action that synchronizes the template with the list of blocks.
*
* @return {Object} Action object.
*/
const synchronizeTemplate = () => ({
select,
dispatch
}) => {
dispatch({
type: 'SYNCHRONIZE_TEMPLATE'
});
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 => ({
registry,
select,
dispatch
}) => {
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 blockB = select.getBlock(selectionB.clientId);
const htmlA = blockA.attributes[selectionA.attributeKey];
const htmlB = blockB.attributes[selectionB.attributeKey];
let valueA = (0,external_wp_richText_namespaceObject.create)({
html: htmlA
});
let valueB = (0,external_wp_richText_namespaceObject.create)({
html: htmlB
});
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
})
});
const cloneB = (0,external_wp_blocks_namespaceObject.cloneBlock)(blockB, {
[selectionB.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({
value: valueB
})
});
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 = retrieveSelectedAttribute(updatedAttributes);
const convertedHtml = updatedAttributes[newAttributeKey];
const convertedValue = (0,external_wp_richText_namespaceObject.create)({
html: convertedHtml
});
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
});
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 = () => ({
select,
dispatch
}) => {
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 blockB = select.getBlock(selectionB.clientId);
const htmlA = blockA.attributes[selectionA.attributeKey];
const htmlB = blockB.attributes[selectionB.attributeKey];
let valueA = (0,external_wp_richText_namespaceObject.create)({
html: htmlA
});
let valueB = (0,external_wp_richText_namespaceObject.create)({
html: htmlB
});
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
})
}
}, {
// Preserve the original client ID.
...blockB,
attributes: {
...blockB.attributes,
[selectionB.attributeKey]: (0,external_wp_richText_namespaceObject.toHTMLString)({
value: valueB
})
}
}]);
};
/**
* Expand the selection to cover the entire blocks, removing partial selection.
*/
const __unstableExpandSelection = () => ({
select,
dispatch
}) => {
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.
*/
const mergeBlocks = (firstBlockClientId, secondBlockClientId) => ({
registry,
select,
dispatch
}) => {
const blocks = [firstBlockClientId, secondBlockClientId];
dispatch({
type: 'MERGE_BLOCKS',
blocks
});
const [clientIdA, clientIdB] = blocks;
const blockA = select.getBlock(clientIdA);
const blockAType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockA.name);
if (!blockAType) return;
const blockB = select.getBlock(clientIdB);
if (!blockAType.merge && (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockA.name, '__experimentalOnMerge')) {
// If there's no merge function defined, attempt merging inner
// blocks.
const blocksWithTheSameType = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blockB, blockAType.name);
// Only focus the previous block if it's not mergeable.
if (blocksWithTheSameType?.length !== 1) {
dispatch.selectBlock(blockA.clientId);
return;
}
const [blockWithSameType] = blocksWithTheSameType;
if (blockWithSameType.innerBlocks.length < 1) {
dispatch.selectBlock(blockA.clientId);
return;
}
registry.batch(() => {
dispatch.insertBlocks(blockWithSameType.innerBlocks, undefined, clientIdA);
dispatch.removeBlock(clientIdB);
dispatch.selectBlock(blockWithSameType.innerBlocks[0].clientId);
// Attempt to merge the next block if it's the same type and
// same attributes. This is useful when merging a paragraph into
// a list, and the next block is also a list. If we don't merge,
// it looks like one list, but it's actually two lists. The same
// applies to other blocks such as a group with the same
// attributes.
const nextBlockClientId = select.getNextBlockClientId(clientIdA);
if (nextBlockClientId && select.getBlockName(clientIdA) === select.getBlockName(nextBlockClientId)) {
const rootAttributes = select.getBlockAttributes(clientIdA);
const previousRootAttributes = select.getBlockAttributes(nextBlockClientId);
if (Object.keys(rootAttributes).every(key => rootAttributes[key] === previousRootAttributes[key])) {
dispatch.moveBlocksToPosition(select.getBlockOrder(nextBlockClientId), nextBlockClientId, clientIdA);
dispatch.removeBlock(nextBlockClientId, false);
}
}
});
return;
}
if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockA)) {
dispatch.removeBlock(clientIdA, select.isBlockSelected(clientIdA));
return;
}
if ((0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blockB)) {
dispatch.removeBlock(clientIdB, select.isBlockSelected(clientIdB));
return;
}
if (!blockAType.merge) {
dispatch.selectBlock(blockA.clientId);
return;
}
const blockBType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockB.name);
const {
clientId,
attributeKey,
offset
} = 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
// is not a defined block attribute key. This can be the case if the
// fallback intance ID is used to store selection (and no RichText
// identifier is set), or when the identifier is wrong.
!!attributeDefinition;
if (!attributeDefinition) {
if (typeof attributeKey === 'number') {
window.console.error(`RichText needs an identifier prop that is the block attribute key of the attribute it controls. Its type is expected to be a string, but was ${typeof attributeKey}`);
} else {
window.console.error('The RichText identifier prop does not match any attributes defined by the block.');
}
}
// Clone the blocks so we don't insert the character in a "live" block.
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 value = (0,external_wp_richText_namespaceObject.insert)((0,external_wp_richText_namespaceObject.create)({
html
}), START_OF_SELECTED_AREA, offset, offset);
selectedBlock.attributes[attributeKey] = (0,external_wp_richText_namespaceObject.toHTMLString)({
value
});
}
// We can only merge blocks with similar types
// 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.
const updatedAttributes = blockAType.merge(cloneA.attributes, blocksWithTheSameType[0].attributes);
if (canRestoreTextSelection) {
const newAttributeKey = retrieveSelectedAttribute(updatedAttributes);
const convertedHtml = updatedAttributes[newAttributeKey];
const convertedValue = (0,external_wp_richText_namespaceObject.create)({
html: convertedHtml
});
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
});
updatedAttributes[newAttributeKey] = newHtml;
dispatch.selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset);
}
dispatch.replaceBlocks([blockA.clientId, blockB.clientId], [{
...blockA,
attributes: {
...blockA.attributes,
...updatedAttributes
}
}, ...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.
*
* @param {string|string[]} clientIds Client IDs of blocks to remove.
* @param {boolean} selectPrevious True if the previous block
* or the immediate parent
* (if no previous block exists)
* should be selected
* when a block is removed.
*/
const removeBlocks = (clientIds, selectPrevious = true) => privateRemoveBlocks(clientIds, selectPrevious);
/**
* Returns an action object used in signalling that the block with the
* specified client ID is to be removed.
*
* @param {string} clientId Client ID of block to remove.
* @param {boolean} selectPrevious True if the previous block should be
* selected when a block is removed.
*
* @return {Object} Action object.
*/
function removeBlock(clientId, selectPrevious) {
return 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.
*
* @param {string} rootClientId Client ID of the block whose InnerBlocks will re replaced.
* @param {Object[]} blocks Block objects to insert as new InnerBlocks
* @param {?boolean} updateSelection If true block selection will be updated. If false, block selection will not change. Defaults to false.
* @param {0|-1|null} initialPosition Initial block position.
* @return {Object} Action object.
*/
function replaceInnerBlocks(rootClientId, blocks, updateSelection = false, initialPosition = 0) {
/* eslint-enable jsdoc/valid-types */
return {
type: 'REPLACE_INNER_BLOCKS',
rootClientId,
blocks,
updateSelection,
initialPosition: updateSelection ? initialPosition : null,
time: Date.now()
};
}
/**
* Returns an action object used to toggle the block editing mode between
* visual and HTML modes.
*
* @param {string} clientId Block client ID.
*
* @return {Object} Action object.
*/
function toggleBlockMode(clientId) {
return {
type: 'TOGGLE_BLOCK_MODE',
clientId
};
}
/**
* Returns an action object used in signalling that the user has begun to type.
*
* @return {Object} Action object.
*/
function startTyping() {
return {
type: 'START_TYPING'
};
}
/**
* Returns an action object used in signalling that the user has stopped typing.
*
* @return {Object} Action object.
*/
function stopTyping() {
return {
type: 'STOP_TYPING'
};
}
/**
* Returns an action object used in signalling that the user has begun to drag blocks.
*
* @param {string[]} clientIds An array of client ids being dragged
*
* @return {Object} Action object.
*/
function startDraggingBlocks(clientIds = []) {
return {
type: 'START_DRAGGING_BLOCKS',
clientIds
};
}
/**
* Returns an action object used in signalling that the user has stopped dragging blocks.
*
* @return {Object} Action object.
*/
function stopDraggingBlocks() {
return {
type: 'STOP_DRAGGING_BLOCKS'
};
}
/**
* Returns an action object used in signalling that the caret has entered formatted text.
*
* @deprecated
*
* @return {Object} Action object.
*/
function enterFormattedText() {
external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).enterFormattedText', {
since: '6.1',
version: '6.3'
});
return {
type: 'DO_NOTHING'
};
}
/**
* Returns an action object used in signalling that the user caret has exited formatted text.
*
* @deprecated
*
* @return {Object} Action object.
*/
function exitFormattedText() {
external_wp_deprecated_default()('wp.data.dispatch( "core/block-editor" ).exitFormattedText', {
since: '6.1',
version: '6.3'
});
return {
type: 'DO_NOTHING'
};
}
/**
* 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 selectionChange(clientId, attributeKey, startOffset, endOffset) {
if (typeof clientId === 'string') {
return {
type: 'SELECTION_CHANGE',
clientId,
attributeKey,
startOffset,
endOffset
};
}
return {
type: 'SELECTION_CHANGE',
...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.
*/
const insertDefaultBlock = (attributes, rootClientId, index) => ({
dispatch
}) => {
// Abort if there is no default block type (if it has been unregistered).
const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)();
if (!defaultBlockName) {
return;
}
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.
* @param {Object} settings Object with the new settings for the nested block.
*
* @return {Object} Action object
*/
function updateBlockListSettings(clientId, settings) {
return {
type: 'UPDATE_BLOCK_LIST_SETTINGS',
clientId,
settings
};
}
/**
* Action that updates the block editor settings.
*
* @param {Object} settings Updated settings
*
* @return {Object} Action object
*/
function updateSettings(settings) {
return __experimentalUpdateSettings(settings, {
stripExperimentalSettings: true
});
}
/**
* 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.
* @param {string} updatedId Updated block's id.
*
* @return {Object} Action object.
*/
function __unstableSaveReusableBlock(id, updatedId) {
return {
type: 'SAVE_REUSABLE_BLOCK_SUCCESS',
id,
updatedId
};
}
/**
* Action that marks the last block change explicitly as persistent.
*
* @return {Object} Action object.
*/
function __unstableMarkLastChangeAsPersistent() {
return {
type: 'MARK_LAST_CHANGE_AS_PERSISTENT'
};
}
/**
* Action that signals that the next block change should be marked explicitly as not persistent.
*
* @return {Object} Action object.
*/
function __unstableMarkNextChangeAsNotPersistent() {
return {
type: 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT'
};
}
/**
* 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.
*/
const __unstableMarkAutomaticChange = () => ({
dispatch
}) => {
dispatch({
type: 'MARK_AUTOMATIC_CHANGE'
});
const {
requestIdleCallback = cb => setTimeout(cb, 100)
} = window;
requestIdleCallback(() => {
dispatch({
type: 'MARK_AUTOMATIC_CHANGE_FINAL'
});
});
};
/**
* Action that enables or disables the navigation mode.
*
* @param {boolean} isNavigationMode Enable/Disable navigation mode.
*/
const setNavigationMode = (isNavigationMode = true) => ({
dispatch
}) => {
dispatch.__unstableSetEditorMode(isNavigationMode ? 'navigation' : 'edit');
};
/**
* Action that sets the editor mode
*
* @param {string} mode Editor mode
*/
const __unstableSetEditorMode = mode => ({
dispatch,
select
}) => {
// When switching to zoom-out mode, we need to select the root block
if (mode === 'zoom-out') {
const firstSelectedClientId = select.getBlockSelectionStart();
if (firstSelectedClientId) {
dispatch.selectBlock(select.getBlockHierarchyRootClientId(firstSelectedClientId));
}
}
dispatch({
type: 'SET_EDITOR_MODE',
mode
});
if (mode === 'navigation') {
(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 if (mode === 'edit') {
(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.'));
} else if (mode === 'zoom-out') {
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('You are currently in zoom-out mode.'));
}
};
/**
* Action that enables or disables the block moving mode.
*
* @param {string|null} hasBlockMovingClientId Enable/Disable block moving mode.
*/
const setBlockMovingClientId = (hasBlockMovingClientId = null) => ({
dispatch
}) => {
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
*/
const duplicateBlocks = (clientIds, updateSelection = true) => ({
select,
dispatch
}) => {
if (!clientIds || !clientIds.length) {
return;
}
// Return early if blocks don't exist.
const blocks = select.getBlocksByClientId(clientIds);
if (blocks.some(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 clientIdsArray = actions_castArray(clientIds);
const lastSelectedIndex = select.getBlockIndex(clientIdsArray[clientIdsArray.length - 1]);
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(clonedBlocks[0].clientId, clonedBlocks[clonedBlocks.length - 1].clientId);
}
return clonedBlocks.map(block => block.clientId);
};
/**
* Action that inserts a default block before a given block.
*
* @param {string} clientId
*/
const insertBeforeBlock = clientId => ({
select,
dispatch
}) => {
if (!clientId) {
return;
}
const rootClientId = select.getBlockRootClientId(clientId);
const isLocked = select.getTemplateLock(rootClientId);
if (isLocked) {
return;
}
const blockIndex = select.getBlockIndex(clientId);
const directInsertBlock = rootClientId ? select.getDirectInsertBlock(rootClientId) : null;
if (!directInsertBlock) {
return dispatch.insertDefaultBlock({}, rootClientId, blockIndex);
}
const copiedAttributes = {};
if (directInsertBlock.attributesToCopy) {
const attributes = select.getBlockAttributes(clientId);
directInsertBlock.attributesToCopy.forEach(key => {
if (attributes[key]) {
copiedAttributes[key] = attributes[key];
}
});
}
const block = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, {
...directInsertBlock.attributes,
...copiedAttributes
});
return dispatch.insertBlock(block, blockIndex, rootClientId);
};
/**
* Action that inserts a default block after a given block.
*
* @param {string} clientId
*/
const insertAfterBlock = clientId => ({
select,
dispatch
}) => {
if (!clientId) {
return;
}
const rootClientId = select.getBlockRootClientId(clientId);
const isLocked = select.getTemplateLock(rootClientId);
if (isLocked) {
return;
}
const blockIndex = select.getBlockIndex(clientId);
const directInsertBlock = rootClientId ? select.getDirectInsertBlock(rootClientId) : null;
if (!directInsertBlock) {
return dispatch.insertDefaultBlock({}, rootClientId, blockIndex + 1);
}
const copiedAttributes = {};
if (directInsertBlock.attributesToCopy) {
const attributes = select.getBlockAttributes(clientId);
directInsertBlock.attributesToCopy.forEach(key => {
if (attributes[key]) {
copiedAttributes[key] = attributes[key];
}
});
}
const block = (0,external_wp_blocks_namespaceObject.createBlock)(directInsertBlock.name, {
...directInsertBlock.attributes,
...copiedAttributes
});
return dispatch.insertBlock(block, blockIndex + 1, rootClientId);
};
/**
* Action that toggles the highlighted block state.
*
* @param {string} clientId The block's clientId.
* @param {boolean} isHighlighted The highlight state.
*/
function toggleBlockHighlight(clientId, isHighlighted) {
return {
type: 'TOGGLE_BLOCK_HIGHLIGHT',
clientId,
isHighlighted
};
}
/**
* Action that "flashes" the block with a given `clientId` by rhythmically highlighting it.
*
* @param {string} clientId Target block client ID.
*/
const flashBlock = clientId => async ({
dispatch
}) => {
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 setHasControlledInnerBlocks(clientId, hasControlledInnerBlocks) {
return {
type: 'SET_HAS_CONTROLLED_INNER_BLOCKS',
hasControlledInnerBlocks,
clientId
};
}
/**
* Action that sets whether given blocks are visible on the canvas.
*
* @param {Record<string,boolean>} updates For each block's clientId, its new visibility setting.
*/
function setBlockVisibility(updates) {
return {
type: 'SET_BLOCK_VISIBILITY',
updates
};
}
/**
* Action that sets whether a block is being temporarily edited as blocks.
*
* DO-NOT-USE in production.
* This action is created for internal/experimental only usage and may be
* removed anytime without any warning, causing breakage on any plugin or theme invoking it.
*
* @param {?string} temporarilyEditingAsBlocks The block's clientId being temporarily edited as blocks.
* @param {?string} focusModeToRevert The focus mode to revert after temporarily edit as blocks finishes.
*/
function __unstableSetTemporarilyEditingAsBlocks(temporarilyEditingAsBlocks, focusModeToRevert) {
return {
type: 'SET_TEMPORARILY_EDITING_AS_BLOCKS',
temporarilyEditingAsBlocks,
focusModeToRevert
};
}
/**
* Interface for inserter media requests.
*
* @typedef {Object} InserterMediaRequest
* @property {number} per_page How many items to fetch per page.
* @property {string} search The search term to use for filtering the results.
*/
/**
* Interface for inserter media responses. Any media resource should
* map their response to this interface, in order to create the core
* WordPress media blocks (image, video, audio).
*
* @typedef {Object} InserterMediaItem
* @property {string} title The title of the media item.
* @property {string} url The source url of the media item.
* @property {string} [previewUrl] The preview source url of the media item to display in the media list.
* @property {number} [id] The WordPress id of the media item.
* @property {number|string} [sourceId] The id of the media item from external source.
* @property {string} [alt] The alt text of the media item.
* @property {string} [caption] The caption of the media item.
*/
/**
* Registers a new inserter media category. Once registered, the media category is
* available in the inserter's media tab.
*
* The following interfaces are used:
*
* _Type Definition_
*
* - _InserterMediaRequest_ `Object`: Interface for inserter media requests.
*
* _Properties_
*
* - _per_page_ `number`: How many items to fetch per page.
* - _search_ `string`: The search term to use for filtering the results.
*
* _Type Definition_
*
* - _InserterMediaItem_ `Object`: Interface for inserter media responses. Any media resource should
* map their response to this interface, in order to create the core
* WordPress media blocks (image, video, audio).
*
* _Properties_
*
* - _title_ `string`: The title of the media item.
* - _url_ `string: The source url of the media item.
* - _previewUrl_ `[string]`: The preview source url of the media item to display in the media list.
* - _id_ `[number]`: The WordPress id of the media item.
* - _sourceId_ `[number|string]`: The id of the media item from external source.
* - _alt_ `[string]`: The alt text of the media item.
* - _caption_ `[string]`: The caption of the media item.
*
* @param {InserterMediaCategory} category The inserter media category to register.
*
* @example
* ```js
*
* wp.data.dispatch('core/block-editor').registerInserterMediaCategory( {
* name: 'openverse',
* labels: {
* name: 'Openverse',
* search_items: 'Search Openverse',
* },
* mediaType: 'image',
* async fetch( query = {} ) {
* const defaultArgs = {
* mature: false,
* excluded_source: 'flickr,inaturalist,wikimedia',
* license: 'pdm,cc0',
* };
* const finalQuery = { ...query, ...defaultArgs };
* // Sometimes you might need to map the supported request params according to `InserterMediaRequest`.
* // interface. In this example the `search` query param is named `q`.
* const mapFromInserterMediaRequest = {
* per_page: 'page_size',
* search: 'q',
* };
* const url = new URL( 'https://api.openverse.engineering/v1/images/' );
* Object.entries( finalQuery ).forEach( ( [ key, value ] ) => {
* const queryKey = mapFromInserterMediaRequest[ key ] || key;
* url.searchParams.set( queryKey, value );
* } );
* const response = await window.fetch( url, {
* headers: {
* 'User-Agent': 'WordPress/inserter-media-fetch',
* },
* } );
* const jsonResponse = await response.json();
* const results = jsonResponse.results;
* return results.map( ( result ) => ( {
* ...result,
* // If your response result includes an `id` prop that you want to access later, it should
* // be mapped to `InserterMediaItem`'s `sourceId` prop. This can be useful if you provide
* // a report URL getter.
* // Additionally you should always clear the `id` value of your response results because
* // it is used to identify WordPress media items.
* sourceId: result.id,
* id: undefined,
* caption: result.caption,
* previewUrl: result.thumbnail,
* } ) );
* },
* getReportUrl: ( { sourceId } ) =>
* `https://wordpress.org/openverse/image/${ sourceId }/report/`,
* isExternalResource: true,
* } );
* ```
*
* @typedef {Object} InserterMediaCategory Interface for inserter media category.
* @property {string} name The name of the media category, that should be unique among all media categories.
* @property {Object} labels Labels for the media category.
* @property {string} labels.name General name of the media category. It's used in the inserter media items list.
* @property {string} [labels.search_items='Search'] Label for searching items. Default is ‘Search Posts’ / ‘Search Pages’.
* @property {('image'|'audio'|'video')} mediaType The media type of the media category.
* @property {(InserterMediaRequest) => Promise<InserterMediaItem[]>} fetch The function to fetch media items for the category.
* @property {(InserterMediaItem) => string} [getReportUrl] If the media category supports reporting media items, this function should return
* the report url for the media item. It accepts the `InserterMediaItem` as an argument.
* @property {boolean} [isExternalResource] If the media category is an external resource, this should be set to true.
* This is used to avoid making a request to the external resource when the user
*/
const registerInserterMediaCategory = category => ({
select,
dispatch
}) => {
if (!category || typeof category !== 'object') {
console.error('Category should be an `InserterMediaCategory` object.');
return;
}
if (!category.name) {
console.error('Category should have a `name` that should be unique among all media categories.');
return;
}
if (!category.labels?.name) {
console.error('Category should have a `labels.name`.');
return;
}
if (!['image', 'audio', 'video'].includes(category.mediaType)) {
console.error('Category should have `mediaType` property that is one of `image|audio|video`.');
return;
}
if (!category.fetch || typeof category.fetch !== 'function') {
console.error('Category should have a `fetch` function defined with the following signature `(InserterMediaRequest) => Promise<InserterMediaItem[]>`.');
return;
}
const registeredInserterMediaCategories = select.getRegisteredInserterMediaCategories();
if (registeredInserterMediaCategories.some(({
name
}) => name === category.name)) {
console.error(`A category is already registered with the same name: "${category.name}".`);
return;
}
if (registeredInserterMediaCategories.some(({
labels: {
name
} = {}
}) => name === category.labels?.name)) {
console.error(`A category is already registered with the same labels.name: "${category.labels.name}".`);
return;
}
// `inserterMediaCategories` is a private block editor setting, which means it cannot
// be updated through the public `updateSettings` action. We preserve this setting as
// private, so extenders can only add new inserter media categories and don't have any
// control over the core media categories.
dispatch({
type: 'REGISTER_INSERTER_MEDIA_CATEGORY',
category: {
...category,
isExternalResource: true
}
});
};
/**
* @typedef {import('../components/block-editing-mode').BlockEditingMode} BlockEditingMode
*/
/**
* Sets the block editing mode for a given block.
*
* @see useBlockEditingMode
*
* @param {string} clientId The block client ID, or `''` for the root container.
* @param {BlockEditingMode} mode The block editing mode. One of `'disabled'`,
* `'contentOnly'`, or `'default'`.
*
* @return {Object} Action object.
*/
function setBlockEditingMode(clientId = '', mode) {
return {
type: 'SET_BLOCK_EDITING_MODE',
clientId,
mode
};
}
/**
* Clears the block editing mode for a given block.
*
* @see useBlockEditingMode
*
* @param {string} clientId The block client ID, or `''` for the root container.
*
* @return {Object} Action object.
*/
function unsetBlockEditingMode(clientId = '') {
return {
type: 'UNSET_BLOCK_EDITING_MODE',
clientId
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Block editor data store configuration.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
*/
const storeConfig = {
reducer: reducer,
selectors: selectors_namespaceObject,
actions: actions_namespaceObject
};
/**
* Store definition for the block editor namespace.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*/
const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
...storeConfig,
persist: ['preferences']
});
// We will be able to use the `register` function once we switch
// the "preferences" persistence to use the new preferences package.
const registeredStore = (0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, {
...storeConfig,
persist: ['preferences']
});
unlock(registeredStore).registerPrivateActions(private_actions_namespaceObject);
unlock(registeredStore).registerPrivateSelectors(private_selectors_namespaceObject);
// TODO: Remove once we switch to the `register` function (see above).
//
// Until then, private functions also need to be attached to the original
// `store` descriptor in order to avoid unit tests failing, which could happen
// when tests create new registries in which they register stores.
//
// @see https://github.com/WordPress/gutenberg/pull/51145#discussion_r1239999590
unlock(store).registerPrivateActions(private_actions_namespaceObject);
unlock(store).registerPrivateSelectors(private_selectors_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-settings/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Hook that retrieves the given settings for the block instance in use.
*
* It looks up the settings first in the block instance hierarchy.
* If none are found, it'll look them up in the block editor settings.
*
* @param {string[]} paths The paths to the settings.
* @return {any[]} Returns the values defined for the settings.
* @example
* ```js
* const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );
* ```
*/
function use_settings_useSettings(...paths) {
const {
clientId = null
} = useBlockEditContext();
return (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getBlockSettings(clientId, ...paths),
// eslint-disable-next-line react-hooks/exhaustive-deps
[clientId, ...paths]);
}
/**
* Hook that retrieves the given setting for the block instance in use.
*
* It looks up the setting first in the block instance hierarchy.
* If none is found, it'll look it up in the block editor settings.
*
* @param {string} path The path to the setting.
* @return {any} Returns the value defined for the setting.
* @deprecated 6.5.0 Use useSettings instead.
* @example
* ```js
* const isEnabled = useSetting( 'typography.dropCap' );
* ```
*/
function useSetting(path) {
external_wp_deprecated_default()('wp.blockEditor.useSetting', {
since: '6.5',
alternative: 'wp.blockEditor.useSettings',
note: 'The new useSettings function can retrieve multiple settings at once, with better performance.'
});
const [value] = use_settings_useSettings(path);
return value;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/fluid-utils.js
/**
* The fluid utilities must match the backend equivalent.
* See: gutenberg_get_typography_font_size_value() in lib/block-supports/typography.php
* ---------------------------------------------------------------
*/
// Defaults.
const DEFAULT_MAXIMUM_VIEWPORT_WIDTH = '1600px';
const DEFAULT_MINIMUM_VIEWPORT_WIDTH = '320px';
const DEFAULT_SCALE_FACTOR = 1;
const DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN = 0.25;
const DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX = 0.75;
const DEFAULT_MINIMUM_FONT_SIZE_LIMIT = '14px';
/**
* Computes a fluid font-size value that uses clamp(). A minimum and maximum
* font size OR a single font size can be specified.
*
* If a single font size is specified, it is scaled up and down using a logarithmic scale.
*
* @example
* ```js
* // Calculate fluid font-size value from a minimum and maximum value.
* const fontSize = getComputedFluidTypographyValue( {
* minimumFontSize: '20px',
* maximumFontSize: '45px'
* } );
* // Calculate fluid font-size value from a single font size.
* const fontSize = getComputedFluidTypographyValue( {
* fontSize: '30px',
* } );
* ```
*
* @param {Object} args
* @param {?string} args.minimumViewportWidth Minimum viewport size from which type will have fluidity. Optional if fontSize is specified.
* @param {?string} args.maximumViewportWidth Maximum size up to which type will have fluidity. Optional if fontSize is specified.
* @param {string|number} [args.fontSize] Size to derive maximumFontSize and minimumFontSize from, if necessary. Optional if minimumFontSize and maximumFontSize are specified.
* @param {?string} args.maximumFontSize Maximum font size for any clamp() calculation. Optional.
* @param {?string} args.minimumFontSize Minimum font size for any clamp() calculation. Optional.
* @param {?number} args.scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.
* @param {?string} args.minimumFontSizeLimit The smallest a calculated font size may be. Optional.
*
* @return {string|null} A font-size value using clamp().
*/
function getComputedFluidTypographyValue({
minimumFontSize,
maximumFontSize,
fontSize,
minimumViewportWidth = DEFAULT_MINIMUM_VIEWPORT_WIDTH,
maximumViewportWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH,
scaleFactor = DEFAULT_SCALE_FACTOR,
minimumFontSizeLimit
}) {
// Validate incoming settings and set defaults.
minimumFontSizeLimit = !!getTypographyValueAndUnit(minimumFontSizeLimit) ? minimumFontSizeLimit : DEFAULT_MINIMUM_FONT_SIZE_LIMIT;
/*
* Calculates missing minimumFontSize and maximumFontSize from
* defaultFontSize if provided.
*/
if (fontSize) {
// Parses default font size.
const fontSizeParsed = getTypographyValueAndUnit(fontSize);
// Protect against invalid units.
if (!fontSizeParsed?.unit) {
return null;
}
// Parses the minimum font size limit, so we can perform checks using it.
const minimumFontSizeLimitParsed = getTypographyValueAndUnit(minimumFontSizeLimit, {
coerceTo: fontSizeParsed.unit
});
// Don't enforce minimum font size if a font size has explicitly set a min and max value.
if (!!minimumFontSizeLimitParsed?.value && !minimumFontSize && !maximumFontSize) {
/*
* If a minimum size was not passed to this function
* and the user-defined font size is lower than $minimum_font_size_limit,
* do not calculate a fluid value.
*/
if (fontSizeParsed?.value <= minimumFontSizeLimitParsed?.value) {
return null;
}
}
// If no fluid max font size is available use the incoming value.
if (!maximumFontSize) {
maximumFontSize = `${fontSizeParsed.value}${fontSizeParsed.unit}`;
}
/*
* If no minimumFontSize is provided, create one using
* the given font size multiplied by the min font size scale factor.
*/
if (!minimumFontSize) {
const fontSizeValueInPx = fontSizeParsed.unit === 'px' ? fontSizeParsed.value : fontSizeParsed.value * 16;
/*
* The scale factor is a multiplier that affects how quickly the curve will move towards the minimum,
* that is, how quickly the size factor reaches 0 given increasing font size values.
* For a - b * log2(), lower values of b will make the curve move towards the minimum faster.
* The scale factor is constrained between min and max values.
*/
const minimumFontSizeFactor = Math.min(Math.max(1 - 0.075 * Math.log2(fontSizeValueInPx), DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN), DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX);
// Calculates the minimum font size.
const calculatedMinimumFontSize = roundToPrecision(fontSizeParsed.value * minimumFontSizeFactor, 3);
// Only use calculated min font size if it's > $minimum_font_size_limit value.
if (!!minimumFontSizeLimitParsed?.value && calculatedMinimumFontSize < minimumFontSizeLimitParsed?.value) {
minimumFontSize = `${minimumFontSizeLimitParsed.value}${minimumFontSizeLimitParsed.unit}`;
} else {
minimumFontSize = `${calculatedMinimumFontSize}${fontSizeParsed.unit}`;
}
}
}
// Grab the minimum font size and normalize it in order to use the value for calculations.
const minimumFontSizeParsed = getTypographyValueAndUnit(minimumFontSize);
// We get a 'preferred' unit to keep units consistent when calculating,
// otherwise the result will not be accurate.
const fontSizeUnit = minimumFontSizeParsed?.unit || 'rem';
// Grabs the maximum font size and normalize it in order to use the value for calculations.
const maximumFontSizeParsed = getTypographyValueAndUnit(maximumFontSize, {
coerceTo: fontSizeUnit
});
// Checks for mandatory min and max sizes, and protects against unsupported units.
if (!minimumFontSizeParsed || !maximumFontSizeParsed) {
return null;
}
// Uses rem for accessible fluid target font scaling.
const minimumFontSizeRem = getTypographyValueAndUnit(minimumFontSize, {
coerceTo: 'rem'
});
// Viewport widths defined for fluid typography. Normalize units
const maximumViewportWidthParsed = getTypographyValueAndUnit(maximumViewportWidth, {
coerceTo: fontSizeUnit
});
const minimumViewportWidthParsed = getTypographyValueAndUnit(minimumViewportWidth, {
coerceTo: fontSizeUnit
});
// Protect against unsupported units.
if (!maximumViewportWidthParsed || !minimumViewportWidthParsed || !minimumFontSizeRem) {
return null;
}
// Calculates the linear factor denominator. If it's 0, we cannot calculate a fluid value.
const linearDenominator = maximumViewportWidthParsed.value - minimumViewportWidthParsed.value;
if (!linearDenominator) {
return null;
}
// Build CSS rule.
// Borrowed from https://websemantics.uk/tools/responsive-font-calculator/.
const minViewportWidthOffsetValue = roundToPrecision(minimumViewportWidthParsed.value / 100, 3);
const viewportWidthOffset = roundToPrecision(minViewportWidthOffsetValue, 3) + fontSizeUnit;
const linearFactor = 100 * ((maximumFontSizeParsed.value - minimumFontSizeParsed.value) / linearDenominator);
const linearFactorScaled = roundToPrecision((linearFactor || 1) * scaleFactor, 3);
const fluidTargetFontSize = `${minimumFontSizeRem.value}${minimumFontSizeRem.unit} + ((1vw - ${viewportWidthOffset}) * ${linearFactorScaled})`;
return `clamp(${minimumFontSize}, ${fluidTargetFontSize}, ${maximumFontSize})`;
}
/**
* Internal method that checks a string for a unit and value and returns an array consisting of `'value'` and `'unit'`, e.g., [ '42', 'rem' ].
* A raw font size of `value + unit` is expected. If the value is an integer, it will convert to `value + 'px'`.
*
* @param {string|number} rawValue Raw size value from theme.json.
* @param {Object|undefined} options Calculation options.
*
* @return {{ unit: string, value: number }|null} An object consisting of `'value'` and `'unit'` properties.
*/
function getTypographyValueAndUnit(rawValue, options = {}) {
if (typeof rawValue !== 'string' && typeof rawValue !== 'number') {
return null;
}
// Converts numeric values to pixel values by default.
if (isFinite(rawValue)) {
rawValue = `${rawValue}px`;
}
const {
coerceTo,
rootSizeValue,
acceptableUnits
} = {
coerceTo: '',
// Default browser font size. Later we could inject some JS to compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`.
rootSizeValue: 16,
acceptableUnits: ['rem', 'px', 'em'],
...options
};
const acceptableUnitsGroup = acceptableUnits?.join('|');
const regexUnits = new RegExp(`^(\\d*\\.?\\d+)(${acceptableUnitsGroup}){1,1}$`);
const matches = rawValue.match(regexUnits);
// We need a number value and a unit.
if (!matches || matches.length < 3) {
return null;
}
let [, value, unit] = matches;
let returnValue = parseFloat(value);
if ('px' === coerceTo && ('em' === unit || 'rem' === unit)) {
returnValue = returnValue * rootSizeValue;
unit = coerceTo;
}
if ('px' === unit && ('em' === coerceTo || 'rem' === coerceTo)) {
returnValue = returnValue / rootSizeValue;
unit = coerceTo;
}
/*
* No calculation is required if swapping between em and rem yet,
* since we assume a root size value. Later we might like to differentiate between
* :root font size (rem) and parent element font size (em) relativity.
*/
if (('em' === coerceTo || 'rem' === coerceTo) && ('em' === unit || 'rem' === unit)) {
unit = coerceTo;
}
return {
value: roundToPrecision(returnValue, 3),
unit
};
}
/**
* Returns a value rounded to defined precision.
* Returns `undefined` if the value is not a valid finite number.
*
* @param {number} value Raw value.
* @param {number} digits The number of digits to appear after the decimal point
*
* @return {number|undefined} Value rounded to standard precision.
*/
function roundToPrecision(value, digits = 3) {
const base = Math.pow(10, digits);
return Number.isFinite(value) ? parseFloat(Math.round(value * base) / base) : undefined;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/typography-utils.js
/**
* The fluid utilities must match the backend equivalent.
* See: gutenberg_get_typography_font_size_value() in lib/block-supports/typography.php
* ---------------------------------------------------------------
*/
/**
* Internal dependencies
*/
/**
* @typedef {Object} FluidPreset
* @property {string|undefined} max A maximum font size value.
* @property {?string|undefined} min A minimum font size value.
*/
/**
* @typedef {Object} Preset
* @property {?string|?number} size A default font size.
* @property {string} name A font size name, displayed in the UI.
* @property {string} slug A font size slug
* @property {boolean|FluidPreset|undefined} fluid Specifies the minimum and maximum font size value of a fluid font size.
*/
/**
* @typedef {Object} TypographySettings
* @property {?string} minViewportWidth Minimum viewport size from which type will have fluidity. Optional if size is specified.
* @property {?string} maxViewportWidth Maximum size up to which type will have fluidity. Optional if size is specified.
* @property {?number} scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.
* @property {?number} minFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.
* @property {?string} minFontSize The smallest a calculated font size may be. Optional.
*/
/**
* Returns a font-size value based on a given font-size preset.
* Takes into account fluid typography parameters and attempts to return a css formula depending on available, valid values.
*
* @param {Preset} preset
* @param {Object} typographyOptions
* @param {boolean|TypographySettings} typographyOptions.fluid Whether fluid typography is enabled, and, optionally, fluid font size options.
*
* @return {string|*} A font-size value or the value of preset.size.
*/
function getTypographyFontSizeValue(preset, typographyOptions) {
const {
size: defaultSize
} = preset;
if (!isFluidTypographyEnabled(typographyOptions)) {
return defaultSize;
}
/*
* Checks whether a font size has explicitly bypassed fluid calculations.
* Also catches falsy values and 0/'0'.
* Fluid calculations cannot be performed on `0`.
*/
if (!defaultSize || '0' === defaultSize || false === preset?.fluid) {
return defaultSize;
}
const fluidTypographySettings = typeof typographyOptions?.fluid === 'object' ? typographyOptions?.fluid : {};
const fluidFontSizeValue = getComputedFluidTypographyValue({
minimumFontSize: preset?.fluid?.min,
maximumFontSize: preset?.fluid?.max,
fontSize: defaultSize,
minimumFontSizeLimit: fluidTypographySettings?.minFontSize,
maximumViewportWidth: fluidTypographySettings?.maxViewportWidth,
minimumViewportWidth: fluidTypographySettings?.minViewportWidth
});
if (!!fluidFontSizeValue) {
return fluidFontSizeValue;
}
return defaultSize;
}
function isFluidTypographyEnabled(typographySettings) {
const fluidSettings = typographySettings?.fluid;
return true === fluidSettings || fluidSettings && typeof fluidSettings === 'object' && Object.keys(fluidSettings).length > 0;
}
/**
* Returns fluid typography settings from theme.json setting object.
*
* @param {Object} settings Theme.json settings
* @param {Object} settings.typography Theme.json typography settings
* @param {Object} settings.layout Theme.json layout settings
* @return {TypographySettings} Fluid typography settings
*/
function getFluidTypographyOptionsFromSettings(settings) {
const typographySettings = settings?.typography;
const layoutSettings = settings?.layout;
const defaultMaxViewportWidth = getTypographyValueAndUnit(layoutSettings?.wideSize) ? layoutSettings?.wideSize : null;
return isFluidTypographyEnabled(typographySettings) && defaultMaxViewportWidth ? {
fluid: {
maxViewportWidth: defaultMaxViewportWidth,
...typographySettings.fluid
}
} : {
fluid: typographySettings?.fluid
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/utils.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/* Supporting data. */
const ROOT_BLOCK_NAME = 'root';
const ROOT_BLOCK_SELECTOR = 'body';
const ROOT_BLOCK_SUPPORTS = (/* unused pure expression or super */ null && (['background', 'backgroundColor', 'color', 'linkColor', 'captionColor', 'buttonColor', 'headingColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'textTransform', 'padding']));
const PRESET_METADATA = [{
path: ['color', 'palette'],
valueKey: 'color',
cssVarInfix: 'color',
classes: [{
classSuffix: 'color',
propertyName: 'color'
}, {
classSuffix: 'background-color',
propertyName: 'background-color'
}, {
classSuffix: 'border-color',
propertyName: 'border-color'
}]
}, {
path: ['color', 'gradients'],
valueKey: 'gradient',
cssVarInfix: 'gradient',
classes: [{
classSuffix: 'gradient-background',
propertyName: 'background'
}]
}, {
path: ['color', 'duotone'],
valueKey: 'colors',
cssVarInfix: 'duotone',
valueFunc: ({
slug
}) => `url( '#wp-duotone-${slug}' )`,
classes: []
}, {
path: ['shadow', 'presets'],
valueKey: 'shadow',
cssVarInfix: 'shadow',
classes: []
}, {
path: ['typography', 'fontSizes'],
valueFunc: (preset, settings) => getTypographyFontSizeValue(preset, getFluidTypographyOptionsFromSettings(settings)),
valueKey: 'size',
cssVarInfix: 'font-size',
classes: [{
classSuffix: 'font-size',
propertyName: 'font-size'
}]
}, {
path: ['typography', 'fontFamilies'],
valueKey: 'fontFamily',
cssVarInfix: 'font-family',
classes: [{
classSuffix: 'font-family',
propertyName: 'font-family'
}]
}, {
path: ['spacing', 'spacingSizes'],
valueKey: 'size',
cssVarInfix: 'spacing',
valueFunc: ({
size
}) => size,
classes: []
}];
const STYLE_PATH_TO_CSS_VAR_INFIX = {
'color.background': 'color',
'color.text': 'color',
'filter.duotone': 'duotone',
'elements.link.color.text': 'color',
'elements.link.:hover.color.text': 'color',
'elements.link.typography.fontFamily': 'font-family',
'elements.link.typography.fontSize': 'font-size',
'elements.button.color.text': 'color',
'elements.button.color.background': 'color',
'elements.caption.color.text': 'color',
'elements.button.typography.fontFamily': 'font-family',
'elements.button.typography.fontSize': 'font-size',
'elements.heading.color': 'color',
'elements.heading.color.background': 'color',
'elements.heading.typography.fontFamily': 'font-family',
'elements.heading.gradient': 'gradient',
'elements.heading.color.gradient': 'gradient',
'elements.h1.color': 'color',
'elements.h1.color.background': 'color',
'elements.h1.typography.fontFamily': 'font-family',
'elements.h1.color.gradient': 'gradient',
'elements.h2.color': 'color',
'elements.h2.color.background': 'color',
'elements.h2.typography.fontFamily': 'font-family',
'elements.h2.color.gradient': 'gradient',
'elements.h3.color': 'color',
'elements.h3.color.background': 'color',
'elements.h3.typography.fontFamily': 'font-family',
'elements.h3.color.gradient': 'gradient',
'elements.h4.color': 'color',
'elements.h4.color.background': 'color',
'elements.h4.typography.fontFamily': 'font-family',
'elements.h4.color.gradient': 'gradient',
'elements.h5.color': 'color',
'elements.h5.color.background': 'color',
'elements.h5.typography.fontFamily': 'font-family',
'elements.h5.color.gradient': 'gradient',
'elements.h6.color': 'color',
'elements.h6.color.background': 'color',
'elements.h6.typography.fontFamily': 'font-family',
'elements.h6.color.gradient': 'gradient',
'color.gradient': 'gradient',
shadow: 'shadow',
'typography.fontSize': 'font-size',
'typography.fontFamily': 'font-family'
};
// A static list of block attributes that store global style preset slugs.
const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
'color.background': 'backgroundColor',
'color.text': 'textColor',
'color.gradient': 'gradient',
'typography.fontSize': 'fontSize',
'typography.fontFamily': 'fontFamily'
};
const TOOLSPANEL_DROPDOWNMENU_PROPS = {
popoverProps: {
placement: 'left-start',
offset: 259 // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
}
};
function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) {
// Block presets take priority above root level presets.
const orderedPresetsByOrigin = [getValueFromObjectPath(features, ['blocks', blockName, ...presetPath]), getValueFromObjectPath(features, presetPath)];
for (const presetByOrigin of orderedPresetsByOrigin) {
if (presetByOrigin) {
// Preset origins ordered by priority.
const origins = ['custom', 'theme', 'default'];
for (const origin of origins) {
const presets = presetByOrigin[origin];
if (presets) {
const presetObject = presets.find(preset => preset[presetProperty] === presetValueValue);
if (presetObject) {
if (presetProperty === 'slug') {
return presetObject;
}
// If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.
const highestPresetObjectWithSameSlug = findInPresetsBy(features, blockName, presetPath, 'slug', presetObject.slug);
if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) {
return presetObject;
}
return undefined;
}
}
}
}
}
}
function getPresetVariableFromValue(features, blockName, variableStylePath, presetPropertyValue) {
if (!presetPropertyValue) {
return presetPropertyValue;
}
const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[variableStylePath];
const metadata = PRESET_METADATA.find(data => data.cssVarInfix === cssVarInfix);
if (!metadata) {
// The property doesn't have preset data
// so the value should be returned as it is.
return presetPropertyValue;
}
const {
valueKey,
path
} = metadata;
const presetObject = findInPresetsBy(features, blockName, path, valueKey, presetPropertyValue);
if (!presetObject) {
// Value wasn't found in the presets,
// so it must be a custom value.
return presetPropertyValue;
}
return `var:preset|${cssVarInfix}|${presetObject.slug}`;
}
function getValueFromPresetVariable(features, blockName, variable, [presetType, slug]) {
const metadata = PRESET_METADATA.find(data => data.cssVarInfix === presetType);
if (!metadata) {
return variable;
}
const presetObject = findInPresetsBy(features.settings, blockName, metadata.path, 'slug', slug);
if (presetObject) {
const {
valueKey
} = metadata;
const result = presetObject[valueKey];
return getValueFromVariable(features, blockName, result);
}
return variable;
}
function getValueFromCustomVariable(features, blockName, variable, path) {
var _getValueFromObjectPa;
const result = (_getValueFromObjectPa = getValueFromObjectPath(features.settings, ['blocks', blockName, 'custom', ...path])) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : getValueFromObjectPath(features.settings, ['custom', ...path]);
if (!result) {
return variable;
}
// A variable may reference another variable so we need recursion until we find the value.
return getValueFromVariable(features, blockName, result);
}
/**
* Attempts to fetch the value of a theme.json CSS variable.
*
* @param {Object} features GlobalStylesContext config, e.g., user, base or merged. Represents the theme.json tree.
* @param {string} blockName The name of a block as represented in the styles property. E.g., 'root' for root-level, and 'core/${blockName}' for blocks.
* @param {string|*} variable An incoming style value. A CSS var value is expected, but it could be any value.
* @return {string|*|{ref}} The value of the CSS var, if found. If not found, the passed variable argument.
*/
function getValueFromVariable(features, blockName, variable) {
if (!variable || typeof variable !== 'string') {
if (variable?.ref && typeof variable?.ref === 'string') {
const refPath = variable.ref.split('.');
variable = getValueFromObjectPath(features, refPath);
// Presence of another ref indicates a reference to another dynamic value.
// Pointing to another dynamic value is not supported.
if (!variable || !!variable?.ref) {
return variable;
}
} else {
return variable;
}
}
const USER_VALUE_PREFIX = 'var:';
const THEME_VALUE_PREFIX = 'var(--wp--';
const THEME_VALUE_SUFFIX = ')';
let parsedVar;
if (variable.startsWith(USER_VALUE_PREFIX)) {
parsedVar = variable.slice(USER_VALUE_PREFIX.length).split('|');
} else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) {
parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split('--');
} else {
// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`
return variable;
}
const [type, ...path] = parsedVar;
if (type === 'preset') {
return getValueFromPresetVariable(features, blockName, variable, path);
}
if (type === 'custom') {
return getValueFromCustomVariable(features, blockName, variable, path);
}
return variable;
}
/**
* 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(', ');
}
/**
* Appends a sub-selector to an existing one.
*
* Given the compounded `selector` "h1, h2, h3"
* and the `toAppend` selector ".some-class" the result will be
* "h1.some-class, h2.some-class, h3.some-class".
*
* @param {string} selector Original selector.
* @param {string} toAppend Selector to append.
*
* @return {string} The new selector.
*/
function appendToSelector(selector, toAppend) {
if (!selector.includes(',')) {
return selector + toAppend;
}
const selectors = selector.split(',');
const newSelectors = selectors.map(sel => sel + toAppend);
return newSelectors.join(',');
}
/**
* Compares global style variations according to their styles and settings properties.
*
* @example
* ```js
* const globalStyles = { styles: { typography: { fontSize: '10px' } }, settings: {} };
* const variation = { styles: { typography: { fontSize: '10000px' } }, settings: {} };
* const isEqual = areGlobalStyleConfigsEqual( globalStyles, variation );
* // false
* ```
*
* @param {Object} original A global styles object.
* @param {Object} variation A global styles object.
*
* @return {boolean} Whether `original` and `variation` match.
*/
function areGlobalStyleConfigsEqual(original, variation) {
if (typeof original !== 'object' || typeof variation !== 'object') {
return original === variation;
}
return es6_default()(original?.styles, variation?.styles) && es6_default()(original?.settings, variation?.settings);
}
/**
* Generates the selector for a block style variation by creating the
* appropriate CSS class and adding it to the ancestor portion of the block's
* selector.
*
* For example, take the Button block which has a compound selector:
* `.wp-block-button .wp-block-button__link`. With a variation named 'custom',
* the class `.is-style-custom` should be added to the `.wp-block-button`
* ancestor only.
*
* This function will take into account comma separated and complex selectors.
*
* @param {string} variation Name for the variation.
* @param {string} blockSelector CSS selector for the block.
*
* @return {string} CSS selector for the block style variation.
*/
function getBlockStyleVariationSelector(variation, blockSelector) {
const variationClass = `.is-style-${variation}`;
if (!blockSelector) {
return variationClass;
}
const ancestorRegex = /((?::\([^)]+\))?\s*)([^\s:]+)/;
const addVariationClass = (_match, group1, group2) => {
return group1 + group2 + variationClass;
};
const result = blockSelector.split(',').map(part => part.replace(ancestorRegex, addVariationClass));
return result.join(',');
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/context.js
/**
* WordPress dependencies
*/
const DEFAULT_GLOBAL_STYLES_CONTEXT = {
user: {},
base: {},
merged: {},
setUserConfig: () => {}
};
const GlobalStylesContext = (0,external_wp_element_namespaceObject.createContext)(DEFAULT_GLOBAL_STYLES_CONTEXT);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/hooks.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const EMPTY_CONFIG = {
settings: {},
styles: {}
};
const VALID_SETTINGS = ['appearanceTools', 'useRootPaddingAwareAlignments', 'background.backgroundImage', 'background.backgroundRepeat', 'background.backgroundSize', 'border.color', 'border.radius', 'border.style', 'border.width', 'shadow.presets', 'shadow.defaultPresets', 'color.background', 'color.button', 'color.caption', 'color.custom', 'color.customDuotone', 'color.customGradient', 'color.defaultDuotone', 'color.defaultGradients', 'color.defaultPalette', 'color.duotone', 'color.gradients', 'color.heading', 'color.link', 'color.palette', 'color.text', 'custom', 'dimensions.aspectRatio', 'dimensions.minHeight', 'layout.contentSize', 'layout.definitions', 'layout.wideSize', 'lightbox.enabled', 'lightbox.allowEditing', 'position.fixed', 'position.sticky', 'spacing.customSpacingSize', 'spacing.spacingSizes', 'spacing.spacingScale', 'spacing.blockGap', 'spacing.margin', 'spacing.padding', 'spacing.units', 'typography.fluid', 'typography.customFontSize', 'typography.dropCap', 'typography.fontFamilies', 'typography.fontSizes', 'typography.fontStyle', 'typography.fontWeight', 'typography.letterSpacing', 'typography.lineHeight', 'typography.textColumns', 'typography.textDecoration', 'typography.textTransform', 'typography.writingMode'];
const useGlobalStylesReset = () => {
const {
user: config,
setUserConfig
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
const canReset = !!config && !es6_default()(config, EMPTY_CONFIG);
return [canReset, (0,external_wp_element_namespaceObject.useCallback)(() => setUserConfig(() => EMPTY_CONFIG), [setUserConfig])];
};
function useGlobalSetting(propertyPath, blockName, source = 'all') {
const {
setUserConfig,
...configs
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
const appendedBlockPath = blockName ? '.blocks.' + blockName : '';
const appendedPropertyPath = propertyPath ? '.' + propertyPath : '';
const contextualPath = `settings${appendedBlockPath}${appendedPropertyPath}`;
const globalPath = `settings${appendedPropertyPath}`;
const sourceKey = source === 'all' ? 'merged' : source;
const settingValue = (0,external_wp_element_namespaceObject.useMemo)(() => {
const configToUse = configs[sourceKey];
if (!configToUse) {
throw 'Unsupported source';
}
if (propertyPath) {
var _getValueFromObjectPa;
return (_getValueFromObjectPa = getValueFromObjectPath(configToUse, contextualPath)) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : getValueFromObjectPath(configToUse, globalPath);
}
let result = {};
VALID_SETTINGS.forEach(setting => {
var _getValueFromObjectPa2;
const value = (_getValueFromObjectPa2 = getValueFromObjectPath(configToUse, `settings${appendedBlockPath}.${setting}`)) !== null && _getValueFromObjectPa2 !== void 0 ? _getValueFromObjectPa2 : getValueFromObjectPath(configToUse, `settings.${setting}`);
if (value !== undefined) {
result = setImmutably(result, setting.split('.'), value);
}
});
return result;
}, [configs, sourceKey, propertyPath, contextualPath, globalPath, appendedBlockPath]);
const setSetting = newValue => {
setUserConfig(currentConfig => setImmutably(currentConfig, contextualPath.split('.'), newValue));
};
return [settingValue, setSetting];
}
function useGlobalStyle(path, blockName, source = 'all', {
shouldDecodeEncode = true
} = {}) {
const {
merged: mergedConfig,
base: baseConfig,
user: userConfig,
setUserConfig
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
const appendedPath = path ? '.' + path : '';
const finalPath = !blockName ? `styles${appendedPath}` : `styles.blocks.${blockName}${appendedPath}`;
const setStyle = newValue => {
setUserConfig(currentConfig => setImmutably(currentConfig, finalPath.split('.'), shouldDecodeEncode ? getPresetVariableFromValue(mergedConfig.settings, blockName, path, newValue) : newValue));
};
let rawResult, result;
switch (source) {
case 'all':
rawResult = getValueFromObjectPath(mergedConfig, finalPath);
result = shouldDecodeEncode ? getValueFromVariable(mergedConfig, blockName, rawResult) : rawResult;
break;
case 'user':
rawResult = getValueFromObjectPath(userConfig, finalPath);
result = shouldDecodeEncode ? getValueFromVariable(mergedConfig, blockName, rawResult) : rawResult;
break;
case 'base':
rawResult = getValueFromObjectPath(baseConfig, finalPath);
result = shouldDecodeEncode ? getValueFromVariable(baseConfig, blockName, rawResult) : rawResult;
break;
default:
throw 'Unsupported source';
}
return [result, setStyle];
}
/**
* React hook that overrides a global settings object with block and element specific settings.
*
* @param {Object} parentSettings Settings object.
* @param {blockName?} blockName Block name.
* @param {element?} element Element name.
*
* @return {Object} Merge of settings and supports.
*/
function useSettingsForBlockElement(parentSettings, blockName, element) {
const {
supportedStyles,
supports
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
return {
supportedStyles: unlock(select(external_wp_blocks_namespaceObject.store)).getSupportedStyles(blockName, element),
supports: select(external_wp_blocks_namespaceObject.store).getBlockType(blockName)?.supports
};
}, [blockName, element]);
return (0,external_wp_element_namespaceObject.useMemo)(() => {
const updatedSettings = {
...parentSettings
};
if (!supportedStyles.includes('fontSize')) {
updatedSettings.typography = {
...updatedSettings.typography,
fontSizes: {},
customFontSize: false
};
}
if (!supportedStyles.includes('fontFamily')) {
updatedSettings.typography = {
...updatedSettings.typography,
fontFamilies: {}
};
}
updatedSettings.color = {
...updatedSettings.color,
text: updatedSettings.color?.text && supportedStyles.includes('color'),
background: updatedSettings.color?.background && (supportedStyles.includes('background') || supportedStyles.includes('backgroundColor')),
button: updatedSettings.color?.button && supportedStyles.includes('buttonColor'),
heading: updatedSettings.color?.heading && supportedStyles.includes('headingColor'),
link: updatedSettings.color?.link && supportedStyles.includes('linkColor'),
caption: updatedSettings.color?.caption && supportedStyles.includes('captionColor')
};
// Some blocks can enable background colors but disable gradients.
if (!supportedStyles.includes('background')) {
updatedSettings.color.gradients = [];
updatedSettings.color.customGradient = false;
}
// If filters are not supported by the block/element, disable duotone.
if (!supportedStyles.includes('filter')) {
updatedSettings.color.defaultDuotone = false;
updatedSettings.color.customDuotone = false;
}
['lineHeight', 'fontStyle', 'fontWeight', 'letterSpacing', 'textTransform', 'textDecoration', 'writingMode'].forEach(key => {
if (!supportedStyles.includes(key)) {
updatedSettings.typography = {
...updatedSettings.typography,
[key]: false
};
}
});
// The column-count style is named text column to reduce confusion with
// the columns block and manage expectations from the support.
// See: https://github.com/WordPress/gutenberg/pull/33587
if (!supportedStyles.includes('columnCount')) {
updatedSettings.typography = {
...updatedSettings.typography,
textColumns: false
};
}
['contentSize', 'wideSize'].forEach(key => {
if (!supportedStyles.includes(key)) {
updatedSettings.layout = {
...updatedSettings.layout,
[key]: false
};
}
});
['padding', 'margin', 'blockGap'].forEach(key => {
if (!supportedStyles.includes(key)) {
updatedSettings.spacing = {
...updatedSettings.spacing,
[key]: false
};
}
const sides = Array.isArray(supports?.spacing?.[key]) ? supports?.spacing?.[key] : supports?.spacing?.[key]?.sides;
// Check if spacing type is supported before adding sides.
if (sides?.length && updatedSettings.spacing?.[key]) {
updatedSettings.spacing = {
...updatedSettings.spacing,
[key]: {
...updatedSettings.spacing?.[key],
sides
}
};
}
});
['aspectRatio', 'minHeight'].forEach(key => {
if (!supportedStyles.includes(key)) {
updatedSettings.dimensions = {
...updatedSettings.dimensions,
[key]: false
};
}
});
['radius', 'color', 'style', 'width'].forEach(key => {
if (!supportedStyles.includes('border' + key.charAt(0).toUpperCase() + key.slice(1))) {
updatedSettings.border = {
...updatedSettings.border,
[key]: false
};
}
});
updatedSettings.shadow = supportedStyles.includes('shadow') ? updatedSettings.shadow : false;
return updatedSettings;
}, [parentSettings, supportedStyles, supports]);
}
function useColorsPerOrigin(settings) {
const customColors = settings?.color?.palette?.custom;
const themeColors = settings?.color?.palette?.theme;
const defaultColors = settings?.color?.palette?.default;
const shouldDisplayDefaultColors = settings?.color?.defaultPalette;
return (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 is created by the user.'),
colors: customColors
});
}
return result;
}, [customColors, themeColors, defaultColors, shouldDisplayDefaultColors]);
}
function useGradientsPerOrigin(settings) {
const customGradients = settings?.color?.gradients?.custom;
const themeGradients = settings?.color?.gradients?.theme;
const defaultGradients = settings?.color?.gradients?.default;
const shouldDisplayDefaultGradients = settings?.color?.defaultGradients;
return (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, shouldDisplayDefaultGradients]);
}
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__(5755);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* External dependencies
*/
/**
* Removed falsy values from nested object.
*
* @param {*} object
* @return {*} Object cleaned from falsy values
*/
const utils_cleanEmptyObject = object => {
if (object === null || typeof object !== 'object' || Array.isArray(object)) {
return object;
}
const cleanedNestedObjects = Object.entries(object).map(([key, value]) => [key, utils_cleanEmptyObject(value)]).filter(([, value]) => value !== undefined);
return !cleanedNestedObjects.length ? undefined : Object.fromEntries(cleanedNestedObjects);
};
function transformStyles(activeSupports, migrationPaths, result, source, index, results) {
// If there are no active supports return early.
if (Object.values(activeSupports !== null && activeSupports !== void 0 ? activeSupports : {}).every(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[0]?.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]) {
referenceBlockAttributes = source[index]?.attributes;
} else {
return result;
}
}
let returnBlock = result;
Object.entries(activeSupports).forEach(([support, isActive]) => {
if (isActive) {
migrationPaths[support].forEach(path => {
const styleValue = getValueFromObjectPath(referenceBlockAttributes, path);
if (styleValue) {
returnBlock = {
...returnBlock,
attributes: setImmutably(returnBlock.attributes, path, styleValue)
};
}
});
}
});
return returnBlock;
}
/**
* Check whether serialization of specific block support feature or set should
* be skipped.
*
* @param {string|Object} blockNameOrType 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(blockNameOrType, featureSet, feature) {
const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, featureSet);
const skipSerialization = support?.__experimentalSkipSerialization;
if (Array.isArray(skipSerialization)) {
return skipSerialization.includes(feature);
}
return skipSerialization;
}
function useStyleOverride({
id,
css,
assets,
__unstableType
} = {}) {
const {
setStyleOverride,
deleteStyleOverride
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
const fallbackId = (0,external_wp_element_namespaceObject.useId)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Unmount if there is CSS and assets are empty.
if (!css && !assets) return;
const _id = id || fallbackId;
setStyleOverride(_id, {
id,
css,
assets,
__unstableType
});
return () => {
deleteStyleOverride(_id);
};
}, [id, css, assets, __unstableType, fallbackId, setStyleOverride, deleteStyleOverride]);
}
/**
* Based on the block and its context, returns an object of all the block settings.
* This object can be passed as a prop to all the Styles UI components
* (TypographyPanel, DimensionsPanel...).
*
* @param {string} name Block name.
* @param {*} parentLayout Parent layout.
*
* @return {Object} Settings object.
*/
function useBlockSettings(name, parentLayout) {
const [backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, writingMode, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, aspectRatio, minHeight, layout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow] = use_settings_useSettings('background.backgroundImage', 'background.backgroundSize', 'typography.fontFamilies.custom', 'typography.fontFamilies.default', 'typography.fontFamilies.theme', 'typography.fontSizes.custom', 'typography.fontSizes.default', 'typography.fontSizes.theme', 'typography.customFontSize', 'typography.fontStyle', 'typography.fontWeight', 'typography.lineHeight', 'typography.textColumns', 'typography.textDecoration', 'typography.writingMode', 'typography.textTransform', 'typography.letterSpacing', 'spacing.padding', 'spacing.margin', 'spacing.blockGap', 'spacing.spacingSizes', 'spacing.units', 'dimensions.aspectRatio', 'dimensions.minHeight', 'layout', 'border.color', 'border.radius', 'border.style', 'border.width', 'color.custom', 'color.palette.custom', 'color.customDuotone', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.defaultDuotone', 'color.duotone.custom', 'color.duotone.theme', 'color.duotone.default', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients', 'color.customGradient', 'color.background', 'color.link', 'color.text', 'color.heading', 'color.button', 'shadow');
const rawSettings = (0,external_wp_element_namespaceObject.useMemo)(() => {
return {
background: {
backgroundImage,
backgroundSize
},
color: {
palette: {
custom: customColors,
theme: themeColors,
default: defaultColors
},
gradients: {
custom: userGradientPalette,
theme: themeGradientPalette,
default: defaultGradientPalette
},
duotone: {
custom: userDuotonePalette,
theme: themeDuotonePalette,
default: defaultDuotonePalette
},
defaultGradients,
defaultPalette,
defaultDuotone,
custom: customColorsEnabled,
customGradient: areCustomGradientsEnabled,
customDuotone,
background: isBackgroundEnabled,
link: isLinkEnabled,
heading: isHeadingEnabled,
button: isButtonEnabled,
text: isTextEnabled
},
typography: {
fontFamilies: {
custom: customFontFamilies,
default: defaultFontFamilies,
theme: themeFontFamilies
},
fontSizes: {
custom: customFontSizes,
default: defaultFontSizes,
theme: themeFontSizes
},
customFontSize,
fontStyle,
fontWeight,
lineHeight,
textColumns,
textDecoration,
textTransform,
letterSpacing,
writingMode
},
spacing: {
spacingSizes: {
custom: spacingSizes
},
padding,
margin,
blockGap,
units
},
border: {
color: borderColor,
radius: borderRadius,
style: borderStyle,
width: borderWidth
},
dimensions: {
aspectRatio,
minHeight
},
layout,
parentLayout,
shadow
};
}, [backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, textTransform, letterSpacing, writingMode, padding, margin, blockGap, spacingSizes, units, aspectRatio, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow]);
return useSettingsForBlockElement(rawSettings, name);
}
function createBlockEditFilter(features) {
// We don't want block controls to re-render when typing inside a block.
// `memo` will prevent re-renders unless props change, so only pass the
// needed props and not the whole attributes object.
features = features.map(settings => {
return {
...settings,
Edit: (0,external_wp_element_namespaceObject.memo)(settings.edit)
};
});
const withBlockEditHooks = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalBlockEdit => props => {
const context = useBlockEditContext();
// CAUTION: code added before this line will be executed for all
// blocks, not just those that support the feature! Code added
// above this line should be carefully evaluated for its impact on
// performance.
return [...features.map((feature, i) => {
const {
Edit,
hasSupport,
attributeKeys = [],
shareWithChildBlocks
} = feature;
const shouldDisplayControls = context[mayDisplayControlsKey] || context[mayDisplayParentControlsKey] && shareWithChildBlocks;
if (!shouldDisplayControls || !hasSupport(props.name)) {
return null;
}
const neededProps = {};
for (const key of attributeKeys) {
if (props.attributes[key]) {
neededProps[key] = props.attributes[key];
}
}
return (0,external_React_.createElement)(Edit
// We can use the index because the array length
// is fixed per page load right now.
, {
key: i,
name: props.name,
isSelected: props.isSelected,
clientId: props.clientId,
setAttributes: props.setAttributes,
__unstableParentLayout: props.__unstableParentLayout
// This component is pure, so only pass needed
// props!!!
,
...neededProps
});
}), (0,external_React_.createElement)(OriginalBlockEdit, {
key: "edit",
...props
})];
}, 'withBlockEditHooks');
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/editor/hooks', withBlockEditHooks);
}
function BlockProps({
index,
useBlockProps,
setAllWrapperProps,
...props
}) {
const wrapperProps = useBlockProps(props);
const setWrapperProps = next => setAllWrapperProps(prev => {
const nextAll = [...prev];
nextAll[index] = next;
return nextAll;
});
// Setting state after every render is fine because this component is
// pure and will only re-render when needed props change.
(0,external_wp_element_namespaceObject.useEffect)(() => {
// We could shallow compare the props, but since this component only
// changes when needed attributes change, the benefit is probably small.
setWrapperProps(wrapperProps);
return () => {
setWrapperProps(undefined);
};
});
return null;
}
const BlockPropsPure = (0,external_wp_element_namespaceObject.memo)(BlockProps);
function createBlockListBlockFilter(features) {
const withBlockListBlockHooks = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => {
const [allWrapperProps, setAllWrapperProps] = (0,external_wp_element_namespaceObject.useState)(Array(features.length).fill(undefined));
return [...features.map((feature, i) => {
const {
hasSupport,
attributeKeys = [],
useBlockProps
} = feature;
const neededProps = {};
for (const key of attributeKeys) {
if (props.attributes[key]) {
neededProps[key] = props.attributes[key];
}
}
if (
// Skip rendering if none of the needed attributes are
// set.
!Object.keys(neededProps).length || !hasSupport(props.name)) {
return null;
}
return (0,external_React_.createElement)(BlockPropsPure
// We can use the index because the array length
// is fixed per page load right now.
, {
key: i,
index: i,
useBlockProps: useBlockProps
// This component is pure, so we must pass a stable
// function reference.
,
setAllWrapperProps: setAllWrapperProps,
name: props.name
// This component is pure, so only pass needed
// props!!!
,
...neededProps
});
}), (0,external_React_.createElement)(BlockListBlock, {
key: "edit",
...props,
wrapperProps: allWrapperProps.filter(Boolean).reduce((acc, wrapperProps) => {
return {
...acc,
...wrapperProps,
className: classnames_default()(acc.className, wrapperProps.className),
style: {
...acc.style,
...wrapperProps.style
}
};
}, props.wrapperProps || {})
})];
}, 'withBlockListBlockHooks');
(0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/editor/hooks', withBlockListBlockHooks);
}
function createBlockSaveFilter(features) {
function extraPropsFromHooks(props, name, attributes) {
return features.reduce((accu, feature) => {
const {
hasSupport,
attributeKeys = [],
addSaveProps
} = feature;
const neededAttributes = {};
for (const key of attributeKeys) {
if (attributes[key]) {
neededAttributes[key] = attributes[key];
}
}
if (
// Skip rendering if none of the needed attributes are
// set.
!Object.keys(neededAttributes).length || !hasSupport(name)) {
return accu;
}
return addSaveProps(accu, name, neededAttributes);
}, props);
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/editor/hooks', extraPropsFromHooks, 0);
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/editor/hooks', props => {
// Previously we had a filter deleting the className if it was an empty
// string. That filter is no longer running, so now we need to delete it
// here.
if (props.hasOwnProperty('className') && !props.className) {
delete props.className;
}
return props;
});
}
;// 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: external ["wp","components"]
const external_wp_components_namespaceObject = window["wp"]["components"];
;// 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 */ const block_controls_groups = (groups);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useBlockControlsFill(group, shareWithChildBlocks) {
const context = useBlockEditContext();
if (context[mayDisplayControlsKey]) {
return block_controls_groups[group]?.Fill;
}
if (context[mayDisplayParentControlsKey] && shareWithChildBlocks) {
return block_controls_groups.parent.Fill;
}
return null;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/fill.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockControlsFill({
group = 'default',
controls,
children,
__experimentalShareWithChildBlocks = false
}) {
const Fill = useBlockControlsFill(group, __experimentalShareWithChildBlocks);
if (!Fill) {
return null;
}
const innerMarkup = (0,external_React_.createElement)(external_React_.Fragment, null, group === 'default' && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, {
controls: controls
}), children);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, {
document: document
}, (0,external_React_.createElement)(Fill, null, fillProps => {
// `fillProps.forwardedContext` is an array of context provider entries, provided by slot,
// that should wrap the fill markup.
const {
forwardedContext = []
} = fillProps;
return forwardedContext.reduce((inner, [Provider, props]) => (0,external_React_.createElement)(Provider, {
...props
}, inner), innerMarkup);
}));
}
;// CONCATENATED MODULE: external ["wp","warning"]
const external_wp_warning_namespaceObject = window["wp"]["warning"];
var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/slot.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
ComponentsContext
} = unlock(external_wp_components_namespaceObject.privateApis);
function BlockControlsSlot({
group = 'default',
...props
}) {
const toolbarState = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolbarContext);
const contextState = (0,external_wp_element_namespaceObject.useContext)(ComponentsContext);
const fillProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
forwardedContext: [[external_wp_components_namespaceObject.__experimentalToolbarContext.Provider, {
value: toolbarState
}], [ComponentsContext.Provider, {
value: contextState
}]]
}), [toolbarState, contextState]);
const Slot = block_controls_groups[group]?.Slot;
const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(Slot?.__unstableName);
if (!Slot) {
true ? external_wp_warning_default()(`Unknown BlockControls group "${group}" provided.`) : 0;
return null;
}
if (!fills?.length) {
return null;
}
const slot = (0,external_React_.createElement)(Slot, {
...props,
bubblesVirtually: true,
fillProps: fillProps
});
if (group === 'default') {
return slot;
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, slot);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/index.js
/**
* Internal dependencies
*/
const BlockControls = BlockControlsFill;
BlockControls.Slot = BlockControlsSlot;
// This is just here for backward compatibility.
const BlockFormatControls = props => {
return (0,external_React_.createElement)(BlockControlsFill, {
group: "inline",
...props
});
};
BlockFormatControls.Slot = props => {
return (0,external_React_.createElement)(BlockControlsSlot, {
group: "inline",
...props
});
};
/* harmony default export */ const block_controls = (BlockControls);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-left.js
/**
* WordPress dependencies
*/
const justifyLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M9 9v6h11V9H9zM4 20h1.5V4H4v16z"
}));
/* harmony default export */ const justify_left = (justifyLeft);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-center.js
/**
* WordPress dependencies
*/
const justifyCenter = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12.5 15v5H11v-5H4V9h7V4h1.5v5h7v6h-7Z"
}));
/* harmony default export */ const justify_center = (justifyCenter);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-right.js
/**
* WordPress dependencies
*/
const justifyRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z"
}));
/* harmony default export */ const justify_right = (justifyRight);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-space-between.js
/**
* WordPress dependencies
*/
const justifySpaceBetween = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z"
}));
/* harmony default export */ const justify_space_between = (justifySpaceBetween);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/justify-stretch.js
/**
* WordPress dependencies
*/
const justifyStretch = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 4H5.5V20H4V4ZM7 10L17 10V14L7 14V10ZM20 4H18.5V20H20V4Z"
}));
/* harmony default export */ const justify_stretch = (justifyStretch);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-right.js
/**
* WordPress dependencies
*/
const arrowRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"
}));
/* harmony default export */ const arrow_right = (arrowRight);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-down.js
/**
* WordPress dependencies
*/
const arrowDown = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"
}));
/* harmony default export */ const arrow_down = (arrowDown);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/definitions.js
// Layout definitions keyed by layout type.
// Provides a common definition of slugs, classnames, base styles, and spacing styles for each layout type.
// If making changes or additions to layout definitions, be sure to update the corresponding PHP definitions in
// `block-supports/layout.php` so that the server-side and client-side definitions match.
const LAYOUT_DEFINITIONS = {
default: {
name: 'default',
slug: 'flow',
className: 'is-layout-flow',
baseStyles: [{
selector: ' > .alignleft',
rules: {
float: 'left',
'margin-inline-start': '0',
'margin-inline-end': '2em'
}
}, {
selector: ' > .alignright',
rules: {
float: 'right',
'margin-inline-start': '2em',
'margin-inline-end': '0'
}
}, {
selector: ' > .aligncenter',
rules: {
'margin-left': 'auto !important',
'margin-right': 'auto !important'
}
}],
spacingStyles: [{
selector: ' > :first-child:first-child',
rules: {
'margin-block-start': '0'
}
}, {
selector: ' > :last-child:last-child',
rules: {
'margin-block-end': '0'
}
}, {
selector: ' > *',
rules: {
'margin-block-start': null,
'margin-block-end': '0'
}
}]
},
constrained: {
name: 'constrained',
slug: 'constrained',
className: 'is-layout-constrained',
baseStyles: [{
selector: ' > .alignleft',
rules: {
float: 'left',
'margin-inline-start': '0',
'margin-inline-end': '2em'
}
}, {
selector: ' > .alignright',
rules: {
float: 'right',
'margin-inline-start': '2em',
'margin-inline-end': '0'
}
}, {
selector: ' > .aligncenter',
rules: {
'margin-left': 'auto !important',
'margin-right': 'auto !important'
}
}, {
selector: ' > :where(:not(.alignleft):not(.alignright):not(.alignfull))',
rules: {
'max-width': 'var(--wp--style--global--content-size)',
'margin-left': 'auto !important',
'margin-right': 'auto !important'
}
}, {
selector: ' > .alignwide',
rules: {
'max-width': 'var(--wp--style--global--wide-size)'
}
}],
spacingStyles: [{
selector: ' > :first-child:first-child',
rules: {
'margin-block-start': '0'
}
}, {
selector: ' > :last-child:last-child',
rules: {
'margin-block-end': '0'
}
}, {
selector: ' > *',
rules: {
'margin-block-start': null,
'margin-block-end': '0'
}
}]
},
flex: {
name: 'flex',
slug: 'flex',
className: 'is-layout-flex',
displayMode: 'flex',
baseStyles: [{
selector: '',
rules: {
'flex-wrap': 'wrap',
'align-items': 'center'
}
}, {
selector: ' > *',
rules: {
margin: '0'
}
}],
spacingStyles: [{
selector: '',
rules: {
gap: null
}
}]
},
grid: {
name: 'grid',
slug: 'grid',
className: 'is-layout-grid',
displayMode: 'grid',
baseStyles: [{
selector: ' > *',
rules: {
margin: '0'
}
}],
spacingStyles: [{
selector: '',
rules: {
gap: null
}
}]
}
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Utility to generate the proper CSS selector for layout styles.
*
* @param {string} selectors CSS selector, also supports multiple comma-separated selectors.
* @param {string} append The string to append.
*
* @return {string} - CSS selector.
*/
function appendSelectors(selectors, append = '') {
// 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
// so we need this to be higher speficity otherwise, it won't be applied to paragraphs inside containers
// When the post editor is fully iframed, this extra classname could be removed.
return selectors.split(',').map(subselector => `.editor-styles-wrapper ${subselector}${append ? ` ${append}` : ''}`).join(',');
}
/**
* Get generated blockGap CSS rules based on layout definitions provided in theme.json
* Falsy values in the layout definition's spacingStyles rules will be swapped out
* with the provided `blockGapValue`.
*
* @param {string} selector The CSS selector to target for the generated rules.
* @param {Object} layoutDefinitions Layout definitions object.
* @param {string} layoutType The layout type (e.g. `default` or `flex`).
* @param {string} blockGapValue The current blockGap value to be applied.
* @return {string} The generated CSS rules.
*/
function getBlockGapCSS(selector, layoutDefinitions = LAYOUT_DEFINITIONS, layoutType, blockGapValue) {
let output = '';
if (layoutDefinitions?.[layoutType]?.spacingStyles?.length && blockGapValue) {
layoutDefinitions[layoutType].spacingStyles.forEach(gapStyle => {
output += `${appendSelectors(selector, gapStyle.selector.trim())} { `;
output += Object.entries(gapStyle.rules).map(([cssProperty, value]) => `${cssProperty}: ${value ? value : blockGapValue}`).join('; ');
output += '; }';
});
}
return output;
}
/**
* 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,
type = 'default'
} = layout;
const alignmentInfo = {};
const sizeRegex = /^(?!0)\d+(px|em|rem|vw|vh|%|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)?$/i;
if (sizeRegex.test(contentSize) && type === 'constrained') {
// 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/icons/build-module/library/sides-all.js
/**
* WordPress dependencies
*/
const sidesAll = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z"
}));
/* harmony default export */ const sides_all = (sidesAll);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sides-horizontal.js
/**
* WordPress dependencies
*/
const sidesHorizontal = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",
style: {
opacity: 0.25
}
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m4.5 7.5v9h1.5v-9z"
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m18 7.5v9h1.5v-9z"
}));
/* harmony default export */ const sides_horizontal = (sidesHorizontal);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sides-vertical.js
/**
* WordPress dependencies
*/
const sidesVertical = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",
style: {
opacity: 0.25
}
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m7.5 6h9v-1.5h-9z"
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m7.5 19.5h9v-1.5h-9z"
}));
/* harmony default export */ const sides_vertical = (sidesVertical);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sides-top.js
/**
* WordPress dependencies
*/
const sidesTop = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",
style: {
opacity: 0.25
}
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m16.5 6h-9v-1.5h9z"
}));
/* harmony default export */ const sides_top = (sidesTop);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sides-right.js
/**
* WordPress dependencies
*/
const sidesRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",
style: {
opacity: 0.25
}
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m18 16.5v-9h1.5v9z"
}));
/* harmony default export */ const sides_right = (sidesRight);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sides-bottom.js
/**
* WordPress dependencies
*/
const sidesBottom = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",
style: {
opacity: 0.25
}
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m16.5 19.5h-9v-1.5h9z",
style: {
fill: '#1e1e1e'
}
}));
/* harmony default export */ const sides_bottom = (sidesBottom);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sides-left.js
/**
* WordPress dependencies
*/
const sidesLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",
style: {
opacity: 0.25
}
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m4.5 16.5v-9h1.5v9z"
}));
/* harmony default export */ const sides_left = (sidesLeft);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/utils.js
/**
* WordPress dependencies
*/
const ALL_SIDES = ['top', 'right', 'bottom', 'left'];
const DEFAULT_VALUES = {
top: undefined,
right: undefined,
bottom: undefined,
left: undefined
};
const ICONS = {
custom: sides_all,
axial: sides_all,
horizontal: sides_horizontal,
vertical: sides_vertical,
top: sides_top,
right: sides_right,
bottom: sides_bottom,
left: sides_left
};
const LABELS = {
default: (0,external_wp_i18n_namespaceObject.__)('Spacing control'),
top: (0,external_wp_i18n_namespaceObject.__)('Top'),
bottom: (0,external_wp_i18n_namespaceObject.__)('Bottom'),
left: (0,external_wp_i18n_namespaceObject.__)('Left'),
right: (0,external_wp_i18n_namespaceObject.__)('Right'),
mixed: (0,external_wp_i18n_namespaceObject.__)('Mixed'),
vertical: (0,external_wp_i18n_namespaceObject.__)('Vertical'),
horizontal: (0,external_wp_i18n_namespaceObject.__)('Horizontal'),
axial: (0,external_wp_i18n_namespaceObject.__)('Horizontal & vertical'),
custom: (0,external_wp_i18n_namespaceObject.__)('Custom')
};
const VIEWS = {
axial: 'axial',
top: 'top',
right: 'right',
bottom: 'bottom',
left: 'left',
custom: 'custom'
};
/**
* Checks is given value is a spacing preset.
*
* @param {string} value Value to check
*
* @return {boolean} Return true if value is string in format var:preset|spacing|.
*/
function isValueSpacingPreset(value) {
if (!value?.includes) {
return false;
}
return value === '0' || value.includes('var:preset|spacing|');
}
/**
* Converts a spacing preset into a custom value.
*
* @param {string} value Value to convert
* @param {Array} spacingSizes Array of the current spacing preset objects
*
* @return {string} Mapping of the spacing preset to its equivalent custom value.
*/
function getCustomValueFromPreset(value, spacingSizes) {
if (!isValueSpacingPreset(value)) {
return value;
}
const slug = getSpacingPresetSlug(value);
const spacingSize = spacingSizes.find(size => String(size.slug) === slug);
return spacingSize?.size;
}
/**
* Converts a custom value to preset value if one can be found.
*
* Returns value as-is if no match is found.
*
* @param {string} value Value to convert
* @param {Array} spacingSizes Array of the current spacing preset objects
*
* @return {string} The preset value if it can be found.
*/
function getPresetValueFromCustomValue(value, spacingSizes) {
// Return value as-is if it is undefined or is already a preset, or '0';
if (!value || isValueSpacingPreset(value) || value === '0') {
return value;
}
const spacingMatch = spacingSizes.find(size => String(size.size) === String(value));
if (spacingMatch?.slug) {
return `var:preset|spacing|${spacingMatch.slug}`;
}
return value;
}
/**
* Converts a spacing preset into a custom value.
*
* @param {string} value Value to convert.
*
* @return {string | undefined} CSS var string for given spacing preset value.
*/
function getSpacingPresetCssVar(value) {
if (!value) {
return;
}
const slug = value.match(/var:preset\|spacing\|(.+)/);
if (!slug) {
return value;
}
return `var(--wp--preset--spacing--${slug[1]})`;
}
/**
* Returns the slug section of the given spacing preset string.
*
* @param {string} value Value to extract slug from.
*
* @return {string|undefined} The int value of the slug from given spacing preset.
*/
function getSpacingPresetSlug(value) {
if (!value) {
return;
}
if (value === '0' || value === 'default') {
return value;
}
const slug = value.match(/var:preset\|spacing\|(.+)/);
return slug ? slug[1] : undefined;
}
/**
* Converts spacing preset value into a Range component value .
*
* @param {string} presetValue Value to convert to Range value.
* @param {Array} spacingSizes Array of current spacing preset value objects.
*
* @return {number} The int value for use in Range control.
*/
function getSliderValueFromPreset(presetValue, spacingSizes) {
if (presetValue === undefined) {
return 0;
}
const slug = parseFloat(presetValue, 10) === 0 ? '0' : getSpacingPresetSlug(presetValue);
const sliderValue = spacingSizes.findIndex(spacingSize => {
return String(spacingSize.slug) === slug;
});
// Returning NaN rather than undefined as undefined makes range control thumb sit in center
return sliderValue !== -1 ? sliderValue : NaN;
}
/**
* Gets an items with the most occurrence within an array
* https://stackoverflow.com/a/20762713
*
* @param {Array<any>} arr Array of items to check.
* @return {any} The item with the most occurrences.
*/
function mode(arr) {
return arr.sort((a, b) => arr.filter(v => v === a).length - arr.filter(v => v === b).length).pop();
}
/**
* Gets the 'all' input value from values data.
*
* @param {Object} values Box spacing values
*
* @return {string} The most common value from all sides of box.
*/
function getAllRawValue(values = {}) {
return mode(Object.values(values));
}
/**
* Checks to determine if values are mixed.
*
* @param {Object} values Box values.
* @param {Array} sides Sides that values relate to.
*
* @return {boolean} Whether values are mixed.
*/
function isValuesMixed(values = {}, sides = ALL_SIDES) {
return Object.values(values).length >= 1 && Object.values(values).length < sides.length || new Set(Object.values(values)).size > 1;
}
/**
* Checks to determine if values are defined.
*
* @param {Object} values Box values.
*
* @return {boolean} Whether values are defined.
*/
function isValuesDefined(values) {
if (values === undefined || values === null) {
return false;
}
return Object.values(values).filter(value => !!value).length > 0;
}
/**
* Determines whether a particular axis has support. If no axis is
* specified, this function checks if either axis is supported.
*
* @param {Array} sides Supported sides.
* @param {string} axis Which axis to check.
*
* @return {boolean} Whether there is support for the specified axis or both axes.
*/
function hasAxisSupport(sides, axis) {
if (!sides || !sides.length) {
return false;
}
const hasHorizontalSupport = sides.includes('horizontal') || sides.includes('left') && sides.includes('right');
const hasVerticalSupport = sides.includes('vertical') || sides.includes('top') && sides.includes('bottom');
if (axis === 'horizontal') {
return hasHorizontalSupport;
}
if (axis === 'vertical') {
return hasVerticalSupport;
}
return hasHorizontalSupport || hasVerticalSupport;
}
/**
* Determines which menu options should be included in the SidePicker.
*
* @param {Array} sides Supported sides.
*
* @return {Object} Menu options with each option containing label & icon.
*/
function getSupportedMenuItems(sides) {
if (!sides || !sides.length) {
return {};
}
const menuItems = {};
// Determine the primary "side" menu options.
const hasHorizontalSupport = hasAxisSupport(sides, 'horizontal');
const hasVerticalSupport = hasAxisSupport(sides, 'vertical');
if (hasHorizontalSupport && hasVerticalSupport) {
menuItems.axial = {
label: LABELS.axial,
icon: ICONS.axial
};
} else if (hasHorizontalSupport) {
menuItems.axial = {
label: LABELS.horizontal,
icon: ICONS.horizontal
};
} else if (hasVerticalSupport) {
menuItems.axial = {
label: LABELS.vertical,
icon: ICONS.vertical
};
}
// Track whether we have any individual sides so we can omit the custom
// option if required.
let numberOfIndividualSides = 0;
ALL_SIDES.forEach(side => {
if (sides.includes(side)) {
numberOfIndividualSides += 1;
menuItems[side] = {
label: LABELS[side],
icon: ICONS[side]
};
}
});
// Add custom item if there are enough sides to warrant a separated view.
if (numberOfIndividualSides > 1) {
menuItems.custom = {
label: LABELS.custom,
icon: ICONS.custom
};
}
return menuItems;
}
/**
* Checks if the supported sides are balanced for each axis.
* - Horizontal - both left and right sides are supported.
* - Vertical - both top and bottom are supported.
*
* @param {Array} sides The supported sides which may be axes as well.
*
* @return {boolean} Whether or not the supported sides are balanced.
*/
function hasBalancedSidesSupport(sides = []) {
const counts = {
top: 0,
right: 0,
bottom: 0,
left: 0
};
sides.forEach(side => counts[side] += 1);
return (counts.top + counts.bottom) % 2 === 0 && (counts.left + counts.right) % 2 === 0;
}
/**
* Determines which view the SpacingSizesControl should default to on its
* first render; Axial, Custom, or Single side.
*
* @param {Object} values Current side values.
* @param {Array} sides Supported sides.
*
* @return {string} View to display.
*/
function getInitialView(values = {}, sides) {
const {
top,
right,
bottom,
left
} = values;
const sideValues = [top, right, bottom, left].filter(Boolean);
// Axial ( Horizontal & vertical ).
// - Has axial side support
// - Has axial side values which match
// - Has no values and the supported sides are balanced
const hasMatchingAxialValues = top === bottom && left === right && (!!top || !!left);
const hasNoValuesAndBalancedSides = !sideValues.length && hasBalancedSidesSupport(sides);
if (hasAxisSupport(sides) && (hasMatchingAxialValues || hasNoValuesAndBalancedSides)) {
return VIEWS.axial;
}
// Single side.
// - Ensure the side returned is the first side that has a value.
if (sideValues.length === 1) {
let side;
Object.entries(values).some(([key, value]) => {
side = key;
return value !== undefined;
});
return side;
}
// Only single side supported and no value defined.
if (sides?.length === 1 && !sideValues.length) {
return sides[0];
}
// Default to the Custom (separated sides) view.
return VIEWS.custom;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/gap.js
/**
* Internal dependencies
*/
/**
* 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?.top,
left: isValueString ? blockGapValue : 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, defaultValue = '0') {
const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue);
if (!blockGapBoxControlValue) {
return null;
}
const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue;
const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue;
return row === column ? row : `${row} ${column}`;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/icons.js
/**
* WordPress dependencies
*/
const alignBottom = (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, {
d: "M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z"
}));
const alignCenter = (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, {
d: "M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z"
}));
const alignTop = (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, {
d: "M9 20h6V9H9v11zM4 4v1.5h16V4H4z"
}));
const alignStretch = (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, {
d: "M4 4L20 4L20 5.5L4 5.5L4 4ZM10 7L14 7L14 17L10 17L10 7ZM20 18.5L4 18.5L4 20L20 20L20 18.5Z"
}));
const spaceBetween = (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, {
d: "M7 4H17V8L7 8V4ZM7 16L17 16V20L7 20V16ZM20 11.25H4V12.75H20V11.25Z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-vertical-alignment-control/ui.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const BLOCK_ALIGNMENTS_CONTROLS = {
top: {
icon: alignTop,
title: (0,external_wp_i18n_namespaceObject._x)('Align top', 'Block vertical alignment setting')
},
center: {
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')
},
stretch: {
icon: alignStretch,
title: (0,external_wp_i18n_namespaceObject._x)('Stretch to fill', 'Block vertical alignment setting')
},
'space-between': {
icon: spaceBetween,
title: (0,external_wp_i18n_namespaceObject._x)('Space between', 'Block vertical alignment setting')
}
};
const DEFAULT_CONTROLS = ['top', 'center', 'bottom'];
const DEFAULT_CONTROL = 'top';
function BlockVerticalAlignmentUI({
value,
onChange,
controls = DEFAULT_CONTROLS,
isCollapsed = true,
isToolbar
}) {
function applyOrUnset(align) {
return () => onChange(value === align ? undefined : align);
}
const activeAlignment = BLOCK_ALIGNMENTS_CONTROLS[value];
const defaultAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[DEFAULT_CONTROL];
const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu;
const extraProps = isToolbar ? {
isCollapsed
} : {};
return (0,external_React_.createElement)(UIComponent, {
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,
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 */ const 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_React_.createElement)(ui, {
...props,
isToolbar: false
});
};
const BlockVerticalAlignmentToolbar = props => {
return (0,external_React_.createElement)(ui, {
...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,
stretch: justify_stretch
};
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: (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')
}, {
name: 'stretch',
icon: justify_stretch,
title: (0,external_wp_i18n_namespaceObject.__)('Stretch items'),
isActive: 'stretch' === value,
onClick: () => handleClick('stretch')
}];
const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu;
const extraProps = isToolbar ? {
isCollapsed
} : {};
return (0,external_React_.createElement)(UIComponent, {
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 */ const 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_React_.createElement)(justify_content_control_ui, {
...props,
isToolbar: false
});
};
const JustifyToolbar = props => {
return (0,external_React_.createElement)(justify_content_control_ui, {
...props,
isToolbar: true
});
};
/**
* @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',
stretch: 'stretch'
};
const verticalAlignmentMap = {
top: 'flex-start',
center: 'center',
bottom: 'flex-end',
stretch: 'stretch',
'space-between': 'space-between'
};
const flexWrapOptions = ['wrap', 'nowrap'];
/* harmony default export */ const flex = ({
name: 'flex',
label: (0,external_wp_i18n_namespaceObject.__)('Flex'),
inspectorControls: function FlexLayoutInspectorControls({
layout = {},
onChange,
layoutBlockSupport = {}
}) {
const {
allowOrientation = true
} = layoutBlockSupport;
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(FlexLayoutJustifyContentControl, {
layout: layout,
onChange: onChange
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, allowOrientation && (0,external_React_.createElement)(OrientationControl, {
layout: layout,
onChange: onChange
}))), (0,external_React_.createElement)(FlexWrapControl, {
layout: layout,
onChange: onChange
}));
},
toolBarControls: function FlexLayoutToolbarControls({
layout = {},
onChange,
layoutBlockSupport
}) {
if (layoutBlockSupport?.allowSwitching) {
return null;
}
const {
allowVerticalAlignment = true
} = layoutBlockSupport;
return (0,external_React_.createElement)(block_controls, {
group: "block",
__experimentalShareWithChildBlocks: true
}, (0,external_React_.createElement)(FlexLayoutJustifyContentControl, {
layout: layout,
onChange: onChange,
isToolbar: true
}), allowVerticalAlignment && (0,external_React_.createElement)(FlexLayoutVerticalAlignmentControl, {
layout: layout,
onChange: onChange,
isToolbar: true
}));
},
getLayoutStyle: function getLayoutStyle({
selector,
layout,
style,
blockName,
hasBlockGapSupport,
layoutDefinitions = LAYOUT_DEFINITIONS
}) {
const {
orientation = 'horizontal'
} = layout;
// 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?.spacing?.blockGap && !shouldSkipSerialization(blockName, 'spacing', 'blockGap') ? getGapCSSValue(style?.spacing?.blockGap, '0.5em') : undefined;
const justifyContent = justifyContentMap[layout.justifyContent];
const flexWrap = flexWrapOptions.includes(layout.flexWrap) ? layout.flexWrap : 'wrap';
const verticalAlignment = verticalAlignmentMap[layout.verticalAlignment];
const alignItems = alignItemsMap[layout.justifyContent] || alignItemsMap.left;
let output = '';
const rules = [];
if (flexWrap && flexWrap !== 'wrap') {
rules.push(`flex-wrap: ${flexWrap}`);
}
if (orientation === 'horizontal') {
if (verticalAlignment) {
rules.push(`align-items: ${verticalAlignment}`);
}
if (justifyContent) {
rules.push(`justify-content: ${justifyContent}`);
}
} else {
if (verticalAlignment) {
rules.push(`justify-content: ${verticalAlignment}`);
}
rules.push('flex-direction: column');
rules.push(`align-items: ${alignItems}`);
}
if (rules.length) {
output = `${appendSelectors(selector)} {
${rules.join('; ')};
}`;
}
// Output blockGap styles based on rules contained in layout definitions in theme.json.
if (hasBlockGapSupport && blockGapValue) {
output += getBlockGapCSS(selector, layoutDefinitions, 'flex', blockGapValue);
}
return output;
},
getOrientation(layout) {
const {
orientation = 'horizontal'
} = layout;
return orientation;
},
getAlignments() {
return [];
}
});
function FlexLayoutVerticalAlignmentControl({
layout,
onChange,
isToolbar = false
}) {
const {
orientation = 'horizontal'
} = layout;
const defaultVerticalAlignment = orientation === 'horizontal' ? verticalAlignmentMap.center : verticalAlignmentMap.top;
const {
verticalAlignment = defaultVerticalAlignment
} = layout;
const onVerticalAlignmentChange = value => {
onChange({
...layout,
verticalAlignment: value
});
};
if (isToolbar) {
return (0,external_React_.createElement)(BlockVerticalAlignmentControl, {
onChange: onVerticalAlignmentChange,
value: verticalAlignment,
controls: orientation === 'horizontal' ? ['top', 'center', 'bottom', 'stretch'] : ['top', 'center', 'bottom', 'space-between']
});
}
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_React_.createElement)("fieldset", {
className: "block-editor-hooks__flex-layout-vertical-alignment-control"
}, (0,external_React_.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Vertical alignment')), (0,external_React_.createElement)("div", null, verticalAlignmentOptions.map((value, icon, label) => {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
key: value,
label: label,
icon: icon,
isPressed: verticalAlignment === value,
onClick: () => onVerticalAlignmentChange(value)
});
})));
}
const POPOVER_PROPS = {
placement: 'bottom-start'
};
function FlexLayoutJustifyContentControl({
layout,
onChange,
isToolbar = false
}) {
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');
} else {
allowedControls.push('stretch');
}
if (isToolbar) {
return (0,external_React_.createElement)(JustifyContentControl, {
allowedControls: allowedControls,
value: justifyContent,
onChange: onJustificationChange,
popoverProps: POPOVER_PROPS
});
}
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')
});
} else {
justificationOptions.push({
value: 'stretch',
icon: justify_stretch,
label: (0,external_wp_i18n_namespaceObject.__)('Stretch items')
});
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Justification'),
value: justifyContent,
onChange: onJustificationChange,
className: "block-editor-hooks__flex-layout-justification-controls"
}, justificationOptions.map(({
value,
icon,
label
}) => {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, {
key: value,
value: value,
icon: icon,
label: label
});
}));
}
function FlexWrapControl({
layout,
onChange
}) {
const {
flexWrap = 'wrap'
} = layout;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
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({
layout,
onChange
}) {
const {
orientation = 'horizontal',
verticalAlignment,
justifyContent
} = layout;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__nextHasNoMarginBottom: true,
className: "block-editor-hooks__flex-layout-orientation-controls",
label: (0,external_wp_i18n_namespaceObject.__)('Orientation'),
value: orientation,
onChange: value => {
// Make sure the vertical alignment and justification are compatible with the new orientation.
let newVerticalAlignment = verticalAlignment;
let newJustification = justifyContent;
if (value === 'horizontal') {
if (verticalAlignment === 'space-between') {
newVerticalAlignment = 'center';
}
if (justifyContent === 'stretch') {
newJustification = 'left';
}
} else {
if (verticalAlignment === 'stretch') {
newVerticalAlignment = 'top';
}
if (justifyContent === 'space-between') {
newJustification = 'left';
}
}
return onChange({
...layout,
orientation: value,
verticalAlignment: newVerticalAlignment,
justifyContent: newJustification
});
}
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, {
icon: arrow_right,
value: 'horizontal',
label: (0,external_wp_i18n_namespaceObject.__)('Horizontal')
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, {
icon: arrow_down,
value: 'vertical',
label: (0,external_wp_i18n_namespaceObject.__)('Vertical')
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/flow.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* harmony default export */ const flow = ({
name: 'default',
label: (0,external_wp_i18n_namespaceObject.__)('Flow'),
inspectorControls: function DefaultLayoutInspectorControls() {
return null;
},
toolBarControls: function DefaultLayoutToolbarControls() {
return null;
},
getLayoutStyle: function getLayoutStyle({
selector,
style,
blockName,
hasBlockGapSupport,
layoutDefinitions = LAYOUT_DEFINITIONS
}) {
const blockGapStyleValue = getGapCSSValue(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.
let blockGapValue = '';
if (!shouldSkipSerialization(blockName, 'spacing', 'blockGap')) {
// If an object is provided only use the 'top' value for this kind of gap.
if (blockGapStyleValue?.top) {
blockGapValue = getGapCSSValue(blockGapStyleValue?.top);
} else if (typeof blockGapStyleValue === 'string') {
blockGapValue = getGapCSSValue(blockGapStyleValue);
}
}
let output = '';
// Output blockGap styles based on rules contained in layout definitions in theme.json.
if (hasBlockGapSupport && blockGapValue) {
output += getBlockGapCSS(selector, layoutDefinitions, 'default', blockGapValue);
}
return output;
},
getOrientation() {
return 'vertical';
},
getAlignments(layout, isBlockBasedTheme) {
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 alignments = [{
name: 'left'
}, {
name: 'center'
}, {
name: 'right'
}];
// This is for backwards compatibility with hybrid themes.
if (!isBlockBasedTheme) {
const {
contentSize,
wideSize
} = layout;
if (contentSize) {
alignments.unshift({
name: 'full'
});
}
if (wideSize) {
alignments.unshift({
name: 'wide',
info: alignmentInfo.wide
});
}
}
alignments.unshift({
name: 'none',
info: alignmentInfo.none
});
return alignments;
}
});
;// 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
* @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element.
*
* @return {JSX.Element} Icon component
*/
function Icon({
icon,
size = 24,
...props
}, ref) {
return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
width: size,
height: size,
...props,
ref
});
}
/* harmony default export */ const build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon));
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-center.js
/**
* WordPress dependencies
*/
const positionCenter = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"
}));
/* harmony default export */ const position_center = (positionCenter);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stretch-wide.js
/**
* WordPress dependencies
*/
const stretchWide = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M16 5.5H8V4h8v1.5ZM16 20H8v-1.5h8V20ZM5 9h14v6H5V9Z"
}));
/* harmony default export */ const stretch_wide = (stretchWide);
;// CONCATENATED MODULE: external ["wp","styleEngine"]
const external_wp_styleEngine_namespaceObject = window["wp"]["styleEngine"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/constrained.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* harmony default export */ const constrained = ({
name: 'constrained',
label: (0,external_wp_i18n_namespaceObject.__)('Constrained'),
inspectorControls: function DefaultLayoutInspectorControls({
layout,
onChange,
layoutBlockSupport = {}
}) {
const {
wideSize,
contentSize,
justifyContent = 'center'
} = layout;
const {
allowJustification = true,
allowCustomContentAndWideSize = true
} = layoutBlockSupport;
const onJustificationChange = value => {
onChange({
...layout,
justifyContent: value
});
};
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')
}];
const [availableUnits] = use_settings_useSettings('spacing.units');
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: availableUnits || ['%', 'px', 'em', 'rem', 'vw']
});
return (0,external_React_.createElement)(external_React_.Fragment, null, allowCustomContentAndWideSize && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
className: "block-editor-hooks__layout-controls"
}, (0,external_React_.createElement)("div", {
className: "block-editor-hooks__layout-controls-unit"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
className: "block-editor-hooks__layout-controls-unit-input",
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_React_.createElement)(build_module_icon, {
icon: position_center
})), (0,external_React_.createElement)("div", {
className: "block-editor-hooks__layout-controls-unit"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
className: "block-editor-hooks__layout-controls-unit-input",
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_React_.createElement)(build_module_icon, {
icon: stretch_wide
}))), (0,external_React_.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.'))), allowJustification && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Justification'),
value: justifyContent,
onChange: onJustificationChange
}, justificationOptions.map(({
value,
icon,
label
}) => {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, {
key: value,
value: value,
icon: icon,
label: label
});
})));
},
toolBarControls: function DefaultLayoutToolbarControls() {
return null;
},
getLayoutStyle: function getLayoutStyle({
selector,
layout = {},
style,
blockName,
hasBlockGapSupport,
layoutDefinitions = LAYOUT_DEFINITIONS
}) {
const {
contentSize,
wideSize,
justifyContent
} = layout;
const blockGapStyleValue = getGapCSSValue(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.
let blockGapValue = '';
if (!shouldSkipSerialization(blockName, 'spacing', 'blockGap')) {
// If an object is provided only use the 'top' value for this kind of gap.
if (blockGapStyleValue?.top) {
blockGapValue = getGapCSSValue(blockGapStyleValue?.top);
} else if (typeof blockGapStyleValue === 'string') {
blockGapValue = getGapCSSValue(blockGapStyleValue);
}
}
const marginLeft = justifyContent === 'left' ? '0 !important' : 'auto !important';
const marginRight = justifyContent === 'right' ? '0 !important' : 'auto !important';
let output = !!contentSize || !!wideSize ? `
${appendSelectors(selector, '> :where(:not(.alignleft):not(.alignright):not(.alignfull))')} {
max-width: ${contentSize !== null && contentSize !== void 0 ? contentSize : wideSize};
margin-left: ${marginLeft};
margin-right: ${marginRight};
}
${appendSelectors(selector, '> .alignwide')} {
max-width: ${wideSize !== null && wideSize !== void 0 ? wideSize : contentSize};
}
${appendSelectors(selector, '> .alignfull')} {
max-width: none;
}
` : '';
if (justifyContent === 'left') {
output += `${appendSelectors(selector, '> :where(:not(.alignleft):not(.alignright):not(.alignfull))')}
{ margin-left: ${marginLeft}; }`;
} else if (justifyContent === 'right') {
output += `${appendSelectors(selector, '> :where(:not(.alignleft):not(.alignright):not(.alignfull))')}
{ margin-right: ${marginRight}; }`;
}
// If there is custom padding, add negative margins for alignfull blocks.
if (style?.spacing?.padding) {
// The style object might be storing a preset so we need to make sure we get a usable value.
const paddingValues = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(style);
paddingValues.forEach(rule => {
if (rule.key === 'paddingRight') {
output += `
${appendSelectors(selector, '> .alignfull')} {
margin-right: calc(${rule.value} * -1);
}
`;
} else if (rule.key === 'paddingLeft') {
output += `
${appendSelectors(selector, '> .alignfull')} {
margin-left: calc(${rule.value} * -1);
}
`;
}
});
}
// Output blockGap styles based on rules contained in layout definitions in theme.json.
if (hasBlockGapSupport && blockGapValue) {
output += getBlockGapCSS(selector, layoutDefinitions, 'constrained', blockGapValue);
}
return 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;
}
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/grid.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const RANGE_CONTROL_MAX_VALUES = {
px: 600,
'%': 100,
vw: 100,
vh: 100,
em: 38,
rem: 38,
svw: 100,
lvw: 100,
dvw: 100,
svh: 100,
lvh: 100,
dvh: 100,
vi: 100,
svi: 100,
lvi: 100,
dvi: 100,
vb: 100,
svb: 100,
lvb: 100,
dvb: 100,
vmin: 100,
svmin: 100,
lvmin: 100,
dvmin: 100,
vmax: 100,
svmax: 100,
lvmax: 100,
dvmax: 100
};
/* harmony default export */ const grid = ({
name: 'grid',
label: (0,external_wp_i18n_namespaceObject.__)('Grid'),
inspectorControls: function GridLayoutInspectorControls({
layout = {},
onChange
}) {
return layout?.columnCount ? (0,external_React_.createElement)(GridLayoutColumnsControl, {
layout: layout,
onChange: onChange
}) : (0,external_React_.createElement)(GridLayoutMinimumWidthControl, {
layout: layout,
onChange: onChange
});
},
toolBarControls: function DefaultLayoutToolbarControls() {
return null;
},
getLayoutStyle: function getLayoutStyle({
selector,
layout,
style,
blockName,
hasBlockGapSupport,
layoutDefinitions = LAYOUT_DEFINITIONS
}) {
const {
minimumColumnWidth = '12rem',
columnCount = null
} = layout;
// 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?.spacing?.blockGap && !shouldSkipSerialization(blockName, 'spacing', 'blockGap') ? getGapCSSValue(style?.spacing?.blockGap, '0.5em') : undefined;
let output = '';
const rules = [];
if (columnCount) {
rules.push(`grid-template-columns: repeat(${columnCount}, minmax(0, 1fr))`);
} else if (minimumColumnWidth) {
rules.push(`grid-template-columns: repeat(auto-fill, minmax(min(${minimumColumnWidth}, 100%), 1fr))`);
}
if (rules.length) {
// Reason to disable: the extra line breaks added by prettier mess with the unit tests.
// eslint-disable-next-line prettier/prettier
output = `${appendSelectors(selector)} { ${rules.join('; ')}; }`;
}
// Output blockGap styles based on rules contained in layout definitions in theme.json.
if (hasBlockGapSupport && blockGapValue) {
output += getBlockGapCSS(selector, layoutDefinitions, 'grid', blockGapValue);
}
return output;
},
getOrientation() {
return 'horizontal';
},
getAlignments() {
return [];
}
});
// Enables setting minimum width of grid items.
function GridLayoutMinimumWidthControl({
layout,
onChange
}) {
const {
minimumColumnWidth: value = '12rem'
} = layout;
const [quantity, unit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value);
const handleSliderChange = next => {
onChange({
...layout,
minimumColumnWidth: [next, unit].join('')
});
};
// Mostly copied from HeightControl.
const handleUnitChange = newUnit => {
// Attempt to smooth over differences between currentUnit and newUnit.
// This should slightly improve the experience of switching between unit types.
let newValue;
if (['em', 'rem'].includes(newUnit) && unit === 'px') {
// Convert pixel value to an approximate of the new unit, assuming a root size of 16px.
newValue = (quantity / 16).toFixed(2) + newUnit;
} else if (['em', 'rem'].includes(unit) && newUnit === 'px') {
// Convert to pixel value assuming a root size of 16px.
newValue = Math.round(quantity * 16) + newUnit;
} else if (['vh', 'vw', '%', 'svw', 'lvw', 'dvw', 'svh', 'lvh', 'dvh', 'vi', 'svi', 'lvi', 'dvi', 'vb', 'svb', 'lvb', 'dvb', 'vmin', 'svmin', 'lvmin', 'dvmin', 'vmax', 'svmax', 'lvmax', 'dvmax'].includes(newUnit) && quantity > 100) {
// When converting to `%` or viewport-relative units, cap the new value at 100.
newValue = 100 + newUnit;
}
onChange({
...layout,
minimumColumnWidth: newValue
});
};
return (0,external_React_.createElement)("fieldset", null, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
as: "legend"
}, (0,external_wp_i18n_namespaceObject.__)('Minimum column width')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
gap: 4
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
isBlock: true
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
size: '__unstable-large',
onChange: newValue => {
onChange({
...layout,
minimumColumnWidth: newValue
});
},
onUnitChange: handleUnitChange,
value: value,
min: 0
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
isBlock: true
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.RangeControl, {
onChange: handleSliderChange,
value: quantity,
min: 0,
max: RANGE_CONTROL_MAX_VALUES[unit] || 600,
withInputField: false
}))));
}
// Enables setting number of grid columns
function GridLayoutColumnsControl({
layout,
onChange
}) {
const {
columnCount = 3
} = layout;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.RangeControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Columns'),
value: columnCount,
onChange: value => onChange({
...layout,
columnCount: value
}),
min: 1,
max: 6
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/layouts/index.js
/**
* Internal dependencies
*/
const layoutTypes = [flow, flex, constrained, grid];
/**
* Retrieves a layout type by name.
*
* @param {string} name - The name of the layout type.
* @return {Object} Layout type.
*/
function getLayoutType(name = '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({
layout = {},
css,
...props
}) {
const layoutType = getLayoutType(layout.type);
const [blockGapSupport] = use_settings_useSettings('spacing.blockGap');
const hasBlockGapSupport = blockGapSupport !== null;
if (layoutType) {
if (css) {
return (0,external_React_.createElement)("style", null, css);
}
const layoutStyle = layoutType.getLayoutStyle?.({
hasBlockGapSupport,
layout,
...props
});
if (layoutStyle) {
return (0,external_React_.createElement)("style", null, layoutStyle);
}
}
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_EMPTY_ARRAY = [];
const use_available_alignments_DEFAULT_CONTROLS = ['none', 'left', 'center', 'right', 'wide', 'full'];
const WIDE_CONTROLS = ['wide', 'full'];
function useAvailableAlignments(controls = use_available_alignments_DEFAULT_CONTROLS) {
// Always add the `none` option if not exists.
if (!controls.includes('none')) {
controls = ['none', ...controls];
}
const isNoneOnly = controls.length === 1 && controls[0] === 'none';
const [wideControlsEnabled, themeSupportsLayout, isBlockBasedTheme] = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _settings$alignWide;
// If `isNoneOnly` is true, we'll be returning early because there is
// nothing to filter on an empty array. We won't need the info from
// the `useSelect` but we must call it anyway because Rules of Hooks.
// So the callback returns early to avoid block editor subscription.
if (isNoneOnly) {
return [false, false, false];
}
const settings = select(store).getSettings();
return [(_settings$alignWide = settings.alignWide) !== null && _settings$alignWide !== void 0 ? _settings$alignWide : false, settings.supportsLayout, settings.__unstableIsBlockBasedTheme];
}, [isNoneOnly]);
const layout = useLayout();
if (isNoneOnly) {
return use_available_alignments_EMPTY_ARRAY;
}
const layoutType = getLayoutType(layout?.type);
if (themeSupportsLayout) {
const layoutAlignments = layoutType.getAlignments(layout, isBlockBasedTheme);
const alignments = layoutAlignments.filter(alignment => controls.includes(alignment.name));
// 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 use_available_alignments_EMPTY_ARRAY;
}
return alignments;
}
// Starting here, it's the fallback for themes not supporting the layout config.
if (layoutType.name !== 'default' && layoutType.name !== 'constrained') {
return use_available_alignments_EMPTY_ARRAY;
}
const alignments = controls.filter(control => {
if (layout.alignments) {
return layout.alignments.includes(control);
}
if (!wideControlsEnabled && WIDE_CONTROLS.includes(control)) {
return false;
}
return use_available_alignments_DEFAULT_CONTROLS.includes(control);
}).map(name => ({
name
}));
// 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 use_available_alignments_EMPTY_ARRAY;
}
return alignments;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-none.js
/**
* WordPress dependencies
*/
const alignNone = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM5 9h14v6H5V9Z"
}));
/* harmony default export */ const align_none = (alignNone);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-left.js
/**
* WordPress dependencies
*/
const positionLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"
}));
/* harmony default export */ const position_left = (positionLeft);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-right.js
/**
* WordPress dependencies
*/
const positionRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"
}));
/* harmony default export */ const position_right = (positionRight);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stretch-full-width.js
/**
* WordPress dependencies
*/
const stretchFullWidth = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M5 4h14v11H5V4Zm11 16H8v-1.5h8V20Z"
}));
/* harmony default export */ const stretch_full_width = (stretchFullWidth);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/constants.js
/**
* WordPress dependencies
*/
const constants_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 constants_DEFAULT_CONTROL = 'none';
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-control/ui.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockAlignmentUI({
value,
onChange,
controls,
isToolbar,
isCollapsed = true
}) {
const enabledControls = useAvailableAlignments(controls);
const hasEnabledControls = !!enabledControls.length;
if (!hasEnabledControls) {
return null;
}
function onChangeAlignment(align) {
onChange([value, 'none'].includes(align) ? undefined : align);
}
const activeAlignmentControl = constants_BLOCK_ALIGNMENTS_CONTROLS[value];
const defaultAlignmentControl = constants_BLOCK_ALIGNMENTS_CONTROLS[constants_DEFAULT_CONTROL];
const UIComponent = isToolbar ? external_wp_components_namespaceObject.ToolbarGroup : external_wp_components_namespaceObject.ToolbarDropdownMenu;
const commonProps = {
icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon,
label: (0,external_wp_i18n_namespaceObject.__)('Align')
};
const extraProps = isToolbar ? {
isCollapsed,
controls: enabledControls.map(({
name: controlName
}) => {
return {
...constants_BLOCK_ALIGNMENTS_CONTROLS[controlName],
isActive: value === controlName || !value && controlName === 'none',
role: isCollapsed ? 'menuitemradio' : undefined,
onClick: () => onChangeAlignment(controlName)
};
})
} : {
toggleProps: {
describedBy: (0,external_wp_i18n_namespaceObject.__)('Change alignment')
},
children: ({
onClose
}) => {
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, {
className: "block-editor-block-alignment-control__menu-group"
}, enabledControls.map(({
name: controlName,
info
}) => {
const {
icon,
title
} = constants_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_React_.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_React_.createElement)(UIComponent, {
...commonProps,
...extraProps
});
}
/* harmony default export */ const 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_React_.createElement)(block_alignment_control_ui, {
...props,
isToolbar: false
});
};
const BlockAlignmentToolbar = props => {
return (0,external_React_.createElement)(block_alignment_control_ui, {
...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/components/block-editing-mode/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @typedef {'disabled'|'contentOnly'|'default'} BlockEditingMode
*/
/**
* Allows a block to restrict the user interface that is displayed for editing
* that block and its inner blocks.
*
* @example
* ```js
* function MyBlock( { attributes, setAttributes } ) {
* useBlockEditingMode( 'disabled' );
* return <div { ...useBlockProps() }></div>;
* }
* ```
*
* `mode` can be one of three options:
*
* - `'disabled'`: Prevents editing the block entirely, i.e. it cannot be
* selected.
* - `'contentOnly'`: Hides all non-content UI, e.g. auxiliary controls in the
* toolbar, the block movers, block settings.
* - `'default'`: Allows editing the block as normal.
*
* The mode is inherited by all of the block's inner blocks, unless they have
* their own mode.
*
* If called outside of a block context, the mode is applied to all blocks.
*
* @param {?BlockEditingMode} mode The editing mode to apply. If undefined, the
* current editing mode is not changed.
*
* @return {BlockEditingMode} The current editing mode.
*/
function useBlockEditingMode(mode) {
const context = useBlockEditContext();
const {
clientId = ''
} = context;
const {
setBlockEditingMode,
unsetBlockEditingMode
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const globalBlockEditingMode = (0,external_wp_data_namespaceObject.useSelect)(select =>
// Avoid adding the subscription if not needed!
clientId ? null : select(store).getBlockEditingMode(), [clientId]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (mode) {
setBlockEditingMode(clientId, mode);
}
return () => {
if (mode) {
unsetBlockEditingMode(clientId);
}
};
}, [clientId, mode, setBlockEditingMode, unsetBlockEditingMode]);
return clientId ? context[blockEditingModeKey] : globalBlockEditingMode;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/align.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* An array which includes all possible valid alignments,
* used to validate if an alignment is valid or not.
*
* @constant
* @type {string[]}
*/
const ALL_ALIGNMENTS = ['left', 'center', 'right', 'wide', 'full'];
/**
* An array which includes all wide alignments.
* In order for this alignments to be valid they need to be supported by the block,
* and by the theme.
*
* @constant
* @type {string[]}
*/
const WIDE_ALIGNMENTS = ['wide', 'full'];
/**
* Returns the valid alignments.
* Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not.
* Exported just for testing purposes, not exported outside the module.
*
* @param {?boolean|string[]} blockAlign Aligns supported by the block.
* @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise.
* @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise.
*
* @return {string[]} Valid alignments.
*/
function getValidAlignments(blockAlign, hasWideBlockSupport = true, hasWideEnabled = 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];
} else {
validAlignments = [];
}
if (!hasWideEnabled || blockAlign === true && !hasWideBlockSupport) {
return validAlignments.filter(alignment => !WIDE_ALIGNMENTS.includes(alignment));
}
return validAlignments;
}
/**
* Filters registered block settings, extending attributes to include `align`.
*
* @param {Object} settings Original block settings.
*
* @return {Object} Filtered block settings.
*/
function addAttribute(settings) {
var _settings$attributes$;
// Allow blocks to specify their own attribute definition with default values if needed.
if ('type' in ((_settings$attributes$ = settings.attributes?.align) !== null && _settings$attributes$ !== void 0 ? _settings$attributes$ : {})) {
return settings;
}
if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'align')) {
// Gracefully handle if settings.attributes is undefined.
settings.attributes = {
...settings.attributes,
align: {
type: 'string',
// Allow for '' since it is used by the `updateAlignment` function
// in toolbar controls for special cases with defined default values.
enum: [...ALL_ALIGNMENTS, '']
}
};
}
return settings;
}
function BlockEditAlignmentToolbarControlsPure({
name: blockName,
align,
setAttributes
}) {
// Compute the block valid alignments by taking into account,
// if the theme supports wide alignments or not and the layout's
// available 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(({
name
}) => name);
const blockEditingMode = useBlockEditingMode();
if (!validAlignments.length || blockEditingMode !== 'default') {
return null;
}
const updateAlignment = nextAlign => {
if (!nextAlign) {
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
const blockDefaultAlign = blockType?.attributes?.align?.default;
if (blockDefaultAlign) {
nextAlign = '';
}
}
setAttributes({
align: nextAlign
});
};
return (0,external_React_.createElement)(block_controls, {
group: "block",
__experimentalShareWithChildBlocks: true
}, (0,external_React_.createElement)(BlockAlignmentControl, {
value: align,
onChange: updateAlignment,
controls: validAlignments
}));
}
/* harmony default export */ const align = ({
shareWithChildBlocks: true,
edit: BlockEditAlignmentToolbarControlsPure,
useBlockProps,
addSaveProps: addAssignedAlign,
attributeKeys: ['align'],
hasSupport(name) {
return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'align', false);
}
});
function useBlockProps({
name,
align
}) {
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 (validAlignments.some(alignment => alignment.name === align)) {
return {
'data-align': align
};
}
return {};
}
/**
* Override props assigned to save component to inject alignment class name if
* block supports it.
*
* @param {Object} props Additional props applied to save element.
* @param {Object} blockType Block type.
* @param {Object} attributes Block attributes.
*
* @return {Object} Filtered props applied to save element.
*/
function addAssignedAlign(props, blockType, attributes) {
const {
align
} = attributes;
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.
const isAlignValid = getValidAlignments(blockAlign, hasWideBlockSupport).includes(align);
if (isAlignValid) {
props.className = classnames_default()(`align${align}`, props.className);
}
return props;
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/align/addAttribute', addAttribute);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/lock.js
/**
* 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) {
var _settings$attributes$;
// Allow blocks to specify their own attribute definition with default values if needed.
if ('type' in ((_settings$attributes$ = settings.attributes?.lock) !== null && _settings$attributes$ !== void 0 ? _settings$attributes$ : {})) {
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/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 InspectorControlsBackground = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsBackground');
const InspectorControlsBorder = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsBorder');
const InspectorControlsColor = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsColor');
const InspectorControlsFilter = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsFilter');
const InspectorControlsDimensions = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsDimensions');
const InspectorControlsPosition = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsPosition');
const InspectorControlsTypography = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsTypography');
const InspectorControlsListView = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsListView');
const InspectorControlsStyles = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsStyles');
const InspectorControlsEffects = (0,external_wp_components_namespaceObject.createSlotFill)('InspectorControlsEffects');
const groups_groups = {
default: InspectorControlsDefault,
advanced: InspectorControlsAdvanced,
background: InspectorControlsBackground,
border: InspectorControlsBorder,
color: InspectorControlsColor,
dimensions: InspectorControlsDimensions,
effects: InspectorControlsEffects,
filter: InspectorControlsFilter,
list: InspectorControlsListView,
position: InspectorControlsPosition,
settings: InspectorControlsDefault,
// Alias for default.
styles: InspectorControlsStyles,
typography: InspectorControlsTypography
};
/* harmony default export */ const inspector_controls_groups = (groups_groups);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/fill.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function InspectorControlsFill({
children,
group = 'default',
__experimentalGroup,
resetAllFilter
}) {
if (__experimentalGroup) {
external_wp_deprecated_default()('`__experimentalGroup` property in `InspectorControlsFill`', {
since: '6.2',
version: '6.4',
alternative: '`group`'
});
group = __experimentalGroup;
}
const context = useBlockEditContext();
const Fill = inspector_controls_groups[group]?.Fill;
if (!Fill) {
true ? external_wp_warning_default()(`Unknown InspectorControls group "${group}" provided.`) : 0;
return null;
}
if (!context[mayDisplayControlsKey]) {
return null;
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, {
document: document
}, (0,external_React_.createElement)(Fill, null, fillProps => {
return (0,external_React_.createElement)(ToolsPanelInspectorControl, {
fillProps: fillProps,
children: children,
resetAllFilter: resetAllFilter
});
}));
}
function RegisterResetAll({
resetAllFilter,
children
}) {
const {
registerResetAllFilter,
deregisterResetAllFilter
} = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolsPanelContext);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (resetAllFilter && registerResetAllFilter && deregisterResetAllFilter) {
registerResetAllFilter(resetAllFilter);
return () => {
deregisterResetAllFilter(resetAllFilter);
};
}
}, [resetAllFilter, registerResetAllFilter, deregisterResetAllFilter]);
return children;
}
function ToolsPanelInspectorControl({
children,
resetAllFilter,
fillProps
}) {
// `fillProps.forwardedContext` is an array of context provider entries, provided by slot,
// that should wrap the fill markup.
const {
forwardedContext = []
} = 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 innerMarkup = (0,external_React_.createElement)(RegisterResetAll, {
resetAllFilter: resetAllFilter
}, children);
return forwardedContext.reduce((inner, [Provider, props]) => (0,external_React_.createElement)(Provider, {
...props
}, inner), innerMarkup);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-tools-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockSupportToolsPanel({
children,
group,
label
}) {
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)((resetFilters = []) => {
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: utils_cleanEmptyObject(newBlockAttributes.style)
};
newAttributes[clientId] = newBlockAttributes;
});
updateBlockAttributes(clientIds, newAttributes, true);
}, [getBlockAttributes, getMultiSelectedBlockClientIds, hasMultiSelection, panelId, updateBlockAttributes]);
return (0,external_React_.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",
dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS
}, children);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/block-support-slot-container.js
/**
* WordPress dependencies
*/
function BlockSupportSlotContainer({
Slot,
fillProps,
...props
}) {
// Add the toolspanel context provider and value to existing fill props
const toolsPanelContext = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolsPanelContext);
const computedFillProps = (0,external_wp_element_namespaceObject.useMemo)(() => {
var _fillProps$forwardedC;
return {
...(fillProps !== null && fillProps !== void 0 ? fillProps : {}),
forwardedContext: [...((_fillProps$forwardedC = fillProps?.forwardedContext) !== null && _fillProps$forwardedC !== void 0 ? _fillProps$forwardedC : []), [external_wp_components_namespaceObject.__experimentalToolsPanelContext.Provider, {
value: toolsPanelContext
}]]
};
}, [toolsPanelContext, fillProps]);
return (0,external_React_.createElement)(Slot, {
...props,
fillProps: computedFillProps,
bubblesVirtually: true
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls/slot.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function InspectorControlsSlot({
__experimentalGroup,
group = 'default',
label,
fillProps,
...props
}) {
if (__experimentalGroup) {
external_wp_deprecated_default()('`__experimentalGroup` property in `InspectorControlsSlot`', {
since: '6.2',
version: '6.4',
alternative: '`group`'
});
group = __experimentalGroup;
}
const Slot = inspector_controls_groups[group]?.Slot;
const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(Slot?.__unstableName);
const motionContextValue = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__unstableMotionContext);
const computedFillProps = (0,external_wp_element_namespaceObject.useMemo)(() => {
var _fillProps$forwardedC;
return {
...(fillProps !== null && fillProps !== void 0 ? fillProps : {}),
forwardedContext: [...((_fillProps$forwardedC = fillProps?.forwardedContext) !== null && _fillProps$forwardedC !== void 0 ? _fillProps$forwardedC : []), [external_wp_components_namespaceObject.__unstableMotionContext.Provider, {
value: motionContextValue
}]]
};
}, [motionContextValue, fillProps]);
if (!Slot) {
true ? external_wp_warning_default()(`Unknown InspectorControls group "${group}" provided.`) : 0;
return null;
}
if (!fills?.length) {
return null;
}
if (label) {
return (0,external_React_.createElement)(BlockSupportToolsPanel, {
group: group,
label: label
}, (0,external_React_.createElement)(BlockSupportSlotContainer, {
...props,
fillProps: computedFillProps,
Slot: Slot
}));
}
return (0,external_React_.createElement)(Slot, {
...props,
fillProps: computedFillProps,
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_React_.createElement)(InspectorControlsFill, {
...props,
group: "advanced"
});
};
InspectorAdvancedControls.Slot = props => {
return (0,external_React_.createElement)(InspectorControlsSlot, {
...props,
group: "advanced"
});
};
InspectorAdvancedControls.slotName = 'InspectorAdvancedControls';
/**
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inspector-controls/README.md
*/
/* harmony default export */ const inspector_controls = (InspectorControls);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/anchor.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Regular expression matching invalid anchor characters for replacement.
*
* @type {RegExp}
*/
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.
*
* @param {Object} settings Original block settings.
*
* @return {Object} Filtered block settings.
*/
function anchor_addAttribute(settings) {
var _settings$attributes$;
// Allow blocks to specify their own attribute definition with default values if needed.
if ('type' in ((_settings$attributes$ = settings.attributes?.anchor) !== null && _settings$attributes$ !== void 0 ? _settings$attributes$ : {})) {
return settings;
}
if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'anchor')) {
// Gracefully handle if settings.attributes is undefined.
settings.attributes = {
...settings.attributes,
anchor: ANCHOR_SCHEMA
};
}
return settings;
}
function BlockEditAnchorControlPure({
name: blockName,
anchor,
setAttributes
}) {
const blockEditingMode = useBlockEditingMode();
const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web';
const textControl = (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
className: "html-anchor-control",
label: (0,external_wp_i18n_namespaceObject.__)('HTML anchor'),
help: (0,external_React_.createElement)(external_React_.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_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, {
href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/page-jumps/')
}, (0,external_wp_i18n_namespaceObject.__)('Learn more about anchors'))),
value: anchor || '',
placeholder: !isWeb ? (0,external_wp_i18n_namespaceObject.__)('Add an anchor') : null,
onChange: nextValue => {
nextValue = nextValue.replace(ANCHOR_REGEX, '-');
setAttributes({
anchor: nextValue
});
},
autoCapitalize: "none",
autoComplete: "off"
});
return (0,external_React_.createElement)(external_React_.Fragment, null, isWeb && blockEditingMode === 'default' && (0,external_React_.createElement)(inspector_controls, {
group: "advanced"
}, textControl), !isWeb && blockName === 'core/heading' && (0,external_React_.createElement)(inspector_controls, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Heading settings')
}, textControl)));
}
/* harmony default export */ const hooks_anchor = ({
addSaveProps,
edit: BlockEditAnchorControlPure,
attributeKeys: ['anchor'],
hasSupport(name) {
return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'anchor');
}
});
/**
* Override props assigned to save component to inject anchor ID, if block
* supports anchor. This is only applied if the block's save result is an
* element and not a markup string.
*
* @param {Object} extraProps Additional props applied to save element.
* @param {Object} blockType Block type.
* @param {Object} attributes Current block attributes.
*
* @return {Object} Filtered props applied to save element.
*/
function addSaveProps(extraProps, blockType, attributes) {
if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'anchor')) {
extraProps.id = attributes.anchor === '' ? null : attributes.anchor;
}
return extraProps;
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/anchor/attribute', anchor_addAttribute);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/aria-label.js
/**
* WordPress dependencies
*/
const ARIA_LABEL_SCHEMA = {
type: 'string',
source: 'attribute',
attribute: 'aria-label',
selector: '*'
};
/**
* Filters registered block settings, extending attributes with ariaLabel using aria-label
* of the first node.
*
* @param {Object} settings Original block settings.
*
* @return {Object} Filtered block settings.
*/
function aria_label_addAttribute(settings) {
// Allow blocks to specify their own attribute definition with default values if needed.
if (settings?.attributes?.ariaLabel?.type) {
return settings;
}
if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'ariaLabel')) {
// Gracefully handle if settings.attributes is undefined.
settings.attributes = {
...settings.attributes,
ariaLabel: ARIA_LABEL_SCHEMA
};
}
return settings;
}
/**
* Override props assigned to save component to inject aria-label, if block
* supports ariaLabel. This is only applied if the block's save result is an
* element and not a markup string.
*
* @param {Object} extraProps Additional props applied to save element.
* @param {Object} blockType Block type.
* @param {Object} attributes Current block attributes.
*
* @return {Object} Filtered props applied to save element.
*/
function aria_label_addSaveProps(extraProps, blockType, attributes) {
if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'ariaLabel')) {
extraProps['aria-label'] = attributes.ariaLabel === '' ? null : attributes.ariaLabel;
}
return extraProps;
}
/* harmony default export */ const aria_label = ({
addSaveProps: aria_label_addSaveProps,
attributeKeys: ['ariaLabel'],
hasSupport(name) {
return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'ariaLabel');
}
});
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/ariaLabel/attribute', aria_label_addAttribute);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/custom-class-name.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Filters registered block settings, extending attributes to include `className`.
*
* @param {Object} settings Original block settings.
*
* @return {Object} Filtered block settings.
*/
function custom_class_name_addAttribute(settings) {
if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'customClassName', true)) {
// Gracefully handle if settings.attributes is undefined.
settings.attributes = {
...settings.attributes,
className: {
type: 'string'
}
};
}
return settings;
}
function CustomClassNameControlsPure({
className,
setAttributes
}) {
const blockEditingMode = useBlockEditingMode();
if (blockEditingMode !== 'default') {
return null;
}
return (0,external_React_.createElement)(inspector_controls, {
group: "advanced"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
autoComplete: "off",
label: (0,external_wp_i18n_namespaceObject.__)('Additional CSS class(es)'),
value: className || '',
onChange: nextValue => {
setAttributes({
className: nextValue !== '' ? nextValue : undefined
});
},
help: (0,external_wp_i18n_namespaceObject.__)('Separate multiple classes with spaces.')
}));
}
/* harmony default export */ const custom_class_name = ({
edit: CustomClassNameControlsPure,
addSaveProps: custom_class_name_addSaveProps,
attributeKeys: ['className'],
hasSupport(name) {
return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'customClassName', true);
}
});
/**
* Override props assigned to save component to inject the className, if block
* supports customClassName. This is only applied if the block's save result is an
* element and not a markup string.
*
* @param {Object} extraProps Additional props applied to save element.
* @param {Object} blockType Block type.
* @param {Object} attributes Current block attributes.
*
* @return {Object} Filtered props applied to save element.
*/
function custom_class_name_addSaveProps(extraProps, blockType, attributes) {
if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'customClassName', true) && attributes.className) {
extraProps.className = classnames_default()(extraProps.className, attributes.className);
}
return extraProps;
}
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]) {
const originClassName = source[index]?.attributes.className;
if (originClassName) {
return {
...result,
attributes: {
...result.attributes,
className: originClassName
}
};
}
}
return result;
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-class-name/attribute', custom_class_name_addAttribute);
(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
/**
* WordPress dependencies
*/
/**
* Override props assigned to save component to inject generated className if
* block supports it. This is only applied if the block's save result is an
* element and not a markup string.
*
* @param {Object} extraProps Additional props applied to save element.
* @param {Object} blockType Block type.
*
* @return {Object} Filtered props applied to save element.
*/
function addGeneratedClassName(extraProps, blockType) {
// Adding the generated className.
if ((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 = [...new Set([(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 = (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockType.name);
}
}
return extraProps;
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/generated-class-name/save-props', addGeneratedClassName);
;// CONCATENATED MODULE: external ["wp","blob"]
const external_wp_blob_namespaceObject = window["wp"]["blob"];
;// CONCATENATED MODULE: external ["wp","dom"]
const external_wp_dom_namespaceObject = window["wp"]["dom"];
;// CONCATENATED MODULE: external ["wp","notices"]
const external_wp_notices_namespaceObject = window["wp"]["notices"];
;// CONCATENATED MODULE: external ["wp","url"]
const external_wp_url_namespaceObject = window["wp"]["url"];
;// CONCATENATED MODULE: external ["wp","keycodes"]
const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js
/**
* WordPress dependencies
*/
const media = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m7 6.5 4 2.5-4 2.5z"
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z"
}));
/* harmony default export */ const library_media = (media);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js
/**
* WordPress dependencies
*/
const upload = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const library_upload = (upload);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-featured-image.js
/**
* WordPress dependencies
*/
const postFeaturedImage = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M19 3H5c-.6 0-1 .4-1 1v7c0 .5.4 1 1 1h14c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1zM5.5 10.5v-.4l1.8-1.3 1.3.8c.3.2.7.2.9-.1L11 8.1l2.4 2.4H5.5zm13 0h-2.9l-4-4c-.3-.3-.8-.3-1.1 0L8.9 8l-1.2-.8c-.3-.2-.6-.2-.9 0l-1.3 1V4.5h13v6zM4 20h9v-1.5H4V20zm0-4h16v-1.5H4V16z"
}));
/* harmony default export */ const post_featured_image = (postFeaturedImage);
;// 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 {Component} 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 */ const 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({
fallback = null,
children
}) {
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 */ const check = (MediaUploadCheck);
;// CONCATENATED MODULE: external ["wp","isShallowEqual"]
const external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"];
var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject);
;// CONCATENATED MODULE: external ["wp","preferences"]
const external_wp_preferences_namespaceObject = window["wp"]["preferences"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard-return.js
/**
* WordPress dependencies
*/
const keyboardReturn = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "-2 -2 24 24"
}, (0,external_React_.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 */ const keyboard_return = (keyboardReturn);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js
/**
* WordPress dependencies
*/
const chevronLeftSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"
}));
/* harmony default export */ const chevron_left_small = (chevronLeftSmall);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js
/**
* WordPress dependencies
*/
const chevronRightSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const chevron_right_small = (chevronRightSmall);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings-drawer.js
/**
* WordPress dependencies
*/
function LinkSettingsDrawer({
children,
settingsOpen,
setSettingsOpen
}) {
const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
const MaybeAnimatePresence = prefersReducedMotion ? external_wp_element_namespaceObject.Fragment : external_wp_components_namespaceObject.__unstableAnimatePresence;
const MaybeMotionDiv = prefersReducedMotion ? 'div' : external_wp_components_namespaceObject.__unstableMotion.div;
const id = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkSettingsDrawer);
const settingsDrawerId = `link-control-settings-drawer-${id}`;
return (0,external_React_.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
className: "block-editor-link-control__drawer-toggle",
"aria-expanded": settingsOpen,
onClick: () => setSettingsOpen(!settingsOpen),
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small,
"aria-controls": settingsDrawerId
}, (0,external_wp_i18n_namespaceObject._x)('Advanced', 'Additional link settings')), (0,external_React_.createElement)(MaybeAnimatePresence, null, settingsOpen && (0,external_React_.createElement)(MaybeMotionDiv, {
className: "block-editor-link-control__drawer",
hidden: !settingsOpen,
id: settingsDrawerId,
initial: "collapsed",
animate: "open",
exit: "collapsed",
variants: {
open: {
opacity: 1,
height: 'auto'
},
collapsed: {
opacity: 0,
height: 0
}
},
transition: {
duration: 0.1
}
}, (0,external_React_.createElement)("div", {
className: "block-editor-link-control__drawer-inner"
}, children))));
}
/* harmony default export */ const settings_drawer = (LinkSettingsDrawer);
// EXTERNAL MODULE: ./node_modules/dom-scroll-into-view/lib/index.js
var lib = __webpack_require__(5428);
var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-input/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Whether the argument is a function.
*
* @param {*} maybeFunc The argument to check.
* @return {boolean} True if the argument is a function, false otherwise.
*/
function isFunction(maybeFunc) {
return typeof maybeFunc === 'function';
}
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_wp_compose_namespaceObject.debounce)(this.updateSuggestions.bind(this), 200);
this.suggestionNodes = [];
this.suggestionsRequest = null;
this.state = {
suggestions: [],
showSuggestions: false,
suggestionsValue: null,
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) {
if (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() {
this.suggestionsRequest?.cancel?.();
this.suggestionsRequest = null;
}
bindSuggestionNode(index) {
return ref => {
this.suggestionNodes[index] = ref;
};
}
shouldShowInitialSuggestions() {
const {
__experimentalShowInitialSuggestions = false,
value
} = this.props;
return __experimentalShowInitialSuggestions && !(value && value.length);
}
updateSuggestions(value = '') {
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?.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.suggestionsRequest?.cancel?.();
this.suggestionsRequest = null;
this.setState({
suggestions: [],
showSuggestions: false,
suggestionsValue: value,
selectedSuggestion: null,
loading: false
});
return;
}
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,
suggestionsValue: value,
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');
}
}).catch(() => {
if (this.suggestionsRequest !== request) {
return;
}
this.setState({
loading: false
});
}).finally(() => {
// If this is the current promise then reset the reference
// to allow for checking if a new request is made.
if (this.suggestionsRequest === request) {
this.suggestionsRequest = null;
}
});
// 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) {
this.props.onChange(event.target.value);
}
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)
// or there is already a request in progress.
if (value && !disableSuggestions && !(suggestions && suggestions.length) && this.suggestionsRequest === null) {
// Ensure the suggestions are updated with the current input value.
this.updateSuggestions(value);
}
}
onKeyDown(event) {
this.props.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) {
event.preventDefault();
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:
{
event.preventDefault();
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({
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 (0,external_React_.createElement)(external_React_.Fragment, null, this.renderControl(), this.renderSuggestions());
}
renderControl() {
const {
/** Start opting into the new margin-free styles that will become the default in a future version. */
__nextHasNoMarginBottom = false,
label = null,
className,
isFullWidth,
instanceId,
placeholder = (0,external_wp_i18n_namespaceObject.__)('Paste URL or type to search'),
__experimentalRenderControl: renderControl,
value = '',
hideLabelFromVision = false
} = this.props;
const {
loading,
showSuggestions,
selectedSuggestion,
suggestionsListboxId,
suggestionOptionIdPrefix
} = this.state;
const inputId = `url-input-control-${instanceId}`;
const controlProps = {
id: inputId,
// Passes attribute to label for the for attribute
label,
className: classnames_default()('block-editor-url-input', className, {
'is-full-width': isFullWidth
}),
hideLabelFromVision
};
const inputProps = {
id: inputId,
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': label ? undefined : (0,external_wp_i18n_namespaceObject.__)('URL'),
// Ensure input always has an accessible label
'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);
}
if (!__nextHasNoMarginBottom) {
external_wp_deprecated_default()('Bottom margin styles for wp.blockEditor.URLInput', {
since: '6.2',
version: '6.5',
hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version'
});
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl, {
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
...controlProps
}, (0,external_React_.createElement)("input", {
...inputProps
}), loading && (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null));
}
renderSuggestions() {
const {
className,
__experimentalRenderSuggestions: renderSuggestions
} = this.props;
const {
showSuggestions,
suggestions,
suggestionsValue,
selectedSuggestion,
suggestionsListboxId,
suggestionOptionIdPrefix,
loading
} = this.state;
if (!showSuggestions || suggestions.length === 0) {
return null;
}
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 ? true : undefined
};
};
if (isFunction(renderSuggestions)) {
return renderSuggestions({
suggestions,
selectedSuggestion,
suggestionsListProps,
buildSuggestionItemProps,
isLoading: loading,
handleSuggestionClick: this.handleOnClick,
isInitialSuggestions: !suggestionsValue?.length,
currentInputValue: suggestionsValue
});
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, {
placement: "bottom",
focusOnMount: false
}, (0,external_React_.createElement)("div", {
...suggestionsListProps,
className: classnames_default()('block-editor-url-input__suggestions', `${className}__suggestions`)
}, suggestions.map((suggestion, index) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
...buildSuggestionItemProps(suggestion, index),
key: suggestion.id,
className: classnames_default()('block-editor-url-input__suggestion', {
'is-selected': index === selectedSuggestion
}),
onClick: () => this.handleOnClick(suggestion)
}, suggestion.title))));
}
}
/**
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-input/README.md
*/
/* harmony default export */ const 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 (isFunction(props.__experimentalFetchLinkSuggestions)) {
return;
}
const {
getSettings
} = select(store);
return {
__experimentalFetchLinkSuggestions: getSettings().__experimentalFetchLinkSuggestions
};
}))(URLInput));
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
/**
* WordPress dependencies
*/
const plus = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"
}));
/* harmony default export */ const library_plus = (plus);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-create-button.js
/**
* WordPress dependencies
*/
const LinkControlSearchCreate = ({
searchTerm,
onClick,
itemProps,
buttonText
}) => {
if (!searchTerm) {
return null;
}
let text;
if (buttonText) {
text = typeof buttonText === 'function' ? 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: <mark>%s</mark>'), searchTerm), {
mark: (0,external_React_.createElement)("mark", null)
});
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
...itemProps,
iconPosition: "left",
icon: library_plus,
className: "block-editor-link-control__search-item",
onClick: onClick
}, text);
};
/* harmony default export */ const search_create_button = (LinkControlSearchCreate);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-list.js
/**
* WordPress dependencies
*/
const postList = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M18 5.5H6a.5.5 0 0 0-.5.5v12a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5V6a.5.5 0 0 0-.5-.5ZM6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm1 5h1.5v1.5H7V9Zm1.5 4.5H7V15h1.5v-1.5ZM10 9h7v1.5h-7V9Zm7 4.5h-7V15h7v-1.5Z"
}));
/* harmony default export */ const post_list = (postList);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js
/**
* WordPress dependencies
*/
const page = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"
}));
/* harmony default export */ const library_page = (page);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tag.js
/**
* WordPress dependencies
*/
const tag = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
}));
/* harmony default export */ const library_tag = (tag);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/category.js
/**
* WordPress dependencies
*/
const category = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",
fillRule: "evenodd",
clipRule: "evenodd"
}));
/* harmony default export */ const library_category = (category);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/file.js
/**
* WordPress dependencies
*/
const file = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"
}));
/* harmony default export */ const library_file = (file);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js
/**
* WordPress dependencies
*/
const globe = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const library_globe = (globe);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/home.js
/**
* WordPress dependencies
*/
const home = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"
}));
/* harmony default export */ const library_home = (home);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/verse.js
/**
* WordPress dependencies
*/
const verse = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"
}));
/* harmony default export */ const library_verse = (verse);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-item.js
/**
* WordPress dependencies
*/
const ICONS_MAP = {
post: post_list,
page: library_page,
post_tag: library_tag,
category: library_category,
attachment: library_file
};
function SearchItemIcon({
isURL,
suggestion
}) {
let icon = null;
if (isURL) {
icon = library_globe;
} else if (suggestion.type in ICONS_MAP) {
icon = ICONS_MAP[suggestion.type];
if (suggestion.type === 'page') {
if (suggestion.isFrontPage) {
icon = library_home;
}
if (suggestion.isBlogHome) {
icon = library_verse;
}
}
}
if (icon) {
return (0,external_React_.createElement)(build_module_icon, {
className: "block-editor-link-control__search-item-icon",
icon: icon
});
}
return null;
}
/**
* Adds a leading slash to a url if it doesn't already have one.
* @param {string} url the url to add a leading slash to.
* @return {string} the url with a leading slash.
*/
function addLeadingSlash(url) {
const trimmedURL = url?.trim();
if (!trimmedURL?.length) return url;
return url?.replace(/^\/?/, '/');
}
function removeTrailingSlash(url) {
const trimmedURL = url?.trim();
if (!trimmedURL?.length) return url;
return url?.replace(/\/$/, '');
}
const partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs);
const defaultTo = d => v => {
return v === null || v === undefined || v !== v ? d : v;
};
/**
* Prepares a URL for display in the UI.
* - decodes the URL.
* - filters it (removes protocol, www, etc.).
* - truncates it if necessary.
* - adds a leading slash.
* @param {string} url the url.
* @return {string} the processed url to display.
*/
function getURLForDisplay(url) {
if (!url) return url;
return (0,external_wp_compose_namespaceObject.pipe)(external_wp_url_namespaceObject.safeDecodeURI, external_wp_url_namespaceObject.getPath, defaultTo(''), partialRight(external_wp_url_namespaceObject.filterURLForDisplay, 24), removeTrailingSlash, addLeadingSlash)(url);
}
const LinkControlSearchItem = ({
itemProps,
suggestion,
searchTerm,
onClick,
isURL = false,
shouldShowType = false
}) => {
const info = isURL ? (0,external_wp_i18n_namespaceObject.__)('Press ENTER to add this link') : getURLForDisplay(suggestion.url);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
...itemProps,
info: info,
iconPosition: "left",
icon: (0,external_React_.createElement)(SearchItemIcon, {
suggestion: suggestion,
isURL: isURL
}),
onClick: onClick,
shortcut: shouldShowType && getVisualTypeName(suggestion),
className: "block-editor-link-control__search-item"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextHighlight
// The component expects a plain text string.
, {
text: (0,external_wp_dom_namespaceObject.__unstableStripHTML)(suggestion.title),
highlight: searchTerm
}));
};
function getVisualTypeName(suggestion) {
if (suggestion.isFrontPage) {
return 'front page';
}
if (suggestion.isBlogHome) {
return 'blog home';
}
// 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 */ const 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 TEL_TYPE = 'tel';
const URL_TYPE = 'link';
const MAILTO_TYPE = 'mailto';
const INTERNAL_TYPE = 'internal';
const LINK_ENTRY_TYPES = [URL_TYPE, MAILTO_TYPE, TEL_TYPE, INTERNAL_TYPE];
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({
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 isSingleDirectEntryResult = suggestions.length === 1 && LINK_ENTRY_TYPES.includes(suggestions[0].type);
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?.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.__)('Suggestions') : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: search term. */
(0,external_wp_i18n_namespaceObject.__)('Search results for "%s"'), currentInputValue);
const searchResultsLabel = (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
id: searchResultsLabelId
}, labelText);
return (0,external_React_.createElement)("div", {
className: "block-editor-link-control__search-results-wrapper"
}, searchResultsLabel, (0,external_React_.createElement)("div", {
...suggestionsListProps,
className: resultsListClasses,
"aria-labelledby": searchResultsLabelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, suggestions.map((suggestion, index) => {
if (shouldShowCreateSuggestion && CREATE_TYPE === suggestion.type) {
return (0,external_React_.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_React_.createElement)(search_item, {
key: `${suggestion.id}-${suggestion.type}`,
itemProps: buildSuggestionItemProps(suggestion, index),
suggestion: suggestion,
index: index,
onClick: () => {
handleSuggestionClick(suggestion);
},
isSelected: index === selectedSuggestion,
isURL: LINK_ENTRY_TYPES.includes(suggestion.type),
searchTerm: currentInputValue,
shouldShowType: shouldShowSuggestionsTypes,
isFrontPage: suggestion?.isFrontPage,
isBlogHome: suggestion?.isBlogHome
});
}))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/is-url-like.js
/**
* 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 hasSpaces = val.includes(' ');
if (hasSpaces) {
return false;
}
const protocol = (0,external_wp_url_namespaceObject.getProtocol)(val);
const protocolIsValid = (0,external_wp_url_namespaceObject.isValidProtocol)(protocol);
const mayBeTLD = hasPossibleTLD(val);
const isWWW = val?.startsWith('www.');
const isInternal = val?.startsWith('#') && (0,external_wp_url_namespaceObject.isValidFragment)(val);
return protocolIsValid || isWWW || isInternal || mayBeTLD;
}
/**
* Checks if a given URL has a valid Top-Level Domain (TLD).
*
* @param {string} url - The URL to check.
* @param {number} maxLength - The maximum length of the TLD.
* @return {boolean} Returns true if the URL has a valid TLD, false otherwise.
*/
function hasPossibleTLD(url, maxLength = 6) {
// Clean the URL by removing anything after the first occurrence of "?" or "#".
const cleanedURL = url.split(/[?#]/)[0];
// Regular expression explanation:
// - (?<=\S) : Positive lookbehind assertion to ensure there is at least one non-whitespace character before the TLD
// - \. : Matches a literal dot (.)
// - [a-zA-Z_]{2,maxLength} : Matches 2 to maxLength letters or underscores, representing the TLD
// - (?:\/|$) : Non-capturing group that matches either a forward slash (/) or the end of the string
const regex = new RegExp(`(?<=\\S)\\.(?:[a-zA-Z_]{2,${maxLength}})(?:\\/|$)`);
return regex.test(cleanedURL);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-search-handler.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const handleNoop = () => Promise.resolve([]);
const handleDirectEntry = val => {
let type = URL_TYPE;
const protocol = (0,external_wp_url_namespaceObject.getProtocol)(val) || '';
if (protocol.includes('mailto')) {
type = MAILTO_TYPE;
}
if (protocol.includes('tel')) {
type = TEL_TYPE;
}
if (val?.startsWith('#')) {
type = INTERNAL_TYPE;
}
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, withCreateSuggestion, pageOnFront, pageForPosts) => {
const {
isInitialSuggestions
} = suggestionsQuery;
const results = await fetchSearchSuggestions(val, suggestionsQuery);
// Identify front page and update type to match.
results.map(result => {
if (Number(result.id) === pageOnFront) {
result.isFrontPage = true;
return result;
} else if (Number(result.id) === pageForPosts) {
result.isBlogHome = true;
return result;
}
return result;
});
// 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 `<input>`. This is because `title` is used
// when creating the suggestion. Similarly `url` is used when using keyboard to select
// the suggestion (the <form> `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 `<input>`s text value.
url: val,
// Must match the existing `<input>`s text value.
type: CREATE_TYPE
});
};
function useSearchHandler(suggestionsQuery, allowDirectEntry, withCreateSuggestion) {
const {
fetchSearchSuggestions,
pageOnFront,
pageForPosts
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(store);
return {
pageOnFront: getSettings().pageOnFront,
pageForPosts: getSettings().pageForPosts,
fetchSearchSuggestions: getSettings().__experimentalFetchLinkSuggestions
};
}, []);
const directEntryHandler = allowDirectEntry ? handleDirectEntry : handleNoop;
return (0,external_wp_element_namespaceObject.useCallback)((val, {
isInitialSuggestions
}) => {
return isURLLike(val) ? directEntryHandler(val, {
isInitialSuggestions
}) : handleEntitySearch(val, {
...suggestionsQuery,
isInitialSuggestions
}, fetchSearchSuggestions, withCreateSuggestion, pageOnFront, pageForPosts);
}, [directEntryHandler, fetchSearchSuggestions, pageOnFront, pageForPosts, suggestionsQuery, withCreateSuggestion]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/search-input.js
/**
* 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 noop = () => {};
const LinkControlSearchInput = (0,external_wp_element_namespaceObject.forwardRef)(({
value,
children,
currentLink = {},
className = null,
placeholder = null,
withCreateSuggestion = false,
onCreateSuggestion = noop,
onChange = noop,
onSelect = noop,
showSuggestions = true,
renderSuggestions = props => (0,external_React_.createElement)(LinkControlSearchResults, {
...props
}),
fetchSuggestions = null,
allowDirectEntry = true,
showInitialSuggestions = false,
suggestionsQuery = {},
withURLSuggestion = true,
createSuggestionButtonText,
hideLabelFromVision = 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,
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 {
suggestion = await onCreateSuggestion(selectedSuggestion.title);
if (suggestion?.url) {
onSelect(suggestion);
}
} catch (e) {}
return;
}
if (allowDirectEntry || suggestion && Object.keys(suggestion).length >= 1) {
const {
id,
url,
...restLinkProps
} = currentLink !== null && currentLink !== void 0 ? currentLink : {};
onSelect(
// Some direct entries don't have types or IDs, and we still need to clear the previous ones.
{
...restLinkProps,
...suggestion
}, suggestion);
}
};
return (0,external_React_.createElement)("div", {
className: "block-editor-link-control__search-input-container"
}, (0,external_React_.createElement)(url_input, {
disableSuggestions: currentLink?.url === value,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link'),
hideLabelFromVision: hideLabelFromVision,
className: className,
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) => {
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?.trim()?.length) {
event.preventDefault();
} else {
onSuggestionSelected(hasSuggestion || {
url: value
});
}
},
ref: ref
}), children);
});
/* harmony default export */ const search_input = (LinkControlSearchInput);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js
/**
* WordPress dependencies
*/
const info = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const library_info = (info);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js
/**
* WordPress dependencies
*/
const pencil = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"
}));
/* harmony default export */ const library_pencil = (pencil);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js
/**
* Internal dependencies
*/
/* harmony default export */ const edit = (library_pencil);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link-off.js
/**
* WordPress dependencies
*/
const linkOff = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"
}));
/* harmony default export */ const link_off = (linkOff);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/copy-small.js
/**
* WordPress dependencies
*/
const copySmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z"
}));
/* harmony default export */ const copy_small = (copySmall);
;// 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 */ const 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?.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 */ const 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({
value,
onEditClick,
hasRichPreviews = false,
hasUnlinkControl = false,
onRemove
}) {
const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_preferences_namespaceObject.store).get('core', 'showIconLabels'), []);
// Avoid fetching if rich previews are not desired.
const showRichPreviews = hasRichPreviews ? 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), 24) || '';
// url can be undefined if the href attribute is unset
const isEmptyURL = !value?.url?.length;
const displayTitle = !isEmptyURL && (0,external_wp_dom_namespaceObject.__unstableStripHTML)(richData?.title || value?.title || displayURL);
let icon;
if (richData?.icon) {
icon = (0,external_React_.createElement)("img", {
src: richData?.icon,
alt: ""
});
} else if (isEmptyURL) {
icon = (0,external_React_.createElement)(build_module_icon, {
icon: library_info,
size: 32
});
} else {
icon = (0,external_React_.createElement)(build_module_icon, {
icon: library_globe
});
}
const {
createNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(value.url, () => {
createNotice('info', (0,external_wp_i18n_namespaceObject.__)('Link copied to clipboard.'), {
isDismissible: true,
type: 'snackbar'
});
});
return (0,external_React_.createElement)("div", {
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Currently selected'),
className: classnames_default()('block-editor-link-control__search-item', {
'is-current': true,
'is-rich': hasRichData,
'is-fetching': !!isFetching,
'is-preview': true,
'is-error': isEmptyURL,
'is-url-title': displayTitle === displayURL
})
}, (0,external_React_.createElement)("div", {
className: "block-editor-link-control__search-item-top"
}, (0,external_React_.createElement)("span", {
className: "block-editor-link-control__search-item-header"
}, (0,external_React_.createElement)("span", {
className: classnames_default()('block-editor-link-control__search-item-icon', {
'is-image': richData?.icon
})
}, icon), (0,external_React_.createElement)("span", {
className: "block-editor-link-control__search-item-details"
}, !isEmptyURL ? (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, {
className: "block-editor-link-control__search-item-title",
href: value.url
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
numberOfLines: 1
}, displayTitle)), value?.url && displayTitle !== displayURL && (0,external_React_.createElement)("span", {
className: "block-editor-link-control__search-item-info"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
numberOfLines: 1
}, displayURL))) : (0,external_React_.createElement)("span", {
className: "block-editor-link-control__search-item-error-notice"
}, (0,external_wp_i18n_namespaceObject.__)('Link is empty')))), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: edit,
label: (0,external_wp_i18n_namespaceObject.__)('Edit link'),
onClick: onEditClick,
size: "compact"
}), hasUnlinkControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: link_off,
label: (0,external_wp_i18n_namespaceObject.__)('Remove link'),
onClick: onRemove,
size: "compact"
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: copy_small,
label: (0,external_wp_i18n_namespaceObject.sprintf)(
// Translators: %s is a placeholder for the link URL and an optional colon, (if a Link URL is present).
(0,external_wp_i18n_namespaceObject.__)('Copy link%s'),
// Ends up looking like "Copy link: https://example.com".
isEmptyURL || showIconLabels ? '' : ': ' + value.url),
ref: ref,
disabled: isEmptyURL,
size: "compact"
}), (0,external_React_.createElement)(ViewerSlot, {
fillProps: value
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/settings.js
/**
* WordPress dependencies
*/
const settings_noop = () => {};
const LinkControlSettings = ({
value,
onChange = settings_noop,
settings
}) => {
if (!settings || !settings.length) {
return null;
}
const handleSettingChange = setting => newValue => {
onChange({
...value,
[setting.id]: newValue
});
};
const theSettings = settings.map(setting => (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
__nextHasNoMarginBottom: true,
className: "block-editor-link-control__setting",
key: setting.id,
label: setting.title,
onChange: handleSettingChange(setting),
checked: value ? !!value[setting.id] : false,
help: setting?.help
}));
return (0,external_React_.createElement)("fieldset", {
className: "block-editor-link-control__settings"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
as: "legend"
}, (0,external_wp_i18n_namespaceObject.__)('Currently selected link settings')), theSettings);
};
/* harmony default export */ const link_control_settings = (LinkControlSettings);
;// 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;
}
};
};
// EXTERNAL MODULE: ./node_modules/fast-deep-equal/index.js
var fast_deep_equal = __webpack_require__(5215);
var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/link-control/use-internal-value.js
/**
* WordPress dependencies
*/
/**
* External dependencies
*/
function useInternalValue(value) {
const [internalValue, setInternalValue] = (0,external_wp_element_namespaceObject.useState)(value || {});
const [previousValue, setPreviousValue] = (0,external_wp_element_namespaceObject.useState)(value);
// If the value prop changes, update the internal state.
// See:
// - https://github.com/WordPress/gutenberg/pull/51387#issuecomment-1722927384.
// - https://react.dev/reference/react/useState#storing-information-from-previous-renders.
if (!fast_deep_equal_default()(value, previousValue)) {
setPreviousValue(value);
setInternalValue(value);
}
const setInternalURLInputValue = nextValue => {
setInternalValue({
...internalValue,
url: nextValue
});
};
const setInternalTextInputValue = nextValue => {
setInternalValue({
...internalValue,
title: nextValue
});
};
const createSetInternalSettingValueHandler = settingsKeys => nextValue => {
// Only apply settings values which are defined in the settings prop.
const settingsUpdates = Object.keys(nextValue).reduce((acc, key) => {
if (settingsKeys.includes(key)) {
acc[key] = nextValue[key];
}
return acc;
}, {});
setInternalValue({
...internalValue,
...settingsUpdates
});
};
return [internalValue, setInternalValue, setInternalURLInputValue, setInternalTextInputValue, createSetInternalSettingValueHandler];
}
;// 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 {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.
* @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.
*/
const link_control_noop = () => {};
const PREFERENCE_SCOPE = 'core/block-editor';
const PREFERENCE_KEY = 'linkControlSettingsDrawer';
/**
* 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 = DEFAULT_LINK_SETTINGS,
onChange = link_control_noop,
onRemove,
onCancel,
noDirectEntry = false,
showSuggestions = true,
showInitialSuggestions,
forceIsEditingLink,
createSuggestion,
withCreateSuggestion,
inputValue: propInputValue = '',
suggestionsQuery = {},
noURLSuggestion = false,
createSuggestionButtonText,
hasRichPreviews = false,
hasTextControl = false,
renderControlBottom = null
}) {
if (withCreateSuggestion === undefined && createSuggestion) {
withCreateSuggestion = true;
}
const [settingsOpen, setSettingsOpen] = (0,external_wp_element_namespaceObject.useState)(false);
const {
advancedSettingsPreference
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _prefsStore$get;
const prefsStore = select(external_wp_preferences_namespaceObject.store);
return {
advancedSettingsPreference: (_prefsStore$get = prefsStore.get(PREFERENCE_SCOPE, PREFERENCE_KEY)) !== null && _prefsStore$get !== void 0 ? _prefsStore$get : false
};
}, []);
const {
set: setPreference
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
/**
* Sets the open/closed state of the Advanced Settings Drawer,
* optionlly persisting the state to the user's preferences.
*
* Note that Block Editor components can be consumed by non-WordPress
* environments which may not have preferences setup.
* Therefore a local state is also used as a fallback.
*
* @param {boolean} prefVal the open/closed state of the Advanced Settings Drawer.
*/
const setSettingsOpenWithPreference = prefVal => {
if (setPreference) {
setPreference(PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal);
}
setSettingsOpen(prefVal);
};
// Block Editor components can be consumed by non-WordPress environments
// which may not have these preferences setup.
// Therefore a local state is used as a fallback.
const isSettingsOpen = advancedSettingsPreference || settingsOpen;
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 isEndingEditWithFocus = (0,external_wp_element_namespaceObject.useRef)(false);
const settingsKeys = settings.map(({
id
}) => id);
const [internalControlValue, setInternalControlValue, setInternalURLInputValue, setInternalTextInputValue, createSetInternalSettingValueHandler] = useInternalValue(value);
const valueHasChanges = value && !(0,external_wp_isShallowEqual_namespaceObject.isShallowEqualObjects)(internalControlValue, value);
const [isEditingLink, setIsEditingLink] = (0,external_wp_element_namespaceObject.useState)(forceIsEditingLink !== undefined ? forceIsEditingLink : !value || !value.url);
const {
createPage,
isCreatingPage,
errorMessage
} = useCreatePage(createSuggestion);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (forceIsEditingLink === undefined) {
return;
}
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;
}
// 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)[0] || wrapperNode.current;
nextFocusTarget.focus();
isEndingEditWithFocus.current = false;
}, [isEditingLink, isCreatingPage]);
const hasLinkValue = value?.url?.trim()?.length > 0;
/**
* 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.
*/
const stopEditing = () => {
isEndingEditWithFocus.current = !!wrapperNode.current?.contains(wrapperNode.current.ownerDocument.activeElement);
setIsEditingLink(false);
};
const handleSelectSuggestion = updatedValue => {
// Suggestions may contains "settings" values (e.g. `opensInNewTab`)
// which should not overide any existing settings values set by the
// user. This filters out any settings values from the suggestion.
const nonSettingsChanges = Object.keys(updatedValue).reduce((acc, key) => {
if (!settingsKeys.includes(key)) {
acc[key] = updatedValue[key];
}
return acc;
}, {});
onChange({
...internalControlValue,
...nonSettingsChanges,
// As title is not a setting, it must be manually applied
// in such a way as to preserve the users changes over
// any "title" value provided by the "suggestion".
title: internalControlValue?.title || updatedValue?.title
});
stopEditing();
};
const handleSubmit = () => {
if (valueHasChanges) {
// Submit the original value with new stored values applied
// on top. URL is a special case as it may also be a prop.
onChange({
...value,
...internalControlValue,
url: currentUrlInputValue
});
}
stopEditing();
};
const handleSubmitWithEnter = event => {
const {
keyCode
} = event;
if (keyCode === external_wp_keycodes_namespaceObject.ENTER && !currentInputIsEmpty // Disallow submitting empty values.
) {
event.preventDefault();
handleSubmit();
}
};
const resetInternalValues = () => {
setInternalControlValue(value);
};
const handleCancel = event => {
event.preventDefault();
event.stopPropagation();
// Ensure that any unsubmitted input changes are reset.
resetInternalValues();
if (hasLinkValue) {
// If there is a link then exist editing mode and show preview.
stopEditing();
} else {
// If there is no link value, then remove the link entirely.
onRemove?.();
}
onCancel?.();
};
const currentUrlInputValue = propInputValue || internalControlValue?.url || '';
const currentInputIsEmpty = !currentUrlInputValue?.trim()?.length;
const shownUnlinkControl = onRemove && value && !isEditingLink && !isCreatingPage;
const showActions = isEditingLink && hasLinkValue;
// 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 = hasLinkValue && hasTextControl;
const isEditing = (isEditingLink || !value) && !isCreatingPage;
const isDisabled = !valueHasChanges || currentInputIsEmpty;
const showSettings = !!settings?.length && isEditingLink && hasLinkValue;
return (0,external_React_.createElement)("div", {
tabIndex: -1,
ref: wrapperNode,
className: "block-editor-link-control"
}, isCreatingPage && (0,external_React_.createElement)("div", {
className: "block-editor-link-control__loading"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null), " ", (0,external_wp_i18n_namespaceObject.__)('Creating'), "\u2026"), isEditing && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
className: classnames_default()({
'block-editor-link-control__search-input-wrapper': true,
'has-text-control': showTextControl,
'has-actions': showActions
})
}, showTextControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
ref: textInputRef,
className: "block-editor-link-control__field block-editor-link-control__text-content",
label: (0,external_wp_i18n_namespaceObject.__)('Text'),
value: internalControlValue?.title,
onChange: setInternalTextInputValue,
onKeyDown: handleSubmitWithEnter,
size: "__unstable-large"
}), (0,external_React_.createElement)(search_input, {
currentLink: value,
className: "block-editor-link-control__field block-editor-link-control__search-input",
placeholder: searchInputPlaceholder,
value: currentUrlInputValue,
withCreateSuggestion: withCreateSuggestion,
onCreateSuggestion: createPage,
onChange: setInternalURLInputValue,
onSelect: handleSelectSuggestion,
showInitialSuggestions: showInitialSuggestions,
allowDirectEntry: !noDirectEntry,
showSuggestions: showSuggestions,
suggestionsQuery: suggestionsQuery,
withURLSuggestion: !noURLSuggestion,
createSuggestionButtonText: createSuggestionButtonText,
hideLabelFromVision: !showTextControl
}), !showActions && (0,external_React_.createElement)("div", {
className: "block-editor-link-control__search-enter"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
onClick: isDisabled ? link_control_noop : handleSubmit,
label: (0,external_wp_i18n_namespaceObject.__)('Submit'),
icon: keyboard_return,
className: "block-editor-link-control__search-submit",
"aria-disabled": isDisabled
}))), errorMessage && (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, {
className: "block-editor-link-control__search-error",
status: "error",
isDismissible: false
}, errorMessage)), value && !isEditingLink && !isCreatingPage && (0,external_React_.createElement)(LinkPreview, {
key: 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();
setIsEditingLink(true);
}
}), showSettings && (0,external_React_.createElement)("div", {
className: "block-editor-link-control__tools"
}, !currentInputIsEmpty && (0,external_React_.createElement)(settings_drawer, {
settingsOpen: isSettingsOpen,
setSettingsOpen: setSettingsOpenWithPreference
}, (0,external_React_.createElement)(link_control_settings, {
value: internalControlValue,
settings: settings,
onChange: createSetInternalSettingValueHandler(settingsKeys)
}))), showActions && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "right",
className: "block-editor-link-control__search-actions"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: handleCancel
}, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: isDisabled ? link_control_noop : handleSubmit,
className: "block-editor-link-control__search-submit",
"aria-disabled": isDisabled
}, (0,external_wp_i18n_namespaceObject.__)('Save'))), !isCreatingPage && renderControlBottom && renderControlBottom());
}
LinkControl.ViewerFill = ViewerFill;
LinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS;
/* harmony default export */ const link_control = (LinkControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-replace-flow/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const media_replace_flow_noop = () => {};
let uniqueId = 0;
const MediaReplaceFlow = ({
mediaURL,
mediaId,
mediaIds,
allowedTypes,
accept,
onError,
onSelect,
onSelectURL,
onToggleFeaturedImage,
useFeaturedImage,
onFilesUpload = media_replace_flow_noop,
name = (0,external_wp_i18n_namespaceObject.__)('Replace'),
createNotice,
removeNotice,
children,
multiple = false,
addToGallery,
handleUpload = true,
popoverProps
}) => {
const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)(select => {
return select(store).getSettings().mediaUpload;
}, []);
const canUpload = !!mediaUpload;
const editMediaButtonRef = (0,external_wp_element_namespaceObject.useRef)();
const errorNoticeID = `block-editor/media-replace-flow/error-notice/${++uniqueId}`;
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) => {
if (useFeaturedImage && onToggleFeaturedImage) {
onToggleFeaturedImage();
}
closeMenu();
// 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: ([media]) => {
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();
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: popoverProps,
contentClassName: "block-editor-media-replace-flow__options",
renderToggle: ({
isOpen,
onToggle
}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
ref: editMediaButtonRef,
"aria-expanded": isOpen,
"aria-haspopup": "true",
onClick: onToggle,
onKeyDown: openOnArrowDown
}, name),
renderContent: ({
onClose
}) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.NavigableMenu, {
className: "block-editor-media-replace-flow__media-upload-menu"
}, (0,external_React_.createElement)(check, null, (0,external_React_.createElement)(media_upload, {
gallery: gallery,
addToGallery: addToGallery,
multiple: multiple,
value: multiple ? mediaIds : mediaId,
onSelect: media => selectMedia(media, onClose),
allowedTypes: allowedTypes,
render: ({
open
}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
icon: library_media,
onClick: open
}, (0,external_wp_i18n_namespaceObject.__)('Open Media Library'))
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.FormFileUpload, {
onChange: event => {
uploadFiles(event, onClose);
},
accept: accept,
multiple: !!multiple,
render: ({
openFileDialog
}) => {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
icon: library_upload,
onClick: () => {
openFileDialog();
}
}, (0,external_wp_i18n_namespaceObject.__)('Upload'));
}
})), onToggleFeaturedImage && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
icon: post_featured_image,
onClick: onToggleFeaturedImage,
isPressed: useFeaturedImage
}, (0,external_wp_i18n_namespaceObject.__)('Use featured image')), children), onSelectURL &&
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
(0,external_React_.createElement)("form", {
className: classnames_default()('block-editor-media-flow__url-input', {
'has-siblings': canUpload || onToggleFeaturedImage
})
}, (0,external_React_.createElement)("span", {
className: "block-editor-media-replace-flow__image-url-label"
}, (0,external_wp_i18n_namespaceObject.__)('Current media URL:')), (0,external_React_.createElement)(link_control, {
value: {
url: mediaURL
},
settings: [],
showSuggestions: false,
onChange: ({
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 */ const 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/hooks/background.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const BACKGROUND_SUPPORT_KEY = 'background';
const IMAGE_BACKGROUND_TYPE = 'image';
/**
* Checks if there is a current value in the background image block support
* attributes.
*
* @param {Object} style Style attribute.
* @return {boolean} Whether or not the block has a background image value set.
*/
function hasBackgroundImageValue(style) {
const hasValue = !!style?.background?.backgroundImage?.id || !!style?.background?.backgroundImage?.url;
return hasValue;
}
/**
* Checks if there is a current value in the background size block support
* attributes. Background size values include background size as well
* as background position.
*
* @param {Object} style Style attribute.
* @return {boolean} Whether or not the block has a background size value set.
*/
function hasBackgroundSizeValue(style) {
return style?.background?.backgroundPosition !== undefined || style?.background?.backgroundSize !== undefined;
}
/**
* Determine whether there is block support for background.
*
* @param {string} blockName Block name.
* @param {string} feature Background image feature to check for.
*
* @return {boolean} Whether there is support.
*/
function hasBackgroundSupport(blockName, feature = 'any') {
if (external_wp_element_namespaceObject.Platform.OS !== 'web') {
return false;
}
const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, BACKGROUND_SUPPORT_KEY);
if (support === true) {
return true;
}
if (feature === 'any') {
return !!support?.backgroundImage || !!support?.backgroundSize || !!support?.backgroundRepeat;
}
return !!support?.[feature];
}
/**
* Resets the background image block support attributes. This can be used when disabling
* the background image controls for a block via a `ToolsPanel`.
*
* @param {Object} style Style attribute.
* @param {Function} setAttributes Function to set block's attributes.
*/
function resetBackgroundImage(style = {}, setAttributes) {
setAttributes({
style: utils_cleanEmptyObject({
...style,
background: {
...style?.background,
backgroundImage: undefined
}
})
});
}
/**
* Resets the background size block support attributes. This can be used when disabling
* the background size controls for a block via a `ToolsPanel`.
*
* @param {Object} style Style attribute.
* @param {Function} setAttributes Function to set block's attributes.
*/
function resetBackgroundSize(style = {}, setAttributes) {
setAttributes({
style: utils_cleanEmptyObject({
...style,
background: {
...style?.background,
backgroundPosition: undefined,
backgroundRepeat: undefined,
backgroundSize: undefined
}
})
});
}
/**
* Generates a CSS class name if an background image is set.
*
* @param {Object} style A block's style attribute.
*
* @return {string} CSS class name.
*/
function getBackgroundImageClasses(style) {
return hasBackgroundImageValue(style) ? 'has-background' : '';
}
function InspectorImagePreview({
label,
filename,
url: imgUrl
}) {
const imgLabel = label || (0,external_wp_url_namespaceObject.getFilename)(imgUrl);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
as: "span"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "flex-start",
as: "span"
}, (0,external_React_.createElement)("span", {
className: classnames_default()('block-editor-hooks__background__inspector-image-indicator-wrapper', {
'has-image': imgUrl
}),
"aria-hidden": true
}, imgUrl && (0,external_React_.createElement)("span", {
className: "block-editor-hooks__background__inspector-image-indicator",
style: {
backgroundImage: `url(${imgUrl})`
}
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
as: "span"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
numberOfLines: 1,
className: "block-editor-hooks__background__inspector-media-replace-title"
}, imgLabel), (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
as: "span"
}, filename ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: file name */
(0,external_wp_i18n_namespaceObject.__)('Selected image: %s'), filename) : (0,external_wp_i18n_namespaceObject.__)('No image selected')))));
}
function BackgroundImagePanelItem({
clientId,
isShownByDefault,
setAttributes
}) {
const {
style,
mediaUpload
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockAttributes,
getSettings
} = select(store);
return {
style: getBlockAttributes(clientId)?.style,
mediaUpload: getSettings().mediaUpload
};
}, [clientId]);
const {
id,
title,
url
} = style?.background?.backgroundImage || {};
const replaceContainerRef = (0,external_wp_element_namespaceObject.useRef)();
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const onUploadError = message => {
createErrorNotice(message, {
type: 'snackbar'
});
};
const onSelectMedia = media => {
if (!media || !media.url) {
const newStyle = {
...style,
background: {
...style?.background,
backgroundImage: undefined
}
};
const newAttributes = {
style: utils_cleanEmptyObject(newStyle)
};
setAttributes(newAttributes);
return;
}
if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) {
return;
}
// For media selections originated from a file upload.
if (media.media_type && media.media_type !== IMAGE_BACKGROUND_TYPE || !media.media_type && media.type && media.type !== IMAGE_BACKGROUND_TYPE) {
onUploadError((0,external_wp_i18n_namespaceObject.__)('Only images can be used as a background image.'));
return;
}
const newStyle = {
...style,
background: {
...style?.background,
backgroundImage: {
url: media.url,
id: media.id,
source: 'file',
title: media.title || undefined
}
}
};
const newAttributes = {
style: utils_cleanEmptyObject(newStyle)
};
setAttributes(newAttributes);
};
const onFilesDrop = filesList => {
mediaUpload({
allowedTypes: ['image'],
filesList,
onFileChange([image]) {
if ((0,external_wp_blob_namespaceObject.isBlobURL)(image?.url)) {
return;
}
onSelectMedia(image);
},
onError: onUploadError
});
};
const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => {
return {
...previousValue,
style: {
...previousValue.style,
background: undefined
}
};
}, []);
const hasValue = hasBackgroundImageValue(style);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "single-column",
hasValue: () => hasValue,
label: (0,external_wp_i18n_namespaceObject.__)('Background image'),
onDeselect: () => resetBackgroundImage(style, setAttributes),
isShownByDefault: isShownByDefault,
resetAllFilter: resetAllFilter,
panelId: clientId
}, (0,external_React_.createElement)("div", {
className: "block-editor-hooks__background__inspector-media-replace-container",
ref: replaceContainerRef
}, (0,external_React_.createElement)(media_replace_flow, {
mediaId: id,
mediaURL: url,
allowedTypes: [IMAGE_BACKGROUND_TYPE],
accept: "image/*",
onSelect: onSelectMedia,
name: (0,external_React_.createElement)(InspectorImagePreview, {
label: (0,external_wp_i18n_namespaceObject.__)('Background image'),
filename: title,
url: url
}),
variant: "secondary"
}, hasValue && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => {
const [toggleButton] = external_wp_dom_namespaceObject.focus.tabbable.find(replaceContainerRef.current);
// Focus the toggle button and close the dropdown menu.
// This ensures similar behaviour as to selecting an image, where the dropdown is
// closed and focus is redirected to the dropdown toggle button.
toggleButton?.focus();
toggleButton?.click();
resetBackgroundImage(style, setAttributes);
}
}, (0,external_wp_i18n_namespaceObject.__)('Reset '))), (0,external_React_.createElement)(external_wp_components_namespaceObject.DropZone, {
onFilesDrop: onFilesDrop,
label: (0,external_wp_i18n_namespaceObject.__)('Drop to upload')
})));
}
function backgroundSizeHelpText(value) {
if (value === 'cover' || value === undefined) {
return (0,external_wp_i18n_namespaceObject.__)('Image covers the space evenly.');
}
if (value === 'contain') {
return (0,external_wp_i18n_namespaceObject.__)('Image is contained without distortion.');
}
return (0,external_wp_i18n_namespaceObject.__)('Specify a fixed width.');
}
const coordsToBackgroundPosition = value => {
if (!value || isNaN(value.x) && isNaN(value.y)) {
return undefined;
}
const x = isNaN(value.x) ? 0.5 : value.x;
const y = isNaN(value.y) ? 0.5 : value.y;
return `${x * 100}% ${y * 100}%`;
};
const backgroundPositionToCoords = value => {
if (!value) {
return {
x: undefined,
y: undefined
};
}
let [x, y] = value.split(' ').map(v => parseFloat(v) / 100);
x = isNaN(x) ? undefined : x;
y = isNaN(y) ? x : y;
return {
x,
y
};
};
function BackgroundSizePanelItem({
clientId,
isShownByDefault,
setAttributes
}) {
const style = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlockAttributes(clientId)?.style, [clientId]);
const sizeValue = style?.background?.backgroundSize;
const repeatValue = style?.background?.backgroundRepeat;
// An `undefined` value is treated as `cover` by the toggle group control.
// An empty string is treated as `auto` by the toggle group control. This
// allows a user to select "Size" and then enter a custom value, with an
// empty value being treated as `auto`.
const currentValueForToggle = sizeValue !== undefined && sizeValue !== 'cover' && sizeValue !== 'contain' || sizeValue === '' ? 'auto' : sizeValue || 'cover';
// If the current value is `cover` and the repeat value is `undefined`, then
// the toggle should be unchecked as the default state. Otherwise, the toggle
// should reflect the current repeat value.
const repeatCheckedValue = repeatValue === 'no-repeat' || currentValueForToggle === 'cover' && repeatValue === undefined ? false : true;
const hasValue = hasBackgroundSizeValue(style);
const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => {
return {
...previousValue,
style: {
...previousValue.style,
background: {
...previousValue.style?.background,
backgroundRepeat: undefined,
backgroundSize: undefined
}
}
};
}, []);
const updateBackgroundSize = next => {
// When switching to 'contain' toggle the repeat off.
let nextRepeat = repeatValue;
if (next === 'contain') {
nextRepeat = 'no-repeat';
}
if ((currentValueForToggle === 'cover' || currentValueForToggle === 'contain') && next === 'auto') {
nextRepeat = undefined;
}
setAttributes({
style: utils_cleanEmptyObject({
...style,
background: {
...style?.background,
backgroundRepeat: nextRepeat,
backgroundSize: next
}
})
});
};
const updateBackgroundPosition = next => {
setAttributes({
style: utils_cleanEmptyObject({
...style,
background: {
...style?.background,
backgroundPosition: coordsToBackgroundPosition(next)
}
})
});
};
const toggleIsRepeated = () => {
setAttributes({
style: utils_cleanEmptyObject({
...style,
background: {
...style?.background,
backgroundRepeat: repeatCheckedValue === true ? 'no-repeat' : undefined
}
})
});
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
as: external_wp_components_namespaceObject.__experimentalToolsPanelItem,
spacing: 2,
className: "single-column",
hasValue: () => hasValue,
label: (0,external_wp_i18n_namespaceObject.__)('Size'),
onDeselect: () => resetBackgroundSize(style, setAttributes),
isShownByDefault: isShownByDefault,
resetAllFilter: resetAllFilter,
panelId: clientId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.FocalPointPicker, {
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Position'),
url: style?.background?.backgroundImage?.url,
value: backgroundPositionToCoords(style?.background?.backgroundPosition),
onChange: updateBackgroundPosition
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
size: '__unstable-large',
label: (0,external_wp_i18n_namespaceObject.__)('Size'),
value: currentValueForToggle,
onChange: updateBackgroundSize,
isBlock: true,
help: backgroundSizeHelpText(sizeValue)
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
key: 'cover',
value: 'cover',
label: (0,external_wp_i18n_namespaceObject.__)('Cover')
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
key: 'contain',
value: 'contain',
label: (0,external_wp_i18n_namespaceObject.__)('Contain')
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
key: 'fixed',
value: 'auto',
label: (0,external_wp_i18n_namespaceObject.__)('Fixed')
})), sizeValue !== undefined && sizeValue !== 'cover' && sizeValue !== 'contain' ? (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
size: '__unstable-large',
onChange: updateBackgroundSize,
value: sizeValue
}) : null, currentValueForToggle !== 'cover' && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Repeat'),
checked: repeatCheckedValue,
onChange: toggleIsRepeated
}));
}
function BackgroundImagePanel(props) {
const [backgroundImage, backgroundSize] = use_settings_useSettings('background.backgroundImage', 'background.backgroundSize');
if (!backgroundImage || !hasBackgroundSupport(props.name, 'backgroundImage')) {
return null;
}
const showBackgroundSize = !!(backgroundSize && hasBackgroundSupport(props.name, 'backgroundSize'));
const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(props.name, [BACKGROUND_SUPPORT_KEY, '__experimentalDefaultControls']);
return (0,external_React_.createElement)(inspector_controls, {
group: "background"
}, (0,external_React_.createElement)(BackgroundImagePanelItem, {
isShownByDefault: defaultControls?.backgroundImage,
...props
}), showBackgroundSize && (0,external_React_.createElement)(BackgroundSizePanelItem, {
isShownByDefault: defaultControls?.backgroundSize,
...props
}));
}
;// 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<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},colord_j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.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 colord_j?r:new colord_j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(colord_j,y),S.push(r))})},E=function(){return new colord_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));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])}
;// CONCATENATED MODULE: ./node_modules/colord/plugins/a11y.mjs
var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(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}}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal 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 = colors?.find(color => color.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 colors?.find(color => color.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;
}
const {
kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
return `has-${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);
const getColorContrast = ({
color
}) => colordColor.contrast(color);
const maxContrast = Math.max(...colors.map(getColorContrast));
return colors.find(color => getColorContrast(color) === maxContrast).color;
}
;// 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 [enableCustomColors, customColors, themeColors, defaultColors, shouldDisplayDefaultColors, enableCustomGradients, customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients] = use_settings_useSettings('color.custom', 'color.palette.custom', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.customGradient', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients');
const colorGradientSettings = {
disableCustomColors: !enableCustomColors,
disableCustomGradients: !enableCustomGradients
};
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;
}, [customColors, themeColors, defaultColors, shouldDisplayDefaultColors]);
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, shouldDisplayDefaultGradients]);
colorGradientSettings.hasColorsOrGradients = !!colorGradientSettings.colors.length || !!colorGradientSettings.gradients.length;
return colorGradientSettings;
}
;// 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<any>} inputArray Array of items to check.
* @return {any} The item with the most occurrences.
*/
function utils_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 from the current CSS unit selections.
*
* - If a single flat border radius is set, its unit will be used
* - If individual corner selections, the most common of those will be used
* - Failing any unit selections a default of 'px' is returned.
*
* @param {Object} selectedUnits Unit selections for flat radius & each corner.
* @return {string} Most common CSS unit from current selections. Default: `px`.
*/
function getAllUnit(selectedUnits = {}) {
const {
flat,
...cornerUnits
} = selectedUnits;
return flat || utils_mode(Object.values(cornerUnits).filter(Boolean)) || '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(values = {}) {
/**
* 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 = utils_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(values = {}) {
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({
onChange,
selectedUnits,
setSelectedUnits,
values,
...props
}) {
let allValue = getAllValue(values);
if (allValue === undefined) {
// If we don't have any value set the unit to any current selection
// or the most common unit from the individual radii values.
allValue = getAllUnit(selectedUnits);
}
const hasValues = hasDefinedValues(values);
const isMixed = hasValues && hasMixedValues(values);
const allPlaceholder = isMixed ? (0,external_wp_i18n_namespaceObject.__)('Mixed') : null;
// Filter out CSS-unit-only values to prevent invalid styles.
const handleOnChange = next => {
const isNumeric = !isNaN(parseFloat(next));
const nextValue = isNumeric ? next : undefined;
onChange(nextValue);
};
// Store current unit selection for use as fallback for individual
// radii controls.
const handleOnUnitChange = unit => {
setSelectedUnits({
topLeft: unit,
topRight: unit,
bottomLeft: unit,
bottomRight: unit
});
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
...props,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Border radius'),
disableUnits: isMixed,
isOnly: true,
value: allValue,
onChange: handleOnChange,
onUnitChange: handleOnUnitChange,
placeholder: allPlaceholder,
size: '__unstable-large'
});
}
;// 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({
onChange,
selectedUnits,
setSelectedUnits,
values: valuesProp,
...props
}) {
const createHandleOnChange = corner => next => {
if (!onChange) {
return;
}
// Filter out CSS-unit-only values to prevent invalid styles.
const isNumeric = !isNaN(parseFloat(next));
const nextValue = isNumeric ? next : undefined;
onChange({
...values,
[corner]: nextValue
});
};
const createHandleOnUnitChange = side => next => {
const newUnits = {
...selectedUnits
};
newUnits[side] = next;
setSelectedUnits(newUnits);
};
// 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.
// Tooltip rendering also requires the UnitControl to be wrapped. See:
// https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026
return (0,external_React_.createElement)("div", {
className: "components-border-radius-control__input-controls-wrapper"
}, Object.entries(CORNERS).map(([corner, label]) => {
const [parsedQuantity, parsedUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values[corner]);
const computedUnit = values[corner] ? parsedUnit : selectedUnits[corner] || selectedUnits.flat;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, {
text: label,
placement: "top",
key: corner
}, (0,external_React_.createElement)("div", {
className: "components-border-radius-control__tooltip-wrapper"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
...props,
"aria-label": label,
value: [parsedQuantity, computedUnit].join(''),
onChange: createHandleOnChange(corner),
onUnitChange: createHandleOnUnitChange(corner),
size: '__unstable-large'
})));
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js
/**
* WordPress dependencies
*/
const link_link = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"
}));
/* harmony default export */ const library_link = (link_link);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/linked-button.js
/**
* WordPress dependencies
*/
function LinkedButton({
isLinked,
...props
}) {
const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink radii') : (0,external_wp_i18n_namespaceObject.__)('Link radii');
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, {
text: label
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
...props,
className: "component-border-radius-control__linked-button",
size: "small",
icon: isLinked ? library_link : link_off,
iconSize: 24,
"aria-label": label
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/border-radius-control/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const border_radius_control_DEFAULT_VALUES = {
topLeft: undefined,
topRight: undefined,
bottomLeft: undefined,
bottomRight: undefined
};
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 {Element} Custom border radius control.
*/
function BorderRadiusControl({
onChange,
values
}) {
const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)(!hasDefinedValues(values) || !hasMixedValues(values));
// Tracking selected units via internal state allows filtering of CSS unit
// only values from being saved while maintaining preexisting unit selection
// behaviour. Filtering CSS unit only values prevents invalid style values.
const [selectedUnits, setSelectedUnits] = (0,external_wp_element_namespaceObject.useState)({
flat: typeof values === 'string' ? (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values)[1] : undefined,
topLeft: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.topLeft)[1],
topRight: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.topRight)[1],
bottomLeft: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.bottomLeft)[1],
bottomRight: (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(values?.bottomRight)[1]
});
const [availableUnits] = use_settings_useSettings('spacing.units');
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: availableUnits || ['px', 'em', 'rem']
});
const unit = getAllUnit(selectedUnits);
const unitConfig = units && units.find(item => item.value === unit);
const step = 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_React_.createElement)("fieldset", {
className: "components-border-radius-control"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
as: "legend"
}, (0,external_wp_i18n_namespaceObject.__)('Radius')), (0,external_React_.createElement)("div", {
className: "components-border-radius-control__wrapper"
}, isLinked ? (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(AllInputControl, {
className: "components-border-radius-control__unit-control",
values: values,
min: MIN_BORDER_RADIUS_VALUE,
onChange: onChange,
selectedUnits: selectedUnits,
setSelectedUnits: setSelectedUnits,
units: units
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.RangeControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Border radius'),
hideLabelFromVision: true,
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,
__nextHasNoMarginBottom: true
})) : (0,external_React_.createElement)(BoxInputControls, {
min: MIN_BORDER_RADIUS_VALUE,
onChange: onChange,
selectedUnits: selectedUnits,
setSelectedUnits: setSelectedUnits,
values: values || border_radius_control_DEFAULT_VALUES,
units: units
}), (0,external_React_.createElement)(LinkedButton, {
onClick: toggleLinked,
isLinked: isLinked
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
/**
* WordPress dependencies
*/
const check_check = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const library_check = (check_check);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/shadow.js
/**
* WordPress dependencies
*/
const shadow = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z"
}));
/* harmony default export */ const library_shadow = (shadow);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/shadow-panel-components.js
/**
* WordPress dependencies
*/
/**
* External 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 shadow_panel_components_EMPTY_ARRAY = [];
function ShadowPopoverContainer({
shadow,
onShadowChange,
settings
}) {
const shadows = useShadowPresets(settings);
return (0,external_React_.createElement)("div", {
className: "block-editor-global-styles__shadow-popover-container"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 4
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
level: 5
}, (0,external_wp_i18n_namespaceObject.__)('Drop shadow')), (0,external_React_.createElement)(ShadowPresets, {
presets: shadows,
activeShadow: shadow,
onSelect: onShadowChange
}), (0,external_React_.createElement)("div", {
className: "block-editor-global-styles__clear-shadow"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: () => onShadowChange(undefined)
}, (0,external_wp_i18n_namespaceObject.__)('Clear')))));
}
function ShadowPresets({
presets,
activeShadow,
onSelect
}) {
const {
CompositeV2: Composite,
useCompositeStoreV2: useCompositeStore
} = unlock(external_wp_components_namespaceObject.privateApis);
const compositeStore = useCompositeStore();
return !presets ? null : (0,external_React_.createElement)(Composite, {
store: compositeStore,
role: "listbox",
className: "block-editor-global-styles__shadow__list",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Drop shadows')
}, presets.map(({
name,
slug,
shadow
}) => (0,external_React_.createElement)(ShadowIndicator, {
key: slug,
label: name,
isActive: shadow === activeShadow,
type: slug === 'unset' ? 'unset' : 'preset',
onSelect: () => onSelect(shadow === activeShadow ? undefined : shadow),
shadow: shadow
})));
}
function ShadowIndicator({
type,
label,
isActive,
onSelect,
shadow
}) {
const {
CompositeItemV2: CompositeItem
} = unlock(external_wp_components_namespaceObject.privateApis);
return (0,external_React_.createElement)(CompositeItem, {
role: "option",
"aria-label": label,
"aria-selected": isActive,
className: classnames_default()('block-editor-global-styles__shadow__item', {
'is-active': isActive
}),
render: (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
className: classnames_default()('block-editor-global-styles__shadow-indicator', {
unset: type === 'unset'
}),
onClick: onSelect,
label: label,
style: {
boxShadow: shadow
},
showTooltip: true
}, isActive && (0,external_React_.createElement)(build_module_icon, {
icon: library_check
}))
});
}
function ShadowPopover({
shadow,
onShadowChange,
settings
}) {
const popoverProps = {
placement: 'left-start',
offset: 36,
shift: true
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: popoverProps,
className: "block-editor-global-styles__shadow-dropdown",
renderToggle: renderShadowToggle(),
renderContent: () => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, {
paddingSize: "medium"
}, (0,external_React_.createElement)(ShadowPopoverContainer, {
shadow: shadow,
onShadowChange: onShadowChange,
settings: settings
}))
});
}
function renderShadowToggle() {
return ({
onToggle,
isOpen
}) => {
const toggleProps = {
onClick: onToggle,
className: classnames_default()({
'is-open': isOpen
}),
'aria-expanded': isOpen
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
...toggleProps
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "flex-start"
}, (0,external_React_.createElement)(build_module_icon, {
className: "block-editor-global-styles__toggle-icon",
icon: library_shadow,
size: 24
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Drop shadow'))));
};
}
function useShadowPresets(settings) {
return (0,external_wp_element_namespaceObject.useMemo)(() => {
var _settings$shadow$pres;
if (!settings?.shadow) {
return shadow_panel_components_EMPTY_ARRAY;
}
const defaultPresetsEnabled = settings?.shadow?.defaultPresets;
const {
default: defaultShadows,
theme: themeShadows
} = (_settings$shadow$pres = settings?.shadow?.presets) !== null && _settings$shadow$pres !== void 0 ? _settings$shadow$pres : {};
const unsetShadow = {
name: (0,external_wp_i18n_namespaceObject.__)('Unset'),
slug: 'unset',
shadow: 'none'
};
const shadowPresets = [...(defaultPresetsEnabled && defaultShadows || shadow_panel_components_EMPTY_ARRAY), ...(themeShadows || shadow_panel_components_EMPTY_ARRAY)];
if (shadowPresets.length) {
shadowPresets.unshift(unsetShadow);
}
return shadowPresets;
}, [settings]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/border-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useHasBorderPanel(settings) {
const controls = Object.values(useHasBorderPanelControls(settings));
return controls.some(Boolean);
}
function useHasBorderPanelControls(settings) {
const controls = {
hasBorderColor: useHasBorderColorControl(settings),
hasBorderRadius: useHasBorderRadiusControl(settings),
hasBorderStyle: useHasBorderStyleControl(settings),
hasBorderWidth: useHasBorderWidthControl(settings),
hasShadow: useHasShadowControl(settings)
};
return controls;
}
function useHasBorderColorControl(settings) {
return settings?.border?.color;
}
function useHasBorderRadiusControl(settings) {
return settings?.border?.radius;
}
function useHasBorderStyleControl(settings) {
return settings?.border?.style;
}
function useHasBorderWidthControl(settings) {
return settings?.border?.width;
}
function useHasShadowControl(settings) {
const shadows = useShadowPresets(settings);
return !!settings?.shadow && shadows.length > 0;
}
function BorderToolsPanel({
resetAllFilter,
onChange,
value,
panelId,
children,
label
}) {
const resetAll = () => {
const updatedValue = resetAllFilter(value);
onChange(updatedValue);
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
label: label,
resetAll: resetAll,
panelId: panelId,
dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS
}, children);
}
const border_panel_DEFAULT_CONTROLS = {
radius: true,
color: true,
width: true,
shadow: false
};
function BorderPanel({
as: Wrapper = BorderToolsPanel,
value,
onChange,
inheritedValue = value,
settings,
panelId,
name,
defaultControls = border_panel_DEFAULT_CONTROLS
}) {
var _settings$shadow$pres, _overrideOrigins;
const colors = useColorsPerOrigin(settings);
const decodeValue = (0,external_wp_element_namespaceObject.useCallback)(rawValue => getValueFromVariable({
settings
}, '', rawValue), [settings]);
const encodeColorValue = colorValue => {
const allColors = colors.flatMap(({
colors: originColors
}) => originColors);
const colorObject = allColors.find(({
color
}) => color === colorValue);
return colorObject ? 'var:preset|color|' + colorObject.slug : colorValue;
};
const border = (0,external_wp_element_namespaceObject.useMemo)(() => {
if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(inheritedValue?.border)) {
const borderValue = {
...inheritedValue?.border
};
['top', 'right', 'bottom', 'left'].forEach(side => {
borderValue[side] = {
...borderValue[side],
color: decodeValue(borderValue[side]?.color)
};
});
return borderValue;
}
return {
...inheritedValue?.border,
color: inheritedValue?.border?.color ? decodeValue(inheritedValue?.border?.color) : undefined
};
}, [inheritedValue?.border, decodeValue]);
const setBorder = newBorder => onChange({
...value,
border: newBorder
});
const showBorderColor = useHasBorderColorControl(settings);
const showBorderStyle = useHasBorderStyleControl(settings);
const showBorderWidth = useHasBorderWidthControl(settings);
// Border radius.
const showBorderRadius = useHasBorderRadiusControl(settings);
const borderRadiusValues = decodeValue(border?.radius);
const setBorderRadius = newBorderRadius => setBorder({
...border,
radius: newBorderRadius
});
const hasBorderRadius = () => {
const borderValues = value?.border?.radius;
if (typeof borderValues === 'object') {
return Object.entries(borderValues).some(Boolean);
}
return !!borderValues;
};
const hasShadowControl = useHasShadowControl(settings);
// Shadow
const shadow = decodeValue(inheritedValue?.shadow);
const shadowPresets = (_settings$shadow$pres = settings?.shadow?.presets) !== null && _settings$shadow$pres !== void 0 ? _settings$shadow$pres : {};
const overriddenShadowPresets = (_overrideOrigins = overrideOrigins(shadowPresets)) !== null && _overrideOrigins !== void 0 ? _overrideOrigins : [];
const setShadow = newValue => {
const slug = overriddenShadowPresets?.find(({
shadow: shadowName
}) => shadowName === newValue)?.slug;
onChange(setImmutably(value, ['shadow'], slug ? `var:preset|shadow|${slug}` : newValue || undefined));
};
const hasShadow = () => !!value?.shadow;
const resetShadow = () => setShadow(undefined);
const resetBorder = () => {
if (hasBorderRadius()) {
return setBorder({
radius: value?.border?.radius
});
}
setBorder(undefined);
};
const onBorderChange = newBorder => {
// Ensure we have a visible border style when a border width or
// color is being selected.
const updatedBorder = {
...newBorder
};
if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(updatedBorder)) {
['top', 'right', 'bottom', 'left'].forEach(side => {
if (updatedBorder[side]) {
updatedBorder[side] = {
...updatedBorder[side],
color: encodeColorValue(updatedBorder[side]?.color)
};
}
});
} else if (updatedBorder) {
updatedBorder.color = encodeColorValue(updatedBorder.color);
}
// As radius is maintained separately to color, style, and width
// maintain its value. Undefined values here will be cleaned when
// global styles are saved.
setBorder({
radius: border?.radius,
...updatedBorder
});
};
const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => {
return {
...previousValue,
border: undefined,
shadow: undefined
};
}, []);
const showBorderByDefault = defaultControls?.color || defaultControls?.width;
const hasBorderControl = showBorderColor || showBorderStyle || showBorderWidth || showBorderRadius;
const label = useBorderPanelLabel({
blockName: name,
hasShadowControl,
hasBorderControl
});
return (0,external_React_.createElement)(Wrapper, {
resetAllFilter: resetAllFilter,
value: value,
onChange: onChange,
panelId: panelId,
label: label
}, (showBorderWidth || showBorderColor) && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => (0,external_wp_components_namespaceObject.__experimentalIsDefinedBorder)(value?.border),
label: (0,external_wp_i18n_namespaceObject.__)('Border'),
onDeselect: () => resetBorder(),
isShownByDefault: showBorderByDefault,
panelId: panelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalBorderBoxControl, {
colors: colors,
enableAlpha: true,
enableStyle: showBorderStyle,
onChange: onBorderChange,
popoverOffset: 40,
popoverPlacement: "left-start",
value: border,
__experimentalIsRenderedInSidebar: true,
size: '__unstable-large',
hideLabelFromVision: !hasShadowControl,
label: (0,external_wp_i18n_namespaceObject.__)('Border')
})), showBorderRadius && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: hasBorderRadius,
label: (0,external_wp_i18n_namespaceObject.__)('Radius'),
onDeselect: () => setBorderRadius(undefined),
isShownByDefault: defaultControls.radius,
panelId: panelId
}, (0,external_React_.createElement)(BorderRadiusControl, {
values: borderRadiusValues,
onChange: newValue => {
setBorderRadius(newValue || undefined);
}
})), hasShadowControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Shadow'),
hasValue: hasShadow,
onDeselect: resetShadow,
isShownByDefault: defaultControls.shadow,
panelId: panelId
}, hasBorderControl ? (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
as: "legend"
}, (0,external_wp_i18n_namespaceObject.__)('Shadow')) : null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
isBordered: true,
isSeparated: true
}, (0,external_React_.createElement)(ShadowPopover, {
shadow: shadow,
onShadowChange: setShadow,
settings: settings
}))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/border.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const BORDER_SUPPORT_KEY = '__experimentalBorder';
const SHADOW_SUPPORT_KEY = 'shadow';
const getColorByProperty = (colors, property, value) => {
let matchedColor;
colors.some(origin => origin.colors.some(color => {
if (color[property] === value) {
matchedColor = color;
return true;
}
return false;
}));
return matchedColor;
};
const getMultiOriginColor = ({
colors,
namedColor,
customColor
}) => {
// Search each origin (default, theme, or user) for matching color by name.
if (namedColor) {
const colorObject = getColorByProperty(colors, 'slug', namedColor);
if (colorObject) {
return colorObject;
}
}
// Skip if no custom color or matching named color.
if (!customColor) {
return {
color: undefined
};
}
// Attempt to find color via custom color value or build new object.
const colorObject = getColorByProperty(colors, 'color', customColor);
return colorObject ? colorObject : {
color: customColor
};
};
function getColorSlugFromVariable(value) {
const namedColor = /var:preset\|color\|(.+)/.exec(value);
if (namedColor && namedColor[1]) {
return namedColor[1];
}
return null;
}
function styleToAttributes(style) {
if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(style?.border)) {
return {
style,
borderColor: undefined
};
}
const borderColorValue = style?.border?.color;
const borderColorSlug = borderColorValue?.startsWith('var:preset|color|') ? borderColorValue.substring('var:preset|color|'.length) : undefined;
const updatedStyle = {
...style
};
updatedStyle.border = {
...updatedStyle.border,
color: borderColorSlug ? undefined : borderColorValue
};
return {
style: utils_cleanEmptyObject(updatedStyle),
borderColor: borderColorSlug
};
}
function attributesToStyle(attributes) {
if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(attributes.style?.border)) {
return attributes.style;
}
return {
...attributes.style,
border: {
...attributes.style?.border,
color: attributes.borderColor ? 'var:preset|color|' + attributes.borderColor : attributes.style?.border?.color
}
};
}
function BordersInspectorControl({
label,
children,
resetAllFilter
}) {
const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(attributes => {
const existingStyle = attributesToStyle(attributes);
const updatedStyle = resetAllFilter(existingStyle);
return {
...attributes,
...styleToAttributes(updatedStyle)
};
}, [resetAllFilter]);
return (0,external_React_.createElement)(inspector_controls, {
group: "border",
resetAllFilter: attributesResetAllFilter,
label: label
}, children);
}
function border_BorderPanel({
clientId,
name,
setAttributes,
settings
}) {
const isEnabled = useHasBorderPanel(settings);
function selector(select) {
const {
style,
borderColor
} = select(store).getBlockAttributes(clientId) || {};
return {
style,
borderColor
};
}
const {
style,
borderColor
} = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId]);
const value = (0,external_wp_element_namespaceObject.useMemo)(() => {
return attributesToStyle({
style,
borderColor
});
}, [style, borderColor]);
const onChange = newStyle => {
setAttributes(styleToAttributes(newStyle));
};
if (!isEnabled) {
return null;
}
const defaultControls = {
...(0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [BORDER_SUPPORT_KEY, '__experimentalDefaultControls']),
...(0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [SHADOW_SUPPORT_KEY, '__experimentalDefaultControls'])
};
return (0,external_React_.createElement)(BorderPanel, {
as: BordersInspectorControl,
panelId: clientId,
settings: settings,
value: value,
onChange: onChange,
defaultControls: defaultControls
});
}
/**
* 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_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?.color || support?.radius || support?.width || support?.style);
}
return !!support?.[feature];
}
/**
* Determine whether there is block support for shadow properties.
*
* @param {string} blockName Block name.
*
* @return {boolean} Whether there is support.
*/
function hasShadowSupport(blockName) {
return hasBlockSupport(blockName, SHADOW_SUPPORT_KEY);
}
function useBorderPanelLabel({
blockName,
hasBorderControl,
hasShadowControl
} = {}) {
const settings = useBlockSettings(blockName);
const controls = useHasBorderPanelControls(settings);
if (!hasBorderControl && !hasShadowControl && blockName) {
hasBorderControl = controls?.hasBorderColor || controls?.hasBorderStyle || controls?.hasBorderWidth || controls?.hasBorderRadius;
hasShadowControl = controls?.hasShadow;
}
if (hasBorderControl && hasShadowControl) {
return (0,external_wp_i18n_namespaceObject.__)('Border & Shadow');
}
if (hasShadowControl) {
return (0,external_wp_i18n_namespaceObject.__)('Shadow');
}
return (0,external_wp_i18n_namespaceObject.__)('Border');
}
/**
* 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?.border,
[attribute]: undefined
}
});
}
/**
* 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|string} blockNameOrType Block type definition.
* @param {Object} attributes Block's attributes.
*
* @return {Object} Filtered props to apply to save element.
*/
function border_addSaveProps(props, blockNameOrType, attributes) {
if (!hasBorderSupport(blockNameOrType, 'color') || shouldSkipSerialization(blockNameOrType, BORDER_SUPPORT_KEY, 'color')) {
return props;
}
const borderClasses = getBorderClasses(attributes);
const newClassName = classnames_default()(props.className, borderClasses);
// 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;
}
/**
* Generates a CSS class name consisting of all the applicable border color
* classes given the current block attributes.
*
* @param {Object} attributes Block's attributes.
*
* @return {string} CSS class name.
*/
function getBorderClasses(attributes) {
const {
borderColor,
style
} = attributes;
const borderColorClass = getColorClassName('border-color', borderColor);
return classnames_default()({
'has-border-color': borderColor || style?.border?.color,
[borderColorClass]: !!borderColorClass
});
}
function border_useBlockProps({
name,
borderColor,
style
}) {
const {
colors
} = useMultipleOriginColorsAndGradients();
if (!hasBorderSupport(name, 'color') || shouldSkipSerialization(name, BORDER_SUPPORT_KEY, 'color')) {
return {};
}
const {
color: borderColorValue
} = getMultiOriginColor({
colors,
namedColor: borderColor
});
const {
color: borderTopColor
} = getMultiOriginColor({
colors,
namedColor: getColorSlugFromVariable(style?.border?.top?.color)
});
const {
color: borderRightColor
} = getMultiOriginColor({
colors,
namedColor: getColorSlugFromVariable(style?.border?.right?.color)
});
const {
color: borderBottomColor
} = getMultiOriginColor({
colors,
namedColor: getColorSlugFromVariable(style?.border?.bottom?.color)
});
const {
color: borderLeftColor
} = getMultiOriginColor({
colors,
namedColor: getColorSlugFromVariable(style?.border?.left?.color)
});
const extraStyles = {
borderTopColor: borderTopColor || borderColorValue,
borderRightColor: borderRightColor || borderColorValue,
borderBottomColor: borderBottomColor || borderColorValue,
borderLeftColor: borderLeftColor || borderColorValue
};
return border_addSaveProps({
style: utils_cleanEmptyObject(extraStyles) || {}
}, name, {
borderColor,
style
});
}
/* harmony default export */ const border = ({
useBlockProps: border_useBlockProps,
addSaveProps: border_addSaveProps,
attributeKeys: ['borderColor', 'style'],
hasSupport(name) {
return hasBorderSupport(name, 'color');
}
});
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/border/addAttributes', addAttributes);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradients/use-gradient.js
/**
* 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 = gradients?.find(g => g.slug === slug);
return gradient && gradient.gradient;
}
function __experimentalGetGradientObjectByGradientValue(gradients, value) {
const gradient = gradients?.find(g => g.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 [userGradientPalette, themeGradientPalette, defaultGradientPalette] = use_settings_useSettings('color.gradients.custom', 'color.gradients.theme', '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/colors-gradients/control.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients'];
const TAB_IDS = {
color: 'color',
gradient: 'gradient'
};
function ColorGradientControlInner({
colors,
gradients,
disableCustomColors,
disableCustomGradients,
__experimentalIsRenderedInSidebar,
className,
label,
onColorChange,
onGradientChange,
colorValue,
gradientValue,
clearable,
showTitle = true,
enableAlpha,
headingLevel
}) {
const canChooseAColor = onColorChange && (colors && colors.length > 0 || !disableCustomColors);
const canChooseAGradient = onGradientChange && (gradients && gradients.length > 0 || !disableCustomGradients);
if (!canChooseAColor && !canChooseAGradient) {
return null;
}
const tabPanels = {
[TAB_IDS.color]: (0,external_React_.createElement)(external_wp_components_namespaceObject.ColorPalette, {
value: colorValue,
onChange: canChooseAGradient ? newColor => {
onColorChange(newColor);
onGradientChange();
} : onColorChange,
colors,
disableCustomColors,
__experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
clearable: clearable,
enableAlpha: enableAlpha,
headingLevel: headingLevel
}),
[TAB_IDS.gradient]: (0,external_React_.createElement)(external_wp_components_namespaceObject.GradientPicker, {
value: gradientValue,
onChange: canChooseAColor ? newGradient => {
onGradientChange(newGradient);
onColorChange();
} : onGradientChange,
gradients,
disableCustomGradients,
__experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
clearable: clearable,
headingLevel: headingLevel
})
};
const renderPanelType = type => (0,external_React_.createElement)("div", {
className: "block-editor-color-gradient-control__panel"
}, tabPanels[type]);
// Unlocking `Tabs` too early causes the `unlock` method to receive an empty
// object, due to circular dependencies.
// See https://github.com/WordPress/gutenberg/issues/52692
const {
Tabs
} = unlock(external_wp_components_namespaceObject.privateApis);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl, {
__nextHasNoMarginBottom: true,
className: classnames_default()('block-editor-color-gradient-control', className)
}, (0,external_React_.createElement)("fieldset", {
className: "block-editor-color-gradient-control__fieldset"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 1
}, showTitle && (0,external_React_.createElement)("legend", null, (0,external_React_.createElement)("div", {
className: "block-editor-color-gradient-control__color-indicator"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, null, label))), canChooseAColor && canChooseAGradient && (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(Tabs, {
initialTabId: gradientValue ? TAB_IDS.gradient : !!canChooseAColor && TAB_IDS.color
}, (0,external_React_.createElement)(Tabs.TabList, null, (0,external_React_.createElement)(Tabs.Tab, {
tabId: TAB_IDS.color
}, (0,external_wp_i18n_namespaceObject.__)('Solid')), (0,external_React_.createElement)(Tabs.Tab, {
tabId: TAB_IDS.gradient
}, (0,external_wp_i18n_namespaceObject.__)('Gradient'))), (0,external_React_.createElement)(Tabs.TabPanel, {
tabId: TAB_IDS.color,
className: 'block-editor-color-gradient-control__panel',
focusable: false
}, tabPanels.color), (0,external_React_.createElement)(Tabs.TabPanel, {
tabId: TAB_IDS.gradient,
className: 'block-editor-color-gradient-control__panel',
focusable: false
}, tabPanels.gradient))), !canChooseAGradient && renderPanelType(TAB_IDS.color), !canChooseAColor && renderPanelType(TAB_IDS.gradient))));
}
function ColorGradientControlSelect(props) {
const [colors, gradients, customColors, customGradients] = use_settings_useSettings('color.palette', 'color.gradients', 'color.custom', 'color.customGradient');
return (0,external_React_.createElement)(ColorGradientControlInner, {
colors: colors,
gradients: gradients,
disableCustomColors: !customColors,
disableCustomGradients: !customGradients,
...props
});
}
function ColorGradientControl(props) {
if (colorsAndGradientKeys.every(key => props.hasOwnProperty(key))) {
return (0,external_React_.createElement)(ColorGradientControlInner, {
...props
});
}
return (0,external_React_.createElement)(ColorGradientControlSelect, {
...props
});
}
/* harmony default export */ const control = (ColorGradientControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/color-panel.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useHasColorPanel(settings) {
const hasTextPanel = useHasTextPanel(settings);
const hasBackgroundPanel = useHasBackgroundPanel(settings);
const hasLinkPanel = useHasLinkPanel(settings);
const hasHeadingPanel = useHasHeadingPanel(settings);
const hasButtonPanel = useHasButtonPanel(settings);
const hasCaptionPanel = useHasCaptionPanel(settings);
return hasTextPanel || hasBackgroundPanel || hasLinkPanel || hasHeadingPanel || hasButtonPanel || hasCaptionPanel;
}
function useHasTextPanel(settings) {
const colors = useColorsPerOrigin(settings);
return settings?.color?.text && (colors?.length > 0 || settings?.color?.custom);
}
function useHasLinkPanel(settings) {
const colors = useColorsPerOrigin(settings);
return settings?.color?.link && (colors?.length > 0 || settings?.color?.custom);
}
function useHasCaptionPanel(settings) {
const colors = useColorsPerOrigin(settings);
return settings?.color?.caption && (colors?.length > 0 || settings?.color?.custom);
}
function useHasHeadingPanel(settings) {
const colors = useColorsPerOrigin(settings);
const gradients = useGradientsPerOrigin(settings);
return settings?.color?.heading && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient);
}
function useHasButtonPanel(settings) {
const colors = useColorsPerOrigin(settings);
const gradients = useGradientsPerOrigin(settings);
return settings?.color?.button && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient);
}
function useHasBackgroundPanel(settings) {
const colors = useColorsPerOrigin(settings);
const gradients = useGradientsPerOrigin(settings);
return settings?.color?.background && (colors?.length > 0 || settings?.color?.custom || gradients?.length > 0 || settings?.color?.customGradient);
}
function ColorToolsPanel({
resetAllFilter,
onChange,
value,
panelId,
children
}) {
const resetAll = () => {
const updatedValue = resetAllFilter(value);
onChange(updatedValue);
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
label: (0,external_wp_i18n_namespaceObject.__)('Color'),
resetAll: resetAll,
panelId: panelId,
hasInnerWrapper: true,
className: "color-block-support-panel",
__experimentalFirstVisibleItemClass: "first",
__experimentalLastVisibleItemClass: "last",
dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS
}, (0,external_React_.createElement)("div", {
className: "color-block-support-panel__inner-wrapper"
}, children));
}
const color_panel_DEFAULT_CONTROLS = {
text: true,
background: true,
link: true,
heading: true,
button: true,
caption: true
};
const popoverProps = {
placement: 'left-start',
offset: 36,
shift: true
};
const LabeledColorIndicators = ({
indicators,
label
}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "flex-start"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalZStack, {
isLayered: false,
offset: -8
}, indicators.map((indicator, index) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
key: index,
expanded: false
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
colorValue: indicator
})))), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
className: "block-editor-panel-color-gradient-settings__color-name",
title: label
}, label));
function ColorPanelTab({
isGradient,
inheritedValue,
userValue,
setValue,
colorGradientControlSettings
}) {
return (0,external_React_.createElement)(control, {
...colorGradientControlSettings,
showTitle: false,
enableAlpha: true,
__experimentalIsRenderedInSidebar: true,
colorValue: isGradient ? undefined : inheritedValue,
gradientValue: isGradient ? inheritedValue : undefined,
onColorChange: isGradient ? undefined : setValue,
onGradientChange: isGradient ? setValue : undefined,
clearable: inheritedValue === userValue,
headingLevel: 3
});
}
function ColorPanelDropdown({
label,
hasValue,
resetValue,
isShownByDefault,
indicators,
tabs,
colorGradientControlSettings,
panelId
}) {
const currentTab = tabs.find(tab => tab.userValue !== undefined);
// Unlocking `Tabs` too early causes the `unlock` method to receive an empty
// object, due to circular dependencies.
// See https://github.com/WordPress/gutenberg/issues/52692
const {
Tabs
} = unlock(external_wp_components_namespaceObject.privateApis);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "block-editor-tools-panel-color-gradient-settings__item",
hasValue: hasValue,
label: label,
onDeselect: resetValue,
isShownByDefault: isShownByDefault,
panelId: panelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: popoverProps,
className: "block-editor-tools-panel-color-gradient-settings__dropdown",
renderToggle: ({
onToggle,
isOpen
}) => {
const toggleProps = {
onClick: onToggle,
className: classnames_default()('block-editor-panel-color-gradient-settings__dropdown', {
'is-open': isOpen
}),
'aria-expanded': isOpen,
'aria-label': (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s is the type of color property, e.g., "background" */
(0,external_wp_i18n_namespaceObject.__)('Color %s styles'), label)
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
...toggleProps
}, (0,external_React_.createElement)(LabeledColorIndicators, {
indicators: indicators,
label: label
}));
},
renderContent: () => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, {
paddingSize: "none"
}, (0,external_React_.createElement)("div", {
className: "block-editor-panel-color-gradient-settings__dropdown-content"
}, tabs.length === 1 && (0,external_React_.createElement)(ColorPanelTab, {
...tabs[0],
colorGradientControlSettings: colorGradientControlSettings
}), tabs.length > 1 && (0,external_React_.createElement)(Tabs, {
initialTabId: currentTab?.key
}, (0,external_React_.createElement)(Tabs.TabList, null, tabs.map(tab => (0,external_React_.createElement)(Tabs.Tab, {
key: tab.key,
tabId: tab.key
}, tab.label))), tabs.map(tab => {
return (0,external_React_.createElement)(Tabs.TabPanel, {
key: tab.key,
tabId: tab.key,
focusable: false
}, (0,external_React_.createElement)(ColorPanelTab, {
...tab,
colorGradientControlSettings: colorGradientControlSettings
}));
}))))
}));
}
function ColorPanel({
as: Wrapper = ColorToolsPanel,
value,
onChange,
inheritedValue = value,
settings,
panelId,
defaultControls = color_panel_DEFAULT_CONTROLS,
children
}) {
const colors = useColorsPerOrigin(settings);
const gradients = useGradientsPerOrigin(settings);
const areCustomSolidsEnabled = settings?.color?.custom;
const areCustomGradientsEnabled = settings?.color?.customGradient;
const hasSolidColors = colors.length > 0 || areCustomSolidsEnabled;
const hasGradientColors = gradients.length > 0 || areCustomGradientsEnabled;
const decodeValue = rawValue => getValueFromVariable({
settings
}, '', rawValue);
const encodeColorValue = colorValue => {
const allColors = colors.flatMap(({
colors: originColors
}) => originColors);
const colorObject = allColors.find(({
color
}) => color === colorValue);
return colorObject ? 'var:preset|color|' + colorObject.slug : colorValue;
};
const encodeGradientValue = gradientValue => {
const allGradients = gradients.flatMap(({
gradients: originGradients
}) => originGradients);
const gradientObject = allGradients.find(({
gradient
}) => gradient === gradientValue);
return gradientObject ? 'var:preset|gradient|' + gradientObject.slug : gradientValue;
};
// BackgroundColor
const showBackgroundPanel = useHasBackgroundPanel(settings);
const backgroundColor = decodeValue(inheritedValue?.color?.background);
const userBackgroundColor = decodeValue(value?.color?.background);
const gradient = decodeValue(inheritedValue?.color?.gradient);
const userGradient = decodeValue(value?.color?.gradient);
const hasBackground = () => !!userBackgroundColor || !!userGradient;
const setBackgroundColor = newColor => {
const newValue = setImmutably(value, ['color', 'background'], encodeColorValue(newColor));
newValue.color.gradient = undefined;
onChange(newValue);
};
const setGradient = newGradient => {
const newValue = setImmutably(value, ['color', 'gradient'], encodeGradientValue(newGradient));
newValue.color.background = undefined;
onChange(newValue);
};
const resetBackground = () => {
const newValue = setImmutably(value, ['color', 'background'], undefined);
newValue.color.gradient = undefined;
onChange(newValue);
};
// Links
const showLinkPanel = useHasLinkPanel(settings);
const linkColor = decodeValue(inheritedValue?.elements?.link?.color?.text);
const userLinkColor = decodeValue(value?.elements?.link?.color?.text);
const setLinkColor = newColor => {
onChange(setImmutably(value, ['elements', 'link', 'color', 'text'], encodeColorValue(newColor)));
};
const hoverLinkColor = decodeValue(inheritedValue?.elements?.link?.[':hover']?.color?.text);
const userHoverLinkColor = decodeValue(value?.elements?.link?.[':hover']?.color?.text);
const setHoverLinkColor = newColor => {
onChange(setImmutably(value, ['elements', 'link', ':hover', 'color', 'text'], encodeColorValue(newColor)));
};
const hasLink = () => !!userLinkColor || !!userHoverLinkColor;
const resetLink = () => {
let newValue = setImmutably(value, ['elements', 'link', ':hover', 'color', 'text'], undefined);
newValue = setImmutably(newValue, ['elements', 'link', 'color', 'text'], undefined);
onChange(newValue);
};
// Text Color
const showTextPanel = useHasTextPanel(settings);
const textColor = decodeValue(inheritedValue?.color?.text);
const userTextColor = decodeValue(value?.color?.text);
const hasTextColor = () => !!userTextColor;
const setTextColor = newColor => {
let changedObject = setImmutably(value, ['color', 'text'], encodeColorValue(newColor));
if (textColor === linkColor) {
changedObject = setImmutably(changedObject, ['elements', 'link', 'color', 'text'], encodeColorValue(newColor));
}
onChange(changedObject);
};
const resetTextColor = () => setTextColor(undefined);
// Elements
const elements = [{
name: 'caption',
label: (0,external_wp_i18n_namespaceObject.__)('Captions'),
showPanel: useHasCaptionPanel(settings)
}, {
name: 'button',
label: (0,external_wp_i18n_namespaceObject.__)('Button'),
showPanel: useHasButtonPanel(settings)
}, {
name: 'heading',
label: (0,external_wp_i18n_namespaceObject.__)('Heading'),
showPanel: useHasHeadingPanel(settings)
}, {
name: 'h1',
label: (0,external_wp_i18n_namespaceObject.__)('H1'),
showPanel: useHasHeadingPanel(settings)
}, {
name: 'h2',
label: (0,external_wp_i18n_namespaceObject.__)('H2'),
showPanel: useHasHeadingPanel(settings)
}, {
name: 'h3',
label: (0,external_wp_i18n_namespaceObject.__)('H3'),
showPanel: useHasHeadingPanel(settings)
}, {
name: 'h4',
label: (0,external_wp_i18n_namespaceObject.__)('H4'),
showPanel: useHasHeadingPanel(settings)
}, {
name: 'h5',
label: (0,external_wp_i18n_namespaceObject.__)('H5'),
showPanel: useHasHeadingPanel(settings)
}, {
name: 'h6',
label: (0,external_wp_i18n_namespaceObject.__)('H6'),
showPanel: useHasHeadingPanel(settings)
}];
const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => {
return {
...previousValue,
color: undefined,
elements: {
...previousValue?.elements,
link: {
...previousValue?.elements?.link,
color: undefined,
':hover': {
color: undefined
}
},
...elements.reduce((acc, element) => {
return {
...acc,
[element.name]: {
...previousValue?.elements?.[element.name],
color: undefined
}
};
}, {})
}
};
}, []);
const items = [showTextPanel && {
key: 'text',
label: (0,external_wp_i18n_namespaceObject.__)('Text'),
hasValue: hasTextColor,
resetValue: resetTextColor,
isShownByDefault: defaultControls.text,
indicators: [textColor],
tabs: [{
key: 'text',
label: (0,external_wp_i18n_namespaceObject.__)('Text'),
inheritedValue: textColor,
setValue: setTextColor,
userValue: userTextColor
}]
}, showBackgroundPanel && {
key: 'background',
label: (0,external_wp_i18n_namespaceObject.__)('Background'),
hasValue: hasBackground,
resetValue: resetBackground,
isShownByDefault: defaultControls.background,
indicators: [gradient !== null && gradient !== void 0 ? gradient : backgroundColor],
tabs: [hasSolidColors && {
key: 'background',
label: (0,external_wp_i18n_namespaceObject.__)('Solid'),
inheritedValue: backgroundColor,
setValue: setBackgroundColor,
userValue: userBackgroundColor
}, hasGradientColors && {
key: 'gradient',
label: (0,external_wp_i18n_namespaceObject.__)('Gradient'),
inheritedValue: gradient,
setValue: setGradient,
userValue: userGradient,
isGradient: true
}].filter(Boolean)
}, showLinkPanel && {
key: 'link',
label: (0,external_wp_i18n_namespaceObject.__)('Link'),
hasValue: hasLink,
resetValue: resetLink,
isShownByDefault: defaultControls.link,
indicators: [linkColor, hoverLinkColor],
tabs: [{
key: 'link',
label: (0,external_wp_i18n_namespaceObject.__)('Default'),
inheritedValue: linkColor,
setValue: setLinkColor,
userValue: userLinkColor
}, {
key: 'hover',
label: (0,external_wp_i18n_namespaceObject.__)('Hover'),
inheritedValue: hoverLinkColor,
setValue: setHoverLinkColor,
userValue: userHoverLinkColor
}]
}].filter(Boolean);
elements.forEach(({
name,
label,
showPanel
}) => {
if (!showPanel) return;
const elementBackgroundColor = decodeValue(inheritedValue?.elements?.[name]?.color?.background);
const elementGradient = decodeValue(inheritedValue?.elements?.[name]?.color?.gradient);
const elementTextColor = decodeValue(inheritedValue?.elements?.[name]?.color?.text);
const elementBackgroundUserColor = decodeValue(value?.elements?.[name]?.color?.background);
const elementGradientUserColor = decodeValue(value?.elements?.[name]?.color?.gradient);
const elementTextUserColor = decodeValue(value?.elements?.[name]?.color?.text);
const hasElement = () => !!(elementTextUserColor || elementBackgroundUserColor || elementGradientUserColor);
const resetElement = () => {
const newValue = setImmutably(value, ['elements', name, 'color', 'background'], undefined);
newValue.elements[name].color.gradient = undefined;
newValue.elements[name].color.text = undefined;
onChange(newValue);
};
const setElementTextColor = newTextColor => {
onChange(setImmutably(value, ['elements', name, 'color', 'text'], encodeColorValue(newTextColor)));
};
const setElementBackgroundColor = newBackgroundColor => {
const newValue = setImmutably(value, ['elements', name, 'color', 'background'], encodeColorValue(newBackgroundColor));
newValue.elements[name].color.gradient = undefined;
onChange(newValue);
};
const setElementGradient = newGradient => {
const newValue = setImmutably(value, ['elements', name, 'color', 'gradient'], encodeGradientValue(newGradient));
newValue.elements[name].color.background = undefined;
onChange(newValue);
};
const supportsTextColor = true;
// Background color is not supported for `caption`
// as there isn't yet a way to set padding for the element.
const supportsBackground = name !== 'caption';
items.push({
key: name,
label,
hasValue: hasElement,
resetValue: resetElement,
isShownByDefault: defaultControls[name],
indicators: supportsTextColor && supportsBackground ? [elementTextColor, elementGradient !== null && elementGradient !== void 0 ? elementGradient : elementBackgroundColor] : [supportsTextColor ? elementTextColor : elementGradient !== null && elementGradient !== void 0 ? elementGradient : elementBackgroundColor],
tabs: [hasSolidColors && supportsTextColor && {
key: 'text',
label: (0,external_wp_i18n_namespaceObject.__)('Text'),
inheritedValue: elementTextColor,
setValue: setElementTextColor,
userValue: elementTextUserColor
}, hasSolidColors && supportsBackground && {
key: 'background',
label: (0,external_wp_i18n_namespaceObject.__)('Background'),
inheritedValue: elementBackgroundColor,
setValue: setElementBackgroundColor,
userValue: elementBackgroundUserColor
}, hasGradientColors && supportsBackground && {
key: 'gradient',
label: (0,external_wp_i18n_namespaceObject.__)('Gradient'),
inheritedValue: elementGradient,
setValue: setElementGradient,
userValue: elementGradientUserColor,
isGradient: true
}].filter(Boolean)
});
});
return (0,external_React_.createElement)(Wrapper, {
resetAllFilter: resetAllFilter,
value: value,
onChange: onChange,
panelId: panelId
}, items.map(item => (0,external_React_.createElement)(ColorPanelDropdown, {
key: item.key,
...item,
colorGradientControlSettings: {
colors,
disableCustomColors: !areCustomSolidsEnabled,
gradients,
disableCustomGradients: !areCustomGradientsEnabled
},
panelId: panelId
})), children);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/contrast-checker/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
k([names, a11y]);
function ContrastChecker({
backgroundColor,
fallbackBackgroundColor,
fallbackTextColor,
fallbackLinkColor,
fontSize,
// Font size value in pixels.
isLargeText,
textColor,
linkColor,
enableAlphaChecker = false
}) {
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_React_.createElement)("div", {
className: "block-editor-contrast-checker"
}, (0,external_React_.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 */ const contrast_checker = (ContrastChecker);
;// 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({
children
}) {
const value = (0,external_wp_element_namespaceObject.useMemo)(() => ({
refs: new Map(),
callbacks: new Map()
}), []);
return (0,external_React_.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/hooks/contrast-checker.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function getComputedStyle(node) {
return node.ownerDocument.defaultView.getComputedStyle(node);
}
function BlockColorContrastChecker({
clientId
}) {
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);
// There are so many things that can change the color of a block
// So we perform this check on every render.
// eslint-disable-next-line react-hooks/exhaustive-deps
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!ref.current) {
return;
}
setDetectedColor(getComputedStyle(ref.current).color);
const firstLinkElement = 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_React_.createElement)(contrast_checker, {
backgroundColor: detectedBackgroundColor,
textColor: detectedColor,
enableAlphaChecker: true,
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 = blockNameOrType => {
const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, 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 colorSupport !== null && typeof colorSupport === 'object' && !!colorSupport.link;
};
const hasGradientSupport = blockNameOrType => {
const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, COLOR_SUPPORT_KEY);
return colorSupport !== null && typeof colorSupport === 'object' && !!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;
};
/**
* 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|string} blockNameOrType Block type.
* @param {Object} attributes Block attributes.
*
* @return {Object} Filtered props applied to save element.
*/
function color_addSaveProps(props, blockNameOrType, attributes) {
if (!hasColorSupport(blockNameOrType) || shouldSkipSerialization(blockNameOrType, COLOR_SUPPORT_KEY)) {
return props;
}
const hasGradient = hasGradientSupport(blockNameOrType);
// I'd have preferred to avoid the "style" attribute usage here
const {
backgroundColor,
textColor,
gradient,
style
} = attributes;
const shouldSerialize = feature => !shouldSkipSerialization(blockNameOrType, 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?.color?.background || hasGradient && (gradient || style?.color?.gradient);
const newClassName = classnames_default()(props.className, textClass, gradientClass, {
// Don't apply the background class if there's a custom gradient.
[backgroundClass]: (!hasGradient || !style?.color?.gradient) && !!backgroundClass,
'has-text-color': shouldSerialize('text') && (textColor || style?.color?.text),
'has-background': serializeHasBackground && hasBackground,
'has-link-color': shouldSerialize('link') && style?.elements?.link?.color
});
props.className = newClassName ? newClassName : undefined;
return props;
}
function color_styleToAttributes(style) {
const textColorValue = style?.color?.text;
const textColorSlug = textColorValue?.startsWith('var:preset|color|') ? textColorValue.substring('var:preset|color|'.length) : undefined;
const backgroundColorValue = style?.color?.background;
const backgroundColorSlug = backgroundColorValue?.startsWith('var:preset|color|') ? backgroundColorValue.substring('var:preset|color|'.length) : undefined;
const gradientValue = style?.color?.gradient;
const gradientSlug = gradientValue?.startsWith('var:preset|gradient|') ? gradientValue.substring('var:preset|gradient|'.length) : undefined;
const updatedStyle = {
...style
};
updatedStyle.color = {
...updatedStyle.color,
text: textColorSlug ? undefined : textColorValue,
background: backgroundColorSlug ? undefined : backgroundColorValue,
gradient: gradientSlug ? undefined : gradientValue
};
return {
style: utils_cleanEmptyObject(updatedStyle),
textColor: textColorSlug,
backgroundColor: backgroundColorSlug,
gradient: gradientSlug
};
}
function color_attributesToStyle(attributes) {
return {
...attributes.style,
color: {
...attributes.style?.color,
text: attributes.textColor ? 'var:preset|color|' + attributes.textColor : attributes.style?.color?.text,
background: attributes.backgroundColor ? 'var:preset|color|' + attributes.backgroundColor : attributes.style?.color?.background,
gradient: attributes.gradient ? 'var:preset|gradient|' + attributes.gradient : attributes.style?.color?.gradient
}
};
}
function ColorInspectorControl({
children,
resetAllFilter
}) {
const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(attributes => {
const existingStyle = color_attributesToStyle(attributes);
const updatedStyle = resetAllFilter(existingStyle);
return {
...attributes,
...color_styleToAttributes(updatedStyle)
};
}, [resetAllFilter]);
return (0,external_React_.createElement)(inspector_controls, {
group: "color",
resetAllFilter: attributesResetAllFilter
}, children);
}
function ColorEdit({
clientId,
name,
setAttributes,
settings
}) {
const isEnabled = useHasColorPanel(settings);
function selector(select) {
const {
style,
textColor,
backgroundColor,
gradient
} = select(store).getBlockAttributes(clientId) || {};
return {
style,
textColor,
backgroundColor,
gradient
};
}
const {
style,
textColor,
backgroundColor,
gradient
} = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId]);
const value = (0,external_wp_element_namespaceObject.useMemo)(() => {
return color_attributesToStyle({
style,
textColor,
backgroundColor,
gradient
});
}, [style, textColor, backgroundColor, gradient]);
const onChange = newStyle => {
setAttributes(color_styleToAttributes(newStyle));
};
if (!isEnabled) {
return null;
}
const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [COLOR_SUPPORT_KEY, '__experimentalDefaultControls']);
const enableContrastChecking = external_wp_element_namespaceObject.Platform.OS === 'web' && !value?.color?.gradient && (settings?.color?.text || settings?.color?.link) &&
// Contrast checking is enabled by default.
// Deactivating it requires `enableContrastChecker` to have
// an explicit value of `false`.
false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [COLOR_SUPPORT_KEY, 'enableContrastChecker']);
return (0,external_React_.createElement)(ColorPanel, {
as: ColorInspectorControl,
panelId: clientId,
settings: settings,
value: value,
onChange: onChange,
defaultControls: defaultControls,
enableContrastChecker: false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [COLOR_SUPPORT_KEY, 'enableContrastChecker'])
}, enableContrastChecking && (0,external_React_.createElement)(BlockColorContrastChecker, {
clientId: clientId
}));
}
function color_useBlockProps({
name,
backgroundColor,
textColor,
gradient,
style
}) {
const [userPalette, themePalette, defaultPalette] = use_settings_useSettings('color.palette.custom', 'color.palette.theme', '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 {};
}
const extraStyles = {};
if (textColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, 'text')) {
extraStyles.color = getColorObjectByAttributeValues(colors, textColor)?.color;
}
if (backgroundColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, 'background')) {
extraStyles.backgroundColor = getColorObjectByAttributeValues(colors, backgroundColor)?.color;
}
const saveProps = color_addSaveProps({
style: extraStyles
}, name, {
textColor,
backgroundColor,
gradient,
style
});
const hasBackgroundValue = backgroundColor || style?.color?.background || gradient || style?.color?.gradient;
return {
...saveProps,
className: classnames_default()(saveProps.className,
// Add background image classes in the editor, if not already handled by background color values.
!hasBackgroundValue && getBackgroundImageClasses(style))
};
}
/* harmony default export */ const color = ({
useBlockProps: color_useBlockProps,
addSaveProps: color_addSaveProps,
attributeKeys: ['backgroundColor', 'textColor', 'gradient', 'style'],
hasSupport: hasColorSupport
});
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.switchToBlockType.transformedBlock', 'core/color/addTransforms', color_addTransforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-family/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function FontFamilyControl({
value = '',
onChange,
fontFamilies,
...props
}) {
const [blockLevelFontFamilies] = use_settings_useSettings('typography.fontFamilies');
if (!fontFamilies) {
fontFamilies = blockLevelFontFamilies;
}
if (!fontFamilies || fontFamilies.length === 0) {
return null;
}
const options = [{
value: '',
label: (0,external_wp_i18n_namespaceObject.__)('Default')
}, ...fontFamilies.map(({
fontFamily,
name
}) => {
return {
value: fontFamily,
label: name || fontFamily
};
})];
return (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Font'),
options: options,
value: value,
onChange: onChange,
labelPosition: "top",
...props
});
}
;// 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 {Element} Font appearance control.
*/
function FontAppearanceControl(props) {
const {
onChange,
hasFontStyles = true,
hasFontWeights = true,
value: {
fontStyle,
fontWeight
},
...otherProps
} = 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(({
name: styleName,
value: styleValue
}) => {
FONT_WEIGHTS.forEach(({
name: weightName,
value: weightValue
}) => {
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(({
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 = (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_React_.createElement)(external_wp_components_namespaceObject.CustomSelectControl, {
...otherProps,
className: "components-font-appearance-control",
label: label,
describedBy: getDescribedBy(),
options: selectOptions,
value: currentSelection,
onChange: ({
selectedItem
}) => onChange(selectedItem.style),
__nextUnconstrainedWidth: true
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/line-height-control/utils.js
const BASE_DEFAULT_VALUE = 1.5;
const STEP = 0.01;
/**
* A spin factor of 10 allows the spin controls to increment/decrement by 0.1.
* e.g. A line-height value of 1.55 will increment to 1.65.
*/
const SPIN_FACTOR = 10;
/**
* 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 line_height_control_LineHeightControl = ({
value: lineHeight,
onChange,
/** Start opting into the new margin-free styles that will become the default in a future version. */
__nextHasNoMarginBottom = false,
__unstableInputWidth = '60px',
...otherProps
}) => {
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 spin up/down action
* (from an undefined value state) so that the next values are better suited for
* line-height rendering. For example, the first spin up should immediately
* go to 1.6, rather than the normally expected 0.1.
*
* Spin up/down actions can be triggered by keydowns of the up/down arrow keys,
* dragging the input or by clicking the spin buttons.
*/
const spin = STEP * SPIN_FACTOR;
switch (`${nextValue}`) {
case `${spin}`:
// Increment by spin value.
return BASE_DEFAULT_VALUE + spin;
case '0':
{
// This means the user explicitly input '0', rather than using the
// spin down action from an undefined value state.
if (wasTypedOrPasted) return nextValue;
// Decrement by spin value.
return BASE_DEFAULT_VALUE - spin;
}
case '':
return BASE_DEFAULT_VALUE;
default:
return nextValue;
}
};
const stateReducer = (state, action) => {
// 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.nativeEvent?.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
};
const handleOnChange = (nextValue, {
event
}) => {
if (nextValue === '') {
onChange();
return;
}
if (event.type === 'click') {
onChange(adjustNextValue(`${nextValue}`, false));
return;
}
onChange(`${nextValue}`);
};
return (0,external_React_.createElement)("div", {
className: "block-editor-line-height-control",
style: deprecatedStyles
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
...otherProps,
__unstableInputWidth: __unstableInputWidth,
__unstableStateReducer: stateReducer,
onChange: handleOnChange,
label: (0,external_wp_i18n_namespaceObject.__)('Line height'),
placeholder: BASE_DEFAULT_VALUE,
step: STEP,
spinFactor: SPIN_FACTOR,
value: value,
min: 0,
spinControls: "custom"
}));
};
/**
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md
*/
/* harmony default export */ const line_height_control = (line_height_control_LineHeightControl);
;// 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 {Element} Letter-spacing control.
*/
function LetterSpacingControl({
value,
onChange,
__unstableInputWidth = '60px',
...otherProps
}) {
const [availableUnits] = use_settings_useSettings('spacing.units');
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: availableUnits || ['px', 'em', 'rem'],
defaultValues: {
px: 2,
em: 0.2,
rem: 0.2
}
});
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
...otherProps,
label: (0,external_wp_i18n_namespaceObject.__)('Letter spacing'),
value: value,
__unstableInputWidth: __unstableInputWidth,
units: units,
onChange: onChange
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/reset.js
/**
* WordPress dependencies
*/
const reset_reset = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M7 11.5h10V13H7z"
}));
/* harmony default export */ const library_reset = (reset_reset);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-uppercase.js
/**
* WordPress dependencies
*/
const formatUppercase = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const format_uppercase = (formatUppercase);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-lowercase.js
/**
* WordPress dependencies
*/
const formatLowercase = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const format_lowercase = (formatLowercase);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-capitalize.js
/**
* WordPress dependencies
*/
const formatCapitalize = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const format_capitalize = (formatCapitalize);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-transform-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const TEXT_TRANSFORMS = [{
name: (0,external_wp_i18n_namespaceObject.__)('None'),
value: 'none',
icon: library_reset
}, {
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.className Class name to add to the control.
* @param {string} props.value Currently selected text transform.
* @param {Function} props.onChange Handles change in text transform selection.
*
* @return {Element} Text transform control.
*/
function TextTransformControl({
className,
value,
onChange
}) {
return (0,external_React_.createElement)("fieldset", {
className: classnames_default()('block-editor-text-transform-control', className)
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
as: "legend"
}, (0,external_wp_i18n_namespaceObject.__)('Letter case')), (0,external_React_.createElement)("div", {
className: "block-editor-text-transform-control__buttons"
}, TEXT_TRANSFORMS.map(textTransform => {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
key: textTransform.value,
icon: textTransform.icon,
label: textTransform.name,
isPressed: textTransform.value === value,
onClick: () => {
onChange(textTransform.value === value ? undefined : textTransform.value);
}
});
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-underline.js
/**
* WordPress dependencies
*/
const formatUnderline = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const format_underline = (formatUnderline);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-strikethrough.js
/**
* WordPress dependencies
*/
const formatStrikethrough = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const format_strikethrough = (formatStrikethrough);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/text-decoration-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const TEXT_DECORATIONS = [{
name: (0,external_wp_i18n_namespaceObject.__)('None'),
value: 'none',
icon: library_reset
}, {
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.
* @param {string} [props.className] Additional class name to apply.
*
* @return {Element} Text decoration control.
*/
function TextDecorationControl({
value,
onChange,
className
}) {
return (0,external_React_.createElement)("fieldset", {
className: classnames_default()('block-editor-text-decoration-control', className)
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
as: "legend"
}, (0,external_wp_i18n_namespaceObject.__)('Decoration')), (0,external_React_.createElement)("div", {
className: "block-editor-text-decoration-control__buttons"
}, TEXT_DECORATIONS.map(textDecoration => {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
key: textDecoration.value,
icon: textDecoration.icon,
label: textDecoration.name,
isPressed: textDecoration.value === value,
onClick: () => {
onChange(textDecoration.value === value ? undefined : textDecoration.value);
}
});
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/text-horizontal.js
/**
* WordPress dependencies
*/
const textHorizontal = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M8.2 14.4h3.9L13 17h1.7L11 6.5H9.3L5.6 17h1.7l.9-2.6zm2-5.5 1.4 4H8.8l1.4-4zm7.4 7.5-1.3.8.8 1.4H5.5V20h14.3l-2.2-3.6z"
}));
/* harmony default export */ const text_horizontal = (textHorizontal);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/text-vertical.js
/**
* WordPress dependencies
*/
const textVertical = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M7 5.6v1.7l2.6.9v3.9L7 13v1.7L17.5 11V9.3L7 5.6zm4.2 6V8.8l4 1.4-4 1.4zm-5.7 5.6V5.5H4v14.3l3.6-2.2-.8-1.3-1.3.9z"
}));
/* harmony default export */ const text_vertical = (textVertical);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-mode-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const WRITING_MODES = [{
name: (0,external_wp_i18n_namespaceObject.__)('Horizontal'),
value: 'horizontal-tb',
icon: text_horizontal
}, {
name: (0,external_wp_i18n_namespaceObject.__)('Vertical'),
value: (0,external_wp_i18n_namespaceObject.isRTL)() ? 'vertical-lr' : 'vertical-rl',
icon: text_vertical
}];
/**
* Control to facilitate writing mode selections.
*
* @param {Object} props Component props.
* @param {string} props.className Class name to add to the control.
* @param {string} props.value Currently selected writing mode.
* @param {Function} props.onChange Handles change in the writing mode selection.
*
* @return {Element} Writing Mode control.
*/
function WritingModeControl({
className,
value,
onChange
}) {
return (0,external_React_.createElement)("fieldset", {
className: classnames_default()('block-editor-writing-mode-control', className)
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
as: "legend"
}, (0,external_wp_i18n_namespaceObject.__)('Orientation')), (0,external_React_.createElement)("div", {
className: "block-editor-writing-mode-control__buttons"
}, WRITING_MODES.map(writingMode => {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
key: writingMode.value,
icon: writingMode.icon,
label: writingMode.name,
isPressed: writingMode.value === value,
onClick: () => {
onChange(writingMode.value === value ? undefined : writingMode.value);
}
});
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/typography-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const MIN_TEXT_COLUMNS = 1;
const MAX_TEXT_COLUMNS = 6;
function useHasTypographyPanel(settings) {
const hasFontFamily = useHasFontFamilyControl(settings);
const hasLineHeight = useHasLineHeightControl(settings);
const hasFontAppearance = useHasAppearanceControl(settings);
const hasLetterSpacing = useHasLetterSpacingControl(settings);
const hasTextTransform = useHasTextTransformControl(settings);
const hasTextDecoration = useHasTextDecorationControl(settings);
const hasWritingMode = useHasWritingModeControl(settings);
const hasTextColumns = useHasTextColumnsControl(settings);
const hasFontSize = useHasFontSizeControl(settings);
return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || hasTextTransform || hasFontSize || hasTextDecoration || hasWritingMode || hasTextColumns;
}
function useHasFontSizeControl(settings) {
return hasOriginValue(settings?.typography?.fontSizes) || settings?.typography?.customFontSize;
}
function useHasFontFamilyControl(settings) {
return hasOriginValue(settings?.typography?.fontFamilies);
}
function useHasLineHeightControl(settings) {
return settings?.typography?.lineHeight;
}
function useHasAppearanceControl(settings) {
return settings?.typography?.fontStyle || settings?.typography?.fontWeight;
}
function useAppearanceControlLabel(settings) {
if (!settings?.typography?.fontStyle) {
return (0,external_wp_i18n_namespaceObject.__)('Font weight');
}
if (!settings?.typography?.fontWeight) {
return (0,external_wp_i18n_namespaceObject.__)('Font style');
}
return (0,external_wp_i18n_namespaceObject.__)('Appearance');
}
function useHasLetterSpacingControl(settings) {
return settings?.typography?.letterSpacing;
}
function useHasTextTransformControl(settings) {
return settings?.typography?.textTransform;
}
function useHasTextDecorationControl(settings) {
return settings?.typography?.textDecoration;
}
function useHasWritingModeControl(settings) {
return settings?.typography?.writingMode;
}
function useHasTextColumnsControl(settings) {
return settings?.typography?.textColumns;
}
function getUniqueFontSizesBySlug(settings) {
var _settings$typography$, _overrideOrigins;
const fontSizes = (_settings$typography$ = settings?.typography?.fontSizes) !== null && _settings$typography$ !== void 0 ? _settings$typography$ : {};
const overriddenFontSizes = (_overrideOrigins = overrideOrigins(fontSizes)) !== null && _overrideOrigins !== void 0 ? _overrideOrigins : [];
const uniqueSizes = [];
for (const currentSize of overriddenFontSizes) {
if (!uniqueSizes.some(({
slug
}) => slug === currentSize.slug)) {
uniqueSizes.push(currentSize);
}
}
return uniqueSizes;
}
function TypographyToolsPanel({
resetAllFilter,
onChange,
value,
panelId,
children
}) {
const resetAll = () => {
const updatedValue = resetAllFilter(value);
onChange(updatedValue);
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
label: (0,external_wp_i18n_namespaceObject.__)('Typography'),
resetAll: resetAll,
panelId: panelId,
dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS
}, children);
}
const typography_panel_DEFAULT_CONTROLS = {
fontFamily: true,
fontSize: true,
fontAppearance: true,
lineHeight: true,
letterSpacing: true,
textTransform: true,
textDecoration: true,
writingMode: true,
textColumns: true
};
function TypographyPanel({
as: Wrapper = TypographyToolsPanel,
value,
onChange,
inheritedValue = value,
settings,
panelId,
defaultControls = typography_panel_DEFAULT_CONTROLS
}) {
var _settings$typography$2;
const decodeValue = rawValue => getValueFromVariable({
settings
}, '', rawValue);
// Font Family
const hasFontFamilyEnabled = useHasFontFamilyControl(settings);
const fontFamilies = (_settings$typography$2 = settings?.typography?.fontFamilies) !== null && _settings$typography$2 !== void 0 ? _settings$typography$2 : {};
const mergedFontFamilies = fontFamilies ? mergeOrigins(fontFamilies) : [];
const fontFamily = decodeValue(inheritedValue?.typography?.fontFamily);
const setFontFamily = newValue => {
const slug = mergedFontFamilies?.find(({
fontFamily: f
}) => f === newValue)?.slug;
onChange(setImmutably(value, ['typography', 'fontFamily'], slug ? `var:preset|font-family|${slug}` : newValue || undefined));
};
const hasFontFamily = () => !!value?.typography?.fontFamily;
const resetFontFamily = () => setFontFamily(undefined);
// Font Size
const hasFontSizeEnabled = useHasFontSizeControl(settings);
const disableCustomFontSizes = !settings?.typography?.customFontSize;
const mergedFontSizes = getUniqueFontSizesBySlug(settings);
const fontSize = decodeValue(inheritedValue?.typography?.fontSize);
const setFontSize = (newValue, metadata) => {
const actualValue = !!metadata?.slug ? `var:preset|font-size|${metadata?.slug}` : newValue;
onChange(setImmutably(value, ['typography', 'fontSize'], actualValue || undefined));
};
const hasFontSize = () => !!value?.typography?.fontSize;
const resetFontSize = () => setFontSize(undefined);
// Appearance
const hasAppearanceControl = useHasAppearanceControl(settings);
const appearanceControlLabel = useAppearanceControlLabel(settings);
const hasFontStyles = settings?.typography?.fontStyle;
const hasFontWeights = settings?.typography?.fontWeight;
const fontStyle = decodeValue(inheritedValue?.typography?.fontStyle);
const fontWeight = decodeValue(inheritedValue?.typography?.fontWeight);
const setFontAppearance = ({
fontStyle: newFontStyle,
fontWeight: newFontWeight
}) => {
onChange({
...value,
typography: {
...value?.typography,
fontStyle: newFontStyle || undefined,
fontWeight: newFontWeight || undefined
}
});
};
const hasFontAppearance = () => !!value?.typography?.fontStyle || !!value?.typography?.fontWeight;
const resetFontAppearance = () => {
setFontAppearance({});
};
// Line Height
const hasLineHeightEnabled = useHasLineHeightControl(settings);
const lineHeight = decodeValue(inheritedValue?.typography?.lineHeight);
const setLineHeight = newValue => {
onChange(setImmutably(value, ['typography', 'lineHeight'], newValue || undefined));
};
const hasLineHeight = () => value?.typography?.lineHeight !== undefined;
const resetLineHeight = () => setLineHeight(undefined);
// Letter Spacing
const hasLetterSpacingControl = useHasLetterSpacingControl(settings);
const letterSpacing = decodeValue(inheritedValue?.typography?.letterSpacing);
const setLetterSpacing = newValue => {
onChange(setImmutably(value, ['typography', 'letterSpacing'], newValue || undefined));
};
const hasLetterSpacing = () => !!value?.typography?.letterSpacing;
const resetLetterSpacing = () => setLetterSpacing(undefined);
// Text Columns
const hasTextColumnsControl = useHasTextColumnsControl(settings);
const textColumns = decodeValue(inheritedValue?.typography?.textColumns);
const setTextColumns = newValue => {
onChange(setImmutably(value, ['typography', 'textColumns'], newValue || undefined));
};
const hasTextColumns = () => !!value?.typography?.textColumns;
const resetTextColumns = () => setTextColumns(undefined);
// Text Transform
const hasTextTransformControl = useHasTextTransformControl(settings);
const textTransform = decodeValue(inheritedValue?.typography?.textTransform);
const setTextTransform = newValue => {
onChange(setImmutably(value, ['typography', 'textTransform'], newValue || undefined));
};
const hasTextTransform = () => !!value?.typography?.textTransform;
const resetTextTransform = () => setTextTransform(undefined);
// Text Decoration
const hasTextDecorationControl = useHasTextDecorationControl(settings);
const textDecoration = decodeValue(inheritedValue?.typography?.textDecoration);
const setTextDecoration = newValue => {
onChange(setImmutably(value, ['typography', 'textDecoration'], newValue || undefined));
};
const hasTextDecoration = () => !!value?.typography?.textDecoration;
const resetTextDecoration = () => setTextDecoration(undefined);
// Text Orientation
const hasWritingModeControl = useHasWritingModeControl(settings);
const writingMode = decodeValue(inheritedValue?.typography?.writingMode);
const setWritingMode = newValue => {
onChange(setImmutably(value, ['typography', 'writingMode'], newValue || undefined));
};
const hasWritingMode = () => !!value?.typography?.writingMode;
const resetWritingMode = () => setWritingMode(undefined);
const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => {
return {
...previousValue,
typography: {}
};
}, []);
return (0,external_React_.createElement)(Wrapper, {
resetAllFilter: resetAllFilter,
value: value,
onChange: onChange,
panelId: panelId
}, hasFontFamilyEnabled && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Font family'),
hasValue: hasFontFamily,
onDeselect: resetFontFamily,
isShownByDefault: defaultControls.fontFamily,
panelId: panelId
}, (0,external_React_.createElement)(FontFamilyControl, {
fontFamilies: mergedFontFamilies,
value: fontFamily,
onChange: setFontFamily,
size: "__unstable-large",
__nextHasNoMarginBottom: true
})), hasFontSizeEnabled && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Font size'),
hasValue: hasFontSize,
onDeselect: resetFontSize,
isShownByDefault: defaultControls.fontSize,
panelId: panelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.FontSizePicker, {
value: fontSize,
onChange: setFontSize,
fontSizes: mergedFontSizes,
disableCustomFontSizes: disableCustomFontSizes,
withReset: false,
withSlider: true,
size: "__unstable-large"
})), hasAppearanceControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "single-column",
label: appearanceControlLabel,
hasValue: hasFontAppearance,
onDeselect: resetFontAppearance,
isShownByDefault: defaultControls.fontAppearance,
panelId: panelId
}, (0,external_React_.createElement)(FontAppearanceControl, {
value: {
fontStyle,
fontWeight
},
onChange: setFontAppearance,
hasFontStyles: hasFontStyles,
hasFontWeights: hasFontWeights,
size: "__unstable-large",
__nextHasNoMarginBottom: true
})), hasLineHeightEnabled && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "single-column",
label: (0,external_wp_i18n_namespaceObject.__)('Line height'),
hasValue: hasLineHeight,
onDeselect: resetLineHeight,
isShownByDefault: defaultControls.lineHeight,
panelId: panelId
}, (0,external_React_.createElement)(line_height_control, {
__nextHasNoMarginBottom: true,
__unstableInputWidth: "auto",
value: lineHeight,
onChange: setLineHeight,
size: "__unstable-large"
})), hasLetterSpacingControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "single-column",
label: (0,external_wp_i18n_namespaceObject.__)('Letter spacing'),
hasValue: hasLetterSpacing,
onDeselect: resetLetterSpacing,
isShownByDefault: defaultControls.letterSpacing,
panelId: panelId
}, (0,external_React_.createElement)(LetterSpacingControl, {
value: letterSpacing,
onChange: setLetterSpacing,
size: "__unstable-large",
__unstableInputWidth: "auto"
})), hasTextColumnsControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "single-column",
label: (0,external_wp_i18n_namespaceObject.__)('Text columns'),
hasValue: hasTextColumns,
onDeselect: resetTextColumns,
isShownByDefault: defaultControls.textColumns,
panelId: panelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Text columns'),
max: MAX_TEXT_COLUMNS,
min: MIN_TEXT_COLUMNS,
onChange: setTextColumns,
size: "__unstable-large",
spinControls: "custom",
value: textColumns,
initialPosition: 1
})), hasTextDecorationControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "single-column",
label: (0,external_wp_i18n_namespaceObject.__)('Text decoration'),
hasValue: hasTextDecoration,
onDeselect: resetTextDecoration,
isShownByDefault: defaultControls.textDecoration,
panelId: panelId
}, (0,external_React_.createElement)(TextDecorationControl, {
value: textDecoration,
onChange: setTextDecoration,
size: "__unstable-large",
__unstableInputWidth: "auto"
})), hasWritingModeControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "single-column",
label: (0,external_wp_i18n_namespaceObject.__)('Text orientation'),
hasValue: hasWritingMode,
onDeselect: resetWritingMode,
isShownByDefault: defaultControls.writingMode,
panelId: panelId
}, (0,external_React_.createElement)(WritingModeControl, {
value: writingMode,
onChange: setWritingMode,
size: "__unstable-large",
__nextHasNoMarginBottom: true
})), hasTextTransformControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Letter case'),
hasValue: hasTextTransform,
onDeselect: resetTextTransform,
isShownByDefault: defaultControls.textTransform,
panelId: panelId
}, (0,external_React_.createElement)(TextTransformControl, {
value: textTransform,
onChange: setTextTransform,
showNone: true,
isBlock: true,
size: "__unstable-large",
__nextHasNoMarginBottom: true
})));
}
;// 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 {Element} Line height edit element.
*/
function LineHeightEdit(props) {
const {
attributes: {
style
},
setAttributes
} = props;
const onChange = newLineHeightValue => {
const newStyle = {
...style,
typography: {
...style?.typography,
lineHeight: newLineHeightValue
}
};
setAttributes({
style: cleanEmptyObject(newStyle)
});
};
return createElement(LineHeightControl, {
__unstableInputWidth: "100%",
__nextHasNoMarginBottom: true,
value: style?.typography?.lineHeight,
onChange: onChange,
size: "__unstable-large"
});
}
/**
* 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 [isEnabled] = useSettings('typography.lineHeight');
return !isEnabled || !hasBlockSupport(blockName, LINE_HEIGHT_SUPPORT_KEY);
}
;// CONCATENATED MODULE: external ["wp","tokenList"]
const 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/hooks/font-family.js
/**
* 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?.fontFamily) {
return props;
}
// Use TokenList to dedupe classes.
const classes = new (external_wp_tokenList_default())(props.className);
const {
kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
classes.add(`has-${kebabCase(attributes?.fontFamily)}-font-family`);
const newClassName = classes.value;
props.className = newClassName ? newClassName : undefined;
return props;
}
function font_family_useBlockProps({
name,
fontFamily
}) {
return font_family_addSaveProps({}, name, {
fontFamily
});
}
/* harmony default export */ const font_family = ({
useBlockProps: font_family_useBlockProps,
addSaveProps: font_family_addSaveProps,
attributeKeys: ['fontFamily'],
hasSupport(name) {
return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_FAMILY_SUPPORT_KEY);
}
});
/**
* 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({
setAttributes
}) {
setAttributes({
fontFamily: undefined
});
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/fontFamily/addAttribute', font_family_addAttributes);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/utils.js
/**
* WordPress dependencies
*/
/**
* Internal 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 utils_getFontSize = (fontSizes, fontSizeAttribute, customFontSizeAttribute) => {
if (fontSizeAttribute) {
const fontSizeObject = fontSizes?.find(({
slug
}) => 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 utils_getFontSizeObjectByValue(fontSizes, value) {
const fontSizeObject = fontSizes?.find(({
size
}) => size === value);
if (fontSizeObject) {
return fontSizeObject;
}
return {
size: value
};
}
/**
* Returns a class based on fontSizeName.
*
* @param {string} fontSizeSlug Slug of the fontSize.
*
* @return {string | undefined} 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;
}
const {
kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
return `has-${kebabCase(fontSizeSlug)}-font-size`;
}
;// 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} blockNameOrType Block type.
* @param {Object} attributes Block attributes.
*
* @return {Object} Filtered props applied to save element.
*/
function font_size_addSaveProps(props, blockNameOrType, attributes) {
if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockNameOrType, FONT_SIZE_SUPPORT_KEY)) {
return props;
}
if (shouldSkipSerialization(blockNameOrType, 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;
}
/**
* Inspector control panel containing the font size related configuration
*
* @param {Object} props
*
* @return {Element} Font size edit element.
*/
function FontSizeEdit(props) {
const {
attributes: {
fontSize,
style
},
setAttributes
} = props;
const [fontSizes] = useSettings('typography.fontSizes');
const onChange = value => {
const fontSizeSlug = getFontSizeObjectByValue(fontSizes, value).slug;
setAttributes({
style: cleanEmptyObject({
...style,
typography: {
...style?.typography,
fontSize: fontSizeSlug ? undefined : value
}
}),
fontSize: fontSizeSlug
});
};
const fontSizeObject = getFontSize(fontSizes, fontSize, style?.typography?.fontSize);
const fontSizeValue = fontSizeObject?.size || style?.typography?.fontSize || fontSize;
return createElement(FontSizePicker, {
onChange: onChange,
value: fontSizeValue,
withReset: false,
withSlider: true,
size: "__unstable-large"
});
}
/**
* 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] = useSettings('typography.fontSizes');
const hasFontSizes = !!fontSizes?.length;
return !hasBlockSupport(blockName, FONT_SIZE_SUPPORT_KEY) || !hasFontSizes;
}
function font_size_useBlockProps({
name,
fontSize,
style
}) {
const [fontSizes, fluidTypographySettings, layoutSettings] = use_settings_useSettings('typography.fontSizes', 'typography.fluid', 'layout');
/*
* Only add inline styles if the block supports font sizes,
* doesn't skip serialization of font sizes,
* and has either a custom font size or a preset font size.
*/
if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_SIZE_SUPPORT_KEY) || shouldSkipSerialization(name, TYPOGRAPHY_SUPPORT_KEY, 'fontSize') || !fontSize && !style?.typography?.fontSize) {
return;
}
let props;
if (style?.typography?.fontSize) {
const fluidSettings = getFluidTypographyOptionsFromSettings({
typography: {
fluid: fluidTypographySettings
},
layout: layoutSettings
});
props = {
style: {
fontSize: getTypographyFontSizeValue({
size: style.typography.fontSize
}, fluidSettings)
}
};
}
if (fontSize) {
props = {
style: {
fontSize: utils_getFontSize(fontSizes, fontSize, style?.typography?.fontSize).size
}
};
}
if (!props) {
return;
}
return font_size_addSaveProps(props, name, {
fontSize
});
}
/* harmony default export */ const font_size = ({
useBlockProps: font_size_useBlockProps,
addSaveProps: font_size_addSaveProps,
attributeKeys: ['fontSize', 'style'],
hasSupport(name) {
return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_SIZE_SUPPORT_KEY);
}
});
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.switchToBlockType.transformedBlock', 'core/font-size/addTransforms', font_size_addTransforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/typography.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function omit(object, keys) {
return Object.fromEntries(Object.entries(object).filter(([key]) => !keys.includes(key)));
}
const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';
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_COLUMNS_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, WRITING_MODE_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
function typography_styleToAttributes(style) {
const updatedStyle = {
...omit(style, ['fontFamily'])
};
const fontSizeValue = style?.typography?.fontSize;
const fontFamilyValue = style?.typography?.fontFamily;
const fontSizeSlug = fontSizeValue?.startsWith('var:preset|font-size|') ? fontSizeValue.substring('var:preset|font-size|'.length) : undefined;
const fontFamilySlug = fontFamilyValue?.startsWith('var:preset|font-family|') ? fontFamilyValue.substring('var:preset|font-family|'.length) : undefined;
updatedStyle.typography = {
...omit(updatedStyle.typography, ['fontFamily']),
fontSize: fontSizeSlug ? undefined : fontSizeValue
};
return {
style: utils_cleanEmptyObject(updatedStyle),
fontFamily: fontFamilySlug,
fontSize: fontSizeSlug
};
}
function typography_attributesToStyle(attributes) {
return {
...attributes.style,
typography: {
...attributes.style?.typography,
fontFamily: attributes.fontFamily ? 'var:preset|font-family|' + attributes.fontFamily : undefined,
fontSize: attributes.fontSize ? 'var:preset|font-size|' + attributes.fontSize : attributes.style?.typography?.fontSize
}
};
}
function TypographyInspectorControl({
children,
resetAllFilter
}) {
const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(attributes => {
const existingStyle = typography_attributesToStyle(attributes);
const updatedStyle = resetAllFilter(existingStyle);
return {
...attributes,
...typography_styleToAttributes(updatedStyle)
};
}, [resetAllFilter]);
return (0,external_React_.createElement)(inspector_controls, {
group: "typography",
resetAllFilter: attributesResetAllFilter
}, children);
}
function typography_TypographyPanel({
clientId,
name,
setAttributes,
settings
}) {
function selector(select) {
const {
style,
fontFamily,
fontSize
} = select(store).getBlockAttributes(clientId) || {};
return {
style,
fontFamily,
fontSize
};
}
const {
style,
fontFamily,
fontSize
} = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId]);
const isEnabled = useHasTypographyPanel(settings);
const value = (0,external_wp_element_namespaceObject.useMemo)(() => typography_attributesToStyle({
style,
fontFamily,
fontSize
}), [style, fontSize, fontFamily]);
const onChange = newStyle => {
setAttributes(typography_styleToAttributes(newStyle));
};
if (!isEnabled) {
return null;
}
const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [TYPOGRAPHY_SUPPORT_KEY, '__experimentalDefaultControls']);
return (0,external_React_.createElement)(TypographyPanel, {
as: TypographyInspectorControl,
panelId: clientId,
settings: settings,
value: value,
onChange: onChange,
defaultControls: defaultControls
});
}
const hasTypographySupport = blockName => {
return TYPOGRAPHY_SUPPORT_KEYS.some(key => hasBlockSupport(blockName, key));
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/settings.js
/**
* WordPress dependencies
*/
const settings_settings = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"
}));
/* harmony default export */ const library_settings = (settings_settings);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const CUSTOM_VALUE_SETTINGS = {
px: {
max: 300,
steps: 1
},
'%': {
max: 100,
steps: 1
},
vw: {
max: 100,
steps: 1
},
vh: {
max: 100,
steps: 1
},
em: {
max: 10,
steps: 0.1
},
rm: {
max: 10,
steps: 0.1
},
svw: {
max: 100,
steps: 1
},
lvw: {
max: 100,
steps: 1
},
dvw: {
max: 100,
steps: 1
},
svh: {
max: 100,
steps: 1
},
lvh: {
max: 100,
steps: 1
},
dvh: {
max: 100,
steps: 1
},
vi: {
max: 100,
steps: 1
},
svi: {
max: 100,
steps: 1
},
lvi: {
max: 100,
steps: 1
},
dvi: {
max: 100,
steps: 1
},
vb: {
max: 100,
steps: 1
},
svb: {
max: 100,
steps: 1
},
lvb: {
max: 100,
steps: 1
},
dvb: {
max: 100,
steps: 1
},
vmin: {
max: 100,
steps: 1
},
svmin: {
max: 100,
steps: 1
},
lvmin: {
max: 100,
steps: 1
},
dvmin: {
max: 100,
steps: 1
},
vmax: {
max: 100,
steps: 1
},
svmax: {
max: 100,
steps: 1
},
lvmax: {
max: 100,
steps: 1
},
dvmax: {
max: 100,
steps: 1
}
};
function SpacingInputControl({
icon,
isMixed = false,
minimumCustomValue,
onChange,
onMouseOut,
onMouseOver,
showSideInLabel = true,
side,
spacingSizes,
type,
value
}) {
var _CUSTOM_VALUE_SETTING, _CUSTOM_VALUE_SETTING2;
// Treat value as a preset value if the passed in value matches the value of one of the spacingSizes.
value = getPresetValueFromCustomValue(value, spacingSizes);
let selectListSizes = spacingSizes;
const showRangeControl = spacingSizes.length <= 8;
const disableCustomSpacingSizes = (0,external_wp_data_namespaceObject.useSelect)(select => {
const editorSettings = select(store).getSettings();
return editorSettings?.disableCustomSpacingSizes;
});
const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)(!disableCustomSpacingSizes && value !== undefined && !isValueSpacingPreset(value));
const previousValue = (0,external_wp_compose_namespaceObject.usePrevious)(value);
if (!!value && previousValue !== value && !isValueSpacingPreset(value) && showCustomValueControl !== true) {
setShowCustomValueControl(true);
}
const [availableUnits] = use_settings_useSettings('spacing.units');
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: availableUnits || ['px', 'em', 'rem']
});
let currentValue = null;
const showCustomValueInSelectList = !showRangeControl && !showCustomValueControl && value !== undefined && (!isValueSpacingPreset(value) || isValueSpacingPreset(value) && isMixed);
if (showCustomValueInSelectList) {
selectListSizes = [...spacingSizes, {
name: !isMixed ?
// translators: A custom measurement, eg. a number followed by a unit like 12px.
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Custom (%s)'), value) : (0,external_wp_i18n_namespaceObject.__)('Mixed'),
slug: 'custom',
size: value
}];
currentValue = selectListSizes.length - 1;
} else if (!isMixed) {
currentValue = !showCustomValueControl ? getSliderValueFromPreset(value, spacingSizes) : getCustomValueFromPreset(value, spacingSizes);
}
const selectedUnit = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(currentValue), [currentValue])[1] || units[0]?.value;
const setInitialValue = () => {
if (value === undefined) {
onChange('0');
}
};
const customTooltipContent = newValue => value === undefined ? undefined : spacingSizes[newValue]?.name;
const customRangeValue = parseFloat(currentValue, 10);
const getNewCustomValue = newSize => {
const isNumeric = !isNaN(parseFloat(newSize));
const nextValue = isNumeric ? newSize : undefined;
return nextValue;
};
const getNewPresetValue = (newSize, controlType) => {
const size = parseInt(newSize, 10);
if (controlType === 'selectList') {
if (size === 0) {
return undefined;
}
if (size === 1) {
return '0';
}
} else if (size === 0) {
return '0';
}
return `var:preset|spacing|${spacingSizes[newSize]?.slug}`;
};
const handleCustomValueSliderChange = next => {
onChange([next, selectedUnit].join(''));
};
const allPlaceholder = isMixed ? (0,external_wp_i18n_namespaceObject.__)('Mixed') : null;
const options = selectListSizes.map((size, index) => ({
key: index,
name: size.name
}));
const marks = spacingSizes.map((_newValue, index) => ({
value: index,
label: undefined
}));
const sideLabel = ALL_SIDES.includes(side) && showSideInLabel ? LABELS[side] : '';
const typeLabel = showSideInLabel ? type?.toLowerCase() : type;
const ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: The side of the block being modified (top, bottom, left, All sides etc.). 2. Type of spacing being modified (Padding, margin, etc)
(0,external_wp_i18n_namespaceObject.__)('%1$s %2$s'), sideLabel, typeLabel).trim();
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
className: "spacing-sizes-control__wrapper"
}, icon && (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
className: "spacing-sizes-control__icon",
icon: icon,
size: 24
}), showCustomValueControl && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
onMouseOver: onMouseOver,
onMouseOut: onMouseOut,
onFocus: onMouseOver,
onBlur: onMouseOut,
onChange: newSize => onChange(getNewCustomValue(newSize)),
value: currentValue,
units: units,
min: minimumCustomValue,
placeholder: allPlaceholder,
disableUnits: isMixed,
label: ariaLabel,
hideLabelFromVision: true,
className: "spacing-sizes-control__custom-value-input",
size: '__unstable-large'
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.RangeControl, {
onMouseOver: onMouseOver,
onMouseOut: onMouseOut,
onFocus: onMouseOver,
onBlur: onMouseOut,
value: customRangeValue,
min: 0,
max: (_CUSTOM_VALUE_SETTING = CUSTOM_VALUE_SETTINGS[selectedUnit]?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10,
step: (_CUSTOM_VALUE_SETTING2 = CUSTOM_VALUE_SETTINGS[selectedUnit]?.steps) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 0.1,
withInputField: false,
onChange: handleCustomValueSliderChange,
className: "spacing-sizes-control__custom-value-range",
__nextHasNoMarginBottom: true
})), showRangeControl && !showCustomValueControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.RangeControl, {
onMouseOver: onMouseOver,
onMouseOut: onMouseOut,
className: "spacing-sizes-control__range-control",
value: currentValue,
onChange: newSize => onChange(getNewPresetValue(newSize)),
onMouseDown: event => {
// If mouse down is near start of range set initial value to 0, which
// prevents the user have to drag right then left to get 0 setting.
if (event?.nativeEvent?.offsetX < 35) {
setInitialValue();
}
},
withInputField: false,
"aria-valuenow": currentValue,
"aria-valuetext": spacingSizes[currentValue]?.name,
renderTooltipContent: customTooltipContent,
min: 0,
max: spacingSizes.length - 1,
marks: marks,
label: ariaLabel,
hideLabelFromVision: true,
__nextHasNoMarginBottom: true,
onFocus: onMouseOver,
onBlur: onMouseOut
}), !showRangeControl && !showCustomValueControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.CustomSelectControl, {
className: "spacing-sizes-control__custom-select-control",
value: options.find(option => option.key === currentValue) || '' // passing undefined here causes a downshift controlled/uncontrolled warning
,
onChange: selection => {
onChange(getNewPresetValue(selection.selectedItem.key, 'selectList'));
},
options: options,
label: ariaLabel,
hideLabelFromVision: true,
__nextUnconstrainedWidth: true,
size: '__unstable-large',
onMouseOver: onMouseOver,
onMouseOut: onMouseOut,
onFocus: onMouseOver,
onBlur: onMouseOut
}), !disableCustomSpacingSizes && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)('Use size preset') : (0,external_wp_i18n_namespaceObject.__)('Set custom size'),
icon: library_settings,
onClick: () => {
setShowCustomValueControl(!showCustomValueControl);
},
isPressed: showCustomValueControl,
size: "small",
className: "spacing-sizes-control__custom-toggle",
iconSize: 24
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/axial.js
/**
* Internal dependencies
*/
const groupedSides = ['vertical', 'horizontal'];
function AxialInputControls({
minimumCustomValue,
onChange,
onMouseOut,
onMouseOver,
sides,
spacingSizes,
type,
values
}) {
const createHandleOnChange = side => next => {
if (!onChange) {
return;
}
// Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes.
const nextValues = {
...Object.keys(values).reduce((acc, key) => {
acc[key] = getPresetValueFromCustomValue(values[key], spacingSizes);
return acc;
}, {})
};
if (side === 'vertical') {
nextValues.top = next;
nextValues.bottom = next;
}
if (side === 'horizontal') {
nextValues.left = next;
nextValues.right = next;
}
onChange(nextValues);
};
// Filter sides if custom configuration provided, maintaining default order.
const filteredSides = sides?.length ? groupedSides.filter(side => hasAxisSupport(sides, side)) : groupedSides;
return (0,external_React_.createElement)(external_React_.Fragment, null, filteredSides.map(side => {
const axisValue = side === 'vertical' ? values.top : values.left;
return (0,external_React_.createElement)(SpacingInputControl, {
key: `spacing-sizes-control-${side}`,
icon: ICONS[side],
label: LABELS[side],
minimumCustomValue: minimumCustomValue,
onChange: createHandleOnChange(side),
onMouseOut: onMouseOut,
onMouseOver: onMouseOver,
side: side,
spacingSizes: spacingSizes,
type: type,
value: axisValue,
withInputField: false
});
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/separated.js
/**
* Internal dependencies
*/
function SeparatedInputControls({
minimumCustomValue,
onChange,
onMouseOut,
onMouseOver,
sides,
spacingSizes,
type,
values
}) {
// Filter sides if custom configuration provided, maintaining default order.
const filteredSides = sides?.length ? ALL_SIDES.filter(side => sides.includes(side)) : ALL_SIDES;
const createHandleOnChange = side => next => {
// Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes.
const nextValues = {
...Object.keys(values).reduce((acc, key) => {
acc[key] = getPresetValueFromCustomValue(values[key], spacingSizes);
return acc;
}, {})
};
nextValues[side] = next;
onChange(nextValues);
};
return (0,external_React_.createElement)(external_React_.Fragment, null, filteredSides.map(side => {
return (0,external_React_.createElement)(SpacingInputControl, {
key: `spacing-sizes-control-${side}`,
icon: ICONS[side],
label: LABELS[side],
minimumCustomValue: minimumCustomValue,
onChange: createHandleOnChange(side),
onMouseOut: onMouseOut,
onMouseOver: onMouseOver,
side: side,
spacingSizes: spacingSizes,
type: type,
value: values[side],
withInputField: false
});
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/single.js
/**
* Internal dependencies
*/
function SingleInputControl({
minimumCustomValue,
onChange,
onMouseOut,
onMouseOver,
showSideInLabel,
side,
spacingSizes,
type,
values
}) {
const createHandleOnChange = currentSide => next => {
// Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes.
const nextValues = {
...Object.keys(values).reduce((acc, key) => {
acc[key] = getPresetValueFromCustomValue(values[key], spacingSizes);
return acc;
}, {})
};
nextValues[currentSide] = next;
onChange(nextValues);
};
return (0,external_React_.createElement)(SpacingInputControl, {
label: LABELS[side],
minimumCustomValue: minimumCustomValue,
onChange: createHandleOnChange(side),
onMouseOut: onMouseOut,
onMouseOver: onMouseOver,
showSideInLabel: showSideInLabel,
side: side,
spacingSizes: spacingSizes,
type: type,
value: values[side],
withInputField: false
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/sides-dropdown/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const checkIcon = (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
icon: library_check,
size: 24
});
function SidesDropdown({
label: labelProp,
onChange,
sides,
value
}) {
if (!sides || !sides.length) {
return;
}
const supportedItems = getSupportedMenuItems(sides);
const sideIcon = supportedItems[value].icon;
const {
custom: customItem,
...menuItems
} = supportedItems;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
icon: sideIcon,
label: labelProp,
className: "spacing-sizes-control__dropdown",
toggleProps: {
isSmall: true
}
}, ({
onClose
}) => {
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, Object.entries(menuItems).map(([slug, {
label,
icon
}]) => {
const isSelected = value === slug;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
key: slug,
icon: icon,
iconPosition: "left",
isSelected: isSelected,
role: "menuitemradio",
onClick: () => {
onChange(slug);
onClose();
},
suffix: isSelected ? checkIcon : undefined
}, label);
})), !!customItem && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
icon: customItem.icon,
iconPosition: "left",
isSelected: value === VIEWS.custom,
role: "menuitemradio",
onClick: () => {
onChange(VIEWS.custom);
onClose();
},
suffix: value === VIEWS.custom ? checkIcon : undefined
}, customItem.label)));
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useSpacingSizes() {
const spacingSizes = [{
name: 0,
slug: '0',
size: 0
}];
const [settingsSizes] = use_settings_useSettings('spacing.spacingSizes');
if (settingsSizes) {
spacingSizes.push(...settingsSizes);
}
if (spacingSizes.length > 8) {
spacingSizes.unshift({
name: (0,external_wp_i18n_namespaceObject.__)('Default'),
slug: 'default',
size: undefined
});
}
return spacingSizes;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function SpacingSizesControl({
inputProps,
label: labelProp,
minimumCustomValue = 0,
onChange,
onMouseOut,
onMouseOver,
showSideInLabel = true,
sides = ALL_SIDES,
useSelect,
values
}) {
const spacingSizes = useSpacingSizes();
const inputValues = values || DEFAULT_VALUES;
const hasOneSide = sides?.length === 1;
const hasOnlyAxialSides = sides?.includes('horizontal') && sides?.includes('vertical') && sides?.length === 2;
const [view, setView] = (0,external_wp_element_namespaceObject.useState)(getInitialView(inputValues, sides));
const handleOnChange = nextValue => {
const newValues = {
...values,
...nextValue
};
onChange(newValues);
};
const inputControlProps = {
...inputProps,
minimumCustomValue,
onChange: handleOnChange,
onMouseOut,
onMouseOver,
sides,
spacingSizes,
type: labelProp,
useSelect,
values: inputValues
};
const renderControls = () => {
if (view === VIEWS.axial) {
return (0,external_React_.createElement)(AxialInputControls, {
...inputControlProps
});
}
if (view === VIEWS.custom) {
return (0,external_React_.createElement)(SeparatedInputControls, {
...inputControlProps
});
}
return (0,external_React_.createElement)(SingleInputControl, {
side: view,
...inputControlProps,
showSideInLabel: showSideInLabel
});
};
const sideLabel = ALL_SIDES.includes(view) && showSideInLabel ? LABELS[view] : '';
const label = (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 2. Type of spacing being modified (Padding, margin, etc). 1: The side of the block being modified (top, bottom, left etc.).
(0,external_wp_i18n_namespaceObject.__)('%1$s %2$s'), labelProp, sideLabel).trim();
const dropdownLabelText = (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The current spacing property e.g. "Padding", "Margin".
(0,external_wp_i18n_namespaceObject._x)('%s options', 'Button label to reveal side configuration options'), labelProp);
return (0,external_React_.createElement)("fieldset", {
className: "spacing-sizes-control"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
className: "spacing-sizes-control__header"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
as: "legend",
className: "spacing-sizes-control__label"
}, label), !hasOneSide && !hasOnlyAxialSides && (0,external_React_.createElement)(SidesDropdown, {
label: dropdownLabelText,
onChange: setView,
sides: sides,
value: view
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 0.5
}, renderControls()));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/height-control/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const RANGE_CONTROL_CUSTOM_SETTINGS = {
px: {
max: 1000,
step: 1
},
'%': {
max: 100,
step: 1
},
vw: {
max: 100,
step: 1
},
vh: {
max: 100,
step: 1
},
em: {
max: 50,
step: 0.1
},
rem: {
max: 50,
step: 0.1
},
svw: {
max: 100,
step: 1
},
lvw: {
max: 100,
step: 1
},
dvw: {
max: 100,
step: 1
},
svh: {
max: 100,
step: 1
},
lvh: {
max: 100,
step: 1
},
dvh: {
max: 100,
step: 1
},
vi: {
max: 100,
step: 1
},
svi: {
max: 100,
step: 1
},
lvi: {
max: 100,
step: 1
},
dvi: {
max: 100,
step: 1
},
vb: {
max: 100,
step: 1
},
svb: {
max: 100,
step: 1
},
lvb: {
max: 100,
step: 1
},
dvb: {
max: 100,
step: 1
},
vmin: {
max: 100,
step: 1
},
svmin: {
max: 100,
step: 1
},
lvmin: {
max: 100,
step: 1
},
dvmin: {
max: 100,
step: 1
},
vmax: {
max: 100,
step: 1
},
svmax: {
max: 100,
step: 1
},
lvmax: {
max: 100,
step: 1
},
dvmax: {
max: 100,
step: 1
}
};
/**
* HeightControl renders a linked unit control and range control for adjusting the height of a block.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/height-control/README.md
*
* @param {Object} props
* @param {?string} props.label A label for the control.
* @param {( value: string ) => void } props.onChange Called when the height changes.
* @param {string} props.value The current height value.
*
* @return {Component} The component to be rendered.
*/
function HeightControl({
label = (0,external_wp_i18n_namespaceObject.__)('Height'),
onChange,
value
}) {
var _RANGE_CONTROL_CUSTOM, _RANGE_CONTROL_CUSTOM2;
const customRangeValue = parseFloat(value);
const [availableUnits] = use_settings_useSettings('spacing.units');
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: availableUnits || ['%', 'px', 'em', 'rem', 'vh', 'vw']
});
const selectedUnit = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value), [value])[1] || units[0]?.value || 'px';
const handleSliderChange = next => {
onChange([next, selectedUnit].join(''));
};
const handleUnitChange = newUnit => {
// Attempt to smooth over differences between currentUnit and newUnit.
// This should slightly improve the experience of switching between unit types.
const [currentValue, currentUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value);
if (['em', 'rem'].includes(newUnit) && currentUnit === 'px') {
// Convert pixel value to an approximate of the new unit, assuming a root size of 16px.
onChange((currentValue / 16).toFixed(2) + newUnit);
} else if (['em', 'rem'].includes(currentUnit) && newUnit === 'px') {
// Convert to pixel value assuming a root size of 16px.
onChange(Math.round(currentValue * 16) + newUnit);
} else if (['%', 'vw', 'svw', 'lvw', 'dvw', 'vh', 'svh', 'lvh', 'dvh', 'vi', 'svi', 'lvi', 'dvi', 'vb', 'svb', 'lvb', 'dvb', 'vmin', 'svmin', 'lvmin', 'dvmin', 'vmax', 'svmax', 'lvmax', 'dvmax'].includes(newUnit) && currentValue > 100) {
// When converting to `%` or viewport-relative units, cap the new value at 100.
onChange(100 + newUnit);
}
};
return (0,external_React_.createElement)("fieldset", {
className: "block-editor-height-control"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
as: "legend"
}, label), (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
isBlock: true
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
value: value,
units: units,
onChange: onChange,
onUnitChange: handleUnitChange,
min: 0,
size: '__unstable-large',
label: label,
hideLabelFromVision: true
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
isBlock: true
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
marginX: 2,
marginBottom: 0
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.RangeControl, {
value: customRangeValue,
min: 0,
max: (_RANGE_CONTROL_CUSTOM = RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.max) !== null && _RANGE_CONTROL_CUSTOM !== void 0 ? _RANGE_CONTROL_CUSTOM : 100,
step: (_RANGE_CONTROL_CUSTOM2 = RANGE_CONTROL_CUSTOM_SETTINGS[selectedUnit]?.step) !== null && _RANGE_CONTROL_CUSTOM2 !== void 0 ? _RANGE_CONTROL_CUSTOM2 : 0.1,
withInputField: false,
onChange: handleSliderChange,
__nextHasNoMarginBottom: true,
label: label,
hideLabelFromVision: true
})))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/child-layout-control/index.js
/**
* WordPress dependencies
*/
function helpText(selfStretch, parentLayout) {
const {
orientation = 'horizontal'
} = parentLayout;
if (selfStretch === 'fill') {
return (0,external_wp_i18n_namespaceObject.__)('Stretch to fill available space.');
}
if (selfStretch === 'fixed' && orientation === 'horizontal') {
return (0,external_wp_i18n_namespaceObject.__)('Specify a fixed width.');
} else if (selfStretch === 'fixed') {
return (0,external_wp_i18n_namespaceObject.__)('Specify a fixed height.');
}
return (0,external_wp_i18n_namespaceObject.__)('Fit contents.');
}
/**
* Form to edit the child layout value.
*
* @param {Object} props Props.
* @param {Object} props.value The child layout value.
* @param {Function} props.onChange Function to update the child layout value.
* @param {Object} props.parentLayout The parent layout value.
*
* @return {Element} child layout edit element.
*/
function ChildLayoutControl({
value: childLayout = {},
onChange,
parentLayout
}) {
const {
selfStretch,
flexSize
} = childLayout;
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (selfStretch === 'fixed' && !flexSize) {
onChange({
...childLayout,
selfStretch: 'fit'
});
}
}, []);
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__nextHasNoMarginBottom: true,
size: '__unstable-large',
label: childLayoutOrientation(parentLayout),
value: selfStretch || 'fit',
help: helpText(selfStretch, parentLayout),
onChange: value => {
const newFlexSize = value !== 'fixed' ? null : flexSize;
onChange({
...childLayout,
selfStretch: value,
flexSize: newFlexSize
});
},
isBlock: true
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
key: 'fit',
value: 'fit',
label: (0,external_wp_i18n_namespaceObject.__)('Fit')
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
key: 'fill',
value: 'fill',
label: (0,external_wp_i18n_namespaceObject.__)('Fill')
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
key: 'fixed',
value: 'fixed',
label: (0,external_wp_i18n_namespaceObject.__)('Fixed')
})), selfStretch === 'fixed' && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
size: '__unstable-large',
onChange: value => {
onChange({
...childLayout,
flexSize: value
});
},
value: flexSize
}));
}
function childLayoutOrientation(parentLayout) {
const {
orientation = 'horizontal'
} = parentLayout;
return orientation === 'horizontal' ? (0,external_wp_i18n_namespaceObject.__)('Width') : (0,external_wp_i18n_namespaceObject.__)('Height');
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/aspect-ratio-tool.js
/**
* WordPress dependencies
*/
/**
* @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps
*/
/**
* @type {SelectControlProps[]}
*/
const DEFAULT_ASPECT_RATIO_OPTIONS = [{
label: (0,external_wp_i18n_namespaceObject._x)('Original', 'Aspect ratio option for dimensions control'),
value: 'auto'
}, {
label: (0,external_wp_i18n_namespaceObject._x)('Square - 1:1', 'Aspect ratio option for dimensions control'),
value: '1'
}, {
label: (0,external_wp_i18n_namespaceObject._x)('Standard - 4:3', 'Aspect ratio option for dimensions control'),
value: '4/3'
}, {
label: (0,external_wp_i18n_namespaceObject._x)('Portrait - 3:4', 'Aspect ratio option for dimensions control'),
value: '3/4'
}, {
label: (0,external_wp_i18n_namespaceObject._x)('Classic - 3:2', 'Aspect ratio option for dimensions control'),
value: '3/2'
}, {
label: (0,external_wp_i18n_namespaceObject._x)('Classic Portrait - 2:3', 'Aspect ratio option for dimensions control'),
value: '2/3'
}, {
label: (0,external_wp_i18n_namespaceObject._x)('Wide - 16:9', 'Aspect ratio option for dimensions control'),
value: '16/9'
}, {
label: (0,external_wp_i18n_namespaceObject._x)('Tall - 9:16', 'Aspect ratio option for dimensions control'),
value: '9/16'
}, {
label: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Aspect ratio option for dimensions control'),
value: 'custom',
disabled: true,
hidden: true
}];
/**
* @callback AspectRatioToolPropsOnChange
* @param {string} [value] New aspect ratio value.
* @return {void} No return.
*/
/**
* @typedef {Object} AspectRatioToolProps
* @property {string} [panelId] ID of the panel this tool is associated with.
* @property {string} [value] Current aspect ratio value.
* @property {AspectRatioToolPropsOnChange} [onChange] Callback to update the aspect ratio value.
* @property {SelectControlProps[]} [options] Aspect ratio options.
* @property {string} [defaultValue] Default aspect ratio value.
* @property {boolean} [isShownByDefault] Whether the tool is shown by default.
*/
function AspectRatioTool({
panelId,
value,
onChange = () => {},
options = DEFAULT_ASPECT_RATIO_OPTIONS,
defaultValue = DEFAULT_ASPECT_RATIO_OPTIONS[0].value,
hasValue,
isShownByDefault = true
}) {
// Match the CSS default so if the value is used directly in CSS it will look correct in the control.
const displayValue = value !== null && value !== void 0 ? value : 'auto';
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: hasValue ? hasValue : () => displayValue !== defaultValue,
label: (0,external_wp_i18n_namespaceObject.__)('Aspect ratio'),
onDeselect: () => onChange(undefined),
isShownByDefault: isShownByDefault,
panelId: panelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Aspect ratio'),
value: displayValue,
options: options,
onChange: onChange,
size: '__unstable-large',
__nextHasNoMarginBottom: true
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/dimensions-panel.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const AXIAL_SIDES = ['horizontal', 'vertical'];
function useHasDimensionsPanel(settings) {
const hasContentSize = useHasContentSize(settings);
const hasWideSize = useHasWideSize(settings);
const hasPadding = useHasPadding(settings);
const hasMargin = useHasMargin(settings);
const hasGap = useHasGap(settings);
const hasMinHeight = useHasMinHeight(settings);
const hasAspectRatio = useHasAspectRatio(settings);
const hasChildLayout = useHasChildLayout(settings);
return external_wp_element_namespaceObject.Platform.OS === 'web' && (hasContentSize || hasWideSize || hasPadding || hasMargin || hasGap || hasMinHeight || hasAspectRatio || hasChildLayout);
}
function useHasContentSize(settings) {
return settings?.layout?.contentSize;
}
function useHasWideSize(settings) {
return settings?.layout?.wideSize;
}
function useHasPadding(settings) {
return settings?.spacing?.padding;
}
function useHasMargin(settings) {
return settings?.spacing?.margin;
}
function useHasGap(settings) {
return settings?.spacing?.blockGap;
}
function useHasMinHeight(settings) {
return settings?.dimensions?.minHeight;
}
function useHasAspectRatio(settings) {
return settings?.dimensions?.aspectRatio;
}
function useHasChildLayout(settings) {
var _settings$parentLayou;
const {
type: parentLayoutType = 'default',
default: {
type: defaultParentLayoutType = 'default'
} = {},
allowSizingOnChildren = false
} = (_settings$parentLayou = settings?.parentLayout) !== null && _settings$parentLayou !== void 0 ? _settings$parentLayou : {};
const support = (defaultParentLayoutType === 'flex' || parentLayoutType === 'flex') && allowSizingOnChildren;
return !!settings?.layout && support;
}
function useHasSpacingPresets(settings) {
var _ref, _ref2;
const {
custom,
theme,
default: defaultPresets
} = settings?.spacing?.spacingSizes || {};
const presets = (_ref = (_ref2 = custom !== null && custom !== void 0 ? custom : theme) !== null && _ref2 !== void 0 ? _ref2 : defaultPresets) !== null && _ref !== void 0 ? _ref : [];
return presets.length > 0;
}
function filterValuesBySides(values, sides) {
// If no custom side configuration, all sides are opted into by default.
// Without any values, we have nothing to filter either.
if (!sides || !values) {
return values;
}
// Only include sides opted into within filtered values.
const filteredValues = {};
sides.forEach(side => {
if (side === 'vertical') {
filteredValues.top = values.top;
filteredValues.bottom = values.bottom;
}
if (side === 'horizontal') {
filteredValues.left = values.left;
filteredValues.right = values.right;
}
filteredValues[side] = values?.[side];
});
return filteredValues;
}
function splitStyleValue(value) {
// Check for shorthand value (a string value).
if (value && typeof value === 'string') {
// Convert to value for individual sides for BoxControl.
return {
top: value,
right: value,
bottom: value,
left: value
};
}
return value;
}
function splitGapValue(value) {
// Check for shorthand value (a string value).
if (value && typeof value === 'string') {
// If the value is a string, treat it as a single side (top) for the spacing controls.
return {
top: value
};
}
if (value) {
return {
...value,
right: value?.left,
bottom: value?.top
};
}
return value;
}
function DimensionsToolsPanel({
resetAllFilter,
onChange,
value,
panelId,
children
}) {
const resetAll = () => {
const updatedValue = resetAllFilter(value);
onChange(updatedValue);
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
label: (0,external_wp_i18n_namespaceObject.__)('Dimensions'),
resetAll: resetAll,
panelId: panelId,
dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS
}, children);
}
const dimensions_panel_DEFAULT_CONTROLS = {
contentSize: true,
wideSize: true,
padding: true,
margin: true,
blockGap: true,
minHeight: true,
aspectRatio: true,
childLayout: true
};
function DimensionsPanel({
as: Wrapper = DimensionsToolsPanel,
value,
onChange,
inheritedValue = value,
settings,
panelId,
defaultControls = dimensions_panel_DEFAULT_CONTROLS,
onVisualize = () => {},
// Special case because the layout controls are not part of the dimensions panel
// in global styles but not in block inspector.
includeLayoutControls = false
}) {
var _settings$parentLayou2, _defaultControls$cont, _defaultControls$wide, _defaultControls$padd, _defaultControls$marg, _defaultControls$bloc, _defaultControls$minH, _defaultControls$aspe, _defaultControls$chil;
const {
dimensions,
spacing
} = settings;
const decodeValue = rawValue => {
if (rawValue && typeof rawValue === 'object') {
return Object.keys(rawValue).reduce((acc, key) => {
acc[key] = getValueFromVariable({
settings: {
dimensions,
spacing
}
}, '', rawValue[key]);
return acc;
}, {});
}
return getValueFromVariable({
settings: {
dimensions,
spacing
}
}, '', rawValue);
};
const showSpacingPresetsControl = useHasSpacingPresets(settings);
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: settings?.spacing?.units || ['%', 'px', 'em', 'rem', 'vw']
});
// Content Size
const showContentSizeControl = useHasContentSize(settings) && includeLayoutControls;
const contentSizeValue = decodeValue(inheritedValue?.layout?.contentSize);
const setContentSizeValue = newValue => {
onChange(setImmutably(value, ['layout', 'contentSize'], newValue || undefined));
};
const hasUserSetContentSizeValue = () => !!value?.layout?.contentSize;
const resetContentSizeValue = () => setContentSizeValue(undefined);
// Wide Size
const showWideSizeControl = useHasWideSize(settings) && includeLayoutControls;
const wideSizeValue = decodeValue(inheritedValue?.layout?.wideSize);
const setWideSizeValue = newValue => {
onChange(setImmutably(value, ['layout', 'wideSize'], newValue || undefined));
};
const hasUserSetWideSizeValue = () => !!value?.layout?.wideSize;
const resetWideSizeValue = () => setWideSizeValue(undefined);
// Padding
const showPaddingControl = useHasPadding(settings);
const rawPadding = decodeValue(inheritedValue?.spacing?.padding);
const paddingValues = splitStyleValue(rawPadding);
const paddingSides = Array.isArray(settings?.spacing?.padding) ? settings?.spacing?.padding : settings?.spacing?.padding?.sides;
const isAxialPadding = paddingSides && paddingSides.some(side => AXIAL_SIDES.includes(side));
const setPaddingValues = newPaddingValues => {
const padding = filterValuesBySides(newPaddingValues, paddingSides);
onChange(setImmutably(value, ['spacing', 'padding'], padding));
};
const hasPaddingValue = () => !!value?.spacing?.padding && Object.keys(value?.spacing?.padding).length;
const resetPaddingValue = () => setPaddingValues(undefined);
const onMouseOverPadding = () => onVisualize('padding');
// Margin
const showMarginControl = useHasMargin(settings);
const rawMargin = decodeValue(inheritedValue?.spacing?.margin);
const marginValues = splitStyleValue(rawMargin);
const marginSides = Array.isArray(settings?.spacing?.margin) ? settings?.spacing?.margin : settings?.spacing?.margin?.sides;
const isAxialMargin = marginSides && marginSides.some(side => AXIAL_SIDES.includes(side));
const setMarginValues = newMarginValues => {
const margin = filterValuesBySides(newMarginValues, marginSides);
onChange(setImmutably(value, ['spacing', 'margin'], margin));
};
const hasMarginValue = () => !!value?.spacing?.margin && Object.keys(value?.spacing?.margin).length;
const resetMarginValue = () => setMarginValues(undefined);
const onMouseOverMargin = () => onVisualize('margin');
// Block Gap
const showGapControl = useHasGap(settings);
const gapValue = decodeValue(inheritedValue?.spacing?.blockGap);
const gapValues = splitGapValue(gapValue);
const gapSides = Array.isArray(settings?.spacing?.blockGap) ? settings?.spacing?.blockGap : settings?.spacing?.blockGap?.sides;
const isAxialGap = gapSides && gapSides.some(side => AXIAL_SIDES.includes(side));
const setGapValue = newGapValue => {
onChange(setImmutably(value, ['spacing', 'blockGap'], newGapValue));
};
const setGapValues = nextBoxGapValue => {
if (!nextBoxGapValue) {
setGapValue(null);
}
// If axial gap is not enabled, treat the 'top' value as the shorthand gap value.
if (!isAxialGap && nextBoxGapValue?.hasOwnProperty('top')) {
setGapValue(nextBoxGapValue.top);
} else {
setGapValue({
top: nextBoxGapValue?.top,
left: nextBoxGapValue?.left
});
}
};
const resetGapValue = () => setGapValue(undefined);
const hasGapValue = () => !!value?.spacing?.blockGap;
// Min Height
const showMinHeightControl = useHasMinHeight(settings);
const minHeightValue = decodeValue(inheritedValue?.dimensions?.minHeight);
const setMinHeightValue = newValue => {
const tempValue = setImmutably(value, ['dimensions', 'minHeight'], newValue);
// Apply min-height, while removing any applied aspect ratio.
onChange(setImmutably(tempValue, ['dimensions', 'aspectRatio'], undefined));
};
const resetMinHeightValue = () => {
setMinHeightValue(undefined);
};
const hasMinHeightValue = () => !!value?.dimensions?.minHeight;
// Aspect Ratio
const showAspectRatioControl = useHasAspectRatio(settings);
const aspectRatioValue = decodeValue(inheritedValue?.dimensions?.aspectRatio);
const setAspectRatioValue = newValue => {
const tempValue = setImmutably(value, ['dimensions', 'aspectRatio'], newValue);
// Apply aspect-ratio, while removing any applied min-height.
onChange(setImmutably(tempValue, ['dimensions', 'minHeight'], undefined));
};
const hasAspectRatioValue = () => !!value?.dimensions?.aspectRatio;
// Child Layout
const showChildLayoutControl = useHasChildLayout(settings);
const childLayout = inheritedValue?.layout;
const {
orientation = 'horizontal'
} = (_settings$parentLayou2 = settings?.parentLayout) !== null && _settings$parentLayou2 !== void 0 ? _settings$parentLayou2 : {};
const childLayoutOrientationLabel = orientation === 'horizontal' ? (0,external_wp_i18n_namespaceObject.__)('Width') : (0,external_wp_i18n_namespaceObject.__)('Height');
const setChildLayout = newChildLayout => {
onChange({
...value,
layout: {
...value?.layout,
...newChildLayout
}
});
};
const resetChildLayoutValue = () => {
setChildLayout({
selfStretch: undefined,
flexSize: undefined
});
};
const hasChildLayoutValue = () => !!value?.layout;
const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => {
return {
...previousValue,
layout: utils_cleanEmptyObject({
...previousValue?.layout,
contentSize: undefined,
wideSize: undefined,
selfStretch: undefined,
flexSize: undefined
}),
spacing: {
...previousValue?.spacing,
padding: undefined,
margin: undefined,
blockGap: undefined
},
dimensions: {
...previousValue?.dimensions,
minHeight: undefined,
aspectRatio: undefined
}
};
}, []);
const onMouseLeaveControls = () => onVisualize(false);
return (0,external_React_.createElement)(Wrapper, {
resetAllFilter: resetAllFilter,
value: value,
onChange: onChange,
panelId: panelId
}, (showContentSizeControl || showWideSizeControl) && (0,external_React_.createElement)("span", {
className: "span-columns"
}, (0,external_wp_i18n_namespaceObject.__)('Set the width of the main content area.')), showContentSizeControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "single-column",
label: (0,external_wp_i18n_namespaceObject.__)('Content size'),
hasValue: hasUserSetContentSizeValue,
onDeselect: resetContentSizeValue,
isShownByDefault: (_defaultControls$cont = defaultControls.contentSize) !== null && _defaultControls$cont !== void 0 ? _defaultControls$cont : dimensions_panel_DEFAULT_CONTROLS.contentSize,
panelId: panelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
alignment: "flex-end",
justify: "flex-start"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Content'),
labelPosition: "top",
__unstableInputWidth: "80px",
value: contentSizeValue || '',
onChange: nextContentSize => {
setContentSizeValue(nextContentSize);
},
units: units
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_React_.createElement)(build_module_icon, {
icon: position_center
})))), showWideSizeControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "single-column",
label: (0,external_wp_i18n_namespaceObject.__)('Wide size'),
hasValue: hasUserSetWideSizeValue,
onDeselect: resetWideSizeValue,
isShownByDefault: (_defaultControls$wide = defaultControls.wideSize) !== null && _defaultControls$wide !== void 0 ? _defaultControls$wide : dimensions_panel_DEFAULT_CONTROLS.wideSize,
panelId: panelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
alignment: "flex-end",
justify: "flex-start"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Wide'),
labelPosition: "top",
__unstableInputWidth: "80px",
value: wideSizeValue || '',
onChange: nextWideSize => {
setWideSizeValue(nextWideSize);
},
units: units
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_React_.createElement)(build_module_icon, {
icon: stretch_wide
})))), showPaddingControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: hasPaddingValue,
label: (0,external_wp_i18n_namespaceObject.__)('Padding'),
onDeselect: resetPaddingValue,
isShownByDefault: (_defaultControls$padd = defaultControls.padding) !== null && _defaultControls$padd !== void 0 ? _defaultControls$padd : dimensions_panel_DEFAULT_CONTROLS.padding,
className: classnames_default()({
'tools-panel-item-spacing': showSpacingPresetsControl
}),
panelId: panelId
}, !showSpacingPresetsControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, {
values: paddingValues,
onChange: setPaddingValues,
label: (0,external_wp_i18n_namespaceObject.__)('Padding'),
sides: paddingSides,
units: units,
allowReset: false,
splitOnAxis: isAxialPadding,
onMouseOver: onMouseOverPadding,
onMouseOut: onMouseLeaveControls
}), showSpacingPresetsControl && (0,external_React_.createElement)(SpacingSizesControl, {
values: paddingValues,
onChange: setPaddingValues,
label: (0,external_wp_i18n_namespaceObject.__)('Padding'),
sides: paddingSides,
units: units,
allowReset: false,
onMouseOver: onMouseOverPadding,
onMouseOut: onMouseLeaveControls
})), showMarginControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: hasMarginValue,
label: (0,external_wp_i18n_namespaceObject.__)('Margin'),
onDeselect: resetMarginValue,
isShownByDefault: (_defaultControls$marg = defaultControls.margin) !== null && _defaultControls$marg !== void 0 ? _defaultControls$marg : dimensions_panel_DEFAULT_CONTROLS.margin,
className: classnames_default()({
'tools-panel-item-spacing': showSpacingPresetsControl
}),
panelId: panelId
}, !showSpacingPresetsControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, {
values: marginValues,
onChange: setMarginValues,
label: (0,external_wp_i18n_namespaceObject.__)('Margin'),
sides: marginSides,
units: units,
allowReset: false,
splitOnAxis: isAxialMargin,
onMouseOver: onMouseOverMargin,
onMouseOut: onMouseLeaveControls
}), showSpacingPresetsControl && (0,external_React_.createElement)(SpacingSizesControl, {
values: marginValues,
onChange: setMarginValues,
label: (0,external_wp_i18n_namespaceObject.__)('Margin'),
sides: marginSides,
units: units,
allowReset: false,
onMouseOver: onMouseOverMargin,
onMouseOut: onMouseLeaveControls
})), showGapControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: hasGapValue,
label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
onDeselect: resetGapValue,
isShownByDefault: (_defaultControls$bloc = defaultControls.blockGap) !== null && _defaultControls$bloc !== void 0 ? _defaultControls$bloc : dimensions_panel_DEFAULT_CONTROLS.blockGap,
className: classnames_default()({
'tools-panel-item-spacing': showSpacingPresetsControl
}),
panelId: panelId
}, !showSpacingPresetsControl && (isAxialGap ? (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
min: 0,
onChange: setGapValues,
units: units,
sides: gapSides,
values: gapValues,
allowReset: false,
splitOnAxis: isAxialGap
}) : (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
__unstableInputWidth: "80px",
min: 0,
onChange: setGapValue,
units: units,
value: gapValue
})), showSpacingPresetsControl && (0,external_React_.createElement)(SpacingSizesControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
min: 0,
onChange: setGapValues,
showSideInLabel: false,
sides: isAxialGap ? gapSides : ['top'] // Use 'top' as the shorthand property in non-axial configurations.
,
values: gapValues,
allowReset: false
})), showMinHeightControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: hasMinHeightValue,
label: (0,external_wp_i18n_namespaceObject.__)('Minimum height'),
onDeselect: resetMinHeightValue,
isShownByDefault: (_defaultControls$minH = defaultControls.minHeight) !== null && _defaultControls$minH !== void 0 ? _defaultControls$minH : dimensions_panel_DEFAULT_CONTROLS.minHeight,
panelId: panelId
}, (0,external_React_.createElement)(HeightControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Minimum height'),
value: minHeightValue,
onChange: setMinHeightValue
})), showAspectRatioControl && (0,external_React_.createElement)(AspectRatioTool, {
hasValue: hasAspectRatioValue,
value: aspectRatioValue,
onChange: setAspectRatioValue,
panelId: panelId,
isShownByDefault: (_defaultControls$aspe = defaultControls.aspectRatio) !== null && _defaultControls$aspe !== void 0 ? _defaultControls$aspe : dimensions_panel_DEFAULT_CONTROLS.aspectRatio
}), showChildLayoutControl && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
as: external_wp_components_namespaceObject.__experimentalToolsPanelItem,
spacing: 2,
hasValue: hasChildLayoutValue,
label: childLayoutOrientationLabel,
onDeselect: resetChildLayoutValue,
isShownByDefault: (_defaultControls$chil = defaultControls.childLayout) !== null && _defaultControls$chil !== void 0 ? _defaultControls$chil : dimensions_panel_DEFAULT_CONTROLS.childLayout,
panelId: panelId
}, (0,external_React_.createElement)(ChildLayoutControl, {
value: childLayout,
onChange: setChildLayout,
parentLayout: settings?.parentLayout
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-popover/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]);
}
/* harmony default export */ const use_popover_scroll = (usePopoverScroll);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-popover/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;
function BlockPopover({
clientId,
bottomClientId,
children,
__unstableRefreshSize,
__unstableCoverTarget = false,
__unstablePopoverSlot,
__unstableContentRef,
shift = true,
...props
}, ref) {
const selectedElement = useBlockElement(clientId);
const lastSelectedElement = useBlockElement(bottomClientId !== null && bottomClientId !== void 0 ? bottomClientId : clientId);
const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, use_popover_scroll(__unstableContentRef)]);
const [popoverDimensionsRecomputeCounter, forceRecomputePopoverDimensions] = (0,external_wp_element_namespaceObject.useReducer)(
// Module is there to make sure that the counter doesn't overflow.
s => (s + 1) % MAX_POPOVER_RECOMPUTE_COUNTER, 0);
// When blocks are moved up/down, they are animated to their new position by
// updating the `transform` property manually (i.e. without using CSS
// transitions or animations). The animation, which can also scroll the block
// editor, can sometimes cause the position of the Popover to get out of sync.
// A MutationObserver is therefore used to make sure that changes to the
// selectedElement's attribute (i.e. `transform`) can be tracked and used to
// trigger the Popover to rerender.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (!selectedElement) {
return;
}
const observer = new window.MutationObserver(forceRecomputePopoverDimensions);
observer.observe(selectedElement, {
attributes: true
});
return () => {
observer.disconnect();
};
}, [selectedElement]);
const style = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (
// popoverDimensionsRecomputeCounter is by definition always equal or greater
// than 0. This check is only there to satisfy the correctness of the
// exhaustive-deps rule for the `useMemo` hook.
popoverDimensionsRecomputeCounter < 0 || !selectedElement || lastSelectedElement !== selectedElement) {
return {};
}
return {
position: 'absolute',
width: selectedElement.offsetWidth,
height: selectedElement.offsetHeight
};
}, [selectedElement, lastSelectedElement, __unstableRefreshSize, popoverDimensionsRecomputeCounter]);
const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (
// popoverDimensionsRecomputeCounter is by definition always equal or greater
// than 0. This check is only there to satisfy the correctness of the
// exhaustive-deps rule for the `useMemo` hook.
popoverDimensionsRecomputeCounter < 0 || !selectedElement || bottomClientId && !lastSelectedElement) {
return undefined;
}
return {
getBoundingClientRect() {
var _lastSelectedBCR$left, _lastSelectedBCR$top, _lastSelectedBCR$righ, _lastSelectedBCR$bott;
const selectedBCR = selectedElement.getBoundingClientRect();
const lastSelectedBCR = lastSelectedElement?.getBoundingClientRect();
// Get the biggest rectangle that encompasses completely the currently
// selected element and the last selected element:
// - for top/left coordinates, use the smaller numbers
// - for the bottom/right coordinates, use the largest numbers
const left = Math.min(selectedBCR.left, (_lastSelectedBCR$left = lastSelectedBCR?.left) !== null && _lastSelectedBCR$left !== void 0 ? _lastSelectedBCR$left : Infinity);
const top = Math.min(selectedBCR.top, (_lastSelectedBCR$top = lastSelectedBCR?.top) !== null && _lastSelectedBCR$top !== void 0 ? _lastSelectedBCR$top : Infinity);
const right = Math.max(selectedBCR.right, (_lastSelectedBCR$righ = lastSelectedBCR.right) !== null && _lastSelectedBCR$righ !== void 0 ? _lastSelectedBCR$righ : -Infinity);
const bottom = Math.max(selectedBCR.bottom, (_lastSelectedBCR$bott = lastSelectedBCR.bottom) !== null && _lastSelectedBCR$bott !== void 0 ? _lastSelectedBCR$bott : -Infinity);
const width = right - left;
const height = bottom - top;
return new window.DOMRect(left, top, width, height);
},
contextElement: selectedElement
};
}, [bottomClientId, lastSelectedElement, selectedElement, popoverDimensionsRecomputeCounter]);
if (!selectedElement || bottomClientId && !lastSelectedElement) {
return null;
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, {
ref: mergedRefs,
animate: false,
focusOnMount: false,
anchor: popoverAnchor
// Render in the old slot if needed for backward compatibility,
// otherwise render in place (not in the default popover slot).
,
__unstableSlotName: __unstablePopoverSlot,
inline: !__unstablePopoverSlot,
placement: "top-start",
resize: false,
flip: false,
shift: shift,
...props,
className: classnames_default()('block-editor-block-popover', props.className),
variant: "unstyled"
}, __unstableCoverTarget && (0,external_React_.createElement)("div", {
style: style
}, children), !__unstableCoverTarget && children);
}
/* harmony default export */ const block_popover = ((0,external_wp_element_namespaceObject.forwardRef)(BlockPopover));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/margin.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function getComputedCSS(element, property) {
return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property);
}
function MarginVisualizer({
clientId,
attributes,
forceShow
}) {
const blockElement = useBlockElement(clientId);
const [style, setStyle] = (0,external_wp_element_namespaceObject.useState)();
const margin = attributes?.style?.spacing?.margin;
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!blockElement || null === blockElement.ownerDocument.defaultView) {
return;
}
const top = getComputedCSS(blockElement, 'margin-top');
const right = getComputedCSS(blockElement, 'margin-right');
const bottom = getComputedCSS(blockElement, 'margin-bottom');
const left = getComputedCSS(blockElement, 'margin-left');
setStyle({
borderTopWidth: top,
borderRightWidth: right,
borderBottomWidth: bottom,
borderLeftWidth: left,
top: top ? `-${top}` : 0,
right: right ? `-${right}` : 0,
bottom: bottom ? `-${bottom}` : 0,
left: left ? `-${left}` : 0
});
}, [blockElement, margin]);
const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(false);
const valueRef = (0,external_wp_element_namespaceObject.useRef)(margin);
const timeoutRef = (0,external_wp_element_namespaceObject.useRef)();
const clearTimer = () => {
if (timeoutRef.current) {
window.clearTimeout(timeoutRef.current);
}
};
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!external_wp_isShallowEqual_default()(margin, valueRef.current) && !forceShow) {
setIsActive(true);
valueRef.current = margin;
timeoutRef.current = setTimeout(() => {
setIsActive(false);
}, 400);
}
return () => {
setIsActive(false);
clearTimer();
};
}, [margin, forceShow]);
if (!isActive && !forceShow) {
return null;
}
return (0,external_React_.createElement)(block_popover, {
clientId: clientId,
__unstableCoverTarget: true,
__unstableRefreshSize: margin,
__unstablePopoverSlot: "block-toolbar",
shift: false
}, (0,external_React_.createElement)("div", {
className: "block-editor__padding-visualizer",
style: style
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/padding.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function padding_getComputedCSS(element, property) {
return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue(property);
}
function PaddingVisualizer({
clientId,
value,
forceShow
}) {
const blockElement = useBlockElement(clientId);
const [style, setStyle] = (0,external_wp_element_namespaceObject.useState)();
const padding = value?.spacing?.padding;
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!blockElement || null === blockElement.ownerDocument.defaultView) {
return;
}
setStyle({
borderTopWidth: padding_getComputedCSS(blockElement, 'padding-top'),
borderRightWidth: padding_getComputedCSS(blockElement, 'padding-right'),
borderBottomWidth: padding_getComputedCSS(blockElement, 'padding-bottom'),
borderLeftWidth: padding_getComputedCSS(blockElement, 'padding-left')
});
}, [blockElement, padding]);
const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(false);
const valueRef = (0,external_wp_element_namespaceObject.useRef)(padding);
const timeoutRef = (0,external_wp_element_namespaceObject.useRef)();
const clearTimer = () => {
if (timeoutRef.current) {
window.clearTimeout(timeoutRef.current);
}
};
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!external_wp_isShallowEqual_default()(padding, valueRef.current) && !forceShow) {
setIsActive(true);
valueRef.current = padding;
timeoutRef.current = setTimeout(() => {
setIsActive(false);
}, 400);
}
return () => {
setIsActive(false);
clearTimer();
};
}, [padding, forceShow]);
if (!isActive && !forceShow) {
return null;
}
return (0,external_React_.createElement)(block_popover, {
clientId: clientId,
__unstableCoverTarget: true,
__unstableRefreshSize: padding,
__unstablePopoverSlot: "block-toolbar",
shift: false
}, (0,external_React_.createElement)("div", {
className: "block-editor__padding-visualizer",
style: style
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/dimensions.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DIMENSIONS_SUPPORT_KEY = 'dimensions';
const SPACING_SUPPORT_KEY = 'spacing';
const dimensions_ALL_SIDES = (/* unused pure expression or super */ null && (['top', 'right', 'bottom', 'left']));
const dimensions_AXIAL_SIDES = (/* unused pure expression or super */ null && (['vertical', 'horizontal']));
function useVisualizer() {
const [property, setProperty] = (0,external_wp_element_namespaceObject.useState)(false);
const {
hideBlockInterface,
showBlockInterface
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!property) {
showBlockInterface();
} else {
hideBlockInterface();
}
}, [property, showBlockInterface, hideBlockInterface]);
return [property, setProperty];
}
function DimensionsInspectorControl({
children,
resetAllFilter
}) {
const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(attributes => {
const existingStyle = attributes.style;
const updatedStyle = resetAllFilter(existingStyle);
return {
...attributes,
style: updatedStyle
};
}, [resetAllFilter]);
return (0,external_React_.createElement)(inspector_controls, {
group: "dimensions",
resetAllFilter: attributesResetAllFilter
}, children);
}
function dimensions_DimensionsPanel({
clientId,
name,
setAttributes,
settings
}) {
const isEnabled = useHasDimensionsPanel(settings);
const value = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlockAttributes(clientId)?.style, [clientId]);
const [visualizedProperty, setVisualizedProperty] = useVisualizer();
const onChange = newStyle => {
setAttributes({
style: utils_cleanEmptyObject(newStyle)
});
};
if (!isEnabled) {
return null;
}
const defaultDimensionsControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [DIMENSIONS_SUPPORT_KEY, '__experimentalDefaultControls']);
const defaultSpacingControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [SPACING_SUPPORT_KEY, '__experimentalDefaultControls']);
const defaultControls = {
...defaultDimensionsControls,
...defaultSpacingControls
};
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(DimensionsPanel, {
as: DimensionsInspectorControl,
panelId: clientId,
settings: settings,
value: value,
onChange: onChange,
defaultControls: defaultControls,
onVisualize: setVisualizedProperty
}), !!settings?.spacing?.padding && (0,external_React_.createElement)(PaddingVisualizer, {
forceShow: visualizedProperty === 'padding',
clientId: clientId,
value: value
}), !!settings?.spacing?.margin && (0,external_React_.createElement)(MarginVisualizer, {
forceShow: visualizedProperty === 'margin',
clientId: clientId,
value: value
}));
}
/**
* Determine whether there is block support for dimensions.
*
* @param {string} blockName Block name.
* @param {string} feature Background image feature to check for.
*
* @return {boolean} Whether there is support.
*/
function hasDimensionsSupport(blockName, feature = 'any') {
if (external_wp_element_namespaceObject.Platform.OS !== 'web') {
return false;
}
const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, DIMENSIONS_SUPPORT_KEY);
if (support === true) {
return true;
}
if (feature === 'any') {
return !!(support?.aspectRatio || !!support?.minHeight);
}
return !!support?.[feature];
}
/* harmony default export */ const dimensions = ({
useBlockProps: dimensions_useBlockProps,
attributeKeys: ['minHeight', 'style'],
hasSupport(name) {
return hasDimensionsSupport(name, 'aspectRatio');
}
});
function dimensions_useBlockProps({
name,
minHeight,
style
}) {
if (!hasDimensionsSupport(name, 'aspectRatio') || shouldSkipSerialization(name, DIMENSIONS_SUPPORT_KEY, 'aspectRatio')) {
return {};
}
const className = classnames_default()({
'has-aspect-ratio': !!style?.dimensions?.aspectRatio
});
// Allow dimensions-based inline style overrides to override any global styles rules that
// might be set for the block, and therefore affect the display of the aspect ratio.
const inlineStyleOverrides = {};
// Apply rules to unset incompatible styles.
// Note that a set `aspectRatio` will win out if both an aspect ratio and a minHeight are set.
// This is because the aspect ratio is a newer block support, so (in theory) any aspect ratio
// that is set should be intentional and should override any existing minHeight. The Cover block
// and dimensions controls have logic that will manually clear the aspect ratio if a minHeight
// is set.
if (style?.dimensions?.aspectRatio) {
// To ensure the aspect ratio does not get overridden by `minHeight` unset any existing rule.
inlineStyleOverrides.minHeight = 'unset';
} else if (minHeight || style?.dimensions?.minHeight) {
// To ensure the minHeight does not get overridden by `aspectRatio` unset any existing rule.
inlineStyleOverrides.aspectRatio = 'unset';
}
return {
className,
style: inlineStyleOverrides
};
}
/**
* @deprecated
*/
function useCustomSides() {
external_wp_deprecated_default()('wp.blockEditor.__experimentalUseCustomSides', {
since: '6.3',
version: '6.4'
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/style.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const styleSupportKeys = [...TYPOGRAPHY_SUPPORT_KEYS, BORDER_SUPPORT_KEY, COLOR_SUPPORT_KEY, DIMENSIONS_SUPPORT_KEY, BACKGROUND_SUPPORT_KEY, SPACING_SUPPORT_KEY, SHADOW_SUPPORT_KEY];
const hasStyleSupport = nameOrType => styleSupportKeys.some(key => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, key));
/**
* 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 = {};
// 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.
(0,external_wp_styleEngine_namespaceObject.getCSSRules)(styles).forEach(rule => {
output[rule.key] = rule.value;
});
return output;
}
/**
* 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<string, string[]>}
*/
const skipSerializationPathsEdit = {
[`${BORDER_SUPPORT_KEY}.__experimentalSkipSerialization`]: ['border'],
[`${COLOR_SUPPORT_KEY}.__experimentalSkipSerialization`]: [COLOR_SUPPORT_KEY],
[`${TYPOGRAPHY_SUPPORT_KEY}.__experimentalSkipSerialization`]: [TYPOGRAPHY_SUPPORT_KEY],
[`${DIMENSIONS_SUPPORT_KEY}.__experimentalSkipSerialization`]: [DIMENSIONS_SUPPORT_KEY],
[`${SPACING_SUPPORT_KEY}.__experimentalSkipSerialization`]: [SPACING_SUPPORT_KEY],
[`${SHADOW_SUPPORT_KEY}.__experimentalSkipSerialization`]: [SHADOW_SUPPORT_KEY]
};
/**
* 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<string, string[]>}
*/
const skipSerializationPathsSave = {
...skipSerializationPathsEdit,
[`${DIMENSIONS_SUPPORT_KEY}.aspectRatio`]: [`${DIMENSIONS_SUPPORT_KEY}.aspectRatio`],
// Skip serialization of aspect ratio in save mode.
[`${BACKGROUND_SUPPORT_KEY}`]: [BACKGROUND_SUPPORT_KEY] // Skip serialization of background support in save mode.
};
const skipSerializationPathsSaveChecks = {
[`${DIMENSIONS_SUPPORT_KEY}.aspectRatio`]: true,
[`${BACKGROUND_SUPPORT_KEY}`]: true
};
/**
* 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<string, string>}
*/
const renamedFeatures = {
gradients: 'gradient'
};
/**
* A utility function used to remove one or more paths from a style object.
* Works in a way similar to Lodash's `omit()`. See unit tests and examples below.
*
* It supports a single string path:
*
* ```
* omitStyle( { color: 'red' }, 'color' ); // {}
* ```
*
* or an array of paths:
*
* ```
* omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {}
* ```
*
* It also allows you to specify paths at multiple levels in a string.
*
* ```
* omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {}
* ```
*
* You can remove multiple paths at the same time:
*
* ```
* omitStyle(
* {
* typography: {
* textDecoration: 'underline',
* textTransform: 'uppercase',
* }
* },
* [
* 'typography.textDecoration',
* 'typography.textTransform',
* ]
* );
* // {}
* ```
*
* You can also specify nested paths as arrays:
*
* ```
* omitStyle(
* {
* typography: {
* textDecoration: 'underline',
* textTransform: 'uppercase',
* }
* },
* [
* [ 'typography', 'textDecoration' ],
* [ 'typography', 'textTransform' ],
* ]
* );
* // {}
* ```
*
* With regards to nesting of styles, infinite depth is supported:
*
* ```
* omitStyle(
* {
* border: {
* radius: {
* topLeft: '10px',
* topRight: '0.5rem',
* }
* }
* },
* [
* [ 'border', 'radius', 'topRight' ],
* ]
* );
* // { border: { radius: { topLeft: '10px' } } }
* ```
*
* The third argument, `preserveReference`, defines how to treat the input style object.
* It is mostly necessary to properly handle mutation when recursively handling the style object.
* Defaulting to `false`, this will always create a new object, avoiding to mutate `style`.
* However, when recursing, we change that value to `true` in order to work with a single copy
* of the original style object.
*
* @see https://lodash.com/docs/4.17.15#omit
*
* @param {Object} style Styles object.
* @param {Array|string} paths Paths to remove.
* @param {boolean} preserveReference True to mutate the `style` object, false otherwise.
* @return {Object} Styles object with the specified paths removed.
*/
function omitStyle(style, paths, preserveReference = false) {
if (!style) {
return style;
}
let newStyle = style;
if (!preserveReference) {
newStyle = JSON.parse(JSON.stringify(style));
}
if (!Array.isArray(paths)) {
paths = [paths];
}
paths.forEach(path => {
if (!Array.isArray(path)) {
path = path.split('.');
}
if (path.length > 1) {
const [firstSubpath, ...restPath] = path;
omitStyle(newStyle[firstSubpath], [restPath], true);
} else if (path.length === 1) {
delete newStyle[path[0]];
}
});
return newStyle;
}
/**
* Override props assigned to save component to inject the CSS variables definition.
*
* @param {Object} props Additional props applied to save element.
* @param {Object|string} blockNameOrType Block type.
* @param {Object} attributes Block attributes.
* @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.
*
* @return {Object} Filtered props applied to save element.
*/
function style_addSaveProps(props, blockNameOrType, attributes, skipPaths = skipSerializationPathsSave) {
if (!hasStyleSupport(blockNameOrType)) {
return props;
}
let {
style
} = attributes;
Object.entries(skipPaths).forEach(([indicator, path]) => {
const skipSerialization = skipSerializationPathsSaveChecks[indicator] || (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, indicator);
if (skipSerialization === true) {
style = omitStyle(style, path);
}
if (Array.isArray(skipSerialization)) {
skipSerialization.forEach(featureName => {
const feature = renamedFeatures[featureName] || featureName;
style = omitStyle(style, [[...path, feature]]);
});
}
});
props.style = {
...getInlineStyles(style),
...props.style
};
return props;
}
function BlockStyleControls({
clientId,
name,
setAttributes,
__unstableParentLayout
}) {
const settings = useBlockSettings(name, __unstableParentLayout);
const blockEditingMode = useBlockEditingMode();
const passedProps = {
clientId,
name,
setAttributes,
settings
};
if (blockEditingMode !== 'default') {
return null;
}
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(ColorEdit, {
...passedProps
}), (0,external_React_.createElement)(BackgroundImagePanel, {
...passedProps
}), (0,external_React_.createElement)(typography_TypographyPanel, {
...passedProps
}), (0,external_React_.createElement)(border_BorderPanel, {
...passedProps
}), (0,external_React_.createElement)(dimensions_DimensionsPanel, {
...passedProps
}));
}
/* harmony default export */ const style = ({
edit: BlockStyleControls,
hasSupport: hasStyleSupport,
addSaveProps: style_addSaveProps,
attributeKeys: ['style'],
useBlockProps: style_useBlockProps
});
// Defines which element types are supported, including their hover styles or
// any other elements that have been included under a single element type
// e.g. heading and h1-h6.
const elementTypes = [{
elementType: 'button'
}, {
elementType: 'link',
pseudo: [':hover']
}, {
elementType: 'heading',
elements: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
}];
function style_useBlockProps({
name,
style
}) {
const blockElementsContainerIdentifier = `wp-elements-${(0,external_wp_compose_namespaceObject.useInstanceId)(style_useBlockProps)}`;
// 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.
const baseElementSelector = `.editor-styles-wrapper .${blockElementsContainerIdentifier}`;
const blockElementStyles = style?.elements;
const styles = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!blockElementStyles) {
return;
}
const elementCSSRules = [];
elementTypes.forEach(({
elementType,
pseudo,
elements
}) => {
const skipSerialization = shouldSkipSerialization(name, COLOR_SUPPORT_KEY, elementType);
if (skipSerialization) {
return;
}
const elementStyles = blockElementStyles?.[elementType];
// Process primary element type styles.
if (elementStyles) {
const selector = scopeSelector(baseElementSelector, external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementType]);
elementCSSRules.push((0,external_wp_styleEngine_namespaceObject.compileCSS)(elementStyles, {
selector
}));
// Process any interactive states for the element type.
if (pseudo) {
pseudo.forEach(pseudoSelector => {
if (elementStyles[pseudoSelector]) {
elementCSSRules.push((0,external_wp_styleEngine_namespaceObject.compileCSS)(elementStyles[pseudoSelector], {
selector: scopeSelector(baseElementSelector, `${external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementType]}${pseudoSelector}`)
}));
}
});
}
}
// Process related elements e.g. h1-h6 for headings
if (elements) {
elements.forEach(element => {
if (blockElementStyles[element]) {
elementCSSRules.push((0,external_wp_styleEngine_namespaceObject.compileCSS)(blockElementStyles[element], {
selector: scopeSelector(baseElementSelector, external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element])
}));
}
});
}
});
return elementCSSRules.length > 0 ? elementCSSRules.join('') : undefined;
}, [baseElementSelector, blockElementStyles, name]);
useStyleOverride({
css: styles
});
return style_addSaveProps({
className: blockElementsContainerIdentifier
}, name, {
style
}, skipSerializationPathsEdit);
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/style/addAttribute', style_addAttribute);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/settings.js
/**
* WordPress dependencies
*/
const hasSettingsSupport = blockType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, '__experimentalSettings', false);
function settings_addAttribute(settings) {
if (!hasSettingsSupport(settings)) {
return settings;
}
// Allow blocks to specify their own attribute definition with default values if needed.
if (!settings?.attributes?.settings) {
settings.attributes = {
...settings.attributes,
settings: {
type: 'object'
}
};
}
return settings;
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/settings/addAttribute', settings_addAttribute);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/filter.js
/**
* WordPress dependencies
*/
const filter = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12 4 4 19h16L12 4zm0 3.2 5.5 10.3H12V7.2z"
}));
/* harmony default export */ const library_filter = (filter);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/duotone-control/index.js
/**
* WordPress dependencies
*/
function DuotoneControl({
id: idProp,
colorPalette,
duotonePalette,
disableCustomColors,
disableCustomDuotone,
value,
onChange
}) {
let toolbarIcon;
if (value === 'unset') {
toolbarIcon = (0,external_React_.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
className: "block-editor-duotone-control__unset-indicator"
});
} else if (value) {
toolbarIcon = (0,external_React_.createElement)(external_wp_components_namespaceObject.DuotoneSwatch, {
values: value
});
} else {
toolbarIcon = (0,external_React_.createElement)(build_module_icon, {
icon: library_filter
});
}
const actionLabel = (0,external_wp_i18n_namespaceObject.__)('Apply duotone filter');
const id = (0,external_wp_compose_namespaceObject.useInstanceId)(DuotoneControl, 'duotone-control', idProp);
const descriptionId = `${id}__description`;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: {
className: 'block-editor-duotone-control__popover',
headerTitle: (0,external_wp_i18n_namespaceObject.__)('Duotone')
},
renderToggle: ({
isOpen,
onToggle
}) => {
const openOnArrowDown = event => {
if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
event.preventDefault();
onToggle();
}
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
showTooltip: true,
onClick: onToggle,
"aria-haspopup": "true",
"aria-expanded": isOpen,
onKeyDown: openOnArrowDown,
label: actionLabel,
icon: toolbarIcon
});
},
renderContent: () => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Duotone')
}, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Create a two-tone color effect without losing your original image.')), (0,external_React_.createElement)(external_wp_components_namespaceObject.DuotonePicker, {
"aria-label": actionLabel,
"aria-describedby": descriptionId,
colorPalette: colorPalette,
duotonePalette: duotonePalette,
disableCustomColors: disableCustomColors,
disableCustomDuotone: disableCustomDuotone,
value: value,
onChange: onChange
}))
});
}
/* harmony default export */ const duotone_control = (DuotoneControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/duotone/utils.js
/**
* External dependencies
*/
/**
* 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: [],
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;
}
/**
* Stylesheet for disabling a global styles duotone filter.
*
* @param {string} selector Selector to disable the filter for.
*
* @return {string} Filter none style.
*/
function getDuotoneUnsetStylesheet(selector) {
return `${selector}{filter:none}`;
}
/**
* SVG and stylesheet needed for rendering the duotone filter.
*
* @param {string} selector Selector to apply the filter to.
* @param {string} id Unique id for this duotone filter.
*
* @return {string} Duotone filter style.
*/
function getDuotoneStylesheet(selector, id) {
return `${selector}{filter:url(#${id})}`;
}
/**
* The SVG part of the duotone filter.
*
* @param {string} id Unique id for this duotone filter.
* @param {string[]} colors Color strings from dark to light.
*
* @return {string} Duotone SVG.
*/
function getDuotoneFilter(id, colors) {
const values = getValuesFromColors(colors);
return `
<svg
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 0 0"
width="0"
height="0"
focusable="false"
role="none"
aria-hidden="true"
style="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;"
>
<defs>
<filter id="${id}">
<!--
Use sRGB instead of linearRGB so transparency looks correct.
Use perceptual brightness to convert to grayscale.
-->
<feColorMatrix color-interpolation-filters="sRGB" type="matrix" values=" .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "></feColorMatrix>
<!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. -->
<feComponentTransfer color-interpolation-filters="sRGB">
<feFuncR type="table" tableValues="${values.r.join(' ')}"></feFuncR>
<feFuncG type="table" tableValues="${values.g.join(' ')}"></feFuncG>
<feFuncB type="table" tableValues="${values.b.join(' ')}"></feFuncB>
<feFuncA type="table" tableValues="${values.a.join(' ')}"></feFuncA>
</feComponentTransfer>
<!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. -->
<feComposite in2="SourceGraphic" operator="in"></feComposite>
</filter>
</defs>
</svg>`;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/get-block-css-selector.js
/**
* Internal dependencies
*/
/**
* Determine the CSS selector for the block type and target provided, returning
* it if available.
*
* @param {import('@wordpress/blocks').Block} blockType The block's type.
* @param {string|string[]} target The desired selector's target e.g. `root`, delimited string, or array path.
* @param {Object} options Options object.
* @param {boolean} options.fallback Whether or not to fallback to broader selector.
*
* @return {?string} The CSS selector or `null` if no selector available.
*/
function getBlockCSSSelector(blockType, target = 'root', options = {}) {
if (!target) {
return null;
}
const {
fallback = false
} = options;
const {
name,
selectors,
supports
} = blockType;
const hasSelectors = selectors && Object.keys(selectors).length > 0;
const path = Array.isArray(target) ? target.join('.') : target;
// Root selector.
// Calculated before returning as it can be used as a fallback for feature
// selectors later on.
let rootSelector = null;
if (hasSelectors && selectors.root) {
// Use the selectors API if available.
rootSelector = selectors?.root;
} else if (supports?.__experimentalSelector) {
// Use the old experimental selector supports property if set.
rootSelector = supports.__experimentalSelector;
} else {
// If no root selector found, generate default block class selector.
rootSelector = '.wp-block-' + name.replace('core/', '').replace('/', '-');
}
// Return selector if it's the root target we are looking for.
if (path === 'root') {
return rootSelector;
}
// If target is not `root` or `duotone` we have a feature or subfeature
// as the target. If the target is a string convert to an array.
const pathArray = Array.isArray(target) ? target : target.split('.');
// Feature selectors ( may fallback to root selector );
if (pathArray.length === 1) {
const fallbackSelector = fallback ? rootSelector : null;
// Prefer the selectors API if available.
if (hasSelectors) {
// Get selector from either `feature.root` or shorthand path.
const featureSelector = getValueFromObjectPath(selectors, `${path}.root`, null) || getValueFromObjectPath(selectors, path, null);
// Return feature selector if found or any available fallback.
return featureSelector || fallbackSelector;
}
// Try getting old experimental supports selector value.
const featureSelector = getValueFromObjectPath(supports, `${path}.__experimentalSelector`, null);
// If nothing to work with, provide fallback selector if available.
if (!featureSelector) {
return fallbackSelector;
}
// Scope the feature selector by the block's root selector.
return scopeSelector(rootSelector, featureSelector);
}
// Subfeature selector.
// This may fallback either to parent feature or root selector.
let subfeatureSelector;
// Use selectors API if available.
if (hasSelectors) {
subfeatureSelector = getValueFromObjectPath(selectors, path, null);
}
// Only return if we have a subfeature selector.
if (subfeatureSelector) {
return subfeatureSelector;
}
// To this point we don't have a subfeature selector. If a fallback has been
// requested, remove subfeature from target path and return results of a
// call for the parent feature's selector.
if (fallback) {
return getBlockCSSSelector(blockType, pathArray[0], options);
}
// We tried.
return null;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/filters-panel.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const filters_panel_EMPTY_ARRAY = [];
function useMultiOriginColorPresets(settings, {
presetSetting,
defaultSetting
}) {
const disableDefault = !settings?.color?.[defaultSetting];
const userPresets = settings?.color?.[presetSetting]?.custom || filters_panel_EMPTY_ARRAY;
const themePresets = settings?.color?.[presetSetting]?.theme || filters_panel_EMPTY_ARRAY;
const defaultPresets = settings?.color?.[presetSetting]?.default || filters_panel_EMPTY_ARRAY;
return (0,external_wp_element_namespaceObject.useMemo)(() => [...userPresets, ...themePresets, ...(disableDefault ? filters_panel_EMPTY_ARRAY : defaultPresets)], [disableDefault, userPresets, themePresets, defaultPresets]);
}
function useHasFiltersPanel(settings) {
return useHasDuotoneControl(settings);
}
function useHasDuotoneControl(settings) {
return settings.color.customDuotone || settings.color.defaultDuotone || settings.color.duotone.length > 0;
}
function FiltersToolsPanel({
resetAllFilter,
onChange,
value,
panelId,
children
}) {
const resetAll = () => {
const updatedValue = resetAllFilter(value);
onChange(updatedValue);
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
label: (0,external_wp_i18n_namespaceObject._x)('Filters', 'Name for applying graphical effects'),
resetAll: resetAll,
panelId: panelId,
dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS
}, children);
}
const filters_panel_DEFAULT_CONTROLS = {
duotone: true
};
const filters_panel_popoverProps = {
placement: 'left-start',
offset: 36,
shift: true,
className: 'block-editor-duotone-control__popover',
headerTitle: (0,external_wp_i18n_namespaceObject.__)('Duotone')
};
const LabeledColorIndicator = ({
indicator,
label
}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "flex-start"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalZStack, {
isLayered: false,
offset: -8
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
expanded: false
}, indicator === 'unset' || !indicator ? (0,external_React_.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
className: "block-editor-duotone-control__unset-indicator"
}) : (0,external_React_.createElement)(external_wp_components_namespaceObject.DuotoneSwatch, {
values: indicator
}))), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
title: label
}, label));
function FiltersPanel({
as: Wrapper = FiltersToolsPanel,
value,
onChange,
inheritedValue = value,
settings,
panelId,
defaultControls = filters_panel_DEFAULT_CONTROLS
}) {
const decodeValue = rawValue => getValueFromVariable({
settings
}, '', rawValue);
// Duotone
const hasDuotoneEnabled = useHasDuotoneControl(settings);
const duotonePalette = useMultiOriginColorPresets(settings, {
presetSetting: 'duotone',
defaultSetting: 'defaultDuotone'
});
const colorPalette = useMultiOriginColorPresets(settings, {
presetSetting: 'palette',
defaultSetting: 'defaultPalette'
});
const duotone = decodeValue(inheritedValue?.filter?.duotone);
const setDuotone = newValue => {
const duotonePreset = duotonePalette.find(({
colors
}) => {
return colors === newValue;
});
const settedValue = duotonePreset ? `var:preset|duotone|${duotonePreset.slug}` : newValue;
onChange(setImmutably(value, ['filter', 'duotone'], settedValue));
};
const hasDuotone = () => !!value?.filter?.duotone;
const resetDuotone = () => setDuotone(undefined);
const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => {
return {
...previousValue,
filter: {
...previousValue.filter,
duotone: undefined
}
};
}, []);
return (0,external_React_.createElement)(Wrapper, {
resetAllFilter: resetAllFilter,
value: value,
onChange: onChange,
panelId: panelId
}, hasDuotoneEnabled && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Duotone'),
hasValue: hasDuotone,
onDeselect: resetDuotone,
isShownByDefault: defaultControls.duotone,
panelId: panelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: filters_panel_popoverProps,
className: "block-editor-global-styles-filters-panel__dropdown",
renderToggle: ({
onToggle,
isOpen
}) => {
const toggleProps = {
onClick: onToggle,
className: classnames_default()({
'is-open': isOpen
}),
'aria-expanded': isOpen
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
isBordered: true,
isSeparated: true
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
...toggleProps
}, (0,external_React_.createElement)(LabeledColorIndicator, {
indicator: duotone,
label: (0,external_wp_i18n_namespaceObject.__)('Duotone')
})));
},
renderContent: () => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, {
paddingSize: "small"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Duotone')
}, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Create a two-tone color effect without losing your original image.')), (0,external_React_.createElement)(external_wp_components_namespaceObject.DuotonePicker, {
colorPalette: colorPalette,
duotonePalette: duotonePalette
// TODO: Re-enable both when custom colors are supported for block-level styles.
,
disableCustomColors: true,
disableCustomDuotone: true,
value: duotone,
onChange: setDuotone
})))
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/duotone.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const duotone_EMPTY_ARRAY = [];
// Safari does not always update the duotone filter when the duotone colors
// are changed. This browser check is later used to force a re-render of the block
// element to ensure the duotone filter is updated. The check is included at the
// root of this file as it only needs to be run once per page load.
const isSafari = window?.navigator.userAgent && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome') && !window.navigator.userAgent.includes('Chromium');
k([names]);
function useMultiOriginPresets({
presetSetting,
defaultSetting
}) {
const [enableDefault, userPresets, themePresets, defaultPresets] = use_settings_useSettings(defaultSetting, `${presetSetting}.custom`, `${presetSetting}.theme`, `${presetSetting}.default`);
return (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPresets || duotone_EMPTY_ARRAY), ...(themePresets || duotone_EMPTY_ARRAY), ...(enableDefault && defaultPresets || duotone_EMPTY_ARRAY)], [enableDefault, userPresets, themePresets, defaultPresets]);
}
function getColorsFromDuotonePreset(duotone, duotonePalette) {
if (!duotone) {
return;
}
const preset = duotonePalette?.find(({
slug
}) => {
return duotone === `var:preset|duotone|${slug}`;
});
return preset ? preset.colors : undefined;
}
function getDuotonePresetFromColors(colors, duotonePalette) {
if (!colors || !Array.isArray(colors)) {
return;
}
const preset = duotonePalette?.find(duotonePreset => {
return duotonePreset?.colors?.every((val, index) => val === colors[index]);
});
return preset ? `var:preset|duotone|${preset.slug}` : undefined;
}
function DuotonePanelPure({
style,
setAttributes,
name
}) {
const duotoneStyle = style?.color?.duotone;
const settings = useBlockSettings(name);
const blockEditingMode = useBlockEditingMode();
const duotonePalette = useMultiOriginPresets({
presetSetting: 'color.duotone',
defaultSetting: 'color.defaultDuotone'
});
const colorPalette = useMultiOriginPresets({
presetSetting: 'color.palette',
defaultSetting: 'color.defaultPalette'
});
const [enableCustomColors, enableCustomDuotone] = use_settings_useSettings('color.custom', 'color.customDuotone');
const disableCustomColors = !enableCustomColors;
const disableCustomDuotone = !enableCustomDuotone || colorPalette?.length === 0 && disableCustomColors;
if (duotonePalette?.length === 0 && disableCustomDuotone) {
return null;
}
if (blockEditingMode !== 'default') {
return null;
}
const duotonePresetOrColors = !Array.isArray(duotoneStyle) ? getColorsFromDuotonePreset(duotoneStyle, duotonePalette) : duotoneStyle;
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(inspector_controls, {
group: "filter"
}, (0,external_React_.createElement)(FiltersPanel, {
value: {
filter: {
duotone: duotonePresetOrColors
}
},
onChange: newDuotone => {
const newStyle = {
...style,
color: {
...newDuotone?.filter
}
};
setAttributes({
style: newStyle
});
},
settings: settings
})), (0,external_React_.createElement)(block_controls, {
group: "block",
__experimentalShareWithChildBlocks: true
}, (0,external_React_.createElement)(duotone_control, {
duotonePalette: duotonePalette,
colorPalette: colorPalette,
disableCustomDuotone: disableCustomDuotone,
disableCustomColors: disableCustomColors,
value: duotonePresetOrColors,
onChange: newDuotone => {
const maybePreset = getDuotonePresetFromColors(newDuotone, duotonePalette);
const newStyle = {
...style,
color: {
...style?.color,
duotone: maybePreset !== null && maybePreset !== void 0 ? maybePreset : newDuotone // use preset or fallback to custom colors.
}
};
setAttributes({
style: newStyle
});
},
settings: settings
})));
}
/* harmony default export */ const duotone = ({
shareWithChildBlocks: true,
edit: DuotonePanelPure,
useBlockProps: duotone_useBlockProps,
attributeKeys: ['style'],
hasSupport(name) {
return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'filter.duotone');
}
});
/**
* 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) {
// Previous `color.__experimentalDuotone` support flag is migrated via
// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.
if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'filter.duotone')) {
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;
}
function useDuotoneStyles({
clientId,
id: filterId,
selector: duotoneSelector,
attribute: duotoneAttr
}) {
const duotonePalette = useMultiOriginPresets({
presetSetting: 'color.duotone',
defaultSetting: 'color.defaultDuotone'
});
// Possible values for duotone attribute:
// 1. Array of colors - e.g. ['#000000', '#ffffff'].
// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''
// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.
const isCustom = Array.isArray(duotoneAttr);
const duotonePreset = isCustom ? undefined : getColorsFromDuotonePreset(duotoneAttr, duotonePalette);
const isPreset = typeof duotoneAttr === 'string' && duotonePreset;
const isCSS = typeof duotoneAttr === 'string' && !isPreset;
// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.
let colors = null;
if (isPreset) {
// Array of colors.
colors = duotonePreset;
} else if (isCSS) {
// CSS filter property string (e.g. 'unset').
colors = duotoneAttr;
} else if (isCustom) {
// Array of colors.
colors = duotoneAttr;
}
// Build the CSS selectors to which the filter will be applied.
const selectors = duotoneSelector.split(',');
const selectorsScoped = selectors.map(selectorPart => {
// 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.
// Assuming the selector part is a subclass selector (not a tag name)
// so we can prepend the filter id class. If we want to support elements
// such as `img` or namespaces, we'll need to add a case for that here.
return `.${filterId}${selectorPart.trim()}`;
});
const selector = selectorsScoped.join(', ');
const isValidFilter = Array.isArray(colors) || colors === 'unset';
useStyleOverride(isValidFilter ? {
css: colors !== 'unset' ? getDuotoneStylesheet(selector, filterId) : getDuotoneUnsetStylesheet(selector),
__unstableType: 'presets'
} : undefined);
useStyleOverride(isValidFilter ? {
assets: colors !== 'unset' ? getDuotoneFilter(filterId, colors) : '',
__unstableType: 'svgs'
} : undefined);
const blockElement = useBlockElement(clientId);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isValidFilter) return;
// Safari does not always update the duotone filter when the duotone colors
// are changed. When using Safari, force the block element to be repainted by
// the browser to ensure any changes are reflected visually. This logic matches
// that used on the site frontend in `block-supports/duotone.php`.
if (blockElement && isSafari) {
const display = blockElement.style.display;
// Switch to `inline-block` to force a repaint. In the editor, `inline-block`
// is used instead of `none` to ensure that scroll position is not affected,
// as `none` results in the editor scrolling to the top of the block.
blockElement.style.display = 'inline-block';
// Simply accessing el.offsetHeight flushes layout and style
// changes in WebKit without having to wait for setTimeout.
// eslint-disable-next-line no-unused-expressions
blockElement.offsetHeight;
blockElement.style.display = display;
}
}, [isValidFilter, blockElement]);
}
function duotone_useBlockProps({
name,
style
}) {
const id = (0,external_wp_compose_namespaceObject.useInstanceId)(duotone_useBlockProps);
const selector = (0,external_wp_element_namespaceObject.useMemo)(() => {
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
if (blockType) {
// Backwards compatibility for `supports.color.__experimentalDuotone`
// is provided via the `block_type_metadata_settings` filter. If
// `supports.filter.duotone` has not been set and the
// experimental property has been, the experimental property
// value is copied into `supports.filter.duotone`.
const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, 'filter.duotone', false);
if (!duotoneSupport) {
return null;
}
// If the experimental duotone support was set, that value is
// to be treated as a selector and requires scoping.
const experimentalDuotone = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, 'color.__experimentalDuotone', false);
if (experimentalDuotone) {
const rootSelector = getBlockCSSSelector(blockType);
return typeof experimentalDuotone === 'string' ? scopeSelector(rootSelector, experimentalDuotone) : rootSelector;
}
// Regular filter.duotone support uses filter.duotone selectors with fallbacks.
return getBlockCSSSelector(blockType, 'filter.duotone', {
fallback: true
});
}
}, [name]);
const attribute = style?.color?.duotone;
const filterClass = `wp-duotone-${id}`;
const shouldRender = selector && attribute;
useDuotoneStyles({
clientId: id,
id: filterClass,
selector,
attribute
});
return {
className: shouldRender ? filterClass : ''
};
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/duotone/add-attributes', addDuotoneAttributes);
;// 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 {boolean} isSynced True if is a reusable block or template part
* @property {string} title Human-readable block type label.
* @property {WPIcon} icon Block type icon.
* @property {string} description A detailed block type description.
* @property {string} anchor HTML anchor.
* @property {name} name A custom, human readable name for the block.
*/
/**
* Get the display label for a block's position type.
*
* @param {Object} attributes Block attributes.
* @return {string} The position type label.
*/
function getPositionTypeLabel(attributes) {
const positionType = attributes?.style?.position?.type;
if (positionType === 'sticky') {
return (0,external_wp_i18n_namespaceObject.__)('Sticky');
}
if (positionType === 'fixed') {
return (0,external_wp_i18n_namespaceObject.__)('Fixed');
}
return null;
}
/**
* 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 variation 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,
__experimentalGetReusableBlockTitle
} = 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 isReusable = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType);
const resusableTitle = isReusable ? __experimentalGetReusableBlockTitle(attributes.ref) : undefined;
const title = resusableTitle || blockType.title;
const isSynced = isReusable || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType);
const positionLabel = getPositionTypeLabel(attributes);
const blockTypeInfo = {
isSynced,
title,
icon: blockType.icon,
description: blockType.description,
anchor: attributes?.anchor,
positionLabel,
positionType: attributes?.style?.position?.type,
name: attributes?.metadata?.name
};
if (!match) return blockTypeInfo;
return {
isSynced,
title: match.title || blockType.title,
icon: match.icon || blockType.icon,
description: match.description || blockType.description,
anchor: attributes?.anchor,
positionLabel,
positionType: attributes?.style?.position?.type,
name: attributes?.metadata?.name
};
}, [clientId]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/position.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
CustomSelectControl
} = unlock(external_wp_components_namespaceObject.privateApis);
const POSITION_SUPPORT_KEY = 'position';
const OPTION_CLASSNAME = 'block-editor-hooks__position-selection__select-control__option';
const DEFAULT_OPTION = {
key: 'default',
value: '',
name: (0,external_wp_i18n_namespaceObject.__)('Default'),
className: OPTION_CLASSNAME
};
const STICKY_OPTION = {
key: 'sticky',
value: 'sticky',
name: (0,external_wp_i18n_namespaceObject._x)('Sticky', 'Name for the value of the CSS position property'),
className: OPTION_CLASSNAME,
__experimentalHint: (0,external_wp_i18n_namespaceObject.__)('The block will stick to the top of the window instead of scrolling.')
};
const FIXED_OPTION = {
key: 'fixed',
value: 'fixed',
name: (0,external_wp_i18n_namespaceObject._x)('Fixed', 'Name for the value of the CSS position property'),
className: OPTION_CLASSNAME,
__experimentalHint: (0,external_wp_i18n_namespaceObject.__)('The block will not move when the page is scrolled.')
};
const POSITION_SIDES = ['top', 'right', 'bottom', 'left'];
const VALID_POSITION_TYPES = ['sticky', 'fixed'];
/**
* Get calculated position CSS.
*
* @param {Object} props Component props.
* @param {string} props.selector Selector to use.
* @param {Object} props.style Style object.
* @return {string} The generated CSS rules.
*/
function getPositionCSS({
selector,
style
}) {
let output = '';
const {
type: positionType
} = style?.position || {};
if (!VALID_POSITION_TYPES.includes(positionType)) {
return output;
}
output += `${selector} {`;
output += `position: ${positionType};`;
POSITION_SIDES.forEach(side => {
if (style?.position?.[side] !== undefined) {
output += `${side}: ${style.position[side]};`;
}
});
if (positionType === 'sticky' || positionType === 'fixed') {
// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.
output += `z-index: 10`;
}
output += `}`;
return output;
}
/**
* Determines if there is sticky position support.
*
* @param {string|Object} blockType Block name or Block Type object.
*
* @return {boolean} Whether there is support.
*/
function hasStickyPositionSupport(blockType) {
const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY);
return !!(true === support || support?.sticky);
}
/**
* Determines if there is fixed position support.
*
* @param {string|Object} blockType Block name or Block Type object.
*
* @return {boolean} Whether there is support.
*/
function hasFixedPositionSupport(blockType) {
const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY);
return !!(true === support || support?.fixed);
}
/**
* Determines if there is position support.
*
* @param {string|Object} blockType Block name or Block Type object.
*
* @return {boolean} Whether there is support.
*/
function hasPositionSupport(blockType) {
const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY);
return !!support;
}
/**
* Checks if there is a current value in the position block support attributes.
*
* @param {Object} props Block props.
* @return {boolean} Whether or not the block has a position value set.
*/
function hasPositionValue(props) {
return props.attributes.style?.position?.type !== undefined;
}
/**
* Checks if the block is currently set to a sticky or fixed position.
* This check is helpful for determining how to position block toolbars or other elements.
*
* @param {Object} attributes Block attributes.
* @return {boolean} Whether or not the block is set to a sticky or fixed position.
*/
function hasStickyOrFixedPositionValue(attributes) {
const positionType = attributes.style?.position?.type;
return positionType === 'sticky' || positionType === 'fixed';
}
/**
* Resets the position block support attributes. This can be used when disabling
* the position 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 resetPosition({
attributes = {},
setAttributes
}) {
const {
style = {}
} = attributes;
setAttributes({
style: cleanEmptyObject({
...style,
position: {
...style?.position,
type: undefined,
top: undefined,
right: undefined,
bottom: undefined,
left: undefined
}
})
});
}
/**
* Custom hook that checks if position settings have been disabled.
*
* @param {string} name The name of the block.
*
* @return {boolean} Whether padding setting is disabled.
*/
function useIsPositionDisabled({
name: blockName
} = {}) {
const [allowFixed, allowSticky] = use_settings_useSettings('position.fixed', 'position.sticky');
const isDisabled = !allowFixed && !allowSticky;
return !hasPositionSupport(blockName) || isDisabled;
}
/*
* Position controls rendered in an inspector control panel.
*
* @param {Object} props
*
* @return {Element} Position panel.
*/
function PositionPanelPure({
style = {},
clientId,
name: blockName,
setAttributes
}) {
const allowFixed = hasFixedPositionSupport(blockName);
const allowSticky = hasStickyPositionSupport(blockName);
const value = style?.position?.type;
const {
firstParentClientId
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockParents
} = select(store);
const parents = getBlockParents(clientId);
return {
firstParentClientId: parents[parents.length - 1]
};
}, [clientId]);
const blockInformation = useBlockDisplayInformation(firstParentClientId);
const stickyHelpText = allowSticky && value === STICKY_OPTION.value && blockInformation ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the name of the parent block. */
(0,external_wp_i18n_namespaceObject.__)('The block will stick to the scrollable area of the parent %s block.'), blockInformation.title) : null;
const options = (0,external_wp_element_namespaceObject.useMemo)(() => {
const availableOptions = [DEFAULT_OPTION];
// Display options if they are allowed, or if a block already has a valid value set.
// This allows for a block to be switched off from a position type that is not allowed.
if (allowSticky || value === STICKY_OPTION.value) {
availableOptions.push(STICKY_OPTION);
}
if (allowFixed || value === FIXED_OPTION.value) {
availableOptions.push(FIXED_OPTION);
}
return availableOptions;
}, [allowFixed, allowSticky, value]);
const onChangeType = next => {
// For now, use a hard-coded `0px` value for the position.
// `0px` is preferred over `0` as it can be used in `calc()` functions.
// In the future, it could be useful to allow for an offset value.
const placementValue = '0px';
const newStyle = {
...style,
position: {
...style?.position,
type: next,
top: next === 'sticky' || next === 'fixed' ? placementValue : undefined
}
};
setAttributes({
style: utils_cleanEmptyObject(newStyle)
});
};
const selectedOption = value ? options.find(option => option.value === value) || DEFAULT_OPTION : DEFAULT_OPTION;
// Only display position controls if there is at least one option to choose from.
return external_wp_element_namespaceObject.Platform.select({
web: options.length > 1 ? (0,external_React_.createElement)(inspector_controls, {
group: "position"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.BaseControl, {
className: "block-editor-hooks__position-selection",
__nextHasNoMarginBottom: true,
help: stickyHelpText
}, (0,external_React_.createElement)(CustomSelectControl, {
__nextUnconstrainedWidth: true,
__next40pxDefaultSize: true,
className: "block-editor-hooks__position-selection__select-control",
label: (0,external_wp_i18n_namespaceObject.__)('Position'),
hideLabelFromVision: true,
describedBy: (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Currently selected position.
(0,external_wp_i18n_namespaceObject.__)('Currently selected position: %s'), selectedOption.name),
options: options,
value: selectedOption,
__experimentalShowSelectedHint: true,
onChange: ({
selectedItem
}) => {
onChangeType(selectedItem.value);
},
size: '__unstable-large'
}))) : null,
native: null
});
}
/* harmony default export */ const position = ({
edit: function Edit(props) {
const isPositionDisabled = useIsPositionDisabled(props);
if (isPositionDisabled) {
return null;
}
return (0,external_React_.createElement)(PositionPanelPure, {
...props
});
},
useBlockProps: position_useBlockProps,
attributeKeys: ['style'],
hasSupport(name) {
return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, POSITION_SUPPORT_KEY);
}
});
function position_useBlockProps({
name,
style
}) {
const hasPositionBlockSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, POSITION_SUPPORT_KEY);
const isPositionDisabled = useIsPositionDisabled({
name
});
const allowPositionStyles = hasPositionBlockSupport && !isPositionDisabled;
const id = (0,external_wp_compose_namespaceObject.useInstanceId)(position_useBlockProps);
// Higher specificity to override defaults in editor UI.
const positionSelector = `.wp-container-${id}.wp-container-${id}`;
// Get CSS string for the current position values.
let css;
if (allowPositionStyles) {
css = getPositionCSS({
selector: positionSelector,
style
}) || '';
}
// Attach a `wp-container-` id-based class name.
const className = classnames_default()({
[`wp-container-${id}`]: allowPositionStyles && !!css,
// Only attach a container class if there is generated CSS to be attached.
[`is-position-${style?.position?.type}`]: allowPositionStyles && !!css && !!style?.position?.type
});
useStyleOverride({
css
});
return {
className
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/layout.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const layoutBlockSupportKey = 'layout';
function hasLayoutBlockSupport(blockName) {
return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'layout') || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, '__experimentalLayout');
}
/**
* Generates the utility classnames for the given block's layout attributes.
*
* @param { Object } blockAttributes Block attributes.
* @param { string } blockName Block name.
*
* @return { Array } Array of CSS classname strings.
*/
function useLayoutClasses(blockAttributes = {}, blockName = '') {
const {
kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
const rootPaddingAlignment = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(store);
return getSettings().__experimentalFeatures?.useRootPaddingAwareAlignments;
}, []);
const {
layout
} = blockAttributes;
const {
default: defaultBlockLayout
} = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, layoutBlockSupportKey) || {};
const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? {
...layout,
type: 'constrained'
} : layout || defaultBlockLayout || {};
const layoutClassnames = [];
if (LAYOUT_DEFINITIONS[usedLayout?.type || 'default']?.className) {
const baseClassName = LAYOUT_DEFINITIONS[usedLayout?.type || 'default']?.className;
const splitBlockName = blockName.split('/');
const fullBlockName = splitBlockName[0] === 'core' ? splitBlockName.pop() : splitBlockName.join('-');
const compoundClassName = `wp-block-${fullBlockName}-${baseClassName}`;
layoutClassnames.push(baseClassName, compoundClassName);
}
if ((usedLayout?.inherit || usedLayout?.contentSize || usedLayout?.type === 'constrained') && rootPaddingAlignment) {
layoutClassnames.push('has-global-padding');
}
if (usedLayout?.orientation) {
layoutClassnames.push(`is-${kebabCase(usedLayout.orientation)}`);
}
if (usedLayout?.justifyContent) {
layoutClassnames.push(`is-content-justification-${kebabCase(usedLayout.justifyContent)}`);
}
if (usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap') {
layoutClassnames.push('is-nowrap');
}
return layoutClassnames;
}
/**
* Generates a CSS rule with the given block's layout styles.
*
* @param { Object } blockAttributes Block attributes.
* @param { string } blockName Block name.
* @param { string } selector A selector to use in generating the CSS rule.
*
* @return { string } CSS rule.
*/
function useLayoutStyles(blockAttributes = {}, blockName, selector) {
const {
layout = {},
style = {}
} = blockAttributes;
// Update type for blocks using legacy layouts.
const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? {
...layout,
type: 'constrained'
} : layout || {};
const fullLayoutType = getLayoutType(usedLayout?.type || 'default');
const [blockGapSupport] = use_settings_useSettings('spacing.blockGap');
const hasBlockGapSupport = blockGapSupport !== null;
const css = fullLayoutType?.getLayoutStyle?.({
blockName,
selector,
layout,
style,
hasBlockGapSupport
});
return css;
}
function LayoutPanelPure({
layout,
setAttributes,
name: blockName
}) {
const settings = useBlockSettings(blockName);
// Block settings come from theme.json under settings.[blockName].
const {
layout: layoutSettings
} = settings;
// Layout comes from block attributes.
const [defaultThemeLayout] = use_settings_useSettings('layout');
const {
themeSupportsLayout
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(store);
return {
themeSupportsLayout: getSettings().supportsLayout
};
}, []);
const blockEditingMode = useBlockEditingMode();
if (blockEditingMode !== 'default') {
return null;
}
// Layout block support comes from the block's block.json.
const layoutBlockSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, layoutBlockSupportKey, {});
const blockSupportAndThemeSettings = {
...layoutSettings,
...layoutBlockSupport
};
const {
allowSwitching,
allowEditing = true,
allowInheriting = true,
default: defaultBlockLayout
} = blockSupportAndThemeSettings;
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 either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.
const showInheritToggle = !!(allowInheriting && !!defaultThemeLayout && (!layout?.type || layout?.type === 'default' || layout?.type === 'constrained' || layout?.inherit));
const usedLayout = layout || defaultBlockLayout || {};
const {
inherit = false,
type = 'default',
contentSize = null
} = usedLayout;
/**
* `themeSupportsLayout` is only relevant to the `default/flow` or
* `constrained` layouts and it should not be taken into account when other
* `layout` types are used.
*/
if ((type === 'default' || type === 'constrained') && !themeSupportsLayout) {
return null;
}
const layoutType = getLayoutType(type);
const constrainedType = getLayoutType('constrained');
const displayControlsForLegacyLayouts = !usedLayout.type && (contentSize || inherit);
const hasContentSizeOrLegacySettings = !!inherit || !!contentSize;
const onChangeType = newType => setAttributes({
layout: {
type: newType
}
});
const onChangeLayout = newLayout => setAttributes({
layout: newLayout
});
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(inspector_controls, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Layout')
}, showInheritToggle && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
className: "block-editor-hooks__toggle-control",
label: (0,external_wp_i18n_namespaceObject.__)('Inner blocks use content width'),
checked: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings,
onChange: () => setAttributes({
layout: {
type: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings ? 'default' : 'constrained'
}
}),
help: layoutType?.name === 'constrained' || hasContentSizeOrLegacySettings ? (0,external_wp_i18n_namespaceObject.__)('Nested blocks use content width with options for full and wide widths.') : (0,external_wp_i18n_namespaceObject.__)('Nested blocks will fill the width of this container. Toggle to constrain.')
})), !inherit && allowSwitching && (0,external_React_.createElement)(LayoutTypeSwitcher, {
type: type,
onChange: onChangeType
}), layoutType && layoutType.name !== 'default' && (0,external_React_.createElement)(layoutType.inspectorControls, {
layout: usedLayout,
onChange: onChangeLayout,
layoutBlockSupport: blockSupportAndThemeSettings
}), constrainedType && displayControlsForLegacyLayouts && (0,external_React_.createElement)(constrainedType.inspectorControls, {
layout: usedLayout,
onChange: onChangeLayout,
layoutBlockSupport: blockSupportAndThemeSettings
}))), !inherit && layoutType && (0,external_React_.createElement)(layoutType.toolBarControls, {
layout: usedLayout,
onChange: onChangeLayout,
layoutBlockSupport: layoutBlockSupport
}));
}
/* harmony default export */ const layout = ({
shareWithChildBlocks: true,
edit: LayoutPanelPure,
attributeKeys: ['layout'],
hasSupport(name) {
return hasLayoutBlockSupport(name);
}
});
function LayoutTypeSwitcher({
type,
onChange
}) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ButtonGroup, null, getLayoutTypes().map(({
name,
label
}) => {
return (0,external_React_.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) {
var _settings$attributes$;
if ('type' in ((_settings$attributes$ = settings.attributes?.layout) !== null && _settings$attributes$ !== void 0 ? _settings$attributes$ : {})) {
return settings;
}
if (hasLayoutBlockSupport(settings)) {
settings.attributes = {
...settings.attributes,
layout: {
type: 'object'
}
};
}
return settings;
}
function BlockWithLayoutStyles({
block: BlockListBlock,
props,
layoutClasses
}) {
const {
name,
attributes
} = props;
const id = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockListBlock);
const {
layout
} = attributes;
const {
default: defaultBlockLayout
} = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, layoutBlockSupportKey) || {};
const usedLayout = layout?.inherit || layout?.contentSize || layout?.wideSize ? {
...layout,
type: 'constrained'
} : layout || defaultBlockLayout || {};
const {
kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
const selectorPrefix = `wp-container-${kebabCase(name)}-is-layout-`;
// Higher specificity to override defaults from theme.json.
const selector = `.${selectorPrefix}${id}.${selectorPrefix}${id}`;
const [blockGapSupport] = use_settings_useSettings('spacing.blockGap');
const hasBlockGapSupport = blockGapSupport !== null;
// Get CSS string for the current layout type.
// The CSS and `style` element is only output if it is not empty.
const fullLayoutType = getLayoutType(usedLayout?.type || 'default');
const css = fullLayoutType?.getLayoutStyle?.({
blockName: name,
selector,
layout: usedLayout,
style: attributes?.style,
hasBlockGapSupport
});
// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.
const layoutClassNames = classnames_default()({
[`${selectorPrefix}${id}`]: !!css // Only attach a container class if there is generated CSS to be attached.
}, layoutClasses);
useStyleOverride({
css
});
return (0,external_React_.createElement)(BlockListBlock, {
...props,
__unstableLayoutClassNames: layoutClassNames
});
}
/**
* 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 blockSupportsLayout = hasLayoutBlockSupport(props.name);
const layoutClasses = useLayoutClasses(attributes, name);
const shouldRenderLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)(select => {
// The callback returns early to avoid block editor subscription.
if (!blockSupportsLayout) {
return false;
}
return !select(store).getSettings().disableLayoutStyles;
}, [blockSupportsLayout]);
if (!shouldRenderLayoutStyles) {
return (0,external_React_.createElement)(BlockListBlock, {
...props,
__unstableLayoutClassNames: blockSupportsLayout ? layoutClasses : undefined
});
}
return (0,external_React_.createElement)(BlockWithLayoutStyles, {
block: BlockListBlock,
props: props,
layoutClasses: layoutClasses
});
}, 'withLayoutStyles');
(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);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/layout-child.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useBlockPropsChildLayoutStyles({
style
}) {
var _style$layout;
const shouldRenderChildLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)(select => {
return !select(store).getSettings().disableLayoutStyles;
});
const layout = (_style$layout = style?.layout) !== null && _style$layout !== void 0 ? _style$layout : {};
const {
selfStretch,
flexSize
} = layout;
const id = (0,external_wp_compose_namespaceObject.useInstanceId)(useBlockPropsChildLayoutStyles);
const selector = `.wp-container-content-${id}`;
let css = '';
if (shouldRenderChildLayoutStyles) {
if (selfStretch === 'fixed' && flexSize) {
css = `${selector} {
flex-basis: ${flexSize};
box-sizing: border-box;
}`;
} else if (selfStretch === 'fill') {
css = `${selector} {
flex-grow: 1;
}`;
}
}
useStyleOverride({
css
});
// Only attach a container class if there is generated CSS to be attached.
if (!css) {
return;
}
// Attach a `wp-container-content` id-based classname.
return {
className: `wp-container-content-${id}`
};
}
/* harmony default export */ const layout_child = ({
useBlockProps: useBlockPropsChildLayoutStyles,
attributeKeys: ['style'],
hasSupport() {
return true;
}
});
;// 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.
*
* @param {?string[]} selectedClientIds An optional array of clientIds to group. The selected blocks
* from the block editor store are used if this is not provided.
*
* @return {ConvertToGroupButtonProps} Returns the properties needed by `ConvertToGroupButton`.
*/
function useConvertToGroupButtonProps(selectedClientIds) {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlocksByClientId,
getSelectedBlockClientIds,
isUngroupable,
isGroupable
} = select(store);
const {
getGroupingBlockName,
getBlockType
} = select(external_wp_blocks_namespaceObject.store);
const clientIds = selectedClientIds?.length ? selectedClientIds : getSelectedBlockClientIds();
const blocksSelection = getBlocksByClientId(clientIds);
const [firstSelectedBlock] = blocksSelection;
const _isUngroupable = clientIds.length === 1 && isUngroupable(clientIds[0]);
return {
clientIds,
isGroupable: isGroupable(clientIds),
isUngroupable: _isUngroupable,
blocksSelection,
groupingBlockName: getGroupingBlockName(),
onUngroup: _isUngroupable && getBlockType(firstSelectedBlock.name)?.transforms?.ungroup
};
}, [selectedClientIds]);
}
;// 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,
onUngroup,
blocksSelection,
groupingBlockName,
onClose = () => {}
}) {
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 = () => {
let innerBlocks = blocksSelection[0].innerBlocks;
if (!innerBlocks.length) {
return;
}
if (onUngroup) {
innerBlocks = onUngroup(blocksSelection[0].attributes, blocksSelection[0].innerBlocks);
}
replaceBlocks(clientIds, innerBlocks);
};
if (!isGroupable && !isUngroupable) {
return null;
}
return (0,external_React_.createElement)(external_React_.Fragment, null, isGroupable && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => {
onConvertToGroup();
onClose();
}
}, (0,external_wp_i18n_namespaceObject._x)('Group', 'verb')), isUngroupable && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => {
onConvertFromGroup();
onClose();
}
}, (0,external_wp_i18n_namespaceObject._x)('Ungroup', 'Ungrouping blocks from within a grouping block back into individual blocks within the Editor ')));
}
;// 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 {
canEditBlock,
canMoveBlock,
canRemoveBlock,
canLockBlockType,
getBlockName,
getBlockRootClientId,
getTemplateLock
} = select(store);
const rootClientId = getBlockRootClientId(clientId);
const canEdit = canEditBlock(clientId);
const canMove = canMoveBlock(clientId, rootClientId);
const canRemove = canRemoveBlock(clientId, rootClientId);
return {
canEdit,
canMove,
canRemove,
canLock: canLockBlockType(getBlockName(clientId)),
isContentLocked: getTemplateLock(clientId) === 'contentOnly',
isLocked: !canEdit || !canMove || !canRemove
};
}, [clientId]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/unlock.js
/**
* WordPress dependencies
*/
const unlock_unlock = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.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 */ const library_unlock = (unlock_unlock);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/lock-outline.js
/**
* WordPress dependencies
*/
const lockOutline = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.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-1zM9.8 7c0-1.2 1-2.2 2.2-2.2 1.2 0 2.2 1 2.2 2.2v3H9.8V7zm6.7 11.5h-9v-7h9v7z"
}));
/* harmony default export */ const lock_outline = (lockOutline);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/lock.js
/**
* WordPress dependencies
*/
const lock_lock = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.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 */ const library_lock = (lock_lock);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-lock/modal.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// Entity based blocks which allow edit locking
const ALLOWS_EDIT_LOCKING = ['core/block', 'core/navigation'];
function getTemplateLockValue(lock) {
// Prevents all operations.
if (lock.remove && lock.move) {
return 'all';
}
// Prevents inserting or removing blocks, but allows moving existing blocks.
if (lock.remove && !lock.move) {
return 'insert';
}
return false;
}
function BlockLockModal({
clientId,
onClose
}) {
const [lock, setLock] = (0,external_wp_element_namespaceObject.useState)({
move: false,
remove: false
});
const {
canEdit,
canMove,
canRemove
} = useBlockLock(clientId);
const {
allowsEditLocking,
templateLock,
hasTemplateLock
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockName,
getBlockAttributes
} = select(store);
const blockName = getBlockName(clientId);
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
return {
allowsEditLocking: ALLOWS_EDIT_LOCKING.includes(blockName),
templateLock: getBlockAttributes(clientId)?.templateLock,
hasTemplateLock: !!blockType?.attributes?.templateLock
};
}, [clientId]);
const [applyTemplateLock, setApplyTemplateLock] = (0,external_wp_element_namespaceObject.useState)(!!templateLock);
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,
...(allowsEditLocking ? {
edit: !canEdit
} : {})
});
}, [canEdit, canMove, canRemove, allowsEditLocking]);
const isAllChecked = Object.values(lock).every(Boolean);
const isMixed = Object.values(lock).some(Boolean) && !isAllChecked;
return (0,external_React_.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",
onRequestClose: onClose
}, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Choose specific attributes to restrict or lock all available options.')), (0,external_React_.createElement)("form", {
onSubmit: event => {
event.preventDefault();
updateBlockAttributes([clientId], {
lock,
templateLock: applyTemplateLock ? getTemplateLockValue(lock) : undefined
});
onClose();
}
}, (0,external_React_.createElement)("div", {
role: "group",
"aria-labelledby": instanceId,
className: "block-editor-block-lock-modal__options"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
__nextHasNoMarginBottom: true,
className: "block-editor-block-lock-modal__options-title",
label: (0,external_React_.createElement)("span", {
id: instanceId
}, (0,external_wp_i18n_namespaceObject.__)('Lock all')),
checked: isAllChecked,
indeterminate: isMixed,
onChange: newValue => setLock({
move: newValue,
remove: newValue,
...(allowsEditLocking ? {
edit: newValue
} : {})
})
}), (0,external_React_.createElement)("ul", {
className: "block-editor-block-lock-modal__checklist"
}, allowsEditLocking && (0,external_React_.createElement)("li", {
className: "block-editor-block-lock-modal__checklist-item"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Restrict editing'),
checked: !!lock.edit,
onChange: edit => setLock(prevLock => ({
...prevLock,
edit
}))
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
className: "block-editor-block-lock-modal__lock-icon",
icon: lock.edit ? library_lock : library_unlock
})), (0,external_React_.createElement)("li", {
className: "block-editor-block-lock-modal__checklist-item"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Disable movement'),
checked: lock.move,
onChange: move => setLock(prevLock => ({
...prevLock,
move
}))
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
className: "block-editor-block-lock-modal__lock-icon",
icon: lock.move ? library_lock : library_unlock
})), (0,external_React_.createElement)("li", {
className: "block-editor-block-lock-modal__checklist-item"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Prevent removal'),
checked: lock.remove,
onChange: remove => setLock(prevLock => ({
...prevLock,
remove
}))
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
className: "block-editor-block-lock-modal__lock-icon",
icon: lock.remove ? library_lock : library_unlock
}))), hasTemplateLock && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
className: "block-editor-block-lock-modal__template-lock",
label: (0,external_wp_i18n_namespaceObject.__)('Apply to all blocks inside'),
checked: applyTemplateLock,
disabled: lock.move && !lock.remove,
onChange: () => setApplyTemplateLock(!applyTemplateLock)
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
className: "block-editor-block-lock-modal__actions",
justify: "flex-end",
expanded: false
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: onClose
}, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.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({
clientId
}) {
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_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
icon: isLocked ? library_unlock : lock_outline,
onClick: toggleModal,
"aria-expanded": isModalOpen,
"aria-haspopup": "dialog"
}, label), isModalOpen && (0,external_React_.createElement)(BlockLockModal, {
clientId: clientId,
onClose: toggleModal
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-mode-toggle.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const block_mode_toggle_noop = () => {};
function BlockModeToggle({
blockType,
mode,
onToggleMode,
small = false,
isCodeEditingEnabled = true
}) {
if (!blockType || !(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_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: onToggleMode
}, !small && label);
}
/* harmony default export */ const block_mode_toggle = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, {
clientId
}) => {
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, {
onToggle = block_mode_toggle_noop,
clientId
}) => ({
onToggleMode() {
dispatch(store).toggleBlockMode(clientId);
onToggle();
}
}))])(BlockModeToggle));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-rename/use-block-rename.js
/**
* WordPress dependencies
*/
function useBlockRename(name) {
return {
canRename: (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, 'renaming', true)
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-rename/is-empty-string.js
function isEmptyString(testString) {
return testString?.trim()?.length === 0;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-rename/modal.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockRenameModal({
blockName,
originalBlockName,
onClose,
onSave
}) {
const [editedBlockName, setEditedBlockName] = (0,external_wp_element_namespaceObject.useState)(blockName);
const nameHasChanged = editedBlockName !== blockName;
const nameIsOriginal = editedBlockName === originalBlockName;
const nameIsEmpty = isEmptyString(editedBlockName);
const isNameValid = nameHasChanged || nameIsOriginal;
const autoSelectInputText = event => event.target.select();
const dialogDescription = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockRenameModal, `block-editor-rename-modal__description`);
const handleSubmit = () => {
const message = nameIsOriginal || nameIsEmpty ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: new name/label for the block */
(0,external_wp_i18n_namespaceObject.__)('Block name reset to: "%s".'), editedBlockName) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: new name/label for the block */
(0,external_wp_i18n_namespaceObject.__)('Block name changed to: "%s".'), editedBlockName);
// Must be assertive to immediately announce change.
(0,external_wp_a11y_namespaceObject.speak)(message, 'assertive');
onSave(editedBlockName);
// Immediate close avoids ability to hit save multiple times.
onClose();
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Rename'),
onRequestClose: onClose,
overlayClassName: "block-editor-block-rename-modal",
aria: {
describedby: dialogDescription
},
focusOnMount: "firstContentElement"
}, (0,external_React_.createElement)("p", {
id: dialogDescription
}, (0,external_wp_i18n_namespaceObject.__)('Enter a custom name for this block.')), (0,external_React_.createElement)("form", {
onSubmit: e => {
e.preventDefault();
if (!isNameValid) {
return;
}
handleSubmit();
}
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: "3"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
value: editedBlockName,
label: (0,external_wp_i18n_namespaceObject.__)('Block name'),
hideLabelFromVision: true,
placeholder: originalBlockName,
onChange: setEditedBlockName,
onFocus: autoSelectInputText
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "right"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "tertiary",
onClick: onClose
}, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
"aria-disabled": !isNameValid,
variant: "primary",
type: "submit"
}, (0,external_wp_i18n_namespaceObject.__)('Save'))))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-rename/rename-control.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockRenameControl({
clientId
}) {
const [renamingBlock, setRenamingBlock] = (0,external_wp_element_namespaceObject.useState)(false);
const {
metadata
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockAttributes
} = select(store);
const _metadata = getBlockAttributes(clientId)?.metadata;
return {
metadata: _metadata
};
}, [clientId]);
const {
updateBlockAttributes
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const customName = metadata?.name;
function onChange(newName) {
updateBlockAttributes([clientId], {
metadata: {
...(metadata && metadata),
name: newName
}
});
}
const blockInformation = useBlockDisplayInformation(clientId);
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => {
setRenamingBlock(true);
},
"aria-expanded": renamingBlock,
"aria-haspopup": "dialog"
}, (0,external_wp_i18n_namespaceObject.__)('Rename')), renamingBlock && (0,external_React_.createElement)(BlockRenameModal, {
blockName: customName || '',
originalBlockName: blockInformation?.title,
onClose: () => setRenamingBlock(false),
onSave: newName => {
// If the new value is the block's original name (e.g. `Group`)
// or it is an empty string then assume the intent is to reset
// the value. Therefore reset the metadata.
if (newName === blockInformation?.title || isEmptyString(newName)) {
newName = undefined;
}
onChange(newName);
}
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu-controls/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
Fill,
Slot
} = (0,external_wp_components_namespaceObject.createSlotFill)('BlockSettingsMenuControls');
const BlockSettingsMenuControlsSlot = ({
fillProps,
clientIds = null,
__unstableDisplayLocation
}) => {
const {
selectedBlocks,
selectedClientIds
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockNamesByClientId,
getSelectedBlockClientIds
} = select(store);
const ids = clientIds !== null ? clientIds : getSelectedBlockClientIds();
return {
selectedBlocks: getBlockNamesByClientId(ids),
selectedClientIds: ids
};
}, [clientIds]);
const {
canLock
} = useBlockLock(selectedClientIds[0]);
const {
canRename
} = useBlockRename(selectedBlocks[0]);
const showLockButton = selectedClientIds.length === 1 && canLock;
const showRenameButton = selectedClientIds.length === 1 && canRename;
// Check if current selection of blocks is Groupable or Ungroupable
// and pass this props down to ConvertToGroupButton.
const convertToGroupButtonProps = useConvertToGroupButtonProps(selectedClientIds);
const {
isGroupable,
isUngroupable
} = convertToGroupButtonProps;
const showConvertToGroupButton = isGroupable || isUngroupable;
return (0,external_React_.createElement)(Slot, {
fillProps: {
...fillProps,
__unstableDisplayLocation,
selectedBlocks,
selectedClientIds
}
}, fills => {
if (!fills?.length > 0 && !showConvertToGroupButton && !showLockButton) {
return null;
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, showConvertToGroupButton && (0,external_React_.createElement)(ConvertToGroupButton, {
...convertToGroupButtonProps,
onClose: fillProps?.onClose
}), showLockButton && (0,external_React_.createElement)(BlockLockMenuItem, {
clientId: selectedClientIds[0]
}), showRenameButton && (0,external_React_.createElement)(BlockRenameControl, {
clientId: selectedClientIds[0]
}), fills, fillProps?.canMove && !fillProps?.onlyBlock && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: (0,external_wp_compose_namespaceObject.pipe)(fillProps?.onClose, fillProps?.onMoveTo)
}, (0,external_wp_i18n_namespaceObject.__)('Move to')), fillProps?.count === 1 && (0,external_React_.createElement)(block_mode_toggle, {
clientId: fillProps?.firstBlockClientId,
onToggle: 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 {Element} Element.
*/
function BlockSettingsMenuControls({
...props
}) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, {
document: document
}, (0,external_React_.createElement)(Fill, {
...props
}));
}
BlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot;
/* harmony default export */ const block_settings_menu_controls = (BlockSettingsMenuControls);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/content-lock-ui.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// The implementation of content locking is mainly in this file, although the mechanism
// to stop temporarily editing as blocks when an outside block is selected is on component StopEditingAsBlocksOnOutsideSelect
// at block-editor/src/components/block-list/index.js.
// Besides the components on this file and the file referenced above the implementation
// also includes artifacts on the store (actions, reducers, and selector).
function ContentLockControlsPure({
clientId,
isSelected
}) {
const {
getBlockListSettings,
getSettings
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
templateLock,
isLockedByParent,
isEditingAsBlocks
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
__unstableGetContentLockingParent,
getTemplateLock,
__unstableGetTemporarilyEditingAsBlocks
} = select(store);
return {
templateLock: getTemplateLock(clientId),
isLockedByParent: !!__unstableGetContentLockingParent(clientId),
isEditingAsBlocks: __unstableGetTemporarilyEditingAsBlocks() === clientId
};
}, [clientId]);
const {
updateSettings,
updateBlockListSettings,
__unstableSetTemporarilyEditingAsBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const {
stopEditingAsBlocks
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
const isContentLocked = !isLockedByParent && templateLock === 'contentOnly';
const {
__unstableMarkNextChangeAsNotPersistent,
updateBlockAttributes
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const stopEditingAsBlockCallback = (0,external_wp_element_namespaceObject.useCallback)(() => {
stopEditingAsBlocks(clientId);
}, [clientId, stopEditingAsBlocks]);
if (!isContentLocked && !isEditingAsBlocks) {
return null;
}
const showStopEditingAsBlocks = isEditingAsBlocks && !isContentLocked;
const showStartEditingAsBlocks = !isEditingAsBlocks && isContentLocked && isSelected;
return (0,external_React_.createElement)(external_React_.Fragment, null, showStopEditingAsBlocks && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(block_controls, {
group: "other"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: stopEditingAsBlockCallback
}, (0,external_wp_i18n_namespaceObject.__)('Done')))), showStartEditingAsBlocks && (0,external_React_.createElement)(block_settings_menu_controls, null, ({
onClose
}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => {
__unstableMarkNextChangeAsNotPersistent();
updateBlockAttributes(clientId, {
templateLock: undefined
});
updateBlockListSettings(clientId, {
...getBlockListSettings(clientId),
templateLock: false
});
const focusModeToRevert = getSettings().focusMode;
updateSettings({
focusMode: true
});
__unstableSetTemporarilyEditingAsBlocks(clientId, focusModeToRevert);
onClose();
}
}, (0,external_wp_i18n_namespaceObject.__)('Modify'))));
}
/* harmony default export */ const content_lock_ui = ({
edit: ContentLockControlsPure,
hasSupport() {
return true;
}
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/metadata.js
/**
* WordPress dependencies
*/
const META_ATTRIBUTE_NAME = 'metadata';
/**
* Filters registered block settings, extending attributes to include `metadata`.
*
* see: https://github.com/WordPress/gutenberg/pull/40393/files#r864632012
*
* @param {Object} blockTypeSettings Original block settings.
* @return {Object} Filtered block settings.
*/
function addMetaAttribute(blockTypeSettings) {
// Allow blocks to specify their own attribute definition with default values if needed.
if (blockTypeSettings?.attributes?.[META_ATTRIBUTE_NAME]?.type) {
return blockTypeSettings;
}
blockTypeSettings.attributes = {
...blockTypeSettings.attributes,
[META_ATTRIBUTE_NAME]: {
type: 'object'
}
};
return blockTypeSettings;
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/metadata/addMetaAttribute', addMetaAttribute);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js
/**
* WordPress dependencies
*/
const blockDefault = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const block_default = (blockDefault);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-icon/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function BlockIcon({
icon,
showColors = false,
className,
context
}) {
if (icon?.src === 'block-default') {
icon = {
src: block_default
};
}
const renderedIcon = (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
icon: icon && icon.src ? icon.src : icon,
context: context
});
const style = showColors ? {
backgroundColor: icon && icon.background,
color: icon && icon.foreground
} : {};
return (0,external_React_.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 */ const block_icon = ((0,external_wp_element_namespaceObject.memo)(BlockIcon));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/block-hooks.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const EMPTY_OBJECT = {};
function BlockHooksControlPure({
name,
clientId,
metadata: {
ignoredHookedBlocks = []
} = {}
}) {
const blockTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), []);
// A hooked block added via a filter will not be exposed through a block
// type's `blockHooks` property; however, if the containing layout has been
// modified, it will be present in the anchor block's `ignoredHookedBlocks`
// metadata.
const hookedBlocksForCurrentBlock = (0,external_wp_element_namespaceObject.useMemo)(() => blockTypes?.filter(({
name: blockName,
blockHooks
}) => blockHooks && name in blockHooks || ignoredHookedBlocks.includes(blockName)), [blockTypes, name, ignoredHookedBlocks]);
const {
blockIndex,
rootClientId,
innerBlocksLength
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlocks,
getBlockIndex,
getBlockRootClientId
} = select(store);
return {
blockIndex: getBlockIndex(clientId),
innerBlocksLength: getBlocks(clientId)?.length,
rootClientId: getBlockRootClientId(clientId)
};
}, [clientId]);
const hookedBlockClientIds = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlocks,
getGlobalBlockCount
} = select(store);
const _hookedBlockClientIds = hookedBlocksForCurrentBlock.reduce((clientIds, block) => {
// If the block doesn't exist anywhere in the block tree,
// we know that we have to set the toggle to disabled.
if (getGlobalBlockCount(block.name) === 0) {
return clientIds;
}
const relativePosition = block?.blockHooks?.[name];
let candidates;
switch (relativePosition) {
case 'before':
case 'after':
// Any of the current block's siblings (with the right block type) qualifies
// as a hooked block (inserted `before` or `after` the current one), as the block
// might've been automatically inserted and then moved around a bit by the user.
candidates = getBlocks(rootClientId);
break;
case 'first_child':
case 'last_child':
// Any of the current block's child blocks (with the right block type) qualifies
// as a hooked first or last child block, as the block might've been automatically
// inserted and then moved around a bit by the user.
candidates = getBlocks(clientId);
break;
case undefined:
// If we haven't found a blockHooks field with a relative position for the hooked
// block, it means that it was added by a filter. In this case, we look for the block
// both among the current block's siblings and its children.
candidates = [...getBlocks(rootClientId), ...getBlocks(clientId)];
break;
}
const hookedBlock = candidates?.find(candidate => candidate.name === block.name);
// If the block exists in the designated location, we consider it hooked
// and show the toggle as enabled.
if (hookedBlock) {
return {
...clientIds,
[block.name]: hookedBlock.clientId
};
}
// If no hooked block was found in any of its designated locations,
// we set the toggle to disabled.
return clientIds;
}, {});
if (Object.values(_hookedBlockClientIds).length > 0) {
return _hookedBlockClientIds;
}
return EMPTY_OBJECT;
}, [hookedBlocksForCurrentBlock, name, clientId, rootClientId]);
const {
insertBlock,
removeBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
if (!hookedBlocksForCurrentBlock.length) {
return null;
}
// Group by block namespace (i.e. prefix before the slash).
const groupedHookedBlocks = hookedBlocksForCurrentBlock.reduce((groups, block) => {
const [namespace] = block.name.split('/');
if (!groups[namespace]) {
groups[namespace] = [];
}
groups[namespace].push(block);
return groups;
}, {});
const insertBlockIntoDesignatedLocation = (block, relativePosition) => {
switch (relativePosition) {
case 'before':
case 'after':
insertBlock(block, relativePosition === 'after' ? blockIndex + 1 : blockIndex, rootClientId,
// Insert as a child of the current block's parent
false);
break;
case 'first_child':
case 'last_child':
insertBlock(block,
// TODO: It'd be great if insertBlock() would accept negative indices for insertion.
relativePosition === 'first_child' ? 0 : innerBlocksLength, clientId,
// Insert as a child of the current block.
false);
break;
case undefined:
// If we do not know the relative position, it is because the block was
// added via a filter. In this case, we default to inserting it after the
// current block.
insertBlock(block, blockIndex + 1, rootClientId,
// Insert as a child of the current block's parent
false);
break;
}
};
return (0,external_React_.createElement)(inspector_controls, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
className: "block-editor-hooks__block-hooks",
title: (0,external_wp_i18n_namespaceObject.__)('Plugins'),
initialOpen: true
}, (0,external_React_.createElement)("p", {
className: "block-editor-hooks__block-hooks-helptext"
}, (0,external_wp_i18n_namespaceObject.__)('Manage the inclusion of blocks added automatically by plugins.')), Object.keys(groupedHookedBlocks).map(vendor => {
return (0,external_React_.createElement)(external_wp_element_namespaceObject.Fragment, {
key: vendor
}, (0,external_React_.createElement)("h3", null, vendor), groupedHookedBlocks[vendor].map(block => {
const checked = (block.name in hookedBlockClientIds);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, {
checked: checked,
key: block.title,
label: (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "flex-start"
}, (0,external_React_.createElement)(block_icon, {
icon: block.icon
}), (0,external_React_.createElement)("span", null, block.title)),
onChange: () => {
if (!checked) {
// Create and insert block.
const relativePosition = block.blockHooks[name];
insertBlockIntoDesignatedLocation((0,external_wp_blocks_namespaceObject.createBlock)(block.name), relativePosition);
return;
}
// Remove block.
removeBlock(hookedBlockClientIds[block.name], false);
}
});
}));
})));
}
/* harmony default export */ const block_hooks = ({
edit: BlockHooksControlPure,
attributeKeys: ['metadata'],
hasSupport() {
return true;
}
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/block-renaming.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Filters registered block settings, adding an `__experimentalLabel` callback if one does not already exist.
*
* @param {Object} settings Original block settings.
*
* @return {Object} Filtered block settings.
*/
function addLabelCallback(settings) {
// If blocks provide their own label callback, do not override it.
if (settings.__experimentalLabel) {
return settings;
}
const supportsBlockNaming = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'renaming', true // default value
);
// Check whether block metadata is supported before using it.
if (supportsBlockNaming) {
settings.__experimentalLabel = (attributes, {
context
}) => {
const {
metadata
} = attributes;
// In the list view, use the block's name attribute as the label.
if (context === 'list-view' && metadata?.name) {
return metadata.name;
}
};
}
return settings;
}
function BlockRenameControlPure({
metadata,
setAttributes
}) {
return (0,external_React_.createElement)(inspector_controls, {
group: "advanced"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Block name'),
value: metadata?.name || '',
onChange: newName => {
setAttributes({
metadata: {
...metadata,
name: newName
}
});
}
}));
}
/* harmony default export */ const block_renaming = ({
edit: BlockRenameControlPure,
attributeKeys: ['metadata'],
hasSupport(name) {
return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'renaming', true);
}
});
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/metadata/addLabelCallback', addLabelCallback);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-bindings-attributes.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */
/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
/**
* Given a binding of block attributes, returns a higher order component that
* overrides its `attributes` and `setAttributes` props to sync any changes needed.
*
* @return {WPHigherOrderComponent} Higher-order component.
*/
const BLOCK_BINDINGS_ALLOWED_BLOCKS = {
'core/paragraph': ['content'],
'core/heading': ['content'],
'core/image': ['url', 'title', 'alt'],
'core/button': ['url', 'text', 'linkTarget']
};
/**
* Based on the given block name,
* check if it is possible to bind the block.
*
* @param {string} blockName - The block name.
* @return {boolean} Whether it is possible to bind the block to sources.
*/
function canBindBlock(blockName) {
return blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS;
}
/**
* Based on the given block name and attribute name,
* check if it is possible to bind the block attribute.
*
* @param {string} blockName - The block name.
* @param {string} attributeName - The attribute name.
* @return {boolean} Whether it is possible to bind the block attribute.
*/
function canBindAttribute(blockName, attributeName) {
return canBindBlock(blockName) && BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName].includes(attributeName);
}
/**
* This component is responsible for detecting and
* propagating data changes from the source to the block.
*
* @param {Object} props - The component props.
* @param {string} props.attrName - The attribute name.
* @param {Object} props.blockProps - The block props with bound attribute.
* @param {Object} props.source - Source handler.
* @param {Object} props.args - The arguments to pass to the source.
* @param {Function} props.onPropValueChange - The function to call when the attribute value changes.
* @return {null} Data-handling component. Render nothing.
*/
const BindingConnector = ({
args,
attrName,
blockProps,
source,
onPropValueChange
}) => {
const {
placeholder,
value: propValue
} = source.useSource(blockProps, args);
const {
name: blockName
} = blockProps;
const attrValue = blockProps.attributes[attrName];
const updateBoundAttibute = (0,external_wp_element_namespaceObject.useCallback)((newAttrValue, prevAttrValue) => {
/*
* If the attribute is a RichTextData instance,
* (core/paragraph, core/heading, core/button, etc.)
* compare its HTML representation with the new value.
*
* To do: it looks like a workaround.
* Consider improving the attribute and metadata fields types.
*/
if (prevAttrValue instanceof external_wp_richText_namespaceObject.RichTextData) {
// Bail early if the Rich Text value is the same.
if (prevAttrValue.toHTMLString() === newAttrValue) {
return;
}
/*
* To preserve the value type,
* convert the new value to a RichTextData instance.
*/
newAttrValue = external_wp_richText_namespaceObject.RichTextData.fromHTMLString(newAttrValue);
}
if (prevAttrValue === newAttrValue) {
return;
}
onPropValueChange({
[attrName]: newAttrValue
});
}, [attrName, onPropValueChange]);
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (typeof propValue !== 'undefined') {
updateBoundAttibute(propValue, attrValue);
} else if (placeholder) {
/*
* Placeholder fallback.
* If the attribute is `src` or `href`,
* a placeholder can't be used because it is not a valid url.
* Adding this workaround until
* attributes and metadata fields types are improved and include `url`.
*/
const htmlAttribute = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName).attributes[attrName].attribute;
if (htmlAttribute === 'src' || htmlAttribute === 'href') {
updateBoundAttibute(null);
return;
}
updateBoundAttibute(placeholder);
}
}, [updateBoundAttibute, propValue, attrValue, placeholder, blockName, attrName]);
return null;
};
/**
* BlockBindingBridge acts like a component wrapper
* that connects the bound attributes of a block
* to the source handlers.
* For this, it creates a BindingConnector for each bound attribute.
*
* @param {Object} props - The component props.
* @param {Object} props.blockProps - The BlockEdit props object.
* @param {Object} props.bindings - The block bindings settings.
* @param {Function} props.onPropValueChange - The function to call when the attribute value changes.
* @return {null} Data-handling component. Render nothing.
*/
function BlockBindingBridge({
blockProps,
bindings,
onPropValueChange
}) {
const blockBindingsSources = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store)).getAllBlockBindingsSources();
return (0,external_React_.createElement)(external_React_.Fragment, null, Object.entries(bindings).map(([attrName, boundAttribute]) => {
// Bail early if the block doesn't have a valid source handler.
const source = blockBindingsSources[boundAttribute.source];
if (!source?.useSource) {
return null;
}
return (0,external_React_.createElement)(BindingConnector, {
key: attrName,
attrName: attrName,
source: source,
blockProps: blockProps,
args: boundAttribute.args,
onPropValueChange: onPropValueChange
});
}));
}
const withBlockBindingSupport = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
/*
* Collect and update the bound attributes
* in a separate state.
*/
const [boundAttributes, setBoundAttributes] = (0,external_wp_element_namespaceObject.useState)({});
const updateBoundAttributes = (0,external_wp_element_namespaceObject.useCallback)(newAttributes => setBoundAttributes(prev => ({
...prev,
...newAttributes
})), []);
/*
* Create binding object filtering
* only the attributes that can be bound.
*/
const bindings = Object.fromEntries(Object.entries(props.attributes.metadata?.bindings || {}).filter(([attrName]) => canBindAttribute(props.name, attrName)));
return (0,external_React_.createElement)(external_React_.Fragment, null, Object.keys(bindings).length > 0 && (0,external_React_.createElement)(BlockBindingBridge, {
blockProps: props,
bindings: bindings,
onPropValueChange: updateBoundAttributes
}), (0,external_React_.createElement)(BlockEdit, {
...props,
attributes: {
...props.attributes,
...boundAttributes
}
}));
}, 'withBlockBindingSupport');
/**
* Filters a registered block's settings to enhance a block's `edit` component
* to upgrade bound attributes.
*
* @param {WPBlockSettings} settings - Registered block settings.
* @param {string} name - Block name.
* @return {WPBlockSettings} Filtered block settings.
*/
function shimAttributeSource(settings, name) {
if (!canBindBlock(name)) {
return settings;
}
return {
...settings,
edit: withBlockBindingSupport(settings.edit)
};
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-border-props.js
/**
* 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.
/**
* Provides the CSS class names and inline styles for a block's border support
* attributes.
*
* @param {Object} attributes Block attributes.
* @return {Object} Border block support derived CSS classes & styles.
*/
function getBorderClassesAndStyles(attributes) {
const border = attributes.style?.border || {};
const className = getBorderClasses(attributes);
return {
className: className || undefined,
style: getInlineStyles({
border
})
};
}
/**
* 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
} = useMultipleOriginColorsAndGradients();
const borderProps = getBorderClassesAndStyles(attributes);
const {
borderColor
} = attributes;
// Force inline styles to apply named border colors when themes do not load
// their color stylesheets in the editor.
if (borderColor) {
const borderColorObject = getMultiOriginColor({
colors,
namedColor: borderColor
});
borderProps.style.borderColor = borderColorObject.color;
}
return borderProps;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-shadow-props.js
/**
* Internal dependencies
*/
// This utility is intended to assist where the serialization of the shadow
// block support is being skipped for a block but the shadow 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 shadow support
* attributes.
*
* @param {Object} attributes Block attributes.
* @return {Object} Shadow block support derived CSS classes & styles.
*/
function getShadowClassesAndStyles(attributes) {
const shadow = attributes.style?.shadow || '';
return {
style: getInlineStyles({
shadow
})
};
}
;// 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) {
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?.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?.color?.text,
'has-background': backgroundColor || style?.color?.background || gradient || style?.color?.gradient,
'has-link-color': style?.elements?.link?.color
});
// Collect inline styles for colors.
const colorStyles = 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 [userPalette, themePalette, defaultPalette, userGradients, themeGradients, defaultGradients] = use_settings_useSettings('color.palette.custom', 'color.palette.theme', 'color.palette.default', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default');
const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]);
const gradients = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userGradients || []), ...(themeGradients || []), ...(defaultGradients || [])], [userGradients, themeGradients, defaultGradients]);
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?.spacing || {};
const styleProp = getInlineStyles({
spacing: spacingStyles
});
return {
style: styleProp
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-typography-props.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/*
* This utility is intended to assist where the serialization of the typography
* block support is being skipped for a block but the typography 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 typography support
* attributes.
*
* @param {Object} attributes Block attributes.
* @param {Object|boolean} settings Merged theme.json settings
*
* @return {Object} Typography block support derived CSS classes & styles.
*/
function getTypographyClassesAndStyles(attributes, settings) {
const {
kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
let typographyStyles = attributes?.style?.typography || {};
const fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings);
typographyStyles = {
...typographyStyles,
fontSize: getTypographyFontSizeValue({
size: attributes?.style?.typography?.fontSize
}, fluidTypographySettings)
};
const style = getInlineStyles({
typography: typographyStyles
});
const fontFamilyClassName = !!attributes?.fontFamily ? `has-${kebabCase(attributes.fontFamily)}-font-family` : '';
const className = classnames_default()(fontFamilyClassName, getFontSizeClass(attributes?.fontSize));
return {
className,
style
};
}
;// 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
*/
createBlockEditFilter([align, hooks_anchor, custom_class_name, style, duotone, position, layout, content_lock_ui, block_hooks, block_renaming].filter(Boolean));
createBlockListBlockFilter([align, style, color, dimensions, duotone, font_family, font_size, border, position, layout_child]);
createBlockSaveFilter([align, hooks_anchor, aria_label, custom_class_name, border, color, style, font_family, font_size]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/with-colors.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Capitalizes the first letter in a string.
*
* @param {string} str The string whose first letter the function will capitalize.
*
* @return {string} Capitalized string.
*/
const upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpperCase() + rest.join('');
/**
* 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_React_.createElement)(WrappedComponent, {
...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 => {
const [userPalette, themePalette, defaultPalette] = use_settings_useSettings('color.palette.custom', 'color.palette.theme', 'color.palette.default');
const allColors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]);
return (0,external_React_.createElement)(WrappedComponent, {
...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 {Component} The component that can be used as a HOC.
*/
function createColorHOC(colorTypes, withColorPalette) {
const {
kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
const colorMap = colorTypes.reduce((colorObject, colorType) => {
return {
...colorObject,
...(typeof colorType === 'string' ? {
[colorType]: 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 Object.keys(colorMap).reduce((settersAccumulator, colorAttributeName) => {
const upperFirstColorAttributeName = 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.entries(colorMap).reduce((newState, [colorAttributeName, colorContext]) => {
const colorObject = getColorObjectByAttributeValues(colors, attributes[colorAttributeName], attributes[`custom${upperFirst(colorAttributeName)}`]);
const previousColorObject = previousState[colorAttributeName];
const previousColor = 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_React_.createElement)(WrappedComponent, {
...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 (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(...colorTypes) {
const withColorPalette = withEditorColorPalette();
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/font-size-picker.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function font_size_picker_FontSizePicker(props) {
const [fontSizes, customFontSize] = use_settings_useSettings('typography.fontSizes', 'typography.customFontSize');
return (0,external_React_.createElement)(external_wp_components_namespaceObject.FontSizePicker, {
...props,
fontSizes: fontSizes,
disableCustomFontSizes: !customFontSize
});
}
/**
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/font-sizes/README.md
*/
/* harmony default export */ const font_size_picker = (font_size_picker_FontSizePicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/with-font-sizes.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DEFAULT_FONT_SIZES = [];
/**
* Capitalizes the first letter in a string.
*
* @param {string} str The string whose first letter the function will capitalize.
*
* @return {string} Capitalized string.
*/
const with_font_sizes_upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpperCase() + rest.join('');
/**
* 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 */ const 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 = fontSizeNames.reduce((fontSizeAttributeNamesAccumulator, fontSizeAttributeName) => {
fontSizeAttributeNamesAccumulator[fontSizeAttributeName] = `custom${with_font_sizes_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] = use_settings_useSettings('typography.fontSizes');
return (0,external_React_.createElement)(WrappedComponent, {
...props,
fontSizes: fontSizes || DEFAULT_FONT_SIZES
});
}, 'withFontSizes'), WrappedComponent => {
return class extends external_wp_element_namespaceObject.Component {
constructor(props) {
super(props);
this.setters = this.createSetters();
this.state = {};
}
createSetters() {
return Object.entries(fontSizeAttributeNames).reduce((settersAccumulator, [fontSizeAttributeName, customFontSizeAttributeName]) => {
const upperFirstFontSizeAttributeName = with_font_sizes_upperFirst(fontSizeAttributeName);
settersAccumulator[`set${upperFirstFontSizeAttributeName}`] = this.createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName);
return settersAccumulator;
}, {});
}
createSetFontSize(fontSizeAttributeName, customFontSizeAttributeName) {
return fontSizeValue => {
const fontSizeObject = this.props.fontSizes?.find(({
size
}) => 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.values(fontSizeAttributeNames).some(didAttributesChange)) {
return null;
}
const newState = Object.entries(fontSizeAttributeNames).filter(([key, value]) => didAttributesChange(value, key)).reduce((newStateAccumulator, [fontSizeAttributeName, customFontSizeAttributeName]) => {
const fontSizeAttributeValue = attributes[fontSizeAttributeName];
const fontSizeObject = utils_getFontSize(fontSizes, fontSizeAttributeValue, attributes[customFontSizeAttributeName]);
newStateAccumulator[fontSizeAttributeName] = {
...fontSizeObject,
class: getFontSizeClass(fontSizeAttributeValue)
};
return newStateAccumulator;
}, {});
return {
...previousState,
...newState
};
}
render() {
return (0,external_React_.createElement)(WrappedComponent, {
...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_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z"
}));
/* harmony default export */ const align_left = (alignLeft);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-center.js
/**
* WordPress dependencies
*/
const align_center_alignCenter = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M7.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z"
}));
/* harmony default export */ const align_center = (align_center_alignCenter);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-right.js
/**
* WordPress dependencies
*/
const alignRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z"
}));
/* harmony default export */ const align_right = (alignRight);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/alignment-control/ui.js
/**
* 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 ui_POPOVER_PROPS = {
placement: 'bottom-start'
};
function AlignmentUI({
value,
onChange,
alignmentControls = DEFAULT_ALIGNMENT_CONTROLS,
label = (0,external_wp_i18n_namespaceObject.__)('Align text'),
describedBy = (0,external_wp_i18n_namespaceObject.__)('Change text alignment'),
isCollapsed = true,
isToolbar
}) {
function applyOrUnset(align) {
return () => onChange(value === align ? undefined : align);
}
const activeAlignment = alignmentControls.find(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
} : {
toggleProps: {
describedBy
},
popoverProps: ui_POPOVER_PROPS
};
return (0,external_React_.createElement)(UIComponent, {
icon: setIcon(),
label: label,
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 */ const 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_React_.createElement)(alignment_control_ui, {
...props,
isToolbar: false
});
};
const AlignmentToolbar = props => {
return (0,external_React_.createElement)(alignment_control_ui, {
...props,
isToolbar: true
});
};
/**
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/alignment-control/README.md
*/
// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
var remove_accents = __webpack_require__(9681);
var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
/**
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
*/
var SUPPORTED_LOCALE = {
tr: {
regexp: /\u0130|\u0049|\u0049\u0307/g,
map: {
İ: "\u0069",
I: "\u0131",
İ: "\u0069",
},
},
az: {
regexp: /\u0130/g,
map: {
İ: "\u0069",
I: "\u0131",
İ: "\u0069",
},
},
lt: {
regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
map: {
I: "\u0069\u0307",
J: "\u006A\u0307",
Į: "\u012F\u0307",
Ì: "\u0069\u0307\u0300",
Í: "\u0069\u0307\u0301",
Ĩ: "\u0069\u0307\u0303",
},
},
};
/**
* Localized lower case.
*/
function localeLowerCase(str, locale) {
var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
if (lang)
return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
return lowerCase(str);
}
/**
* Lower case as a function.
*/
function lowerCase(str) {
return str.toLowerCase();
}
;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
// Remove all non-word characters.
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
/**
* Normalize the string into something other libraries can manipulate easier.
*/
function noCase(input, options) {
if (options === void 0) { options = {}; }
var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
var result = dist_es2015_replace(dist_es2015_replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
var start = 0;
var end = result.length;
// Trim the delimiter from around the output string.
while (result.charAt(start) === "\0")
start++;
while (result.charAt(end - 1) === "\0")
end--;
// Transform each token independently.
return result.slice(start, end).split("\0").map(transform).join(delimiter);
}
/**
* Replace `re` in the input string with the replacement value.
*/
function dist_es2015_replace(input, re, value) {
if (re instanceof RegExp)
return input.replace(re, value);
return re.reduce(function (input, re) { return input.replace(re, value); }, input);
}
;// 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;
/**
* Extracts words from an input string.
*
* @param {string} input The input string.
*
* @return {Array} Words, extracted from the input string.
*/
function extractWords(input = '') {
return noCase(input, {
splitRegexp: [/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu,
// One lowercase or digit, followed by one uppercase.
/([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu // One uppercase followed by one uppercase and one lowercase.
],
stripRegexp: /(\p{C}|\p{P}|\p{S})+/giu // Anything that's not a punctuation, symbol or control/format character.
}).split(' ').filter(Boolean);
}
/**
* 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 = remove_accents_default()(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 = '') => {
return extractWords(normalizeSearchInput(input));
};
const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => {
return unmatchedTerms.filter(term => !getNormalizedSearchTerms(unprocessedTerms).some(unprocessedTerm => unprocessedTerm.includes(term)));
};
const searchBlockItems = (items, categories, collections, searchInput) => {
const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
if (normalizedSearchTerms.length === 0) {
return items;
}
const config = {
getCategory: item => categories.find(({
slug
}) => slug === item.category)?.title,
getCollection: item => collections[item.name.split('/')[0]]?.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 = extractWords(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/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 [items] = (0,external_wp_data_namespaceObject.useSelect)(select => [select(store).getInserterItems(rootClientId)], [rootClientId]);
const [categories, collections] = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getCategories,
getCollections
} = select(external_wp_blocks_namespaceObject.store);
return [getCategories(), getCollections()];
}, []);
const onSelectItem = (0,external_wp_element_namespaceObject.useCallback)(({
name,
initialAttributes,
innerBlocks,
syncStatus,
content
}, shouldFocusBlock) => {
const insertedBlock = syncStatus === 'unsynced' ? (0,external_wp_blocks_namespaceObject.parse)(content, {
__unstableSkipMigrationLogs: true
}) : (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 */ const use_block_types_state = (useBlockTypesState);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/order-inserter-block-items.js
/** @typedef {import('../store/selectors').WPEditorInserterItem} WPEditorInserterItem */
/**
* Helper function to order inserter block items according to a provided array of prioritized blocks.
*
* @param {WPEditorInserterItem[]} items The array of editor inserter block items to be sorted.
* @param {string[]} priority The array of block names to be prioritized.
* @return {WPEditorInserterItem[]} The sorted array of editor inserter block items.
*/
const orderInserterBlockItems = (items, priority) => {
if (!priority) {
return items;
}
items.sort(({
id: aName
}, {
id: bName
}) => {
// Sort block items according to `priority`.
let aIndex = priority.indexOf(aName);
let bIndex = priority.indexOf(bName);
// All other block items should come after that.
if (aIndex < 0) aIndex = priority.length;
if (bIndex < 0) bIndex = priority.length;
return aIndex - bIndex;
});
return items;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/autocompleters/block.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const block_noop = () => {};
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,
prioritizedBlocks
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSelectedBlockClientId,
getBlockName,
getBlockListSettings,
getBlockRootClientId
} = select(store);
const selectedBlockClientId = getSelectedBlockClientId();
const _rootClientId = getBlockRootClientId(selectedBlockClientId);
return {
selectedBlockName: selectedBlockClientId ? getBlockName(selectedBlockClientId) : null,
rootClientId: _rootClientId,
prioritizedBlocks: getBlockListSettings(_rootClientId)?.prioritizedInserterBlocks
};
}, []);
const [items, categories, collections] = use_block_types_state(rootClientId, block_noop);
const filteredItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
const initialFilteredItems = !!filterValue.trim() ? searchBlockItems(items, categories, collections, filterValue) : orderInserterBlockItems(orderBy(items, 'frecency', 'desc'), prioritizedBlocks);
return initialFilteredItems.filter(item => item.name !== selectedBlockName).slice(0, SHOWN_BLOCK_TYPES);
}, [filterValue, selectedBlockName, items, categories, collections, prioritizedBlocks]);
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_React_.createElement)(external_React_.Fragment, null, (0,external_React_.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,
syncStatus,
content
} = inserterItem;
return {
action: 'replace',
value: syncStatus === 'unsynced' ? (0,external_wp_blocks_namespaceObject.parse)(content, {
__unstableSkipMigrationLogs: true
}) : (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 */ const block = (createBlockCompleter());
;// CONCATENATED MODULE: external ["wp","apiFetch"]
const 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/post.js
/**
* WordPress dependencies
*/
const post = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const library_post = (post);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/autocompleters/link.js
/**
* WordPress dependencies
*/
// Disable Reason: Needs to be refactored.
// eslint-disable-next-line no-restricted-imports
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_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(build_module_icon, {
key: "icon",
icon: item.subtype === 'page' ? library_page : library_post
}), item.title);
},
getOptionCompletion(item) {
return (0,external_React_.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 */ const autocompleters_link = (createLinkCompleter());
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/autocomplete/index.js
/**
* 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 (0,external_wp_element_namespaceObject.useMemo)(() => {
let filteredCompleters = [...completers, autocompleters_link];
if (name === (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() || (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, '__experimentalSlashInserter', false)) {
filteredCompleters = [...filteredCompleters, block];
}
if ((0,external_wp_hooks_namespaceObject.hasFilter)('editor.Autocomplete.completers')) {
// Provide copies so filters may directly modify them.
if (filteredCompleters === completers) {
filteredCompleters = filteredCompleters.map(completer => ({
...completer
}));
}
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_React_.createElement)(external_wp_components_namespaceObject.Autocomplete, {
...props,
completers: useCompleters(props)
});
}
/**
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/autocomplete/README.md
*/
/* harmony default export */ const autocomplete = (BlockEditorAutocomplete);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/fullscreen.js
/**
* WordPress dependencies
*/
const fullscreen = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z"
}));
/* harmony default export */ const 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 = (0,external_wp_i18n_namespaceObject.__)('Toggle full height'),
onToggle,
isDisabled
}) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
isActive: isActive,
icon: library_fullscreen,
label: label,
onClick: () => onToggle(!isActive),
disabled: isDisabled
});
}
/* harmony default export */ const block_full_height_alignment_control = (BlockFullHeightAlignmentControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-alignment-matrix-control/index.js
/**
* WordPress dependencies
*/
const block_alignment_matrix_control_noop = () => {};
function BlockAlignmentMatrixControl(props) {
const {
label = (0,external_wp_i18n_namespaceObject.__)('Change matrix alignment'),
onChange = block_alignment_matrix_control_noop,
value = 'center',
isDisabled
} = props;
const icon = (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalAlignmentMatrixControl.Icon, {
value: value
});
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: {
placement: 'bottom-start'
},
renderToggle: ({
onToggle,
isOpen
}) => {
const openOnArrowDown = event => {
if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
event.preventDefault();
onToggle();
}
};
return (0,external_React_.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_React_.createElement)(external_wp_components_namespaceObject.__experimentalAlignmentMatrixControl, {
hasFocusBorder: false,
onChange: onChange,
value: value
})
});
}
/* harmony default export */ const block_alignment_matrix_control = (BlockAlignmentMatrixControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-title/use-block-display-title.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns the block's configured title as a string, or empty if the title
* cannot be determined.
*
* @example
*
* ```js
* useBlockDisplayTitle( { clientId: 'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1', maximumLength: 17 } );
* ```
*
* @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.
* @param {string|undefined} props.context The context to pass to `getBlockLabel`.
* @return {?string} Block title.
*/
function useBlockDisplayTitle({
clientId,
maximumLength,
context
}) {
const blockTitle = (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 label = (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes, context);
// If the label is defined we prioritize it over a possible block variation title match.
if (label !== blockType.title) {
return label;
}
const match = getActiveBlockVariation(blockName, attributes);
// Label will fallback to the title if no label is defined for the current label context.
return match?.title || blockType.title;
}, [clientId, context]);
if (!blockTitle) {
return null;
}
if (maximumLength && maximumLength > 0 && blockTitle.length > maximumLength) {
const omission = '...';
return blockTitle.slice(0, maximumLength - omission.length) + omission;
}
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
* <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" maximumLength={ 17 }/>
* ```
*
* @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.
* @param {string|undefined} props.context The context to pass to `getBlockLabel`.
*
* @return {JSX.Element} Block title.
*/
function BlockTitle({
clientId,
maximumLength,
context
}) {
return useBlockDisplayTitle({
clientId,
maximumLength,
context
});
}
;// 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 {Element} Block Breadcrumb.
*/
function BlockBreadcrumb({
rootLabelText
}) {
const {
selectBlock,
clearSelectedBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const {
clientId,
parents,
hasSelection
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSelectionStart,
getSelectedBlockClientId,
getEnabledBlockParents
} = unlock(select(store));
const selectedBlockClientId = getSelectedBlockClientId();
return {
parents: getEnabledBlockParents(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_React_.createElement)("ul", {
className: "block-editor-block-breadcrumb",
role: "list",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Block breadcrumb')
}, (0,external_React_.createElement)("li", {
className: !hasSelection ? 'block-editor-block-breadcrumb__current' : undefined,
"aria-current": !hasSelection ? 'true' : undefined
}, hasSelection && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
className: "block-editor-block-breadcrumb__button",
variant: "tertiary",
onClick: clearSelectedBlock
}, rootLabel), !hasSelection && rootLabel, !!clientId && (0,external_React_.createElement)(build_module_icon, {
icon: chevron_right_small,
className: "block-editor-block-breadcrumb__separator"
})), parents.map(parentClientId => (0,external_React_.createElement)("li", {
key: parentClientId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
className: "block-editor-block-breadcrumb__button",
variant: "tertiary",
onClick: () => selectBlock(parentClientId)
}, (0,external_React_.createElement)(BlockTitle, {
clientId: parentClientId,
maximumLength: 35
})), (0,external_React_.createElement)(build_module_icon, {
icon: chevron_right_small,
className: "block-editor-block-breadcrumb__separator"
}))), !!clientId && (0,external_React_.createElement)("li", {
className: "block-editor-block-breadcrumb__current",
"aria-current": "true"
}, (0,external_React_.createElement)(BlockTitle, {
clientId: clientId,
maximumLength: 35
})))
/* eslint-enable jsx-a11y/no-redundant-roles */;
}
/* harmony default export */ const block_breadcrumb = (BlockBreadcrumb);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-content-overlay/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useBlockOverlayActive(clientId) {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
__unstableHasActiveBlockOverlayActive
} = select(store);
return __unstableHasActiveBlockOverlayActive(clientId);
}, [clientId]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-context/index.js
/**
* WordPress dependencies
*/
/** @typedef {import('react').ReactNode} ReactNode */
/**
* @typedef BlockContextProviderProps
*
* @property {Record<string,*>} value Context value to merge with current
* value.
* @property {ReactNode} children Component children.
*/
/** @type {import('react').Context<Record<string,*>>} */
const block_context_Context = (0,external_wp_element_namespaceObject.createContext)({});
/**
* Component which merges passed value with current consumed block context.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-context/README.md
*
* @param {BlockContextProviderProps} props
*/
function BlockContextProvider({
value,
children
}) {
const context = (0,external_wp_element_namespaceObject.useContext)(block_context_Context);
const nextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
...context,
...value
}), [context, value]);
return (0,external_React_.createElement)(block_context_Context.Provider, {
value: nextValue,
children: children
});
}
/* harmony default export */ const block_context = (block_context_Context);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Default value used for blocks which do not define their own context needs,
* used to guarantee that a block's `context` prop will always be an object. It
* is assigned as a constant since it is always expected to be an empty object,
* and in order to avoid unnecessary React reconciliations of a changing object.
*
* @type {{}}
*/
const DEFAULT_BLOCK_CONTEXT = {};
const Edit = props => {
const {
name
} = props;
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
if (!blockType) {
return null;
}
// `edit` and `save` are functions or components describing the markup
// with which a block is displayed. If `blockType` is valid, assign
// them preferentially as the render value for the block.
const Component = blockType.edit || blockType.save;
return (0,external_React_.createElement)(Component, {
...props
});
};
const EditWithFilters = (0,external_wp_components_namespaceObject.withFilters)('editor.BlockEdit')(Edit);
const EditWithGeneratedProps = props => {
const {
attributes = {},
name
} = props;
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 ? Object.fromEntries(Object.entries(blockContext).filter(([key]) => blockType.usesContext.includes(key))) : DEFAULT_BLOCK_CONTEXT;
}, [blockType, blockContext]);
if (!blockType) {
return null;
}
if (blockType.apiVersion > 1) {
return (0,external_React_.createElement)(EditWithFilters, {
...props,
context: context
});
}
// 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, props.className);
return (0,external_React_.createElement)(EditWithFilters, {
...props,
context: context,
className: className
});
};
/* harmony default export */ const block_edit_edit = (EditWithGeneratedProps);
;// 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({
mayDisplayControls,
mayDisplayParentControls,
blockEditingMode,
// The remaining props are passed through the BlockEdit filters and are thus
// public API!
...props
}) {
const {
name,
isSelected,
clientId,
attributes = {},
__unstableLayoutClassNames
} = props;
const {
layout = null,
metadata = {}
} = attributes;
const {
bindings
} = metadata;
const layoutSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'layout', false) || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, '__experimentalLayout', false);
return (0,external_React_.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: (0,external_wp_element_namespaceObject.useMemo)(() => ({
name,
isSelected,
clientId,
layout: layoutSupport ? layout : null,
__unstableLayoutClassNames,
// We use symbols in favour of an __unstable prefix to avoid
// usage outside of the package (this context is exposed).
[mayDisplayControlsKey]: mayDisplayControls,
[mayDisplayParentControlsKey]: mayDisplayParentControls,
[blockEditingModeKey]: blockEditingMode,
[blockBindingsKey]: bindings
}), [name, isSelected, clientId, layoutSupport, layout, __unstableLayoutClassNames, mayDisplayControls, mayDisplayParentControls, blockEditingMode, bindings])
}, (0,external_React_.createElement)(block_edit_edit, {
...props
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
/**
* WordPress dependencies
*/
const moreVertical = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
}));
/* harmony default export */ const more_vertical = (moreVertical);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/warning/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function Warning({
className,
actions,
children,
secondaryActions
}) {
return (0,external_React_.createElement)("div", {
style: {
display: 'contents',
all: 'initial'
}
}, (0,external_React_.createElement)("div", {
className: classnames_default()(className, 'block-editor-warning')
}, (0,external_React_.createElement)("div", {
className: "block-editor-warning__contents"
}, (0,external_React_.createElement)("p", {
className: "block-editor-warning__message"
}, children), (external_wp_element_namespaceObject.Children.count(actions) > 0 || secondaryActions) && (0,external_React_.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_React_.createElement)("span", {
key: i,
className: "block-editor-warning__action"
}, action)), secondaryActions && (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
className: "block-editor-warning__secondary",
icon: more_vertical,
label: (0,external_wp_i18n_namespaceObject.__)('More options'),
popoverProps: {
position: 'bottom left',
className: 'block-editor-warning__dropdown'
},
noIcons: true
}, () => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, secondaryActions.map((item, pos) => (0,external_React_.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 */ const warning = (Warning);
// EXTERNAL MODULE: ./node_modules/diff/lib/diff/character.js
var character = __webpack_require__(8021);
;// 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 (0,external_React_.createElement)("div", {
className: className
}, (0,external_React_.createElement)("div", {
className: "block-editor-block-compare__content"
}, (0,external_React_.createElement)("h2", {
className: "block-editor-block-compare__heading"
}, title), (0,external_React_.createElement)("div", {
className: "block-editor-block-compare__html"
}, rawContent), (0,external_React_.createElement)("div", {
className: "block-editor-block-compare__preview edit-post-visual-editor"
}, (0,external_React_.createElement)(external_wp_element_namespaceObject.RawHTML, null, (0,external_wp_dom_namespaceObject.safeHTML)(renderedContent)))), (0,external_React_.createElement)("div", {
className: "block-editor-block-compare__action"
}, (0,external_React_.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({
block,
onKeep,
onConvert,
convertor,
convertButtonText
}) {
function getDifference(originalContent, newContent) {
const difference = (0,character/* diffChars */.JJ)(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_React_.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 = Array.isArray(convertedBlock) ? convertedBlock : [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_React_.createElement)("div", {
className: "block-editor-block-compare__wrapper"
}, (0,external_React_.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_React_.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 */ const block_compare = (BlockCompare);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/block-invalid-warning.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const blockToBlocks = block => (0,external_wp_blocks_namespaceObject.rawHandler)({
HTML: block.originalContent
});
function BlockInvalidWarning({
clientId
}) {
const {
block,
canInsertHTMLBlock,
canInsertClassicBlock
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canInsertBlockType,
getBlock,
getBlockRootClientId
} = select(store);
const rootClientId = getBlockRootClientId(clientId);
return {
block: getBlock(clientId),
canInsertHTMLBlock: canInsertBlockType('core/html', rootClientId),
canInsertClassicBlock: canInsertBlockType('core/freeform', rootClientId)
};
}, [clientId]);
const {
replaceBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const [compare, setCompare] = (0,external_wp_element_namespaceObject.useState)(false);
const onCompareClose = (0,external_wp_element_namespaceObject.useCallback)(() => setCompare(false), []);
const convert = (0,external_wp_element_namespaceObject.useMemo)(() => ({
toClassic() {
const classicBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/freeform', {
content: block.originalContent
});
return replaceBlock(block.clientId, classicBlock);
},
toHTML() {
const htmlBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/html', {
content: block.originalContent
});
return replaceBlock(block.clientId, htmlBlock);
},
toBlocks() {
const newBlocks = blockToBlocks(block);
return replaceBlock(block.clientId, newBlocks);
},
toRecoveredBlock() {
const recoveredBlock = (0,external_wp_blocks_namespaceObject.createBlock)(block.name, block.attributes, block.innerBlocks);
return replaceBlock(block.clientId, recoveredBlock);
}
}), [block, replaceBlock]);
const secondaryActions = (0,external_wp_element_namespaceObject.useMemo)(() => [{
// translators: Button to fix block content
title: (0,external_wp_i18n_namespaceObject._x)('Resolve', 'imperative verb'),
onClick: () => setCompare(true)
}, canInsertHTMLBlock && {
title: (0,external_wp_i18n_namespaceObject.__)('Convert to HTML'),
onClick: convert.toHTML
}, canInsertClassicBlock && {
title: (0,external_wp_i18n_namespaceObject.__)('Convert to Classic Block'),
onClick: convert.toClassic
}].filter(Boolean), [canInsertHTMLBlock, canInsertClassicBlock, convert]);
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(warning, {
actions: [(0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
key: "recover",
onClick: convert.toRecoveredBlock,
variant: "primary"
}, (0,external_wp_i18n_namespaceObject.__)('Attempt Block Recovery'))],
secondaryActions: secondaryActions
}, (0,external_wp_i18n_namespaceObject.__)('This block contains unexpected or invalid content.')), compare && (0,external_React_.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_React_.createElement)(block_compare, {
block: block,
onKeep: convert.toHTML,
onConvert: convert.toBlocks,
convertor: blockToBlocks,
convertButtonText: (0,external_wp_i18n_namespaceObject.__)('Convert to Blocks')
})));
}
;// 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_React_.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 */ const 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 */ const block_crash_boundary = (BlockCrashBoundary);
// EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
var react_autosize_textarea_lib = __webpack_require__(4132);
;// 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] = (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_React_.createElement)(react_autosize_textarea_lib/* default */.A, {
className: "block-editor-block-list__block-html-textarea",
value: html,
onBlur: onChange,
onChange: event => setHtml(event.target.value)
});
}
/* harmony default export */ const block_html = (BlockHTML);
;// CONCATENATED MODULE: ./node_modules/@react-spring/rafz/dist/esm/index.js
var esm_f=esm_l(),esm_n=e=>esm_c(e,esm_f),esm_m=esm_l();esm_n.write=e=>esm_c(e,esm_m);var esm_d=esm_l();esm_n.onStart=e=>esm_c(e,esm_d);var esm_h=esm_l();esm_n.onFrame=e=>esm_c(e,esm_h);var esm_p=esm_l();esm_n.onFinish=e=>esm_c(e,esm_p);var esm_i=[];esm_n.setTimeout=(e,t)=>{let a=esm_n.now()+t,o=()=>{let F=esm_i.findIndex(z=>z.cancel==o);~F&&esm_i.splice(F,1),esm_u-=~F?1:0},s={time:a,handler:e,cancel:o};return esm_i.splice(esm_w(a),0,s),esm_u+=1,esm_v(),s};var esm_w=e=>~(~esm_i.findIndex(t=>t.time>e)||~esm_i.length);esm_n.cancel=e=>{esm_d.delete(e),esm_h.delete(e),esm_p.delete(e),esm_f.delete(e),esm_m.delete(e)};esm_n.sync=e=>{T=!0,esm_n.batchedUpdates(e),T=!1};esm_n.throttle=e=>{let t;function a(){try{e(...t)}finally{t=null}}function o(...s){t=s,esm_n.onStart(a)}return o.handler=e,o.cancel=()=>{esm_d.delete(a),t=null},o};var esm_y=typeof window<"u"?window.requestAnimationFrame:()=>{};esm_n.use=e=>esm_y=e;esm_n.now=typeof performance<"u"?()=>performance.now():Date.now;esm_n.batchedUpdates=e=>e();esm_n.catch=console.error;esm_n.frameLoop="always";esm_n.advance=()=>{esm_n.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):esm_x()};var esm_r=-1,esm_u=0,T=!1;function esm_c(e,t){T?(t.delete(e),e(0)):(t.add(e),esm_v())}function esm_v(){esm_r<0&&(esm_r=0,esm_n.frameLoop!=="demand"&&esm_y(esm_b))}function esm_R(){esm_r=-1}function esm_b(){~esm_r&&(esm_y(esm_b),esm_n.batchedUpdates(esm_x))}function esm_x(){let e=esm_r;esm_r=esm_n.now();let t=esm_w(esm_r);if(t&&(Q(esm_i.splice(0,t),a=>a.handler()),esm_u-=t),!esm_u){esm_R();return}esm_d.flush(),esm_f.flush(e?Math.min(64,esm_r-e):16.667),esm_h.flush(),esm_m.flush(),esm_p.flush()}function esm_l(){let e=new Set,t=e;return{add(a){esm_u+=t==e&&!e.has(a)?1:0,e.add(a)},delete(a){return esm_u-=t==e&&e.has(a)?1:0,e.delete(a)},flush(a){t.size&&(e=new Set,esm_u-=t.size,Q(t,o=>o(a)&&e.add(o)),esm_u+=e.size,t=e)}}}function Q(e,t){e.forEach(a=>{try{t(a)}catch(o){esm_n.catch(o)}})}var esm_S={count(){return esm_u},isRunning(){return esm_r>=0},clear(){esm_r=-1,esm_i=[],esm_d=esm_l(),esm_f=esm_l(),esm_h=esm_l(),esm_m=esm_l(),esm_p=esm_l(),esm_u=0}};
;// CONCATENATED MODULE: ./node_modules/@react-spring/shared/dist/esm/index.js
var ze=Object.defineProperty;var Le=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:!0})};var dist_esm_p={};Le(dist_esm_p,{assign:()=>U,colors:()=>dist_esm_c,createStringInterpolator:()=>esm_k,skipAnimation:()=>ee,to:()=>J,willAdvance:()=>dist_esm_S});function Y(){}var mt=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0}),dist_esm_l={arr:Array.isArray,obj:e=>!!e&&e.constructor.name==="Object",fun:e=>typeof e=="function",str:e=>typeof e=="string",num:e=>typeof e=="number",und:e=>e===void 0};function bt(e,t){if(dist_esm_l.arr(e)){if(!dist_esm_l.arr(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return e===t}var esm_Ve=(e,t)=>e.forEach(t);function xt(e,t,r){if(dist_esm_l.arr(e)){for(let n=0;n<e.length;n++)t.call(r,e[n],`${n}`);return}for(let n in e)e.hasOwnProperty(n)&&t.call(r,e[n],n)}var ht=e=>dist_esm_l.und(e)?[]:dist_esm_l.arr(e)?e:[e];function Pe(e,t){if(e.size){let r=Array.from(e);e.clear(),esm_Ve(r,t)}}var yt=(e,...t)=>Pe(e,r=>r(...t)),dist_esm_h=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);var esm_k,J,dist_esm_c=null,ee=!1,dist_esm_S=Y,U=e=>{e.to&&(J=e.to),e.now&&(esm_n.now=e.now),e.colors!==void 0&&(dist_esm_c=e.colors),e.skipAnimation!=null&&(ee=e.skipAnimation),e.createStringInterpolator&&(esm_k=e.createStringInterpolator),e.requestAnimationFrame&&esm_n.use(e.requestAnimationFrame),e.batchedUpdates&&(esm_n.batchedUpdates=e.batchedUpdates),e.willAdvance&&(dist_esm_S=e.willAdvance),e.frameLoop&&(esm_n.frameLoop=e.frameLoop)};var esm_E=new Set,dist_esm_u=[],esm_H=[],A=0,qe={get idle(){return!esm_E.size&&!dist_esm_u.length},start(e){A>e.priority?(esm_E.add(e),esm_n.onStart($e)):(te(e),esm_n(B))},advance:B,sort(e){if(A)esm_n.onFrame(()=>qe.sort(e));else{let t=dist_esm_u.indexOf(e);~t&&(dist_esm_u.splice(t,1),re(e))}},clear(){dist_esm_u=[],esm_E.clear()}};function $e(){esm_E.forEach(te),esm_E.clear(),esm_n(B)}function te(e){dist_esm_u.includes(e)||re(e)}function re(e){dist_esm_u.splice(Ge(dist_esm_u,t=>t.priority>e.priority),0,e)}function B(e){let t=esm_H;for(let r=0;r<dist_esm_u.length;r++){let n=dist_esm_u[r];A=n.priority,n.idle||(dist_esm_S(n),n.advance(e),n.idle||t.push(n))}return A=0,esm_H=dist_esm_u,esm_H.length=0,dist_esm_u=t,dist_esm_u.length>0}function Ge(e,t){let r=e.findIndex(t);return r<0?e.length:r}var ne=(e,t,r)=>Math.min(Math.max(r,e),t);var It={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};var dist_esm_d="[-+]?\\d*\\.?\\d+",esm_M=dist_esm_d+"%";function C(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var oe=new RegExp("rgb"+C(dist_esm_d,dist_esm_d,dist_esm_d)),fe=new RegExp("rgba"+C(dist_esm_d,dist_esm_d,dist_esm_d,dist_esm_d)),ae=new RegExp("hsl"+C(dist_esm_d,esm_M,esm_M)),ie=new RegExp("hsla"+C(dist_esm_d,esm_M,esm_M,dist_esm_d)),se=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ue=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,le=/^#([0-9a-fA-F]{6})$/,esm_ce=/^#([0-9a-fA-F]{8})$/;function be(e){let t;return typeof e=="number"?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=le.exec(e))?parseInt(t[1]+"ff",16)>>>0:dist_esm_c&&dist_esm_c[e]!==void 0?dist_esm_c[e]:(t=oe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|255)>>>0:(t=fe.exec(e))?(dist_esm_y(t[1])<<24|dist_esm_y(t[2])<<16|dist_esm_y(t[3])<<8|me(t[4]))>>>0:(t=se.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=esm_ce.exec(e))?parseInt(t[1],16)>>>0:(t=ue.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=ae.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|255)>>>0:(t=ie.exec(e))?(de(esm_pe(t[1]),esm_z(t[2]),esm_z(t[3]))|me(t[4]))>>>0:null}function esm_j(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function de(e,t,r){let n=r<.5?r*(1+t):r+t-r*t,f=2*r-n,o=esm_j(f,n,e+1/3),i=esm_j(f,n,e),s=esm_j(f,n,e-1/3);return Math.round(o*255)<<24|Math.round(i*255)<<16|Math.round(s*255)<<8}function dist_esm_y(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function esm_pe(e){return(parseFloat(e)%360+360)%360/360}function me(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function esm_z(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function D(e){let t=be(e);if(t===null)return e;t=t||0;let r=(t&4278190080)>>>24,n=(t&16711680)>>>16,f=(t&65280)>>>8,o=(t&255)/255;return`rgba(${r}, ${n}, ${f}, ${o})`}var W=(e,t,r)=>{if(dist_esm_l.fun(e))return e;if(dist_esm_l.arr(e))return W({range:e,output:t,extrapolate:r});if(dist_esm_l.str(e.output[0]))return esm_k(e);let n=e,f=n.output,o=n.range||[0,1],i=n.extrapolateLeft||n.extrapolate||"extend",s=n.extrapolateRight||n.extrapolate||"extend",x=n.easing||(a=>a);return a=>{let F=He(a,o);return Ue(a,o[F],o[F+1],f[F],f[F+1],x,i,s,n.map)}};function Ue(e,t,r,n,f,o,i,s,x){let a=x?x(e):e;if(a<t){if(i==="identity")return a;i==="clamp"&&(a=t)}if(a>r){if(s==="identity")return a;s==="clamp"&&(a=r)}return n===f?n:t===r?e<=t?n:f:(t===-1/0?a=-a:r===1/0?a=a-t:a=(a-t)/(r-t),a=o(a),n===-1/0?a=-a:f===1/0?a=a+n:a=a*(f-n)+n,a)}function He(e,t){for(var r=1;r<t.length-1&&!(t[r]>=e);++r);return r-1}var Be=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);let n=r*e,f=t==="end"?Math.floor(n):Math.ceil(n);return ne(0,1,f/e)},P=1.70158,L=P*1.525,xe=P+1,he=2*Math.PI/3,ye=2*Math.PI/4.5,V=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Lt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:Math.pow(2,10*e-10),easeOutExpo:e=>e===1?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>xe*e*e*e-P*e*e,easeOutBack:e=>1+xe*Math.pow(e-1,3)+P*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*((L+1)*2*e-L)/2:(Math.pow(2*e-2,2)*((L+1)*(e*2-2)+L)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-Math.pow(2,10*e-10)*Math.sin((e*10-10.75)*he),easeOutElastic:e=>e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e*10-.75)*he)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*ye))/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*ye)/2+1,easeInBounce:e=>1-V(1-e),easeOutBounce:V,easeInOutBounce:e=>e<.5?(1-V(1-2*e))/2:(1+V(2*e-1))/2,steps:Be};var esm_g=Symbol.for("FluidValue.get"),dist_esm_m=Symbol.for("FluidValue.observers");var Pt=e=>Boolean(e&&e[esm_g]),ve=e=>e&&e[esm_g]?e[esm_g]():e,esm_qt=e=>e[dist_esm_m]||null;function je(e,t){e.eventObserved?e.eventObserved(t):e(t)}function $t(e,t){let r=e[dist_esm_m];r&&r.forEach(n=>{je(n,t)})}var esm_ge=class{[esm_g];[dist_esm_m];constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");De(this,t)}},De=(e,t)=>Ee(e,esm_g,t);function Gt(e,t){if(e[esm_g]){let r=e[dist_esm_m];r||Ee(e,dist_esm_m,r=new Set),r.has(t)||(r.add(t),e.observerAdded&&e.observerAdded(r.size,t))}return t}function Qt(e,t){let r=e[dist_esm_m];if(r&&r.has(t)){let n=r.size-1;n?r.delete(t):e[dist_esm_m]=null,e.observerRemoved&&e.observerRemoved(n,t)}}var Ee=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0});var O=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,esm_Oe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,K=new RegExp(`(${O.source})(%|[a-z]+)`,"i"),we=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,dist_esm_b=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;var esm_N=e=>{let[t,r]=We(e);if(!t||dist_esm_h())return e;let n=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(n)return n.trim();if(r&&r.startsWith("--")){let f=window.getComputedStyle(document.documentElement).getPropertyValue(r);return f||e}else{if(r&&dist_esm_b.test(r))return esm_N(r);if(r)return r}return e},We=e=>{let t=dist_esm_b.exec(e);if(!t)return[,];let[,r,n]=t;return[r,n]};var _,esm_Ke=(e,t,r,n,f)=>`rgba(${Math.round(t)}, ${Math.round(r)}, ${Math.round(n)}, ${f})`,Xt=e=>{_||(_=dist_esm_c?new RegExp(`(${Object.keys(dist_esm_c).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map(o=>ve(o).replace(dist_esm_b,esm_N).replace(esm_Oe,D).replace(_,D)),r=t.map(o=>o.match(O).map(Number)),f=r[0].map((o,i)=>r.map(s=>{if(!(i in s))throw Error('The arity of each "output" value must be equal');return s[i]})).map(o=>W({...e,output:o}));return o=>{let i=!K.test(t[0])&&t.find(x=>K.test(x))?.replace(O,""),s=0;return t[0].replace(O,()=>`${f[s++](o)}${i||""}`).replace(we,esm_Ke)}};var Z="react-spring: ",Te=e=>{let t=e,r=!1;if(typeof t!="function")throw new TypeError(`${Z}once requires a function parameter`);return(...n)=>{r||(t(...n),r=!0)}},Ne=Te(console.warn);function Jt(){Ne(`${Z}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var _e=Te(console.warn);function er(){_e(`${Z}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 esm_or(e){return dist_esm_l.str(e)&&(e[0]=="#"||/\d/.test(e)||!dist_esm_h()&&dist_esm_b.test(e)||e in(dist_esm_c||{}))}var dist_esm_v,q=new WeakMap,Ze=e=>e.forEach(({target:t,contentRect:r})=>q.get(t)?.forEach(n=>n(r)));function Fe(e,t){dist_esm_v||typeof ResizeObserver<"u"&&(dist_esm_v=new ResizeObserver(Ze));let r=q.get(t);return r||(r=new Set,q.set(t,r)),r.add(e),dist_esm_v&&dist_esm_v.observe(t),()=>{let n=q.get(t);!n||(n.delete(e),!n.size&&dist_esm_v&&dist_esm_v.unobserve(t))}}var esm_$=new Set,dist_esm_w,esm_Xe=()=>{let e=()=>{esm_$.forEach(t=>t({width:window.innerWidth,height:window.innerHeight}))};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},Ie=e=>(esm_$.add(e),dist_esm_w||(dist_esm_w=esm_Xe()),()=>{esm_$.delete(e),!esm_$.size&&dist_esm_w&&(dist_esm_w(),dist_esm_w=void 0)});var ke=(e,{container:t=document.documentElement}={})=>t===document.documentElement?Ie(e):Fe(e,t);var Se=(e,t,r)=>t-e===0?1:(r-e)/(t-e);var esm_Ye={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}},esm_G=class{callback;container;info;constructor(t,r){this.callback=t,this.container=r,this.info={time:0,x:this.createAxis(),y:this.createAxis()}}createAxis=()=>({current:0,progress:0,scrollLength:0});updateAxis=t=>{let r=this.info[t],{length:n,position:f}=esm_Ye[t];r.current=this.container[`scroll${f}`],r.scrollLength=this.container["scroll"+n]-this.container["client"+n],r.progress=Se(0,r.scrollLength,r.current)};update=()=>{this.updateAxis("x"),this.updateAxis("y")};sendEvent=()=>{this.callback(this.info)};advance=()=>{this.update(),this.sendEvent()}};var esm_T=new WeakMap,Ae=new WeakMap,X=new WeakMap,Me=e=>e===document.documentElement?window:e,yr=(e,{container:t=document.documentElement}={})=>{let r=X.get(t);r||(r=new Set,X.set(t,r));let n=new esm_G(e,t);if(r.add(n),!esm_T.has(t)){let o=()=>(r?.forEach(s=>s.advance()),!0);esm_T.set(t,o);let i=Me(t);window.addEventListener("resize",o,{passive:!0}),t!==document.documentElement&&Ae.set(t,ke(o,{container:t})),i.addEventListener("scroll",o,{passive:!0})}let f=esm_T.get(t);return Re(f),()=>{Re.cancel(f);let o=X.get(t);if(!o||(o.delete(n),o.size))return;let i=esm_T.get(t);esm_T.delete(t),i&&(Me(t).removeEventListener("scroll",i),window.removeEventListener("resize",i),Ae.get(t)?.())}};function Er(e){let t=Je(null);return t.current===null&&(t.current=e()),t.current}var esm_Q=dist_esm_h()?external_React_.useEffect:external_React_.useLayoutEffect;var Ce=()=>{let e=(0,external_React_.useRef)(!1);return esm_Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function Mr(){let e=(0,external_React_.useState)()[1],t=Ce();return()=>{t.current&&e(Math.random())}}function Lr(e,t){let[r]=(0,external_React_.useState)(()=>({inputs:t,result:e()})),n=(0,external_React_.useRef)(),f=n.current,o=f;return o?Boolean(t&&o.inputs&&it(t,o.inputs))||(o={inputs:t,result:e()}):o=r,(0,external_React_.useEffect)(()=>{n.current=o,f==r&&(r.inputs=r.result=void 0)},[o]),o.result}function it(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var $r=e=>(0,external_React_.useEffect)(e,ut),ut=[];function Ur(e){let t=ct();return lt(()=>{t.current=e}),t.current}var Wr=()=>{let[e,t]=dt(null);return esm_Q(()=>{let r=window.matchMedia("(prefers-reduced-motion)"),n=f=>{t(f.matches),U({skipAnimation:f.matches})};return n(r),r.addEventListener("change",n),()=>{r.removeEventListener("change",n)}},[]),e};
;// CONCATENATED MODULE: ./node_modules/@react-spring/animated/dist/esm/index.js
var animated_dist_esm_h=Symbol.for("Animated:node"),animated_dist_esm_v=e=>!!e&&e[animated_dist_esm_h]===e,dist_esm_k=e=>e&&e[animated_dist_esm_h],esm_D=(e,t)=>mt(e,animated_dist_esm_h,t),F=e=>e&&e[animated_dist_esm_h]&&e[animated_dist_esm_h].getPayload(),animated_dist_esm_c=class{payload;constructor(){esm_D(this,this)}getPayload(){return this.payload||[]}};var animated_dist_esm_l=class extends animated_dist_esm_c{constructor(r){super();this._value=r;dist_esm_l.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(r){return new animated_dist_esm_l(r)}getPayload(){return[this]}getValue(){return this._value}setValue(r,n){return dist_esm_l.num(r)&&(this.lastPosition=r,n&&(r=Math.round(r/n)*n,this.done&&(this.lastPosition=r))),this._value===r?!1:(this._value=r,!0)}reset(){let{done:r}=this;this.done=!1,dist_esm_l.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,r&&(this.lastVelocity=null),this.v0=null)}};var animated_dist_esm_d=class extends animated_dist_esm_l{_string=null;_toString;constructor(t){super(0),this._toString=W({output:[t,t]})}static create(t){return new animated_dist_esm_d(t)}getValue(){let t=this._string;return t??(this._string=this._toString(this._value))}setValue(t){if(dist_esm_l.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=W({output:[this.getValue(),t]})),this._value=0,super.reset()}};var dist_esm_f={dependencies:null};var animated_dist_esm_u=class extends animated_dist_esm_c{constructor(r){super();this.source=r;this.setValue(r)}getValue(r){let n={};return xt(this.source,(a,i)=>{animated_dist_esm_v(a)?n[i]=a.getValue(r):Pt(a)?n[i]=ve(a):r||(n[i]=a)}),n}setValue(r){this.source=r,this.payload=this._makePayload(r)}reset(){this.payload&&esm_Ve(this.payload,r=>r.reset())}_makePayload(r){if(r){let n=new Set;return xt(r,this._addToPayload,n),Array.from(n)}}_addToPayload(r){dist_esm_f.dependencies&&Pt(r)&&dist_esm_f.dependencies.add(r);let n=F(r);n&&esm_Ve(n,a=>this.add(a))}};var animated_dist_esm_y=class extends animated_dist_esm_u{constructor(t){super(t)}static create(t){return new animated_dist_esm_y(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){let r=this.getPayload();return t.length==r.length?r.map((n,a)=>n.setValue(t[a])).some(Boolean):(super.setValue(t.map(dist_esm_z)),!0)}};function dist_esm_z(e){return(esm_or(e)?animated_dist_esm_d:animated_dist_esm_l).create(e)}function esm_Le(e){let t=dist_esm_k(e);return t?t.constructor:dist_esm_l.arr(e)?animated_dist_esm_y:esm_or(e)?animated_dist_esm_d:animated_dist_esm_l}var dist_esm_x=(e,t)=>{let r=!dist_esm_l.fun(e)||e.prototype&&e.prototype.isReactComponent;return (0,external_React_.forwardRef)((n,a)=>{let i=(0,external_React_.useRef)(null),o=r&&(0,external_React_.useCallback)(s=>{i.current=esm_ae(a,s)},[a]),[m,T]=esm_ne(n,t),W=Mr(),P=()=>{let s=i.current;if(r&&!s)return;(s?t.applyAnimatedValues(s,m.getValue(!0)):!1)===!1&&W()},_=new animated_dist_esm_b(P,T),p=(0,external_React_.useRef)();esm_Q(()=>(p.current=_,esm_Ve(T,s=>Gt(s,_)),()=>{p.current&&(esm_Ve(p.current.deps,s=>Qt(s,p.current)),esm_n.cancel(p.current.update))})),(0,external_React_.useEffect)(P,[]),$r(()=>()=>{let s=p.current;esm_Ve(s.deps,S=>Qt(S,s))});let $=t.getComponentProps(m.getValue());return external_React_.createElement(e,{...$,ref:o})})},animated_dist_esm_b=class{constructor(t,r){this.update=t;this.deps=r}eventObserved(t){t.type=="change"&&esm_n.write(this.update)}};function esm_ne(e,t){let r=new Set;return dist_esm_f.dependencies=r,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new animated_dist_esm_u(e),dist_esm_f.dependencies=null,[e,r]}function esm_ae(e,t){return e&&(dist_esm_l.fun(e)?e(t):e.current=t),t}var dist_esm_j=Symbol.for("AnimatedComponent"),dist_esm_Ke=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:r=a=>new animated_dist_esm_u(a),getComponentProps:n=a=>a}={})=>{let a={applyAnimatedValues:t,createAnimatedStyle:r,getComponentProps:n},i=o=>{let m=esm_I(o)||"Anonymous";return dist_esm_l.str(o)?o=i[o]||(i[o]=dist_esm_x(o,a)):o=o[dist_esm_j]||(o[dist_esm_j]=dist_esm_x(o,a)),o.displayName=`Animated(${m})`,o};return xt(e,(o,m)=>{dist_esm_l.arr(e)&&(m=esm_I(o)),i[m]=i(o)}),{animated:i}},esm_I=e=>dist_esm_l.str(e)?e:e&&dist_esm_l.str(e.displayName)?e.displayName:dist_esm_l.fun(e)&&e.name||null;
;// CONCATENATED MODULE: ./node_modules/@react-spring/core/dist/esm/index.js
function dist_esm_I(t,...e){return dist_esm_l.fun(t)?t(...e):t}var esm_te=(t,e)=>t===!0||!!(e&&t&&(dist_esm_l.fun(t)?t(e):ht(t).includes(e))),et=(t,e)=>dist_esm_l.obj(t)?e&&t[e]:t;var esm_ke=(t,e)=>t.default===!0?t[e]:t.default?t.default[e]:void 0,nn=t=>t,dist_esm_ne=(t,e=nn)=>{let n=rn;t.default&&t.default!==!0&&(t=t.default,n=Object.keys(t));let r={};for(let o of n){let s=e(t[o],o);dist_esm_l.und(s)||(r[o]=s)}return r},rn=["config","onProps","onStart","onChange","onPause","onResume","onRest"],on={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 sn(t){let e={},n=0;if(xt(t,(r,o)=>{on[o]||(e[o]=r,n++)}),n)return e}function esm_de(t){let e=sn(t);if(e){let n={to:e};return xt(t,(r,o)=>o in e||(n[o]=r)),n}return{...t}}function esm_me(t){return t=ve(t),dist_esm_l.arr(t)?t.map(esm_me):esm_or(t)?dist_esm_p.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function esm_Ue(t){for(let e in t)return!0;return!1}function esm_Ee(t){return dist_esm_l.fun(t)||dist_esm_l.arr(t)&&dist_esm_l.obj(t[0])}function esm_xe(t,e){t.ref?.delete(t),e?.delete(t)}function esm_he(t,e){e&&t.ref!==e&&(t.ref?.delete(t),e.add(t),t.ref=e)}function wr(t,e,n=1e3){an(()=>{if(e){let r=0;ge(t,(o,s)=>{let a=o.current;if(a.length){let i=n*e[s];isNaN(i)?i=r:r=i,ge(a,u=>{ge(u.queue,p=>{let f=p.delay;p.delay=d=>i+dist_esm_I(f||0,d)})}),o.start()}})}else{let r=Promise.resolve();ge(t,o=>{let s=o.current;if(s.length){let a=s.map(i=>{let u=i.queue;return i.queue=[],u});r=r.then(()=>(ge(s,(i,u)=>ge(a[u]||[],p=>i.queue.push(p))),Promise.all(o.start())))}})}})}var esm_mt={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}};var tt={...esm_mt.default,mass:1,damping:1,easing:Lt.linear,clamp:!1},esm_we=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,tt)}};function gt(t,e,n){n&&(n={...n},esm_ht(n,e),e={...n,...e}),esm_ht(t,e),Object.assign(t,e);for(let a in tt)t[a]==null&&(t[a]=tt[a]);let{mass:r,frequency:o,damping:s}=t;return dist_esm_l.und(o)||(o<.01&&(o=.01),s<0&&(s=0),t.tension=Math.pow(2*Math.PI/o,2)*r,t.friction=4*Math.PI*s*r/o),t}function esm_ht(t,e){if(!dist_esm_l.und(e.decay))t.duration=void 0;else{let n=!dist_esm_l.und(e.tension)||!dist_esm_l.und(e.friction);(n||!dist_esm_l.und(e.frequency)||!dist_esm_l.und(e.damping)||!dist_esm_l.und(e.mass))&&(t.duration=void 0,t.decay=void 0),n&&(t.frequency=void 0)}}var esm_yt=[],dist_esm_Le=class{changed=!1;values=esm_yt;toValues=null;fromValues=esm_yt;to;from;config=new esm_we;immediate=!1};function esm_Me(t,{key:e,props:n,defaultProps:r,state:o,actions:s}){return new Promise((a,i)=>{let u,p,f=esm_te(n.cancel??r?.cancel,e);if(f)b();else{dist_esm_l.und(n.pause)||(o.paused=esm_te(n.pause,e));let c=r?.pause;c!==!0&&(c=o.paused||esm_te(c,e)),u=dist_esm_I(n.delay||0,e),c?(o.resumeQueue.add(m),s.pause()):(s.resume(),m())}function d(){o.resumeQueue.add(m),o.timeouts.delete(p),p.cancel(),u=p.time-esm_n.now()}function m(){u>0&&!dist_esm_p.skipAnimation?(o.delayed=!0,p=esm_n.setTimeout(b,u),o.pauseQueue.add(d),o.timeouts.add(p)):b()}function b(){o.delayed&&(o.delayed=!1),o.pauseQueue.delete(d),o.timeouts.delete(p),t<=(o.cancelId||0)&&(f=!0);try{s.start({...n,callId:t,cancel:f},a)}catch(c){i(c)}}})}var esm_be=(t,e)=>e.length==1?e[0]:e.some(n=>n.cancelled)?esm_q(t.get()):e.every(n=>n.noop)?nt(t.get()):dist_esm_E(t.get(),e.every(n=>n.finished)),nt=t=>({value:t,noop:!0,finished:!0,cancelled:!1}),dist_esm_E=(t,e,n=!1)=>({value:t,finished:e,cancelled:n}),esm_q=t=>({value:t,cancelled:!0,finished:!1});function esm_De(t,e,n,r){let{callId:o,parentId:s,onRest:a}=e,{asyncTo:i,promise:u}=n;return!s&&t===i&&!e.reset?u:n.promise=(async()=>{n.asyncId=o,n.asyncTo=t;let p=dist_esm_ne(e,(l,h)=>h==="onRest"?void 0:l),f,d,m=new Promise((l,h)=>(f=l,d=h)),b=l=>{let h=o<=(n.cancelId||0)&&esm_q(r)||o!==n.asyncId&&dist_esm_E(r,!1);if(h)throw l.result=h,d(l),l},c=(l,h)=>{let g=new esm_Ae,x=new esm_Ne;return(async()=>{if(dist_esm_p.skipAnimation)throw esm_oe(n),x.result=dist_esm_E(r,!1),d(x),x;b(g);let S=dist_esm_l.obj(l)?{...l}:{...h,to:l};S.parentId=o,xt(p,(V,_)=>{dist_esm_l.und(S[_])&&(S[_]=V)});let A=await r.start(S);return b(g),n.paused&&await new Promise(V=>{n.resumeQueue.add(V)}),A})()},P;if(dist_esm_p.skipAnimation)return esm_oe(n),dist_esm_E(r,!1);try{let l;dist_esm_l.arr(t)?l=(async h=>{for(let g of h)await c(g)})(t):l=Promise.resolve(t(c,r.stop.bind(r))),await Promise.all([l.then(f),m]),P=dist_esm_E(r.get(),!0,!1)}catch(l){if(l instanceof esm_Ae)P=l.result;else if(l instanceof esm_Ne)P=l.result;else throw l}finally{o==n.asyncId&&(n.asyncId=s,n.asyncTo=s?i:void 0,n.promise=s?u:void 0)}return dist_esm_l.fun(a)&&esm_n.batchedUpdates(()=>{a(P,r,r.item)}),P})()}function esm_oe(t,e){Pe(t.timeouts,n=>n.cancel()),t.pauseQueue.clear(),t.resumeQueue.clear(),t.asyncId=t.asyncTo=t.promise=void 0,e&&(t.cancelId=e)}var esm_Ae=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},esm_Ne=class extends Error{result;constructor(){super("SkipAnimationSignal")}};var esm_Re=t=>t instanceof esm_X,Sn=1,esm_X=class extends esm_ge{id=Sn++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=dist_esm_k(this);return e&&e.getValue()}to(...e){return dist_esm_p.to(this,e)}interpolate(...e){return Jt(),dist_esm_p.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,n=!1){$t(this,{type:"change",parent:this,value:e,idle:n})}_onPriorityChange(e){this.idle||qe.sort(this),$t(this,{type:"priority",parent:this,priority:e})}};var esm_se=Symbol.for("SpringPhase"),esm_bt=1,rt=2,ot=4,esm_qe=t=>(t[esm_se]&esm_bt)>0,dist_esm_Q=t=>(t[esm_se]&rt)>0,esm_ye=t=>(t[esm_se]&ot)>0,st=(t,e)=>e?t[esm_se]|=rt|esm_bt:t[esm_se]&=~rt,esm_it=(t,e)=>e?t[esm_se]|=ot:t[esm_se]&=~ot;var esm_ue=class extends esm_X{key;animation=new dist_esm_Le;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,n){if(super(),!dist_esm_l.und(e)||!dist_esm_l.und(n)){let r=dist_esm_l.obj(e)?{...e}:{...n,from:e};dist_esm_l.und(r.default)&&(r.default=!0),this.start(r)}}get idle(){return!(dist_esm_Q(this)||this._state.asyncTo)||esm_ye(this)}get goal(){return ve(this.animation.to)}get velocity(){let e=dist_esm_k(this);return e instanceof animated_dist_esm_l?e.lastVelocity||0:e.getPayload().map(n=>n.lastVelocity||0)}get hasAnimated(){return esm_qe(this)}get isAnimating(){return dist_esm_Q(this)}get isPaused(){return esm_ye(this)}get isDelayed(){return this._state.delayed}advance(e){let n=!0,r=!1,o=this.animation,{config:s,toValues:a}=o,i=F(o.to);!i&&Pt(o.to)&&(a=ht(ve(o.to))),o.values.forEach((f,d)=>{if(f.done)return;let m=f.constructor==animated_dist_esm_d?1:i?i[d].lastPosition:a[d],b=o.immediate,c=m;if(!b){if(c=f.lastPosition,s.tension<=0){f.done=!0;return}let P=f.elapsedTime+=e,l=o.fromValues[d],h=f.v0!=null?f.v0:f.v0=dist_esm_l.arr(s.velocity)?s.velocity[d]:s.velocity,g,x=s.precision||(l==m?.005:Math.min(1,Math.abs(m-l)*.001));if(dist_esm_l.und(s.duration))if(s.decay){let S=s.decay===!0?.998:s.decay,A=Math.exp(-(1-S)*P);c=l+h/(1-S)*(1-A),b=Math.abs(f.lastPosition-c)<=x,g=h*A}else{g=f.lastVelocity==null?h:f.lastVelocity;let S=s.restVelocity||x/10,A=s.clamp?0:s.bounce,V=!dist_esm_l.und(A),_=l==m?f.v0>0:l<m,v,w=!1,C=1,$=Math.ceil(e/C);for(let L=0;L<$&&(v=Math.abs(g)>S,!(!v&&(b=Math.abs(m-c)<=x,b)));++L){V&&(w=c==m||c>m==_,w&&(g=-g*A,c=m));let N=-s.tension*1e-6*(c-m),y=-s.friction*.001*g,T=(N+y)/s.mass;g=g+T*C,c=c+g*C}}else{let S=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,f.durationProgress>0&&(f.elapsedTime=s.duration*f.durationProgress,P=f.elapsedTime+=e)),S=(s.progress||0)+P/this._memoizedDuration,S=S>1?1:S<0?0:S,f.durationProgress=S),c=l+s.easing(S)*(m-l),g=(c-f.lastPosition)/e,b=S==1}f.lastVelocity=g,Number.isNaN(c)&&(console.warn("Got NaN while animating:",this),b=!0)}i&&!i[d].done&&(b=!1),b?f.done=!0:n=!1,f.setValue(c,s.round)&&(r=!0)});let u=dist_esm_k(this),p=u.getValue();if(n){let f=ve(o.to);(p!==f||r)&&!s.decay?(u.setValue(f),this._onChange(f)):r&&s.decay&&this._onChange(p),this._stop()}else r&&this._onChange(p)}set(e){return esm_n.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(dist_esm_Q(this)){let{to:e,config:n}=this.animation;esm_n.batchedUpdates(()=>{this._onStart(),n.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,n){let r;return dist_esm_l.und(e)?(r=this.queue||[],this.queue=[]):r=[dist_esm_l.obj(e)?e:{...n,to:e}],Promise.all(r.map(o=>this._update(o))).then(o=>esm_be(this,o))}stop(e){let{to:n}=this.animation;return this._focus(this.get()),esm_oe(this._state,e&&this._lastCallId),esm_n.batchedUpdates(()=>this._stop(n,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){let n=this.key||"",{to:r,from:o}=e;r=dist_esm_l.obj(r)?r[n]:r,(r==null||esm_Ee(r))&&(r=void 0),o=dist_esm_l.obj(o)?o[n]:o,o==null&&(o=void 0);let s={to:r,from:o};return esm_qe(this)||(e.reverse&&([r,o]=[o,r]),o=ve(o),dist_esm_l.und(o)?dist_esm_k(this)||this._set(r):this._set(o)),s}_update({...e},n){let{key:r,defaultProps:o}=this;e.default&&Object.assign(o,dist_esm_ne(e,(i,u)=>/^on/.test(u)?et(i,r):i)),_t(this,e,"onProps"),esm_Ie(this,"onProps",e,this);let s=this._prepareNode(e);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?");let a=this._state;return esm_Me(++this._lastCallId,{key:r,props:e,defaultProps:o,state:a,actions:{pause:()=>{esm_ye(this)||(esm_it(this,!0),yt(a.pauseQueue),esm_Ie(this,"onPause",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},resume:()=>{esm_ye(this)&&(esm_it(this,!1),dist_esm_Q(this)&&this._resume(),yt(a.resumeQueue),esm_Ie(this,"onResume",dist_esm_E(this,esm_Ce(this,this.animation.to)),this))},start:this._merge.bind(this,s)}}).then(i=>{if(e.loop&&i.finished&&!(n&&i.noop)){let u=at(e);if(u)return this._update(u,!0)}return i})}_merge(e,n,r){if(n.cancel)return this.stop(!0),r(esm_q(this));let o=!dist_esm_l.und(e.to),s=!dist_esm_l.und(e.from);if(o||s)if(n.callId>this._lastToId)this._lastToId=n.callId;else return r(esm_q(this));let{key:a,defaultProps:i,animation:u}=this,{to:p,from:f}=u,{to:d=p,from:m=f}=e;s&&!o&&(!n.default||dist_esm_l.und(d))&&(d=m),n.reverse&&([d,m]=[m,d]);let b=!bt(m,f);b&&(u.from=m),m=ve(m);let c=!bt(d,p);c&&this._focus(d);let P=esm_Ee(n.to),{config:l}=u,{decay:h,velocity:g}=l;(o||s)&&(l.velocity=0),n.config&&!P&>(l,dist_esm_I(n.config,a),n.config!==i.config?dist_esm_I(i.config,a):void 0);let x=dist_esm_k(this);if(!x||dist_esm_l.und(d))return r(dist_esm_E(this,!0));let S=dist_esm_l.und(n.reset)?s&&!n.default:!dist_esm_l.und(m)&&esm_te(n.reset,a),A=S?m:this.get(),V=esm_me(d),_=dist_esm_l.num(V)||dist_esm_l.arr(V)||esm_or(V),v=!P&&(!_||esm_te(i.immediate||n.immediate,a));if(c){let L=esm_Le(d);if(L!==x.constructor)if(v)x=this._set(V);else throw Error(`Cannot animate between ${x.constructor.name} and ${L.name}, as the "to" prop suggests`)}let w=x.constructor,C=Pt(d),$=!1;if(!C){let L=S||!esm_qe(this)&&b;(c||L)&&($=bt(esm_me(A),V),C=!$),(!bt(u.immediate,v)&&!v||!bt(l.decay,h)||!bt(l.velocity,g))&&(C=!0)}if($&&dist_esm_Q(this)&&(u.changed&&!S?C=!0:C||this._stop(p)),!P&&((C||Pt(p))&&(u.values=x.getPayload(),u.toValues=Pt(d)?null:w==animated_dist_esm_d?[1]:ht(V)),u.immediate!=v&&(u.immediate=v,!v&&!S&&this._set(p)),C)){let{onRest:L}=u;esm_Ve(_n,y=>_t(this,n,y));let N=dist_esm_E(this,esm_Ce(this,p));yt(this._pendingCalls,N),this._pendingCalls.add(r),u.changed&&esm_n.batchedUpdates(()=>{u.changed=!S,L?.(N,this),S?dist_esm_I(i.onRest,N):u.onStart?.(N,this)})}S&&this._set(A),P?r(esm_De(n.to,n,this._state,this)):C?this._start():dist_esm_Q(this)&&!c?this._pendingCalls.add(r):r(nt(A))}_focus(e){let n=this.animation;e!==n.to&&(esm_qt(this)&&this._detach(),n.to=e,esm_qt(this)&&this._attach())}_attach(){let e=0,{to:n}=this.animation;Pt(n)&&(Gt(n,this),esm_Re(n)&&(e=n.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;Pt(e)&&Qt(e,this)}_set(e,n=!0){let r=ve(e);if(!dist_esm_l.und(r)){let o=dist_esm_k(this);if(!o||!bt(r,o.getValue())){let s=esm_Le(r);!o||o.constructor!=s?esm_D(this,s.create(r)):o.setValue(r),o&&esm_n.batchedUpdates(()=>{this._onChange(r,n)})}}return dist_esm_k(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,esm_Ie(this,"onStart",dist_esm_E(this,esm_Ce(this,e.to)),this))}_onChange(e,n){n||(this._onStart(),dist_esm_I(this.animation.onChange,e,this)),dist_esm_I(this.defaultProps.onChange,e,this),super._onChange(e,n)}_start(){let e=this.animation;dist_esm_k(this).reset(ve(e.to)),e.immediate||(e.fromValues=e.values.map(n=>n.lastPosition)),dist_esm_Q(this)||(st(this,!0),esm_ye(this)||this._resume())}_resume(){dist_esm_p.skipAnimation?this.finish():qe.start(this)}_stop(e,n){if(dist_esm_Q(this)){st(this,!1);let r=this.animation;esm_Ve(r.values,s=>{s.done=!0}),r.toValues&&(r.onChange=r.onPause=r.onResume=void 0),$t(this,{type:"idle",parent:this});let o=n?esm_q(this.get()):dist_esm_E(this.get(),esm_Ce(this,e??r.to));yt(this._pendingCalls,o),r.changed&&(r.changed=!1,esm_Ie(this,"onRest",o,this))}}};function esm_Ce(t,e){let n=esm_me(e),r=esm_me(t.get());return bt(r,n)}function at(t,e=t.loop,n=t.to){let r=dist_esm_I(e);if(r){let o=r!==!0&&esm_de(r),s=(o||t).reverse,a=!o||o.reset;return esm_Pe({...t,loop:e,default:!1,pause:void 0,to:!s||esm_Ee(n)?n:void 0,from:a?t.from:void 0,reset:a,...o})}}function esm_Pe(t){let{to:e,from:n}=t=esm_de(t),r=new Set;return dist_esm_l.obj(e)&&Vt(e,r),dist_esm_l.obj(n)&&Vt(n,r),t.keys=r.size?Array.from(r):null,t}function Ot(t){let e=esm_Pe(t);return R.und(e.default)&&(e.default=dist_esm_ne(e)),e}function Vt(t,e){xt(t,(n,r)=>n!=null&&e.add(r))}var _n=["onStart","onRest","onChange","onPause","onResume"];function _t(t,e,n){t.animation[n]=e[n]!==esm_ke(e,n)?et(e[n],t.key):void 0}function esm_Ie(t,e,...n){t.animation[e]?.(...n),t.defaultProps[e]?.(...n)}var Fn=["onStart","onChange","onRest"],kn=1,esm_le=class{id=kn++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,n){this._onFrame=this._onFrame.bind(this),n&&(this._flush=n),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each((n,r)=>e[r]=n.get()),e}set(e){for(let n in e){let r=e[n];dist_esm_l.und(r)||this.springs[n].set(r)}}update(e){return e&&this.queue.push(esm_Pe(e)),this}start(e){let{queue:n}=this;return e?n=ht(e).map(esm_Pe):this.queue=[],this._flush?this._flush(this,n):(jt(this,n),esm_ze(this,n))}stop(e,n){if(e!==!!e&&(n=e),n){let r=this.springs;esm_Ve(ht(n),o=>r[o].stop(!!e))}else esm_oe(this._state,this._lastAsyncId),this.each(r=>r.stop(!!e));return this}pause(e){if(dist_esm_l.und(e))this.start({pause:!0});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].pause())}return this}resume(e){if(dist_esm_l.und(e))this.start({pause:!1});else{let n=this.springs;esm_Ve(ht(e),r=>n[r].resume())}return this}each(e){xt(this.springs,e)}_onFrame(){let{onStart:e,onChange:n,onRest:r}=this._events,o=this._active.size>0,s=this._changed.size>0;(o&&!this._started||s&&!this._started)&&(this._started=!0,Pe(e,([u,p])=>{p.value=this.get(),u(p,this,this._item)}));let a=!o&&this._started,i=s||a&&r.size?this.get():null;s&&n.size&&Pe(n,([u,p])=>{p.value=i,u(p,this,this._item)}),a&&(this._started=!1,Pe(r,([u,p])=>{p.value=i,u(p,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;esm_n.onFrame(this._onFrame)}};function esm_ze(t,e){return Promise.all(e.map(n=>wt(t,n))).then(n=>esm_be(t,n))}async function wt(t,e,n){let{keys:r,to:o,from:s,loop:a,onRest:i,onResolve:u}=e,p=dist_esm_l.obj(e.default)&&e.default;a&&(e.loop=!1),o===!1&&(e.to=null),s===!1&&(e.from=null);let f=dist_esm_l.arr(o)||dist_esm_l.fun(o)?o:void 0;f?(e.to=void 0,e.onRest=void 0,p&&(p.onRest=void 0)):esm_Ve(Fn,P=>{let l=e[P];if(dist_esm_l.fun(l)){let h=t._events[P];e[P]=({finished:g,cancelled:x})=>{let S=h.get(l);S?(g||(S.finished=!1),x&&(S.cancelled=!0)):h.set(l,{value:null,finished:g||!1,cancelled:x||!1})},p&&(p[P]=e[P])}});let d=t._state;e.pause===!d.paused?(d.paused=e.pause,yt(e.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(e.pause=!0);let m=(r||Object.keys(t.springs)).map(P=>t.springs[P].start(e)),b=e.cancel===!0||esm_ke(e,"cancel")===!0;(f||b&&d.asyncId)&&m.push(esm_Me(++t._lastAsyncId,{props:e,state:d,actions:{pause:Y,resume:Y,start(P,l){b?(esm_oe(d,t._lastAsyncId),l(esm_q(t))):(P.onRest=i,l(esm_De(f,P,d,t)))}}})),d.paused&&await new Promise(P=>{d.resumeQueue.add(P)});let c=esm_be(t,await Promise.all(m));if(a&&c.finished&&!(n&&c.noop)){let P=at(e,a,o);if(P)return jt(t,[P]),wt(t,P,!0)}return u&&esm_n.batchedUpdates(()=>u(c,t,t.item)),c}function esm_e(t,e){let n={...t.springs};return e&&pe(Ve(e),r=>{z.und(r.keys)&&(r=esm_Pe(r)),z.obj(r.to)||(r={...r,to:void 0}),Mt(n,r,o=>esm_Lt(o))}),pt(t,n),n}function pt(t,e){Ut(e,(n,r)=>{t.springs[r]||(t.springs[r]=n,Et(n,t))})}function esm_Lt(t,e){let n=new esm_ue;return n.key=t,e&&Gt(n,e),n}function Mt(t,e,n){e.keys&&esm_Ve(e.keys,r=>{(t[r]||(t[r]=n(r)))._prepareNode(e)})}function jt(t,e){esm_Ve(e,n=>{Mt(t.springs,n,r=>esm_Lt(r,t))})}var dist_esm_H=({children:t,...e})=>{let n=(0,external_React_.useContext)(esm_Ge),r=e.pause||!!n.pause,o=e.immediate||!!n.immediate;e=Lr(()=>({pause:r,immediate:o}),[r,o]);let{Provider:s}=esm_Ge;return external_React_.createElement(s,{value:e},t)},esm_Ge=wn(dist_esm_H,{});dist_esm_H.Provider=esm_Ge.Provider;dist_esm_H.Consumer=esm_Ge.Consumer;function wn(t,e){return Object.assign(t,external_React_.createContext(e)),t.Provider._context=t,t.Consumer._context=t,t}var esm_fe=()=>{let t=[],e=function(r){Ln();let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=n(r,s,a);i&&o.push(s.start(i))}}),o};e.current=t,e.add=function(r){t.includes(r)||t.push(r)},e.delete=function(r){let o=t.indexOf(r);~o&&t.splice(o,1)},e.pause=function(){return ce(t,r=>r.pause(...arguments)),this},e.resume=function(){return ce(t,r=>r.resume(...arguments)),this},e.set=function(r){ce(t,(o,s)=>{let a=Ke.fun(r)?r(s,o):r;a&&o.set(a)})},e.start=function(r){let o=[];return ce(t,(s,a)=>{if(Ke.und(r))o.push(s.start());else{let i=this._getProps(r,s,a);i&&o.push(s.start(i))}}),o},e.stop=function(){return ce(t,r=>r.stop(...arguments)),this},e.update=function(r){return ce(t,(o,s)=>o.update(this._getProps(r,o,s))),this};let n=function(r,o,s){return Ke.fun(r)?r(s,o):r};return e._getProps=n,e};function esm_He(t,e,n){let r=jn.fun(e)&&e;r&&!n&&(n=[]);let o=Xe(()=>r||arguments.length==3?esm_fe():void 0,[]),s=Nt(0),a=Dn(),i=Xe(()=>({ctrls:[],queue:[],flush(h,g){let x=esm_e(h,g);return s.current>0&&!i.queue.length&&!Object.keys(x).some(A=>!h.springs[A])?esm_ze(h,g):new Promise(A=>{pt(h,x),i.queue.push(()=>{A(esm_ze(h,g))}),a()})}}),[]),u=Nt([...i.ctrls]),p=[],f=Dt(t)||0;Xe(()=>{Ye(u.current.slice(t,f),h=>{esm_xe(h,o),h.stop(!0)}),u.current.length=t,d(f,t)},[t]),Xe(()=>{d(0,Math.min(f,t))},n);function d(h,g){for(let x=h;x<g;x++){let S=u.current[x]||(u.current[x]=new esm_le(null,i.flush)),A=r?r(x,S):e[x];A&&(p[x]=Ot(A))}}let m=u.current.map((h,g)=>esm_e(h,p[g])),b=Mn(dist_esm_H),c=Dt(b),P=b!==c&&esm_Ue(b);qn(()=>{s.current++,i.ctrls=u.current;let{queue:h}=i;h.length&&(i.queue=[],Ye(h,g=>g())),Ye(u.current,(g,x)=>{o?.add(g),P&&g.start({default:b});let S=p[x];S&&(esm_he(g,S.ref),g.ref?g.queue.push(S):g.start(S))})}),Nn(()=>()=>{Ye(i.ctrls,h=>h.stop(!0))});let l=m.map(h=>({...h}));return o?[l,o]:l}function esm_J(t,e){let n=Qn.fun(t),[[r],o]=esm_He(1,n?t:[t],n?e||[]:e);return n||arguments.length==2?[r,o]:r}var Gn=()=>esm_fe(),Xo=()=>zn(Gn)[0];var Wo=(t,e)=>{let n=Bn(()=>new esm_ue(t,e));return Kn(()=>()=>{n.stop()}),n};function esm_Qt(t,e,n){let r=qt.fun(e)&&e;r&&!n&&(n=[]);let o=!0,s,a=esm_He(t,(i,u)=>{let p=r?r(i,u):e;return s=p.ref,o=o&&p.reverse,p},n||[{}]);if(Yn(()=>{Xn(a[1].current,(i,u)=>{let p=a[1].current[u+(o?1:-1)];if(esm_he(i,s),i.ref){p&&i.update({to:p.springs});return}p?i.start({to:p.springs}):i.start()})},n),r||arguments.length==3){let i=s??a[1];return i._getProps=(u,p,f)=>{let d=qt.fun(u)?u(f,p):u;if(d){let m=i.current[f+(d.reverse?1:-1)];return m&&(d.to=m.springs),d}},a}return a[0]}function esm_Gt(t,e,n){let r=G.fun(e)&&e,{reset:o,sort:s,trail:a=0,expires:i=!0,exitBeforeEnter:u=!1,onDestroyed:p,ref:f,config:d}=r?r():e,m=Jn(()=>r||arguments.length==3?esm_fe():void 0,[]),b=zt(t),c=[],P=lt(null),l=o?null:P.current;Je(()=>{P.current=c}),$n(()=>(j(c,y=>{m?.add(y.ctrl),y.ctrl.ref=m}),()=>{j(P.current,y=>{y.expired&&clearTimeout(y.expirationId),esm_xe(y.ctrl,m),y.ctrl.stop(!0)})}));let h=tr(b,r?r():e,l),g=o&&P.current||[];Je(()=>j(g,({ctrl:y,item:T,key:F})=>{esm_xe(y,m),dist_esm_I(p,T,F)}));let x=[];if(l&&j(l,(y,T)=>{y.expired?(clearTimeout(y.expirationId),g.push(y)):(T=x[T]=h.indexOf(y.key),~T&&(c[T]=y))}),j(b,(y,T)=>{c[T]||(c[T]={key:h[T],item:y,phase:"mount",ctrl:new esm_le},c[T].ctrl.item=y)}),x.length){let y=-1,{leave:T}=r?r():e;j(x,(F,k)=>{let O=l[k];~F?(y=c.indexOf(O),c[y]={...O,item:b[F]}):T&&c.splice(++y,0,O)})}G.fun(s)&&c.sort((y,T)=>s(y.item,T.item));let S=-a,A=Wn(),V=dist_esm_ne(e),_=new Map,v=lt(new Map),w=lt(!1);j(c,(y,T)=>{let F=y.key,k=y.phase,O=r?r():e,U,D,Jt=dist_esm_I(O.delay||0,F);if(k=="mount")U=O.enter,D="enter";else{let M=h.indexOf(F)<0;if(k!="leave")if(M)U=O.leave,D="leave";else if(U=O.update)D="update";else return;else if(!M)U=O.enter,D="enter";else return}if(U=dist_esm_I(U,y.item,T),U=G.obj(U)?esm_de(U):{to:U},!U.config){let M=d||V.config;U.config=dist_esm_I(M,y.item,T,D)}S+=a;let Z={...V,delay:Jt+S,ref:f,immediate:O.immediate,reset:!1,...U};if(D=="enter"&&G.und(Z.from)){let M=r?r():e,Te=G.und(M.initial)||l?M.from:M.initial;Z.from=dist_esm_I(Te,y.item,T)}let{onResolve:Wt}=Z;Z.onResolve=M=>{dist_esm_I(Wt,M);let Te=P.current,B=Te.find(Fe=>Fe.key===F);if(!!B&&!(M.cancelled&&B.phase!="update")&&B.ctrl.idle){let Fe=Te.every(ee=>ee.ctrl.idle);if(B.phase=="leave"){let ee=dist_esm_I(i,B.item);if(ee!==!1){let Ze=ee===!0?0:ee;if(B.expired=!0,!Fe&&Ze>0){Ze<=2147483647&&(B.expirationId=setTimeout(A,Ze));return}}}Fe&&Te.some(ee=>ee.expired)&&(v.current.delete(B),u&&(w.current=!0),A())}};let ft=esm_e(y.ctrl,Z);D==="leave"&&u?v.current.set(y,{phase:D,springs:ft,payload:Z}):_.set(y,{phase:D,springs:ft,payload:Z})});let C=Hn(dist_esm_H),$=Zn(C),L=C!==$&&esm_Ue(C);Je(()=>{L&&j(c,y=>{y.ctrl.start({default:C})})},[C]),j(_,(y,T)=>{if(v.current.size){let F=c.findIndex(k=>k.key===T.key);c.splice(F,1)}}),Je(()=>{j(v.current.size?v.current:_,({phase:y,payload:T},F)=>{let{ctrl:k}=F;F.phase=y,m?.add(k),L&&y=="enter"&&k.start({default:C}),T&&(esm_he(k,T.ref),(k.ref||m)&&!w.current?k.update(T):(k.start(T),w.current&&(w.current=!1)))})},o?void 0:n);let N=y=>Oe.createElement(Oe.Fragment,null,c.map((T,F)=>{let{springs:k}=_.get(T)||T.ctrl,O=y({...k},T.item,T,F);return O&&O.type?Oe.createElement(O.type,{...O.props,key:G.str(T.key)||G.num(T.key)?T.key:T.ctrl.id,ref:O.ref}):O}));return m?[N,m]:N}var esm_er=1;function tr(t,{key:e,keys:n=e},r){if(n===null){let o=new Set;return t.map(s=>{let a=r&&r.find(i=>i.item===s&&i.phase!=="leave"&&!o.has(i));return a?(o.add(a),a.key):esm_er++})}return G.und(n)?t:G.fun(n)?t.map(n):zt(n)}var hs=({container:t,...e}={})=>{let[n,r]=esm_J(()=>({scrollX:0,scrollY:0,scrollXProgress:0,scrollYProgress:0,...e}),[]);return or(()=>{let o=rr(({x:s,y:a})=>{r.start({scrollX:s.current,scrollXProgress:s.progress,scrollY:a.current,scrollYProgress:a.progress})},{container:t?.current||void 0});return()=>{nr(Object.values(n),s=>s.stop()),o()}},[]),n};var Ps=({container:t,...e})=>{let[n,r]=esm_J(()=>({width:0,height:0,...e}),[]);return ar(()=>{let o=sr(({width:s,height:a})=>{r.start({width:s,height:a,immediate:n.width.get()===0||n.height.get()===0})},{container:t?.current||void 0});return()=>{ir(Object.values(n),s=>s.stop()),o()}},[]),n};var cr={any:0,all:1};function Cs(t,e){let[n,r]=pr(!1),o=ur(),s=Bt.fun(t)&&t,a=s?s():{},{to:i={},from:u={},...p}=a,f=s?e:t,[d,m]=esm_J(()=>({from:u,...p}),[]);return lr(()=>{let b=o.current,{root:c,once:P,amount:l="any",...h}=f??{};if(!b||P&&n||typeof IntersectionObserver>"u")return;let g=new WeakMap,x=()=>(i&&m.start(i),r(!0),P?void 0:()=>{u&&m.start(u),r(!1)}),S=V=>{V.forEach(_=>{let v=g.get(_.target);if(_.isIntersecting!==Boolean(v))if(_.isIntersecting){let w=x();Bt.fun(w)?g.set(_.target,w):A.unobserve(_.target)}else v&&(v(),g.delete(_.target))})},A=new IntersectionObserver(S,{root:c&&c.current||void 0,threshold:typeof l=="number"||Array.isArray(l)?l:cr[l],...h});return A.observe(b),()=>A.unobserve(b)},[f]),s?[o,d]:[o,n]}function qs({children:t,...e}){return t(esm_J(e))}function Bs({items:t,children:e,...n}){let r=esm_Qt(t.length,n);return t.map((o,s)=>{let a=e(o,s);return fr.fun(a)?a(r[s]):a})}function Ys({items:t,children:e,...n}){return esm_Gt(t,n)(e)}var esm_W=class extends esm_X{constructor(n,r){super();this.source=n;this.calc=W(...r);let o=this._get(),s=esm_Le(o);esm_D(this,s.create(o))}key;idle=!0;calc;_active=new Set;advance(n){let r=this._get(),o=this.get();bt(r,o)||(dist_esm_k(this).setValue(r),this._onChange(r,this.idle)),!this.idle&&Yt(this._active)&&esm_ct(this)}_get(){let n=dist_esm_l.arr(this.source)?this.source.map(ve):ht(ve(this.source));return this.calc(...n)}_start(){this.idle&&!Yt(this._active)&&(this.idle=!1,esm_Ve(F(this),n=>{n.done=!1}),dist_esm_p.skipAnimation?(esm_n.batchedUpdates(()=>this.advance()),esm_ct(this)):qe.start(this))}_attach(){let n=1;esm_Ve(ht(this.source),r=>{Pt(r)&&Gt(r,this),esm_Re(r)&&(r.idle||this._active.add(r),n=Math.max(n,r.priority+1))}),this.priority=n,this._start()}_detach(){esm_Ve(ht(this.source),n=>{Pt(n)&&Qt(n,this)}),this._active.clear(),esm_ct(this)}eventObserved(n){n.type=="change"?n.idle?this.advance():(this._active.add(n.parent),this._start()):n.type=="idle"?this._active.delete(n.parent):n.type=="priority"&&(this.priority=ht(this.source).reduce((r,o)=>Math.max(r,(esm_Re(o)?o.priority:0)+1),0))}};function vr(t){return t.idle!==!1}function Yt(t){return!t.size||Array.from(t).every(vr)}function esm_ct(t){t.idle||(t.idle=!0,esm_Ve(F(t),e=>{e.done=!0}),$t(t,{type:"idle",parent:t}))}var esm_ui=(t,...e)=>new esm_W(t,e),pi=(t,...e)=>(Cr(),new esm_W(t,e));dist_esm_p.assign({createStringInterpolator:Xt,to:(t,e)=>new esm_W(t,e)});var di=qe.advance;
;// CONCATENATED MODULE: external "ReactDOM"
const external_ReactDOM_namespaceObject = window["ReactDOM"];
;// CONCATENATED MODULE: ./node_modules/@react-spring/web/dist/esm/index.js
var web_dist_esm_k=/^--/;function web_dist_esm_I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!web_dist_esm_k.test(t)&&!(web_dist_esm_c.hasOwnProperty(t)&&web_dist_esm_c[t])?e+"px":(""+e).trim()}var web_dist_esm_v={};function esm_V(t,e){if(!t.nodeType||!t.setAttribute)return!1;let r=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{style:i,children:s,scrollTop:u,scrollLeft:l,viewBox:a,...n}=e,d=Object.values(n),m=Object.keys(n).map(o=>r||t.hasAttribute(o)?o:web_dist_esm_v[o]||(web_dist_esm_v[o]=o.replace(/([A-Z])/g,p=>"-"+p.toLowerCase())));s!==void 0&&(t.textContent=s);for(let o in i)if(i.hasOwnProperty(o)){let p=web_dist_esm_I(o,i[o]);web_dist_esm_k.test(o)?t.style.setProperty(o,p):t.style[o]=p}m.forEach((o,p)=>{t.setAttribute(o,d[p])}),u!==void 0&&(t.scrollTop=u),l!==void 0&&(t.scrollLeft=l),a!==void 0&&t.setAttribute("viewBox",a)}var web_dist_esm_c={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},esm_F=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),esm_L=["Webkit","Ms","Moz","O"];web_dist_esm_c=Object.keys(web_dist_esm_c).reduce((t,e)=>(esm_L.forEach(r=>t[esm_F(r,e)]=t[e]),t),web_dist_esm_c);var esm_=/^(matrix|translate|scale|rotate|skew)/,dist_esm_$=/^(translate)/,dist_esm_G=/^(rotate|skew)/,web_dist_esm_y=(t,e)=>dist_esm_l.num(t)&&t!==0?t+e:t,web_dist_esm_h=(t,e)=>dist_esm_l.arr(t)?t.every(r=>web_dist_esm_h(r,e)):dist_esm_l.num(t)?t===e:parseFloat(t)===e,dist_esm_g=class extends animated_dist_esm_u{constructor({x:e,y:r,z:i,...s}){let u=[],l=[];(e||r||i)&&(u.push([e||0,r||0,i||0]),l.push(a=>[`translate3d(${a.map(n=>web_dist_esm_y(n,"px")).join(",")})`,web_dist_esm_h(a,0)])),xt(s,(a,n)=>{if(n==="transform")u.push([a||""]),l.push(d=>[d,d===""]);else if(esm_.test(n)){if(delete s[n],dist_esm_l.und(a))return;let d=dist_esm_$.test(n)?"px":dist_esm_G.test(n)?"deg":"";u.push(ht(a)),l.push(n==="rotate3d"?([m,o,p,O])=>[`rotate3d(${m},${o},${p},${web_dist_esm_y(O,d)})`,web_dist_esm_h(O,0)]:m=>[`${n}(${m.map(o=>web_dist_esm_y(o,d)).join(",")})`,web_dist_esm_h(m,n.startsWith("scale")?1:0)])}}),u.length&&(s.transform=new web_dist_esm_x(u,l)),super(s)}},web_dist_esm_x=class extends esm_ge{constructor(r,i){super();this.inputs=r;this.transforms=i}_value=null;get(){return this._value||(this._value=this._get())}_get(){let r="",i=!0;return esm_Ve(this.inputs,(s,u)=>{let l=ve(s[0]),[a,n]=this.transforms[u](dist_esm_l.arr(l)?l:s.map(ve));r+=" "+a,i=i&&n}),i?"none":r}observerAdded(r){r==1&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Gt(s,this)))}observerRemoved(r){r==0&&esm_Ve(this.inputs,i=>esm_Ve(i,s=>Pt(s)&&Qt(s,this)))}eventObserved(r){r.type=="change"&&(this._value=null),$t(this,r)}};var esm_C=["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"];dist_esm_p.assign({batchedUpdates:external_ReactDOM_namespaceObject.unstable_batchedUpdates,createStringInterpolator:Xt,colors:It});var dist_esm_q=dist_esm_Ke(esm_C,{applyAnimatedValues:esm_V,createAnimatedStyle:t=>new dist_esm_g(t),getComponentProps:({scrollTop:t,scrollLeft:e,...r})=>r}),dist_esm_it=dist_esm_q.animated;
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-moving-animation/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;
function getAbsolutePosition(element) {
return {
top: element.offsetTop,
left: element.offsetLeft
};
}
/**
* Hook used to compute the styles required to move a div into a new position.
*
* The way this animation works is the following:
* - It first renders the element as if there was no animation.
* - It takes a snapshot of the position of the block to use it
* as a destination point for the animation.
* - It restores the element to the previous position using a CSS transform
* - It uses the "resetAnimation" flag to reset the animation
* from the beginning in order to animate to the new destination point.
*
* @param {Object} $1 Options
* @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.
* @param {string} $1.clientId
*/
function useMovingAnimation({
triggerAnimationOnChange,
clientId
}) {
const ref = (0,external_wp_element_namespaceObject.useRef)();
const {
isTyping,
getGlobalBlockCount,
isBlockSelected,
isFirstMultiSelectedBlock,
isBlockMultiSelected,
isAncestorMultiSelected
} = (0,external_wp_data_namespaceObject.useSelect)(store);
// Whenever the trigger changes, we need to take a snapshot of the current
// position of the block to use it as a destination point for the animation.
const {
previous,
prevRect
} = (0,external_wp_element_namespaceObject.useMemo)(() => ({
previous: ref.current && getAbsolutePosition(ref.current),
prevRect: ref.current && ref.current.getBoundingClientRect()
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[triggerAnimationOnChange]);
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (!previous || !ref.current) {
return;
}
const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(ref.current);
const isSelected = isBlockSelected(clientId);
const adjustScrolling = isSelected || isFirstMultiSelectedBlock(clientId);
function preserveScrollPosition() {
if (adjustScrolling && prevRect) {
const blockRect = ref.current.getBoundingClientRect();
const diff = blockRect.top - prevRect.top;
if (diff) {
scrollContainer.scrollTop += diff;
}
}
}
// We disable the animation if the user has a preference for reduced
// motion, if the user is typing (insertion by Enter), or if the block
// count exceeds the threshold (insertion caused all the blocks that
// follow to animate).
// To do: consider enableing the _moving_ animation even for large
// posts, while only disabling the _insertion_ animation?
const disableAnimation = window.matchMedia('(prefers-reduced-motion: reduce)').matches || isTyping() || getGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;
if (disableAnimation) {
// If the animation is disabled and the scroll needs to be adjusted,
// just move directly to the final scroll position.
preserveScrollPosition();
return;
}
const isPartOfSelection = isSelected || isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId);
// Make sure the other blocks move under the selected block(s).
const zIndex = isPartOfSelection ? '1' : '';
const controller = new esm_le({
x: 0,
y: 0,
config: {
mass: 5,
tension: 2000,
friction: 200
},
onChange({
value
}) {
if (!ref.current) {
return;
}
let {
x,
y
} = value;
x = Math.round(x);
y = Math.round(y);
const finishedMoving = x === 0 && y === 0;
ref.current.style.transformOrigin = 'center center';
ref.current.style.transform = finishedMoving ? null // Set to `null` to explicitly remove the transform.
: `translate3d(${x}px,${y}px,0)`;
ref.current.style.zIndex = zIndex;
preserveScrollPosition();
}
});
ref.current.style.transform = undefined;
const destination = getAbsolutePosition(ref.current);
const x = Math.round(previous.left - destination.left);
const y = Math.round(previous.top - destination.top);
controller.start({
x: 0,
y: 0,
from: {
x,
y
}
});
return () => {
controller.stop();
controller.set({
x: 0,
y: 0
});
};
}, [previous, prevRect, clientId, isTyping, getGlobalBlockCount, isBlockSelected, isFirstMultiSelectedBlock, isBlockMultiSelected, isAncestorMultiSelected]);
return ref;
}
/* harmony default export */ const use_moving_animation = (useMovingAnimation);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/private-block-context.js
/**
* WordPress dependencies
*/
const PrivateBlockContext = (0,external_wp_element_namespaceObject.createContext)({});
;// 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.
*
* @param {Element} a First element.
* @param {Element} b Second element.
*
* @return {boolean} Whether elements are in the same block.
*/
function isInSameBlock(a, b) {
return a.closest(BLOCK_SELECTOR) === b.closest(BLOCK_SELECTOR);
}
/**
* 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 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, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS].join(','));
return parentBlock === blockElement;
}
/**
* Finds the block client ID given any DOM node inside the block.
*
* @param {Node?} node DOM node.
*
* @return {string|undefined} Client ID or undefined if the node is not part of
* a block.
*/
function getBlockClientId(node) {
while (node && node.nodeType !== node.ELEMENT_NODE) {
node = node.parentNode;
}
if (!node) {
return;
}
const elementNode = /** @type {Element} */node;
const blockNode = elementNode.closest(BLOCK_SELECTOR);
if (!blockNode) {
return;
}
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
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('@wordpress/element').RefObject} RefObject */
/**
* Transitions focus to the block or inner tabbable when the block becomes
* selected and an initial position is set.
*
* @param {string} clientId Block client ID.
*
* @return {RefObject} React ref with the block element.
*/
function useFocusFirstElement({
clientId,
initialPosition
}) {
const ref = (0,external_wp_element_namespaceObject.useRef)();
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;
}
if (!ref.current) {
return;
}
const {
ownerDocument
} = ref.current;
// Do not focus the block if it already contains the active element.
if (isInsideRootBlock(ref.current, ownerDocument.activeElement)) {
return;
}
// Find all tabbables within node.
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 = textInputs[isReverse ? textInputs.length - 1 : 0] || ref.current;
if (!isInsideRootBlock(ref.current, target)) {
ref.current.focus();
return;
}
// 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
/**
* WordPress dependencies
*/
function listener(event) {
if (event.defaultPrevented) {
return;
}
const action = event.type === 'mouseover' ? 'add' : 'remove';
event.preventDefault();
event.currentTarget.classList[action]('is-hovered');
}
/*
* Adds `is-hovered` class when the block is hovered and in navigation or
* outline mode.
*/
function useIsHovered({
isEnabled
}) {
return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
if (isEnabled) {
node.addEventListener('mouseout', listener);
node.addEventListener('mouseover', listener);
return () => {
node.removeEventListener('mouseout', listener);
node.removeEventListener('mouseover', listener);
// Remove class in case it lingers.
node.classList.remove('is-hovered');
};
}
}, [isEnabled]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-focus-handler.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Selects the block if it receives focus.
*
* @param {string} clientId Block client ID.
*/
function useFocusHandler(clientId) {
const {
isBlockSelected
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
selectBlock,
selectionChange
} = (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
* set focus on its own (via `setFocus`), typically if there is no
* focusable input in the block.
*
* @param {FocusEvent} event Focus event.
*/
function onFocus(event) {
// 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) {
selectionChange(clientId);
}
return;
}
// If an inner block is focussed, that block is resposible for
// setting the selected block.
if (!isInsideRootBlock(node, event.target)) {
return;
}
selectBlock(clientId);
}
node.addEventListener('focusin', onFocus);
return () => {
node.removeEventListener('focusin', onFocus);
};
}, [isBlockSelected, selectBlock]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Adds block behaviour:
* - Removes the block on BACKSPACE.
* - Inserts a default block on ENTER.
* - Disables dragging of block contents.
*
* @param {string} clientId Block client ID.
*/
function useEventHandlers({
clientId,
isSelected
}) {
const {
getBlockRootClientId,
getBlockIndex
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
insertAfterBlock,
removeBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
if (!isSelected) {
return;
}
/**
* Interprets keydown event intent to remove or insert after block if
* key event occurs on wrapper node. This can occur when the block has
* no text fields of its own, particularly after initial insertion, to
* allow for easy deletion and continuous writing flow to add additional
* content.
*
* @param {KeyboardEvent} event Keydown event.
*/
function onKeyDown(event) {
const {
keyCode,
target
} = event;
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_namespaceObject.ENTER) {
insertAfterBlock(clientId);
} else {
removeBlock(clientId);
}
}
/**
* Prevents default dragging behavior within a block. To do: we must
* handle this in the future and clean up the drag target.
*
* @param {DragEvent} event Drag event.
*/
function onDragStart(event) {
event.preventDefault();
}
node.addEventListener('keydown', onKeyDown);
node.addEventListener('dragstart', onDragStart);
return () => {
node.removeEventListener('keydown', onKeyDown);
node.removeEventListener('dragstart', onDragStart);
};
}, [clientId, isSelected, getBlockRootClientId, getBlockIndex, insertAfterBlock, removeBlock]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/use-nav-mode-exit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Allows navigation mode to be exited by clicking in the selected block.
*
* @param {string} clientId Block client ID.
*/
function useNavModeExit(clientId) {
const {
isNavigationMode,
isBlockSelected
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
setNavigationMode,
selectBlock
} = (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.
if (isNavigationMode() && !event.defaultPrevented) {
// Prevent focus from moving to the block.
event.preventDefault();
// When clicking on a selected block, exit navigation mode.
if (isBlockSelected(clientId)) {
setNavigationMode(false);
} else {
selectBlock(clientId);
}
}
}
node.addEventListener('mousedown', onMouseDown);
return () => {
node.removeEventListener('mousedown', onMouseDown);
};
}, [clientId, isNavigationMode, isBlockSelected, setNavigationMode]);
}
;// 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)(block_list_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/use-flash-editable-blocks/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useFlashEditableBlocks({
clientId = '',
isEnabled = true
} = {}) {
const {
getEnabledClientIdsTree
} = unlock((0,external_wp_data_namespaceObject.useSelect)(store));
return (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
if (!isEnabled) {
return;
}
const flashEditableBlocks = () => {
getEnabledClientIdsTree(clientId).forEach(({
clientId: id
}) => {
const block = element.querySelector(`[data-block="${id}"]`);
if (!block) {
return;
}
block.classList.remove('has-editable-outline');
// Force reflow to trigger the animation.
// eslint-disable-next-line no-unused-expressions
block.offsetWidth;
block.classList.add('has-editable-outline');
});
};
const handleClick = event => {
const shouldFlash = event.target === element || event.target.classList.contains('is-root-container');
if (!shouldFlash) {
return;
}
if (event.defaultPrevented) {
return;
}
event.preventDefault();
flashEditableBlocks();
};
element.addEventListener('click', handleClick);
return () => element.removeEventListener('click', handleClick);
}, [isEnabled]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/use-block-props/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* 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.
*
* Use of this hook on the outermost element of a block is required if using API >= v2.
*
* @example
* ```js
* import { useBlockProps } from '@wordpress/block-editor';
*
* export default function Edit() {
*
* const blockProps = useBlockProps(
* className: 'my-custom-class',
* style: {
* color: '#222222',
* backgroundColor: '#eeeeee'
* }
* )
*
* return (
* <div { ...blockProps }>
*
* </div>
* )
* }
*
* ```
*
*
* @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 use_block_props_useBlockProps(props = {}, {
__unstableIsHtml
} = {}) {
const {
clientId,
className,
wrapperProps = {},
isAligned,
index,
mode,
name,
blockApiVersion,
blockTitle,
isSelected,
isSubtreeDisabled,
isOutlineEnabled,
hasOverlay,
initialPosition,
blockEditingMode,
isHighlighted,
isMultiSelected,
isPartiallySelected,
isReusable,
isDragging,
hasChildSelected,
removeOutline,
isBlockMovingMode,
canInsertMovingBlock,
isEditingDisabled,
hasEditableOutline,
isTemporarilyEditingAsBlocks,
defaultClassName,
templateLock
} = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext);
// 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,
initialPosition
}), useBlockRefProvider(clientId), useFocusHandler(clientId), useEventHandlers({
clientId,
isSelected
}), useNavModeExit(clientId), useIsHovered({
isEnabled: isOutlineEnabled
}), useIntersectionObserver(), use_moving_animation({
triggerAnimationOnChange: index,
clientId
}), (0,external_wp_compose_namespaceObject.useDisabled)({
isDisabled: !hasOverlay
}), useFlashEditableBlocks({
clientId,
isEnabled: name === 'core/block' || templateLock === 'contentOnly'
})]);
const blockEditContext = useBlockEditContext();
const hasBlockBindings = !!blockEditContext[blockBindingsKey];
const bindingsStyle = hasBlockBindings && canBindBlock(name) ? {
'--wp-admin-theme-color': 'var(--wp-bound-block-color)'
} : {};
// Ensures it warns only inside the `edit` implementation for the block.
if (blockApiVersion < 2 && clientId === blockEditContext.clientId) {
true ? external_wp_warning_default()(`Block type "${name}" must support API version 2 or higher to work correctly with "useBlockProps" method.`) : 0;
}
return {
tabIndex: blockEditingMode === 'disabled' ? -1 : 0,
...wrapperProps,
...props,
ref: mergedRefs,
id: `block-${clientId}${htmlSuffix}`,
role: 'document',
'aria-label': blockLabel,
'data-block': clientId,
'data-type': name,
'data-title': blockTitle,
inert: isSubtreeDisabled ? 'true' : undefined,
className: classnames_default()('block-editor-block-list__block', {
// The wp-block className is important for editor styles.
'wp-block': !isAligned,
'has-block-overlay': hasOverlay,
'is-selected': isSelected,
'is-highlighted': isHighlighted,
'is-multi-selected': isMultiSelected,
'is-partially-selected': isPartiallySelected,
'is-reusable': isReusable,
'is-dragging': isDragging,
'has-child-selected': hasChildSelected,
'remove-outline': removeOutline,
'is-block-moving-mode': isBlockMovingMode,
'can-insert-moving-block': canInsertMovingBlock,
'is-editing-disabled': isEditingDisabled,
'has-editable-outline': hasEditableOutline,
'is-content-locked-temporarily-editing-as-blocks': isTemporarilyEditingAsBlocks
}, className, props.className, wrapperProps.className, defaultClassName),
style: {
...wrapperProps.style,
...props.style,
...bindingsStyle
}
};
}
/**
* Call within a save function to get the props for the block wrapper.
*
* @param {Object} props Optional. Props to pass to the element.
*/
use_block_props_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
*/
/**
* 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
};
// May be set to undefined, so check if the property is set!
if (propsA?.hasOwnProperty('className') && propsB?.hasOwnProperty('className')) {
newProps.className = classnames_default()(propsA.className, propsB.className);
}
if (propsA?.hasOwnProperty('style') && propsB?.hasOwnProperty('style')) {
newProps.style = {
...propsA.style,
...propsB.style
};
}
return newProps;
}
function Block({
children,
isHtml,
...props
}) {
return (0,external_React_.createElement)("div", {
...use_block_props_useBlockProps(props, {
__unstableIsHtml: isHtml
})
}, children);
}
function BlockListBlock({
block: {
__unstableBlockSource
},
mode,
isLocked,
canRemove,
clientId,
isSelected,
isSelectionEnabled,
className,
__unstableLayoutClassNames: layoutClassNames,
name,
isValid,
attributes,
wrapperProps,
setAttributes,
onReplace,
onInsertBlocksAfter,
onMerge,
toggleSelection
}) {
var _wrapperProps;
const {
mayDisplayControls,
mayDisplayParentControls,
themeSupportsLayout,
...context
} = (0,external_wp_element_namespaceObject.useContext)(PrivateBlockContext);
const {
removeBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const onRemove = (0,external_wp_element_namespaceObject.useCallback)(() => removeBlock(clientId), [clientId]);
const parentLayout = useLayout() || {};
// 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_React_.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,
__unstableLayoutClassNames: layoutClassNames,
__unstableParentLayout: Object.keys(parentLayout).length ? parentLayout : undefined,
mayDisplayControls: mayDisplayControls,
mayDisplayParentControls: mayDisplayParentControls,
blockEditingMode: context.blockEditingMode
});
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
// 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'] && !themeSupportsLayout;
// Support for sticky position in classic themes with alignment wrappers.
const isSticky = className?.includes('is-position-sticky');
// 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_React_.createElement)("div", {
className: classnames_default()('wp-block', isSticky && className),
"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_React_.createElement)(Block, {
className: "has-warning"
}, (0,external_React_.createElement)(BlockInvalidWarning, {
clientId: clientId
}), (0,external_React_.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_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
style: {
display: 'none'
}
}, blockEdit), (0,external_React_.createElement)(Block, {
isHtml: true
}, (0,external_React_.createElement)(block_html, {
clientId: clientId
})));
} else if (blockType?.apiVersion > 1) {
block = blockEdit;
} else {
block = (0,external_React_.createElement)(Block, null, blockEdit);
}
const {
'data-align': dataAlign,
...restWrapperProps
} = (_wrapperProps = wrapperProps) !== null && _wrapperProps !== void 0 ? _wrapperProps : {};
restWrapperProps.className = classnames_default()(restWrapperProps.className, dataAlign && themeSupportsLayout && `align${dataAlign}`, !(dataAlign && isSticky) && className);
// We set a new context with the adjusted and filtered wrapperProps (through
// `editor.BlockListBlock`), which the `BlockListBlockProvider` did not have
// access to.
return (0,external_React_.createElement)(PrivateBlockContext.Provider, {
value: {
wrapperProps: restWrapperProps,
isAligned,
...context
}
}, (0,external_React_.createElement)(block_crash_boundary, {
fallback: (0,external_React_.createElement)(Block, {
className: "has-warning"
}, (0,external_React_.createElement)(block_crash_warning, null))
}, block));
}
const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, registry) => {
const {
updateBlockAttributes,
insertBlocks,
mergeBlocks,
replaceBlocks,
toggleSelection,
__unstableMarkLastChangeAsPersistent,
moveBlocksToPosition,
removeBlock
} = 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
} = registry.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
} = registry.select(store);
const index = getBlockIndex(clientId);
insertBlocks(blocks, index + 1, rootClientId);
},
onMerge(forward) {
const {
clientId,
rootClientId
} = ownProps;
const {
getPreviousBlockClientId,
getNextBlockClientId,
getBlock,
getBlockAttributes,
getBlockName,
getBlockOrder,
getBlockIndex,
getBlockRootClientId,
canInsertBlockType
} = registry.select(store);
/**
* Moves the block with clientId up one level. If the block type
* cannot be inserted at the new location, it will be attempted to
* convert to the default block type.
*
* @param {string} _clientId The block to move.
* @param {boolean} changeSelection Whether to change the selection
* to the moved block.
*/
function moveFirstItemUp(_clientId, changeSelection = true) {
const targetRootClientId = getBlockRootClientId(_clientId);
const blockOrder = getBlockOrder(_clientId);
const [firstClientId] = blockOrder;
if (blockOrder.length === 1 && (0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(getBlock(firstClientId))) {
removeBlock(_clientId);
} else {
registry.batch(() => {
if (canInsertBlockType(getBlockName(firstClientId), targetRootClientId)) {
moveBlocksToPosition([firstClientId], _clientId, targetRootClientId, getBlockIndex(_clientId));
} else {
const replacement = (0,external_wp_blocks_namespaceObject.switchToBlockType)(getBlock(firstClientId), (0,external_wp_blocks_namespaceObject.getDefaultBlockName)());
if (replacement && replacement.length) {
insertBlocks(replacement, getBlockIndex(_clientId), targetRootClientId, changeSelection);
removeBlock(firstClientId, false);
}
}
if (!getBlockOrder(_clientId).length && (0,external_wp_blocks_namespaceObject.isUnmodifiedBlock)(getBlock(_clientId))) {
removeBlock(_clientId, false);
}
});
}
}
// For `Delete` or forward merge, we should do the exact same thing
// as `Backspace`, but from the other block.
if (forward) {
if (rootClientId) {
const nextRootClientId = getNextBlockClientId(rootClientId);
if (nextRootClientId) {
// If there is a block that follows with the same parent
// block name and the same attributes, merge the inner
// blocks.
if (getBlockName(rootClientId) === getBlockName(nextRootClientId)) {
const rootAttributes = getBlockAttributes(rootClientId);
const previousRootAttributes = getBlockAttributes(nextRootClientId);
if (Object.keys(rootAttributes).every(key => rootAttributes[key] === previousRootAttributes[key])) {
registry.batch(() => {
moveBlocksToPosition(getBlockOrder(nextRootClientId), nextRootClientId, rootClientId);
removeBlock(nextRootClientId, false);
});
return;
}
} else {
mergeBlocks(rootClientId, nextRootClientId);
return;
}
}
}
const nextBlockClientId = getNextBlockClientId(clientId);
if (!nextBlockClientId) {
return;
}
if (getBlockOrder(nextBlockClientId).length) {
moveFirstItemUp(nextBlockClientId, false);
} else {
mergeBlocks(clientId, nextBlockClientId);
}
} else {
const previousBlockClientId = getPreviousBlockClientId(clientId);
if (previousBlockClientId) {
mergeBlocks(previousBlockClientId, clientId);
} else if (rootClientId) {
const previousRootClientId = getPreviousBlockClientId(rootClientId);
// If there is a preceding block with the same parent block
// name and the same attributes, merge the inner blocks.
if (previousRootClientId && getBlockName(rootClientId) === getBlockName(previousRootClientId)) {
const rootAttributes = getBlockAttributes(rootClientId);
const previousRootAttributes = getBlockAttributes(previousRootClientId);
if (Object.keys(rootAttributes).every(key => rootAttributes[key] === previousRootAttributes[key])) {
registry.batch(() => {
moveBlocksToPosition(getBlockOrder(rootClientId), rootClientId, previousRootClientId);
removeBlock(rootClientId, false);
});
return;
}
}
moveFirstItemUp(rootClientId);
} else {
removeBlock(clientId);
}
}
},
onReplace(blocks, indexToSelect, initialPosition) {
if (blocks.length && !(0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blocks[blocks.length - 1])) {
__unstableMarkLastChangeAsPersistent();
}
//Unsynced patterns are nested in an array so we need to flatten them.
const replacementBlocks = blocks?.length === 1 && Array.isArray(blocks[0]) ? blocks[0] : blocks;
replaceBlocks([ownProps.clientId], replacementBlocks, indexToSelect, initialPosition);
},
toggleSelection(selectionEnabled) {
toggleSelection(selectionEnabled);
}
};
});
// This component is used by the BlockListBlockProvider component below. It will
// add the props necessary for the `editor.BlockListBlock` filters.
BlockListBlock = (0,external_wp_compose_namespaceObject.compose)(applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)('editor.BlockListBlock'))(BlockListBlock);
// This component provides all the information we need through a single store
// subscription (useSelect mapping). Only the necessary props are passed down
// to the BlockListBlock component, which is a filtered component, so these
// props are public API. To avoid adding to the public API, we use a private
// context to pass the rest of the information to the filtered BlockListBlock
// component, and useBlockProps.
function BlockListBlockProvider(props) {
const {
clientId,
rootClientId
} = props;
const selectedProps = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
isBlockSelected,
getBlockMode,
isSelectionEnabled,
getTemplateLock,
getBlockWithoutAttributes,
getBlockAttributes,
canRemoveBlock,
canMoveBlock,
getSettings,
__unstableGetTemporarilyEditingAsBlocks,
getBlockEditingMode,
getBlockName,
isFirstMultiSelectedBlock,
getMultiSelectedBlockClientIds,
hasSelectedInnerBlock,
getBlockIndex,
isTyping,
isBlockMultiSelected,
isBlockSubtreeDisabled,
isBlockHighlighted,
__unstableIsFullySelected,
__unstableSelectionHasUnmergeableBlock,
isBlockBeingDragged,
isDragging,
hasBlockMovingClientId,
canInsertBlockType,
__unstableHasActiveBlockOverlayActive,
__unstableGetEditorMode,
getSelectedBlocksInitialCaretPosition
} = unlock(select(store));
const blockWithoutAttributes = getBlockWithoutAttributes(clientId);
// This 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.
if (!blockWithoutAttributes) {
return;
}
const {
hasBlockSupport: _hasBlockSupport,
getActiveBlockVariation
} = select(external_wp_blocks_namespaceObject.store);
const _isSelected = isBlockSelected(clientId);
const canRemove = canRemoveBlock(clientId, rootClientId);
const canMove = canMoveBlock(clientId, rootClientId);
const attributes = getBlockAttributes(clientId);
const {
name: blockName,
isValid
} = blockWithoutAttributes;
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
const match = getActiveBlockVariation(blockName, attributes);
const {
outlineMode,
supportsLayout
} = getSettings();
const isMultiSelected = isBlockMultiSelected(clientId);
const checkDeep = true;
const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep);
const typing = isTyping();
const hasLightBlockWrapper = blockType?.apiVersion > 1;
const movingClientId = hasBlockMovingClientId();
const blockEditingMode = getBlockEditingMode(clientId);
return {
mode: getBlockMode(clientId),
isSelectionEnabled: isSelectionEnabled(),
isLocked: !!getTemplateLock(rootClientId),
templateLock: getTemplateLock(clientId),
canRemove,
canMove,
blockWithoutAttributes,
name: blockName,
attributes,
isValid,
isSelected: _isSelected,
themeSupportsLayout: supportsLayout,
isTemporarilyEditingAsBlocks: __unstableGetTemporarilyEditingAsBlocks() === clientId,
blockEditingMode,
mayDisplayControls: _isSelected || isFirstMultiSelectedBlock(clientId) && getMultiSelectedBlockClientIds().every(id => getBlockName(id) === blockName),
mayDisplayParentControls: _hasBlockSupport(getBlockName(clientId), '__experimentalExposeControlsToChildren', false) && hasSelectedInnerBlock(clientId),
index: getBlockIndex(clientId),
blockApiVersion: blockType?.apiVersion || 1,
blockTitle: match?.title || blockType?.title,
isSubtreeDisabled: blockEditingMode === 'disabled' && isBlockSubtreeDisabled(clientId),
isOutlineEnabled: outlineMode,
hasOverlay: __unstableHasActiveBlockOverlayActive(clientId) && !isDragging(),
initialPosition: _isSelected && __unstableGetEditorMode() === 'edit' ? getSelectedBlocksInitialCaretPosition() : undefined,
isHighlighted: isBlockHighlighted(clientId),
isMultiSelected,
isPartiallySelected: isMultiSelected && !__unstableIsFullySelected() && !__unstableSelectionHasUnmergeableBlock(),
isReusable: (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType),
isDragging: isBlockBeingDragged(clientId),
hasChildSelected: isAncestorOfSelectedBlock,
removeOutline: _isSelected && outlineMode && typing,
isBlockMovingMode: !!movingClientId,
canInsertMovingBlock: movingClientId && canInsertBlockType(getBlockName(movingClientId), rootClientId),
isEditingDisabled: blockEditingMode === 'disabled',
hasEditableOutline: blockEditingMode !== 'disabled' && getBlockEditingMode(rootClientId) === 'disabled',
className: hasLightBlockWrapper ? attributes.className : undefined,
defaultClassName: hasLightBlockWrapper ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(blockName) : undefined
};
}, [clientId, rootClientId]);
const {
mode,
isSelectionEnabled,
isLocked,
canRemove,
canMove,
blockWithoutAttributes,
name,
attributes,
isValid,
isSelected,
themeSupportsLayout,
isTemporarilyEditingAsBlocks,
blockEditingMode,
mayDisplayControls,
mayDisplayParentControls,
index,
blockApiVersion,
blockTitle,
isSubtreeDisabled,
isOutlineEnabled,
hasOverlay,
initialPosition,
isHighlighted,
isMultiSelected,
isPartiallySelected,
isReusable,
isDragging,
hasChildSelected,
removeOutline,
isBlockMovingMode,
canInsertMovingBlock,
templateLock,
isEditingDisabled,
hasEditableOutline,
className,
defaultClassName
} = selectedProps;
// 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.
const block = (0,external_wp_element_namespaceObject.useMemo)(() => ({
...blockWithoutAttributes,
attributes
}), [blockWithoutAttributes, attributes]);
// 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
if (!selectedProps) {
return null;
}
const privateContext = {
clientId,
className,
index,
mode,
name,
blockApiVersion,
blockTitle,
isSelected,
isSubtreeDisabled,
isOutlineEnabled,
hasOverlay,
initialPosition,
blockEditingMode,
isHighlighted,
isMultiSelected,
isPartiallySelected,
isReusable,
isDragging,
hasChildSelected,
removeOutline,
isBlockMovingMode,
canInsertMovingBlock,
templateLock,
isEditingDisabled,
hasEditableOutline,
isTemporarilyEditingAsBlocks,
defaultClassName,
mayDisplayControls,
mayDisplayParentControls,
themeSupportsLayout
};
// Here we separate between the props passed to BlockListBlock and any other
// information we selected for internal use. BlockListBlock is a filtered
// component and thus ALL the props are PUBLIC API.
// Note that the context value doesn't have to be memoized in this case
// because when it changes, this component will be re-rendered anyway, and
// none of the consumers (BlockListBlock and useBlockProps) are memoized or
// "pure". This is different from the public BlockEditContext, where
// consumers might be memoized or "pure".
return (0,external_React_.createElement)(PrivateBlockContext.Provider, {
value: privateContext
}, (0,external_React_.createElement)(BlockListBlock, {
...props,
mode,
isSelectionEnabled,
isLocked,
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
}));
}
/* harmony default export */ const block_list_block = ((0,external_wp_element_namespaceObject.memo)(BlockListBlockProvider));
;// CONCATENATED MODULE: external ["wp","htmlEntities"]
const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
;// 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 <kbd>/</kbd> to quickly insert new blocks.'), {
kbd: (0,external_React_.createElement)("kbd", null)
}), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Indent a list by pressing <kbd>space</kbd> at the beginning of a line.'), {
kbd: (0,external_React_.createElement)("kbd", null)
}), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Outdent a list by pressing <kbd>backspace</kbd> at the beginning of a line.'), {
kbd: (0,external_React_.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] = (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 (0,external_React_.createElement)(external_wp_components_namespaceObject.Tip, null, globalTips[randomIndex]);
}
/* harmony default export */ const tips = (Tips);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
/**
* WordPress dependencies
*/
const chevronRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const chevron_right = (chevronRight);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
/**
* WordPress dependencies
*/
const chevronLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const chevron_left = (chevronLeft);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-card/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockCard({
title,
icon,
description,
blockType,
className
}) {
if (blockType) {
external_wp_deprecated_default()('`blockType` property in `BlockCard component`', {
since: '5.7',
alternative: '`title, icon and description` properties'
});
({
title,
icon,
description
} = blockType);
}
const {
parentNavBlockClientId
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSelectedBlockClientId,
getBlockParentsByBlockName
} = select(store);
const _selectedBlockClientId = getSelectedBlockClientId();
return {
parentNavBlockClientId: getBlockParentsByBlockName(_selectedBlockClientId, 'core/navigation', true)[0]
};
}, []);
const {
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
return (0,external_React_.createElement)("div", {
className: classnames_default()('block-editor-block-card', className)
}, parentNavBlockClientId &&
// This is only used by the Navigation block for now. It's not ideal having Navigation block specific code here.
(0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
onClick: () => selectBlock(parentNavBlockClientId),
label: (0,external_wp_i18n_namespaceObject.__)('Go to parent Navigation block'),
style:
// TODO: This style override is also used in ToolsPanelHeader.
// It should be supported out-of-the-box by Button.
{
minWidth: 24,
padding: 0
},
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
size: "small"
}), (0,external_React_.createElement)(block_icon, {
icon: icon,
showColors: true
}), (0,external_React_.createElement)("div", {
className: "block-editor-block-card__content"
}, (0,external_React_.createElement)("h2", {
className: "block-editor-block-card__title"
}, title), description && (0,external_React_.createElement)("span", {
className: "block-editor-block-card__description"
}, description)));
}
/* harmony default export */ const block_card = (BlockCard);
;// 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)(({
useSubRegistry = true,
registry,
...props
}) => {
if (!useSubRegistry) {
return (0,external_React_.createElement)(WrappedComponent, {
registry: registry,
...props
});
}
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]);
if (!subRegistry) {
return null;
}
return (0,external_React_.createElement)(external_wp_data_namespaceObject.RegistryProvider, {
value: subRegistry
}, (0,external_React_.createElement)(WrappedComponent, {
registry: subRegistry,
...props
}));
});
}, 'withRegistryProvider');
/* harmony default export */ const with_registry_provider = (withRegistryProvider);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/use-block-sync.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const use_block_sync_noop = () => {};
/**
* A function to call when the block value has been updated in the block-editor
* store.
*
* @callback onBlockUpdate
* @param {Object[]} blocks The updated blocks.
* @param {Object} options The updated block options, such as selectionStart
* and selectionEnd.
*/
/**
* useBlockSync is a side effect which handles bidirectional sync between the
* block-editor store and a controlling data source which provides blocks. This
* is most commonly used by the BlockEditorProvider to synchronize the contents
* of the block-editor store with the root entity, like a post.
*
* Another example would be the template part block, which provides blocks from
* a separate entity data source than a root entity. This hook syncs edits to
* the template part in the block editor back to the entity and vice-versa.
*
* Here are some of its basic functions:
* - Initalizes the block-editor store for the given clientID to the blocks
* given via props.
* - Adds incoming changes (like undo) to the block-editor store.
* - Adds outgoing changes (like editing content) to the controlling entity,
* determining if a change should be considered persistent or not.
* - Handles edge cases and race conditions which occur in those operations.
* - Ignores changes which happen to other entities (like nested inner block
* 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 = use_block_sync_noop,
onInput = use_block_sync_noop
}) {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
resetBlocks,
resetSelection,
replaceInnerBlocks,
setHasControlledInnerBlocks,
__unstableMarkNextChangeAsNotPersistent
} = registry.dispatch(store);
const {
getBlockName,
getBlocks,
getSelectionStart,
getSelectionEnd
} = registry.select(store);
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 = (0,external_wp_element_namespaceObject.useRef)(false);
const setControlledBlocks = () => {
if (!controlledBlocks) {
return;
}
// We don't need to persist this change because we only replace
// controlled inner blocks when the change was caused by an entity,
// and so it would already be persisted.
__unstableMarkNextChangeAsNotPersistent();
if (clientId) {
// 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;
}
resetBlocks(controlledBlocks);
}
};
// Clean up the changes made by setControlledBlocks() when the component
// containing useBlockSync() unmounts.
const unsetControlledBlocks = () => {
__unstableMarkNextChangeAsNotPersistent();
if (clientId) {
setHasControlledInnerBlocks(clientId, false);
__unstableMarkNextChangeAsNotPersistent();
replaceInnerBlocks(clientId, []);
} else {
resetBlocks([]);
}
};
// Add a subscription to the block-editor registry to detect when changes
// have been made. This lets us inform the data source of changes. This
// is an effect so that the subscriber can run synchronously without
// waiting for React renders for changes.
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.
(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.
// Only skip if the value matches expectation, since a reset should
// 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 (pendingChanges.current.outgoing[pendingChanges.current.outgoing.length - 1] === controlledBlocks) {
pendingChanges.current.outgoing = [];
}
} else if (getBlocks(clientId) !== controlledBlocks) {
// Reset changing value in all other cases than the sync described
// above. Since this can be reached in an update following an out-
// bound sync, unset the outbound value to avoid considering it in
// subsequent renders.
pendingChanges.current.outgoing = [];
setControlledBlocks();
if (controlledSelection) {
resetSelection(controlledSelection.selectionStart, controlledSelection.selectionEnd, controlledSelection.initialPosition);
}
}
}, [controlledBlocks, clientId]);
(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 {
getSelectedBlocksInitialCaretPosition,
isLastBlockChangePersistent,
__unstableIsLastBlockChangeIgnored,
areInnerBlocksControlled
} = registry.select(store);
let blocks = getBlocks(clientId);
let isPersistent = isLastBlockChangePersistent();
let previousAreBlocksDifferent = false;
subscribed.current = true;
const unsubscribe = registry.subscribe(() => {
// Sometimes, when changing block lists, lingering subscriptions
// might trigger before they are cleaned up. If the block for which
// the subscription runs is no longer in the store, this would clear
// its parent entity's block list. To avoid this, we bail out if
// 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;
// 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;
blocks = newBlocks;
if (areBlocksDifferent && (pendingChanges.current.incoming || __unstableIsLastBlockChangeIgnored())) {
pendingChanges.current.incoming = null;
isPersistent = newIsPersistent;
return;
}
// Since we often dispatch an action to mark the previous action as
// persistent, we need to make sure that the blocks changed on the
// previous action before committing the change.
const didPersistenceChange = previousAreBlocksDifferent && !areBlocksDifferent && newIsPersistent && !isPersistent;
if (areBlocksDifferent || didPersistenceChange) {
isPersistent = newIsPersistent;
// We know that onChange/onInput will update controlledBlocks.
// We need to be aware that it was caused by an outgoing change
// so that we do not treat it as an incoming change later on,
// which would cause a block reset.
pendingChanges.current.outgoing.push(blocks);
// Inform the controlling entity that changes have been made to
// the block-editor store they should be aware about.
const updateParent = isPersistent ? onChangeRef.current : onInputRef.current;
const undoIgnore = undoIgnoreBlocks.has(blocks);
if (undoIgnore) {
undoIgnoreBlocks.delete(blocks);
}
updateParent(blocks, {
selection: {
selectionStart: getSelectionStart(),
selectionEnd: getSelectionEnd(),
initialPosition: getSelectedBlocksInitialCaretPosition()
},
undoIgnore
});
}
previousAreBlocksDifferent = areBlocksDifferent;
}, store);
return () => {
subscribed.current = false;
unsubscribe();
};
}, [registry, clientId]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
return () => {
unsetControlledBlocks();
};
}, []);
}
;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
;// 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.
const {
registerShortcut
} = (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: (0,external_wp_i18n_namespaceObject.__)('Duplicate the selected block(s).'),
keyCombination: {
modifier: 'primaryShift',
character: 'd'
}
});
registerShortcut({
name: 'core/block-editor/remove',
category: 'block',
description: (0,external_wp_i18n_namespaceObject.__)('Remove the selected block(s).'),
keyCombination: {
modifier: 'access',
character: 'z'
}
});
registerShortcut({
name: 'core/block-editor/insert-before',
category: 'block',
description: (0,external_wp_i18n_namespaceObject.__)('Insert a new block before the selected block(s).'),
keyCombination: {
modifier: 'primaryAlt',
character: 't'
}
});
registerShortcut({
name: 'core/block-editor/insert-after',
category: 'block',
description: (0,external_wp_i18n_namespaceObject.__)('Insert a new block after the selected block(s).'),
keyCombination: {
modifier: 'primaryAlt',
character: 'y'
}
});
registerShortcut({
name: 'core/block-editor/delete-multi-selection',
category: 'block',
description: (0,external_wp_i18n_namespaceObject.__)('Delete selection.'),
keyCombination: {
character: 'del'
},
aliases: [{
character: 'backspace'
}]
});
registerShortcut({
name: 'core/block-editor/select-all',
category: 'selection',
description: (0,external_wp_i18n_namespaceObject.__)('Select all text when typing. Press again to select all blocks.'),
keyCombination: {
modifier: 'primary',
character: 'a'
}
});
registerShortcut({
name: 'core/block-editor/unselect',
category: 'selection',
description: (0,external_wp_i18n_namespaceObject.__)('Clear selection.'),
keyCombination: {
character: 'escape'
}
});
registerShortcut({
name: 'core/block-editor/multi-text-selection',
category: 'selection',
description: (0,external_wp_i18n_namespaceObject.__)('Select text across multiple blocks.'),
keyCombination: {
modifier: 'shift',
character: 'arrow'
}
});
registerShortcut({
name: 'core/block-editor/focus-toolbar',
category: 'global',
description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the nearest toolbar.'),
keyCombination: {
modifier: 'alt',
character: 'F10'
}
});
registerShortcut({
name: 'core/block-editor/move-up',
category: 'block',
description: (0,external_wp_i18n_namespaceObject.__)('Move the selected block(s) up.'),
keyCombination: {
modifier: 'secondary',
character: 't'
}
});
registerShortcut({
name: 'core/block-editor/move-down',
category: 'block',
description: (0,external_wp_i18n_namespaceObject.__)('Move the selected block(s) down.'),
keyCombination: {
modifier: 'secondary',
character: 'y'
}
});
}, [registerShortcut]);
return null;
}
KeyboardShortcuts.Register = KeyboardShortcutsRegister;
/* harmony default export */ const keyboard_shortcuts = (KeyboardShortcuts);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/provider/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */
const ExperimentalBlockEditorProvider = with_registry_provider(props => {
const {
children,
settings,
stripExperimentalSettings = false
} = props;
const {
__experimentalUpdateSettings
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
(0,external_wp_element_namespaceObject.useEffect)(() => {
__experimentalUpdateSettings({
...settings,
__internalIsInitialized: true
}, {
stripExperimentalSettings,
reset: true
});
}, [settings, stripExperimentalSettings, __experimentalUpdateSettings]);
// Syncs the entity provider with changes in the block-editor store.
useBlockSync(props);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.SlotFillProvider, {
passthrough: true
}, !settings?.__unstableIsPreviewMode && (0,external_React_.createElement)(keyboard_shortcuts.Register, null), (0,external_React_.createElement)(BlockRefsProvider, null, children));
});
const BlockEditorProvider = props => {
return (0,external_React_.createElement)(ExperimentalBlockEditorProvider, {
...props,
stripExperimentalSettings: true
}, props.children);
};
/* harmony default export */ const provider = (BlockEditorProvider);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-selection-clearer/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Pass the returned ref callback to an element that should clear block
* selection. Selection will only be cleared if the element is clicked directly,
* not if a child element is clicked.
*
* @return {import('react').RefCallback} Ref callback.
*/
function useBlockSelectionClearer() {
const {
getSettings,
hasSelectedBlock,
hasMultiSelection
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
clearSelectedBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const {
clearBlockSelection: isEnabled
} = getSettings();
return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
if (!isEnabled) {
return;
}
function onMouseDown(event) {
if (!hasSelectedBlock() && !hasMultiSelection()) {
return;
}
// Only handle clicks on the element, not the children.
if (event.target !== node) {
return;
}
clearSelectedBlock();
}
node.addEventListener('mousedown', onMouseDown);
return () => {
node.removeEventListener('mousedown', onMouseDown);
};
}, [hasSelectedBlock, hasMultiSelection, clearSelectedBlock, isEnabled]);
}
function BlockSelectionClearer(props) {
return (0,external_React_.createElement)("div", {
ref: useBlockSelectionClearer(),
...props
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-multi-selection.js
/**
* 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, []);
/**
* 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) {
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 removal.
node.focus();
defaultView.getSelection().removeAllRanges();
}, [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 {
hasMultiSelection,
getSelectedBlockClientId,
getBlockCount
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
setNavigationMode,
setLastFocus
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
const isNavigationMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isNavigationMode(), []);
const {
getLastFocus
} = unlock((0,external_wp_data_namespaceObject.useSelect)(store));
// 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()) {
getLastFocus()?.current.focus();
} else {
setNavigationMode(true);
const canvasElement = container.current.ownerDocument === event.target.ownerDocument ? container.current : container.current.ownerDocument.defaultView.frameElement;
const isBefore =
// eslint-disable-next-line no-bitwise
event.target.compareDocumentPosition(canvasElement) & event.target.DOCUMENT_POSITION_FOLLOWING;
const tabbables = external_wp_dom_namespaceObject.focus.tabbable.find(container.current);
if (tabbables.length) {
const next = isBefore ? tabbables[0] : tabbables[tabbables.length - 1];
next.focus();
}
}
}
const before = (0,external_React_.createElement)("div", {
ref: focusCaptureBeforeRef,
tabIndex: focusCaptureTabIndex,
onFocus: onFocusCapture
});
const after = (0,external_React_.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;
}
const nextTabbable = external_wp_dom_namespaceObject.focus.tabbable[direction](event.target);
// We want to constrain the tabbing to the block and its child blocks.
// If the preceding form element is within a different block,
// such as two sibling image blocks in the placeholder state,
// we want shift + tab from the first form element to move to the image
// block toolbar and not the previous image block's form element.
const currentBlock = event.target.closest('[data-block]');
const isElementPartOfSelectedBlock = currentBlock && nextTabbable && (isInSameBlock(currentBlock, nextTabbable) || isInsideRootBlock(currentBlock, nextTabbable));
// Allow tabbing from the block wrapper to a form element,
// and between form elements rendered in a block and its child blocks,
// 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)(nextTabbable) && isElementPartOfSelectedBlock) {
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) {
setLastFocus({
...getLastFocus(),
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) {
if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) {
return;
}
if (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
/**
* 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;
const {
tagName
} = element;
const elementType = element.getAttribute('type');
// Native inputs should not navigate vertically, unless they are simple types that don't need up/down arrow keys.
if (isVertical && !hasModifier) {
if (tagName === 'INPUT') {
const verticalInputTypes = ['date', 'datetime-local', 'month', 'number', 'range', 'time', 'week'];
return !verticalInputTypes.includes(elementType);
}
return true;
}
// Native inputs should not navigate horizontally, unless they are simple types that don't need left/right arrow keys.
if (tagName === 'INPUT') {
const simpleInputTypes = ['button', 'checkbox', 'number', 'color', 'file', 'image', 'radio', 'reset', 'submit'];
return simpleInputTypes.includes(elementType);
}
// Native textareas should not navigate horizontally.
return 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.reverse();
}
// 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) {
if (node.closest('[inert]')) {
return;
}
// Skip if there's only one child that is content editable (and thus a
// better candidate).
if (node.children.length === 1 && isInSameBlock(node, node.firstElementChild) && node.firstElementChild.getAttribute('contenteditable') === 'true') {
return;
}
// 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 focusableNodes.find(isTabCandidate);
}
function useArrowNav() {
const {
getMultiSelectedBlocksStartClientId,
getMultiSelectedBlocksEndClientId,
getSettings,
hasMultiSelection,
__unstableIsFullySelected
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(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;
}
function isClosestTabbableABlock(target, isReverse) {
const closestTabbable = getClosestTabbable(target, isReverse, node);
return closestTabbable && getBlockClientId(closestTabbable);
}
function onKeyDown(event) {
// Abort if navigation has already been handled (e.g. RichText
// inline boundaries).
if (event.defaultPrevented) {
return;
}
const {
keyCode,
target,
shiftKey,
ctrlKey,
altKey,
metaKey
} = 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 hasModifier = shiftKey || ctrlKey || altKey || metaKey;
const isNavEdge = isVertical ? external_wp_dom_namespaceObject.isVerticalEdge : external_wp_dom_namespaceObject.isHorizontalEdge;
const {
ownerDocument
} = node;
const {
defaultView
} = ownerDocument;
if (!isNav) {
return;
}
// If there is a multi-selection, the arrow keys should collapse the
// selection to the start or end of the selection.
if (hasMultiSelection()) {
if (shiftKey) {
return;
}
// Only handle if we have a full selection (not a native partial
// selection).
if (!__unstableIsFullySelected()) {
return;
}
event.preventDefault();
if (isReverse) {
selectBlock(getMultiSelectedBlocksStartClientId());
} else {
selectBlock(getMultiSelectedBlocksEndClientId(), -1);
}
return;
}
// Abort if our current target is not a candidate for navigation
// (e.g. preserve native input behaviors).
if (!isNavigationCandidate(target, keyCode, hasModifier)) {
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);
}
// 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();
if (shiftKey) {
if (isClosestTabbableABlock(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) && (
// When Alt is pressed, only intercept if the caret is also at
// the horizontal edge.
altKey ? (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) : true) && !keepCaretInsideBlock) {
const closestTabbable = getClosestTabbable(target, isReverse, node, true);
if (closestTabbable) {
(0,external_wp_dom_namespaceObject.placeCaretAtVerticalEdge)(closestTabbable,
// When Alt is pressed, place the caret at the furthest
// horizontal edge and the furthest vertical edge.
altKey ? !isReverse : isReverse, altKey ? undefined : 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);
};
}, []);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-select-all.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useSelectAll() {
const {
getBlockOrder,
getSelectedBlockClientIds,
getBlockRootClientId
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
multiSelect,
selectBlock
} = (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;
}
event.preventDefault();
const [firstSelectedClientId] = selectedClientIds;
const rootClientId = getBlockRootClientId(firstSelectedClientId);
const 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) {
if (rootClientId) {
node.ownerDocument.defaultView.getSelection().removeAllRanges();
selectBlock(rootClientId);
}
return;
}
multiSelect(blockClientIds[0], blockClientIds[blockClientIds.length - 1]);
}
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,
hasSelectedBlock,
isDraggingBlocks,
isMultiSelecting
} = (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 (!hasSelectedBlock()) {
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 range = selection.getRangeAt(0);
const {
commonAncestorContainer
} = range;
const clonedRange = range.cloneRange();
if (anchorElement.contains(commonAncestorContainer)) {
anchorElement.focus();
selection.removeAllRanges();
selection.addRange(clonedRange);
}
}
});
}
function onMouseLeave({
buttons,
target,
relatedTarget
}) {
// If we're moving into a child element, ignore. We're tracking
// the mouse leaving the element to a parent, no a child.
if (target.contains(relatedTarget)) {
return;
}
// Avoid triggering a multi-selection if the user is already
// dragging blocks.
if (isDraggingBlocks()) {
return;
}
// 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;
}
// Abort if we are already multi-selecting.
if (isMultiSelecting()) {
return;
}
// Abort if selection is leaving writing flow.
if (node === target) {
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') !== 'true') {
return;
}
if (!isSelectionEnabled()) {
return;
}
// Do not rely on the active element because it may change after
// the mouse leaves for the first time. See
// https://github.com/WordPress/gutenberg/issues/48747.
anchorElement = target;
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, hasSelectedBlock]);
}
;// 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;
}
if (anchorOffset === 0) {
return anchorNode;
}
return anchorNode.childNodes[anchorOffset - 1];
}
/**
* 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;
}
if (focusOffset === focusNode.childNodes.length) {
return focusNode;
}
return focusNode.childNodes[focusOffset];
}
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) {
// Since we are calling this on every selection change, check if the value
// needs to be updated first because it trigger the browser to recalculate
// style.
if (node.contentEditable !== String(value)) {
node.contentEditable = value;
// Firefox doesn't automatically move focus.
if (value) {
node.focus();
}
}
}
function getRichTextElement(node) {
const element = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement;
return element?.closest('[data-wp-block-attribute-key]');
}
/**
* 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,
isMultiSelecting
} = (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 (!selection.rangeCount) {
return;
}
const startNode = extractSelectionStartNode(selection);
const endNode = extractSelectionEndNode(selection);
if (!node.contains(startNode) || !node.contains(endNode)) {
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) {
if (node.contentEditable === 'true' && !isMultiSelecting()) {
use_selection_observer_setContentEditableWrapper(node, false);
let element = startNode.nodeType === startNode.ELEMENT_NODE ? startNode : startNode.parentElement;
element = element?.closest('[contenteditable]');
element?.focus();
}
return;
}
let startClientId = getBlockClientId(startNode);
let endClientId = getBlockClientId(endNode);
// 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) {
if (!isMultiSelecting()) {
selectBlock(startClientId);
} else {
multiSelect(startClientId, startClientId);
}
} else {
const startPath = [...getBlockParents(startClientId), startClientId];
const endPath = [...getBlockParents(endClientId), endClientId];
const depth = findDepth(startPath, endPath);
if (startPath[depth] !== startClientId || endPath[depth] !== endClientId) {
multiSelect(startPath[depth], endPath[depth]);
return;
}
const richTextElementStart = getRichTextElement(startNode);
const richTextElementEnd = getRichTextElement(endNode);
if (richTextElementStart && richTextElementEnd) {
var _richTextDataStart$st, _richTextDataEnd$star;
const range = selection.getRangeAt(0);
const richTextDataStart = (0,external_wp_richText_namespaceObject.create)({
element: richTextElementStart,
range,
__unstableIsEditableTree: true
});
const richTextDataEnd = (0,external_wp_richText_namespaceObject.create)({
element: richTextElementEnd,
range,
__unstableIsEditableTree: true
});
const startOffset = (_richTextDataStart$st = richTextDataStart.start) !== null && _richTextDataStart$st !== void 0 ? _richTextDataStart$st : richTextDataStart.end;
const endOffset = (_richTextDataEnd$star = richTextDataEnd.start) !== null && _richTextDataEnd$star !== void 0 ? _richTextDataEnd$star : richTextDataEnd.end;
selectionChange({
start: {
clientId: startClientId,
attributeKey: richTextElementStart.dataset.wpBlockAttributeKey,
offset: startOffset
},
end: {
clientId: endClientId,
attributeKey: richTextElementEnd.dataset.wpBlockAttributeKey,
offset: endOffset
}
});
} else {
multiSelect(startClientId, endClientId);
}
}
}
ownerDocument.addEventListener('selectionchange', onSelectionChange);
defaultView.addEventListener('mouseup', onSelectionChange);
return () => {
ownerDocument.removeEventListener('selectionchange', onSelectionChange);
defaultView.removeEventListener('mouseup', onSelectionChange);
};
}, [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
} = (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 onBeforeInput(event) {
// If writing flow is editable, NEVER allow the browser to alter the
// DOM. This will cause React errors (and the DOM should only be
// altered in a controlled fashion).
if (node.contentEditable === 'true') {
event.preventDefault();
}
}
function onKeyDown(event) {
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('beforeinput', onBeforeInput);
node.addEventListener('keydown', onKeyDown);
node.addEventListener('compositionstart', onCompositionStart);
return () => {
node.removeEventListener('beforeinput', onBeforeInput);
node.removeEventListener('keydown', onKeyDown);
node.removeEventListener('compositionstart', onCompositionStart);
};
}, []);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/use-notify-copy.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) {
const clientId = selectedBlockClientIds[0];
const title = getBlockType(getBlockName(clientId))?.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'
});
}, []);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/pasting.js
/**
* WordPress dependencies
*/
/**
* Normalizes a given string of HTML to remove the Windows-specific "Fragment"
* comments and any preceding and trailing content.
*
* @param {string} html the html to be normalized
* @return {string} the normalized html
*/
function removeWindowsFragments(html) {
const startStr = '<!--StartFragment-->';
const startIdx = html.indexOf(startStr);
if (startIdx > -1) {
html = html.substring(startIdx + startStr.length);
} else {
// No point looking for EndFragment
return html;
}
const endStr = '<!--EndFragment-->';
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 = `<meta charset='utf-8'>`;
if (html.startsWith(metaTag)) {
return html.slice(metaTag.length);
}
return html;
}
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;
}
}
// Remove Windows-specific metadata appended within copied HTML text.
html = removeWindowsFragments(html);
// Strip meta tag.
html = removeCharsetMetaTag(html);
const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(clipboardData);
if (files.length && !shouldDismissPastedFiles(files, html)) {
return {
files
};
}
return {
html,
plainText,
files: []
};
}
/**
* 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?.length === 1 && files[0].type.indexOf('image/') === 0) {
// A single <img> tag found in the HTML source suggests that the
// content being pasted revolves around an image. Sometimes there are
// other elements found, like <figure>, but we assume that the user's
// intention is to paste the actual image file.
const IMAGE_TAG = /<\s*img\b/gi;
if (html.match(IMAGE_TAG)?.length !== 1) return true;
// Even when there is exactly one <img> tag in the HTML payload, we
// choose to weed out local images, i.e. those whose source starts with
// "file://". These payloads occur in specific configurations, such as
// when copying an entire document from Microsoft Word, that contains
// text and exactly one image, and pasting that content using Google
// Chrome.
const IMG_WITH_LOCAL_SRC = /<\s*img\b[^>]*\bsrc="file:\/\//i;
if (html.match(IMG_WITH_LOCAL_SRC)) return true;
}
return false;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const requiresWrapperOnCopy = Symbol('requiresWrapperOnCopy');
/**
* Sets the clipboard data for the provided blocks, with both HTML and plain
* text representations.
*
* @param {ClipboardEvent} event Clipboard event.
* @param {WPBlock[]} blocks Blocks to set as clipboard data.
* @param {Object} registry The registry to select from.
*/
function setClipboardBlocks(event, blocks, registry) {
let _blocks = blocks;
const [firstBlock] = blocks;
if (firstBlock) {
const firstBlockType = registry.select(external_wp_blocks_namespaceObject.store).getBlockType(firstBlock.name);
if (firstBlockType[requiresWrapperOnCopy]) {
const {
getBlockRootClientId,
getBlockName,
getBlockAttributes
} = registry.select(store);
const wrapperBlockClientId = getBlockRootClientId(firstBlock.clientId);
const wrapperBlockName = getBlockName(wrapperBlockClientId);
if (wrapperBlockName) {
_blocks = (0,external_wp_blocks_namespaceObject.createBlock)(wrapperBlockName, getBlockAttributes(wrapperBlockClientId), _blocks);
}
}
}
const serialized = (0,external_wp_blocks_namespaceObject.serialize)(_blocks);
event.clipboardData.setData('text/plain', toPlainText(serialized));
event.clipboardData.setData('text/html', serialized);
}
/**
* Returns the blocks to be pasted from the clipboard event.
*
* @param {ClipboardEvent} event The clipboard event.
* @param {boolean} canUserUseUnfilteredHTML Whether the user can or can't post unfiltered HTML.
* @return {Array|string} A list of blocks or a string, depending on `handlerMode`.
*/
function getPasteBlocks(event, canUserUseUnfilteredHTML) {
const {
plainText,
html,
files
} = getPasteEventData(event);
let blocks = [];
if (files.length) {
const fromTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from');
blocks = files.reduce((accumulator, file) => {
const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(fromTransforms, transform => transform.type === 'files' && transform.isMatch([file]));
if (transformation) {
accumulator.push(transformation.transform([file]));
}
return accumulator;
}, []).flat();
} else {
blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({
HTML: html,
plainText,
mode: 'BLOCKS',
canUserUseUnfilteredHTML
});
}
return blocks;
}
/**
* Given a string of HTML representing serialized blocks, returns the plain
* text extracted after stripping the HTML of any tags and fixing line breaks.
*
* @param {string} html Serialized blocks.
* @return {string} The plain-text content with any html removed.
*/
function toPlainText(html) {
// Manually handle BR tags as line breaks prior to `stripHTML` call
html = html.replace(/<br>/g, '\n');
const plainText = (0,external_wp_dom_namespaceObject.__unstableStripHTML)(html).trim();
// Merge any consecutive line breaks
return plainText.replace(/\n\n+/g, '\n\n');
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-clipboard-handler.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useClipboardHandler() {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
getBlocksByClientId,
getSelectedBlockClientIds,
hasMultiSelection,
getSettings,
__unstableIsFullySelected,
__unstableIsSelectionCollapsed,
__unstableIsSelectionMergeable,
__unstableGetSelectedBlocksWithPartialSelection,
canInsertBlockType
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
flashBlock,
removeBlocks,
replaceBlocks,
__unstableDeleteSelection,
__unstableExpandSelection,
insertBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const notifyCopy = useNotifyCopy();
return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
function handler(event) {
if (event.defaultPrevented) {
// This was likely already handled in rich-text/use-paste-handler.js.
return;
}
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;
}
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];
}
setClipboardBlocks(event, blocks, registry);
}
}
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 {
event.target.ownerDocument.activeElement.contentEditable = false;
__unstableDeleteSelection();
}
} else if (event.type === 'paste') {
const {
__experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML
} = getSettings();
const blocks = getPasteBlocks(event, canUserUseUnfilteredHTML);
if (selectedBlockClientIds.length === 1) {
const [selectedBlockClientId] = selectedBlockClientIds;
if (blocks.every(block => canInsertBlockType(block.name, selectedBlockClientId))) {
insertBlocks(blocks, undefined, selectedBlockClientId);
return;
}
}
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);
};
}, []);
}
;// 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, useClipboardHandler(), useInput(), useDragSelection(), useSelectionObserver(), useClickSelection(), useMultiSelection(), useSelectAll(), useArrowNav(), (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
node.tabIndex = 0;
if (!hasMultiSelection) {
return;
}
node.classList.add('has-multi-selection');
node.setAttribute('aria-label', (0,external_wp_i18n_namespaceObject.__)('Multiple selected blocks'));
return () => {
node.classList.remove('has-multi-selection');
node.removeAttribute('aria-label');
};
}, [hasMultiSelection])]), after];
}
function WritingFlow({
children,
...props
}, forwardedRef) {
const [before, ref, after] = useWritingFlow();
return (0,external_React_.createElement)(external_React_.Fragment, null, before, (0,external_React_.createElement)("div", {
...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 {Element} props.children Children to be rendered.
*/
/* harmony default export */ const writing_flow = ((0,external_wp_element_namespaceObject.forwardRef)(WritingFlow));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/iframe/get-compatibility-styles.js
let compatibilityStyles = null;
/**
* Returns a list of stylesheets that target the editor canvas. 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 getCompatibilityStyles() {
if (compatibilityStyles) {
return compatibilityStyles;
}
// Only memoize the result once on load, since these stylesheets should not
// change.
compatibilityStyles = Array.from(document.styleSheets).reduce((accumulator, styleSheet) => {
try {
// May fail for external styles.
// eslint-disable-next-line no-unused-expressions
styleSheet.cssRules;
} catch (e) {
return accumulator;
}
const {
ownerNode,
cssRules
} = styleSheet;
// Stylesheet is added by another stylesheet. See
// https://developer.mozilla.org/en-US/docs/Web/API/StyleSheet/ownerNode#notes.
if (ownerNode === null) {
return accumulator;
}
if (!cssRules) {
return accumulator;
}
// 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 accumulator;
}
// Don't try to add styles without ID. Styles enqueued via the WP dependency system will always have IDs.
if (!ownerNode.id) {
return accumulator;
}
function matchFromRules(_cssRules) {
return Array.from(_cssRules).find(({
selectorText,
conditionText,
cssRules: __cssRules
}) => {
// If the rule is conditional then it will not have selector text.
// Recurse into child CSS ruleset to determine selector eligibility.
if (conditionText) {
return matchFromRules(__cssRules);
}
return selectorText && (selectorText.includes('.editor-styles-wrapper') || selectorText.includes('.wp-block'));
});
}
if (matchFromRules(cssRules)) {
const isInline = ownerNode.tagName === 'STYLE';
if (isInline) {
// If the current target is inline,
// it could be a dependency of an existing stylesheet.
// Look for that dependency and add it BEFORE the current target.
const mainStylesCssId = ownerNode.id.replace('-inline-css', '-css');
const mainStylesElement = document.getElementById(mainStylesCssId);
if (mainStylesElement) {
accumulator.push(mainStylesElement.cloneNode(true));
}
}
accumulator.push(ownerNode.cloneNode(true));
if (!isInline) {
// If the current target is not inline,
// we still look for inline styles that could be relevant for the current target.
// If they exist, add them AFTER the current target.
const inlineStylesCssId = ownerNode.id.replace('-css', '-inline-css');
const inlineStylesElement = document.getElementById(inlineStylesCssId);
if (inlineStylesElement) {
accumulator.push(inlineStylesElement.cloneNode(true));
}
}
}
return accumulator;
}, []);
return compatibilityStyles;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/iframe/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function bubbleEvent(event, Constructor, frame) {
const init = {};
for (const key in event) {
init[key] = event[key];
}
// Check if the event is a MouseEvent generated within the iframe.
// If so, adjust the coordinates to be relative to the position of
// the iframe. This ensures that components such as Draggable
// receive coordinates relative to the window, instead of relative
// to the iframe. Without this, the Draggable event handler would
// result in components "jumping" position as soon as the user
// drags over the iframe.
if (event instanceof frame.contentDocument.defaultView.MouseEvent) {
const rect = frame.getBoundingClientRect();
init.clientX += rect.left;
init.clientY += rect.top;
}
const newEvent = new Constructor(event.type, init);
if (init.defaultPrevented) {
newEvent.preventDefault();
}
const cancelled = !frame.dispatchEvent(newEvent);
if (cancelled) {
event.preventDefault();
}
}
/**
* 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} iframeDocument Document to attach listeners to.
*/
function useBubbleEvents(iframeDocument) {
return (0,external_wp_compose_namespaceObject.useRefEffect)(() => {
const {
defaultView
} = iframeDocument;
if (!defaultView) {
return;
}
const {
frameElement
} = defaultView;
const html = iframeDocument.documentElement;
const eventTypes = ['dragover', 'mousemove'];
const handlers = {};
for (const name of eventTypes) {
handlers[name] = event => {
const prototype = Object.getPrototypeOf(event);
const constructorName = prototype.constructor.name;
const Constructor = window[constructorName];
bubbleEvent(event, Constructor, frameElement);
};
html.addEventListener(name, handlers[name]);
}
return () => {
for (const name of eventTypes) {
html.removeEventListener(name, handlers[name]);
}
};
});
}
function Iframe({
contentRef,
children,
tabIndex = 0,
scale = 1,
frameSize = 0,
expand = false,
readonly,
forwardedRef: ref,
...props
}) {
const {
resolvedAssets,
isPreviewMode
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const settings = select(store).getSettings();
return {
resolvedAssets: settings.__unstableResolvedAssets,
isPreviewMode: settings.__unstableIsPreviewMode
};
}, []);
const {
styles = '',
scripts = ''
} = resolvedAssets;
const [iframeDocument, setIframeDocument] = (0,external_wp_element_namespaceObject.useState)();
const [bodyClasses, setBodyClasses] = (0,external_wp_element_namespaceObject.useState)([]);
const clearerRef = useBlockSelectionClearer();
const [before, writingFlowRef, after] = useWritingFlow();
const [contentResizeListener, {
height: contentHeight
}] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
const setRef = (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
node._load = () => {
setIframeDocument(node.contentDocument);
};
let iFrameDocument;
// Prevent the default browser action for files dropped outside of dropzones.
function preventFileDropDefault(event) {
event.preventDefault();
}
function onLoad() {
const {
contentDocument,
ownerDocument
} = node;
const {
documentElement
} = contentDocument;
iFrameDocument = 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;
for (const compatStyle of getCompatibilityStyles()) {
if (contentDocument.getElementById(compatStyle.id)) {
continue;
}
contentDocument.head.appendChild(compatStyle.cloneNode(true));
if (!isPreviewMode) {
// eslint-disable-next-line no-console
console.warn(`${compatStyle.id} was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`, compatStyle);
}
}
iFrameDocument.addEventListener('dragover', preventFileDropDefault, false);
iFrameDocument.addEventListener('drop', preventFileDropDefault, false);
}
node.addEventListener('load', onLoad);
return () => {
delete node._load;
node.removeEventListener('load', onLoad);
iFrameDocument?.removeEventListener('dragover', preventFileDropDefault);
iFrameDocument?.removeEventListener('drop', preventFileDropDefault);
};
}, []);
const disabledRef = (0,external_wp_compose_namespaceObject.useDisabled)({
isDisabled: !readonly
});
const bodyRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([useBubbleEvents(iframeDocument), contentRef, clearerRef, writingFlowRef, disabledRef]);
// Correct doctype is required to enable rendering in standards
// mode. Also preload the styles to avoid a flash of unstyled
// content.
const html = `<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script>window.frameElement._load()</script>
<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>
${styles}
${scripts}
</head>
<body>
<script>document.currentScript.parentElement.remove()</script>
</body>
</html>`;
const [src, cleanup] = (0,external_wp_element_namespaceObject.useMemo)(() => {
const _src = URL.createObjectURL(new window.Blob([html], {
type: 'text/html'
}));
return [_src, () => URL.revokeObjectURL(_src)];
}, [html]);
(0,external_wp_element_namespaceObject.useEffect)(() => cleanup, [cleanup]);
// We need to counter the margin created by scaling the iframe. If the scale
// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the
// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).
const marginFromScaling = contentHeight * (1 - scale) / 2;
return (0,external_React_.createElement)(external_React_.Fragment, null, tabIndex >= 0 && before, (0,external_React_.createElement)("iframe", {
...props,
style: {
border: 0,
...props.style,
height: expand ? contentHeight : props.style?.height,
marginTop: scale !== 1 ? -marginFromScaling + frameSize : props.style?.marginTop,
marginBottom: scale !== 1 ? -marginFromScaling + frameSize : props.style?.marginBottom,
transform: scale !== 1 ? `scale( ${scale} )` : props.style?.transform,
transition: 'all .3s'
},
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, setRef]),
tabIndex: tabIndex
// Correct doctype is required to enable rendering in standards
// mode. Also preload the styles to avoid a flash of unstyled
// content.
,
src: src,
title: (0,external_wp_i18n_namespaceObject.__)('Editor canvas'),
onKeyDown: event => {
if (props.onKeyDown) {
props.onKeyDown(event);
}
// If the event originates from inside the iframe, it means
// it bubbled through the portal, but only with React
// events. We need to to bubble native events as well,
// though by doing so we also trigger another React event,
// so we need to stop the propagation of this event to avoid
// duplication.
else if (event.currentTarget.ownerDocument !== event.target.ownerDocument) {
event.stopPropagation();
bubbleEvent(event, window.KeyboardEvent, event.currentTarget);
}
}
}, iframeDocument && (0,external_wp_element_namespaceObject.createPortal)(
// We want to prevent React events from bubbling throught the iframe
// we bubble these manually.
/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
(0,external_React_.createElement)("body", {
ref: bodyRef,
className: classnames_default()('block-editor-iframe__body', 'editor-styles-wrapper', ...bodyClasses)
}, contentResizeListener, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, {
document: iframeDocument
}, children)), iframeDocument.documentElement)), tabIndex >= 0 && after);
}
function IframeIfReady(props, ref) {
const isInitialised = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().__internalIsInitialized, []);
// We shouldn't render the iframe until the editor settings are initialised.
// The initial settings are needed to get the styles for the srcDoc, which
// cannot be changed after the iframe is mounted. srcDoc is used to to set
// the initial iframe HTML, which is required to avoid a flash of unstyled
// content.
if (!isInitialised) {
return null;
}
return (0,external_React_.createElement)(Iframe, {
...props,
forwardedRef: ref
});
}
/* harmony default export */ const iframe = ((0,external_wp_element_namespaceObject.forwardRef)(IframeIfReady));
// EXTERNAL MODULE: ./node_modules/postcss/lib/postcss.js
var postcss = __webpack_require__(4529);
;// CONCATENATED MODULE: ./node_modules/postcss/lib/postcss.mjs
/* harmony default export */ const lib_postcss = (postcss);
const stringify = postcss.stringify
const fromJSON = postcss.fromJSON
const postcss_plugin = postcss.plugin
const parse = postcss.parse
const list = postcss.list
const postcss_document = postcss.document
const comment = postcss.comment
const atRule = postcss.atRule
const rule = postcss.rule
const decl = postcss.decl
const root = postcss.root
const CssSyntaxError = postcss.CssSyntaxError
const Declaration = postcss.Declaration
const Container = postcss.Container
const Processor = postcss.Processor
const Document = postcss.Document
const Comment = postcss.Comment
const postcss_Warning = postcss.Warning
const AtRule = postcss.AtRule
const Result = postcss.Result
const Input = postcss.Input
const Rule = postcss.Rule
const Root = postcss.Root
const Node = postcss.Node
// EXTERNAL MODULE: ./node_modules/postcss-prefixwrap/build/index.js
var build = __webpack_require__(8036);
var build_default = /*#__PURE__*/__webpack_require__.n(build);
// EXTERNAL MODULE: ./node_modules/postcss-urlrebase/index.js
var postcss_urlrebase = __webpack_require__(5404);
var postcss_urlrebase_default = /*#__PURE__*/__webpack_require__.n(postcss_urlrebase);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/transform-styles/index.js
/**
* External dependencies
*/
const transformStylesCache = new WeakMap();
function transformStyle({
css,
ignoredSelectors = [],
baseURL
}, wrapperSelector = '') {
// When there is no wrapper selector or base URL, there is no need
// to transform the CSS. This is most cases because in the default
// iframed editor, no wrapping is needed, and not many styles
// provide a base URL.
if (!wrapperSelector && !baseURL) {
return css;
}
try {
return lib_postcss([wrapperSelector && build_default()(wrapperSelector, {
ignoredSelectors: [...ignoredSelectors, wrapperSelector]
}), baseURL && postcss_urlrebase_default()({
rootUrl: baseURL
})].filter(Boolean)).process(css, {}).css; // use sync PostCSS API
} catch (error) {
if (error instanceof CssSyntaxError) {
// eslint-disable-next-line no-console
console.warn('wp.blockEditor.transformStyles Failed to transform CSS.', error.message + '\n' + error.showSourceCode(false));
} else {
// eslint-disable-next-line no-console
console.warn('wp.blockEditor.transformStyles Failed to transform CSS.', error);
}
return null;
}
}
/**
* Applies a series of CSS rule transforms to wrap selectors inside a given class and/or rewrite URLs depending on the parameters passed.
*
* @typedef {Object} EditorStyle
* @property {string} css the CSS block(s), as a single string.
* @property {?string} baseURL the base URL to be used as the reference when rewritting urls.
* @property {?string[]} ignoredSelectors the selectors not to wrap.
*
* @param {EditorStyle[]} styles CSS rules.
* @param {string} wrapperSelector Wrapper selector.
* @return {Array} converted rules.
*/
const transform_styles_transformStyles = (styles, wrapperSelector = '') => {
return styles.map(style => {
if (transformStylesCache.has(style)) {
return transformStylesCache.get(style);
}
const transformedStyle = transformStyle(style, wrapperSelector);
transformStylesCache.set(style, transformedStyle);
return transformedStyle;
});
};
/* harmony default export */ const transform_styles = (transform_styles_transformStyles);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/editor-styles/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
k([names, a11y]);
function useDarkThemeBodyClassName(styles, scope) {
return (0,external_wp_element_namespaceObject.useCallback)(node => {
if (!node) {
return;
}
const {
ownerDocument
} = node;
const {
defaultView,
body
} = ownerDocument;
const canvas = scope ? ownerDocument.querySelector(scope) : body;
let backgroundColor;
if (!canvas) {
// The real .editor-styles-wrapper element might not exist in the
// DOM, so calculate the background color by creating a fake
// wrapper.
const tempCanvas = ownerDocument.createElement('div');
tempCanvas.classList.add('editor-styles-wrapper');
body.appendChild(tempCanvas);
backgroundColor = defaultView?.getComputedStyle(tempCanvas, null).getPropertyValue('background-color');
body.removeChild(tempCanvas);
} else {
backgroundColor = defaultView?.getComputedStyle(canvas, null).getPropertyValue('background-color');
}
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');
}
}, [styles, scope]);
}
function EditorStyles({
styles,
scope
}) {
const overrides = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getStyleOverrides(), []);
const [transformedStyles, transformedSvgs] = (0,external_wp_element_namespaceObject.useMemo)(() => {
const _styles = Object.values(styles !== null && styles !== void 0 ? styles : []);
for (const [id, override] of overrides) {
const index = _styles.findIndex(({
id: _id
}) => id === _id);
const overrideWithId = {
...override,
id
};
if (index === -1) {
_styles.push(overrideWithId);
} else {
_styles[index] = overrideWithId;
}
}
return [transform_styles(_styles.filter(style => style?.css), scope), _styles.filter(style => style.__unstableType === 'svgs').map(style => style.assets).join('')];
}, [styles, overrides, scope]);
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("style", {
ref: useDarkThemeBodyClassName(transformedStyles, scope)
}), transformedStyles.map((css, index) => (0,external_React_.createElement)("style", {
key: index
}, css)), (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 0 0",
width: "0",
height: "0",
role: "none",
style: {
visibility: 'hidden',
position: 'absolute',
left: '-9999px',
overflow: 'hidden'
},
dangerouslySetInnerHTML: {
__html: transformedSvgs
}
}));
}
;// 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;
const EMPTY_ADDITIONAL_STYLES = [];
function ScaledBlockPreview({
viewportWidth,
containerWidth,
minHeight,
additionalStyles = EMPTY_ADDITIONAL_STYLES
}) {
if (!viewportWidth) {
viewportWidth = containerWidth;
}
const [contentResizeListener, {
height: contentHeight
}] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
const {
styles
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const settings = select(store).getSettings();
return {
styles: settings.styles
};
}, []);
// Avoid scrollbars for pattern previews.
const editorStyles = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (styles) {
return [...styles, {
css: 'body{height:auto;overflow:hidden;border:none;padding:0;}',
__unstableType: 'presets'
}, ...additionalStyles];
}
return styles;
}, [styles, additionalStyles]);
// Initialize on render instead of module top level, to avoid circular dependency issues.
MemoizedBlockList = MemoizedBlockList || (0,external_wp_element_namespaceObject.memo)(BlockList);
const scale = containerWidth / viewportWidth;
const aspectRatio = contentHeight ? containerWidth / (contentHeight * scale) : 0;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Disabled, {
className: "block-editor-block-preview__content",
style: {
transform: `scale(${scale})`,
// Using width + aspect-ratio instead of height here triggers browsers' native
// handling of scrollbar's visibility. It prevents the flickering issue seen
// in https://github.com/WordPress/gutenberg/issues/52027.
// See https://github.com/WordPress/gutenberg/pull/52921 for more info.
aspectRatio,
maxHeight: contentHeight > MAX_HEIGHT ? MAX_HEIGHT * scale : undefined,
minHeight
}
}, (0,external_React_.createElement)(iframe, {
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%';
// Necessary for contentResizeListener to work.
bodyElement.style.boxSizing = 'border-box';
bodyElement.style.position = 'absolute';
bodyElement.style.width = '100%';
}, []),
"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 !== 0 && scale < 1 && minHeight ? minHeight / scale : minHeight
}
}, (0,external_React_.createElement)(EditorStyles, {
styles: editorStyles
}), contentResizeListener, (0,external_React_.createElement)(MemoizedBlockList, {
renderAppender: false
})));
}
function AutoBlockPreview(props) {
const [containerResizeListener, {
width: containerWidth
}] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
style: {
position: 'relative',
width: '100%',
height: 0
}
}, containerResizeListener), (0,external_React_.createElement)("div", {
className: "block-editor-block-preview__container"
}, !!containerWidth && (0,external_React_.createElement)(ScaledBlockPreview, {
...props,
containerWidth: containerWidth
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-preview/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockPreview({
blocks,
viewportWidth = 1200,
minHeight,
additionalStyles = [],
// Deprecated props:
__experimentalMinHeight,
__experimentalPadding
}) {
if (__experimentalMinHeight) {
minHeight = __experimentalMinHeight;
external_wp_deprecated_default()('The __experimentalMinHeight prop', {
since: '6.2',
version: '6.4',
alternative: 'minHeight'
});
}
if (__experimentalPadding) {
additionalStyles = [...additionalStyles, {
css: `body { padding: ${__experimentalPadding}px; }`
}];
external_wp_deprecated_default()('The __experimentalPadding prop of BlockPreview', {
since: '6.2',
version: '6.4',
alternative: 'additionalStyles'
});
}
const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings(), []);
const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({
...originalSettings,
focusMode: false,
// Disable "Spotlight mode".
__unstableIsPreviewMode: true
}), [originalSettings]);
const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]);
if (!blocks || blocks.length === 0) {
return null;
}
return (0,external_React_.createElement)(ExperimentalBlockEditorProvider, {
value: renderedBlocks,
settings: settings
}, (0,external_React_.createElement)(AutoBlockPreview, {
viewportWidth: viewportWidth,
minHeight: minHeight,
additionalStyles: additionalStyles
}));
}
/**
* 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 {Component} The component to be rendered.
*/
/* harmony default export */ const 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.layout Layout settings to be used in the preview.
*/
function useBlockPreview({
blocks,
props = {},
layout
}) {
const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings(), []);
const settings = (0,external_wp_element_namespaceObject.useMemo)(() => ({
...originalSettings,
styles: undefined,
// Clear styles included by the parent settings, as they are already output by the parent's EditorStyles.
focusMode: false,
// Disable "Spotlight mode".
__unstableIsPreviewMode: true
}), [originalSettings]);
const disabledRef = (0,external_wp_compose_namespaceObject.useDisabled)();
const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, disabledRef]);
const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]);
const children = (0,external_React_.createElement)(ExperimentalBlockEditorProvider, {
value: renderedBlocks,
settings: settings
}, (0,external_React_.createElement)(EditorStyles, null), (0,external_React_.createElement)(BlockListItems, {
renderAppender: false,
layout: layout
}));
return {
...props,
ref,
className: classnames_default()(props.className, 'block-editor-block-preview__live-content', 'components-disabled'),
children: blocks?.length ? children : null
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/preview-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function InserterPreviewPanel({
item
}) {
var _example$viewportWidt;
const {
name,
title,
icon,
description,
initialAttributes,
example
} = item;
const isReusable = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item);
const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!example) {
return (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes);
}
return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(name, {
attributes: {
...example.attributes,
...initialAttributes
},
innerBlocks: example.innerBlocks
});
}, [name, example, initialAttributes]);
return (0,external_React_.createElement)("div", {
className: "block-editor-inserter__preview-container"
}, (0,external_React_.createElement)("div", {
className: "block-editor-inserter__preview"
}, isReusable || example ? (0,external_React_.createElement)("div", {
className: "block-editor-inserter__preview-content"
}, (0,external_React_.createElement)(block_preview, {
blocks: blocks,
viewportWidth: (_example$viewportWidt = example?.viewportWidth) !== null && _example$viewportWidt !== void 0 ? _example$viewportWidt : 500,
additionalStyles: [{
css: 'body { padding: 24px; }'
}]
})) : (0,external_React_.createElement)("div", {
className: "block-editor-inserter__preview-content-missing"
}, (0,external_wp_i18n_namespaceObject.__)('No preview available.'))), !isReusable && (0,external_React_.createElement)(block_card, {
title: title,
icon: icon,
description: description
}));
}
/* harmony default export */ const preview_panel = (InserterPreviewPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/item.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
CompositeItemV2: CompositeItem
} = unlock(external_wp_components_namespaceObject.privateApis);
function InserterListboxItem({
isFirst,
as: Component,
children,
...props
}, ref) {
return (0,external_React_.createElement)(CompositeItem, {
ref: ref,
role: "option"
// Use the CompositeItem `accessibleWhenDisabled` prop
// over Button's `isFocusable`. The latter was shown to
// cause an issue with tab order in the inserter list.
,
accessibleWhenDisabled: true,
...props,
render: htmlProps => {
const propsWithTabIndex = {
...htmlProps,
tabIndex: isFirst ? 0 : htmlProps.tabIndex
};
if (Component) {
return (0,external_React_.createElement)(Component, {
...propsWithTabIndex
}, children);
}
if (typeof children === 'function') {
return children(propsWithTabIndex);
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
...propsWithTabIndex
}, children);
}
});
}
/* harmony default export */ const 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_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"
}));
/* harmony default export */ const 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,
isPattern,
fadeWhenDisabled
}) {
const patternLabel = isPattern && (0,external_wp_i18n_namespaceObject.__)('Pattern');
return (0,external_React_.createElement)("div", {
className: "block-editor-block-draggable-chip-wrapper"
}, (0,external_React_.createElement)("div", {
className: "block-editor-block-draggable-chip",
"data-testid": "block-draggable-chip"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
justify: "center",
className: "block-editor-block-draggable-chip__content"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, icon ? (0,external_React_.createElement)(block_icon, {
icon: icon
}) : patternLabel || (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_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(block_icon, {
icon: drag_handle
})), fadeWhenDisabled && (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
className: "block-editor-block-draggable-chip__disabled"
}, (0,external_React_.createElement)("span", {
className: "block-editor-block-draggable-chip__disabled-icon"
})))));
}
;// 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,
pattern
}) => {
const transferData = {
type: 'inserter',
blocks
};
const blockTypeIcon = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockType
} = select(external_wp_blocks_namespaceObject.store);
return blocks.length === 1 && getBlockType(blocks[0].name)?.icon;
}, [blocks]);
const {
startDragging,
stopDragging
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Draggable, {
__experimentalTransferDataType: "wp-blocks",
transferData: transferData,
onDragStart: event => {
startDragging();
const parsedBlocks = pattern?.type === INSERTER_PATTERN_TYPES.user && pattern?.syncStatus !== 'unsynced' ? [(0,external_wp_blocks_namespaceObject.createBlock)('core/block', {
ref: pattern.id
})] : blocks;
event.dataTransfer.setData('text/html', (0,external_wp_blocks_namespaceObject.serialize)(parsedBlocks));
},
onDragEnd: () => {
stopDragging();
},
__experimentalDragComponent: (0,external_React_.createElement)(BlockDraggableChip, {
count: blocks.length,
icon: icon || !pattern && blockTypeIcon,
isPattern: !!pattern
})
}, ({
onDraggableStart,
onDraggableEnd
}) => {
return children({
draggable: isEnabled,
onDragStart: isEnabled ? onDraggableStart : undefined,
onDragEnd: isEnabled ? onDraggableEnd : undefined
});
});
};
/* harmony default export */ const 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
*/
function InserterListItem({
className,
isFirst,
item,
onSelect,
onHover,
isDraggable,
...props
}) {
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)(() => [(0,external_wp_blocks_namespaceObject.createBlock)(item.name, item.initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(item.innerBlocks))], [item.name, item.initialAttributes, item.innerBlocks]);
const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item) && item.syncStatus !== 'unsynced' || (0,external_wp_blocks_namespaceObject.isTemplatePart)(item);
return (0,external_React_.createElement)(inserter_draggable_blocks, {
isEnabled: isDraggable && !item.isDisabled,
blocks: blocks,
icon: item.icon
}, ({
draggable,
onDragStart,
onDragEnd
}) => (0,external_React_.createElement)("div", {
className: classnames_default()('block-editor-block-types-list__list-item', {
'is-synced': isSynced
}),
draggable: draggable,
onDragStart: event => {
isDragging.current = true;
if (onDragStart) {
onHover(null);
onDragStart(event);
}
},
onDragEnd: event => {
isDragging.current = false;
if (onDragEnd) {
onDragEnd(event);
}
}
}, (0,external_React_.createElement)(inserter_listbox_item, {
isFirst: isFirst,
className: classnames_default()('block-editor-block-types-list__item', className),
disabled: item.isDisabled,
onClick: event => {
event.preventDefault();
onSelect(item, (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey);
onHover(null);
},
onKeyDown: event => {
const {
keyCode
} = event;
if (keyCode === external_wp_keycodes_namespaceObject.ENTER) {
event.preventDefault();
onSelect(item, (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? event.metaKey : event.ctrlKey);
onHover(null);
}
},
onMouseEnter: () => {
if (isDragging.current) {
return;
}
onHover(item);
},
onMouseLeave: () => onHover(null),
...props
}, (0,external_React_.createElement)("span", {
className: "block-editor-block-types-list__item-icon",
style: itemIconStyle
}, (0,external_React_.createElement)(block_icon, {
icon: item.icon,
showColors: true
})), (0,external_React_.createElement)("span", {
className: "block-editor-block-types-list__item-title"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
numberOfLines: 3
}, item.title)))));
}
/* harmony default export */ const 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_React_.createElement)("div", {
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 */ const 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
*/
const {
CompositeGroupV2: CompositeGroup
} = unlock(external_wp_components_namespaceObject.privateApis);
function InserterListboxRow(props, ref) {
return (0,external_React_.createElement)(CompositeGroup, {
role: "presentation",
ref: ref,
...props
});
}
/* harmony default export */ const 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({
items = [],
onSelect,
onHover = () => {},
children,
label,
isDraggable = true
}) {
const className = 'block-editor-block-types-list';
const listId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockTypesList, className);
return (0,external_React_.createElement)(group, {
className: className,
"aria-label": label
}, chunk(items, 3).map((row, i) => (0,external_React_.createElement)(inserter_listbox_row, {
key: i
}, row.map((item, j) => (0,external_React_.createElement)(inserter_list_item, {
key: item.id,
item: item,
className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(item.id),
onSelect: onSelect,
onHover: onHover,
isDraggable: isDraggable && !item.isDisabled,
isFirst: i === 0 && j === 0,
rowId: `${listId}-${i}`
})))), children);
}
/* harmony default export */ const 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 (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
className: "block-editor-inserter__panel-header"
}, (0,external_React_.createElement)("h2", {
className: "block-editor-inserter__panel-title"
}, title), (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
icon: icon
})), (0,external_React_.createElement)("div", {
className: "block-editor-inserter__panel-content"
}, children));
}
/* harmony default export */ const panel = (InserterPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter-listbox/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
CompositeV2: Composite,
useCompositeStoreV2: useCompositeStore
} = unlock(external_wp_components_namespaceObject.privateApis);
function InserterListbox({
children
}) {
const store = useCompositeStore({
focusShift: true,
focusWrap: 'horizontal'
});
return (0,external_React_.createElement)(Composite, {
store: store,
render: (0,external_React_.createElement)(external_React_.Fragment, null)
}, children);
}
/* harmony default export */ const inserter_listbox = (InserterListbox);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-types-tab.js
/**
* 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({
rootClientId,
onInsert,
onHover,
showMostUsedBlocks
}) {
const [items, categories, collections, onSelectItem] = use_block_types_state(rootClientId, onInsert);
const suggestedItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
return 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_wp_compose_namespaceObject.pipe)(itemList => itemList.filter(item => item.category && item.category !== 'reusable'), itemList => itemList.reduce((acc, item) => {
const {
category
} = item;
if (!acc[category]) {
acc[category] = [];
}
acc[category].push(item);
return acc;
}, {}))(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_React_.createElement)(inserter_listbox, null, (0,external_React_.createElement)("div", null, showMostUsedBlocks && !!suggestedItems.length && (0,external_React_.createElement)(panel, {
title: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks')
}, (0,external_React_.createElement)(block_types_list, {
items: suggestedItems,
onSelect: onSelectItem,
onHover: onHover,
label: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks')
})), currentlyRenderedCategories.map(category => {
const categoryItems = itemsPerCategory[category.slug];
if (!categoryItems || !categoryItems.length) {
return null;
}
return (0,external_React_.createElement)(panel, {
key: category.slug,
title: category.title,
icon: category.icon
}, (0,external_React_.createElement)(block_types_list, {
items: categoryItems,
onSelect: onSelectItem,
onHover: onHover,
label: category.title
}));
}), didRenderAllCategories && uncategorizedItems.length > 0 && (0,external_React_.createElement)(panel, {
className: "block-editor-inserter__uncategorized-blocks-panel",
title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized')
}, (0,external_React_.createElement)(block_types_list, {
items: uncategorizedItems,
onSelect: onSelectItem,
onHover: onHover,
label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized')
})), currentlyRenderedCollections.map(([namespace, collection]) => {
const collectionItems = itemsPerCollection[namespace];
if (!collectionItems || !collectionItems.length) {
return null;
}
return (0,external_React_.createElement)(panel, {
key: namespace,
title: collection.title,
icon: collection.icon
}, (0,external_React_.createElement)(block_types_list, {
items: collectionItems,
onSelect: onSelectItem,
onHover: onHover,
label: collection.title
}));
})));
}
/* harmony default export */ const block_types_tab = (BlockTypesTab);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js
/**
* WordPress dependencies
*/
function PatternCategoriesList({
selectedCategory,
patternCategories,
onClickCategory
}) {
const baseClassName = 'block-editor-block-patterns-explorer__sidebar';
return (0,external_React_.createElement)("div", {
className: `${baseClassName}__categories-list`
}, patternCategories.map(({
name,
label
}) => {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
key: name,
label: label,
className: `${baseClassName}__categories-list__item`,
isPressed: selectedCategory === name,
onClick: () => {
onClickCategory(name);
}
}, label);
}));
}
function PatternsExplorerSearch({
searchValue,
setSearchValue
}) {
const baseClassName = 'block-editor-block-patterns-explorer__search';
return (0,external_React_.createElement)("div", {
className: baseClassName
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.SearchControl, {
__nextHasNoMarginBottom: true,
onChange: setSearchValue,
value: searchValue,
label: (0,external_wp_i18n_namespaceObject.__)('Search for patterns'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Search')
}));
}
function PatternExplorerSidebar({
selectedCategory,
patternCategories,
onClickCategory,
searchValue,
setSearchValue
}) {
const baseClassName = 'block-editor-block-patterns-explorer__sidebar';
return (0,external_React_.createElement)("div", {
className: baseClassName
}, (0,external_React_.createElement)(PatternsExplorerSearch, {
searchValue: searchValue,
setSearchValue: setSearchValue
}), !searchValue && (0,external_React_.createElement)(PatternCategoriesList, {
selectedCategory: selectedCategory,
patternCategories: patternCategories,
onClickCategory: onClickCategory
}));
}
/* harmony default export */ const pattern_explorer_sidebar = (PatternExplorerSidebar);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-paging/index.js
/**
* WordPress dependencies
*/
function Pagination({
currentPage,
numPages,
changePage,
totalItems
}) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
className: "block-editor-patterns__grid-pagination-wrapper"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
variant: "muted"
},
// translators: %s: Total number of patterns.
(0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Total number of patterns.
(0,external_wp_i18n_namespaceObject._n)('%s item', '%s items', totalItems), totalItems)), numPages > 1 && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
expanded: false,
spacing: 3,
justify: "flex-start",
className: "block-editor-patterns__grid-pagination"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
expanded: false,
spacing: 1,
className: "block-editor-patterns__grid-pagination-previous"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: () => changePage(1),
disabled: currentPage === 1,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('First page'),
__experimentalIsFocusable: true
}, (0,external_React_.createElement)("span", null, "\xAB")), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: () => changePage(currentPage - 1),
disabled: currentPage === 1,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Previous page'),
__experimentalIsFocusable: true
}, (0,external_React_.createElement)("span", null, "\u2039"))), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
variant: "muted"
}, (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1$s: Current page number, %2$s: Total number of pages.
(0,external_wp_i18n_namespaceObject._x)('%1$s of %2$s', 'paging'), currentPage, numPages)), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
expanded: false,
spacing: 1,
className: "block-editor-patterns__grid-pagination-next"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: () => changePage(currentPage + 1),
disabled: currentPage === numPages,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Next page'),
__experimentalIsFocusable: true
}, (0,external_React_.createElement)("span", null, "\u203A")), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: () => changePage(numPages),
disabled: currentPage === numPages,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Last page'),
size: "default",
__experimentalIsFocusable: true
}, (0,external_React_.createElement)("span", null, "\xBB")))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-patterns-list/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
CompositeV2: block_patterns_list_Composite,
CompositeItemV2: block_patterns_list_CompositeItem,
useCompositeStoreV2: block_patterns_list_useCompositeStore
} = unlock(external_wp_components_namespaceObject.privateApis);
const WithToolTip = ({
showTooltip,
title,
children
}) => {
if (showTooltip) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, {
text: title
}, children);
}
return (0,external_React_.createElement)(external_React_.Fragment, null, children);
};
function BlockPattern({
id,
isDraggable,
pattern,
onClick,
onHover,
showTooltip
}) {
const [isDragging, setIsDragging] = (0,external_wp_element_namespaceObject.useState)(false);
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_React_.createElement)(inserter_draggable_blocks, {
isEnabled: isDraggable,
blocks: blocks,
pattern: pattern
}, ({
draggable,
onDragStart,
onDragEnd
}) => (0,external_React_.createElement)("div", {
className: "block-editor-block-patterns-list__list-item",
draggable: draggable,
onDragStart: event => {
setIsDragging(true);
if (onDragStart) {
onHover?.(null);
onDragStart(event);
}
},
onDragEnd: event => {
setIsDragging(false);
if (onDragEnd) {
onDragEnd(event);
}
}
}, (0,external_React_.createElement)(WithToolTip, {
showTooltip: showTooltip && !pattern.type !== INSERTER_PATTERN_TYPES.user,
title: pattern.title
}, (0,external_React_.createElement)(block_patterns_list_CompositeItem, {
render: (0,external_React_.createElement)("div", {
role: "option",
"aria-label": pattern.title,
"aria-describedby": pattern.description ? descriptionId : undefined,
className: classnames_default()('block-editor-block-patterns-list__item', {
'block-editor-block-patterns-list__list-item-synced': pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus
})
}),
id: id,
onClick: () => {
onClick(pattern, blocks);
onHover?.(null);
},
onMouseEnter: () => {
if (isDragging) {
return;
}
onHover?.(pattern);
},
onMouseLeave: () => onHover?.(null)
}, (0,external_React_.createElement)(block_preview, {
blocks: blocks,
viewportWidth: viewportWidth
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
className: "block-editor-patterns__pattern-details"
}, pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus && (0,external_React_.createElement)("div", {
className: "block-editor-patterns__pattern-icon-wrapper"
}, (0,external_React_.createElement)(build_module_icon, {
className: "block-editor-patterns__pattern-icon",
icon: library_symbol
})), (!showTooltip || pattern.type === INSERTER_PATTERN_TYPES.user) && (0,external_React_.createElement)("div", {
className: "block-editor-block-patterns-list__item-title"
}, pattern.title)), !!pattern.description && (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
id: descriptionId
}, pattern.description)))));
}
function BlockPatternPlaceholder() {
return (0,external_React_.createElement)("div", {
className: "block-editor-block-patterns-list__item is-placeholder"
});
}
function BlockPatternsList({
isDraggable,
blockPatterns,
shownPatterns,
onHover,
onClickPattern,
orientation,
label = (0,external_wp_i18n_namespaceObject.__)('Block patterns'),
showTitlesAsTooltip,
pagingProps
}, ref) {
const compositeStore = block_patterns_list_useCompositeStore({
orientation
});
const {
setActiveId
} = compositeStore;
(0,external_wp_element_namespaceObject.useEffect)(() => {
// We reset the active composite item whenever the
// available patterns change, to make sure that
// focus is put back to the start.
setActiveId(undefined);
}, [setActiveId, shownPatterns, blockPatterns]);
return (0,external_React_.createElement)(block_patterns_list_Composite, {
store: compositeStore,
role: "listbox",
className: "block-editor-block-patterns-list",
"aria-label": label,
ref: ref
}, blockPatterns.map(pattern => {
const isShown = shownPatterns.includes(pattern);
return isShown ? (0,external_React_.createElement)(BlockPattern, {
key: pattern.name,
id: pattern.name,
pattern: pattern,
onClick: onClickPattern,
onHover: onHover,
isDraggable: isDraggable,
showTooltip: showTitlesAsTooltip
}) : (0,external_React_.createElement)(BlockPatternPlaceholder, {
key: pattern.name
});
}), pagingProps && (0,external_React_.createElement)(Pagination, {
...pagingProps
}));
}
/* harmony default export */ const block_patterns_list = ((0,external_wp_element_namespaceObject.forwardRef)(BlockPatternsList));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-insertion-point.js
/**
* 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,
selectBlockOnInsert = true
}) {
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)((blocks, meta, shouldForceFocusBlock = 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, selectBlockOnInsert, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta);
}
const blockLength = Array.isArray(blocks) ? blocks.length : 1;
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.', blockLength), blockLength);
(0,external_wp_a11y_namespaceObject.speak)(message);
if (onSelect) {
onSelect(blocks);
}
}, [isAppender, getSelectedBlock, replaceBlocks, insertBlocks, destinationRootClientId, destinationIndex, onSelect, shouldFocusBlock, selectBlockOnInsert]);
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 */ const use_insertion_point = (useInsertionPoint);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-state.js
/**
* 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,
userPatternCategories
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
__experimentalGetAllowedPatterns,
getSettings
} = select(store);
const {
__experimentalUserPatternCategories,
__experimentalBlockPatternCategories
} = getSettings();
return {
patterns: __experimentalGetAllowedPatterns(rootClientId),
userPatternCategories: __experimentalUserPatternCategories,
patternCategories: __experimentalBlockPatternCategories
};
}, [rootClientId]);
const allCategories = (0,external_wp_element_namespaceObject.useMemo)(() => {
const categories = [...patternCategories];
userPatternCategories?.forEach(userCategory => {
if (!categories.find(existingCategory => existingCategory.name === userCategory.name)) {
categories.push(userCategory);
}
});
return categories;
}, [patternCategories, userPatternCategories]);
const {
createSuccessNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const onClickPattern = (0,external_wp_element_namespaceObject.useCallback)((pattern, blocks) => {
const patternBlocks = pattern.type === INSERTER_PATTERN_TYPES.user && pattern.syncStatus !== 'unsynced' ? [(0,external_wp_blocks_namespaceObject.createBlock)('core/block', {
ref: pattern.id
})] : blocks;
onInsert((patternBlocks !== null && patternBlocks !== void 0 ? patternBlocks : []).map(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',
id: 'block-pattern-inserted-notice'
});
}, [createSuccessNotice, onInsert]);
return [patterns, allCategories, onClickPattern];
};
/* harmony default export */ const use_patterns_state = (usePatternsState);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/hooks/use-patterns-paging.js
/**
* WordPress dependencies
*/
const PAGE_SIZE = 20;
const INITIAL_INSERTER_RESULTS = 5;
/**
* Supplies values needed to page the patterns list client side.
*
* @param {Array} currentCategoryPatterns An array of the current patterns to display.
* @param {string} currentCategory The currently selected category.
* @param {Object} scrollContainerRef Ref of container to to find scroll container for when moving between pages.
* @param {string} currentFilter The currently search filter.
*
* @return {Object} Returns the relevant paging values. (totalItems, categoryPatternsList, numPages, changePage, currentPage)
*/
function usePatternsPaging(currentCategoryPatterns, currentCategory, scrollContainerRef, currentFilter = '') {
const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(1);
const previousCategory = (0,external_wp_compose_namespaceObject.usePrevious)(currentCategory);
const previousFilter = (0,external_wp_compose_namespaceObject.usePrevious)(currentFilter);
if ((previousCategory !== currentCategory || previousFilter !== currentFilter) && currentPage !== 1) {
setCurrentPage(1);
}
const totalItems = currentCategoryPatterns.length;
const pageIndex = currentPage - 1;
const categoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => {
return currentCategoryPatterns.slice(pageIndex * PAGE_SIZE, pageIndex * PAGE_SIZE + PAGE_SIZE);
}, [pageIndex, currentCategoryPatterns]);
const categoryPatternsAsyncList = (0,external_wp_compose_namespaceObject.useAsyncList)(categoryPatterns, {
step: INITIAL_INSERTER_RESULTS
});
const numPages = Math.ceil(currentCategoryPatterns.length / PAGE_SIZE);
const changePage = page => {
const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(scrollContainerRef?.current);
scrollContainer?.scrollTo(0, 0);
setCurrentPage(page);
};
(0,external_wp_element_namespaceObject.useEffect)(function scrollToTopOnCategoryChange() {
const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(scrollContainerRef?.current);
scrollContainer?.scrollTo(0, 0);
}, [currentCategory, scrollContainerRef]);
return {
totalItems,
categoryPatterns,
categoryPatternsAsyncList,
numPages,
changePage,
currentPage
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/pattern-list.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PatternsListHeader({
filterValue,
filteredBlockPatternsLength
}) {
if (!filterValue) {
return null;
}
return (0,external_React_.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. */
(0,external_wp_i18n_namespaceObject._n)('%d pattern found', '%d patterns found', filteredBlockPatternsLength), filteredBlockPatternsLength));
}
function PatternList({
searchValue,
selectedCategory,
patternCategories,
rootClientId
}) {
const container = (0,external_wp_element_namespaceObject.useRef)();
const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
const [destinationRootClientId, onInsertBlocks] = use_insertion_point({
rootClientId,
shouldFocusBlock: true
});
const [patterns,, onClickPattern] = 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)(() => {
const filteredPatterns = patterns.filter(pattern => {
if (selectedCategory === allPatternsCategory.name) {
return true;
}
if (selectedCategory === myPatternsCategory.name && pattern.type === INSERTER_PATTERN_TYPES.user) {
return true;
}
if (selectedCategory === 'uncategorized') {
const hasKnownCategory = pattern.categories.some(category => registeredPatternCategories.includes(category));
return !pattern.categories?.length || !hasKnownCategory;
}
return pattern.categories?.includes(selectedCategory);
});
if (!searchValue) {
return filteredPatterns;
}
return searchItems(filteredPatterns, searchValue);
}, [searchValue, patterns, selectedCategory, registeredPatternCategories]);
// Announce search results on change.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!searchValue) {
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);
}, [searchValue, debouncedSpeak, filteredBlockPatterns.length]);
const pagingProps = usePatternsPaging(filteredBlockPatterns, selectedCategory, container);
// Reset page when search value changes.
const [previousSearchValue, setPreviousSearchValue] = (0,external_wp_element_namespaceObject.useState)(searchValue);
if (searchValue !== previousSearchValue) {
setPreviousSearchValue(searchValue);
pagingProps.changePage(1);
}
const hasItems = !!filteredBlockPatterns?.length;
return (0,external_React_.createElement)("div", {
className: "block-editor-block-patterns-explorer__list",
ref: container
}, (0,external_React_.createElement)(PatternsListHeader, {
filterValue: searchValue,
filteredBlockPatternsLength: filteredBlockPatterns.length
}), (0,external_React_.createElement)(inserter_listbox, null, hasItems && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(block_patterns_list, {
shownPatterns: pagingProps.categoryPatternsAsyncList,
blockPatterns: pagingProps.categoryPatterns,
onClickPattern: onClickPattern,
isDraggable: false
}), (0,external_React_.createElement)(Pagination, {
...pagingProps
}))));
}
/* harmony default export */ const pattern_list = (PatternList);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function hasRegisteredCategory(pattern, allCategories) {
if (!pattern.categories || !pattern.categories.length) {
return false;
}
return pattern.categories.some(cat => allCategories.some(category => category.name === cat));
}
function usePatternCategories(rootClientId, sourceFilter = 'all') {
const [patterns, allCategories] = use_patterns_state(undefined, rootClientId);
const filteredPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => sourceFilter === 'all' ? patterns : patterns.filter(pattern => !isPatternFiltered(pattern, sourceFilter)), [sourceFilter, patterns]);
// Remove any empty categories.
const populatedCategories = (0,external_wp_element_namespaceObject.useMemo)(() => {
const categories = allCategories.filter(category => filteredPatterns.some(pattern => pattern.categories?.includes(category.name))).sort((a, b) => a.label.localeCompare(b.label));
if (filteredPatterns.some(pattern => !hasRegisteredCategory(pattern, allCategories)) && !categories.find(category => category.name === 'uncategorized')) {
categories.push({
name: 'uncategorized',
label: (0,external_wp_i18n_namespaceObject._x)('Uncategorized')
});
}
if (filteredPatterns.some(pattern => pattern.type === INSERTER_PATTERN_TYPES.user)) {
categories.unshift(myPatternsCategory);
}
if (filteredPatterns.length > 0) {
categories.unshift({
name: allPatternsCategory.name,
label: allPatternsCategory.label
});
}
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of categories . */
(0,external_wp_i18n_namespaceObject._n)('%d category button displayed.', '%d category buttons displayed.', categories.length), categories.length));
return categories;
}, [allCategories, filteredPatterns]);
return populatedCategories;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-explorer/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PatternsExplorer({
initialCategory,
rootClientId
}) {
const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)('');
const [patternSourceFilter, setPatternSourceFilter] = (0,external_wp_element_namespaceObject.useState)('all');
const [selectedCategory, setSelectedCategory] = (0,external_wp_element_namespaceObject.useState)(initialCategory?.name);
const patternCategories = usePatternCategories(rootClientId, patternSourceFilter);
return (0,external_React_.createElement)("div", {
className: "block-editor-block-patterns-explorer"
}, (0,external_React_.createElement)(pattern_explorer_sidebar, {
selectedCategory: selectedCategory,
patternCategories: patternCategories,
onClickCategory: setSelectedCategory,
searchValue: searchValue,
setSearchValue: setSearchValue,
patternSourceFilter: patternSourceFilter,
setPatternSourceFilter: setPatternSourceFilter
}), (0,external_React_.createElement)(pattern_list, {
searchValue: searchValue,
selectedCategory: selectedCategory,
patternCategories: patternCategories,
patternSourceFilter: patternSourceFilter,
rootClientId: rootClientId
}));
}
function PatternsExplorerModal({
onModalClose,
...restProps
}) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Patterns'),
onRequestClose: onModalClose,
isFullScreen: true
}, (0,external_React_.createElement)(PatternsExplorer, {
...restProps
}));
}
/* harmony default export */ const block_patterns_explorer = (PatternsExplorerModal);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/mobile-tab-navigation.js
/**
* WordPress dependencies
*/
function ScreenHeader({
title
}) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 0
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
marginBottom: 0,
paddingX: 4,
paddingY: 3
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
spacing: 2
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, {
style:
// TODO: This style override is also used in ToolsPanelHeader.
// It should be supported out-of-the-box by Button.
{
minWidth: 24,
padding: 0
},
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
isSmall: true,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view')
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
level: 5
}, title))))));
}
function MobileTabNavigation({
categories,
children
}) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
initialPath: "/",
className: "block-editor-inserter__mobile-tab-navigation"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
path: "/"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, categories.map(category => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
key: category.name,
path: `/category/${category.name}`,
as: external_wp_components_namespaceObject.__experimentalItem,
isAction: true
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, null, category.label), (0,external_React_.createElement)(build_module_icon, {
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
})))))), categories.map(category => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
key: category.name,
path: `/category/${category.name}`
}, (0,external_React_.createElement)(ScreenHeader, {
title: (0,external_wp_i18n_namespaceObject.__)('Back')
}), children(category))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/patterns-filter.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const getShouldDisableSyncFilter = sourceFilter => sourceFilter !== 'all';
const getShouldDisableNonUserSources = category => {
return category.name === myPatternsCategory.name;
};
function PatternsFilter({
setPatternSyncFilter,
setPatternSourceFilter,
patternSyncFilter,
patternSourceFilter,
scrollContainerRef,
category
}) {
// If the category is `myPatterns` then we need to set the source filter to `user`, but
// we do this by deriving from props rather than calling setPatternSourceFilter otherwise
// the user may be confused when switching to another category if the haven't explicity set
// this filter themselves.
const currentPatternSourceFilter = category.name === myPatternsCategory.name ? INSERTER_PATTERN_TYPES.user : patternSourceFilter;
// We need to disable the sync filter option if the source filter is not 'all' or 'user'
// otherwise applying them will just result in no patterns being shown.
const shouldDisableSyncFilter = getShouldDisableSyncFilter(currentPatternSourceFilter);
// We also need to disable the directory and theme source filter options if the category
// is `myPatterns` otherwise applying them will also just result in no patterns being shown.
const shouldDisableNonUserSources = getShouldDisableNonUserSources(category);
const patternSyncMenuOptions = (0,external_wp_element_namespaceObject.useMemo)(() => [{
value: 'all',
label: (0,external_wp_i18n_namespaceObject._x)('All', 'patterns')
}, {
value: INSERTER_SYNC_TYPES.full,
label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'patterns'),
disabled: shouldDisableSyncFilter
}, {
value: INSERTER_SYNC_TYPES.unsynced,
label: (0,external_wp_i18n_namespaceObject._x)('Not synced', 'patterns'),
disabled: shouldDisableSyncFilter
}], [shouldDisableSyncFilter]);
const patternSourceMenuOptions = (0,external_wp_element_namespaceObject.useMemo)(() => [{
value: 'all',
label: (0,external_wp_i18n_namespaceObject._x)('All', 'patterns'),
disabled: shouldDisableNonUserSources
}, {
value: INSERTER_PATTERN_TYPES.directory,
label: (0,external_wp_i18n_namespaceObject.__)('Pattern Directory'),
disabled: shouldDisableNonUserSources
}, {
value: INSERTER_PATTERN_TYPES.theme,
label: (0,external_wp_i18n_namespaceObject.__)('Theme & Plugins'),
disabled: shouldDisableNonUserSources
}, {
value: INSERTER_PATTERN_TYPES.user,
label: (0,external_wp_i18n_namespaceObject.__)('User')
}], [shouldDisableNonUserSources]);
function handleSetSourceFilterChange(newSourceFilter) {
setPatternSourceFilter(newSourceFilter);
if (getShouldDisableSyncFilter(newSourceFilter)) {
setPatternSyncFilter('all');
}
}
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
popoverProps: {
placement: 'right-end'
},
label: "Filter patterns",
icon: (0,external_React_.createElement)(build_module_icon, {
icon: (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Path, {
d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z",
fill: "#1E1E1E"
}))
})
}, () => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Source')
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
choices: patternSourceMenuOptions,
onSelect: value => {
handleSetSourceFilterChange(value);
scrollContainerRef.current?.scrollTo(0, 0);
},
value: currentPatternSourceFilter
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Type')
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
choices: patternSyncMenuOptions,
onSelect: value => {
setPatternSyncFilter(value);
scrollContainerRef.current?.scrollTo(0, 0);
},
value: patternSyncFilter
})), (0,external_React_.createElement)("div", {
className: "block-editor-tool-selector__help"
}, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Patterns are available from the <Link>WordPress.org Pattern Directory</Link>, bundled in the active theme, or created by users on this site. Only patterns created on this site can be synced.'), {
Link: (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, {
href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/patterns/')
})
})))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const pattern_category_previews_noop = () => {};
function PatternCategoryPreviews({
rootClientId,
onInsert,
onHover = pattern_category_previews_noop,
category,
showTitlesAsTooltip
}) {
const [allPatterns,, onClickPattern] = use_patterns_state(onInsert, rootClientId);
const [patternSyncFilter, setPatternSyncFilter] = (0,external_wp_element_namespaceObject.useState)('all');
const [patternSourceFilter, setPatternSourceFilter] = (0,external_wp_element_namespaceObject.useState)('all');
const availableCategories = usePatternCategories(rootClientId, patternSourceFilter);
const scrollContainerRef = (0,external_wp_element_namespaceObject.useRef)();
const currentCategoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => allPatterns.filter(pattern => {
if (isPatternFiltered(pattern, patternSourceFilter, patternSyncFilter)) {
return false;
}
if (category.name === allPatternsCategory.name) {
return true;
}
if (category.name === myPatternsCategory.name && pattern.type === INSERTER_PATTERN_TYPES.user) {
return true;
}
if (category.name === 'uncategorized') {
// The uncategorized category should show all the patterns without any category...
if (!pattern.categories) {
return true;
}
// ...or with no available category.
return !pattern.categories.some(catName => availableCategories.some(c => c.name === catName));
}
return pattern.categories?.includes(category.name);
}), [allPatterns, availableCategories, category.name, patternSourceFilter, patternSyncFilter]);
const pagingProps = usePatternsPaging(currentCategoryPatterns, category, scrollContainerRef);
const {
changePage
} = pagingProps;
// Hide block pattern preview on unmount.
// eslint-disable-next-line react-hooks/exhaustive-deps
(0,external_wp_element_namespaceObject.useEffect)(() => () => onHover(null), []);
const onSetPatternSyncFilter = (0,external_wp_element_namespaceObject.useCallback)(value => {
setPatternSyncFilter(value);
changePage(1);
}, [setPatternSyncFilter, changePage]);
const onSetPatternSourceFilter = (0,external_wp_element_namespaceObject.useCallback)(value => {
setPatternSourceFilter(value);
changePage(1);
}, [setPatternSourceFilter, changePage]);
return (0,external_React_.createElement)("div", {
className: "block-editor-inserter__patterns-category-panel"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 2,
className: "block-editor-inserter__patterns-category-panel-header"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
level: 4,
as: "div"
}, category.label)), (0,external_React_.createElement)(PatternsFilter, {
patternSyncFilter: patternSyncFilter,
patternSourceFilter: patternSourceFilter,
setPatternSyncFilter: onSetPatternSyncFilter,
setPatternSourceFilter: onSetPatternSourceFilter,
scrollContainerRef: scrollContainerRef,
category: category
})), !currentCategoryPatterns.length && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, {
variant: "muted",
className: "block-editor-inserter__patterns-category-no-results"
}, (0,external_wp_i18n_namespaceObject.__)('No results found'))), currentCategoryPatterns.length > 0 && (0,external_React_.createElement)(block_patterns_list, {
ref: scrollContainerRef,
shownPatterns: pagingProps.categoryPatternsAsyncList,
blockPatterns: pagingProps.categoryPatterns,
onClickPattern: onClickPattern,
onHover: onHover,
label: category.label,
orientation: "vertical",
category: category.name,
isDraggable: true,
showTitlesAsTooltip: showTitlesAsTooltip,
patternFilter: patternSourceFilter,
pagingProps: pagingProps
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockPatternsTab({
onSelectCategory,
selectedCategory,
onInsert,
rootClientId
}) {
const [showPatternsExplorer, setShowPatternsExplorer] = (0,external_wp_element_namespaceObject.useState)(false);
const categories = usePatternCategories(rootClientId);
const initialCategory = selectedCategory || categories[0];
const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
return (0,external_React_.createElement)(external_React_.Fragment, null, !isMobile && (0,external_React_.createElement)("div", {
className: "block-editor-inserter__block-patterns-tabs-container"
}, (0,external_React_.createElement)("nav", {
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Block pattern categories'),
className: "block-editor-inserter__block-patterns-tabs"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
role: "list"
}, categories.map(category => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItem, {
role: "listitem",
key: category.name,
onClick: () => onSelectCategory(category),
className: category === selectedCategory ? 'block-editor-inserter__patterns-category block-editor-inserter__patterns-selected-category' : 'block-editor-inserter__patterns-category',
"aria-label": category.label,
"aria-current": category === selectedCategory ? 'true' : undefined
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, null, category.label), (0,external_React_.createElement)(build_module_icon, {
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
})))), (0,external_React_.createElement)("div", {
role: "listitem"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
className: "block-editor-inserter__patterns-explore-button",
onClick: () => setShowPatternsExplorer(true),
variant: "secondary"
}, (0,external_wp_i18n_namespaceObject.__)('Explore all patterns')))))), isMobile && (0,external_React_.createElement)(MobileTabNavigation, {
categories: categories
}, category => (0,external_React_.createElement)(PatternCategoryPreviews, {
key: category.name,
onInsert: onInsert,
rootClientId: rootClientId,
category: category,
showTitlesAsTooltip: false
})), showPatternsExplorer && (0,external_React_.createElement)(block_patterns_explorer, {
initialCategory: initialCategory,
patternCategories: categories,
onModalClose: () => setShowPatternsExplorer(false),
rootClientId: rootClientId
}));
}
/* harmony default export */ const block_patterns_tab = (BlockPatternsTab);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PatternCategoryPreviewPanel({
rootClientId,
onInsert,
onHover,
category,
showTitlesAsTooltip,
patternFilter
}) {
const container = (0,external_wp_element_namespaceObject.useRef)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
const timeout = setTimeout(() => {
const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(container.current);
firstTabbable?.focus();
});
return () => clearTimeout(timeout);
}, [category]);
return (0,external_React_.createElement)("div", {
ref: container,
className: "block-editor-inserter__patterns-category-dialog"
}, (0,external_React_.createElement)(PatternCategoryPreviews, {
key: category.name,
rootClientId: rootClientId,
onInsert: onInsert,
onHover: onHover,
category: category,
showTitlesAsTooltip: showTitlesAsTooltip,
patternFilter: patternFilter
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/hooks.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('../../../store/actions').InserterMediaRequest} InserterMediaRequest */
/** @typedef {import('../../../store/actions').InserterMediaItem} InserterMediaItem */
/**
* Fetches media items based on the provided category.
* Each media category is responsible for providing a `fetch` function.
*
* @param {Object} category The media category to fetch results for.
* @param {InserterMediaRequest} query The query args to use for the request.
* @return {InserterMediaItem[]} The media results.
*/
function useMediaResults(category, query = {}) {
const [mediaList, setMediaList] = (0,external_wp_element_namespaceObject.useState)();
const [isLoading, setIsLoading] = (0,external_wp_element_namespaceObject.useState)(false);
// We need to keep track of the last request made because
// multiple request can be fired without knowing the order
// of resolution, and we need to ensure we are showing
// the results of the last request.
// In the future we could use AbortController to cancel previous
// requests, but we don't for now as it involves adding support
// for this to `core-data` package.
const lastRequest = (0,external_wp_element_namespaceObject.useRef)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
(async () => {
const key = JSON.stringify({
category: category.name,
...query
});
lastRequest.current = key;
setIsLoading(true);
setMediaList([]); // Empty the previous results.
const _media = await category.fetch?.(query);
if (key === lastRequest.current) {
setMediaList(_media);
setIsLoading(false);
}
})();
}, [category.name, ...Object.values(query)]);
return {
mediaList,
isLoading
};
}
function useMediaCategories(rootClientId) {
const [categories, setCategories] = (0,external_wp_element_namespaceObject.useState)([]);
const inserterMediaCategories = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getInserterMediaCategories(), []);
const {
canInsertImage,
canInsertVideo,
canInsertAudio
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canInsertBlockType
} = select(store);
return {
canInsertImage: canInsertBlockType('core/image', rootClientId),
canInsertVideo: canInsertBlockType('core/video', rootClientId),
canInsertAudio: canInsertBlockType('core/audio', rootClientId)
};
}, [rootClientId]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
(async () => {
const _categories = [];
// If `inserterMediaCategories` is not defined in
// block editor settings, do not show any media categories.
if (!inserterMediaCategories) {
return;
}
// Loop through categories to check if they have at least one media item.
const categoriesHaveMedia = new Map(await Promise.all(inserterMediaCategories.map(async category => {
// Some sources are external and we don't need to make a request.
if (category.isExternalResource) {
return [category.name, true];
}
let results = [];
try {
results = await category.fetch({
per_page: 1
});
} catch (e) {
// If the request fails, we shallow the error and just don't show
// the category, in order to not break the media tab.
}
return [category.name, !!results.length];
})));
// We need to filter out categories that don't have any media items or
// whose corresponding block type is not allowed to be inserted, based
// on the category's `mediaType`.
const canInsertMediaType = {
image: canInsertImage,
video: canInsertVideo,
audio: canInsertAudio
};
inserterMediaCategories.forEach(category => {
if (canInsertMediaType[category.mediaType] && categoriesHaveMedia.get(category.name)) {
_categories.push(category);
}
});
if (!!_categories.length) {
setCategories(_categories);
}
})();
}, [canInsertImage, canInsertVideo, canInsertAudio, inserterMediaCategories]);
return categories;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
/**
* WordPress dependencies
*/
const external = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"
}));
/* harmony default export */ const library_external = (external);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/utils.js
/**
* WordPress dependencies
*/
const mediaTypeTag = {
image: 'img',
video: 'video',
audio: 'audio'
};
/** @typedef {import('./hooks').InserterMediaItem} InserterMediaItem */
/**
* Creates a block and a preview element from a media object.
*
* @param {InserterMediaItem} media The media object to create the block from.
* @param {('image'|'audio'|'video')} mediaType The media type to create the block for.
* @return {[WPBlock, JSX.Element]} An array containing the block and the preview element.
*/
function getBlockAndPreviewFromMedia(media, mediaType) {
// Add the common attributes between the different media types.
const attributes = {
id: media.id || undefined,
caption: media.caption || undefined
};
const mediaSrc = media.url;
const alt = media.alt || undefined;
if (mediaType === 'image') {
attributes.url = mediaSrc;
attributes.alt = alt;
} else if (['video', 'audio'].includes(mediaType)) {
attributes.src = mediaSrc;
}
const PreviewTag = mediaTypeTag[mediaType];
const preview = (0,external_React_.createElement)(PreviewTag, {
src: media.previewUrl || mediaSrc,
alt: alt,
controls: mediaType === 'audio' ? true : undefined,
inert: "true",
onError: ({
currentTarget
}) => {
// Fall back to the media source if the preview cannot be loaded.
if (currentTarget.src === media.previewUrl) {
currentTarget.src = mediaSrc;
}
}
});
return [(0,external_wp_blocks_namespaceObject.createBlock)(`core/${mediaType}`, attributes), preview];
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-preview.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ALLOWED_MEDIA_TYPES = ['image'];
const MAXIMUM_TITLE_LENGTH = 25;
const MEDIA_OPTIONS_POPOVER_PROPS = {
position: 'bottom left',
className: 'block-editor-inserter__media-list__item-preview-options__popover'
};
const {
CompositeItemV2: media_preview_CompositeItem
} = unlock(external_wp_components_namespaceObject.privateApis);
function MediaPreviewOptions({
category,
media
}) {
if (!category.getReportUrl) {
return null;
}
const reportUrl = category.getReportUrl(media);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
className: "block-editor-inserter__media-list__item-preview-options",
label: (0,external_wp_i18n_namespaceObject.__)('Options'),
popoverProps: MEDIA_OPTIONS_POPOVER_PROPS,
icon: more_vertical
}, () => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => window.open(reportUrl, '_blank').focus(),
icon: library_external
}, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The media type to report e.g: "image", "video", "audio" */
(0,external_wp_i18n_namespaceObject.__)('Report %s'), category.mediaType))));
}
function InsertExternalImageModal({
onClose,
onSubmit
}) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Insert external image'),
onRequestClose: onClose,
className: "block-editor-inserter-media-tab-media-preview-inserter-external-image-modal"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 3
}, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('This image cannot be uploaded to your Media Library, but it can still be inserted as an external image.')), (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('External images can be removed by the external provider without warning and could even have legal compliance issues related to privacy legislation.'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
className: "block-editor-block-lock-modal__actions",
justify: "flex-end",
expanded: false
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: onClose
}, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: onSubmit
}, (0,external_wp_i18n_namespaceObject.__)('Insert')))));
}
function MediaPreview({
media,
onClick,
category
}) {
const [showExternalUploadModal, setShowExternalUploadModal] = (0,external_wp_element_namespaceObject.useState)(false);
const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false);
const [isInserting, setIsInserting] = (0,external_wp_element_namespaceObject.useState)(false);
const [block, preview] = (0,external_wp_element_namespaceObject.useMemo)(() => getBlockAndPreviewFromMedia(media, category.mediaType), [media, category.mediaType]);
const {
createErrorNotice,
createSuccessNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().mediaUpload, []);
const onMediaInsert = (0,external_wp_element_namespaceObject.useCallback)(previewBlock => {
// Prevent multiple uploads when we're in the process of inserting.
if (isInserting) {
return;
}
const clonedBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(previewBlock);
const {
id,
url,
caption
} = clonedBlock.attributes;
// Media item already exists in library, so just insert it.
if (!!id) {
onClick(clonedBlock);
return;
}
setIsInserting(true);
// Media item does not exist in library, so try to upload it.
// Fist fetch the image data. This may fail if the image host
// doesn't allow CORS with the domain.
// If this happens, we insert the image block using the external
// URL and let the user know about the possible implications.
window.fetch(url).then(response => response.blob()).then(blob => {
mediaUpload({
filesList: [blob],
additionalData: {
caption
},
onFileChange([img]) {
if ((0,external_wp_blob_namespaceObject.isBlobURL)(img.url)) {
return;
}
onClick({
...clonedBlock,
attributes: {
...clonedBlock.attributes,
id: img.id,
url: img.url
}
});
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Image uploaded and inserted.'), {
type: 'snackbar'
});
setIsInserting(false);
},
allowedTypes: ALLOWED_MEDIA_TYPES,
onError(message) {
createErrorNotice(message, {
type: 'snackbar'
});
setIsInserting(false);
}
});
}).catch(() => {
setShowExternalUploadModal(true);
setIsInserting(false);
});
}, [isInserting, onClick, mediaUpload, createErrorNotice, createSuccessNotice]);
const title = typeof media.title === 'string' ? media.title : media.title?.rendered || (0,external_wp_i18n_namespaceObject.__)('no title');
let truncatedTitle;
if (title.length > MAXIMUM_TITLE_LENGTH) {
const omission = '...';
truncatedTitle = title.slice(0, MAXIMUM_TITLE_LENGTH - omission.length) + omission;
}
const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(true), []);
const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => setIsHovered(false), []);
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(inserter_draggable_blocks, {
isEnabled: true,
blocks: [block]
}, ({
draggable,
onDragStart,
onDragEnd
}) => (0,external_React_.createElement)("div", {
className: classnames_default()('block-editor-inserter__media-list__list-item', {
'is-hovered': isHovered
}),
draggable: draggable,
onDragStart: onDragStart,
onDragEnd: onDragEnd
}, (0,external_React_.createElement)("div", {
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, {
text: truncatedTitle || title
}, (0,external_React_.createElement)(media_preview_CompositeItem, {
render: (0,external_React_.createElement)("div", {
"aria-label": title,
role: "option",
className: "block-editor-inserter__media-list__item"
}),
onClick: () => onMediaInsert(block)
}, (0,external_React_.createElement)("div", {
className: "block-editor-inserter__media-list__item-preview"
}, preview, isInserting && (0,external_React_.createElement)("div", {
className: "block-editor-inserter__media-list__item-preview-spinner"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null))))), !isInserting && (0,external_React_.createElement)(MediaPreviewOptions, {
category: category,
media: media
})))), showExternalUploadModal && (0,external_React_.createElement)(InsertExternalImageModal, {
onClose: () => setShowExternalUploadModal(false),
onSubmit: () => {
onClick((0,external_wp_blocks_namespaceObject.cloneBlock)(block));
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Image inserted.'), {
type: 'snackbar'
});
setShowExternalUploadModal(false);
}
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-list.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
CompositeV2: media_list_Composite,
useCompositeStoreV2: media_list_useCompositeStore
} = unlock(external_wp_components_namespaceObject.privateApis);
function MediaList({
mediaList,
category,
onClick,
label = (0,external_wp_i18n_namespaceObject.__)('Media List')
}) {
const compositeStore = media_list_useCompositeStore();
return (0,external_React_.createElement)(media_list_Composite, {
store: compositeStore,
role: "listbox",
className: "block-editor-inserter__media-list",
"aria-label": label
}, mediaList.map((media, index) => (0,external_React_.createElement)(MediaPreview, {
key: media.id || media.sourceId || index,
media: media,
category: category,
onClick: onClick
})));
}
/* harmony default export */ const media_list = (MediaList);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/no-results.js
/**
* WordPress dependencies
*/
function InserterNoResults() {
return (0,external_React_.createElement)("div", {
className: "block-editor-inserter__no-results"
}, (0,external_React_.createElement)(build_module_icon, {
className: "block-editor-inserter__no-results-icon",
icon: block_default
}), (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No results found.')));
}
/* harmony default export */ const no_results = (InserterNoResults);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const INITIAL_MEDIA_ITEMS_PER_PAGE = 10;
function MediaCategoryDialog({
rootClientId,
onInsert,
category
}) {
const container = (0,external_wp_element_namespaceObject.useRef)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
const timeout = setTimeout(() => {
const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(container.current);
firstTabbable?.focus();
});
return () => clearTimeout(timeout);
}, [category]);
return (0,external_React_.createElement)("div", {
ref: container,
className: "block-editor-inserter__media-dialog"
}, (0,external_React_.createElement)(MediaCategoryPanel, {
rootClientId: rootClientId,
onInsert: onInsert,
category: category
}));
}
function MediaCategoryPanel({
rootClientId,
onInsert,
category
}) {
const [search, setSearch, debouncedSearch] = (0,external_wp_compose_namespaceObject.useDebouncedInput)();
const {
mediaList,
isLoading
} = useMediaResults(category, {
per_page: !!debouncedSearch ? 20 : INITIAL_MEDIA_ITEMS_PER_PAGE,
search: debouncedSearch
});
const baseCssClass = 'block-editor-inserter__media-panel';
const searchLabel = category.labels.search_items || (0,external_wp_i18n_namespaceObject.__)('Search');
return (0,external_React_.createElement)("div", {
className: baseCssClass
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.SearchControl, {
className: `${baseCssClass}-search`,
onChange: setSearch,
value: search,
label: searchLabel,
placeholder: searchLabel
}), isLoading && (0,external_React_.createElement)("div", {
className: `${baseCssClass}-spinner`
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null)), !isLoading && !mediaList?.length && (0,external_React_.createElement)(no_results, null), !isLoading && !!mediaList?.length && (0,external_React_.createElement)(media_list, {
rootClientId: rootClientId,
onClick: onInsert,
mediaList: mediaList,
category: category
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/media-tab/media-tab.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const media_tab_ALLOWED_MEDIA_TYPES = ['image', 'video', 'audio'];
function MediaTab({
rootClientId,
selectedCategory,
onSelectCategory,
onInsert
}) {
const mediaCategories = useMediaCategories(rootClientId);
const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
const baseCssClass = 'block-editor-inserter__media-tabs';
const onSelectMedia = (0,external_wp_element_namespaceObject.useCallback)(media => {
if (!media?.url) {
return;
}
const [block] = getBlockAndPreviewFromMedia(media, media.type);
onInsert(block);
}, [onInsert]);
const mobileMediaCategories = (0,external_wp_element_namespaceObject.useMemo)(() => mediaCategories.map(mediaCategory => ({
...mediaCategory,
label: mediaCategory.labels.name
})), [mediaCategories]);
return (0,external_React_.createElement)(external_React_.Fragment, null, !isMobile && (0,external_React_.createElement)("div", {
className: `${baseCssClass}-container`
}, (0,external_React_.createElement)("nav", {
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Media categories')
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
role: "list",
className: baseCssClass
}, mediaCategories.map(mediaCategory => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalItem, {
role: "listitem",
key: mediaCategory.name,
onClick: () => onSelectCategory(mediaCategory),
className: classnames_default()(`${baseCssClass}__media-category`, {
'is-selected': selectedCategory === mediaCategory
}),
"aria-label": mediaCategory.labels.name,
"aria-current": mediaCategory === selectedCategory ? 'true' : undefined
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, null, mediaCategory.labels.name), (0,external_React_.createElement)(build_module_icon, {
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
})))), (0,external_React_.createElement)("div", {
role: "listitem"
}, (0,external_React_.createElement)(check, null, (0,external_React_.createElement)(media_upload, {
multiple: false,
onSelect: onSelectMedia,
allowedTypes: media_tab_ALLOWED_MEDIA_TYPES,
render: ({
open
}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
onClick: event => {
// Safari doesn't emit a focus event on button elements when
// clicked and we need to manually focus the button here.
// The reason is that core's Media Library modal explicitly triggers a
// focus event and therefore a `blur` event is triggered on a different
// element, which doesn't contain the `data-unstable-ignore-focus-outside-for-relatedtarget`
// attribute making the Inserter dialog to close.
event.target.focus();
open();
},
className: "block-editor-inserter__media-library-button",
variant: "secondary",
"data-unstable-ignore-focus-outside-for-relatedtarget": ".media-modal"
}, (0,external_wp_i18n_namespaceObject.__)('Open Media Library'))
})))))), isMobile && (0,external_React_.createElement)(MobileTabNavigation, {
categories: mobileMediaCategories
}, category => (0,external_React_.createElement)(MediaCategoryPanel, {
onInsert: onInsert,
rootClientId: rootClientId,
category: category
})));
}
/* harmony default export */ const media_tab = (MediaTab);
;// 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
} = (0,external_wp_components_namespaceObject.createSlotFill)('__unstableInserterMenuExtension');
__unstableInserterMenuExtension.Slot = inserter_menu_extension_Slot;
/* harmony default export */ const inserter_menu_extension = (__unstableInserterMenuExtension);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/search-results.js
/**
* 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({
filterValue,
onSelect,
onHover,
onHoverPattern,
rootClientId,
clientId,
isAppender,
__experimentalInsertionIndex,
maxBlockPatterns,
maxBlockTypes,
showBlockDirectory = false,
isDraggable = true,
shouldFocusBlock = true,
prioritizePatterns,
selectBlockOnInsert
}) {
const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
const {
prioritizedBlocks
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const blockListSettings = select(store).getBlockListSettings(rootClientId);
return {
prioritizedBlocks: blockListSettings?.prioritizedInserterBlocks || search_results_EMPTY_ARRAY
};
}, [rootClientId]);
const [destinationRootClientId, onInsertBlocks] = use_insertion_point({
onSelect,
rootClientId,
clientId,
isAppender,
insertionIndex: __experimentalInsertionIndex,
shouldFocusBlock,
selectBlockOnInsert
});
const [blockTypes, blockTypeCategories, blockTypeCollections, onSelectBlockType] = use_block_types_state(destinationRootClientId, onInsertBlocks);
const [patterns,, onClickPattern] = 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 nonPatternBlockTypes = blockTypes.filter(blockType => blockType.name !== 'core/block');
let orderedItems = orderBy(nonPatternBlockTypes, 'frecency', 'desc');
if (!filterValue && prioritizedBlocks.length) {
orderedItems = orderInserterBlockItems(orderedItems, prioritizedBlocks);
}
const results = searchBlockItems(orderedItems, blockTypeCategories, blockTypeCollections, filterValue);
return maxBlockTypesToShow !== undefined ? results.slice(0, maxBlockTypesToShow) : results;
}, [filterValue, blockTypes, blockTypeCategories, blockTypeCollections, maxBlockTypesToShow, prioritizedBlocks]);
// 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, filteredBlockTypes, filteredBlockPatterns]);
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 = filteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0;
const blocksUI = !!filteredBlockTypes.length && (0,external_React_.createElement)(panel, {
title: (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Blocks'))
}, (0,external_React_.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_React_.createElement)(panel, {
title: (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Block patterns'))
}, (0,external_React_.createElement)("div", {
className: "block-editor-inserter__quick-inserter-patterns"
}, (0,external_React_.createElement)(block_patterns_list, {
shownPatterns: currentShownPatterns,
blockPatterns: filteredBlockPatterns,
onClickPattern: onClickPattern,
onHover: onHoverPattern,
isDraggable: isDraggable
})));
return (0,external_React_.createElement)(inserter_listbox, null, !showBlockDirectory && !hasItems && (0,external_React_.createElement)(no_results, null), prioritizePatterns ? patternsUI : blocksUI, !!filteredBlockTypes.length && !!filteredBlockPatterns.length && (0,external_React_.createElement)("div", {
className: "block-editor-inserter__quick-inserter-separator"
}), prioritizePatterns ? blocksUI : patternsUI, showBlockDirectory && (0,external_React_.createElement)(inserter_menu_extension.Slot, {
fillProps: {
onSelect: onSelectBlockType,
onHover,
filterValue,
hasItems,
rootClientId: destinationRootClientId
}
}, fills => {
if (fills.length) {
return fills;
}
if (!hasItems) {
return (0,external_React_.createElement)(no_results, null);
}
return null;
}));
}
/* harmony default export */ const search_results = (InserterSearchResults);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/tabs.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
Tabs
} = unlock(external_wp_components_namespaceObject.privateApis);
const blocksTab = {
name: 'blocks',
/* translators: Blocks tab title in the block inserter. */
title: (0,external_wp_i18n_namespaceObject.__)('Blocks')
};
const patternsTab = {
name: 'patterns',
/* translators: Theme and Directory Patterns tab title in the block inserter. */
title: (0,external_wp_i18n_namespaceObject.__)('Patterns')
};
const mediaTab = {
name: 'media',
/* translators: Media tab title in the block inserter. */
title: (0,external_wp_i18n_namespaceObject.__)('Media')
};
function InserterTabs({
showPatterns = false,
showMedia = false,
onSelect,
tabsContents
}) {
const tabs = [blocksTab, showPatterns && patternsTab, showMedia && mediaTab].filter(Boolean);
return (0,external_React_.createElement)("div", {
className: "block-editor-inserter__tabs"
}, (0,external_React_.createElement)(Tabs, {
onSelect: onSelect
}, (0,external_React_.createElement)(Tabs.TabList, null, tabs.map(tab => (0,external_React_.createElement)(Tabs.Tab, {
key: tab.name,
tabId: tab.name
}, tab.title))), tabs.map(tab => (0,external_React_.createElement)(Tabs.TabPanel, {
key: tab.name,
tabId: tab.name,
focusable: false
}, tabsContents[tab.name]))));
}
/* harmony default export */ const tabs = (InserterTabs);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/menu.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function InserterMenu({
rootClientId,
clientId,
isAppender,
__experimentalInsertionIndex,
onSelect,
showInserterHelpPanel,
showMostUsedBlocks,
__experimentalFilterValue = '',
shouldFocusBlock = true
}, ref) {
const [filterValue, setFilterValue, delayedFilterValue] = (0,external_wp_compose_namespaceObject.useDebouncedInput)(__experimentalFilterValue);
const [hoveredItem, setHoveredItem] = (0,external_wp_element_namespaceObject.useState)(null);
const [selectedPatternCategory, setSelectedPatternCategory] = (0,external_wp_element_namespaceObject.useState)(null);
const [patternFilter, setPatternFilter] = (0,external_wp_element_namespaceObject.useState)('all');
const [selectedMediaCategory, setSelectedMediaCategory] = (0,external_wp_element_namespaceObject.useState)(null);
const [selectedTab, setSelectedTab] = (0,external_wp_element_namespaceObject.useState)(null);
const [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint] = use_insertion_point({
rootClientId,
clientId,
isAppender,
insertionIndex: __experimentalInsertionIndex,
shouldFocusBlock
});
const {
showPatterns
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
hasAllowedPatterns
} = unlock(select(store));
return {
showPatterns: hasAllowedPatterns(destinationRootClientId)
};
}, [destinationRootClientId]);
const mediaCategories = useMediaCategories(destinationRootClientId);
const showMedia = mediaCategories.length > 0;
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 onHoverPattern = (0,external_wp_element_namespaceObject.useCallback)(item => {
onToggleInsertionPoint(!!item);
}, [onToggleInsertionPoint]);
const onClickPatternCategory = (0,external_wp_element_namespaceObject.useCallback)((patternCategory, filter) => {
setSelectedPatternCategory(patternCategory);
setPatternFilter(filter);
}, [setSelectedPatternCategory]);
const blocksTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
className: "block-editor-inserter__block-list"
}, (0,external_React_.createElement)(block_types_tab, {
rootClientId: destinationRootClientId,
onInsert: onInsert,
onHover: onHover,
showMostUsedBlocks: showMostUsedBlocks
})), showInserterHelpPanel && (0,external_React_.createElement)("div", {
className: "block-editor-inserter__tips"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
as: "h2"
}, (0,external_wp_i18n_namespaceObject.__)('A tip for using the block editor')), (0,external_React_.createElement)(tips, null))), [destinationRootClientId, onInsert, onHover, showMostUsedBlocks, showInserterHelpPanel]);
const patternsTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_React_.createElement)(block_patterns_tab, {
rootClientId: destinationRootClientId,
onInsert: onInsertPattern,
onSelectCategory: onClickPatternCategory,
selectedCategory: selectedPatternCategory
}), [destinationRootClientId, onInsertPattern, onClickPatternCategory, selectedPatternCategory]);
const mediaTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_React_.createElement)(media_tab, {
rootClientId: destinationRootClientId,
selectedCategory: selectedMediaCategory,
onSelectCategory: setSelectedMediaCategory,
onInsert: onInsert
}), [destinationRootClientId, onInsert, selectedMediaCategory, setSelectedMediaCategory]);
const inserterTabsContents = (0,external_wp_element_namespaceObject.useMemo)(() => ({
blocks: blocksTab,
patterns: patternsTab,
media: mediaTab
}), [blocksTab, mediaTab, patternsTab]);
const searchRef = (0,external_wp_element_namespaceObject.useRef)();
(0,external_wp_element_namespaceObject.useImperativeHandle)(ref, () => ({
focusSearch: () => {
searchRef.current.focus();
}
}));
const showPatternPanel = selectedTab === 'patterns' && !delayedFilterValue && selectedPatternCategory;
const showAsTabs = !delayedFilterValue && (showPatterns || showMedia);
const showMediaPanel = selectedTab === 'media' && !delayedFilterValue && selectedMediaCategory;
const handleSetSelectedTab = value => {
// If no longer on patterns tab remove the category setting.
if (value !== 'patterns') {
setSelectedPatternCategory(null);
}
setSelectedTab(value);
};
return (0,external_React_.createElement)("div", {
className: "block-editor-inserter__menu"
}, (0,external_React_.createElement)("div", {
className: classnames_default()('block-editor-inserter__main-area', {
'show-as-tabs': showAsTabs
})
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.SearchControl, {
__nextHasNoMarginBottom: true,
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
}), !!delayedFilterValue && (0,external_React_.createElement)("div", {
className: "block-editor-inserter__no-tab-container"
}, (0,external_React_.createElement)(search_results, {
filterValue: delayedFilterValue,
onSelect: onSelect,
onHover: onHover,
onHoverPattern: onHoverPattern,
rootClientId: rootClientId,
clientId: clientId,
isAppender: isAppender,
__experimentalInsertionIndex: __experimentalInsertionIndex,
showBlockDirectory: true,
shouldFocusBlock: shouldFocusBlock
})), showAsTabs && (0,external_React_.createElement)(tabs, {
showPatterns: showPatterns,
showMedia: showMedia,
onSelect: handleSetSelectedTab,
tabsContents: inserterTabsContents
}), !delayedFilterValue && !showAsTabs && (0,external_React_.createElement)("div", {
className: "block-editor-inserter__no-tab-container"
}, blocksTab)), showMediaPanel && (0,external_React_.createElement)(MediaCategoryDialog, {
rootClientId: destinationRootClientId,
onInsert: onInsert,
category: selectedMediaCategory
}), showInserterHelpPanel && hoveredItem && (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, {
className: "block-editor-inserter__preview-container__popover",
placement: "right-start",
offset: 16,
focusOnMount: false,
animate: false
}, (0,external_React_.createElement)(preview_panel, {
item: hoveredItem
})), showPatternPanel && (0,external_React_.createElement)(PatternCategoryPreviewPanel, {
rootClientId: destinationRootClientId,
onInsert: onInsertPattern,
onHover: onHoverPattern,
category: selectedPatternCategory,
patternFilter: patternFilter,
showTitlesAsTooltip: true
}));
}
/* harmony default export */ const 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 quick_inserter_SHOWN_BLOCK_TYPES = 6;
const SHOWN_BLOCK_PATTERNS = 2;
const SHOWN_BLOCK_PATTERNS_WITH_PRIORITIZATION = 4;
function QuickInserter({
onSelect,
rootClientId,
clientId,
isAppender,
prioritizePatterns,
selectBlockOnInsert,
hasSearch = true
}) {
const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
const [destinationRootClientId, onInsertBlocks] = use_insertion_point({
onSelect,
rootClientId,
clientId,
isAppender,
selectBlockOnInsert
});
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 = hasSearch && (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_React_.createElement)("div", {
className: classnames_default()('block-editor-inserter__quick-inserter', {
'has-search': showSearch,
'has-expand': setInserterIsOpened
})
}, showSearch && (0,external_React_.createElement)(external_wp_components_namespaceObject.SearchControl, {
__nextHasNoMarginBottom: true,
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_React_.createElement)("div", {
className: "block-editor-inserter__quick-inserter-results"
}, (0,external_React_.createElement)(search_results, {
filterValue: filterValue,
onSelect: onSelect,
rootClientId: rootClientId,
clientId: clientId,
isAppender: isAppender,
maxBlockPatterns: maxBlockPatterns,
maxBlockTypes: quick_inserter_SHOWN_BLOCK_TYPES,
isDraggable: false,
prioritizePatterns: prioritizePatterns,
selectBlockOnInsert: selectBlockOnInsert
})), setInserterIsOpened && (0,external_React_.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 = ({
onToggle,
disabled,
isOpen,
blockTitle,
hasSingleBlockType,
toggleProps = {},
prioritizePatterns
}) => {
const {
as: Wrapper = external_wp_components_namespaceObject.Button,
label: labelProp,
onClick,
...rest
} = toggleProps;
let label = labelProp;
if (!label && 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 (!label && prioritizePatterns) {
label = (0,external_wp_i18n_namespaceObject.__)('Add pattern');
} else if (!label) {
label = (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button');
}
// 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_React_.createElement)(Wrapper, {
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 PrivateInserter 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 {Element} Dropdown toggle element.
*/
renderToggle({
onToggle,
isOpen
}) {
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 {Element} 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,
prioritizePatterns,
onSelectOrClose,
selectBlockOnInsert
} = this.props;
if (isQuick) {
return (0,external_React_.createElement)(QuickInserter, {
onSelect: blocks => {
const firstBlock = Array.isArray(blocks) && blocks?.length ? blocks[0] : blocks;
if (onSelectOrClose && typeof onSelectOrClose === 'function') {
onSelectOrClose(firstBlock);
}
onClose();
},
rootClientId: rootClientId,
clientId: clientId,
isAppender: isAppender,
prioritizePatterns: prioritizePatterns,
selectBlockOnInsert: selectBlockOnInsert
});
}
return (0,external_React_.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_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
className: "block-editor-inserter",
contentClassName: classnames_default()('block-editor-inserter__popover', {
'is-quick': isQuick
}),
popoverProps: {
position,
shift: true
},
onToggle: this.onToggle,
expandOnMobile: true,
headerTitle: (0,external_wp_i18n_namespaceObject.__)('Add a block'),
renderToggle: this.renderToggle,
renderContent: this.renderContent,
onClose: onSelectOrClose
});
}
}
const ComposedPrivateInserter = (0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, {
clientId,
rootClientId,
shouldDirectInsert = true
}) => {
const {
getBlockRootClientId,
hasInserterItems,
getAllowedBlocks,
getDirectInsertBlock,
getSettings
} = select(store);
const {
getBlockVariations
} = select(external_wp_blocks_namespaceObject.store);
rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined;
const allowedBlocks = getAllowedBlocks(rootClientId);
const directInsertBlock = shouldDirectInsert && getDirectInsertBlock(rootClientId);
const settings = getSettings();
const hasSingleBlockType = allowedBlocks?.length === 1 && getBlockVariations(allowedBlocks[0].name, 'inserter')?.length === 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
};
}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, {
select
}) => {
return {
insertOnlyAllowedBlock() {
const {
rootClientId,
clientId,
isAppender,
hasSingleBlockType,
allowedBlockType,
directInsertBlock,
onSelectOrClose,
selectBlockOnInsert
} = 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) {
const parentBlock = getBlock(rootClientId);
if (parentBlock?.innerBlocks?.length) {
const lastInnerBlock = parentBlock.innerBlocks[parentBlock.innerBlocks.length - 1];
if (directInsertBlock && 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?.name === previousBlock?.name) {
adjacentAttributes = 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, selectBlockOnInsert);
if (onSelectOrClose) {
onSelectOrClose({
clientId: blockToInsert?.clientId
});
}
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)(({
hasItems,
isAppender,
rootClientId,
clientId
}) => hasItems || !isAppender && !rootClientId && !clientId)])(PrivateInserter);
const Inserter = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
return (0,external_React_.createElement)(ComposedPrivateInserter, {
ref: ref,
...props
});
});
/* harmony default export */ const inserter = (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({
rootClientId
}) {
const {
showPrompt,
isLocked,
placeholder
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockCount,
getSettings,
getTemplateLock
} = select(store);
const isEmpty = !getBlockCount(rootClientId);
const {
bodyPlaceholder
} = getSettings();
return {
showPrompt: isEmpty,
isLocked: !!getTemplateLock(rootClientId),
placeholder: bodyPlaceholder
};
}, [rootClientId]);
const {
insertDefaultBlock,
startTyping
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
if (isLocked) {
return null;
}
const value = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Type / to choose a block');
const onAppend = () => {
insertDefaultBlock(undefined, rootClientId);
startTyping();
};
return (0,external_React_.createElement)("div", {
"data-root-client-id": rootClientId || '',
className: classnames_default()('block-editor-default-block-appender', {
'has-visible-prompt': showPrompt
})
}, (0,external_React_.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_React_.createElement)(inserter, {
rootClientId: rootClientId,
position: "bottom right",
isAppender: true,
__experimentalIsQuick: true
}));
}
;// 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 (0,external_React_.createElement)(inserter, {
position: "bottom center",
rootClientId: rootClientId,
__experimentalIsQuick: true,
renderToggle: ({
onToggle,
disabled,
isOpen,
blockTitle,
hasSingleBlockType
}) => {
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_React_.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_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
as: "span"
}, label), (0,external_React_.createElement)(build_module_icon, {
icon: library_plus
}));
if (isToggleButton || hasSingleBlockType) {
inserterButton = (0,external_React_.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 */ const 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 DefaultAppender({
rootClientId
}) {
const canInsertDefaultBlock = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).canInsertBlockType((0,external_wp_blocks_namespaceObject.getDefaultBlockName)(), rootClientId));
if (canInsertDefaultBlock) {
// Render the default block appender if the context supports use
// of the default appender.
return (0,external_React_.createElement)(DefaultBlockAppender, {
rootClientId: rootClientId
});
}
// Fallback in case the default block can't be inserted.
return (0,external_React_.createElement)(button_block_appender, {
rootClientId: rootClientId,
className: "block-list-appender__toggle"
});
}
function BlockListAppender({
rootClientId,
CustomAppender,
className,
tagName: TagName = 'div'
}) {
const isDragOver = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockInsertionPoint,
isBlockInsertionPointVisible,
getBlockCount
} = select(store);
const insertionPoint = getBlockInsertionPoint();
// Ideally we should also check for `isDragging` but currently it
// requires a lot more setup. We can revisit this once we refactor
// the DnD utility hooks.
return isBlockInsertionPointVisible() && rootClientId === insertionPoint?.rootClientId && getBlockCount(rootClientId) === 0;
}, [rootClientId]);
return (0,external_React_.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, {
'is-drag-over': isDragOver
})
// 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
}, CustomAppender ? (0,external_React_.createElement)(CustomAppender, null) : (0,external_React_.createElement)(DefaultAppender, {
rootClientId: rootClientId
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-popover/inbetween.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const inbetween_MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;
const InsertionPointOpenRef = (0,external_wp_element_namespaceObject.createContext)();
function BlockPopoverInbetween({
previousClientId,
nextClientId,
children,
__unstablePopoverSlot,
__unstableContentRef,
operation = 'insert',
nearestSide = 'right',
...props
}) {
// This is a temporary hack to get the inbetween inserter to recompute properly.
const [popoverRecomputeCounter, forcePopoverRecompute] = (0,external_wp_element_namespaceObject.useReducer)(
// Module is there to make sure that the counter doesn't overflow.
s => (s + 1) % inbetween_MAX_POPOVER_RECOMPUTE_COUNTER, 0);
const {
orientation,
rootClientId,
isVisible
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockListSettings,
getBlockRootClientId,
isBlockVisible
} = select(store);
const _rootClientId = getBlockRootClientId(previousClientId !== null && previousClientId !== void 0 ? previousClientId : nextClientId);
return {
orientation: getBlockListSettings(_rootClientId)?.orientation || 'vertical',
rootClientId: _rootClientId,
isVisible: isBlockVisible(previousClientId) && isBlockVisible(nextClientId)
};
}, [previousClientId, nextClientId]);
const previousElement = useBlockElement(previousClientId);
const nextElement = useBlockElement(nextClientId);
const isVertical = orientation === 'vertical';
const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (
// popoverRecomputeCounter is by definition always equal or greater than 0.
// This check is only there to satisfy the correctness of the
// exhaustive-deps rule for the `useMemo` hook.
popoverRecomputeCounter < 0 || !previousElement && !nextElement || !isVisible) {
return undefined;
}
const contextElement = operation === 'group' ? nextElement || previousElement : previousElement || nextElement;
return {
contextElement,
getBoundingClientRect() {
const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
let left = 0;
let top = 0;
let width = 0;
let height = 0;
if (operation === 'group') {
const targetRect = nextRect || previousRect;
top = targetRect.top;
// No spacing is likely around blocks in this operation.
// So width of the inserter containing rect is set to 0.
width = 0;
height = targetRect.bottom - targetRect.top;
// Popover calculates its distance from mid-block so some
// adjustments are needed to make it appear in the right place.
left = nearestSide === 'left' ? targetRect.left - 2 : targetRect.right - 2;
} else if (isVertical) {
// vertical
top = previousRect ? previousRect.bottom : nextRect.top;
width = previousRect ? previousRect.width : nextRect.width;
height = nextRect && previousRect ? nextRect.top - previousRect.bottom : 0;
left = previousRect ? previousRect.left : nextRect.left;
} else {
top = previousRect ? previousRect.top : nextRect.top;
height = previousRect ? previousRect.height : nextRect.height;
if ((0,external_wp_i18n_namespaceObject.isRTL)()) {
// non vertical, rtl
left = nextRect ? nextRect.right : previousRect.left;
width = previousRect && nextRect ? previousRect.left - nextRect.right : 0;
} else {
// non vertical, ltr
left = previousRect ? previousRect.right : nextRect.left;
width = previousRect && nextRect ? nextRect.left - previousRect.right : 0;
}
}
return new window.DOMRect(left, top, width, height);
}
};
}, [previousElement, nextElement, popoverRecomputeCounter, isVertical, isVisible, operation, nearestSide]);
const popoverScrollRef = use_popover_scroll(__unstableContentRef);
// This is only needed for a smooth transition when moving blocks.
// When blocks are moved up/down, their position can be set by
// updating the `transform` property manually (i.e. without using CSS
// transitions or animations). The animation, which can also scroll the block
// editor, can sometimes cause the position of the Popover to get out of sync.
// A MutationObserver is therefore used to make sure that changes to the
// selectedElement's attribute (i.e. `transform`) can be tracked and used to
// trigger the Popover to rerender.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (!previousElement) {
return;
}
const observer = new window.MutationObserver(forcePopoverRecompute);
observer.observe(previousElement, {
attributes: true
});
return () => {
observer.disconnect();
};
}, [previousElement]);
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (!nextElement) {
return;
}
const observer = new window.MutationObserver(forcePopoverRecompute);
observer.observe(nextElement, {
attributes: true
});
return () => {
observer.disconnect();
};
}, [nextElement]);
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (!previousElement) {
return;
}
previousElement.ownerDocument.defaultView.addEventListener('resize', forcePopoverRecompute);
return () => {
previousElement.ownerDocument.defaultView?.removeEventListener('resize', forcePopoverRecompute);
};
}, [previousElement]);
// If there's either a previous or a next element, show the inbetween popover.
// Note that drag and drop uses the inbetween popover to show the drop indicator
// before the first block and after the last block.
if (!previousElement && !nextElement || !isVisible) {
return null;
}
/* 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_React_.createElement)(external_wp_components_namespaceObject.Popover, {
ref: popoverScrollRef,
animate: false,
anchor: popoverAnchor,
focusOnMount: false
// Render in the old slot if needed for backward compatibility,
// otherwise render in place (not in the default popover slot).
,
__unstableSlotName: __unstablePopoverSlot,
inline: !__unstablePopoverSlot
// 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,
...props,
className: classnames_default()('block-editor-block-popover', 'block-editor-block-popover__inbetween', props.className),
resize: false,
flip: false,
placement: "overlay",
variant: "unstyled"
}, (0,external_React_.createElement)("div", {
className: "block-editor-block-popover__inbetween-container"
}, children));
/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
}
/* harmony default export */ const inbetween = (BlockPopoverInbetween);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-popover/drop-zone.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const animateVariants = {
hide: {
opacity: 0,
scaleY: 0.75
},
show: {
opacity: 1,
scaleY: 1
},
exit: {
opacity: 0,
scaleY: 0.9
}
};
function BlockDropZonePopover({
__unstablePopoverSlot,
__unstableContentRef
}) {
const {
clientId
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockOrder,
getBlockInsertionPoint
} = select(store);
const insertionPoint = getBlockInsertionPoint();
const order = getBlockOrder(insertionPoint.rootClientId);
if (!order.length) {
return {};
}
return {
clientId: order[insertionPoint.index]
};
}, []);
const reducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
return (0,external_React_.createElement)(block_popover, {
clientId: clientId,
__unstableCoverTarget: true,
__unstablePopoverSlot: __unstablePopoverSlot,
__unstableContentRef: __unstableContentRef,
className: "block-editor-block-popover__drop-zone"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
"data-testid": "block-popover-drop-zone",
initial: reducedMotion ? animateVariants.show : animateVariants.hide,
animate: animateVariants.show,
exit: reducedMotion ? animateVariants.show : animateVariants.exit,
className: "block-editor-block-popover__drop-zone-foreground"
}));
}
/* harmony default export */ const drop_zone = (BlockDropZonePopover);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/insertion-point.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const insertion_point_InsertionPointOpenRef = (0,external_wp_element_namespaceObject.createContext)();
function InbetweenInsertionPointPopover({
__unstablePopoverSlot,
__unstableContentRef,
operation = 'insert',
nearestSide = 'right'
}) {
const {
selectBlock,
hideInsertionPoint
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const openRef = (0,external_wp_element_namespaceObject.useContext)(insertion_point_InsertionPointOpenRef);
const ref = (0,external_wp_element_namespaceObject.useRef)();
const {
orientation,
previousClientId,
nextClientId,
rootClientId,
isInserterShown,
isDistractionFree,
isNavigationMode
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockOrder,
getBlockListSettings,
getBlockInsertionPoint,
isBlockBeingDragged,
getPreviousBlockClientId,
getNextBlockClientId,
getSettings,
isNavigationMode: _isNavigationMode
} = 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);
}
const settings = getSettings();
return {
previousClientId: _previousClientId,
nextClientId: _nextClientId,
orientation: getBlockListSettings(insertionPoint.rootClientId)?.orientation || 'vertical',
rootClientId: insertionPoint.rootClientId,
isNavigationMode: _isNavigationMode(),
isDistractionFree: settings.isDistractionFree,
isInserterShown: insertionPoint?.__unstableWithInserter
};
}, []);
const {
getBlockEditingMode
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
function onClick(event) {
if (event.target === ref.current && nextClientId && getBlockEditingMode(nextClientId) !== 'disabled') {
selectBlock(nextClientId, -1);
}
}
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();
}
}
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;
}
}
const lineVariants = {
// Initial position starts from the center and invisible.
start: {
opacity: 0,
scale: 0
},
// The line expands to fill the container. If the inserter is visible it
// is delayed so it appears orchestrated.
rest: {
opacity: 1,
scale: 1,
transition: {
delay: isInserterShown ? 0.5 : 0,
type: 'tween'
}
},
hover: {
opacity: 1,
scale: 1,
transition: {
delay: 0.5,
type: 'tween'
}
}
};
const inserterVariants = {
start: {
scale: disableMotion ? 1 : 0
},
rest: {
scale: 1,
transition: {
delay: 0.4,
type: 'tween'
}
}
};
if (isDistractionFree && !isNavigationMode) {
return null;
}
const orientationClassname = orientation === 'horizontal' || operation === 'group' ? 'is-horizontal' : 'is-vertical';
const className = classnames_default()('block-editor-block-list__insertion-point', orientationClassname);
return (0,external_React_.createElement)(inbetween, {
previousClientId: previousClientId,
nextClientId: nextClientId,
__unstablePopoverSlot: __unstablePopoverSlot,
__unstableContentRef: __unstableContentRef,
operation: operation,
nearestSide: nearestSide
}, (0,external_React_.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': isInserterShown
}),
onHoverEnd: maybeHideInserterPoint
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
variants: lineVariants,
className: "block-editor-block-list__insertion-point-indicator",
"data-testid": "block-list-insertion-point-indicator"
}), isInserterShown && (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
variants: inserterVariants,
className: classnames_default()('block-editor-block-list__insertion-point-inserter')
}, (0,external_React_.createElement)(inserter, {
position: "bottom center",
clientId: nextClientId,
rootClientId: rootClientId,
__experimentalIsQuick: true,
onToggle: isOpen => {
openRef.current = isOpen;
},
onSelectOrClose: () => {
openRef.current = false;
}
}))));
}
function InsertionPoint(props) {
const {
insertionPoint,
isVisible,
isBlockListEmpty
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockInsertionPoint,
isBlockInsertionPointVisible,
getBlockCount
} = select(store);
const blockInsertionPoint = getBlockInsertionPoint();
return {
insertionPoint: blockInsertionPoint,
isVisible: isBlockInsertionPointVisible(),
isBlockListEmpty: getBlockCount(blockInsertionPoint?.rootClientId) === 0
};
}, []);
if (!isVisible ||
// Don't render the insertion point if the block list is empty.
// The insertion point will be represented by the appender instead.
isBlockListEmpty) {
return null;
}
/**
* Render a popover that overlays the block when the desired operation is to replace it.
* Otherwise, render a popover in between blocks for the indication of inserting between them.
*/
return insertionPoint.operation === 'replace' ? (0,external_React_.createElement)(drop_zone
// Force remount to trigger the animation.
, {
key: `${insertionPoint.rootClientId}-${insertionPoint.index}`,
...props
}) : (0,external_React_.createElement)(InbetweenInsertionPointPopover, {
operation: insertionPoint.operation,
nearestSide: insertionPoint.nearestSide,
...props
});
}
;// 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)(insertion_point_InsertionPointOpenRef);
const isInBetweenInserterDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().isDistractionFree || select(store).__unstableGetEditorMode() === 'zoom-out', []);
const {
getBlockListSettings,
getBlockIndex,
isMultiSelecting,
getSelectedBlockClientIds,
getTemplateLock,
__unstableIsWithinBlockOverlay,
getBlockEditingMode,
getBlockName
} = (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 (isInBetweenInserterDisabled) {
return;
}
function onMouseMove(event) {
if (openRef.current) {
return;
}
// Ignore text nodes sometimes detected in FireFox.
if (event.target.nodeType === event.target.TEXT_NODE) {
return;
}
if (isMultiSelecting()) {
return;
}
if (!event.target.classList.contains('block-editor-block-list__layout')) {
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');
}
if (getTemplateLock(rootClientId) || getBlockEditingMode(rootClientId) === 'disabled' || getBlockName(rootClientId) === 'core/block') {
return;
}
const orientation = getBlockListSettings(rootClientId)?.orientation || 'vertical';
const offsetTop = event.clientY;
const offsetLeft = event.clientX;
const children = Array.from(event.target.children);
let element = children.find(blockEl => {
const blockElRect = blockEl.getBoundingClientRect();
return blockEl.classList.contains('wp-block') && orientation === 'vertical' && blockElRect.top > offsetTop || blockEl.classList.contains('wp-block') && orientation === 'horizontal' && ((0,external_wp_i18n_namespaceObject.isRTL)() ? blockElRect.right < offsetLeft : blockElRect.left > offsetLeft);
});
if (!element) {
hideInsertionPoint();
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) {
hideInsertionPoint();
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 clientId = element.id.slice('block-'.length);
if (!clientId || __unstableIsWithinBlockOverlay(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)) {
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) {
hideInsertionPoint();
return;
}
showInsertionPoint(rootClientId, index, {
__unstableWithInserter: true
});
}
node.addEventListener('mousemove', onMouseMove);
return () => {
node.removeEventListener('mousemove', onMouseMove);
};
}, [openRef, getBlockListSettings, getBlockIndex, isMultiSelecting, showInsertionPoint, hideInsertionPoint, getSelectedBlockClientIds, isInBetweenInserterDisabled]);
}
;// 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_React_.createElement)(WrappedComponent, {
...props,
clientId: clientId
});
}, 'withClientId');
/* harmony default export */ const 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 = ({
clientId,
showSeparator,
isFloating,
onAddBlock,
isToggle
}) => {
return (0,external_React_.createElement)(button_block_appender, {
className: classnames_default()({
'block-list-appender__toggle': isToggle
}),
rootClientId: clientId,
showSeparator: showSeparator,
isFloating: isFloating,
onAddBlock: onAddBlock
});
};
/* harmony default export */ const 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
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const default_block_appender_DefaultBlockAppender = ({
clientId
}) => {
return (0,external_React_.createElement)(DefaultBlockAppender, {
rootClientId: clientId
});
};
/* harmony default export */ const default_block_appender = ((0,external_wp_compose_namespaceObject.compose)([with_client_id, (0,external_wp_data_namespaceObject.withSelect)((select, {
clientId
}) => {
const {
getBlockOrder
} = select(store);
const blockClientIds = getBlockOrder(clientId);
return {
lastBlockClientId: blockClientIds[blockClientIds.length - 1]
};
})])(default_block_appender_DefaultBlockAppender));
;// 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 */
const pendingSettingsUpdates = new WeakMap();
function useShallowMemo(value) {
const [prevValue, setPrevValue] = (0,external_wp_element_namespaceObject.useState)(value);
if (!external_wp_isShallowEqual_default()(prevValue, value)) {
setPrevValue(value);
}
return prevValue;
}
/**
* 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} parentLock
* @param {string[]} allowedBlocks An array of block names which are permitted
* in inner blocks.
* @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.
* @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ].
* @param {?Function|boolean} directInsert If a default block should be inserted directly by the appender.
*
* @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead.
*
* @param {?Function|boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.
*
* @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, parentLock, allowedBlocks, prioritizedInserterBlocks, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout) {
// Instead of adding a useSelect mapping here, please add to the useSelect
// mapping in InnerBlocks! Every subscription impacts performance.
const {
updateBlockListSettings
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
// Implementors often pass a new array on every render,
// and the contents of the arrays are just strings, so the entire array
// can be passed as dependencies but We need to include the length of the array,
// otherwise if the arrays change length but the first elements are equal the comparison,
// does not works as expected.
const _allowedBlocks = useShallowMemo(allowedBlocks);
const _prioritizedInserterBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => prioritizedInserterBlocks,
// eslint-disable-next-line react-hooks/exhaustive-deps
prioritizedInserterBlocks);
const _templateLock = templateLock === undefined || parentLock === 'contentOnly' ? parentLock : templateLock;
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
const newSettings = {
allowedBlocks: _allowedBlocks,
prioritizedInserterBlocks: _prioritizedInserterBlocks,
templateLock: _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?.type);
newSettings.orientation = layoutType.getOrientation(layout);
}
if (__experimentalDefaultBlock !== undefined) {
external_wp_deprecated_default()('__experimentalDefaultBlock', {
alternative: 'defaultBlock',
since: '6.3',
version: '6.4'
});
newSettings.defaultBlock = __experimentalDefaultBlock;
}
if (defaultBlock !== undefined) {
newSettings.defaultBlock = defaultBlock;
}
if (__experimentalDirectInsert !== undefined) {
external_wp_deprecated_default()('__experimentalDirectInsert', {
alternative: 'directInsert',
since: '6.3',
version: '6.4'
});
newSettings.directInsert = __experimentalDirectInsert;
}
if (directInsert !== undefined) {
newSettings.directInsert = directInsert;
}
// Batch updates to block list settings to avoid triggering cascading renders
// for each container block included in a tree and optimize initial render.
// To avoid triggering updateBlockListSettings for each container block
// causing X re-renderings for X container blocks,
// we batch all the updatedBlockListSettings in a single "data" batch
// which results in a single re-render.
if (!pendingSettingsUpdates.get(registry)) {
pendingSettingsUpdates.set(registry, []);
}
pendingSettingsUpdates.get(registry).push([clientId, newSettings]);
window.queueMicrotask(() => {
if (pendingSettingsUpdates.get(registry)?.length) {
registry.batch(() => {
pendingSettingsUpdates.get(registry).forEach(args => {
updateBlockListSettings(...args);
});
pendingSettingsUpdates.set(registry, []);
});
}
});
}, [clientId, _allowedBlocks, _prioritizedInserterBlocks, _templateLock, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, captureToolbars, orientation, updateBlockListSettings, layout, registry]);
}
;// 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" or templateLock = "contentOnly"),
* 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) {
// Instead of adding a useSelect mapping here, please add to the useSelect
// mapping in InnerBlocks! Every subscription impacts performance.
const {
getBlocks,
getSelectedBlocksInitialCaretPosition,
isBlockSelected
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
replaceInnerBlocks,
__unstableMarkNextChangeAsNotPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
// 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)(() => {
let isCancelled = false;
// There's an implicit dependency between useInnerBlockTemplateSync and useNestedSettingsUpdate
// The former needs to happen after the latter and since the latter is using microtasks to batch updates (performance optimization),
// we need to schedule this one in a microtask as well.
// Example: If you remove queueMicrotask here, ctrl + click to insert quote block won't close the inserter.
window.queueMicrotask(() => {
if (isCancelled) {
return;
}
// Only synchronize innerBlocks with template if innerBlocks are empty
// or a locking "all" or "contentOnly" exists directly on the block.
const currentInnerBlocks = getBlocks(clientId);
const shouldApplyTemplate = currentInnerBlocks.length === 0 || templateLock === 'all' || templateLock === 'contentOnly';
const hasTemplateChanged = !es6_default()(template, existingTemplate.current);
if (!shouldApplyTemplate || !hasTemplateChanged) {
return;
}
existingTemplate.current = template;
const nextBlocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(currentInnerBlocks, template);
if (!es6_default()(nextBlocks, currentInnerBlocks)) {
__unstableMarkNextChangeAsNotPersistent();
replaceInnerBlocks(clientId, nextBlocks, currentInnerBlocks.length === 0 && templateInsertUpdatesSelection && nextBlocks.length !== 0 && isBlockSelected(clientId),
// 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());
}
});
return () => {
isCancelled = true;
};
}, [template, templateLock, clientId]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/use-block-context.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns a context object for a given block.
*
* @param {string} clientId The block client ID.
*
* @return {Record<string,*>} Context value.
*/
function useBlockContext(clientId) {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const block = select(store).getBlock(clientId);
if (!block) {
return undefined;
}
const blockType = select(external_wp_blocks_namespaceObject.store).getBlockType(block.name);
if (!blockType) {
return undefined;
}
if (Object.keys(blockType.providesContext).length === 0) {
return undefined;
}
return Object.fromEntries(Object.entries(blockType.providesContext).map(([contextName, attributeName]) => [contextName, block.attributes[attributeName]]));
}, [clientId]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-on-block-drop/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('react').SyntheticEvent} SyntheticEvent */
/** @typedef {import('./types').WPDropOperation} WPDropOperation */
/**
* Retrieve the data for a block drop event.
*
* @param {SyntheticEvent} 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} moveBlocks A function that moves blocks.
* @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.
* @param {Function} clearSelectedBlock A function that clears block selection.
* @param {string} operation The type of operation to perform on drop. Could be `insert` or `replace` or `group`.
* @param {Function} getBlock A function that returns a block given its client id.
* @return {Function} The event handler for a block drop event.
*/
function onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocks, insertOrReplaceBlocks, clearSelectedBlock, operation, getBlock) {
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));
insertOrReplaceBlocks(blocksToInsert, 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;
}
// If the user is dropping a block over another block, replace both blocks
// with a group block containing them
if (operation === 'group') {
const blocksToInsert = sourceClientIds.map(clientId => getBlock(clientId));
insertOrReplaceBlocks(blocksToInsert, true, null, sourceClientIds);
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;
moveBlocks(sourceClientIds, sourceRootClientId, 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 {Function} getSettings A function that gets the block editor settings.
* @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} insertOrReplaceBlocks A function that inserts or replaces blocks.
*
* @return {Function} The event handler for a block-related file drop event.
*/
function onFilesDrop(targetRootClientId, getSettings, updateBlockAttributes, canInsertBlockType, insertOrReplaceBlocks) {
return files => {
if (!getSettings().mediaUpload) {
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);
insertOrReplaceBlocks(blocks);
}
};
}
/**
* A function that returns an event handler function for block-related HTML drop events.
*
* @param {Function} insertOrReplaceBlocks A function that inserts or replaces blocks.
*
* @return {Function} The event handler for a block-related HTML drop event.
*/
function onHTMLDrop(insertOrReplaceBlocks) {
return HTML => {
const blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({
HTML,
mode: 'BLOCKS'
});
if (blocks.length) {
insertOrReplaceBlocks(blocks);
}
};
}
/**
* 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.
* @param {Object} options The optional options.
* @param {WPDropOperation} [options.operation] The type of operation to perform on drop. Could be `insert` or `replace` for now.
*
* @return {Function} A function to be passed to the onDrop handler.
*/
function useOnBlockDrop(targetRootClientId, targetBlockIndex, options = {}) {
const {
operation = 'insert',
nearestSide = 'right'
} = options;
const {
canInsertBlockType,
getBlockIndex,
getClientIdsOfDescendants,
getBlockOrder,
getBlocksByClientId,
getSettings,
getBlock,
isGroupable
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
getGroupingBlockName
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
const {
insertBlocks,
moveBlocksToPosition,
updateBlockAttributes,
clearSelectedBlock,
replaceBlocks,
removeBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const insertOrReplaceBlocks = (0,external_wp_element_namespaceObject.useCallback)((blocks, updateSelection = true, initialPosition = 0, clientIdsToReplace = []) => {
if (!Array.isArray(blocks)) blocks = [blocks];
const clientIds = getBlockOrder(targetRootClientId);
const clientId = clientIds[targetBlockIndex];
const blocksClientIds = blocks.map(block => block.clientId);
const areGroupableBlocks = isGroupable([...blocksClientIds, clientId]);
if (operation === 'replace') {
replaceBlocks(clientId, blocks, undefined, initialPosition);
} else if (operation === 'group' && areGroupableBlocks) {
const targetBlock = getBlock(clientId);
if (nearestSide === 'left') {
blocks.push(targetBlock);
} else {
blocks.unshift(targetBlock);
}
const groupInnerBlocks = blocks.map(block => {
return (0,external_wp_blocks_namespaceObject.createBlock)(block.name, block.attributes, block.innerBlocks);
});
const areAllImages = blocks.every(block => {
return block.name === 'core/image';
});
const galleryBlock = canInsertBlockType('core/gallery', targetRootClientId);
const wrappedBlocks = (0,external_wp_blocks_namespaceObject.createBlock)(areAllImages && galleryBlock ? 'core/gallery' : getGroupingBlockName(), {
layout: {
type: 'flex',
flexWrap: areAllImages && galleryBlock ? null : 'nowrap'
}
}, groupInnerBlocks);
// Need to make sure both the target block and the block being dragged are replaced
// otherwise the dragged block will be duplicated.
replaceBlocks([clientId, ...clientIdsToReplace], wrappedBlocks, undefined, initialPosition);
} else {
insertBlocks(blocks, targetBlockIndex, targetRootClientId, updateSelection, initialPosition);
}
}, [getBlockOrder, targetRootClientId, targetBlockIndex, isGroupable, operation, replaceBlocks, getBlock, nearestSide, canInsertBlockType, getGroupingBlockName, insertBlocks]);
const moveBlocks = (0,external_wp_element_namespaceObject.useCallback)((sourceClientIds, sourceRootClientId, insertIndex) => {
if (operation === 'replace') {
const sourceBlocks = getBlocksByClientId(sourceClientIds);
const targetBlockClientIds = getBlockOrder(targetRootClientId);
const targetBlockClientId = targetBlockClientIds[targetBlockIndex];
registry.batch(() => {
// Remove the source blocks.
removeBlocks(sourceClientIds, false);
// Replace the target block with the source blocks.
replaceBlocks(targetBlockClientId, sourceBlocks, undefined, 0);
});
} else {
moveBlocksToPosition(sourceClientIds, sourceRootClientId, targetRootClientId, insertIndex);
}
}, [operation, getBlockOrder, getBlocksByClientId, moveBlocksToPosition, registry, removeBlocks, replaceBlocks, targetBlockIndex, targetRootClientId]);
const _onDrop = onBlockDrop(targetRootClientId, targetBlockIndex, getBlockIndex, getClientIdsOfDescendants, moveBlocks, insertOrReplaceBlocks, clearSelectedBlock, operation, getBlock);
const _onFilesDrop = onFilesDrop(targetRootClientId, getSettings, updateBlockAttributes, canInsertBlockType, insertOrReplaceBlocks);
const _onHTMLDrop = onHTMLDrop(insertOrReplaceBlocks);
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, 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];
}
/**
* 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;
}
/**
* Is the point within the top and bottom boundaries of the rectangle.
*
* @param {WPPoint} point The point.
* @param {DOMRect} rect The rectangle.
*
* @return {boolean} True if the point is within top and bottom of rectangle, false otherwise.
*/
function isPointWithinTopAndBottomBoundariesOfRect(point, rect) {
return rect.top <= point.y && rect.bottom >= point.y;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-block-drop-zone/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const THRESHOLD_DISTANCE = 30;
const MINIMUM_HEIGHT_FOR_THRESHOLD = 120;
const MINIMUM_WIDTH_FOR_THRESHOLD = 120;
/** @typedef {import('../../utils/math').WPPoint} WPPoint */
/** @typedef {import('../use-on-block-drop/types').WPDropOperation} WPDropOperation */
/**
* The orientation of a block list.
*
* @typedef {'horizontal'|'vertical'|undefined} WPBlockListOrientation
*/
/**
* The insert position when dropping a block.
*
* @typedef {'before'|'after'} WPInsertPosition
*/
/**
* @typedef {Object} WPBlockData
* @property {boolean} isUnmodifiedDefaultBlock Is the block unmodified default block.
* @property {() => DOMRect} getBoundingClientRect Get the bounding client rect of the block.
* @property {number} blockIndex The index of the block.
*/
/**
* Get the drop target position from a given drop point and the orientation.
*
* @param {WPBlockData[]} blocksData The block data list.
* @param {WPPoint} position The position of the item being dragged.
* @param {WPBlockListOrientation} orientation The orientation of the block list.
* @param {Object} options Additional options.
* @return {[number, WPDropOperation]} The drop target position.
*/
function getDropTargetPosition(blocksData, position, orientation = 'vertical', options = {}) {
const allowedEdges = orientation === 'horizontal' ? ['left', 'right'] : ['top', 'bottom'];
let nearestIndex = 0;
let insertPosition = 'before';
let minDistance = Infinity;
let targetBlockIndex = null;
let nearestSide = 'right';
const {
dropZoneElement,
parentBlockOrientation,
rootBlockIndex = 0
} = options;
// Allow before/after when dragging over the top/bottom edges of the drop zone.
if (dropZoneElement && parentBlockOrientation !== 'horizontal') {
const rect = dropZoneElement.getBoundingClientRect();
const [distance, edge] = getDistanceToNearestEdge(position, rect, ['top', 'bottom']);
// If dragging over the top or bottom of the drop zone, insert the block
// before or after the parent block. This only applies to blocks that use
// a drop zone element, typically container blocks such as Group or Cover.
if (rect.height > MINIMUM_HEIGHT_FOR_THRESHOLD && distance < THRESHOLD_DISTANCE) {
if (edge === 'top') {
return [rootBlockIndex, 'before'];
}
if (edge === 'bottom') {
return [rootBlockIndex + 1, 'after'];
}
}
}
const isRightToLeft = (0,external_wp_i18n_namespaceObject.isRTL)();
// Allow before/after when dragging over the left/right edges of the drop zone.
if (dropZoneElement && parentBlockOrientation === 'horizontal') {
const rect = dropZoneElement.getBoundingClientRect();
const [distance, edge] = getDistanceToNearestEdge(position, rect, ['left', 'right']);
// If dragging over the left or right of the drop zone, insert the block
// before or after the parent block. This only applies to blocks that use
// a drop zone element, typically container blocks such as Group.
if (rect.width > MINIMUM_WIDTH_FOR_THRESHOLD && distance < THRESHOLD_DISTANCE) {
if (isRightToLeft && edge === 'right' || !isRightToLeft && edge === 'left') {
return [rootBlockIndex, 'before'];
}
if (isRightToLeft && edge === 'left' || !isRightToLeft && edge === 'right') {
return [rootBlockIndex + 1, 'after'];
}
}
}
blocksData.forEach(({
isUnmodifiedDefaultBlock,
getBoundingClientRect,
blockIndex,
blockOrientation
}) => {
const rect = getBoundingClientRect();
let [distance, edge] = getDistanceToNearestEdge(position, rect, allowedEdges);
// If the the point is close to a side, prioritize that side.
const [sideDistance, sideEdge] = getDistanceToNearestEdge(position, rect, ['left', 'right']);
const isPointInsideRect = isPointContainedByRect(position, rect);
// Prioritize the element if the point is inside of an unmodified default block.
if (isUnmodifiedDefaultBlock && isPointInsideRect) {
distance = 0;
} else if (orientation === 'vertical' && blockOrientation !== 'horizontal' && (isPointInsideRect && sideDistance < THRESHOLD_DISTANCE || !isPointInsideRect && isPointWithinTopAndBottomBoundariesOfRect(position, rect))) {
/**
* This condition should only apply when the layout is vertical (otherwise there's
* no need to create a Row) and dropzones should only activate when the block is
* either within and close to the sides of the target block or on its outer sides.
*/
targetBlockIndex = blockIndex;
nearestSide = sideEdge;
}
if (distance < minDistance) {
// Where the dropped block will be inserted on the nearest block.
insertPosition = edge === 'bottom' || !isRightToLeft && edge === 'right' || isRightToLeft && edge === 'left' ? 'after' : 'before';
// Update the currently known best candidate.
minDistance = distance;
nearestIndex = blockIndex;
}
});
const adjacentIndex = nearestIndex + (insertPosition === 'after' ? 1 : -1);
const isNearestBlockUnmodifiedDefaultBlock = !!blocksData[nearestIndex]?.isUnmodifiedDefaultBlock;
const isAdjacentBlockUnmodifiedDefaultBlock = !!blocksData[adjacentIndex]?.isUnmodifiedDefaultBlock;
// If the target index is set then group with the block at that index.
if (targetBlockIndex !== null) {
return [targetBlockIndex, 'group', nearestSide];
}
// If both blocks are not unmodified default blocks then just insert between them.
if (!isNearestBlockUnmodifiedDefaultBlock && !isAdjacentBlockUnmodifiedDefaultBlock) {
// If the user is dropping to the trailing edge of the block
// add 1 to the index to represent dragging after.
const insertionIndex = insertPosition === 'after' ? nearestIndex + 1 : nearestIndex;
return [insertionIndex, 'insert'];
}
// Otherwise, replace the nearest unmodified default block.
return [isNearestBlockUnmodifiedDefaultBlock ? nearestIndex : adjacentIndex, 'replace'];
}
/**
* Check if the dragged blocks can be dropped on the target.
* @param {Function} getBlockType
* @param {Object[]} allowedBlocks
* @param {string[]} draggedBlockNames
* @param {string} targetBlockName
* @return {boolean} Whether the dragged blocks can be dropped on the target.
*/
function isDropTargetValid(getBlockType, allowedBlocks, draggedBlockNames, targetBlockName) {
// At root level allowedBlocks is undefined and all blocks are allowed.
// Otherwise, check if all dragged blocks are allowed.
let areBlocksAllowed = true;
if (allowedBlocks) {
const allowedBlockNames = allowedBlocks?.map(({
name
}) => name);
areBlocksAllowed = draggedBlockNames.every(name => allowedBlockNames?.includes(name));
}
// Work out if dragged blocks have an allowed parent and if so
// check target block matches the allowed parent.
const draggedBlockTypes = draggedBlockNames.map(name => getBlockType(name));
const targetMatchesDraggedBlockParents = draggedBlockTypes.every(block => {
const [allowedParentName] = block?.parent || [];
if (!allowedParentName) {
return true;
}
return allowedParentName === targetBlockName;
});
return areBlocksAllowed && targetMatchesDraggedBlockParents;
}
/**
* @typedef {Object} WPBlockDropZoneConfig
* @property {?HTMLElement} dropZoneElement Optional element to be used as the drop zone.
* @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({
dropZoneElement,
// 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 = '',
parentClientId: parentBlockClientId = '',
isDisabled = false
} = {}) {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const [dropTarget, setDropTarget] = (0,external_wp_element_namespaceObject.useState)({
index: null,
operation: 'insert'
});
const {
getBlockType
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
const {
getBlockListSettings,
getBlocks,
getBlockIndex,
getDraggedBlockClientIds,
getBlockNamesByClientId,
getAllowedBlocks,
isDragging
} = unlock((0,external_wp_data_namespaceObject.useSelect)(store));
const {
showInsertionPoint,
hideInsertionPoint,
startDragging,
stopDragging
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
const onBlockDrop = useOnBlockDrop(dropTarget.operation === 'before' || dropTarget.operation === 'after' ? parentBlockClientId : targetRootClientId, dropTarget.index, {
operation: dropTarget.operation,
nearestSide: dropTarget.nearestSide
});
const throttled = (0,external_wp_compose_namespaceObject.useThrottle)((0,external_wp_element_namespaceObject.useCallback)((event, ownerDocument) => {
if (!isDragging()) {
// When dragging from the desktop, no drag start event is fired.
// So, ensure that the drag state is set when the user drags over a drop zone.
startDragging();
}
const allowedBlocks = getAllowedBlocks(targetRootClientId);
const targetBlockName = getBlockNamesByClientId([targetRootClientId])[0];
const draggedBlockNames = getBlockNamesByClientId(getDraggedBlockClientIds());
const isBlockDroppingAllowed = isDropTargetValid(getBlockType, allowedBlocks, draggedBlockNames, targetBlockName);
if (!isBlockDroppingAllowed) {
return;
}
const blocks = getBlocks(targetRootClientId);
// The block list is empty, don't show the insertion point but still allow dropping.
if (blocks.length === 0) {
registry.batch(() => {
setDropTarget({
index: 0,
operation: 'insert'
});
showInsertionPoint(targetRootClientId, 0, {
operation: 'insert'
});
});
return;
}
const blocksData = blocks.map(block => {
const clientId = block.clientId;
return {
isUnmodifiedDefaultBlock: (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(block),
getBoundingClientRect: () => ownerDocument.getElementById(`block-${clientId}`).getBoundingClientRect(),
blockIndex: getBlockIndex(clientId),
blockOrientation: getBlockListSettings(clientId)?.orientation
};
});
const [targetIndex, operation, nearestSide] = getDropTargetPosition(blocksData, {
x: event.clientX,
y: event.clientY
}, getBlockListSettings(targetRootClientId)?.orientation, {
dropZoneElement,
parentBlockClientId,
parentBlockOrientation: parentBlockClientId ? getBlockListSettings(parentBlockClientId)?.orientation : undefined,
rootBlockIndex: getBlockIndex(targetRootClientId)
});
registry.batch(() => {
setDropTarget({
index: targetIndex,
operation,
nearestSide
});
const insertionPointClientId = ['before', 'after'].includes(operation) ? parentBlockClientId : targetRootClientId;
showInsertionPoint(insertionPointClientId, targetIndex, {
operation,
nearestSide
});
});
}, [getAllowedBlocks, targetRootClientId, getBlockNamesByClientId, getDraggedBlockClientIds, getBlockType, getBlocks, getBlockListSettings, dropZoneElement, parentBlockClientId, getBlockIndex, registry, showInsertionPoint, isDragging, startDragging]), 200);
return (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({
dropZoneElement,
isDisabled,
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.ownerDocument);
},
onDragLeave() {
throttled.cancel();
hideInsertionPoint();
},
onDragEnd() {
throttled.cancel();
stopDragging();
hideInsertionPoint();
}
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inner-blocks/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const inner_blocks_EMPTY_OBJECT = {};
function BlockContext({
children,
clientId
}) {
const context = useBlockContext(clientId);
return (0,external_React_.createElement)(BlockContextProvider, {
value: context
}, children);
}
const BlockListItemsMemo = (0,external_wp_element_namespaceObject.memo)(BlockListItems);
/**
* 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,
prioritizedInserterBlocks,
defaultBlock,
directInsert,
__experimentalDefaultBlock,
__experimentalDirectInsert,
template,
templateLock,
wrapperRef,
templateInsertUpdatesSelection,
__experimentalCaptureToolbars: captureToolbars,
__experimentalAppenderTagName,
renderAppender,
orientation,
placeholder,
layout,
name,
blockType,
parentLock,
defaultLayout
} = props;
useNestedSettingsUpdate(clientId, parentLock, allowedBlocks, prioritizedInserterBlocks, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout);
useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection);
const defaultLayoutBlockSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, 'layout') || (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, '__experimentalLayout') || inner_blocks_EMPTY_OBJECT;
const {
allowSizingOnChildren = false
} = defaultLayoutBlockSupport;
const usedLayout = layout || defaultLayoutBlockSupport;
const memoedLayout = (0,external_wp_element_namespaceObject.useMemo)(() => ({
// Default layout will know about any content/wide size defined by the theme.
...defaultLayout,
...usedLayout,
...(allowSizingOnChildren && {
allowSizingOnChildren: true
})
}), [defaultLayout, usedLayout, allowSizingOnChildren]);
// For controlled inner blocks, we don't want a change in blocks to
// re-render the blocks list.
const items = (0,external_React_.createElement)(BlockListItemsMemo, {
rootClientId: clientId,
renderAppender: renderAppender,
__experimentalAppenderTagName: __experimentalAppenderTagName,
layout: memoedLayout,
wrapperRef: wrapperRef,
placeholder: placeholder
});
if (Object.keys(blockType.providesContext).length === 0) {
return items;
}
return (0,external_React_.createElement)(BlockContext, {
clientId: clientId
}, items);
}
/**
* 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_React_.createElement)(UncontrolledInnerBlocks, {
...props
});
}
const ForwardedInnerBlocks = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
const innerBlocksProps = useInnerBlocksProps({
ref
}, props);
return (0,external_React_.createElement)("div", {
className: "block-editor-inner-blocks"
}, (0,external_React_.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 {
__unstableDisableLayoutClassNames,
__unstableDisableDropZone,
dropZoneElement
} = options;
const {
clientId,
layout = null,
__unstableLayoutClassNames: layoutClassNames = ''
} = useBlockEditContext();
const selected = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!clientId) {
return {};
}
const {
getBlockName,
isBlockSelected,
hasSelectedInnerBlock,
__unstableGetEditorMode,
getTemplateLock,
getBlockRootClientId,
getBlockEditingMode,
getBlockSettings,
isDragging
} = unlock(select(store));
const {
hasBlockSupport,
getBlockType
} = select(external_wp_blocks_namespaceObject.store);
const blockName = getBlockName(clientId);
const enableClickThrough = __unstableGetEditorMode() === 'navigation';
const blockEditingMode = getBlockEditingMode(clientId);
const parentClientId = getBlockRootClientId(clientId);
const [defaultLayout] = getBlockSettings(clientId, 'layout');
return {
__experimentalCaptureToolbars: hasBlockSupport(blockName, '__experimentalExposeControlsToChildren', false),
hasOverlay: blockName !== 'core/template' && !isBlockSelected(clientId) && !hasSelectedInnerBlock(clientId, true) && enableClickThrough && !isDragging(),
name: blockName,
blockType: getBlockType(blockName),
parentLock: getTemplateLock(parentClientId),
parentClientId,
isDropZoneDisabled: blockEditingMode === 'disabled',
defaultLayout
};
}, [clientId]);
const {
__experimentalCaptureToolbars,
hasOverlay,
name,
blockType,
parentLock,
parentClientId,
isDropZoneDisabled,
defaultLayout
} = selected;
const blockDropZoneRef = useBlockDropZone({
dropZoneElement,
rootClientId: clientId,
parentClientId,
isDisabled: isDropZoneDisabled
});
const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, __unstableDisableDropZone ? null : blockDropZoneRef]);
const innerBlocksProps = {
__experimentalCaptureToolbars,
layout,
name,
blockType,
parentLock,
defaultLayout,
...options
};
const InnerBlocks = innerBlocksProps.value && innerBlocksProps.onChange ? ControlledInnerBlocks : UncontrolledInnerBlocks;
return {
...props,
ref,
className: classnames_default()(props.className, 'block-editor-block-list__layout', __unstableDisableLayoutClassNames ? '' : layoutClassNames, {
'has-overlay': hasOverlay
}),
children: clientId ? (0,external_React_.createElement)(InnerBlocks, {
...innerBlocksProps,
clientId: clientId
}) : (0,external_React_.createElement)(BlockListItems, {
...options
})
};
}
useInnerBlocksProps.save = external_wp_blocks_namespaceObject.__unstableGetInnerBlocksProps;
// Expose default appender placeholders as components.
ForwardedInnerBlocks.DefaultBlockAppender = 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 */ const inner_blocks = (ForwardedInnerBlocks);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/observe-typing/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Set of key codes upon which typing is to be initiated on a keydown event.
*
* @type {Set<number>}
*/
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
* text navigation without shift active.
*
* @param {KeyboardEvent} event Keydown event to test.
*
* @return {boolean} Whether event is eligible to start typing.
*/
function isKeyDownEligibleForStartTyping(event) {
const {
keyCode,
shiftKey
} = event;
return !shiftKey && KEY_DOWN_ELIGIBLE_KEY_CODES.has(keyCode);
}
/**
* Removes the `isTyping` flag when the mouse moves in the document of the given
* element.
*/
function useMouseMoveTypingReset() {
const isTyping = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isTyping(), []);
const {
stopTyping
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
if (!isTyping) {
return;
}
const {
ownerDocument
} = node;
let lastClientX;
let lastClientY;
/**
* On mouse move, unset typing flag if user has moved cursor.
*
* @param {MouseEvent} event Mousemove event.
*/
function stopTypingOnMouseMove(event) {
const {
clientX,
clientY
} = event;
// We need to check that the mouse really moved because Safari
// triggers mousemove events when shift or ctrl are pressed.
if (lastClientX && lastClientY && (lastClientX !== clientX || lastClientY !== clientY)) {
stopTyping();
}
lastClientX = clientX;
lastClientY = clientY;
}
ownerDocument.addEventListener('mousemove', stopTypingOnMouseMove);
return () => {
ownerDocument.removeEventListener('mousemove', stopTypingOnMouseMove);
};
}, [isTyping, stopTyping]);
}
/**
* Sets and removes the `isTyping` flag based on user actions:
*
* - Sets the flag if the user types within the given element.
* - Removes the flag when the user selects some text, focusses a non-text
* field, presses ESC or TAB, or moves the mouse in the document.
*/
function useTypingObserver() {
const {
isTyping,
hasInlineToolbar
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
isTyping: _isTyping,
getSettings
} = select(store);
return {
isTyping: _isTyping(),
hasInlineToolbar: getSettings().hasInlineToolbar
};
}, []);
const {
startTyping,
stopTyping
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const ref1 = useMouseMoveTypingReset();
const ref2 = (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
const {
ownerDocument
} = node;
const {
defaultView
} = ownerDocument;
const selection = defaultView.getSelection();
// Listeners to stop typing should only be added when typing.
// Listeners to start typing should only be added when not typing.
if (isTyping) {
let timerId;
/**
* Stops typing when focus transitions to a non-text field element.
*
* @param {FocusEvent} event Focus event.
*/
function stopTypingOnNonTextField(event) {
const {
target
} = event;
// Since focus to a non-text field via arrow key will trigger
// before the keydown event, wait until after current stack
// before evaluating whether typing is to be stopped. Otherwise,
// typing will re-start.
timerId = defaultView.setTimeout(() => {
if (!(0,external_wp_dom_namespaceObject.isTextField)(target)) {
stopTyping();
}
});
}
/**
* Unsets typing flag if user presses Escape while typing flag is
* active.
*
* @param {KeyboardEvent} event Keypress or keydown event to
* interpret.
*/
function stopTypingOnEscapeKey(event) {
const {
keyCode
} = event;
if (keyCode === external_wp_keycodes_namespaceObject.ESCAPE || keyCode === external_wp_keycodes_namespaceObject.TAB) {
stopTyping();
}
}
/**
* On selection change, unset typing flag if user has made an
* uncollapsed (shift) selection.
*/
function stopTypingOnSelectionUncollapse() {
if (!selection.isCollapsed) {
stopTyping();
}
}
node.addEventListener('focus', stopTypingOnNonTextField);
node.addEventListener('keydown', stopTypingOnEscapeKey);
if (!hasInlineToolbar) {
ownerDocument.addEventListener('selectionchange', stopTypingOnSelectionUncollapse);
}
return () => {
defaultView.clearTimeout(timerId);
node.removeEventListener('focus', stopTypingOnNonTextField);
node.removeEventListener('keydown', stopTypingOnEscapeKey);
ownerDocument.removeEventListener('selectionchange', stopTypingOnSelectionUncollapse);
};
}
/**
* Handles a keypress or keydown event to infer intention to start
* typing.
*
* @param {KeyboardEvent} event Keypress or keydown event to interpret.
*/
function startTypingInTextField(event) {
const {
type,
target
} = event;
// Abort early if already typing, or key press is incurred outside a
// text field (e.g. arrow-ing through toolbar buttons).
// Ignore typing if outside the current DOM container
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
// there are many keydown which are explicitly not targeted for
// typing.
if (type === 'keydown' && !isKeyDownEligibleForStartTyping(event)) {
return;
}
startTyping();
}
node.addEventListener('keypress', startTypingInTextField);
node.addEventListener('keydown', startTypingInTextField);
return () => {
node.removeEventListener('keypress', startTypingInTextField);
node.removeEventListener('keydown', startTypingInTextField);
};
}, [isTyping, hasInlineToolbar, startTyping, stopTyping]);
return (0,external_wp_compose_namespaceObject.useMergeRefs)([ref1, ref2]);
}
function ObserveTyping({
children
}) {
return (0,external_React_.createElement)("div", {
ref: useTypingObserver()
}, children);
}
/**
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/observe-typing/README.md
*/
/* harmony default export */ const observe_typing = (ObserveTyping);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-list/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const block_list_IntersectionObserver = (0,external_wp_element_namespaceObject.createContext)();
const pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();
function block_list_Root({
className,
...settings
}) {
const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
const {
isOutlineMode,
isFocusMode,
editorMode
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings,
__unstableGetEditorMode
} = select(store);
const {
outlineMode,
focusMode
} = getSettings();
return {
isOutlineMode: outlineMode,
isFocusMode: focusMode,
editorMode: __unstableGetEditorMode()
};
}, []);
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
setBlockVisibility
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const delayedBlockVisibilityUpdates = (0,external_wp_compose_namespaceObject.useDebounce)((0,external_wp_element_namespaceObject.useCallback)(() => {
const updates = {};
pendingBlockVisibilityUpdatesPerRegistry.get(registry).forEach(([id, isIntersecting]) => {
updates[id] = isIntersecting;
});
setBlockVisibility(updates);
}, [registry]), 300, {
trailing: true
});
const intersectionObserver = (0,external_wp_element_namespaceObject.useMemo)(() => {
const {
IntersectionObserver: Observer
} = window;
if (!Observer) {
return;
}
return new Observer(entries => {
if (!pendingBlockVisibilityUpdatesPerRegistry.get(registry)) {
pendingBlockVisibilityUpdatesPerRegistry.set(registry, []);
}
for (const entry of entries) {
const clientId = entry.target.getAttribute('data-block');
pendingBlockVisibilityUpdatesPerRegistry.get(registry).push([clientId, entry.isIntersecting]);
}
delayedBlockVisibilityUpdates();
});
}, []);
const innerBlocksProps = useInnerBlocksProps({
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([useBlockSelectionClearer(), useInBetweenInserter(), useTypingObserver()]),
className: classnames_default()('is-root-container', className, {
'is-outline-mode': isOutlineMode,
'is-focus-mode': isFocusMode && isLargeViewport,
'is-navigate-mode': editorMode === 'navigation'
})
}, settings);
return (0,external_React_.createElement)(block_list_IntersectionObserver.Provider, {
value: intersectionObserver
}, (0,external_React_.createElement)("div", {
...innerBlocksProps
}));
}
function StopEditingAsBlocksOnOutsideSelect({
clientId
}) {
const {
stopEditingAsBlocks
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
const isBlockOrDescendantSelected = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
isBlockSelected,
hasSelectedInnerBlock
} = select(store);
return isBlockSelected(clientId) || hasSelectedInnerBlock(clientId, true);
}, [clientId]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isBlockOrDescendantSelected) {
stopEditingAsBlocks(clientId);
}
}, [isBlockOrDescendantSelected, clientId, stopEditingAsBlocks]);
return null;
}
function BlockList(settings) {
return (0,external_React_.createElement)(Provider, {
value: DEFAULT_BLOCK_EDIT_CONTEXT
}, (0,external_React_.createElement)(block_list_Root, {
...settings
}));
}
function Items({
placeholder,
rootClientId,
renderAppender: CustomAppender,
__experimentalAppenderTagName,
layout = defaultLayout
}) {
// Avoid passing CustomAppender to useSelect because it could be a new
// function on every render.
const hasAppender = CustomAppender !== false;
const hasCustomAppender = !!CustomAppender;
const {
order,
selectedBlocks,
visibleBlocks,
temporarilyEditingAsBlocks,
shouldRenderAppender
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockOrder,
getSelectedBlockClientId,
getSelectedBlockClientIds,
__unstableGetVisibleBlocks,
__unstableGetTemporarilyEditingAsBlocks,
getTemplateLock,
getBlockEditingMode,
__unstableGetEditorMode
} = select(store);
const selectedBlockClientId = getSelectedBlockClientId();
return {
order: getBlockOrder(rootClientId),
selectedBlocks: getSelectedBlockClientIds(),
visibleBlocks: __unstableGetVisibleBlocks(),
temporarilyEditingAsBlocks: __unstableGetTemporarilyEditingAsBlocks(),
shouldRenderAppender: hasAppender && (hasCustomAppender ? !getTemplateLock(rootClientId) && getBlockEditingMode(rootClientId) !== 'disabled' && __unstableGetEditorMode() !== 'zoom-out' : rootClientId === selectedBlockClientId || !rootClientId && !selectedBlockClientId)
};
}, [rootClientId, hasAppender, hasCustomAppender]);
return (0,external_React_.createElement)(LayoutProvider, {
value: layout
}, order.map(clientId => (0,external_React_.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, {
key: clientId,
value:
// Only provide data asynchronously if the block is
// not visible and not selected.
!visibleBlocks.has(clientId) && !selectedBlocks.includes(clientId)
}, (0,external_React_.createElement)(block_list_block, {
rootClientId: rootClientId,
clientId: clientId
}))), order.length < 1 && placeholder, !!temporarilyEditingAsBlocks && (0,external_React_.createElement)(StopEditingAsBlocksOnOutsideSelect, {
clientId: temporarilyEditingAsBlocks
}), shouldRenderAppender && (0,external_React_.createElement)(BlockListAppender, {
tagName: __experimentalAppenderTagName,
rootClientId: rootClientId,
CustomAppender: CustomAppender
}));
}
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_React_.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, {
value: false
}, (0,external_React_.createElement)(Items, {
...props
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-block-toolbar-popover-props.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const COMMON_PROPS = {
placement: 'top-start'
};
// By default the toolbar sets the `shift` prop. If the user scrolls the page
// down the toolbar will stay on screen by adopting a sticky position at the
// top of the viewport.
const DEFAULT_PROPS = {
...COMMON_PROPS,
flip: false,
shift: true
};
// When there isn't enough height between the top of the block and the editor
// canvas, the `shift` prop is set to `false`, as it will cause the block to be
// obscured. The `flip` behavior is enabled, which positions the toolbar below
// the block. This only happens if the block is smaller than the viewport, as
// otherwise the toolbar will be off-screen.
const RESTRICTED_HEIGHT_PROPS = {
...COMMON_PROPS,
flip: true,
shift: false
};
/**
* Get the popover props for the block toolbar, determined by the space at the top of the canvas and the toolbar height.
*
* @param {Element} contentElement The DOM element that represents the editor content or canvas.
* @param {Element} selectedBlockElement The outer DOM element of the first selected block.
* @param {Element} scrollContainer The scrollable container for the contentElement.
* @param {number} toolbarHeight The height of the toolbar in pixels.
* @param {boolean} isSticky Whether or not the selected block is sticky or fixed.
*
* @return {Object} The popover props used to determine the position of the toolbar.
*/
function getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky) {
if (!contentElement || !selectedBlockElement) {
return DEFAULT_PROPS;
}
// Get how far the content area has been scrolled.
const scrollTop = scrollContainer?.scrollTop || 0;
const blockRect = selectedBlockElement.getBoundingClientRect();
const contentRect = contentElement.getBoundingClientRect();
// Get the vertical position of top of the visible content area.
const topOfContentElementInViewport = scrollTop + contentRect.top;
// The document element's clientHeight represents the viewport height.
const viewportHeight = contentElement.ownerDocument.documentElement.clientHeight;
// The restricted height area is calculated as the sum of the
// vertical position of the visible content area, plus the height
// of the block toolbar.
const restrictedTopArea = topOfContentElementInViewport + toolbarHeight;
const hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;
const isBlockTallerThanViewport = blockRect.height > viewportHeight - toolbarHeight;
// Sticky blocks are treated as if they will never have enough space for the toolbar above.
if (!isSticky && (hasSpaceForToolbarAbove || isBlockTallerThanViewport)) {
return DEFAULT_PROPS;
}
return RESTRICTED_HEIGHT_PROPS;
}
/**
* Determines the desired popover positioning behavior, returning a set of appropriate props.
*
* @param {Object} elements
* @param {Element} elements.contentElement The DOM element that represents the editor content or canvas.
* @param {string} elements.clientId The clientId of the first selected block.
*
* @return {Object} The popover props used to determine the position of the toolbar.
*/
function useBlockToolbarPopoverProps({
contentElement,
clientId
}) {
const selectedBlockElement = useBlockElement(clientId);
const [toolbarHeight, setToolbarHeight] = (0,external_wp_element_namespaceObject.useState)(0);
const {
blockIndex,
isSticky
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockIndex,
getBlockAttributes
} = select(store);
return {
blockIndex: getBlockIndex(clientId),
isSticky: hasStickyOrFixedPositionValue(getBlockAttributes(clientId))
};
}, [clientId]);
const scrollContainer = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!contentElement) {
return;
}
return (0,external_wp_dom_namespaceObject.getScrollContainer)(contentElement);
}, [contentElement]);
const [props, setProps] = (0,external_wp_element_namespaceObject.useState)(() => getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky));
const popoverRef = (0,external_wp_compose_namespaceObject.useRefEffect)(popoverNode => {
setToolbarHeight(popoverNode.offsetHeight);
}, []);
const updateProps = (0,external_wp_element_namespaceObject.useCallback)(() => setProps(getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky)), [contentElement, selectedBlockElement, scrollContainer, toolbarHeight]);
// Update props when the block is moved. This also ensures the props are
// correct on initial mount, and when the selected block or content element
// changes (since the callback ref will update).
(0,external_wp_element_namespaceObject.useLayoutEffect)(updateProps, [blockIndex, updateProps]);
// Update props when the viewport is resized or the block is resized.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (!contentElement || !selectedBlockElement) {
return;
}
// Update the toolbar props on viewport resize.
const contentView = contentElement?.ownerDocument?.defaultView;
contentView?.addEventHandler?.('resize', updateProps);
// Update the toolbar props on block resize.
let resizeObserver;
const blockView = selectedBlockElement?.ownerDocument?.defaultView;
if (blockView.ResizeObserver) {
resizeObserver = new blockView.ResizeObserver(updateProps);
resizeObserver.observe(selectedBlockElement);
}
return () => {
contentView?.removeEventHandler?.('resize', updateProps);
if (resizeObserver) {
resizeObserver.disconnect();
}
};
}, [updateProps, contentElement, selectedBlockElement]);
return {
...props,
ref: popoverRef
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/use-selected-block-tool-props.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns props for the selected block tools and empty block inserter.
*
* @param {string} clientId Selected block client ID.
*/
function useSelectedBlockToolProps(clientId) {
const selectedBlockProps = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockRootClientId,
getBlockParents,
__experimentalGetBlockListSettingsForBlocks,
isBlockInsertionPointVisible,
getBlockInsertionPoint,
getBlockOrder,
hasMultiSelection,
getLastMultiSelectedBlockClientId
} = select(store);
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 = blockParentsClientIds.find(parentClientId => parentBlockListSettings[parentClientId]?.__experimentalCaptureToolbars);
let isInsertionPointVisible = false;
if (isBlockInsertionPointVisible()) {
const insertionPoint = getBlockInsertionPoint();
const order = getBlockOrder(insertionPoint.rootClientId);
isInsertionPointVisible = order[insertionPoint.index] === clientId;
}
return {
capturingClientId,
isInsertionPointVisible,
lastClientId: hasMultiSelection() ? getLastMultiSelectedBlockClientId() : null,
rootClientId: getBlockRootClientId(clientId)
};
}, [clientId]);
return selectedBlockProps;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/empty-block-inserter.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function EmptyBlockInserter({
clientId,
__unstableContentRef
}) {
const {
capturingClientId,
isInsertionPointVisible,
lastClientId,
rootClientId
} = useSelectedBlockToolProps(clientId);
const popoverProps = useBlockToolbarPopoverProps({
contentElement: __unstableContentRef?.current,
clientId
});
return (0,external_React_.createElement)(block_popover, {
clientId: capturingClientId || clientId,
__unstableCoverTarget: true,
bottomClientId: lastClientId,
className: classnames_default()('block-editor-block-list__block-side-inserter-popover', {
'is-insertion-point-visible': isInsertionPointVisible
}),
__unstableContentRef: __unstableContentRef,
resize: false,
shift: false,
...popoverProps
}, (0,external_React_.createElement)("div", {
className: "block-editor-block-list__empty-block-inserter"
}, (0,external_React_.createElement)(inserter, {
position: "bottom right",
rootClientId: rootClientId,
clientId: clientId,
__experimentalIsQuick: true
})));
}
;// 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 = moveableDistance === 0 || dragDistance === 0 ? 0 : 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 = moveableDistance === 0 || dragDistance === 0 ? 0 : 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 = ({
appendToOwnerDocument,
children,
clientIds,
cloneClassname,
elementId,
onDragStart,
onDragEnd,
fadeWhenDisabled = false,
dragComponent
}) => {
const {
srcRootClientId,
isDraggable,
icon,
visibleInserter,
getBlockType
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canMoveBlocks,
getBlockRootClientId,
getBlockName,
getBlockAttributes,
isBlockInsertionPointVisible
} = select(store);
const {
getBlockType: _getBlockType,
getActiveBlockVariation
} = select(external_wp_blocks_namespaceObject.store);
const rootClientId = getBlockRootClientId(clientIds[0]);
const blockName = getBlockName(clientIds[0]);
const variation = getActiveBlockVariation(blockName, getBlockAttributes(clientIds[0]));
return {
srcRootClientId: rootClientId,
isDraggable: canMoveBlocks(clientIds, rootClientId),
icon: variation?.icon || _getBlockType(blockName)?.icon,
visibleInserter: isBlockInsertionPointVisible(),
getBlockType: _getBlockType
};
}, [clientIds]);
const isDragging = (0,external_wp_element_namespaceObject.useRef)(false);
const [startScrolling, scrollOnDragOver, stopScrolling] = useScrollWhenDragging();
const {
getAllowedBlocks,
getBlockNamesByClientId,
getBlockRootClientId
} = (0,external_wp_data_namespaceObject.useSelect)(store);
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();
}
};
}, []);
// Find the root of the editor iframe.
const blockRef = useBlockRef(clientIds[0]);
const editorRoot = blockRef.current?.closest('body');
/*
* Add a dragover event listener to the editor root to track the blocks being dragged over.
* The listener has to be inside the editor iframe otherwise the target isn't accessible.
*/
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!editorRoot || !fadeWhenDisabled) {
return;
}
const onDragOver = event => {
if (!event.target.closest('[data-block]')) {
return;
}
const draggedBlockNames = getBlockNamesByClientId(clientIds);
const targetClientId = event.target.closest('[data-block]').getAttribute('data-block');
const allowedBlocks = getAllowedBlocks(targetClientId);
const targetBlockName = getBlockNamesByClientId([targetClientId])[0];
/*
* Check if the target is valid to drop in.
* If the target's allowedBlocks is an empty array,
* it isn't a container block, in which case we check
* its parent's validity instead.
*/
let dropTargetValid;
if (allowedBlocks?.length === 0) {
const targetRootClientId = getBlockRootClientId(targetClientId);
const targetRootBlockName = getBlockNamesByClientId([targetRootClientId])[0];
const rootAllowedBlocks = getAllowedBlocks(targetRootClientId);
dropTargetValid = isDropTargetValid(getBlockType, rootAllowedBlocks, draggedBlockNames, targetRootBlockName);
} else {
dropTargetValid = isDropTargetValid(getBlockType, allowedBlocks, draggedBlockNames, targetBlockName);
}
/*
* Update the body class to reflect if drop target is valid.
* This has to be done on the document body because the draggable
* chip is rendered outside of the editor iframe.
*/
if (!dropTargetValid && !visibleInserter) {
window?.document?.body?.classList?.add('block-draggable-invalid-drag-token');
} else {
window?.document?.body?.classList?.remove('block-draggable-invalid-drag-token');
}
};
const throttledOnDragOver = (0,external_wp_compose_namespaceObject.throttle)(onDragOver, 200);
editorRoot.addEventListener('dragover', throttledOnDragOver);
return () => {
editorRoot.removeEventListener('dragover', throttledOnDragOver);
};
}, [clientIds, editorRoot, fadeWhenDisabled, getAllowedBlocks, getBlockNamesByClientId, getBlockRootClientId, getBlockType, visibleInserter]);
if (!isDraggable) {
return children({
draggable: false
});
}
const transferData = {
type: 'block',
srcClientIds: clientIds,
srcRootClientId
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Draggable, {
appendToOwnerDocument: appendToOwnerDocument,
cloneClassname: cloneClassname,
__experimentalTransferDataType: "wp-blocks",
transferData: transferData,
onDragStart: event => {
// Defer hiding the dragged source element to the next
// frame to enable dragging.
window.requestAnimationFrame(() => {
startDraggingBlocks(clientIds);
isDragging.current = true;
startScrolling(event);
if (onDragStart) {
onDragStart();
}
});
},
onDragOver: scrollOnDragOver,
onDragEnd: () => {
stopDraggingBlocks();
isDragging.current = false;
stopScrolling();
if (onDragEnd) {
onDragEnd();
}
},
__experimentalDragComponent:
// Check against `undefined` so that `null` can be used to disable
// the default drag component.
dragComponent !== undefined ? dragComponent : (0,external_React_.createElement)(BlockDraggableChip, {
count: clientIds.length,
icon: icon,
fadeWhenDisabled: true
}),
elementId: elementId
}, ({
onDraggableStart,
onDraggableEnd
}) => {
return children({
draggable: true,
onDragStart: onDraggableStart,
onDragEnd: onDraggableEnd
});
});
};
/* harmony default export */ const block_draggable = (BlockDraggable);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js
/**
* WordPress dependencies
*/
const chevronUp = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.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 */ const chevron_up = (chevronUp);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
/**
* WordPress dependencies
*/
const chevronDown = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.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 */ const chevron_down = (chevronDown);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-mover/mover-description.js
/**
* WordPress dependencies
*/
const getMovementDirection = (moveDirection, orientation) => {
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;
};
/**
* 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 | undefined} Label for the block movement controls.
*/
function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLast, dir, orientation) {
const position = firstIndex + 1;
if (selectedCount > 1) {
return getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir, orientation);
}
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', orientation);
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', orientation);
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', orientation);
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', orientation);
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).
* @param {string} orientation The orientation of the block movers, vertical or
* horizontal.
*
* @return {string | undefined} Label for the block movement controls.
*/
function getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir, orientation) {
const position = firstIndex + 1;
if (isFirst && isLast) {
// All blocks are selected
return (0,external_wp_i18n_namespaceObject.__)('All blocks are selected, and cannot be moved');
}
if (dir > 0 && !isLast) {
// moving down
const movementDirection = getMovementDirection('down', orientation);
if (movementDirection === 'down') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Number of selected blocks, 2: Position of selected blocks
(0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d down by one place'), selectedCount, position);
}
if (movementDirection === 'left') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Number of selected blocks, 2: Position of selected blocks
(0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d left by one place'), selectedCount, position);
}
if (movementDirection === 'right') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Number of selected blocks, 2: Position of selected blocks
(0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d right by one place'), selectedCount, position);
}
}
if (dir > 0 && isLast) {
// moving down, and the selected blocks are the last item
const movementDirection = getMovementDirection('down', orientation);
if (movementDirection === 'down') {
return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved down as they are already at the bottom');
}
if (movementDirection === 'left') {
return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved left as they are already are at the leftmost position');
}
if (movementDirection === 'right') {
return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved right as they are already are at the rightmost position');
}
}
if (dir < 0 && !isFirst) {
// moving up
const movementDirection = getMovementDirection('up', orientation);
if (movementDirection === 'up') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Number of selected blocks, 2: Position of selected blocks
(0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d up by one place'), selectedCount, position);
}
if (movementDirection === 'left') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Number of selected blocks, 2: Position of selected blocks
(0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d left by one place'), selectedCount, position);
}
if (movementDirection === 'right') {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Number of selected blocks, 2: Position of selected blocks
(0,external_wp_i18n_namespaceObject.__)('Move %1$d blocks from position %2$d right by one place'), selectedCount, position);
}
}
if (dir < 0 && isFirst) {
// moving up, and the selected blocks are the first item
const movementDirection = getMovementDirection('up', orientation);
if (movementDirection === 'up') {
return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved up as they are already at the top');
}
if (movementDirection === 'left') {
return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved left as they are already are at the leftmost position');
}
if (movementDirection === 'right') {
return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved right as they are already are at the rightmost 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)(({
clientIds,
direction,
orientation: moverOrientation,
...props
}, ref) => {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockMoverButton);
const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds];
const blocksCount = normalizedClientIds.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 firstClientId = normalizedClientIds[0];
const blockRootClientId = getBlockRootClientId(firstClientId);
const firstBlockIndex = getBlockIndex(firstClientId);
const lastBlockIndex = getBlockIndex(normalizedClientIds[normalizedClientIds.length - 1]);
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_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
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,
disabled: isDisabled,
__experimentalIsFocusable: true
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
id: descriptionId
}, 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_React_.createElement)(BlockMoverButton, {
direction: "up",
ref: ref,
...props
});
});
const BlockMoverDownButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
return (0,external_React_.createElement)(BlockMoverButton, {
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({
clientIds,
hideDragHandle
}) {
const {
canMove,
rootClientId,
isFirst,
isLast,
orientation
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockIndex,
getBlockListSettings,
canMoveBlocks,
getBlockOrder,
getBlockRootClientId
} = select(store);
const normalizedClientIds = Array.isArray(clientIds) ? clientIds : [clientIds];
const firstClientId = normalizedClientIds[0];
const _rootClientId = getBlockRootClientId(firstClientId);
const firstIndex = getBlockIndex(firstClientId);
const lastIndex = getBlockIndex(normalizedClientIds[normalizedClientIds.length - 1]);
const blockOrder = getBlockOrder(_rootClientId);
return {
canMove: canMoveBlocks(clientIds, _rootClientId),
rootClientId: _rootClientId,
isFirst: firstIndex === 0,
isLast: lastIndex === blockOrder.length - 1,
orientation: getBlockListSettings(_rootClientId)?.orientation
};
}, [clientIds]);
if (!canMove || isFirst && isLast && !rootClientId) {
return null;
}
const dragHandleLabel = (0,external_wp_i18n_namespaceObject.__)('Drag');
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, {
className: classnames_default()('block-editor-block-mover', {
'is-horizontal': orientation === 'horizontal'
})
}, !hideDragHandle && (0,external_React_.createElement)(block_draggable, {
clientIds: clientIds,
fadeWhenDisabled: true
}, draggableProps => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
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_React_.createElement)("div", {
className: "block-editor-block-mover__move-button-container"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, itemProps => (0,external_React_.createElement)(BlockMoverUpButton, {
clientIds: clientIds,
...itemProps
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, itemProps => (0,external_React_.createElement)(BlockMoverDownButton, {
clientIds: clientIds,
...itemProps
}))));
}
/**
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-mover/README.md
*/
/* harmony default export */ const block_mover = (BlockMover);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
clearTimeout: utils_clearTimeout,
setTimeout: utils_setTimeout
} = window;
const DEBOUNCE_TIMEOUT = 200;
/**
* Hook that creates debounced callbacks when the node is hovered or focused.
*
* @param {Object} props Component props.
* @param {Object} props.ref Element reference.
* @param {boolean} props.isFocused Whether the component has current focus.
* @param {number} props.highlightParent Whether to highlight the parent block. It defaults in highlighting the selected block.
* @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds.
*/
function useDebouncedShowGestures({
ref,
isFocused,
highlightParent,
debounceTimeout = DEBOUNCE_TIMEOUT
}) {
const {
getSelectedBlockClientId,
getBlockRootClientId
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
toggleBlockHighlight
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const timeoutRef = (0,external_wp_element_namespaceObject.useRef)();
const isDistractionFree = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().isDistractionFree, []);
const handleOnChange = nextIsFocused => {
if (nextIsFocused && isDistractionFree) {
return;
}
const selectedBlockClientId = getSelectedBlockClientId();
const clientId = highlightParent ? getBlockRootClientId(selectedBlockClientId) : selectedBlockClientId;
toggleBlockHighlight(clientId, nextIsFocused);
};
const getIsHovered = () => {
return ref?.current && ref.current.matches(':hover');
};
const shouldHideGestures = () => {
const isHovered = getIsHovered();
return !isFocused && !isHovered;
};
const clearTimeoutRef = () => {
const timeout = timeoutRef.current;
if (timeout && utils_clearTimeout) {
utils_clearTimeout(timeout);
}
};
const debouncedShowGestures = event => {
if (event) {
event.stopPropagation();
}
clearTimeoutRef();
handleOnChange(true);
};
const debouncedHideGestures = event => {
if (event) {
event.stopPropagation();
}
clearTimeoutRef();
timeoutRef.current = utils_setTimeout(() => {
if (shouldHideGestures()) {
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 {
debouncedShowGestures,
debouncedHideGestures
};
}
/**
* Hook that provides gesture events for DOM elements
* that interact with the isFocused state.
*
* @param {Object} props Component props.
* @param {Object} props.ref Element reference.
* @param {number} [props.highlightParent=false] Whether to highlight the parent block. It defaults to highlighting the selected block.
* @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds.
*/
function useShowHoveredOrFocusedGestures({
ref,
highlightParent = false,
debounceTimeout = DEBOUNCE_TIMEOUT
}) {
const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
const {
debouncedShowGestures,
debouncedHideGestures
} = useDebouncedShowGestures({
ref,
debounceTimeout,
isFocused,
highlightParent
});
const registerRef = (0,external_wp_element_namespaceObject.useRef)(false);
const isFocusedWithin = () => {
return 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);
debouncedShowGestures();
}
};
const handleOnBlur = () => {
if (!isFocusedWithin()) {
setIsFocused(false);
debouncedHideGestures();
}
};
/**
* 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, debouncedShowGestures, debouncedHideGestures]);
return {
onMouseMove: debouncedShowGestures,
onMouseLeave: debouncedHideGestures
};
}
;// 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 {Component} Parent block selector.
*/
function BlockParentSelector() {
const {
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const {
firstParentClientId,
isVisible
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockName,
getBlockParents,
getSelectedBlockClientId,
getBlockEditingMode
} = 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);
return {
firstParentClientId: _firstParentClientId,
isVisible: _firstParentClientId && getBlockEditingMode(_firstParentClientId) === 'default' && hasBlockSupport(_parentBlockType, '__experimentalParentSelector', true)
};
}, []);
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 showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures({
ref: nodeRef,
highlightParent: true
});
if (!isVisible) {
return null;
}
return (0,external_React_.createElement)("div", {
className: "block-editor-block-parent-selector",
key: firstParentClientId,
ref: nodeRef,
...showHoveredOrFocusedGestures
}, (0,external_React_.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 parent block: %s'), blockInformation?.title),
showTooltip: true,
icon: (0,external_React_.createElement)(block_icon, {
icon: blockInformation?.icon
})
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/copy.js
/**
* WordPress dependencies
*/
const copy_copy = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"
}));
/* harmony default export */ const library_copy = (copy_copy);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/preview-block-popover.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PreviewBlockPopover({
blocks
}) {
return (0,external_React_.createElement)("div", {
className: "block-editor-block-switcher__popover__preview__parent"
}, (0,external_React_.createElement)("div", {
className: "block-editor-block-switcher__popover__preview__container"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, {
className: "block-editor-block-switcher__preview__popover",
placement: "bottom-start",
focusOnMount: false
}, (0,external_React_.createElement)("div", {
className: "block-editor-block-switcher__preview"
}, (0,external_React_.createElement)("div", {
className: "block-editor-block-switcher__preview-title"
}, (0,external_wp_i18n_namespaceObject.__)('Preview')), (0,external_React_.createElement)(block_preview, {
viewportWidth: 500,
blocks: blocks
})))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-variation-transformations.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const block_variation_transformations_EMPTY_OBJECT = {};
function useBlockVariationTransforms({
clientIds,
blocks
}) {
const {
activeBlockVariation,
blockVariationTransformations
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockRootClientId,
getBlockAttributes,
canRemoveBlocks
} = select(store);
const {
getActiveBlockVariation,
getBlockVariations
} = select(external_wp_blocks_namespaceObject.store);
const rootClientId = getBlockRootClientId(Array.isArray(clientIds) ? clientIds[0] : clientIds);
const canRemove = canRemoveBlocks(clientIds, rootClientId);
// Only handle single selected blocks for now.
if (blocks.length !== 1 || !canRemove) {
return block_variation_transformations_EMPTY_OBJECT;
}
const [firstBlock] = blocks;
return {
blockVariationTransformations: getBlockVariations(firstBlock.name, 'transform'),
activeBlockVariation: getActiveBlockVariation(firstBlock.name, getBlockAttributes(firstBlock.clientId))
};
}, [clientIds, blocks]);
const transformations = (0,external_wp_element_namespaceObject.useMemo)(() => {
return blockVariationTransformations?.filter(({
name
}) => name !== activeBlockVariation?.name);
}, [blockVariationTransformations, activeBlockVariation]);
return transformations;
}
const BlockVariationTransformations = ({
transformations,
onSelect,
blocks
}) => {
const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)();
return (0,external_React_.createElement)(external_React_.Fragment, null, hoveredTransformItemName && (0,external_React_.createElement)(PreviewBlockPopover, {
blocks: (0,external_wp_blocks_namespaceObject.cloneBlock)(blocks[0], transformations.find(({
name
}) => name === hoveredTransformItemName).attributes)
}), transformations?.map(item => (0,external_React_.createElement)(BlockVariationTranformationItem, {
key: item.name,
item: item,
onSelect: onSelect,
setHoveredTransformItemName: setHoveredTransformItemName
})));
};
function BlockVariationTranformationItem({
item,
onSelect,
setHoveredTransformItemName
}) {
const {
name,
icon,
title
} = item;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name),
onClick: event => {
event.preventDefault();
onSelect(name);
},
onMouseLeave: () => setHoveredTransformItemName(null),
onMouseEnter: () => setHoveredTransformItemName(name)
}, (0,external_React_.createElement)(block_icon, {
icon: icon,
showColors: true
}), title);
}
/* harmony default export */ const block_variation_transformations = (BlockVariationTransformations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/block-transformations-menu.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Helper hook to group transformations to display them in a specific order in the UI.
* For now we group only priority content driven transformations(ex. paragraph -> heading).
*
* Later on we could also group 'layout' transformations(ex. paragraph -> group) and
* display them in different sections.
*
* @param {Object[]} possibleBlockTransformations The available block transformations.
* @return {Record<string, Object[]>} The grouped block transformations.
*/
function useGroupedTransforms(possibleBlockTransformations) {
const priorityContentTranformationBlocks = {
'core/paragraph': 1,
'core/heading': 2,
'core/list': 3,
'core/quote': 4
};
const transformations = (0,external_wp_element_namespaceObject.useMemo)(() => {
const priorityTextTranformsNames = Object.keys(priorityContentTranformationBlocks);
const groupedPossibleTransforms = possibleBlockTransformations.reduce((accumulator, item) => {
const {
name
} = item;
if (priorityTextTranformsNames.includes(name)) {
accumulator.priorityTextTransformations.push(item);
} else {
accumulator.restTransformations.push(item);
}
return accumulator;
}, {
priorityTextTransformations: [],
restTransformations: []
});
/**
* If there is only one priority text transformation and it's a Quote,
* is should move to the rest transformations. This is because Quote can
* be a container for any block type, so in multi-block selection it will
* always be suggested, even for non-text blocks.
*/
if (groupedPossibleTransforms.priorityTextTransformations.length === 1 && groupedPossibleTransforms.priorityTextTransformations[0].name === 'core/quote') {
const singleQuote = groupedPossibleTransforms.priorityTextTransformations.pop();
groupedPossibleTransforms.restTransformations.push(singleQuote);
}
return groupedPossibleTransforms;
}, [possibleBlockTransformations]);
// Order the priority text transformations.
transformations.priorityTextTransformations.sort(({
name: currentName
}, {
name: nextName
}) => {
return priorityContentTranformationBlocks[currentName] < priorityContentTranformationBlocks[nextName] ? -1 : 1;
});
return transformations;
}
const BlockTransformationsMenu = ({
className,
possibleBlockTransformations,
possibleBlockVariationTransformations,
onSelect,
onSelectVariation,
blocks
}) => {
const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)();
const {
priorityTextTransformations,
restTransformations
} = useGroupedTransforms(possibleBlockTransformations);
// We have to check if both content transformations(priority and rest) are set
// in order to create a separate MenuGroup for them.
const hasBothContentTransformations = priorityTextTransformations.length && restTransformations.length;
const restTransformItems = !!restTransformations.length && (0,external_React_.createElement)(RestTransformationItems, {
restTransformations: restTransformations,
onSelect: onSelect,
setHoveredTransformItemName: setHoveredTransformItemName
});
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Transform to'),
className: className
}, hoveredTransformItemName && (0,external_React_.createElement)(PreviewBlockPopover, {
blocks: (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, hoveredTransformItemName)
}), !!possibleBlockVariationTransformations?.length && (0,external_React_.createElement)(block_variation_transformations, {
transformations: possibleBlockVariationTransformations,
blocks: blocks,
onSelect: onSelectVariation
}), priorityTextTransformations.map(item => (0,external_React_.createElement)(BlockTranformationItem, {
key: item.name,
item: item,
onSelect: onSelect,
setHoveredTransformItemName: setHoveredTransformItemName
})), !hasBothContentTransformations && restTransformItems), !!hasBothContentTransformations && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, {
className: className
}, restTransformItems));
};
function RestTransformationItems({
restTransformations,
onSelect,
setHoveredTransformItemName
}) {
return restTransformations.map(item => (0,external_React_.createElement)(BlockTranformationItem, {
key: item.name,
item: item,
onSelect: onSelect,
setHoveredTransformItemName: setHoveredTransformItemName
}));
}
function BlockTranformationItem({
item,
onSelect,
setHoveredTransformItemName
}) {
const {
name,
icon,
title,
isDisabled
} = item;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name),
onClick: event => {
event.preventDefault();
onSelect(name);
},
disabled: isDisabled,
onMouseLeave: () => setHoveredTransformItemName(null),
onMouseEnter: () => setHoveredTransformItemName(name)
}, (0,external_React_.createElement)(block_icon, {
icon: icon,
showColors: true
}), title);
}
/* harmony default export */ const block_transformations_menu = (BlockTransformationsMenu);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/utils.js
/**
* WordPress dependencies
*/
/**
* Returns the active style from the given className.
*
* @param {Array} styles Block styles.
* @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 = styles?.find(({
name
}) => name === potentialStyleName);
if (activeStyle) {
return activeStyle;
}
}
return getDefaultStyle(styles);
}
/**
* 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 styles.
*
* @return {Array<Object?>} 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 styles.
*
* @return {Object?} The default style object, if found.
*/
function getDefaultStyle(styles) {
return styles?.find(style => style.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?.example;
const blockName = 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?.example ? 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({
clientId,
onSwitch
}) {
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
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const menu_items_noop = () => {};
function BlockStylesMenuItems({
clientId,
onSwitch = menu_items_noop
}) {
const {
onSelect,
stylesToRender,
activeStyle
} = useStylesForBlocks({
clientId,
onSwitch
});
if (!stylesToRender || stylesToRender.length === 0) {
return null;
}
return (0,external_React_.createElement)(external_React_.Fragment, null, stylesToRender.map(style => {
const menuItemText = style.label || style.name;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
key: style.name,
icon: activeStyle.name === style.name ? library_check : null,
onClick: () => onSelect(style)
}, (0,external_React_.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({
hoveredBlock,
onSwitch
}) {
const {
clientId
} = hoveredBlock;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Styles'),
className: "block-editor-block-switcher__styles__menugroup"
}, (0,external_React_.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 | undefined} 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 = (0,external_wp_blocks_namespaceObject.__experimentalGetBlockAttributesNamesByRole)(name, 'content');
if (!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 */ const use_transformed_patterns = (useTransformedPatterns);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/pattern-transformations-menu.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
CompositeV2: pattern_transformations_menu_Composite,
CompositeItemV2: pattern_transformations_menu_CompositeItem,
useCompositeStoreV2: pattern_transformations_menu_useCompositeStore
} = unlock(external_wp_components_namespaceObject.privateApis);
function PatternTransformationsMenu({
blocks,
patterns: statePatterns,
onSelect
}) {
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_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, {
className: "block-editor-block-switcher__pattern__transforms__menugroup"
}, showTransforms && (0,external_React_.createElement)(PreviewPatternsPopover, {
patterns: patterns,
onSelect: onSelect
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: event => {
event.preventDefault();
setShowTransforms(!showTransforms);
},
icon: chevron_right
}, (0,external_wp_i18n_namespaceObject.__)('Patterns')));
}
function PreviewPatternsPopover({
patterns,
onSelect
}) {
return (0,external_React_.createElement)("div", {
className: "block-editor-block-switcher__popover__preview__parent"
}, (0,external_React_.createElement)("div", {
className: "block-editor-block-switcher__popover__preview__container"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, {
className: "block-editor-block-switcher__preview__popover",
position: "bottom right"
}, (0,external_React_.createElement)("div", {
className: "block-editor-block-switcher__preview is-pattern-list-preview"
}, (0,external_React_.createElement)(pattern_transformations_menu_BlockPatternsList, {
patterns: patterns,
onSelect: onSelect
})))));
}
function pattern_transformations_menu_BlockPatternsList({
patterns,
onSelect
}) {
const composite = pattern_transformations_menu_useCompositeStore();
return (0,external_React_.createElement)(pattern_transformations_menu_Composite, {
store: 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_React_.createElement)(pattern_transformations_menu_BlockPattern, {
key: pattern.name,
pattern: pattern,
onSelect: onSelect
})));
}
function pattern_transformations_menu_BlockPattern({
pattern,
onSelect
}) {
// 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_React_.createElement)("div", {
className: `${baseClassName}-list__list-item`
}, (0,external_React_.createElement)(pattern_transformations_menu_CompositeItem, {
render: (0,external_React_.createElement)("div", {
role: "option",
"aria-label": pattern.title,
"aria-describedby": pattern.description ? descriptionId : undefined,
className: `${baseClassName}-list__item`
}),
onClick: () => onSelect(pattern.transformedBlocks)
}, (0,external_React_.createElement)(block_preview, {
blocks: pattern.transformedBlocks,
viewportWidth: pattern.viewportWidth || 500
}), (0,external_React_.createElement)("div", {
className: `${baseClassName}-list__item-title`
}, pattern.title)), !!pattern.description && (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
id: descriptionId
}, pattern.description));
}
/* harmony default export */ const pattern_transformations_menu = (PatternTransformationsMenu);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-switcher/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockSwitcherDropdownMenuContents({
onClose,
clientIds,
hasBlockStyles,
canRemove
}) {
const {
replaceBlocks,
multiSelect,
updateBlockAttributes
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const {
possibleBlockTransformations,
patterns,
blocks
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlocksByClientId,
getBlockRootClientId,
getBlockTransformItems,
__experimentalGetPatternTransformItems
} = select(store);
const rootClientId = getBlockRootClientId(Array.isArray(clientIds) ? clientIds[0] : clientIds);
const _blocks = getBlocksByClientId(clientIds);
return {
blocks: _blocks,
possibleBlockTransformations: getBlockTransformItems(_blocks, rootClientId),
patterns: __experimentalGetPatternTransformItems(_blocks, rootClientId)
};
}, [clientIds]);
const blockVariationTransformations = useBlockVariationTransforms({
clientIds,
blocks
});
function selectForMultipleBlocks(insertedBlocks) {
if (insertedBlocks.length > 1) {
multiSelect(insertedBlocks[0].clientId, insertedBlocks[insertedBlocks.length - 1].clientId);
}
}
// Simple block tranformation based on the `Block Transforms` API.
function onBlockTransform(name) {
const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name);
replaceBlocks(clientIds, newBlocks);
selectForMultipleBlocks(newBlocks);
}
function onBlockVariationTransform(name) {
updateBlockAttributes(blocks[0].clientId, {
...blockVariationTransformations.find(({
name: variationName
}) => variationName === name).attributes
});
}
// Pattern transformation through the `Patterns` API.
function onPatternTransform(transformedBlocks) {
replaceBlocks(clientIds, transformedBlocks);
selectForMultipleBlocks(transformedBlocks);
}
/**
* The `isTemplate` check is a stopgap solution here.
* Ideally, the Transforms API should handle this
* by allowing to exclude blocks from wildcard transformations.
*/
const isSingleBlock = blocks.length === 1;
const isTemplate = isSingleBlock && (0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]);
const hasPossibleBlockTransformations = !!possibleBlockTransformations.length && canRemove && !isTemplate;
const hasPossibleBlockVariationTransformations = !!blockVariationTransformations?.length;
const hasPatternTransformation = !!patterns?.length && canRemove;
const hasBlockOrBlockVariationTransforms = hasPossibleBlockTransformations || hasPossibleBlockVariationTransformations;
const hasContents = hasBlockStyles || hasBlockOrBlockVariationTransforms || hasPatternTransformation;
if (!hasContents) {
return (0,external_React_.createElement)("p", {
className: "block-editor-block-switcher__no-transforms"
}, (0,external_wp_i18n_namespaceObject.__)('No transforms.'));
}
return (0,external_React_.createElement)("div", {
className: "block-editor-block-switcher__container"
}, hasPatternTransformation && (0,external_React_.createElement)(pattern_transformations_menu, {
blocks: blocks,
patterns: patterns,
onSelect: transformedBlocks => {
onPatternTransform(transformedBlocks);
onClose();
}
}), hasBlockOrBlockVariationTransforms && (0,external_React_.createElement)(block_transformations_menu, {
className: "block-editor-block-switcher__transforms__menugroup",
possibleBlockTransformations: possibleBlockTransformations,
possibleBlockVariationTransformations: blockVariationTransformations,
blocks: blocks,
onSelect: name => {
onBlockTransform(name);
onClose();
},
onSelectVariation: name => {
onBlockVariationTransform(name);
onClose();
}
}), hasBlockStyles && (0,external_React_.createElement)(BlockStylesMenu, {
hoveredBlock: blocks[0],
onSwitch: onClose
}));
}
const BlockSwitcher = ({
clientIds
}) => {
const {
canRemove,
hasBlockStyles,
icon,
invalidBlocks,
isReusable,
isTemplate
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockRootClientId,
getBlocksByClientId,
getBlockAttributes,
canRemoveBlocks
} = select(store);
const {
getBlockStyles,
getBlockType,
getActiveBlockVariation
} = select(external_wp_blocks_namespaceObject.store);
const _blocks = getBlocksByClientId(clientIds);
if (!_blocks.length || _blocks.some(block => !block)) {
return {
invalidBlocks: true
};
}
const rootClientId = getBlockRootClientId(Array.isArray(clientIds) ? clientIds[0] : clientIds);
const [{
name: firstBlockName
}] = _blocks;
const _isSingleBlockSelected = _blocks.length === 1;
const blockType = getBlockType(firstBlockName);
let _icon;
if (_isSingleBlockSelected) {
const match = getActiveBlockVariation(firstBlockName, getBlockAttributes(clientIds[0]));
// Take into account active block variations.
_icon = match?.icon || blockType.icon;
} else {
const isSelectionOfSameType = new Set(_blocks.map(({
name
}) => name)).size === 1;
// When selection consists of blocks of multiple types, display an
// appropriate icon to communicate the non-uniformity.
_icon = isSelectionOfSameType ? blockType.icon : library_copy;
}
return {
canRemove: canRemoveBlocks(clientIds, rootClientId),
hasBlockStyles: _isSingleBlockSelected && !!getBlockStyles(firstBlockName)?.length,
icon: _icon,
isReusable: _isSingleBlockSelected && (0,external_wp_blocks_namespaceObject.isReusableBlock)(_blocks[0]),
isTemplate: _isSingleBlockSelected && (0,external_wp_blocks_namespaceObject.isTemplatePart)(_blocks[0])
};
}, [clientIds]);
const blockTitle = useBlockDisplayTitle({
clientId: clientIds?.[0],
maximumLength: 35
});
if (invalidBlocks) {
return null;
}
const isSingleBlock = clientIds.length === 1;
const blockSwitcherLabel = isSingleBlock ? blockTitle : (0,external_wp_i18n_namespaceObject.__)('Multiple blocks selected');
const hideDropdown = !hasBlockStyles && !canRemove;
if (hideDropdown) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
disabled: true,
className: "block-editor-block-switcher__no-switcher-icon",
title: blockSwitcherLabel,
icon: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(block_icon, {
icon: icon,
showColors: true
}), (isReusable || isTemplate) && (0,external_React_.createElement)("span", {
className: "block-editor-block-switcher__toggle-text"
}, blockTitle))
}));
}
const blockSwitcherDescription = isSingleBlock ? (0,external_wp_i18n_namespaceObject.__)('Change block type or style') : (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', clientIds.length), clientIds.length);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
className: "block-editor-block-switcher",
label: blockSwitcherLabel,
popoverProps: {
placement: 'bottom-start',
className: 'block-editor-block-switcher__popover'
},
icon: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(block_icon, {
icon: icon,
className: "block-editor-block-switcher__toggle",
showColors: true
}), (isReusable || isTemplate) && (0,external_React_.createElement)("span", {
className: "block-editor-block-switcher__toggle-text"
}, blockTitle)),
toggleProps: {
describedBy: blockSwitcherDescription,
...toggleProps
},
menuProps: {
orientation: 'both'
}
}, ({
onClose
}) => (0,external_React_.createElement)(BlockSwitcherDropdownMenuContents, {
onClose: onClose,
clientIds: clientIds,
hasBlockStyles: hasBlockStyles,
canRemove: canRemove
}))));
};
/* harmony default export */ const 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 */ const block_toolbar_last_item = (__unstableBlockToolbarLastItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/supports.js
/**
* WordPress dependencies
*/
const ALIGN_SUPPORT_KEY = 'align';
const ALIGN_WIDE_SUPPORT_KEY = 'alignWide';
const supports_BORDER_SUPPORT_KEY = '__experimentalBorder';
const supports_COLOR_SUPPORT_KEY = 'color';
const CUSTOM_CLASS_NAME_SUPPORT_KEY = 'customClassName';
const supports_FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
const supports_FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';
const supports_LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';
/**
* Key within block settings' support array indicating support for font style.
*/
const supports_FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
/**
* Key within block settings' support array indicating support for font weight.
*/
const supports_FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
/**
* Key within block settings' supports array indicating support for text
* columns e.g. settings found in `block.json`.
*/
const supports_TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
/**
* Key within block settings' supports array indicating support for text
* decorations e.g. settings found in `block.json`.
*/
const supports_TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
/**
* Key within block settings' supports array indicating support for writing mode
* e.g. settings found in `block.json`.
*/
const supports_WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';
/**
* Key within block settings' supports array indicating support for text
* transforms e.g. settings found in `block.json`.
*/
const supports_TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
/**
* Key within block settings' supports array indicating support for letter-spacing
* e.g. settings found in `block.json`.
*/
const supports_LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
const LAYOUT_SUPPORT_KEY = 'layout';
const supports_TYPOGRAPHY_SUPPORT_KEYS = [supports_LINE_HEIGHT_SUPPORT_KEY, supports_FONT_SIZE_SUPPORT_KEY, supports_FONT_STYLE_SUPPORT_KEY, supports_FONT_WEIGHT_SUPPORT_KEY, supports_FONT_FAMILY_SUPPORT_KEY, supports_TEXT_COLUMNS_SUPPORT_KEY, supports_TEXT_DECORATION_SUPPORT_KEY, supports_TEXT_TRANSFORM_SUPPORT_KEY, supports_WRITING_MODE_SUPPORT_KEY, supports_LETTER_SPACING_SUPPORT_KEY];
const EFFECTS_SUPPORT_KEYS = ['shadow'];
const supports_SPACING_SUPPORT_KEY = 'spacing';
const supports_styleSupportKeys = [...EFFECTS_SUPPORT_KEYS, ...supports_TYPOGRAPHY_SUPPORT_KEYS, supports_BORDER_SUPPORT_KEY, supports_COLOR_SUPPORT_KEY, supports_SPACING_SUPPORT_KEY];
/**
* Returns true if the block defines support for align.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {boolean} Whether the block supports the feature.
*/
const hasAlignSupport = nameOrType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, ALIGN_SUPPORT_KEY);
/**
* Returns the block support value for align, if defined.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {unknown} The block support value.
*/
const getAlignSupport = nameOrType => getBlockSupport(nameOrType, ALIGN_SUPPORT_KEY);
/**
* Returns true if the block defines support for align wide.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {boolean} Whether the block supports the feature.
*/
const hasAlignWideSupport = nameOrType => hasBlockSupport(nameOrType, ALIGN_WIDE_SUPPORT_KEY);
/**
* Returns the block support value for align wide, if defined.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {unknown} The block support value.
*/
const getAlignWideSupport = nameOrType => getBlockSupport(nameOrType, ALIGN_WIDE_SUPPORT_KEY);
/**
* Determine whether there is block support for border properties.
*
* @param {string|Object} nameOrType Block name or type object.
* @param {string} feature Border feature to check support for.
*
* @return {boolean} Whether there is support.
*/
function supports_hasBorderSupport(nameOrType, feature = 'any') {
if (external_wp_element_namespaceObject.Platform.OS !== 'web') {
return false;
}
const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_BORDER_SUPPORT_KEY);
if (support === true) {
return true;
}
if (feature === 'any') {
return !!(support?.color || support?.radius || support?.width || support?.style);
}
return !!support?.[feature];
}
/**
* Get block support for border properties.
*
* @param {string|Object} nameOrType Block name or type object.
* @param {string} feature Border feature to get.
*
* @return {unknown} The block support.
*/
const getBorderSupport = (nameOrType, feature) => getBlockSupport(nameOrType, [supports_BORDER_SUPPORT_KEY, feature]);
/**
* Returns true if the block defines support for color.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {boolean} Whether the block supports the feature.
*/
const supports_hasColorSupport = nameOrType => {
const colorSupport = getBlockSupport(nameOrType, supports_COLOR_SUPPORT_KEY);
return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false);
};
/**
* Returns true if the block defines support for link color.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {boolean} Whether the block supports the feature.
*/
const supports_hasLinkColorSupport = nameOrType => {
if (Platform.OS !== 'web') {
return false;
}
const colorSupport = getBlockSupport(nameOrType, supports_COLOR_SUPPORT_KEY);
return colorSupport !== null && typeof colorSupport === 'object' && !!colorSupport.link;
};
/**
* Returns true if the block defines support for gradient color.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {boolean} Whether the block supports the feature.
*/
const supports_hasGradientSupport = nameOrType => {
const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY);
return colorSupport !== null && typeof colorSupport === 'object' && !!colorSupport.gradients;
};
/**
* Returns true if the block defines support for background color.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {boolean} Whether the block supports the feature.
*/
const supports_hasBackgroundColorSupport = nameOrType => {
const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY);
return colorSupport && colorSupport.background !== false;
};
/**
* Returns true if the block defines support for background color.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {boolean} Whether the block supports the feature.
*/
const supports_hasTextColorSupport = nameOrType => {
const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(nameOrType, supports_COLOR_SUPPORT_KEY);
return colorSupport && colorSupport.text !== false;
};
/**
* Get block support for color properties.
*
* @param {string|Object} nameOrType Block name or type object.
* @param {string} feature Color feature to get.
*
* @return {unknown} The block support.
*/
const getColorSupport = (nameOrType, feature) => getBlockSupport(nameOrType, [supports_COLOR_SUPPORT_KEY, feature]);
/**
* Returns true if the block defines support for custom class name.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {boolean} Whether the block supports the feature.
*/
const hasCustomClassNameSupport = nameOrType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true);
/**
* Returns the block support value for custom class name, if defined.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {unknown} The block support value.
*/
const getCustomClassNameSupport = nameOrType => getBlockSupport(nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true);
/**
* Returns true if the block defines support for font family.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {boolean} Whether the block supports the feature.
*/
const hasFontFamilySupport = nameOrType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_FONT_FAMILY_SUPPORT_KEY);
/**
* Returns the block support value for font family, if defined.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {unknown} The block support value.
*/
const getFontFamilySupport = nameOrType => getBlockSupport(nameOrType, supports_FONT_FAMILY_SUPPORT_KEY);
/**
* Returns true if the block defines support for font size.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {boolean} Whether the block supports the feature.
*/
const hasFontSizeSupport = nameOrType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, supports_FONT_SIZE_SUPPORT_KEY);
/**
* Returns the block support value for font size, if defined.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {unknown} The block support value.
*/
const getFontSizeSupport = nameOrType => getBlockSupport(nameOrType, supports_FONT_SIZE_SUPPORT_KEY);
/**
* Returns true if the block defines support for layout.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {boolean} Whether the block supports the feature.
*/
const hasLayoutSupport = nameOrType => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, LAYOUT_SUPPORT_KEY);
/**
* Returns the block support value for layout, if defined.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {unknown} The block support value.
*/
const getLayoutSupport = nameOrType => getBlockSupport(nameOrType, LAYOUT_SUPPORT_KEY);
/**
* Returns true if the block defines support for style.
*
* @param {string|Object} nameOrType Block name or type object.
* @return {boolean} Whether the block supports the feature.
*/
const supports_hasStyleSupport = nameOrType => supports_styleSupportKeys.some(key => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(nameOrType, key));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-paste-styles/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Determine if the copied text looks like serialized blocks or not.
* Since plain text will always get parsed into a freeform block,
* we check that if the parsed blocks is anything other than that.
*
* @param {string} text The copied text.
* @return {boolean} True if the text looks like serialized blocks, false otherwise.
*/
function hasSerializedBlocks(text) {
try {
const blocks = (0,external_wp_blocks_namespaceObject.parse)(text, {
__unstableSkipMigrationLogs: true,
__unstableSkipAutop: true
});
if (blocks.length === 1 && blocks[0].name === 'core/freeform') {
// It's likely that the text is just plain text and not serialized blocks.
return false;
}
return true;
} catch (err) {
// Parsing error, the text is not serialized blocks.
// (Even though that it technically won't happen)
return false;
}
}
/**
* Style attributes are attributes being added in `block-editor/src/hooks/*`.
* (Except for some unrelated to style like `anchor` or `settings`.)
* They generally represent the default block supports.
*/
const STYLE_ATTRIBUTES = {
align: hasAlignSupport,
borderColor: nameOrType => supports_hasBorderSupport(nameOrType, 'color'),
backgroundColor: supports_hasBackgroundColorSupport,
textColor: supports_hasTextColorSupport,
gradient: supports_hasGradientSupport,
className: hasCustomClassNameSupport,
fontFamily: hasFontFamilySupport,
fontSize: hasFontSizeSupport,
layout: hasLayoutSupport,
style: supports_hasStyleSupport
};
/**
* Get the "style attributes" from a given block to a target block.
*
* @param {WPBlock} sourceBlock The source block.
* @param {WPBlock} targetBlock The target block.
* @return {Object} the filtered attributes object.
*/
function getStyleAttributes(sourceBlock, targetBlock) {
return Object.entries(STYLE_ATTRIBUTES).reduce((attributes, [attributeKey, hasSupport]) => {
// Only apply the attribute if both blocks support it.
if (hasSupport(sourceBlock.name) && hasSupport(targetBlock.name)) {
// Override attributes that are not present in the block to their defaults.
attributes[attributeKey] = sourceBlock.attributes[attributeKey];
}
return attributes;
}, {});
}
/**
* Update the target blocks with style attributes recursively.
*
* @param {WPBlock[]} targetBlocks The target blocks to be updated.
* @param {WPBlock[]} sourceBlocks The source blocks to get th style attributes from.
* @param {Function} updateBlockAttributes The function to update the attributes.
*/
function recursivelyUpdateBlockAttributes(targetBlocks, sourceBlocks, updateBlockAttributes) {
for (let index = 0; index < Math.min(sourceBlocks.length, targetBlocks.length); index += 1) {
updateBlockAttributes(targetBlocks[index].clientId, getStyleAttributes(sourceBlocks[index], targetBlocks[index]));
recursivelyUpdateBlockAttributes(targetBlocks[index].innerBlocks, sourceBlocks[index].innerBlocks, updateBlockAttributes);
}
}
/**
* A hook to return a pasteStyles event function for handling pasting styles to blocks.
*
* @return {Function} A function to update the styles to the blocks.
*/
function usePasteStyles() {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
updateBlockAttributes
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const {
createSuccessNotice,
createWarningNotice,
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
return (0,external_wp_element_namespaceObject.useCallback)(async targetBlocks => {
let html = '';
try {
// `http:` sites won't have the clipboard property on navigator.
// (with the exception of localhost.)
if (!window.navigator.clipboard) {
createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Unable to paste styles. This feature is only available on secure (https) sites in supporting browsers.'), {
type: 'snackbar'
});
return;
}
html = await window.navigator.clipboard.readText();
} catch (error) {
// Possibly the permission is denied.
createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Unable to paste styles. Please allow browser clipboard permissions before continuing.'), {
type: 'snackbar'
});
return;
}
// Abort if the copied text is empty or doesn't look like serialized blocks.
if (!html || !hasSerializedBlocks(html)) {
createWarningNotice((0,external_wp_i18n_namespaceObject.__)("Unable to paste styles. Block styles couldn't be found within the copied content."), {
type: 'snackbar'
});
return;
}
const copiedBlocks = (0,external_wp_blocks_namespaceObject.parse)(html);
if (copiedBlocks.length === 1) {
// Apply styles of the block to all the target blocks.
registry.batch(() => {
recursivelyUpdateBlockAttributes(targetBlocks, targetBlocks.map(() => copiedBlocks[0]), updateBlockAttributes);
});
} else {
registry.batch(() => {
recursivelyUpdateBlockAttributes(targetBlocks, copiedBlocks, updateBlockAttributes);
});
}
if (targetBlocks.length === 1) {
const title = (0,external_wp_blocks_namespaceObject.getBlockType)(targetBlocks[0].name)?.title;
createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
// Translators: Name of the block being pasted, e.g. "Paragraph".
(0,external_wp_i18n_namespaceObject.__)('Pasted styles to %s.'), title), {
type: 'snackbar'
});
} else {
createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
// Translators: The number of the blocks.
(0,external_wp_i18n_namespaceObject.__)('Pasted styles to %d blocks.'), targetBlocks.length), {
type: 'snackbar'
});
}
}, [registry.batch, updateBlockAttributes, createSuccessNotice, createWarningNotice, createErrorNotice]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-actions/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockActions({
clientIds,
children,
__experimentalUpdateSelection: updateSelection
}) {
const {
getDefaultBlockName,
getGroupingBlockName
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
const selected = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canInsertBlockType,
getBlockRootClientId,
getBlocksByClientId,
getDirectInsertBlock,
canMoveBlocks,
canRemoveBlocks
} = select(store);
const blocks = getBlocksByClientId(clientIds);
const rootClientId = getBlockRootClientId(clientIds[0]);
const canInsertDefaultBlock = canInsertBlockType(getDefaultBlockName(), rootClientId);
const directInsertBlock = rootClientId ? getDirectInsertBlock(rootClientId) : null;
return {
canMove: canMoveBlocks(clientIds, rootClientId),
canRemove: canRemoveBlocks(clientIds, rootClientId),
canInsertBlock: canInsertDefaultBlock || !!directInsertBlock,
canCopyStyles: blocks.every(block => {
return !!block && ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'color') || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'typography'));
}),
canDuplicate: blocks.every(block => {
return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true) && canInsertBlockType(block.name, rootClientId);
})
};
}, [clientIds, getDefaultBlockName]);
const {
getBlocksByClientId,
getBlocks
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
canMove,
canRemove,
canInsertBlock,
canCopyStyles,
canDuplicate
} = selected;
const {
removeBlocks,
replaceBlocks,
duplicateBlocks,
insertAfterBlock,
insertBeforeBlock,
flashBlock,
setBlockMovingClientId,
setNavigationMode,
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const notifyCopy = useNotifyCopy();
const pasteStyles = usePasteStyles();
return children({
canCopyStyles,
canDuplicate,
canInsertBlock,
canMove,
canRemove,
onDuplicate() {
return duplicateBlocks(clientIds, updateSelection);
},
onRemove() {
return removeBlocks(clientIds, updateSelection);
},
onInsertBefore() {
const clientId = Array.isArray(clientIds) ? clientIds[0] : clientId;
insertBeforeBlock(clientId);
},
onInsertAfter() {
const clientId = Array.isArray(clientIds) ? clientIds[clientIds.length - 1] : clientId;
insertAfterBlock(clientId);
},
onMoveTo() {
setNavigationMode(true);
selectBlock(clientIds[0]);
setBlockMovingClientId(clientIds[0]);
},
onGroup() {
if (!clientIds.length) {
return;
}
const groupingBlockName = getGroupingBlockName();
// Activate the `transform` on `core/group` which does the conversion.
const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(getBlocksByClientId(clientIds), groupingBlockName);
if (!newBlocks) {
return;
}
replaceBlocks(clientIds, newBlocks);
},
onUngroup() {
if (!clientIds.length) {
return;
}
const innerBlocks = getBlocks(clientIds[0]);
if (!innerBlocks.length) {
return;
}
replaceBlocks(clientIds, innerBlocks);
},
onCopy() {
if (clientIds.length === 1) {
flashBlock(clientIds[0]);
}
notifyCopy('copy', clientIds);
},
async onPasteStyles() {
await pasteStyles(getBlocksByClientId(clientIds));
}
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-html-convert-button.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockHTMLConvertButton({
clientId
}) {
const block = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlock(clientId), [clientId]);
const {
replaceBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
if (!block || block.name !== 'core/html') {
return null;
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => replaceBlocks(clientId, (0,external_wp_blocks_namespaceObject.rawHandler)({
HTML: (0,external_wp_blocks_namespaceObject.getBlockContent)(block)
}))
}, (0,external_wp_i18n_namespaceObject.__)('Convert to Blocks'));
}
/* harmony default export */ const block_html_convert_button = (BlockHTMLConvertButton);
;// 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 */ const block_settings_menu_first_item = (__unstableBlockSettingsMenuFirstItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-settings-menu/block-settings-dropdown.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const block_settings_dropdown_POPOVER_PROPS = {
className: 'block-editor-block-settings-menu__popover',
placement: 'bottom-start'
};
function CopyMenuItem({
clientIds,
onCopy,
label
}) {
const {
getBlocksByClientId
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(() => (0,external_wp_blocks_namespaceObject.serialize)(getBlocksByClientId(clientIds)), onCopy);
const copyMenuItemLabel = label ? label : (0,external_wp_i18n_namespaceObject.__)('Copy');
return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
ref: ref
}, copyMenuItemLabel);
}
function ParentSelectorMenuItem({
parentClientId,
parentBlockType
}) {
const isSmallViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
const {
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
// Allows highlighting the parent block outline when focusing or hovering
// the parent block selector within the child.
const menuItemRef = (0,external_wp_element_namespaceObject.useRef)();
const gesturesProps = useShowHoveredOrFocusedGestures({
ref: menuItemRef,
highlightParent: true
});
if (!isSmallViewport) {
return null;
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
...gesturesProps,
ref: menuItemRef,
icon: (0,external_React_.createElement)(block_icon, {
icon: parentBlockType.icon
}),
onClick: () => selectBlock(parentClientId)
}, (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));
}
function BlockSettingsDropdown({
block,
clientIds,
__experimentalSelectBlock,
children,
__unstableDisplayLocation,
...props
}) {
// Get the client id of the current block for this menu, if one is set.
const currentClientId = block?.clientId;
const blockClientIds = Array.isArray(clientIds) ? clientIds : [clientIds];
const count = blockClientIds.length;
const firstBlockClientId = blockClientIds[0];
const {
firstParentClientId,
onlyBlock,
parentBlockType,
previousBlockClientId,
selectedBlockClientIds
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockCount,
getBlockName,
getBlockRootClientId,
getPreviousBlockClientId,
getSelectedBlockClientIds,
getBlockAttributes
} = select(store);
const {
getActiveBlockVariation
} = select(external_wp_blocks_namespaceObject.store);
const _firstParentClientId = getBlockRootClientId(firstBlockClientId);
const parentBlockName = _firstParentClientId && getBlockName(_firstParentClientId);
return {
firstParentClientId: _firstParentClientId,
onlyBlock: 1 === getBlockCount(_firstParentClientId),
parentBlockType: _firstParentClientId && (getActiveBlockVariation(parentBlockName, getBlockAttributes(_firstParentClientId)) || (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName)),
previousBlockClientId: getPreviousBlockClientId(firstBlockClientId),
selectedBlockClientIds: getSelectedBlockClientIds()
};
}, [firstBlockClientId]);
const {
getBlockOrder,
getSelectedBlockClientIds
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const openedBlockSettingsMenu = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getOpenedBlockSettingsMenu(), []);
const {
setOpenedBlockSettingsMenu
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
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 isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)();
const hasSelectedBlocks = selectedBlockClientIds.length > 0;
const updateSelectionAfterDuplicate = (0,external_wp_element_namespaceObject.useCallback)(async clientIdsPromise => {
if (__experimentalSelectBlock) {
const ids = await clientIdsPromise;
if (ids && ids[0]) {
__experimentalSelectBlock(ids[0], false);
}
}
}, [__experimentalSelectBlock]);
const updateSelectionAfterRemove = (0,external_wp_element_namespaceObject.useCallback)(() => {
if (__experimentalSelectBlock) {
let blockToFocus = previousBlockClientId || firstParentClientId;
// Focus the first block if there's no previous block nor parent block.
if (!blockToFocus) {
blockToFocus = getBlockOrder()[0];
}
// Only update the selection if the original selection is removed.
const shouldUpdateSelection = hasSelectedBlocks && getSelectedBlockClientIds().length === 0;
__experimentalSelectBlock(blockToFocus, shouldUpdateSelection);
}
}, [__experimentalSelectBlock, previousBlockClientId, firstParentClientId, getBlockOrder, hasSelectedBlocks, getSelectedBlockClientIds]);
// This can occur when the selected block (the parent)
// displays child blocks within a List View.
const parentBlockIsSelected = selectedBlockClientIds?.includes(firstParentClientId);
// When a currentClientId is in use, treat the menu as a controlled component.
// This ensures that only one block settings menu is open at a time.
// This is a temporary solution to work around an issue with `onFocusOutside`
// where it does not allow a dropdown to be closed if focus was never within
// the dropdown to begin with. Examples include a user either CMD+Clicking or
// right clicking into an inactive window.
// See: https://github.com/WordPress/gutenberg/pull/54083
const open = !currentClientId ? undefined : openedBlockSettingsMenu === currentClientId || false;
const onToggle = (0,external_wp_element_namespaceObject.useCallback)(localOpen => {
if (localOpen && openedBlockSettingsMenu !== currentClientId) {
setOpenedBlockSettingsMenu(currentClientId);
} else if (!localOpen && openedBlockSettingsMenu && openedBlockSettingsMenu === currentClientId) {
setOpenedBlockSettingsMenu(undefined);
}
}, [currentClientId, openedBlockSettingsMenu, setOpenedBlockSettingsMenu]);
return (0,external_React_.createElement)(BlockActions, {
clientIds: clientIds,
__experimentalUpdateSelection: !__experimentalSelectBlock
}, ({
canCopyStyles,
canDuplicate,
canInsertBlock,
canMove,
canRemove,
onDuplicate,
onInsertAfter,
onInsertBefore,
onRemove,
onCopy,
onPasteStyles,
onMoveTo
}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
icon: more_vertical,
label: (0,external_wp_i18n_namespaceObject.__)('Options'),
className: "block-editor-block-settings-menu",
popoverProps: block_settings_dropdown_POPOVER_PROPS,
open: open,
onToggle: onToggle,
noIcons: true,
menuProps: {
/**
* @param {KeyboardEvent} event
*/
onKeyDown(event) {
if (event.defaultPrevented) return;
if (isMatch('core/block-editor/remove', event) && canRemove) {
event.preventDefault();
updateSelectionAfterRemove(onRemove());
} else if (isMatch('core/block-editor/duplicate', event) && canDuplicate) {
event.preventDefault();
updateSelectionAfterDuplicate(onDuplicate());
} else if (isMatch('core/block-editor/insert-after', event) && canInsertBlock) {
event.preventDefault();
setOpenedBlockSettingsMenu(undefined);
onInsertAfter();
} else if (isMatch('core/block-editor/insert-before', event) && canInsertBlock) {
event.preventDefault();
setOpenedBlockSettingsMenu(undefined);
onInsertBefore();
}
}
},
...props
}, ({
onClose
}) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(block_settings_menu_first_item.Slot, {
fillProps: {
onClose
}
}), !parentBlockIsSelected && !!firstParentClientId && (0,external_React_.createElement)(ParentSelectorMenuItem, {
parentClientId: firstParentClientId,
parentBlockType: parentBlockType
}), count === 1 && (0,external_React_.createElement)(block_html_convert_button, {
clientId: firstBlockClientId
}), (0,external_React_.createElement)(CopyMenuItem, {
clientIds: clientIds,
onCopy: onCopy
}), canDuplicate && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onDuplicate, updateSelectionAfterDuplicate),
shortcut: shortcuts.duplicate
}, (0,external_wp_i18n_namespaceObject.__)('Duplicate')), canInsertBlock && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onInsertBefore),
shortcut: shortcuts.insertBefore
}, (0,external_wp_i18n_namespaceObject.__)('Add before')), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onInsertAfter),
shortcut: shortcuts.insertAfter
}, (0,external_wp_i18n_namespaceObject.__)('Add after')))), canCopyStyles && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(CopyMenuItem, {
clientIds: clientIds,
onCopy: onCopy,
label: (0,external_wp_i18n_namespaceObject.__)('Copy styles')
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: onPasteStyles
}, (0,external_wp_i18n_namespaceObject.__)('Paste styles'))), (0,external_React_.createElement)(block_settings_menu_controls.Slot, {
fillProps: {
onClose,
canMove,
onMoveTo,
onlyBlock,
count,
firstBlockClientId
},
clientIds: clientIds,
__unstableDisplayLocation: __unstableDisplayLocation
}), typeof children === 'function' ? children({
onClose
}) : external_wp_element_namespaceObject.Children.map(child => (0,external_wp_element_namespaceObject.cloneElement)(child, {
onClose
})), canRemove && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: (0,external_wp_compose_namespaceObject.pipe)(onClose, onRemove, updateSelectionAfterRemove),
shortcut: shortcuts.remove
}, (0,external_wp_i18n_namespaceObject.__)('Delete'))))));
}
/* harmony default export */ const 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 (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_React_.createElement)(block_settings_dropdown, {
clientIds: clientIds,
toggleProps: toggleProps,
...props
})));
}
/* harmony default export */ const block_settings_menu = (BlockSettingsMenu);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-lock/toolbar.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockLockToolbar({
clientId
}) {
const {
canLock,
isLocked
} = useBlockLock(clientId);
const [isModalOpen, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false);
const hasLockButtonShown = (0,external_wp_element_namespaceObject.useRef)(false);
// If the block lock button has been shown, we don't want to remove it
// from the toolbar until the toolbar is rendered again without it.
// Removing it beforehand can cause focus loss issues, such as when
// unlocking the block from the modal. It needs to return focus from
// whence it came, and to do that, we need to leave the button in the toolbar.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (isLocked) {
hasLockButtonShown.current = true;
}
}, [isLocked]);
if (!isLocked && !hasLockButtonShown.current) {
return null;
}
let label = isLocked ? (0,external_wp_i18n_namespaceObject.__)('Unlock') : (0,external_wp_i18n_namespaceObject.__)('Lock');
if (!canLock && isLocked) {
label = (0,external_wp_i18n_namespaceObject.__)('Locked');
}
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, {
className: "block-editor-block-lock-toolbar"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
accessibleWhenDisabled: true,
disabled: !canLock,
icon: isLocked ? library_lock : library_unlock,
label: label,
onClick: toggleModal,
"aria-expanded": isModalOpen,
"aria-haspopup": "dialog"
})), isModalOpen && (0,external_React_.createElement)(BlockLockModal, {
clientId: clientId,
onClose: toggleModal
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/group.js
/**
* WordPress dependencies
*/
const group_group = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.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 */ const library_group = (group_group);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/row.js
/**
* WordPress dependencies
*/
const row = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 6.5h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4V16h5a.5.5 0 0 0 .5-.5v-7A.5.5 0 0 0 9 8H4V6.5Zm16 0h-5a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h5V16h-5a.5.5 0 0 1-.5-.5v-7A.5.5 0 0 1 15 8h5V6.5Z"
}));
/* harmony default export */ const library_row = (row);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stack.js
/**
* WordPress dependencies
*/
const stack = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.5 4v5a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V4H8v5a.5.5 0 0 0 .5.5h7A.5.5 0 0 0 16 9V4h1.5Zm0 16v-5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v5H8v-5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v5h1.5Z"
}));
/* harmony default export */ const 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: {
type: 'constrained'
},
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,
variations
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canRemoveBlocks
} = select(store);
const {
getBlockVariations
} = select(external_wp_blocks_namespaceObject.store);
return {
canRemove: canRemoveBlocks(clientIds),
variations: getBlockVariations(groupingBlockName, 'transform')
};
}, [clientIds, groupingBlockName]);
const onConvertToGroup = layout => {
const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocksSelection, groupingBlockName);
if (typeof layout !== 'string') {
layout = 'group';
}
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;
}
const canInsertRow = !!variations.find(({
name
}) => name === 'group-row');
const canInsertStack = !!variations.find(({
name
}) => name === 'group-stack');
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: library_group,
label: (0,external_wp_i18n_namespaceObject._x)('Group', 'verb'),
onClick: onConvertToGroup
}), canInsertRow && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: library_row,
label: (0,external_wp_i18n_namespaceObject._x)('Row', 'single horizontal line'),
onClick: onConvertToRow
}), canInsertStack && (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: library_stack,
label: (0,external_wp_i18n_namespaceObject._x)('Stack', 'verb'),
onClick: onConvertToStack
}));
}
/* harmony default export */ const toolbar = (BlockGroupToolbar);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-edit-visually-button/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockEditVisuallyButton({
clientIds
}) {
// Edit visually only works for single block selection.
const clientId = clientIds.length === 1 ? clientIds[0] : undefined;
const canEditVisually = (0,external_wp_data_namespaceObject.useSelect)(select => !!clientId && select(store).getBlockMode(clientId) === 'html', [clientId]);
const {
toggleBlockMode
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
if (!canEditVisually) {
return null;
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: () => {
toggleBlockMode(clientId);
}
}, (0,external_wp_i18n_namespaceObject.__)('Edit visually')));
}
;// 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 */ const block_name_context = (__unstableBlockNameContext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/navigable-toolbar/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function hasOnlyToolbarItem(elements) {
const dataProp = 'toolbarItem';
return !elements.some(element => !(dataProp in element.dataset));
}
function getAllFocusableToolbarItemsIn(container) {
return Array.from(container.querySelectorAll('[data-toolbar-item]:not([disabled])'));
}
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({
// When focusing newly mounted toolbars,
// the position of the popover is often not right on the first render
// This prevents the layout shifts when focusing the dialogs.
preventScroll: true
});
}
}
function useIsAccessibleToolbar(toolbarRef) {
/*
* 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
* <Toolbar /> 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(toolbarRef.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);
}, [toolbarRef]);
(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(toolbarRef.current, {
childList: true,
subtree: true
});
return () => observer.disconnect();
}, [determineIsAccessibleToolbar, isAccessibleToolbar, toolbarRef]);
return isAccessibleToolbar;
}
function useToolbarFocus({
toolbarRef,
focusOnMount,
isAccessibleToolbar,
defaultIndex,
onIndexChange,
shouldUseKeyboardFocusShortcut,
focusEditorOnEscape
}) {
// 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(toolbarRef.current);
}, [toolbarRef]);
const focusToolbarViaShortcut = () => {
if (shouldUseKeyboardFocusShortcut) {
focusToolbar();
}
};
// Focus on toolbar when pressing alt+F10 when the toolbar is visible.
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/block-editor/focus-toolbar', focusToolbarViaShortcut);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (initialFocusOnMount) {
focusToolbar();
}
}, [isAccessibleToolbar, initialFocusOnMount, focusToolbar]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Store ref so we have access on useEffect cleanup: https://legacy.reactjs.org/blog/2020/08/10/react-v17-rc.html#effect-cleanup-timing
const navigableToolbarRef = toolbarRef.current;
// 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 the toolbar already had focus before the render, we don't want to move it.
// https://github.com/WordPress/gutenberg/issues/58511
if (!initialFocusOnMount && !hasFocusWithin(navigableToolbarRef)) {
raf = window.requestAnimationFrame(() => {
const items = getAllFocusableToolbarItemsIn(navigableToolbarRef);
const index = initialIndex || 0;
if (items[index] && hasFocusWithin(navigableToolbarRef)) {
items[index].focus({
// When focusing newly mounted toolbars,
// the position of the popover is often not right on the first render
// This prevents the layout shifts when focusing the dialogs.
preventScroll: true
});
}
});
}
return () => {
window.cancelAnimationFrame(raf);
if (!onIndexChange || !navigableToolbarRef) 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 = getAllFocusableToolbarItemsIn(navigableToolbarRef);
const index = items.findIndex(item => item.tabIndex === 0);
onIndexChange(index);
};
}, [initialIndex, initialFocusOnMount, onIndexChange, toolbarRef]);
const {
getLastFocus
} = unlock((0,external_wp_data_namespaceObject.useSelect)(store));
/**
* Handles returning focus to the block editor canvas when pressing escape.
*/
(0,external_wp_element_namespaceObject.useEffect)(() => {
const navigableToolbarRef = toolbarRef.current;
if (focusEditorOnEscape) {
const handleKeyDown = event => {
const lastFocus = getLastFocus();
if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && lastFocus?.current) {
// Focus the last focused element when pressing escape.
event.preventDefault();
lastFocus.current.focus();
}
};
navigableToolbarRef.addEventListener('keydown', handleKeyDown);
return () => {
navigableToolbarRef.removeEventListener('keydown', handleKeyDown);
};
}
}, [focusEditorOnEscape, getLastFocus, toolbarRef]);
}
function NavigableToolbar({
children,
focusOnMount,
focusEditorOnEscape = false,
shouldUseKeyboardFocusShortcut = true,
__experimentalInitialIndex: initialIndex,
__experimentalOnIndexChange: onIndexChange,
...props
}) {
const toolbarRef = (0,external_wp_element_namespaceObject.useRef)();
const isAccessibleToolbar = useIsAccessibleToolbar(toolbarRef);
useToolbarFocus({
toolbarRef,
focusOnMount,
defaultIndex: initialIndex,
onIndexChange,
isAccessibleToolbar,
shouldUseKeyboardFocusShortcut,
focusEditorOnEscape
});
if (isAccessibleToolbar) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Toolbar, {
label: props['aria-label'],
ref: toolbarRef,
...props
}, children);
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.NavigableMenu, {
orientation: "horizontal",
role: "toolbar",
ref: toolbarRef,
...props
}, children);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-controls/use-has-block-controls.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useHasAnyBlockControls() {
let hasAnyBlockControls = false;
for (const group in block_controls_groups) {
// It is safe to violate the rules of hooks here as the `groups` object
// is static and will not change length between renders. Do not return
// early as that will cause the hook to be called a different number of
// times between renders.
// eslint-disable-next-line react-hooks/rules-of-hooks
if (useHasBlockControls(group)) {
hasAnyBlockControls = true;
}
}
return hasAnyBlockControls;
}
function useHasBlockControls(group = 'default') {
const Slot = block_controls_groups[group]?.Slot;
const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(Slot?.__unstableName);
if (!Slot) {
true ? external_wp_warning_default()(`Unknown BlockControls group "${group}" provided.`) : 0;
return null;
}
return !!fills?.length;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/connection.js
/**
* WordPress dependencies
*/
const connection = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg",
fillRule: "evenodd"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M5 19L8 16L5 19Z"
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M16 8L19 5L16 8Z"
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.G, null, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M5 19L8 16"
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M9.30003 17.3C9.523 17.5237 9.78794 17.7013 10.0797 17.8224C10.3714 17.9435 10.6842 18.0059 11 18.0059C11.3159 18.0059 11.6287 17.9435 11.9204 17.8224C12.2121 17.7013 12.4771 17.5237 12.7 17.3L15 15L9.00003 9L6.70003 11.3C6.47629 11.523 6.29876 11.7879 6.17763 12.0796C6.05649 12.3714 5.99414 12.6841 5.99414 13C5.99414 13.3159 6.05649 13.6286 6.17763 13.9204C6.29876 14.2121 6.47629 14.477 6.70003 14.7L9.30003 17.3Z"
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M16 8L19 5"
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M9 9.00003L15 15L17.3 12.7C17.5237 12.4771 17.7013 12.2121 17.8224 11.9204C17.9435 11.6287 18.0059 11.3159 18.0059 11C18.0059 10.6842 17.9435 10.3714 17.8224 10.0797C17.7013 9.78794 17.5237 9.523 17.3 9.30003L14.7 6.70003C14.477 6.47629 14.2121 6.29876 13.9204 6.17763C13.6286 6.05649 13.3159 5.99414 13 5.99414C12.6841 5.99414 12.3714 6.05649 12.0796 6.17763C11.7879 6.29876 11.523 6.47629 11.3 6.70003L9 9.00003Z"
})));
/* harmony default export */ const library_connection = (connection);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-bindings-toolbar-indicator/index.js
/**
* WordPress dependencies
*/
function BlockBindingsToolbarIndicator() {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
as: 'div',
"aria-label": (0,external_wp_i18n_namespaceObject._x)('Connected', 'block toolbar button label'),
className: "block-editor-block-bindings-toolbar-indicator"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
icon: library_connection,
size: 24
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-toolbar/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Renders the block toolbar.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md
*
* @param {Object} props Components props.
* @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.
* @param {boolean} props.focusOnMount Focus the toolbar when mounted.
* @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.
* @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.
* @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.
*/
function PrivateBlockToolbar({
hideDragHandle,
focusOnMount,
__experimentalInitialIndex,
__experimentalOnIndexChange,
variant = 'unstyled'
}) {
const {
blockClientId,
blockClientIds,
isDefaultEditingMode,
blockType,
blockName,
shouldShowVisualToolbar,
showParentSelector,
isUsingBindings
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockName,
getBlockMode,
getBlockParents,
getSelectedBlockClientIds,
isBlockValid,
getBlockRootClientId,
getBlockEditingMode,
getBlockAttributes
} = select(store);
const selectedBlockClientIds = getSelectedBlockClientIds();
const selectedBlockClientId = selectedBlockClientIds[0];
const blockRootClientId = getBlockRootClientId(selectedBlockClientId);
const parents = getBlockParents(selectedBlockClientId);
const firstParentClientId = parents[parents.length - 1];
const parentBlockName = getBlockName(firstParentClientId);
const parentBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName);
const _isDefaultEditingMode = getBlockEditingMode(selectedBlockClientId) === 'default';
const _blockName = getBlockName(selectedBlockClientId);
const isValid = selectedBlockClientIds.every(id => isBlockValid(id));
const isVisual = selectedBlockClientIds.every(id => getBlockMode(id) === 'visual');
const _isUsingBindings = !!getBlockAttributes(selectedBlockClientId)?.metadata?.bindings;
return {
blockClientId: selectedBlockClientId,
blockClientIds: selectedBlockClientIds,
isDefaultEditingMode: _isDefaultEditingMode,
blockName: _blockName,
blockType: selectedBlockClientId && (0,external_wp_blocks_namespaceObject.getBlockType)(_blockName),
shouldShowVisualToolbar: isValid && isVisual,
rootClientId: blockRootClientId,
showParentSelector: parentBlockType && getBlockEditingMode(firstParentClientId) === 'default' && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(parentBlockType, '__experimentalParentSelector', true) && selectedBlockClientIds.length === 1 && _isDefaultEditingMode,
isUsingBindings: _isUsingBindings
};
}, []);
const toolbarWrapperRef = (0,external_wp_element_namespaceObject.useRef)(null);
// Handles highlighting the current block outline on hover or focus of the
// block type toolbar area.
const nodeRef = (0,external_wp_element_namespaceObject.useRef)();
const showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures({
ref: nodeRef
});
const isLargeViewport = !(0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
const isToolbarEnabled = blockType && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, '__experimentalToolbar', true);
const hasAnyBlockControls = useHasAnyBlockControls();
if (!isToolbarEnabled || !isDefaultEditingMode && !hasAnyBlockControls) {
return null;
}
const isMultiToolbar = blockClientIds.length > 1;
const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType) || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType);
// Shifts the toolbar to make room for the parent block selector.
const classes = classnames_default()('block-editor-block-contextual-toolbar', {
'has-parent': showParentSelector
});
const innerClasses = classnames_default()('block-editor-block-toolbar', {
'is-synced': isSynced
});
return (0,external_React_.createElement)(NavigableToolbar, {
focusEditorOnEscape: true,
className: classes
/* translators: accessibility text for the block toolbar */,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Block tools')
// The variant is applied as "toolbar" when undefined, which is the black border style of the dropdown from the toolbar popover.
,
variant: variant === 'toolbar' ? undefined : variant,
focusOnMount: focusOnMount,
__experimentalInitialIndex: __experimentalInitialIndex,
__experimentalOnIndexChange: __experimentalOnIndexChange
// Resets the index whenever the active block changes so
// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
,
key: blockClientId
}, (0,external_React_.createElement)("div", {
ref: toolbarWrapperRef,
className: innerClasses
}, !isMultiToolbar && isLargeViewport && isDefaultEditingMode && (0,external_React_.createElement)(BlockParentSelector, null), isUsingBindings && canBindBlock(blockName) && (0,external_React_.createElement)(BlockBindingsToolbarIndicator, null), (shouldShowVisualToolbar || isMultiToolbar) && isDefaultEditingMode && (0,external_React_.createElement)("div", {
ref: nodeRef,
...showHoveredOrFocusedGestures
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, {
className: "block-editor-block-toolbar__block-controls"
}, (0,external_React_.createElement)(block_switcher, {
clientIds: blockClientIds
}), !isMultiToolbar && (0,external_React_.createElement)(BlockLockToolbar, {
clientId: blockClientId
}), (0,external_React_.createElement)(block_mover, {
clientIds: blockClientIds,
hideDragHandle: hideDragHandle
}))), shouldShowVisualToolbar && isMultiToolbar && (0,external_React_.createElement)(toolbar, null), shouldShowVisualToolbar && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(block_controls.Slot, {
group: "parent",
className: "block-editor-block-toolbar__slot"
}), (0,external_React_.createElement)(block_controls.Slot, {
group: "block",
className: "block-editor-block-toolbar__slot"
}), (0,external_React_.createElement)(block_controls.Slot, {
className: "block-editor-block-toolbar__slot"
}), (0,external_React_.createElement)(block_controls.Slot, {
group: "inline",
className: "block-editor-block-toolbar__slot"
}), (0,external_React_.createElement)(block_controls.Slot, {
group: "other",
className: "block-editor-block-toolbar__slot"
}), (0,external_React_.createElement)(block_name_context.Provider, {
value: blockType?.name
}, (0,external_React_.createElement)(block_toolbar_last_item.Slot, null))), (0,external_React_.createElement)(BlockEditVisuallyButton, {
clientIds: blockClientIds
}), isDefaultEditingMode && (0,external_React_.createElement)(block_settings_menu, {
clientIds: blockClientIds
})));
}
/**
* Renders the block toolbar.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md
*
* @param {Object} props Components props.
* @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.
* @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.
*/
function BlockToolbar({
hideDragHandle,
variant
}) {
return (0,external_React_.createElement)(PrivateBlockToolbar, {
hideDragHandle: hideDragHandle,
variant: variant,
focusOnMount: undefined,
__experimentalInitialIndex: undefined,
__experimentalOnIndexChange: undefined
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-toolbar-popover.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockToolbarPopover({
clientId,
isTyping,
__unstableContentRef
}) {
const {
capturingClientId,
isInsertionPointVisible,
lastClientId
} = useSelectedBlockToolProps(clientId);
// 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)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Resets the index whenever the active block changes so this is not
// persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
initialToolbarItemIndexRef.current = undefined;
}, [clientId]);
const {
stopTyping
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const isToolbarForced = (0,external_wp_element_namespaceObject.useRef)(false);
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/block-editor/focus-toolbar', () => {
isToolbarForced.current = true;
stopTyping(true);
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
isToolbarForced.current = false;
});
const popoverProps = useBlockToolbarPopoverProps({
contentElement: __unstableContentRef?.current,
clientId
});
return !isTyping && (0,external_React_.createElement)(block_popover, {
clientId: capturingClientId || clientId,
bottomClientId: lastClientId,
className: classnames_default()('block-editor-block-list__block-popover', {
'is-insertion-point-visible': isInsertionPointVisible
}),
resize: false,
...popoverProps
}, (0,external_React_.createElement)(PrivateBlockToolbar
// If the toolbar is being shown because of being forced
// it should focus the toolbar right after the mount.
, {
focusOnMount: isToolbarForced.current,
__experimentalInitialIndex: initialToolbarItemIndexRef.current,
__experimentalOnIndexChange: index => {
initialToolbarItemIndexRef.current = index;
},
variant: "toolbar"
}));
}
;// 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 {Component} The component to be rendered.
*/
function BlockSelectionButton({
clientId,
rootClientId
}) {
const selected = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlock,
getBlockIndex,
hasBlockMovingClientId,
getBlockListSettings,
__unstableGetEditorMode
} = select(store);
const {
getActiveBlockVariation,
getBlockType
} = select(external_wp_blocks_namespaceObject.store);
const index = getBlockIndex(clientId);
const {
name,
attributes
} = getBlock(clientId);
const blockType = getBlockType(name);
const orientation = getBlockListSettings(rootClientId)?.orientation;
const match = getActiveBlockVariation(name, attributes);
return {
blockMovingMode: hasBlockMovingClientId(),
editorMode: __unstableGetEditorMode(),
icon: match?.icon || blockType.icon,
label: (0,external_wp_blocks_namespaceObject.__experimentalGetAccessibleBlockLabel)(blockType, attributes, index + 1, orientation)
};
}, [clientId, rootClientId]);
const {
label,
icon,
blockMovingMode,
editorMode
} = selected;
const {
setNavigationMode,
removeBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const ref = (0,external_wp_element_namespaceObject.useRef)();
// Focus the breadcrumb in navigation mode.
(0,external_wp_element_namespaceObject.useEffect)(() => {
ref.current.focus();
(0,external_wp_a11y_namespaceObject.speak)(label);
}, [label]);
const blockElement = useBlockElement(clientId);
const {
hasBlockMovingClientId,
getBlockIndex,
getBlockRootClientId,
getClientIdsOfDescendants,
getSelectedBlockClientId,
getMultiSelectedBlocksEndClientId,
getPreviousBlockClientId,
getNextBlockClientId
} = (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 (isEscape && editorMode === 'navigation') {
setNavigationMode(false);
event.preventDefault();
return;
}
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 && 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);
}
// Prevent the block from being moved into itself.
if (startingBlockClientId && selectedBlockClientId === startingBlockClientId && navigateIn) {
return;
}
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_React_.createElement)("div", {
className: classNames
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, {
justify: "center",
className: "block-editor-block-list__block-selection-button__content"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(block_icon, {
icon: icon,
showColors: true
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, editorMode === 'zoom-out' && (0,external_React_.createElement)(block_mover, {
clientIds: [clientId],
hideDragHandle: true
}), editorMode === 'navigation' && (0,external_React_.createElement)(block_draggable, {
clientIds: [clientId]
}, draggableProps => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
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_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
ref: ref,
onClick: editorMode === 'navigation' ? () => setNavigationMode(false) : undefined,
onKeyDown: onKeyDown,
label: label,
showTooltip: false,
className: "block-selection-button_select-button"
}, (0,external_React_.createElement)(BlockTitle, {
clientId: clientId,
maximumLength: 35
})))));
}
/* harmony default export */ const block_selection_button = (BlockSelectionButton);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/block-toolbar-breadcrumb.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function BlockToolbarBreadcrumb({
clientId,
__unstableContentRef
}) {
const {
capturingClientId,
isInsertionPointVisible,
lastClientId,
rootClientId
} = useSelectedBlockToolProps(clientId);
const popoverProps = useBlockToolbarPopoverProps({
contentElement: __unstableContentRef?.current,
clientId
});
return (0,external_React_.createElement)(block_popover, {
clientId: capturingClientId || clientId,
bottomClientId: lastClientId,
className: classnames_default()('block-editor-block-list__block-popover', {
'is-insertion-point-visible': isInsertionPointVisible
}),
resize: false,
...popoverProps
}, (0,external_React_.createElement)(block_selection_button, {
clientId: clientId,
rootClientId: rootClientId
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/zoom-out-mode-inserters.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ZoomOutModeInserters({
__unstableContentRef
}) {
const [isReady, setIsReady] = (0,external_wp_element_namespaceObject.useState)(false);
const blockOrder = (0,external_wp_data_namespaceObject.useSelect)(select => {
return select(store).getBlockOrder();
}, []);
// Defer the initial rendering to avoid the jumps due to the animation.
(0,external_wp_element_namespaceObject.useEffect)(() => {
const timeout = setTimeout(() => {
setIsReady(true);
}, 500);
return () => {
clearTimeout(timeout);
};
}, []);
if (!isReady) {
return null;
}
return blockOrder.map((clientId, index) => {
if (index === blockOrder.length - 1) {
return null;
}
return (0,external_React_.createElement)(inbetween, {
key: clientId,
previousClientId: clientId,
nextClientId: blockOrder[index + 1],
__unstableContentRef: __unstableContentRef
}, (0,external_React_.createElement)("div", {
className: "block-editor-block-list__insertion-point-inserter is-with-inserter"
}, (0,external_React_.createElement)(inserter, {
position: "bottom center",
clientId: blockOrder[index + 1],
__experimentalIsQuick: true
})));
});
}
/* harmony default export */ const zoom_out_mode_inserters = (ZoomOutModeInserters);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-tools/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function block_tools_selector(select) {
const {
getSelectedBlockClientId,
getFirstMultiSelectedBlockClientId,
getBlock,
getSettings,
hasMultiSelection,
__unstableGetEditorMode,
isTyping
} = select(store);
const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
const {
name = '',
attributes = {}
} = getBlock(clientId) || {};
const editorMode = __unstableGetEditorMode();
const hasSelectedBlock = clientId && name;
const isEmptyDefaultBlock = (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)({
name,
attributes
});
const _showEmptyBlockSideInserter = clientId && !isTyping() && editorMode === 'edit' && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)({
name,
attributes
});
const maybeShowBreadcrumb = hasSelectedBlock && !hasMultiSelection() && (editorMode === 'navigation' || editorMode === 'zoom-out');
return {
clientId,
hasFixedToolbar: getSettings().hasFixedToolbar,
isTyping: isTyping(),
isZoomOutMode: editorMode === 'zoom-out',
showEmptyBlockSideInserter: _showEmptyBlockSideInserter,
showBreadcrumb: !_showEmptyBlockSideInserter && maybeShowBreadcrumb,
showBlockToolbar: !getSettings().hasFixedToolbar && !_showEmptyBlockSideInserter && hasSelectedBlock && !isEmptyDefaultBlock && !maybeShowBreadcrumb
};
}
/**
* 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,
...props
}) {
const {
clientId,
hasFixedToolbar,
isTyping,
isZoomOutMode,
showEmptyBlockSideInserter,
showBreadcrumb,
showBlockToolbar
} = (0,external_wp_data_namespaceObject.useSelect)(block_tools_selector, []);
const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)();
const {
getSelectedBlockClientIds,
getBlockRootClientId
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
duplicateBlocks,
removeBlocks,
insertAfterBlock,
insertBeforeBlock,
selectBlock,
moveBlocksUp,
moveBlocksDown
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
function onKeyDown(event) {
if (event.defaultPrevented) return;
if (isMatch('core/block-editor/move-up', event)) {
const clientIds = getSelectedBlockClientIds();
if (clientIds.length) {
event.preventDefault();
const rootClientId = getBlockRootClientId(clientIds[0]);
moveBlocksUp(clientIds, rootClientId);
}
} else if (isMatch('core/block-editor/move-down', event)) {
const clientIds = getSelectedBlockClientIds();
if (clientIds.length) {
event.preventDefault();
const rootClientId = getBlockRootClientId(clientIds[0]);
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(clientIds[clientIds.length - 1]);
}
} else if (isMatch('core/block-editor/insert-before', event)) {
const clientIds = getSelectedBlockClientIds();
if (clientIds.length) {
event.preventDefault();
insertBeforeBlock(clientIds[0]);
}
} else if (isMatch('core/block-editor/unselect', event)) {
if (event.target.closest('[role=toolbar]')) {
// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:
// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar
// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.
// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.
// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.
return;
}
const clientIds = getSelectedBlockClientIds();
if (clientIds.length > 1) {
event.preventDefault();
// If there is more than one block selected, select the first
// block so that focus is directed back to the beginning of the selection.
// In effect, to the user this feels like deselecting the multi-selection.
selectBlock(clientIds[0]);
}
}
}
const blockToolbarRef = use_popover_scroll(__unstableContentRef);
const blockToolbarAfterRef = use_popover_scroll(__unstableContentRef);
return (
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
(0,external_React_.createElement)("div", {
...props,
onKeyDown: onKeyDown
}, (0,external_React_.createElement)(insertion_point_InsertionPointOpenRef.Provider, {
value: (0,external_wp_element_namespaceObject.useRef)(false)
}, !isTyping && (0,external_React_.createElement)(InsertionPoint, {
__unstableContentRef: __unstableContentRef
}), showEmptyBlockSideInserter && (0,external_React_.createElement)(EmptyBlockInserter, {
__unstableContentRef: __unstableContentRef,
clientId: clientId
}), showBlockToolbar && (0,external_React_.createElement)(BlockToolbarPopover, {
__unstableContentRef: __unstableContentRef,
clientId: clientId,
isTyping: isTyping
}), showBreadcrumb && (0,external_React_.createElement)(BlockToolbarBreadcrumb, {
__unstableContentRef: __unstableContentRef,
clientId: clientId
}), !isZoomOutMode && !hasFixedToolbar && (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover.Slot, {
name: "block-toolbar",
ref: blockToolbarRef
}), children, (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover.Slot, {
name: "__unstable-block-tools-after",
ref: blockToolbarAfterRef
}), isZoomOutMode && (0,external_React_.createElement)(zoom_out_mode_inserters, {
__unstableContentRef: __unstableContentRef
})))
);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-canvas/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ExperimentalBlockCanvas({
shouldIframe = true,
height = '300px',
children = (0,external_React_.createElement)(BlockList, null),
styles,
contentRef: contentRefProp,
iframeProps
}) {
const resetTypingRef = useMouseMoveTypingReset();
const clearerRef = useBlockSelectionClearer();
const localRef = (0,external_wp_element_namespaceObject.useRef)();
const contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRefProp, clearerRef, localRef]);
if (!shouldIframe) {
return (0,external_React_.createElement)(BlockTools, {
__unstableContentRef: localRef,
style: {
height,
display: 'flex'
}
}, (0,external_React_.createElement)(EditorStyles, {
styles: styles,
scope: ".editor-styles-wrapper"
}), (0,external_React_.createElement)(writing_flow, {
ref: contentRef,
className: "editor-styles-wrapper",
tabIndex: -1,
style: {
height: '100%',
width: '100%'
}
}, children));
}
return (0,external_React_.createElement)(BlockTools, {
__unstableContentRef: localRef,
style: {
height,
display: 'flex'
}
}, (0,external_React_.createElement)(iframe, {
...iframeProps,
ref: resetTypingRef,
contentRef: contentRef,
style: {
...iframeProps?.style
},
name: "editor-canvas"
}, (0,external_React_.createElement)(EditorStyles, {
styles: styles
}), children));
}
/**
* BlockCanvas component is a component used to display the canvas of the block editor.
* What we call the canvas is an iframe containing the block list that you can manipulate.
* The component is also responsible of wiring up all the necessary hooks to enable
* the keyboard navigation across blocks in the editor and inject content styles into the iframe.
*
* @example
*
* ```jsx
* function MyBlockEditor() {
* const [ blocks, updateBlocks ] = useState([]);
* return (
* <BlockEditorProvider
* value={ blocks }
* onInput={ updateBlocks }
* onChange={ persistBlocks }
* >
* <BlockCanvas height="400px" />
* </BlockEditorProvider>
* );
* }
* ```
*
* @param {Object} props Component props.
* @param {string} props.height Canvas height, defaults to 300px.
* @param {Array} props.styles Content styles to inject into the iframe.
* @param {Element} props.children Content of the canvas, defaults to the BlockList component.
* @return {Element} Block Breadcrumb.
*/
function BlockCanvas({
children,
height,
styles
}) {
return (0,external_React_.createElement)(ExperimentalBlockCanvas, {
height: height,
styles: styles
}, children);
}
/* harmony default export */ const block_canvas = (BlockCanvas);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-style-selector/index.js
/**
* WordPress dependencies
*/
const ColorSelectorSVGIcon = () => (0,external_React_.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20"
}, (0,external_React_.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 = ({
style,
className
}) => {
return (0,external_React_.createElement)("div", {
className: "block-library-colors-selector__icon-container"
}, (0,external_React_.createElement)("div", {
className: `${className} block-library-colors-selector__state-selection`,
style: style
}, (0,external_React_.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_namespaceObject.DOWN) {
event.preventDefault();
onToggle();
}
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.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_React_.createElement)(BackgroundColor, null, (0,external_React_.createElement)(TextColor, null, (0,external_React_.createElement)(ColorSelectorIcon, null)))
}));
};
const BlockColorsStyleSelector = ({
children,
...other
}) => {
external_wp_deprecated_default()(`wp.blockEditor.BlockColorsStyleSelector`, {
alternative: 'block supports API',
since: '6.1',
version: '6.3'
});
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: {
placement: 'bottom-start'
},
className: "block-library-colors-selector",
contentClassName: "block-library-colors-selector__popover",
renderToggle: renderToggleComponent(other),
renderContent: () => children
});
};
/* harmony default export */ const color_style_selector = (BlockColorsStyleSelector);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js
/**
* WordPress dependencies
*/
const listView = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"
}));
/* harmony default export */ const list_view = (listView);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/context.js
/**
* WordPress dependencies
*/
const ListViewContext = (0,external_wp_element_namespaceObject.createContext)({});
const useListViewContext = () => (0,external_wp_element_namespaceObject.useContext)(ListViewContext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/aria-referenced-text.js
/**
* WordPress dependencies
*/
/**
* A component specifically designed to be used as an element referenced
* by ARIA attributes such as `aria-labelledby` or `aria-describedby`.
*
* @param {Object} props Props.
* @param {import('react').ReactNode} props.children
*/
function AriaReferencedText({
children,
...props
}) {
const ref = (0,external_wp_element_namespaceObject.useRef)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (ref.current) {
// This seems like a no-op, but it fixes a bug in Firefox where
// it fails to recompute the text when only the text node changes.
// @see https://github.com/WordPress/gutenberg/pull/51035
ref.current.textContent = ref.current.textContent;
}
}, [children]);
return (0,external_React_.createElement)("div", {
hidden: true,
...props,
ref: ref
}, children);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/appender.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const Appender = (0,external_wp_element_namespaceObject.forwardRef)(({
nestingLevel,
blockCount,
clientId,
...props
}, ref) => {
const {
insertedBlock,
setInsertedBlock
} = useListViewContext();
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Appender);
const hideInserter = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getTemplateLock,
__unstableGetEditorMode
} = select(store);
return !!getTemplateLock(clientId) || __unstableGetEditorMode() === 'zoom-out';
}, [clientId]);
const blockTitle = useBlockDisplayTitle({
clientId,
context: 'list-view'
});
const insertedBlockTitle = useBlockDisplayTitle({
clientId: insertedBlock?.clientId,
context: 'list-view'
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!insertedBlockTitle?.length) {
return;
}
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: name of block being inserted (i.e. Paragraph, Image, Group etc)
(0,external_wp_i18n_namespaceObject.__)('%s block inserted'), insertedBlockTitle), 'assertive');
}, [insertedBlockTitle]);
if (hideInserter) {
return null;
}
const descriptionId = `list-view-appender__${instanceId}`;
const description = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */
(0,external_wp_i18n_namespaceObject.__)('Append to %1$s block at position %2$d, Level %3$d'), blockTitle, blockCount + 1, nestingLevel);
return (0,external_React_.createElement)("div", {
className: "list-view-appender"
}, (0,external_React_.createElement)(inserter, {
ref: ref,
rootClientId: clientId,
position: "bottom right",
isAppender: true,
selectBlockOnInsert: false,
shouldDirectInsert: false,
__experimentalIsQuick: true,
...props,
toggleProps: {
'aria-describedby': descriptionId
},
onSelectOrClose: maybeInsertedBlock => {
if (maybeInsertedBlock?.clientId) {
setInsertedBlock(maybeInsertedBlock);
}
}
}), (0,external_React_.createElement)(AriaReferencedText, {
id: descriptionId
}, description));
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/leaf.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const AnimatedTreeGridRow = dist_esm_it(external_wp_components_namespaceObject.__experimentalTreeGridRow);
const ListViewLeaf = (0,external_wp_element_namespaceObject.forwardRef)(({
isDragged,
isSelected,
position,
level,
rowCount,
children,
className,
path,
...props
}, ref) => {
const animationRef = use_moving_animation({
clientId: props['data-block'],
enableAnimation: true,
triggerAnimationOnChange: path
});
const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, animationRef]);
return (0,external_React_.createElement)(AnimatedTreeGridRow, {
ref: mergedRef,
className: classnames_default()('block-editor-list-view-leaf', className),
level: level,
positionInSet: position,
setSize: rowCount,
isExpanded: undefined,
...props
}, children);
});
/* harmony default export */ const leaf = (ListViewLeaf);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-scroll-into-view.js
/**
* WordPress dependencies
*/
function useListViewScrollIntoView({
isSelected,
selectedClientIds,
rowItemRef
}) {
const isSingleSelection = selectedClientIds.length === 1;
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
// Skip scrolling into view if this particular block isn't selected,
// or if more than one block is selected overall. This is to avoid
// scrolling the view in a multi selection where the user has intentionally
// selected multiple blocks within the list view, but the initially
// selected block may be out of view.
if (!isSelected || !isSingleSelection || !rowItemRef.current) {
return;
}
const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(rowItemRef.current);
const {
ownerDocument
} = rowItemRef.current;
const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement;
// If the there is no scroll container, of if the scroll container is the window,
// do not scroll into view, as the block is already in view.
if (windowScroll || !scrollContainer) {
return;
}
const rowRect = rowItemRef.current.getBoundingClientRect();
const scrollContainerRect = scrollContainer.getBoundingClientRect();
// If the selected block is not currently visible, scroll to it.
if (rowRect.top < scrollContainerRect.top || rowRect.bottom > scrollContainerRect.bottom) {
rowItemRef.current.scrollIntoView();
}
}, [isSelected, isSingleSelection, rowItemRef]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pin-small.js
/**
* WordPress dependencies
*/
const pinSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M10.97 10.159a3.382 3.382 0 0 0-2.857.955l1.724 1.723-2.836 2.913L7 17h1.25l2.913-2.837 1.723 1.723a3.38 3.38 0 0 0 .606-.825c.33-.63.446-1.343.35-2.032L17 10.695 13.305 7l-2.334 3.159Z"
}));
/* harmony default export */ const pin_small = (pinSmall);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/lock-small.js
/**
* WordPress dependencies
*/
const lockSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z"
}));
/* harmony default export */ const lock_small = (lockSmall);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/expander.js
/**
* WordPress dependencies
*/
function ListViewExpander({
onClick
}) {
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_React_.createElement)("span", {
className: "block-editor-list-view__expander",
onClick: event => onClick(event, {
forceToggle: true
}),
"aria-hidden": "true",
"data-testid": "list-view-expander"
}, (0,external_React_.createElement)(build_module_icon, {
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left_small : chevron_right_small
}))
);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-images.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// Maximum number of images to display in a list view row.
const MAX_IMAGES = 3;
function getImage(block) {
if (block.name !== 'core/image') {
return;
}
if (block.attributes?.url) {
return {
url: block.attributes.url,
alt: block.attributes.alt,
clientId: block.clientId
};
}
}
function getImagesFromGallery(block) {
if (block.name !== 'core/gallery' || !block.innerBlocks) {
return [];
}
const images = [];
for (const innerBlock of block.innerBlocks) {
const img = getImage(innerBlock);
if (img) {
images.push(img);
}
if (images.length >= MAX_IMAGES) {
return images;
}
}
return images;
}
function getImagesFromBlock(block, isExpanded) {
const img = getImage(block);
if (img) {
return [img];
}
return isExpanded ? [] : getImagesFromGallery(block);
}
/**
* Get a block's preview images for display within a list view row.
*
* TODO: Currently only supports images from the core/image and core/gallery
* blocks. This should be expanded to support other blocks that have images,
* potentially via an API that blocks can opt into / provide their own logic.
*
* @param {Object} props Hook properties.
* @param {string} props.clientId The block's clientId.
* @param {boolean} props.isExpanded Whether or not the block is expanded in the list view.
* @return {Array} Images.
*/
function useListViewImages({
clientId,
isExpanded
}) {
const {
block
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const _block = select(store).getBlock(clientId);
return {
block: _block
};
}, [clientId]);
const images = (0,external_wp_element_namespaceObject.useMemo)(() => {
return getImagesFromBlock(block, isExpanded);
}, [block, isExpanded]);
return images;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/block-select-button.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ListViewBlockSelectButton({
className,
block: {
clientId,
name: blockName
},
onClick,
onContextMenu,
onMouseDown,
onToggleExpanded,
tabIndex,
onFocus,
onDragStart,
onDragEnd,
draggable,
isExpanded,
ariaLabel,
ariaDescribedBy,
updateFocusAndSelection
}, ref) {
const blockInformation = useBlockDisplayInformation(clientId);
const blockTitle = useBlockDisplayTitle({
clientId,
context: 'list-view'
});
const {
isLocked
} = useBlockLock(clientId);
const {
canInsertBlockType,
getSelectedBlockClientIds,
getPreviousBlockClientId,
getBlockRootClientId,
getBlockOrder,
getBlocksByClientId,
getBlockAttributes,
canRemoveBlocks
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
duplicateBlocks,
multiSelect,
removeBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)();
const isSticky = blockInformation?.positionType === 'sticky';
const images = useListViewImages({
clientId,
isExpanded
});
const {
rootClientId
} = useListViewContext();
const isConnected = getBlockAttributes(clientId)?.metadata?.bindings;
const positionLabel = blockInformation?.positionLabel ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: Position of selected block, e.g. "Sticky" or "Fixed".
(0,external_wp_i18n_namespaceObject.__)('Position: %1$s'), blockInformation.positionLabel) : '';
// 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?.(event);
};
// Determine which blocks to update:
// If the current (focused) block is part of the block selection, use the whole selection.
// If the focused block is not part of the block selection, only update the focused block.
function getBlocksToUpdate() {
const selectedBlockClientIds = getSelectedBlockClientIds();
const isUpdatingSelectedBlocks = selectedBlockClientIds.includes(clientId);
const firstBlockClientId = isUpdatingSelectedBlocks ? selectedBlockClientIds[0] : clientId;
const firstBlockRootClientId = getBlockRootClientId(firstBlockClientId);
const blocksToUpdate = isUpdatingSelectedBlocks ? selectedBlockClientIds : [clientId];
return {
blocksToUpdate,
firstBlockClientId,
firstBlockRootClientId,
selectedBlockClientIds
};
}
/**
* @param {KeyboardEvent} event
*/
async function onKeyDownHandler(event) {
if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER || event.keyCode === external_wp_keycodes_namespaceObject.SPACE) {
onClick(event);
} else if (event.keyCode === external_wp_keycodes_namespaceObject.BACKSPACE || event.keyCode === external_wp_keycodes_namespaceObject.DELETE || isMatch('core/block-editor/remove', event)) {
var _getPreviousBlockClie;
const {
blocksToUpdate: blocksToDelete,
firstBlockClientId,
firstBlockRootClientId,
selectedBlockClientIds
} = getBlocksToUpdate();
// Don't update the selection if the blocks cannot be deleted.
if (!canRemoveBlocks(blocksToDelete, firstBlockRootClientId)) {
return;
}
let blockToFocus = (_getPreviousBlockClie = getPreviousBlockClientId(firstBlockClientId)) !== null && _getPreviousBlockClie !== void 0 ? _getPreviousBlockClie :
// If the previous block is not found (when the first block is deleted),
// fallback to focus the parent block.
firstBlockRootClientId;
removeBlocks(blocksToDelete, false);
// Update the selection if the original selection has been removed.
const shouldUpdateSelection = selectedBlockClientIds.length > 0 && getSelectedBlockClientIds().length === 0;
// If there's no previous block nor parent block, focus the first block.
if (!blockToFocus) {
blockToFocus = getBlockOrder()[0];
}
updateFocusAndSelection(blockToFocus, shouldUpdateSelection);
} else if (isMatch('core/block-editor/duplicate', event)) {
if (event.defaultPrevented) {
return;
}
event.preventDefault();
const {
blocksToUpdate,
firstBlockRootClientId
} = getBlocksToUpdate();
const canDuplicate = getBlocksByClientId(blocksToUpdate).every(block => {
return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true) && canInsertBlockType(block.name, firstBlockRootClientId);
});
if (canDuplicate) {
const updatedBlocks = await duplicateBlocks(blocksToUpdate, false);
if (updatedBlocks?.length) {
// If blocks have been duplicated, focus the first duplicated block.
updateFocusAndSelection(updatedBlocks[0], false);
}
}
} else if (isMatch('core/block-editor/select-all', event)) {
if (event.defaultPrevented) {
return;
}
event.preventDefault();
const {
firstBlockRootClientId,
selectedBlockClientIds
} = getBlocksToUpdate();
const blockClientIds = getBlockOrder(firstBlockRootClientId);
if (!blockClientIds.length) {
return;
}
// If we have selected all sibling nested blocks, try selecting up a level.
// This is a similar implementation to that used by `useSelectAll`.
// `isShallowEqual` is used for the list view instead of a length check,
// as the array of siblings of the currently focused block may be a different
// set of blocks from the current block selection if the user is focused
// on a different part of the list view from the block selection.
if (external_wp_isShallowEqual_default()(selectedBlockClientIds, blockClientIds)) {
// Only select up a level if the first block is not the root block.
// This ensures that the block selection can't break out of the root block
// used by the list view, if the list view is only showing a partial hierarchy.
if (firstBlockRootClientId && firstBlockRootClientId !== rootClientId) {
updateFocusAndSelection(firstBlockRootClientId, true);
return;
}
}
// Select all while passing `null` to skip focusing to the editor canvas,
// and retain focus within the list view.
multiSelect(blockClientIds[0], blockClientIds[blockClientIds.length - 1], null);
}
}
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
className: classnames_default()('block-editor-list-view-block-select-button', className),
onClick: onClick,
onContextMenu: onContextMenu,
onKeyDown: onKeyDownHandler,
onMouseDown: onMouseDown,
ref: ref,
tabIndex: tabIndex,
onFocus: onFocus,
onDragStart: onDragStartHandler,
onDragEnd: onDragEnd,
draggable: draggable,
href: `#block-${clientId}`,
"aria-label": ariaLabel,
"aria-describedby": ariaDescribedBy,
"aria-expanded": isExpanded
}, (0,external_React_.createElement)(ListViewExpander, {
onClick: onToggleExpanded
}), (0,external_React_.createElement)(block_icon, {
icon: blockInformation?.icon,
showColors: true,
context: "list-view"
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
alignment: "center",
className: "block-editor-list-view-block-select-button__label-wrapper",
justify: "flex-start",
spacing: 1
}, (0,external_React_.createElement)("span", {
className: "block-editor-list-view-block-select-button__title"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
ellipsizeMode: "auto"
}, blockTitle)), blockInformation?.anchor && (0,external_React_.createElement)("span", {
className: "block-editor-list-view-block-select-button__anchor-wrapper"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
className: "block-editor-list-view-block-select-button__anchor",
ellipsizeMode: "auto"
}, blockInformation.anchor)), isConnected && canBindBlock(blockName) && (0,external_React_.createElement)("span", {
className: "block-editor-list-view-block-select-button__bindings"
}, (0,external_React_.createElement)(build_module_icon, {
icon: library_connection
})), positionLabel && isSticky && (0,external_React_.createElement)(external_wp_components_namespaceObject.Tooltip, {
text: positionLabel
}, (0,external_React_.createElement)(build_module_icon, {
icon: pin_small
})), images.length ? (0,external_React_.createElement)("span", {
className: "block-editor-list-view-block-select-button__images",
"aria-hidden": true
}, images.map((image, index) => (0,external_React_.createElement)("span", {
className: "block-editor-list-view-block-select-button__image",
key: image.clientId,
style: {
backgroundImage: `url(${image.url})`,
zIndex: images.length - index // Ensure the first image is on top, and subsequent images are behind.
}
}))) : null, isLocked && (0,external_React_.createElement)("span", {
className: "block-editor-list-view-block-select-button__lock"
}, (0,external_React_.createElement)(build_module_icon, {
icon: lock_small
})))));
}
/* harmony default export */ const 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)(({
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()
};
}, []);
const {
AdditionalBlockContent,
insertedBlock,
setInsertedBlock
} = useListViewContext();
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_React_.createElement)(external_React_.Fragment, null, AdditionalBlockContent && (0,external_React_.createElement)(AdditionalBlockContent, {
block: block,
insertedBlock: insertedBlock,
setInsertedBlock: setInsertedBlock
}), (0,external_React_.createElement)(block_draggable, {
appendToOwnerDocument: true,
clientIds: draggableClientIds,
cloneClassname: 'block-editor-list-view-draggable-chip'
}, ({
draggable,
onDragStart,
onDragEnd
}) => (0,external_React_.createElement)(block_select_button, {
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 */ const block_contents = (ListViewBlockContents);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/utils.js
/**
* 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) => Array.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
};
}
/**
* Shift focus to the list view item associated with a particular clientId.
*
* @typedef {import('@wordpress/element').RefObject} RefObject
*
* @param {string} focusClientId The client ID of the block to focus.
* @param {?HTMLElement} treeGridElement The container element to search within.
*/
function focusListItem(focusClientId, treeGridElement) {
const getFocusElement = () => {
const row = treeGridElement?.querySelector(`[role=row][data-block="${focusClientId}"]`);
if (!row) return null;
// Focus the first focusable in the row, which is the ListViewBlockSelectButton.
return external_wp_dom_namespaceObject.focus.focusable.find(row)[0];
};
let focusElement = getFocusElement();
if (focusElement) {
focusElement.focus();
} else {
// The element hasn't been painted yet. Defer focusing on the next frame.
// This could happen when all blocks have been deleted and the default block
// hasn't been added to the editor yet.
window.requestAnimationFrame(() => {
focusElement = getFocusElement();
// Ignore if the element still doesn't exist.
if (focusElement) {
focusElement.focus();
}
});
}
}
/**
* Get values for the block that flag whether the block should be displaced up or down,
* whether the block is being nested, and whether the block appears after the dragged
* blocks. These values are used to determine the class names to apply to the block.
* The list view rows are displaced visually via CSS rules. Displacement rules:
* - `normal`: no displacement — used to apply a translateY of `0` so that the block
* appears in its original position, and moves to that position smoothly when dragging
* outside of the list view area.
* - `up`: the block should be displaced up, creating room beneath the block for the drop indicator.
* - `down`: the block should be displaced down, creating room above the block for the drop indicator.
*
* @param {Object} props
* @param {Object} props.blockIndexes The indexes of all the blocks in the list view, keyed by clientId.
* @param {number|null|undefined} props.blockDropTargetIndex The index of the block that the user is dropping to.
* @param {?string} props.blockDropPosition The position relative to the block that the user is dropping to.
* @param {string} props.clientId The client id for the current block.
* @param {?number} props.firstDraggedBlockIndex The index of the first dragged block.
* @param {?boolean} props.isDragged Whether the current block is being dragged. Dragged blocks skip displacement.
* @return {Object} An object containing the `displacement`, `isAfterDraggedBlocks` and `isNesting` values.
*/
function getDragDisplacementValues({
blockIndexes,
blockDropTargetIndex,
blockDropPosition,
clientId,
firstDraggedBlockIndex,
isDragged
}) {
let displacement;
let isNesting;
let isAfterDraggedBlocks;
if (!isDragged) {
isNesting = false;
const thisBlockIndex = blockIndexes[clientId];
isAfterDraggedBlocks = thisBlockIndex > firstDraggedBlockIndex;
// Determine where to displace the position of the current block, relative
// to the blocks being dragged (in their original position) and the drop target
// (the position where a user is currently dragging the blocks to).
if (blockDropTargetIndex !== undefined && blockDropTargetIndex !== null && firstDraggedBlockIndex !== undefined) {
// If the block is being dragged and there is a valid drop target,
// determine if the block being rendered should be displaced up or down.
if (thisBlockIndex !== undefined) {
if (thisBlockIndex >= firstDraggedBlockIndex && thisBlockIndex < blockDropTargetIndex) {
// If the current block appears after the set of dragged blocks
// (in their original position), but is before the drop target,
// then the current block should be displaced up.
displacement = 'up';
} else if (thisBlockIndex < firstDraggedBlockIndex && thisBlockIndex >= blockDropTargetIndex) {
// If the current block appears before the set of dragged blocks
// (in their original position), but is after the drop target,
// then the current block should be displaced down.
displacement = 'down';
} else {
displacement = 'normal';
}
isNesting = typeof blockDropTargetIndex === 'number' && blockDropTargetIndex - 1 === thisBlockIndex && blockDropPosition === 'inside';
}
} else if (blockDropTargetIndex === null && firstDraggedBlockIndex !== undefined) {
// A `null` value for `blockDropTargetIndex` indicates that the
// drop target is outside of the valid areas within the list view.
// In this case, the drag is still active, but as there is no
// valid drop target, we should remove the gap indicating where
// the block would be inserted.
if (thisBlockIndex !== undefined && thisBlockIndex >= firstDraggedBlockIndex) {
displacement = 'up';
} else {
displacement = 'normal';
}
} else if (blockDropTargetIndex !== undefined && blockDropTargetIndex !== null && firstDraggedBlockIndex === undefined) {
// If the blockdrop target is defined, but there are no dragged blocks,
// then the block should be displaced relative to the drop target.
if (thisBlockIndex !== undefined) {
if (thisBlockIndex < blockDropTargetIndex) {
displacement = 'normal';
} else {
displacement = 'down';
}
}
} else if (blockDropTargetIndex === null) {
displacement = 'normal';
}
}
return {
displacement,
isNesting,
isAfterDraggedBlocks
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/block.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ListViewBlock({
block: {
clientId
},
displacement,
isAfterDraggedBlocks,
isDragged,
isNesting,
isSelected,
isBranchSelected,
selectBlock,
position,
level,
rowCount,
siblingBlockCount,
showBlockMovers,
path,
isExpanded,
selectedClientIds,
isSyncedBranch
}) {
const cellRef = (0,external_wp_element_namespaceObject.useRef)(null);
const rowRef = (0,external_wp_element_namespaceObject.useRef)(null);
const settingsRef = (0,external_wp_element_namespaceObject.useRef)(null);
const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false);
const [settingsAnchorRect, setSettingsAnchorRect] = (0,external_wp_element_namespaceObject.useState)();
const {
isLocked,
canEdit,
canMove
} = useBlockLock(clientId);
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 blockTitle = blockInformation?.name || blockInformation?.title || (0,external_wp_i18n_namespaceObject.__)('Untitled');
const {
block,
blockName,
blockEditingMode
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlock,
getBlockName,
getBlockEditingMode
} = select(store);
return {
block: getBlock(clientId),
blockName: getBlockName(clientId),
blockEditingMode: getBlockEditingMode(clientId)
};
}, [clientId]);
const allowRightClickOverrides = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().allowRightClickOverrides, []);
const showBlockActions =
// When a block hides its toolbar it also hides the block settings menu,
// since that menu is part of the toolbar in the editor canvas.
// List View respects this by also hiding the block settings menu.
(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, '__experimentalToolbar', true) &&
// Don't show the settings menu if block is disabled or content only.
blockEditingMode === 'default';
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewBlock);
const descriptionId = `list-view-block-select-button__${instanceId}`;
const {
expand,
collapse,
BlockSettingsMenu,
listViewInstanceId,
expandedState,
setInsertedBlock,
treeGridElementRef
} = useListViewContext();
// If multiple blocks are selected, deselect all blocks when the user
// presses the escape key.
const onKeyDown = event => {
if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented && selectedClientIds.length > 0) {
event.stopPropagation();
event.preventDefault();
selectBlock(event, undefined);
}
};
const onMouseEnter = (0,external_wp_element_namespaceObject.useCallback)(() => {
setIsHovered(true);
toggleBlockHighlight(clientId, true);
}, [clientId, setIsHovered, toggleBlockHighlight]);
const onMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(() => {
setIsHovered(false);
toggleBlockHighlight(clientId, false);
}, [clientId, setIsHovered, toggleBlockHighlight]);
const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)(event => {
selectBlock(event, clientId);
event.preventDefault();
}, [clientId, selectBlock]);
const updateFocusAndSelection = (0,external_wp_element_namespaceObject.useCallback)((focusClientId, shouldSelectBlock) => {
if (shouldSelectBlock) {
selectBlock(undefined, focusClientId, null, null);
}
focusListItem(focusClientId, treeGridElementRef?.current);
}, [selectBlock, treeGridElementRef]);
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]);
// Allow right-clicking an item in the List View to open up the block settings dropdown.
const onContextMenu = (0,external_wp_element_namespaceObject.useCallback)(event => {
if (showBlockActions && allowRightClickOverrides) {
settingsRef.current?.click();
// Ensure the position of the settings dropdown is at the cursor.
setSettingsAnchorRect(new window.DOMRect(event.clientX, event.clientY, 0, 0));
event.preventDefault();
}
}, [allowRightClickOverrides, settingsRef, showBlockActions]);
const onMouseDown = (0,external_wp_element_namespaceObject.useCallback)(event => {
// Prevent right-click from focusing the block,
// because focus will be handled when opening the block settings dropdown.
if (allowRightClickOverrides && event.button === 2) {
event.preventDefault();
}
}, [allowRightClickOverrides]);
const settingsPopoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => {
const {
ownerDocument
} = rowRef?.current || {};
// If no custom position is set, the settings dropdown will be anchored to the
// DropdownMenu toggle button.
if (!settingsAnchorRect || !ownerDocument) {
return undefined;
}
// Position the settings dropdown at the cursor when right-clicking a block.
return {
ownerDocument,
getBoundingClientRect() {
return settingsAnchorRect;
}
};
}, [settingsAnchorRect]);
const clearSettingsAnchorRect = (0,external_wp_element_namespaceObject.useCallback)(() => {
// Clear the custom position for the settings dropdown so that it is restored back
// to being anchored to the DropdownMenu toggle button.
setSettingsAnchorRect(undefined);
}, [setSettingsAnchorRect]);
// Pass in a ref to the row, so that it can be scrolled
// into view when selected. For long lists, the placeholder for the
// selected block is also observed, within ListViewLeafPlaceholder.
useListViewScrollIntoView({
isSelected,
rowItemRef: rowRef,
selectedClientIds
});
// When switching between rendering modes (such as template preview and content only),
// it is possible for a block to temporarily be unavailable. In this case, we should not
// render the leaf, to avoid errors further down the tree.
if (!block) {
return null;
}
const blockPositionDescription = getBlockPositionDescription(position, siblingBlockCount, level);
const 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 (locked)'), blockTitle) : blockTitle;
const settingsAriaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The title of the block.
(0,external_wp_i18n_namespaceObject.__)('Options for %s'), blockTitle);
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
});
let colSpan;
if (hasRenderedMovers) {
colSpan = 2;
} else if (!showBlockActions) {
colSpan = 3;
}
const classes = classnames_default()({
'is-selected': isSelected,
'is-first-selected': isFirstSelectedBlock,
'is-last-selected': isLastSelectedBlock,
'is-branch-selected': isBranchSelected,
'is-synced-branch': isSyncedBranch,
'is-dragging': isDragged,
'has-single-cell': !showBlockActions,
'is-synced': blockInformation?.isSynced,
'is-draggable': canMove,
'is-displacement-normal': displacement === 'normal',
'is-displacement-up': displacement === 'up',
'is-displacement-down': displacement === 'down',
'is-after-dragged-blocks': isAfterDraggedBlocks,
'is-nesting': isNesting
});
// 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];
// Detect if there is a block in the canvas currently being edited and multi-selection is not happening.
const currentlyEditingBlockInCanvas = isSelected && selectedClientIds.length === 1;
return (0,external_React_.createElement)(leaf, {
className: classes,
isDragged: isDragged,
onKeyDown: onKeyDown,
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
onFocus: onMouseEnter,
onBlur: onMouseLeave,
level: level,
position: position,
rowCount: rowCount,
path: path,
id: `list-view-${listViewInstanceId}-block-${clientId}`,
"data-block": clientId,
"data-expanded": canEdit ? isExpanded : undefined,
ref: rowRef
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, {
className: "block-editor-list-view-block__contents-cell",
colSpan: colSpan,
ref: cellRef,
"aria-selected": !!isSelected
}, ({
ref,
tabIndex,
onFocus
}) => (0,external_React_.createElement)("div", {
className: "block-editor-list-view-block__contents-container"
}, (0,external_React_.createElement)(block_contents, {
block: block,
onClick: selectEditorBlock,
onContextMenu: onContextMenu,
onMouseDown: onMouseDown,
onToggleExpanded: toggleExpanded,
isSelected: isSelected,
position: position,
siblingBlockCount: siblingBlockCount,
level: level,
ref: ref,
tabIndex: currentlyEditingBlockInCanvas ? 0 : tabIndex,
onFocus: onFocus,
isExpanded: canEdit ? isExpanded : undefined,
selectedClientIds: selectedClientIds,
ariaLabel: blockAriaLabel,
ariaDescribedBy: descriptionId,
updateFocusAndSelection: updateFocusAndSelection
}), (0,external_React_.createElement)(AriaReferencedText, {
id: descriptionId
}, blockPositionDescription))), hasRenderedMovers && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, {
className: moverCellClassName,
withoutGridItem: true
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridItem, null, ({
ref,
tabIndex,
onFocus
}) => (0,external_React_.createElement)(BlockMoverUpButton, {
orientation: "vertical",
clientIds: [clientId],
ref: ref,
tabIndex: tabIndex,
onFocus: onFocus
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridItem, null, ({
ref,
tabIndex,
onFocus
}) => (0,external_React_.createElement)(BlockMoverDownButton, {
orientation: "vertical",
clientIds: [clientId],
ref: ref,
tabIndex: tabIndex,
onFocus: onFocus
})))), showBlockActions && BlockSettingsMenu && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, {
className: listViewBlockSettingsClassName,
"aria-selected": !!isSelected,
ref: settingsRef
}, ({
ref,
tabIndex,
onFocus
}) => (0,external_React_.createElement)(BlockSettingsMenu, {
clientIds: dropdownClientIds,
block: block,
icon: more_vertical,
label: settingsAriaLabel,
popoverProps: {
anchor: settingsPopoverAnchor // Used to position the settings at the cursor on right-click.
},
toggleProps: {
ref,
className: 'block-editor-list-view-block__menu',
tabIndex,
onClick: clearSettingsAnchorRect,
onFocus
},
disableOpenOnArrowDown: true,
expand: expand,
expandedState: expandedState,
setInsertedBlock: setInsertedBlock,
__experimentalSelectBlock: updateFocusAndSelection
})));
}
/* harmony default export */ const list_view_block = ((0,external_wp_element_namespaceObject.memo)(ListViewBlock));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/branch.js
/**
* 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?.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?.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;
};
const branch_noop = () => {};
function ListViewBranch(props) {
const {
blocks,
selectBlock = branch_noop,
showBlockMovers,
selectedClientIds,
level = 1,
path = '',
isBranchSelected = false,
listPosition = 0,
fixedListWindow,
isExpanded,
parentId,
shouldShowInnerBlocks = true,
isSyncedBranch = false,
showAppender: showAppenderProp = true
} = props;
const parentBlockInformation = useBlockDisplayInformation(parentId);
const syncedBranch = isSyncedBranch || !!parentBlockInformation?.isSynced;
const canParentExpand = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!parentId) {
return true;
}
return select(store).canEditBlock(parentId);
}, [parentId]);
const {
blockDropPosition,
blockDropTargetIndex,
firstDraggedBlockIndex,
blockIndexes,
expandedState,
draggedClientIds
} = useListViewContext();
if (!canParentExpand) {
return null;
}
// Only show the appender at the first level.
const showAppender = showAppenderProp && level === 1;
const filteredBlocks = blocks.filter(Boolean);
const blockCount = filteredBlocks.length;
// The appender means an extra row in List View, so add 1 to the row count.
const rowCount = showAppender ? blockCount + 1 : blockCount;
let nextPosition = listPosition;
return (0,external_React_.createElement)(external_React_.Fragment, null, filteredBlocks.map((block, index) => {
var _expandedState$client;
const {
clientId,
innerBlocks
} = block;
if (index > 0) {
nextPosition += countBlocks(filteredBlocks[index - 1], expandedState, draggedClientIds, isExpanded);
}
const isDragged = !!draggedClientIds?.includes(clientId);
// Determine the displacement of the block while dragging. This
// works out whether the current block should be displaced up or
// down, relative to the dragged blocks and the drop target.
const {
displacement,
isAfterDraggedBlocks,
isNesting
} = getDragDisplacementValues({
blockIndexes,
blockDropTargetIndex,
blockDropPosition,
clientId,
firstDraggedBlockIndex,
isDragged
});
const {
itemInView
} = fixedListWindow;
const blockInView = itemInView(nextPosition);
const position = index + 1;
const updatedPath = path.length > 0 ? `${path}_${position}` : `${position}`;
const hasNestedBlocks = !!innerBlocks?.length;
const shouldExpand = hasNestedBlocks && shouldShowInnerBlocks ? (_expandedState$client = expandedState[clientId]) !== null && _expandedState$client !== void 0 ? _expandedState$client : isExpanded : undefined;
// 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;
// To avoid performance issues, we only render blocks that are in view,
// or blocks that are selected or dragged. If a block is selected,
// it is only counted if it is the first of the block selection.
// This prevents the entire tree from being rendered when a branch is
// selected, or a user selects all blocks, while still enabling scroll
// into view behavior when selecting a block or opening the list view.
const showBlock = isDragged || blockInView || isSelected && clientId === selectedClientIds[0];
return (0,external_React_.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, {
key: clientId,
value: !isSelected
}, showBlock && (0,external_React_.createElement)(list_view_block, {
block: block,
selectBlock: selectBlock,
isSelected: isSelected,
isBranchSelected: isSelectedBranch,
isDragged: isDragged,
level: level,
position: position,
rowCount: rowCount,
siblingBlockCount: blockCount,
showBlockMovers: showBlockMovers,
path: updatedPath,
isExpanded: isDragged ? false : shouldExpand,
listPosition: nextPosition,
selectedClientIds: selectedClientIds,
isSyncedBranch: syncedBranch,
displacement: displacement,
isAfterDraggedBlocks: isAfterDraggedBlocks,
isNesting: isNesting
}), !showBlock && (0,external_React_.createElement)("tr", null, (0,external_React_.createElement)("td", {
className: "block-editor-list-view-placeholder"
})), hasNestedBlocks && shouldExpand && !isDragged && (0,external_React_.createElement)(ListViewBranch, {
parentId: clientId,
blocks: innerBlocks,
selectBlock: selectBlock,
showBlockMovers: showBlockMovers,
level: level + 1,
path: updatedPath,
listPosition: nextPosition + 1,
fixedListWindow: fixedListWindow,
isBranchSelected: isSelectedBranch,
selectedClientIds: selectedClientIds,
isExpanded: isExpanded,
isSyncedBranch: syncedBranch
}));
}), showAppender && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridRow, {
level: level,
setSize: rowCount,
positionInSet: rowCount,
isExpanded: true
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGridCell, null, treeGridCellProps => (0,external_React_.createElement)(Appender, {
clientId: parentId,
nestingLevel: level,
blockCount: blockCount,
...treeGridCellProps
}))));
}
/* harmony default export */ const branch = ((0,external_wp_element_namespaceObject.memo)(ListViewBranch));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/drop-indicator.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ListViewDropIndicatorPreview({
draggedBlockClientId,
listViewRef,
blockDropTarget
}) {
const blockInformation = useBlockDisplayInformation(draggedBlockClientId);
const blockTitle = useBlockDisplayTitle({
clientId: draggedBlockClientId,
context: 'list-view'
});
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];
}, [listViewRef, 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 rtl = (0,external_wp_i18n_namespaceObject.isRTL)();
const getDropIndicatorWidth = (0,external_wp_element_namespaceObject.useCallback)((targetElementRect, indent) => {
if (!targetElement) {
return 0;
}
// Default to assuming that the width of the drop indicator
// should be the same as the target element.
let width = targetElement.offsetWidth;
// In deeply nested lists, where a scrollbar is present,
// the width of the drop indicator should be the width of
// the scroll container, minus the distance from the left
// edge of the scroll container to the left edge of the
// target element.
const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(targetElement, 'horizontal');
const ownerDocument = targetElement.ownerDocument;
const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement;
if (scrollContainer && !windowScroll) {
const scrollContainerRect = scrollContainer.getBoundingClientRect();
const distanceBetweenContainerAndTarget = (0,external_wp_i18n_namespaceObject.isRTL)() ? scrollContainerRect.right - targetElementRect.right : targetElementRect.left - scrollContainerRect.left;
const scrollContainerWidth = scrollContainer.clientWidth;
if (scrollContainerWidth < width + distanceBetweenContainerAndTarget) {
width = scrollContainerWidth - distanceBetweenContainerAndTarget;
}
// LTR logic for ensuring the drop indicator does not extend
// beyond the right edge of the scroll container.
if (!rtl && targetElementRect.left + indent < scrollContainerRect.left) {
width -= scrollContainerRect.left - targetElementRect.left;
return width;
}
// RTL logic for ensuring the drop indicator does not extend
// beyond the right edge of the scroll container.
if (rtl && targetElementRect.right - indent > scrollContainerRect.right) {
width -= targetElementRect.right - scrollContainerRect.right;
return width;
}
}
// Subtract the indent from the final width of the indicator.
return width - indent;
}, [rtl, targetElement]);
const style = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!targetElement) {
return {};
}
const targetElementRect = targetElement.getBoundingClientRect();
return {
width: getDropIndicatorWidth(targetElementRect, 0)
};
}, [getDropIndicatorWidth, targetElement]);
const horizontalScrollOffsetStyle = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!targetElement) {
return {};
}
const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(targetElement);
const ownerDocument = targetElement.ownerDocument;
const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement;
if (scrollContainer && !windowScroll) {
const scrollContainerRect = scrollContainer.getBoundingClientRect();
const targetElementRect = targetElement.getBoundingClientRect();
const distanceBetweenContainerAndTarget = rtl ? scrollContainerRect.right - targetElementRect.right : targetElementRect.left - scrollContainerRect.left;
if (!rtl && scrollContainerRect.left > targetElementRect.left) {
return {
transform: `translateX( ${distanceBetweenContainerAndTarget}px )`
};
}
if (rtl && scrollContainerRect.right < targetElementRect.right) {
return {
transform: `translateX( ${distanceBetweenContainerAndTarget * -1}px )`
};
}
}
return {};
}, [rtl, targetElement]);
const ariaLevel = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!rootBlockElement) {
return 1;
}
const _ariaLevel = parseInt(rootBlockElement.getAttribute('aria-level'), 10);
return _ariaLevel ? _ariaLevel + 1 : 1;
}, [rootBlockElement]);
const hasAdjacentSelectedBranch = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!targetElement) {
return false;
}
return targetElement.classList.contains('is-branch-selected');
}, [targetElement]);
const popoverAnchor = (0,external_wp_element_namespaceObject.useMemo)(() => {
const isValidDropPosition = dropPosition === 'top' || dropPosition === 'bottom' || dropPosition === 'inside';
if (!targetElement || !isValidDropPosition) {
return undefined;
}
return {
contextElement: targetElement,
getBoundingClientRect() {
const rect = targetElement.getBoundingClientRect();
// In RTL languages, the drop indicator should be positioned
// to the left of the target element, with the width of the
// indicator determining the indent at the right edge of the
// target element. In LTR languages, the drop indicator should
// end at the right edge of the target element, with the indent
// added to the position of the left edge of the target element.
// let left = rtl ? rect.left : rect.left + indent;
let left = rect.left;
let top = 0;
// In deeply nested lists, where a scrollbar is present,
// the width of the drop indicator should be the width of
// the visible area of the scroll container. Additionally,
// the left edge of the drop indicator line needs to be
// offset by the distance the left edge of the target element
// and the left edge of the scroll container. The ensures
// that the drop indicator position never breaks out of the
// visible area of the scroll container.
const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(targetElement, 'horizontal');
const doc = targetElement.ownerDocument;
const windowScroll = scrollContainer === doc.body || scrollContainer === doc.documentElement;
// If the scroll container is not the window, offset the left position, if need be.
if (scrollContainer && !windowScroll) {
const scrollContainerRect = scrollContainer.getBoundingClientRect();
// In RTL languages, a vertical scrollbar is present on the
// left edge of the scroll container. The width of the
// scrollbar needs to be accounted for when positioning the
// drop indicator.
const scrollbarWidth = rtl ? scrollContainer.offsetWidth - scrollContainer.clientWidth : 0;
if (left < scrollContainerRect.left + scrollbarWidth) {
left = scrollContainerRect.left + scrollbarWidth;
}
}
if (dropPosition === 'top') {
top = rect.top - rect.height * 2;
} else {
// `dropPosition` is either `bottom` or `inside`
top = rect.top;
}
const width = getDropIndicatorWidth(rect, 0);
const height = rect.height;
return new window.DOMRect(left, top, width, height);
}
};
}, [targetElement, dropPosition, getDropIndicatorWidth, rtl]);
if (!targetElement) {
return null;
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, {
animate: false,
anchor: popoverAnchor,
focusOnMount: false,
className: "block-editor-list-view-drop-indicator--preview",
variant: "unstyled",
flip: false,
resize: true
}, (0,external_React_.createElement)("div", {
style: style,
className: classnames_default()('block-editor-list-view-drop-indicator__line', {
'block-editor-list-view-drop-indicator__line--darker': hasAdjacentSelectedBranch
})
}, (0,external_React_.createElement)("div", {
className: "block-editor-list-view-leaf",
"aria-level": ariaLevel
}, (0,external_React_.createElement)("div", {
className: classnames_default()('block-editor-list-view-block-select-button', 'block-editor-list-view-block-contents'),
style: horizontalScrollOffsetStyle
}, (0,external_React_.createElement)(ListViewExpander, {
onClick: () => {}
}), (0,external_React_.createElement)(block_icon, {
icon: blockInformation?.icon,
showColors: true,
context: "list-view"
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
alignment: "center",
className: "block-editor-list-view-block-select-button__label-wrapper",
justify: "flex-start",
spacing: 1
}, (0,external_React_.createElement)("span", {
className: "block-editor-list-view-block-select-button__title"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
ellipsizeMode: "auto"
}, blockTitle)))), (0,external_React_.createElement)("div", {
className: "block-editor-list-view-block__menu-cell"
}))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-block-selection.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useBlockSelection() {
const {
clearSelectedBlock,
multiSelect,
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const {
getBlockName,
getBlockParents,
getBlockSelectionStart,
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, focusPosition) => {
if (!event?.shiftKey && event?.keyCode !== external_wp_keycodes_namespaceObject.ESCAPE) {
selectBlock(clientId, focusPosition);
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 isOnlyDeselection = event.type === 'keydown' && event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE;
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 (isOnlyDeselection || 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();
}
// Update selection, if not only clearing the selection.
if (!isOnlyDeselection) {
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 = selectedBlocks.filter(blockId => !updatedSelectedBlocks.includes(blockId));
let label;
if (selectionDiff.length === 1) {
const title = getBlockType(getBlockName(selectionDiff[0]))?.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, 'assertive');
}
}, [clearSelectedBlock, getBlockName, getBlockType, getBlockParents, getBlockSelectionStart, getSelectedBlockClientIds, hasMultiSelection, hasSelectedBlock, multiSelect, selectBlock]);
return {
updateBlockSelection
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-list-view-block-indexes.js
/**
* WordPress dependencies
*/
function useListViewBlockIndexes(blocks) {
const blockIndexes = (0,external_wp_element_namespaceObject.useMemo)(() => {
const indexes = {};
let currentGlobalIndex = 0;
const traverseBlocks = blockList => {
blockList.forEach(block => {
indexes[block.clientId] = currentGlobalIndex;
currentGlobalIndex++;
if (block.innerBlocks.length > 0) {
traverseBlocks(block.innerBlocks);
}
});
};
traverseBlocks(blocks);
return indexes;
}, [blocks]);
return blockIndexes;
}
;// 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,
rootClientId
}) {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getDraggedBlockClientIds,
getSelectedBlockClientIds,
getEnabledClientIdsTree
} = unlock(select(store));
return {
selectedClientIds: getSelectedBlockClientIds(),
draggedClientIds: getDraggedBlockClientIds(),
clientIdsTree: blocks !== null && blocks !== void 0 ? blocks : getEnabledClientIdsTree(rootClientId)
};
}, [blocks, rootClientId]);
}
;// 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 object representing data for blocks in the DOM used by drag and drop.
*
* @typedef {Object} WPListViewDropZoneBlock
* @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} isExpanded Whether the block is expanded in the UI.
* @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 array representing data for blocks in the DOM used by drag and drop.
*
* @typedef {WPListViewDropZoneBlock[]} WPListViewDropZoneBlocks
*/
/**
* 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.
*/
// When the indentation level, the corresponding left margin in `style.scss`
// must be updated as well to ensure the drop zone is aligned with the indentation.
const NESTING_LEVEL_INDENTATION = 28;
/**
* Determines whether the user is positioning the dragged block to be
* moved up to a parent level.
*
* Determined based on nesting level indentation of the current block.
*
* @param {WPPoint} point The point representing the cursor position when dragging.
* @param {DOMRect} rect The rectangle.
* @param {number} nestingLevel The nesting level of the block.
* @param {boolean} rtl Whether the editor is in RTL mode.
* @return {boolean} Whether the gesture is an upward gesture.
*/
function isUpGesture(point, rect, nestingLevel = 1, rtl = false) {
// If the block is nested, and the user is dragging to the bottom
// left of the block (or bottom right in RTL languages), then it is an upward gesture.
const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
return rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition;
}
/**
* Returns how many nesting levels up the user is attempting to drag to.
*
* The relative parent level is calculated based on how far
* the cursor is from the provided nesting level (e.g. of a candidate block
* that the user is hovering over). The nesting level is considered "desired"
* because it is not guaranteed that the user will be able to drag to the desired level.
*
* The returned integer can be used to access an ascending array
* of parent blocks, where the first item is the block the user
* is hovering over, and the last item is the root block.
*
* @param {WPPoint} point The point representing the cursor position when dragging.
* @param {DOMRect} rect The rectangle.
* @param {number} nestingLevel The nesting level of the block.
* @param {boolean} rtl Whether the editor is in RTL mode.
* @return {number} The desired relative parent level.
*/
function getDesiredRelativeParentLevel(point, rect, nestingLevel = 1, rtl = false) {
// In RTL languages, the block indent position is from the right edge of the block.
// In LTR languages, the block indent position is from the left edge of the block.
const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
const distanceBetweenPointAndBlockIndentPosition = rtl ? blockIndentPosition - point.x : point.x - blockIndentPosition;
const desiredParentLevel = Math.round(distanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION);
return Math.abs(desiredParentLevel);
}
/**
* Returns an array of the parent blocks of the block the user is dropping to.
*
* @param {WPListViewDropZoneBlock} candidateBlockData The block the user is dropping to.
* @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.
* @return {WPListViewDropZoneBlocks} An array of block parents, including the block the user is dropping to.
*/
function getCandidateBlockParents(candidateBlockData, blocksData) {
const candidateBlockParents = [];
let currentBlockData = candidateBlockData;
while (currentBlockData) {
candidateBlockParents.push({
...currentBlockData
});
currentBlockData = blocksData.find(blockData => blockData.clientId === currentBlockData.rootClientId);
}
return candidateBlockParents;
}
/**
* Given a list of blocks data and a block index, return the next non-dragged
* block. This is used to determine the block that the user is dropping to,
* while ignoring the dragged block.
*
* @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.
* @param {number} index The index to begin searching from.
* @return {WPListViewDropZoneBlock | undefined} The next non-dragged block.
*/
function getNextNonDraggedBlock(blocksData, index) {
const nextBlockData = blocksData[index + 1];
if (nextBlockData && nextBlockData.isDraggedBlock) {
return getNextNonDraggedBlock(blocksData, index + 1);
}
return nextBlockData;
}
/**
* Determines whether the user positioning the dragged block to nest as an
* inner block.
*
* Determined based on nesting level indentation of the current block, plus
* the indentation of the next level of nesting. The vertical position of the
* cursor must also be within the block.
*
* @param {WPPoint} point The point representing the cursor position when dragging.
* @param {DOMRect} rect The rectangle.
* @param {number} nestingLevel The nesting level of the block.
* @param {boolean} rtl Whether the editor is in RTL mode.
*/
function isNestingGesture(point, rect, nestingLevel = 1, rtl = false) {
const blockIndentPosition = rtl ? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION : rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;
const isNestingHorizontalGesture = rtl ? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION : point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION;
return isNestingHorizontalGesture && point.y < rect.bottom;
}
// 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.
* @param {boolean} rtl Whether the editor is in RTL mode.
*
* @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target.
*/
function getListViewDropTarget(blocksData, position, rtl = false) {
let candidateEdge;
let candidateBlockData;
let candidateDistance;
let candidateRect;
let candidateBlockIndex;
for (let i = 0; i < blocksData.length; i++) {
const blockData = blocksData[i];
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();
candidateBlockIndex = index - 1;
} else {
candidateBlockData = blockData;
candidateEdge = edge;
candidateRect = rect;
candidateBlockIndex = index;
}
// 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 candidateBlockParents = getCandidateBlockParents(candidateBlockData, blocksData);
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, and is expanded, this should be treated
// as nesting since the next block in the tree will be the first child.
// However, if the block is collapsed, dragging beneath the block should
// still be allowed, as the next visible block in the tree will be a sibling.
if (isDraggingBelow && candidateBlockData.canInsertDraggedBlocksAsChild && (candidateBlockData.innerBlockCount > 0 && candidateBlockData.isExpanded || isNestingGesture(position, candidateRect, candidateBlockParents.length, rtl))) {
// If the block is expanded, insert the block as the first child.
// Otherwise, for collapsed blocks, insert the block as the last child.
const newBlockIndex = candidateBlockData.isExpanded ? 0 : candidateBlockData.innerBlockCount || 0;
return {
rootClientId: candidateBlockData.clientId,
clientId: candidateBlockData.clientId,
blockIndex: newBlockIndex,
dropPosition: 'inside'
};
}
// If the user is dragging towards the bottom of the block check whether
// they might be trying to move the block to be at a parent level.
if (isDraggingBelow && candidateBlockData.rootClientId && isUpGesture(position, candidateRect, candidateBlockParents.length, rtl)) {
const nextBlock = getNextNonDraggedBlock(blocksData, candidateBlockIndex);
const currentLevel = candidateBlockData.nestingLevel;
const nextLevel = nextBlock ? nextBlock.nestingLevel : 1;
if (currentLevel && nextLevel) {
// Determine the desired relative level of the block to be dropped.
const desiredRelativeLevel = getDesiredRelativeParentLevel(position, candidateRect, candidateBlockParents.length, rtl);
const targetParentIndex = Math.max(Math.min(desiredRelativeLevel, currentLevel - nextLevel), 0);
if (candidateBlockParents[targetParentIndex]) {
// Default to the block index of the candidate block.
let newBlockIndex = candidateBlockData.blockIndex;
// If the next block is at the same level, use that as the default
// block index. This ensures that the block is dropped in the correct
// position when dragging to the bottom of a block.
if (candidateBlockParents[targetParentIndex].nestingLevel === nextBlock?.nestingLevel) {
newBlockIndex = nextBlock?.blockIndex;
} else {
// Otherwise, search from the current block index back
// to find the last block index within the same target parent.
for (let i = candidateBlockIndex; i >= 0; i--) {
const blockData = blocksData[i];
if (blockData.rootClientId === candidateBlockParents[targetParentIndex].rootClientId) {
newBlockIndex = blockData.blockIndex + 1;
break;
}
}
}
return {
rootClientId: candidateBlockParents[targetParentIndex].rootClientId,
clientId: candidateBlockData.clientId,
blockIndex: newBlockIndex,
dropPosition: candidateEdge
};
}
}
}
// 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
};
}
// Throttle options need to be defined outside of the hook to avoid
// re-creating the object on every render. This is due to a limitation
// of the `useThrottle` hook, where the options object is included
// in the dependency array for memoization.
const EXPAND_THROTTLE_OPTIONS = {
leading: false,
// Don't call the function immediately on the first call.
trailing: true // Do call the function on the last call.
};
/**
* A react hook for implementing a drop zone in list view.
*
* @param {Object} props Named parameters.
* @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.
* @param {Object} [props.expandedState] The expanded state of the blocks in the list view.
* @param {Function} [props.setExpandedState] Function to set the expanded state of a list of block clientIds.
*
* @return {WPListViewDropZoneTarget} The drop target.
*/
function useListViewDropZone({
dropZoneElement,
expandedState,
setExpandedState
}) {
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 rtl = (0,external_wp_i18n_namespaceObject.isRTL)();
const previousRootClientId = (0,external_wp_compose_namespaceObject.usePrevious)(targetRootClientId);
const maybeExpandBlock = (0,external_wp_element_namespaceObject.useCallback)((_expandedState, _target) => {
// If the user is attempting to drop a block inside a collapsed block,
// that is, using a nesting gesture flagged by 'inside' dropPosition,
// expand the block within the list view, if it isn't already.
const {
rootClientId
} = _target || {};
if (!rootClientId) {
return;
}
if (_target?.dropPosition === 'inside' && !_expandedState[rootClientId]) {
setExpandedState({
type: 'expand',
clientIds: [rootClientId]
});
}
}, [setExpandedState]);
// Throttle the maybeExpandBlock function to avoid expanding the block
// too quickly when the user is dragging over the block. This is to
// avoid expanding the block when the user is just passing over it.
const throttledMaybeExpandBlock = (0,external_wp_compose_namespaceObject.useThrottle)(maybeExpandBlock, 500, EXPAND_THROTTLE_OPTIONS);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (target?.dropPosition !== 'inside' || previousRootClientId !== target?.rootClientId) {
throttledMaybeExpandBlock.cancel();
return;
}
throttledMaybeExpandBlock(expandedState, target);
}, [expandedState, previousRootClientId, target, throttledMaybeExpandBlock]);
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?.length;
const blockElements = Array.from(currentTarget.querySelectorAll('[data-block]'));
const blocksData = blockElements.map(blockElement => {
const clientId = blockElement.dataset.block;
const isExpanded = blockElement.dataset.expanded === 'true';
const isDraggedBlock = blockElement.classList.contains('is-dragging');
// Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`.
const nestingLevel = parseInt(blockElement.getAttribute('aria-level'), 10);
const rootClientId = getBlockRootClientId(clientId);
return {
clientId,
isExpanded,
rootClientId,
blockIndex: getBlockIndex(clientId),
element: blockElement,
nestingLevel: nestingLevel || undefined,
isDraggedBlock: isBlockDrag ? isDraggedBlock : false,
innerBlockCount: getBlockCount(clientId),
canInsertDraggedBlocksAsSibling: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, rootClientId) : true,
canInsertDraggedBlocksAsChild: isBlockDrag ? canInsertBlocks(draggedBlockClientIds, clientId) : true
};
});
const newTarget = getListViewDropTarget(blocksData, position, rtl);
if (newTarget) {
setTarget(newTarget);
}
}, [canInsertBlocks, draggedBlockClientIds, getBlockCount, getBlockIndex, getBlockRootClientId, rtl]), 50);
const ref = (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({
dropZoneElement,
onDrop(event) {
throttled.cancel();
if (target) {
onBlockDrop(event);
}
// Use `undefined` value to indicate that the drag has concluded.
// This allows styling rules that are active only when a user is
// dragging to be removed.
setTarget(undefined);
},
onDragLeave() {
throttled.cancel();
// Use `null` value to indicate that the drop target is not valid,
// but that the drag is still active. This allows for styling rules
// that are active only when a user drags outside of the list view.
setTarget(null);
},
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();
// Use `undefined` value to indicate that the drag has concluded.
// This allows styling rules that are active only when a user is
// dragging to be removed.
setTarget(undefined);
}
});
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({
firstSelectedBlockClientId,
setExpandedState
}) {
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]);
// 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 (selectedBlockParentClientIds?.length) {
// If the selected block has parents,
// expand the tree branch.
setExpandedState({
type: 'expand',
clientIds: selectedBlockParentClientIds
});
}
}, [firstSelectedBlockClientId, selectedBlockParentClientIds, selectedTreeId, setExpandedState]);
return {
setSelectedTreeId
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/use-clipboard-handler.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// This hook borrows from useClipboardHandler in ../writing-flow/use-clipboard-handler.js
// and adds behaviour for the list view, while skipping partial selection.
function use_clipboard_handler_useClipboardHandler({
selectBlock
}) {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
getBlockOrder,
getBlockRootClientId,
getBlocksByClientId,
getPreviousBlockClientId,
getSelectedBlockClientIds,
getSettings,
canInsertBlockType,
canRemoveBlocks
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
flashBlock,
removeBlocks,
replaceBlocks,
insertBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const notifyCopy = useNotifyCopy();
return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
function updateFocusAndSelection(focusClientId, shouldSelectBlock) {
if (shouldSelectBlock) {
selectBlock(undefined, focusClientId, null, null);
}
focusListItem(focusClientId, node);
}
// Determine which blocks to update:
// If the current (focused) block is part of the block selection, use the whole selection.
// If the focused block is not part of the block selection, only update the focused block.
function getBlocksToUpdate(clientId) {
const selectedBlockClientIds = getSelectedBlockClientIds();
const isUpdatingSelectedBlocks = selectedBlockClientIds.includes(clientId);
const firstBlockClientId = isUpdatingSelectedBlocks ? selectedBlockClientIds[0] : clientId;
const firstBlockRootClientId = getBlockRootClientId(firstBlockClientId);
const blocksToUpdate = isUpdatingSelectedBlocks ? selectedBlockClientIds : [clientId];
return {
blocksToUpdate,
firstBlockClientId,
firstBlockRootClientId,
originallySelectedBlockClientIds: selectedBlockClientIds
};
}
function handler(event) {
if (event.defaultPrevented) {
// This was possibly already handled in rich-text/use-paste-handler.js.
return;
}
// Only handle events that occur within the list view.
if (!node.contains(event.target.ownerDocument.activeElement)) {
return;
}
// Retrieve the block clientId associated with the focused list view row.
// This enables applying copy / cut / paste behavior to the focused block,
// rather than just the blocks that are currently selected.
const listViewRow = event.target.ownerDocument.activeElement?.closest('[role=row]');
const clientId = listViewRow?.dataset?.block;
if (!clientId) {
return;
}
const {
blocksToUpdate: selectedBlockClientIds,
firstBlockClientId,
firstBlockRootClientId,
originallySelectedBlockClientIds
} = getBlocksToUpdate(clientId);
if (selectedBlockClientIds.length === 0) {
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);
setClipboardBlocks(event, blocks, registry);
}
if (event.type === 'cut') {
var _getPreviousBlockClie;
// Don't update the selection if the blocks cannot be deleted.
if (!canRemoveBlocks(selectedBlockClientIds, firstBlockRootClientId)) {
return;
}
let blockToFocus = (_getPreviousBlockClie = getPreviousBlockClientId(firstBlockClientId)) !== null && _getPreviousBlockClie !== void 0 ? _getPreviousBlockClie :
// If the previous block is not found (when the first block is deleted),
// fallback to focus the parent block.
firstBlockRootClientId;
// Remove blocks, but don't update selection, and it will be handled below.
removeBlocks(selectedBlockClientIds, false);
// Update the selection if the original selection has been removed.
const shouldUpdateSelection = originallySelectedBlockClientIds.length > 0 && getSelectedBlockClientIds().length === 0;
// If there's no previous block nor parent block, focus the first block.
if (!blockToFocus) {
blockToFocus = getBlockOrder()[0];
}
updateFocusAndSelection(blockToFocus, shouldUpdateSelection);
} else if (event.type === 'paste') {
const {
__experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML
} = getSettings();
const blocks = getPasteBlocks(event, canUserUseUnfilteredHTML);
if (selectedBlockClientIds.length === 1) {
const [selectedBlockClientId] = selectedBlockClientIds;
// If a single block is focused, and the blocks to be posted can
// be inserted within the block, then append the pasted blocks
// within the focused block. For example, if you have copied a paragraph
// block and paste it within a single Group block, this will append
// the paragraph block within the Group block.
if (blocks.every(block => canInsertBlockType(block.name, selectedBlockClientId))) {
insertBlocks(blocks, undefined, selectedBlockClientId);
updateFocusAndSelection(blocks[0]?.clientId, false);
return;
}
}
replaceBlocks(selectedBlockClientIds, blocks, blocks.length - 1, -1);
updateFocusAndSelection(blocks[0]?.clientId, false);
}
}
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);
};
}, []);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/list-view/index.js
/**
* External dependencies
*/
/**
* 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;
/** @typedef {import('react').ComponentType} ComponentType */
/** @typedef {import('react').Ref<HTMLElement>} Ref */
/**
* Show a hierarchical list of blocks.
*
* @param {Object} props Components props.
* @param {string} props.id An HTML element id for the root element of ListView.
* @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy.
* @param {?HTMLElement} props.dropZoneElement Optional element to be used as the drop zone.
* @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`.
* @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`.
* @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.
* @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component.
* @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.
* @param {string} props.description Optional accessible description for the tree grid component.
* @param {?Function} props.onSelect Optional callback to be invoked when a block is selected. Receives the block object that was selected.
* @param {?ComponentType} props.additionalBlockContent Component that renders additional block content UI.
* @param {Ref} ref Forwarded ref
*/
function ListViewComponent({
id,
blocks,
dropZoneElement,
showBlockMovers = false,
isExpanded = false,
showAppender = false,
blockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown,
rootClientId,
description,
onSelect,
additionalBlockContent: AdditionalBlockContent
}, ref) {
// This can be removed once we no longer need to support the blocks prop.
if (blocks) {
external_wp_deprecated_default()('`blocks` property in `wp.blockEditor.__experimentalListView`', {
since: '6.3',
alternative: '`rootClientId` property'
});
}
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewComponent);
const {
clientIdsTree,
draggedClientIds,
selectedClientIds
} = useListViewClientIds({
blocks,
rootClientId
});
const blockIndexes = useListViewBlockIndexes(clientIdsTree);
const {
getBlock
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
visibleBlockCount,
shouldShowInnerBlocks
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getGlobalBlockCount,
getClientIdsOfDescendants,
__unstableGetEditorMode
} = select(store);
const draggedBlockCount = draggedClientIds?.length > 0 ? getClientIdsOfDescendants(draggedClientIds).length + 1 : 0;
return {
visibleBlockCount: getGlobalBlockCount() - draggedBlockCount,
shouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out'
};
}, [draggedClientIds]);
const {
updateBlockSelection
} = useBlockSelection();
const [expandedState, setExpandedState] = (0,external_wp_element_namespaceObject.useReducer)(expanded, {});
const [insertedBlock, setInsertedBlock] = (0,external_wp_element_namespaceObject.useState)(null);
const {
setSelectedTreeId
} = useListViewExpandSelectedItem({
firstSelectedBlockClientId: selectedClientIds[0],
setExpandedState
});
const selectEditorBlock = (0,external_wp_element_namespaceObject.useCallback)(
/**
* @param {MouseEvent | KeyboardEvent | undefined} event
* @param {string} blockClientId
* @param {null | undefined | -1 | 1} focusPosition
*/
(event, blockClientId, focusPosition) => {
updateBlockSelection(event, blockClientId, null, focusPosition);
setSelectedTreeId(blockClientId);
if (onSelect) {
onSelect(getBlock(blockClientId));
}
}, [setSelectedTreeId, updateBlockSelection, onSelect, getBlock]);
const {
ref: dropZoneRef,
target: blockDropTarget
} = useListViewDropZone({
dropZoneElement,
expandedState,
setExpandedState
});
const elementRef = (0,external_wp_element_namespaceObject.useRef)();
// Allow handling of copy, cut, and paste events.
const clipBoardRef = use_clipboard_handler_useClipboardHandler({
selectBlock: selectEditorBlock
});
const treeGridRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([clipBoardRef, elementRef, dropZoneRef, ref]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// If a blocks are already selected when the list view is initially
// mounted, shift focus to the first selected block.
if (selectedClientIds?.length) {
focusListItem(selectedClientIds[0], elementRef?.current);
}
// Disable reason: Only focus on the selected item when the list view is mounted.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
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 => {
expand(row?.dataset?.block);
}, [expand]);
const collapseRow = (0,external_wp_element_namespaceObject.useCallback)(row => {
collapse(row?.dataset?.block);
}, [collapse]);
const focusRow = (0,external_wp_element_namespaceObject.useCallback)((event, startRow, endRow) => {
if (event.shiftKey) {
updateBlockSelection(event, startRow?.dataset?.block, endRow?.dataset?.block);
}
}, [updateBlockSelection]);
const firstDraggedBlockClientId = draggedClientIds?.[0];
// Convert a blockDropTarget into indexes relative to the blocks in the list view.
// These values are used to determine which blocks should be displaced to make room
// for the drop indicator. See `ListViewBranch` and `getDragDisplacementValues`.
const {
blockDropTargetIndex,
blockDropPosition,
firstDraggedBlockIndex
} = (0,external_wp_element_namespaceObject.useMemo)(() => {
let _blockDropTargetIndex, _firstDraggedBlockIndex;
if (blockDropTarget?.clientId) {
const foundBlockIndex = blockIndexes[blockDropTarget.clientId];
// If dragging below or inside the block, treat the drop target as the next block.
_blockDropTargetIndex = foundBlockIndex === undefined || blockDropTarget?.dropPosition === 'top' ? foundBlockIndex : foundBlockIndex + 1;
} else if (blockDropTarget === null) {
// A `null` value is used to indicate that the user is dragging outside of the list view.
_blockDropTargetIndex = null;
}
if (firstDraggedBlockClientId) {
const foundBlockIndex = blockIndexes[firstDraggedBlockClientId];
_firstDraggedBlockIndex = foundBlockIndex === undefined || blockDropTarget?.dropPosition === 'top' ? foundBlockIndex : foundBlockIndex + 1;
}
return {
blockDropTargetIndex: _blockDropTargetIndex,
blockDropPosition: blockDropTarget?.dropPosition,
firstDraggedBlockIndex: _firstDraggedBlockIndex
};
}, [blockDropTarget, blockIndexes, firstDraggedBlockClientId]);
const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
blockDropPosition,
blockDropTargetIndex,
blockIndexes,
draggedClientIds,
expandedState,
expand,
firstDraggedBlockIndex,
collapse,
BlockSettingsMenu,
listViewInstanceId: instanceId,
AdditionalBlockContent,
insertedBlock,
setInsertedBlock,
treeGridElementRef: elementRef,
rootClientId
}), [blockDropPosition, blockDropTargetIndex, blockIndexes, draggedClientIds, expandedState, expand, firstDraggedBlockIndex, collapse, BlockSettingsMenu, instanceId, AdditionalBlockContent, insertedBlock, setInsertedBlock, rootClientId]);
// 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, {
// Ensure that the windowing logic is recalculated when the expanded state changes.
// This is necessary because expanding a collapsed block in a short list view can
// switch the list view to a tall list view with a scrollbar, and vice versa.
// When this happens, the windowing logic needs to be recalculated to ensure that
// the correct number of blocks are rendered, by rechecking for a scroll container.
expandedState,
useWindowing: true,
windowOverscan: 40
});
// If there are no blocks to show and we're not showing the appender, do not render the list view.
if (!clientIdsTree.length && !showAppender) {
return null;
}
const describedById = description && `block-editor-list-view-description-${instanceId}`;
return (0,external_React_.createElement)(external_wp_data_namespaceObject.AsyncModeProvider, {
value: true
}, (0,external_React_.createElement)(ListViewDropIndicatorPreview, {
draggedBlockClientId: firstDraggedBlockClientId,
listViewRef: elementRef,
blockDropTarget: blockDropTarget
}), description && (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
id: describedById
}, description), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTreeGrid, {
id: id,
className: classnames_default()('block-editor-list-view-tree', {
'is-dragging': draggedClientIds?.length > 0 && blockDropTargetIndex !== undefined
}),
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Block navigation structure'),
ref: treeGridRef,
onCollapseRow: collapseRow,
onExpandRow: expandRow,
onFocusRow: focusRow,
applicationAriaLabel: (0,external_wp_i18n_namespaceObject.__)('Block navigation structure'),
"aria-describedby": describedById,
style: {
'--wp-admin--list-view-dragged-items-height': draggedClientIds?.length ? `${BLOCK_LIST_ITEM_HEIGHT * (draggedClientIds.length - 1)}px` : null
}
}, (0,external_React_.createElement)(ListViewContext.Provider, {
value: contextValue
}, (0,external_React_.createElement)(branch, {
blocks: clientIdsTree,
parentId: rootClientId,
selectBlock: selectEditorBlock,
showBlockMovers: showBlockMovers,
fixedListWindow: fixedListWindow,
selectedClientIds: selectedClientIds,
isExpanded: isExpanded,
shouldShowInnerBlocks: shouldShowInnerBlocks,
showAppender: showAppender
}))));
}
// This is the private API for the ListView component.
// It allows access to all props, not just the public ones.
const PrivateListView = (0,external_wp_element_namespaceObject.forwardRef)(ListViewComponent);
// This is the public API for the ListView component.
// We wrap the PrivateListView component to hide some props from the public API.
/* harmony default export */ const components_list_view = ((0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
return (0,external_React_.createElement)(PrivateListView, {
ref: ref,
...props,
showAppender: false,
rootClientId: null,
onSelect: null,
additionalBlockContent: null,
blockSettingsMenu: undefined
});
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-navigation/dropdown.js
/**
* WordPress dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockNavigationDropdownToggle({
isEnabled,
onToggle,
isOpen,
innerRef,
...props
}) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
...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({
isDisabled,
...props
}, ref) {
external_wp_deprecated_default()('wp.blockEditor.BlockNavigationDropdown', {
since: '6.1',
alternative: 'wp.components.Dropdown and wp.blockEditor.ListView'
});
const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(store).getBlockCount(), []);
const isEnabled = hasBlocks && !isDisabled;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
contentClassName: "block-editor-block-navigation__popover",
popoverProps: {
placement: 'bottom-start'
},
renderToggle: ({
isOpen,
onToggle
}) => (0,external_React_.createElement)(BlockNavigationDropdownToggle, {
...props,
innerRef: ref,
isOpen: isOpen,
onToggle: onToggle,
isEnabled: isEnabled
}),
renderContent: () => (0,external_React_.createElement)("div", {
className: "block-editor-block-navigation__container"
}, (0,external_React_.createElement)("p", {
className: "block-editor-block-navigation__label"
}, (0,external_wp_i18n_namespaceObject.__)('List view')), (0,external_React_.createElement)(components_list_view, null))
});
}
/* harmony default export */ const 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({
genericPreviewBlock,
style,
className,
activeStyle
}) {
const example = (0,external_wp_blocks_namespaceObject.getBlockType)(genericPreviewBlock.name)?.example;
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'
},
example
};
}, [genericPreviewBlock, styleClassName]);
return (0,external_React_.createElement)(preview_panel, {
item: previewBlocks
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-styles/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const block_styles_noop = () => {};
// Block Styles component for the Settings Sidebar.
function BlockStyles({
clientId,
onSwitch = block_styles_noop,
onHoverClassName = block_styles_noop
}) {
const {
onSelect,
stylesToRender,
activeStyle,
genericPreviewBlock,
className: previewClassName
} = useStylesForBlocks({
clientId,
onSwitch
});
const [hoveredStyle, setHoveredStyle] = (0,external_wp_element_namespaceObject.useState)(null);
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
if (!stylesToRender || stylesToRender.length === 0) {
return null;
}
const debouncedSetHoveredStyle = (0,external_wp_compose_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?.name) !== null && _item$name !== void 0 ? _item$name : null);
};
return (0,external_React_.createElement)("div", {
className: "block-editor-block-styles"
}, (0,external_React_.createElement)("div", {
className: "block-editor-block-styles__variants"
}, stylesToRender.map(style => {
const buttonText = style.label || style.name;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
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),
onClick: () => onSelectStylePreview(style),
"aria-current": activeStyle.name === style.name
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
numberOfLines: 1,
className: "block-editor-block-styles__item-text"
}, buttonText));
})), hoveredStyle && !isMobileViewport && (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, {
placement: "left-start",
offset: 34,
focusOnMount: false
}, (0,external_React_.createElement)("div", {
className: "block-editor-block-styles__preview-panel",
onMouseLeave: () => styleItemHandler(null)
}, (0,external_React_.createElement)(BlockStylesPreviewPanel, {
activeStyle: activeStyle,
className: previewClassName,
genericPreviewBlock: genericPreviewBlock,
style: hoveredStyle
}))));
}
/* harmony default export */ const block_styles = (BlockStyles);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/paragraph.js
/**
* WordPress dependencies
*/
const paragraph = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z"
}));
/* harmony default export */ const library_paragraph = (paragraph);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading-level-1.js
/**
* WordPress dependencies
*/
const headingLevel1 = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.6 7c-.6.9-1.5 1.7-2.6 2v1h2v7h2V7h-1.4zM11 11H7V7H5v10h2v-4h4v4h2V7h-2v4z"
}));
/* harmony default export */ const heading_level_1 = (headingLevel1);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading-level-2.js
/**
* WordPress dependencies
*/
const headingLevel2 = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M9 11.1H5v-4H3v10h2v-4h4v4h2v-10H9v4zm8 4c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6v1.5h8v-2H17z"
}));
/* harmony default export */ const heading_level_2 = (headingLevel2);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading-level-3.js
/**
* WordPress dependencies
*/
const headingLevel3 = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.3 1.7c-.4-.4-1-.7-1.6-.8v-.1c.6-.2 1.1-.5 1.5-.9.3-.4.5-.8.5-1.3 0-.4-.1-.8-.3-1.1-.2-.3-.5-.6-.8-.8-.4-.2-.8-.4-1.2-.5-.6-.1-1.1-.2-1.6-.2-.6 0-1.3.1-1.8.3s-1.1.5-1.6.9l1.2 1.4c.4-.2.7-.4 1.1-.6.3-.2.7-.3 1.1-.3.4 0 .8.1 1.1.3.3.2.4.5.4.8 0 .4-.2.7-.6.9-.7.3-1.5.5-2.2.4v1.6c.5 0 1 0 1.5.1.3.1.7.2 1 .3.2.1.4.2.5.4s.1.4.1.6c0 .3-.2.7-.5.8-.4.2-.9.3-1.4.3s-1-.1-1.4-.3c-.4-.2-.8-.4-1.2-.7L13 15.6c.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.6 0 1.1-.1 1.6-.2.4-.1.9-.2 1.3-.5.4-.2.7-.5.9-.9.2-.4.3-.8.3-1.2 0-.6-.3-1.1-.7-1.5z"
}));
/* harmony default export */ const heading_level_3 = (headingLevel3);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading-level-4.js
/**
* WordPress dependencies
*/
const headingLevel4 = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M20 13V7h-3l-4 6v2h5v2h2v-2h1v-2h-1zm-2 0h-2.8L18 9v4zm-9-2H5V7H3v10h2v-4h4v4h2V7H9v4z"
}));
/* harmony default export */ const heading_level_4 = (headingLevel4);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading-level-5.js
/**
* WordPress dependencies
*/
const headingLevel5 = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.7 1.2c-.2-.3-.5-.7-.8-.9-.3-.3-.7-.5-1.1-.6-.5-.1-.9-.2-1.4-.2-.2 0-.5.1-.7.1-.2.1-.5.1-.7.2l.1-1.9h4.3V7H14l-.3 5 1 .6.5-.2.4-.1c.1-.1.3-.1.4-.1h.5c.5 0 1 .1 1.4.4.4.2.6.7.6 1.1 0 .4-.2.8-.6 1.1-.4.3-.9.4-1.4.4-.4 0-.9-.1-1.3-.3-.4-.2-.7-.4-1.1-.7 0 0-1.1 1.4-1 1.5.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.5 0 1-.1 1.5-.3s.9-.4 1.3-.7c.4-.3.7-.7.9-1.1s.3-.9.3-1.4-.1-1-.3-1.4z"
}));
/* harmony default export */ const heading_level_5 = (headingLevel5);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading-level-6.js
/**
* WordPress dependencies
*/
const headingLevel6 = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M20.7 12.4c-.2-.3-.4-.6-.7-.9s-.6-.5-1-.6c-.4-.2-.8-.2-1.2-.2-.5 0-.9.1-1.3.3s-.8.5-1.2.8c0-.5 0-.9.2-1.4l.6-.9c.2-.2.5-.4.8-.5.6-.2 1.3-.2 1.9 0 .3.1.6.3.8.5 0 0 1.3-1.3 1.3-1.4-.4-.3-.9-.6-1.4-.8-.6-.2-1.3-.3-2-.3-.6 0-1.1.1-1.7.4-.5.2-1 .5-1.4.9-.4.4-.8 1-1 1.6-.3.7-.4 1.5-.4 2.3s.1 1.5.3 2.1c.2.6.6 1.1 1 1.5.4.4.9.7 1.4.9 1 .3 2 .3 3 0 .4-.1.8-.3 1.2-.6.3-.3.6-.6.8-1 .2-.5.3-.9.3-1.4s-.1-.9-.3-1.3zm-2 2.1c-.1.2-.3.4-.4.5-.1.1-.3.2-.5.2-.2.1-.4.1-.6.1-.2.1-.5 0-.7-.1-.2 0-.3-.2-.5-.3-.1-.2-.3-.4-.4-.6-.2-.3-.3-.7-.3-1 .3-.3.6-.5 1-.7.3-.1.7-.2 1-.2.4 0 .8.1 1.1.3.3.3.4.7.4 1.1 0 .2 0 .5-.1.7zM9 11H5V7H3v10h2v-4h4v4h2V7H9v4z"
}));
/* harmony default export */ const heading_level_6 = (headingLevel6);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-heading-level-dropdown/heading-level-icon.js
/**
* WordPress dependencies
*/
/** @typedef {import('react').ComponentType} ComponentType */
/**
* HeadingLevelIcon props.
*
* @typedef WPHeadingLevelIconProps
*
* @property {number} level The heading level to show an icon for.
*/
const LEVEL_TO_PATH = {
0: library_paragraph,
1: heading_level_1,
2: heading_level_2,
3: heading_level_3,
4: heading_level_4,
5: heading_level_5,
6: heading_level_6
};
/**
* Heading level icon.
*
* @param {WPHeadingLevelIconProps} props Component props.
*
* @return {?ComponentType} The icon.
*/
function HeadingLevelIcon({
level
}) {
if (LEVEL_TO_PATH[level]) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Icon, {
icon: LEVEL_TO_PATH[level]
});
}
return null;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-heading-level-dropdown/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const HEADING_LEVELS = [1, 2, 3, 4, 5, 6];
const block_heading_level_dropdown_POPOVER_PROPS = {
className: 'block-library-heading-level-dropdown'
};
/** @typedef {import('react').ComponentType} ComponentType */
/**
* HeadingLevelDropdown props.
*
* @typedef WPHeadingLevelDropdownProps
*
* @property {number} value The chosen heading level.
* @property {number[]} options An array of supported heading levels.
* @property {(newValue:number)=>any} onChange Callback to run when
* toolbar value is changed.
*/
/**
* Dropdown for selecting a heading level (1 through 6) or paragraph (0).
*
* @param {WPHeadingLevelDropdownProps} props Component props.
*
* @return {ComponentType} The toolbar.
*/
function HeadingLevelDropdown({
options = HEADING_LEVELS,
value,
onChange
}) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarDropdownMenu, {
popoverProps: block_heading_level_dropdown_POPOVER_PROPS,
icon: (0,external_React_.createElement)(HeadingLevelIcon, {
level: value
}),
label: (0,external_wp_i18n_namespaceObject.__)('Change level'),
controls: options.map(targetLevel => {
{
const isActive = targetLevel === value;
return {
icon: (0,external_React_.createElement)(HeadingLevelIcon, {
level: targetLevel,
isPressed: isActive
}),
title: targetLevel === 0 ? (0,external_wp_i18n_namespaceObject.__)('Paragraph') : (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: heading level e.g: "1", "2", "3"
(0,external_wp_i18n_namespaceObject.__)('Heading %d'), targetLevel),
isActive,
onClick() {
onChange(targetLevel);
},
role: 'menuitemradio'
};
}
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
/**
* WordPress dependencies
*/
const layout_layout = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const library_layout = (layout_layout);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-variation-picker/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function BlockVariationPicker({
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
}) {
const classes = classnames_default()('block-editor-block-variation-picker', {
'has-many-variations': variations.length > 4
});
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Placeholder, {
icon: icon,
label: label,
instructions: instructions,
className: classes
}, (0,external_React_.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_React_.createElement)("li", {
key: variation.name
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "secondary",
icon: variation.icon && variation.icon.src ? variation.icon.src : variation.icon,
iconSize: 48,
onClick: () => onSelect(variation),
className: "block-editor-block-variation-picker__variation",
label: variation.description || variation.title
}), (0,external_React_.createElement)("span", {
className: "block-editor-block-variation-picker__variation-label"
}, variation.title)))), allowSkip && (0,external_React_.createElement)("div", {
className: "block-editor-block-variation-picker__skip"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "link",
onClick: () => onSelect()
}, (0,external_wp_i18n_namespaceObject.__)('Skip'))));
}
/* harmony default export */ const block_variation_picker = (BlockVariationPicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/grid.js
/**
* WordPress dependencies
*/
const grid_grid = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z",
fillRule: "evenodd",
clipRule: "evenodd"
}));
/* harmony default export */ const library_grid = (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 = ({
onBlockPatternSelect
}) => (0,external_React_.createElement)("div", {
className: "block-editor-block-pattern-setup__actions"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: onBlockPatternSelect
}, (0,external_wp_i18n_namespaceObject.__)('Choose')));
const CarouselNavigation = ({
handlePrevious,
handleNext,
activeSlide,
totalSlides
}) => (0,external_React_.createElement)("div", {
className: "block-editor-block-pattern-setup__navigation"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: chevron_left,
label: (0,external_wp_i18n_namespaceObject.__)('Previous pattern'),
onClick: handlePrevious,
disabled: activeSlide === 0,
__experimentalIsFocusable: true
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: chevron_right,
label: (0,external_wp_i18n_namespaceObject.__)('Next pattern'),
onClick: handleNext,
disabled: activeSlide === totalSlides - 1,
__experimentalIsFocusable: true
}));
const SetupToolbar = ({
viewMode,
setViewMode,
handlePrevious,
handleNext,
activeSlide,
totalSlides,
onBlockPatternSelect
}) => {
const isCarouselView = viewMode === VIEWMODES.carousel;
const displayControls = (0,external_React_.createElement)("div", {
className: "block-editor-block-pattern-setup__display-controls"
}, (0,external_React_.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_React_.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_React_.createElement)("div", {
className: "block-editor-block-pattern-setup__toolbar"
}, isCarouselView && (0,external_React_.createElement)(CarouselNavigation, {
handlePrevious: handlePrevious,
handleNext: handleNext,
activeSlide: activeSlide,
totalSlides: totalSlides
}), displayControls, isCarouselView && (0,external_React_.createElement)(Actions, {
onBlockPatternSelect: onBlockPatternSelect
}));
};
/* harmony default export */ const 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,
getPatternsByBlockTypes,
__experimentalGetAllowedPatterns
} = select(store);
const rootClientId = getBlockRootClientId(clientId);
if (filterPatternsFn) {
return __experimentalGetAllowedPatterns(rootClientId).filter(filterPatternsFn);
}
return getPatternsByBlockTypes(blockName, rootClientId);
}, [clientId, blockName, filterPatternsFn]);
}
/* harmony default export */ const use_patterns_setup = (usePatternsSetup);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-pattern-setup/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
CompositeV2: block_pattern_setup_Composite,
CompositeItemV2: block_pattern_setup_CompositeItem,
useCompositeStoreV2: block_pattern_setup_useCompositeStore
} = unlock(external_wp_components_namespaceObject.privateApis);
const SetupContent = ({
viewMode,
activeSlide,
patterns,
onBlockPatternSelect,
showTitles
}) => {
const compositeStore = block_pattern_setup_useCompositeStore();
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_React_.createElement)("div", {
className: "block-editor-block-pattern-setup__carousel"
}, (0,external_React_.createElement)("div", {
className: containerClass
}, (0,external_React_.createElement)("div", {
className: "carousel-container"
}, patterns.map((pattern, index) => (0,external_React_.createElement)(BlockPatternSlide, {
active: index === activeSlide,
className: slideClass.get(index) || '',
key: pattern.name,
pattern: pattern
})))));
}
return (0,external_React_.createElement)("div", {
className: "block-editor-block-pattern-setup__grid"
}, (0,external_React_.createElement)(block_pattern_setup_Composite, {
store: compositeStore,
role: "listbox",
className: containerClass,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Patterns list')
}, patterns.map(pattern => (0,external_React_.createElement)(block_pattern_setup_BlockPattern, {
key: pattern.name,
pattern: pattern,
onSelect: onBlockPatternSelect,
showTitles: showTitles
}))));
};
function block_pattern_setup_BlockPattern({
pattern,
onSelect,
showTitles
}) {
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_React_.createElement)("div", {
className: `${baseClassName}__list-item`
}, (0,external_React_.createElement)(block_pattern_setup_CompositeItem, {
render: (0,external_React_.createElement)("div", {
"aria-describedby": description ? descriptionId : undefined,
"aria-label": pattern.title,
className: `${baseClassName}__item`
}),
id: `${baseClassName}__pattern__${pattern.name}`,
role: "option",
onClick: () => onSelect(blocks)
}, (0,external_React_.createElement)(block_preview, {
blocks: blocks,
viewportWidth: viewportWidth
}), showTitles && (0,external_React_.createElement)("div", {
className: `${baseClassName}__item-title`
}, pattern.title), !!description && (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
id: descriptionId
}, description)));
}
function BlockPatternSlide({
active,
className,
pattern,
minHeight
}) {
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_React_.createElement)("div", {
"aria-hidden": !active,
role: "img",
className: `pattern-slide ${className}`,
"aria-label": title,
"aria-describedby": description ? descriptionId : undefined
}, (0,external_React_.createElement)(block_preview, {
blocks: blocks,
minHeight: minHeight
}), !!description && (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
id: descriptionId
}, description));
}
const BlockPatternSetup = ({
clientId,
blockName,
filterPatternsFn,
onBlockPatternSelect,
initialViewMode = VIEWMODES.carousel,
showTitles = false
}) => {
const [viewMode, setViewMode] = (0,external_wp_element_namespaceObject.useState)(initialViewMode);
const [activeSlide, setActiveSlide] = (0,external_wp_element_namespaceObject.useState)(0);
const {
replaceBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const patterns = use_patterns_setup(clientId, blockName, filterPatternsFn);
if (!patterns?.length) {
return null;
}
const onBlockPatternSelectDefault = blocks => {
const clonedBlocks = blocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block));
replaceBlock(clientId, clonedBlocks);
};
const onPatternSelectCallback = onBlockPatternSelect || onBlockPatternSelectDefault;
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("div", {
className: `block-editor-block-pattern-setup view-mode-${viewMode}`
}, (0,external_React_.createElement)(SetupContent, {
viewMode: viewMode,
activeSlide: activeSlide,
patterns: patterns,
onBlockPatternSelect: onPatternSelectCallback,
showTitles: showTitles
}), (0,external_React_.createElement)(setup_toolbar, {
viewMode: viewMode,
setViewMode: setViewMode,
activeSlide: activeSlide,
totalSlides: patterns.length,
handleNext: () => {
setActiveSlide(active => Math.min(active + 1, patterns.length - 1));
},
handlePrevious: () => {
setActiveSlide(active => Math.max(active - 1, 0));
},
onBlockPatternSelect: () => {
onPatternSelectCallback(patterns[activeSlide].blocks);
}
})));
};
/* harmony default export */ const 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({
className,
onSelectVariation,
selectedValue,
variations
}) {
return (0,external_React_.createElement)("fieldset", {
className: className
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
as: "legend"
}, (0,external_wp_i18n_namespaceObject.__)('Transform to variation')), variations.map(variation => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
key: variation.name,
icon: (0,external_React_.createElement)(block_icon, {
icon: variation.icon,
showColors: true
}),
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({
className,
onSelectVariation,
selectedValue,
variations
}) {
const selectOptions = variations.map(({
name,
title,
description
}) => ({
value: name,
label: title,
info: description
}));
return (0,external_React_.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_React_.createElement)("div", {
className: `${className}__container`
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
choices: selectOptions,
value: selectedValue,
onSelect: onSelectVariation
}))));
}
function VariationsToggleGroupControl({
className,
onSelectVariation,
selectedValue,
variations
}) {
return (0,external_React_.createElement)("div", {
className: className
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Transform to variation'),
value: selectedValue,
hideLabelFromVision: true,
onChange: onSelectVariation,
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true
}, variations.map(variation => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOptionIcon, {
key: variation.name,
icon: variation.icon,
value: 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)
}))));
}
function __experimentalBlockVariationTransforms({
blockClientId
}) {
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?.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?.src || variation.icon);
}
});
return variationIcons.size === variations.length;
}, [variations]);
const onSelectVariation = variationName => {
updateBlockAttributes(blockClientId, {
...variations.find(({
name
}) => name === variationName).attributes
});
};
// Skip rendering if there are no variations
if (!variations?.length) return null;
const baseClass = 'block-editor-block-variation-transforms';
// Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap
const showButtons = variations.length > 5;
const ButtonComponent = showButtons ? VariationsButtons : VariationsToggleGroupControl;
const Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown;
return (0,external_React_.createElement)(Component, {
className: baseClass,
onSelectVariation: onSelectVariation,
selectedValue: selectedValue,
variations: variations
});
}
/* harmony default export */ const block_variation_transforms = (__experimentalBlockVariationTransforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/color-palette/with-color-context.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* harmony default export */ const with_color_context = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => {
return props => {
const [colorsFeature, enableCustomColors] = use_settings_useSettings('color.palette', 'color.custom');
const {
colors = colorsFeature,
disableCustomColors = !enableCustomColors
} = props;
const hasColorsToChoose = colors && colors.length > 0 || !disableCustomColors;
return (0,external_React_.createElement)(WrappedComponent, {
...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 */ const 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({
onChange,
value,
...otherProps
}) {
return (0,external_React_.createElement)(control, {
...otherProps,
onColorChange: onChange,
colorValue: value,
gradients: [],
disableCustomGradients: true
});
}
;// CONCATENATED MODULE: external ["wp","date"]
const external_wp_date_namespaceObject = window["wp"]["date"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/date-format-picker/index.js
/**
* 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({
format,
defaultFormat,
onChange
}) {
return (0,external_React_.createElement)("fieldset", {
className: "block-editor-date-format-picker"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
as: "legend"
}, (0,external_wp_i18n_namespaceObject.__)('Date format')), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Default format'),
help: `${(0,external_wp_i18n_namespaceObject.__)('Example:')} ${(0,external_wp_date_namespaceObject.dateI18n)(defaultFormat, EXAMPLE_DATE)}`,
checked: !format,
onChange: checked => onChange(checked ? null : defaultFormat)
}), format && (0,external_React_.createElement)(NonDefaultControls, {
format: format,
onChange: onChange
}));
}
function NonDefaultControls({
format,
onChange
}) {
var _suggestedOptions$fin;
// 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 = [...new Set([/* translators: See https://www.php.net/manual/datetime.format.php */
'Y-m-d', /* translators: See https://www.php.net/manual/datetime.format.php */
(0,external_wp_i18n_namespaceObject._x)('n/j/Y', 'short date format'), /* translators: See https://www.php.net/manual/datetime.format.php */
(0,external_wp_i18n_namespaceObject._x)('n/j/Y g:i A', 'short date format with time'), /* translators: See https://www.php.net/manual/datetime.format.php */
(0,external_wp_i18n_namespaceObject._x)('M j, Y', 'medium date format'), /* translators: See https://www.php.net/manual/datetime.format.php */
(0,external_wp_i18n_namespaceObject._x)('M j, Y g:i A', 'medium date format with time'), /* translators: See https://www.php.net/manual/datetime.format.php */
(0,external_wp_i18n_namespaceObject._x)('F j, Y', 'long date format'), /* translators: See https://www.php.net/manual/datetime.format.php */
(0,external_wp_i18n_namespaceObject._x)('M j', 'short date format without the year')])];
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_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.CustomSelectControl, {
__nextUnconstrainedWidth: true,
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: ({
selectedItem
}) => {
if (selectedItem === customOption) {
setIsCustom(true);
} else {
setIsCustom(false);
onChange(selectedItem.format);
}
}
}), isCustom && (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
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 <Link>format string</Link>.'), {
Link: (0,external_React_.createElement)(external_wp_components_namespaceObject.ExternalLink, {
href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/customize-date-and-time-format/')
})
}),
value: format,
onChange: value => onChange(value)
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/dropdown.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// When the `ColorGradientSettingsDropdown` controls are being rendered to a
// `ToolsPanel` they must be wrapped in a `ToolsPanelItem`.
const WithToolsPanelItem = ({
setting,
children,
panelId,
...props
}) => {
const clearValue = () => {
if (setting.colorValue) {
setting.onColorChange();
} else if (setting.gradientValue) {
setting.onGradientChange();
}
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => {
return !!setting.colorValue || !!setting.gradientValue;
},
label: setting.label,
onDeselect: clearValue,
isShownByDefault: setting.isShownByDefault !== undefined ? setting.isShownByDefault : true,
...props,
className: "block-editor-tools-panel-color-gradient-settings__item",
panelId: panelId
// Pass resetAllFilter if supplied due to rendering via SlotFill
// into parent ToolsPanel.
,
resetAllFilter: setting.resetAllFilter
}, children);
};
const dropdown_LabeledColorIndicator = ({
colorValue,
label
}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "flex-start"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
className: "block-editor-panel-color-gradient-settings__color-indicator",
colorValue: colorValue
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, {
className: "block-editor-panel-color-gradient-settings__color-name",
title: label
}, label));
// Renders a color dropdown's toggle as an `Item` if it is within an `ItemGroup`
// or as a `Button` if it isn't e.g. the controls are being rendered in
// a `ToolsPanel`.
const renderToggle = settings => ({
onToggle,
isOpen
}) => {
const {
colorValue,
label
} = settings;
const toggleProps = {
onClick: onToggle,
className: classnames_default()('block-editor-panel-color-gradient-settings__dropdown', {
'is-open': isOpen
}),
'aria-expanded': isOpen
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
...toggleProps
}, (0,external_React_.createElement)(dropdown_LabeledColorIndicator, {
colorValue: colorValue,
label: label
}));
};
// Renders a collection of color controls as dropdowns. Depending upon the
// context in which these dropdowns are being rendered, they may be wrapped
// in an `ItemGroup` with each dropdown's toggle as an `Item`, or alternatively,
// the may be individually wrapped in a `ToolsPanelItem` with the toggle as
// a regular `Button`.
//
// For more context see: https://github.com/WordPress/gutenberg/pull/40084
function ColorGradientSettingsDropdown({
colors,
disableCustomColors,
disableCustomGradients,
enableAlpha,
gradients,
settings,
__experimentalIsRenderedInSidebar,
...props
}) {
let popoverProps;
if (__experimentalIsRenderedInSidebar) {
popoverProps = {
placement: 'left-start',
offset: 36,
shift: true
};
}
return (0,external_React_.createElement)(external_React_.Fragment, null, settings.map((setting, index) => {
var _setting$gradientValu;
const controlProps = {
clearable: false,
colorValue: setting.colorValue,
colors,
disableCustomColors,
disableCustomGradients,
enableAlpha,
gradientValue: setting.gradientValue,
gradients,
label: setting.label,
onColorChange: setting.onColorChange,
onGradientChange: setting.onGradientChange,
showTitle: false,
__experimentalIsRenderedInSidebar,
...setting
};
const toggleSettings = {
colorValue: (_setting$gradientValu = setting.gradientValue) !== null && _setting$gradientValu !== void 0 ? _setting$gradientValu : setting.colorValue,
label: setting.label
};
return setting &&
// If not in an `ItemGroup` wrap the dropdown in a
// `ToolsPanelItem`
(0,external_React_.createElement)(WithToolsPanelItem, {
key: index,
setting: setting,
...props
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: popoverProps,
className: "block-editor-tools-panel-color-gradient-settings__dropdown",
renderToggle: renderToggle(toggleSettings),
renderContent: () => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, {
paddingSize: "none"
}, (0,external_React_.createElement)("div", {
className: "block-editor-panel-color-gradient-settings__dropdown-content"
}, (0,external_React_.createElement)(control, {
...controlProps
})))
}));
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const panel_color_gradient_settings_colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients'];
const PanelColorGradientSettingsInner = ({
className,
colors,
gradients,
disableCustomColors,
disableCustomGradients,
children,
settings,
title,
showTitle = true,
__experimentalIsRenderedInSidebar,
enableAlpha
}) => {
const panelId = (0,external_wp_compose_namespaceObject.useInstanceId)(PanelColorGradientSettingsInner);
const {
batch
} = (0,external_wp_data_namespaceObject.useRegistry)();
if ((!colors || colors.length === 0) && (!gradients || gradients.length === 0) && disableCustomColors && disableCustomGradients && settings?.every(setting => (!setting.colors || setting.colors.length === 0) && (!setting.gradients || setting.gradients.length === 0) && (setting.disableCustomColors === undefined || setting.disableCustomColors) && (setting.disableCustomGradients === undefined || setting.disableCustomGradients))) {
return null;
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
className: classnames_default()('block-editor-panel-color-gradient-settings', className),
label: showTitle ? title : undefined,
resetAll: () => {
batch(() => {
settings.forEach(({
colorValue,
gradientValue,
onColorChange,
onGradientChange
}) => {
if (colorValue) {
onColorChange();
} else if (gradientValue) {
onGradientChange();
}
});
});
},
panelId: panelId,
__experimentalFirstVisibleItemClass: "first",
__experimentalLastVisibleItemClass: "last"
}, (0,external_React_.createElement)(ColorGradientSettingsDropdown, {
settings: settings,
panelId: panelId,
colors,
gradients,
disableCustomColors,
disableCustomGradients,
__experimentalIsRenderedInSidebar,
enableAlpha
}), !!children && (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
marginY: 4
}), " ", children));
};
const PanelColorGradientSettingsSelect = props => {
const colorGradientSettings = useMultipleOriginColorsAndGradients();
return (0,external_React_.createElement)(PanelColorGradientSettingsInner, {
...colorGradientSettings,
...props
});
};
const PanelColorGradientSettings = props => {
if (panel_color_gradient_settings_colorsAndGradientKeys.every(key => props.hasOwnProperty(key))) {
return (0,external_React_.createElement)(PanelColorGradientSettingsInner, {
...props
});
}
return (0,external_React_.createElement)(PanelColorGradientSettingsSelect, {
...props
});
};
/* harmony default export */ const panel_color_gradient_settings = (PanelColorGradientSettings);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/use-save-image.js
/**
* WordPress dependencies
*/
// Disable Reason: Needs to be refactored.
// eslint-disable-next-line no-restricted-imports
function useSaveImage({
crop,
rotation,
url,
id,
onSaveImage,
onFinishEditing
}) {
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();
}, [onFinishEditing]);
const apply = (0,external_wp_element_namespaceObject.useCallback)(() => {
setIsInProgress(true);
const modifiers = [];
if (rotation > 0) {
modifiers.push({
type: 'rotate',
args: {
angle: rotation
}
});
}
// 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) {
modifiers.push({
type: 'crop',
args: {
left: crop.x,
top: crop.y,
width: crop.width,
height: crop.height
}
});
}
external_wp_apiFetch_default()({
path: `/wp/v2/media/${id}/edit`,
method: 'POST',
data: {
src: url,
modifiers
}
}).then(response => {
onSaveImage({
id: response.id,
url: response.source_url
});
}).catch(error => {
createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1. Error message */
(0,external_wp_i18n_namespaceObject.__)('Could not edit image. %s'), (0,external_wp_dom_namespaceObject.__unstableStripHTML)(error.message)), {
id: 'image-editing-error',
type: 'snackbar'
});
}).finally(() => {
setIsInProgress(false);
onFinishEditing();
});
}, [crop, rotation, id, url, onSaveImage, createErrorNotice, 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 useTransformImage({
url,
naturalWidth,
naturalHeight
}) {
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)(100);
const [rotation, setRotation] = (0,external_wp_element_namespaceObject.useState)(0);
const defaultAspect = naturalWidth / naturalHeight;
const [aspect, setAspect] = (0,external_wp_element_namespaceObject.useState)(defaultAspect);
const rotateClockwise = (0,external_wp_element_namespaceObject.useCallback)(() => {
const angle = (rotation + 90) % 360;
let naturalAspectRatio = defaultAspect;
if (rotation % 180 === 90) {
naturalAspectRatio = 1 / defaultAspect;
}
if (angle === 0) {
setEditedUrl();
setRotation(angle);
setAspect(defaultAspect);
setPosition(prevPosition => ({
x: -(prevPosition.y * naturalAspectRatio),
y: prevPosition.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(canvas.width / canvas.height);
setPosition(prevPosition => ({
x: -(prevPosition.y * naturalAspectRatio),
y: prevPosition.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, defaultAspect, url]);
return (0,external_wp_element_namespaceObject.useMemo)(() => ({
editedUrl,
setEditedUrl,
crop,
setCrop,
position,
setPosition,
zoom,
setZoom,
rotation,
setRotation,
rotateClockwise,
aspect,
setAspect,
defaultAspect
}), [editedUrl, crop, position, zoom, rotation, rotateClockwise, aspect, defaultAspect]);
}
;// 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({
id,
url,
naturalWidth,
naturalHeight,
onFinishEditing,
onSaveImage,
children
}) {
const transformImage = useTransformImage({
url,
naturalWidth,
naturalHeight
});
const saveImage = useSaveImage({
id,
url,
onSaveImage,
onFinishEditing,
...transformImage
});
const providerValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
...transformImage,
...saveImage
}), [transformImage, saveImage]);
return (0,external_React_.createElement)(ImageEditingContext.Provider, {
value: providerValue
}, children);
}
;// 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__(7520);
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 = rotateSize(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
};
}
/**
* Compute media zoom.
* We fit the media into the container with "max-width: 100%; max-height: 100%;"
*/
function getMediaZoom(mediaSize) {
// Take the axis with more pixels to improve accuracy
return mediaSize.width > mediaSize.height ? mediaSize.width / mediaSize.naturalWidth : mediaSize.height / mediaSize.naturalHeight;
}
/**
* 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 = rotateSize(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 clamp(position, -maxPosition, 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 ? limitArea : noOp;
var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation);
var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation);
// calculate the crop area in percentages
// in the rotated space
var croppedAreaPercentages = {
x: limitAreaFn(100, ((mediaBBoxSize.width - cropSize.width / zoom) / 2 - crop.x / zoom) / mediaBBoxSize.width * 100),
y: limitAreaFn(100, ((mediaBBoxSize.height - cropSize.height / zoom) / 2 - crop.y / zoom) / mediaBBoxSize.height * 100),
width: limitAreaFn(100, cropSize.width / mediaBBoxSize.width * 100 / zoom),
height: limitAreaFn(100, cropSize.height / mediaBBoxSize.height * 100 / zoom)
};
// we compute the pixels size naively
var widthInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.width, croppedAreaPercentages.width * mediaNaturalBBoxSize.width / 100));
var heightInPixels = Math.round(limitAreaFn(mediaNaturalBBoxSize.height, croppedAreaPercentages.height * mediaNaturalBBoxSize.height / 100));
var isImgWiderThanHigh = mediaNaturalBBoxSize.width >= mediaNaturalBBoxSize.height * 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 image 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(mediaNaturalBBoxSize.width - sizePixels.width, croppedAreaPercentages.x * mediaNaturalBBoxSize.width / 100)),
y: Math.round(limitAreaFn(mediaNaturalBBoxSize.height - sizePixels.height, croppedAreaPercentages.y * mediaNaturalBBoxSize.height / 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 crop and zoom from the croppedAreaPercentages.
*/
function getInitialCropFromCroppedAreaPercentages(croppedAreaPercentages, mediaSize, rotation, cropSize, minZoom, maxZoom) {
var mediaBBoxSize = rotateSize(mediaSize.width, mediaSize.height, rotation);
// This is the inverse process of computeCroppedArea
var zoom = clamp(cropSize.width / mediaBBoxSize.width * (100 / croppedAreaPercentages.width), minZoom, maxZoom);
var crop = {
x: zoom * mediaBBoxSize.width / 2 - cropSize.width / 2 - mediaBBoxSize.width * zoom * (croppedAreaPercentages.x / 100),
y: zoom * mediaBBoxSize.height / 2 - cropSize.height / 2 - mediaBBoxSize.height * zoom * (croppedAreaPercentages.y / 100)
};
return {
crop: crop,
zoom: zoom
};
}
/**
* Compute zoom from the croppedAreaPixels
*/
function getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize) {
var mediaZoom = getMediaZoom(mediaSize);
return cropSize.height > cropSize.width ? cropSize.height / (croppedAreaPixels.height * mediaZoom) : cropSize.width / (croppedAreaPixels.width * mediaZoom);
}
/**
* Compute crop and zoom from the croppedAreaPixels
*/
function getInitialCropFromCroppedAreaPixels(croppedAreaPixels, mediaSize, rotation, cropSize, minZoom, maxZoom) {
if (rotation === void 0) {
rotation = 0;
}
var mediaNaturalBBoxSize = rotateSize(mediaSize.naturalWidth, mediaSize.naturalHeight, rotation);
var zoom = clamp(getZoomFromCroppedAreaPixels(croppedAreaPixels, mediaSize, cropSize), minZoom, maxZoom);
var cropZoom = cropSize.height > cropSize.width ? cropSize.height / croppedAreaPixels.height : cropSize.width / croppedAreaPixels.width;
var crop = {
x: ((mediaNaturalBBoxSize.width - croppedAreaPixels.width) / 2 - croppedAreaPixels.x) * cropZoom,
y: ((mediaNaturalBBoxSize.height - 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
};
}
function getRadianAngle(degreeValue) {
return degreeValue * Math.PI / 180;
}
/**
* Returns the new bounding area of a rotated rectangle.
*/
function rotateSize(width, height, rotation) {
var rotRad = getRadianAngle(rotation);
return {
width: Math.abs(Math.cos(rotRad) * width) + Math.abs(Math.sin(rotRad) * height),
height: Math.abs(Math.sin(rotRad) * width) + Math.abs(Math.cos(rotRad) * height)
};
}
/**
* Clamp value between min and max
*/
function clamp(value, min, max) {
return Math.min(Math.max(value, min), max);
}
/**
* 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 = external_React_default().createRef();
_this.videoRef = external_React_default().createRef();
_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.gestureZoomStart = 0;
_this.gestureRotationStart = 0;
_this.isTouching = false;
_this.lastPinchDistance = 0;
_this.lastPinchRotation = 0;
_this.rafDragTimeout = null;
_this.rafPinchTimeout = null;
_this.wheelTimer = null;
_this.currentDoc = typeof document !== 'undefined' ? document : null;
_this.currentWindow = typeof window !== 'undefined' ? window : null;
_this.resizeObserver = null;
_this.state = {
cropSize: null,
hasWheelJustStarted: false
};
_this.initResizeObserver = function () {
if (typeof window.ResizeObserver === 'undefined' || !_this.containerRef) {
return;
}
var isFirstResize = true;
_this.resizeObserver = new window.ResizeObserver(function (entries) {
if (isFirstResize) {
isFirstResize = false; // observe() is called on mount, we don't want to trigger a recompute on mount
return;
}
_this.computeSizes();
});
_this.resizeObserver.observe(_this.containerRef);
};
// this is to prevent Safari on iOS >= 10 to zoom the page
_this.preventZoomSafari = function (e) {
return e.preventDefault();
};
_this.cleanEvents = function () {
if (!_this.currentDoc) return;
_this.currentDoc.removeEventListener('mousemove', _this.onMouseMove);
_this.currentDoc.removeEventListener('mouseup', _this.onDragStopped);
_this.currentDoc.removeEventListener('touchmove', _this.onTouchMove);
_this.currentDoc.removeEventListener('touchend', _this.onDragStopped);
_this.currentDoc.removeEventListener('gesturemove', _this.onGestureMove);
_this.currentDoc.removeEventListener('gestureend', _this.onGestureEnd);
};
_this.clearScrollEvent = function () {
if (_this.containerRef) _this.containerRef.removeEventListener('wheel', _this.onWheel);
if (_this.wheelTimer) {
clearTimeout(_this.wheelTimer);
}
};
_this.onMediaLoad = function () {
var cropSize = _this.computeSizes();
if (cropSize) {
_this.emitCropData();
_this.setInitialCrop(cropSize);
}
if (_this.props.onMediaLoaded) {
_this.props.onMediaLoaded(_this.mediaSize);
}
};
_this.setInitialCrop = function (cropSize) {
if (_this.props.initialCroppedAreaPercentages) {
var _a = getInitialCropFromCroppedAreaPercentages(_this.props.initialCroppedAreaPercentages, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom),
crop = _a.crop,
zoom = _a.zoom;
_this.props.onCropChange(crop);
_this.props.onZoomChange && _this.props.onZoomChange(zoom);
} else if (_this.props.initialCroppedAreaPixels) {
var _b = getInitialCropFromCroppedAreaPixels(_this.props.initialCroppedAreaPixels, _this.mediaSize, _this.props.rotation, cropSize, _this.props.minZoom, _this.props.maxZoom),
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.current || _this.videoRef.current;
if (mediaRef && _this.containerRef) {
_this.containerRect = _this.containerRef.getBoundingClientRect();
var containerAspect = _this.containerRect.width / _this.containerRect.height;
var naturalWidth = ((_a = _this.imageRef.current) === null || _a === void 0 ? void 0 : _a.naturalWidth) || ((_b = _this.videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) || 0;
var naturalHeight = ((_c = _this.imageRef.current) === null || _c === void 0 ? void 0 : _c.naturalHeight) || ((_d = _this.videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) || 0;
var isMediaScaledDown = mediaRef.offsetWidth < naturalWidth || mediaRef.offsetHeight < naturalHeight;
var mediaAspect = naturalWidth / naturalHeight;
// We do not rely on the offsetWidth/offsetHeight if the media is scaled down
// as the values they report are rounded. That will result in precision losses
// when calculating zoom. We use the fact that the media is positionned relative
// to the container. That allows us to use the container's dimensions
// and natural aspect ratio of the media to calculate accurate media size.
// However, for this to work, the container should not be rotated
var renderedMediaSize = void 0;
if (isMediaScaledDown) {
switch (_this.props.objectFit) {
default:
case 'contain':
renderedMediaSize = containerAspect > mediaAspect ? {
width: _this.containerRect.height * mediaAspect,
height: _this.containerRect.height
} : {
width: _this.containerRect.width,
height: _this.containerRect.width / mediaAspect
};
break;
case 'horizontal-cover':
renderedMediaSize = {
width: _this.containerRect.width,
height: _this.containerRect.width / mediaAspect
};
break;
case 'vertical-cover':
renderedMediaSize = {
width: _this.containerRect.height * mediaAspect,
height: _this.containerRect.height
};
break;
case 'auto-cover':
renderedMediaSize = naturalWidth > naturalHeight ? {
width: _this.containerRect.width,
height: _this.containerRect.width / mediaAspect
} : {
width: _this.containerRect.height * mediaAspect,
height: _this.containerRect.height
};
break;
}
} else {
renderedMediaSize = {
width: mediaRef.offsetWidth,
height: mediaRef.offsetHeight
};
}
_this.mediaSize = __assign(__assign({}, renderedMediaSize), {
naturalWidth: naturalWidth,
naturalHeight: naturalHeight
});
// set media size in the parent
if (_this.props.setMediaSize) {
_this.props.setMediaSize(_this.mediaSize);
}
var cropSize = _this.props.cropSize ? _this.props.cropSize : getCropSize(_this.mediaSize.width, _this.mediaSize.height, _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);
// pass crop size to parent
if (_this.props.setCropSize) {
_this.props.setCropSize(cropSize);
}
return cropSize;
}
};
_this.onMouseDown = function (e) {
if (!_this.currentDoc) return;
e.preventDefault();
_this.currentDoc.addEventListener('mousemove', _this.onMouseMove);
_this.currentDoc.addEventListener('mouseup', _this.onDragStopped);
_this.onDragStart(Cropper.getMousePoint(e));
};
_this.onMouseMove = function (e) {
return _this.onDrag(Cropper.getMousePoint(e));
};
_this.onTouchStart = function (e) {
if (!_this.currentDoc) return;
_this.isTouching = true;
if (_this.props.onTouchRequest && !_this.props.onTouchRequest(e)) {
return;
}
_this.currentDoc.addEventListener('touchmove', _this.onTouchMove, {
passive: false
}); // iOS 11 now defaults to passive: true
_this.currentDoc.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.onGestureStart = function (e) {
if (!_this.currentDoc) return;
e.preventDefault();
_this.currentDoc.addEventListener('gesturechange', _this.onGestureMove);
_this.currentDoc.addEventListener('gestureend', _this.onGestureEnd);
_this.gestureZoomStart = _this.props.zoom;
_this.gestureRotationStart = _this.props.rotation;
};
_this.onGestureMove = function (e) {
e.preventDefault();
if (_this.isTouching) {
// this is to avoid conflict between gesture and touch events
return;
}
var point = Cropper.getMousePoint(e);
var newZoom = _this.gestureZoomStart - 1 + e.scale;
_this.setNewZoom(newZoom, point, {
shouldUpdatePosition: true
});
if (_this.props.onRotationChange) {
var newRotation = _this.gestureRotationStart + e.rotation;
_this.props.onRotationChange(newRotation);
}
};
_this.onGestureEnd = function (e) {
_this.cleanEvents();
};
_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.currentWindow) return;
if (_this.rafDragTimeout) _this.currentWindow.cancelAnimationFrame(_this.rafDragTimeout);
_this.rafDragTimeout = _this.currentWindow.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.isTouching = false;
_this.cleanEvents();
_this.emitCropData();
(_b = (_a = _this.props).onInteractionEnd) === null || _b === void 0 ? void 0 : _b.call(_a);
};
_this.onWheel = function (e) {
if (!_this.currentWindow) return;
if (_this.props.onWheelRequest && !_this.props.onWheelRequest(e)) {
return;
}
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, {
shouldUpdatePosition: true
});
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 = _this.currentWindow.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, _a) {
var _b = _a === void 0 ? {} : _a,
_c = _b.shouldUpdatePosition,
shouldUpdatePosition = _c === void 0 ? true : _c;
if (!_this.state.cropSize || !_this.props.onZoomChange) return;
var newZoom = clamp(zoom, _this.props.minZoom, _this.props.maxZoom);
if (shouldUpdatePosition) {
var zoomPoint = _this.getPointOnContainer(point);
var zoomTarget = _this.getPointOnMedia(zoomPoint);
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/ValentinH/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 () {
if (!this.currentDoc || !this.currentWindow) return;
if (this.containerRef) {
if (this.containerRef.ownerDocument) {
this.currentDoc = this.containerRef.ownerDocument;
}
if (this.currentDoc.defaultView) {
this.currentWindow = this.currentDoc.defaultView;
}
this.initResizeObserver();
// only add window resize listener if ResizeObserver is not supported. Otherwise, it would be redundant
if (typeof window.ResizeObserver === 'undefined') {
this.currentWindow.addEventListener('resize', this.computeSizes);
}
this.props.zoomWithScroll && this.containerRef.addEventListener('wheel', this.onWheel, {
passive: false
});
this.containerRef.addEventListener('gesturestart', this.onGestureStart);
}
if (!this.props.disableAutomaticStylesInjection) {
this.styleRef = this.currentDoc.createElement('style');
this.styleRef.setAttribute('type', 'text/css');
if (this.props.nonce) {
this.styleRef.setAttribute('nonce', this.props.nonce);
}
this.styleRef.innerHTML = css_248z;
this.currentDoc.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.current && this.imageRef.current.complete) {
this.onMediaLoad();
}
// set image and video refs in the parent if the callbacks exist
if (this.props.setImageRef) {
this.props.setImageRef(this.imageRef);
}
if (this.props.setVideoRef) {
this.props.setVideoRef(this.videoRef);
}
};
Cropper.prototype.componentWillUnmount = function () {
var _a, _b;
if (!this.currentDoc || !this.currentWindow) return;
if (typeof window.ResizeObserver === 'undefined') {
this.currentWindow.removeEventListener('resize', this.computeSizes);
}
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
if (this.containerRef) {
this.containerRef.removeEventListener('gesturestart', this.preventZoomSafari);
}
if (this.styleRef) {
(_b = this.styleRef.parentNode) === null || _b === void 0 ? void 0 : _b.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.current) === 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;
if (!this.currentDoc || !this.currentWindow) return;
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) this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout);
this.rafPinchTimeout = this.currentWindow.requestAnimationFrame(function () {
var distance = getDistanceBetweenPoints(pointA, pointB);
var newZoom = _this.props.zoom * (distance / _this.lastPinchDistance);
_this.setNewZoom(newZoom, center, {
shouldUpdatePosition: false
});
_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 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 ? 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', objectFit === 'auto-cover' && (this.mediaSize.naturalWidth > this.mediaSize.naturalHeight ? 'reactEasyCrop_Cover_Horizontal' : 'reactEasyCrop_Cover_Vertical'), mediaClassName)
}, mediaProps, {
src: image,
ref: this.imageRef,
style: __assign(__assign({}, mediaStyle), {
transform: transform || "translate(".concat(x, "px, ").concat(y, "px) rotate(").concat(rotation, "deg) scale(").concat(zoom, ")")
}),
onLoad: this.onMediaLoad
})) : video && 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', objectFit === 'auto-cover' && (this.mediaSize.naturalWidth > this.mediaSize.naturalHeight ? 'reactEasyCrop_Cover_Horizontal' : 'reactEasyCrop_Cover_Vertical'), mediaClassName)
}, mediaProps, {
ref: this.videoRef,
onLoadedMetadata: this.onMediaLoad,
style: __assign(__assign({}, mediaStyle), {
transform: transform || "translate(".concat(x, "px, ").concat(y, "px) rotate(").concat(rotation, "deg) scale(").concat(zoom, ")")
}),
controls: false
}), (Array.isArray(video) ? video : [{
src: video
}]).map(function (item) {
return external_React_default().createElement("source", __assign({
key: item.src
}, item));
})), this.state.cropSize && 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);
;// 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 = {
placement: 'bottom-start'
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/image-editor/cropper.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ImageCropper({
url,
width,
height,
clientWidth,
naturalHeight,
naturalWidth,
borderProps
}) {
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_React_.createElement)("div", {
className: classnames_default()('wp-block-image__crop-area', borderProps?.className, {
'is-applying': isInProgress
}),
style: {
...borderProps?.style,
width: width || clientWidth,
height: editedHeight
}
}, (0,external_React_.createElement)(Cropper, {
image: editedUrl || url,
disabled: isInProgress,
minZoom: constants_MIN_ZOOM / 100,
maxZoom: constants_MAX_ZOOM / 100,
crop: position,
zoom: zoom / 100,
aspect: aspect,
onCropChange: pos => {
setPosition(pos);
},
onCropComplete: newCropPercent => {
setCrop(newCropPercent);
},
onZoomChange: newZoom => {
setZoom(newZoom * 100);
}
}), isInProgress && (0,external_React_.createElement)(external_wp_components_namespaceObject.Spinner, null));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js
/**
* WordPress dependencies
*/
const search = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"
}));
/* harmony default export */ const 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_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
contentClassName: "wp-block-image__zoom",
popoverProps: constants_POPOVER_PROPS,
renderToggle: ({
isOpen,
onToggle
}) => (0,external_React_.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_React_.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
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_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const 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({
aspectRatios,
isDisabled,
label,
onClick,
value
}) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuGroup, {
label: label
}, aspectRatios.map(({
title,
aspect
}) => (0,external_React_.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({
toggleProps
}) {
const {
isInProgress,
aspect,
setAspect,
defaultAspect
} = useImageEditingContext();
return (0,external_React_.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"
}, ({
onClose
}) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(AspectGroup, {
isDisabled: isInProgress,
onClick: newAspect => {
setAspect(newAspect);
onClose();
},
value: aspect,
aspectRatios: [
// All ratios should be mirrored in AspectRatioTool in @wordpress/block-editor.
{
title: (0,external_wp_i18n_namespaceObject.__)('Original'),
aspect: defaultAspect
}, {
title: (0,external_wp_i18n_namespaceObject.__)('Square'),
aspect: 1
}]
}), (0,external_React_.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: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_React_.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.__)('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_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const 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_React_.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_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: apply,
disabled: isInProgress
}, (0,external_wp_i18n_namespaceObject.__)('Apply')), (0,external_React_.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({
id,
url,
width,
height,
clientWidth,
naturalHeight,
naturalWidth,
onSaveImage,
onFinishEditing,
borderProps
}) {
return (0,external_React_.createElement)(ImageEditingProvider, {
id: id,
url: url,
naturalWidth: naturalWidth,
naturalHeight: naturalHeight,
onSaveImage: onSaveImage,
onFinishEditing: onFinishEditing
}, (0,external_React_.createElement)(ImageCropper, {
borderProps: borderProps,
url: url,
width: width,
height: height,
clientWidth: clientWidth,
naturalHeight: naturalHeight,
naturalWidth: naturalWidth
}), (0,external_React_.createElement)(block_controls, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(ZoomDropdown, null), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_React_.createElement)(AspectRatioDropdown, {
toggleProps: toggleProps
})), (0,external_React_.createElement)(RotationButton, null)), (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.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) => {
const parsedValue = value === '' ? undefined : parseInt(value, 10);
if (dimension === 'width') {
setCurrentWidth(parsedValue);
} else {
setCurrentHeight(parsedValue);
}
onChange({
[dimension]: parsedValue
});
};
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
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const IMAGE_SIZE_PRESETS = [25, 50, 75, 100];
const image_size_control_noop = () => {};
function ImageSizeControl({
imageSizeHelp,
imageWidth,
imageHeight,
imageSizeOptions = [],
isResizable = true,
slug,
width,
height,
onChange,
onChangeImage = image_size_control_noop
}) {
const {
currentHeight,
currentWidth,
updateDimension,
updateDimensions
} = useDimensionHandler(height, width, imageHeight, imageWidth, onChange);
return (0,external_React_.createElement)(external_React_.Fragment, null, imageSizeOptions && imageSizeOptions.length > 0 && (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Resolution'),
value: slug,
options: imageSizeOptions,
onChange: onChangeImage,
help: imageSizeHelp,
size: "__unstable-large"
}), isResizable && (0,external_React_.createElement)("div", {
className: "block-editor-image-size-control"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
align: "baseline",
spacing: "3"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
className: "block-editor-image-size-control__width",
label: (0,external_wp_i18n_namespaceObject.__)('Width'),
value: currentWidth,
min: 1,
onChange: value => updateDimension('width', value),
size: "__unstable-large"
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
className: "block-editor-image-size-control__height",
label: (0,external_wp_i18n_namespaceObject.__)('Height'),
value: currentHeight,
min: 1,
onChange: value => updateDimension('height', value),
size: "__unstable-large"
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, null, (0,external_React_.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_React_.createElement)(external_wp_components_namespaceObject.Button, {
key: scale,
size: "small",
variant: isCurrent ? 'primary' : undefined,
isPressed: isCurrent,
onClick: () => updateDimensions(scaledHeight, scaledWidth)
}, scale, "%");
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
size: "small",
onClick: () => updateDimensions()
}, (0,external_wp_i18n_namespaceObject.__)('Reset')))));
}
;// 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 (0,external_React_.createElement)("span", {
className: linkClassName
});
}
return (0,external_React_.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({
className,
linkClassName,
onEditLinkClick,
url,
urlLabel,
...props
}) {
return (0,external_React_.createElement)("div", {
className: classnames_default()('block-editor-url-popover__link-viewer', className),
...props
}, (0,external_React_.createElement)(LinkViewerURL, {
url: url,
urlLabel: urlLabel,
className: linkClassName
}), onEditLinkClick && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: edit,
label: (0,external_wp_i18n_namespaceObject.__)('Edit'),
onClick: onEditLinkClick,
size: "compact"
}));
}
;// 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 (0,external_React_.createElement)("form", {
className: classnames_default()('block-editor-url-popover__link-editor', className),
...props
}, (0,external_React_.createElement)(url_input, {
__nextHasNoMarginBottom: true,
value: value,
onChange: onChangeInputValue,
autocompleteRef: autocompleteRef
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: keyboard_return,
label: (0,external_wp_i18n_namespaceObject.__)('Apply'),
type: "submit",
size: "compact"
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
__experimentalPopoverLegacyPositionToPlacement
} = unlock(external_wp_components_namespaceObject.privateApis);
const DEFAULT_PLACEMENT = 'bottom';
const URLPopover = (0,external_wp_element_namespaceObject.forwardRef)(({
additionalControls,
children,
renderSettings,
// The DEFAULT_PLACEMENT value is assigned inside the function's body
placement,
focusOnMount = 'firstElement',
// Deprecated
position,
// Rest
...popoverProps
}, ref) => {
if (position !== undefined) {
external_wp_deprecated_default()('`position` prop in wp.blockEditor.URLPopover', {
since: '6.2',
alternative: '`placement` prop'
});
}
// Compute popover's placement:
// - give priority to `placement` prop, if defined
// - otherwise, compute it from the legacy `position` prop (if defined)
// - finally, fallback to the DEFAULT_PLACEMENT.
let computedPlacement;
if (placement !== undefined) {
computedPlacement = placement;
} else if (position !== undefined) {
computedPlacement = __experimentalPopoverLegacyPositionToPlacement(position);
}
computedPlacement = computedPlacement || DEFAULT_PLACEMENT;
const [isSettingsExpanded, setIsSettingsExpanded] = (0,external_wp_element_namespaceObject.useState)(false);
const showSettings = !!renderSettings && isSettingsExpanded;
const toggleSettingsVisibility = () => {
setIsSettingsExpanded(!isSettingsExpanded);
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, {
ref: ref,
className: "block-editor-url-popover",
focusOnMount: focusOnMount,
placement: computedPlacement,
shift: true,
variant: "toolbar",
...popoverProps
}, (0,external_React_.createElement)("div", {
className: "block-editor-url-popover__input-container"
}, (0,external_React_.createElement)("div", {
className: "block-editor-url-popover__row"
}, children, !!renderSettings && (0,external_React_.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,
size: "compact"
}))), showSettings && (0,external_React_.createElement)("div", {
className: "block-editor-url-popover__settings"
}, renderSettings()), additionalControls && !showSettings && (0,external_React_.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 */ const url_popover = (URLPopover);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/media-placeholder/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const media_placeholder_noop = () => {};
const InsertFromURLPopover = ({
src,
onChange,
onSubmit,
onClose,
popoverAnchor
}) => (0,external_React_.createElement)(url_popover, {
anchor: popoverAnchor,
onClose: onClose
}, (0,external_React_.createElement)("form", {
className: "block-editor-media-placeholder__url-input-form",
onSubmit: onSubmit
}, (0,external_React_.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_React_.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"
})));
const URLSelectionUI = ({
isURLInputVisible,
src,
onChangeSrc,
onSubmitSrc,
openURLInput,
closeURLInput
}) => {
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
return (0,external_React_.createElement)("div", {
className: "block-editor-media-placeholder__url-input-container",
ref: setPopoverAnchor
}, (0,external_React_.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_React_.createElement)(InsertFromURLPopover, {
src: src,
onChange: onChangeSrc,
onSubmit: onSubmitSrc,
onClose: closeURLInput,
popoverAnchor: popoverAnchor
}));
};
function MediaPlaceholder({
value = {},
allowedTypes,
className,
icon,
labels = {},
mediaPreview,
notices,
isAppender,
accept,
addToGallery,
multiple = false,
handleUpload = true,
disableDropZone,
disableMediaButtons,
onError,
onSelect,
onCancel,
onSelectURL,
onToggleFeaturedImage,
onDoubleClick,
onFilesPreUpload = media_placeholder_noop,
onHTMLDrop: deprecatedOnHTMLDrop,
children,
mediaLibraryButton,
placeholder,
style
}) {
if (deprecatedOnHTMLDrop) {
external_wp_deprecated_default()('wp.blockEditor.MediaPlaceholder onHTMLDrop prop', {
since: '6.2',
version: '6.4'
});
}
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?.src) !== null && _value$src !== void 0 ? _value$src : '');
}, [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.
({
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
});
};
async function handleBlocksDrop(blocks) {
if (!blocks || !Array.isArray(blocks)) {
return;
}
function recursivelyFindMediaFromBlocks(_blocks) {
return _blocks.flatMap(block => (block.name === 'core/image' || block.name === 'core/audio' || block.name === 'core/video') && block.attributes.url ? [block] : recursivelyFindMediaFromBlocks(block.innerBlocks));
}
const mediaBlocks = recursivelyFindMediaFromBlocks(blocks);
if (!mediaBlocks.length) {
return;
}
const uploadedMediaList = await Promise.all(mediaBlocks.map(block => block.attributes.id ? block.attributes : new Promise((resolve, reject) => {
window.fetch(block.attributes.url).then(response => response.blob()).then(blob => mediaUpload({
filesList: [blob],
additionalData: {
title: block.attributes.title,
alt_text: block.attributes.alt,
caption: block.attributes.caption
},
onFileChange: ([media]) => {
if (media.id) {
resolve(media);
}
},
allowedTypes,
onError: reject
})).catch(() => resolve(block.attributes.url));
}))).catch(err => onError(err));
if (multiple) {
onSelect(uploadedMediaList);
} else {
onSelect(uploadedMediaList[0]);
}
}
async function onHTMLDrop(HTML) {
const blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({
HTML
});
return await handleBlocksDrop(blocks);
}
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_React_.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_React_.createElement)(external_wp_components_namespaceObject.DropZone, {
onFilesDrop: onFilesUpload,
onHTMLDrop: onHTMLDrop
});
};
const renderCancelLink = () => {
return onCancel && (0,external_React_.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_React_.createElement)(URLSelectionUI, {
isURLInputVisible: isURLInputVisible,
src: src,
onChangeSrc: onChangeSrc,
onSubmitSrc: onSubmitSrc,
openURLInput: openURLInput,
closeURLInput: closeURLInput
});
};
const renderFeaturedImageToggle = () => {
return onToggleFeaturedImage && (0,external_React_.createElement)("div", {
className: "block-editor-media-placeholder__url-input-container"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
className: "block-editor-media-placeholder__button",
onClick: onToggleFeaturedImage,
variant: "tertiary"
}, (0,external_wp_i18n_namespaceObject.__)('Use featured image')));
};
const renderMediaUploadChecked = () => {
const defaultButton = ({
open
}) => {
return (0,external_React_.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_React_.createElement)(media_upload, {
addToGallery: addToGallery,
gallery: multiple && onlyAllowsImages(),
multiple: multiple,
onSelect: onSelect,
allowedTypes: allowedTypes,
mode: 'browse',
value: Array.isArray(value) ? value.map(({
id
}) => id) : value.id,
render: libraryButton
});
if (mediaUpload && isAppender) {
return (0,external_React_.createElement)(external_React_.Fragment, null, renderDropZone(), (0,external_React_.createElement)(external_wp_components_namespaceObject.FormFileUpload, {
onChange: onUpload,
accept: accept,
multiple: !!multiple,
render: ({
openFileDialog
}) => {
const content = (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.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(), renderFeaturedImageToggle(), renderCancelLink());
return renderPlaceholder(content);
}
}));
}
if (mediaUpload) {
const content = (0,external_React_.createElement)(external_React_.Fragment, null, renderDropZone(), (0,external_React_.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(), renderFeaturedImageToggle(), renderCancelLink());
return renderPlaceholder(content);
}
return renderPlaceholder(uploadMediaLibraryButton);
};
if (disableMediaButtons) {
return (0,external_React_.createElement)(check, null, renderDropZone());
}
return (0,external_React_.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 */ const 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 = ({
colorSettings,
...props
}) => {
const settings = colorSettings.map(setting => {
if (!setting) {
return setting;
}
const {
value,
onChange,
...otherSettings
} = setting;
return {
...otherSettings,
colorValue: value,
onColorChange: onChange
};
});
return (0,external_React_.createElement)(panel_color_gradient_settings, {
settings: settings,
gradients: [],
disableCustomGradients: true,
...props
});
};
/* harmony default export */ const panel_color_settings = (PanelColorSettings);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const format_toolbar_POPOVER_PROPS = {
placement: 'bottom-start'
};
const FormatToolbar = () => {
return (0,external_React_.createElement)(external_React_.Fragment, null, ['bold', 'italic', 'link', 'unknown'].map(format => (0,external_React_.createElement)(external_wp_components_namespaceObject.Slot, {
name: `RichText.ToolbarControls.${format}`,
key: format
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.Slot, {
name: "RichText.ToolbarControls"
}, fills => {
if (!fills.length) {
return null;
}
const allProps = fills.map(([{
props
}]) => props);
const hasActive = allProps.some(({
isActive
}) => isActive);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_React_.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: orderBy(fills.map(([{
props
}]) => props), 'title'),
popoverProps: format_toolbar_POPOVER_PROPS
}));
}));
};
/* harmony default export */ const format_toolbar = (FormatToolbar);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/format-toolbar-container.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function InlineSelectionToolbar({
editableContentElement,
activeFormats
}) {
const lastFormat = activeFormats[activeFormats.length - 1];
const lastFormatType = lastFormat?.type;
const settings = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_richText_namespaceObject.store).getFormatType(lastFormatType), [lastFormatType]);
const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
editableContentElement,
settings
});
return (0,external_React_.createElement)(InlineToolbar, {
popoverAnchor: popoverAnchor
});
}
function InlineToolbar({
popoverAnchor
}) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover, {
placement: "top",
focusOnMount: false,
anchor: popoverAnchor,
className: "block-editor-rich-text__inline-format-toolbar",
__unstableSlotName: "block-toolbar"
}, (0,external_React_.createElement)(NavigableToolbar, {
className: "block-editor-rich-text__inline-format-toolbar-group"
/* translators: accessibility text for the inline format toolbar */,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Format tools')
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_.createElement)(format_toolbar, null))));
}
const FormatToolbarContainer = ({
inline,
editableContentElement,
value
}) => {
const hasInlineToolbar = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().hasInlineToolbar, []);
if (inline) {
return (0,external_React_.createElement)(InlineToolbar, {
popoverAnchor: editableContentElement
});
}
if (hasInlineToolbar) {
const activeFormats = (0,external_wp_richText_namespaceObject.getActiveFormats)(value);
if ((0,external_wp_richText_namespaceObject.isCollapsed)(value) && !activeFormats.length) {
return null;
}
return (0,external_React_.createElement)(InlineSelectionToolbar, {
editableContentElement: editableContentElement,
activeFormats: activeFormats
});
}
// Render regular toolbar.
return (0,external_React_.createElement)(block_controls, {
group: "inline"
}, (0,external_React_.createElement)(format_toolbar, null));
};
/* harmony default export */ const 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;
}
const {
__experimentalUndo
} = getSettings();
if (!__experimentalUndo) {
return;
}
if (!didAutomaticChange()) {
return;
}
event.preventDefault();
__experimentalUndo();
}
element.addEventListener('keydown', onKeyDown);
return () => {
element.removeEventListener('keydown', onKeyDown);
};
}, []);
}
;// 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 = (0,external_wp_element_namespaceObject.useRef)();
const hasActiveFormats = !!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/utils.js
/**
* WordPress dependencies
*/
function addActiveFormats(value, activeFormats) {
if (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 | undefined} The multiline tag.
*/
function getMultilineTag(multiline) {
if (multiline !== true && multiline !== 'p' && multiline !== 'li') {
return;
}
return multiline === true ? 'p' : multiline;
}
function getAllowedFormats({
allowedFormats,
disableFormats
}) {
if (disableFormats) {
return getAllowedFormats.EMPTY_ARRAY;
}
return allowedFormats;
}
getAllowedFormats.EMPTY_ARRAY = [];
/**
* 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({
value,
pastedBlocks = [],
onReplace,
onSplit
}) {
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 we 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
}), !isAfterOriginal));
lastPastedBlockIndex += 1;
}
if (hasPastedBlocks) {
blocks.push(...pastedBlocks);
lastPastedBlockIndex += pastedBlocks.length;
}
// Create a block with the content after 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 trailing empty block on paste, but we do if we split with e.g.
// the enter key.
if (!hasPastedBlocks || !(0,external_wp_richText_namespaceObject.isEmpty)(after)) {
blocks.push(onSplit((0,external_wp_richText_namespaceObject.toHTMLString)({
value: after
}), 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 */
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,
__unstableEmbedURLOnPaste,
pastePlainText
} = propsRef.current;
if (!isSelected) {
return;
}
const {
plainText,
html,
files
} = getPasteEventData(event);
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 isInternal = event.clipboardData.getData('rich-text') === 'true';
function pasteInline(content) {
const transformed = formatTypes.reduce((accumulator, {
__unstablePasteRule
}) => {
// Only allow one transform.
if (__unstablePasteRule && accumulator === value) {
accumulator = __unstablePasteRule(value, {
html,
plainText
});
}
return accumulator;
}, value);
if (transformed !== value) {
onChange(transformed);
} else {
const valueToInsert = (0,external_wp_richText_namespaceObject.create)({
html: content
});
addActiveFormats(valueToInsert, value.activeFormats);
onChange((0,external_wp_richText_namespaceObject.insert)(value, valueToInsert));
}
}
// 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) {
pasteInline(html);
return;
}
if (pastePlainText) {
onChange((0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.create)({
text: plainText
})));
return;
}
if (files?.length) {
// 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);
const fromTransforms = (0,external_wp_blocks_namespaceObject.getBlockTransforms)('from');
const blocks = files.reduce((accumulator, file) => {
const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(fromTransforms, transform => transform.type === 'files' && transform.isMatch([file]));
if (transformation) {
accumulator.push(transformation.transform([file]));
}
return accumulator;
}, []).flat();
if (!blocks.length) {
return;
}
if (onReplace && (0,external_wp_richText_namespaceObject.isEmpty)(value)) {
onReplace(blocks);
} else {
splitValue({
value,
pastedBlocks: blocks,
onReplace,
onSplit
});
}
return;
}
let mode = onReplace && onSplit ? 'AUTO' : 'INLINE';
const trimmedPlainText = plainText.trim();
if (__unstableEmbedURLOnPaste && (0,external_wp_richText_namespaceObject.isEmpty)(value) && (0,external_wp_url_namespaceObject.isURL)(trimmedPlainText) &&
// For the link pasting feature, allow only http(s) protocols.
/^https?:/.test(trimmedPlainText)) {
mode = 'BLOCKS';
}
const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({
HTML: html,
plainText,
mode,
tagName
});
if (typeof content === 'string') {
pasteInline(content);
} 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
});
}
}
}
element.addEventListener('paste', _onPaste);
return () => {
element.removeEventListener('paste', _onPaste);
};
}, []);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-before-input-rules.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* When typing over a selection, the selection will we wrapped by a matching
* character pair. The second character is optional, it defaults to the first
* character.
*
* @type {string[]} Array of character pairs.
*/
const wrapSelectionSettings = ['`', '"', "'", '“”', '‘’'];
function useBeforeInputRules(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 onInput(event) {
const {
inputType,
data
} = event;
const {
value,
onChange
} = propsRef.current;
// Only run the rules when inserting text.
if (inputType !== 'insertText') {
return;
}
if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) {
return;
}
const pair = (0,external_wp_hooks_namespaceObject.applyFilters)('blockEditor.wrapSelectionSettings', wrapSelectionSettings).find(([startChar, endChar]) => startChar === data || endChar === data);
if (!pair) {
return;
}
const [startChar, endChar = startChar] = pair;
const start = value.start;
const end = value.end + startChar.length;
let newValue = (0,external_wp_richText_namespaceObject.insert)(value, startChar, start, start);
newValue = (0,external_wp_richText_namespaceObject.insert)(newValue, endChar, end, end);
__unstableMarkLastChangeAsPersistent();
onChange(newValue);
__unstableMarkAutomaticChange();
const init = {};
for (const key in event) {
init[key] = event[key];
}
init.data = endChar;
const {
ownerDocument
} = element;
const {
defaultView
} = ownerDocument;
const newEvent = new defaultView.InputEvent('input', init);
// Dispatch an `input` event with the new data. This will trigger the
// input rules.
// Postpone the `input` to the next event loop tick so that the dispatch
// doesn't happen synchronously in the middle of `beforeinput` dispatch.
// This is closer to how native `input` event would be timed, and also
// makes sure that the `input` event is dispatched only after the `onChange`
// call few lines above has fully updated the data store state and rerendered
// all affected components.
window.queueMicrotask(() => {
event.target.dispatchEvent(newEvent);
});
event.preventDefault();
}
element.addEventListener('beforeinput', onInput);
return () => {
element.removeEventListener('beforeinput', onInput);
};
}, []);
}
;// 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
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function findSelection(blocks) {
let i = blocks.length;
while (i--) {
const attributeKey = retrieveSelectedAttribute(blocks[i].attributes);
if (attributeKey) {
blocks[i].attributes[attributeKey] = blocks[i].attributes[attributeKey]
// To do: refactor this to use rich text's selection instead, so
// we no longer have to use on this hack inserting a special
// character.
.toString().replace(START_OF_SELECTED_AREA, '');
return [blocks[i].clientId, attributeKey, 0, 0];
}
const nestedSelection = findSelection(blocks[i].innerBlocks);
if (nestedSelection) {
return nestedSelection;
}
}
return [];
}
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 {
getValue,
onReplace,
selectionChange
} = propsRef.current;
if (!onReplace) {
return;
}
// We must use getValue() here because value may be update
// asynchronously.
const value = getValue();
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(({
type
}) => type === 'prefix');
const transformation = (0,external_wp_blocks_namespaceObject.findTransform)(prefixTransforms, ({
prefix
}) => {
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();
return true;
}
function onInput(event) {
const {
inputType,
type
} = event;
const {
getValue,
onChange,
__unstableAllowPrefixTransformations,
formatTypes
} = propsRef.current;
// Only run input rules when inserting text.
if (inputType !== 'insertText' && type !== 'compositionend') {
return;
}
if (__unstableAllowPrefixTransformations && inputRule()) {
return;
}
const value = getValue();
const transformed = formatTypes.reduce((accumlator, {
__unstableInputRule
}) => {
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-delete.js
/**
* WordPress dependencies
*/
function useDelete(props) {
const propsRef = (0,external_wp_element_namespaceObject.useRef)(props);
propsRef.current = props;
return (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
function onKeyDown(event) {
const {
keyCode
} = event;
if (event.defaultPrevented) {
return;
}
const {
value,
onMerge,
onRemove
} = propsRef.current;
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).
else if (onRemove && (0,external_wp_richText_namespaceObject.isEmpty)(value) && isReverse) {
onRemove(!isReverse);
}
event.preventDefault();
}
}
element.addEventListener('keydown', onKeyDown);
return () => {
element.removeEventListener('keydown', onKeyDown);
};
}, []);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/use-enter.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useEnter(props) {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
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.target.contentEditable !== 'true') {
return;
}
if (event.defaultPrevented) {
return;
}
if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) {
return;
}
const {
removeEditorOnlyFormats,
value,
onReplace,
onSplit,
onChange,
disableLineBreaks,
onSplitAtEnd,
onSplitAtDoubleLineEnd
} = propsRef.current;
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(({
type
}) => 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();
return;
}
}
const {
text,
start,
end
} = _value;
if (event.shiftKey) {
if (!disableLineBreaks) {
onChange((0,external_wp_richText_namespaceObject.insert)(_value, '\n'));
}
} else if (canSplit) {
splitValue({
value: _value,
onReplace,
onSplit
});
} else if (onSplitAtEnd && start === end && end === text.length) {
onSplitAtEnd();
} else if (
// For some blocks it's desirable to split at the end of the
// block when there are two line breaks at the end of the
// block, so triple Enter exits the block.
onSplitAtDoubleLineEnd && start === end && end === text.length && text.slice(-2) === '\n\n') {
registry.batch(() => {
_value.start = _value.end - 2;
onChange((0,external_wp_richText_namespaceObject.remove)(_value));
onSplitAtDoubleLineEnd();
});
} else if (!disableLineBreaks) {
onChange((0,external_wp_richText_namespaceObject.insert)(_value, '\n'));
}
}
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
*/
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']);
function prefixSelectKeys(selected, prefix) {
if (typeof selected !== 'object') return {
[prefix]: selected
};
return Object.fromEntries(Object.entries(selected).map(([key, value]) => [`${prefix}.${key}`, value]));
}
function getPrefixedSelectKeys(selected, prefix) {
if (selected[prefix]) return selected[prefix];
return Object.keys(selected).filter(key => key.startsWith(prefix + '.')).reduce((accumulator, key) => {
accumulator[key.slice(prefix.length + 1)] = selected[key];
return accumulator;
}, {});
}
/**
* 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 = (0,external_wp_data_namespaceObject.useSelect)(formatTypesSelector, []);
const formatTypes = (0,external_wp_element_namespaceObject.useMemo)(() => {
return allFormatTypes.filter(({
name,
interactive,
tagName
}) => {
if (allowedFormats && !allowedFormats.includes(name)) {
return false;
}
if (withoutInteractiveFormatting && (interactive || interactiveContentTags.has(tagName))) {
return false;
}
return true;
});
}, [allFormatTypes, allowedFormats, withoutInteractiveFormatting]);
const keyedSelected = (0,external_wp_data_namespaceObject.useSelect)(select => formatTypes.reduce((accumulator, type) => {
if (!type.__experimentalGetPropsForEditableTreePreparation) {
return accumulator;
}
return {
...accumulator,
...prefixSelectKeys(type.__experimentalGetPropsForEditableTreePreparation(select, {
richTextIdentifier: identifier,
blockClientId: clientId
}), type.name)
};
}, {}), [formatTypes, clientId, identifier]);
const dispatch = (0,external_wp_data_namespaceObject.useDispatch)();
const prepareHandlers = [];
const valueHandlers = [];
const changeHandlers = [];
const dependencies = [];
for (const key in keyedSelected) {
dependencies.push(keyedSelected[key]);
}
formatTypes.forEach(type => {
if (type.__experimentalCreatePrepareEditableTree) {
const handler = type.__experimentalCreatePrepareEditableTree(getPrefixedSelectKeys(keyedSelected, type.name), {
richTextIdentifier: identifier,
blockClientId: clientId
});
if (type.__experimentalCreateOnChangeEditableValue) {
valueHandlers.push(handler);
} else {
prepareHandlers.push(handler);
}
}
if (type.__experimentalCreateOnChangeEditableValue) {
let dispatchers = {};
if (type.__experimentalGetPropsForEditableTreeChangeHandler) {
dispatchers = type.__experimentalGetPropsForEditableTreeChangeHandler(dispatch, {
richTextIdentifier: identifier,
blockClientId: clientId
});
}
const selected = getPrefixedSelectKeys(keyedSelected, type.name);
changeHandlers.push(type.__experimentalCreateOnChangeEditableValue({
...(typeof selected === 'object' ? selected : {}),
...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.removeEventListener('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-insert-replacement-text.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* When the browser is about to auto correct, add an undo level so the user can
* revert the change.
*/
function useInsertReplacementText() {
const {
__unstableMarkLastChangeAsPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
return (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
function onInput(event) {
if (event.inputType === 'insertReplacementText') {
__unstableMarkLastChangeAsPersistent();
}
}
element.addEventListener('beforeinput', onInput);
return () => {
element.removeEventListener('beforeinput', 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
*/
/**
* Internal dependencies
*/
const format_edit_DEFAULT_BLOCK_CONTEXT = {};
const usesContextKey = Symbol('usesContext');
function format_edit_Edit({
onChange,
onFocus,
value,
forwardedRef,
settings
}) {
const {
name,
edit: EditFunction,
[usesContextKey]: usesContext
} = settings;
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 usesContext ? Object.fromEntries(Object.entries(blockContext).filter(([key]) => usesContext.includes(key))) : format_edit_DEFAULT_BLOCK_CONTEXT;
}, [usesContext, blockContext]);
if (!EditFunction) {
return null;
}
const activeFormat = (0,external_wp_richText_namespaceObject.getActiveFormat)(value, name);
const isActive = activeFormat !== undefined;
const activeObject = (0,external_wp_richText_namespaceObject.getActiveObject)(value);
const isObjectActive = activeObject !== undefined && activeObject.type === name;
return (0,external_React_.createElement)(EditFunction, {
key: name,
isActive: isActive,
activeAttributes: isActive ? activeFormat.attributes || {} : {},
isObjectActive: isObjectActive,
activeObjectAttributes: isObjectActive ? activeObject.attributes || {} : {},
value: value,
onChange: onChange,
onFocus: onFocus,
contentRef: forwardedRef,
context: context
});
}
function FormatEdit({
formatTypes,
...props
}) {
return formatTypes.map(settings => (0,external_React_.createElement)(format_edit_Edit, {
settings: settings,
...props,
key: settings.name
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/content.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Internal dependencies
*/
function Content({
value,
tagName: Tag,
multiline,
format,
...props
}) {
if (rich_text.isEmpty(value)) {
const MultilineTag = getMultilineTag(multiline);
value = MultilineTag ? (0,external_React_.createElement)(MultilineTag, null) : null;
} else if (Array.isArray(value)) {
external_wp_deprecated_default()('wp.blockEditor.RichText value prop as children type', {
since: '6.1',
version: '6.3',
alternative: 'value prop as string',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
value = (0,external_React_.createElement)(external_wp_element_namespaceObject.RawHTML, null, external_wp_blocks_namespaceObject.children.toHTML(value));
} else if (typeof value === 'string') {
// To do: deprecate.
value = (0,external_React_.createElement)(external_wp_element_namespaceObject.RawHTML, null, value);
} else {
// To do: create a toReactComponent method on RichTextData, which we
// might in the future also use for the editable tree. See
// https://github.com/WordPress/gutenberg/pull/41655.
value = (0,external_React_.createElement)(external_wp_element_namespaceObject.RawHTML, null, value.toHTMLString());
}
return Tag ? (0,external_React_.createElement)(Tag, {
...props
}, value) : value;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/multiline.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function RichTextMultiline({
children,
identifier,
tagName: TagName = 'div',
value = '',
onChange,
multiline,
...props
}, forwardedRef) {
external_wp_deprecated_default()('wp.blockEditor.RichText multiline prop', {
since: '6.1',
version: '6.3',
alternative: 'nested blocks (InnerBlocks)',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/nested-blocks-inner-blocks/'
});
const {
clientId
} = useBlockEditContext();
const {
selectionChange
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const multilineTagName = getMultilineTag(multiline);
value = value || `<${multilineTagName}></${multilineTagName}>`;
const padded = `</${multilineTagName}>${value}<${multilineTagName}>`;
const values = padded.split(`</${multilineTagName}><${multilineTagName}>`);
values.shift();
values.pop();
function _onChange(newValues) {
onChange(`<${multilineTagName}>${newValues.join(`</${multilineTagName}><${multilineTagName}>`)}</${multilineTagName}>`);
}
return (0,external_React_.createElement)(TagName, {
ref: forwardedRef
}, values.map((_value, index) => {
return (0,external_React_.createElement)(RichTextWrapper, {
key: index,
identifier: `${identifier}-${index}`,
tagName: multilineTagName,
value: _value,
onChange: newValue => {
const newValues = values.slice();
newValues[index] = newValue;
_onChange(newValues);
},
isSelected: undefined,
onSplit: v => v,
onReplace: array => {
const newValues = values.slice();
newValues.splice(index, 1, ...array);
_onChange(newValues);
selectionChange(clientId, `${identifier}-${index + 1}`, 0, 0);
},
onMerge: forward => {
const newValues = values.slice();
let offset = 0;
if (forward) {
if (!newValues[index + 1]) return;
newValues.splice(index, 2, newValues[index] + newValues[index + 1]);
offset = newValues[index].length - 1;
} else {
if (!newValues[index - 1]) return;
newValues.splice(index - 1, 2, newValues[index - 1] + newValues[index]);
offset = newValues[index - 1].length - 1;
}
_onChange(newValues);
selectionChange(clientId, `${identifier}-${index - (forward ? 0 : 1)}`, offset, offset);
},
...props
});
}));
}
/* harmony default export */ const multiline = ((0,external_wp_element_namespaceObject.forwardRef)(RichTextMultiline));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/with-deprecations.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function withDeprecations(Component) {
return (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
let value = props.value;
let onChange = props.onChange;
// Handle deprecated format.
if (Array.isArray(value)) {
external_wp_deprecated_default()('wp.blockEditor.RichText value prop as children type', {
since: '6.1',
version: '6.3',
alternative: 'value prop as string',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
value = external_wp_blocks_namespaceObject.children.toHTML(props.value);
onChange = newValue => props.onChange(external_wp_blocks_namespaceObject.children.fromDOM((0,external_wp_richText_namespaceObject.__unstableCreateElement)(document, newValue).childNodes));
}
const NewComponent = props.multiline ? multiline : Component;
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(NewComponent);
return (0,external_React_.createElement)(NewComponent, {
...props,
identifier: props.identifier || instanceId,
value: value,
onChange: onChange,
ref: ref
});
});
}
;// 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) {
const {
__unstableMobileNoFocusOnMount,
deleteEnter,
placeholderTextColor,
textAlign,
selectionColor,
tagsToEliminate,
disableEditingMenu,
fontSize,
fontFamily,
fontWeight,
fontStyle,
minWidth,
maxWidth,
setRef,
disableSuggestions,
disableAutocorrection,
...restProps
} = props;
return restProps;
}
function RichTextWrapper({
children,
tagName = 'div',
value: adjustedValue = '',
onChange: adjustedOnChange,
isSelected: originalIsSelected,
multiline,
inlineToolbar,
wrapperClassName,
autocompleters,
onReplace,
placeholder,
allowedFormats,
withoutInteractiveFormatting,
onRemove,
onMerge,
onSplit,
__unstableOnSplitAtEnd: onSplitAtEnd,
__unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd,
identifier,
preserveWhiteSpace,
__unstablePastePlainText: pastePlainText,
__unstableEmbedURLOnPaste,
__unstableDisableFormats: disableFormats,
disableLineBreaks,
__unstableAllowPrefixTransformations,
disableEditing,
...props
}, forwardedRef) {
props = removeNativeProps(props);
const anchorRef = (0,external_wp_element_namespaceObject.useRef)();
const context = useBlockEditContext();
const {
clientId,
isSelected: isBlockSelected,
name: blockName
} = context;
const blockBindings = context[blockBindingsKey];
const selector = select => {
// Avoid subscribing to the block editor store if the block is not
// selected.
if (!isBlockSelected) {
return {
isSelected: false
};
}
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
};
};
const {
selectionStart,
selectionEnd,
isSelected
} = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId, identifier, originalIsSelected, isBlockSelected]);
const disableBoundBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => {
// Disable Rich Text editing if block bindings specify that.
let _disableBoundBlocks = false;
if (blockBindings && canBindBlock(blockName)) {
const blockTypeAttributes = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName).attributes;
const {
getBlockBindingsSource
} = unlock(select(external_wp_blocks_namespaceObject.store));
for (const [attribute, args] of Object.entries(blockBindings)) {
if (blockTypeAttributes?.[attribute]?.source !== 'rich-text') {
break;
}
// If the source is not defined, or if its value of `lockAttributesEditing` is `true`, disable it.
const blockBindingsSource = getBlockBindingsSource(args.source);
if (!blockBindingsSource || blockBindingsSource.lockAttributesEditing) {
_disableBoundBlocks = true;
break;
}
}
}
return _disableBoundBlocks;
}, [blockBindings, blockName]);
const shouldDisableEditing = disableEditing || disableBoundBlocks;
const {
getSelectionStart,
getSelectionEnd,
getBlockRootClientId
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
selectionChange
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const adjustedAllowedFormats = getAllowedFormats({
allowedFormats,
disableFormats
});
const hasFormats = !adjustedAllowedFormats || adjustedAllowedFormats.length > 0;
const onSelectionChange = (0,external_wp_element_namespaceObject.useCallback)((start, end) => {
const selection = {};
const unset = start === undefined && end === undefined;
if (typeof start === 'number' || unset) {
// If we are only setting the start (or the end below), which
// means a partial selection, and we're not updating a selection
// with the same client ID, abort. This means the selected block
// is a parent block.
if (end === undefined && getBlockRootClientId(clientId) !== getBlockRootClientId(getSelectionEnd().clientId)) {
return;
}
selection.start = {
clientId,
attributeKey: identifier,
offset: start
};
}
if (typeof end === 'number' || unset) {
if (start === undefined && getBlockRootClientId(clientId) !== getBlockRootClientId(getSelectionStart().clientId)) {
return;
}
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,
getValue,
onChange,
ref: richTextRef
} = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({
value: adjustedValue,
onChange(html, {
__unstableFormats,
__unstableText
}) {
adjustedOnChange(html);
Object.values(changeHandlers).forEach(changeHandler => {
changeHandler(__unstableFormats, __unstableText);
});
},
selectionStart,
selectionEnd,
onSelectionChange,
placeholder,
__unstableIsSelected: isSelected,
__unstableDisableFormats: disableFormats,
preserveWhiteSpace,
__unstableDependencies: [...dependencies, tagName],
__unstableAfterParse: addEditorOnlyFormats,
__unstableBeforeSerialize: removeEditorOnlyFormats,
__unstableAddInvisibleFormats: addInvisibleFormats
});
const autocompleteProps = useBlockEditorAutocompleteProps({
onReplace,
completers: autocompleters,
record: value,
onChange
});
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 onFocus() {
anchorRef.current?.focus();
}
const TagName = tagName;
return (0,external_React_.createElement)(external_React_.Fragment, null, isSelected && (0,external_React_.createElement)(keyboardShortcutContext.Provider, {
value: keyboardShortcuts
}, (0,external_React_.createElement)(inputEventContext.Provider, {
value: inputEvents
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Popover.__unstableSlotNameProvider, {
value: "__unstable-block-tools-after"
}, children && children({
value,
onChange,
onFocus
}), (0,external_React_.createElement)(FormatEdit, {
value: value,
onChange: onChange,
onFocus: onFocus,
formatTypes: formatTypes,
forwardedRef: anchorRef
})))), isSelected && hasFormats && (0,external_React_.createElement)(format_toolbar_container, {
inline: inlineToolbar,
editableContentElement: anchorRef.current,
value: value
}), (0,external_React_.createElement)(TagName
// Overridable props.
, {
role: "textbox",
"aria-multiline": !disableLineBreaks,
"aria-label": placeholder,
"aria-readonly": shouldDisableEditing,
...props,
...autocompleteProps,
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([
// Rich text ref must be first because its focus listener
// must be set up before any other ref calls .focus() on
// mount.
richTextRef, forwardedRef, autocompleteProps.ref, props.ref, useBeforeInputRules({
value,
onChange
}), useInputRules({
getValue,
onChange,
__unstableAllowPrefixTransformations,
formatTypes,
onReplace,
selectionChange
}), useInsertReplacementText(), useRemoveBrowserShortcuts(), useShortcuts(keyboardShortcuts), useInputEvents(inputEvents), useUndoAutomaticChange(), usePasteHandler({
isSelected,
disableFormats,
onChange,
value,
formatTypes,
tagName,
onReplace,
onSplit,
__unstableEmbedURLOnPaste,
pastePlainText
}), useDelete({
value,
onMerge,
onRemove
}), useEnter({
removeEditorOnlyFormats,
value,
onReplace,
onSplit,
onChange,
disableLineBreaks,
onSplitAtEnd,
onSplitAtDoubleLineEnd
}), useFirefoxCompat(), anchorRef]),
contentEditable: !shouldDisableEditing,
suppressContentEditableWarning: true,
className: classnames_default()('block-editor-rich-text__editable', props.className, 'rich-text')
// Setting tabIndex to 0 is unnecessary, the element is already
// focusable because it's contentEditable. This also fixes a
// Safari bug where it's not possible to Shift+Click multi
// select blocks when Shift Clicking into an element with
// tabIndex because Safari will focus the element. However,
// Safari will correctly ignore nested contentEditable elements.
,
tabIndex: props.tabIndex === 0 && !shouldDisableEditing ? null : props.tabIndex,
"data-wp-block-attribute-key": identifier
}));
}
// This is the private API for the RichText component.
// It allows access to all props, not just the public ones.
const PrivateRichText = withDeprecations((0,external_wp_element_namespaceObject.forwardRef)(RichTextWrapper));
PrivateRichText.Content = Content;
PrivateRichText.isEmpty = value => {
return !value || value.length === 0;
};
// This is the public API for the RichText component.
// We wrap the PrivateRichText component to hide some props from the public API.
/**
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md
*/
const PublicForwardedRichTextContainer = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
return (0,external_React_.createElement)(PrivateRichText, {
ref: ref,
...props,
disableEditing: false
});
});
PublicForwardedRichTextContainer.Content = Content;
PublicForwardedRichTextContainer.isEmpty = value => {
return !value || value.length === 0;
};
/* harmony default export */ const rich_text = (PublicForwardedRichTextContainer);
;// 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_React_.createElement)(rich_text, {
ref: ref,
...props,
__unstableDisableFormats: true
});
});
EditableText.Content = ({
value = '',
tagName: Tag = 'div',
...props
}) => {
return (0,external_React_.createElement)(Tag, {
...props
}, value);
};
/**
* Renders an editable text input in which text formatting is not allowed.
*/
/* harmony default export */ const 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)(({
__experimentalVersion,
...props
}, ref) => {
if (__experimentalVersion === 2) {
return (0,external_React_.createElement)(editable_text, {
ref: ref,
...props
});
}
const {
className,
onChange,
...remainingProps
} = props;
return (0,external_React_.createElement)(react_autosize_textarea_lib/* default */.A, {
ref: ref,
className: classnames_default()('block-editor-plain-text', className),
onChange: event => onChange(event.target.value),
...remainingProps
});
});
/* harmony default export */ const 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 = (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_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("span", {
"aria-describedby": `rbc-desc-${instanceId}`
}, viewport.label), (0,external_React_.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',
label: (0,external_wp_i18n_namespaceObject._x)('All', 'screen sizes')
},
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: %s: Property value for the control (eg: margin, padding, etc.). */
(0,external_wp_i18n_namespaceObject.__)('Use the same %s on all screensizes.'), property);
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_React_.createElement)(ResponsiveBlockControlLabel, {
property: property,
viewport: defaultLabel
}), defaultLabel);
const defaultResponsiveControls = () => {
return viewports.map(viewport => (0,external_React_.createElement)(external_wp_element_namespaceObject.Fragment, {
key: viewport.id
}, renderDefaultControl((0,external_React_.createElement)(ResponsiveBlockControlLabel, {
property: property,
viewport: viewport
}), viewport)));
};
return (0,external_React_.createElement)("fieldset", {
className: "block-editor-responsive-block-control"
}, (0,external_React_.createElement)("legend", {
className: "block-editor-responsive-block-control__title"
}, title), (0,external_React_.createElement)("div", {
className: "block-editor-responsive-block-control__inner"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
className: "block-editor-responsive-block-control__toggle",
label: toggleControlLabel,
checked: !isResponsive,
onChange: onIsResponsiveChange,
help: toggleHelpText
}), (0,external_React_.createElement)("div", {
className: classnames_default()('block-editor-responsive-block-control__group', {
'is-responsive': isResponsive
})
}, !isResponsive && defaultControl, isResponsive && (renderResponsiveControls ? renderResponsiveControls(viewports) : defaultResponsiveControls()))));
}
/* harmony default export */ const responsive_block_control = (ResponsiveBlockControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/shortcut.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function RichTextShortcut({
character,
type,
onUse
}) {
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({
name,
shortcutType,
shortcutCharacter,
...props
}) {
let shortcut;
let fillName = 'RichText.ToolbarControls';
if (name) {
fillName += `.${name}`;
}
if (shortcutType && shortcutCharacter) {
shortcut = external_wp_keycodes_namespaceObject.displayShortcut[shortcutType](shortcutCharacter);
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Fill, {
name: fillName
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
...props,
shortcut: shortcut
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/input-event.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function __unstableRichTextInputEvent({
inputType,
onInput
}) {
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_React_.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
width: "24",
height: "24",
viewBox: "0 0 24 24"
}, (0,external_React_.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 mode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).__unstableGetEditorMode(), []);
const {
__unstableSetEditorMode
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Dropdown, {
renderToggle: ({
isOpen,
onToggle
}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
...props,
ref: ref,
icon: mode === 'navigation' ? selectIcon : 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')
}),
popoverProps: {
placement: 'bottom-start'
},
renderContent: () => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.NavigableMenu, {
role: "menu",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Tools')
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
value: mode === 'navigation' ? 'navigation' : 'edit',
onSelect: __unstableSetEditorMode,
choices: [{
value: 'edit',
label: (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(build_module_icon, {
icon: edit
}), (0,external_wp_i18n_namespaceObject.__)('Edit'))
}, {
value: 'navigation',
label: (0,external_React_.createElement)(external_React_.Fragment, null, selectIcon, (0,external_wp_i18n_namespaceObject.__)('Select'))
}]
})), (0,external_React_.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 */ const 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({
units: unitsProp,
...props
}) {
const [availableUnits] = use_settings_useSettings('spacing.units');
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: availableUnits || ['%', 'px', 'em', 'rem', 'vw'],
units: unitsProp
});
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
units: units,
...props
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js
/**
* WordPress dependencies
*/
const arrowLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"
}));
/* harmony default export */ const 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_React_.createElement)("div", {
className: "block-editor-url-input__button"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: library_link,
label: buttonLabel,
onClick: this.toggle,
className: "components-toolbar__control",
isPressed: !!url
}), expanded && (0,external_React_.createElement)("form", {
className: "block-editor-url-input__button-modal",
onSubmit: this.submitLink
}, (0,external_React_.createElement)("div", {
className: "block-editor-url-input__button-modal-line"
}, (0,external_React_.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_React_.createElement)(url_input, {
__nextHasNoMarginBottom: true,
value: url || '',
onChange: onChange
}), (0,external_React_.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 */ const url_input_button = (URLInputButton);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/image.js
/**
* WordPress dependencies
*/
const image_image = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.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-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"
}));
/* harmony default export */ const library_image = (image_image);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/url-popover/image-url-input-ui.js
/**
* 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 ImageURLInputUI = ({
linkDestination,
onChangeUrl,
url,
mediaType = 'image',
mediaUrl,
mediaLink,
linkTarget,
linkClass,
rel,
showLightboxSetting,
lightboxEnabled,
onSetLightbox,
resetLightbox
}) => {
const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false);
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
const openLinkUI = () => {
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 wrapperRef = (0,external_wp_element_namespaceObject.useRef)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!wrapperRef.current) {
return;
}
const nextFocusTarget = external_wp_dom_namespaceObject.focus.focusable.find(wrapperRef.current)[0] || wrapperRef.current;
nextFocusTarget.focus();
}, [isEditingLink, url, lightboxEnabled]);
const startEditLink = () => {
if (linkDestination === LINK_DESTINATION_MEDIA || linkDestination === LINK_DESTINATION_ATTACHMENT) {
setUrlInput('');
}
setIsEditingLink(true);
};
const stopEditLink = () => {
setIsEditingLink(false);
};
const closeLinkUI = () => {
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 = () => {
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 = () => {
return event => {
if (urlInput) {
// It is possible the entered URL actually matches a named link destination.
// This check will ensure our link destination is correct.
const selectedDestination = getLinkDestinations().find(destination => destination.url === urlInput)?.linkDestination || LINK_DESTINATION_CUSTOM;
onChangeUrl({
href: urlInput,
linkDestination: selectedDestination,
lightbox: {
enabled: false
}
});
}
stopEditLink();
setUrlInput(null);
event.preventDefault();
};
};
const onLinkRemove = () => {
onChangeUrl({
linkDestination: LINK_DESTINATION_NONE,
href: ''
});
};
const getLinkDestinations = () => {
const linkDestinations = [{
linkDestination: LINK_DESTINATION_MEDIA,
title: (0,external_wp_i18n_namespaceObject.__)('Link to image file'),
url: mediaType === 'image' ? mediaUrl : undefined,
icon: library_image
}];
if (mediaType === 'image' && mediaLink) {
linkDestinations.push({
linkDestination: LINK_DESTINATION_ATTACHMENT,
title: (0,external_wp_i18n_namespaceObject.__)('Link to attachment page'),
url: mediaType === 'image' ? mediaLink : undefined,
icon: library_page
});
}
return linkDestinations;
};
const onSetHref = value => {
const linkDestinations = getLinkDestinations();
let linkDestinationInput;
if (!value) {
linkDestinationInput = LINK_DESTINATION_NONE;
} else {
linkDestinationInput = (linkDestinations.find(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_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: "3"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
onChange: onSetNewTab,
checked: linkTarget === '_blank'
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link rel'),
value: rel !== null && rel !== void 0 ? rel : '',
onChange: onSetLinkRel
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link CSS class'),
value: linkClass || '',
onChange: onSetLinkClass
}));
const linkEditorValue = urlInput !== null ? urlInput : url;
const hideLightboxPanel = !lightboxEnabled || lightboxEnabled && !showLightboxSetting;
const showLinkEditor = !linkEditorValue && hideLightboxPanel;
const urlLabel = (getLinkDestinations().find(destination => destination.linkDestination === linkDestination) || {}).title;
const PopoverChildren = () => {
if (lightboxEnabled && showLightboxSetting && !url && !isEditingLink) {
return (0,external_React_.createElement)("div", {
className: "block-editor-url-popover__expand-on-click"
}, (0,external_React_.createElement)(build_module_icon, {
icon: library_fullscreen
}), (0,external_React_.createElement)("div", {
className: "text"
}, (0,external_React_.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Expand on click')), (0,external_React_.createElement)("p", {
className: "description"
}, (0,external_wp_i18n_namespaceObject.__)('Scales the image with a lightbox effect'))), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: link_off,
label: (0,external_wp_i18n_namespaceObject.__)('Disable expand on click'),
onClick: () => {
onSetLightbox(false);
},
size: "compact"
}));
} else if (!url || isEditingLink) {
return (0,external_React_.createElement)(url_popover.LinkEditor, {
className: "block-editor-format-toolbar__link-container-content",
value: linkEditorValue,
onChangeInputValue: setUrlInput,
onSubmit: onSubmitLinkChange(),
autocompleteRef: autocompleteRef
});
} else if (url && !isEditingLink) {
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(url_popover.LinkViewer, {
className: "block-editor-format-toolbar__link-container-content",
url: url,
onEditLinkClick: startEditLink,
urlLabel: urlLabel
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: link_off,
label: (0,external_wp_i18n_namespaceObject.__)('Remove link'),
onClick: () => {
onLinkRemove();
resetLightbox();
},
size: "compact"
}));
}
};
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: library_link,
className: "components-toolbar__control",
label: (0,external_wp_i18n_namespaceObject.__)('Link'),
"aria-expanded": isOpen,
onClick: openLinkUI,
ref: setPopoverAnchor,
isActive: !!url || lightboxEnabled && showLightboxSetting
}), isOpen && (0,external_React_.createElement)(url_popover, {
ref: wrapperRef,
anchor: popoverAnchor,
onFocusOutside: onFocusOutside(),
onClose: closeLinkUI,
renderSettings: hideLightboxPanel ? () => advancedOptions : null,
additionalControls: showLinkEditor && (0,external_React_.createElement)(external_wp_components_namespaceObject.NavigableMenu, null, getLinkDestinations().map(link => (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
key: link.linkDestination,
icon: link.icon,
iconPosition: "left",
onClick: () => {
setUrlInput(null);
onSetHref(link.url);
stopEditLink();
}
}, link.title)), showLightboxSetting && (0,external_React_.createElement)(external_wp_components_namespaceObject.MenuItem, {
key: "expand-on-click",
className: "block-editor-url-popover__expand-on-click",
icon: library_fullscreen,
info: (0,external_wp_i18n_namespaceObject.__)('Scale the image with a lightbox effect.'),
iconPosition: "left",
onClick: () => {
setUrlInput(null);
onChangeUrl({
linkDestination: LINK_DESTINATION_NONE,
href: ''
});
onSetLightbox(true);
stopEditLink();
}
}, (0,external_wp_i18n_namespaceObject.__)('Expand on click'))),
offset: 13
}, PopoverChildren()));
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/preview-options/index.js
/**
* WordPress dependencies
*/
function PreviewOptions() {
external_wp_deprecated_default()('wp.blockEditor.PreviewOptions', {
version: '6.5'
});
return null;
}
;// 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';
const marginVertical = marginValue() + 'px';
const marginHorizontal = 'auto';
switch (device) {
case 'Tablet':
case 'Mobile':
return {
width: getCanvasWidth(device),
// Keeping margin styles separate to avoid warnings
// when those props get overridden in the iframe component
marginTop: marginVertical,
marginBottom: marginVertical,
marginLeft: marginHorizontal,
marginRight: marginHorizontal,
height,
borderRadius: '2px 2px 2px 2px',
border: '1px solid #ddd',
overflowY: 'auto'
};
default:
return {
marginLeft: marginHorizontal,
marginRight: marginHorizontal
};
}
};
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 ? (0,external_React_.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 */ const skip_to_selected_block = ((0,external_wp_data_namespaceObject.withSelect)(select => {
return {
selectedBlockClientId: select(store).getBlockSelectionStart()
};
})(SkipToSelectedBlock));
;// CONCATENATED MODULE: external ["wp","wordcount"]
const 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({
blocks
}) {
const words = (0,external_wp_wordcount_namespaceObject.count)((0,external_wp_blocks_namespaceObject.serialize)(blocks), 'words');
return (0,external_React_.createElement)("div", {
className: "block-editor-multi-selection-inspector__card"
}, (0,external_React_.createElement)(block_icon, {
icon: library_copy,
showColors: true
}), (0,external_React_.createElement)("div", {
className: "block-editor-multi-selection-inspector__card-content"
}, (0,external_React_.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_React_.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 selected.', '%d words selected.', words), words))));
}
/* harmony default export */ const 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({
blockName
}) {
const {
preferredStyle,
onUpdatePreferredStyleVariations,
styles
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _preferredStyleVariat;
const settings = select(store).getSettings();
const preferredStyleVariations = settings.__experimentalPreferredStyleVariations;
return {
preferredStyle: preferredStyleVariations?.value?.[blockName],
onUpdatePreferredStyleVariations: (_preferredStyleVariat = preferredStyleVariations?.onChange) !== null && _preferredStyleVariat !== void 0 ? _preferredStyleVariat : 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(({
label,
name
}) => ({
label,
value: name
}))], [styles]);
const defaultStyleName = (0,external_wp_element_namespaceObject.useMemo)(() => getDefaultStyle(styles)?.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_React_.createElement)("div", {
className: "default-style-picker__default-switcher"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
options: selectOptions,
value: preferredStyle || '',
label: (0,external_wp_i18n_namespaceObject.__)('Default Style'),
onChange: selectOnChange
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js
/**
* WordPress dependencies
*/
const cog = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",
clipRule: "evenodd"
}));
/* harmony default export */ const library_cog = (cog);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/styles.js
/**
* WordPress dependencies
*/
const styles = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z"
}));
/* harmony default export */ const library_styles = (styles);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/utils.js
/**
* WordPress dependencies
*/
const TAB_SETTINGS = {
name: 'settings',
title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
value: 'settings',
icon: library_cog,
className: 'block-editor-block-inspector__tab-item'
};
const TAB_STYLES = {
name: 'styles',
title: (0,external_wp_i18n_namespaceObject.__)('Styles'),
value: 'styles',
icon: library_styles,
className: 'block-editor-block-inspector__tab-item'
};
const TAB_LIST_VIEW = {
name: 'list',
title: (0,external_wp_i18n_namespaceObject.__)('List View'),
value: 'list-view',
icon: list_view,
className: 'block-editor-block-inspector__tab-item'
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/advanced-controls-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const AdvancedControls = () => {
const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(InspectorAdvancedControls.slotName);
const hasFills = Boolean(fills && fills.length);
if (!hasFills) {
return null;
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
className: "block-editor-block-inspector__advanced",
title: (0,external_wp_i18n_namespaceObject.__)('Advanced'),
initialOpen: false
}, (0,external_React_.createElement)(inspector_controls.Slot, {
group: "advanced"
}));
};
/* harmony default export */ const advanced_controls_panel = (AdvancedControls);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/position-controls-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const PositionControlsPanel = () => {
const [initialOpen, setInitialOpen] = (0,external_wp_element_namespaceObject.useState)();
// Determine whether the panel should be expanded.
const {
multiSelectedBlocks
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlocksByClientId,
getSelectedBlockClientIds
} = select(store);
const clientIds = getSelectedBlockClientIds();
return {
multiSelectedBlocks: getBlocksByClientId(clientIds)
};
}, []);
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
// If any selected block has a position set, open the panel by default.
// The first block's value will still be used within the control though.
if (initialOpen === undefined) {
setInitialOpen(multiSelectedBlocks.some(({
attributes
}) => !!attributes?.style?.position?.type));
}
}, [initialOpen, multiSelectedBlocks, setInitialOpen]);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
className: "block-editor-block-inspector__position",
title: (0,external_wp_i18n_namespaceObject.__)('Position'),
initialOpen: initialOpen !== null && initialOpen !== void 0 ? initialOpen : false
}, (0,external_React_.createElement)(inspector_controls.Slot, {
group: "position"
}));
};
const PositionControls = () => {
const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(inspector_controls_groups.position.Slot.__unstableName);
const hasFills = Boolean(fills && fills.length);
if (!hasFills) {
return null;
}
return (0,external_React_.createElement)(PositionControlsPanel, null);
};
/* harmony default export */ const position_controls_panel = (PositionControls);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
/**
* WordPress dependencies
*/
const close_close = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const library_close = (close_close);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/settings-tab-hint.js
/**
* WordPress dependencies
*/
const PREFERENCE_NAME = 'isInspectorControlsTabsHintVisible';
function InspectorControlsTabsHint() {
const isInspectorControlsTabsHintVisible = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _select$get;
return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', PREFERENCE_NAME)) !== null && _select$get !== void 0 ? _select$get : true;
}, []);
const ref = (0,external_wp_element_namespaceObject.useRef)();
const {
set: setPreference
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
if (!isInspectorControlsTabsHintVisible) {
return null;
}
return (0,external_React_.createElement)("div", {
ref: ref,
className: "block-editor-inspector-controls-tabs__hint"
}, (0,external_React_.createElement)("div", {
className: "block-editor-inspector-controls-tabs__hint-content"
}, (0,external_wp_i18n_namespaceObject.__)("Looking for other block settings? They've moved to the styles tab.")), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
className: "block-editor-inspector-controls-tabs__hint-dismiss",
icon: library_close,
iconSize: "16",
label: (0,external_wp_i18n_namespaceObject.__)('Dismiss hint'),
onClick: () => {
// Retain focus when dismissing the element.
const previousElement = external_wp_dom_namespaceObject.focus.tabbable.findPrevious(ref.current);
previousElement?.focus();
setPreference('core', PREFERENCE_NAME, false);
},
showTooltip: false
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/settings-tab.js
/**
* Internal dependencies
*/
const SettingsTab = ({
showAdvancedControls = false
}) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(inspector_controls.Slot, null), (0,external_React_.createElement)(position_controls_panel, null), showAdvancedControls && (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(advanced_controls_panel, null)), (0,external_React_.createElement)(InspectorControlsTabsHint, null));
/* harmony default export */ const settings_tab = (SettingsTab);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/styles-tab.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const StylesTab = ({
blockName,
clientId,
hasBlockStyles
}) => {
const borderPanelLabel = useBorderPanelLabel({
blockName
});
return (0,external_React_.createElement)(external_React_.Fragment, null, hasBlockStyles && (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Styles')
}, (0,external_React_.createElement)(block_styles, {
clientId: clientId
}), (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'defaultStylePicker', true) && (0,external_React_.createElement)(DefaultStylePicker, {
blockName: blockName
}))), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "color",
label: (0,external_wp_i18n_namespaceObject.__)('Color'),
className: "color-block-support-panel__inner-wrapper"
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "background",
label: (0,external_wp_i18n_namespaceObject.__)('Background')
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "filter"
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "typography",
label: (0,external_wp_i18n_namespaceObject.__)('Typography')
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "dimensions",
label: (0,external_wp_i18n_namespaceObject.__)('Dimensions')
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "border",
label: borderPanelLabel
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "styles"
}));
};
/* harmony default export */ const styles_tab = (StylesTab);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js
// List view tab restricts the blocks that may render to it via the
// allowlist below.
const allowlist = ['core/navigation'];
const useIsListViewTabDisabled = blockName => {
return !allowlist.includes(blockName);
};
/* harmony default export */ const use_is_list_view_tab_disabled = (useIsListViewTabDisabled);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
Tabs: inspector_controls_tabs_Tabs
} = unlock(external_wp_components_namespaceObject.privateApis);
function InspectorControlsTabs({
blockName,
clientId,
hasBlockStyles,
tabs
}) {
// The tabs panel will mount before fills are rendered to the list view
// slot. This means the list view tab isn't initially included in the
// available tabs so the panel defaults selection to the settings tab
// which at the time is the first tab. This check allows blocks known to
// include the list view tab to set it as the tab selected by default.
const initialTabName = !use_is_list_view_tab_disabled(blockName) ? TAB_LIST_VIEW.name : undefined;
return (0,external_React_.createElement)("div", {
className: "block-editor-block-inspector__tabs"
}, (0,external_React_.createElement)(inspector_controls_tabs_Tabs, {
initialTabId: initialTabName,
key: clientId
}, (0,external_React_.createElement)(inspector_controls_tabs_Tabs.TabList, null, tabs.map(tab => (0,external_React_.createElement)(inspector_controls_tabs_Tabs.Tab, {
key: tab.name,
tabId: tab.name,
render: (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
icon: tab.icon,
label: tab.title,
className: tab.className
})
}))), (0,external_React_.createElement)(inspector_controls_tabs_Tabs.TabPanel, {
tabId: TAB_SETTINGS.name,
focusable: false
}, (0,external_React_.createElement)(settings_tab, {
showAdvancedControls: !!blockName
})), (0,external_React_.createElement)(inspector_controls_tabs_Tabs.TabPanel, {
tabId: TAB_STYLES.name,
focusable: false
}, (0,external_React_.createElement)(styles_tab, {
blockName: blockName,
clientId: clientId,
hasBlockStyles: hasBlockStyles
})), (0,external_React_.createElement)(inspector_controls_tabs_Tabs.TabPanel, {
tabId: TAB_LIST_VIEW.name,
focusable: false
}, (0,external_React_.createElement)(inspector_controls.Slot, {
group: "list"
}))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const use_inspector_controls_tabs_EMPTY_ARRAY = [];
function getShowTabs(blockName, tabSettings = {}) {
// Block specific setting takes precedence over generic default.
if (tabSettings[blockName] !== undefined) {
return tabSettings[blockName];
}
// Use generic default if set over the Gutenberg experiment option.
if (tabSettings.default !== undefined) {
return tabSettings.default;
}
return true;
}
function useInspectorControlsTabs(blockName) {
const tabs = [];
const {
border: borderGroup,
color: colorGroup,
default: defaultGroup,
dimensions: dimensionsGroup,
list: listGroup,
position: positionGroup,
styles: stylesGroup,
typography: typographyGroup,
effects: effectsGroup
} = inspector_controls_groups;
// List View Tab: If there are any fills for the list group add that tab.
const listViewDisabled = use_is_list_view_tab_disabled(blockName);
const listFills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(listGroup.Slot.__unstableName);
const hasListFills = !listViewDisabled && !!listFills && listFills.length;
// Styles Tab: Add this tab if there are any fills for block supports
// e.g. border, color, spacing, typography, etc.
const styleFills = [...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(borderGroup.Slot.__unstableName) || []), ...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(colorGroup.Slot.__unstableName) || []), ...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(dimensionsGroup.Slot.__unstableName) || []), ...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(stylesGroup.Slot.__unstableName) || []), ...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(typographyGroup.Slot.__unstableName) || []), ...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(effectsGroup.Slot.__unstableName) || [])];
const hasStyleFills = styleFills.length;
// Settings Tab: If we don't have multiple tabs to display
// (i.e. both list view and styles), check only the default and position
// InspectorControls slots. If we have multiple tabs, we'll need to check
// the advanced controls slot as well to ensure they are rendered.
const advancedFills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(InspectorAdvancedControls.slotName) || [];
const settingsFills = [...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(defaultGroup.Slot.__unstableName) || []), ...((0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(positionGroup.Slot.__unstableName) || []), ...(hasListFills && hasStyleFills > 1 ? advancedFills : [])];
// Add the tabs in the order that they will default to if available.
// List View > Settings > Styles.
if (hasListFills) {
tabs.push(TAB_LIST_VIEW);
}
if (settingsFills.length) {
tabs.push(TAB_SETTINGS);
}
if (hasStyleFills) {
tabs.push(TAB_STYLES);
}
const tabSettings = (0,external_wp_data_namespaceObject.useSelect)(select => {
return select(store).getSettings().blockInspectorTabs;
}, []);
const showTabs = getShowTabs(blockName, tabSettings);
return showTabs ? tabs : use_inspector_controls_tabs_EMPTY_ARRAY;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useBlockInspectorAnimationSettings(blockType, selectedBlockClientId) {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
if (blockType) {
const globalBlockInspectorAnimationSettings = select(store).getSettings().blockInspectorAnimation;
// Get the name of the block that will allow it's children to be animated.
const animationParent = globalBlockInspectorAnimationSettings?.animationParent;
// Determine whether the animationParent block is a parent of the selected block.
const {
getSelectedBlockClientId,
getBlockParentsByBlockName
} = select(store);
const _selectedBlockClientId = getSelectedBlockClientId();
const animationParentBlockClientId = getBlockParentsByBlockName(_selectedBlockClientId, animationParent, true)[0];
// If the selected block is not a child of the animationParent block,
// and not an animationParent block itself, don't animate.
if (!animationParentBlockClientId && blockType.name !== animationParent) {
return null;
}
return globalBlockInspectorAnimationSettings?.[blockType.name];
}
return null;
}, [selectedBlockClientId, blockType]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-info-slot-fill/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
createPrivateSlotFill
} = unlock(external_wp_components_namespaceObject.privateApis);
const {
Fill: block_info_slot_fill_Fill,
Slot: block_info_slot_fill_Slot
} = createPrivateSlotFill('BlockInformation');
const BlockInfo = props => {
const context = useBlockEditContext();
if (!context[mayDisplayControlsKey]) {
return null;
}
return (0,external_React_.createElement)(block_info_slot_fill_Fill, {
...props
});
};
BlockInfo.Slot = props => (0,external_React_.createElement)(block_info_slot_fill_Slot, {
...props
});
/* harmony default export */ const block_info_slot_fill = (BlockInfo);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-quick-navigation/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockQuickNavigation({
clientIds
}) {
if (!clientIds.length) {
return null;
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 1
}, clientIds.map(clientId => (0,external_React_.createElement)(BlockQuickNavigationItem, {
key: clientId,
clientId: clientId
})));
}
function BlockQuickNavigationItem({
clientId
}) {
const {
name,
icon,
isSelected
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockName,
getBlockAttributes,
isBlockSelected,
hasSelectedInnerBlock
} = select(store);
const {
getBlockType
} = select(external_wp_blocks_namespaceObject.store);
const blockType = getBlockType(getBlockName(clientId));
const attributes = getBlockAttributes(clientId);
return {
name: blockType && (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes, 'list-view'),
icon: blockType?.icon,
isSelected: isBlockSelected(clientId) || hasSelectedInnerBlock(clientId, /* deep: */true)
};
}, [clientId]);
const {
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
isPressed: isSelected,
onClick: () => selectBlock(clientId)
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_.createElement)(block_icon, {
icon: icon
})), (0,external_React_.createElement)(external_wp_components_namespaceObject.FlexBlock, {
style: {
textAlign: 'left'
}
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, null, name))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-inspector/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockInspectorLockedBlocks({
topLevelLockedBlock
}) {
const contentClientIds = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getClientIdsOfDescendants,
getBlockName,
getBlockEditingMode
} = select(store);
return getClientIdsOfDescendants(topLevelLockedBlock).filter(clientId => getBlockName(clientId) !== 'core/list-item' && getBlockEditingMode(clientId) === 'contentOnly');
}, [topLevelLockedBlock]);
const blockInformation = useBlockDisplayInformation(topLevelLockedBlock);
return (0,external_React_.createElement)("div", {
className: "block-editor-block-inspector"
}, (0,external_React_.createElement)(block_card, {
...blockInformation,
className: blockInformation.isSynced && 'is-synced'
}), (0,external_React_.createElement)(block_variation_transforms, {
blockClientId: topLevelLockedBlock
}), (0,external_React_.createElement)(block_info_slot_fill.Slot, null), contentClientIds.length > 0 && (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Content')
}, (0,external_React_.createElement)(BlockQuickNavigation, {
clientIds: contentClientIds
})));
}
const BlockInspector = ({
showNoBlockSelectedMessage = true
}) => {
const {
count,
selectedBlockName,
selectedBlockClientId,
blockType,
topLevelLockedBlock
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSelectedBlockClientId,
getSelectedBlockCount,
getBlockName,
__unstableGetContentLockingParent,
getTemplateLock
} = select(store);
const _selectedBlockClientId = getSelectedBlockClientId();
const _selectedBlockName = _selectedBlockClientId && getBlockName(_selectedBlockClientId);
const _blockType = _selectedBlockName && (0,external_wp_blocks_namespaceObject.getBlockType)(_selectedBlockName);
return {
count: getSelectedBlockCount(),
selectedBlockClientId: _selectedBlockClientId,
selectedBlockName: _selectedBlockName,
blockType: _blockType,
topLevelLockedBlock: __unstableGetContentLockingParent(_selectedBlockClientId) || (getTemplateLock(_selectedBlockClientId) === 'contentOnly' || _selectedBlockName === 'core/block' ? _selectedBlockClientId : undefined)
};
}, []);
const availableTabs = useInspectorControlsTabs(blockType?.name);
const showTabs = availableTabs?.length > 1;
// The block inspector animation settings will be completely
// removed in the future to create an API which allows the block
// inspector to transition between what it
// displays based on the relationship between the selected block
// and its parent, and only enable it if the parent is controlling
// its children blocks.
const blockInspectorAnimationSettings = useBlockInspectorAnimationSettings(blockType, selectedBlockClientId);
const borderPanelLabel = useBorderPanelLabel({
blockName: selectedBlockName
});
if (count > 1) {
return (0,external_React_.createElement)("div", {
className: "block-editor-block-inspector"
}, (0,external_React_.createElement)(multi_selection_inspector, null), showTabs ? (0,external_React_.createElement)(InspectorControlsTabs, {
tabs: availableTabs
}) : (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(inspector_controls.Slot, null), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "color",
label: (0,external_wp_i18n_namespaceObject.__)('Color'),
className: "color-block-support-panel__inner-wrapper"
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "typography",
label: (0,external_wp_i18n_namespaceObject.__)('Typography')
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "dimensions",
label: (0,external_wp_i18n_namespaceObject.__)('Dimensions')
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "border",
label: borderPanelLabel
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "styles"
})));
}
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_React_.createElement)("span", {
className: "block-editor-block-inspector__no-blocks"
}, (0,external_wp_i18n_namespaceObject.__)('No block selected.'));
}
return null;
}
if (topLevelLockedBlock) {
return (0,external_React_.createElement)(BlockInspectorLockedBlocks, {
topLevelLockedBlock: topLevelLockedBlock
});
}
return (0,external_React_.createElement)(BlockInspectorSingleBlockWrapper, {
animate: blockInspectorAnimationSettings,
wrapper: children => (0,external_React_.createElement)(AnimatedContainer, {
blockInspectorAnimationSettings: blockInspectorAnimationSettings,
selectedBlockClientId: selectedBlockClientId
}, children)
}, (0,external_React_.createElement)(BlockInspectorSingleBlock, {
clientId: selectedBlockClientId,
blockName: blockType.name
}));
};
const BlockInspectorSingleBlockWrapper = ({
animate,
wrapper,
children
}) => {
return animate ? wrapper(children) : children;
};
const AnimatedContainer = ({
blockInspectorAnimationSettings,
selectedBlockClientId,
children
}) => {
const animationOrigin = blockInspectorAnimationSettings && blockInspectorAnimationSettings.enterDirection === 'leftToRight' ? -50 : 50;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
animate: {
x: 0,
opacity: 1,
transition: {
ease: 'easeInOut',
duration: 0.14
}
},
initial: {
x: animationOrigin,
opacity: 0
},
key: selectedBlockClientId
}, children);
};
const BlockInspectorSingleBlock = ({
clientId,
blockName
}) => {
const availableTabs = useInspectorControlsTabs(blockName);
const showTabs = availableTabs?.length > 1;
const hasBlockStyles = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockStyles
} = select(external_wp_blocks_namespaceObject.store);
const blockStyles = getBlockStyles(blockName);
return blockStyles && blockStyles.length > 0;
}, [blockName]);
const blockInformation = useBlockDisplayInformation(clientId);
const borderPanelLabel = useBorderPanelLabel({
blockName
});
return (0,external_React_.createElement)("div", {
className: "block-editor-block-inspector"
}, (0,external_React_.createElement)(block_card, {
...blockInformation,
className: blockInformation.isSynced && 'is-synced'
}), (0,external_React_.createElement)(block_variation_transforms, {
blockClientId: clientId
}), (0,external_React_.createElement)(block_info_slot_fill.Slot, null), showTabs && (0,external_React_.createElement)(InspectorControlsTabs, {
hasBlockStyles: hasBlockStyles,
clientId: clientId,
blockName: blockName,
tabs: availableTabs
}), !showTabs && (0,external_React_.createElement)(external_React_.Fragment, null, hasBlockStyles && (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Styles')
}, (0,external_React_.createElement)(block_styles, {
clientId: clientId
}), (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'defaultStylePicker', true) && (0,external_React_.createElement)(DefaultStylePicker, {
blockName: blockName
}))), (0,external_React_.createElement)(inspector_controls.Slot, null), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "list"
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "color",
label: (0,external_wp_i18n_namespaceObject.__)('Color'),
className: "color-block-support-panel__inner-wrapper"
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "typography",
label: (0,external_wp_i18n_namespaceObject.__)('Typography')
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "dimensions",
label: (0,external_wp_i18n_namespaceObject.__)('Dimensions')
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "border",
label: borderPanelLabel
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "styles"
}), (0,external_React_.createElement)(inspector_controls.Slot, {
group: "background",
label: (0,external_wp_i18n_namespaceObject.__)('Background')
}), (0,external_React_.createElement)(position_controls_panel, null), (0,external_React_.createElement)("div", null, (0,external_React_.createElement)(advanced_controls_panel, null))), (0,external_React_.createElement)(skip_to_selected_block, {
key: "back"
}));
};
/**
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-inspector/README.md
*/
/* harmony default export */ const block_inspector = (BlockInspector);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/copy-handler/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @deprecated
*/
const __unstableUseClipboardHandler = () => {
external_wp_deprecated_default()('__unstableUseClipboardHandler', {
alternative: 'BlockCanvas or WritingFlow',
since: '6.4',
version: '6.7'
});
return useClipboardHandler();
};
/**
* @deprecated
* @param {Object} props
*/
function CopyHandler(props) {
external_wp_deprecated_default()('CopyHandler', {
alternative: 'BlockCanvas or WritingFlow',
since: '6.4',
version: '6.7'
});
return (0,external_React_.createElement)("div", {
...props,
ref: useClipboardHandler()
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/library.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const library_noop = () => {};
function InserterLibrary({
rootClientId,
clientId,
isAppender,
showInserterHelpPanel,
showMostUsedBlocks = false,
__experimentalInsertionIndex,
__experimentalFilterValue,
onSelect = library_noop,
shouldFocusBlock = false
}, ref) {
const {
destinationRootClientId
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockRootClientId
} = select(store);
const _rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined;
return {
destinationRootClientId: _rootClientId
};
}, [clientId, rootClientId]);
return (0,external_React_.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 */ const library = ((0,external_wp_element_namespaceObject.forwardRef)(InserterLibrary));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/selection-scroll-into-view/index.js
/**
* WordPress dependencies
*/
/**
* Scrolls the multi block selection end into view if not in view already. This
* is important to do after selection by keyboard.
*
* @deprecated
*/
function MultiSelectScrollIntoView() {
external_wp_deprecated_default()('wp.blockEditor.MultiSelectScrollIntoView', {
hint: 'This behaviour is now built-in.',
since: '5.8'
});
return null;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/typewriter/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const isIE = window.navigator.userAgent.indexOf('Trident') !== -1;
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 = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).hasSelectedBlock(), []);
return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
if (!hasSelectedBlock) {
return;
}
const {
ownerDocument
} = node;
const {
defaultView
} = ownerDocument;
let scrollResizeRafId;
let onKeyDownRafId;
let caretRect;
function onScrollResize() {
if (scrollResizeRafId) {
return;
}
scrollResizeRafId = defaultView.requestAnimationFrame(() => {
computeCaretRectangle();
scrollResizeRafId = null;
});
}
function onKeyDown(event) {
// Ensure the any remaining request is cancelled.
if (onKeyDownRafId) {
defaultView.cancelAnimationFrame(onKeyDownRafId);
}
// Use an animation frame for a smooth result.
onKeyDownRafId = defaultView.requestAnimationFrame(() => {
maintainCaretPosition(event);
onKeyDownRafId = null;
});
}
/**
* Maintains the scroll position after a selection change caused by a
* keyboard event.
*
* @param {KeyboardEvent} event Keyboard event.
*/
function maintainCaretPosition({
keyCode
}) {
if (!isSelectionEligibleForScroll()) {
return;
}
const currentCaretRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView);
if (!currentCaretRect) {
return;
}
// If for some reason there is no position set to be scrolled to, let
// this be the position to be scrolled to in the future.
if (!caretRect) {
caretRect = currentCaretRect;
return;
}
// Even though enabling the typewriter effect for arrow keys results in
// a pleasant experience, it may not be the case for everyone, so, for
// now, let's disable it.
if (arrowKeyCodes.has(keyCode)) {
// Reset the caret position to maintain.
caretRect = currentCaretRect;
return;
}
const diff = currentCaretRect.top - caretRect.top;
if (diff === 0) {
return;
}
const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(node);
// The page must be scrollable.
if (!scrollContainer) {
return;
}
const windowScroll = scrollContainer === ownerDocument.body || scrollContainer === ownerDocument.documentElement;
const scrollY = windowScroll ? defaultView.scrollY : scrollContainer.scrollTop;
const scrollContainerY = windowScroll ? 0 : scrollContainer.getBoundingClientRect().top;
const relativeScrollPosition = windowScroll ? caretRect.top / defaultView.innerHeight : (caretRect.top - scrollContainerY) / (defaultView.innerHeight - scrollContainerY);
// If the scroll position is at the start, the active editable element
// is the last one, and the caret is positioned within the initial
// trigger percentage of the page, do not scroll the page.
// The typewriter effect should not kick in until an empty page has been
// filled with the initial trigger percentage or the user scrolls
// intentionally down.
if (scrollY === 0 && relativeScrollPosition < initialTriggerPercentage && isLastEditableNode()) {
// Reset the caret position to maintain.
caretRect = currentCaretRect;
return;
}
const scrollContainerHeight = windowScroll ? defaultView.innerHeight : scrollContainer.clientHeight;
// Abort if the target scroll position would scroll the caret out of
// view.
if (
// The caret is under the lower fold.
caretRect.top + caretRect.height > scrollContainerY + scrollContainerHeight ||
// The caret is above the upper fold.
caretRect.top < scrollContainerY) {
// Reset the caret position to maintain.
caretRect = currentCaretRect;
return;
}
if (windowScroll) {
defaultView.scrollBy(0, diff);
} else {
scrollContainer.scrollTop += diff;
}
}
/**
* Adds a `selectionchange` listener to reset the scroll position to be
* maintained.
*/
function addSelectionChangeListener() {
ownerDocument.addEventListener('selectionchange', computeCaretRectOnSelectionChange);
}
/**
* Resets the scroll position to be maintained during a `selectionchange`
* event. Also removes the listener, so it acts as a one-time listener.
*/
function computeCaretRectOnSelectionChange() {
ownerDocument.removeEventListener('selectionchange', computeCaretRectOnSelectionChange);
computeCaretRectangle();
}
/**
* Resets the scroll position to be maintained.
*/
function computeCaretRectangle() {
if (isSelectionEligibleForScroll()) {
caretRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView);
}
}
/**
* Checks if the current situation is elegible for scroll:
* - There should be one and only one block selected.
* - The component must contain the selection.
* - The active element must be contenteditable.
*/
function isSelectionEligibleForScroll() {
return node.contains(ownerDocument.activeElement) && ownerDocument.activeElement.isContentEditable;
}
function isLastEditableNode() {
const editableNodes = node.querySelectorAll('[contenteditable="true"]');
const lastEditableNode = editableNodes[editableNodes.length - 1];
return lastEditableNode === ownerDocument.activeElement;
}
// When the user scrolls or resizes, the scroll position should be
// reset.
defaultView.addEventListener('scroll', onScrollResize, true);
defaultView.addEventListener('resize', onScrollResize, true);
node.addEventListener('keydown', onKeyDown);
node.addEventListener('keyup', maintainCaretPosition);
node.addEventListener('mousedown', addSelectionChangeListener);
node.addEventListener('touchstart', addSelectionChangeListener);
return () => {
defaultView.removeEventListener('scroll', onScrollResize, true);
defaultView.removeEventListener('resize', onScrollResize, true);
node.removeEventListener('keydown', onKeyDown);
node.removeEventListener('keyup', maintainCaretPosition);
node.removeEventListener('mousedown', addSelectionChangeListener);
node.removeEventListener('touchstart', addSelectionChangeListener);
ownerDocument.removeEventListener('selectionchange', computeCaretRectOnSelectionChange);
defaultView.cancelAnimationFrame(scrollResizeRafId);
defaultView.cancelAnimationFrame(onKeyDownRafId);
};
}, [hasSelectedBlock]);
}
function Typewriter({
children
}) {
return (0,external_React_.createElement)("div", {
ref: useTypewriter(),
className: "block-editor__typewriter"
}, children);
}
/**
* The exported component. The implementation of Typewriter faced technical
* challenges in Internet Explorer, and is simply skipped, rendering the given
* props children instead.
*
* @type {Component}
*/
const TypewriterOrIEBypass = isIE ? props => props.children : Typewriter;
/**
* Ensures that the text selection keeps the same vertical distance from the
* viewport during keyboard events within this component. The vertical distance
* can vary. It is the last clicked or scrolled to position.
*/
/* harmony default export */ const typewriter = (TypewriterOrIEBypass);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/recursion-provider/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.
*
* @return {Object} The list of rendered blocks grouped by block name.
*/
function addToBlockType(renderedBlocks, blockName, uniqueId) {
const result = {
...renderedBlocks,
[blockName]: renderedBlocks[blockName] ? new Set(renderedBlocks[blockName]) : new Set()
};
result[blockName].add(uniqueId);
return result;
}
/**
* A React context provider for use with the `useHasRecursion` hook to prevent recursive
* renders.
*
* Wrap block content with this provider and provide the same `uniqueId` prop as used
* with `useHasRecursion`.
*
* @param {Object} props
* @param {*} props.uniqueId Any value that acts as a unique identifier for a block instance.
* @param {string} props.blockName Optional block name.
* @param {JSX.Element} props.children React children.
*
* @return {JSX.Element} A React element.
*/
function RecursionProvider({
children,
uniqueId,
blockName = ''
}) {
const previouslyRenderedBlocks = (0,external_wp_element_namespaceObject.useContext)(RenderedRefsContext);
const {
name
} = useBlockEditContext();
blockName = blockName || name;
const newRenderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => addToBlockType(previouslyRenderedBlocks, blockName, uniqueId), [previouslyRenderedBlocks, blockName, uniqueId]);
return (0,external_React_.createElement)(RenderedRefsContext.Provider, {
value: newRenderedBlocks
}, children);
}
/**
* A React hook for keeping track of blocks previously rendered up in the block
* tree. Blocks susceptible to recursion can use this hook in their `Edit`
* function to prevent said recursion.
*
* Use this with the `RecursionProvider` component, using the same `uniqueId` value
* for both the hook and the provider.
*
* @param {*} uniqueId Any value that acts as a unique identifier for a block instance.
* @param {string} blockName Optional block name.
*
* @return {boolean} A boolean describing whether the provided id has already been rendered.
*/
function useHasRecursion(uniqueId, blockName = '') {
const previouslyRenderedBlocks = (0,external_wp_element_namespaceObject.useContext)(RenderedRefsContext);
const {
name
} = useBlockEditContext();
blockName = blockName || name;
return Boolean(previouslyRenderedBlocks[blockName]?.has(uniqueId));
}
const DeprecatedExperimentalRecursionProvider = props => {
external_wp_deprecated_default()('wp.blockEditor.__experimentalRecursionProvider', {
since: '6.5',
alternative: 'wp.blockEditor.RecursionProvider'
});
return (0,external_React_.createElement)(RecursionProvider, {
...props
});
};
const DeprecatedExperimentalUseHasRecursion = (...args) => {
external_wp_deprecated_default()('wp.blockEditor.__experimentalUseHasRecursion', {
since: '6.5',
alternative: 'wp.blockEditor.useHasRecursion'
});
return useHasRecursion(...args);
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
/**
* WordPress dependencies
*/
const closeSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.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 */ const close_small = (closeSmall);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inspector-popover-header/index.js
/**
* WordPress dependencies
*/
function InspectorPopoverHeader({
title,
help,
actions = [],
onClose
}) {
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
className: "block-editor-inspector-popover-header",
spacing: 4
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
alignment: "center"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
className: "block-editor-inspector-popover-header__heading",
level: 2,
size: 13
}, title), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, null), actions.map(({
label,
icon,
onClick
}) => (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
key: label,
className: "block-editor-inspector-popover-header__action",
label: label,
icon: icon,
variant: !icon && 'tertiary',
onClick: onClick
}, !icon && label)), onClose && (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
className: "block-editor-inspector-popover-header__action",
label: (0,external_wp_i18n_namespaceObject.__)('Close'),
icon: close_small,
onClick: onClose
})), help && (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalText, null, help));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/publish-date-time-picker/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PublishDateTimePicker({
onClose,
onChange,
...additionalProps
}, ref) {
return (0,external_React_.createElement)("div", {
ref: ref,
className: "block-editor-publish-date-time-picker"
}, (0,external_React_.createElement)(InspectorPopoverHeader, {
title: (0,external_wp_i18n_namespaceObject.__)('Publish'),
actions: [{
label: (0,external_wp_i18n_namespaceObject.__)('Now'),
onClick: () => onChange?.(null)
}],
onClose: onClose
}), (0,external_React_.createElement)(external_wp_components_namespaceObject.DateTimePicker, {
startOfWeek: (0,external_wp_date_namespaceObject.getSettings)().l10n.startOfWeek,
onChange: onChange,
...additionalProps
}));
}
/* harmony default export */ const publish_date_time_picker = ((0,external_wp_element_namespaceObject.forwardRef)(PublishDateTimePicker));
;// CONCATENATED MODULE: external ["wp","commands"]
const external_wp_commands_namespaceObject = window["wp"]["commands"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/move-to.js
/**
* WordPress dependencies
*/
const move_to_moveTo = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z"
}));
/* harmony default export */ const move_to = (move_to_moveTo);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/ungroup.js
/**
* WordPress dependencies
*/
const ungroup = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M18 4h-7c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7zm-5 5c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h1V9H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-1h-1.5v1z"
}));
/* harmony default export */ const library_ungroup = (ungroup);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/trash.js
/**
* WordPress dependencies
*/
const trash = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"
}));
/* harmony default export */ const library_trash = (trash);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-block-commands/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const useTransformCommands = () => {
const {
replaceBlocks,
multiSelect
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const {
blocks,
clientIds,
canRemove,
possibleBlockTransformations
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockRootClientId,
getBlockTransformItems,
getSelectedBlockClientIds,
getBlocksByClientId,
canRemoveBlocks
} = select(store);
const selectedBlockClientIds = getSelectedBlockClientIds();
const selectedBlocks = getBlocksByClientId(selectedBlockClientIds);
const rootClientId = getBlockRootClientId(selectedBlockClientIds[0]);
return {
blocks: selectedBlocks,
clientIds: selectedBlockClientIds,
possibleBlockTransformations: getBlockTransformItems(selectedBlocks, rootClientId),
canRemove: canRemoveBlocks(selectedBlockClientIds, rootClientId)
};
}, []);
const isTemplate = blocks.length === 1 && (0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]);
function selectForMultipleBlocks(insertedBlocks) {
if (insertedBlocks.length > 1) {
multiSelect(insertedBlocks[0].clientId, insertedBlocks[insertedBlocks.length - 1].clientId);
}
}
// Simple block tranformation based on the `Block Transforms` API.
function onBlockTransform(name) {
const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name);
replaceBlocks(clientIds, newBlocks);
selectForMultipleBlocks(newBlocks);
}
/**
* The `isTemplate` check is a stopgap solution here.
* Ideally, the Transforms API should handle this
* by allowing to exclude blocks from wildcard transformations.
*/
const hasPossibleBlockTransformations = !!possibleBlockTransformations.length && canRemove && !isTemplate;
if (!clientIds || clientIds.length < 1 || !hasPossibleBlockTransformations) {
return {
isLoading: false,
commands: []
};
}
const commands = possibleBlockTransformations.map(transformation => {
const {
name,
title,
icon
} = transformation;
return {
name: 'core/block-editor/transform-to-' + name.replace('/', '-'),
// translators: %s: block title/name.
label: (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Transform to %s'), title),
icon: (0,external_React_.createElement)(block_icon, {
icon: icon
}),
callback: ({
close
}) => {
onBlockTransform(name);
close();
}
};
});
return {
isLoading: false,
commands
};
};
const useActionsCommands = () => {
const {
clientIds
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSelectedBlockClientIds
} = select(store);
const selectedBlockClientIds = getSelectedBlockClientIds();
return {
clientIds: selectedBlockClientIds
};
}, []);
const {
getBlockRootClientId,
canMoveBlocks,
getBlockCount
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const {
setBlockMovingClientId,
setNavigationMode,
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
if (!clientIds || clientIds.length < 1) {
return {
isLoading: false,
commands: []
};
}
const rootClientId = getBlockRootClientId(clientIds[0]);
const canMove = canMoveBlocks(clientIds, rootClientId) && getBlockCount(rootClientId) !== 1;
const commands = [];
if (canMove) {
commands.push({
name: 'move-to',
label: (0,external_wp_i18n_namespaceObject.__)('Move to'),
callback: () => {
setNavigationMode(true);
selectBlock(clientIds[0]);
setBlockMovingClientId(clientIds[0]);
},
icon: move_to
});
}
return {
isLoading: false,
commands: commands.map(command => ({
...command,
name: 'core/block-editor/action-' + command.name,
callback: ({
close
}) => {
command.callback();
close();
}
}))
};
};
const useQuickActionsCommands = () => {
const {
clientIds,
isUngroupable,
isGroupable
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSelectedBlockClientIds,
isUngroupable: _isUngroupable,
isGroupable: _isGroupable
} = select(store);
const selectedBlockClientIds = getSelectedBlockClientIds();
return {
clientIds: selectedBlockClientIds,
isUngroupable: _isUngroupable(),
isGroupable: _isGroupable()
};
}, []);
const {
canInsertBlockType,
getBlockRootClientId,
getBlocksByClientId,
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 {
removeBlocks,
replaceBlocks,
duplicateBlocks,
insertAfterBlock,
insertBeforeBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const 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);
};
const onUngroup = () => {
if (!blocks.length) {
return;
}
const innerBlocks = blocks[0].innerBlocks;
if (!innerBlocks.length) {
return;
}
replaceBlocks(clientIds, innerBlocks);
};
if (!clientIds || clientIds.length < 1) {
return {
isLoading: false,
commands: []
};
}
const rootClientId = getBlockRootClientId(clientIds[0]);
const canInsertDefaultBlock = canInsertBlockType(getDefaultBlockName(), rootClientId);
const canDuplicate = blocks.every(block => {
return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true) && canInsertBlockType(block.name, rootClientId);
});
const canRemove = canRemoveBlocks(clientIds, rootClientId);
const commands = [];
if (canDuplicate) {
commands.push({
name: 'duplicate',
label: (0,external_wp_i18n_namespaceObject.__)('Duplicate'),
callback: () => duplicateBlocks(clientIds, true),
icon: library_copy
});
}
if (canInsertDefaultBlock) {
commands.push({
name: 'add-before',
label: (0,external_wp_i18n_namespaceObject.__)('Add before'),
callback: () => {
const clientId = Array.isArray(clientIds) ? clientIds[0] : clientId;
insertBeforeBlock(clientId);
},
icon: library_plus
}, {
name: 'add-after',
label: (0,external_wp_i18n_namespaceObject.__)('Add after'),
callback: () => {
const clientId = Array.isArray(clientIds) ? clientIds[clientIds.length - 1] : clientId;
insertAfterBlock(clientId);
},
icon: library_plus
});
}
if (isGroupable) {
commands.push({
name: 'Group',
label: (0,external_wp_i18n_namespaceObject.__)('Group'),
callback: onGroup,
icon: library_group
});
}
if (isUngroupable) {
commands.push({
name: 'ungroup',
label: (0,external_wp_i18n_namespaceObject.__)('Ungroup'),
callback: onUngroup,
icon: library_ungroup
});
}
if (canRemove) {
commands.push({
name: 'remove',
label: (0,external_wp_i18n_namespaceObject.__)('Delete'),
callback: () => removeBlocks(clientIds, true),
icon: library_trash
});
}
return {
isLoading: false,
commands: commands.map(command => ({
...command,
name: 'core/block-editor/action-' + command.name,
callback: ({
close
}) => {
command.callback();
close();
}
}))
};
};
const useBlockCommands = () => {
(0,external_wp_commands_namespaceObject.useCommandLoader)({
name: 'core/block-editor/blockTransforms',
hook: useTransformCommands
});
(0,external_wp_commands_namespaceObject.useCommandLoader)({
name: 'core/block-editor/blockActions',
hook: useActionsCommands
});
(0,external_wp_commands_namespaceObject.useCommandLoader)({
name: 'core/block-editor/blockQuickActions',
hook: useQuickActionsCommands,
context: 'block-selection-edit'
});
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/reusable-block-rename-hint.js
/**
* WordPress dependencies
*/
const reusable_block_rename_hint_PREFERENCE_NAME = 'isResuableBlocksrRenameHintVisible';
/*
* This hook was added in 6.3 to help users with the transition from Reusable blocks to Patterns.
* It is only exported for use in the reusable-blocks package as well as block-editor.
* It will be removed in 6.4. and should not be used in any new code.
*/
function useReusableBlocksRenameHint() {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
var _select$get;
return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', reusable_block_rename_hint_PREFERENCE_NAME)) !== null && _select$get !== void 0 ? _select$get : true;
}, []);
}
/*
* This component was added in 6.3 to help users with the transition from Reusable blocks to Patterns.
* It is only exported for use in the reusable-blocks package as well as block-editor.
* It will be removed in 6.4. and should not be used in any new code.
*/
function ReusableBlocksRenameHint() {
const isReusableBlocksRenameHint = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _select$get2;
return (_select$get2 = select(external_wp_preferences_namespaceObject.store).get('core', reusable_block_rename_hint_PREFERENCE_NAME)) !== null && _select$get2 !== void 0 ? _select$get2 : true;
}, []);
const ref = (0,external_wp_element_namespaceObject.useRef)();
const {
set: setPreference
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
if (!isReusableBlocksRenameHint) {
return null;
}
return (0,external_React_.createElement)("div", {
ref: ref,
className: "reusable-blocks-menu-items__rename-hint"
}, (0,external_React_.createElement)("div", {
className: "reusable-blocks-menu-items__rename-hint-content"
}, (0,external_wp_i18n_namespaceObject.__)('Reusable blocks are now synced patterns. A synced pattern will behave in exactly the same way as a reusable block.')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
className: "reusable-blocks-menu-items__rename-hint-dismiss",
icon: library_close,
iconSize: "16",
label: (0,external_wp_i18n_namespaceObject.__)('Dismiss hint'),
onClick: () => {
// Retain focus when dismissing the element.
const previousElement = external_wp_dom_namespaceObject.focus.tabbable.findPrevious(ref.current);
previousElement?.focus();
setPreference('core', reusable_block_rename_hint_PREFERENCE_NAME, false);
},
showTooltip: false
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/index.js
/*
* Block Creation Components
*/
/*
* Content Related Components
*/
/*
* State Related Components
*/
/*
* The following rename hint component can be removed in 6.4.
*/
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/elements/index.js
const ELEMENT_CLASS_NAMES = {
button: 'wp-element-button',
caption: 'wp-element-caption'
};
const __experimentalGetElementClassName = element => {
return ELEMENT_CLASS_NAMES[element] ? ELEMENT_CLASS_NAMES[element] : '';
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/get-px-from-css-unit.js
/**
* This function was accidentially exposed for mobile/native usage.
*
* @deprecated
*
* @return {string} Empty string.
*/
/* harmony default export */ const get_px_from_css_unit = (() => '');
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/index.js
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/use-global-styles-output.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// List of block support features that can have their related styles
// generated under their own feature level selector rather than the block's.
const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {
__experimentalBorder: 'border',
color: 'color',
spacing: 'spacing',
typography: 'typography'
};
function compileStyleValue(uncompiledValue) {
const VARIABLE_REFERENCE_PREFIX = 'var:';
const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';
const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';
if (uncompiledValue?.startsWith?.(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;
}
/**
* Transform given preset tree into a set of style declarations.
*
* @param {Object} blockPresets
* @param {Object} mergedSettings Merged theme.json settings.
*
* @return {Array<Object>} An array of style declarations.
*/
function getPresetsDeclarations(blockPresets = {}, mergedSettings) {
const {
kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
return PRESET_METADATA.reduce((declarations, {
path,
valueKey,
valueFunc,
cssVarInfix
}) => {
const presetByOrigin = getValueFromObjectPath(blockPresets, path, []);
['default', 'theme', 'custom'].forEach(origin => {
if (presetByOrigin[origin]) {
presetByOrigin[origin].forEach(value => {
if (valueKey && !valueFunc) {
declarations.push(`--wp--preset--${cssVarInfix}--${kebabCase(value.slug)}: ${value[valueKey]}`);
} else if (valueFunc && typeof valueFunc === 'function') {
declarations.push(`--wp--preset--${cssVarInfix}--${kebabCase(value.slug)}: ${valueFunc(value, mergedSettings)}`);
}
});
}
});
return declarations;
}, []);
}
/**
* Transform given preset tree into a set of preset class declarations.
*
* @param {?string} blockSelector
* @param {Object} blockPresets
* @return {string} CSS declarations for the preset classes.
*/
function getPresetsClasses(blockSelector = '*', blockPresets = {}) {
const {
kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
return PRESET_METADATA.reduce((declarations, {
path,
cssVarInfix,
classes
}) => {
if (!classes) {
return declarations;
}
const presetByOrigin = getValueFromObjectPath(blockPresets, path, []);
['default', 'theme', 'custom'].forEach(origin => {
if (presetByOrigin[origin]) {
presetByOrigin[origin].forEach(({
slug
}) => {
classes.forEach(({
classSuffix,
propertyName
}) => {
const classSelectorToUse = `.has-${kebabCase(slug)}-${classSuffix}`;
const selectorToUse = blockSelector.split(',') // Selector can be "h1, h2, h3"
.map(selector => `${selector}${classSelectorToUse}`).join(',');
const value = `var(--wp--preset--${cssVarInfix}--${kebabCase(slug)})`;
declarations += `${selectorToUse}{${propertyName}: ${value} !important;}`;
});
});
}
});
return declarations;
}, '');
}
function getPresetsSvgFilters(blockPresets = {}) {
return PRESET_METADATA.filter(
// Duotone are the only type of filters for now.
metadata => metadata.path.at(-1) === 'duotone').flatMap(metadata => {
const presetByOrigin = getValueFromObjectPath(blockPresets, metadata.path, {});
return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset => getDuotoneFilter(`wp-duotone-${preset.slug}`, preset.colors))).join('');
});
}
function flattenTree(input = {}, prefix, token) {
const {
kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
let result = [];
Object.keys(input).forEach(key => {
const newKey = prefix + kebabCase(key.replace('/', '-'));
const newLeaf = input[key];
if (newLeaf instanceof Object) {
const newPrefix = newKey + token;
result = [...result, ...flattenTree(newLeaf, newPrefix, token)];
} else {
result.push(`${newKey}: ${newLeaf}`);
}
});
return result;
}
/**
* Gets variation selector string from feature selector.
*
* @param {string} featureSelector The feature selector.
*
* @param {string} styleVariationSelector The style variation selector.
* @return {string} Combined selector string.
*/
function concatFeatureVariationSelectorString(featureSelector, styleVariationSelector) {
const featureSelectors = featureSelector.split(',');
const combinedSelectors = [];
featureSelectors.forEach(selector => {
combinedSelectors.push(`${styleVariationSelector.trim()}${selector.trim()}`);
});
return combinedSelectors.join(', ');
}
/**
* Generate style declarations for a block's custom feature and subfeature
* selectors.
*
* NOTE: The passed `styles` object will be mutated by this function.
*
* @param {Object} selectors Custom selectors object for a block.
* @param {Object} styles A block's styles object.
*
* @return {Object} Style declarations.
*/
const getFeatureDeclarations = (selectors, styles) => {
const declarations = {};
Object.entries(selectors).forEach(([feature, selector]) => {
// We're only processing features/subfeatures that have styles.
if (feature === 'root' || !styles?.[feature]) {
return;
}
const isShorthand = typeof selector === 'string';
// If we have a selector object instead of shorthand process it.
if (!isShorthand) {
Object.entries(selector).forEach(([subfeature, subfeatureSelector]) => {
// Don't process root feature selector yet or any
// subfeature that doesn't have a style.
if (subfeature === 'root' || !styles?.[feature][subfeature]) {
return;
}
// Create a temporary styles object and build
// declarations for subfeature.
const subfeatureStyles = {
[feature]: {
[subfeature]: styles[feature][subfeature]
}
};
const newDeclarations = getStylesDeclarations(subfeatureStyles);
// Merge new declarations in with any others that
// share the same selector.
declarations[subfeatureSelector] = [...(declarations[subfeatureSelector] || []), ...newDeclarations];
// Remove the subfeature's style now it will be
// included under its own selector not the block's.
delete styles[feature][subfeature];
});
}
// Now subfeatures have been processed and removed, we can
// process root, or shorthand, feature selectors.
if (isShorthand || selector.root) {
const featureSelector = isShorthand ? selector : selector.root;
// Create temporary style object and build declarations for feature.
const featureStyles = {
[feature]: styles[feature]
};
const newDeclarations = getStylesDeclarations(featureStyles);
// Merge new declarations with any others that share the selector.
declarations[featureSelector] = [...(declarations[featureSelector] || []), ...newDeclarations];
// Remove the feature from the block's styles now as it will be
// included under its own selector not the block's.
delete styles[feature];
}
});
return declarations;
};
/**
* Transform given style tree into a set of style declarations.
*
* @param {Object} blockStyles Block styles.
*
* @param {string} selector The selector these declarations should attach to.
*
* @param {boolean} useRootPaddingAlign Whether to use CSS custom properties in root selector.
*
* @param {Object} tree A theme.json tree containing layout definitions.
*
* @param {boolean} isTemplate Whether the entity being edited is a full template or a pattern.
* @return {Array} An array of style declarations.
*/
function getStylesDeclarations(blockStyles = {}, selector = '', useRootPaddingAlign, tree = {}, isTemplate = true) {
const {
kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
const isRoot = ROOT_BLOCK_SELECTOR === selector;
const output = Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).reduce((declarations, [key, {
value,
properties,
useEngine,
rootOnly
}]) => {
if (rootOnly && !isRoot) {
return declarations;
}
const pathToValue = value;
if (pathToValue[0] === 'elements' || useEngine) {
return declarations;
}
const styleValue = getValueFromObjectPath(blockStyles, pathToValue);
// Root-level padding styles don't currently support strings with CSS shorthand values.
// This may change: https://github.com/WordPress/gutenberg/issues/40132.
if (key === '--wp--style--root--padding' && (typeof styleValue === 'string' || !useRootPaddingAlign)) {
return declarations;
}
if (properties && typeof styleValue !== 'string') {
Object.entries(properties).forEach(entry => {
const [name, prop] = entry;
if (!getValueFromObjectPath(styleValue, [prop], false)) {
// Do not create a declaration
// for sub-properties that don't have any value.
return;
}
const cssProperty = name.startsWith('--') ? name : kebabCase(name);
declarations.push(`${cssProperty}: ${compileStyleValue(getValueFromObjectPath(styleValue, [prop]))}`);
});
} else if (getValueFromObjectPath(blockStyles, pathToValue, false)) {
const cssProperty = key.startsWith('--') ? key : kebabCase(key);
declarations.push(`${cssProperty}: ${compileStyleValue(getValueFromObjectPath(blockStyles, pathToValue))}`);
}
return declarations;
}, []);
// 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 = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(blockStyles);
extraRules.forEach(rule => {
// Don't output padding properties if padding variables are set or if we're not editing a full template.
if (isRoot && (useRootPaddingAlign || !isTemplate) && rule.key.startsWith('padding')) {
return;
}
const cssProperty = rule.key.startsWith('--') ? rule.key : kebabCase(rule.key);
let ruleValue = rule.value;
if (typeof ruleValue !== 'string' && ruleValue?.ref) {
const refPath = ruleValue.ref.split('.');
ruleValue = getValueFromObjectPath(tree, refPath);
// Presence of another ref indicates a reference to another dynamic value.
// Pointing to another dynamic value is not supported.
if (!ruleValue || ruleValue?.ref) {
return;
}
}
// Calculate fluid typography rules where available.
if (cssProperty === 'font-size') {
/*
* getTypographyFontSizeValue() will check
* if fluid typography has been activated and also
* whether the incoming value can be converted to a fluid value.
* Values that already have a "clamp()" function will not pass the test,
* and therefore the original $value will be returned.
*/
ruleValue = getTypographyFontSizeValue({
size: ruleValue
}, getFluidTypographyOptionsFromSettings(tree?.settings));
}
// For aspect ratio to work, other dimensions rules (and Cover block defaults) must be unset.
// This ensures that a fixed height does not override the aspect ratio.
if (cssProperty === 'aspect-ratio') {
output.push('min-height: unset');
}
output.push(`${cssProperty}: ${ruleValue}`);
});
return output;
}
/**
* Get generated CSS for layout styles by looking up layout definitions provided
* in theme.json, and outputting common layout styles, and specific blockGap values.
*
* @param {Object} props
* @param {Object} props.layoutDefinitions Layout definitions, keyed by layout type.
* @param {Object} props.style A style object containing spacing values.
* @param {string} props.selector Selector used to group together layout styling rules.
* @param {boolean} props.hasBlockGapSupport Whether or not the theme opts-in to blockGap support.
* @param {boolean} props.hasFallbackGapSupport Whether or not the theme allows fallback gap styles.
* @param {?string} props.fallbackGapValue An optional fallback gap value if no real gap value is available.
* @return {string} Generated CSS rules for the layout styles.
*/
function getLayoutStyles({
layoutDefinitions = LAYOUT_DEFINITIONS,
style,
selector,
hasBlockGapSupport,
hasFallbackGapSupport,
fallbackGapValue
}) {
let ruleset = '';
let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : '';
// Ensure a fallback gap value for the root layout definitions,
// and use a fallback value if one is provided for the current block.
if (hasFallbackGapSupport) {
if (selector === ROOT_BLOCK_SELECTOR) {
gapValue = !gapValue ? '0.5em' : gapValue;
} else if (!hasBlockGapSupport && fallbackGapValue) {
gapValue = fallbackGapValue;
}
}
if (gapValue && layoutDefinitions) {
Object.values(layoutDefinitions).forEach(({
className,
name,
spacingStyles
}) => {
// Allow outputting fallback gap styles for flex layout type when block gap support isn't available.
if (!hasBlockGapSupport && 'flex' !== name && 'grid' !== name) {
return;
}
if (spacingStyles?.length) {
spacingStyles.forEach(spacingStyle => {
const declarations = [];
if (spacingStyle.rules) {
Object.entries(spacingStyle.rules).forEach(([cssProperty, cssValue]) => {
declarations.push(`${cssProperty}: ${cssValue ? cssValue : gapValue}`);
});
}
if (declarations.length) {
let combinedSelector = '';
if (!hasBlockGapSupport) {
// For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles.
combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.${className}${spacingStyle?.selector || ''})` : `:where(${selector}.${className}${spacingStyle?.selector || ''})`;
} else {
combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(${selector} .${className})${spacingStyle?.selector || ''}` : `${selector}-${className}${spacingStyle?.selector || ''}`;
}
ruleset += `${combinedSelector} { ${declarations.join('; ')}; }`;
}
});
}
});
// For backwards compatibility, ensure the legacy block gap CSS variable is still available.
if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) {
ruleset += `${selector} { --wp--style--block-gap: ${gapValue}; }`;
}
}
// Output base styles
if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) {
const validDisplayModes = ['block', 'flex', 'grid'];
Object.values(layoutDefinitions).forEach(({
className,
displayMode,
baseStyles
}) => {
if (displayMode && validDisplayModes.includes(displayMode)) {
ruleset += `${selector} .${className} { display:${displayMode}; }`;
}
if (baseStyles?.length) {
baseStyles.forEach(baseStyle => {
const declarations = [];
if (baseStyle.rules) {
Object.entries(baseStyle.rules).forEach(([cssProperty, cssValue]) => {
declarations.push(`${cssProperty}: ${cssValue}`);
});
}
if (declarations.length) {
const combinedSelector = `${selector} .${className}${baseStyle?.selector || ''}`;
ruleset += `${combinedSelector} { ${declarations.join('; ')}; }`;
}
});
}
});
}
return ruleset;
}
const STYLE_KEYS = ['border', 'color', 'dimensions', 'spacing', 'typography', 'filter', 'outline', 'shadow'];
function pickStyleKeys(treeToPickFrom) {
if (!treeToPickFrom) {
return {};
}
const entries = Object.entries(treeToPickFrom);
const pickedEntries = entries.filter(([key]) => STYLE_KEYS.includes(key));
// clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it
const clonedEntries = pickedEntries.map(([key, style]) => [key, JSON.parse(JSON.stringify(style))]);
return Object.fromEntries(clonedEntries);
}
const getNodesWithStyles = (tree, blockSelectors) => {
var _tree$styles$blocks;
const nodes = [];
if (!tree?.styles) {
return nodes;
}
// Top-level.
const styles = pickStyleKeys(tree.styles);
if (styles) {
nodes.push({
styles,
selector: ROOT_BLOCK_SELECTOR
});
}
Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS).forEach(([name, selector]) => {
if (tree.styles?.elements?.[name]) {
nodes.push({
styles: tree.styles?.elements?.[name],
selector
});
}
});
// Iterate over blocks: they can have styles & elements.
Object.entries((_tree$styles$blocks = tree.styles?.blocks) !== null && _tree$styles$blocks !== void 0 ? _tree$styles$blocks : {}).forEach(([blockName, node]) => {
var _node$elements;
const blockStyles = pickStyleKeys(node);
if (node?.variations) {
const variations = {};
Object.keys(node.variations).forEach(variation => {
variations[variation] = pickStyleKeys(node.variations[variation]);
});
blockStyles.variations = variations;
}
if (blockStyles && blockSelectors?.[blockName]?.selector) {
nodes.push({
duotoneSelector: blockSelectors[blockName].duotoneSelector,
fallbackGapValue: blockSelectors[blockName].fallbackGapValue,
hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport,
selector: blockSelectors[blockName].selector,
styles: blockStyles,
featureSelectors: blockSelectors[blockName].featureSelectors,
styleVariationSelectors: blockSelectors[blockName].styleVariationSelectors
});
}
Object.entries((_node$elements = node?.elements) !== null && _node$elements !== void 0 ? _node$elements : {}).forEach(([elementName, value]) => {
if (value && blockSelectors?.[blockName] && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName]) {
nodes.push({
styles: value,
selector: blockSelectors[blockName]?.selector.split(',').map(sel => {
const elementSelectors = external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName].split(',');
return elementSelectors.map(elementSelector => sel + ' ' + elementSelector);
}).join(',')
});
}
});
});
return nodes;
};
const getNodesWithSettings = (tree, blockSelectors) => {
var _tree$settings$blocks;
const nodes = [];
if (!tree?.settings) {
return nodes;
}
const pickPresets = treeToPickFrom => {
let presets = {};
PRESET_METADATA.forEach(({
path
}) => {
const value = getValueFromObjectPath(treeToPickFrom, path, false);
if (value !== false) {
presets = setImmutably(presets, path, value);
}
});
return presets;
};
// Top-level.
const presets = pickPresets(tree.settings);
const custom = tree.settings?.custom;
if (Object.keys(presets).length > 0 || custom) {
nodes.push({
presets,
custom,
selector: ROOT_BLOCK_SELECTOR
});
}
// Blocks.
Object.entries((_tree$settings$blocks = tree.settings?.blocks) !== null && _tree$settings$blocks !== void 0 ? _tree$settings$blocks : {}).forEach(([blockName, node]) => {
const blockPresets = pickPresets(node);
const blockCustom = node.custom;
if (Object.keys(blockPresets).length > 0 || blockCustom) {
nodes.push({
presets: blockPresets,
custom: blockCustom,
selector: blockSelectors[blockName]?.selector
});
}
});
return nodes;
};
const toCustomProperties = (tree, blockSelectors) => {
const settings = getNodesWithSettings(tree, blockSelectors);
let ruleset = '';
settings.forEach(({
presets,
custom,
selector
}) => {
const declarations = getPresetsDeclarations(presets, tree?.settings);
const customProps = flattenTree(custom, '--wp--custom--', '--');
if (customProps.length > 0) {
declarations.push(...customProps);
}
if (declarations.length > 0) {
ruleset += `${selector}{${declarations.join(';')};}`;
}
});
return ruleset;
};
const toStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, isTemplate = true) => {
const nodesWithStyles = getNodesWithStyles(tree, blockSelectors);
const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;
const {
contentSize,
wideSize
} = tree?.settings?.layout || {};
/*
* Reset default browser margin on the root body element.
* This is set on the root selector **before** generating the ruleset
* from the `theme.json`. This is to ensure that if the `theme.json` declares
* `margin` in its `spacing` declaration for the `body` element then these
* user-generated values take precedence in the CSS cascade.
* @link https://github.com/WordPress/gutenberg/issues/36147.
*/
let ruleset = 'body {margin: 0;';
if (contentSize) {
ruleset += ` --wp--style--global--content-size: ${contentSize};`;
}
if (wideSize) {
ruleset += ` --wp--style--global--wide-size: ${wideSize};`;
}
// Root padding styles should only be output for full templates, not patterns or template parts.
if (useRootPaddingAlign && isTemplate) {
/*
* These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508
* almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors.
*/
ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
.has-global-padding :where(.has-global-padding:not(.wp-block-block)) { padding-right: 0; padding-left: 0; }
.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
.has-global-padding :where(.has-global-padding:not(.wp-block-block)) > .alignfull { margin-right: 0; margin-left: 0; }
.has-global-padding > .alignfull:where(:not(.has-global-padding):not(.is-layout-flex):not(.is-layout-grid)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;
}
ruleset += '}';
nodesWithStyles.forEach(({
selector,
duotoneSelector,
styles,
fallbackGapValue,
hasLayoutSupport,
featureSelectors,
styleVariationSelectors
}) => {
// Process styles for block support features with custom feature level
// CSS selectors set.
if (featureSelectors) {
const featureDeclarations = getFeatureDeclarations(featureSelectors, styles);
Object.entries(featureDeclarations).forEach(([cssSelector, declarations]) => {
if (declarations.length) {
const rules = declarations.join(';');
ruleset += `${cssSelector}{${rules};}`;
}
});
}
if (styleVariationSelectors) {
Object.entries(styleVariationSelectors).forEach(([styleVariationName, styleVariationSelector]) => {
const styleVariations = styles?.variations?.[styleVariationName];
if (styleVariations) {
// If the block uses any custom selectors for block support, add those first.
if (featureSelectors) {
const featureDeclarations = getFeatureDeclarations(featureSelectors, styleVariations);
Object.entries(featureDeclarations).forEach(([baseSelector, declarations]) => {
if (declarations.length) {
const cssSelector = concatFeatureVariationSelectorString(baseSelector, styleVariationSelector);
const rules = declarations.join(';');
ruleset += `${cssSelector}{${rules};}`;
}
});
}
// Otherwise add regular selectors.
const styleVariationDeclarations = getStylesDeclarations(styleVariations, styleVariationSelector, useRootPaddingAlign, tree);
if (styleVariationDeclarations.length) {
ruleset += `${styleVariationSelector}{${styleVariationDeclarations.join(';')};}`;
}
}
});
}
// Process duotone styles.
if (duotoneSelector) {
const duotoneStyles = {};
if (styles?.filter) {
duotoneStyles.filter = styles.filter;
delete styles.filter;
}
const duotoneDeclarations = getStylesDeclarations(duotoneStyles);
if (duotoneDeclarations.length) {
ruleset += `${duotoneSelector}{${duotoneDeclarations.join(';')};}`;
}
}
// Process blockGap and layout styles.
if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport)) {
ruleset += getLayoutStyles({
style: styles,
selector,
hasBlockGapSupport,
hasFallbackGapSupport,
fallbackGapValue
});
}
// Process the remaining block styles (they use either normal block class or __experimentalSelector).
const declarations = getStylesDeclarations(styles, selector, useRootPaddingAlign, tree, isTemplate);
if (declarations?.length) {
ruleset += `${selector}{${declarations.join(';')};}`;
}
// Check for pseudo selector in `styles` and handle separately.
const pseudoSelectorStyles = Object.entries(styles).filter(([key]) => key.startsWith(':'));
if (pseudoSelectorStyles?.length) {
pseudoSelectorStyles.forEach(([pseudoKey, pseudoStyle]) => {
const pseudoDeclarations = getStylesDeclarations(pseudoStyle);
if (!pseudoDeclarations?.length) {
return;
}
// `selector` maybe provided in a form
// where block level selectors have sub element
// selectors appended to them as a comma separated
// string.
// e.g. `h1 a,h2 a,h3 a,h4 a,h5 a,h6 a`;
// Split and append pseudo selector to create
// the proper rules to target the elements.
const _selector = selector.split(',').map(sel => sel + pseudoKey).join(',');
const pseudoRule = `${_selector}{${pseudoDeclarations.join(';')};}`;
ruleset += pseudoRule;
});
}
});
/* Add alignment / layout styles */
ruleset = ruleset + '.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';
ruleset = ruleset + '.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';
ruleset = ruleset + '.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';
if (hasBlockGapSupport) {
// Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value.
const gapValue = getGapCSSValue(tree?.styles?.spacing?.blockGap) || '0.5em';
ruleset = ruleset + `:where(.wp-site-blocks) > * { margin-block-start: ${gapValue}; margin-block-end: 0; }`;
ruleset = ruleset + ':where(.wp-site-blocks) > :first-child:first-child { margin-block-start: 0; }';
ruleset = ruleset + ':where(.wp-site-blocks) > :last-child:last-child { margin-block-end: 0; }';
}
nodesWithSettings.forEach(({
selector,
presets
}) => {
if (ROOT_BLOCK_SELECTOR === selector) {
// Do not add extra specificity for top-level classes.
selector = '';
}
const classes = getPresetsClasses(selector, presets);
if (classes.length > 0) {
ruleset += classes;
}
});
return ruleset;
};
function toSvgFilters(tree, blockSelectors) {
const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
return nodesWithSettings.flatMap(({
presets
}) => {
return getPresetsSvgFilters(presets);
});
}
const getSelectorsConfig = (blockType, rootSelector) => {
if (blockType?.selectors && Object.keys(blockType.selectors).length > 0) {
return blockType.selectors;
}
const config = {
root: rootSelector
};
Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(([featureKey, featureName]) => {
const featureSelector = getBlockCSSSelector(blockType, featureKey);
if (featureSelector) {
config[featureName] = featureSelector;
}
});
return config;
};
const getBlockSelectors = (blockTypes, getBlockStyles) => {
const result = {};
blockTypes.forEach(blockType => {
const name = blockType.name;
const selector = getBlockCSSSelector(blockType);
let duotoneSelector = getBlockCSSSelector(blockType, 'filter.duotone');
// Keep backwards compatibility for support.color.__experimentalDuotone.
if (!duotoneSelector) {
const rootSelector = getBlockCSSSelector(blockType);
const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, 'color.__experimentalDuotone', false);
duotoneSelector = duotoneSupport && scopeSelector(rootSelector, duotoneSupport);
}
const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout;
const fallbackGapValue = blockType?.supports?.spacing?.blockGap?.__experimentalDefault;
const blockStyleVariations = getBlockStyles(name);
const styleVariationSelectors = {};
if (blockStyleVariations?.length) {
blockStyleVariations.forEach(variation => {
const styleVariationSelector = getBlockStyleVariationSelector(variation.name, selector);
styleVariationSelectors[variation.name] = styleVariationSelector;
});
}
// For each block support feature add any custom selectors.
const featureSelectors = getSelectorsConfig(blockType, selector);
result[name] = {
duotoneSelector,
fallbackGapValue,
featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : undefined,
hasLayoutSupport,
name,
selector,
styleVariationSelectors: Object.keys(styleVariationSelectors).length ? styleVariationSelectors : undefined
};
});
return result;
};
/**
* If there is a separator block whose color is defined in theme.json via background,
* update the separator color to the same value by using border color.
*
* @param {Object} config Theme.json configuration file object.
* @return {Object} configTheme.json configuration file object updated.
*/
function updateConfigWithSeparator(config) {
const needsSeparatorStyleUpdate = config.styles?.blocks?.['core/separator'] && config.styles?.blocks?.['core/separator'].color?.background && !config.styles?.blocks?.['core/separator'].color?.text && !config.styles?.blocks?.['core/separator'].border?.color;
if (needsSeparatorStyleUpdate) {
return {
...config,
styles: {
...config.styles,
blocks: {
...config.styles.blocks,
'core/separator': {
...config.styles.blocks['core/separator'],
color: {
...config.styles.blocks['core/separator'].color,
text: config.styles?.blocks['core/separator'].color.background
}
}
}
}
};
}
return config;
}
function processCSSNesting(css, blockSelector) {
let processedCSS = '';
// Split CSS nested rules.
const parts = css.split('&');
parts.forEach(part => {
const isRootCss = !part.includes('{');
if (isRootCss) {
// If the part doesn't contain braces, it applies to the root level.
processedCSS += `${blockSelector}{${part.trim()}}`;
} else {
// If the part contains braces, it's a nested CSS rule.
const splittedPart = part.replace('}', '').split('{');
if (splittedPart.length !== 2) {
return;
}
const [nestedSelector, cssValue] = splittedPart;
const combinedSelector = nestedSelector.startsWith(' ') ? scopeSelector(blockSelector, nestedSelector) : appendToSelector(blockSelector, nestedSelector);
processedCSS += `${combinedSelector}{${cssValue.trim()}}`;
}
});
return processedCSS;
}
/**
* Returns the global styles output using a global styles configuration.
* If wishing to generate global styles and settings based on the
* global styles config loaded in the editor context, use `useGlobalStylesOutput()`.
* The use case for a custom config is to generate bespoke styles
* and settings for previews, or other out-of-editor experiences.
*
* @param {Object} mergedConfig Global styles configuration.
* @return {Array} Array of stylesheets and settings.
*/
function useGlobalStylesOutputWithConfig(mergedConfig = {}) {
const [blockGap] = useGlobalSetting('spacing.blockGap');
const hasBlockGapSupport = blockGap !== null;
const hasFallbackGapSupport = !hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.
const disableLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(store);
return !!getSettings().disableLayoutStyles;
});
const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context);
const isTemplate = blockContext?.templateSlug !== undefined;
const {
getBlockStyles
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
return (0,external_wp_element_namespaceObject.useMemo)(() => {
var _updatedConfig$styles;
if (!mergedConfig?.styles || !mergedConfig?.settings) {
return [];
}
const updatedConfig = updateConfigWithSeparator(mergedConfig);
const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)(), getBlockStyles);
const customProperties = toCustomProperties(updatedConfig, blockSelectors);
const globalStyles = toStyles(updatedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, isTemplate);
const svgs = toSvgFilters(updatedConfig, blockSelectors);
const styles = [{
css: customProperties,
isGlobalStyles: true
}, {
css: globalStyles,
isGlobalStyles: true
},
// Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.
{
css: (_updatedConfig$styles = updatedConfig.styles.css) !== null && _updatedConfig$styles !== void 0 ? _updatedConfig$styles : '',
isGlobalStyles: true
}, {
assets: svgs,
__unstableType: 'svg',
isGlobalStyles: true
}];
// Loop through the blocks to check if there are custom CSS values.
// If there are, get the block selector and push the selector together with
// the CSS value to the 'stylesheets' array.
(0,external_wp_blocks_namespaceObject.getBlockTypes)().forEach(blockType => {
if (updatedConfig.styles.blocks[blockType.name]?.css) {
const selector = blockSelectors[blockType.name].selector;
styles.push({
css: processCSSNesting(updatedConfig.styles.blocks[blockType.name]?.css, selector),
isGlobalStyles: true
});
}
});
return [styles, updatedConfig.settings];
}, [hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles, isTemplate, getBlockStyles]);
}
/**
* Returns the global styles output based on the current state of global styles config loaded in the editor context.
*
* @return {Array} Array of stylesheets and settings.
*/
function useGlobalStylesOutput() {
const {
merged: mergedConfig
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
return useGlobalStylesOutputWithConfig(mergedConfig);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/image-settings-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useHasImageSettingsPanel(name, value, inheritedValue) {
// Note: If lightbox `value` exists, that means it was
// defined via the the Global Styles UI and will NOT
// be a boolean value or contain the `allowEditing` property,
// so we should show the settings panel in those cases.
return name === 'core/image' && inheritedValue?.lightbox?.allowEditing || !!value?.lightbox;
}
function ImageSettingsPanel({
onChange,
value,
inheritedValue,
panelId
}) {
const resetLightbox = () => {
onChange(undefined);
};
const onChangeLightbox = newSetting => {
onChange({
enabled: newSetting
});
};
let lightboxChecked = false;
if (inheritedValue?.lightbox?.enabled) {
lightboxChecked = inheritedValue.lightbox.enabled;
}
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
label: (0,external_wp_i18n_namespaceObject._x)('Settings', 'Image settings'),
resetAll: resetLightbox,
panelId: panelId,
dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem
// We use the `userSettings` prop instead of `settings`, because `settings`
// contains the core/theme values for the lightbox and we want to show the
// "RESET" button ONLY when the user has explicitly set a value in the
// Global Styles.
, {
hasValue: () => !!value?.lightbox,
label: (0,external_wp_i18n_namespaceObject.__)('Expand on click'),
onDeselect: resetLightbox,
isShownByDefault: true,
panelId: panelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ToggleControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Expand on click'),
checked: lightboxChecked,
onChange: onChangeLightbox
}))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/advanced-panel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function AdvancedPanel({
value,
onChange,
inheritedValue = value
}) {
// Custom CSS
const [cssError, setCSSError] = (0,external_wp_element_namespaceObject.useState)(null);
const customCSS = inheritedValue?.css;
function handleOnChange(newValue) {
onChange({
...value,
css: newValue
});
if (cssError) {
const [transformed] = transform_styles([{
css: newValue
}], '.editor-styles-wrapper');
if (transformed) {
setCSSError(null);
}
}
}
function handleOnBlur(event) {
if (!event?.target?.value) {
setCSSError(null);
return;
}
const [transformed] = transform_styles([{
css: event.target.value
}], '.editor-styles-wrapper');
setCSSError(transformed === null ? (0,external_wp_i18n_namespaceObject.__)('There is an error with your CSS structure.') : null);
}
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: 3
}, cssError && (0,external_React_.createElement)(external_wp_components_namespaceObject.Notice, {
status: "error",
onRemove: () => setCSSError(null)
}, cssError), (0,external_React_.createElement)(external_wp_components_namespaceObject.TextareaControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Additional CSS'),
__nextHasNoMarginBottom: true,
value: customCSS,
onChange: newValue => handleOnChange(newValue),
onBlur: handleOnBlur,
className: "block-editor-global-styles-advanced-panel__custom-css-input",
spellCheck: false
}));
}
;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js
/**
* 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 {(...args: any[]) => any} F
*
* @param {F} fn Function to memoize.
* @param {MemizeOptions} [options] Options object.
*
* @return {((...args: Parameters<F>) => ReturnType<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;
};
// 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;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/get-global-styles-changes.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const globalStylesChangesCache = new Map();
const get_global_styles_changes_EMPTY_ARRAY = [];
const translationMap = {
caption: (0,external_wp_i18n_namespaceObject.__)('Caption'),
link: (0,external_wp_i18n_namespaceObject.__)('Link'),
button: (0,external_wp_i18n_namespaceObject.__)('Button'),
heading: (0,external_wp_i18n_namespaceObject.__)('Heading'),
h1: (0,external_wp_i18n_namespaceObject.__)('H1'),
h2: (0,external_wp_i18n_namespaceObject.__)('H2'),
h3: (0,external_wp_i18n_namespaceObject.__)('H3'),
h4: (0,external_wp_i18n_namespaceObject.__)('H4'),
h5: (0,external_wp_i18n_namespaceObject.__)('H5'),
h6: (0,external_wp_i18n_namespaceObject.__)('H6'),
'settings.color': (0,external_wp_i18n_namespaceObject.__)('Color'),
'settings.typography': (0,external_wp_i18n_namespaceObject.__)('Typography'),
'styles.color': (0,external_wp_i18n_namespaceObject.__)('Colors'),
'styles.spacing': (0,external_wp_i18n_namespaceObject.__)('Spacing'),
'styles.typography': (0,external_wp_i18n_namespaceObject.__)('Typography')
};
const getBlockNames = memize(() => (0,external_wp_blocks_namespaceObject.getBlockTypes)().reduce((accumulator, {
name,
title
}) => {
accumulator[name] = title;
return accumulator;
}, {}));
const isObject = obj => obj !== null && typeof obj === 'object';
/**
* Get the translation for a given global styles key.
* @param {string} key A key representing a path to a global style property or setting.
* @return {string|undefined} A translated key or undefined if no translation exists.
*/
function getTranslation(key) {
if (translationMap[key]) {
return translationMap[key];
}
const keyArray = key.split('.');
if (keyArray?.[0] === 'blocks') {
const blockName = getBlockNames()?.[keyArray[1]];
return blockName || keyArray[1];
}
if (keyArray?.[0] === 'elements') {
return translationMap[keyArray[1]] || keyArray[1];
}
return undefined;
}
/**
* A deep comparison of two objects, optimized for comparing global styles.
* @param {Object} changedObject The changed object to compare.
* @param {Object} originalObject The original object to compare against.
* @param {string} parentPath A key/value pair object of block names and their rendered titles.
* @return {string[]} An array of paths whose values have changed.
*/
function deepCompare(changedObject, originalObject, parentPath = '') {
// We have two non-object values to compare.
if (!isObject(changedObject) && !isObject(originalObject)) {
/*
* Only return a path if the value has changed.
* And then only the path name up to 2 levels deep.
*/
return changedObject !== originalObject ? parentPath.split('.').slice(0, 2).join('.') : undefined;
}
// Enable comparison when an object doesn't have a corresponding property to compare.
changedObject = isObject(changedObject) ? changedObject : {};
originalObject = isObject(originalObject) ? originalObject : {};
const allKeys = new Set([...Object.keys(changedObject), ...Object.keys(originalObject)]);
let diffs = [];
for (const key of allKeys) {
const path = parentPath ? parentPath + '.' + key : key;
const changedPath = deepCompare(changedObject[key], originalObject[key], path);
if (changedPath) {
diffs = diffs.concat(changedPath);
}
}
return diffs;
}
/**
* Returns an array of translated summarized global styles changes.
* Results are cached using a Map() key of `JSON.stringify( { next, previous } )`.
*
* @param {Object} next The changed object to compare.
* @param {Object} previous The original object to compare against.
* @return {Array[]} A 2-dimensional array of tuples: [ "group", "translated change" ].
*/
function getGlobalStylesChangelist(next, previous) {
const cacheKey = JSON.stringify({
next,
previous
});
if (globalStylesChangesCache.has(cacheKey)) {
return globalStylesChangesCache.get(cacheKey);
}
/*
* Compare the two changesets with normalized keys.
* The order of these keys determines the order in which
* they'll appear in the results.
*/
const changedValueTree = deepCompare({
styles: {
color: next?.styles?.color,
typography: next?.styles?.typography,
spacing: next?.styles?.spacing
},
blocks: next?.styles?.blocks,
elements: next?.styles?.elements,
settings: next?.settings
}, {
styles: {
color: previous?.styles?.color,
typography: previous?.styles?.typography,
spacing: previous?.styles?.spacing
},
blocks: previous?.styles?.blocks,
elements: previous?.styles?.elements,
settings: previous?.settings
});
if (!changedValueTree.length) {
globalStylesChangesCache.set(cacheKey, get_global_styles_changes_EMPTY_ARRAY);
return get_global_styles_changes_EMPTY_ARRAY;
}
// Remove duplicate results.
const result = [...new Set(changedValueTree)]
/*
* Translate the keys.
* Remove empty translations.
*/.reduce((acc, curr) => {
const translation = getTranslation(curr);
if (translation) {
acc.push([curr.split('.')[0], translation]);
}
return acc;
}, []);
globalStylesChangesCache.set(cacheKey, result);
return result;
}
/**
* From a getGlobalStylesChangelist() result, returns an array of translated global styles changes, grouped by type.
* The types are 'blocks', 'elements', 'settings', and 'styles'.
*
* @param {Object} next The changed object to compare.
* @param {Object} previous The original object to compare against.
* @param {{maxResults:number}} options Options. maxResults: results to return before truncating.
* @return {string[]} An array of translated changes.
*/
function getGlobalStylesChanges(next, previous, options = {}) {
let changeList = getGlobalStylesChangelist(next, previous);
const changesLength = changeList.length;
const {
maxResults
} = options;
if (changesLength) {
// Truncate to `n` results if necessary.
if (!!maxResults && changesLength > maxResults) {
changeList = changeList.slice(0, maxResults);
}
return Object.entries(changeList.reduce((acc, curr) => {
const group = acc[curr[0]] || [];
if (!group.includes(curr[1])) {
acc[curr[0]] = [...group, curr[1]];
}
return acc;
}, {})).map(([key, changeValues]) => {
const changeValuesLength = changeValues.length;
const joinedChangesValue = changeValues.join((0,external_wp_i18n_namespaceObject.__)(', '));
switch (key) {
case 'blocks':
{
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: a list of block names separated by a comma.
(0,external_wp_i18n_namespaceObject._n)('%s block.', '%s blocks.', changeValuesLength), joinedChangesValue);
}
case 'elements':
{
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: a list of element names separated by a comma.
(0,external_wp_i18n_namespaceObject._n)('%s element.', '%s elements.', changeValuesLength), joinedChangesValue);
}
case 'settings':
{
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: a list of theme.json setting labels separated by a comma.
(0,external_wp_i18n_namespaceObject.__)('%s settings.'), joinedChangesValue);
}
case 'styles':
{
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: a list of theme.json top-level styles labels separated by a comma.
(0,external_wp_i18n_namespaceObject.__)('%s styles.'), joinedChangesValue);
}
default:
{
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: a list of global styles changes separated by a comma.
(0,external_wp_i18n_namespaceObject.__)('%s.'), joinedChangesValue);
}
}
});
}
return get_global_styles_changes_EMPTY_ARRAY;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/index.js
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/rich-text/get-rich-text-values.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/*
* This function is similar to `@wordpress/element`'s `renderToString` function,
* except that it does not render the elements to a string, but instead collects
* the values of all rich text `Content` elements.
*/
function addValuesForElement(element, values, innerBlocks) {
if (null === element || undefined === element || false === element) {
return;
}
if (Array.isArray(element)) {
return addValuesForElements(element, values, innerBlocks);
}
switch (typeof element) {
case 'string':
case 'number':
return;
}
const {
type,
props
} = element;
switch (type) {
case external_wp_element_namespaceObject.StrictMode:
case external_wp_element_namespaceObject.Fragment:
return addValuesForElements(props.children, values, innerBlocks);
case external_wp_element_namespaceObject.RawHTML:
return;
case inner_blocks.Content:
return addValuesForBlocks(values, innerBlocks);
case Content:
values.push(props.value);
return;
}
switch (typeof type) {
case 'string':
if (typeof props.children !== 'undefined') {
return addValuesForElements(props.children, values, innerBlocks);
}
return;
case 'function':
const el = type.prototype && typeof type.prototype.render === 'function' ? new type(props).render() : type(props);
return addValuesForElement(el, values, innerBlocks);
}
}
function addValuesForElements(children, ...args) {
children = Array.isArray(children) ? children : [children];
for (let i = 0; i < children.length; i++) {
addValuesForElement(children[i], ...args);
}
}
function addValuesForBlocks(values, blocks) {
for (let i = 0; i < blocks.length; i++) {
const {
name,
attributes,
innerBlocks
} = blocks[i];
const saveElement = (0,external_wp_blocks_namespaceObject.getSaveElement)(name, attributes,
// Instead of letting save elements use `useInnerBlocksProps.save`,
// force them to use InnerBlocks.Content instead so we can intercept
// a single component.
(0,external_React_.createElement)(inner_blocks.Content, null));
addValuesForElement(saveElement, values, innerBlocks);
}
}
function getRichTextValues(blocks = []) {
external_wp_blocks_namespaceObject.__unstableGetBlockProps.skipFilters = true;
const values = [];
addValuesForBlocks(values, blocks);
external_wp_blocks_namespaceObject.__unstableGetBlockProps.skipFilters = false;
return values.map(value => value instanceof external_wp_richText_namespaceObject.RichTextData ? value : external_wp_richText_namespaceObject.RichTextData.fromHTMLString(value));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/resizable-box-popover/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ResizableBoxPopover({
clientId,
resizableBoxProps,
...props
}) {
return (0,external_React_.createElement)(block_popover, {
clientId: clientId,
__unstableCoverTarget: true,
__unstablePopoverSlot: "__unstable-block-tools-after",
shift: false,
...props
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.ResizableBox, {
...resizableBoxProps
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/use-can-block-toolbar-be-focused.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns true if the block toolbar should be able to receive focus.
*
* @return {boolean} Whether the block toolbar should be able to receive focus
*/
function useCanBlockToolbarBeFocused() {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
__unstableGetEditorMode,
getBlock,
getSettings,
getSelectedBlockClientId,
getFirstMultiSelectedBlockClientId
} = unlock(select(store));
const selectedBlockId = getFirstMultiSelectedBlockClientId() || getSelectedBlockClientId();
const isEmptyDefaultBlock = (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(getBlock(selectedBlockId) || {});
// Fixed Toolbar can be focused when:
// - a block is selected
// - fixed toolbar is on
// Block Toolbar Popover can be focused when:
// - a block is selected
// - we are in edit mode
// - it is not an empty default block
return !!selectedBlockId && (getSettings().hasFixedToolbar || __unstableGetEditorMode() === 'edit' && !isEmptyDefaultBlock);
}, []);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-removal-warning-modal/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BlockRemovalWarningModal({
rules
}) {
const {
clientIds,
selectPrevious,
blockNamesForPrompt,
messageType
} = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(store)).getRemovalPromptData());
const {
clearBlockRemovalPrompt,
setBlockRemovalRules,
privateRemoveBlocks
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
// Load block removal rules, simultaneously signalling that the block
// removal prompt is in place.
(0,external_wp_element_namespaceObject.useEffect)(() => {
setBlockRemovalRules(rules);
return () => {
setBlockRemovalRules();
};
}, [rules, setBlockRemovalRules]);
if (!blockNamesForPrompt) {
return;
}
const message = messageType === 'templates' ? (0,external_wp_i18n_namespaceObject._n)('Deleting this block will stop your post or page content from displaying on this template. It is not recommended.', 'Deleting these blocks will stop your post or page content from displaying on this template. It is not recommended.', blockNamesForPrompt.length) : (0,external_wp_i18n_namespaceObject._n)('Deleting this block could break patterns on your site that have content linked to it. Are you sure you want to delete it?', 'Deleting these blocks could break patterns on your site that have content linked to them. Are you sure you want to delete them?', blockNamesForPrompt.length);
const onConfirmRemoval = () => {
privateRemoveBlocks(clientIds, selectPrevious, /* force */true);
clearBlockRemovalPrompt();
};
return (0,external_React_.createElement)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Be careful!'),
onRequestClose: clearBlockRemovalPrompt,
size: "medium"
}, (0,external_React_.createElement)("p", null, message), (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "right"
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: clearBlockRemovalPrompt
}, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: onConfirmRemoval
}, (0,external_wp_i18n_namespaceObject.__)('Delete'))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/scale-tool.js
/**
* WordPress dependencies
*/
/**
* @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps
*/
/**
* The descriptions are purposely made generic as object-fit could be used for
* any replaced element. Provide your own set of options if you need different
* help text or labels.
*
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/Replaced_element
*
* @type {SelectControlProps[]}
*/
const DEFAULT_SCALE_OPTIONS = [{
value: 'fill',
label: (0,external_wp_i18n_namespaceObject._x)('Fill', 'Scale option for dimensions control'),
help: (0,external_wp_i18n_namespaceObject.__)('Fill the space by stretching the content.')
}, {
value: 'contain',
label: (0,external_wp_i18n_namespaceObject._x)('Contain', 'Scale option for dimensions control'),
help: (0,external_wp_i18n_namespaceObject.__)('Fit the content to the space without clipping.')
}, {
value: 'cover',
label: (0,external_wp_i18n_namespaceObject._x)('Cover', 'Scale option for dimensions control'),
help: (0,external_wp_i18n_namespaceObject.__)("Fill the space by clipping what doesn't fit.")
}, {
value: 'none',
label: (0,external_wp_i18n_namespaceObject._x)('None', 'Scale option for dimensions control'),
help: (0,external_wp_i18n_namespaceObject.__)('Do not adjust the sizing of the content. Content that is too large will be clipped, and content that is too small will have additional padding.')
}, {
value: 'scale-down',
label: (0,external_wp_i18n_namespaceObject._x)('Scale down', 'Scale option for dimensions control'),
help: (0,external_wp_i18n_namespaceObject.__)('Scale down the content to fit the space if it is too big. Content that is too small will have additional padding.')
}];
/**
* @callback ScaleToolPropsOnChange
* @param {string} nextValue New scale value.
* @return {void}
*/
/**
* @typedef {Object} ScaleToolProps
* @property {string} [panelId] ID of the panel that contains the controls.
* @property {string} [value] Current scale value.
* @property {ScaleToolPropsOnChange} [onChange] Callback to update the scale value.
* @property {SelectControlProps[]} [options] Scale options.
* @property {string} [defaultValue] Default scale value.
* @property {boolean} [showControl=true] Whether to show the control.
* @property {boolean} [isShownByDefault=true] Whether the tool panel is shown by default.
*/
/**
* A tool to select the CSS object-fit property for the image.
*
* @param {ScaleToolProps} props
*
* @return {import('react').ReactElement} The scale tool.
*/
function ScaleTool({
panelId,
value,
onChange,
options = DEFAULT_SCALE_OPTIONS,
defaultValue = DEFAULT_SCALE_OPTIONS[0].value,
isShownByDefault = true
}) {
// Match the CSS default so if the value is used directly in CSS it will look correct in the control.
const displayValue = value !== null && value !== void 0 ? value : 'fill';
const scaleHelp = (0,external_wp_element_namespaceObject.useMemo)(() => {
return options.reduce((acc, option) => {
acc[option.value] = option.help;
return acc;
}, {});
}, [options]);
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Scale'),
isShownByDefault: isShownByDefault,
hasValue: () => displayValue !== defaultValue,
onDeselect: () => onChange(defaultValue),
panelId: panelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Scale'),
isBlock: true,
help: scaleHelp[displayValue],
value: displayValue,
onChange: onChange,
size: '__unstable-large'
}, options.map(option => (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
key: option.value,
...option
}))));
}
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
function extends_extends() {
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_extends.apply(this, arguments);
}
;// CONCATENATED MODULE: ./node_modules/@emotion/styled/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
function memoize(fn) {
var cache = Object.create(null);
return function (arg) {
if (cache[arg] === undefined) cache[arg] = fn(arg);
return cache[arg];
};
}
;// CONCATENATED MODULE: ./node_modules/@emotion/styled/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
var isPropValid = /* #__PURE__ */memoize(function (prop) {
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
/* o */
&& prop.charCodeAt(1) === 110
/* n */
&& prop.charCodeAt(2) < 91;
}
/* Z+1 */
);
;// CONCATENATED MODULE: ./node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js
/*
Based off glamor's StyleSheet, thanks Sunil ❤️
high performance StyleSheet for css-in-js systems
- uses multiple style tags behind the scenes for millions of rules
- uses `insertRule` for appending in production for *much* faster performance
// usage
import { StyleSheet } from '@emotion/sheet'
let styleSheet = new StyleSheet({ key: '', container: document.head })
styleSheet.insert('#box { border: 1px solid red; }')
- appends a css rule into the stylesheet
styleSheet.flush()
- empties the stylesheet of all its contents
*/
// $FlowFixMe
function sheetForTag(tag) {
if (tag.sheet) {
// $FlowFixMe
return tag.sheet;
} // this weirdness brought to you by firefox
/* istanbul ignore next */
for (var i = 0; i < document.styleSheets.length; i++) {
if (document.styleSheets[i].ownerNode === tag) {
// $FlowFixMe
return document.styleSheets[i];
}
}
}
function createStyleElement(options) {
var tag = document.createElement('style');
tag.setAttribute('data-emotion', options.key);
if (options.nonce !== undefined) {
tag.setAttribute('nonce', options.nonce);
}
tag.appendChild(document.createTextNode(''));
tag.setAttribute('data-s', '');
return tag;
}
var StyleSheet = /*#__PURE__*/function () {
// Using Node instead of HTMLElement since container may be a ShadowRoot
function StyleSheet(options) {
var _this = this;
this._insertTag = function (tag) {
var before;
if (_this.tags.length === 0) {
if (_this.insertionPoint) {
before = _this.insertionPoint.nextSibling;
} else if (_this.prepend) {
before = _this.container.firstChild;
} else {
before = _this.before;
}
} else {
before = _this.tags[_this.tags.length - 1].nextSibling;
}
_this.container.insertBefore(tag, before);
_this.tags.push(tag);
};
this.isSpeedy = options.speedy === undefined ? "production" === 'production' : options.speedy;
this.tags = [];
this.ctr = 0;
this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
this.key = options.key;
this.container = options.container;
this.prepend = options.prepend;
this.insertionPoint = options.insertionPoint;
this.before = null;
}
var _proto = StyleSheet.prototype;
_proto.hydrate = function hydrate(nodes) {
nodes.forEach(this._insertTag);
};
_proto.insert = function insert(rule) {
// the max length is how many rules we have per style tag, it's 65000 in speedy mode
// it's 1 in dev because we insert source maps that map a single rule to a location
// and you can only have one source map per style tag
if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
this._insertTag(createStyleElement(this));
}
var tag = this.tags[this.tags.length - 1];
if (false) { var isImportRule; }
if (this.isSpeedy) {
var sheet = sheetForTag(tag);
try {
// this is the ultrafast version, works across browsers
// the big drawback is that the css won't be editable in devtools
sheet.insertRule(rule, sheet.cssRules.length);
} catch (e) {
if (false) {}
}
} else {
tag.appendChild(document.createTextNode(rule));
}
this.ctr++;
};
_proto.flush = function flush() {
// $FlowFixMe
this.tags.forEach(function (tag) {
return tag.parentNode && tag.parentNode.removeChild(tag);
});
this.tags = [];
this.ctr = 0;
if (false) {}
};
return StyleSheet;
}();
;// CONCATENATED MODULE: ./node_modules/stylis/src/Utility.js
/**
* @param {number}
* @return {number}
*/
var abs = Math.abs
/**
* @param {number}
* @return {string}
*/
var Utility_from = String.fromCharCode
/**
* @param {object}
* @return {object}
*/
var Utility_assign = Object.assign
/**
* @param {string} value
* @param {number} length
* @return {number}
*/
function hash (value, length) {
return Utility_charat(value, 0) ^ 45 ? (((((((length << 2) ^ Utility_charat(value, 0)) << 2) ^ Utility_charat(value, 1)) << 2) ^ Utility_charat(value, 2)) << 2) ^ Utility_charat(value, 3) : 0
}
/**
* @param {string} value
* @return {string}
*/
function trim (value) {
return value.trim()
}
/**
* @param {string} value
* @param {RegExp} pattern
* @return {string?}
*/
function Utility_match (value, pattern) {
return (value = pattern.exec(value)) ? value[0] : value
}
/**
* @param {string} value
* @param {(string|RegExp)} pattern
* @param {string} replacement
* @return {string}
*/
function Utility_replace (value, pattern, replacement) {
return value.replace(pattern, replacement)
}
/**
* @param {string} value
* @param {string} search
* @return {number}
*/
function indexof (value, search) {
return value.indexOf(search)
}
/**
* @param {string} value
* @param {number} index
* @return {number}
*/
function Utility_charat (value, index) {
return value.charCodeAt(index) | 0
}
/**
* @param {string} value
* @param {number} begin
* @param {number} end
* @return {string}
*/
function Utility_substr (value, begin, end) {
return value.slice(begin, end)
}
/**
* @param {string} value
* @return {number}
*/
function Utility_strlen (value) {
return value.length
}
/**
* @param {any[]} value
* @return {number}
*/
function Utility_sizeof (value) {
return value.length
}
/**
* @param {any} value
* @param {any[]} array
* @return {any}
*/
function Utility_append (value, array) {
return array.push(value), value
}
/**
* @param {string[]} array
* @param {function} callback
* @return {string}
*/
function Utility_combine (array, callback) {
return array.map(callback).join('')
}
;// CONCATENATED MODULE: ./node_modules/stylis/src/Tokenizer.js
var line = 1
var column = 1
var Tokenizer_length = 0
var Tokenizer_position = 0
var Tokenizer_character = 0
var characters = ''
/**
* @param {string} value
* @param {object | null} root
* @param {object | null} parent
* @param {string} type
* @param {string[] | string} props
* @param {object[] | string} children
* @param {number} length
*/
function node (value, root, parent, type, props, children, length) {
return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}
}
/**
* @param {object} root
* @param {object} props
* @return {object}
*/
function Tokenizer_copy (root, props) {
return Utility_assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)
}
/**
* @return {number}
*/
function Tokenizer_char () {
return Tokenizer_character
}
/**
* @return {number}
*/
function prev () {
Tokenizer_character = Tokenizer_position > 0 ? Utility_charat(characters, --Tokenizer_position) : 0
if (column--, Tokenizer_character === 10)
column = 1, line--
return Tokenizer_character
}
/**
* @return {number}
*/
function next () {
Tokenizer_character = Tokenizer_position < Tokenizer_length ? Utility_charat(characters, Tokenizer_position++) : 0
if (column++, Tokenizer_character === 10)
column = 1, line++
return Tokenizer_character
}
/**
* @return {number}
*/
function peek () {
return Utility_charat(characters, Tokenizer_position)
}
/**
* @return {number}
*/
function caret () {
return Tokenizer_position
}
/**
* @param {number} begin
* @param {number} end
* @return {string}
*/
function slice (begin, end) {
return Utility_substr(characters, begin, end)
}
/**
* @param {number} type
* @return {number}
*/
function token (type) {
switch (type) {
// \0 \t \n \r \s whitespace token
case 0: case 9: case 10: case 13: case 32:
return 5
// ! + , / > @ ~ isolate token
case 33: case 43: case 44: case 47: case 62: case 64: case 126:
// ; { } breakpoint token
case 59: case 123: case 125:
return 4
// : accompanied token
case 58:
return 3
// " ' ( [ opening delimit token
case 34: case 39: case 40: case 91:
return 2
// ) ] closing delimit token
case 41: case 93:
return 1
}
return 0
}
/**
* @param {string} value
* @return {any[]}
*/
function alloc (value) {
return line = column = 1, Tokenizer_length = Utility_strlen(characters = value), Tokenizer_position = 0, []
}
/**
* @param {any} value
* @return {any}
*/
function dealloc (value) {
return characters = '', value
}
/**
* @param {number} type
* @return {string}
*/
function delimit (type) {
return trim(slice(Tokenizer_position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
}
/**
* @param {string} value
* @return {string[]}
*/
function Tokenizer_tokenize (value) {
return dealloc(tokenizer(alloc(value)))
}
/**
* @param {number} type
* @return {string}
*/
function whitespace (type) {
while (Tokenizer_character = peek())
if (Tokenizer_character < 33)
next()
else
break
return token(type) > 2 || token(Tokenizer_character) > 3 ? '' : ' '
}
/**
* @param {string[]} children
* @return {string[]}
*/
function tokenizer (children) {
while (next())
switch (token(Tokenizer_character)) {
case 0: append(identifier(Tokenizer_position - 1), children)
break
case 2: append(delimit(Tokenizer_character), children)
break
default: append(from(Tokenizer_character), children)
}
return children
}
/**
* @param {number} index
* @param {number} count
* @return {string}
*/
function escaping (index, count) {
while (--count && next())
// not 0-9 A-F a-f
if (Tokenizer_character < 48 || Tokenizer_character > 102 || (Tokenizer_character > 57 && Tokenizer_character < 65) || (Tokenizer_character > 70 && Tokenizer_character < 97))
break
return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))
}
/**
* @param {number} type
* @return {number}
*/
function delimiter (type) {
while (next())
switch (Tokenizer_character) {
// ] ) " '
case type:
return Tokenizer_position
// " '
case 34: case 39:
if (type !== 34 && type !== 39)
delimiter(Tokenizer_character)
break
// (
case 40:
if (type === 41)
delimiter(type)
break
// \
case 92:
next()
break
}
return Tokenizer_position
}
/**
* @param {number} type
* @param {number} index
* @return {number}
*/
function commenter (type, index) {
while (next())
// //
if (type + Tokenizer_character === 47 + 10)
break
// /*
else if (type + Tokenizer_character === 42 + 42 && peek() === 47)
break
return '/*' + slice(index, Tokenizer_position - 1) + '*' + Utility_from(type === 47 ? type : next())
}
/**
* @param {number} index
* @return {string}
*/
function identifier (index) {
while (!token(peek()))
next()
return slice(index, Tokenizer_position)
}
;// CONCATENATED MODULE: ./node_modules/stylis/src/Enum.js
var Enum_MS = '-ms-'
var Enum_MOZ = '-moz-'
var Enum_WEBKIT = '-webkit-'
var COMMENT = 'comm'
var Enum_RULESET = 'rule'
var Enum_DECLARATION = 'decl'
var PAGE = '@page'
var MEDIA = '@media'
var IMPORT = '@import'
var CHARSET = '@charset'
var VIEWPORT = '@viewport'
var SUPPORTS = '@supports'
var DOCUMENT = '@document'
var NAMESPACE = '@namespace'
var Enum_KEYFRAMES = '@keyframes'
var FONT_FACE = '@font-face'
var COUNTER_STYLE = '@counter-style'
var FONT_FEATURE_VALUES = '@font-feature-values'
;// CONCATENATED MODULE: ./node_modules/stylis/src/Serializer.js
/**
* @param {object[]} children
* @param {function} callback
* @return {string}
*/
function Serializer_serialize (children, callback) {
var output = ''
var length = Utility_sizeof(children)
for (var i = 0; i < length; i++)
output += callback(children[i], i, children, callback) || ''
return output
}
/**
* @param {object} element
* @param {number} index
* @param {object[]} children
* @param {function} callback
* @return {string}
*/
function Serializer_stringify (element, index, children, callback) {
switch (element.type) {
case IMPORT: case Enum_DECLARATION: return element.return = element.return || element.value
case COMMENT: return ''
case Enum_KEYFRAMES: return element.return = element.value + '{' + Serializer_serialize(element.children, callback) + '}'
case Enum_RULESET: element.value = element.props.join(',')
}
return Utility_strlen(children = Serializer_serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
}
;// CONCATENATED MODULE: ./node_modules/stylis/src/Middleware.js
/**
* @param {function[]} collection
* @return {function}
*/
function middleware (collection) {
var length = Utility_sizeof(collection)
return function (element, index, children, callback) {
var output = ''
for (var i = 0; i < length; i++)
output += collection[i](element, index, children, callback) || ''
return output
}
}
/**
* @param {function} callback
* @return {function}
*/
function rulesheet (callback) {
return function (element) {
if (!element.root)
if (element = element.return)
callback(element)
}
}
/**
* @param {object} element
* @param {number} index
* @param {object[]} children
* @param {function} callback
*/
function prefixer (element, index, children, callback) {
if (element.length > -1)
if (!element.return)
switch (element.type) {
case DECLARATION: element.return = prefix(element.value, element.length, children)
return
case KEYFRAMES:
return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)
case RULESET:
if (element.length)
return combine(element.props, function (value) {
switch (match(value, /(::plac\w+|:read-\w+)/)) {
// :read-(only|write)
case ':read-only': case ':read-write':
return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback)
// :placeholder
case '::placeholder':
return serialize([
copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}),
copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}),
copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]})
], callback)
}
return ''
})
}
}
/**
* @param {object} element
* @param {number} index
* @param {object[]} children
*/
function namespace (element) {
switch (element.type) {
case RULESET:
element.props = element.props.map(function (value) {
return combine(tokenize(value), function (value, index, children) {
switch (charat(value, 0)) {
// \f
case 12:
return substr(value, 1, strlen(value))
// \0 ( + > ~
case 0: case 40: case 43: case 62: case 126:
return value
// :
case 58:
if (children[++index] === 'global')
children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1)
// \s
case 32:
return index === 1 ? '' : value
default:
switch (index) {
case 0: element = value
return sizeof(children) > 1 ? '' : value
case index = sizeof(children) - 1: case 2:
return index === 2 ? value + element + element : value + element
default:
return value
}
}
})
})
}
}
;// CONCATENATED MODULE: ./node_modules/stylis/src/Parser.js
/**
* @param {string} value
* @return {object[]}
*/
function compile (value) {
return dealloc(Parser_parse('', null, null, null, [''], value = alloc(value), 0, [0], value))
}
/**
* @param {string} value
* @param {object} root
* @param {object?} parent
* @param {string[]} rule
* @param {string[]} rules
* @param {string[]} rulesets
* @param {number[]} pseudo
* @param {number[]} points
* @param {string[]} declarations
* @return {object}
*/
function Parser_parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
var index = 0
var offset = 0
var length = pseudo
var atrule = 0
var property = 0
var previous = 0
var variable = 1
var scanning = 1
var ampersand = 1
var character = 0
var type = ''
var props = rules
var children = rulesets
var reference = rule
var characters = type
while (scanning)
switch (previous = character, character = next()) {
// (
case 40:
if (previous != 108 && Utility_charat(characters, length - 1) == 58) {
if (indexof(characters += Utility_replace(delimit(character), '&', '&\f'), '&\f') != -1)
ampersand = -1
break
}
// " ' [
case 34: case 39: case 91:
characters += delimit(character)
break
// \t \n \r \s
case 9: case 10: case 13: case 32:
characters += whitespace(previous)
break
// \
case 92:
characters += escaping(caret() - 1, 7)
continue
// /
case 47:
switch (peek()) {
case 42: case 47:
Utility_append(Parser_comment(commenter(next(), caret()), root, parent), declarations)
break
default:
characters += '/'
}
break
// {
case 123 * variable:
points[index++] = Utility_strlen(characters) * ampersand
// } ; \0
case 125 * variable: case 59: case 0:
switch (character) {
// \0 }
case 0: case 125: scanning = 0
// ;
case 59 + offset:
if (property > 0 && (Utility_strlen(characters) - length))
Utility_append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(Utility_replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)
break
// @ ;
case 59: characters += ';'
// { rule/at-rule
default:
Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)
if (character === 123)
if (offset === 0)
Parser_parse(characters, root, reference, reference, props, rulesets, length, points, children)
else
switch (atrule === 99 && Utility_charat(characters, 3) === 110 ? 100 : atrule) {
// d m s
case 100: case 109: case 115:
Parser_parse(value, reference, reference, rule && Utility_append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children)
break
default:
Parser_parse(characters, reference, reference, reference, [''], children, 0, points, children)
}
}
index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo
break
// :
case 58:
length = 1 + Utility_strlen(characters), property = previous
default:
if (variable < 1)
if (character == 123)
--variable
else if (character == 125 && variable++ == 0 && prev() == 125)
continue
switch (characters += Utility_from(character), character * variable) {
// &
case 38:
ampersand = offset > 0 ? 1 : (characters += '\f', -1)
break
// ,
case 44:
points[index++] = (Utility_strlen(characters) - 1) * ampersand, ampersand = 1
break
// @
case 64:
// -
if (peek() === 45)
characters += delimit(next())
atrule = peek(), offset = length = Utility_strlen(type = characters += identifier(caret())), character++
break
// -
case 45:
if (previous === 45 && Utility_strlen(characters) == 2)
variable = 0
}
}
return rulesets
}
/**
* @param {string} value
* @param {object} root
* @param {object?} parent
* @param {number} index
* @param {number} offset
* @param {string[]} rules
* @param {number[]} points
* @param {string} type
* @param {string[]} props
* @param {string[]} children
* @param {number} length
* @return {object}
*/
function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {
var post = offset - 1
var rule = offset === 0 ? rules : ['']
var size = Utility_sizeof(rule)
for (var i = 0, j = 0, k = 0; i < index; ++i)
for (var x = 0, y = Utility_substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
if (z = trim(j > 0 ? rule[x] + ' ' + y : Utility_replace(y, /&\f/g, rule[x])))
props[k++] = z
return node(value, root, parent, offset === 0 ? Enum_RULESET : type, props, children, length)
}
/**
* @param {number} value
* @param {object} root
* @param {object?} parent
* @return {object}
*/
function Parser_comment (value, root, parent) {
return node(value, root, parent, COMMENT, Utility_from(Tokenizer_char()), Utility_substr(value, 2, -2), 0)
}
/**
* @param {string} value
* @param {object} root
* @param {object?} parent
* @param {number} length
* @return {object}
*/
function declaration (value, root, parent, length) {
return node(value, root, parent, Enum_DECLARATION, Utility_substr(value, 0, length), Utility_substr(value, length + 1, -1), length)
}
;// CONCATENATED MODULE: ./node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
var previous = 0;
var character = 0;
while (true) {
previous = character;
character = peek(); // &\f
if (previous === 38 && character === 12) {
points[index] = 1;
}
if (token(character)) {
break;
}
next();
}
return slice(begin, Tokenizer_position);
};
var toRules = function toRules(parsed, points) {
// pretend we've started with a comma
var index = -1;
var character = 44;
do {
switch (token(character)) {
case 0:
// &\f
if (character === 38 && peek() === 12) {
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
// and when it should just concatenate the outer and inner selectors
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
points[index] = 1;
}
parsed[index] += identifierWithPointTracking(Tokenizer_position - 1, points, index);
break;
case 2:
parsed[index] += delimit(character);
break;
case 4:
// comma
if (character === 44) {
// colon
parsed[++index] = peek() === 58 ? '&\f' : '';
points[index] = parsed[index].length;
break;
}
// fallthrough
default:
parsed[index] += Utility_from(character);
}
} while (character = next());
return parsed;
};
var getRules = function getRules(value, points) {
return dealloc(toRules(alloc(value), points));
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
var fixedElements = /* #__PURE__ */new WeakMap();
var compat = function compat(element) {
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
// negative .length indicates that this rule has been already prefixed
element.length < 1) {
return;
}
var value = element.value,
parent = element.parent;
var isImplicitRule = element.column === parent.column && element.line === parent.line;
while (parent.type !== 'rule') {
parent = parent.parent;
if (!parent) return;
} // short-circuit for the simplest case
if (element.props.length === 1 && value.charCodeAt(0) !== 58
/* colon */
&& !fixedElements.get(parent)) {
return;
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
if (isImplicitRule) {
return;
}
fixedElements.set(element, true);
var points = [];
var rules = getRules(value, points);
var parentRules = parent.props;
for (var i = 0, k = 0; i < rules.length; i++) {
for (var j = 0; j < parentRules.length; j++, k++) {
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
}
}
};
var removeLabel = function removeLabel(element) {
if (element.type === 'decl') {
var value = element.value;
if ( // charcode for l
value.charCodeAt(0) === 108 && // charcode for b
value.charCodeAt(2) === 98) {
// this ignores label
element["return"] = '';
element.value = '';
}
}
};
var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
var isIgnoringComment = function isIgnoringComment(element) {
return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
};
var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
return function (element, index, children) {
if (element.type !== 'rule' || cache.compat) return;
var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
if (unsafePseudoClasses) {
var isNested = element.parent === children[0]; // in nested rules comments become children of the "auto-inserted" rule
//
// considering this input:
// .a {
// .b /* comm */ {}
// color: hotpink;
// }
// we get output corresponding to this:
// .a {
// & {
// /* comm */
// color: hotpink;
// }
// .b {}
// }
var commentContainer = isNested ? children[0].children : // global rule at the root level
children;
for (var i = commentContainer.length - 1; i >= 0; i--) {
var node = commentContainer[i];
if (node.line < element.line) {
break;
} // it is quite weird but comments are *usually* put at `column: element.column - 1`
// so we seek *from the end* for the node that is earlier than the rule's `element` and check that
// this will also match inputs like this:
// .a {
// /* comm */
// .b {}
// }
//
// but that is fine
//
// it would be the easiest to change the placement of the comment to be the first child of the rule:
// .a {
// .b { /* comm */ }
// }
// with such inputs we wouldn't have to search for the comment at all
// TODO: consider changing this comment placement in the next major version
if (node.column < element.column) {
if (isIgnoringComment(node)) {
return;
}
break;
}
}
unsafePseudoClasses.forEach(function (unsafePseudoClass) {
console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
});
}
};
};
var isImportRule = function isImportRule(element) {
return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
};
var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
for (var i = index - 1; i >= 0; i--) {
if (!isImportRule(children[i])) {
return true;
}
}
return false;
}; // use this to remove incorrect elements from further processing
// so they don't get handed to the `sheet` (or anything else)
// as that could potentially lead to additional logs which in turn could be overhelming to the user
var nullifyElement = function nullifyElement(element) {
element.type = '';
element.value = '';
element["return"] = '';
element.children = '';
element.props = '';
};
var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
if (!isImportRule(element)) {
return;
}
if (element.parent) {
console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
nullifyElement(element);
} else if (isPrependedWithRegularRules(index, children)) {
console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
nullifyElement(element);
}
};
/* eslint-disable no-fallthrough */
function emotion_cache_browser_esm_prefix(value, length) {
switch (hash(value, length)) {
// color-adjust
case 5103:
return Enum_WEBKIT + 'print-' + value + value;
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
case 5737:
case 4201:
case 3177:
case 3433:
case 1641:
case 4457:
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
case 5572:
case 6356:
case 5844:
case 3191:
case 6645:
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
case 6391:
case 5879:
case 5623:
case 6135:
case 4599:
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
case 4215:
case 6389:
case 5109:
case 5365:
case 5621:
case 3829:
return Enum_WEBKIT + value + value;
// appearance, user-select, transform, hyphens, text-size-adjust
case 5349:
case 4246:
case 4810:
case 6968:
case 2756:
return Enum_WEBKIT + value + Enum_MOZ + value + Enum_MS + value + value;
// flex, flex-direction
case 6828:
case 4268:
return Enum_WEBKIT + value + Enum_MS + value + value;
// order
case 6165:
return Enum_WEBKIT + value + Enum_MS + 'flex-' + value + value;
// align-items
case 5187:
return Enum_WEBKIT + value + Utility_replace(value, /(\w+).+(:[^]+)/, Enum_WEBKIT + 'box-$1$2' + Enum_MS + 'flex-$1$2') + value;
// align-self
case 5443:
return Enum_WEBKIT + value + Enum_MS + 'flex-item-' + Utility_replace(value, /flex-|-self/, '') + value;
// align-content
case 4675:
return Enum_WEBKIT + value + Enum_MS + 'flex-line-pack' + Utility_replace(value, /align-content|flex-|-self/, '') + value;
// flex-shrink
case 5548:
return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'shrink', 'negative') + value;
// flex-basis
case 5292:
return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'basis', 'preferred-size') + value;
// flex-grow
case 6060:
return Enum_WEBKIT + 'box-' + Utility_replace(value, '-grow', '') + Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'grow', 'positive') + value;
// transition
case 4554:
return Enum_WEBKIT + Utility_replace(value, /([^-])(transform)/g, '$1' + Enum_WEBKIT + '$2') + value;
// cursor
case 6187:
return Utility_replace(Utility_replace(Utility_replace(value, /(zoom-|grab)/, Enum_WEBKIT + '$1'), /(image-set)/, Enum_WEBKIT + '$1'), value, '') + value;
// background, background-image
case 5495:
case 3959:
return Utility_replace(value, /(image-set\([^]*)/, Enum_WEBKIT + '$1' + '$`$1');
// justify-content
case 4968:
return Utility_replace(Utility_replace(value, /(.+:)(flex-)?(.*)/, Enum_WEBKIT + 'box-pack:$3' + Enum_MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + Enum_WEBKIT + value + value;
// (margin|padding)-inline-(start|end)
case 4095:
case 3583:
case 4068:
case 2532:
return Utility_replace(value, /(.+)-inline(.+)/, Enum_WEBKIT + '$1$2') + value;
// (min|max)?(width|height|inline-size|block-size)
case 8116:
case 7059:
case 5753:
case 5535:
case 5445:
case 5701:
case 4933:
case 4677:
case 5533:
case 5789:
case 5021:
case 4765:
// stretch, max-content, min-content, fill-available
if (Utility_strlen(value) - 1 - length > 6) switch (Utility_charat(value, length + 1)) {
// (m)ax-content, (m)in-content
case 109:
// -
if (Utility_charat(value, length + 4) !== 45) break;
// (f)ill-available, (f)it-content
case 102:
return Utility_replace(value, /(.+:)(.+)-([^]+)/, '$1' + Enum_WEBKIT + '$2-$3' + '$1' + Enum_MOZ + (Utility_charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
// (s)tretch
case 115:
return ~indexof(value, 'stretch') ? emotion_cache_browser_esm_prefix(Utility_replace(value, 'stretch', 'fill-available'), length) + value : value;
}
break;
// position: sticky
case 4949:
// (s)ticky?
if (Utility_charat(value, length + 1) !== 115) break;
// display: (flex|inline-flex)
case 6444:
switch (Utility_charat(value, Utility_strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
// stic(k)y
case 107:
return Utility_replace(value, ':', ':' + Enum_WEBKIT) + value;
// (inline-)?fl(e)x
case 101:
return Utility_replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + Enum_WEBKIT + (Utility_charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + Enum_WEBKIT + '$2$3' + '$1' + Enum_MS + '$2box$3') + value;
}
break;
// writing-mode
case 5936:
switch (Utility_charat(value, length + 11)) {
// vertical-l(r)
case 114:
return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
// vertical-r(l)
case 108:
return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
// horizontal(-)tb
case 45:
return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
}
return Enum_WEBKIT + value + Enum_MS + value + value;
}
return value;
}
var emotion_cache_browser_esm_prefixer = function prefixer(element, index, children, callback) {
if (element.length > -1) if (!element["return"]) switch (element.type) {
case Enum_DECLARATION:
element["return"] = emotion_cache_browser_esm_prefix(element.value, element.length);
break;
case Enum_KEYFRAMES:
return Serializer_serialize([Tokenizer_copy(element, {
value: Utility_replace(element.value, '@', '@' + Enum_WEBKIT)
})], callback);
case Enum_RULESET:
if (element.length) return Utility_combine(element.props, function (value) {
switch (Utility_match(value, /(::plac\w+|:read-\w+)/)) {
// :read-(only|write)
case ':read-only':
case ':read-write':
return Serializer_serialize([Tokenizer_copy(element, {
props: [Utility_replace(value, /:(read-\w+)/, ':' + Enum_MOZ + '$1')]
})], callback);
// :placeholder
case '::placeholder':
return Serializer_serialize([Tokenizer_copy(element, {
props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_WEBKIT + 'input-$1')]
}), Tokenizer_copy(element, {
props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_MOZ + '$1')]
}), Tokenizer_copy(element, {
props: [Utility_replace(value, /:(plac\w+)/, Enum_MS + 'input-$1')]
})], callback);
}
return '';
});
}
};
var defaultStylisPlugins = [emotion_cache_browser_esm_prefixer];
var emotion_cache_browser_esm_createCache = function createCache(options) {
var key = options.key;
if (false) {}
if ( key === 'css') {
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
// note this very very intentionally targets all style elements regardless of the key to ensure
// that creating a cache works inside of render of a React component
Array.prototype.forEach.call(ssrStyles, function (node) {
// we want to only move elements which have a space in the data-emotion attribute value
// because that indicates that it is an Emotion 11 server-side rendered style elements
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
// will not result in the Emotion 10 styles being destroyed
var dataEmotionAttribute = node.getAttribute('data-emotion');
if (dataEmotionAttribute.indexOf(' ') === -1) {
return;
}
document.head.appendChild(node);
node.setAttribute('data-s', '');
});
}
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
if (false) {}
var inserted = {};
var container;
var nodesToHydrate = [];
{
container = options.container || document.head;
Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe
for (var i = 1; i < attrib.length; i++) {
inserted[attrib[i]] = true;
}
nodesToHydrate.push(node);
});
}
var _insert;
var omnipresentPlugins = [compat, removeLabel];
if (false) {}
{
var currentSheet;
var finalizingPlugins = [Serializer_stringify, false ? 0 : rulesheet(function (rule) {
currentSheet.insert(rule);
})];
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
var stylis = function stylis(styles) {
return Serializer_serialize(compile(styles), serializer);
};
_insert = function insert(selector, serialized, sheet, shouldCache) {
currentSheet = sheet;
if (false) {}
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
if (shouldCache) {
cache.inserted[serialized.name] = true;
}
};
}
var cache = {
key: key,
sheet: new StyleSheet({
key: key,
container: container,
nonce: options.nonce,
speedy: options.speedy,
prepend: options.prepend,
insertionPoint: options.insertionPoint
}),
nonce: options.nonce,
inserted: inserted,
registered: {},
insert: _insert
};
cache.sheet.hydrate(nodesToHydrate);
return cache;
};
/* harmony default export */ const emotion_cache_browser_esm = (emotion_cache_browser_esm_createCache);
;// CONCATENATED MODULE: ./node_modules/@emotion/hash/dist/emotion-hash.esm.js
/* eslint-disable */
// Inspired by https://github.com/garycourt/murmurhash-js
// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
function murmur2(str) {
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
// const m = 0x5bd1e995;
// const r = 24;
// Initialize the hash
var h = 0; // Mix 4 bytes at a time into the hash
var k,
i = 0,
len = str.length;
for (; len >= 4; ++i, len -= 4) {
k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
k =
/* Math.imul(k, m): */
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
k ^=
/* k >>> r: */
k >>> 24;
h =
/* Math.imul(k, m): */
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
/* Math.imul(h, m): */
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
} // Handle the last few bytes of the input array
switch (len) {
case 3:
h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
case 2:
h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
case 1:
h ^= str.charCodeAt(i) & 0xff;
h =
/* Math.imul(h, m): */
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
} // Do a few final mixes of the hash to ensure the last few
// bytes are well-incorporated.
h ^= h >>> 13;
h =
/* Math.imul(h, m): */
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
return ((h ^ h >>> 15) >>> 0).toString(36);
}
/* harmony default export */ const emotion_hash_esm = (murmur2);
;// CONCATENATED MODULE: ./node_modules/@emotion/unitless/dist/emotion-unitless.esm.js
var unitlessKeys = {
animationIterationCount: 1,
borderImageOutset: 1,
borderImageSlice: 1,
borderImageWidth: 1,
boxFlex: 1,
boxFlexGroup: 1,
boxOrdinalGroup: 1,
columnCount: 1,
columns: 1,
flex: 1,
flexGrow: 1,
flexPositive: 1,
flexShrink: 1,
flexNegative: 1,
flexOrder: 1,
gridRow: 1,
gridRowEnd: 1,
gridRowSpan: 1,
gridRowStart: 1,
gridColumn: 1,
gridColumnEnd: 1,
gridColumnSpan: 1,
gridColumnStart: 1,
msGridRow: 1,
msGridRowSpan: 1,
msGridColumn: 1,
msGridColumnSpan: 1,
fontWeight: 1,
lineHeight: 1,
opacity: 1,
order: 1,
orphans: 1,
tabSize: 1,
widows: 1,
zIndex: 1,
zoom: 1,
WebkitLineClamp: 1,
// SVG-related properties
fillOpacity: 1,
floodOpacity: 1,
stopOpacity: 1,
strokeDasharray: 1,
strokeDashoffset: 1,
strokeMiterlimit: 1,
strokeOpacity: 1,
strokeWidth: 1
};
/* harmony default export */ const emotion_unitless_esm = (unitlessKeys);
;// CONCATENATED MODULE: ./node_modules/@emotion/serialize/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
function emotion_memoize_esm_memoize(fn) {
var cache = Object.create(null);
return function (arg) {
if (cache[arg] === undefined) cache[arg] = fn(arg);
return cache[arg];
};
}
;// CONCATENATED MODULE: ./node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js
var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).";
var hyphenateRegex = /[A-Z]|^ms/g;
var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
var isCustomProperty = function isCustomProperty(property) {
return property.charCodeAt(1) === 45;
};
var isProcessableValue = function isProcessableValue(value) {
return value != null && typeof value !== 'boolean';
};
var processStyleName = /* #__PURE__ */emotion_memoize_esm_memoize(function (styleName) {
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
});
var processStyleValue = function processStyleValue(key, value) {
switch (key) {
case 'animation':
case 'animationName':
{
if (typeof value === 'string') {
return value.replace(animationRegex, function (match, p1, p2) {
cursor = {
name: p1,
styles: p2,
next: cursor
};
return p1;
});
}
}
}
if (emotion_unitless_esm[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {
return value + 'px';
}
return value;
};
if (false) { var hyphenatedCache, hyphenPattern, msPattern, oldProcessStyleValue, contentValues, contentValuePattern; }
var noComponentSelectorMessage = (/* unused pure expression or super */ null && ('Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.'));
function handleInterpolation(mergedProps, registered, interpolation) {
if (interpolation == null) {
return '';
}
if (interpolation.__emotion_styles !== undefined) {
if (false) {}
return interpolation;
}
switch (typeof interpolation) {
case 'boolean':
{
return '';
}
case 'object':
{
if (interpolation.anim === 1) {
cursor = {
name: interpolation.name,
styles: interpolation.styles,
next: cursor
};
return interpolation.name;
}
if (interpolation.styles !== undefined) {
var next = interpolation.next;
if (next !== undefined) {
// not the most efficient thing ever but this is a pretty rare case
// and there will be very few iterations of this generally
while (next !== undefined) {
cursor = {
name: next.name,
styles: next.styles,
next: cursor
};
next = next.next;
}
}
var styles = interpolation.styles + ";";
if (false) {}
return styles;
}
return createStringFromObject(mergedProps, registered, interpolation);
}
case 'function':
{
if (mergedProps !== undefined) {
var previousCursor = cursor;
var result = interpolation(mergedProps);
cursor = previousCursor;
return handleInterpolation(mergedProps, registered, result);
} else if (false) {}
break;
}
case 'string':
if (false) { var replaced, matched; }
break;
} // finalize string values (regular strings and functions interpolated into css calls)
if (registered == null) {
return interpolation;
}
var cached = registered[interpolation];
return cached !== undefined ? cached : interpolation;
}
function createStringFromObject(mergedProps, registered, obj) {
var string = '';
if (Array.isArray(obj)) {
for (var i = 0; i < obj.length; i++) {
string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
}
} else {
for (var _key in obj) {
var value = obj[_key];
if (typeof value !== 'object') {
if (registered != null && registered[value] !== undefined) {
string += _key + "{" + registered[value] + "}";
} else if (isProcessableValue(value)) {
string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";";
}
} else {
if (_key === 'NO_COMPONENT_SELECTOR' && "production" !== 'production') {}
if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
for (var _i = 0; _i < value.length; _i++) {
if (isProcessableValue(value[_i])) {
string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";";
}
}
} else {
var interpolated = handleInterpolation(mergedProps, registered, value);
switch (_key) {
case 'animation':
case 'animationName':
{
string += processStyleName(_key) + ":" + interpolated + ";";
break;
}
default:
{
if (false) {}
string += _key + "{" + interpolated + "}";
}
}
}
}
}
}
return string;
}
var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g;
var sourceMapPattern;
if (false) {} // this is the cursor for keyframes
// keyframes are stored on the SerializedStyles object as a linked list
var cursor;
var emotion_serialize_browser_esm_serializeStyles = function serializeStyles(args, registered, mergedProps) {
if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
return args[0];
}
var stringMode = true;
var styles = '';
cursor = undefined;
var strings = args[0];
if (strings == null || strings.raw === undefined) {
stringMode = false;
styles += handleInterpolation(mergedProps, registered, strings);
} else {
if (false) {}
styles += strings[0];
} // we start at 1 since we've already handled the first arg
for (var i = 1; i < args.length; i++) {
styles += handleInterpolation(mergedProps, registered, args[i]);
if (stringMode) {
if (false) {}
styles += strings[i];
}
}
var sourceMap;
if (false) {} // using a global regex with .exec is stateful so lastIndex has to be reset each time
labelPattern.lastIndex = 0;
var identifierName = '';
var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
while ((match = labelPattern.exec(styles)) !== null) {
identifierName += '-' + // $FlowFixMe we know it's not null
match[1];
}
var name = emotion_hash_esm(styles) + identifierName;
if (false) {}
return {
name: name,
styles: styles,
next: cursor
};
};
;// CONCATENATED MODULE: ./node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js
var syncFallback = function syncFallback(create) {
return create();
};
var useInsertionEffect = external_React_['useInsertion' + 'Effect'] ? external_React_['useInsertion' + 'Effect'] : false;
var emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback;
var useInsertionEffectWithLayoutFallback = (/* unused pure expression or super */ null && (useInsertionEffect || useLayoutEffect));
;// CONCATENATED MODULE: ./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js
var emotion_element_6a883da9_browser_esm_hasOwnProperty = {}.hasOwnProperty;
var EmotionCacheContext = /* #__PURE__ */(0,external_React_.createContext)( // we're doing this to avoid preconstruct's dead code elimination in this one case
// because this module is primarily intended for the browser and node
// but it's also required in react native and similar environments sometimes
// and we could have a special build just for that
// but this is much easier and the native packages
// might use a different theme context in the future anyway
typeof HTMLElement !== 'undefined' ? /* #__PURE__ */emotion_cache_browser_esm({
key: 'css'
}) : null);
if (false) {}
var CacheProvider = EmotionCacheContext.Provider;
var __unsafe_useEmotionCache = function useEmotionCache() {
return useContext(EmotionCacheContext);
};
var withEmotionCache = function withEmotionCache(func) {
// $FlowFixMe
return /*#__PURE__*/(0,external_React_.forwardRef)(function (props, ref) {
// the cache will never be null in the browser
var cache = (0,external_React_.useContext)(EmotionCacheContext);
return func(props, cache, ref);
});
};
var ThemeContext = /* #__PURE__ */(0,external_React_.createContext)({});
if (false) {}
var useTheme = function useTheme() {
return useContext(ThemeContext);
};
var getTheme = function getTheme(outerTheme, theme) {
if (typeof theme === 'function') {
var mergedTheme = theme(outerTheme);
if (false) {}
return mergedTheme;
}
if (false) {}
return _extends({}, outerTheme, theme);
};
var createCacheWithTheme = /* #__PURE__ */(/* unused pure expression or super */ null && (weakMemoize(function (outerTheme) {
return weakMemoize(function (theme) {
return getTheme(outerTheme, theme);
});
})));
var ThemeProvider = function ThemeProvider(props) {
var theme = useContext(ThemeContext);
if (props.theme !== theme) {
theme = createCacheWithTheme(theme)(props.theme);
}
return /*#__PURE__*/createElement(ThemeContext.Provider, {
value: theme
}, props.children);
};
function withTheme(Component) {
var componentName = Component.displayName || Component.name || 'Component';
var render = function render(props, ref) {
var theme = useContext(ThemeContext);
return /*#__PURE__*/createElement(Component, _extends({
theme: theme,
ref: ref
}, props));
}; // $FlowFixMe
var WithTheme = /*#__PURE__*/forwardRef(render);
WithTheme.displayName = "WithTheme(" + componentName + ")";
return hoistNonReactStatics(WithTheme, Component);
}
var getLastPart = function getLastPart(functionName) {
// The match may be something like 'Object.createEmotionProps' or
// 'Loader.prototype.render'
var parts = functionName.split('.');
return parts[parts.length - 1];
};
var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
// V8
var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
if (match) return getLastPart(match[1]); // Safari / Firefox
match = /^([A-Za-z0-9$.]+)@/.exec(line);
if (match) return getLastPart(match[1]);
return undefined;
};
var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS
// identifiers, thus we only need to replace what is a valid character for JS,
// but not for CSS.
var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
return identifier.replace(/\$/g, '-');
};
var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
if (!stackTrace) return undefined;
var lines = stackTrace.split('\n');
for (var i = 0; i < lines.length; i++) {
var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error"
if (!functionName) continue; // If we reach one of these, we have gone too far and should quit
if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an
// uppercase letter
if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);
}
return undefined;
};
var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
var createEmotionProps = function createEmotionProps(type, props) {
if (false) {}
var newProps = {};
for (var key in props) {
if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key)) {
newProps[key] = props[key];
}
}
newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when
// the label hasn't already been computed
if (false) { var label; }
return newProps;
};
var Insertion = function Insertion(_ref) {
var cache = _ref.cache,
serialized = _ref.serialized,
isStringTag = _ref.isStringTag;
registerStyles(cache, serialized, isStringTag);
var rules = useInsertionEffectAlwaysWithSyncFallback(function () {
return insertStyles(cache, serialized, isStringTag);
});
return null;
};
var Emotion = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache, ref) {
var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
// not passing the registered cache to serializeStyles because it would
// make certain babel optimisations not possible
if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {
cssProp = cache.registered[cssProp];
}
var WrappedComponent = props[typePropName];
var registeredStyles = [cssProp];
var className = '';
if (typeof props.className === 'string') {
className = getRegisteredStyles(cache.registered, registeredStyles, props.className);
} else if (props.className != null) {
className = props.className + " ";
}
var serialized = serializeStyles(registeredStyles, undefined, useContext(ThemeContext));
if (false) { var labelFromStack; }
className += cache.key + "-" + serialized.name;
var newProps = {};
for (var key in props) {
if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && ( true || 0)) {
newProps[key] = props[key];
}
}
newProps.ref = ref;
newProps.className = className;
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, {
cache: cache,
serialized: serialized,
isStringTag: typeof WrappedComponent === 'string'
}), /*#__PURE__*/createElement(WrappedComponent, newProps));
})));
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js
var isBrowser = "object" !== 'undefined';
function emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, classNames) {
var rawClassName = '';
classNames.split(' ').forEach(function (className) {
if (registered[className] !== undefined) {
registeredStyles.push(registered[className] + ";");
} else {
rawClassName += className + " ";
}
});
return rawClassName;
}
var emotion_utils_browser_esm_registerStyles = function registerStyles(cache, serialized, isStringTag) {
var className = cache.key + "-" + serialized.name;
if ( // we only need to add the styles to the registered cache if the
// class name could be used further down
// the tree but if it's a string tag, we know it won't
// so we don't have to add it to registered cache.
// this improves memory usage since we can avoid storing the whole style string
(isStringTag === false || // we need to always store it if we're in compat mode and
// in node since emotion-server relies on whether a style is in
// the registered cache to know whether a style is global or not
// also, note that this check will be dead code eliminated in the browser
isBrowser === false ) && cache.registered[className] === undefined) {
cache.registered[className] = serialized.styles;
}
};
var emotion_utils_browser_esm_insertStyles = function insertStyles(cache, serialized, isStringTag) {
emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag);
var className = cache.key + "-" + serialized.name;
if (cache.inserted[serialized.name] === undefined) {
var current = serialized;
do {
var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
current = current.next;
} while (current !== undefined);
}
};
;// CONCATENATED MODULE: ./node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js
var testOmitPropsOnStringTag = isPropValid;
var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) {
return key !== 'theme';
};
var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) {
return typeof tag === 'string' && // 96 is one less than the char code
// for "a" so this is checking that
// it's a lowercase character
tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent;
};
var composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) {
var shouldForwardProp;
if (options) {
var optionsShouldForwardProp = options.shouldForwardProp;
shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) {
return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName);
} : optionsShouldForwardProp;
}
if (typeof shouldForwardProp !== 'function' && isReal) {
shouldForwardProp = tag.__emotion_forwardProp;
}
return shouldForwardProp;
};
var emotion_styled_base_browser_esm_ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
var emotion_styled_base_browser_esm_Insertion = function Insertion(_ref) {
var cache = _ref.cache,
serialized = _ref.serialized,
isStringTag = _ref.isStringTag;
emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag);
var rules = emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback(function () {
return emotion_utils_browser_esm_insertStyles(cache, serialized, isStringTag);
});
return null;
};
var createStyled = function createStyled(tag, options) {
if (false) {}
var isReal = tag.__emotion_real === tag;
var baseTag = isReal && tag.__emotion_base || tag;
var identifierName;
var targetClassName;
if (options !== undefined) {
identifierName = options.label;
targetClassName = options.target;
}
var shouldForwardProp = composeShouldForwardProps(tag, options, isReal);
var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag);
var shouldUseAs = !defaultShouldForwardProp('as');
return function () {
var args = arguments;
var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : [];
if (identifierName !== undefined) {
styles.push("label:" + identifierName + ";");
}
if (args[0] == null || args[0].raw === undefined) {
styles.push.apply(styles, args);
} else {
if (false) {}
styles.push(args[0][0]);
var len = args.length;
var i = 1;
for (; i < len; i++) {
if (false) {}
styles.push(args[i], args[0][i]);
}
} // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class
var Styled = withEmotionCache(function (props, cache, ref) {
var FinalTag = shouldUseAs && props.as || baseTag;
var className = '';
var classInterpolations = [];
var mergedProps = props;
if (props.theme == null) {
mergedProps = {};
for (var key in props) {
mergedProps[key] = props[key];
}
mergedProps.theme = (0,external_React_.useContext)(ThemeContext);
}
if (typeof props.className === 'string') {
className = emotion_utils_browser_esm_getRegisteredStyles(cache.registered, classInterpolations, props.className);
} else if (props.className != null) {
className = props.className + " ";
}
var serialized = emotion_serialize_browser_esm_serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps);
className += cache.key + "-" + serialized.name;
if (targetClassName !== undefined) {
className += " " + targetClassName;
}
var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;
var newProps = {};
for (var _key in props) {
if (shouldUseAs && _key === 'as') continue;
if ( // $FlowFixMe
finalShouldForwardProp(_key)) {
newProps[_key] = props[_key];
}
}
newProps.className = className;
newProps.ref = ref;
return /*#__PURE__*/(0,external_React_.createElement)(external_React_.Fragment, null, /*#__PURE__*/(0,external_React_.createElement)(emotion_styled_base_browser_esm_Insertion, {
cache: cache,
serialized: serialized,
isStringTag: typeof FinalTag === 'string'
}), /*#__PURE__*/(0,external_React_.createElement)(FinalTag, newProps));
});
Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")";
Styled.defaultProps = tag.defaultProps;
Styled.__emotion_real = Styled;
Styled.__emotion_base = baseTag;
Styled.__emotion_styles = styles;
Styled.__emotion_forwardProp = shouldForwardProp;
Object.defineProperty(Styled, 'toString', {
value: function value() {
if (targetClassName === undefined && "production" !== 'production') {} // $FlowFixMe: coerce undefined to string
return "." + targetClassName;
}
});
Styled.withComponent = function (nextTag, nextOptions) {
return createStyled(nextTag, extends_extends({}, options, nextOptions, {
shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)
})).apply(void 0, styles);
};
return Styled;
};
};
/* harmony default export */ const emotion_styled_base_browser_esm = (createStyled);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/width-height-tool.js
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const SingleColumnToolsPanelItem = /*#__PURE__*/emotion_styled_base_browser_esm(external_wp_components_namespaceObject.__experimentalToolsPanelItem, true ? {
target: "ef8pe3d0"
} : 0)( true ? {
name: "957xgf",
styles: "grid-column:span 1"
} : 0);
/**
* @typedef {import('@wordpress/components/build-types/unit-control/types').WPUnitControlUnit} WPUnitControlUnit
*/
/**
* @typedef {Object} WidthHeightToolValue
* @property {string} [width] Width CSS value.
* @property {string} [height] Height CSS value.
*/
/**
* @callback WidthHeightToolOnChange
* @param {WidthHeightToolValue} nextValue Next dimensions value.
* @return {void}
*/
/**
* @typedef {Object} WidthHeightToolProps
* @property {string} [panelId] ID of the panel that contains the controls.
* @property {WidthHeightToolValue} [value] Current dimensions values.
* @property {WidthHeightToolOnChange} [onChange] Callback to update the dimensions values.
* @property {WPUnitControlUnit[]} [units] Units options.
* @property {boolean} [isShownByDefault] Whether the panel is shown by default.
*/
/**
* Component that renders controls to edit the dimensions of an image or container.
*
* @param {WidthHeightToolProps} props The component props.
*
* @return {import('react').ReactElement} The width and height tool.
*/
function WidthHeightTool({
panelId,
value = {},
onChange = () => {},
units,
isShownByDefault = true
}) {
var _value$width, _value$height;
// null, undefined, and 'auto' all represent the default value.
const width = value.width === 'auto' ? '' : (_value$width = value.width) !== null && _value$width !== void 0 ? _value$width : '';
const height = value.height === 'auto' ? '' : (_value$height = value.height) !== null && _value$height !== void 0 ? _value$height : '';
const onDimensionChange = dimension => nextDimension => {
const nextValue = {
...value
};
// Empty strings or undefined may be passed and both represent removing the value.
if (!nextDimension) {
delete nextValue[dimension];
} else {
nextValue[dimension] = nextDimension;
}
onChange(nextValue);
};
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(SingleColumnToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Width'),
isShownByDefault: isShownByDefault,
hasValue: () => width !== '',
onDeselect: onDimensionChange('width'),
panelId: panelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Width'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Auto'),
labelPosition: "top",
units: units,
min: 0,
value: width,
onChange: onDimensionChange('width'),
size: '__unstable-large'
})), (0,external_React_.createElement)(SingleColumnToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Height'),
isShownByDefault: isShownByDefault,
hasValue: () => height !== '',
onDeselect: onDimensionChange('height'),
panelId: panelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Height'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Auto'),
labelPosition: "top",
units: units,
min: 0,
value: height,
onChange: onDimensionChange('height'),
size: '__unstable-large'
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/dimensions-tool/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps
*/
/**
* @typedef {import('@wordpress/components/build-types/unit-control/types').WPUnitControlUnit} WPUnitControlUnit
*/
/**
* @typedef {Object} Dimensions
* @property {string} [width] CSS width property.
* @property {string} [height] CSS height property.
* @property {string} [scale] CSS object-fit property.
* @property {string} [aspectRatio] CSS aspect-ratio property.
*/
/**
* @callback DimensionsControlsOnChange
* @param {Dimensions} nextValue
* @return {void}
*/
/**
* @typedef {Object} DimensionsControlsProps
* @property {string} [panelId] ID of the panel that contains the controls.
* @property {Dimensions} [value] Current dimensions values.
* @property {DimensionsControlsOnChange} [onChange] Callback to update the dimensions values.
* @property {SelectControlProps[]} [aspectRatioOptions] Aspect ratio options.
* @property {SelectControlProps[]} [scaleOptions] Scale options.
* @property {WPUnitControlUnit[]} [unitsOptions] Units options.
*/
/**
* Component that renders controls to edit the dimensions of an image or container.
*
* @param {DimensionsControlsProps} props The component props.
*
* @return {Element} The dimensions controls.
*/
function DimensionsTool({
panelId,
value = {},
onChange = () => {},
aspectRatioOptions,
// Default options handled by AspectRatioTool.
defaultAspectRatio = 'auto',
// Match CSS default value for aspect-ratio.
scaleOptions,
// Default options handled by ScaleTool.
defaultScale = 'fill',
// Match CSS default value for object-fit.
unitsOptions // Default options handled by UnitControl.
}) {
// Coerce undefined and CSS default values to be null.
const width = value.width === undefined || value.width === 'auto' ? null : value.width;
const height = value.height === undefined || value.height === 'auto' ? null : value.height;
const aspectRatio = value.aspectRatio === undefined || value.aspectRatio === 'auto' ? null : value.aspectRatio;
const scale = value.scale === undefined || value.scale === 'fill' ? null : value.scale;
// Keep track of state internally, so when the value is cleared by means
// other than directly editing that field, it's easier to restore the
// previous value.
const [lastScale, setLastScale] = (0,external_wp_element_namespaceObject.useState)(scale);
const [lastAspectRatio, setLastAspectRatio] = (0,external_wp_element_namespaceObject.useState)(aspectRatio);
// 'custom' is not a valid value for CSS aspect-ratio, but it is used in the
// dropdown to indicate that setting both the width and height is the same
// as a custom aspect ratio.
const aspectRatioValue = width && height ? 'custom' : lastAspectRatio;
const showScaleControl = aspectRatio || width && height;
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(AspectRatioTool, {
panelId: panelId,
options: aspectRatioOptions,
defaultValue: defaultAspectRatio,
value: aspectRatioValue,
onChange: nextAspectRatio => {
const nextValue = {
...value
};
// 'auto' is CSS default, so it gets treated as null.
nextAspectRatio = nextAspectRatio === 'auto' ? null : nextAspectRatio;
setLastAspectRatio(nextAspectRatio);
// Update aspectRatio.
if (!nextAspectRatio) {
delete nextValue.aspectRatio;
} else {
nextValue.aspectRatio = nextAspectRatio;
}
// Auto-update scale.
if (!nextAspectRatio) {
delete nextValue.scale;
} else if (lastScale) {
nextValue.scale = lastScale;
} else {
nextValue.scale = defaultScale;
setLastScale(defaultScale);
}
// Auto-update width and height.
if ('custom' !== nextAspectRatio && width && height) {
delete nextValue.height;
}
onChange(nextValue);
}
}), (0,external_React_.createElement)(WidthHeightTool, {
panelId: panelId,
units: unitsOptions,
value: {
width,
height
},
onChange: ({
width: nextWidth,
height: nextHeight
}) => {
const nextValue = {
...value
};
// 'auto' is CSS default, so it gets treated as null.
nextWidth = nextWidth === 'auto' ? null : nextWidth;
nextHeight = nextHeight === 'auto' ? null : nextHeight;
// Update width.
if (!nextWidth) {
delete nextValue.width;
} else {
nextValue.width = nextWidth;
}
// Update height.
if (!nextHeight) {
delete nextValue.height;
} else {
nextValue.height = nextHeight;
}
// Auto-update aspectRatio.
if (nextWidth && nextHeight) {
delete nextValue.aspectRatio;
} else if (lastAspectRatio) {
nextValue.aspectRatio = lastAspectRatio;
} else {
// No setting defaultAspectRatio here, because
// aspectRatio is optional in this scenario,
// unlike scale.
}
// Auto-update scale.
if (!lastAspectRatio && !!nextWidth !== !!nextHeight) {
delete nextValue.scale;
} else if (lastScale) {
nextValue.scale = lastScale;
} else {
nextValue.scale = defaultScale;
setLastScale(defaultScale);
}
onChange(nextValue);
}
}), showScaleControl && (0,external_React_.createElement)(ScaleTool, {
panelId: panelId,
options: scaleOptions,
defaultValue: defaultScale,
value: lastScale,
onChange: nextScale => {
const nextValue = {
...value
};
// 'fill' is CSS default, so it gets treated as null.
nextScale = nextScale === 'fill' ? null : nextScale;
setLastScale(nextScale);
// Update scale.
if (!nextScale) {
delete nextValue.scale;
} else {
nextValue.scale = nextScale;
}
onChange(nextValue);
}
}));
}
/* harmony default export */ const dimensions_tool = (DimensionsTool);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/resolution-tool/index.js
/**
* WordPress dependencies
*/
const DEFAULT_SIZE_OPTIONS = [{
label: (0,external_wp_i18n_namespaceObject._x)('Thumbnail', 'Image size option for resolution control'),
value: 'thumbnail'
}, {
label: (0,external_wp_i18n_namespaceObject._x)('Medium', 'Image size option for resolution control'),
value: 'medium'
}, {
label: (0,external_wp_i18n_namespaceObject._x)('Large', 'Image size option for resolution control'),
value: 'large'
}, {
label: (0,external_wp_i18n_namespaceObject._x)('Full Size', 'Image size option for resolution control'),
value: 'full'
}];
function ResolutionTool({
panelId,
value,
onChange,
options = DEFAULT_SIZE_OPTIONS,
defaultValue = DEFAULT_SIZE_OPTIONS[0].value,
isShownByDefault = true
}) {
const displayValue = value !== null && value !== void 0 ? value : defaultValue;
return (0,external_React_.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => displayValue !== defaultValue,
label: (0,external_wp_i18n_namespaceObject.__)('Resolution'),
onDeselect: () => onChange(defaultValue),
isShownByDefault: isShownByDefault,
panelId: panelId
}, (0,external_React_.createElement)(external_wp_components_namespaceObject.SelectControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Resolution'),
value: displayValue,
options: options,
onChange: onChange,
help: (0,external_wp_i18n_namespaceObject.__)('Select the size of the source image.'),
size: '__unstable-large'
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/private-apis.js
/**
* Internal dependencies
*/
/**
* Private @wordpress/block-editor APIs.
*/
const privateApis = {};
lock(privateApis, {
...global_styles_namespaceObject,
ExperimentalBlockCanvas: ExperimentalBlockCanvas,
ExperimentalBlockEditorProvider: ExperimentalBlockEditorProvider,
getDuotoneFilter: getDuotoneFilter,
getRichTextValues: getRichTextValues,
PrivateInserter: ComposedPrivateInserter,
PrivateQuickInserter: QuickInserter,
PrivateListView: PrivateListView,
ResizableBoxPopover: ResizableBoxPopover,
BlockInfo: block_info_slot_fill,
useCanBlockToolbarBeFocused: useCanBlockToolbarBeFocused,
cleanEmptyObject: utils_cleanEmptyObject,
useStyleOverride: useStyleOverride,
BlockQuickNavigation: BlockQuickNavigation,
LayoutStyle: LayoutStyle,
BlockRemovalWarningModal: BlockRemovalWarningModal,
useLayoutClasses: useLayoutClasses,
useLayoutStyles: useLayoutStyles,
DimensionsTool: dimensions_tool,
ResolutionTool: ResolutionTool,
ReusableBlocksRenameHint: ReusableBlocksRenameHint,
useReusableBlocksRenameHint: useReusableBlocksRenameHint,
usesContextKey: usesContextKey,
useFlashEditableBlocks: useFlashEditableBlocks,
selectBlockPatternsKey: selectBlockPatternsKey,
requiresWrapperOnCopy: requiresWrapperOnCopy,
PrivateRichText: PrivateRichText
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/index.js
/**
* Internal dependencies
*/
})();
(window.wp = window.wp || {}).blockEditor = __webpack_exports__;
/******/ })()
;/*! This file is auto-generated */
(()=>{var e={4306:function(e,t){var n,o,r;
/*!
autosize 4.0.4
license: MIT
http://www.jacklmoore.com/autosize
*/o=[e,t],n=function(e,t){"use strict";var n,o,r="function"==typeof Map?new Map:(n=[],o=[],{has:function(e){return n.indexOf(e)>-1},get:function(e){return o[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),o.push(t))},delete:function(e){var t=n.indexOf(e);t>-1&&(n.splice(t,1),o.splice(t,1))}}),l=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){l=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function i(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!r.has(e)){var t=null,n=null,o=null,i=function(){e.clientWidth!==n&&p()},s=function(t){window.removeEventListener("resize",i,!1),e.removeEventListener("input",p,!1),e.removeEventListener("keyup",p,!1),e.removeEventListener("autosize:destroy",s,!1),e.removeEventListener("autosize:update",p,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),r.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",s,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",p,!1),window.addEventListener("resize",i,!1),e.addEventListener("input",p,!1),e.addEventListener("autosize:update",p,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",r.set(e,{destroy:s,update:p}),a()}function a(){var n=window.getComputedStyle(e,null);"vertical"===n.resize?e.style.resize="none":"both"===n.resize&&(e.style.resize="horizontal"),t="content-box"===n.boxSizing?-(parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)):parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),isNaN(t)&&(t=0),p()}function c(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function u(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function d(){if(0!==e.scrollHeight){var o=u(e),r=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+t+"px",n=e.clientWidth,o.forEach((function(e){e.node.scrollTop=e.scrollTop})),r&&(document.documentElement.scrollTop=r)}}function p(){d();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),r="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(r<t?"hidden"===n.overflowY&&(c("scroll"),d(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==n.overflowY&&(c("hidden"),d(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),o!==r){o=r;var i=l("autosize:resized");try{e.dispatchEvent(i)}catch(e){}}}}function s(e){var t=r.get(e);t&&t.destroy()}function a(e){var t=r.get(e);t&&t.update()}var c=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((c=function(e){return e}).destroy=function(e){return e},c.update=function(e){return e}):((c=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],(function(e){return i(e,t)})),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],s),e},c.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],a),e}),t.default=c,e.exports=t.default},void 0===(r="function"==typeof n?n.apply(t,o):n)||(e.exports=r)},5755:(e,t)=>{var n;
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var l=typeof n;if("string"===l||"number"===l)e.push(n);else if(Array.isArray(n)){if(n.length){var i=r.apply(null,n);i&&e.push(i)}}else if("object"===l){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var s in n)o.call(n,s)&&n[s]&&e.push(s)}}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},6109:e=>{e.exports=function(e,t,n){return((n=window.getComputedStyle)?n(e):e.currentStyle)[t.replace(/-(\w)/gi,(function(e,t){return t.toUpperCase()}))]}},5417:(e,t)=>{"use strict";function n(){}function o(e,t,n,o,r){for(var l=0,i=t.length,s=0,a=0;l<i;l++){var c=t[l];if(c.removed){if(c.value=e.join(o.slice(a,a+c.count)),a+=c.count,l&&t[l-1].added){var u=t[l-1];t[l-1]=t[l],t[l]=u}}else{if(!c.added&&r){var d=n.slice(s,s+c.count);d=d.map((function(e,t){var n=o[a+t];return n.length>e.length?n:e})),c.value=e.join(d)}else c.value=e.join(n.slice(s,s+c.count));s+=c.count,c.added||(a+=c.count)}}var p=t[i-1];return i>1&&"string"==typeof p.value&&(p.added||p.removed)&&e.equals("",p.value)&&(t[i-2].value+=p.value,t.pop()),t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.prototype={diff:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.callback;"function"==typeof n&&(r=n,n={}),this.options=n;var l=this;function i(e){return r?(setTimeout((function(){r(void 0,e)}),0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e));var s=(t=this.removeEmpty(this.tokenize(t))).length,a=e.length,c=1,u=s+a,d=[{newPos:-1,components:[]}],p=this.extractCommon(d[0],t,e,0);if(d[0].newPos+1>=s&&p+1>=a)return i([{value:this.join(t),count:t.length}]);function m(){for(var n=-1*c;n<=c;n+=2){var r=void 0,u=d[n-1],p=d[n+1],m=(p?p.newPos:0)-n;u&&(d[n-1]=void 0);var h=u&&u.newPos+1<s,g=p&&0<=m&&m<a;if(h||g){if(!h||g&&u.newPos<p.newPos?(r={newPos:(f=p).newPos,components:f.components.slice(0)},l.pushComponent(r.components,void 0,!0)):((r=u).newPos++,l.pushComponent(r.components,!0,void 0)),m=l.extractCommon(r,t,e,n),r.newPos+1>=s&&m+1>=a)return i(o(l,r.components,t,e,l.useLongestToken));d[n]=r}else d[n]=void 0}var f;c++}if(r)!function e(){setTimeout((function(){if(c>u)return r();m()||e()}),0)}();else for(;c<=u;){var h=m();if(h)return h}},pushComponent:function(e,t,n){var o=e[e.length-1];o&&o.added===t&&o.removed===n?e[e.length-1]={count:o.count+1,added:t,removed:n}:e.push({count:1,added:t,removed:n})},extractCommon:function(e,t,n,o){for(var r=t.length,l=n.length,i=e.newPos,s=i-o,a=0;i+1<r&&s+1<l&&this.equals(t[i+1],n[s+1]);)i++,s++,a++;return a&&e.components.push({count:a}),e.newPos=i,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}}},8021:(e,t,n)=>{"use strict";var o;t.JJ=function(e,t,n){return r.diff(e,t,n)};var r=new(((o=n(5417))&&o.__esModule?o:{default:o}).default)},1637:(e,t,n)=>{"use strict";var o=n(3062);e.exports=function(e,t,n){n=n||{},9===t.nodeType&&(t=o.getWindow(t));var r=n.allowHorizontalScroll,l=n.onlyScrollIfNeeded,i=n.alignWithTop,s=n.alignWithLeft,a=n.offsetTop||0,c=n.offsetLeft||0,u=n.offsetBottom||0,d=n.offsetRight||0;r=void 0===r||r;var p=o.isWindow(t),m=o.offset(e),h=o.outerHeight(e),g=o.outerWidth(e),f=void 0,b=void 0,v=void 0,k=void 0,_=void 0,y=void 0,E=void 0,w=void 0,S=void 0,C=void 0;p?(E=t,C=o.height(E),S=o.width(E),w={left:o.scrollLeft(E),top:o.scrollTop(E)},_={left:m.left-w.left-c,top:m.top-w.top-a},y={left:m.left+g-(w.left+S)+d,top:m.top+h-(w.top+C)+u},k=w):(f=o.offset(t),b=t.clientHeight,v=t.clientWidth,k={left:t.scrollLeft,top:t.scrollTop},_={left:m.left-(f.left+(parseFloat(o.css(t,"borderLeftWidth"))||0))-c,top:m.top-(f.top+(parseFloat(o.css(t,"borderTopWidth"))||0))-a},y={left:m.left+g-(f.left+v+(parseFloat(o.css(t,"borderRightWidth"))||0))+d,top:m.top+h-(f.top+b+(parseFloat(o.css(t,"borderBottomWidth"))||0))+u}),_.top<0||y.top>0?!0===i?o.scrollTop(t,k.top+_.top):!1===i?o.scrollTop(t,k.top+y.top):_.top<0?o.scrollTop(t,k.top+_.top):o.scrollTop(t,k.top+y.top):l||((i=void 0===i||!!i)?o.scrollTop(t,k.top+_.top):o.scrollTop(t,k.top+y.top)),r&&(_.left<0||y.left>0?!0===s?o.scrollLeft(t,k.left+_.left):!1===s?o.scrollLeft(t,k.left+y.left):_.left<0?o.scrollLeft(t,k.left+_.left):o.scrollLeft(t,k.left+y.left):l||((s=void 0===s||!!s)?o.scrollLeft(t,k.left+_.left):o.scrollLeft(t,k.left+y.left)))}},5428:(e,t,n)=>{"use strict";e.exports=n(1637)},3062:e=>{"use strict";var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};function o(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],o="scroll"+(t?"Top":"Left");if("number"!=typeof n){var r=e.document;"number"!=typeof(n=r.documentElement[o])&&(n=r.body[o])}return n}function r(e){return o(e)}function l(e){return o(e,!0)}function i(e){var t=function(e){var t,n=void 0,o=void 0,r=e.ownerDocument,l=r.body,i=r&&r.documentElement;return n=(t=e.getBoundingClientRect()).left,o=t.top,{left:n-=i.clientLeft||l.clientLeft||0,top:o-=i.clientTop||l.clientTop||0}}(e),n=e.ownerDocument,o=n.defaultView||n.parentWindow;return t.left+=r(o),t.top+=l(o),t}var s=new RegExp("^("+/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source+")(?!px)[a-z%]+$","i"),a=/^(top|right|bottom|left)$/,c="currentStyle",u="runtimeStyle",d="left";var p=void 0;function m(e,t){for(var n=0;n<e.length;n++)t(e[n])}function h(e){return"border-box"===p(e,"boxSizing")}"undefined"!=typeof window&&(p=window.getComputedStyle?function(e,t,n){var o="",r=e.ownerDocument,l=n||r.defaultView.getComputedStyle(e,null);return l&&(o=l.getPropertyValue(t)||l[t]),o}:function(e,t){var n=e[c]&&e[c][t];if(s.test(n)&&!a.test(t)){var o=e.style,r=o[d],l=e[u][d];e[u][d]=e[c][d],o[d]="fontSize"===t?"1em":n||0,n=o.pixelLeft+"px",o[d]=r,e[u][d]=l}return""===n?"auto":n});var g=["margin","border","padding"],f=-1,b=2,v=1;function k(e,t,n){var o=0,r=void 0,l=void 0,i=void 0;for(l=0;l<t.length;l++)if(r=t[l])for(i=0;i<n.length;i++){var s=void 0;s="border"===r?r+n[i]+"Width":r+n[i],o+=parseFloat(p(e,s))||0}return o}function _(e){return null!=e&&e==e.window}var y={};function E(e,t,n){if(_(e))return"width"===t?y.viewportWidth(e):y.viewportHeight(e);if(9===e.nodeType)return"width"===t?y.docWidth(e):y.docHeight(e);var o="width"===t?["Left","Right"]:["Top","Bottom"],r="width"===t?e.offsetWidth:e.offsetHeight,l=(p(e),h(e)),i=0;(null==r||r<=0)&&(r=void 0,(null==(i=p(e,t))||Number(i)<0)&&(i=e.style[t]||0),i=parseFloat(i)||0),void 0===n&&(n=l?v:f);var s=void 0!==r||l,a=r||i;if(n===f)return s?a-k(e,["border","padding"],o):i;if(s){var c=n===b?-k(e,["border"],o):k(e,["margin"],o);return a+(n===v?0:c)}return i+k(e,g.slice(n),o)}m(["Width","Height"],(function(e){y["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],y["viewport"+e](n))},y["viewport"+e]=function(t){var n="client"+e,o=t.document,r=o.body,l=o.documentElement[n];return"CSS1Compat"===o.compatMode&&l||r&&r[n]||l}}));var w={position:"absolute",visibility:"hidden",display:"block"};function S(e){var t=void 0,n=arguments;return 0!==e.offsetWidth?t=E.apply(void 0,n):function(e,t,n){var o={},r=e.style,l=void 0;for(l in t)t.hasOwnProperty(l)&&(o[l]=r[l],r[l]=t[l]);for(l in n.call(e),t)t.hasOwnProperty(l)&&(r[l]=o[l])}(e,w,(function(){t=E.apply(void 0,n)})),t}function C(e,t,o){var r=o;if("object"!==(void 0===t?"undefined":n(t)))return void 0!==r?("number"==typeof r&&(r+="px"),void(e.style[t]=r)):p(e,t);for(var l in t)t.hasOwnProperty(l)&&C(e,l,t[l])}m(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);y["outer"+t]=function(t,n){return t&&S(t,e,n?0:v)};var n="width"===e?["Left","Right"]:["Top","Bottom"];y[e]=function(t,o){if(void 0===o)return t&&S(t,e,f);if(t){p(t);return h(t)&&(o+=k(t,["padding","border"],n)),C(t,e,o)}}})),e.exports=t({getWindow:function(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t){if(void 0===t)return i(e);!function(e,t){"static"===C(e,"position")&&(e.style.position="relative");var n=i(e),o={},r=void 0,l=void 0;for(l in t)t.hasOwnProperty(l)&&(r=parseFloat(C(e,l))||0,o[l]=r+t[l]-n[l]);C(e,o)}(e,t)},isWindow:_,each:m,css:C,clone:function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);if(e.overflow)for(var n in e)e.hasOwnProperty(n)&&(t.overflow[n]=e.overflow[n]);return t},scrollLeft:function(e,t){if(_(e)){if(void 0===t)return r(e);window.scrollTo(t,l(e))}else{if(void 0===t)return e.scrollLeft;e.scrollLeft=t}},scrollTop:function(e,t){if(_(e)){if(void 0===t)return l(e);window.scrollTo(r(e),t)}else{if(void 0===t)return e.scrollTop;e.scrollTop=t}},viewportWidth:0,viewportHeight:0},y)},7734:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var o,r,l;if(Array.isArray(t)){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;for(r of t.entries())if(!e(r[1],n.get(r[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(r of t.entries())if(!n.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(t[r]!==n[r])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((o=(l=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=o;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,l[r]))return!1;for(r=o;0!=r--;){var i=l[r];if(!e(t[i],n[i]))return!1}return!0}return t!=t&&n!=n}},5215:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var o,r,l;if(Array.isArray(t)){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((o=(l=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=o;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,l[r]))return!1;for(r=o;0!=r--;){var i=l[r];if(!e(t[i],n[i]))return!1}return!0}return t!=t&&n!=n}},461:(e,t,n)=>{var o=n(6109);e.exports=function(e){var t=o(e,"line-height"),n=parseFloat(t,10);if(t===n+""){var r=e.style.lineHeight;e.style.lineHeight=t+"em",t=o(e,"line-height"),n=parseFloat(t,10),r?e.style.lineHeight=r:delete e.style.lineHeight}if(-1!==t.indexOf("pt")?(n*=4,n/=3):-1!==t.indexOf("mm")?(n*=96,n/=25.4):-1!==t.indexOf("cm")?(n*=96,n/=2.54):-1!==t.indexOf("in")?n*=96:-1!==t.indexOf("pc")&&(n*=16),n=Math.round(n),"normal"===t){var l=e.nodeName,i=document.createElement(l);i.innerHTML=" ","TEXTAREA"===l.toUpperCase()&&i.setAttribute("rows","1");var s=o(e,"font-size");i.style.fontSize=s,i.style.padding="0px",i.style.border="0px";var a=document.body;a.appendChild(i),n=i.offsetHeight,a.removeChild(i)}return n}},7520:(e,t,n)=>{e.exports=n(7191)},8202:e=>{"use strict";var t=!("undefined"==typeof window||!window.document||!window.document.createElement),n={canUseDOM:t,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:t&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:t&&!!window.screen,isInWorker:!t};e.exports=n},2213:e=>{var t,n,o,r,l,i,s,a,c,u,d,p,m,h,g,f=!1;function b(){if(!f){f=!0;var e=navigator.userAgent,b=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),v=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(p=/\b(iPhone|iP[ao]d)/.exec(e),m=/\b(iP[ao]d)/.exec(e),u=/Android/i.exec(e),h=/FBAN\/\w+;/i.exec(e),g=/Mobile/i.exec(e),d=!!/Win64/.exec(e),b){(t=b[1]?parseFloat(b[1]):b[5]?parseFloat(b[5]):NaN)&&document&&document.documentMode&&(t=document.documentMode);var k=/(?:Trident\/(\d+.\d+))/.exec(e);i=k?parseFloat(k[1])+4:t,n=b[2]?parseFloat(b[2]):NaN,o=b[3]?parseFloat(b[3]):NaN,(r=b[4]?parseFloat(b[4]):NaN)?(b=/(?:Chrome\/(\d+\.\d+))/.exec(e),l=b&&b[1]?parseFloat(b[1]):NaN):l=NaN}else t=n=o=l=r=NaN;if(v){if(v[1]){var _=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);s=!_||parseFloat(_[1].replace("_","."))}else s=!1;a=!!v[2],c=!!v[3]}else s=a=c=!1}}var v={ie:function(){return b()||t},ieCompatibilityMode:function(){return b()||i>t},ie64:function(){return v.ie()&&d},firefox:function(){return b()||n},opera:function(){return b()||o},webkit:function(){return b()||r},safari:function(){return v.webkit()},chrome:function(){return b()||l},windows:function(){return b()||a},osx:function(){return b()||s},linux:function(){return b()||c},iphone:function(){return b()||p},mobile:function(){return b()||p||m||u||g},nativeApp:function(){return b()||h},android:function(){return b()||u},ipad:function(){return b()||m}};e.exports=v},1087:(e,t,n)=>{"use strict";var o,r=n(8202);r.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""))
/**
* 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
*/,e.exports=function(e,t){if(!r.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,l=n in document;if(!l){var i=document.createElement("div");i.setAttribute(n,"return;"),l="function"==typeof i[n]}return!l&&o&&"wheel"===e&&(l=document.implementation.hasFeature("Events.wheel","3.0")),l}},7191:(e,t,n)=>{"use strict";var o=n(2213),r=n(1087);function l(e){var t=0,n=0,o=0,r=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),o=10*t,r=10*n,"deltaY"in e&&(r=e.deltaY),"deltaX"in e&&(o=e.deltaX),(o||r)&&e.deltaMode&&(1==e.deltaMode?(o*=40,r*=40):(o*=800,r*=800)),o&&!t&&(t=o<1?-1:1),r&&!n&&(n=r<1?-1:1),{spinX:t,spinY:n,pixelX:o,pixelY:r}}l.getEventType=function(){return o.firefox()?"DOMMouseScroll":r("wheel")?"wheel":"mousewheel"},e.exports=l},2775:e=>{var t=String,n=function(){return{isColorSupported:!1,reset:t,bold:t,dim:t,italic:t,underline:t,inverse:t,hidden:t,strikethrough:t,black:t,red:t,green:t,yellow:t,blue:t,magenta:t,cyan:t,white:t,gray:t,bgBlack:t,bgRed:t,bgGreen:t,bgYellow:t,bgBlue:t,bgMagenta:t,bgCyan:t,bgWhite:t}};e.exports=n(),e.exports.createColors=n},4465:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},8036:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n(4465);const r=o(n(4529)),l=o(n(3576));e.exports=(0,l.default)(r.default)},5525:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prefixWrapCSSSelector=t.prefixWrapCSSRule=void 0;const o=n(3467);t.prefixWrapCSSRule=(e,n,r,l,i)=>{const s=e.selector.split(",").filter((e=>!(0,o.cssRuleMatchesPrefixSelector)({selector:e},l)));0!==s.length&&(e.selector=s.map((o=>(0,t.prefixWrapCSSSelector)(o,e,n,r,l,i))).filter(o.isValidCSSSelector).join(", "))};t.prefixWrapCSSSelector=(e,t,n,r,l,i)=>{const s=(0,o.cleanSelector)(e);return""===s?null:null!==n&&s.startsWith(n,0)||(0,o.isKeyframes)(t)||r.some((e=>s.match(e)))?s:(0,o.isNotRootTag)(s)?l+" "+s:i?l+" ."+s:s.replace(/^(body|html|:root)/,l)}},3467:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.cssRuleMatchesPrefixSelector=t.isNotRootTag=t.isKeyframes=t.cleanSelector=t.isValidCSSSelector=void 0;const n=/(^\s*|\s*$)/g,o=/^(body|html|:root).*$/;t.isValidCSSSelector=e=>null!==e;t.cleanSelector=e=>e.replace(n,"");t.isKeyframes=e=>{const{parent:t}=e,n=t;return void 0!==t&&"atrule"===n.type&&void 0!==n.name&&null!==n.name.match(/keyframes$/)};t.isNotRootTag=e=>!e.match(o);t.cssRuleMatchesPrefixSelector=(e,t)=>{const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^${n}$`).test(e.selector)}},9411:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shouldIncludeFilePath=void 0;t.shouldIncludeFilePath=(e,t,n)=>t.length>0?null!=e&&t.some((t=>e.match(t))):!(n.length>0)||!(null!=e&&n.some((t=>e.match(t))))},8061:function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.asPostCSSv7PluginGenerator=void 0;const i=l(n(1311));t.asPostCSSv7PluginGenerator=e=>e.plugin(i.PLUGIN_NAME,((e,t)=>new i.default(e,t).prefix()))},2888:function(e,t,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.asPostCSSv8PluginGenerator=t.isPostCSSv8=void 0;const i=l(n(1311));t.isPostCSSv8=e=>void 0!==e.Root;t.asPostCSSv8PluginGenerator=()=>(e,t)=>{const n=new i.default(e,t);return{postcssPlugin:i.PLUGIN_NAME,Once(e){n.prefixRoot(e)}}}},3576:(e,t,n)=>{"use strict";const o=n(2888),r=n(8061);e.exports=e=>(0,o.isPostCSSv8)(e)?(0,o.asPostCSSv8PluginGenerator)():(0,r.asPostCSSv7PluginGenerator)(e)},1311:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PLUGIN_NAME=void 0;const o=n(5525),r=n(9411);t.PLUGIN_NAME="postcss-prefixwrap";t.default=class{blacklist;ignoredSelectors;isPrefixSelector;prefixRootTags;prefixSelector;whitelist;nested;constructor(e,t={}){this.blacklist=t.blacklist??[],this.ignoredSelectors=t.ignoredSelectors??[],this.isPrefixSelector=new RegExp(`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`),this.prefixRootTags=t.prefixRootTags??!1,this.prefixSelector=e,this.whitelist=t.whitelist??[],this.nested=t.nested??null}prefixRoot(e){(0,r.shouldIncludeFilePath)(e.source?.input?.file,this.whitelist,this.blacklist)&&e.walkRules((e=>{(0,o.prefixWrapCSSRule)(e,this.nested,this.ignoredSelectors,this.prefixSelector,this.prefixRootTags)}))}prefix(){return e=>{this.prefixRoot(e)}}}},5404:(e,t,n)=>{const o=n(1544);e.exports=e=>{const t=Object.assign({skipHostRelativeUrls:!0},e);return{postcssPlugin:"rebaseUrl",Declaration(n){const r=o(n.value);let l=!1;r.walk((n=>{if("function"!==n.type||"url"!==n.value)return;const o=n.nodes[0].value,r=new URL(o,e.rootUrl);return r.pathname===o&&t.skipHostRelativeUrls||(n.nodes[0].value=r.toString(),l=!0),!1})),l&&(n.value=o.stringify(r))}}},e.exports.postcss=!0},1544:(e,t,n)=>{var o=n(8491),r=n(3815),l=n(4725);function i(e){return this instanceof i?(this.nodes=o(e),this):new i(e)}i.prototype.toString=function(){return Array.isArray(this.nodes)?l(this.nodes):""},i.prototype.walk=function(e,t){return r(this.nodes,e,t),this},i.unit=n(1524),i.walk=r,i.stringify=l,e.exports=i},8491:e=>{var t="(".charCodeAt(0),n=")".charCodeAt(0),o="'".charCodeAt(0),r='"'.charCodeAt(0),l="\\".charCodeAt(0),i="/".charCodeAt(0),s=",".charCodeAt(0),a=":".charCodeAt(0),c="*".charCodeAt(0),u="u".charCodeAt(0),d="U".charCodeAt(0),p="+".charCodeAt(0),m=/^[a-f0-9?-]+$/i;e.exports=function(e){for(var h,g,f,b,v,k,_,y,E,w=[],S=e,C=0,x=S.charCodeAt(C),B=S.length,I=[{nodes:w}],T=0,M="",P="",R="";C<B;)if(x<=32){h=C;do{h+=1,x=S.charCodeAt(h)}while(x<=32);b=S.slice(C,h),f=w[w.length-1],x===n&&T?R=b:f&&"div"===f.type?(f.after=b,f.sourceEndIndex+=b.length):x===s||x===a||x===i&&S.charCodeAt(h+1)!==c&&(!E||E&&"function"===E.type&&"calc"!==E.value)?P=b:w.push({type:"space",sourceIndex:C,sourceEndIndex:h,value:b}),C=h}else if(x===o||x===r){h=C,b={type:"string",sourceIndex:C,quote:g=x===o?"'":'"'};do{if(v=!1,~(h=S.indexOf(g,h+1)))for(k=h;S.charCodeAt(k-1)===l;)k-=1,v=!v;else h=(S+=g).length-1,b.unclosed=!0}while(v);b.value=S.slice(C+1,h),b.sourceEndIndex=b.unclosed?h:h+1,w.push(b),C=h+1,x=S.charCodeAt(C)}else if(x===i&&S.charCodeAt(C+1)===c)b={type:"comment",sourceIndex:C,sourceEndIndex:(h=S.indexOf("*/",C))+2},-1===h&&(b.unclosed=!0,h=S.length,b.sourceEndIndex=h),b.value=S.slice(C+2,h),w.push(b),C=h+2,x=S.charCodeAt(C);else if(x!==i&&x!==c||!E||"function"!==E.type||"calc"!==E.value)if(x===i||x===s||x===a)b=S[C],w.push({type:"div",sourceIndex:C-P.length,sourceEndIndex:C+b.length,value:b,before:P,after:""}),P="",C+=1,x=S.charCodeAt(C);else if(t===x){h=C;do{h+=1,x=S.charCodeAt(h)}while(x<=32);if(y=C,b={type:"function",sourceIndex:C-M.length,value:M,before:S.slice(y+1,h)},C=h,"url"===M&&x!==o&&x!==r){h-=1;do{if(v=!1,~(h=S.indexOf(")",h+1)))for(k=h;S.charCodeAt(k-1)===l;)k-=1,v=!v;else h=(S+=")").length-1,b.unclosed=!0}while(v);_=h;do{_-=1,x=S.charCodeAt(_)}while(x<=32);y<_?(b.nodes=C!==_+1?[{type:"word",sourceIndex:C,sourceEndIndex:_+1,value:S.slice(C,_+1)}]:[],b.unclosed&&_+1!==h?(b.after="",b.nodes.push({type:"space",sourceIndex:_+1,sourceEndIndex:h,value:S.slice(_+1,h)})):(b.after=S.slice(_+1,h),b.sourceEndIndex=h)):(b.after="",b.nodes=[]),C=h+1,b.sourceEndIndex=b.unclosed?h:C,x=S.charCodeAt(C),w.push(b)}else T+=1,b.after="",b.sourceEndIndex=C+1,w.push(b),I.push(b),w=b.nodes=[],E=b;M=""}else if(n===x&&T)C+=1,x=S.charCodeAt(C),E.after=R,E.sourceEndIndex+=R.length,R="",T-=1,I[I.length-1].sourceEndIndex=C,I.pop(),w=(E=I[T]).nodes;else{h=C;do{x===l&&(h+=1),h+=1,x=S.charCodeAt(h)}while(h<B&&!(x<=32||x===o||x===r||x===s||x===a||x===i||x===t||x===c&&E&&"function"===E.type&&"calc"===E.value||x===i&&"function"===E.type&&"calc"===E.value||x===n&&T));b=S.slice(C,h),t===x?M=b:u!==b.charCodeAt(0)&&d!==b.charCodeAt(0)||p!==b.charCodeAt(1)||!m.test(b.slice(2))?w.push({type:"word",sourceIndex:C,sourceEndIndex:h,value:b}):w.push({type:"unicode-range",sourceIndex:C,sourceEndIndex:h,value:b}),C=h}else b=S[C],w.push({type:"word",sourceIndex:C-P.length,sourceEndIndex:C+b.length,value:b}),C+=1,x=S.charCodeAt(C);for(C=I.length-1;C;C-=1)I[C].unclosed=!0,I[C].sourceEndIndex=S.length;return I[0].nodes}},4725:e=>{function t(e,t){var o,r,l=e.type,i=e.value;return t&&void 0!==(r=t(e))?r:"word"===l||"space"===l?i:"string"===l?(o=e.quote||"")+i+(e.unclosed?"":o):"comment"===l?"/*"+i+(e.unclosed?"":"*/"):"div"===l?(e.before||"")+i+(e.after||""):Array.isArray(e.nodes)?(o=n(e.nodes,t),"function"!==l?o:i+"("+(e.before||"")+o+(e.after||"")+(e.unclosed?"":")")):i}function n(e,n){var o,r;if(Array.isArray(e)){for(o="",r=e.length-1;~r;r-=1)o=t(e[r],n)+o;return o}return t(e,n)}e.exports=n},1524:e=>{var t="-".charCodeAt(0),n="+".charCodeAt(0),o=".".charCodeAt(0),r="e".charCodeAt(0),l="E".charCodeAt(0);e.exports=function(e){var i,s,a,c=0,u=e.length;if(0===u||!function(e){var r,l=e.charCodeAt(0);if(l===n||l===t){if((r=e.charCodeAt(1))>=48&&r<=57)return!0;var i=e.charCodeAt(2);return r===o&&i>=48&&i<=57}return l===o?(r=e.charCodeAt(1))>=48&&r<=57:l>=48&&l<=57}(e))return!1;for((i=e.charCodeAt(c))!==n&&i!==t||c++;c<u&&!((i=e.charCodeAt(c))<48||i>57);)c+=1;if(i=e.charCodeAt(c),s=e.charCodeAt(c+1),i===o&&s>=48&&s<=57)for(c+=2;c<u&&!((i=e.charCodeAt(c))<48||i>57);)c+=1;if(i=e.charCodeAt(c),s=e.charCodeAt(c+1),a=e.charCodeAt(c+2),(i===r||i===l)&&(s>=48&&s<=57||(s===n||s===t)&&a>=48&&a<=57))for(c+=s===n||s===t?3:2;c<u&&!((i=e.charCodeAt(c))<48||i>57);)c+=1;return{number:e.slice(0,c),unit:e.slice(c)}}},3815:e=>{e.exports=function e(t,n,o){var r,l,i,s;for(r=0,l=t.length;r<l;r+=1)i=t[r],o||(s=n(i,r,t)),!1!==s&&"function"===i.type&&Array.isArray(i.nodes)&&e(i.nodes,n,o),o&&n(i,r,t)}},1326:(e,t,n)=>{"use strict";let o=n(683);class r extends o{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}e.exports=r,r.default=r,o.registerAtRule(r)},6589:(e,t,n)=>{"use strict";let o=n(7490);class r extends o{constructor(e){super(e),this.type="comment"}}e.exports=r,r.default=r},683:(e,t,n)=>{"use strict";let o,r,l,i,{isClean:s,my:a}=n(1381),c=n(1516),u=n(6589),d=n(7490);function p(e){return e.map((e=>(e.nodes&&(e.nodes=p(e.nodes)),delete e.source,e)))}function m(e){if(e[s]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)m(t)}class h extends d{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,n,o=this.getIterator();for(;this.indexes[o]<this.proxyOf.nodes.length&&(t=this.indexes[o],n=e(this.proxyOf.nodes[t],t),!1!==n);)this.indexes[o]+=1;return delete this.indexes[o],n}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...n)=>e[t](...n.map((e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e))):"every"===t||"some"===t?n=>e[t](((e,...t)=>n(e.toProxy(),...t))):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map((e=>e.toProxy())):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let n,o=this.index(e),r=this.normalize(t,this.proxyOf.nodes[o]).reverse();o=this.index(e);for(let e of r)this.proxyOf.nodes.splice(o+1,0,e);for(let e in this.indexes)n=this.indexes[e],o<n&&(this.indexes[e]=n+r.length);return this.markDirty(),this}insertBefore(e,t){let n,o=this.index(e),r=0===o&&"prepend",l=this.normalize(t,this.proxyOf.nodes[o],r).reverse();o=this.index(e);for(let e of l)this.proxyOf.nodes.splice(o,0,e);for(let e in this.indexes)n=this.indexes[e],o<=n&&(this.indexes[e]=n+l.length);return this.markDirty(),this}normalize(e,t){if("string"==typeof e)e=p(o(e).nodes);else if(void 0===e)e=[];else if(Array.isArray(e)){e=e.slice(0);for(let t of e)t.parent&&t.parent.removeChild(t,"ignore")}else if("root"===e.type&&"document"!==this.type){e=e.nodes.slice(0);for(let t of e)t.parent&&t.parent.removeChild(t,"ignore")}else if(e.type)e=[e];else if(e.prop){if(void 0===e.value)throw new Error("Value field is missed in node creation");"string"!=typeof e.value&&(e.value=String(e.value)),e=[new c(e)]}else if(e.selector)e=[new r(e)];else if(e.name)e=[new l(e)];else{if(!e.text)throw new Error("Unknown node type in node creation");e=[new u(e)]}return e.map((e=>(e[a]||h.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[s]&&m(e),void 0===e.raws.before&&t&&void 0!==t.raws.before&&(e.raws.before=t.raws.before.replace(/\S/g,"")),e.parent=this.proxyOf,e)))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls((o=>{t.props&&!t.props.includes(o.prop)||t.fast&&!o.value.includes(t.fast)||(o.value=o.value.replace(e,n))})),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each(((t,n)=>{let o;try{o=e(t,n)}catch(e){throw t.addToError(e)}return!1!==o&&t.walk&&(o=t.walk(e)),o}))}walkAtRules(e,t){return t?e instanceof RegExp?this.walk(((n,o)=>{if("atrule"===n.type&&e.test(n.name))return t(n,o)})):this.walk(((n,o)=>{if("atrule"===n.type&&n.name===e)return t(n,o)})):(t=e,this.walk(((e,n)=>{if("atrule"===e.type)return t(e,n)})))}walkComments(e){return this.walk(((t,n)=>{if("comment"===t.type)return e(t,n)}))}walkDecls(e,t){return t?e instanceof RegExp?this.walk(((n,o)=>{if("decl"===n.type&&e.test(n.prop))return t(n,o)})):this.walk(((n,o)=>{if("decl"===n.type&&n.prop===e)return t(n,o)})):(t=e,this.walk(((e,n)=>{if("decl"===e.type)return t(e,n)})))}walkRules(e,t){return t?e instanceof RegExp?this.walk(((n,o)=>{if("rule"===n.type&&e.test(n.selector))return t(n,o)})):this.walk(((n,o)=>{if("rule"===n.type&&n.selector===e)return t(n,o)})):(t=e,this.walk(((e,n)=>{if("rule"===e.type)return t(e,n)})))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}h.registerParse=e=>{o=e},h.registerRule=e=>{r=e},h.registerAtRule=e=>{l=e},h.registerRoot=e=>{i=e},e.exports=h,h.default=h,h.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,l.prototype):"rule"===e.type?Object.setPrototypeOf(e,r.prototype):"decl"===e.type?Object.setPrototypeOf(e,c.prototype):"comment"===e.type?Object.setPrototypeOf(e,u.prototype):"root"===e.type&&Object.setPrototypeOf(e,i.prototype),e[a]=!0,e.nodes&&e.nodes.forEach((e=>{h.rebuild(e)}))}},356:(e,t,n)=>{"use strict";let o=n(2775),r=n(9746);class l extends Error{constructor(e,t,n,o,r,i){super(e),this.name="CssSyntaxError",this.reason=e,r&&(this.file=r),o&&(this.source=o),i&&(this.plugin=i),void 0!==t&&void 0!==n&&("number"==typeof t?(this.line=t,this.column=n):(this.line=t.line,this.column=t.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,l)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=o.isColorSupported),r&&e&&(t=r(t));let n,l,i=t.split(/\r?\n/),s=Math.max(this.line-3,0),a=Math.min(this.line+2,i.length),c=String(a).length;if(e){let{bold:e,gray:t,red:r}=o.createColors(!0);n=t=>e(r(t)),l=e=>t(e)}else n=l=e=>e;return i.slice(s,a).map(((e,t)=>{let o=s+1+t,r=" "+(" "+o).slice(-c)+" | ";if(o===this.line){let t=l(r.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return n(">")+l(r)+e+"\n "+t+n("^")}return" "+l(r)+e})).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}e.exports=l,l.default=l},1516:(e,t,n)=>{"use strict";let o=n(7490);class r extends o{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}}e.exports=r,r.default=r},271:(e,t,n)=>{"use strict";let o,r,l=n(683);class i extends l{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new o(new r,this,e).stringify()}}i.registerLazyResult=e=>{o=e},i.registerProcessor=e=>{r=e},e.exports=i,i.default=i},8940:(e,t,n)=>{"use strict";let o=n(1516),r=n(5696),l=n(6589),i=n(1326),s=n(5380),a=n(9434),c=n(4092);function u(e,t){if(Array.isArray(e))return e.map((e=>u(e)));let{inputs:n,...d}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:s.prototype};n.map&&(n.map={...n.map,__proto__:r.prototype}),t.push(n)}}if(d.nodes&&(d.nodes=e.nodes.map((e=>u(e,t)))),d.source){let{inputId:e,...n}=d.source;d.source=n,null!=e&&(d.source.input=t[e])}if("root"===d.type)return new a(d);if("decl"===d.type)return new o(d);if("rule"===d.type)return new c(d);if("comment"===d.type)return new l(d);if("atrule"===d.type)return new i(d);throw new Error("Unknown node type: "+e.type)}e.exports=u,u.default=u},5380:(e,t,n)=>{"use strict";let{SourceMapConsumer:o,SourceMapGenerator:r}=n(1866),{fileURLToPath:l,pathToFileURL:i}=n(2739),{isAbsolute:s,resolve:a}=n(197),{nanoid:c}=n(5042),u=n(9746),d=n(356),p=n(5696),m=Symbol("fromOffsetCache"),h=Boolean(o&&r),g=Boolean(a&&s);class f{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||""===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!g||/^\w+:\/\//.test(t.from)||s(t.from)?this.file=t.from:this.file=a(t.from)),g&&h){let e=new p(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+c(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,n,o={}){let r,l,s;if(t&&"object"==typeof t){let e=t,o=n;if("number"==typeof e.offset){let o=this.fromOffset(e.offset);t=o.line,n=o.col}else t=e.line,n=e.column;if("number"==typeof o.offset){let e=this.fromOffset(o.offset);l=e.line,s=e.col}else l=o.line,s=o.column}else if(!n){let e=this.fromOffset(t);t=e.line,n=e.col}let a=this.origin(t,n,l,s);return r=a?new d(e,void 0===a.endLine?a.line:{column:a.column,line:a.line},void 0===a.endLine?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,o.plugin):new d(e,void 0===l?t:{column:n,line:t},void 0===l?n:{column:s,line:l},this.css,this.file,o.plugin),r.input={column:n,endColumn:s,endLine:l,line:t,source:this.css},this.file&&(i&&(r.input.url=i(this.file).toString()),r.input.file=this.file),r}fromOffset(e){let t,n;if(this[m])n=this[m];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let o=0,r=e.length;o<r;o++)n[o]=t,t+=e[o].length+1;this[m]=n}t=n[n.length-1];let o=0;if(e>=t)o=n.length-1;else{let t,r=n.length-2;for(;o<r;)if(t=o+(r-o>>1),e<n[t])r=t-1;else{if(!(e>=n[t+1])){o=t;break}o=t+1}}return{col:e-n[o]+1,line:o+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:a(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,n,o){if(!this.map)return!1;let r,a,c=this.map.consumer(),u=c.originalPositionFor({column:t,line:e});if(!u.source)return!1;"number"==typeof n&&(r=c.originalPositionFor({column:o,line:n})),a=s(u.source)?i(u.source):new URL(u.source,this.map.consumer().sourceRoot||i(this.map.mapFile));let d={column:u.column,endColumn:r&&r.column,endLine:r&&r.line,line:u.line,url:a.toString()};if("file:"===a.protocol){if(!l)throw new Error("file: protocol is not available in this PostCSS build");d.file=l(a)}let p=c.sourceContentFor(u.source);return p&&(d.source=p),d}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}}e.exports=f,f.default=f,u&&u.registerInput&&u.registerInput(f)},448:(e,t,n)=>{"use strict";let{isClean:o,my:r}=n(1381),l=n(1670),i=n(633),s=n(683),a=n(271),c=(n(3122),n(9055)),u=n(4295),d=n(9434);const p={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},m={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},h={Once:!0,postcssPlugin:!0,prepare:!0},g=0;function f(e){return"object"==typeof e&&"function"==typeof e.then}function b(e){let t=!1,n=p[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,g,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,g,n+"Exit"]:[n,n+"Exit"]}function v(e){let t;return t="document"===e.type?["Document",g,"DocumentExit"]:"root"===e.type?["Root",g,"RootExit"]:b(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function k(e){return e[o]=!1,e.nodes&&e.nodes.forEach((e=>k(e))),e}let _={};class y{constructor(e,t,n){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof t||null===t||"root"!==t.type&&"document"!==t.type)if(t instanceof y||t instanceof c)o=k(t.root),t.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=t.map);else{let e=u;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{o=e(t,n)}catch(e){this.processed=!0,this.error=e}o&&!o[r]&&s.rebuild(o)}else o=k(t);this.result=new c(e,o,n),this.helpers={..._,postcss:_,result:this.result},this.plugins=this.processor.plugins.map((e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e))}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let n=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin?n.postcssVersion:(e.plugin=n.postcssPlugin,e.setMessage())}catch(e){console&&console.error&&console.error(e)}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!m[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!h[n])if("object"==typeof t[n])for(let o in t[n])e(t,"*"===o?n:n+"-"+o.toLowerCase(),t[n][o]);else"function"==typeof t[n]&&e(t,n,t[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],n=this.runOnRoot(t);if(f(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[o];){e[o]=!0;let t=[v(e)];for(;t.length>0;){let e=this.visitTick(t);if(f(e))try{await e}catch(e){let n=t[t.length-1].node;throw this.handleError(e,n)}}}if(this.listeners.OnceExit)for(let[t,n]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if("document"===e.type){let t=e.nodes.map((e=>n(e,this.helpers)));await Promise.all(t)}else await n(e,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map((t=>e.Once(t,this.helpers)));return f(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=i;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new l(t,this.result.root,this.result.opts).generate();return this.result.css=n[0],this.result.map=n[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(f(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[o];)e[o]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[n,o]of e){let e;this.result.lastPlugin=n;try{e=o(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(f(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:n,visitors:r}=t;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void e.pop();if(r.length>0&&t.visitorIndex<r.length){let[e,o]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return o(n.toProxy(),this.helpers)}catch(e){throw this.handleError(e,n)}}if(0!==t.iterator){let r,l=t.iterator;for(;r=n.nodes[n.indexes[l]];)if(n.indexes[l]+=1,!r[o])return r[o]=!0,void e.push(v(r));t.iterator=0,delete n.indexes[l]}let l=t.events;for(;t.eventIndex<l.length;){let e=l[t.eventIndex];if(t.eventIndex+=1,e===g)return void(n.nodes&&n.nodes.length&&(n[o]=!0,t.iterator=n.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[o]=!0;let t=b(e);for(let n of t)if(n===g)e.nodes&&e.each((e=>{e[o]||this.walkSync(e)}));else{let t=this.listeners[n];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}}y.registerPostcss=e=>{_=e},e.exports=y,y.default=y,d.registerLazyResult(y),a.registerLazyResult(y)},7374:e=>{"use strict";let t={comma:e=>t.split(e,[","],!0),space:e=>t.split(e,[" ","\n","\t"]),split(e,t,n){let o=[],r="",l=!1,i=0,s=!1,a="",c=!1;for(let n of e)c?c=!1:"\\"===n?c=!0:s?n===a&&(s=!1):'"'===n||"'"===n?(s=!0,a=n):"("===n?i+=1:")"===n?i>0&&(i-=1):0===i&&t.includes(n)&&(l=!0),l?(""!==r&&o.push(r.trim()),r="",l=!1):r+=n;return(n||""!==r)&&o.push(r.trim()),o}};e.exports=t,t.default=t},1670:(e,t,n)=>{"use strict";let{SourceMapConsumer:o,SourceMapGenerator:r}=n(1866),{dirname:l,relative:i,resolve:s,sep:a}=n(197),{pathToFileURL:c}=n(2739),u=n(5380),d=Boolean(o&&r),p=Boolean(l&&s&&i&&a);e.exports=class{constructor(e,t,n,o){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=o,this.originalCSS=o,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,n=this.toUrl(this.path(e.file)),r=e.root||l(e.file);!1===this.mapOpts.sourcesContent?(t=new o(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),p&&d&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,(t=>{e+=t})),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=r.fromSourceMap(e)}else this.map=new r({file:this.outputFile()}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new r({file:this.outputFile()});let e,t,n=1,o=1,l="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,((r,s,a)=>{if(this.css+=r,s&&"end"!==a&&(i.generated.line=n,i.generated.column=o-1,s.source&&s.source.start?(i.source=this.sourcePath(s),i.original.line=s.source.start.line,i.original.column=s.source.start.column-1,this.map.addMapping(i)):(i.source=l,i.original.line=1,i.original.column=0,this.map.addMapping(i))),e=r.match(/\n/g),e?(n+=e.length,t=r.lastIndexOf("\n"),o=r.length-t):o+=r.length,s&&"start"!==a){let e=s.parent||{raws:{}};("decl"===s.type||"atrule"===s.type&&!s.nodes)&&s===e.last&&!e.raws.semicolon||(s.source&&s.source.end?(i.source=this.sourcePath(s),i.original.line=s.source.end.line,i.original.column=s.source.end.column-1,i.generated.line=n,i.generated.column=o-2,this.map.addMapping(i)):(i.source=l,i.original.line=1,i.original.column=0,i.generated.line=n,i.generated.column=o-1,this.map.addMapping(i)))}}))}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some((e=>e.annotation)))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some((e=>e.inline)))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some((e=>e.withContent()))}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let n=this.opts.to?l(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(n=l(s(n,this.mapOpts.annotation)));let o=i(n,e);return this.memoizedPaths.set(e,o),o}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk((e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}}));else{let e=new u(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk((t=>{if(t.source){let n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let o=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(o,t.source.input.css)}}}));else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(c){let t=c(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===a&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}}},7661:(e,t,n)=>{"use strict";let o=n(1670),r=n(633),l=(n(3122),n(4295));const i=n(9055);class s{constructor(e,t,n){let l;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=n,this._map=void 0;let s=r;this.result=new i(this._processor,l,this._opts),this.result.css=t;let a=this;Object.defineProperty(this.result,"root",{get:()=>a.root});let c=new o(s,l,this._opts,t);if(c.isMap()){let[e,t]=c.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else c.clearAnnotation(),this.result.css=c.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=l;try{e=t(this._css,this._opts)}catch(e){this.error=e}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}}e.exports=s,s.default=s},7490:(e,t,n)=>{"use strict";let{isClean:o,my:r}=n(1381),l=n(356),i=n(346),s=n(633);function a(e,t){let n=new e.constructor;for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;if("proxyCache"===o)continue;let r=e[o],l=typeof r;"parent"===o&&"object"===l?t&&(n[o]=t):"source"===o?n[o]=r:Array.isArray(r)?n[o]=r.map((e=>a(e,n))):("object"===l&&null!==r&&(r=a(r)),n[o]=r)}return n}class c{constructor(e={}){this.raws={},this[o]=!1,this[r]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let n of e[t])"function"==typeof n.clone?this.append(n.clone()):this.append(n)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=a(this);for(let n in e)t[n]=e[n];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:n,start:o}=this.rangeBy(t);return this.source.input.error(e,{column:o.column,line:o.line},{column:n.column,line:n.line},t)}return new l(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[o]){this[o]=!1;let e=this;for(;e=e.parent;)e[o]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let n=this.source.start;if(e.index)n=this.positionInside(e.index,t);else if(e.word){let o=(t=this.toString()).indexOf(e.word);-1!==o&&(n=this.positionInside(o,t))}return n}positionInside(e,t){let n=t||this.toString(),o=this.source.start.column,r=this.source.start.line;for(let t=0;t<e;t++)"\n"===n[t]?(o=1,r+=1):o+=1;return{column:o,line:r}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let o=this.toString(),r=o.indexOf(e.word);-1!==r&&(t=this.positionInside(r,o),n=this.positionInside(r+e.word.length,o))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?n={column:e.end.column,line:e.end.line}:e.endIndex?n=this.positionInside(e.endIndex):e.index&&(n=this.positionInside(e.index+1));return(n.line<t.line||n.line===t.line&&n.column<=t.column)&&(n={column:t.column+1,line:t.line}),{end:n,start:t}}raw(e,t){return(new i).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,n=!1;for(let o of e)o===this?n=!0:n?(this.parent.insertAfter(t,o),t=o):this.parent.insertBefore(t,o);n||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let n={},o=null==t;t=t||new Map;let r=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let o=this[e];if(Array.isArray(o))n[e]=o.map((e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e));else if("object"==typeof o&&o.toJSON)n[e]=o.toJSON(null,t);else if("source"===e){let l=t.get(o.input);null==l&&(l=r,t.set(o.input,r),r++),n[e]={end:o.end,inputId:l,start:o.start}}else n[e]=o}return o&&(n.inputs=[...t.keys()].map((e=>e.toJSON()))),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=s){e.stringify&&(e=e.stringify);let t="";return e(this,(e=>{t+=e})),t}warn(e,t,n){let o={node:this};for(let e in n)o[e]=n[e];return e.warn(t,o)}get proxyOf(){return this}}e.exports=c,c.default=c},4295:(e,t,n)=>{"use strict";let o=n(683),r=n(3937),l=n(5380);function i(e,t){let n=new l(e,t),o=new r(n);try{o.parse()}catch(e){throw e}return o.root}e.exports=i,i.default=i,o.registerParse(i)},3937:(e,t,n)=>{"use strict";let o=n(1516),r=n(2327),l=n(6589),i=n(1326),s=n(9434),a=n(4092);const c={empty:!0,space:!0};e.exports=class{constructor(e){this.input=e,this.root=new s,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,n,o,r=new i;r.name=e[1].slice(1),""===r.name&&this.unnamedAtrule(r,e),this.init(r,e[2]);let l=!1,s=!1,a=[],c=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?c.push("("===t?")":"]"):"{"===t&&c.length>0?c.push("}"):t===c[c.length-1]&&c.pop(),0===c.length){if(";"===t){r.source.end=this.getPosition(e[2]),r.source.end.offset++,this.semicolon=!0;break}if("{"===t){s=!0;break}if("}"===t){if(a.length>0){for(o=a.length-1,n=a[o];n&&"space"===n[0];)n=a[--o];n&&(r.source.end=this.getPosition(n[3]||n[2]),r.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){l=!0;break}}r.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(r.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(r,"params",a),l&&(e=a[a.length-1],r.source.end=this.getPosition(e[3]||e[2]),r.source.end.offset++,this.spaces=r.raws.between,r.raws.between="")):(r.raws.afterName="",r.params=""),s&&(r.nodes=[],this.current=r)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let n,o=0;for(let r=t-1;r>=0&&(n=e[r],"space"===n[0]||(o+=1,2!==o));r--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,o,r=0;for(let[l,i]of e.entries()){if(t=i,n=t[0],"("===n&&(r+=1),")"===n&&(r-=1),0===r&&":"===n){if(o){if("word"===o[0]&&"progid"===o[1])continue;return l}this.doubleColon(t)}o=t}return!1}comment(e){let t=new l;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=r(this.input)}decl(e,t){let n=new o;this.init(n,e[0][2]);let r,l=e[e.length-1];for(";"===l[0]&&(this.semicolon=!0,e.pop()),n.source.end=this.getPosition(l[3]||l[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],o=n[3]||n[2];if(o)return o}}(e)),n.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),n.raws.before+=e.shift()[1];for(n.source.start=this.getPosition(e[0][2]),n.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;n.prop+=e.shift()[1]}for(n.raws.between="";e.length;){if(r=e.shift(),":"===r[0]){n.raws.between+=r[1];break}"word"===r[0]&&/\w/.test(r[1])&&this.unknownWord([r]),n.raws.between+=r[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let i,s=[];for(;e.length&&(i=e[0][0],"space"===i||"comment"===i);)s.push(e.shift());this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(r=e[t],"!important"===r[1].toLowerCase()){n.important=!0;let o=this.stringFrom(e,t);o=this.spacesFromEnd(e)+o," !important"!==o&&(n.raws.important=o);break}if("important"===r[1].toLowerCase()){let o=e.slice(0),r="";for(let e=t;e>0;e--){let t=o[e][0];if(0===r.trim().indexOf("!")&&"space"!==t)break;r=o.pop()[1]+r}0===r.trim().indexOf("!")&&(n.important=!0,n.raws.important=r,e=o)}if("space"!==r[0]&&"comment"!==r[0])break}e.some((e=>"space"!==e[0]&&"comment"!==e[0]))&&(n.raws.between+=s.map((e=>e[1])).join(""),s=[]),this.raw(n,"value",s.concat(e),t),n.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new a;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,n=null,o=!1,r=null,l=[],i=e[1].startsWith("--"),s=[],a=e;for(;a;){if(n=a[0],s.push(a),"("===n||"["===n)r||(r=a),l.push("("===n?")":"]");else if(i&&o&&"{"===n)r||(r=a),l.push("}");else if(0===l.length){if(";"===n){if(o)return void this.decl(s,i);break}if("{"===n)return void this.rule(s);if("}"===n){this.tokenizer.back(s.pop()),t=!0;break}":"===n&&(o=!0)}else n===l[l.length-1]&&(l.pop(),0===l.length&&(r=null));a=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),l.length>0&&this.unclosedBracket(r),t&&o){if(!i)for(;s.length&&(a=s[s.length-1][0],"space"===a||"comment"===a);)this.tokenizer.back(s.pop());this.decl(s,i)}else this.unknownWord(s)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,n,o){let r,l,i,s,a=n.length,u="",d=!0;for(let e=0;e<a;e+=1)r=n[e],l=r[0],"space"!==l||e!==a-1||o?"comment"===l?(s=n[e-1]?n[e-1][0]:"empty",i=n[e+1]?n[e+1][0]:"empty",c[s]||c[i]||","===u.slice(-1)?d=!1:u+=r[1]):u+=r[1]:d=!1;if(!d){let o=n.reduce(((e,t)=>e+t[1]),"");e.raws[t]={raw:o,value:u}}e[t]=u}rule(e){e.pop();let t=new a;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let o=t;o<e.length;o++)n+=e[o][1];return e.splice(t,e.length-t),n}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}}},4529:(e,t,n)=>{"use strict";let o=n(356),r=n(1516),l=n(448),i=n(683),s=n(9656),a=n(633),c=n(8940),u=n(271),d=n(5776),p=n(6589),m=n(1326),h=n(9055),g=n(5380),f=n(4295),b=n(7374),v=n(4092),k=n(9434),_=n(7490);function y(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new s(e)}y.plugin=function(e,t){let n,o=!1;function r(...n){console&&console.warn&&!o&&(o=!0,console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": 里面 postcss.plugin 被弃用. 迁移指南:\nhttps://www.w3ctech.com/topic/2226"));let r=t(...n);return r.postcssPlugin=e,r.postcssVersion=(new s).version,r}return Object.defineProperty(r,"postcss",{get:()=>(n||(n=r()),n)}),r.process=function(e,t,n){return y([r(n)]).process(e,t)},r},y.stringify=a,y.parse=f,y.fromJSON=c,y.list=b,y.comment=e=>new p(e),y.atRule=e=>new m(e),y.decl=e=>new r(e),y.rule=e=>new v(e),y.root=e=>new k(e),y.document=e=>new u(e),y.CssSyntaxError=o,y.Declaration=r,y.Container=i,y.Processor=s,y.Document=u,y.Comment=p,y.Warning=d,y.AtRule=m,y.Result=h,y.Input=g,y.Rule=v,y.Root=k,y.Node=_,l.registerPostcss(y),e.exports=y,y.default=y},5696:(e,t,n)=>{"use strict";let{SourceMapConsumer:o,SourceMapGenerator:r}=n(1866),{existsSync:l,readFileSync:i}=n(9977),{dirname:s,join:a}=n(197);class c{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let n=t.map?t.map.prev:void 0,o=this.loadMap(t.from,n);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=s(this.mapFile)),o&&(this.text=o)}consumer(){return this.consumerCache||(this.consumerCache=new o(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let n=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+n)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let n=e.lastIndexOf(t.pop()),o=e.indexOf("*/",n);n>-1&&o>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,o)))}loadFile(e){if(this.root=s(e),l(e))return this.mapFile=e,i(e,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof o)return r.fromSourceMap(t).toString();if(t instanceof r)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let n=t(e);if(n){let e=this.loadFile(n);if(!e)throw new Error("Unable to load previous source map: "+n.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=a(s(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}e.exports=c,c.default=c},9656:(e,t,n)=>{"use strict";let o=n(7661),r=n(448),l=n(271),i=n(9434);class s{constructor(e=[]){this.version="8.4.35",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else{if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" is not a PostCSS plugin")}return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new r(this,e,t):new o(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}}e.exports=s,s.default=s,i.registerProcessor(s),l.registerProcessor(s)},9055:(e,t,n)=>{"use strict";let o=n(5776);class r{constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let n=new o(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter((e=>"warning"===e.type))}get content(){return this.css}}e.exports=r,r.default=r},9434:(e,t,n)=>{"use strict";let o,r,l=n(683);class i extends l{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let o=super.normalize(e);if(t)if("prepend"===n)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of o)e.raws.before=t.raws.before;return o}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(e={}){return new o(new r,this,e).stringify()}}i.registerLazyResult=e=>{o=e},i.registerProcessor=e=>{r=e},e.exports=i,i.default=i,l.registerRoot(i)},4092:(e,t,n)=>{"use strict";let o=n(683),r=n(7374);class l extends o{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return r.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}}e.exports=l,l.default=l,o.registerRule(l)},346:e=>{"use strict";const t={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};class n{constructor(e){this.builder=e}atrule(e,t){let n="@"+e.name,o=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:o&&(n+=" "),e.nodes)this.block(e,n+o);else{let r=(e.raws.between||"")+(t?";":"");this.builder(n+o+r,e)}}beforeAfter(e,t){let n;n="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let o=e.parent,r=0;for(;o&&"root"!==o.type;)r+=1,o=o.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<r;e++)n+=t}return n}block(e,t){let n,o=this.raw(e,"between","beforeOpen");this.builder(t+o+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let o=0;o<e.nodes.length;o++){let r=e.nodes[o],l=this.raw(r,"before");l&&this.builder(l),this.stringify(r,t!==o||n)}}comment(e){let t=this.raw(e,"left","commentLeft"),n=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+n+"*/",e)}decl(e,t){let n=this.raw(e,"between","colon"),o=e.prop+n+this.rawValue(e,"value");e.important&&(o+=e.raws.important||" !important"),t&&(o+=";"),this.builder(o,e)}document(e){this.body(e)}raw(e,n,o){let r;if(o||(o=n),n&&(r=e.raws[n],void 0!==r))return r;let l=e.parent;if("before"===o){if(!l||"root"===l.type&&l.first===e)return"";if(l&&"document"===l.type)return""}if(!l)return t[o];let i=e.root();if(i.rawCache||(i.rawCache={}),void 0!==i.rawCache[o])return i.rawCache[o];if("before"===o||"after"===o)return this.beforeAfter(e,o);{let t="raw"+((s=o)[0].toUpperCase()+s.slice(1));this[t]?r=this[t](i,e):i.walk((e=>{if(r=e.raws[n],void 0!==r)return!1}))}var s;return void 0===r&&(r=t[o]),i.rawCache[o]=r,r}rawBeforeClose(e){let t;return e.walk((e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1})),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let n;return e.walkComments((e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1})),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls((e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1})),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(e){let t;return e.walk((e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1})),t}rawBeforeRule(e){let t;return e.walk((n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1})),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls((e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1})),t}rawEmptyBody(e){let t;return e.walk((e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1})),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk((n=>{let o=n.parent;if(o&&o!==e&&o.parent&&o.parent===e&&void 0!==n.raws.before){let e=n.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}})),t}rawSemicolon(e){let t;return e.walk((e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1})),t}rawValue(e,t){let n=e[t],o=e.raws[t];return o&&o.value===n?o.raw:n}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}}e.exports=n,n.default=n},633:(e,t,n)=>{"use strict";let o=n(346);function r(e,t){new o(t).stringify(e)}e.exports=r,r.default=r},1381:e=>{"use strict";e.exports.isClean=Symbol("isClean"),e.exports.my=Symbol("my")},2327:e=>{"use strict";const t="'".charCodeAt(0),n='"'.charCodeAt(0),o="\\".charCodeAt(0),r="/".charCodeAt(0),l="\n".charCodeAt(0),i=" ".charCodeAt(0),s="\f".charCodeAt(0),a="\t".charCodeAt(0),c="\r".charCodeAt(0),u="[".charCodeAt(0),d="]".charCodeAt(0),p="(".charCodeAt(0),m=")".charCodeAt(0),h="{".charCodeAt(0),g="}".charCodeAt(0),f=";".charCodeAt(0),b="*".charCodeAt(0),v=":".charCodeAt(0),k="@".charCodeAt(0),_=/[\t\n\f\r "#'()/;[\\\]{}]/g,y=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,E=/.[\r\n"'(/\\]/,w=/[\da-f]/i;e.exports=function(e,S={}){let C,x,B,I,T,M,P,R,N,L,A=e.css.valueOf(),O=S.ignoreErrors,D=A.length,z=0,V=[],F=[];function H(t){throw e.error("Unclosed "+t,z)}return{back:function(e){F.push(e)},endOfFile:function(){return 0===F.length&&z>=D},nextToken:function(e){if(F.length)return F.pop();if(z>=D)return;let S=!!e&&e.ignoreUnclosed;switch(C=A.charCodeAt(z),C){case l:case i:case a:case c:case s:x=z;do{x+=1,C=A.charCodeAt(x)}while(C===i||C===l||C===a||C===c||C===s);L=["space",A.slice(z,x)],z=x-1;break;case u:case d:case h:case g:case v:case f:case m:{let e=String.fromCharCode(C);L=[e,e,z];break}case p:if(R=V.length?V.pop()[1]:"",N=A.charCodeAt(z+1),"url"===R&&N!==t&&N!==n&&N!==i&&N!==l&&N!==a&&N!==s&&N!==c){x=z;do{if(M=!1,x=A.indexOf(")",x+1),-1===x){if(O||S){x=z;break}H("bracket")}for(P=x;A.charCodeAt(P-1)===o;)P-=1,M=!M}while(M);L=["brackets",A.slice(z,x+1),z,x],z=x}else x=A.indexOf(")",z+1),I=A.slice(z,x+1),-1===x||E.test(I)?L=["(","(",z]:(L=["brackets",I,z,x],z=x);break;case t:case n:B=C===t?"'":'"',x=z;do{if(M=!1,x=A.indexOf(B,x+1),-1===x){if(O||S){x=z+1;break}H("string")}for(P=x;A.charCodeAt(P-1)===o;)P-=1,M=!M}while(M);L=["string",A.slice(z,x+1),z,x],z=x;break;case k:_.lastIndex=z+1,_.test(A),x=0===_.lastIndex?A.length-1:_.lastIndex-2,L=["at-word",A.slice(z,x+1),z,x],z=x;break;case o:for(x=z,T=!0;A.charCodeAt(x+1)===o;)x+=1,T=!T;if(C=A.charCodeAt(x+1),T&&C!==r&&C!==i&&C!==l&&C!==a&&C!==c&&C!==s&&(x+=1,w.test(A.charAt(x)))){for(;w.test(A.charAt(x+1));)x+=1;A.charCodeAt(x+1)===i&&(x+=1)}L=["word",A.slice(z,x+1),z,x],z=x;break;default:C===r&&A.charCodeAt(z+1)===b?(x=A.indexOf("*/",z+2)+1,0===x&&(O||S?x=A.length:H("comment")),L=["comment",A.slice(z,x+1),z,x],z=x):(y.lastIndex=z+1,y.test(A),x=0===y.lastIndex?A.length-1:y.lastIndex-2,L=["word",A.slice(z,x+1),z,x],V.push(L),z=x)}return z++,L},position:function(){return z}}}},3122:e=>{"use strict";let t={};e.exports=function(e){t[e]||(t[e]=!0,"undefined"!=typeof console&&console.warn&&console.warn(e))}},5776:e=>{"use strict";class t{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}e.exports=t,t.default=t},628:(e,t,n)=>{"use strict";var o=n(4067);function r(){}function l(){}l.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,l,i){if(i!==o){var s=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");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:l,resetWarningCache:r};return n.PropTypes=n,n}},5826:(e,t,n)=>{e.exports=n(628)()},4067:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4462:function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),l=this&&this.__assign||Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i=this&&this.__rest||function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&(n[o[r]]=e[o[r]])}return n};t.__esModule=!0;var s=n(1609),a=n(5826),c=n(4306),u=n(461),d="autosize:resized",p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={lineHeight:null},t.textarea=null,t.onResize=function(e){t.props.onResize&&t.props.onResize(e)},t.updateLineHeight=function(){t.textarea&&t.setState({lineHeight:u(t.textarea)})},t.onChange=function(e){var n=t.props.onChange;t.currentValue=e.currentTarget.value,n&&n(e)},t}return r(t,e),t.prototype.componentDidMount=function(){var e=this,t=this.props,n=t.maxRows,o=t.async;"number"==typeof n&&this.updateLineHeight(),"number"==typeof n||o?setTimeout((function(){return e.textarea&&c(e.textarea)})):this.textarea&&c(this.textarea),this.textarea&&this.textarea.addEventListener(d,this.onResize)},t.prototype.componentWillUnmount=function(){this.textarea&&(this.textarea.removeEventListener(d,this.onResize),c.destroy(this.textarea))},t.prototype.render=function(){var e=this,t=this.props,n=(t.onResize,t.maxRows),o=(t.onChange,t.style),r=(t.innerRef,t.children),a=i(t,["onResize","maxRows","onChange","style","innerRef","children"]),c=this.state.lineHeight,u=n&&c?c*n:null;return s.createElement("textarea",l({},a,{onChange:this.onChange,style:u?l({},o,{maxHeight:u}):o,ref:function(t){e.textarea=t,"function"==typeof e.props.innerRef?e.props.innerRef(t):e.props.innerRef&&(e.props.innerRef.current=t)}}),r)},t.prototype.componentDidUpdate=function(){this.textarea&&c.update(this.textarea)},t.defaultProps={rows:1,async:!1},t.propTypes={rows:a.number,maxRows:a.number,onResize:a.func,innerRef:a.any,async:a.bool},t}(s.Component);t.TextareaAutosize=s.forwardRef((function(e,t){return s.createElement(p,l({},e,{innerRef:t}))}))},4132:(e,t,n)=>{"use strict";var o=n(4462);t.A=o.TextareaAutosize},9681:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},n=Object.keys(t).join("|"),o=new RegExp(n,"g"),r=new RegExp(n,"");function l(e){return t[e]}var i=function(e){return e.replace(o,l)};e.exports=i,e.exports.has=function(e){return!!e.match(r)},e.exports.remove=i},1609:e=>{"use strict";e.exports=window.React},9746:()=>{},9977:()=>{},197:()=>{},1866:()=>{},2739:()=>{},5042:e=>{e.exports={nanoid:(e=21)=>{let t="",n=e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let o="",r=n;for(;r--;)o+=e[Math.random()*e.length|0];return o}}}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var l=t[o]={exports:{}};return e[o].call(l.exports,l,l.exports,n),l.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";n.r(o),n.d(o,{AlignmentControl:()=>Tg,AlignmentToolbar:()=>Mg,Autocomplete:()=>lf,BlockAlignmentControl:()=>es,BlockAlignmentToolbar:()=>ts,BlockBreadcrumb:()=>mf,BlockCanvas:()=>WC,BlockColorsStyleSelector:()=>YC,BlockContextProvider:()=>ff,BlockControls:()=>Bl,BlockEdit:()=>yf,BlockEditorKeyboardShortcuts:()=>D_,BlockEditorProvider:()=>V_,BlockFormatControls:()=>xl,BlockIcon:()=>qh,BlockInspector:()=>XT,BlockList:()=>Xw,BlockMover:()=>bS,BlockNavigationDropdown:()=>Rx,BlockPreview:()=>Ty,BlockSelectionClearer:()=>H_,BlockSettingsMenu:()=>yC,BlockSettingsMenuControls:()=>jh,BlockStyles:()=>Ax,BlockTitle:()=>pf,BlockToolbar:()=>zC,BlockTools:()=>$C,BlockVerticalAlignmentControl:()=>pi,BlockVerticalAlignmentToolbar:()=>mi,ButtonBlockAppender:()=>uw,ButtonBlockerAppender:()=>cw,ColorPalette:()=>aB,ColorPaletteControl:()=>cB,ContrastChecker:()=>pd,CopyHandler:()=>JT,DefaultBlockAppender:()=>sw,FontSizePicker:()=>kg,HeadingLevelDropdown:()=>Fx,HeightControl:()=>Kp,InnerBlocks:()=>Gw,Inserter:()=>lw,InspectorAdvancedControls:()=>xs,InspectorControls:()=>Bs,JustifyContentControl:()=>fi,JustifyToolbar:()=>bi,LineHeightControl:()=>Vd,MediaPlaceholder:()=>cI,MediaReplaceFlow:()=>ec,MediaUpload:()=>Gs,MediaUploadCheck:()=>Us,MultiSelectScrollIntoView:()=>nM,NavigableToolbar:()=>NC,ObserveTyping:()=>Ww,PanelColorSettings:()=>uI,PlainText:()=>YI,RecursionProvider:()=>cM,ReusableBlocksRenameHint:()=>CM,RichText:()=>KI,RichTextShortcut:()=>JI,RichTextToolbarButton:()=>eT,SETTINGS_DEFAULTS:()=>I,SkipToSelectedBlock:()=>bT,ToolSelector:()=>oT,Typewriter:()=>sM,URLInput:()=>ta,URLInputButton:()=>sT,URLPopover:()=>lI,Warning:()=>wf,WritingFlow:()=>sy,__experimentalBlockAlignmentMatrixControl:()=>uf,__experimentalBlockFullHeightAligmentControl:()=>af,__experimentalBlockPatternSetup:()=>nB,__experimentalBlockPatternsList:()=>rE,__experimentalBlockVariationPicker:()=>Gx,__experimentalBlockVariationTransforms:()=>iB,__experimentalBorderRadiusControl:()=>cu,__experimentalColorGradientControl:()=>Xu,__experimentalColorGradientSettingsDropdown:()=>bB,__experimentalDateFormatPicker:()=>pB,__experimentalDuotoneControl:()=>Fm,__experimentalFontAppearanceControl:()=>Dd,__experimentalFontFamilyControl:()=>Nd,__experimentalGetBorderClassesAndStyles:()=>rg,__experimentalGetColorClassesAndStyles:()=>sg,__experimentalGetElementClassName:()=>BM,__experimentalGetGapCSSValue:()=>oi,__experimentalGetGradientClass:()=>Gu,__experimentalGetGradientObjectByGradientValue:()=>$u,__experimentalGetShadowClassesAndStyles:()=>ig,__experimentalGetSpacingClassesAndStyles:()=>cg,__experimentalImageEditor:()=>QB,__experimentalImageSizeControl:()=>tI,__experimentalImageURLInputUI:()=>hT,__experimentalInspectorPopoverHeader:()=>hM,__experimentalLetterSpacingControl:()=>Fd,__experimentalLibrary:()=>tM,__experimentalLinkControl:()=>Xa,__experimentalLinkControlSearchInput:()=>Ra,__experimentalLinkControlSearchItem:()=>ba,__experimentalLinkControlSearchResults:()=>Sa,__experimentalListView:()=>Mx,__experimentalPanelColorGradientSettings:()=>yB,__experimentalPreviewOptions:()=>gT,__experimentalPublishDateTimePicker:()=>gM,__experimentalRecursionProvider:()=>dM,__experimentalResponsiveBlockControl:()=>QI,__experimentalSpacingSizesControl:()=>jp,__experimentalTextDecorationControl:()=>Yd,__experimentalTextTransformControl:()=>Wd,__experimentalUnitControl:()=>rT,__experimentalUseBlockOverlayActive:()=>hf,__experimentalUseBlockPreview:()=>My,__experimentalUseBorderProps:()=>lg,__experimentalUseColorProps:()=>ag,__experimentalUseCustomSides:()=>Bm,__experimentalUseGradient:()=>Wu,__experimentalUseHasRecursion:()=>pM,__experimentalUseMultipleOriginColorsAndGradients:()=>qc,__experimentalUseResizeCanvas:()=>fT,__experimentalWritingModeControl:()=>ep,__unstableBlockNameContext:()=>TC,__unstableBlockSettingsMenuFirstItem:()=>gC,__unstableBlockToolbarLastItem:()=>QS,__unstableEditorStyles:()=>wy,__unstableIframe:()=>py,__unstableInserterMenuExtension:()=>WE,__unstableRichTextInputEvent:()=>tT,__unstableUseBlockSelectionClearer:()=>F_,__unstableUseClipboardHandler:()=>QT,__unstableUseMouseMoveTypingReset:()=>$w,__unstableUseTypewriter:()=>iM,__unstableUseTypingObserver:()=>jw,createCustomColorsHOC:()=>bg,getColorClassName:()=>Zc,getColorObjectByAttributeValues:()=>Wc,getColorObjectByColorValue:()=>Kc,getComputedFluidTypographyValue:()=>Ur,getCustomValueFromPreset:()=>Ql,getFontSize:()=>Ep,getFontSizeClass:()=>Sp,getFontSizeObjectByValue:()=>wp,getGradientSlugByValue:()=>ju,getGradientValueBySlug:()=>Uu,getPxFromCssUnit:()=>IM,getSpacingPresetCssVar:()=>ei,getTypographyClassesAndStyles:()=>ug,isValueSpacingPreset:()=>Xl,privateApis:()=>HR,store:()=>Nr,storeConfig:()=>Rr,transformStyles:()=>yy,useBlockCommands:()=>wM,useBlockDisplayInformation:()=>ih,useBlockEditContext:()=>y,useBlockEditingMode:()=>ns,useBlockProps:()=>y_,useCachedTruthy:()=>dg,useHasRecursion:()=>uM,useInnerBlocksProps:()=>Hw,useSetting:()=>Or,useSettings:()=>Ar,withColorContext:()=>sB,withColors:()=>vg,withFontSizes:()=>Eg});var e={};n.r(e),n.d(e,{__experimentalGetActiveBlockIdByBlockNames:()=>dn,__experimentalGetAllowedBlocks:()=>Ht,__experimentalGetAllowedPatterns:()=>Wt,__experimentalGetBlockListSettingsForBlocks:()=>Jt,__experimentalGetDirectInsertBlock:()=>Ut,__experimentalGetGlobalBlocksByName:()=>ye,__experimentalGetLastBlockAttributeChanges:()=>nn,__experimentalGetParsedPattern:()=>$t,__experimentalGetPatternTransformItems:()=>qt,__experimentalGetPatternsByBlockTypes:()=>Zt,__experimentalGetReusableBlockTitle:()=>en,__unstableGetBlockWithoutInnerBlocks:()=>me,__unstableGetClientIdWithClientIdsTree:()=>ge,__unstableGetClientIdsTree:()=>fe,__unstableGetContentLockingParent:()=>gn,__unstableGetEditorMode:()=>ln,__unstableGetSelectedBlocksWithPartialSelection:()=>nt,__unstableGetTemporarilyEditingAsBlocks:()=>fn,__unstableGetTemporarilyEditingFocusModeToRevert:()=>bn,__unstableGetVisibleBlocks:()=>hn,__unstableHasActiveBlockOverlayActive:()=>vn,__unstableIsFullySelected:()=>Qe,__unstableIsLastBlockChangeIgnored:()=>tn,__unstableIsSelectionCollapsed:()=>Je,__unstableIsSelectionMergeable:()=>tt,__unstableIsWithinBlockOverlay:()=>kn,__unstableSelectionHasUnmergeableBlock:()=>et,areInnerBlocksControlled:()=>un,canEditBlock:()=>Pt,canInsertBlockType:()=>Ct,canInsertBlocks:()=>xt,canLockBlockType:()=>Rt,canMoveBlock:()=>Tt,canMoveBlocks:()=>Mt,canRemoveBlock:()=>Bt,canRemoveBlocks:()=>It,didAutomaticChange:()=>an,getAdjacentBlockClientId:()=>ze,getAllowedBlocks:()=>Ft,getBlock:()=>pe,getBlockAttributes:()=>de,getBlockCount:()=>Se,getBlockEditingMode:()=>_n,getBlockHierarchyRootClientId:()=>Oe,getBlockIndex:()=>rt,getBlockInsertionPoint:()=>kt,getBlockListSettings:()=>Yt,getBlockMode:()=>pt,getBlockName:()=>ce,getBlockNamesByClientId:()=>we,getBlockOrder:()=>ot,getBlockParents:()=>Le,getBlockParentsByBlockName:()=>Ae,getBlockRootClientId:()=>Ne,getBlockSelectionEnd:()=>Ie,getBlockSelectionStart:()=>Be,getBlockTransformItems:()=>zt,getBlocks:()=>he,getBlocksByClientId:()=>Ee,getBlocksByName:()=>_e,getClientIdsOfDescendants:()=>be,getClientIdsWithDescendants:()=>ve,getDirectInsertBlock:()=>Gt,getDraggedBlockClientIds:()=>gt,getFirstMultiSelectedBlockClientId:()=>je,getGlobalBlockCount:()=>ke,getInserterItems:()=>Dt,getLastMultiSelectedBlockClientId:()=>We,getLowestCommonAncestorWithSelectedBlock:()=>De,getMultiSelectedBlockClientIds:()=>Ue,getMultiSelectedBlocks:()=>$e,getMultiSelectedBlocksEndClientId:()=>Xe,getMultiSelectedBlocksStartClientId:()=>Ye,getNextBlockClientId:()=>Fe,getPatternsByBlockTypes:()=>Kt,getPreviousBlockClientId:()=>Ve,getSelectedBlock:()=>Re,getSelectedBlockClientId:()=>Pe,getSelectedBlockClientIds:()=>Ge,getSelectedBlockCount:()=>Te,getSelectedBlocksInitialCaretPosition:()=>He,getSelectionEnd:()=>xe,getSelectionStart:()=>Ce,getSettings:()=>Xt,getTemplate:()=>Et,getTemplateLock:()=>wt,hasBlockMovingClientId:()=>sn,hasDraggedInnerBlock:()=>st,hasInserterItems:()=>Vt,hasMultiSelection:()=>ct,hasSelectedBlock:()=>Me,hasSelectedInnerBlock:()=>it,isAncestorBeingDragged:()=>bt,isAncestorMultiSelected:()=>qe,isBlockBeingDragged:()=>ft,isBlockHighlighted:()=>cn,isBlockInsertionPointVisible:()=>_t,isBlockMultiSelected:()=>Ze,isBlockSelected:()=>lt,isBlockValid:()=>ue,isBlockVisible:()=>mn,isBlockWithinSelection:()=>at,isCaretWithinFormattedText:()=>vt,isDraggingBlocks:()=>ht,isFirstMultiSelectedBlock:()=>Ke,isGroupable:()=>En,isLastBlockChangePersistent:()=>Qt,isMultiSelecting:()=>ut,isNavigationMode:()=>rn,isSelectionEnabled:()=>dt,isTyping:()=>mt,isUngroupable:()=>yn,isValidTemplate:()=>yt,wasBlockJustInserted:()=>pn});var t={};n.r(t),n.d(t,{__experimentalUpdateSettings:()=>Cn,clearBlockRemovalPrompt:()=>Mn,deleteStyleOverride:()=>Ln,ensureDefaultBlock:()=>Tn,hideBlockInterface:()=>xn,privateRemoveBlocks:()=>In,setBlockRemovalRules:()=>Pn,setLastFocus:()=>On,setOpenedBlockSettingsMenu:()=>Rn,setStyleOverride:()=>Nn,showBlockInterface:()=>Bn,startDragging:()=>zn,stopDragging:()=>Vn,stopEditingAsBlocks:()=>Dn,syncDerivedUpdates:()=>An});var r={};n.r(r),n.d(r,{getAllPatterns:()=>go,getBlockRemovalRules:()=>ao,getBlockSettings:()=>eo,getBlockWithoutAttributes:()=>oo,getEnabledBlockParents:()=>io,getEnabledClientIdsTree:()=>lo,getInserterMediaCategories:()=>mo,getLastFocus:()=>fo,getLastInsertedBlocksClientIds:()=>no,getOpenedBlockSettingsMenu:()=>co,getRegisteredInserterMediaCategories:()=>po,getRemovalPromptData:()=>so,getStyleOverrides:()=>uo,hasAllowedPatterns:()=>ho,isBlockInterfaceHidden:()=>to,isBlockSubtreeDisabled:()=>ro,isDragging:()=>bo});var l={};n.r(l),n.d(l,{__unstableDeleteSelection:()=>Yo,__unstableExpandSelection:()=>Qo,__unstableMarkAutomaticChange:()=>br,__unstableMarkLastChangeAsPersistent:()=>gr,__unstableMarkNextChangeAsNotPersistent:()=>fr,__unstableSaveReusableBlock:()=>hr,__unstableSetEditorMode:()=>kr,__unstableSetTemporarilyEditingAsBlocks:()=>Ir,__unstableSplitSelection:()=>Xo,clearSelectedBlock:()=>Lo,duplicateBlocks:()=>yr,enterFormattedText:()=>ar,exitFormattedText:()=>cr,flashBlock:()=>Cr,hideInsertionPoint:()=>Ko,insertAfterBlock:()=>wr,insertBeforeBlock:()=>Er,insertBlock:()=>$o,insertBlocks:()=>jo,insertDefaultBlock:()=>dr,mergeBlocks:()=>Jo,moveBlockToPosition:()=>Uo,moveBlocksDown:()=>Fo,moveBlocksToPosition:()=>Go,moveBlocksUp:()=>Ho,multiSelect:()=>No,receiveBlocks:()=>Co,registerInserterMediaCategory:()=>Tr,removeBlock:()=>tr,removeBlocks:()=>er,replaceBlock:()=>zo,replaceBlocks:()=>Do,replaceInnerBlocks:()=>nr,resetBlocks:()=>Eo,resetSelection:()=>So,selectBlock:()=>Io,selectNextBlock:()=>Mo,selectPreviousBlock:()=>To,selectionChange:()=>ur,setBlockEditingMode:()=>Mr,setBlockMovingClientId:()=>_r,setBlockVisibility:()=>Br,setHasControlledInnerBlocks:()=>xr,setNavigationMode:()=>vr,setTemplateValidity:()=>Zo,showInsertionPoint:()=>Wo,startDraggingBlocks:()=>ir,startMultiSelect:()=>Po,startTyping:()=>rr,stopDraggingBlocks:()=>sr,stopMultiSelect:()=>Ro,stopTyping:()=>lr,synchronizeTemplate:()=>qo,toggleBlockHighlight:()=>Sr,toggleBlockMode:()=>or,toggleSelection:()=>Ao,unsetBlockEditingMode:()=>Pr,updateBlock:()=>Bo,updateBlockAttributes:()=>xo,updateBlockListSettings:()=>pr,updateSettings:()=>mr,validateBlocksToTemplate:()=>wo});var i={};n.r(i),n.d(i,{AdvancedPanel:()=>KM,BorderPanel:()=>Bu,ColorPanel:()=>dd,DimensionsPanel:()=>mm,FiltersPanel:()=>Jm,GlobalStylesContext:()=>ol,ImageSettingsPanel:()=>WM,TypographyPanel:()=>gp,areGlobalStyleConfigsEqual:()=>nl,getBlockCSSSelector:()=>$m,getGlobalStylesChanges:()=>tP,getLayoutStyles:()=>LM,useGlobalSetting:()=>sl,useGlobalStyle:()=>al,useGlobalStylesOutput:()=>$M,useGlobalStylesOutputWithConfig:()=>UM,useGlobalStylesReset:()=>il,useHasBorderPanel:()=>vu,useHasBorderPanelControls:()=>ku,useHasColorPanel:()=>Qu,useHasDimensionsPanel:()=>em,useHasFiltersPanel:()=>Km,useHasImageSettingsPanel:()=>jM,useHasTypographyPanel:()=>op,useSettingsForBlockElement:()=>cl});var s=n(1609),a=n.n(s);const c=window.wp.blocks,u=window.wp.element,d=window.wp.data,p=window.wp.compose,m=window.wp.hooks,h=Symbol("mayDisplayControls"),g=Symbol("mayDisplayParentControls"),f=Symbol("blockEditingMode"),b=Symbol("blockBindings"),v={name:"",isSelected:!1},k=(0,u.createContext)(v),{Provider:_}=k;function y(){return(0,u.useContext)(k)}const E=window.wp.deprecated;var w=n.n(E),S=n(7734),C=n.n(S);const x=window.wp.i18n,B={insertUsage:{}},I={alignWide:!1,supportsLayout:!0,colors:[{name:(0,x.__)("Black"),slug:"black",color:"#000000"},{name:(0,x.__)("Cyan bluish gray"),slug:"cyan-bluish-gray",color:"#abb8c3"},{name:(0,x.__)("White"),slug:"white",color:"#ffffff"},{name:(0,x.__)("Pale pink"),slug:"pale-pink",color:"#f78da7"},{name:(0,x.__)("Vivid red"),slug:"vivid-red",color:"#cf2e2e"},{name:(0,x.__)("Luminous vivid orange"),slug:"luminous-vivid-orange",color:"#ff6900"},{name:(0,x.__)("Luminous vivid amber"),slug:"luminous-vivid-amber",color:"#fcb900"},{name:(0,x.__)("Light green cyan"),slug:"light-green-cyan",color:"#7bdcb5"},{name:(0,x.__)("Vivid green cyan"),slug:"vivid-green-cyan",color:"#00d084"},{name:(0,x.__)("Pale cyan blue"),slug:"pale-cyan-blue",color:"#8ed1fc"},{name:(0,x.__)("Vivid cyan blue"),slug:"vivid-cyan-blue",color:"#0693e3"},{name:(0,x.__)("Vivid purple"),slug:"vivid-purple",color:"#9b51e0"}],fontSizes:[{name:(0,x._x)("Small","font size name"),size:13,slug:"small"},{name:(0,x._x)("Normal","font size name"),size:16,slug:"normal"},{name:(0,x._x)("Medium","font size name"),size:20,slug:"medium"},{name:(0,x._x)("Large","font size name"),size:36,slug:"large"},{name:(0,x._x)("Huge","font size name"),size:42,slug:"huge"}],imageDefaultSize:"large",imageSizes:[{slug:"thumbnail",name:(0,x.__)("Thumbnail")},{slug:"medium",name:(0,x.__)("Medium")},{slug:"large",name:(0,x.__)("Large")},{slug:"full",name:(0,x.__)("Full Size")}],imageEditing:!0,maxWidth:580,allowedBlockTypes:!0,maxUploadFileSize:0,allowedMimeTypes:null,canLockBlocks:!0,enableOpenverseMediaCategory:!0,clearBlockSelection:!0,__experimentalCanUserUseUnfilteredHTML:!1,__experimentalBlockDirectory:!1,__mobileEnablePageTemplates:!1,__experimentalBlockPatterns:[],__experimentalBlockPatternCategories:[],__unstableGalleryWithImageBlocks:!1,__unstableIsPreviewMode:!1,blockInspectorAnimation:{animationParent:"core/navigation","core/navigation":{enterDirection:"leftToRight"},"core/navigation-submenu":{enterDirection:"rightToLeft"},"core/navigation-link":{enterDirection:"rightToLeft"},"core/search":{enterDirection:"rightToLeft"},"core/social-links":{enterDirection:"rightToLeft"},"core/page-list":{enterDirection:"rightToLeft"},"core/spacer":{enterDirection:"rightToLeft"},"core/home-link":{enterDirection:"rightToLeft"},"core/site-title":{enterDirection:"rightToLeft"},"core/site-logo":{enterDirection:"rightToLeft"}},generateAnchors:!1,gradients:[{name:(0,x.__)("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:(0,x.__)("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:(0,x.__)("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:(0,x.__)("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:(0,x.__)("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:(0,x.__)("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:(0,x.__)("Blush light purple"),gradient:"linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%)",slug:"blush-light-purple"},{name:(0,x.__)("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:(0,x.__)("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:(0,x.__)("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:(0,x.__)("Electric grass"),gradient:"linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%)",slug:"electric-grass"},{name:(0,x.__)("Midnight"),gradient:"linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%)",slug:"midnight"}],__unstableResolvedAssets:{styles:[],scripts:[]}};function T(e,t,n){return[...e.slice(0,n),...Array.isArray(t)?t:[t],...e.slice(n)]}function M(e,t,n,o=1){const r=[...e];return r.splice(t,o),T(r,e.slice(t,t+o),n)}const P=e=>e;function R(e,t=""){const n=new Map,o=[];return n.set(t,o),e.forEach((e=>{const{clientId:t,innerBlocks:r}=e;o.push(t),R(r,t).forEach(((e,t)=>{n.set(t,e)}))})),n}function N(e,t=""){const n=[],o=[[t,e]];for(;o.length;){const[e,t]=o.shift();t.forEach((({innerBlocks:t,...r})=>{n.push([r.clientId,e]),t?.length&&o.push([r.clientId,t])}))}return n}function L(e,t=P){const n=[],o=[...e];for(;o.length;){const{innerBlocks:e,...r}=o.shift();o.push(...e),n.push([r.clientId,t(r)])}return n}function A(e){return L(e,(e=>{const{attributes:t,...n}=e;return n}))}function O(e){return L(e,(e=>e.attributes))}function D(e,t){return"UPDATE_BLOCK_ATTRIBUTES"===e.type&&void 0!==t&&"UPDATE_BLOCK_ATTRIBUTES"===t.type&&C()(e.clientIds,t.clientIds)&&function(e,t){return C()(Object.keys(e),Object.keys(t))}(e.attributes,t.attributes)}function z(e,t){const n=e.tree,o=[...t],r=[...t];for(;o.length;){const e=o.shift();o.push(...e.innerBlocks),r.push(...e.innerBlocks)}for(const e of r)n.set(e.clientId,{});for(const t of r)n.set(t.clientId,Object.assign(n.get(t.clientId),{...e.byClientId.get(t.clientId),attributes:e.attributes.get(t.clientId),innerBlocks:t.innerBlocks.map((e=>n.get(e.clientId)))}))}function V(e,t,n=!1){const o=e.tree,r=new Set([]),l=new Set;for(const o of t){let t=n?o:e.parents.get(o);do{if(e.controlledInnerBlocks[t]){l.add(t);break}r.add(t),t=e.parents.get(t)}while(void 0!==t)}for(const e of r)o.set(e,{...o.get(e)});for(const t of r)o.get(t).innerBlocks=(e.order.get(t)||[]).map((e=>o.get(e)));for(const t of l)o.set("controlled||"+t,{innerBlocks:(e.order.get(t)||[]).map((e=>o.get(e)))})}const F=(0,p.pipe)(d.combineReducers,(e=>(t,n)=>{if(t&&"SAVE_REUSABLE_BLOCK_SUCCESS"===n.type){const{id:e,updatedId:o}=n;if(e===o)return t;(t={...t}).attributes=new Map(t.attributes),t.attributes.forEach(((n,r)=>{const{name:l}=t.byClientId.get(r);"core/block"===l&&n.ref===e&&t.attributes.set(r,{...n,ref:o})}))}return e(t,n)}),(e=>(t={},n)=>{const o=e(t,n);if(o===t)return t;switch(o.tree=t.tree?t.tree:new Map,n.type){case"RECEIVE_BLOCKS":case"INSERT_BLOCKS":o.tree=new Map(o.tree),z(o,n.blocks),V(o,n.rootClientId?[n.rootClientId]:[""],!0);break;case"UPDATE_BLOCK":o.tree=new Map(o.tree),o.tree.set(n.clientId,{...o.tree.get(n.clientId),...o.byClientId.get(n.clientId),attributes:o.attributes.get(n.clientId)}),V(o,[n.clientId],!1);break;case"SYNC_DERIVED_BLOCK_ATTRIBUTES":case"UPDATE_BLOCK_ATTRIBUTES":o.tree=new Map(o.tree),n.clientIds.forEach((e=>{o.tree.set(e,{...o.tree.get(e),attributes:o.attributes.get(e)})})),V(o,n.clientIds,!1);break;case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const e=function(e){const t={},n=[...e];for(;n.length;){const{innerBlocks:e,...o}=n.shift();n.push(...e),t[o.clientId]=!0}return t}(n.blocks);o.tree=new Map(o.tree),n.replacedClientIds.concat(n.replacedClientIds.filter((t=>!e[t])).map((e=>"controlled||"+e))).forEach((e=>{o.tree.delete(e)})),z(o,n.blocks),V(o,n.blocks.map((e=>e.clientId)),!1);const r=[];for(const e of n.clientIds)void 0===t.parents.get(e)||""!==t.parents.get(e)&&!o.byClientId.get(t.parents.get(e))||r.push(t.parents.get(e));V(o,r,!0);break}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":const e=[];for(const r of n.clientIds)void 0===t.parents.get(r)||""!==t.parents.get(r)&&!o.byClientId.get(t.parents.get(r))||e.push(t.parents.get(r));o.tree=new Map(o.tree),n.removedClientIds.concat(n.removedClientIds.map((e=>"controlled||"+e))).forEach((e=>{o.tree.delete(e)})),V(o,e,!0);break;case"MOVE_BLOCKS_TO_POSITION":{const e=[];n.fromRootClientId?e.push(n.fromRootClientId):e.push(""),n.toRootClientId&&e.push(n.toRootClientId),o.tree=new Map(o.tree),V(o,e,!0);break}case"MOVE_BLOCKS_UP":case"MOVE_BLOCKS_DOWN":{const e=[n.rootClientId?n.rootClientId:""];o.tree=new Map(o.tree),V(o,e,!0);break}case"SAVE_REUSABLE_BLOCK_SUCCESS":{const e=[];o.attributes.forEach(((t,r)=>{"core/block"===o.byClientId.get(r).name&&t.ref===n.updatedId&&e.push(r)})),o.tree=new Map(o.tree),e.forEach((e=>{o.tree.set(e,{...o.byClientId.get(e),attributes:o.attributes.get(e),innerBlocks:o.tree.get(e).innerBlocks})})),V(o,e,!1)}}return o}),(e=>(t,n)=>{const o=e=>{let o=e;for(let r=0;r<o.length;r++)!t.order.get(o[r])||n.keepControlledInnerBlocks&&n.keepControlledInnerBlocks[o[r]]||(o===e&&(o=[...o]),o.push(...t.order.get(o[r])));return o};if(t)switch(n.type){case"REMOVE_BLOCKS":n={...n,type:"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN",removedClientIds:o(n.clientIds)};break;case"REPLACE_BLOCKS":n={...n,type:"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN",replacedClientIds:o(n.clientIds)}}return e(t,n)}),(e=>(t,n)=>{if("REPLACE_INNER_BLOCKS"!==n.type)return e(t,n);const o={};if(Object.keys(t.controlledInnerBlocks).length){const e=[...n.blocks];for(;e.length;){const{innerBlocks:n,...r}=e.shift();e.push(...n),t.controlledInnerBlocks[r.clientId]&&(o[r.clientId]=!0)}}let r=t;t.order.get(n.rootClientId)&&(r=e(r,{type:"REMOVE_BLOCKS",keepControlledInnerBlocks:o,clientIds:t.order.get(n.rootClientId)}));let l=r;if(n.blocks.length){l=e(l,{...n,type:"INSERT_BLOCKS",index:0});const r=new Map(l.order);Object.keys(o).forEach((e=>{t.order.get(e)&&r.set(e,t.order.get(e))})),l.order=r,l.tree=new Map(l.tree),Object.keys(o).forEach((e=>{const n=`controlled||${e}`;t.tree.has(n)&&l.tree.set(n,t.tree.get(n))}))}return l}),(e=>(t,n)=>{if("RESET_BLOCKS"===n.type){const e={...t,byClientId:new Map(A(n.blocks)),attributes:new Map(O(n.blocks)),order:R(n.blocks),parents:new Map(N(n.blocks)),controlledInnerBlocks:{}};return e.tree=new Map(t?.tree),z(e,n.blocks),e.tree.set("",{innerBlocks:n.blocks.map((t=>e.tree.get(t.clientId)))}),e}return e(t,n)}),(function(e){let t,n,o=!1;return(r,l)=>{let i,s=e(r,l);var a;"SET_EXPLICIT_PERSISTENT"===l.type&&(n=l.isPersistentChange,i=null===(a=r.isPersistentChange)||void 0===a||a);if(void 0!==n)return i=n,i===s.isPersistentChange?s:{...s,isPersistentChange:i};const c="MARK_LAST_CHANGE_AS_PERSISTENT"===l.type||o;var u;return r!==s||c?(s={...s,isPersistentChange:c?!o:!D(l,t)},t=l,o="MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"===l.type,s):(o="MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"===l.type,i=null===(u=r?.isPersistentChange)||void 0===u||u,r.isPersistentChange===i?r:{...s,isPersistentChange:i})}}),(function(e){const t=new Set(["RECEIVE_BLOCKS"]);return(n,o)=>{const r=e(n,o);return r!==n&&(r.isIgnoredChange=t.has(o.type)),r}}),(e=>(t,n)=>{if("SET_HAS_CONTROLLED_INNER_BLOCKS"===n.type){const o=e(t,{type:"REPLACE_INNER_BLOCKS",rootClientId:n.clientId,blocks:[]});return e(o,n)}return e(t,n)}))({byClientId(e=new Map,t){switch(t.type){case"RECEIVE_BLOCKS":case"INSERT_BLOCKS":{const n=new Map(e);return A(t.blocks).forEach((([e,t])=>{n.set(e,t)})),n}case"UPDATE_BLOCK":{if(!e.has(t.clientId))return e;const{attributes:n,...o}=t.updates;if(0===Object.values(o).length)return e;const r=new Map(e);return r.set(t.clientId,{...e.get(t.clientId),...o}),r}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{if(!t.blocks)return e;const n=new Map(e);return t.replacedClientIds.forEach((e=>{n.delete(e)})),A(t.blocks).forEach((([e,t])=>{n.set(e,t)})),n}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const n=new Map(e);return t.removedClientIds.forEach((e=>{n.delete(e)})),n}}return e},attributes(e=new Map,t){switch(t.type){case"RECEIVE_BLOCKS":case"INSERT_BLOCKS":{const n=new Map(e);return O(t.blocks).forEach((([e,t])=>{n.set(e,t)})),n}case"UPDATE_BLOCK":{if(!e.get(t.clientId)||!t.updates.attributes)return e;const n=new Map(e);return n.set(t.clientId,{...e.get(t.clientId),...t.updates.attributes}),n}case"SYNC_DERIVED_BLOCK_ATTRIBUTES":case"UPDATE_BLOCK_ATTRIBUTES":{if(t.clientIds.every((t=>!e.get(t))))return e;let o=!1;const r=new Map(e);for(const l of t.clientIds){var n;const i=Object.entries(t.uniqueByBlock?t.attributes[l]:null!==(n=t.attributes)&&void 0!==n?n:{});if(0===i.length)continue;let s=!1;const a=e.get(l),c={};i.forEach((([e,t])=>{a[e]!==t&&(s=!0,c[e]=t)})),o=o||s,s&&r.set(l,{...a,...c})}return o?r:e}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{if(!t.blocks)return e;const n=new Map(e);return t.replacedClientIds.forEach((e=>{n.delete(e)})),O(t.blocks).forEach((([e,t])=>{n.set(e,t)})),n}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const n=new Map(e);return t.removedClientIds.forEach((e=>{n.delete(e)})),n}}return e},order(e=new Map,t){switch(t.type){case"RECEIVE_BLOCKS":{var n;const o=R(t.blocks),r=new Map(e);return o.forEach(((e,t)=>{""!==t&&r.set(t,e)})),r.set("",(null!==(n=e.get(""))&&void 0!==n?n:[]).concat(o[""])),r}case"INSERT_BLOCKS":{const{rootClientId:n=""}=t,o=e.get(n)||[],r=R(t.blocks,n),{index:l=o.length}=t,i=new Map(e);return r.forEach(((e,t)=>{i.set(t,e)})),i.set(n,T(o,r.get(n),l)),i}case"MOVE_BLOCKS_TO_POSITION":{var o;const{fromRootClientId:n="",toRootClientId:r="",clientIds:l}=t,{index:i=e.get(r).length}=t;if(n===r){const t=e.get(r).indexOf(l[0]),n=new Map(e);return n.set(r,M(e.get(r),t,i,l.length)),n}const s=new Map(e);return s.set(n,null!==(o=e.get(n)?.filter((e=>!l.includes(e))))&&void 0!==o?o:[]),s.set(r,T(e.get(r),l,i)),s}case"MOVE_BLOCKS_UP":{const{clientIds:n,rootClientId:o=""}=t,r=n[0],l=e.get(o);if(!l.length||r===l[0])return e;const i=l.indexOf(r),s=new Map(e);return s.set(o,M(l,i,i-1,n.length)),s}case"MOVE_BLOCKS_DOWN":{const{clientIds:n,rootClientId:o=""}=t,r=n[0],l=n[n.length-1],i=e.get(o);if(!i.length||l===i[i.length-1])return e;const s=i.indexOf(r),a=new Map(e);return a.set(o,M(i,s,s+1,n.length)),a}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const{clientIds:n}=t;if(!t.blocks)return e;const o=R(t.blocks),r=new Map(e);return t.replacedClientIds.forEach((e=>{r.delete(e)})),o.forEach(((e,t)=>{""!==t&&r.set(t,e)})),r.forEach(((e,t)=>{const l=Object.values(e).reduce(((e,t)=>t===n[0]?[...e,...o.get("")]:(-1===n.indexOf(t)&&e.push(t),e)),[]);r.set(t,l)})),r}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const n=new Map(e);return t.removedClientIds.forEach((e=>{n.delete(e)})),n.forEach(((e,o)=>{var r;const l=null!==(r=e?.filter((e=>!t.removedClientIds.includes(e))))&&void 0!==r?r:[];l.length!==e.length&&n.set(o,l)})),n}}return e},parents(e=new Map,t){switch(t.type){case"RECEIVE_BLOCKS":{const n=new Map(e);return N(t.blocks).forEach((([e,t])=>{n.set(e,t)})),n}case"INSERT_BLOCKS":{const n=new Map(e);return N(t.blocks,t.rootClientId||"").forEach((([e,t])=>{n.set(e,t)})),n}case"MOVE_BLOCKS_TO_POSITION":{const n=new Map(e);return t.clientIds.forEach((e=>{n.set(e,t.toRootClientId||"")})),n}case"REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const n=new Map(e);return t.replacedClientIds.forEach((e=>{n.delete(e)})),N(t.blocks,e.get(t.clientIds[0])).forEach((([e,t])=>{n.set(e,t)})),n}case"REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN":{const n=new Map(e);return t.removedClientIds.forEach((e=>{n.delete(e)})),n}}return e},controlledInnerBlocks:(e={},{type:t,clientId:n,hasControlledInnerBlocks:o})=>"SET_HAS_CONTROLLED_INNER_BLOCKS"===t?{...e,[n]:o}:e});function H(e={},t){switch(t.type){case"CLEAR_SELECTED_BLOCK":return e.clientId?{}:e;case"SELECT_BLOCK":return t.clientId===e.clientId?e:{clientId:t.clientId};case"REPLACE_INNER_BLOCKS":case"INSERT_BLOCKS":return t.updateSelection&&t.blocks.length?{clientId:t.blocks[0].clientId}:e;case"REMOVE_BLOCKS":return t.clientIds&&t.clientIds.length&&-1!==t.clientIds.indexOf(e.clientId)?{}:e;case"REPLACE_BLOCKS":{if(-1===t.clientIds.indexOf(e.clientId))return e;const n=t.blocks[t.indexToSelect]||t.blocks[t.blocks.length-1];return n?n.clientId===e.clientId?e:{clientId:n.clientId}:{}}}return e}const G=(0,d.combineReducers)({blocks:F,isDragging:function(e=!1,t){switch(t.type){case"START_DRAGGING":return!0;case"STOP_DRAGGING":return!1}return e},isTyping:function(e=!1,t){switch(t.type){case"START_TYPING":return!0;case"STOP_TYPING":return!1}return e},isBlockInterfaceHidden:function(e=!1,t){switch(t.type){case"HIDE_BLOCK_INTERFACE":return!0;case"SHOW_BLOCK_INTERFACE":return!1}return e},draggedBlocks:function(e=[],t){switch(t.type){case"START_DRAGGING_BLOCKS":return t.clientIds;case"STOP_DRAGGING_BLOCKS":return[]}return e},selection:function(e={},t){switch(t.type){case"SELECTION_CHANGE":return t.clientId?{selectionStart:{clientId:t.clientId,attributeKey:t.attributeKey,offset:t.startOffset},selectionEnd:{clientId:t.clientId,attributeKey:t.attributeKey,offset:t.endOffset}}:{selectionStart:t.start||e.selectionStart,selectionEnd:t.end||e.selectionEnd};case"RESET_SELECTION":const{selectionStart:n,selectionEnd:o}=t;return{selectionStart:n,selectionEnd:o};case"MULTI_SELECT":const{start:r,end:l}=t;return r===e.selectionStart?.clientId&&l===e.selectionEnd?.clientId?e:{selectionStart:{clientId:r},selectionEnd:{clientId:l}};case"RESET_BLOCKS":const i=e?.selectionStart?.clientId,s=e?.selectionEnd?.clientId;if(!i&&!s)return e;if(!t.blocks.some((e=>e.clientId===i)))return{selectionStart:{},selectionEnd:{}};if(!t.blocks.some((e=>e.clientId===s)))return{...e,selectionEnd:e.selectionStart}}const n=H(e.selectionStart,t),o=H(e.selectionEnd,t);return n===e.selectionStart&&o===e.selectionEnd?e:{selectionStart:n,selectionEnd:o}},isMultiSelecting:function(e=!1,t){switch(t.type){case"START_MULTI_SELECT":return!0;case"STOP_MULTI_SELECT":return!1}return e},isSelectionEnabled:function(e=!0,t){return"TOGGLE_SELECTION"===t.type?t.isSelectionEnabled:e},initialPosition:function(e=null,t){return"REPLACE_BLOCKS"===t.type&&void 0!==t.initialPosition||["MULTI_SELECT","SELECT_BLOCK","RESET_SELECTION","INSERT_BLOCKS","REPLACE_INNER_BLOCKS"].includes(t.type)?t.initialPosition:e},blocksMode:function(e={},t){if("TOGGLE_BLOCK_MODE"===t.type){const{clientId:n}=t;return{...e,[n]:e[n]&&"html"===e[n]?"visual":"html"}}return e},blockListSettings:(e={},t)=>{switch(t.type){case"REPLACE_BLOCKS":case"REMOVE_BLOCKS":return Object.fromEntries(Object.entries(e).filter((([e])=>!t.clientIds.includes(e))));case"UPDATE_BLOCK_LIST_SETTINGS":{const{clientId:n}=t;if(!t.settings){if(e.hasOwnProperty(n)){const{[n]:t,...o}=e;return o}return e}return C()(e[n],t.settings)?e:{...e,[n]:t.settings}}}return e},insertionPoint:function(e=null,t){switch(t.type){case"SHOW_INSERTION_POINT":{const{rootClientId:n,index:o,__unstableWithInserter:r,operation:l,nearestSide:i}=t,s={rootClientId:n,index:o,__unstableWithInserter:r,operation:l,nearestSide:i};return C()(e,s)?e:s}case"HIDE_INSERTION_POINT":return null}return e},template:function(e={isValid:!0},t){return"SET_TEMPLATE_VALIDITY"===t.type?{...e,isValid:t.isValid}:e},settings:function(e=I,t){return"UPDATE_SETTINGS"===t.type?t.reset?{...I,...t.settings}:{...e,...t.settings}:e},preferences:function(e=B,t){switch(t.type){case"INSERT_BLOCKS":case"REPLACE_BLOCKS":return t.blocks.reduce(((e,n)=>{const{attributes:o,name:r}=n;let l=r;const i=(0,d.select)(c.store).getActiveBlockVariation(r,o);return i?.name&&(l+="/"+i.name),"core/block"===r&&(l+="/"+o.ref),{...e,insertUsage:{...e.insertUsage,[l]:{time:t.time,count:e.insertUsage[l]?e.insertUsage[l].count+1:1}}}}),e)}return e},lastBlockAttributesChange:function(e=null,t){switch(t.type){case"UPDATE_BLOCK":if(!t.updates.attributes)break;return{[t.clientId]:t.updates.attributes};case"UPDATE_BLOCK_ATTRIBUTES":return t.clientIds.reduce(((e,n)=>({...e,[n]:t.uniqueByBlock?t.attributes[n]:t.attributes})),{})}return e},lastFocus:function(e=!1,t){return"LAST_FOCUS"===t.type?t.lastFocus:e},editorMode:function(e="edit",t){return"INSERT_BLOCKS"===t.type&&"navigation"===e?"edit":"SET_EDITOR_MODE"===t.type?t.mode:e},hasBlockMovingClientId:function(e=null,t){return"SET_BLOCK_MOVING_MODE"===t.type?t.hasBlockMovingClientId:"SET_EDITOR_MODE"===t.type?null:e},highlightedBlock:function(e,t){switch(t.type){case"TOGGLE_BLOCK_HIGHLIGHT":const{clientId:n,isHighlighted:o}=t;return o?n:e===n?null:e;case"SELECT_BLOCK":if(t.clientId!==e)return null}return e},lastBlockInserted:function(e={},t){switch(t.type){case"INSERT_BLOCKS":case"REPLACE_BLOCKS":if(!t.blocks.length)return e;const n=t.blocks.map((e=>e.clientId)),o=t.meta?.source;return{clientIds:n,source:o};case"RESET_BLOCKS":return{}}return e},temporarilyEditingAsBlocks:function(e="",t){return"SET_TEMPORARILY_EDITING_AS_BLOCKS"===t.type?t.temporarilyEditingAsBlocks:e},temporarilyEditingFocusModeRevert:function(e="",t){return"SET_TEMPORARILY_EDITING_AS_BLOCKS"===t.type?t.focusModeToRevert:e},blockVisibility:function(e={},t){return"SET_BLOCK_VISIBILITY"===t.type?{...e,...t.updates}:e},blockEditingModes:function(e=new Map,t){switch(t.type){case"SET_BLOCK_EDITING_MODE":return new Map(e).set(t.clientId,t.mode);case"UNSET_BLOCK_EDITING_MODE":{const n=new Map(e);return n.delete(t.clientId),n}case"RESET_BLOCKS":return e.has("")?(new Map).set("",e.get("")):e}return e},styleOverrides:function(e=new Map,t){switch(t.type){case"SET_STYLE_OVERRIDE":return new Map(e).set(t.id,t.style);case"DELETE_STYLE_OVERRIDE":{const n=new Map(e);return n.delete(t.id),n}}return e},removalPromptData:function(e=!1,t){switch(t.type){case"DISPLAY_BLOCK_REMOVAL_PROMPT":const{clientIds:e,selectPrevious:n,blockNamesForPrompt:o,messageType:r}=t;return{clientIds:e,selectPrevious:n,blockNamesForPrompt:o,messageType:r};case"CLEAR_BLOCK_REMOVAL_PROMPT":return!1}return e},blockRemovalRules:function(e=!1,t){return"SET_BLOCK_REMOVAL_RULES"===t.type?t.rules:e},openedBlockSettingsMenu:function(e=null,t){var n;return"SET_OPENED_BLOCK_SETTINGS_MENU"===t.type?null!==(n=t?.clientId)&&void 0!==n?n:null:e},registeredInserterMediaCategories:function(e=[],t){return"REGISTER_INSERTER_MEDIA_CATEGORY"===t.type?[...e,t.category]:e}});const U=function(e){return(t,n)=>{const o=e(t,n);return t?(o.automaticChangeStatus=t.automaticChangeStatus,"MARK_AUTOMATIC_CHANGE"===n.type?{...o,automaticChangeStatus:"pending"}:"MARK_AUTOMATIC_CHANGE_FINAL"===n.type&&"pending"===t.automaticChangeStatus?{...o,automaticChangeStatus:"final"}:o.blocks===t.blocks&&o.selection===t.selection||"final"!==o.automaticChangeStatus&&o.selection!==t.selection?o:{...o,automaticChangeStatus:void 0}):o}}(G);var $={};function j(e){return[e]}function W(e,t,n){var o;if(e.length!==t.length)return!1;for(o=n;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}function K(e,t){var n,o=t||j;function r(){n=new WeakMap}function l(){var t,r,l,i,s,a=arguments.length;for(i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];for(t=function(e){var t,o,r,l,i,s=n,a=!0;for(t=0;t<e.length;t++){if(!(i=o=e[t])||"object"!=typeof i){a=!1;break}s.has(o)?s=s.get(o):(r=new WeakMap,s.set(o,r),s=r)}return s.has($)||((l=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=a,s.set($,l)),s.get($)}(s=o.apply(null,i)),t.isUniqueByDependants||(t.lastDependants&&!W(s,t.lastDependants,0)&&t.clear(),t.lastDependants=s),r=t.head;r;){if(W(r.args,i,1))return r!==t.head&&(r.prev.next=r.next,r.next&&(r.next.prev=r.prev),r.next=t.head,r.prev=null,t.head.prev=r,t.head=r),r.val;r=r.next}return r={val:e.apply(null,i)},i[0]=null,r.args=i,t.head&&(t.head.prev=r,r.next=t.head),t.head=r,r.val}return l.getDependants=o,l.clear=r,r(),l}const Z=window.wp.primitives,q=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"})),Y=window.wp.richText,X=Symbol("selectBlockPatternsKey"),Q=(e,t,n=null)=>"boolean"==typeof e?e:Array.isArray(e)?!(!e.includes("core/post-content")||null!==t)||e.includes(t):n,J=(e,t)=>{if("boolean"==typeof t)return t;const n=[...e];for(;n.length>0;){const e=n.shift();if(!Q(t,e.name||e.blockName,!0))return!1;e.innerBlocks?.forEach((e=>{n.push(e)}))}return!0},ee=e=>t=>[t.settings.__experimentalBlockPatterns,t.settings.__experimentalUserPatternCategories,t.settings.__experimentalReusableBlocks,t.settings[X]?.(e),t.blockPatterns],te=(e,t,n)=>(o,r)=>{let l,i;if("function"==typeof e?(l=e(o),i=e(r)):(l=o[e],i=r[e]),l>i)return"asc"===n?1:-1;if(i>l)return"asc"===n?-1:1;const s=t.findIndex((e=>e===o)),a=t.findIndex((e=>e===r));return s>a?1:a>s?-1:0};function ne(e,t,n="asc"){return e.concat().sort(te(t,e,n))}const oe="core/block-editor",re=window.wp.privateApis,{lock:le,unlock:ie}=(0,re.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/block-editor"),se=[],ae=new Set;function ce(e,t){const n=e.blocks.byClientId.get(t),o="core/social-link";if("web"!==u.Platform.OS&&n?.name===o){const n=e.blocks.attributes.get(t),{service:r}=null!=n?n:{};return r?`${o}-${r}`:o}return n?n.name:null}function ue(e,t){const n=e.blocks.byClientId.get(t);return!!n&&n.isValid}function de(e,t){return e.blocks.byClientId.get(t)?e.blocks.attributes.get(t):null}function pe(e,t){return e.blocks.byClientId.has(t)?e.blocks.tree.get(t):null}const me=K(((e,t)=>{const n=e.blocks.byClientId.get(t);return n?{...n,attributes:de(e,t)}:null}),((e,t)=>[e.blocks.byClientId.get(t),e.blocks.attributes.get(t)]));function he(e,t){const n=t&&un(e,t)?"controlled||"+t:t||"";return e.blocks.tree.get(n)?.innerBlocks||se}const ge=K(((e,t)=>(w()("wp.data.select( 'core/block-editor' ).__unstableGetClientIdWithClientIdsTree",{since:"6.3",version:"6.5"}),{clientId:t,innerBlocks:fe(e,t)})),(e=>[e.blocks.order])),fe=K(((e,t="")=>(w()("wp.data.select( 'core/block-editor' ).__unstableGetClientIdsTree",{since:"6.3",version:"6.5"}),ot(e,t).map((t=>ge(e,t))))),(e=>[e.blocks.order])),be=K(((e,t)=>{t=Array.isArray(t)?[...t]:[t];const n=[];for(const o of t){const t=e.blocks.order.get(o);t&&n.push(...t)}let o=0;for(;o<n.length;){const t=n[o],r=e.blocks.order.get(t);r&&n.splice(o+1,0,...r),o++}return n}),(e=>[e.blocks.order])),ve=e=>be(e,""),ke=K(((e,t)=>{const n=ve(e);if(!t)return n.length;let o=0;for(const r of n){e.blocks.byClientId.get(r).name===t&&o++}return o}),(e=>[e.blocks.order,e.blocks.byClientId])),_e=K(((e,t)=>{if(!t)return se;const n=Array.isArray(t)?t:[t],o=ve(e).filter((t=>{const o=e.blocks.byClientId.get(t);return n.includes(o.name)}));return o.length>0?o:se}),(e=>[e.blocks.order,e.blocks.byClientId]));function ye(e,t){return w()("wp.data.select( 'core/block-editor' ).__experimentalGetGlobalBlocksByName",{since:"6.5",alternative:"wp.data.select( 'core/block-editor' ).getBlocksByName"}),_e(e,t)}const Ee=K(((e,t)=>(Array.isArray(t)?t:[t]).map((t=>pe(e,t)))),((e,t)=>(Array.isArray(t)?t:[t]).map((t=>e.blocks.tree.get(t))))),we=K(((e,t)=>Ee(e,t).filter(Boolean).map((e=>e.name))),((e,t)=>Ee(e,t)));function Se(e,t){return ot(e,t).length}function Ce(e){return e.selection.selectionStart}function xe(e){return e.selection.selectionEnd}function Be(e){return e.selection.selectionStart.clientId}function Ie(e){return e.selection.selectionEnd.clientId}function Te(e){const t=Ue(e).length;return t||(e.selection.selectionStart.clientId?1:0)}function Me(e){const{selectionStart:t,selectionEnd:n}=e.selection;return!!t.clientId&&t.clientId===n.clientId}function Pe(e){const{selectionStart:t,selectionEnd:n}=e.selection,{clientId:o}=t;return o&&o===n.clientId?o:null}function Re(e){const t=Pe(e);return t?pe(e,t):null}function Ne(e,t){var n;return null!==(n=e.blocks.parents.get(t))&&void 0!==n?n:null}const Le=K(((e,t,n=!1)=>{const o=[];let r=t;for(;r=e.blocks.parents.get(r);)o.push(r);return o.length?n?o:o.reverse():se}),(e=>[e.blocks.parents])),Ae=K(((e,t,n,o=!1)=>{const r=Le(e,t,o),l=Array.isArray(n)?e=>n.includes(e):e=>n===e;return r.filter((t=>l(ce(e,t))))}),(e=>[e.blocks.parents]));function Oe(e,t){let n,o=t;do{n=o,o=e.blocks.parents.get(o)}while(o);return n}function De(e,t){const n=Pe(e),o=[...Le(e,t),t],r=[...Le(e,n),n];let l;const i=Math.min(o.length,r.length);for(let e=0;e<i&&o[e]===r[e];e++)l=o[e];return l}function ze(e,t,n=1){if(void 0===t&&(t=Pe(e)),void 0===t&&(t=n<0?je(e):We(e)),!t)return null;const o=Ne(e,t);if(null===o)return null;const{order:r}=e.blocks,l=r.get(o),i=l.indexOf(t)+1*n;return i<0||i===l.length?null:l[i]}function Ve(e,t){return ze(e,t,-1)}function Fe(e,t){return ze(e,t,1)}function He(e){return e.initialPosition}const Ge=K((e=>{const{selectionStart:t,selectionEnd:n}=e.selection;if(!t.clientId||!n.clientId)return se;if(t.clientId===n.clientId)return[t.clientId];const o=Ne(e,t.clientId);if(null===o)return se;const r=ot(e,o),l=r.indexOf(t.clientId),i=r.indexOf(n.clientId);return l>i?r.slice(i,l+1):r.slice(l,i+1)}),(e=>[e.blocks.order,e.selection.selectionStart.clientId,e.selection.selectionEnd.clientId]));function Ue(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId===n.clientId?se:Ge(e)}const $e=K((e=>{const t=Ue(e);return t.length?t.map((t=>pe(e,t))):se}),(e=>[...Ge.getDependants(e),e.blocks.byClientId,e.blocks.order,e.blocks.attributes]));function je(e){return Ue(e)[0]||null}function We(e){const t=Ue(e);return t[t.length-1]||null}function Ke(e,t){return je(e)===t}function Ze(e,t){return-1!==Ue(e).indexOf(t)}const qe=K(((e,t)=>{let n=t,o=!1;for(;n&&!o;)n=Ne(e,n),o=Ze(e,n);return o}),(e=>[e.blocks.order,e.selection.selectionStart.clientId,e.selection.selectionEnd.clientId]));function Ye(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId===n.clientId?null:t.clientId||null}function Xe(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId===n.clientId?null:n.clientId||null}function Qe(e){const t=Ce(e),n=xe(e);return!t.attributeKey&&!n.attributeKey&&void 0===t.offset&&void 0===n.offset}function Je(e){const t=Ce(e),n=xe(e);return!!t&&!!n&&t.clientId===n.clientId&&t.attributeKey===n.attributeKey&&t.offset===n.offset}function et(e){return Ge(e).some((t=>{const n=ce(e,t);return!(0,c.getBlockType)(n).merge}))}function tt(e,t){const n=Ce(e),o=xe(e);if(n.clientId===o.clientId)return!1;if(!n.attributeKey||!o.attributeKey||void 0===n.offset||void 0===o.offset)return!1;const r=Ne(e,n.clientId);if(r!==Ne(e,o.clientId))return!1;const l=ot(e,r);let i,s;l.indexOf(n.clientId)>l.indexOf(o.clientId)?(i=o,s=n):(i=n,s=o);const a=t?s.clientId:i.clientId,u=t?i.clientId:s.clientId,d=ce(e,a);if(!(0,c.getBlockType)(d).merge)return!1;const p=pe(e,u);if(p.name===d)return!0;const m=(0,c.switchToBlockType)(p,d);return m&&m.length}const nt=e=>{const t=Ce(e),n=xe(e);if(t.clientId===n.clientId)return se;if(!t.attributeKey||!n.attributeKey||void 0===t.offset||void 0===n.offset)return se;const o=Ne(e,t.clientId);if(o!==Ne(e,n.clientId))return se;const r=ot(e,o),l=r.indexOf(t.clientId),i=r.indexOf(n.clientId),[s,a]=l>i?[n,t]:[t,n],c=pe(e,s.clientId),u=pe(e,a.clientId),d=c.attributes[s.attributeKey],p=u.attributes[a.attributeKey];let m=(0,Y.create)({html:d}),h=(0,Y.create)({html:p});return m=(0,Y.remove)(m,0,s.offset),h=(0,Y.remove)(h,a.offset,h.text.length),[{...c,attributes:{...c.attributes,[s.attributeKey]:(0,Y.toHTMLString)({value:m})}},{...u,attributes:{...u.attributes,[a.attributeKey]:(0,Y.toHTMLString)({value:h})}}]};function ot(e,t){return e.blocks.order.get(t||"")||se}function rt(e,t){return ot(e,Ne(e,t)).indexOf(t)}function lt(e,t){const{selectionStart:n,selectionEnd:o}=e.selection;return n.clientId===o.clientId&&n.clientId===t}function it(e,t,n=!1){return ot(e,t).some((t=>lt(e,t)||Ze(e,t)||n&&it(e,t,n)))}function st(e,t,n=!1){return ot(e,t).some((t=>ft(e,t)||n&&st(e,t,n)))}function at(e,t){if(!t)return!1;const n=Ue(e),o=n.indexOf(t);return o>-1&&o<n.length-1}function ct(e){const{selectionStart:t,selectionEnd:n}=e.selection;return t.clientId!==n.clientId}function ut(e){return e.isMultiSelecting}function dt(e){return e.isSelectionEnabled}function pt(e,t){return e.blocksMode[t]||"visual"}function mt(e){return e.isTyping}function ht(e){return!!e.draggedBlocks.length}function gt(e){return e.draggedBlocks}function ft(e,t){return e.draggedBlocks.includes(t)}function bt(e,t){if(!ht(e))return!1;return Le(e,t).some((t=>ft(e,t)))}function vt(){return w()('wp.data.select( "core/block-editor" ).isCaretWithinFormattedText',{since:"6.1",version:"6.3"}),!1}const kt=K((e=>{let t,n;const{insertionPoint:o,selection:{selectionEnd:r}}=e;if(null!==o)return o;const{clientId:l}=r;return l?(t=Ne(e,l)||void 0,n=rt(e,r.clientId)+1):n=ot(e).length,{rootClientId:t,index:n}}),(e=>[e.insertionPoint,e.selection.selectionEnd.clientId,e.blocks.parents,e.blocks.order]));function _t(e){return null!==e.insertionPoint}function yt(e){return e.template.isValid}function Et(e){return e.settings.template}function wt(e,t){var n,o;return t?null!==(n=Yt(e,t)?.templateLock)&&void 0!==n&&n:null!==(o=e.settings.templateLock)&&void 0!==o&&o}const St=(e,t,n=null)=>{let o;if(t&&"object"==typeof t?(o=t,t=o.name):o=(0,c.getBlockType)(t),!o)return!1;const{allowedBlockTypes:r}=Xt(e);if(!Q(r,t,!0))return!1;if(!!wt(e,n))return!1;if("disabled"===_n(e,null!=n?n:""))return!1;const l=Yt(e,n);if(n&&void 0===l)return!1;const i=ce(e,n),s=(0,c.getBlockType)(i),a=s?.allowedBlocks;let u=Q(a,t);if(!1!==u){const e=l?.allowedBlocks,n=Q(e,t);null!==n&&(u=n)}const d=o.parent,p=Q(d,i);let h=!0;const g=o.ancestor;if(g){h=[n,...Le(e,n)].some((t=>Q(g,ce(e,t))))}const f=h&&(null===u&&null===p||!0===u||!0===p);return f?(0,m.applyFilters)("blockEditor.__unstableCanInsertBlockType",f,o,n,{getBlock:pe.bind(null,e),getBlockParentsByBlockName:Ae.bind(null,e)}):f},Ct=K(St,((e,t,n)=>[e.blockListSettings[n],e.blocks.byClientId.get(n),e.settings.allowedBlockTypes,e.settings.templateLock,e.blockEditingModes]));function xt(e,t,n=null){return t.every((t=>Ct(e,ce(e,t),n)))}function Bt(e,t,n=null){const o=de(e,t);return null===o||(void 0!==o.lock?.remove?!o.lock.remove:!wt(e,n)&&"disabled"!==_n(e,n))}function It(e,t,n=null){return t.every((t=>Bt(e,t,n)))}function Tt(e,t,n=null){const o=de(e,t);return null===o||(void 0!==o.lock?.move?!o.lock.move:"all"!==wt(e,n)&&"disabled"!==_n(e,n))}function Mt(e,t,n=null){return t.every((t=>Tt(e,t,n)))}function Pt(e,t){const n=de(e,t);if(null===n)return!0;const{lock:o}=n;return!o?.edit}function Rt(e,t){return!!(0,c.hasBlockSupport)(t,"lock",!0)&&!!e.settings?.canLockBlocks}function Nt(e,t){var n;return null!==(n=e.preferences.insertUsage?.[t])&&void 0!==n?n:null}const Lt=(e,t,n)=>!!(0,c.hasBlockSupport)(t,"inserter",!0)&&St(e,t.name,n),At=(e,t)=>{if(!e)return t;const n=Date.now()-e;switch(!0){case n<36e5:return 4*t;case n<864e5:return 2*t;case n<6048e5:return t/2;default:return t/4}},Ot=(e,{buildScope:t="inserter"})=>n=>{const o=n.name;let r=!1;(0,c.hasBlockSupport)(n.name,"multiple",!0)||(r=Ee(e,ve(e)).some((({name:e})=>e===n.name)));const{time:l,count:i=0}=Nt(e,o)||{},s={id:o,name:n.name,title:n.title,icon:n.icon,isDisabled:r,frecency:At(l,i)};if("transform"===t)return s;const a=(0,c.getBlockVariations)(n.name,"inserter");return{...s,initialAttributes:{},description:n.description,category:n.category,keywords:n.keywords,variations:a,example:n.example,utility:1}},Dt=K(((e,t=null)=>{const n=St(e,"core/block",t)?on(e).map((t=>{const n=t.wp_pattern_sync_status?q:{src:q,foreground:"var(--wp-block-synced-color)"},o=`core/block/${t.id}`,{time:r,count:l=0}=Nt(e,o)||{},i=At(r,l);return{id:o,name:"core/block",initialAttributes:{ref:t.id},title:t.title?.raw,icon:n,category:"reusable",keywords:["reusable"],isDisabled:!1,utility:1,frecency:i,content:t.content?.raw,syncStatus:t.wp_pattern_sync_status}})):[],o=Ot(e,{buildScope:"inserter"}),r=(0,c.getBlockTypes)().filter((n=>Lt(e,n,t))).map(o).reduce(((t,n)=>{const{variations:o=[]}=n;if(o.some((({isDefault:e})=>e))||t.push(n),o.length){const r=((e,t)=>n=>{const o=`${t.id}/${n.name}`,{time:r,count:l=0}=Nt(e,o)||{};return{...t,id:o,icon:n.icon||t.icon,title:n.title||t.title,description:n.description||t.description,category:n.category||t.category,example:n.hasOwnProperty("example")?n.example:t.example,initialAttributes:{...t.initialAttributes,...n.attributes},innerBlocks:n.innerBlocks,keywords:n.keywords||t.keywords,frecency:At(r,l)}})(e,n);t.push(...o.map(r))}return t}),[]),{core:l,noncore:i}=r.reduce(((e,t)=>{const{core:n,noncore:o}=e;return(t.name.startsWith("core/")?n:o).push(t),e}),{core:[],noncore:[]});return[...[...l,...i],...n]}),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId.get(t),e.blocks.order,e.preferences.insertUsage,e.settings.allowedBlockTypes,e.settings.templateLock,on(e),(0,c.getBlockTypes)()])),zt=K(((e,t,n=null)=>{const o=Array.isArray(t)?t:[t],r=Ot(e,{buildScope:"transform"}),l=(0,c.getBlockTypes)().filter((t=>Lt(e,t,n))).map(r),i=Object.fromEntries(Object.entries(l).map((([,e])=>[e.name,e]))),s=(0,c.getPossibleBlockTransformations)(o).reduce(((e,t)=>(i[t?.name]&&e.push(i[t.name]),e)),[]);return ne(s,(e=>i[e.name].frecency),"desc")}),((e,t,n)=>[e.blockListSettings[n],e.blocks.byClientId.get(n),e.preferences.insertUsage,e.settings.allowedBlockTypes,e.settings.templateLock,(0,c.getBlockTypes)()])),Vt=K(((e,t=null)=>{if((0,c.getBlockTypes)().some((n=>Lt(e,n,t))))return!0;return St(e,"core/block",t)&&on(e).length>0}),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId.get(t),e.settings.allowedBlockTypes,e.settings.templateLock,on(e),(0,c.getBlockTypes)()])),Ft=K(((e,t=null)=>{if(!t)return;const n=(0,c.getBlockTypes)().filter((n=>Lt(e,n,t)));return St(e,"core/block",t)&&on(e).length>0&&n.push("core/block"),n}),((e,t)=>[e.blockListSettings[t],e.blocks.byClientId.get(t),e.settings.allowedBlockTypes,e.settings.templateLock,on(e),(0,c.getBlockTypes)()])),Ht=K(((e,t=null)=>(w()('wp.data.select( "core/block-editor" ).__experimentalGetAllowedBlocks',{alternative:'wp.data.select( "core/block-editor" ).getAllowedBlocks',since:"6.2",version:"6.4"}),Ft(e,t))),((e,t)=>[...Ft.getDependants(e,t)])),Gt=K(((e,t=null)=>{if(!t)return;const n=e.blockListSettings[t]?.defaultBlock,o=e.blockListSettings[t]?.directInsert;return n&&o?"function"==typeof o?o(pe(e,t))?n:null:n:void 0}),((e,t)=>[e.blockListSettings[t],e.blocks.tree.get(t)])),Ut=K(((e,t=null)=>(w()('wp.data.select( "core/block-editor" ).__experimentalGetDirectInsertBlock',{alternative:'wp.data.select( "core/block-editor" ).getDirectInsertBlock',since:"6.3",version:"6.4"}),Gt(e,t))),((e,t)=>[e.blockListSettings[t],e.blocks.tree.get(t)])),$t=(0,d.createRegistrySelector)((e=>K(((t,n)=>{const{getAllPatterns:o}=ie(e(oe)),r=o().find((({name:e})=>e===n));return r?{...r,blocks:(0,c.parse)(r.content,{__unstableSkipMigrationLogs:!0})}:null}),ee(e)))),jt=e=>(t,n)=>[...ee(e)(t),t.settings.allowedBlockTypes,t.settings.templateLock,t.blockListSettings[n],t.blocks.byClientId.get(n)],Wt=(0,d.createRegistrySelector)((e=>K(((t,n=null)=>{const{getAllPatterns:o,__experimentalGetParsedPattern:r}=ie(e(oe)),l=o(),{allowedBlockTypes:i}=Xt(t),s=l.filter((({inserter:e=!0})=>!!e)).map((({name:e})=>r(e))),a=s.filter((({blocks:e})=>J(e,i))),c=a.filter((({blocks:e})=>e.every((({name:e})=>Ct(t,e,n)))));return c}),jt(e)))),Kt=(0,d.createRegistrySelector)((e=>K(((t,n,o=null)=>{if(!n)return se;const r=e(oe).__experimentalGetAllowedPatterns(o),l=Array.isArray(n)?n:[n],i=r.filter((e=>e?.blockTypes?.some?.((e=>l.includes(e)))));return 0===i.length?se:i}),((t,n,o)=>jt(e)(t,o))))),Zt=(0,d.createRegistrySelector)((e=>(w()('wp.data.select( "core/block-editor" ).__experimentalGetPatternsByBlockTypes',{alternative:'wp.data.select( "core/block-editor" ).getPatternsByBlockTypes',since:"6.2",version:"6.4"}),e(oe).getPatternsByBlockTypes))),qt=(0,d.createRegistrySelector)((e=>K(((t,n,o=null)=>{if(!n)return se;if(n.some((({clientId:e,innerBlocks:n})=>n.length||un(t,e))))return se;const r=Array.from(new Set(n.map((({name:e})=>e))));return e(oe).getPatternsByBlockTypes(r,o)}),((t,n,o)=>jt(e)(t,o)))));function Yt(e,t){return e.blockListSettings[t]}function Xt(e){return e.settings}function Qt(e){return e.blocks.isPersistentChange}const Jt=K(((e,t=[])=>t.reduce(((t,n)=>e.blockListSettings[n]?{...t,[n]:e.blockListSettings[n]}:t),{})),(e=>[e.blockListSettings])),en=K(((e,t)=>{const n=on(e).find((e=>e.id===t));return n?n.title?.raw:null}),(e=>[on(e)]));function tn(e){return e.blocks.isIgnoredChange}function nn(e){return e.lastBlockAttributesChange}function on(e){var t;return null!==(t=e.settings.__experimentalReusableBlocks)&&void 0!==t?t:se}function rn(e){return"navigation"===e.editorMode}function ln(e){return e.editorMode}function sn(e){return e.hasBlockMovingClientId}function an(e){return!!e.automaticChangeStatus}function cn(e,t){return e.highlightedBlock===t}function un(e,t){return!!e.blocks.controlledInnerBlocks[t]}const dn=K(((e,t)=>{if(!t.length)return null;const n=Pe(e);if(t.includes(ce(e,n)))return n;const o=Ue(e),r=Ae(e,n||o[0],t);return r?r[r.length-1]:null}),((e,t)=>[e.selection.selectionStart.clientId,e.selection.selectionEnd.clientId,t]));function pn(e,t,n){const{lastBlockInserted:o}=e;return o.clientIds?.includes(t)&&o.source===n}function mn(e,t){var n;return null===(n=e.blockVisibility?.[t])||void 0===n||n}const hn=K((e=>{const t=new Set(Object.keys(e.blockVisibility).filter((t=>e.blockVisibility[t])));return 0===t.size?ae:t}),(e=>[e.blockVisibility])),gn=K(((e,t)=>{let n,o=t;for(;o=e.blocks.parents.get(o);)"core/block"!==ce(e,o)&&"contentOnly"!==wt(e,o)||(n=o);return n}),(e=>[e.blocks.parents,e.blockListSettings]));function fn(e){return e.temporarilyEditingAsBlocks}function bn(e){return e.temporarilyEditingFocusModeRevert}function vn(e,t){if("default"!==_n(e,t))return!1;if(!Pt(e,t))return!0;const n=ln(e);if("zoom-out"===n&&t&&!Ne(e,t))return!0;const o=(0,c.hasBlockSupport)(ce(e,t),"__experimentalDisableBlockOverlay",!1);return("navigation"===n||!o&&un(e,t))&&!lt(e,t)&&!it(e,t,!0)}function kn(e,t){let n=e.blocks.parents.get(t);for(;n;){if(vn(e,n))return!0;n=e.blocks.parents.get(n)}return!1}const _n=(0,d.createRegistrySelector)((e=>(t,n="")=>{const o=t.blockEditingModes.get(n);if(o)return o;if(!n)return"default";const r=Ne(t,n);if("contentOnly"===wt(t,r)){const o=ce(t,n);return e(c.store).__experimentalHasContentRoleAttribute(o)?"contentOnly":"disabled"}const l=_n(t,r);return"contentOnly"===l?"default":l})),yn=(0,d.createRegistrySelector)((e=>(t,n="")=>{const o=n||Pe(t);if(!o)return!1;const{getGroupingBlockName:r}=e(c.store),l=pe(t,o),i=r();return l&&(l.name===i||(0,c.getBlockType)(l.name)?.transforms?.ungroup)&&!!l.innerBlocks.length&&Bt(t,o)})),En=(0,d.createRegistrySelector)((e=>(t,n=se)=>{const{getGroupingBlockName:o}=e(c.store),r=o(),l=n?.length?n:Ge(t),i=l?.length?Ne(t,l[0]):void 0;return Ct(t,r,i)&&l.length&&It(t,l,i)})),wn=new WeakSet,Sn=["inserterMediaCategories","blockInspectorAnimation"];function Cn(e,{stripExperimentalSettings:t=!1,reset:n=!1}={}){let o=e;if(t&&"web"===u.Platform.OS){o={};for(const t in e)Sn.includes(t)||(o[t]=e[t])}return{type:"UPDATE_SETTINGS",settings:o,reset:n}}function xn(){return{type:"HIDE_BLOCK_INTERFACE"}}function Bn(){return{type:"SHOW_BLOCK_INTERFACE"}}const In=(e,t=!0,n=!1)=>({select:o,dispatch:r,registry:l})=>{if(!e||!e.length)return;var i;i=e,e=Array.isArray(i)?i:[i];const s=o.getBlockRootClientId(e[0]);if(!o.canRemoveBlocks(e,s))return;const a=!n&&o.getBlockRemovalRules();if(a){const n=new Set,l=[...e];let i="templates";for(;l.length;){const e=l.shift(),t=o.getBlockName(e);if(a[t]&&n.add(t),a["bindings/core/pattern-overrides"]){const r=o.getBlockParentsByBlockName(e,"core/block");if(r?.length>0)continue;const l=o.getBlockAttributes(e);l?.metadata?.bindings&&JSON.stringify(l.metadata.bindings).includes("core/pattern-overrides")&&(n.add(t),i="patternOverrides")}const r=o.getBlockOrder(e);l.push(...r)}if(n.size)return void r(function(e,t,n,o){return{type:"DISPLAY_BLOCK_REMOVAL_PROMPT",clientIds:e,selectPrevious:t,blockNamesForPrompt:n,messageType:o}}(e,t,Array.from(n),i))}t&&r.selectPreviousBlock(e[0],t),l.batch((()=>{r({type:"REMOVE_BLOCKS",clientIds:e}),r(Tn())}))},Tn=()=>({select:e,dispatch:t})=>{if(e.getBlockCount()>0)return;const{__unstableHasCustomAppender:n}=e.getSettings();n||t.insertDefaultBlock()};function Mn(){return{type:"CLEAR_BLOCK_REMOVAL_PROMPT"}}function Pn(e=!1){return{type:"SET_BLOCK_REMOVAL_RULES",rules:e}}function Rn(e){return{type:"SET_OPENED_BLOCK_SETTINGS_MENU",clientId:e}}function Nn(e,t){return{type:"SET_STYLE_OVERRIDE",id:e,style:t}}function Ln(e){return{type:"DELETE_STYLE_OVERRIDE",id:e}}function An(e){return({dispatch:t,select:n,registry:o})=>{o.batch((()=>{t({type:"SET_EXPLICIT_PERSISTENT",isPersistentChange:!1}),e(),t({type:"SET_EXPLICIT_PERSISTENT",isPersistentChange:void 0});const o=n.getBlocks();wn.add(o)}))}}function On(e=null){return{type:"LAST_FOCUS",lastFocus:e}}function Dn(e){return({select:t,dispatch:n})=>{const o=t.__unstableGetTemporarilyEditingFocusModeToRevert();n.__unstableMarkNextChangeAsNotPersistent(),n.updateBlockAttributes(e,{templateLock:"contentOnly"}),n.updateBlockListSettings(e,{...t.getBlockListSettings(e),templateLock:"contentOnly"}),n.updateSettings({focusMode:o}),n.__unstableSetTemporarilyEditingAsBlocks()}}function zn(){return{type:"START_DRAGGING"}}function Vn(){return{type:"STOP_DRAGGING"}}const Fn={user:"user",theme:"theme",directory:"directory"},Hn={full:"fully",unsynced:"unsynced"},Gn={name:"allPatterns",label:(0,x._x)("All","patterns")},Un={name:"myPatterns",label:(0,x.__)("My patterns")};function $n(e,t,n){const o=e.name.startsWith("core/block"),r="core"===e.source||e.source?.startsWith("pattern-directory");return!(t!==Fn.theme||!o&&!r)||(!(t!==Fn.directory||!o&&r)||(t===Fn.user&&e.type!==Fn.user||(n===Hn.full&&""!==e.syncStatus||!(n!==Hn.unsynced||"unsynced"===e.syncStatus||!o))))}function jn(e,t,n){t=Array.isArray(t)?[...t]:[t],e=Array.isArray(e)?[...e]:{...e};const o=t.pop();let r=e;for(const e of t){const t=r[e];r=r[e]=Array.isArray(t)?[...t]:{...t}}return r[o]=n,e}const Wn=(e,t,n)=>{var o;const r=Array.isArray(t)?t:t.split(".");let l=e;return r.forEach((e=>{l=l?.[e]})),null!==(o=l)&&void 0!==o?o:n},Kn=["color","border","dimensions","typography","spacing"],Zn={"color.palette":e=>e.colors,"color.gradients":e=>e.gradients,"color.custom":e=>void 0===e.disableCustomColors?void 0:!e.disableCustomColors,"color.customGradient":e=>void 0===e.disableCustomGradients?void 0:!e.disableCustomGradients,"typography.fontSizes":e=>e.fontSizes,"typography.customFontSize":e=>void 0===e.disableCustomFontSizes?void 0:!e.disableCustomFontSizes,"typography.lineHeight":e=>e.enableCustomLineHeight,"spacing.units":e=>{if(void 0!==e.enableCustomUnits)return!0===e.enableCustomUnits?["px","em","rem","vh","vw","%"]:e.enableCustomUnits},"spacing.padding":e=>e.enableCustomSpacing},qn={"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","border.customRadius":"border.radius","spacing.customMargin":"spacing.margin","spacing.customPadding":"spacing.padding","typography.customLineHeight":"typography.lineHeight"},Yn=e=>qn[e]||e;const Xn=new WeakMap;function Qn(e){var t,n;return null!==(t=null!==(n=e.custom)&&void 0!==n?n:e.theme)&&void 0!==t?t:e.default}function Jn(e){return["default","theme","custom"].some((t=>e?.[t]?.length))}function eo(e,t,...n){const o=ce(e,t),r=[];if(t){let n=t;do{const t=ce(e,n);(0,c.hasBlockSupport)(t,"__experimentalSettings",!1)&&r.push(n)}while(n=e.blocks.parents.get(n))}return n.map((n=>{if(Kn.includes(n))return void console.warn("Top level useSetting paths are disabled. Please use a subpath to query the information needed.");let l=(0,m.applyFilters)("blockEditor.useSetting.before",void 0,n,t,o);if(void 0!==l)return l;const i=Yn(n);for(const t of r){var s;const n=de(e,t);if(l=null!==(s=Wn(n.settings?.blocks?.[o],i))&&void 0!==s?s:Wn(n.settings,i),void 0!==l)break}const a=Xt(e);if(void 0===l&&o&&(l=Wn(a.__experimentalFeatures?.blocks?.[o],i)),void 0===l&&(l=Wn(a.__experimentalFeatures,i)),void 0!==l)return c.__EXPERIMENTAL_PATHS_WITH_OVERRIDE[i]?Qn(l):l;const u=Zn[i]?.(a);return void 0!==u?u:"typography.dropCap"===i||void 0}))}function to(e){return e.isBlockInterfaceHidden}function no(e){return e?.lastBlockInserted?.clientIds}function oo(e,t){return e.blocks.byClientId.get(t)}const ro=(e,t)=>{const n=t=>"disabled"===_n(e,t)&&ot(e,t).every(n);return ot(e,t).every(n)};const lo=K((function e(t,n){const o=ot(t,n),r=[];for(const n of o){const o=e(t,n);"disabled"!==_n(t,n)?r.push({clientId:n,innerBlocks:o}):r.push(...o)}return r}),(e=>[e.blocks.order,e.blockEditingModes,e.settings.templateLock,e.blockListSettings])),io=K(((e,t,n=!1)=>Le(e,t,n).filter((t=>"disabled"!==_n(e,t)))),(e=>[e.blocks.parents,e.blockEditingModes,e.settings.templateLock,e.blockListSettings]));function so(e){return e.removalPromptData}function ao(e){return e.blockRemovalRules}function co(e){return e.openedBlockSettingsMenu}function uo(e){return e.styleOverrides}function po(e){return e.registeredInserterMediaCategories}const mo=K((e=>{const{settings:{inserterMediaCategories:t,allowedMimeTypes:n,enableOpenverseMediaCategory:o},registeredInserterMediaCategories:r}=e;if(!t&&!r.length||!n)return;const l=t?.map((({name:e})=>e))||[];return[...t||[],...(r||[]).filter((({name:e})=>!l.includes(e)))].filter((e=>!(!o&&"openverse"===e.name)&&Object.values(n).some((t=>t.startsWith(`${e.mediaType}/`)))))}),(e=>[e.settings.inserterMediaCategories,e.settings.allowedMimeTypes,e.settings.enableOpenverseMediaCategory,e.registeredInserterMediaCategories])),ho=(0,d.createRegistrySelector)((e=>K(((t,n=null)=>{const{getAllPatterns:o,__experimentalGetParsedPattern:r}=ie(e(oe)),l=o(),{allowedBlockTypes:i}=Xt(t);return l.some((({name:e,inserter:o=!0})=>{if(!o)return!1;const{blocks:l}=r(e);return J(l,i)&&l.every((({name:e})=>Ct(t,e,n)))}))}),((t,n)=>[ee(e)(t),t.settings.allowedBlockTypes,t.settings.templateLock,t.blockListSettings[n],t.blocks.byClientId.get(n)])))),go=(0,d.createRegistrySelector)((e=>K((t=>{var n;const{__experimentalBlockPatterns:o=[],__experimentalUserPatternCategories:r=[],__experimentalReusableBlocks:l=[]}=t.settings,i=(null!=l?l:[]).map((e=>({name:`core/block/${e.id}`,id:e.id,type:Fn.user,title:e.title.raw,categories:e.wp_pattern_category.map((e=>{const t=(null!=r?r:[]).find((({id:t})=>t===e));return t?t.slug:e})),content:e.content.raw,syncStatus:e.wp_pattern_sync_status})));return[...i,...o,...null!==(n=t.settings[X]?.(e))&&void 0!==n?n:[]].filter(((e,t,n)=>t===n.findIndex((t=>e.name===t.name))))}),ee(e))));function fo(e){return e.lastFocus}function bo(e){return e.isDragging}const vo=window.wp.a11y,ko="";function _o(e){if(e)return Object.keys(e).find((t=>{const n=e[t];return("string"==typeof n||n instanceof Y.RichTextData)&&-1!==n.toString().indexOf(ko)}))}const yo=e=>Array.isArray(e)?e:[e],Eo=e=>({dispatch:t})=>{t({type:"RESET_BLOCKS",blocks:e}),t(wo(e))},wo=e=>({select:t,dispatch:n})=>{const o=t.getTemplate(),r=t.getTemplateLock(),l=!o||"all"!==r||(0,c.doBlocksMatchTemplate)(e,o);if(l!==t.isValidTemplate())return n.setTemplateValidity(l),l};function So(e,t,n){return{type:"RESET_SELECTION",selectionStart:e,selectionEnd:t,initialPosition:n}}function Co(e){return w()('wp.data.dispatch( "core/block-editor" ).receiveBlocks',{since:"5.9",alternative:"resetBlocks or insertBlocks"}),{type:"RECEIVE_BLOCKS",blocks:e}}function xo(e,t,n=!1){return{type:"UPDATE_BLOCK_ATTRIBUTES",clientIds:yo(e),attributes:t,uniqueByBlock:n}}function Bo(e,t){return{type:"UPDATE_BLOCK",clientId:e,updates:t}}function Io(e,t=0){return{type:"SELECT_BLOCK",initialPosition:t,clientId:e}}const To=(e,t=!1)=>({select:n,dispatch:o})=>{const r=n.getPreviousBlockClientId(e);if(r)o.selectBlock(r,-1);else if(t){const t=n.getBlockRootClientId(e);t&&o.selectBlock(t,-1)}},Mo=e=>({select:t,dispatch:n})=>{const o=t.getNextBlockClientId(e);o&&n.selectBlock(o)};function Po(){return{type:"START_MULTI_SELECT"}}function Ro(){return{type:"STOP_MULTI_SELECT"}}const No=(e,t,n=0)=>({select:o,dispatch:r})=>{if(o.getBlockRootClientId(e)!==o.getBlockRootClientId(t))return;r({type:"MULTI_SELECT",start:e,end:t,initialPosition:n});const l=o.getSelectedBlockCount();(0,vo.speak)((0,x.sprintf)((0,x._n)("%s block selected.","%s blocks selected.",l),l),"assertive")};function Lo(){return{type:"CLEAR_SELECTED_BLOCK"}}function Ao(e=!0){return{type:"TOGGLE_SELECTION",isSelectionEnabled:e}}function Oo(e,t){var n;const o=null!==(n=t?.__experimentalPreferredStyleVariations?.value)&&void 0!==n?n:{};return e.map((e=>{const t=e.name;if(!(0,c.hasBlockSupport)(t,"defaultStylePicker",!0))return e;if(!o[t])return e;const n=e.attributes?.className;if(n?.includes("is-style-"))return e;const{attributes:r={}}=e,l=o[t];return{...e,attributes:{...r,className:`${n||""} is-style-${l}`.trim()}}}))}const Do=(e,t,n,o=0,r)=>({select:l,dispatch:i,registry:s})=>{e=yo(e),t=Oo(yo(t),l.getSettings());const a=l.getBlockRootClientId(e[0]);for(let e=0;e<t.length;e++){const n=t[e];if(!l.canInsertBlockType(n.name,a))return}s.batch((()=>{i({type:"REPLACE_BLOCKS",clientIds:e,blocks:t,time:Date.now(),indexToSelect:n,initialPosition:o,meta:r}),i.ensureDefaultBlock()}))};function zo(e,t){return Do(e,t)}const Vo=e=>(t,n)=>({select:o,dispatch:r})=>{o.canMoveBlocks(t,n)&&r({type:e,clientIds:yo(t),rootClientId:n})},Fo=Vo("MOVE_BLOCKS_DOWN"),Ho=Vo("MOVE_BLOCKS_UP"),Go=(e,t="",n="",o)=>({select:r,dispatch:l})=>{if(r.canMoveBlocks(e,t)){if(t!==n){if(!r.canRemoveBlocks(e,t))return;if(!r.canInsertBlocks(e,n))return}l({type:"MOVE_BLOCKS_TO_POSITION",fromRootClientId:t,toRootClientId:n,clientIds:e,index:o})}};function Uo(e,t="",n="",o){return Go([e],t,n,o)}function $o(e,t,n,o,r){return jo([e],t,n,o,0,r)}const jo=(e,t,n,o=!0,r=0,l)=>({select:i,dispatch:s})=>{null!==r&&"object"==typeof r&&(l=r,r=0,w()("meta argument in wp.data.dispatch('core/block-editor')",{since:"5.8",hint:"The meta argument is now the 6th argument of the function"})),e=Oo(yo(e),i.getSettings());const a=[];for(const t of e){i.canInsertBlockType(t.name,n)&&a.push(t)}a.length&&s({type:"INSERT_BLOCKS",blocks:a,index:t,rootClientId:n,time:Date.now(),updateSelection:o,initialPosition:o?r:null,meta:l})};function Wo(e,t,n={}){const{__unstableWithInserter:o,operation:r,nearestSide:l}=n;return{type:"SHOW_INSERTION_POINT",rootClientId:e,index:t,__unstableWithInserter:o,operation:r,nearestSide:l}}const Ko=()=>({select:e,dispatch:t})=>{e.isBlockInsertionPointVisible()&&t({type:"HIDE_INSERTION_POINT"})};function Zo(e){return{type:"SET_TEMPLATE_VALIDITY",isValid:e}}const qo=()=>({select:e,dispatch:t})=>{t({type:"SYNCHRONIZE_TEMPLATE"});const n=e.getBlocks(),o=e.getTemplate(),r=(0,c.synchronizeBlocksWithTemplate)(n,o);t.resetBlocks(r)},Yo=e=>({registry:t,select:n,dispatch:o})=>{const r=n.getSelectionStart(),l=n.getSelectionEnd();if(r.clientId===l.clientId)return;if(!r.attributeKey||!l.attributeKey||void 0===r.offset||void 0===l.offset)return!1;const i=n.getBlockRootClientId(r.clientId);if(i!==n.getBlockRootClientId(l.clientId))return;const s=n.getBlockOrder(i);let a,u;s.indexOf(r.clientId)>s.indexOf(l.clientId)?(a=l,u=r):(a=r,u=l);const d=e?u:a,p=n.getBlock(d.clientId),m=(0,c.getBlockType)(p.name);if(!m.merge)return;const h=a,g=u,f=n.getBlock(h.clientId),b=n.getBlock(g.clientId),v=f.attributes[h.attributeKey],k=b.attributes[g.attributeKey];let _=(0,Y.create)({html:v}),y=(0,Y.create)({html:k});_=(0,Y.remove)(_,h.offset,_.text.length),y=(0,Y.insert)(y,ko,0,g.offset);const E=(0,c.cloneBlock)(f,{[h.attributeKey]:(0,Y.toHTMLString)({value:_})}),w=(0,c.cloneBlock)(b,{[g.attributeKey]:(0,Y.toHTMLString)({value:y})}),S=e?E:w,C=f.name===b.name?[S]:(0,c.switchToBlockType)(S,m.name);if(!C||!C.length)return;let x;if(e){const e=C.pop();x=m.merge(e.attributes,w.attributes)}else{const e=C.shift();x=m.merge(E.attributes,e.attributes)}const B=_o(x),I=x[B],T=(0,Y.create)({html:I}),M=T.text.indexOf(ko),P=(0,Y.remove)(T,M,M+1),R=(0,Y.toHTMLString)({value:P});x[B]=R;const N=n.getSelectedBlockClientIds(),L=[...e?C:[],{...p,attributes:{...p.attributes,...x}},...e?[]:C];t.batch((()=>{o.selectionChange(p.clientId,B,M,M),o.replaceBlocks(N,L,0,n.getSelectedBlocksInitialCaretPosition())}))},Xo=()=>({select:e,dispatch:t})=>{const n=e.getSelectionStart(),o=e.getSelectionEnd();if(n.clientId===o.clientId)return;if(!n.attributeKey||!o.attributeKey||void 0===n.offset||void 0===o.offset)return;const r=e.getBlockRootClientId(n.clientId);if(r!==e.getBlockRootClientId(o.clientId))return;const l=e.getBlockOrder(r);let i,s;l.indexOf(n.clientId)>l.indexOf(o.clientId)?(i=o,s=n):(i=n,s=o);const a=i,c=s,u=e.getBlock(a.clientId),d=e.getBlock(c.clientId),p=u.attributes[a.attributeKey],m=d.attributes[c.attributeKey];let h=(0,Y.create)({html:p}),g=(0,Y.create)({html:m});h=(0,Y.remove)(h,a.offset,h.text.length),g=(0,Y.remove)(g,0,c.offset),t.replaceBlocks(e.getSelectedBlockClientIds(),[{...u,attributes:{...u.attributes,[a.attributeKey]:(0,Y.toHTMLString)({value:h})}},{...d,attributes:{...d.attributes,[c.attributeKey]:(0,Y.toHTMLString)({value:g})}}])},Qo=()=>({select:e,dispatch:t})=>{const n=e.getSelectionStart(),o=e.getSelectionEnd();t.selectionChange({start:{clientId:n.clientId},end:{clientId:o.clientId}})},Jo=(e,t)=>({registry:n,select:o,dispatch:r})=>{const l=[e,t];r({type:"MERGE_BLOCKS",blocks:l});const[i,s]=l,a=o.getBlock(i),u=(0,c.getBlockType)(a.name);if(!u)return;const d=o.getBlock(s);if(!u.merge&&(0,c.getBlockSupport)(a.name,"__experimentalOnMerge")){const e=(0,c.switchToBlockType)(d,u.name);if(1!==e?.length)return void r.selectBlock(a.clientId);const[t]=e;return t.innerBlocks.length<1?void r.selectBlock(a.clientId):void n.batch((()=>{r.insertBlocks(t.innerBlocks,void 0,i),r.removeBlock(s),r.selectBlock(t.innerBlocks[0].clientId);const e=o.getNextBlockClientId(i);if(e&&o.getBlockName(i)===o.getBlockName(e)){const t=o.getBlockAttributes(i),n=o.getBlockAttributes(e);Object.keys(t).every((e=>t[e]===n[e]))&&(r.moveBlocksToPosition(o.getBlockOrder(e),e,i),r.removeBlock(e,!1))}}))}if((0,c.isUnmodifiedDefaultBlock)(a))return void r.removeBlock(i,o.isBlockSelected(i));if((0,c.isUnmodifiedDefaultBlock)(d))return void r.removeBlock(s,o.isBlockSelected(s));if(!u.merge)return void r.selectBlock(a.clientId);const p=(0,c.getBlockType)(d.name),{clientId:m,attributeKey:h,offset:g}=o.getSelectionStart(),f=(m===i?u:p).attributes[h],b=(m===i||m===s)&&void 0!==h&&void 0!==g&&!!f;f||("number"==typeof h?window.console.error("RichText needs an identifier prop that is the block attribute key of the attribute it controls. Its type is expected to be a string, but was "+typeof h):window.console.error("The RichText identifier prop does not match any attributes defined by the block."));const v=(0,c.cloneBlock)(a),k=(0,c.cloneBlock)(d);if(b){const e=m===i?v:k,t=e.attributes[h],n=(0,Y.insert)((0,Y.create)({html:t}),ko,g,g);e.attributes[h]=(0,Y.toHTMLString)({value:n})}const _=a.name===d.name?[k]:(0,c.switchToBlockType)(k,a.name);if(!_||!_.length)return;const y=u.merge(v.attributes,_[0].attributes);if(b){const e=_o(y),t=y[e],n=(0,Y.create)({html:t}),o=n.text.indexOf(ko),l=(0,Y.remove)(n,o,o+1),i=(0,Y.toHTMLString)({value:l});y[e]=i,r.selectionChange(a.clientId,e,o,o)}r.replaceBlocks([a.clientId,d.clientId],[{...a,attributes:{...a.attributes,...y}},..._.slice(1)],0)},er=(e,t=!0)=>In(e,t);function tr(e,t){return er([e],t)}function nr(e,t,n=!1,o=0){return{type:"REPLACE_INNER_BLOCKS",rootClientId:e,blocks:t,updateSelection:n,initialPosition:n?o:null,time:Date.now()}}function or(e){return{type:"TOGGLE_BLOCK_MODE",clientId:e}}function rr(){return{type:"START_TYPING"}}function lr(){return{type:"STOP_TYPING"}}function ir(e=[]){return{type:"START_DRAGGING_BLOCKS",clientIds:e}}function sr(){return{type:"STOP_DRAGGING_BLOCKS"}}function ar(){return w()('wp.data.dispatch( "core/block-editor" ).enterFormattedText',{since:"6.1",version:"6.3"}),{type:"DO_NOTHING"}}function cr(){return w()('wp.data.dispatch( "core/block-editor" ).exitFormattedText',{since:"6.1",version:"6.3"}),{type:"DO_NOTHING"}}function ur(e,t,n,o){return"string"==typeof e?{type:"SELECTION_CHANGE",clientId:e,attributeKey:t,startOffset:n,endOffset:o}:{type:"SELECTION_CHANGE",...e}}const dr=(e,t,n)=>({dispatch:o})=>{const r=(0,c.getDefaultBlockName)();if(!r)return;const l=(0,c.createBlock)(r,e);return o.insertBlock(l,n,t)};function pr(e,t){return{type:"UPDATE_BLOCK_LIST_SETTINGS",clientId:e,settings:t}}function mr(e){return Cn(e,{stripExperimentalSettings:!0})}function hr(e,t){return{type:"SAVE_REUSABLE_BLOCK_SUCCESS",id:e,updatedId:t}}function gr(){return{type:"MARK_LAST_CHANGE_AS_PERSISTENT"}}function fr(){return{type:"MARK_NEXT_CHANGE_AS_NOT_PERSISTENT"}}const br=()=>({dispatch:e})=>{e({type:"MARK_AUTOMATIC_CHANGE"});const{requestIdleCallback:t=(e=>setTimeout(e,100))}=window;t((()=>{e({type:"MARK_AUTOMATIC_CHANGE_FINAL"})}))},vr=(e=!0)=>({dispatch:t})=>{t.__unstableSetEditorMode(e?"navigation":"edit")},kr=e=>({dispatch:t,select:n})=>{if("zoom-out"===e){const e=n.getBlockSelectionStart();e&&t.selectBlock(n.getBlockHierarchyRootClientId(e))}t({type:"SET_EDITOR_MODE",mode:e}),"navigation"===e?(0,vo.speak)((0,x.__)("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.")):"edit"===e?(0,vo.speak)((0,x.__)("You are currently in edit mode. To return to the navigation mode, press Escape.")):"zoom-out"===e&&(0,vo.speak)((0,x.__)("You are currently in zoom-out mode."))},_r=(e=null)=>({dispatch:t})=>{t({type:"SET_BLOCK_MOVING_MODE",hasBlockMovingClientId:e}),e&&(0,vo.speak)((0,x.__)("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."))},yr=(e,t=!0)=>({select:n,dispatch:o})=>{if(!e||!e.length)return;const r=n.getBlocksByClientId(e);if(r.some((e=>!e)))return;const l=r.map((e=>e.name));if(l.some((e=>!(0,c.hasBlockSupport)(e,"multiple",!0))))return;const i=n.getBlockRootClientId(e[0]),s=yo(e),a=n.getBlockIndex(s[s.length-1]),u=r.map((e=>(0,c.__experimentalCloneSanitizedBlock)(e)));return o.insertBlocks(u,a+1,i,t),u.length>1&&t&&o.multiSelect(u[0].clientId,u[u.length-1].clientId),u.map((e=>e.clientId))},Er=e=>({select:t,dispatch:n})=>{if(!e)return;const o=t.getBlockRootClientId(e);if(t.getTemplateLock(o))return;const r=t.getBlockIndex(e),l=o?t.getDirectInsertBlock(o):null;if(!l)return n.insertDefaultBlock({},o,r);const i={};if(l.attributesToCopy){const n=t.getBlockAttributes(e);l.attributesToCopy.forEach((e=>{n[e]&&(i[e]=n[e])}))}const s=(0,c.createBlock)(l.name,{...l.attributes,...i});return n.insertBlock(s,r,o)},wr=e=>({select:t,dispatch:n})=>{if(!e)return;const o=t.getBlockRootClientId(e);if(t.getTemplateLock(o))return;const r=t.getBlockIndex(e),l=o?t.getDirectInsertBlock(o):null;if(!l)return n.insertDefaultBlock({},o,r+1);const i={};if(l.attributesToCopy){const n=t.getBlockAttributes(e);l.attributesToCopy.forEach((e=>{n[e]&&(i[e]=n[e])}))}const s=(0,c.createBlock)(l.name,{...l.attributes,...i});return n.insertBlock(s,r+1,o)};function Sr(e,t){return{type:"TOGGLE_BLOCK_HIGHLIGHT",clientId:e,isHighlighted:t}}const Cr=e=>async({dispatch:t})=>{t(Sr(e,!0)),await new Promise((e=>setTimeout(e,150))),t(Sr(e,!1))};function xr(e,t){return{type:"SET_HAS_CONTROLLED_INNER_BLOCKS",hasControlledInnerBlocks:t,clientId:e}}function Br(e){return{type:"SET_BLOCK_VISIBILITY",updates:e}}function Ir(e,t){return{type:"SET_TEMPORARILY_EDITING_AS_BLOCKS",temporarilyEditingAsBlocks:e,focusModeToRevert:t}}const Tr=e=>({select:t,dispatch:n})=>{if(!e||"object"!=typeof e)return void console.error("Category should be an `InserterMediaCategory` object.");if(!e.name)return void console.error("Category should have a `name` that should be unique among all media categories.");if(!e.labels?.name)return void console.error("Category should have a `labels.name`.");if(!["image","audio","video"].includes(e.mediaType))return void console.error("Category should have `mediaType` property that is one of `image|audio|video`.");if(!e.fetch||"function"!=typeof e.fetch)return void console.error("Category should have a `fetch` function defined with the following signature `(InserterMediaRequest) => Promise<InserterMediaItem[]>`.");const o=t.getRegisteredInserterMediaCategories();o.some((({name:t})=>t===e.name))?console.error(`A category is already registered with the same name: "${e.name}".`):o.some((({labels:{name:t}={}})=>t===e.labels?.name))?console.error(`A category is already registered with the same labels.name: "${e.labels.name}".`):n({type:"REGISTER_INSERTER_MEDIA_CATEGORY",category:{...e,isExternalResource:!0}})};function Mr(e="",t){return{type:"SET_BLOCK_EDITING_MODE",clientId:e,mode:t}}function Pr(e=""){return{type:"UNSET_BLOCK_EDITING_MODE",clientId:e}}const Rr={reducer:U,selectors:e,actions:l},Nr=(0,d.createReduxStore)(oe,{...Rr,persist:["preferences"]}),Lr=(0,d.registerStore)(oe,{...Rr,persist:["preferences"]});function Ar(...e){const{clientId:t=null}=y();return(0,d.useSelect)((n=>ie(n(Nr)).getBlockSettings(t,...e)),[t,...e])}function Or(e){w()("wp.blockEditor.useSetting",{since:"6.5",alternative:"wp.blockEditor.useSettings",note:"The new useSettings function can retrieve multiple settings at once, with better performance."});const[t]=Ar(e);return t}ie(Lr).registerPrivateActions(t),ie(Lr).registerPrivateSelectors(r),ie(Nr).registerPrivateActions(t),ie(Nr).registerPrivateSelectors(r);const Dr="1600px",zr="320px",Vr=1,Fr=.25,Hr=.75,Gr="14px";function Ur({minimumFontSize:e,maximumFontSize:t,fontSize:n,minimumViewportWidth:o=zr,maximumViewportWidth:r=Dr,scaleFactor:l=Vr,minimumFontSizeLimit:i}){if(i=$r(i)?i:Gr,n){const o=$r(n);if(!o?.unit)return null;const r=$r(i,{coerceTo:o.unit});if(r?.value&&!e&&!t&&o?.value<=r?.value)return null;if(t||(t=`${o.value}${o.unit}`),!e){const t="px"===o.unit?o.value:16*o.value,n=Math.min(Math.max(1-.075*Math.log2(t),Fr),Hr),l=jr(o.value*n,3);e=r?.value&&l<r?.value?`${r.value}${r.unit}`:`${l}${o.unit}`}}const s=$r(e),a=s?.unit||"rem",c=$r(t,{coerceTo:a});if(!s||!c)return null;const u=$r(e,{coerceTo:"rem"}),d=$r(r,{coerceTo:a}),p=$r(o,{coerceTo:a});if(!d||!p||!u)return null;const m=d.value-p.value;if(!m)return null;const h=jr(p.value/100,3),g=jr(h,3)+a,f=jr(((c.value-s.value)/m*100||1)*l,3);return`clamp(${e}, ${`${u.value}${u.unit} + ((1vw - ${g}) * ${f})`}, ${t})`}function $r(e,t={}){if("string"!=typeof e&&"number"!=typeof e)return null;isFinite(e)&&(e=`${e}px`);const{coerceTo:n,rootSizeValue:o,acceptableUnits:r}={coerceTo:"",rootSizeValue:16,acceptableUnits:["rem","px","em"],...t},l=r?.join("|"),i=new RegExp(`^(\\d*\\.?\\d+)(${l}){1,1}$`),s=e.match(i);if(!s||s.length<3)return null;let[,a,c]=s,u=parseFloat(a);return"px"!==n||"em"!==c&&"rem"!==c||(u*=o,c=n),"px"!==c||"em"!==n&&"rem"!==n||(u/=o,c=n),"em"!==n&&"rem"!==n||"em"!==c&&"rem"!==c||(c=n),{value:jr(u,3),unit:c}}function jr(e,t=3){const n=Math.pow(10,t);return Number.isFinite(e)?parseFloat(Math.round(e*n)/n):void 0}function Wr(e,t){const{size:n}=e;if(!Kr(t))return n;if(!n||"0"===n||!1===e?.fluid)return n;const o="object"==typeof t?.fluid?t?.fluid:{},r=Ur({minimumFontSize:e?.fluid?.min,maximumFontSize:e?.fluid?.max,fontSize:n,minimumFontSizeLimit:o?.minFontSize,maximumViewportWidth:o?.maxViewportWidth,minimumViewportWidth:o?.minViewportWidth});return r||n}function Kr(e){const t=e?.fluid;return!0===t||t&&"object"==typeof t&&Object.keys(t).length>0}function Zr(e){const t=e?.typography,n=e?.layout,o=$r(n?.wideSize)?n?.wideSize:null;return Kr(t)&&o?{fluid:{maxViewportWidth:o,...t.fluid}}:{fluid:t?.fluid}}const qr="body",Yr=[{path:["color","palette"],valueKey:"color",cssVarInfix:"color",classes:[{classSuffix:"color",propertyName:"color"},{classSuffix:"background-color",propertyName:"background-color"},{classSuffix:"border-color",propertyName:"border-color"}]},{path:["color","gradients"],valueKey:"gradient",cssVarInfix:"gradient",classes:[{classSuffix:"gradient-background",propertyName:"background"}]},{path:["color","duotone"],valueKey:"colors",cssVarInfix:"duotone",valueFunc:({slug:e})=>`url( '#wp-duotone-${e}' )`,classes:[]},{path:["shadow","presets"],valueKey:"shadow",cssVarInfix:"shadow",classes:[]},{path:["typography","fontSizes"],valueFunc:(e,t)=>Wr(e,Zr(t)),valueKey:"size",cssVarInfix:"font-size",classes:[{classSuffix:"font-size",propertyName:"font-size"}]},{path:["typography","fontFamilies"],valueKey:"fontFamily",cssVarInfix:"font-family",classes:[{classSuffix:"font-family",propertyName:"font-family"}]},{path:["spacing","spacingSizes"],valueKey:"size",cssVarInfix:"spacing",valueFunc:({size:e})=>e,classes:[]}],Xr={"color.background":"color","color.text":"color","filter.duotone":"duotone","elements.link.color.text":"color","elements.link.:hover.color.text":"color","elements.link.typography.fontFamily":"font-family","elements.link.typography.fontSize":"font-size","elements.button.color.text":"color","elements.button.color.background":"color","elements.caption.color.text":"color","elements.button.typography.fontFamily":"font-family","elements.button.typography.fontSize":"font-size","elements.heading.color":"color","elements.heading.color.background":"color","elements.heading.typography.fontFamily":"font-family","elements.heading.gradient":"gradient","elements.heading.color.gradient":"gradient","elements.h1.color":"color","elements.h1.color.background":"color","elements.h1.typography.fontFamily":"font-family","elements.h1.color.gradient":"gradient","elements.h2.color":"color","elements.h2.color.background":"color","elements.h2.typography.fontFamily":"font-family","elements.h2.color.gradient":"gradient","elements.h3.color":"color","elements.h3.color.background":"color","elements.h3.typography.fontFamily":"font-family","elements.h3.color.gradient":"gradient","elements.h4.color":"color","elements.h4.color.background":"color","elements.h4.typography.fontFamily":"font-family","elements.h4.color.gradient":"gradient","elements.h5.color":"color","elements.h5.color.background":"color","elements.h5.typography.fontFamily":"font-family","elements.h5.color.gradient":"gradient","elements.h6.color":"color","elements.h6.color.background":"color","elements.h6.typography.fontFamily":"font-family","elements.h6.color.gradient":"gradient","color.gradient":"gradient",shadow:"shadow","typography.fontSize":"font-size","typography.fontFamily":"font-family"},Qr={popoverProps:{placement:"left-start",offset:259}};function Jr(e,t,n,o,r){const l=[Wn(e,["blocks",t,...n]),Wn(e,n)];for(const i of l)if(i){const l=["custom","theme","default"];for(const s of l){const l=i[s];if(l){const i=l.find((e=>e[o]===r));if(i){if("slug"===o)return i;return Jr(e,t,n,"slug",i.slug)[o]===i[o]?i:void 0}}}}}function el(e,t,n){if(!n||"string"!=typeof n){if(!n?.ref||"string"!=typeof n?.ref)return n;{const t=n.ref.split(".");if(!(n=Wn(e,t))||n?.ref)return n}}const o="var:",r="var(--wp--";let l;if(n.startsWith(o))l=n.slice(4).split("|");else{if(!n.startsWith(r)||!n.endsWith(")"))return n;l=n.slice(10,-1).split("--")}const[i,...s]=l;return"preset"===i?function(e,t,n,[o,r]){const l=Yr.find((e=>e.cssVarInfix===o));if(!l)return n;const i=Jr(e.settings,t,l.path,"slug",r);if(i){const{valueKey:n}=l;return el(e,t,i[n])}return n}(e,t,n,s):"custom"===i?function(e,t,n,o){var r;const l=null!==(r=Wn(e.settings,["blocks",t,"custom",...o]))&&void 0!==r?r:Wn(e.settings,["custom",...o]);return l?el(e,t,l):n}(e,t,n,s):n}function tl(e,t){const n=e.split(","),o=t.split(","),r=[];return n.forEach((e=>{o.forEach((t=>{r.push(`${e.trim()} ${t.trim()}`)}))})),r.join(", ")}function nl(e,t){return"object"!=typeof e||"object"!=typeof t?e===t:C()(e?.styles,t?.styles)&&C()(e?.settings,t?.settings)}const ol=(0,u.createContext)({user:{},base:{},merged:{},setUserConfig:()=>{}}),rl={settings:{},styles:{}},ll=["appearanceTools","useRootPaddingAwareAlignments","background.backgroundImage","background.backgroundRepeat","background.backgroundSize","border.color","border.radius","border.style","border.width","shadow.presets","shadow.defaultPresets","color.background","color.button","color.caption","color.custom","color.customDuotone","color.customGradient","color.defaultDuotone","color.defaultGradients","color.defaultPalette","color.duotone","color.gradients","color.heading","color.link","color.palette","color.text","custom","dimensions.aspectRatio","dimensions.minHeight","layout.contentSize","layout.definitions","layout.wideSize","lightbox.enabled","lightbox.allowEditing","position.fixed","position.sticky","spacing.customSpacingSize","spacing.spacingSizes","spacing.spacingScale","spacing.blockGap","spacing.margin","spacing.padding","spacing.units","typography.fluid","typography.customFontSize","typography.dropCap","typography.fontFamilies","typography.fontSizes","typography.fontStyle","typography.fontWeight","typography.letterSpacing","typography.lineHeight","typography.textColumns","typography.textDecoration","typography.textTransform","typography.writingMode"],il=()=>{const{user:e,setUserConfig:t}=(0,u.useContext)(ol);return[!!e&&!C()(e,rl),(0,u.useCallback)((()=>t((()=>rl))),[t])]};function sl(e,t,n="all"){const{setUserConfig:o,...r}=(0,u.useContext)(ol),l=t?".blocks."+t:"",i=e?"."+e:"",s=`settings${l}${i}`,a=`settings${i}`,c="all"===n?"merged":n;return[(0,u.useMemo)((()=>{const t=r[c];if(!t)throw"Unsupported source";var n;if(e)return null!==(n=Wn(t,s))&&void 0!==n?n:Wn(t,a);let o={};return ll.forEach((e=>{var n;const r=null!==(n=Wn(t,`settings${l}.${e}`))&&void 0!==n?n:Wn(t,`settings.${e}`);void 0!==r&&(o=jn(o,e.split("."),r))})),o}),[r,c,e,s,a,l]),e=>{o((t=>jn(t,s.split("."),e)))}]}function al(e,t,n="all",{shouldDecodeEncode:o=!0}={}){const{merged:r,base:l,user:i,setUserConfig:s}=(0,u.useContext)(ol),a=e?"."+e:"",c=t?`styles.blocks.${t}${a}`:`styles${a}`;let d,p;switch(n){case"all":d=Wn(r,c),p=o?el(r,t,d):d;break;case"user":d=Wn(i,c),p=o?el(r,t,d):d;break;case"base":d=Wn(l,c),p=o?el(l,t,d):d;break;default:throw"Unsupported source"}return[p,n=>{s((l=>jn(l,c.split("."),o?function(e,t,n,o){if(!o)return o;const r=Xr[n],l=Yr.find((e=>e.cssVarInfix===r));if(!l)return o;const{valueKey:i,path:s}=l,a=Jr(e,t,s,i,o);return a?`var:preset|${r}|${a.slug}`:o}(r.settings,t,e,n):n)))}]}function cl(e,t,n){const{supportedStyles:o,supports:r}=(0,d.useSelect)((e=>({supportedStyles:ie(e(c.store)).getSupportedStyles(t,n),supports:e(c.store).getBlockType(t)?.supports})),[t,n]);return(0,u.useMemo)((()=>{const t={...e};return o.includes("fontSize")||(t.typography={...t.typography,fontSizes:{},customFontSize:!1}),o.includes("fontFamily")||(t.typography={...t.typography,fontFamilies:{}}),t.color={...t.color,text:t.color?.text&&o.includes("color"),background:t.color?.background&&(o.includes("background")||o.includes("backgroundColor")),button:t.color?.button&&o.includes("buttonColor"),heading:t.color?.heading&&o.includes("headingColor"),link:t.color?.link&&o.includes("linkColor"),caption:t.color?.caption&&o.includes("captionColor")},o.includes("background")||(t.color.gradients=[],t.color.customGradient=!1),o.includes("filter")||(t.color.defaultDuotone=!1,t.color.customDuotone=!1),["lineHeight","fontStyle","fontWeight","letterSpacing","textTransform","textDecoration","writingMode"].forEach((e=>{o.includes(e)||(t.typography={...t.typography,[e]:!1})})),o.includes("columnCount")||(t.typography={...t.typography,textColumns:!1}),["contentSize","wideSize"].forEach((e=>{o.includes(e)||(t.layout={...t.layout,[e]:!1})})),["padding","margin","blockGap"].forEach((e=>{o.includes(e)||(t.spacing={...t.spacing,[e]:!1});const n=Array.isArray(r?.spacing?.[e])?r?.spacing?.[e]:r?.spacing?.[e]?.sides;n?.length&&t.spacing?.[e]&&(t.spacing={...t.spacing,[e]:{...t.spacing?.[e],sides:n}})})),["aspectRatio","minHeight"].forEach((e=>{o.includes(e)||(t.dimensions={...t.dimensions,[e]:!1})})),["radius","color","style","width"].forEach((e=>{o.includes("border"+e.charAt(0).toUpperCase()+e.slice(1))||(t.border={...t.border,[e]:!1})})),t.shadow=!!o.includes("shadow")&&t.shadow,t}),[e,o,r])}function ul(e){const t=e?.color?.palette?.custom,n=e?.color?.palette?.theme,o=e?.color?.palette?.default,r=e?.color?.defaultPalette;return(0,u.useMemo)((()=>{const e=[];return n&&n.length&&e.push({name:(0,x._x)("Theme","Indicates this palette comes from the theme."),colors:n}),r&&o&&o.length&&e.push({name:(0,x._x)("Default","Indicates this palette comes from WordPress."),colors:o}),t&&t.length&&e.push({name:(0,x._x)("Custom","Indicates this palette is created by the user."),colors:t}),e}),[t,n,o,r])}function dl(e){const t=e?.color?.gradients?.custom,n=e?.color?.gradients?.theme,o=e?.color?.gradients?.default,r=e?.color?.defaultGradients;return(0,u.useMemo)((()=>{const e=[];return n&&n.length&&e.push({name:(0,x._x)("Theme","Indicates this palette comes from the theme."),gradients:n}),r&&o&&o.length&&e.push({name:(0,x._x)("Default","Indicates this palette comes from WordPress."),gradients:o}),t&&t.length&&e.push({name:(0,x._x)("Custom","Indicates this palette is created by the user."),gradients:t}),e}),[t,n,o,r])}var pl=n(5755),ml=n.n(pl);const hl=e=>{if(null===e||"object"!=typeof e||Array.isArray(e))return e;const t=Object.entries(e).map((([e,t])=>[e,hl(t)])).filter((([,e])=>void 0!==e));return t.length?Object.fromEntries(t):void 0};function gl(e,t,n,o,r,l){if(Object.values(null!=e?e:{}).every((e=>!e)))return n;if(1===l.length&&n.innerBlocks.length===o.length)return n;let i=o[0]?.attributes;if(l.length>1&&o.length>1){if(!o[r])return n;i=o[r]?.attributes}let s=n;return Object.entries(e).forEach((([e,n])=>{n&&t[e].forEach((e=>{const t=Wn(i,e);t&&(s={...s,attributes:jn(s.attributes,e,t)})}))})),s}function fl(e,t,n){const o=(0,c.getBlockSupport)(e,t),r=o?.__experimentalSkipSerialization;return Array.isArray(r)?r.includes(n):r}function bl({id:e,css:t,assets:n,__unstableType:o}={}){const{setStyleOverride:r,deleteStyleOverride:l}=ie((0,d.useDispatch)(Nr)),i=(0,u.useId)();(0,u.useEffect)((()=>{if(!t&&!n)return;const s=e||i;return r(s,{id:e,css:t,assets:n,__unstableType:o}),()=>{l(s)}}),[e,t,n,o,i,r,l])}function vl(e,t){const[n,o,r,l,i,s,a,c,d,p,m,h,g,f,b,v,k,_,y,E,w,S,C,x,B,I,T,M,P,R,N,L,A,O,D,z,V,F,H,G,U,$,j,W,K,Z,q,Y,X,Q]=Ar("background.backgroundImage","background.backgroundSize","typography.fontFamilies.custom","typography.fontFamilies.default","typography.fontFamilies.theme","typography.fontSizes.custom","typography.fontSizes.default","typography.fontSizes.theme","typography.customFontSize","typography.fontStyle","typography.fontWeight","typography.lineHeight","typography.textColumns","typography.textDecoration","typography.writingMode","typography.textTransform","typography.letterSpacing","spacing.padding","spacing.margin","spacing.blockGap","spacing.spacingSizes","spacing.units","dimensions.aspectRatio","dimensions.minHeight","layout","border.color","border.radius","border.style","border.width","color.custom","color.palette.custom","color.customDuotone","color.palette.theme","color.palette.default","color.defaultPalette","color.defaultDuotone","color.duotone.custom","color.duotone.theme","color.duotone.default","color.gradients.custom","color.gradients.theme","color.gradients.default","color.defaultGradients","color.customGradient","color.background","color.link","color.text","color.heading","color.button","shadow");return cl((0,u.useMemo)((()=>({background:{backgroundImage:n,backgroundSize:o},color:{palette:{custom:N,theme:A,default:O},gradients:{custom:G,theme:U,default:$},duotone:{custom:V,theme:F,default:H},defaultGradients:j,defaultPalette:D,defaultDuotone:z,custom:R,customGradient:W,customDuotone:L,background:K,link:Z,heading:Y,button:X,text:q},typography:{fontFamilies:{custom:r,default:l,theme:i},fontSizes:{custom:s,default:a,theme:c},customFontSize:d,fontStyle:p,fontWeight:m,lineHeight:h,textColumns:g,textDecoration:f,textTransform:v,letterSpacing:k,writingMode:b},spacing:{spacingSizes:{custom:w},padding:_,margin:y,blockGap:E,units:S},border:{color:I,radius:T,style:M,width:P},dimensions:{aspectRatio:C,minHeight:x},layout:B,parentLayout:t,shadow:Q})),[n,o,r,l,i,s,a,c,d,p,m,h,g,f,v,k,b,_,y,E,w,S,C,x,B,t,I,T,M,P,R,N,L,A,O,D,z,V,F,H,G,U,$,j,W,K,Z,q,Y,X,Q]),e)}const kl=(0,u.memo)((function({index:e,useBlockProps:t,setAllWrapperProps:n,...o}){const r=t(o),l=t=>n((n=>{const o=[...n];return o[e]=t,o}));return(0,u.useEffect)((()=>(l(r),()=>{l(void 0)}))),null}));(0,m.addFilter)("blocks.registerBlockType","core/compat/migrateLightBlockWrapper",(function(e){const{apiVersion:t=1}=e;return t<2&&(0,c.hasBlockSupport)(e,"lightBlockWrapper",!1)&&(e.apiVersion=2),e}));const _l=window.wp.components,yl={default:(0,_l.createSlotFill)("BlockControls"),block:(0,_l.createSlotFill)("BlockControlsBlock"),inline:(0,_l.createSlotFill)("BlockFormatControls"),other:(0,_l.createSlotFill)("BlockControlsOther"),parent:(0,_l.createSlotFill)("BlockControlsParent")};function El({group:e="default",controls:t,children:n,__experimentalShareWithChildBlocks:o=!1}){const r=function(e,t){const n=y();return n[h]?yl[e]?.Fill:n[g]&&t?yl.parent.Fill:null}(e,o);if(!r)return null;const l=(0,s.createElement)(s.Fragment,null,"default"===e&&(0,s.createElement)(_l.ToolbarGroup,{controls:t}),n);return(0,s.createElement)(_l.__experimentalStyleProvider,{document},(0,s.createElement)(r,null,(e=>{const{forwardedContext:t=[]}=e;return t.reduce(((e,[t,n])=>(0,s.createElement)(t,{...n},e)),l)})))}window.wp.warning;const{ComponentsContext:wl}=ie(_l.privateApis);function Sl({group:e="default",...t}){const n=(0,u.useContext)(_l.__experimentalToolbarContext),o=(0,u.useContext)(wl),r=(0,u.useMemo)((()=>({forwardedContext:[[_l.__experimentalToolbarContext.Provider,{value:n}],[wl.Provider,{value:o}]]})),[n,o]),l=yl[e]?.Slot,i=(0,_l.__experimentalUseSlotFills)(l?.__unstableName);if(!l)return null;if(!i?.length)return null;const a=(0,s.createElement)(l,{...t,bubblesVirtually:!0,fillProps:r});return"default"===e?a:(0,s.createElement)(_l.ToolbarGroup,null,a)}const Cl=El;Cl.Slot=Sl;const xl=e=>(0,s.createElement)(El,{group:"inline",...e});xl.Slot=e=>(0,s.createElement)(Sl,{group:"inline",...e});const Bl=Cl,Il=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M9 9v6h11V9H9zM4 20h1.5V4H4v16z"})),Tl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M12.5 15v5H11v-5H4V9h7V4h1.5v5h7v6h-7Z"})),Ml=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z"})),Pl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z"})),Rl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M4 4H5.5V20H4V4ZM7 10L17 10V14L7 14V10ZM20 4H18.5V20H20V4Z"})),Nl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})),Ll=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})),Al={default:{name:"default",slug:"flow",className:"is-layout-flow",baseStyles:[{selector:" > .alignleft",rules:{float:"left","margin-inline-start":"0","margin-inline-end":"2em"}},{selector:" > .alignright",rules:{float:"right","margin-inline-start":"2em","margin-inline-end":"0"}},{selector:" > .aligncenter",rules:{"margin-left":"auto !important","margin-right":"auto !important"}}],spacingStyles:[{selector:" > :first-child:first-child",rules:{"margin-block-start":"0"}},{selector:" > :last-child:last-child",rules:{"margin-block-end":"0"}},{selector:" > *",rules:{"margin-block-start":null,"margin-block-end":"0"}}]},constrained:{name:"constrained",slug:"constrained",className:"is-layout-constrained",baseStyles:[{selector:" > .alignleft",rules:{float:"left","margin-inline-start":"0","margin-inline-end":"2em"}},{selector:" > .alignright",rules:{float:"right","margin-inline-start":"2em","margin-inline-end":"0"}},{selector:" > .aligncenter",rules:{"margin-left":"auto !important","margin-right":"auto !important"}},{selector:" > :where(:not(.alignleft):not(.alignright):not(.alignfull))",rules:{"max-width":"var(--wp--style--global--content-size)","margin-left":"auto !important","margin-right":"auto !important"}},{selector:" > .alignwide",rules:{"max-width":"var(--wp--style--global--wide-size)"}}],spacingStyles:[{selector:" > :first-child:first-child",rules:{"margin-block-start":"0"}},{selector:" > :last-child:last-child",rules:{"margin-block-end":"0"}},{selector:" > *",rules:{"margin-block-start":null,"margin-block-end":"0"}}]},flex:{name:"flex",slug:"flex",className:"is-layout-flex",displayMode:"flex",baseStyles:[{selector:"",rules:{"flex-wrap":"wrap","align-items":"center"}},{selector:" > *",rules:{margin:"0"}}],spacingStyles:[{selector:"",rules:{gap:null}}]},grid:{name:"grid",slug:"grid",className:"is-layout-grid",displayMode:"grid",baseStyles:[{selector:" > *",rules:{margin:"0"}}],spacingStyles:[{selector:"",rules:{gap:null}}]}};function Ol(e,t=""){return e.split(",").map((e=>`.editor-styles-wrapper ${e}${t?` ${t}`:""}`)).join(",")}function Dl(e,t=Al,n,o){let r="";return t?.[n]?.spacingStyles?.length&&o&&t[n].spacingStyles.forEach((t=>{r+=`${Ol(e,t.selector.trim())} { `,r+=Object.entries(t.rules).map((([e,t])=>`${e}: ${t||o}`)).join("; "),r+="; }"})),r}function zl(e){const{contentSize:t,wideSize:n,type:o="default"}=e,r={},l=/^(?!0)\d+(px|em|rem|vw|vh|%|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)?$/i;return l.test(t)&&"constrained"===o&&(r.none=(0,x.sprintf)((0,x.__)("Max %s wide"),t)),l.test(n)&&(r.wide=(0,x.sprintf)((0,x.__)("Max %s wide"),n)),r}const Vl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z"})),Fl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",style:{opacity:.25}}),(0,s.createElement)(Z.Path,{d:"m4.5 7.5v9h1.5v-9z"}),(0,s.createElement)(Z.Path,{d:"m18 7.5v9h1.5v-9z"})),Hl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",style:{opacity:.25}}),(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9z"}),(0,s.createElement)(Z.Path,{d:"m7.5 19.5h9v-1.5h-9z"})),Gl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",style:{opacity:.25}}),(0,s.createElement)(Z.Path,{d:"m16.5 6h-9v-1.5h9z"})),Ul=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",style:{opacity:.25}}),(0,s.createElement)(Z.Path,{d:"m18 16.5v-9h1.5v9z"})),$l=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",style:{opacity:.25}}),(0,s.createElement)(Z.Path,{d:"m16.5 19.5h-9v-1.5h9z",style:{fill:"#1e1e1e"}})),jl=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7.5 6h9v-1.5h-9zm0 13.5h9v-1.5h-9zm-3-3h1.5v-9h-1.5zm13.5-9v9h1.5v-9z",style:{opacity:.25}}),(0,s.createElement)(Z.Path,{d:"m4.5 16.5v-9h1.5v9z"})),Wl=["top","right","bottom","left"],Kl={top:void 0,right:void 0,bottom:void 0,left:void 0},Zl={custom:Vl,axial:Vl,horizontal:Fl,vertical:Hl,top:Gl,right:Ul,bottom:$l,left:jl},ql={default:(0,x.__)("Spacing control"),top:(0,x.__)("Top"),bottom:(0,x.__)("Bottom"),left:(0,x.__)("Left"),right:(0,x.__)("Right"),mixed:(0,x.__)("Mixed"),vertical:(0,x.__)("Vertical"),horizontal:(0,x.__)("Horizontal"),axial:(0,x.__)("Horizontal & vertical"),custom:(0,x.__)("Custom")},Yl={axial:"axial",top:"top",right:"right",bottom:"bottom",left:"left",custom:"custom"};function Xl(e){return!!e?.includes&&("0"===e||e.includes("var:preset|spacing|"))}function Ql(e,t){if(!Xl(e))return e;const n=ti(e),o=t.find((e=>String(e.slug)===n));return o?.size}function Jl(e,t){if(!e||Xl(e)||"0"===e)return e;const n=t.find((t=>String(t.size)===String(e)));return n?.slug?`var:preset|spacing|${n.slug}`:e}function ei(e){if(!e)return;const t=e.match(/var:preset\|spacing\|(.+)/);return t?`var(--wp--preset--spacing--${t[1]})`:e}function ti(e){if(!e)return;if("0"===e||"default"===e)return e;const t=e.match(/var:preset\|spacing\|(.+)/);return t?t[1]:void 0}function ni(e,t){if(!e||!e.length)return!1;const n=e.includes("horizontal")||e.includes("left")&&e.includes("right"),o=e.includes("vertical")||e.includes("top")&&e.includes("bottom");return"horizontal"===t?n:"vertical"===t?o:n||o}function oi(e,t="0"){const n=function(e){if(!e)return null;const t="string"==typeof e;return{top:t?e:e?.top,left:t?e:e?.left}}(e);if(!n)return null;const o=ei(n?.top)||t,r=ei(n?.left)||t;return o===r?o:`${o} ${r}`}const ri=(0,s.createElement)(_l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(_l.Path,{d:"M15 4H9v11h6V4zM4 18.5V20h16v-1.5H4z"})),li=(0,s.createElement)(_l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(_l.Path,{d:"M20 11h-5V4H9v7H4v1.5h5V20h6v-7.5h5z"})),ii=(0,s.createElement)(_l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(_l.Path,{d:"M9 20h6V9H9v11zM4 4v1.5h16V4H4z"})),si=(0,s.createElement)(_l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(_l.Path,{d:"M4 4L20 4L20 5.5L4 5.5L4 4ZM10 7L14 7L14 17L10 17L10 7ZM20 18.5L4 18.5L4 20L20 20L20 18.5Z"})),ai=(0,s.createElement)(_l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(_l.Path,{d:"M7 4H17V8L7 8V4ZM7 16L17 16V20L7 20V16ZM20 11.25H4V12.75H20V11.25Z"})),ci={top:{icon:ii,title:(0,x._x)("Align top","Block vertical alignment setting")},center:{icon:li,title:(0,x._x)("Align middle","Block vertical alignment setting")},bottom:{icon:ri,title:(0,x._x)("Align bottom","Block vertical alignment setting")},stretch:{icon:si,title:(0,x._x)("Stretch to fill","Block vertical alignment setting")},"space-between":{icon:ai,title:(0,x._x)("Space between","Block vertical alignment setting")}},ui=["top","center","bottom"];const di=function({value:e,onChange:t,controls:n=ui,isCollapsed:o=!0,isToolbar:r}){function l(n){return()=>t(e===n?void 0:n)}const i=ci[e],a=ci.top,c=r?_l.ToolbarGroup:_l.ToolbarDropdownMenu,u=r?{isCollapsed:o}:{};return(0,s.createElement)(c,{icon:i?i.icon:a.icon,label:(0,x._x)("Change vertical alignment","Block vertical alignment setting label"),controls:n.map((t=>({...ci[t],isActive:e===t,role:o?"menuitemradio":void 0,onClick:l(t)}))),...u})},pi=e=>(0,s.createElement)(di,{...e,isToolbar:!1}),mi=e=>(0,s.createElement)(di,{...e,isToolbar:!0}),hi={left:Il,center:Tl,right:Ml,"space-between":Pl,stretch:Rl};const gi=function({allowedControls:e=["left","center","right","space-between"],isCollapsed:t=!0,onChange:n,value:o,popoverProps:r,isToolbar:l}){const i=e=>{n(e===o?void 0:e)},a=o?hi[o]:hi.left,c=[{name:"left",icon:Il,title:(0,x.__)("Justify items left"),isActive:"left"===o,onClick:()=>i("left")},{name:"center",icon:Tl,title:(0,x.__)("Justify items center"),isActive:"center"===o,onClick:()=>i("center")},{name:"right",icon:Ml,title:(0,x.__)("Justify items right"),isActive:"right"===o,onClick:()=>i("right")},{name:"space-between",icon:Pl,title:(0,x.__)("Space between items"),isActive:"space-between"===o,onClick:()=>i("space-between")},{name:"stretch",icon:Rl,title:(0,x.__)("Stretch items"),isActive:"stretch"===o,onClick:()=>i("stretch")}],u=l?_l.ToolbarGroup:_l.ToolbarDropdownMenu,d=l?{isCollapsed:t}:{};return(0,s.createElement)(u,{icon:a,popoverProps:r,label:(0,x.__)("Change items justification"),controls:c.filter((t=>e.includes(t.name))),...d})},fi=e=>(0,s.createElement)(gi,{...e,isToolbar:!1}),bi=e=>(0,s.createElement)(gi,{...e,isToolbar:!0}),vi={left:"flex-start",right:"flex-end",center:"center","space-between":"space-between"},ki={left:"flex-start",right:"flex-end",center:"center",stretch:"stretch"},_i={top:"flex-start",center:"center",bottom:"flex-end",stretch:"stretch","space-between":"space-between"},yi=["wrap","nowrap"],Ei={name:"flex",label:(0,x.__)("Flex"),inspectorControls:function({layout:e={},onChange:t,layoutBlockSupport:n={}}){const{allowOrientation:o=!0}=n;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.Flex,null,(0,s.createElement)(_l.FlexItem,null,(0,s.createElement)(Ci,{layout:e,onChange:t})),(0,s.createElement)(_l.FlexItem,null,o&&(0,s.createElement)(Bi,{layout:e,onChange:t}))),(0,s.createElement)(xi,{layout:e,onChange:t}))},toolBarControls:function({layout:e={},onChange:t,layoutBlockSupport:n}){if(n?.allowSwitching)return null;const{allowVerticalAlignment:o=!0}=n;return(0,s.createElement)(Bl,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(Ci,{layout:e,onChange:t,isToolbar:!0}),o&&(0,s.createElement)(wi,{layout:e,onChange:t,isToolbar:!0}))},getLayoutStyle:function({selector:e,layout:t,style:n,blockName:o,hasBlockGapSupport:r,layoutDefinitions:l=Al}){const{orientation:i="horizontal"}=t,s=n?.spacing?.blockGap&&!fl(o,"spacing","blockGap")?oi(n?.spacing?.blockGap,"0.5em"):void 0,a=vi[t.justifyContent],c=yi.includes(t.flexWrap)?t.flexWrap:"wrap",u=_i[t.verticalAlignment],d=ki[t.justifyContent]||ki.left;let p="";const m=[];return c&&"wrap"!==c&&m.push(`flex-wrap: ${c}`),"horizontal"===i?(u&&m.push(`align-items: ${u}`),a&&m.push(`justify-content: ${a}`)):(u&&m.push(`justify-content: ${u}`),m.push("flex-direction: column"),m.push(`align-items: ${d}`)),m.length&&(p=`${Ol(e)} {\n\t\t\t\t${m.join("; ")};\n\t\t\t}`),r&&s&&(p+=Dl(e,l,"flex",s)),p},getOrientation(e){const{orientation:t="horizontal"}=e;return t},getAlignments:()=>[]};function wi({layout:e,onChange:t,isToolbar:n=!1}){const{orientation:o="horizontal"}=e,r="horizontal"===o?_i.center:_i.top,{verticalAlignment:l=r}=e,i=n=>{t({...e,verticalAlignment:n})};if(n)return(0,s.createElement)(pi,{onChange:i,value:l,controls:"horizontal"===o?["top","center","bottom","stretch"]:["top","center","bottom","space-between"]});const a=[{value:"flex-start",label:(0,x.__)("Align items top")},{value:"center",label:(0,x.__)("Align items center")},{value:"flex-end",label:(0,x.__)("Align items bottom")}];return(0,s.createElement)("fieldset",{className:"block-editor-hooks__flex-layout-vertical-alignment-control"},(0,s.createElement)("legend",null,(0,x.__)("Vertical alignment")),(0,s.createElement)("div",null,a.map(((e,t,n)=>(0,s.createElement)(_l.Button,{key:e,label:n,icon:t,isPressed:l===e,onClick:()=>i(e)})))))}const Si={placement:"bottom-start"};function Ci({layout:e,onChange:t,isToolbar:n=!1}){const{justifyContent:o="left",orientation:r="horizontal"}=e,l=n=>{t({...e,justifyContent:n})},i=["left","center","right"];if("horizontal"===r?i.push("space-between"):i.push("stretch"),n)return(0,s.createElement)(fi,{allowedControls:i,value:o,onChange:l,popoverProps:Si});const a=[{value:"left",icon:Il,label:(0,x.__)("Justify items left")},{value:"center",icon:Tl,label:(0,x.__)("Justify items center")},{value:"right",icon:Ml,label:(0,x.__)("Justify items right")}];return"horizontal"===r?a.push({value:"space-between",icon:Pl,label:(0,x.__)("Space between items")}):a.push({value:"stretch",icon:Rl,label:(0,x.__)("Stretch items")}),(0,s.createElement)(_l.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Justification"),value:o,onChange:l,className:"block-editor-hooks__flex-layout-justification-controls"},a.map((({value:e,icon:t,label:n})=>(0,s.createElement)(_l.__experimentalToggleGroupControlOptionIcon,{key:e,value:e,icon:t,label:n}))))}function xi({layout:e,onChange:t}){const{flexWrap:n="wrap"}=e;return(0,s.createElement)(_l.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Allow to wrap to multiple lines"),onChange:n=>{t({...e,flexWrap:n?"wrap":"nowrap"})},checked:"wrap"===n})}function Bi({layout:e,onChange:t}){const{orientation:n="horizontal",verticalAlignment:o,justifyContent:r}=e;return(0,s.createElement)(_l.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,className:"block-editor-hooks__flex-layout-orientation-controls",label:(0,x.__)("Orientation"),value:n,onChange:n=>{let l=o,i=r;return"horizontal"===n?("space-between"===o&&(l="center"),"stretch"===r&&(i="left")):("stretch"===o&&(l="top"),"space-between"===r&&(i="left")),t({...e,orientation:n,verticalAlignment:l,justifyContent:i})}},(0,s.createElement)(_l.__experimentalToggleGroupControlOptionIcon,{icon:Nl,value:"horizontal",label:(0,x.__)("Horizontal")}),(0,s.createElement)(_l.__experimentalToggleGroupControlOptionIcon,{icon:Ll,value:"vertical",label:(0,x.__)("Vertical")}))}const Ii={name:"default",label:(0,x.__)("Flow"),inspectorControls:function(){return null},toolBarControls:function(){return null},getLayoutStyle:function({selector:e,style:t,blockName:n,hasBlockGapSupport:o,layoutDefinitions:r=Al}){const l=oi(t?.spacing?.blockGap);let i="";fl(n,"spacing","blockGap")||(l?.top?i=oi(l?.top):"string"==typeof l&&(i=oi(l)));let s="";return o&&i&&(s+=Dl(e,r,"default",i)),s},getOrientation:()=>"vertical",getAlignments(e,t){const n=zl(e);if(void 0!==e.alignments)return e.alignments.includes("none")||e.alignments.unshift("none"),e.alignments.map((e=>({name:e,info:n[e]})));const o=[{name:"left"},{name:"center"},{name:"right"}];if(!t){const{contentSize:t,wideSize:r}=e;t&&o.unshift({name:"full"}),r&&o.unshift({name:"wide",info:n.wide})}return o.unshift({name:"none",info:n.none}),o}};const Ti=(0,u.forwardRef)((function({icon:e,size:t=24,...n},o){return(0,u.cloneElement)(e,{width:t,height:t,...n,ref:o})})),Mi=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})),Pi=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M16 5.5H8V4h8v1.5ZM16 20H8v-1.5h8V20ZM5 9h14v6H5V9Z"})),Ri=window.wp.styleEngine,Ni={name:"constrained",label:(0,x.__)("Constrained"),inspectorControls:function({layout:e,onChange:t,layoutBlockSupport:n={}}){const{wideSize:o,contentSize:r,justifyContent:l="center"}=e,{allowJustification:i=!0,allowCustomContentAndWideSize:a=!0}=n,c=[{value:"left",icon:Il,label:(0,x.__)("Justify items left")},{value:"center",icon:Tl,label:(0,x.__)("Justify items center")},{value:"right",icon:Ml,label:(0,x.__)("Justify items right")}],[u]=Ar("spacing.units"),d=(0,_l.__experimentalUseCustomUnits)({availableUnits:u||["%","px","em","rem","vw"]});return(0,s.createElement)(s.Fragment,null,a&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"block-editor-hooks__layout-controls"},(0,s.createElement)("div",{className:"block-editor-hooks__layout-controls-unit"},(0,s.createElement)(_l.__experimentalUnitControl,{className:"block-editor-hooks__layout-controls-unit-input",label:(0,x.__)("Content"),labelPosition:"top",__unstableInputWidth:"80px",value:r||o||"",onChange:n=>{n=0>parseFloat(n)?"0":n,t({...e,contentSize:n})},units:d}),(0,s.createElement)(Ti,{icon:Mi})),(0,s.createElement)("div",{className:"block-editor-hooks__layout-controls-unit"},(0,s.createElement)(_l.__experimentalUnitControl,{className:"block-editor-hooks__layout-controls-unit-input",label:(0,x.__)("Wide"),labelPosition:"top",__unstableInputWidth:"80px",value:o||r||"",onChange:n=>{n=0>parseFloat(n)?"0":n,t({...e,wideSize:n})},units:d}),(0,s.createElement)(Ti,{icon:Pi}))),(0,s.createElement)("p",{className:"block-editor-hooks__layout-controls-helptext"},(0,x.__)("Customize the width for all elements that are assigned to the center or wide columns."))),i&&(0,s.createElement)(_l.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Justification"),value:l,onChange:n=>{t({...e,justifyContent:n})}},c.map((({value:e,icon:t,label:n})=>(0,s.createElement)(_l.__experimentalToggleGroupControlOptionIcon,{key:e,value:e,icon:t,label:n})))))},toolBarControls:function(){return null},getLayoutStyle:function({selector:e,layout:t={},style:n,blockName:o,hasBlockGapSupport:r,layoutDefinitions:l=Al}){const{contentSize:i,wideSize:s,justifyContent:a}=t,c=oi(n?.spacing?.blockGap);let u="";fl(o,"spacing","blockGap")||(c?.top?u=oi(c?.top):"string"==typeof c&&(u=oi(c)));const d="left"===a?"0 !important":"auto !important",p="right"===a?"0 !important":"auto !important";let m=i||s?`\n\t\t\t\t\t${Ol(e,"> :where(:not(.alignleft):not(.alignright):not(.alignfull))")} {\n\t\t\t\t\t\tmax-width: ${null!=i?i:s};\n\t\t\t\t\t\tmargin-left: ${d};\n\t\t\t\t\t\tmargin-right: ${p};\n\t\t\t\t\t}\n\t\t\t\t\t${Ol(e,"> .alignwide")} {\n\t\t\t\t\t\tmax-width: ${null!=s?s:i};\n\t\t\t\t\t}\n\t\t\t\t\t${Ol(e,"> .alignfull")} {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t`:"";if("left"===a?m+=`${Ol(e,"> :where(:not(.alignleft):not(.alignright):not(.alignfull))")}\n\t\t\t{ margin-left: ${d}; }`:"right"===a&&(m+=`${Ol(e,"> :where(:not(.alignleft):not(.alignright):not(.alignfull))")}\n\t\t\t{ margin-right: ${p}; }`),n?.spacing?.padding){(0,Ri.getCSSRules)(n).forEach((t=>{"paddingRight"===t.key?m+=`\n\t\t\t\t\t${Ol(e,"> .alignfull")} {\n\t\t\t\t\t\tmargin-right: calc(${t.value} * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`:"paddingLeft"===t.key&&(m+=`\n\t\t\t\t\t${Ol(e,"> .alignfull")} {\n\t\t\t\t\t\tmargin-left: calc(${t.value} * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`)}))}return r&&u&&(m+=Dl(e,l,"constrained",u)),m},getOrientation:()=>"vertical",getAlignments(e){const t=zl(e);if(void 0!==e.alignments)return e.alignments.includes("none")||e.alignments.unshift("none"),e.alignments.map((e=>({name:e,info:t[e]})));const{contentSize:n,wideSize:o}=e,r=[{name:"left"},{name:"center"},{name:"right"}];return n&&r.unshift({name:"full"}),o&&r.unshift({name:"wide",info:t.wide}),r.unshift({name:"none",info:t.none}),r}},Li={px:600,"%":100,vw:100,vh:100,em:38,rem:38,svw:100,lvw:100,dvw:100,svh:100,lvh:100,dvh:100,vi:100,svi:100,lvi:100,dvi:100,vb:100,svb:100,lvb:100,dvb:100,vmin:100,svmin:100,lvmin:100,dvmin:100,vmax:100,svmax:100,lvmax:100,dvmax:100},Ai={name:"grid",label:(0,x.__)("Grid"),inspectorControls:function({layout:e={},onChange:t}){return e?.columnCount?(0,s.createElement)(Di,{layout:e,onChange:t}):(0,s.createElement)(Oi,{layout:e,onChange:t})},toolBarControls:function(){return null},getLayoutStyle:function({selector:e,layout:t,style:n,blockName:o,hasBlockGapSupport:r,layoutDefinitions:l=Al}){const{minimumColumnWidth:i="12rem",columnCount:s=null}=t,a=n?.spacing?.blockGap&&!fl(o,"spacing","blockGap")?oi(n?.spacing?.blockGap,"0.5em"):void 0;let c="";const u=[];return s?u.push(`grid-template-columns: repeat(${s}, minmax(0, 1fr))`):i&&u.push(`grid-template-columns: repeat(auto-fill, minmax(min(${i}, 100%), 1fr))`),u.length&&(c=`${Ol(e)} { ${u.join("; ")}; }`),r&&a&&(c+=Dl(e,l,"grid",a)),c},getOrientation:()=>"horizontal",getAlignments:()=>[]};function Oi({layout:e,onChange:t}){const{minimumColumnWidth:n="12rem"}=e,[o,r]=(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(n);return(0,s.createElement)("fieldset",null,(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},(0,x.__)("Minimum column width")),(0,s.createElement)(_l.Flex,{gap:4},(0,s.createElement)(_l.FlexItem,{isBlock:!0},(0,s.createElement)(_l.__experimentalUnitControl,{size:"__unstable-large",onChange:n=>{t({...e,minimumColumnWidth:n})},onUnitChange:n=>{let l;["em","rem"].includes(n)&&"px"===r?l=(o/16).toFixed(2)+n:["em","rem"].includes(r)&&"px"===n?l=Math.round(16*o)+n:["vh","vw","%","svw","lvw","dvw","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax"].includes(n)&&o>100&&(l=100+n),t({...e,minimumColumnWidth:l})},value:n,min:0})),(0,s.createElement)(_l.FlexItem,{isBlock:!0},(0,s.createElement)(_l.RangeControl,{onChange:n=>{t({...e,minimumColumnWidth:[n,r].join("")})},value:o,min:0,max:Li[r]||600,withInputField:!1}))))}function Di({layout:e,onChange:t}){const{columnCount:n=3}=e;return(0,s.createElement)(_l.RangeControl,{label:(0,x.__)("Columns"),value:n,onChange:n=>t({...e,columnCount:n}),min:1,max:6})}const zi=[Ii,Ei,Ni,Ai];function Vi(e="default"){return zi.find((t=>t.name===e))}const Fi={type:"default"},Hi=(0,u.createContext)(Fi),Gi=Hi.Provider;function Ui(){return(0,u.useContext)(Hi)}const $i=[],ji=["none","left","center","right","wide","full"],Wi=["wide","full"];function Ki(e=ji){e.includes("none")||(e=["none",...e]);const t=1===e.length&&"none"===e[0],[n,o,r]=(0,d.useSelect)((e=>{var n;if(t)return[!1,!1,!1];const o=e(Nr).getSettings();return[null!==(n=o.alignWide)&&void 0!==n&&n,o.supportsLayout,o.__unstableIsBlockBasedTheme]}),[t]),l=Ui();if(t)return $i;const i=Vi(l?.type);if(o){const t=i.getAlignments(l,r).filter((t=>e.includes(t.name)));return 1===t.length&&"none"===t[0].name?$i:t}if("default"!==i.name&&"constrained"!==i.name)return $i;const s=e.filter((e=>l.alignments?l.alignments.includes(e):!(!n&&Wi.includes(e))&&ji.includes(e))).map((e=>({name:e})));return 1===s.length&&"none"===s[0].name?$i:s}const Zi=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM5 9h14v6H5V9Z"})),qi=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})),Yi=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})),Xi=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M5 4h14v11H5V4Zm11 16H8v-1.5h8V20Z"})),Qi={none:{icon:Zi,title:(0,x._x)("None","Alignment option")},left:{icon:qi,title:(0,x.__)("Align left")},center:{icon:Mi,title:(0,x.__)("Align center")},right:{icon:Yi,title:(0,x.__)("Align right")},wide:{icon:Pi,title:(0,x.__)("Wide width")},full:{icon:Xi,title:(0,x.__)("Full width")}};const Ji=function({value:e,onChange:t,controls:n,isToolbar:o,isCollapsed:r=!0}){const l=Ki(n);if(!!!l.length)return null;function i(n){t([e,"none"].includes(n)?void 0:n)}const a=Qi[e],c=Qi.none,u=o?_l.ToolbarGroup:_l.ToolbarDropdownMenu,d={icon:a?a.icon:c.icon,label:(0,x.__)("Align")},p=o?{isCollapsed:r,controls:l.map((({name:t})=>({...Qi[t],isActive:e===t||!e&&"none"===t,role:r?"menuitemradio":void 0,onClick:()=>i(t)})))}:{toggleProps:{describedBy:(0,x.__)("Change alignment")},children:({onClose:t})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.MenuGroup,{className:"block-editor-block-alignment-control__menu-group"},l.map((({name:n,info:o})=>{const{icon:r,title:l}=Qi[n],a=n===e||!e&&"none"===n;return(0,s.createElement)(_l.MenuItem,{key:n,icon:r,iconPosition:"left",className:ml()("components-dropdown-menu__menu-item",{"is-active":a}),isSelected:a,onClick:()=>{i(n),t()},role:"menuitemradio",info:o},l)}))))};return(0,s.createElement)(u,{...d,...p})},es=e=>(0,s.createElement)(Ji,{...e,isToolbar:!1}),ts=e=>(0,s.createElement)(Ji,{...e,isToolbar:!0});function ns(e){const t=y(),{clientId:n=""}=t,{setBlockEditingMode:o,unsetBlockEditingMode:r}=(0,d.useDispatch)(Nr),l=(0,d.useSelect)((e=>n?null:e(Nr).getBlockEditingMode()),[n]);return(0,u.useEffect)((()=>(e&&o(n,e),()=>{e&&r(n)})),[n,e,o,r]),n?t[f]:l}const os=["left","center","right","wide","full"],rs=["wide","full"];function ls(e,t=!0,n=!0){let o;return o=Array.isArray(e)?os.filter((t=>e.includes(t))):!0===e?[...os]:[],!n||!0===e&&!t?o.filter((e=>!rs.includes(e))):o}const is={shareWithChildBlocks:!0,edit:function({name:e,align:t,setAttributes:n}){const o=Ki(ls((0,c.getBlockSupport)(e,"align"),(0,c.hasBlockSupport)(e,"alignWide",!0))).map((({name:e})=>e)),r=ns();return o.length&&"default"===r?(0,s.createElement)(Bl,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(es,{value:t,onChange:t=>{if(!t){const n=(0,c.getBlockType)(e),o=n?.attributes?.align?.default;o&&(t="")}n({align:t})},controls:o})):null},useBlockProps:function({name:e,align:t}){const n=ls((0,c.getBlockSupport)(e,"align"),(0,c.hasBlockSupport)(e,"alignWide",!0));if(Ki(n).some((e=>e.name===t)))return{"data-align":t};return{}},addSaveProps:function(e,t,n){const{align:o}=n,r=(0,c.getBlockSupport)(t,"align"),l=(0,c.hasBlockSupport)(t,"alignWide",!0),i=ls(r,l).includes(o);i&&(e.className=ml()(`align${o}`,e.className));return e},attributeKeys:["align"],hasSupport:e=>(0,c.hasBlockSupport)(e,"align",!1)};(0,m.addFilter)("blocks.registerBlockType","core/editor/align/addAttribute",(function(e){var t;return"type"in(null!==(t=e.attributes?.align)&&void 0!==t?t:{})||(0,c.hasBlockSupport)(e,"align")&&(e.attributes={...e.attributes,align:{type:"string",enum:[...os,""]}}),e})),(0,m.addFilter)("blocks.registerBlockType","core/lock/addAttribute",(function(e){var t;return"type"in(null!==(t=e.attributes?.lock)&&void 0!==t?t:{})||(e.attributes={...e.attributes,lock:{type:"object"}}),e}));const ss=(0,_l.createSlotFill)("InspectorControls"),as=(0,_l.createSlotFill)("InspectorAdvancedControls"),cs=(0,_l.createSlotFill)("InspectorControlsBackground"),us=(0,_l.createSlotFill)("InspectorControlsBorder"),ds=(0,_l.createSlotFill)("InspectorControlsColor"),ps=(0,_l.createSlotFill)("InspectorControlsFilter"),ms=(0,_l.createSlotFill)("InspectorControlsDimensions"),hs=(0,_l.createSlotFill)("InspectorControlsPosition"),gs=(0,_l.createSlotFill)("InspectorControlsTypography"),fs=(0,_l.createSlotFill)("InspectorControlsListView"),bs=(0,_l.createSlotFill)("InspectorControlsStyles"),vs={default:ss,advanced:as,background:cs,border:us,color:ds,dimensions:ms,effects:(0,_l.createSlotFill)("InspectorControlsEffects"),filter:ps,list:fs,position:hs,settings:ss,styles:bs,typography:gs};function ks({children:e,group:t="default",__experimentalGroup:n,resetAllFilter:o}){n&&(w()("`__experimentalGroup` property in `InspectorControlsFill`",{since:"6.2",version:"6.4",alternative:"`group`"}),t=n);const r=y(),l=vs[t]?.Fill;return l&&r[h]?(0,s.createElement)(_l.__experimentalStyleProvider,{document},(0,s.createElement)(l,null,(t=>(0,s.createElement)(ys,{fillProps:t,children:e,resetAllFilter:o})))):null}function _s({resetAllFilter:e,children:t}){const{registerResetAllFilter:n,deregisterResetAllFilter:o}=(0,u.useContext)(_l.__experimentalToolsPanelContext);return(0,u.useEffect)((()=>{if(e&&n&&o)return n(e),()=>{o(e)}}),[e,n,o]),t}function ys({children:e,resetAllFilter:t,fillProps:n}){const{forwardedContext:o=[]}=n,r=(0,s.createElement)(_s,{resetAllFilter:t},e);return o.reduce(((e,[t,n])=>(0,s.createElement)(t,{...n},e)),r)}function Es({children:e,group:t,label:n}){const{updateBlockAttributes:o}=(0,d.useDispatch)(Nr),{getBlockAttributes:r,getMultiSelectedBlockClientIds:l,getSelectedBlockClientId:i,hasMultiSelection:a}=(0,d.useSelect)(Nr),c=i(),p=(0,u.useCallback)(((e=[])=>{const t={},n=a()?l():[c];n.forEach((n=>{const{style:o}=r(n);let l={style:o};e.forEach((e=>{l={...l,...e(l)}})),l={...l,style:hl(l.style)},t[n]=l})),o(n,t,!0)}),[r,l,a,c,o]);return(0,s.createElement)(_l.__experimentalToolsPanel,{className:`${t}-block-support-panel`,label:n,resetAll:p,key:c,panelId:c,hasInnerWrapper:!0,shouldRenderPlaceholderItems:!0,__experimentalFirstVisibleItemClass:"first",__experimentalLastVisibleItemClass:"last",dropdownMenuProps:Qr},e)}function ws({Slot:e,fillProps:t,...n}){const o=(0,u.useContext)(_l.__experimentalToolsPanelContext),r=(0,u.useMemo)((()=>{var e;return{...null!=t?t:{},forwardedContext:[...null!==(e=t?.forwardedContext)&&void 0!==e?e:[],[_l.__experimentalToolsPanelContext.Provider,{value:o}]]}}),[o,t]);return(0,s.createElement)(e,{...n,fillProps:r,bubblesVirtually:!0})}function Ss({__experimentalGroup:e,group:t="default",label:n,fillProps:o,...r}){e&&(w()("`__experimentalGroup` property in `InspectorControlsSlot`",{since:"6.2",version:"6.4",alternative:"`group`"}),t=e);const l=vs[t]?.Slot,i=(0,_l.__experimentalUseSlotFills)(l?.__unstableName),a=(0,u.useContext)(_l.__unstableMotionContext),c=(0,u.useMemo)((()=>{var e;return{...null!=o?o:{},forwardedContext:[...null!==(e=o?.forwardedContext)&&void 0!==e?e:[],[_l.__unstableMotionContext.Provider,{value:a}]]}}),[a,o]);return l&&i?.length?n?(0,s.createElement)(Es,{group:t,label:n},(0,s.createElement)(ws,{...r,fillProps:c,Slot:l})):(0,s.createElement)(l,{...r,fillProps:c,bubblesVirtually:!0}):null}const Cs=ks;Cs.Slot=Ss;const xs=e=>(0,s.createElement)(ks,{...e,group:"advanced"});xs.Slot=e=>(0,s.createElement)(Ss,{...e,group:"advanced"}),xs.slotName="InspectorAdvancedControls";const Bs=Cs,Is=/[\s#]/g,Ts={type:"string",source:"attribute",attribute:"id",selector:"*"};const Ms={addSaveProps:function(e,t,n){(0,c.hasBlockSupport)(t,"anchor")&&(e.id=""===n.anchor?null:n.anchor);return e},edit:function({name:e,anchor:t,setAttributes:n}){const o=ns(),r="web"===u.Platform.OS,l=(0,s.createElement)(_l.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,className:"html-anchor-control",label:(0,x.__)("HTML anchor"),help:(0,s.createElement)(s.Fragment,null,(0,x.__)("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."),r&&(0,s.createElement)(_l.ExternalLink,{href:(0,x.__)("https://wordpress.org/documentation/article/page-jumps/")},(0,x.__)("Learn more about anchors"))),value:t||"",placeholder:r?null:(0,x.__)("Add an anchor"),onChange:e=>{e=e.replace(Is,"-"),n({anchor:e})},autoCapitalize:"none",autoComplete:"off"});return(0,s.createElement)(s.Fragment,null,r&&"default"===o&&(0,s.createElement)(Bs,{group:"advanced"},l),!r&&"core/heading"===e&&(0,s.createElement)(Bs,null,(0,s.createElement)(_l.PanelBody,{title:(0,x.__)("Heading settings")},l)))},attributeKeys:["anchor"],hasSupport:e=>(0,c.hasBlockSupport)(e,"anchor")};(0,m.addFilter)("blocks.registerBlockType","core/anchor/attribute",(function(e){var t;return"type"in(null!==(t=e.attributes?.anchor)&&void 0!==t?t:{})||(0,c.hasBlockSupport)(e,"anchor")&&(e.attributes={...e.attributes,anchor:Ts}),e}));const Ps={type:"string",source:"attribute",attribute:"aria-label",selector:"*"};const Rs={addSaveProps:function(e,t,n){return(0,c.hasBlockSupport)(t,"ariaLabel")&&(e["aria-label"]=""===n.ariaLabel?null:n.ariaLabel),e},attributeKeys:["ariaLabel"],hasSupport:e=>(0,c.hasBlockSupport)(e,"ariaLabel")};(0,m.addFilter)("blocks.registerBlockType","core/ariaLabel/attribute",(function(e){return e?.attributes?.ariaLabel?.type||(0,c.hasBlockSupport)(e,"ariaLabel")&&(e.attributes={...e.attributes,ariaLabel:Ps}),e}));const Ns={edit:function({className:e,setAttributes:t}){return"default"!==ns()?null:(0,s.createElement)(Bs,{group:"advanced"},(0,s.createElement)(_l.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,autoComplete:"off",label:(0,x.__)("Additional CSS class(es)"),value:e||"",onChange:e=>{t({className:""!==e?e:void 0})},help:(0,x.__)("Separate multiple classes with spaces.")}))},addSaveProps:function(e,t,n){(0,c.hasBlockSupport)(t,"customClassName",!0)&&n.className&&(e.className=ml()(e.className,n.className));return e},attributeKeys:["className"],hasSupport:e=>(0,c.hasBlockSupport)(e,"customClassName",!0)};(0,m.addFilter)("blocks.registerBlockType","core/editor/custom-class-name/attribute",(function(e){return(0,c.hasBlockSupport)(e,"customClassName",!0)&&(e.attributes={...e.attributes,className:{type:"string"}}),e})),(0,m.addFilter)("blocks.switchToBlockType.transformedBlock","core/color/addTransforms",(function(e,t,n,o){if(!(0,c.hasBlockSupport)(e.name,"customClassName",!0))return e;if(1===o.length&&e.innerBlocks.length===t.length)return e;if(1===o.length&&t.length>1||o.length>1&&1===t.length)return e;if(t[n]){const o=t[n]?.attributes.className;if(o)return{...e,attributes:{...e.attributes,className:o}}}return e})),(0,m.addFilter)("blocks.getSaveContent.extraProps","core/generated-class-name/save-props",(function(e,t){return(0,c.hasBlockSupport)(t,"className",!0)&&("string"==typeof e.className?e.className=[...new Set([(0,c.getBlockDefaultClassName)(t.name),...e.className.split(" ")])].join(" ").trim():e.className=(0,c.getBlockDefaultClassName)(t.name)),e}));const Ls=window.wp.blob,As=window.wp.dom,Os=window.wp.notices,Ds=window.wp.url,zs=window.wp.keycodes,Vs=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m7 6.5 4 2.5-4 2.5z"}),(0,s.createElement)(Z.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z"})),Fs=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"})),Hs=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M19 3H5c-.6 0-1 .4-1 1v7c0 .5.4 1 1 1h14c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1zM5.5 10.5v-.4l1.8-1.3 1.3.8c.3.2.7.2.9-.1L11 8.1l2.4 2.4H5.5zm13 0h-2.9l-4-4c-.3-.3-.8-.3-1.1 0L8.9 8l-1.2-.8c-.3-.2-.6-.2-.9 0l-1.3 1V4.5h13v6zM4 20h9v-1.5H4V20zm0-4h16v-1.5H4V16z"})),Gs=(0,_l.withFilters)("editor.MediaUpload")((()=>null));const Us=function({fallback:e=null,children:t}){const n=(0,d.useSelect)((e=>{const{getSettings:t}=e(Nr);return!!t().mediaUpload}),[]);return n?t:e},$s=window.wp.isShallowEqual;var js=n.n($s);const Ws=window.wp.preferences,Ks=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,s.createElement)(Z.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"})),Zs=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"})),qs=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"}));const Ys=function e({children:t,settingsOpen:n,setSettingsOpen:o}){const r=(0,p.useReducedMotion)(),l=r?u.Fragment:_l.__unstableAnimatePresence,i=r?"div":_l.__unstableMotion.div,a=`link-control-settings-drawer-${(0,p.useInstanceId)(e)}`;return(0,s.createElement)(u.Fragment,null,(0,s.createElement)(_l.Button,{className:"block-editor-link-control__drawer-toggle","aria-expanded":n,onClick:()=>o(!n),icon:(0,x.isRTL)()?Zs:qs,"aria-controls":a},(0,x._x)("Advanced","Additional link settings")),(0,s.createElement)(l,null,n&&(0,s.createElement)(i,{className:"block-editor-link-control__drawer",hidden:!n,id:a,initial:"collapsed",animate:"open",exit:"collapsed",variants:{open:{opacity:1,height:"auto"},collapsed:{opacity:0,height:0}},transition:{duration:.1}},(0,s.createElement)("div",{className:"block-editor-link-control__drawer-inner"},t))))};var Xs=n(5428),Qs=n.n(Xs);function Js(e){return"function"==typeof e}class ea extends u.Component{constructor(e){super(e),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=e.autocompleteRef||(0,u.createRef)(),this.inputRef=(0,u.createRef)(),this.updateSuggestions=(0,p.debounce)(this.updateSuggestions.bind(this),200),this.suggestionNodes=[],this.suggestionsRequest=null,this.state={suggestions:[],showSuggestions:!1,suggestionsValue:null,selectedSuggestion:null,suggestionsListboxId:"",suggestionOptionIdPrefix:""}}componentDidUpdate(e){const{showSuggestions:t,selectedSuggestion:n}=this.state,{value:o,__experimentalShowInitialSuggestions:r=!1}=this.props;t&&null!==n&&this.suggestionNodes[n]&&!this.scrollingIntoView&&(this.scrollingIntoView=!0,Qs()(this.suggestionNodes[n],this.autocompleteRef.current,{onlyScrollIfNeeded:!0}),this.props.setTimeout((()=>{this.scrollingIntoView=!1}),100)),e.value===o||this.props.disableSuggestions||(o?.length?this.updateSuggestions(o):r&&this.updateSuggestions())}componentDidMount(){this.shouldShowInitialSuggestions()&&this.updateSuggestions()}componentWillUnmount(){this.suggestionsRequest?.cancel?.(),this.suggestionsRequest=null}bindSuggestionNode(e){return t=>{this.suggestionNodes[e]=t}}shouldShowInitialSuggestions(){const{__experimentalShowInitialSuggestions:e=!1,value:t}=this.props;return e&&!(t&&t.length)}updateSuggestions(e=""){const{__experimentalFetchLinkSuggestions:t,__experimentalHandleURLSuggestions:n}=this.props;if(!t)return;const o=!e?.length;if(e=e.trim(),!o&&(e.length<2||!n&&(0,Ds.isURL)(e)))return this.suggestionsRequest?.cancel?.(),this.suggestionsRequest=null,void this.setState({suggestions:[],showSuggestions:!1,suggestionsValue:e,selectedSuggestion:null,loading:!1});this.setState({selectedSuggestion:null,loading:!0});const r=t(e,{isInitialSuggestions:o});r.then((t=>{this.suggestionsRequest===r&&(this.setState({suggestions:t,suggestionsValue:e,loading:!1,showSuggestions:!!t.length}),t.length?this.props.debouncedSpeak((0,x.sprintf)((0,x._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",t.length),t.length),"assertive"):this.props.debouncedSpeak((0,x.__)("No results."),"assertive"))})).catch((()=>{this.suggestionsRequest===r&&this.setState({loading:!1})})).finally((()=>{this.suggestionsRequest===r&&(this.suggestionsRequest=null)})),this.suggestionsRequest=r}onChange(e){this.props.onChange(e.target.value)}onFocus(){const{suggestions:e}=this.state,{disableSuggestions:t,value:n}=this.props;!n||t||e&&e.length||null!==this.suggestionsRequest||this.updateSuggestions(n)}onKeyDown(e){this.props.onKeyDown?.(e);const{showSuggestions:t,selectedSuggestion:n,suggestions:o,loading:r}=this.state;if(!t||!o.length||r){switch(e.keyCode){case zs.UP:0!==e.target.selectionStart&&(e.preventDefault(),e.target.setSelectionRange(0,0));break;case zs.DOWN:this.props.value.length!==e.target.selectionStart&&(e.preventDefault(),e.target.setSelectionRange(this.props.value.length,this.props.value.length));break;case zs.ENTER:this.props.onSubmit&&(e.preventDefault(),this.props.onSubmit(null,e))}return}const l=this.state.suggestions[this.state.selectedSuggestion];switch(e.keyCode){case zs.UP:{e.preventDefault();const t=n?n-1:o.length-1;this.setState({selectedSuggestion:t});break}case zs.DOWN:{e.preventDefault();const t=null===n||n===o.length-1?0:n+1;this.setState({selectedSuggestion:t});break}case zs.TAB:null!==this.state.selectedSuggestion&&(this.selectLink(l),this.props.speak((0,x.__)("Link selected.")));break;case zs.ENTER:e.preventDefault(),null!==this.state.selectedSuggestion?(this.selectLink(l),this.props.onSubmit&&this.props.onSubmit(l,e)):this.props.onSubmit&&this.props.onSubmit(null,e)}}selectLink(e){this.props.onChange(e.url,e),this.setState({selectedSuggestion:null,showSuggestions:!1})}handleOnClick(e){this.selectLink(e),this.inputRef.current.focus()}static getDerivedStateFromProps({value:e,instanceId:t,disableSuggestions:n,__experimentalShowInitialSuggestions:o=!1},{showSuggestions:r}){let l=r;const i=e&&e.length;return o||i||(l=!1),!0===n&&(l=!1),{showSuggestions:l,suggestionsListboxId:`block-editor-url-input-suggestions-${t}`,suggestionOptionIdPrefix:`block-editor-url-input-suggestion-${t}`}}render(){return(0,s.createElement)(s.Fragment,null,this.renderControl(),this.renderSuggestions())}renderControl(){const{__nextHasNoMarginBottom:e=!1,label:t=null,className:n,isFullWidth:o,instanceId:r,placeholder:l=(0,x.__)("Paste URL or type to search"),__experimentalRenderControl:i,value:a="",hideLabelFromVision:c=!1}=this.props,{loading:u,showSuggestions:d,selectedSuggestion:p,suggestionsListboxId:m,suggestionOptionIdPrefix:h}=this.state,g=`url-input-control-${r}`,f={id:g,label:t,className:ml()("block-editor-url-input",n,{"is-full-width":o}),hideLabelFromVision:c},b={id:g,value:a,required:!0,className:"block-editor-url-input__input",type:"text",onChange:this.onChange,onFocus:this.onFocus,placeholder:l,onKeyDown:this.onKeyDown,role:"combobox","aria-label":t?void 0:(0,x.__)("URL"),"aria-expanded":d,"aria-autocomplete":"list","aria-owns":m,"aria-activedescendant":null!==p?`${h}-${p}`:void 0,ref:this.inputRef};return i?i(f,b,u):(e||w()("Bottom margin styles for wp.blockEditor.URLInput",{since:"6.2",version:"6.5",hint:"Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version"}),(0,s.createElement)(_l.BaseControl,{__nextHasNoMarginBottom:e,...f},(0,s.createElement)("input",{...b}),u&&(0,s.createElement)(_l.Spinner,null)))}renderSuggestions(){const{className:e,__experimentalRenderSuggestions:t}=this.props,{showSuggestions:n,suggestions:o,suggestionsValue:r,selectedSuggestion:l,suggestionsListboxId:i,suggestionOptionIdPrefix:a,loading:c}=this.state;if(!n||0===o.length)return null;const u={id:i,ref:this.autocompleteRef,role:"listbox"},d=(e,t)=>({role:"option",tabIndex:"-1",id:`${a}-${t}`,ref:this.bindSuggestionNode(t),"aria-selected":t===l||void 0});return Js(t)?t({suggestions:o,selectedSuggestion:l,suggestionsListProps:u,buildSuggestionItemProps:d,isLoading:c,handleSuggestionClick:this.handleOnClick,isInitialSuggestions:!r?.length,currentInputValue:r}):(0,s.createElement)(_l.Popover,{placement:"bottom",focusOnMount:!1},(0,s.createElement)("div",{...u,className:ml()("block-editor-url-input__suggestions",`${e}__suggestions`)},o.map(((e,t)=>(0,s.createElement)(_l.Button,{...d(0,t),key:e.id,className:ml()("block-editor-url-input__suggestion",{"is-selected":t===l}),onClick:()=>this.handleOnClick(e)},e.title)))))}}const ta=(0,p.compose)(p.withSafeTimeout,_l.withSpokenMessages,p.withInstanceId,(0,d.withSelect)(((e,t)=>{if(Js(t.__experimentalFetchLinkSuggestions))return;const{getSettings:n}=e(Nr);return{__experimentalFetchLinkSuggestions:n().__experimentalFetchLinkSuggestions}})))(ea),na=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})),oa=({searchTerm:e,onClick:t,itemProps:n,buttonText:o})=>{if(!e)return null;let r;return r=o?"function"==typeof o?o(e):o:(0,u.createInterpolateElement)((0,x.sprintf)((0,x.__)("Create: <mark>%s</mark>"),e),{mark:(0,s.createElement)("mark",null)}),(0,s.createElement)(_l.MenuItem,{...n,iconPosition:"left",icon:na,className:"block-editor-link-control__search-item",onClick:t},r)},ra=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M18 5.5H6a.5.5 0 0 0-.5.5v12a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5V6a.5.5 0 0 0-.5-.5ZM6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm1 5h1.5v1.5H7V9Zm1.5 4.5H7V15h1.5v-1.5ZM10 9h7v1.5h-7V9Zm7 4.5h-7V15h7v-1.5Z"})),la=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,s.createElement)(Z.Path,{d:"M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"})),ia=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})),sa=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",fillRule:"evenodd",clipRule:"evenodd"})),aa=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"})),ca=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"})),ua=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"})),da=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"})),pa={post:ra,page:la,post_tag:ia,category:sa,attachment:aa};function ma({isURL:e,suggestion:t}){let n=null;return e?n=ca:t.type in pa&&(n=pa[t.type],"page"===t.type&&(t.isFrontPage&&(n=ua),t.isBlogHome&&(n=da))),n?(0,s.createElement)(Ti,{className:"block-editor-link-control__search-item-icon",icon:n}):null}function ha(e){const t=e?.trim();return t?.length?e?.replace(/^\/?/,"/"):e}function ga(e){const t=e?.trim();return t?.length?e?.replace(/\/$/,""):e}function fa(e){return e.isFrontPage?"front page":e.isBlogHome?"blog home":"post_tag"===e.type?"tag":e.type}const ba=({itemProps:e,suggestion:t,searchTerm:n,onClick:o,isURL:r=!1,shouldShowType:l=!1})=>{const i=r?(0,x.__)("Press ENTER to add this link"):(a=t.url)?(0,p.pipe)(Ds.safeDecodeURI,Ds.getPath,(e=>t=>null==t||t!=t?e:t)(""),((e,...t)=>(...n)=>e(...n,...t))(Ds.filterURLForDisplay,24),ga,ha)(a):a;var a;return(0,s.createElement)(_l.MenuItem,{...e,info:i,iconPosition:"left",icon:(0,s.createElement)(ma,{suggestion:t,isURL:r}),onClick:o,shortcut:l&&fa(t),className:"block-editor-link-control__search-item"},(0,s.createElement)(_l.TextHighlight,{text:(0,As.__unstableStripHTML)(t.title),highlight:n}))},va="__CREATE__",ka="link",_a="mailto",ya="internal",Ea=[ka,_a,"tel",ya],wa=[{id:"opensInNewTab",title:(0,x.__)("Open in new tab")}];function Sa({instanceId:e,withCreateSuggestion:t,currentInputValue:n,handleSuggestionClick:o,suggestionsListProps:r,buildSuggestionItemProps:l,suggestions:i,selectedSuggestion:a,isLoading:c,isInitialSuggestions:u,createSuggestionButtonText:d,suggestionsQuery:p}){const m=ml()("block-editor-link-control__search-results",{"is-loading":c}),h=1===i.length&&Ea.includes(i[0].type),g=t&&!h&&!u,f=!p?.type,b=`block-editor-link-control-search-results-label-${e}`,v=u?(0,x.__)("Suggestions"):(0,x.sprintf)((0,x.__)('Search results for "%s"'),n),k=(0,s.createElement)(_l.VisuallyHidden,{id:b},v);return(0,s.createElement)("div",{className:"block-editor-link-control__search-results-wrapper"},k,(0,s.createElement)("div",{...r,className:m,"aria-labelledby":b},(0,s.createElement)(_l.MenuGroup,null,i.map(((e,t)=>g&&va===e.type?(0,s.createElement)(oa,{searchTerm:n,buttonText:d,onClick:()=>o(e),key:e.type,itemProps:l(e,t),isSelected:t===a}):va===e.type?null:(0,s.createElement)(ba,{key:`${e.id}-${e.type}`,itemProps:l(e,t),suggestion:e,index:t,onClick:()=>{o(e)},isSelected:t===a,isURL:Ea.includes(e.type),searchTerm:n,shouldShowType:f,isFrontPage:e?.isFrontPage,isBlogHome:e?.isBlogHome}))))))}function Ca(e){if(e.includes(" "))return!1;const t=(0,Ds.getProtocol)(e),n=(0,Ds.isValidProtocol)(t),o=function(e,t=6){const n=e.split(/[?#]/)[0];return new RegExp(`(?<=\\S)\\.(?:[a-zA-Z_]{2,${t}})(?:\\/|$)`).test(n)}(e),r=e?.startsWith("www."),l=e?.startsWith("#")&&(0,Ds.isValidFragment)(e);return n||r||l||o}const xa=()=>Promise.resolve([]),Ba=e=>{let t=ka;const n=(0,Ds.getProtocol)(e)||"";return n.includes("mailto")&&(t=_a),n.includes("tel")&&(t="tel"),e?.startsWith("#")&&(t=ya),Promise.resolve([{id:e,title:e,url:"URL"===t?(0,Ds.prependHTTP)(e):e,type:t}])};function Ia(e,t,n){const{fetchSearchSuggestions:o,pageOnFront:r,pageForPosts:l}=(0,d.useSelect)((e=>{const{getSettings:t}=e(Nr);return{pageOnFront:t().pageOnFront,pageForPosts:t().pageForPosts,fetchSearchSuggestions:t().__experimentalFetchLinkSuggestions}}),[]),i=t?Ba:xa;return(0,u.useCallback)(((t,{isInitialSuggestions:s})=>Ca(t)?i(t,{isInitialSuggestions:s}):(async(e,t,n,o,r,l)=>{const{isInitialSuggestions:i}=t,s=await n(e,t);return s.map((e=>Number(e.id)===r?(e.isFrontPage=!0,e):Number(e.id)===l?(e.isBlogHome=!0,e):e)),i||Ca(e)||!o?s:s.concat({title:e,url:e,type:va})})(t,{...e,isInitialSuggestions:s},o,n,r,l)),[i,o,r,l,e,n])}const Ta=()=>Promise.resolve([]),Ma=()=>{},Pa=(0,u.forwardRef)((({value:e,children:t,currentLink:n={},className:o=null,placeholder:r=null,withCreateSuggestion:l=!1,onCreateSuggestion:i=Ma,onChange:a=Ma,onSelect:c=Ma,showSuggestions:d=!0,renderSuggestions:m=(e=>(0,s.createElement)(Sa,{...e})),fetchSuggestions:h=null,allowDirectEntry:g=!0,showInitialSuggestions:f=!1,suggestionsQuery:b={},withURLSuggestion:v=!0,createSuggestionButtonText:k,hideLabelFromVision:_=!1},y)=>{const E=Ia(b,g,l),w=d?h||E:Ta,S=(0,p.useInstanceId)(Pa),[C,B]=(0,u.useState)(),I=async e=>{let t=e;if(va!==e.type){if(g||t&&Object.keys(t).length>=1){const{id:e,url:o,...r}=null!=n?n:{};c({...r,...t},t)}}else try{t=await i(e.title),t?.url&&c(t)}catch(e){}};return(0,s.createElement)("div",{className:"block-editor-link-control__search-input-container"},(0,s.createElement)(ta,{disableSuggestions:n?.url===e,__nextHasNoMarginBottom:!0,label:(0,x.__)("Link"),hideLabelFromVision:_,className:o,value:e,onChange:(e,t)=>{a(e),B(t)},placeholder:null!=r?r:(0,x.__)("Search or type url"),__experimentalRenderSuggestions:d?e=>m({...e,instanceId:S,withCreateSuggestion:l,createSuggestionButtonText:k,suggestionsQuery:b,handleSuggestionClick:t=>{e.handleSuggestionClick&&e.handleSuggestionClick(t),I(t)}}):null,__experimentalFetchLinkSuggestions:w,__experimentalHandleURLSuggestions:!0,__experimentalShowInitialSuggestions:f,onSubmit:(t,n)=>{const o=t||C;o||e?.trim()?.length?I(o||{url:e}):n.preventDefault()},ref:y}),t)})),Ra=Pa,Na=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"})),La=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})),Aa=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"})),Oa=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5.625 5.5h9.75c.069 0 .125.056.125.125v9.75a.125.125 0 0 1-.125.125h-9.75a.125.125 0 0 1-.125-.125v-9.75c0-.069.056-.125.125-.125ZM4 5.625C4 4.728 4.728 4 5.625 4h9.75C16.273 4 17 4.728 17 5.625v9.75c0 .898-.727 1.625-1.625 1.625h-9.75A1.625 1.625 0 0 1 4 15.375v-9.75Zm14.5 11.656v-9H20v9C20 18.8 18.77 20 17.251 20H6.25v-1.5h11.001c.69 0 1.249-.528 1.249-1.219Z"})),{Slot:Da,Fill:za}=(0,_l.createSlotFill)("BlockEditorLinkControlViewer");function Va(e,t){switch(t.type){case"RESOLVED":return{...e,isFetching:!1,richData:t.richData};case"ERROR":return{...e,isFetching:!1,richData:null};case"LOADING":return{...e,isFetching:!0};default:throw new Error(`Unexpected action type ${t.type}`)}}const Fa=function(e){const[t,n]=(0,u.useReducer)(Va,{richData:null,isFetching:!1}),{fetchRichUrlData:o}=(0,d.useSelect)((e=>{const{getSettings:t}=e(Nr);return{fetchRichUrlData:t().__experimentalFetchRichUrlData}}),[]);return(0,u.useEffect)((()=>{if(e?.length&&o&&"undefined"!=typeof AbortController){n({type:"LOADING"});const t=new window.AbortController,r=t.signal;return o(e,{signal:r}).then((e=>{n({type:"RESOLVED",richData:e})})).catch((()=>{r.aborted||n({type:"ERROR"})})),()=>{t.abort()}}}),[e]),t};function Ha({value:e,onEditClick:t,hasRichPreviews:n=!1,hasUnlinkControl:o=!1,onRemove:r}){const l=(0,d.useSelect)((e=>e(Ws.store).get("core","showIconLabels")),[]),i=n?e?.url:null,{richData:a,isFetching:c}=Fa(i),u=a&&Object.keys(a).length,m=e&&(0,Ds.filterURLForDisplay)((0,Ds.safeDecodeURI)(e.url),24)||"",h=!e?.url?.length,g=!h&&(0,As.__unstableStripHTML)(a?.title||e?.title||m);let f;f=a?.icon?(0,s.createElement)("img",{src:a?.icon,alt:""}):h?(0,s.createElement)(Ti,{icon:Na,size:32}):(0,s.createElement)(Ti,{icon:ca});const{createNotice:b}=(0,d.useDispatch)(Os.store),v=(0,p.useCopyToClipboard)(e.url,(()=>{b("info",(0,x.__)("Link copied to clipboard."),{isDismissible:!0,type:"snackbar"})}));return(0,s.createElement)("div",{"aria-label":(0,x.__)("Currently selected"),className:ml()("block-editor-link-control__search-item",{"is-current":!0,"is-rich":u,"is-fetching":!!c,"is-preview":!0,"is-error":h,"is-url-title":g===m})},(0,s.createElement)("div",{className:"block-editor-link-control__search-item-top"},(0,s.createElement)("span",{className:"block-editor-link-control__search-item-header"},(0,s.createElement)("span",{className:ml()("block-editor-link-control__search-item-icon",{"is-image":a?.icon})},f),(0,s.createElement)("span",{className:"block-editor-link-control__search-item-details"},h?(0,s.createElement)("span",{className:"block-editor-link-control__search-item-error-notice"},(0,x.__)("Link is empty")):(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.ExternalLink,{className:"block-editor-link-control__search-item-title",href:e.url},(0,s.createElement)(_l.__experimentalTruncate,{numberOfLines:1},g)),e?.url&&g!==m&&(0,s.createElement)("span",{className:"block-editor-link-control__search-item-info"},(0,s.createElement)(_l.__experimentalTruncate,{numberOfLines:1},m))))),(0,s.createElement)(_l.Button,{icon:La,label:(0,x.__)("Edit link"),onClick:t,size:"compact"}),o&&(0,s.createElement)(_l.Button,{icon:Aa,label:(0,x.__)("Remove link"),onClick:r,size:"compact"}),(0,s.createElement)(_l.Button,{icon:Oa,label:(0,x.sprintf)((0,x.__)("Copy link%s"),h||l?"":": "+e.url),ref:v,disabled:h,size:"compact"}),(0,s.createElement)(Da,{fillProps:e})))}const Ga=()=>{},Ua=({value:e,onChange:t=Ga,settings:n})=>{if(!n||!n.length)return null;const o=n=>o=>{t({...e,[n.id]:o})},r=n.map((t=>(0,s.createElement)(_l.CheckboxControl,{__nextHasNoMarginBottom:!0,className:"block-editor-link-control__setting",key:t.id,label:t.title,onChange:o(t),checked:!!e&&!!e[t.id],help:t?.help})));return(0,s.createElement)("fieldset",{className:"block-editor-link-control__settings"},(0,s.createElement)(_l.VisuallyHidden,{as:"legend"},(0,x.__)("Currently selected link settings")),r)};const $a=e=>{let t=!1;return{promise:new Promise(((n,o)=>{e.then((e=>t?o({isCanceled:!0}):n(e)),(e=>o(t?{isCanceled:!0}:e)))})),cancel(){t=!0}}};var ja=n(5215),Wa=n.n(ja);const Ka=()=>{},Za="core/block-editor",qa="linkControlSettingsDrawer";function Ya({searchInputPlaceholder:e,value:t,settings:n=wa,onChange:o=Ka,onRemove:r,onCancel:l,noDirectEntry:i=!1,showSuggestions:a=!0,showInitialSuggestions:c,forceIsEditingLink:p,createSuggestion:m,withCreateSuggestion:h,inputValue:g="",suggestionsQuery:f={},noURLSuggestion:b=!1,createSuggestionButtonText:v,hasRichPreviews:k=!1,hasTextControl:_=!1,renderControlBottom:y=null}){void 0===h&&m&&(h=!0);const[E,w]=(0,u.useState)(!1),{advancedSettingsPreference:S}=(0,d.useSelect)((e=>{var t;return{advancedSettingsPreference:null!==(t=e(Ws.store).get(Za,qa))&&void 0!==t&&t}}),[]),{set:C}=(0,d.useDispatch)(Ws.store),B=S||E,I=(0,u.useRef)(!0),T=(0,u.useRef)(),M=(0,u.useRef)(),P=(0,u.useRef)(!1),R=n.map((({id:e})=>e)),[N,L,A,O,D]=function(e){const[t,n]=(0,u.useState)(e||{}),[o,r]=(0,u.useState)(e);return Wa()(e,o)||(r(e),n(e)),[t,n,e=>{n({...t,url:e})},e=>{n({...t,title:e})},e=>o=>{const r=Object.keys(o).reduce(((t,n)=>(e.includes(n)&&(t[n]=o[n]),t)),{});n({...t,...r})}]}(t),z=t&&!(0,$s.isShallowEqualObjects)(N,t),[V,F]=(0,u.useState)(void 0!==p?p:!t||!t.url),{createPage:H,isCreatingPage:G,errorMessage:U}=function(e){const t=(0,u.useRef)(),[n,o]=(0,u.useState)(!1),[r,l]=(0,u.useState)(null);return(0,u.useEffect)((()=>()=>{t.current&&t.current.cancel()}),[]),{createPage:async function(n){o(!0),l(null);try{return t.current=$a(Promise.resolve(e(n))),await t.current.promise}catch(e){if(e&&e.isCanceled)return;throw l(e.message||(0,x.__)("An unknown error occurred during creation. Please try again.")),e}finally{o(!1)}},isCreatingPage:n,errorMessage:r}}(m);(0,u.useEffect)((()=>{void 0!==p&&F(p)}),[p]),(0,u.useEffect)((()=>{if(I.current)return void(I.current=!1);(As.focus.focusable.find(T.current)[0]||T.current).focus(),P.current=!1}),[V,G]);const $=t?.url?.trim()?.length>0,j=()=>{P.current=!!T.current?.contains(T.current.ownerDocument.activeElement),F(!1)},W=()=>{z&&o({...t,...N,url:K}),j()},K=g||N?.url||"",Z=!K?.trim()?.length,q=r&&t&&!V&&!G,Y=V&&$,X=$&&_,Q=(V||!t)&&!G,J=!z||Z,ee=!!n?.length&&V&&$;return(0,s.createElement)("div",{tabIndex:-1,ref:T,className:"block-editor-link-control"},G&&(0,s.createElement)("div",{className:"block-editor-link-control__loading"},(0,s.createElement)(_l.Spinner,null)," ",(0,x.__)("Creating"),"…"),Q&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:ml()({"block-editor-link-control__search-input-wrapper":!0,"has-text-control":X,"has-actions":Y})},X&&(0,s.createElement)(_l.TextControl,{__nextHasNoMarginBottom:!0,ref:M,className:"block-editor-link-control__field block-editor-link-control__text-content",label:(0,x.__)("Text"),value:N?.title,onChange:O,onKeyDown:e=>{const{keyCode:t}=e;t!==zs.ENTER||Z||(e.preventDefault(),W())},size:"__unstable-large"}),(0,s.createElement)(Ra,{currentLink:t,className:"block-editor-link-control__field block-editor-link-control__search-input",placeholder:e,value:K,withCreateSuggestion:h,onCreateSuggestion:H,onChange:A,onSelect:e=>{const t=Object.keys(e).reduce(((t,n)=>(R.includes(n)||(t[n]=e[n]),t)),{});o({...N,...t,title:N?.title||e?.title}),j()},showInitialSuggestions:c,allowDirectEntry:!i,showSuggestions:a,suggestionsQuery:f,withURLSuggestion:!b,createSuggestionButtonText:v,hideLabelFromVision:!X}),!Y&&(0,s.createElement)("div",{className:"block-editor-link-control__search-enter"},(0,s.createElement)(_l.Button,{onClick:J?Ka:W,label:(0,x.__)("Submit"),icon:Ks,className:"block-editor-link-control__search-submit","aria-disabled":J}))),U&&(0,s.createElement)(_l.Notice,{className:"block-editor-link-control__search-error",status:"error",isDismissible:!1},U)),t&&!V&&!G&&(0,s.createElement)(Ha,{key:t?.url,value:t,onEditClick:()=>F(!0),hasRichPreviews:k,hasUnlinkControl:q,onRemove:()=>{r(),F(!0)}}),ee&&(0,s.createElement)("div",{className:"block-editor-link-control__tools"},!Z&&(0,s.createElement)(Ys,{settingsOpen:B,setSettingsOpen:e=>{C&&C(Za,qa,e),w(e)}},(0,s.createElement)(Ua,{value:N,settings:n,onChange:D(R)}))),Y&&(0,s.createElement)(_l.__experimentalHStack,{justify:"right",className:"block-editor-link-control__search-actions"},(0,s.createElement)(_l.Button,{variant:"tertiary",onClick:e=>{e.preventDefault(),e.stopPropagation(),L(t),$?j():r?.(),l?.()}},(0,x.__)("Cancel")),(0,s.createElement)(_l.Button,{variant:"primary",onClick:J?Ka:W,className:"block-editor-link-control__search-submit","aria-disabled":J},(0,x.__)("Save"))),!G&&y&&y())}Ya.ViewerFill=za,Ya.DEFAULT_LINK_SETTINGS=wa;const Xa=Ya,Qa=()=>{};let Ja=0;const ec=(0,p.compose)([(0,d.withDispatch)((e=>{const{createNotice:t,removeNotice:n}=e(Os.store);return{createNotice:t,removeNotice:n}})),(0,_l.withFilters)("editor.MediaReplaceFlow")])((({mediaURL:e,mediaId:t,mediaIds:n,allowedTypes:o,accept:r,onError:l,onSelect:i,onSelectURL:a,onToggleFeaturedImage:c,useFeaturedImage:p,onFilesUpload:m=Qa,name:h=(0,x.__)("Replace"),createNotice:g,removeNotice:f,children:b,multiple:v=!1,addToGallery:k,handleUpload:_=!0,popoverProps:y})=>{const E=(0,d.useSelect)((e=>e(Nr).getSettings().mediaUpload),[]),w=!!E,S=(0,u.useRef)(),C="block-editor/media-replace-flow/error-notice/"+ ++Ja,B=e=>{const t=(0,As.__unstableStripHTML)(e);l?l(t):setTimeout((()=>{g("error",t,{speak:!0,id:C,isDismissible:!0})}),1e3)},I=(e,t)=>{p&&c&&c(),t(),i(e),(0,vo.speak)((0,x.__)("The media file has been replaced")),f(C)},T=e=>{e.keyCode===zs.DOWN&&(e.preventDefault(),e.target.click())},M=v&&!(!o||0===o.length)&&o.every((e=>"image"===e||e.startsWith("image/")));return(0,s.createElement)(_l.Dropdown,{popoverProps:y,contentClassName:"block-editor-media-replace-flow__options",renderToggle:({isOpen:e,onToggle:t})=>(0,s.createElement)(_l.ToolbarButton,{ref:S,"aria-expanded":e,"aria-haspopup":"true",onClick:t,onKeyDown:T},h),renderContent:({onClose:l})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.NavigableMenu,{className:"block-editor-media-replace-flow__media-upload-menu"},(0,s.createElement)(Us,null,(0,s.createElement)(Gs,{gallery:M,addToGallery:k,multiple:v,value:v?n:t,onSelect:e=>I(e,l),allowedTypes:o,render:({open:e})=>(0,s.createElement)(_l.MenuItem,{icon:Vs,onClick:e},(0,x.__)("Open Media Library"))}),(0,s.createElement)(_l.FormFileUpload,{onChange:e=>{((e,t)=>{const n=e.target.files;if(!_)return t(),i(n);m(n),E({allowedTypes:o,filesList:n,onFileChange:([e])=>{I(e,t)},onError:B})})(e,l)},accept:r,multiple:!!v,render:({openFileDialog:e})=>(0,s.createElement)(_l.MenuItem,{icon:Fs,onClick:()=>{e()}},(0,x.__)("Upload"))})),c&&(0,s.createElement)(_l.MenuItem,{icon:Hs,onClick:c,isPressed:p},(0,x.__)("Use featured image")),b),a&&(0,s.createElement)("form",{className:ml()("block-editor-media-flow__url-input",{"has-siblings":w||c})},(0,s.createElement)("span",{className:"block-editor-media-replace-flow__image-url-label"},(0,x.__)("Current media URL:")),(0,s.createElement)(Xa,{value:{url:e},settings:[],showSuggestions:!1,onChange:({url:e})=>{a(e),S.current.focus()}})))})})),tc="background",nc="image";function oc(e){return!!e?.background?.backgroundImage?.id||!!e?.background?.backgroundImage?.url}function rc(e,t="any"){if("web"!==u.Platform.OS)return!1;const n=(0,c.getBlockSupport)(e,tc);return!0===n||("any"===t?!!n?.backgroundImage||!!n?.backgroundSize||!!n?.backgroundRepeat:!!n?.[t])}function lc(e={},t){t({style:hl({...e,background:{...e?.background,backgroundImage:void 0}})})}function ic(e){return oc(e)?"has-background":""}function sc({label:e,filename:t,url:n}){const o=e||(0,Ds.getFilename)(n);return(0,s.createElement)(_l.__experimentalItemGroup,{as:"span"},(0,s.createElement)(_l.__experimentalHStack,{justify:"flex-start",as:"span"},(0,s.createElement)("span",{className:ml()("block-editor-hooks__background__inspector-image-indicator-wrapper",{"has-image":n}),"aria-hidden":!0},n&&(0,s.createElement)("span",{className:"block-editor-hooks__background__inspector-image-indicator",style:{backgroundImage:`url(${n})`}})),(0,s.createElement)(_l.FlexItem,{as:"span"},(0,s.createElement)(_l.__experimentalTruncate,{numberOfLines:1,className:"block-editor-hooks__background__inspector-media-replace-title"},o),(0,s.createElement)(_l.VisuallyHidden,{as:"span"},t?(0,x.sprintf)((0,x.__)("Selected image: %s"),t):(0,x.__)("No image selected")))))}function ac({clientId:e,isShownByDefault:t,setAttributes:n}){const{style:o,mediaUpload:r}=(0,d.useSelect)((t=>{const{getBlockAttributes:n,getSettings:o}=t(Nr);return{style:n(e)?.style,mediaUpload:o().mediaUpload}}),[e]),{id:l,title:i,url:a}=o?.background?.backgroundImage||{},c=(0,u.useRef)(),{createErrorNotice:p}=(0,d.useDispatch)(Os.store),m=e=>{p(e,{type:"snackbar"})},h=e=>{if(!e||!e.url){const e={...o,background:{...o?.background,backgroundImage:void 0}},t={style:hl(e)};return void n(t)}if((0,Ls.isBlobURL)(e.url))return;if(e.media_type&&e.media_type!==nc||!e.media_type&&e.type&&e.type!==nc)return void m((0,x.__)("Only images can be used as a background image."));const t={...o,background:{...o?.background,backgroundImage:{url:e.url,id:e.id,source:"file",title:e.title||void 0}}},r={style:hl(t)};n(r)},g=(0,u.useCallback)((e=>({...e,style:{...e.style,background:void 0}})),[]),f=oc(o);return(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",hasValue:()=>f,label:(0,x.__)("Background image"),onDeselect:()=>lc(o,n),isShownByDefault:t,resetAllFilter:g,panelId:e},(0,s.createElement)("div",{className:"block-editor-hooks__background__inspector-media-replace-container",ref:c},(0,s.createElement)(ec,{mediaId:l,mediaURL:a,allowedTypes:[nc],accept:"image/*",onSelect:h,name:(0,s.createElement)(sc,{label:(0,x.__)("Background image"),filename:i,url:a}),variant:"secondary"},f&&(0,s.createElement)(_l.MenuItem,{onClick:()=>{const[e]=As.focus.tabbable.find(c.current);e?.focus(),e?.click(),lc(o,n)}},(0,x.__)("Reset "))),(0,s.createElement)(_l.DropZone,{onFilesDrop:e=>{r({allowedTypes:["image"],filesList:e,onFileChange([e]){(0,Ls.isBlobURL)(e?.url)||h(e)},onError:m})},label:(0,x.__)("Drop to upload")})))}const cc=e=>{if(!e||isNaN(e.x)&&isNaN(e.y))return;return`${100*(isNaN(e.x)?.5:e.x)}% ${100*(isNaN(e.y)?.5:e.y)}%`},uc=e=>{if(!e)return{x:void 0,y:void 0};let[t,n]=e.split(" ").map((e=>parseFloat(e)/100));return t=isNaN(t)?void 0:t,n=isNaN(n)?t:n,{x:t,y:n}};function dc({clientId:e,isShownByDefault:t,setAttributes:n}){const o=(0,d.useSelect)((t=>t(Nr).getBlockAttributes(e)?.style),[e]),r=o?.background?.backgroundSize,l=o?.background?.backgroundRepeat,i=void 0!==r&&"cover"!==r&&"contain"!==r||""===r?"auto":r||"cover",a="no-repeat"!==l&&("cover"!==i||void 0!==l),c=function(e){return void 0!==e?.background?.backgroundPosition||void 0!==e?.background?.backgroundSize}(o),p=(0,u.useCallback)((e=>({...e,style:{...e.style,background:{...e.style?.background,backgroundRepeat:void 0,backgroundSize:void 0}}})),[]),m=e=>{let t=l;"contain"===e&&(t="no-repeat"),"cover"!==i&&"contain"!==i||"auto"!==e||(t=void 0),n({style:hl({...o,background:{...o?.background,backgroundRepeat:t,backgroundSize:e}})})};return(0,s.createElement)(_l.__experimentalVStack,{as:_l.__experimentalToolsPanelItem,spacing:2,className:"single-column",hasValue:()=>c,label:(0,x.__)("Size"),onDeselect:()=>function(e={},t){t({style:hl({...e,background:{...e?.background,backgroundPosition:void 0,backgroundRepeat:void 0,backgroundSize:void 0}})})}(o,n),isShownByDefault:t,resetAllFilter:p,panelId:e},(0,s.createElement)(_l.FocalPointPicker,{__next40pxDefaultSize:!0,label:(0,x.__)("Position"),url:o?.background?.backgroundImage?.url,value:uc(o?.background?.backgroundPosition),onChange:e=>{n({style:hl({...o,background:{...o?.background,backgroundPosition:cc(e)}})})}}),(0,s.createElement)(_l.__experimentalToggleGroupControl,{size:"__unstable-large",label:(0,x.__)("Size"),value:i,onChange:m,isBlock:!0,help:(h=r,"cover"===h||void 0===h?(0,x.__)("Image covers the space evenly."):"contain"===h?(0,x.__)("Image is contained without distortion."):(0,x.__)("Specify a fixed width."))},(0,s.createElement)(_l.__experimentalToggleGroupControlOption,{key:"cover",value:"cover",label:(0,x.__)("Cover")}),(0,s.createElement)(_l.__experimentalToggleGroupControlOption,{key:"contain",value:"contain",label:(0,x.__)("Contain")}),(0,s.createElement)(_l.__experimentalToggleGroupControlOption,{key:"fixed",value:"auto",label:(0,x.__)("Fixed")})),void 0!==r&&"cover"!==r&&"contain"!==r?(0,s.createElement)(_l.__experimentalUnitControl,{size:"__unstable-large",onChange:m,value:r}):null,"cover"!==i&&(0,s.createElement)(_l.ToggleControl,{label:(0,x.__)("Repeat"),checked:a,onChange:()=>{n({style:hl({...o,background:{...o?.background,backgroundRepeat:!0===a?"no-repeat":void 0}})})}}));var h}function pc(e){const[t,n]=Ar("background.backgroundImage","background.backgroundSize");if(!t||!rc(e.name,"backgroundImage"))return null;const o=!(!n||!rc(e.name,"backgroundSize")),r=(0,c.getBlockSupport)(e.name,[tc,"__experimentalDefaultControls"]);return(0,s.createElement)(Bs,{group:"background"},(0,s.createElement)(ac,{isShownByDefault:r?.backgroundImage,...e}),o&&(0,s.createElement)(dc,{isShownByDefault:r?.backgroundSize,...e}))}var mc={grad:.9,turn:360,rad:360/(2*Math.PI)},hc=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},gc=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},fc=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},bc=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},vc=function(e){return{r:fc(e.r,0,255),g:fc(e.g,0,255),b:fc(e.b,0,255),a:fc(e.a)}},kc=function(e){return{r:gc(e.r),g:gc(e.g),b:gc(e.b),a:gc(e.a,3)}},_c=/^#([0-9a-f]{3,8})$/i,yc=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Ec=function(e){var t=e.r,n=e.g,o=e.b,r=e.a,l=Math.max(t,n,o),i=l-Math.min(t,n,o),s=i?l===t?(n-o)/i:l===n?2+(o-t)/i:4+(t-n)/i:0;return{h:60*(s<0?s+6:s),s:l?i/l*100:0,v:l/255*100,a:r}},wc=function(e){var t=e.h,n=e.s,o=e.v,r=e.a;t=t/360*6,n/=100,o/=100;var l=Math.floor(t),i=o*(1-n),s=o*(1-(t-l)*n),a=o*(1-(1-t+l)*n),c=l%6;return{r:255*[o,s,i,i,a,o][c],g:255*[a,o,o,s,i,i][c],b:255*[i,i,a,o,o,s][c],a:r}},Sc=function(e){return{h:bc(e.h),s:fc(e.s,0,100),l:fc(e.l,0,100),a:fc(e.a)}},Cc=function(e){return{h:gc(e.h),s:gc(e.s),l:gc(e.l),a:gc(e.a,3)}},xc=function(e){return wc((n=(t=e).s,{h:t.h,s:(n*=((o=t.l)<50?o:100-o)/100)>0?2*n/(o+n)*100:0,v:o+n,a:t.a}));var t,n,o},Bc=function(e){return{h:(t=Ec(e)).h,s:(r=(200-(n=t.s))*(o=t.v)/100)>0&&r<200?n*o/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,n,o,r},Ic=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Tc=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Mc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Rc={string:[[function(e){var t=_c.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?gc(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?gc(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=Mc.exec(e)||Pc.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:vc({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(e){var t=Ic.exec(e)||Tc.exec(e);if(!t)return null;var n,o,r=Sc({h:(n=t[1],o=t[2],void 0===o&&(o="deg"),Number(n)*(mc[o]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return xc(r)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,o=e.b,r=e.a,l=void 0===r?1:r;return hc(t)&&hc(n)&&hc(o)?vc({r:Number(t),g:Number(n),b:Number(o),a:Number(l)}):null},"rgb"],[function(e){var t=e.h,n=e.s,o=e.l,r=e.a,l=void 0===r?1:r;if(!hc(t)||!hc(n)||!hc(o))return null;var i=Sc({h:Number(t),s:Number(n),l:Number(o),a:Number(l)});return xc(i)},"hsl"],[function(e){var t=e.h,n=e.s,o=e.v,r=e.a,l=void 0===r?1:r;if(!hc(t)||!hc(n)||!hc(o))return null;var i=function(e){return{h:bc(e.h),s:fc(e.s,0,100),v:fc(e.v,0,100),a:fc(e.a)}}({h:Number(t),s:Number(n),v:Number(o),a:Number(l)});return wc(i)},"hsv"]]},Nc=function(e,t){for(var n=0;n<t.length;n++){var o=t[n][0](e);if(o)return[o,t[n][1]]}return[null,void 0]},Lc=function(e){return"string"==typeof e?Nc(e.trim(),Rc.string):"object"==typeof e&&null!==e?Nc(e,Rc.object):[null,void 0]},Ac=function(e,t){var n=Bc(e);return{h:n.h,s:fc(n.s+100*t,0,100),l:n.l,a:n.a}},Oc=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Dc=function(e,t){var n=Bc(e);return{h:n.h,s:n.s,l:fc(n.l+100*t,0,100),a:n.a}},zc=function(){function e(e){this.parsed=Lc(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return null!==this.parsed},e.prototype.brightness=function(){return gc(Oc(this.rgba),2)},e.prototype.isDark=function(){return Oc(this.rgba)<.5},e.prototype.isLight=function(){return Oc(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=kc(this.rgba)).r,n=e.g,o=e.b,l=(r=e.a)<1?yc(gc(255*r)):"","#"+yc(t)+yc(n)+yc(o)+l;var e,t,n,o,r,l},e.prototype.toRgb=function(){return kc(this.rgba)},e.prototype.toRgbString=function(){return t=(e=kc(this.rgba)).r,n=e.g,o=e.b,(r=e.a)<1?"rgba("+t+", "+n+", "+o+", "+r+")":"rgb("+t+", "+n+", "+o+")";var e,t,n,o,r},e.prototype.toHsl=function(){return Cc(Bc(this.rgba))},e.prototype.toHslString=function(){return t=(e=Cc(Bc(this.rgba))).h,n=e.s,o=e.l,(r=e.a)<1?"hsla("+t+", "+n+"%, "+o+"%, "+r+")":"hsl("+t+", "+n+"%, "+o+"%)";var e,t,n,o,r},e.prototype.toHsv=function(){return e=Ec(this.rgba),{h:gc(e.h),s:gc(e.s),v:gc(e.v),a:gc(e.a,3)};var e},e.prototype.invert=function(){return Vc({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),Vc(Ac(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Vc(Ac(this.rgba,-e))},e.prototype.grayscale=function(){return Vc(Ac(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Vc(Dc(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Vc(Dc(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?Vc({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):gc(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=Bc(this.rgba);return"number"==typeof e?Vc({h:e,s:t.s,l:t.l,a:t.a}):gc(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Vc(e).toHex()},e}(),Vc=function(e){return e instanceof zc?e:new zc(e)},Fc=[],Hc=function(e){e.forEach((function(e){Fc.indexOf(e)<0&&(e(zc,Rc),Fc.push(e))}))};function Gc(e,t){var n={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"},o={};for(var r in n)o[n[r]]=r;var l={};e.prototype.toName=function(t){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var r,i,s=o[this.toHex()];if(s)return s;if(null==t?void 0:t.closest){var a=this.toRgb(),c=1/0,u="black";if(!l.length)for(var d in n)l[d]=new e(n[d]).toRgb();for(var p in n){var m=(r=a,i=l[p],Math.pow(r.r-i.r,2)+Math.pow(r.g-i.g,2)+Math.pow(r.b-i.b,2));m<c&&(c=m,u=p)}return u}},t.string.push([function(t){var o=t.toLowerCase(),r="transparent"===o?"#0000":n[o];return r?new e(r).toRgb():null},"name"])}var Uc=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},$c=function(e){return.2126*Uc(e.r)+.7152*Uc(e.g)+.0722*Uc(e.b)};function jc(e){e.prototype.luminance=function(){return e=$c(this.rgba),void 0===(t=2)&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0;var e,t,n},e.prototype.contrast=function(t){void 0===t&&(t="#FFF");var n,o,r,l,i,s,a,c=t instanceof e?t:new e(t);return l=this.rgba,i=c.toRgb(),n=(s=$c(l))>(a=$c(i))?(s+.05)/(a+.05):(a+.05)/(s+.05),void 0===(o=2)&&(o=0),void 0===r&&(r=Math.pow(10,o)),Math.floor(r*n)/r+0},e.prototype.isReadable=function(e,t){return void 0===e&&(e="#FFF"),void 0===t&&(t={}),this.contrast(e)>=(i=void 0===(l=(n=t).size)?"normal":l,"AAA"===(r=void 0===(o=n.level)?"AA":o)&&"normal"===i?7:"AA"===r&&"large"===i?3:4.5);var n,o,r,l,i}}Hc([Gc,jc]);const Wc=(e,t,n)=>{if(t){const n=e?.find((e=>e.slug===t));if(n)return n}return{color:n}},Kc=(e,t)=>e?.find((e=>e.color===t));function Zc(e,t){if(!e||!t)return;const{kebabCase:n}=ie(_l.privateApis);return`has-${n(t)}-${e}`}function qc(){const[e,t,n,o,r,l,i,s,a,c]=Ar("color.custom","color.palette.custom","color.palette.theme","color.palette.default","color.defaultPalette","color.customGradient","color.gradients.custom","color.gradients.theme","color.gradients.default","color.defaultGradients"),d={disableCustomColors:!e,disableCustomGradients:!l};return d.colors=(0,u.useMemo)((()=>{const e=[];return n&&n.length&&e.push({name:(0,x._x)("Theme","Indicates this palette comes from the theme."),colors:n}),r&&o&&o.length&&e.push({name:(0,x._x)("Default","Indicates this palette comes from WordPress."),colors:o}),t&&t.length&&e.push({name:(0,x._x)("Custom","Indicates this palette comes from the theme."),colors:t}),e}),[t,n,o,r]),d.gradients=(0,u.useMemo)((()=>{const e=[];return s&&s.length&&e.push({name:(0,x._x)("Theme","Indicates this palette comes from the theme."),gradients:s}),c&&a&&a.length&&e.push({name:(0,x._x)("Default","Indicates this palette comes from WordPress."),gradients:a}),i&&i.length&&e.push({name:(0,x._x)("Custom","Indicates this palette is created by the user."),gradients:i}),e}),[i,s,a,c]),d.hasColorsOrGradients=!!d.colors.length||!!d.gradients.length,d}function Yc(e){return[...e].sort(((t,n)=>e.filter((e=>e===n)).length-e.filter((e=>e===t)).length)).shift()}function Xc(e={}){const{flat:t,...n}=e;return t||Yc(Object.values(n).filter(Boolean))||"px"}function Qc(e={}){if("string"==typeof e)return e;const t=Object.values(e).map((e=>(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(e))),n=t.map((e=>{var t;return null!==(t=e[0])&&void 0!==t?t:""})),o=t.map((e=>e[1])),r=n.every((e=>e===n[0]))?n[0]:"",l=Yc(o);return 0===r||r?`${r}${l}`:void 0}function Jc(e={}){const t=Qc(e);return"string"!=typeof e&&isNaN(parseFloat(t))}function eu(e){if(!e)return!1;if("string"==typeof e)return!0;return!!Object.values(e).filter((e=>!!e||0===e)).length}function tu({onChange:e,selectedUnits:t,setSelectedUnits:n,values:o,...r}){let l=Qc(o);void 0===l&&(l=Xc(t));const i=eu(o)&&Jc(o),a=i?(0,x.__)("Mixed"):null;return(0,s.createElement)(_l.__experimentalUnitControl,{...r,"aria-label":(0,x.__)("Border radius"),disableUnits:i,isOnly:!0,value:l,onChange:t=>{const n=!isNaN(parseFloat(t));e(n?t:void 0)},onUnitChange:e=>{n({topLeft:e,topRight:e,bottomLeft:e,bottomRight:e})},placeholder:a,size:"__unstable-large"})}const nu={topLeft:(0,x.__)("Top left"),topRight:(0,x.__)("Top right"),bottomLeft:(0,x.__)("Bottom left"),bottomRight:(0,x.__)("Bottom right")};function ou({onChange:e,selectedUnits:t,setSelectedUnits:n,values:o,...r}){const l=t=>n=>{if(!e)return;const o=!isNaN(parseFloat(n))?n:void 0;e({...i,[t]:o})},i="string"!=typeof o?o:{topLeft:o,topRight:o,bottomLeft:o,bottomRight:o};return(0,s.createElement)("div",{className:"components-border-radius-control__input-controls-wrapper"},Object.entries(nu).map((([e,o])=>{const[a,c]=(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(i[e]),u=i[e]?c:t[e]||t.flat;return(0,s.createElement)(_l.Tooltip,{text:o,placement:"top",key:e},(0,s.createElement)("div",{className:"components-border-radius-control__tooltip-wrapper"},(0,s.createElement)(_l.__experimentalUnitControl,{...r,"aria-label":o,value:[a,u].join(""),onChange:l(e),onUnitChange:(d=e,e=>{const o={...t};o[d]=e,n(o)}),size:"__unstable-large"})));var d})))}const ru=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"}));function lu({isLinked:e,...t}){const n=e?(0,x.__)("Unlink radii"):(0,x.__)("Link radii");return(0,s.createElement)(_l.Tooltip,{text:n},(0,s.createElement)(_l.Button,{...t,className:"component-border-radius-control__linked-button",size:"small",icon:e?ru:Aa,iconSize:24,"aria-label":n}))}const iu={topLeft:void 0,topRight:void 0,bottomLeft:void 0,bottomRight:void 0},su=0,au={px:100,em:20,rem:20};function cu({onChange:e,values:t}){const[n,o]=(0,u.useState)(!eu(t)||!Jc(t)),[r,l]=(0,u.useState)({flat:"string"==typeof t?(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(t)[1]:void 0,topLeft:(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(t?.topLeft)[1],topRight:(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(t?.topRight)[1],bottomLeft:(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(t?.bottomLeft)[1],bottomRight:(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(t?.bottomRight)[1]}),[i]=Ar("spacing.units"),a=(0,_l.__experimentalUseCustomUnits)({availableUnits:i||["px","em","rem"]}),c=Xc(r),d=a&&a.find((e=>e.value===c)),p=d?.step||1,[m]=(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(Qc(t));return(0,s.createElement)("fieldset",{className:"components-border-radius-control"},(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},(0,x.__)("Radius")),(0,s.createElement)("div",{className:"components-border-radius-control__wrapper"},n?(0,s.createElement)(s.Fragment,null,(0,s.createElement)(tu,{className:"components-border-radius-control__unit-control",values:t,min:su,onChange:e,selectedUnits:r,setSelectedUnits:l,units:a}),(0,s.createElement)(_l.RangeControl,{label:(0,x.__)("Border radius"),hideLabelFromVision:!0,className:"components-border-radius-control__range-control",value:null!=m?m:"",min:su,max:au[c],initialPosition:0,withInputField:!1,onChange:t=>{e(void 0!==t?`${t}${c}`:void 0)},step:p,__nextHasNoMarginBottom:!0})):(0,s.createElement)(ou,{min:su,onChange:e,selectedUnits:r,setSelectedUnits:l,values:t||iu,units:a}),(0,s.createElement)(lu,{onClick:()=>o(!n),isLinked:n})))}const uu=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),du=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z"})),pu=[];function mu({shadow:e,onShadowChange:t,settings:n}){const o=bu(n);return(0,s.createElement)("div",{className:"block-editor-global-styles__shadow-popover-container"},(0,s.createElement)(_l.__experimentalVStack,{spacing:4},(0,s.createElement)(_l.__experimentalHeading,{level:5},(0,x.__)("Drop shadow")),(0,s.createElement)(hu,{presets:o,activeShadow:e,onSelect:t}),(0,s.createElement)("div",{className:"block-editor-global-styles__clear-shadow"},(0,s.createElement)(_l.Button,{variant:"tertiary",onClick:()=>t(void 0)},(0,x.__)("Clear")))))}function hu({presets:e,activeShadow:t,onSelect:n}){const{CompositeV2:o,useCompositeStoreV2:r}=ie(_l.privateApis),l=r();return e?(0,s.createElement)(o,{store:l,role:"listbox",className:"block-editor-global-styles__shadow__list","aria-label":(0,x.__)("Drop shadows")},e.map((({name:e,slug:o,shadow:r})=>(0,s.createElement)(gu,{key:o,label:e,isActive:r===t,type:"unset"===o?"unset":"preset",onSelect:()=>n(r===t?void 0:r),shadow:r})))):null}function gu({type:e,label:t,isActive:n,onSelect:o,shadow:r}){const{CompositeItemV2:l}=ie(_l.privateApis);return(0,s.createElement)(l,{role:"option","aria-label":t,"aria-selected":n,className:ml()("block-editor-global-styles__shadow__item",{"is-active":n}),render:(0,s.createElement)(_l.Button,{className:ml()("block-editor-global-styles__shadow-indicator",{unset:"unset"===e}),onClick:o,label:t,style:{boxShadow:r},showTooltip:!0},n&&(0,s.createElement)(Ti,{icon:uu}))})}function fu({shadow:e,onShadowChange:t,settings:n}){return(0,s.createElement)(_l.Dropdown,{popoverProps:{placement:"left-start",offset:36,shift:!0},className:"block-editor-global-styles__shadow-dropdown",renderToggle:({onToggle:e,isOpen:t})=>{const n={onClick:e,className:ml()({"is-open":t}),"aria-expanded":t};return(0,s.createElement)(_l.Button,{...n},(0,s.createElement)(_l.__experimentalHStack,{justify:"flex-start"},(0,s.createElement)(Ti,{className:"block-editor-global-styles__toggle-icon",icon:du,size:24}),(0,s.createElement)(_l.FlexItem,null,(0,x.__)("Drop shadow"))))},renderContent:()=>(0,s.createElement)(_l.__experimentalDropdownContentWrapper,{paddingSize:"medium"},(0,s.createElement)(mu,{shadow:e,onShadowChange:t,settings:n}))})}function bu(e){return(0,u.useMemo)((()=>{var t;if(!e?.shadow)return pu;const n=e?.shadow?.defaultPresets,{default:o,theme:r}=null!==(t=e?.shadow?.presets)&&void 0!==t?t:{},l={name:(0,x.__)("Unset"),slug:"unset",shadow:"none"},i=[...n&&o||pu,...r||pu];return i.length&&i.unshift(l),i}),[e])}function vu(e){return Object.values(ku(e)).some(Boolean)}function ku(e){return{hasBorderColor:_u(e),hasBorderRadius:yu(e),hasBorderStyle:Eu(e),hasBorderWidth:wu(e),hasShadow:Su(e)}}function _u(e){return e?.border?.color}function yu(e){return e?.border?.radius}function Eu(e){return e?.border?.style}function wu(e){return e?.border?.width}function Su(e){const t=bu(e);return!!e?.shadow&&t.length>0}function Cu({resetAllFilter:e,onChange:t,value:n,panelId:o,children:r,label:l}){return(0,s.createElement)(_l.__experimentalToolsPanel,{label:l,resetAll:()=>{const o=e(n);t(o)},panelId:o,dropdownMenuProps:Qr},r)}const xu={radius:!0,color:!0,width:!0,shadow:!1};function Bu({as:e=Cu,value:t,onChange:n,inheritedValue:o=t,settings:r,panelId:l,name:i,defaultControls:a=xu}){var c,d;const p=ul(r),m=(0,u.useCallback)((e=>el({settings:r},"",e)),[r]),h=e=>{const t=p.flatMap((({colors:e})=>e)).find((({color:t})=>t===e));return t?"var:preset|color|"+t.slug:e},g=(0,u.useMemo)((()=>{if((0,_l.__experimentalHasSplitBorders)(o?.border)){const e={...o?.border};return["top","right","bottom","left"].forEach((t=>{e[t]={...e[t],color:m(e[t]?.color)}})),e}return{...o?.border,color:o?.border?.color?m(o?.border?.color):void 0}}),[o?.border,m]),f=e=>n({...t,border:e}),b=_u(r),v=Eu(r),k=wu(r),_=yu(r),y=m(g?.radius),E=e=>f({...g,radius:e}),w=()=>{const e=t?.border?.radius;return"object"==typeof e?Object.entries(e).some(Boolean):!!e},S=Su(r),C=m(o?.shadow),B=null!==(d=Qn(null!==(c=r?.shadow?.presets)&&void 0!==c?c:{}))&&void 0!==d?d:[],I=e=>{const o=B?.find((({shadow:t})=>t===e))?.slug;n(jn(t,["shadow"],o?`var:preset|shadow|${o}`:e||void 0))},T=(0,u.useCallback)((e=>({...e,border:void 0,shadow:void 0})),[]),M=a?.color||a?.width,P=b||v||k||_,R=zu({blockName:i,hasShadowControl:S,hasBorderControl:P});return(0,s.createElement)(e,{resetAllFilter:T,value:t,onChange:n,panelId:l,label:R},(k||b)&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:()=>(0,_l.__experimentalIsDefinedBorder)(t?.border),label:(0,x.__)("Border"),onDeselect:()=>(()=>{if(w())return f({radius:t?.border?.radius});f(void 0)})(),isShownByDefault:M,panelId:l},(0,s.createElement)(_l.__experimentalBorderBoxControl,{colors:p,enableAlpha:!0,enableStyle:v,onChange:e=>{const t={...e};(0,_l.__experimentalHasSplitBorders)(t)?["top","right","bottom","left"].forEach((e=>{t[e]&&(t[e]={...t[e],color:h(t[e]?.color)})})):t&&(t.color=h(t.color)),f({radius:g?.radius,...t})},popoverOffset:40,popoverPlacement:"left-start",value:g,__experimentalIsRenderedInSidebar:!0,size:"__unstable-large",hideLabelFromVision:!S,label:(0,x.__)("Border")})),_&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:w,label:(0,x.__)("Radius"),onDeselect:()=>E(void 0),isShownByDefault:a.radius,panelId:l},(0,s.createElement)(cu,{values:y,onChange:e=>{E(e||void 0)}})),S&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{label:(0,x.__)("Shadow"),hasValue:()=>!!t?.shadow,onDeselect:()=>I(void 0),isShownByDefault:a.shadow,panelId:l},P?(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},(0,x.__)("Shadow")):null,(0,s.createElement)(_l.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},(0,s.createElement)(fu,{shadow:C,onShadowChange:I,settings:r}))))}const Iu="__experimentalBorder",Tu="shadow",Mu=(e,t,n)=>{let o;return e.some((e=>e.colors.some((e=>e[t]===n&&(o=e,!0))))),o},Pu=({colors:e,namedColor:t,customColor:n})=>{if(t){const n=Mu(e,"slug",t);if(n)return n}if(!n)return{color:void 0};const o=Mu(e,"color",n);return o||{color:n}};function Ru(e){const t=/var:preset\|color\|(.+)/.exec(e);return t&&t[1]?t[1]:null}function Nu(e){if((0,_l.__experimentalHasSplitBorders)(e?.border))return{style:e,borderColor:void 0};const t=e?.border?.color,n=t?.startsWith("var:preset|color|")?t.substring(17):void 0,o={...e};return o.border={...o.border,color:n?void 0:t},{style:hl(o),borderColor:n}}function Lu(e){return(0,_l.__experimentalHasSplitBorders)(e.style?.border)?e.style:{...e.style,border:{...e.style?.border,color:e.borderColor?"var:preset|color|"+e.borderColor:e.style?.border?.color}}}function Au({label:e,children:t,resetAllFilter:n}){const o=(0,u.useCallback)((e=>{const t=Lu(e),o=n(t);return{...e,...Nu(o)}}),[n]);return(0,s.createElement)(Bs,{group:"border",resetAllFilter:o,label:e},t)}function Ou({clientId:e,name:t,setAttributes:n,settings:o}){const r=vu(o);const{style:l,borderColor:i}=(0,d.useSelect)((function(t){const{style:n,borderColor:o}=t(Nr).getBlockAttributes(e)||{};return{style:n,borderColor:o}}),[e]),a=(0,u.useMemo)((()=>Lu({style:l,borderColor:i})),[l,i]);if(!r)return null;const p={...(0,c.getBlockSupport)(t,[Iu,"__experimentalDefaultControls"]),...(0,c.getBlockSupport)(t,[Tu,"__experimentalDefaultControls"])};return(0,s.createElement)(Bu,{as:Au,panelId:e,settings:o,value:a,onChange:e=>{n(Nu(e))},defaultControls:p})}function Du(e,t="any"){if("web"!==u.Platform.OS)return!1;const n=(0,c.getBlockSupport)(e,Iu);return!0===n||("any"===t?!!(n?.color||n?.radius||n?.width||n?.style):!!n?.[t])}function zu({blockName:e,hasBorderControl:t,hasShadowControl:n}={}){const o=ku(vl(e));return t||n||!e||(t=o?.hasBorderColor||o?.hasBorderStyle||o?.hasBorderWidth||o?.hasBorderRadius,n=o?.hasShadow),t&&n?(0,x.__)("Border & Shadow"):n?(0,x.__)("Shadow"):(0,x.__)("Border")}function Vu(e,t,n){if(!Du(t,"color")||fl(t,Iu,"color"))return e;const o=Fu(n),r=ml()(e.className,o);return e.className=r||void 0,e}function Fu(e){const{borderColor:t,style:n}=e,o=Zc("border-color",t);return ml()({"has-border-color":t||n?.border?.color,[o]:!!o})}const Hu={useBlockProps:function({name:e,borderColor:t,style:n}){const{colors:o}=qc();if(!Du(e,"color")||fl(e,Iu,"color"))return{};const{color:r}=Pu({colors:o,namedColor:t}),{color:l}=Pu({colors:o,namedColor:Ru(n?.border?.top?.color)}),{color:i}=Pu({colors:o,namedColor:Ru(n?.border?.right?.color)}),{color:s}=Pu({colors:o,namedColor:Ru(n?.border?.bottom?.color)}),{color:a}=Pu({colors:o,namedColor:Ru(n?.border?.left?.color)});return Vu({style:hl({borderTopColor:l||r,borderRightColor:i||r,borderBottomColor:s||r,borderLeftColor:a||r})||{}},e,{borderColor:t,style:n})},addSaveProps:Vu,attributeKeys:["borderColor","style"],hasSupport:e=>Du(e,"color")};function Gu(e){if(e)return`has-${e}-gradient-background`}function Uu(e,t){const n=e?.find((e=>e.slug===t));return n&&n.gradient}function $u(e,t){const n=e?.find((e=>e.gradient===t));return n}function ju(e,t){const n=$u(e,t);return n&&n.slug}function Wu({gradientAttribute:e="gradient",customGradientAttribute:t="customGradient"}={}){const{clientId:n}=y(),[o,r,l]=Ar("color.gradients.custom","color.gradients.theme","color.gradients.default"),i=(0,u.useMemo)((()=>[...o||[],...r||[],...l||[]]),[o,r,l]),{gradient:s,customGradient:a}=(0,d.useSelect)((o=>{const{getBlockAttributes:r}=o(Nr),l=r(n)||{};return{customGradient:l[t],gradient:l[e]}}),[n,e,t]),{updateBlockAttributes:c}=(0,d.useDispatch)(Nr),p=(0,u.useCallback)((o=>{const r=ju(i,o);c(n,r?{[e]:r,[t]:void 0}:{[e]:void 0,[t]:o})}),[i,n,c]),m=Gu(s);let h;return h=s?Uu(i,s):a,{gradientClass:m,gradientValue:h,setGradient:p}}(0,m.addFilter)("blocks.registerBlockType","core/border/addAttributes",(function(e){return Du(e,"color")?e.attributes.borderColor?e:{...e,attributes:{...e.attributes,borderColor:{type:"string"}}}:e}));const Ku=["colors","disableCustomColors","gradients","disableCustomGradients"],Zu={color:"color",gradient:"gradient"};function qu({colors:e,gradients:t,disableCustomColors:n,disableCustomGradients:o,__experimentalIsRenderedInSidebar:r,className:l,label:i,onColorChange:a,onGradientChange:c,colorValue:u,gradientValue:d,clearable:p,showTitle:m=!0,enableAlpha:h,headingLevel:g}){const f=a&&(e&&e.length>0||!n),b=c&&(t&&t.length>0||!o);if(!f&&!b)return null;const v={[Zu.color]:(0,s.createElement)(_l.ColorPalette,{value:u,onChange:b?e=>{a(e),c()}:a,colors:e,disableCustomColors:n,__experimentalIsRenderedInSidebar:r,clearable:p,enableAlpha:h,headingLevel:g}),[Zu.gradient]:(0,s.createElement)(_l.GradientPicker,{value:d,onChange:f?e=>{c(e),a()}:c,gradients:t,disableCustomGradients:o,__experimentalIsRenderedInSidebar:r,clearable:p,headingLevel:g})},k=e=>(0,s.createElement)("div",{className:"block-editor-color-gradient-control__panel"},v[e]),{Tabs:_}=ie(_l.privateApis);return(0,s.createElement)(_l.BaseControl,{__nextHasNoMarginBottom:!0,className:ml()("block-editor-color-gradient-control",l)},(0,s.createElement)("fieldset",{className:"block-editor-color-gradient-control__fieldset"},(0,s.createElement)(_l.__experimentalVStack,{spacing:1},m&&(0,s.createElement)("legend",null,(0,s.createElement)("div",{className:"block-editor-color-gradient-control__color-indicator"},(0,s.createElement)(_l.BaseControl.VisualLabel,null,i))),f&&b&&(0,s.createElement)("div",null,(0,s.createElement)(_,{initialTabId:d?Zu.gradient:!!f&&Zu.color},(0,s.createElement)(_.TabList,null,(0,s.createElement)(_.Tab,{tabId:Zu.color},(0,x.__)("Solid")),(0,s.createElement)(_.Tab,{tabId:Zu.gradient},(0,x.__)("Gradient"))),(0,s.createElement)(_.TabPanel,{tabId:Zu.color,className:"block-editor-color-gradient-control__panel",focusable:!1},v.color),(0,s.createElement)(_.TabPanel,{tabId:Zu.gradient,className:"block-editor-color-gradient-control__panel",focusable:!1},v.gradient))),!b&&k(Zu.color),!f&&k(Zu.gradient))))}function Yu(e){const[t,n,o,r]=Ar("color.palette","color.gradients","color.custom","color.customGradient");return(0,s.createElement)(qu,{colors:t,gradients:n,disableCustomColors:!o,disableCustomGradients:!r,...e})}const Xu=function(e){return Ku.every((t=>e.hasOwnProperty(t)))?(0,s.createElement)(qu,{...e}):(0,s.createElement)(Yu,{...e})};function Qu(e){const t=Ju(e),n=rd(e),o=ed(e),r=nd(e),l=od(e),i=td(e);return t||n||o||r||l||i}function Ju(e){const t=ul(e);return e?.color?.text&&(t?.length>0||e?.color?.custom)}function ed(e){const t=ul(e);return e?.color?.link&&(t?.length>0||e?.color?.custom)}function td(e){const t=ul(e);return e?.color?.caption&&(t?.length>0||e?.color?.custom)}function nd(e){const t=ul(e),n=dl(e);return e?.color?.heading&&(t?.length>0||e?.color?.custom||n?.length>0||e?.color?.customGradient)}function od(e){const t=ul(e),n=dl(e);return e?.color?.button&&(t?.length>0||e?.color?.custom||n?.length>0||e?.color?.customGradient)}function rd(e){const t=ul(e),n=dl(e);return e?.color?.background&&(t?.length>0||e?.color?.custom||n?.length>0||e?.color?.customGradient)}function ld({resetAllFilter:e,onChange:t,value:n,panelId:o,children:r}){return(0,s.createElement)(_l.__experimentalToolsPanel,{label:(0,x.__)("Color"),resetAll:()=>{const o=e(n);t(o)},panelId:o,hasInnerWrapper:!0,className:"color-block-support-panel",__experimentalFirstVisibleItemClass:"first",__experimentalLastVisibleItemClass:"last",dropdownMenuProps:Qr},(0,s.createElement)("div",{className:"color-block-support-panel__inner-wrapper"},r))}const id={text:!0,background:!0,link:!0,heading:!0,button:!0,caption:!0},sd={placement:"left-start",offset:36,shift:!0},ad=({indicators:e,label:t})=>(0,s.createElement)(_l.__experimentalHStack,{justify:"flex-start"},(0,s.createElement)(_l.__experimentalZStack,{isLayered:!1,offset:-8},e.map(((e,t)=>(0,s.createElement)(_l.Flex,{key:t,expanded:!1},(0,s.createElement)(_l.ColorIndicator,{colorValue:e}))))),(0,s.createElement)(_l.FlexItem,{className:"block-editor-panel-color-gradient-settings__color-name",title:t},t));function cd({isGradient:e,inheritedValue:t,userValue:n,setValue:o,colorGradientControlSettings:r}){return(0,s.createElement)(Xu,{...r,showTitle:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,colorValue:e?void 0:t,gradientValue:e?t:void 0,onColorChange:e?void 0:o,onGradientChange:e?o:void 0,clearable:t===n,headingLevel:3})}function ud({label:e,hasValue:t,resetValue:n,isShownByDefault:o,indicators:r,tabs:l,colorGradientControlSettings:i,panelId:a}){const c=l.find((e=>void 0!==e.userValue)),{Tabs:u}=ie(_l.privateApis);return(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"block-editor-tools-panel-color-gradient-settings__item",hasValue:t,label:e,onDeselect:n,isShownByDefault:o,panelId:a},(0,s.createElement)(_l.Dropdown,{popoverProps:sd,className:"block-editor-tools-panel-color-gradient-settings__dropdown",renderToggle:({onToggle:t,isOpen:n})=>{const o={onClick:t,className:ml()("block-editor-panel-color-gradient-settings__dropdown",{"is-open":n}),"aria-expanded":n,"aria-label":(0,x.sprintf)((0,x.__)("Color %s styles"),e)};return(0,s.createElement)(_l.Button,{...o},(0,s.createElement)(ad,{indicators:r,label:e}))},renderContent:()=>(0,s.createElement)(_l.__experimentalDropdownContentWrapper,{paddingSize:"none"},(0,s.createElement)("div",{className:"block-editor-panel-color-gradient-settings__dropdown-content"},1===l.length&&(0,s.createElement)(cd,{...l[0],colorGradientControlSettings:i}),l.length>1&&(0,s.createElement)(u,{initialTabId:c?.key},(0,s.createElement)(u.TabList,null,l.map((e=>(0,s.createElement)(u.Tab,{key:e.key,tabId:e.key},e.label)))),l.map((e=>(0,s.createElement)(u.TabPanel,{key:e.key,tabId:e.key,focusable:!1},(0,s.createElement)(cd,{...e,colorGradientControlSettings:i})))))))}))}function dd({as:e=ld,value:t,onChange:n,inheritedValue:o=t,settings:r,panelId:l,defaultControls:i=id,children:a}){const c=ul(r),d=dl(r),p=r?.color?.custom,m=r?.color?.customGradient,h=c.length>0||p,g=d.length>0||m,f=e=>el({settings:r},"",e),b=e=>{const t=c.flatMap((({colors:e})=>e)).find((({color:t})=>t===e));return t?"var:preset|color|"+t.slug:e},v=e=>{const t=d.flatMap((({gradients:e})=>e)).find((({gradient:t})=>t===e));return t?"var:preset|gradient|"+t.slug:e},k=rd(r),_=f(o?.color?.background),y=f(t?.color?.background),E=f(o?.color?.gradient),w=f(t?.color?.gradient),S=ed(r),C=f(o?.elements?.link?.color?.text),B=f(t?.elements?.link?.color?.text),I=f(o?.elements?.link?.[":hover"]?.color?.text),T=f(t?.elements?.link?.[":hover"]?.color?.text),M=Ju(r),P=f(o?.color?.text),R=f(t?.color?.text),N=e=>{let o=jn(t,["color","text"],b(e));P===C&&(o=jn(o,["elements","link","color","text"],b(e))),n(o)},L=[{name:"caption",label:(0,x.__)("Captions"),showPanel:td(r)},{name:"button",label:(0,x.__)("Button"),showPanel:od(r)},{name:"heading",label:(0,x.__)("Heading"),showPanel:nd(r)},{name:"h1",label:(0,x.__)("H1"),showPanel:nd(r)},{name:"h2",label:(0,x.__)("H2"),showPanel:nd(r)},{name:"h3",label:(0,x.__)("H3"),showPanel:nd(r)},{name:"h4",label:(0,x.__)("H4"),showPanel:nd(r)},{name:"h5",label:(0,x.__)("H5"),showPanel:nd(r)},{name:"h6",label:(0,x.__)("H6"),showPanel:nd(r)}],A=(0,u.useCallback)((e=>({...e,color:void 0,elements:{...e?.elements,link:{...e?.elements?.link,color:void 0,":hover":{color:void 0}},...L.reduce(((t,n)=>({...t,[n.name]:{...e?.elements?.[n.name],color:void 0}})),{})}})),[]),O=[M&&{key:"text",label:(0,x.__)("Text"),hasValue:()=>!!R,resetValue:()=>N(void 0),isShownByDefault:i.text,indicators:[P],tabs:[{key:"text",label:(0,x.__)("Text"),inheritedValue:P,setValue:N,userValue:R}]},k&&{key:"background",label:(0,x.__)("Background"),hasValue:()=>!!y||!!w,resetValue:()=>{const e=jn(t,["color","background"],void 0);e.color.gradient=void 0,n(e)},isShownByDefault:i.background,indicators:[null!=E?E:_],tabs:[h&&{key:"background",label:(0,x.__)("Solid"),inheritedValue:_,setValue:e=>{const o=jn(t,["color","background"],b(e));o.color.gradient=void 0,n(o)},userValue:y},g&&{key:"gradient",label:(0,x.__)("Gradient"),inheritedValue:E,setValue:e=>{const o=jn(t,["color","gradient"],v(e));o.color.background=void 0,n(o)},userValue:w,isGradient:!0}].filter(Boolean)},S&&{key:"link",label:(0,x.__)("Link"),hasValue:()=>!!B||!!T,resetValue:()=>{let e=jn(t,["elements","link",":hover","color","text"],void 0);e=jn(e,["elements","link","color","text"],void 0),n(e)},isShownByDefault:i.link,indicators:[C,I],tabs:[{key:"link",label:(0,x.__)("Default"),inheritedValue:C,setValue:e=>{n(jn(t,["elements","link","color","text"],b(e)))},userValue:B},{key:"hover",label:(0,x.__)("Hover"),inheritedValue:I,setValue:e=>{n(jn(t,["elements","link",":hover","color","text"],b(e)))},userValue:T}]}].filter(Boolean);return L.forEach((({name:e,label:r,showPanel:l})=>{if(!l)return;const s=f(o?.elements?.[e]?.color?.background),a=f(o?.elements?.[e]?.color?.gradient),c=f(o?.elements?.[e]?.color?.text),u=f(t?.elements?.[e]?.color?.background),d=f(t?.elements?.[e]?.color?.gradient),p=f(t?.elements?.[e]?.color?.text),m="caption"!==e;O.push({key:e,label:r,hasValue:()=>!!(p||u||d),resetValue:()=>{const o=jn(t,["elements",e,"color","background"],void 0);o.elements[e].color.gradient=void 0,o.elements[e].color.text=void 0,n(o)},isShownByDefault:i[e],indicators:m?[c,null!=a?a:s]:[c],tabs:[h&&{key:"text",label:(0,x.__)("Text"),inheritedValue:c,setValue:o=>{n(jn(t,["elements",e,"color","text"],b(o)))},userValue:p},h&&m&&{key:"background",label:(0,x.__)("Background"),inheritedValue:s,setValue:o=>{const r=jn(t,["elements",e,"color","background"],b(o));r.elements[e].color.gradient=void 0,n(r)},userValue:u},g&&m&&{key:"gradient",label:(0,x.__)("Gradient"),inheritedValue:a,setValue:o=>{const r=jn(t,["elements",e,"color","gradient"],v(o));r.elements[e].color.background=void 0,n(r)},userValue:d,isGradient:!0}].filter(Boolean)})})),(0,s.createElement)(e,{resetAllFilter:A,value:t,onChange:n,panelId:l},O.map((e=>(0,s.createElement)(ud,{key:e.key,...e,colorGradientControlSettings:{colors:c,disableCustomColors:!p,gradients:d,disableCustomGradients:!m},panelId:l}))),a)}Hc([Gc,jc]);const pd=function({backgroundColor:e,fallbackBackgroundColor:t,fallbackTextColor:n,fallbackLinkColor:o,fontSize:r,isLargeText:l,textColor:i,linkColor:a,enableAlphaChecker:c=!1}){const u=e||t;if(!u)return null;const d=i||n,p=a||o;if(!d&&!p)return null;const m=[{color:d,description:(0,x.__)("text color")},{color:p,description:(0,x.__)("link color")}],h=Vc(u),g=h.alpha()<1,f=h.brightness(),b={level:"AA",size:l||!1!==l&&r>=24?"large":"small"};let v="",k="";for(const e of m){if(!e.color)continue;const t=Vc(e.color),n=t.isReadable(h,b),o=t.alpha()<1;if(!n){if(g||o)continue;v=f<t.brightness()?(0,x.sprintf)((0,x.__)("This color combination may be hard for people to read. Try using a darker background color and/or a brighter %s."),e.description):(0,x.sprintf)((0,x.__)("This color combination may be hard for people to read. Try using a brighter background color and/or a darker %s."),e.description),k=(0,x.__)("This color combination may be hard for people to read.");break}o&&c&&(v=(0,x.__)("Transparent text may be hard for people to read."),k=(0,x.__)("Transparent text may be hard for people to read."))}return v?((0,vo.speak)(k),(0,s.createElement)("div",{className:"block-editor-contrast-checker"},(0,s.createElement)(_l.Notice,{spokenMessage:null,status:"warning",isDismissible:!1},v))):null},md=(0,u.createContext)({refs:new Map,callbacks:new Map});function hd({children:e}){const t=(0,u.useMemo)((()=>({refs:new Map,callbacks:new Map})),[]);return(0,s.createElement)(md.Provider,{value:t},e)}function gd(e){const{refs:t,callbacks:n}=(0,u.useContext)(md),o=(0,u.useRef)();return(0,u.useLayoutEffect)((()=>(t.set(o,e),()=>{t.delete(o)})),[e]),(0,p.useRefEffect)((t=>{o.current=t,n.forEach(((n,o)=>{e===n&&o(t)}))}),[e])}function fd(e){const{refs:t}=(0,u.useContext)(md),n=(0,u.useRef)();return n.current=e,(0,u.useMemo)((()=>({get current(){let e=null;for(const[o,r]of t.entries())r===n.current&&o.current&&(e=o.current);return e}})),[])}function bd(e){const{callbacks:t}=(0,u.useContext)(md),n=fd(e),[o,r]=(0,u.useState)(null);return(0,u.useLayoutEffect)((()=>{if(e)return t.set(r,e),()=>{t.delete(r)}}),[e]),n.current||o}function vd(e){return e.ownerDocument.defaultView.getComputedStyle(e)}function kd({clientId:e}){const[t,n]=(0,u.useState)(),[o,r]=(0,u.useState)(),[l,i]=(0,u.useState)(),a=fd(e);return(0,u.useEffect)((()=>{if(!a.current)return;r(vd(a.current).color);const e=a.current?.querySelector("a");e&&e.innerText&&i(vd(e).color);let t=a.current,o=vd(t).backgroundColor;for(;"rgba(0, 0, 0, 0)"===o&&t.parentNode&&t.parentNode.nodeType===t.parentNode.ELEMENT_NODE;)t=t.parentNode,o=vd(t).backgroundColor;n(o)})),(0,s.createElement)(pd,{backgroundColor:t,textColor:o,enableAlphaChecker:!0,linkColor:l})}const _d="color",yd=e=>{const t=(0,c.getBlockSupport)(e,_d);return t&&(!0===t.link||!0===t.gradient||!1!==t.background||!1!==t.text)},Ed=e=>{if("web"!==u.Platform.OS)return!1;const t=(0,c.getBlockSupport)(e,_d);return null!==t&&"object"==typeof t&&!!t.link},wd=e=>{const t=(0,c.getBlockSupport)(e,_d);return null!==t&&"object"==typeof t&&!!t.gradients},Sd=e=>{const t=(0,c.getBlockSupport)(e,_d);return t&&!1!==t.background},Cd=e=>{const t=(0,c.getBlockSupport)(e,_d);return t&&!1!==t.text};function xd(e,t,n){if(!yd(t)||fl(t,_d))return e;const o=wd(t),{backgroundColor:r,textColor:l,gradient:i,style:s}=n,a=e=>!fl(t,_d,e),c=a("text")?Zc("color",l):void 0,u=a("gradients")?Gu(i):void 0,d=a("background")?Zc("background-color",r):void 0,p=a("background")||a("gradients"),m=r||s?.color?.background||o&&(i||s?.color?.gradient),h=ml()(e.className,c,u,{[d]:!(o&&s?.color?.gradient||!d),"has-text-color":a("text")&&(l||s?.color?.text),"has-background":p&&m,"has-link-color":a("link")&&s?.elements?.link?.color});return e.className=h||void 0,e}function Bd(e){const t=e?.color?.text,n=t?.startsWith("var:preset|color|")?t.substring(17):void 0,o=e?.color?.background,r=o?.startsWith("var:preset|color|")?o.substring(17):void 0,l=e?.color?.gradient,i=l?.startsWith("var:preset|gradient|")?l.substring(20):void 0,s={...e};return s.color={...s.color,text:n?void 0:t,background:r?void 0:o,gradient:i?void 0:l},{style:hl(s),textColor:n,backgroundColor:r,gradient:i}}function Id(e){return{...e.style,color:{...e.style?.color,text:e.textColor?"var:preset|color|"+e.textColor:e.style?.color?.text,background:e.backgroundColor?"var:preset|color|"+e.backgroundColor:e.style?.color?.background,gradient:e.gradient?"var:preset|gradient|"+e.gradient:e.style?.color?.gradient}}}function Td({children:e,resetAllFilter:t}){const n=(0,u.useCallback)((e=>{const n=Id(e),o=t(n);return{...e,...Bd(o)}}),[t]);return(0,s.createElement)(Bs,{group:"color",resetAllFilter:n},e)}function Md({clientId:e,name:t,setAttributes:n,settings:o}){const r=Qu(o);const{style:l,textColor:i,backgroundColor:a,gradient:p}=(0,d.useSelect)((function(t){const{style:n,textColor:o,backgroundColor:r,gradient:l}=t(Nr).getBlockAttributes(e)||{};return{style:n,textColor:o,backgroundColor:r,gradient:l}}),[e]),m=(0,u.useMemo)((()=>Id({style:l,textColor:i,backgroundColor:a,gradient:p})),[l,i,a,p]);if(!r)return null;const h=(0,c.getBlockSupport)(t,[_d,"__experimentalDefaultControls"]),g="web"===u.Platform.OS&&!m?.color?.gradient&&(o?.color?.text||o?.color?.link)&&!1!==(0,c.getBlockSupport)(t,[_d,"enableContrastChecker"]);return(0,s.createElement)(dd,{as:Td,panelId:e,settings:o,value:m,onChange:e=>{n(Bd(e))},defaultControls:h,enableContrastChecker:!1!==(0,c.getBlockSupport)(t,[_d,"enableContrastChecker"])},g&&(0,s.createElement)(kd,{clientId:e}))}const Pd={useBlockProps:function({name:e,backgroundColor:t,textColor:n,gradient:o,style:r}){const[l,i,s]=Ar("color.palette.custom","color.palette.theme","color.palette.default"),a=(0,u.useMemo)((()=>[...l||[],...i||[],...s||[]]),[l,i,s]);if(!yd(e)||fl(e,_d))return{};const c={};n&&!fl(e,_d,"text")&&(c.color=Wc(a,n)?.color),t&&!fl(e,_d,"background")&&(c.backgroundColor=Wc(a,t)?.color);const d=xd({style:c},e,{textColor:n,backgroundColor:t,gradient:o,style:r}),p=t||r?.color?.background||o||r?.color?.gradient;return{...d,className:ml()(d.className,!p&&ic(r))}},addSaveProps:xd,attributeKeys:["backgroundColor","textColor","gradient","style"],hasSupport:yd},Rd={linkColor:[["style","elements","link","color","text"]],textColor:[["textColor"],["style","color","text"]],backgroundColor:[["backgroundColor"],["style","color","background"]],gradient:[["gradient"],["style","color","gradient"]]};function Nd({value:e="",onChange:t,fontFamilies:n,...o}){const[r]=Ar("typography.fontFamilies");if(n||(n=r),!n||0===n.length)return null;const l=[{value:"",label:(0,x.__)("Default")},...n.map((({fontFamily:e,name:t})=>({value:e,label:t||e})))];return(0,s.createElement)(_l.SelectControl,{label:(0,x.__)("Font"),options:l,value:e,onChange:t,labelPosition:"top",...o})}(0,m.addFilter)("blocks.registerBlockType","core/color/addAttribute",(function(e){return yd(e)?(e.attributes.backgroundColor||Object.assign(e.attributes,{backgroundColor:{type:"string"}}),e.attributes.textColor||Object.assign(e.attributes,{textColor:{type:"string"}}),wd(e)&&!e.attributes.gradient&&Object.assign(e.attributes,{gradient:{type:"string"}}),e):e})),(0,m.addFilter)("blocks.switchToBlockType.transformedBlock","core/color/addTransforms",(function(e,t,n,o){const r=e.name;return gl({linkColor:Ed(r),textColor:Cd(r),backgroundColor:Sd(r),gradient:wd(r)},Rd,e,t,n,o)}));const Ld=[{name:(0,x._x)("Regular","font style"),value:"normal"},{name:(0,x._x)("Italic","font style"),value:"italic"}],Ad=[{name:(0,x._x)("Thin","font weight"),value:"100"},{name:(0,x._x)("Extra Light","font weight"),value:"200"},{name:(0,x._x)("Light","font weight"),value:"300"},{name:(0,x._x)("Regular","font weight"),value:"400"},{name:(0,x._x)("Medium","font weight"),value:"500"},{name:(0,x._x)("Semi Bold","font weight"),value:"600"},{name:(0,x._x)("Bold","font weight"),value:"700"},{name:(0,x._x)("Extra Bold","font weight"),value:"800"},{name:(0,x._x)("Black","font weight"),value:"900"}],Od=(e,t)=>e?t?(0,x.__)("Appearance"):(0,x.__)("Font style"):(0,x.__)("Font weight");function Dd(e){const{onChange:t,hasFontStyles:n=!0,hasFontWeights:o=!0,value:{fontStyle:r,fontWeight:l},...i}=e,a=n||o,c=Od(n,o),d={key:"default",name:(0,x.__)("Default"),style:{fontStyle:void 0,fontWeight:void 0}},p=(0,u.useMemo)((()=>n&&o?(()=>{const e=[d];return Ld.forEach((({name:t,value:n})=>{Ad.forEach((({name:o,value:r})=>{const l="normal"===n?o:(0,x.sprintf)((0,x.__)("%1$s %2$s"),o,t);e.push({key:`${n}-${r}`,name:l,style:{fontStyle:n,fontWeight:r}})}))})),e})():n?(()=>{const e=[d];return Ld.forEach((({name:t,value:n})=>{e.push({key:n,name:t,style:{fontStyle:n,fontWeight:void 0}})})),e})():(()=>{const e=[d];return Ad.forEach((({name:t,value:n})=>{e.push({key:n,name:t,style:{fontStyle:void 0,fontWeight:n}})})),e})()),[e.options]),m=p.find((e=>e.style.fontStyle===r&&e.style.fontWeight===l))||p[0];return a&&(0,s.createElement)(_l.CustomSelectControl,{...i,className:"components-font-appearance-control",label:c,describedBy:m?n?o?(0,x.sprintf)((0,x.__)("Currently selected font appearance: %s"),m.name):(0,x.sprintf)((0,x.__)("Currently selected font style: %s"),m.name):(0,x.sprintf)((0,x.__)("Currently selected font weight: %s"),m.name):(0,x.__)("No selected font appearance"),options:p,value:m,onChange:({selectedItem:e})=>t(e.style),__nextUnconstrainedWidth:!0})}const zd=1.5;const Vd=({value:e,onChange:t,__nextHasNoMarginBottom:n=!1,__unstableInputWidth:o="60px",...r})=>{const l=function(e){return void 0!==e&&""!==e}(e),i=(e,t)=>{if(l)return e;switch(`${e}`){case"0.1":return 1.6;case"0":return t?e:1.4;case"":return zd;default:return e}},a=l?e:"";n||w()("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 c=n?void 0:{marginBottom:24};return(0,s.createElement)("div",{className:"block-editor-line-height-control",style:c},(0,s.createElement)(_l.__experimentalNumberControl,{...r,__unstableInputWidth:o,__unstableStateReducer:(e,t)=>{const n=["insertText","insertFromPaste"].includes(t.payload.event.nativeEvent?.inputType),o=i(e.value,n);return{...e,value:o}},onChange:(e,{event:n})=>{""!==e?"click"!==n.type?t(`${e}`):t(i(`${e}`,!1)):t()},label:(0,x.__)("Line height"),placeholder:zd,step:.01,spinFactor:10,value:a,min:0,spinControls:"custom"}))};function Fd({value:e,onChange:t,__unstableInputWidth:n="60px",...o}){const[r]=Ar("spacing.units"),l=(0,_l.__experimentalUseCustomUnits)({availableUnits:r||["px","em","rem"],defaultValues:{px:2,em:.2,rem:.2}});return(0,s.createElement)(_l.__experimentalUnitControl,{...o,label:(0,x.__)("Letter spacing"),value:e,__unstableInputWidth:n,units:l,onChange:t})}const Hd=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M7 11.5h10V13H7z"})),Gd=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"})),Ud=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"})),$d=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"})),jd=[{name:(0,x.__)("None"),value:"none",icon:Hd},{name:(0,x.__)("Uppercase"),value:"uppercase",icon:Gd},{name:(0,x.__)("Lowercase"),value:"lowercase",icon:Ud},{name:(0,x.__)("Capitalize"),value:"capitalize",icon:$d}];function Wd({className:e,value:t,onChange:n}){return(0,s.createElement)("fieldset",{className:ml()("block-editor-text-transform-control",e)},(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},(0,x.__)("Letter case")),(0,s.createElement)("div",{className:"block-editor-text-transform-control__buttons"},jd.map((e=>(0,s.createElement)(_l.Button,{key:e.value,icon:e.icon,label:e.name,isPressed:e.value===t,onClick:()=>{n(e.value===t?void 0:e.value)}})))))}const Kd=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"})),Zd=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"})),qd=[{name:(0,x.__)("None"),value:"none",icon:Hd},{name:(0,x.__)("Underline"),value:"underline",icon:Kd},{name:(0,x.__)("Strikethrough"),value:"line-through",icon:Zd}];function Yd({value:e,onChange:t,className:n}){return(0,s.createElement)("fieldset",{className:ml()("block-editor-text-decoration-control",n)},(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},(0,x.__)("Decoration")),(0,s.createElement)("div",{className:"block-editor-text-decoration-control__buttons"},qd.map((n=>(0,s.createElement)(_l.Button,{key:n.value,icon:n.icon,label:n.name,isPressed:n.value===e,onClick:()=>{t(n.value===e?void 0:n.value)}})))))}const Xd=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M8.2 14.4h3.9L13 17h1.7L11 6.5H9.3L5.6 17h1.7l.9-2.6zm2-5.5 1.4 4H8.8l1.4-4zm7.4 7.5-1.3.8.8 1.4H5.5V20h14.3l-2.2-3.6z"})),Qd=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M7 5.6v1.7l2.6.9v3.9L7 13v1.7L17.5 11V9.3L7 5.6zm4.2 6V8.8l4 1.4-4 1.4zm-5.7 5.6V5.5H4v14.3l3.6-2.2-.8-1.3-1.3.9z"})),Jd=[{name:(0,x.__)("Horizontal"),value:"horizontal-tb",icon:Xd},{name:(0,x.__)("Vertical"),value:(0,x.isRTL)()?"vertical-lr":"vertical-rl",icon:Qd}];function ep({className:e,value:t,onChange:n}){return(0,s.createElement)("fieldset",{className:ml()("block-editor-writing-mode-control",e)},(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},(0,x.__)("Orientation")),(0,s.createElement)("div",{className:"block-editor-writing-mode-control__buttons"},Jd.map((e=>(0,s.createElement)(_l.Button,{key:e.value,icon:e.icon,label:e.name,isPressed:e.value===t,onClick:()=>{n(e.value===t?void 0:e.value)}})))))}const tp=1,np=6;function op(e){const t=lp(e),n=ip(e),o=sp(e),r=ap(e),l=cp(e),i=up(e),s=dp(e),a=pp(e),c=rp(e);return t||n||o||r||l||c||i||s||a}function rp(e){return Jn(e?.typography?.fontSizes)||e?.typography?.customFontSize}function lp(e){return Jn(e?.typography?.fontFamilies)}function ip(e){return e?.typography?.lineHeight}function sp(e){return e?.typography?.fontStyle||e?.typography?.fontWeight}function ap(e){return e?.typography?.letterSpacing}function cp(e){return e?.typography?.textTransform}function up(e){return e?.typography?.textDecoration}function dp(e){return e?.typography?.writingMode}function pp(e){return e?.typography?.textColumns}function mp({resetAllFilter:e,onChange:t,value:n,panelId:o,children:r}){return(0,s.createElement)(_l.__experimentalToolsPanel,{label:(0,x.__)("Typography"),resetAll:()=>{const o=e(n);t(o)},panelId:o,dropdownMenuProps:Qr},r)}const hp={fontFamily:!0,fontSize:!0,fontAppearance:!0,lineHeight:!0,letterSpacing:!0,textTransform:!0,textDecoration:!0,writingMode:!0,textColumns:!0};function gp({as:e=mp,value:t,onChange:n,inheritedValue:o=t,settings:r,panelId:l,defaultControls:i=hp}){var a;const c=e=>el({settings:r},"",e),d=lp(r),p=null!==(a=r?.typography?.fontFamilies)&&void 0!==a?a:{},m=p?function(e){let t=Xn.get(e);return t||(t=["default","theme","custom"].flatMap((t=>{var n;return null!==(n=e[t])&&void 0!==n?n:[]})),Xn.set(e,t)),t}(p):[],h=c(o?.typography?.fontFamily),g=e=>{const o=m?.find((({fontFamily:t})=>t===e))?.slug;n(jn(t,["typography","fontFamily"],o?`var:preset|font-family|${o}`:e||void 0))},f=rp(r),b=!r?.typography?.customFontSize,v=function(e){var t,n;const o=null!==(n=Qn(null!==(t=e?.typography?.fontSizes)&&void 0!==t?t:{}))&&void 0!==n?n:[],r=[];for(const e of o)r.some((({slug:t})=>t===e.slug))||r.push(e);return r}(r),k=c(o?.typography?.fontSize),_=(e,o)=>{n(jn(t,["typography","fontSize"],(o?.slug?`var:preset|font-size|${o?.slug}`:e)||void 0))},y=sp(r),E=function(e){return e?.typography?.fontStyle?e?.typography?.fontWeight?(0,x.__)("Appearance"):(0,x.__)("Font style"):(0,x.__)("Font weight")}(r),w=r?.typography?.fontStyle,S=r?.typography?.fontWeight,C=c(o?.typography?.fontStyle),B=c(o?.typography?.fontWeight),I=({fontStyle:e,fontWeight:o})=>{n({...t,typography:{...t?.typography,fontStyle:e||void 0,fontWeight:o||void 0}})},T=ip(r),M=c(o?.typography?.lineHeight),P=e=>{n(jn(t,["typography","lineHeight"],e||void 0))},R=ap(r),N=c(o?.typography?.letterSpacing),L=e=>{n(jn(t,["typography","letterSpacing"],e||void 0))},A=pp(r),O=c(o?.typography?.textColumns),D=e=>{n(jn(t,["typography","textColumns"],e||void 0))},z=cp(r),V=c(o?.typography?.textTransform),F=e=>{n(jn(t,["typography","textTransform"],e||void 0))},H=up(r),G=c(o?.typography?.textDecoration),U=e=>{n(jn(t,["typography","textDecoration"],e||void 0))},$=dp(r),j=c(o?.typography?.writingMode),W=e=>{n(jn(t,["typography","writingMode"],e||void 0))},K=(0,u.useCallback)((e=>({...e,typography:{}})),[]);return(0,s.createElement)(e,{resetAllFilter:K,value:t,onChange:n,panelId:l},d&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{label:(0,x.__)("Font family"),hasValue:()=>!!t?.typography?.fontFamily,onDeselect:()=>g(void 0),isShownByDefault:i.fontFamily,panelId:l},(0,s.createElement)(Nd,{fontFamilies:m,value:h,onChange:g,size:"__unstable-large",__nextHasNoMarginBottom:!0})),f&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{label:(0,x.__)("Font size"),hasValue:()=>!!t?.typography?.fontSize,onDeselect:()=>_(void 0),isShownByDefault:i.fontSize,panelId:l},(0,s.createElement)(_l.FontSizePicker,{value:k,onChange:_,fontSizes:v,disableCustomFontSizes:b,withReset:!1,withSlider:!0,size:"__unstable-large"})),y&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:E,hasValue:()=>!!t?.typography?.fontStyle||!!t?.typography?.fontWeight,onDeselect:()=>{I({})},isShownByDefault:i.fontAppearance,panelId:l},(0,s.createElement)(Dd,{value:{fontStyle:C,fontWeight:B},onChange:I,hasFontStyles:w,hasFontWeights:S,size:"__unstable-large",__nextHasNoMarginBottom:!0})),T&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Line height"),hasValue:()=>void 0!==t?.typography?.lineHeight,onDeselect:()=>P(void 0),isShownByDefault:i.lineHeight,panelId:l},(0,s.createElement)(Vd,{__nextHasNoMarginBottom:!0,__unstableInputWidth:"auto",value:M,onChange:P,size:"__unstable-large"})),R&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Letter spacing"),hasValue:()=>!!t?.typography?.letterSpacing,onDeselect:()=>L(void 0),isShownByDefault:i.letterSpacing,panelId:l},(0,s.createElement)(Fd,{value:N,onChange:L,size:"__unstable-large",__unstableInputWidth:"auto"})),A&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Text columns"),hasValue:()=>!!t?.typography?.textColumns,onDeselect:()=>D(void 0),isShownByDefault:i.textColumns,panelId:l},(0,s.createElement)(_l.__experimentalNumberControl,{label:(0,x.__)("Text columns"),max:np,min:tp,onChange:D,size:"__unstable-large",spinControls:"custom",value:O,initialPosition:1})),H&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Text decoration"),hasValue:()=>!!t?.typography?.textDecoration,onDeselect:()=>U(void 0),isShownByDefault:i.textDecoration,panelId:l},(0,s.createElement)(Yd,{value:G,onChange:U,size:"__unstable-large",__unstableInputWidth:"auto"})),$&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Text orientation"),hasValue:()=>!!t?.typography?.writingMode,onDeselect:()=>W(void 0),isShownByDefault:i.writingMode,panelId:l},(0,s.createElement)(ep,{value:j,onChange:W,size:"__unstable-large",__nextHasNoMarginBottom:!0})),z&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{label:(0,x.__)("Letter case"),hasValue:()=>!!t?.typography?.textTransform,onDeselect:()=>F(void 0),isShownByDefault:i.textTransform,panelId:l},(0,s.createElement)(Wd,{value:V,onChange:F,showNone:!0,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0})))}const fp="typography.lineHeight";const bp=window.wp.tokenList;var vp=n.n(bp);const kp="typography.__experimentalFontFamily";function _p(e,t,n){if(!(0,c.hasBlockSupport)(t,kp))return e;if(fl(t,Mp,"fontFamily"))return e;if(!n?.fontFamily)return e;const o=new(vp())(e.className),{kebabCase:r}=ie(_l.privateApis);o.add(`has-${r(n?.fontFamily)}-font-family`);const l=o.value;return e.className=l||void 0,e}const yp={useBlockProps:function({name:e,fontFamily:t}){return _p({},e,{fontFamily:t})},addSaveProps:_p,attributeKeys:["fontFamily"],hasSupport:e=>(0,c.hasBlockSupport)(e,kp)};(0,m.addFilter)("blocks.registerBlockType","core/fontFamily/addAttribute",(function(e){return(0,c.hasBlockSupport)(e,kp)?(e.attributes.fontFamily||Object.assign(e.attributes,{fontFamily:{type:"string"}}),e):e}));const Ep=(e,t,n)=>{if(t){const n=e?.find((({slug:e})=>e===t));if(n)return n}return{size:n}};function wp(e,t){const n=e?.find((({size:e})=>e===t));return n||{size:t}}function Sp(e){if(!e)return;const{kebabCase:t}=ie(_l.privateApis);return`has-${t(e)}-font-size`}const Cp="typography.fontSize";function xp(e,t,n){if(!(0,c.hasBlockSupport)(t,Cp))return e;if(fl(t,Mp,"fontSize"))return e;const o=new(vp())(e.className);o.add(Sp(n.fontSize));const r=o.value;return e.className=r||void 0,e}const Bp={useBlockProps:function({name:e,fontSize:t,style:n}){const[o,r,l]=Ar("typography.fontSizes","typography.fluid","layout");if(!(0,c.hasBlockSupport)(e,Cp)||fl(e,Mp,"fontSize")||!t&&!n?.typography?.fontSize)return;let i;if(n?.typography?.fontSize){const e=Zr({typography:{fluid:r},layout:l});i={style:{fontSize:Wr({size:n.typography.fontSize},e)}}}return t&&(i={style:{fontSize:Ep(o,t,n?.typography?.fontSize).size}}),i?xp(i,e,{fontSize:t}):void 0},addSaveProps:xp,attributeKeys:["fontSize","style"],hasSupport:e=>(0,c.hasBlockSupport)(e,Cp)},Ip={fontSize:[["fontSize"],["style","typography","fontSize"]]};function Tp(e,t){return Object.fromEntries(Object.entries(e).filter((([e])=>!t.includes(e))))}(0,m.addFilter)("blocks.registerBlockType","core/font/addAttribute",(function(e){return(0,c.hasBlockSupport)(e,Cp)?(e.attributes.fontSize||Object.assign(e.attributes,{fontSize:{type:"string"}}),e):e})),(0,m.addFilter)("blocks.switchToBlockType.transformedBlock","core/font-size/addTransforms",(function(e,t,n,o){const r=e.name;return gl({fontSize:(0,c.hasBlockSupport)(r,Cp)},Ip,e,t,n,o)}));const Mp="typography",Pp=[fp,Cp,"typography.__experimentalFontStyle","typography.__experimentalFontWeight",kp,"typography.textColumns","typography.__experimentalTextDecoration","typography.__experimentalWritingMode","typography.__experimentalTextTransform","typography.__experimentalLetterSpacing"];function Rp(e){const t={...Tp(e,["fontFamily"])},n=e?.typography?.fontSize,o=e?.typography?.fontFamily,r=n?.startsWith("var:preset|font-size|")?n.substring(21):void 0,l=o?.startsWith("var:preset|font-family|")?o.substring(23):void 0;return t.typography={...Tp(t.typography,["fontFamily"]),fontSize:r?void 0:n},{style:hl(t),fontFamily:l,fontSize:r}}function Np(e){return{...e.style,typography:{...e.style?.typography,fontFamily:e.fontFamily?"var:preset|font-family|"+e.fontFamily:void 0,fontSize:e.fontSize?"var:preset|font-size|"+e.fontSize:e.style?.typography?.fontSize}}}function Lp({children:e,resetAllFilter:t}){const n=(0,u.useCallback)((e=>{const n=Np(e),o=t(n);return{...e,...Rp(o)}}),[t]);return(0,s.createElement)(Bs,{group:"typography",resetAllFilter:n},e)}function Ap({clientId:e,name:t,setAttributes:n,settings:o}){const{style:r,fontFamily:l,fontSize:i}=(0,d.useSelect)((function(t){const{style:n,fontFamily:o,fontSize:r}=t(Nr).getBlockAttributes(e)||{};return{style:n,fontFamily:o,fontSize:r}}),[e]),a=op(o),p=(0,u.useMemo)((()=>Np({style:r,fontFamily:l,fontSize:i})),[r,i,l]);if(!a)return null;const m=(0,c.getBlockSupport)(t,[Mp,"__experimentalDefaultControls"]);return(0,s.createElement)(gp,{as:Lp,panelId:e,settings:o,value:p,onChange:e=>{n(Rp(e))},defaultControls:m})}const Op=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"}),(0,s.createElement)(Z.Path,{d:"m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"})),Dp={px:{max:300,steps:1},"%":{max:100,steps:1},vw:{max:100,steps:1},vh:{max:100,steps:1},em:{max:10,steps:.1},rm:{max:10,steps:.1},svw:{max:100,steps:1},lvw:{max:100,steps:1},dvw:{max:100,steps:1},svh:{max:100,steps:1},lvh:{max:100,steps:1},dvh:{max:100,steps:1},vi:{max:100,steps:1},svi:{max:100,steps:1},lvi:{max:100,steps:1},dvi:{max:100,steps:1},vb:{max:100,steps:1},svb:{max:100,steps:1},lvb:{max:100,steps:1},dvb:{max:100,steps:1},vmin:{max:100,steps:1},svmin:{max:100,steps:1},lvmin:{max:100,steps:1},dvmin:{max:100,steps:1},vmax:{max:100,steps:1},svmax:{max:100,steps:1},lvmax:{max:100,steps:1},dvmax:{max:100,steps:1}};function zp({icon:e,isMixed:t=!1,minimumCustomValue:n,onChange:o,onMouseOut:r,onMouseOver:l,showSideInLabel:i=!0,side:a,spacingSizes:c,type:m,value:h}){var g,f;h=Jl(h,c);let b=c;const v=c.length<=8,k=(0,d.useSelect)((e=>{const t=e(Nr).getSettings();return t?.disableCustomSpacingSizes})),[_,y]=(0,u.useState)(!k&&void 0!==h&&!Xl(h)),E=(0,p.usePrevious)(h);h&&E!==h&&!Xl(h)&&!0!==_&&y(!0);const[w]=Ar("spacing.units"),S=(0,_l.__experimentalUseCustomUnits)({availableUnits:w||["px","em","rem"]});let C=null;!v&&!_&&void 0!==h&&(!Xl(h)||Xl(h)&&t)?(b=[...c,{name:t?(0,x.__)("Mixed"):(0,x.sprintf)((0,x.__)("Custom (%s)"),h),slug:"custom",size:h}],C=b.length-1):t||(C=_?Ql(h,c):function(e,t){if(void 0===e)return 0;const n=0===parseFloat(e,10)?"0":ti(e),o=t.findIndex((e=>String(e.slug)===n));return-1!==o?o:NaN}(h,c));const B=(0,u.useMemo)((()=>(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(C)),[C])[1]||S[0]?.value,I=parseFloat(C,10),T=(e,t)=>{const n=parseInt(e,10);if("selectList"===t){if(0===n)return;if(1===n)return"0"}else if(0===n)return"0";return`var:preset|spacing|${c[e]?.slug}`},M=t?(0,x.__)("Mixed"):null,P=b.map(((e,t)=>({key:t,name:e.name}))),R=c.map(((e,t)=>({value:t,label:void 0}))),N=Wl.includes(a)&&i?ql[a]:"",L=i?m?.toLowerCase():m,A=(0,x.sprintf)((0,x.__)("%1$s %2$s"),N,L).trim();return(0,s.createElement)(_l.__experimentalHStack,{className:"spacing-sizes-control__wrapper"},e&&(0,s.createElement)(_l.Icon,{className:"spacing-sizes-control__icon",icon:e,size:24}),_&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.__experimentalUnitControl,{onMouseOver:l,onMouseOut:r,onFocus:l,onBlur:r,onChange:e=>o((e=>isNaN(parseFloat(e))?void 0:e)(e)),value:C,units:S,min:n,placeholder:M,disableUnits:t,label:A,hideLabelFromVision:!0,className:"spacing-sizes-control__custom-value-input",size:"__unstable-large"}),(0,s.createElement)(_l.RangeControl,{onMouseOver:l,onMouseOut:r,onFocus:l,onBlur:r,value:I,min:0,max:null!==(g=Dp[B]?.max)&&void 0!==g?g:10,step:null!==(f=Dp[B]?.steps)&&void 0!==f?f:.1,withInputField:!1,onChange:e=>{o([e,B].join(""))},className:"spacing-sizes-control__custom-value-range",__nextHasNoMarginBottom:!0})),v&&!_&&(0,s.createElement)(_l.RangeControl,{onMouseOver:l,onMouseOut:r,className:"spacing-sizes-control__range-control",value:C,onChange:e=>o(T(e)),onMouseDown:e=>{e?.nativeEvent?.offsetX<35&&void 0===h&&o("0")},withInputField:!1,"aria-valuenow":C,"aria-valuetext":c[C]?.name,renderTooltipContent:e=>void 0===h?void 0:c[e]?.name,min:0,max:c.length-1,marks:R,label:A,hideLabelFromVision:!0,__nextHasNoMarginBottom:!0,onFocus:l,onBlur:r}),!v&&!_&&(0,s.createElement)(_l.CustomSelectControl,{className:"spacing-sizes-control__custom-select-control",value:P.find((e=>e.key===C))||"",onChange:e=>{o(T(e.selectedItem.key,"selectList"))},options:P,label:A,hideLabelFromVision:!0,__nextUnconstrainedWidth:!0,size:"__unstable-large",onMouseOver:l,onMouseOut:r,onFocus:l,onBlur:r}),!k&&(0,s.createElement)(_l.Button,{label:_?(0,x.__)("Use size preset"):(0,x.__)("Set custom size"),icon:Op,onClick:()=>{y(!_)},isPressed:_,size:"small",className:"spacing-sizes-control__custom-toggle",iconSize:24}))}const Vp=["vertical","horizontal"];function Fp({minimumCustomValue:e,onChange:t,onMouseOut:n,onMouseOver:o,sides:r,spacingSizes:l,type:i,values:a}){const c=e=>n=>{if(!t)return;const o={...Object.keys(a).reduce(((e,t)=>(e[t]=Jl(a[t],l),e)),{})};"vertical"===e&&(o.top=n,o.bottom=n),"horizontal"===e&&(o.left=n,o.right=n),t(o)},u=r?.length?Vp.filter((e=>ni(r,e))):Vp;return(0,s.createElement)(s.Fragment,null,u.map((t=>{const r="vertical"===t?a.top:a.left;return(0,s.createElement)(zp,{key:`spacing-sizes-control-${t}`,icon:Zl[t],label:ql[t],minimumCustomValue:e,onChange:c(t),onMouseOut:n,onMouseOver:o,side:t,spacingSizes:l,type:i,value:r,withInputField:!1})})))}function Hp({minimumCustomValue:e,onChange:t,onMouseOut:n,onMouseOver:o,sides:r,spacingSizes:l,type:i,values:a}){const c=r?.length?Wl.filter((e=>r.includes(e))):Wl,u=e=>n=>{const o={...Object.keys(a).reduce(((e,t)=>(e[t]=Jl(a[t],l),e)),{})};o[e]=n,t(o)};return(0,s.createElement)(s.Fragment,null,c.map((t=>(0,s.createElement)(zp,{key:`spacing-sizes-control-${t}`,icon:Zl[t],label:ql[t],minimumCustomValue:e,onChange:u(t),onMouseOut:n,onMouseOver:o,side:t,spacingSizes:l,type:i,value:a[t],withInputField:!1}))))}function Gp({minimumCustomValue:e,onChange:t,onMouseOut:n,onMouseOver:o,showSideInLabel:r,side:l,spacingSizes:i,type:a,values:c}){return(0,s.createElement)(zp,{label:ql[l],minimumCustomValue:e,onChange:(u=l,e=>{const n={...Object.keys(c).reduce(((e,t)=>(e[t]=Jl(c[t],i),e)),{})};n[u]=e,t(n)}),onMouseOut:n,onMouseOver:o,showSideInLabel:r,side:l,spacingSizes:i,type:a,value:c[l],withInputField:!1});var u}const Up=(0,s.createElement)(_l.Icon,{icon:uu,size:24});function $p({label:e,onChange:t,sides:n,value:o}){if(!n||!n.length)return;const r=function(e){if(!e||!e.length)return{};const t={},n=ni(e,"horizontal"),o=ni(e,"vertical");n&&o?t.axial={label:ql.axial,icon:Zl.axial}:n?t.axial={label:ql.horizontal,icon:Zl.horizontal}:o&&(t.axial={label:ql.vertical,icon:Zl.vertical});let r=0;return Wl.forEach((n=>{e.includes(n)&&(r+=1,t[n]={label:ql[n],icon:Zl[n]})})),r>1&&(t.custom={label:ql.custom,icon:Zl.custom}),t}(n),l=r[o].icon,{custom:i,...a}=r;return(0,s.createElement)(_l.DropdownMenu,{icon:l,label:e,className:"spacing-sizes-control__dropdown",toggleProps:{isSmall:!0}},(({onClose:e})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.MenuGroup,null,Object.entries(a).map((([n,{label:r,icon:l}])=>{const i=o===n;return(0,s.createElement)(_l.MenuItem,{key:n,icon:l,iconPosition:"left",isSelected:i,role:"menuitemradio",onClick:()=>{t(n),e()},suffix:i?Up:void 0},r)}))),!!i&&(0,s.createElement)(_l.MenuGroup,null,(0,s.createElement)(_l.MenuItem,{icon:i.icon,iconPosition:"left",isSelected:o===Yl.custom,role:"menuitemradio",onClick:()=>{t(Yl.custom),e()},suffix:o===Yl.custom?Up:void 0},i.label)))))}function jp({inputProps:e,label:t,minimumCustomValue:n=0,onChange:o,onMouseOut:r,onMouseOver:l,showSideInLabel:i=!0,sides:a=Wl,useSelect:c,values:d}){const p=function(){const e=[{name:0,slug:"0",size:0}],[t]=Ar("spacing.spacingSizes");return t&&e.push(...t),e.length>8&&e.unshift({name:(0,x.__)("Default"),slug:"default",size:void 0}),e}(),m=d||Kl,h=1===a?.length,g=a?.includes("horizontal")&&a?.includes("vertical")&&2===a?.length,[f,b]=(0,u.useState)(function(e={},t){const{top:n,right:o,bottom:r,left:l}=e,i=[n,o,r,l].filter(Boolean),s=!(n!==r||l!==o||!n&&!l),a=!i.length&&function(e=[]){const t={top:0,right:0,bottom:0,left:0};return e.forEach((e=>t[e]+=1)),(t.top+t.bottom)%2==0&&(t.left+t.right)%2==0}(t);if(ni(t)&&(s||a))return Yl.axial;if(1===i.length){let t;return Object.entries(e).some((([e,n])=>(t=e,void 0!==n))),t}return 1!==t?.length||i.length?Yl.custom:t[0]}(m,a)),v={...e,minimumCustomValue:n,onChange:e=>{const t={...d,...e};o(t)},onMouseOut:r,onMouseOver:l,sides:a,spacingSizes:p,type:t,useSelect:c,values:m},k=Wl.includes(f)&&i?ql[f]:"",_=(0,x.sprintf)((0,x.__)("%1$s %2$s"),t,k).trim(),y=(0,x.sprintf)((0,x._x)("%s options","Button label to reveal side configuration options"),t);return(0,s.createElement)("fieldset",{className:"spacing-sizes-control"},(0,s.createElement)(_l.__experimentalHStack,{className:"spacing-sizes-control__header"},(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend",className:"spacing-sizes-control__label"},_),!h&&!g&&(0,s.createElement)($p,{label:y,onChange:b,sides:a,value:f})),(0,s.createElement)(_l.__experimentalVStack,{spacing:.5},f===Yl.axial?(0,s.createElement)(Fp,{...v}):f===Yl.custom?(0,s.createElement)(Hp,{...v}):(0,s.createElement)(Gp,{side:f,...v,showSideInLabel:i})))}const Wp={px:{max:1e3,step:1},"%":{max:100,step:1},vw:{max:100,step:1},vh:{max:100,step:1},em:{max:50,step:.1},rem:{max:50,step:.1},svw:{max:100,step:1},lvw:{max:100,step:1},dvw:{max:100,step:1},svh:{max:100,step:1},lvh:{max:100,step:1},dvh:{max:100,step:1},vi:{max:100,step:1},svi:{max:100,step:1},lvi:{max:100,step:1},dvi:{max:100,step:1},vb:{max:100,step:1},svb:{max:100,step:1},lvb:{max:100,step:1},dvb:{max:100,step:1},vmin:{max:100,step:1},svmin:{max:100,step:1},lvmin:{max:100,step:1},dvmin:{max:100,step:1},vmax:{max:100,step:1},svmax:{max:100,step:1},lvmax:{max:100,step:1},dvmax:{max:100,step:1}};function Kp({label:e=(0,x.__)("Height"),onChange:t,value:n}){var o,r;const l=parseFloat(n),[i]=Ar("spacing.units"),a=(0,_l.__experimentalUseCustomUnits)({availableUnits:i||["%","px","em","rem","vh","vw"]}),c=(0,u.useMemo)((()=>(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(n)),[n])[1]||a[0]?.value||"px";return(0,s.createElement)("fieldset",{className:"block-editor-height-control"},(0,s.createElement)(_l.BaseControl.VisualLabel,{as:"legend"},e),(0,s.createElement)(_l.Flex,null,(0,s.createElement)(_l.FlexItem,{isBlock:!0},(0,s.createElement)(_l.__experimentalUnitControl,{value:n,units:a,onChange:t,onUnitChange:e=>{const[o,r]=(0,_l.__experimentalParseQuantityAndUnitFromRawValue)(n);["em","rem"].includes(e)&&"px"===r?t((o/16).toFixed(2)+e):["em","rem"].includes(r)&&"px"===e?t(Math.round(16*o)+e):["%","vw","svw","lvw","dvw","vh","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax"].includes(e)&&o>100&&t(100+e)},min:0,size:"__unstable-large",label:e,hideLabelFromVision:!0})),(0,s.createElement)(_l.FlexItem,{isBlock:!0},(0,s.createElement)(_l.__experimentalSpacer,{marginX:2,marginBottom:0},(0,s.createElement)(_l.RangeControl,{value:l,min:0,max:null!==(o=Wp[c]?.max)&&void 0!==o?o:100,step:null!==(r=Wp[c]?.step)&&void 0!==r?r:.1,withInputField:!1,onChange:e=>{t([e,c].join(""))},__nextHasNoMarginBottom:!0,label:e,hideLabelFromVision:!0})))))}function Zp(e,t){const{orientation:n="horizontal"}=t;return"fill"===e?(0,x.__)("Stretch to fill available space."):"fixed"===e&&"horizontal"===n?(0,x.__)("Specify a fixed width."):"fixed"===e?(0,x.__)("Specify a fixed height."):(0,x.__)("Fit contents.")}function qp({value:e={},onChange:t,parentLayout:n}){const{selfStretch:o,flexSize:r}=e;return(0,u.useEffect)((()=>{"fixed"!==o||r||t({...e,selfStretch:"fit"})}),[]),(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,size:"__unstable-large",label:Yp(n),value:o||"fit",help:Zp(o,n),onChange:n=>{const o="fixed"!==n?null:r;t({...e,selfStretch:n,flexSize:o})},isBlock:!0},(0,s.createElement)(_l.__experimentalToggleGroupControlOption,{key:"fit",value:"fit",label:(0,x.__)("Fit")}),(0,s.createElement)(_l.__experimentalToggleGroupControlOption,{key:"fill",value:"fill",label:(0,x.__)("Fill")}),(0,s.createElement)(_l.__experimentalToggleGroupControlOption,{key:"fixed",value:"fixed",label:(0,x.__)("Fixed")})),"fixed"===o&&(0,s.createElement)(_l.__experimentalUnitControl,{size:"__unstable-large",onChange:n=>{t({...e,flexSize:n})},value:r}))}function Yp(e){const{orientation:t="horizontal"}=e;return"horizontal"===t?(0,x.__)("Width"):(0,x.__)("Height")}const Xp=[{label:(0,x._x)("Original","Aspect ratio option for dimensions control"),value:"auto"},{label:(0,x._x)("Square - 1:1","Aspect ratio option for dimensions control"),value:"1"},{label:(0,x._x)("Standard - 4:3","Aspect ratio option for dimensions control"),value:"4/3"},{label:(0,x._x)("Portrait - 3:4","Aspect ratio option for dimensions control"),value:"3/4"},{label:(0,x._x)("Classic - 3:2","Aspect ratio option for dimensions control"),value:"3/2"},{label:(0,x._x)("Classic Portrait - 2:3","Aspect ratio option for dimensions control"),value:"2/3"},{label:(0,x._x)("Wide - 16:9","Aspect ratio option for dimensions control"),value:"16/9"},{label:(0,x._x)("Tall - 9:16","Aspect ratio option for dimensions control"),value:"9/16"},{label:(0,x._x)("Custom","Aspect ratio option for dimensions control"),value:"custom",disabled:!0,hidden:!0}];function Qp({panelId:e,value:t,onChange:n=(()=>{}),options:o=Xp,defaultValue:r=Xp[0].value,hasValue:l,isShownByDefault:i=!0}){const a=null!=t?t:"auto";return(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:l||(()=>a!==r),label:(0,x.__)("Aspect ratio"),onDeselect:()=>n(void 0),isShownByDefault:i,panelId:e},(0,s.createElement)(_l.SelectControl,{label:(0,x.__)("Aspect ratio"),value:a,options:o,onChange:n,size:"__unstable-large",__nextHasNoMarginBottom:!0}))}const Jp=["horizontal","vertical"];function em(e){const t=tm(e),n=nm(e),o=om(e),r=rm(e),l=lm(e),i=im(e),s=sm(e),a=am(e);return"web"===u.Platform.OS&&(t||n||o||r||l||i||s||a)}function tm(e){return e?.layout?.contentSize}function nm(e){return e?.layout?.wideSize}function om(e){return e?.spacing?.padding}function rm(e){return e?.spacing?.margin}function lm(e){return e?.spacing?.blockGap}function im(e){return e?.dimensions?.minHeight}function sm(e){return e?.dimensions?.aspectRatio}function am(e){var t;const{type:n="default",default:{type:o="default"}={},allowSizingOnChildren:r=!1}=null!==(t=e?.parentLayout)&&void 0!==t?t:{},l=("flex"===o||"flex"===n)&&r;return!!e?.layout&&l}function cm(e,t){if(!t||!e)return e;const n={};return t.forEach((t=>{"vertical"===t&&(n.top=e.top,n.bottom=e.bottom),"horizontal"===t&&(n.left=e.left,n.right=e.right),n[t]=e?.[t]})),n}function um(e){return e&&"string"==typeof e?{top:e,right:e,bottom:e,left:e}:e}function dm({resetAllFilter:e,onChange:t,value:n,panelId:o,children:r}){return(0,s.createElement)(_l.__experimentalToolsPanel,{label:(0,x.__)("Dimensions"),resetAll:()=>{const o=e(n);t(o)},panelId:o,dropdownMenuProps:Qr},r)}const pm={contentSize:!0,wideSize:!0,padding:!0,margin:!0,blockGap:!0,minHeight:!0,aspectRatio:!0,childLayout:!0};function mm({as:e=dm,value:t,onChange:n,inheritedValue:o=t,settings:r,panelId:l,defaultControls:i=pm,onVisualize:a=(()=>{}),includeLayoutControls:c=!1}){var d,p,m,h,g,f,b,v,k;const{dimensions:_,spacing:y}=r,E=e=>e&&"object"==typeof e?Object.keys(e).reduce(((t,n)=>(t[n]=el({settings:{dimensions:_,spacing:y}},"",e[n]),t)),{}):el({settings:{dimensions:_,spacing:y}},"",e),w=function(e){var t,n;const{custom:o,theme:r,default:l}=e?.spacing?.spacingSizes||{};return(null!==(t=null!==(n=null!=o?o:r)&&void 0!==n?n:l)&&void 0!==t?t:[]).length>0}(r),S=(0,_l.__experimentalUseCustomUnits)({availableUnits:r?.spacing?.units||["%","px","em","rem","vw"]}),C=tm(r)&&c,B=E(o?.layout?.contentSize),I=e=>{n(jn(t,["layout","contentSize"],e||void 0))},T=nm(r)&&c,M=E(o?.layout?.wideSize),P=e=>{n(jn(t,["layout","wideSize"],e||void 0))},R=om(r),N=um(E(o?.spacing?.padding)),L=Array.isArray(r?.spacing?.padding)?r?.spacing?.padding:r?.spacing?.padding?.sides,A=L&&L.some((e=>Jp.includes(e))),O=e=>{const o=cm(e,L);n(jn(t,["spacing","padding"],o))},D=()=>a("padding"),z=rm(r),V=um(E(o?.spacing?.margin)),F=Array.isArray(r?.spacing?.margin)?r?.spacing?.margin:r?.spacing?.margin?.sides,H=F&&F.some((e=>Jp.includes(e))),G=e=>{const o=cm(e,F);n(jn(t,["spacing","margin"],o))},U=()=>a("margin"),$=lm(r),j=E(o?.spacing?.blockGap),W=function(e){return e&&"string"==typeof e?{top:e}:e?{...e,right:e?.left,bottom:e?.top}:e}(j),K=Array.isArray(r?.spacing?.blockGap)?r?.spacing?.blockGap:r?.spacing?.blockGap?.sides,Z=K&&K.some((e=>Jp.includes(e))),q=e=>{n(jn(t,["spacing","blockGap"],e))},Y=e=>{e||q(null),!Z&&e?.hasOwnProperty("top")?q(e.top):q({top:e?.top,left:e?.left})},X=im(r),Q=E(o?.dimensions?.minHeight),J=e=>{const o=jn(t,["dimensions","minHeight"],e);n(jn(o,["dimensions","aspectRatio"],void 0))},ee=sm(r),te=E(o?.dimensions?.aspectRatio),ne=am(r),oe=o?.layout,{orientation:re="horizontal"}=null!==(d=r?.parentLayout)&&void 0!==d?d:{},le="horizontal"===re?(0,x.__)("Width"):(0,x.__)("Height"),ie=e=>{n({...t,layout:{...t?.layout,...e}})},se=(0,u.useCallback)((e=>({...e,layout:hl({...e?.layout,contentSize:void 0,wideSize:void 0,selfStretch:void 0,flexSize:void 0}),spacing:{...e?.spacing,padding:void 0,margin:void 0,blockGap:void 0},dimensions:{...e?.dimensions,minHeight:void 0,aspectRatio:void 0}})),[]),ae=()=>a(!1);return(0,s.createElement)(e,{resetAllFilter:se,value:t,onChange:n,panelId:l},(C||T)&&(0,s.createElement)("span",{className:"span-columns"},(0,x.__)("Set the width of the main content area.")),C&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Content size"),hasValue:()=>!!t?.layout?.contentSize,onDeselect:()=>I(void 0),isShownByDefault:null!==(p=i.contentSize)&&void 0!==p?p:pm.contentSize,panelId:l},(0,s.createElement)(_l.__experimentalHStack,{alignment:"flex-end",justify:"flex-start"},(0,s.createElement)(_l.__experimentalUnitControl,{label:(0,x.__)("Content"),labelPosition:"top",__unstableInputWidth:"80px",value:B||"",onChange:e=>{I(e)},units:S}),(0,s.createElement)(_l.__experimentalView,null,(0,s.createElement)(Ti,{icon:Mi})))),T&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{className:"single-column",label:(0,x.__)("Wide size"),hasValue:()=>!!t?.layout?.wideSize,onDeselect:()=>P(void 0),isShownByDefault:null!==(m=i.wideSize)&&void 0!==m?m:pm.wideSize,panelId:l},(0,s.createElement)(_l.__experimentalHStack,{alignment:"flex-end",justify:"flex-start"},(0,s.createElement)(_l.__experimentalUnitControl,{label:(0,x.__)("Wide"),labelPosition:"top",__unstableInputWidth:"80px",value:M||"",onChange:e=>{P(e)},units:S}),(0,s.createElement)(_l.__experimentalView,null,(0,s.createElement)(Ti,{icon:Pi})))),R&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:()=>!!t?.spacing?.padding&&Object.keys(t?.spacing?.padding).length,label:(0,x.__)("Padding"),onDeselect:()=>O(void 0),isShownByDefault:null!==(h=i.padding)&&void 0!==h?h:pm.padding,className:ml()({"tools-panel-item-spacing":w}),panelId:l},!w&&(0,s.createElement)(_l.__experimentalBoxControl,{values:N,onChange:O,label:(0,x.__)("Padding"),sides:L,units:S,allowReset:!1,splitOnAxis:A,onMouseOver:D,onMouseOut:ae}),w&&(0,s.createElement)(jp,{values:N,onChange:O,label:(0,x.__)("Padding"),sides:L,units:S,allowReset:!1,onMouseOver:D,onMouseOut:ae})),z&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:()=>!!t?.spacing?.margin&&Object.keys(t?.spacing?.margin).length,label:(0,x.__)("Margin"),onDeselect:()=>G(void 0),isShownByDefault:null!==(g=i.margin)&&void 0!==g?g:pm.margin,className:ml()({"tools-panel-item-spacing":w}),panelId:l},!w&&(0,s.createElement)(_l.__experimentalBoxControl,{values:V,onChange:G,label:(0,x.__)("Margin"),sides:F,units:S,allowReset:!1,splitOnAxis:H,onMouseOver:U,onMouseOut:ae}),w&&(0,s.createElement)(jp,{values:V,onChange:G,label:(0,x.__)("Margin"),sides:F,units:S,allowReset:!1,onMouseOver:U,onMouseOut:ae})),$&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:()=>!!t?.spacing?.blockGap,label:(0,x.__)("Block spacing"),onDeselect:()=>q(void 0),isShownByDefault:null!==(f=i.blockGap)&&void 0!==f?f:pm.blockGap,className:ml()({"tools-panel-item-spacing":w}),panelId:l},!w&&(Z?(0,s.createElement)(_l.__experimentalBoxControl,{label:(0,x.__)("Block spacing"),min:0,onChange:Y,units:S,sides:K,values:W,allowReset:!1,splitOnAxis:Z}):(0,s.createElement)(_l.__experimentalUnitControl,{label:(0,x.__)("Block spacing"),__unstableInputWidth:"80px",min:0,onChange:q,units:S,value:j})),w&&(0,s.createElement)(jp,{label:(0,x.__)("Block spacing"),min:0,onChange:Y,showSideInLabel:!1,sides:Z?K:["top"],values:W,allowReset:!1})),X&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:()=>!!t?.dimensions?.minHeight,label:(0,x.__)("Minimum height"),onDeselect:()=>{J(void 0)},isShownByDefault:null!==(b=i.minHeight)&&void 0!==b?b:pm.minHeight,panelId:l},(0,s.createElement)(Kp,{label:(0,x.__)("Minimum height"),value:Q,onChange:J})),ee&&(0,s.createElement)(Qp,{hasValue:()=>!!t?.dimensions?.aspectRatio,value:te,onChange:e=>{const o=jn(t,["dimensions","aspectRatio"],e);n(jn(o,["dimensions","minHeight"],void 0))},panelId:l,isShownByDefault:null!==(v=i.aspectRatio)&&void 0!==v?v:pm.aspectRatio}),ne&&(0,s.createElement)(_l.__experimentalVStack,{as:_l.__experimentalToolsPanelItem,spacing:2,hasValue:()=>!!t?.layout,label:le,onDeselect:()=>{ie({selfStretch:void 0,flexSize:void 0})},isShownByDefault:null!==(k=i.childLayout)&&void 0!==k?k:pm.childLayout,panelId:l},(0,s.createElement)(qp,{value:oe,onChange:ie,parentLayout:r?.parentLayout})))}const hm=function(e){return(0,p.useRefEffect)((t=>{if(!e)return;function n(t){const{deltaX:n,deltaY:o}=t;e.current.scrollBy(n,o)}const o={passive:!0};return t.addEventListener("wheel",n,o),()=>{t.removeEventListener("wheel",n,o)}}),[e])},gm=Number.MAX_SAFE_INTEGER;const fm=(0,u.forwardRef)((function({clientId:e,bottomClientId:t,children:n,__unstableRefreshSize:o,__unstableCoverTarget:r=!1,__unstablePopoverSlot:l,__unstableContentRef:i,shift:a=!0,...c},d){const m=bd(e),h=bd(null!=t?t:e),g=(0,p.useMergeRefs)([d,hm(i)]),[f,b]=(0,u.useReducer)((e=>(e+1)%gm),0);(0,u.useLayoutEffect)((()=>{if(!m)return;const e=new window.MutationObserver(b);return e.observe(m,{attributes:!0}),()=>{e.disconnect()}}),[m]);const v=(0,u.useMemo)((()=>f<0||!m||h!==m?{}:{position:"absolute",width:m.offsetWidth,height:m.offsetHeight}),[m,h,o,f]),k=(0,u.useMemo)((()=>{if(!(f<0||!m||t&&!h))return{getBoundingClientRect(){var e,t,n,o;const r=m.getBoundingClientRect(),l=h?.getBoundingClientRect(),i=Math.min(r.left,null!==(e=l?.left)&&void 0!==e?e:1/0),s=Math.min(r.top,null!==(t=l?.top)&&void 0!==t?t:1/0),a=Math.max(r.right,null!==(n=l.right)&&void 0!==n?n:-1/0)-i,c=Math.max(r.bottom,null!==(o=l.bottom)&&void 0!==o?o:-1/0)-s;return new window.DOMRect(i,s,a,c)},contextElement:m}}),[t,h,m,f]);return!m||t&&!h?null:(0,s.createElement)(_l.Popover,{ref:g,animate:!1,focusOnMount:!1,anchor:k,__unstableSlotName:l,inline:!l,placement:"top-start",resize:!1,flip:!1,shift:a,...c,className:ml()("block-editor-block-popover",c.className),variant:"unstyled"},r&&(0,s.createElement)("div",{style:v},n),!r&&n)}));function bm(e,t){return e.ownerDocument.defaultView.getComputedStyle(e).getPropertyValue(t)}function vm({clientId:e,attributes:t,forceShow:n}){const o=bd(e),[r,l]=(0,u.useState)(),i=t?.style?.spacing?.margin;(0,u.useEffect)((()=>{if(!o||null===o.ownerDocument.defaultView)return;const e=bm(o,"margin-top"),t=bm(o,"margin-right"),n=bm(o,"margin-bottom"),r=bm(o,"margin-left");l({borderTopWidth:e,borderRightWidth:t,borderBottomWidth:n,borderLeftWidth:r,top:e?`-${e}`:0,right:t?`-${t}`:0,bottom:n?`-${n}`:0,left:r?`-${r}`:0})}),[o,i]);const[a,c]=(0,u.useState)(!1),d=(0,u.useRef)(i),p=(0,u.useRef)();return(0,u.useEffect)((()=>(js()(i,d.current)||n||(c(!0),d.current=i,p.current=setTimeout((()=>{c(!1)}),400)),()=>{c(!1),p.current&&window.clearTimeout(p.current)})),[i,n]),a||n?(0,s.createElement)(fm,{clientId:e,__unstableCoverTarget:!0,__unstableRefreshSize:i,__unstablePopoverSlot:"block-toolbar",shift:!1},(0,s.createElement)("div",{className:"block-editor__padding-visualizer",style:r})):null}function km(e,t){return e.ownerDocument.defaultView.getComputedStyle(e).getPropertyValue(t)}function _m({clientId:e,value:t,forceShow:n}){const o=bd(e),[r,l]=(0,u.useState)(),i=t?.spacing?.padding;(0,u.useEffect)((()=>{o&&null!==o.ownerDocument.defaultView&&l({borderTopWidth:km(o,"padding-top"),borderRightWidth:km(o,"padding-right"),borderBottomWidth:km(o,"padding-bottom"),borderLeftWidth:km(o,"padding-left")})}),[o,i]);const[a,c]=(0,u.useState)(!1),d=(0,u.useRef)(i),p=(0,u.useRef)();return(0,u.useEffect)((()=>(js()(i,d.current)||n||(c(!0),d.current=i,p.current=setTimeout((()=>{c(!1)}),400)),()=>{c(!1),p.current&&window.clearTimeout(p.current)})),[i,n]),a||n?(0,s.createElement)(fm,{clientId:e,__unstableCoverTarget:!0,__unstableRefreshSize:i,__unstablePopoverSlot:"block-toolbar",shift:!1},(0,s.createElement)("div",{className:"block-editor__padding-visualizer",style:r})):null}const ym="dimensions",Em="spacing";function wm({children:e,resetAllFilter:t}){const n=(0,u.useCallback)((e=>{const n=e.style,o=t(n);return{...e,style:o}}),[t]);return(0,s.createElement)(Bs,{group:"dimensions",resetAllFilter:n},e)}function Sm({clientId:e,name:t,setAttributes:n,settings:o}){const r=em(o),l=(0,d.useSelect)((t=>t(Nr).getBlockAttributes(e)?.style),[e]),[i,a]=function(){const[e,t]=(0,u.useState)(!1),{hideBlockInterface:n,showBlockInterface:o}=ie((0,d.useDispatch)(Nr));return(0,u.useEffect)((()=>{e?n():o()}),[e,o,n]),[e,t]}();if(!r)return null;const p={...(0,c.getBlockSupport)(t,[ym,"__experimentalDefaultControls"]),...(0,c.getBlockSupport)(t,[Em,"__experimentalDefaultControls"])};return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(mm,{as:wm,panelId:e,settings:o,value:l,onChange:e=>{n({style:hl(e)})},defaultControls:p,onVisualize:a}),!!o?.spacing?.padding&&(0,s.createElement)(_m,{forceShow:"padding"===i,clientId:e,value:l}),!!o?.spacing?.margin&&(0,s.createElement)(vm,{forceShow:"margin"===i,clientId:e,value:l}))}function Cm(e,t="any"){if("web"!==u.Platform.OS)return!1;const n=(0,c.getBlockSupport)(e,ym);return!0===n||("any"===t?!(!n?.aspectRatio&&!n?.minHeight):!!n?.[t])}const xm={useBlockProps:function({name:e,minHeight:t,style:n}){if(!Cm(e,"aspectRatio")||fl(e,ym,"aspectRatio"))return{};const o=ml()({"has-aspect-ratio":!!n?.dimensions?.aspectRatio}),r={};n?.dimensions?.aspectRatio?r.minHeight="unset":(t||n?.dimensions?.minHeight)&&(r.aspectRatio="unset");return{className:o,style:r}},attributeKeys:["minHeight","style"],hasSupport:e=>Cm(e,"aspectRatio")};function Bm(){w()("wp.blockEditor.__experimentalUseCustomSides",{since:"6.3",version:"6.4"})}const Im=[...Pp,Iu,_d,ym,tc,Em,Tu],Tm=e=>Im.some((t=>(0,c.hasBlockSupport)(e,t)));function Mm(e={}){const t={};return(0,Ri.getCSSRules)(e).forEach((e=>{t[e.key]=e.value})),t}const Pm={[`${Iu}.__experimentalSkipSerialization`]:["border"],[`${_d}.__experimentalSkipSerialization`]:[_d],[`${Mp}.__experimentalSkipSerialization`]:[Mp],[`${ym}.__experimentalSkipSerialization`]:[ym],[`${Em}.__experimentalSkipSerialization`]:[Em],[`${Tu}.__experimentalSkipSerialization`]:[Tu]},Rm={...Pm,[`${ym}.aspectRatio`]:[`${ym}.aspectRatio`],[`${tc}`]:[tc]},Nm={[`${ym}.aspectRatio`]:!0,[`${tc}`]:!0},Lm={gradients:"gradient"};function Am(e,t,n=!1){if(!e)return e;let o=e;return n||(o=JSON.parse(JSON.stringify(e))),Array.isArray(t)||(t=[t]),t.forEach((e=>{if(Array.isArray(e)||(e=e.split(".")),e.length>1){const[t,...n]=e;Am(o[t],[n],!0)}else 1===e.length&&delete o[e[0]]})),o}function Om(e,t,n,o=Rm){if(!Tm(t))return e;let{style:r}=n;return Object.entries(o).forEach((([e,n])=>{const o=Nm[e]||(0,c.getBlockSupport)(t,e);!0===o&&(r=Am(r,n)),Array.isArray(o)&&o.forEach((e=>{const t=Lm[e]||e;r=Am(r,[[...n,t]])}))})),e.style={...Mm(r),...e.style},e}const Dm={edit:function({clientId:e,name:t,setAttributes:n,__unstableParentLayout:o}){const r={clientId:e,name:t,setAttributes:n,settings:vl(t,o)};return"default"!==ns()?null:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Md,{...r}),(0,s.createElement)(pc,{...r}),(0,s.createElement)(Ap,{...r}),(0,s.createElement)(Ou,{...r}),(0,s.createElement)(Sm,{...r}))},hasSupport:Tm,addSaveProps:Om,attributeKeys:["style"],useBlockProps:function e({name:t,style:n}){const o=`wp-elements-${(0,p.useInstanceId)(e)}`,r=`.editor-styles-wrapper .${o}`,l=n?.elements,i=(0,u.useMemo)((()=>{if(!l)return;const e=[];return zm.forEach((({elementType:n,pseudo:o,elements:i})=>{if(fl(t,_d,n))return;const s=l?.[n];if(s){const t=tl(r,c.__EXPERIMENTAL_ELEMENTS[n]);e.push((0,Ri.compileCSS)(s,{selector:t})),o&&o.forEach((t=>{s[t]&&e.push((0,Ri.compileCSS)(s[t],{selector:tl(r,`${c.__EXPERIMENTAL_ELEMENTS[n]}${t}`)}))}))}i&&i.forEach((t=>{l[t]&&e.push((0,Ri.compileCSS)(l[t],{selector:tl(r,c.__EXPERIMENTAL_ELEMENTS[t])}))}))})),e.length>0?e.join(""):void 0}),[r,l,t]);return bl({css:i}),Om({className:o},t,{style:n},Pm)}},zm=[{elementType:"button"},{elementType:"link",pseudo:[":hover"]},{elementType:"heading",elements:["h1","h2","h3","h4","h5","h6"]}];(0,m.addFilter)("blocks.registerBlockType","core/style/addAttribute",(function(e){return Tm(e)?(e.attributes.style||Object.assign(e.attributes,{style:{type:"object"}}),e):e}));(0,m.addFilter)("blocks.registerBlockType","core/settings/addAttribute",(function(e){return t=e,(0,c.hasBlockSupport)(t,"__experimentalSettings",!1)?(e?.attributes?.settings||(e.attributes={...e.attributes,settings:{type:"object"}}),e):e;var t}));const Vm=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M12 4 4 19h16L12 4zm0 3.2 5.5 10.3H12V7.2z"}));const Fm=function e({id:t,colorPalette:n,duotonePalette:o,disableCustomColors:r,disableCustomDuotone:l,value:i,onChange:a}){let c;c="unset"===i?(0,s.createElement)(_l.ColorIndicator,{className:"block-editor-duotone-control__unset-indicator"}):i?(0,s.createElement)(_l.DuotoneSwatch,{values:i}):(0,s.createElement)(Ti,{icon:Vm});const u=(0,x.__)("Apply duotone filter"),d=`${(0,p.useInstanceId)(e,"duotone-control",t)}__description`;return(0,s.createElement)(_l.Dropdown,{popoverProps:{className:"block-editor-duotone-control__popover",headerTitle:(0,x.__)("Duotone")},renderToggle:({isOpen:e,onToggle:t})=>(0,s.createElement)(_l.ToolbarButton,{showTooltip:!0,onClick:t,"aria-haspopup":"true","aria-expanded":e,onKeyDown:n=>{e||n.keyCode!==zs.DOWN||(n.preventDefault(),t())},label:u,icon:c}),renderContent:()=>(0,s.createElement)(_l.MenuGroup,{label:(0,x.__)("Duotone")},(0,s.createElement)("p",null,(0,x.__)("Create a two-tone color effect without losing your original image.")),(0,s.createElement)(_l.DuotonePicker,{"aria-label":u,"aria-describedby":d,colorPalette:n,duotonePalette:o,disableCustomColors:r,disableCustomDuotone:l,value:i,onChange:a}))})};function Hm(e){return`${e}{filter:none}`}function Gm(e,t){return`${e}{filter:url(#${t})}`}function Um(e,t){const n=function(e=[]){const t={r:[],g:[],b:[],a:[]};return e.forEach((e=>{const n=Vc(e).toRgb();t.r.push(n.r/255),t.g.push(n.g/255),t.b.push(n.b/255),t.a.push(n.a)})),t}(t);return`\n<svg\n\txmlns:xlink="http://www.w3.org/1999/xlink"\n\tviewBox="0 0 0 0"\n\twidth="0"\n\theight="0"\n\tfocusable="false"\n\trole="none"\n\taria-hidden="true"\n\tstyle="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;"\n>\n\t<defs>\n\t\t<filter id="${e}">\n\t\t\t\x3c!--\n\t\t\t\tUse sRGB instead of linearRGB so transparency looks correct.\n\t\t\t\tUse perceptual brightness to convert to grayscale.\n\t\t\t--\x3e\n\t\t\t<feColorMatrix color-interpolation-filters="sRGB" type="matrix" values=" .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "></feColorMatrix>\n\t\t\t\x3c!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. --\x3e\n\t\t\t<feComponentTransfer color-interpolation-filters="sRGB">\n\t\t\t\t<feFuncR type="table" tableValues="${n.r.join(" ")}"></feFuncR>\n\t\t\t\t<feFuncG type="table" tableValues="${n.g.join(" ")}"></feFuncG>\n\t\t\t\t<feFuncB type="table" tableValues="${n.b.join(" ")}"></feFuncB>\n\t\t\t\t<feFuncA type="table" tableValues="${n.a.join(" ")}"></feFuncA>\n\t\t\t</feComponentTransfer>\n\t\t\t\x3c!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. --\x3e\n\t\t\t<feComposite in2="SourceGraphic" operator="in"></feComposite>\n\t\t</filter>\n\t</defs>\n</svg>`}function $m(e,t="root",n={}){if(!t)return null;const{fallback:o=!1}=n,{name:r,selectors:l,supports:i}=e,s=l&&Object.keys(l).length>0,a=Array.isArray(t)?t.join("."):t;let c=null;if(c=s&&l.root?l?.root:i?.__experimentalSelector?i.__experimentalSelector:".wp-block-"+r.replace("core/","").replace("/","-"),"root"===a)return c;const u=Array.isArray(t)?t:t.split(".");if(1===u.length){const e=o?c:null;if(s){return Wn(l,`${a}.root`,null)||Wn(l,a,null)||e}const t=Wn(i,`${a}.__experimentalSelector`,null);return t?tl(c,t):e}let d;return s&&(d=Wn(l,a,null)),d||(o?$m(e,u[0],n):null)}const jm=[];function Wm(e,{presetSetting:t,defaultSetting:n}){const o=!e?.color?.[n],r=e?.color?.[t]?.custom||jm,l=e?.color?.[t]?.theme||jm,i=e?.color?.[t]?.default||jm;return(0,u.useMemo)((()=>[...r,...l,...o?jm:i]),[o,r,l,i])}function Km(e){return Zm(e)}function Zm(e){return e.color.customDuotone||e.color.defaultDuotone||e.color.duotone.length>0}function qm({resetAllFilter:e,onChange:t,value:n,panelId:o,children:r}){return(0,s.createElement)(_l.__experimentalToolsPanel,{label:(0,x._x)("Filters","Name for applying graphical effects"),resetAll:()=>{const o=e(n);t(o)},panelId:o,dropdownMenuProps:Qr},r)}const Ym={duotone:!0},Xm={placement:"left-start",offset:36,shift:!0,className:"block-editor-duotone-control__popover",headerTitle:(0,x.__)("Duotone")},Qm=({indicator:e,label:t})=>(0,s.createElement)(_l.__experimentalHStack,{justify:"flex-start"},(0,s.createElement)(_l.__experimentalZStack,{isLayered:!1,offset:-8},(0,s.createElement)(_l.Flex,{expanded:!1},"unset"!==e&&e?(0,s.createElement)(_l.DuotoneSwatch,{values:e}):(0,s.createElement)(_l.ColorIndicator,{className:"block-editor-duotone-control__unset-indicator"}))),(0,s.createElement)(_l.FlexItem,{title:t},t));function Jm({as:e=qm,value:t,onChange:n,inheritedValue:o=t,settings:r,panelId:l,defaultControls:i=Ym}){const a=Zm(r),c=Wm(r,{presetSetting:"duotone",defaultSetting:"defaultDuotone"}),d=Wm(r,{presetSetting:"palette",defaultSetting:"defaultPalette"}),p=(m=o?.filter?.duotone,el({settings:r},"",m));var m;const h=e=>{const o=c.find((({colors:t})=>t===e)),r=o?`var:preset|duotone|${o.slug}`:e;n(jn(t,["filter","duotone"],r))},g=(0,u.useCallback)((e=>({...e,filter:{...e.filter,duotone:void 0}})),[]);return(0,s.createElement)(e,{resetAllFilter:g,value:t,onChange:n,panelId:l},a&&(0,s.createElement)(_l.__experimentalToolsPanelItem,{label:(0,x.__)("Duotone"),hasValue:()=>!!t?.filter?.duotone,onDeselect:()=>h(void 0),isShownByDefault:i.duotone,panelId:l},(0,s.createElement)(_l.Dropdown,{popoverProps:Xm,className:"block-editor-global-styles-filters-panel__dropdown",renderToggle:({onToggle:e,isOpen:t})=>{const n={onClick:e,className:ml()({"is-open":t}),"aria-expanded":t};return(0,s.createElement)(_l.__experimentalItemGroup,{isBordered:!0,isSeparated:!0},(0,s.createElement)(_l.Button,{...n},(0,s.createElement)(Qm,{indicator:p,label:(0,x.__)("Duotone")})))},renderContent:()=>(0,s.createElement)(_l.__experimentalDropdownContentWrapper,{paddingSize:"small"},(0,s.createElement)(_l.MenuGroup,{label:(0,x.__)("Duotone")},(0,s.createElement)("p",null,(0,x.__)("Create a two-tone color effect without losing your original image.")),(0,s.createElement)(_l.DuotonePicker,{colorPalette:d,duotonePalette:c,disableCustomColors:!0,disableCustomDuotone:!0,value:p,onChange:h})))})))}const eh=[],th=window?.navigator.userAgent&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&!window.navigator.userAgent.includes("Chromium");function nh({presetSetting:e,defaultSetting:t}){const[n,o,r,l]=Ar(t,`${e}.custom`,`${e}.theme`,`${e}.default`);return(0,u.useMemo)((()=>[...o||eh,...r||eh,...n&&l||eh]),[n,o,r,l])}function oh(e,t){if(!e)return;const n=t?.find((({slug:t})=>e===`var:preset|duotone|${t}`));return n?n.colors:void 0}Hc([Gc]);const rh={shareWithChildBlocks:!0,edit:function({style:e,setAttributes:t,name:n}){const o=e?.color?.duotone,r=vl(n),l=ns(),i=nh({presetSetting:"color.duotone",defaultSetting:"color.defaultDuotone"}),a=nh({presetSetting:"color.palette",defaultSetting:"color.defaultPalette"}),[c,u]=Ar("color.custom","color.customDuotone"),d=!c,p=!u||0===a?.length&&d;if(0===i?.length&&p)return null;if("default"!==l)return null;const m=Array.isArray(o)?o:oh(o,i);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Bs,{group:"filter"},(0,s.createElement)(Jm,{value:{filter:{duotone:m}},onChange:n=>{const o={...e,color:{...n?.filter}};t({style:o})},settings:r})),(0,s.createElement)(Bl,{group:"block",__experimentalShareWithChildBlocks:!0},(0,s.createElement)(Fm,{duotonePalette:i,colorPalette:a,disableCustomDuotone:p,disableCustomColors:d,value:m,onChange:n=>{const o=function(e,t){if(!e||!Array.isArray(e))return;const n=t?.find((t=>t?.colors?.every(((t,n)=>t===e[n]))));return n?`var:preset|duotone|${n.slug}`:void 0}(n,i),r={...e,color:{...e?.color,duotone:null!=o?o:n}};t({style:r})},settings:r})))},useBlockProps:function e({name:t,style:n}){const o=(0,p.useInstanceId)(e),r=(0,u.useMemo)((()=>{const e=(0,c.getBlockType)(t);if(e){if(!(0,c.getBlockSupport)(e,"filter.duotone",!1))return null;const t=(0,c.getBlockSupport)(e,"color.__experimentalDuotone",!1);if(t){const n=$m(e);return"string"==typeof t?tl(n,t):n}return $m(e,"filter.duotone",{fallback:!0})}}),[t]),l=n?.color?.duotone,i=`wp-duotone-${o}`,s=r&&l;return lh({clientId:o,id:i,selector:r,attribute:l}),{className:s?i:""}},attributeKeys:["style"],hasSupport:e=>(0,c.hasBlockSupport)(e,"filter.duotone")};function lh({clientId:e,id:t,selector:n,attribute:o}){const r=nh({presetSetting:"color.duotone",defaultSetting:"color.defaultDuotone"}),l=Array.isArray(o),i=l?void 0:oh(o,r),s="string"==typeof o&&i;let a=null;s?a=i:("string"==typeof o&&!s||l)&&(a=o);const c=n.split(",").map((e=>`.${t}${e.trim()}`)).join(", "),d=Array.isArray(a)||"unset"===a;bl(d?{css:"unset"!==a?Gm(c,t):Hm(c),__unstableType:"presets"}:void 0),bl(d?{assets:"unset"!==a?Um(t,a):"",__unstableType:"svgs"}:void 0);const p=bd(e);(0,u.useEffect)((()=>{if(d&&p&&th){const e=p.style.display;p.style.display="inline-block",p.offsetHeight,p.style.display=e}}),[d,p])}function ih(e){return(0,d.useSelect)((t=>{if(!e)return null;const{getBlockName:n,getBlockAttributes:o,__experimentalGetReusableBlockTitle:r}=t(Nr),{getBlockType:l,getActiveBlockVariation:i}=t(c.store),s=n(e),a=l(s);if(!a)return null;const u=o(e),d=i(s,u),p=(0,c.isReusableBlock)(a),m=(p?r(u.ref):void 0)||a.title,h=p||(0,c.isTemplatePart)(a),g=function(e){const t=e?.style?.position?.type;return"sticky"===t?(0,x.__)("Sticky"):"fixed"===t?(0,x.__)("Fixed"):null}(u),f={isSynced:h,title:m,icon:a.icon,description:a.description,anchor:u?.anchor,positionLabel:g,positionType:u?.style?.position?.type,name:u?.metadata?.name};return d?{isSynced:h,title:d.title||a.title,icon:d.icon||a.icon,description:d.description||a.description,anchor:u?.anchor,positionLabel:g,positionType:u?.style?.position?.type,name:u?.metadata?.name}:f}),[e])}(0,m.addFilter)("blocks.registerBlockType","core/editor/duotone/add-attributes",(function(e){return(0,c.hasBlockSupport)(e,"filter.duotone")?(e.attributes.style||Object.assign(e.attributes,{style:{type:"object"}}),e):e}));const{CustomSelectControl:sh}=ie(_l.privateApis),ah="position",ch="block-editor-hooks__position-selection__select-control__option",uh={key:"default",value:"",name:(0,x.__)("Default"),className:ch},dh={key:"sticky",value:"sticky",name:(0,x._x)("Sticky","Name for the value of the CSS position property"),className:ch,__experimentalHint:(0,x.__)("The block will stick to the top of the window instead of scrolling.")},ph={key:"fixed",value:"fixed",name:(0,x._x)("Fixed","Name for the value of the CSS position property"),className:ch,__experimentalHint:(0,x.__)("The block will not move when the page is scrolled.")},mh=["top","right","bottom","left"],hh=["sticky","fixed"];function gh(e){const t=e.style?.position?.type;return"sticky"===t||"fixed"===t}function fh({name:e}={}){const[t,n]=Ar("position.fixed","position.sticky"),o=!t&&!n;return r=e,!(0,c.getBlockSupport)(r,ah)||o;var r}function bh({style:e={},clientId:t,name:n,setAttributes:o}){const r=function(e){const t=(0,c.getBlockSupport)(e,ah);return!(!0!==t&&!t?.fixed)}(n),l=function(e){const t=(0,c.getBlockSupport)(e,ah);return!(!0!==t&&!t?.sticky)}(n),i=e?.position?.type,{firstParentClientId:a}=(0,d.useSelect)((e=>{const{getBlockParents:n}=e(Nr),o=n(t);return{firstParentClientId:o[o.length-1]}}),[t]),p=ih(a),m=l&&i===dh.value&&p?(0,x.sprintf)((0,x.__)("The block will stick to the scrollable area of the parent %s block."),p.title):null,h=(0,u.useMemo)((()=>{const e=[uh];return(l||i===dh.value)&&e.push(dh),(r||i===ph.value)&&e.push(ph),e}),[r,l,i]),g=i&&h.find((e=>e.value===i))||uh;return u.Platform.select({web:h.length>1?(0,s.createElement)(Bs,{group:"position"},(0,s.createElement)(_l.BaseControl,{className:"block-editor-hooks__position-selection",__nextHasNoMarginBottom:!0,help:m},(0,s.createElement)(sh,{__nextUnconstrainedWidth:!0,__next40pxDefaultSize:!0,className:"block-editor-hooks__position-selection__select-control",label:(0,x.__)("Position"),hideLabelFromVision:!0,describedBy:(0,x.sprintf)((0,x.__)("Currently selected position: %s"),g.name),options:h,value:g,__experimentalShowSelectedHint:!0,onChange:({selectedItem:t})=>{(t=>{const n={...e,position:{...e?.position,type:t,top:"sticky"===t||"fixed"===t?"0px":void 0}};o({style:hl(n)})})(t.value)},size:"__unstable-large"}))):null,native:null})}const vh={edit:function(e){return fh(e)?null:(0,s.createElement)(bh,{...e})},useBlockProps:function e({name:t,style:n}){const o=(0,c.hasBlockSupport)(t,ah),r=fh({name:t}),l=o&&!r,i=(0,p.useInstanceId)(e),s=`.wp-container-${i}.wp-container-${i}`;let a;l&&(a=function({selector:e,style:t}){let n="";const{type:o}=t?.position||{};return hh.includes(o)?(n+=`${e} {`,n+=`position: ${o};`,mh.forEach((e=>{void 0!==t?.position?.[e]&&(n+=`${e}: ${t.position[e]};`)})),"sticky"!==o&&"fixed"!==o||(n+="z-index: 10"),n+="}",n):n}({selector:s,style:n})||"");const u=ml()({[`wp-container-${i}`]:l&&!!a,[`is-position-${n?.position?.type}`]:l&&!!a&&!!n?.position?.type});return bl({css:a}),{className:u}},attributeKeys:["style"],hasSupport:e=>(0,c.hasBlockSupport)(e,ah)};const kh="layout";function _h(e){return(0,c.hasBlockSupport)(e,"layout")||(0,c.hasBlockSupport)(e,"__experimentalLayout")}function yh(e={},t=""){const{kebabCase:n}=ie(_l.privateApis),o=(0,d.useSelect)((e=>{const{getSettings:t}=e(Nr);return t().__experimentalFeatures?.useRootPaddingAwareAlignments}),[]),{layout:r}=e,{default:l}=(0,c.getBlockSupport)(t,kh)||{},i=r?.inherit||r?.contentSize||r?.wideSize?{...r,type:"constrained"}:r||l||{},s=[];if(Al[i?.type||"default"]?.className){const e=Al[i?.type||"default"]?.className,n=t.split("/"),o=`wp-block-${"core"===n[0]?n.pop():n.join("-")}-${e}`;s.push(e,o)}return(i?.inherit||i?.contentSize||"constrained"===i?.type)&&o&&s.push("has-global-padding"),i?.orientation&&s.push(`is-${n(i.orientation)}`),i?.justifyContent&&s.push(`is-content-justification-${n(i.justifyContent)}`),i?.flexWrap&&"nowrap"===i.flexWrap&&s.push("is-nowrap"),s}const Eh={shareWithChildBlocks:!0,edit:function({layout:e,setAttributes:t,name:n}){const o=vl(n),{layout:r}=o,[l]=Ar("layout"),{themeSupportsLayout:i}=(0,d.useSelect)((e=>{const{getSettings:t}=e(Nr);return{themeSupportsLayout:t().supportsLayout}}),[]);if("default"!==ns())return null;const a=(0,c.getBlockSupport)(n,kh,{}),u={...r,...a},{allowSwitching:p,allowEditing:m=!0,allowInheriting:h=!0,default:g}=u;if(!m)return null;const f=!(!h||!l||e?.type&&"default"!==e?.type&&"constrained"!==e?.type&&!e?.inherit),b=e||g||{},{inherit:v=!1,type:k="default",contentSize:_=null}=b;if(("default"===k||"constrained"===k)&&!i)return null;const y=Vi(k),E=Vi("constrained"),w=!b.type&&(_||v),S=!!v||!!_,C=e=>t({layout:e});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Bs,null,(0,s.createElement)(_l.PanelBody,{title:(0,x.__)("Layout")},f&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.ToggleControl,{__nextHasNoMarginBottom:!0,className:"block-editor-hooks__toggle-control",label:(0,x.__)("Inner blocks use content width"),checked:"constrained"===y?.name||S,onChange:()=>t({layout:{type:"constrained"===y?.name||S?"default":"constrained"}}),help:"constrained"===y?.name||S?(0,x.__)("Nested blocks use content width with options for full and wide widths."):(0,x.__)("Nested blocks will fill the width of this container. Toggle to constrain.")})),!v&&p&&(0,s.createElement)(wh,{type:k,onChange:e=>t({layout:{type:e}})}),y&&"default"!==y.name&&(0,s.createElement)(y.inspectorControls,{layout:b,onChange:C,layoutBlockSupport:u}),E&&w&&(0,s.createElement)(E.inspectorControls,{layout:b,onChange:C,layoutBlockSupport:u}))),!v&&y&&(0,s.createElement)(y.toolBarControls,{layout:b,onChange:C,layoutBlockSupport:a}))},attributeKeys:["layout"],hasSupport:e=>_h(e)};function wh({type:e,onChange:t}){return(0,s.createElement)(_l.ButtonGroup,null,zi.map((({name:n,label:o})=>(0,s.createElement)(_l.Button,{key:n,isPressed:e===n,onClick:()=>t(n)},o))))}function Sh({block:e,props:t,layoutClasses:n}){const{name:o,attributes:r}=t,l=(0,p.useInstanceId)(e),{layout:i}=r,{default:a}=(0,c.getBlockSupport)(o,kh)||{},u=i?.inherit||i?.contentSize||i?.wideSize?{...i,type:"constrained"}:i||a||{},{kebabCase:d}=ie(_l.privateApis),m=`wp-container-${d(o)}-is-layout-`,h=`.${m}${l}.${m}${l}`,[g]=Ar("spacing.blockGap"),f=null!==g,b=Vi(u?.type||"default"),v=b?.getLayoutStyle?.({blockName:o,selector:h,layout:u,style:r?.style,hasBlockGapSupport:f}),k=ml()({[`${m}${l}`]:!!v},n);return bl({css:v}),(0,s.createElement)(e,{...t,__unstableLayoutClassNames:k})}const Ch=(0,p.createHigherOrderComponent)((e=>t=>{const{name:n,attributes:o}=t,r=_h(t.name),l=yh(o,n);return(0,d.useSelect)((e=>!!r&&!e(Nr).getSettings().disableLayoutStyles),[r])?(0,s.createElement)(Sh,{block:e,props:t,layoutClasses:l}):(0,s.createElement)(e,{...t,__unstableLayoutClassNames:r?l:void 0})}),"withLayoutStyles");(0,m.addFilter)("blocks.registerBlockType","core/layout/addAttribute",(function(e){var t;return"type"in(null!==(t=e.attributes?.layout)&&void 0!==t?t:{})||_h(e)&&(e.attributes={...e.attributes,layout:{type:"object"}}),e})),(0,m.addFilter)("editor.BlockListBlock","core/editor/layout/with-layout-styles",Ch);const xh={useBlockProps:function e({style:t}){var n;const o=(0,d.useSelect)((e=>!e(Nr).getSettings().disableLayoutStyles)),r=null!==(n=t?.layout)&&void 0!==n?n:{},{selfStretch:l,flexSize:i}=r,s=(0,p.useInstanceId)(e),a=`.wp-container-content-${s}`;let c="";if(o&&("fixed"===l&&i?c=`${a} {\n\t\t\t\tflex-basis: ${i};\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`:"fill"===l&&(c=`${a} {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`)),bl({css:c}),c)return{className:`wp-container-content-${s}`}},attributeKeys:["style"],hasSupport:()=>!0};function Bh(e){return(0,d.useSelect)((t=>{const{getBlocksByClientId:n,getSelectedBlockClientIds:o,isUngroupable:r,isGroupable:l}=t(Nr),{getGroupingBlockName:i,getBlockType:s}=t(c.store),a=e?.length?e:o(),u=n(a),[d]=u,p=1===a.length&&r(a[0]);return{clientIds:a,isGroupable:l(a),isUngroupable:p,blocksSelection:u,groupingBlockName:i(),onUngroup:p&&s(d.name)?.transforms?.ungroup}}),[e])}function Ih({clientIds:e,isGroupable:t,isUngroupable:n,onUngroup:o,blocksSelection:r,groupingBlockName:l,onClose:i=(()=>{})}){const{replaceBlocks:a}=(0,d.useDispatch)(Nr);return t||n?(0,s.createElement)(s.Fragment,null,t&&(0,s.createElement)(_l.MenuItem,{onClick:()=>{(()=>{const t=(0,c.switchToBlockType)(r,l);t&&a(e,t)})(),i()}},(0,x._x)("Group","verb")),n&&(0,s.createElement)(_l.MenuItem,{onClick:()=>{(()=>{let t=r[0].innerBlocks;t.length&&(o&&(t=o(r[0].attributes,r[0].innerBlocks)),a(e,t))})(),i()}},(0,x._x)("Ungroup","Ungrouping blocks from within a grouping block back into individual blocks within the Editor "))):null}function Th(e){return(0,d.useSelect)((t=>{const{canEditBlock:n,canMoveBlock:o,canRemoveBlock:r,canLockBlockType:l,getBlockName:i,getBlockRootClientId:s,getTemplateLock:a}=t(Nr),c=s(e),u=n(e),d=o(e,c),p=r(e,c);return{canEdit:u,canMove:d,canRemove:p,canLock:l(i(e)),isContentLocked:"contentOnly"===a(e),isLocked:!u||!d||!p}}),[e])}const Mh=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.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"})),Ph=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.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-1zM9.8 7c0-1.2 1-2.2 2.2-2.2 1.2 0 2.2 1 2.2 2.2v3H9.8V7zm6.7 11.5h-9v-7h9v7z"})),Rh=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.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"})),Nh=["core/block","core/navigation"];function Lh(e){return e.remove&&e.move?"all":!(!e.remove||e.move)&&"insert"}function Ah({clientId:e,onClose:t}){const[n,o]=(0,u.useState)({move:!1,remove:!1}),{canEdit:r,canMove:l,canRemove:i}=Th(e),{allowsEditLocking:a,templateLock:m,hasTemplateLock:h}=(0,d.useSelect)((t=>{const{getBlockName:n,getBlockAttributes:o}=t(Nr),r=n(e),l=(0,c.getBlockType)(r);return{allowsEditLocking:Nh.includes(r),templateLock:o(e)?.templateLock,hasTemplateLock:!!l?.attributes?.templateLock}}),[e]),[g,f]=(0,u.useState)(!!m),{updateBlockAttributes:b}=(0,d.useDispatch)(Nr),v=ih(e),k=(0,p.useInstanceId)(Ah,"block-editor-block-lock-modal__options-title");(0,u.useEffect)((()=>{o({move:!l,remove:!i,...a?{edit:!r}:{}})}),[r,l,i,a]);const _=Object.values(n).every(Boolean),y=Object.values(n).some(Boolean)&&!_;return(0,s.createElement)(_l.Modal,{title:(0,x.sprintf)((0,x.__)("Lock %s"),v.title),overlayClassName:"block-editor-block-lock-modal",onRequestClose:t},(0,s.createElement)("p",null,(0,x.__)("Choose specific attributes to restrict or lock all available options.")),(0,s.createElement)("form",{onSubmit:o=>{o.preventDefault(),b([e],{lock:n,templateLock:g?Lh(n):void 0}),t()}},(0,s.createElement)("div",{role:"group","aria-labelledby":k,className:"block-editor-block-lock-modal__options"},(0,s.createElement)(_l.CheckboxControl,{__nextHasNoMarginBottom:!0,className:"block-editor-block-lock-modal__options-title",label:(0,s.createElement)("span",{id:k},(0,x.__)("Lock all")),checked:_,indeterminate:y,onChange:e=>o({move:e,remove:e,...a?{edit:e}:{}})}),(0,s.createElement)("ul",{className:"block-editor-block-lock-modal__checklist"},a&&(0,s.createElement)("li",{className:"block-editor-block-lock-modal__checklist-item"},(0,s.createElement)(_l.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Restrict editing"),checked:!!n.edit,onChange:e=>o((t=>({...t,edit:e})))}),(0,s.createElement)(_l.Icon,{className:"block-editor-block-lock-modal__lock-icon",icon:n.edit?Rh:Mh})),(0,s.createElement)("li",{className:"block-editor-block-lock-modal__checklist-item"},(0,s.createElement)(_l.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Disable movement"),checked:n.move,onChange:e=>o((t=>({...t,move:e})))}),(0,s.createElement)(_l.Icon,{className:"block-editor-block-lock-modal__lock-icon",icon:n.move?Rh:Mh})),(0,s.createElement)("li",{className:"block-editor-block-lock-modal__checklist-item"},(0,s.createElement)(_l.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Prevent removal"),checked:n.remove,onChange:e=>o((t=>({...t,remove:e})))}),(0,s.createElement)(_l.Icon,{className:"block-editor-block-lock-modal__lock-icon",icon:n.remove?Rh:Mh}))),h&&(0,s.createElement)(_l.ToggleControl,{__nextHasNoMarginBottom:!0,className:"block-editor-block-lock-modal__template-lock",label:(0,x.__)("Apply to all blocks inside"),checked:g,disabled:n.move&&!n.remove,onChange:()=>f(!g)})),(0,s.createElement)(_l.Flex,{className:"block-editor-block-lock-modal__actions",justify:"flex-end",expanded:!1},(0,s.createElement)(_l.FlexItem,null,(0,s.createElement)(_l.Button,{variant:"tertiary",onClick:t},(0,x.__)("Cancel"))),(0,s.createElement)(_l.FlexItem,null,(0,s.createElement)(_l.Button,{variant:"primary",type:"submit"},(0,x.__)("Apply"))))))}function Oh({clientId:e}){const{canLock:t,isLocked:n}=Th(e),[o,r]=(0,u.useReducer)((e=>!e),!1);if(!t)return null;const l=n?(0,x.__)("Unlock"):(0,x.__)("Lock");return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.MenuItem,{icon:n?Mh:Ph,onClick:r,"aria-expanded":o,"aria-haspopup":"dialog"},l),o&&(0,s.createElement)(Ah,{clientId:e,onClose:r}))}const Dh=()=>{};const zh=(0,p.compose)([(0,d.withSelect)(((e,{clientId:t})=>{const{getBlock:n,getBlockMode:o,getSettings:r}=e(Nr),l=n(t),i=r().codeEditingEnabled;return{mode:o(t),blockType:l?(0,c.getBlockType)(l.name):null,isCodeEditingEnabled:i}})),(0,d.withDispatch)(((e,{onToggle:t=Dh,clientId:n})=>({onToggleMode(){e(Nr).toggleBlockMode(n),t()}})))])((function({blockType:e,mode:t,onToggleMode:n,small:o=!1,isCodeEditingEnabled:r=!0}){if(!e||!(0,c.hasBlockSupport)(e,"html",!0)||!r)return null;const l="visual"===t?(0,x.__)("Edit as HTML"):(0,x.__)("Edit visually");return(0,s.createElement)(_l.MenuItem,{onClick:n},!o&&l)}));function Vh(e){return 0===e?.trim()?.length}function Fh({blockName:e,originalBlockName:t,onClose:n,onSave:o}){const[r,l]=(0,u.useState)(e),i=r!==e,a=r===t,c=Vh(r),d=i||a,m=(0,p.useInstanceId)(Fh,"block-editor-rename-modal__description");return(0,s.createElement)(_l.Modal,{title:(0,x.__)("Rename"),onRequestClose:n,overlayClassName:"block-editor-block-rename-modal",aria:{describedby:m},focusOnMount:"firstContentElement"},(0,s.createElement)("p",{id:m},(0,x.__)("Enter a custom name for this block.")),(0,s.createElement)("form",{onSubmit:e=>{e.preventDefault(),d&&(()=>{const e=a||c?(0,x.sprintf)((0,x.__)('Block name reset to: "%s".'),r):(0,x.sprintf)((0,x.__)('Block name changed to: "%s".'),r);(0,vo.speak)(e,"assertive"),o(r),n()})()}},(0,s.createElement)(_l.__experimentalVStack,{spacing:"3"},(0,s.createElement)(_l.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:r,label:(0,x.__)("Block name"),hideLabelFromVision:!0,placeholder:t,onChange:l,onFocus:e=>e.target.select()}),(0,s.createElement)(_l.__experimentalHStack,{justify:"right"},(0,s.createElement)(_l.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:n},(0,x.__)("Cancel")),(0,s.createElement)(_l.Button,{__next40pxDefaultSize:!0,"aria-disabled":!d,variant:"primary",type:"submit"},(0,x.__)("Save"))))))}function Hh({clientId:e}){const[t,n]=(0,u.useState)(!1),{metadata:o}=(0,d.useSelect)((t=>{const{getBlockAttributes:n}=t(Nr),o=n(e)?.metadata;return{metadata:o}}),[e]),{updateBlockAttributes:r}=(0,d.useDispatch)(Nr),l=o?.name;const i=ih(e);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.MenuItem,{onClick:()=>{n(!0)},"aria-expanded":t,"aria-haspopup":"dialog"},(0,x.__)("Rename")),t&&(0,s.createElement)(Fh,{blockName:l||"",originalBlockName:i?.title,onClose:()=>n(!1),onSave:t=>{(t===i?.title||Vh(t))&&(t=void 0),function(t){r([e],{metadata:{...o&&o,name:t}})}(t)}}))}const{Fill:Gh,Slot:Uh}=(0,_l.createSlotFill)("BlockSettingsMenuControls");function $h({...e}){return(0,s.createElement)(_l.__experimentalStyleProvider,{document},(0,s.createElement)(Gh,{...e}))}$h.Slot=({fillProps:e,clientIds:t=null,__unstableDisplayLocation:n})=>{const{selectedBlocks:o,selectedClientIds:r}=(0,d.useSelect)((e=>{const{getBlockNamesByClientId:n,getSelectedBlockClientIds:o}=e(Nr),r=null!==t?t:o();return{selectedBlocks:n(r),selectedClientIds:r}}),[t]),{canLock:l}=Th(r[0]),{canRename:i}=(a=o[0],{canRename:(0,c.getBlockSupport)(a,"renaming",!0)});var a;const u=1===r.length&&l,m=1===r.length&&i,h=Bh(r),{isGroupable:g,isUngroupable:f}=h,b=g||f;return(0,s.createElement)(Uh,{fillProps:{...e,__unstableDisplayLocation:n,selectedBlocks:o,selectedClientIds:r}},(t=>!t?.length>0&&!b&&!u?null:(0,s.createElement)(_l.MenuGroup,null,b&&(0,s.createElement)(Ih,{...h,onClose:e?.onClose}),u&&(0,s.createElement)(Oh,{clientId:r[0]}),m&&(0,s.createElement)(Hh,{clientId:r[0]}),t,e?.canMove&&!e?.onlyBlock&&(0,s.createElement)(_l.MenuItem,{onClick:(0,p.pipe)(e?.onClose,e?.onMoveTo)},(0,x.__)("Move to")),1===e?.count&&(0,s.createElement)(zh,{clientId:e?.firstBlockClientId,onToggle:e?.onClose}))))};const jh=$h;const Wh={edit:function({clientId:e,isSelected:t}){const{getBlockListSettings:n,getSettings:o}=(0,d.useSelect)(Nr),{templateLock:r,isLockedByParent:l,isEditingAsBlocks:i}=(0,d.useSelect)((t=>{const{__unstableGetContentLockingParent:n,getTemplateLock:o,__unstableGetTemporarilyEditingAsBlocks:r}=t(Nr);return{templateLock:o(e),isLockedByParent:!!n(e),isEditingAsBlocks:r()===e}}),[e]),{updateSettings:a,updateBlockListSettings:c,__unstableSetTemporarilyEditingAsBlocks:p}=(0,d.useDispatch)(Nr),{stopEditingAsBlocks:m}=ie((0,d.useDispatch)(Nr)),h=!l&&"contentOnly"===r,{__unstableMarkNextChangeAsNotPersistent:g,updateBlockAttributes:f}=(0,d.useDispatch)(Nr),b=(0,u.useCallback)((()=>{m(e)}),[e,m]);if(!h&&!i)return null;const v=i&&!h,k=!i&&h&&t;return(0,s.createElement)(s.Fragment,null,v&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Bl,{group:"other"},(0,s.createElement)(_l.ToolbarButton,{onClick:b},(0,x.__)("Done")))),k&&(0,s.createElement)(jh,null,(({onClose:t})=>(0,s.createElement)(_l.MenuItem,{onClick:()=>{g(),f(e,{templateLock:void 0}),c(e,{...n(e),templateLock:!1});const r=o().focusMode;a({focusMode:!0}),p(e,r),t()}},(0,x.__)("Modify")))))},hasSupport:()=>!0},Kh="metadata";(0,m.addFilter)("blocks.registerBlockType","core/metadata/addMetaAttribute",(function(e){return e?.attributes?.[Kh]?.type||(e.attributes={...e.attributes,[Kh]:{type:"object"}}),e}));const Zh=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"}));const qh=(0,u.memo)((function({icon:e,showColors:t=!1,className:n,context:o}){"block-default"===e?.src&&(e={src:Zh});const r=(0,s.createElement)(_l.Icon,{icon:e&&e.src?e.src:e,context:o}),l=t?{backgroundColor:e&&e.background,color:e&&e.foreground}:{};return(0,s.createElement)("span",{style:l,className:ml()("block-editor-block-icon",n,{"has-colors":t})},r)})),Yh={};const Xh={edit:function({name:e,clientId:t,metadata:{ignoredHookedBlocks:n=[]}={}}){const o=(0,d.useSelect)((e=>e(c.store).getBlockTypes()),[]),r=(0,u.useMemo)((()=>o?.filter((({name:t,blockHooks:o})=>o&&e in o||n.includes(t)))),[o,e,n]),{blockIndex:l,rootClientId:i,innerBlocksLength:a}=(0,d.useSelect)((e=>{const{getBlocks:n,getBlockIndex:o,getBlockRootClientId:r}=e(Nr);return{blockIndex:o(t),innerBlocksLength:n(t)?.length,rootClientId:r(t)}}),[t]),p=(0,d.useSelect)((n=>{const{getBlocks:o,getGlobalBlockCount:l}=n(Nr),s=r.reduce(((n,r)=>{if(0===l(r.name))return n;const s=r?.blockHooks?.[e];let a;switch(s){case"before":case"after":a=o(i);break;case"first_child":case"last_child":a=o(t);break;case void 0:a=[...o(i),...o(t)]}const c=a?.find((e=>e.name===r.name));return c?{...n,[r.name]:c.clientId}:n}),{});return Object.values(s).length>0?s:Yh}),[r,e,t,i]),{insertBlock:m,removeBlock:h}=(0,d.useDispatch)(Nr);if(!r.length)return null;const g=r.reduce(((e,t)=>{const[n]=t.name.split("/");return e[n]||(e[n]=[]),e[n].push(t),e}),{});return(0,s.createElement)(Bs,null,(0,s.createElement)(_l.PanelBody,{className:"block-editor-hooks__block-hooks",title:(0,x.__)("Plugins"),initialOpen:!0},(0,s.createElement)("p",{className:"block-editor-hooks__block-hooks-helptext"},(0,x.__)("Manage the inclusion of blocks added automatically by plugins.")),Object.keys(g).map((n=>(0,s.createElement)(u.Fragment,{key:n},(0,s.createElement)("h3",null,n),g[n].map((n=>{const o=n.name in p;return(0,s.createElement)(_l.ToggleControl,{checked:o,key:n.title,label:(0,s.createElement)(_l.__experimentalHStack,{justify:"flex-start"},(0,s.createElement)(qh,{icon:n.icon}),(0,s.createElement)("span",null,n.title)),onChange:()=>{if(o)h(p[n.name],!1);else{const o=n.blockHooks[e];((e,n)=>{switch(n){case"before":case"after":m(e,"after"===n?l+1:l,i,!1);break;case"first_child":case"last_child":m(e,"first_child"===n?0:a,t,!1);break;case void 0:m(e,l+1,i,!1)}})((0,c.createBlock)(n.name),o)}}})})))))))},attributeKeys:["metadata"],hasSupport:()=>!0};const Qh={edit:function({metadata:e,setAttributes:t}){return(0,s.createElement)(Bs,{group:"advanced"},(0,s.createElement)(_l.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,x.__)("Block name"),value:e?.name||"",onChange:n=>{t({metadata:{...e,name:n}})}}))},attributeKeys:["metadata"],hasSupport:e=>(0,c.hasBlockSupport)(e,"renaming",!0)};(0,m.addFilter)("blocks.registerBlockType","core/metadata/addLabelCallback",(function(e){return e.__experimentalLabel||(0,c.hasBlockSupport)(e,"renaming",!0)&&(e.__experimentalLabel=(e,{context:t})=>{const{metadata:n}=e;if("list-view"===t&&n?.name)return n.name}),e}));const Jh={"core/paragraph":["content"],"core/heading":["content"],"core/image":["url","title","alt"],"core/button":["url","text","linkTarget"]};function eg(e){return e in Jh}const tg=({args:e,attrName:t,blockProps:n,source:o,onPropValueChange:r})=>{const{placeholder:l,value:i}=o.useSource(n,e),{name:s}=n,a=n.attributes[t],d=(0,u.useCallback)(((e,n)=>{if(n instanceof Y.RichTextData){if(n.toHTMLString()===e)return;e=Y.RichTextData.fromHTMLString(e)}n!==e&&r({[t]:e})}),[t,r]);return(0,u.useLayoutEffect)((()=>{if(void 0!==i)d(i,a);else if(l){const e=(0,c.getBlockType)(s).attributes[t].attribute;if("src"===e||"href"===e)return void d(null);d(l)}}),[d,i,a,l,s,t]),null};function ng({blockProps:e,bindings:t,onPropValueChange:n}){const o=ie((0,d.useSelect)(c.store)).getAllBlockBindingsSources();return(0,s.createElement)(s.Fragment,null,Object.entries(t).map((([t,r])=>{const l=o[r.source];return l?.useSource?(0,s.createElement)(tg,{key:t,attrName:t,source:l,blockProps:e,args:r.args,onPropValueChange:n}):null})))}const og=(0,p.createHigherOrderComponent)((e=>t=>{const[n,o]=(0,u.useState)({}),r=(0,u.useCallback)((e=>o((t=>({...t,...e})))),[]),l=Object.fromEntries(Object.entries(t.attributes.metadata?.bindings||{}).filter((([e])=>{return n=t.name,o=e,eg(n)&&Jh[n].includes(o);var n,o})));return(0,s.createElement)(s.Fragment,null,Object.keys(l).length>0&&(0,s.createElement)(ng,{blockProps:t,bindings:l,onPropValueChange:r}),(0,s.createElement)(e,{...t,attributes:{...t.attributes,...n}}))}),"withBlockBindingSupport");function rg(e){const t=e.style?.border||{};return{className:Fu(e)||void 0,style:Mm({border:t})}}function lg(e){const{colors:t}=qc(),n=rg(e),{borderColor:o}=e;if(o){const e=Pu({colors:t,namedColor:o});n.style.borderColor=e.color}return n}function ig(e){return{style:Mm({shadow:e.style?.shadow||""})}}function sg(e){const{backgroundColor:t,textColor:n,gradient:o,style:r}=e,l=Zc("background-color",t),i=Zc("color",n),s=Gu(o),a=s||r?.color?.gradient;return{className:ml()(i,s,{[l]:!a&&!!l,"has-text-color":n||r?.color?.text,"has-background":t||r?.color?.background||o||r?.color?.gradient,"has-link-color":r?.elements?.link?.color})||void 0,style:Mm({color:r?.color||{}})}}function ag(e){const{backgroundColor:t,textColor:n,gradient:o}=e,[r,l,i,s,a,c]=Ar("color.palette.custom","color.palette.theme","color.palette.default","color.gradients.custom","color.gradients.theme","color.gradients.default"),d=(0,u.useMemo)((()=>[...r||[],...l||[],...i||[]]),[r,l,i]),p=(0,u.useMemo)((()=>[...s||[],...a||[],...c||[]]),[s,a,c]),m=sg(e);if(t){const e=Wc(d,t);m.style.backgroundColor=e.color}if(o&&(m.style.background=Uu(p,o)),n){const e=Wc(d,n);m.style.color=e.color}return m}function cg(e){const{style:t}=e;return{style:Mm({spacing:t?.spacing||{}})}}function ug(e,t){const{kebabCase:n}=ie(_l.privateApis);let o=e?.style?.typography||{};const r=Zr(t);o={...o,fontSize:Wr({size:e?.style?.typography?.fontSize},r)};const l=Mm({typography:o}),i=e?.fontFamily?`has-${n(e.fontFamily)}-font-family`:"";return{className:ml()(i,Sp(e?.fontSize)),style:l}}function dg(e){const[t,n]=(0,u.useState)(e);return(0,u.useEffect)((()=>{e&&n(e)}),[e]),t}var pg;(0,m.addFilter)("blocks.registerBlockType","core/editor/custom-sources-backwards-compatibility/shim-attribute-source",(function(e,t){return eg(t)?{...e,edit:og(e.edit)}:e})),function(e){e=e.map((e=>({...e,Edit:(0,u.memo)(e.edit)})));const t=(0,p.createHigherOrderComponent)((t=>n=>{const o=y();return[...e.map(((e,t)=>{const{Edit:r,hasSupport:l,attributeKeys:i=[],shareWithChildBlocks:a}=e;if(!(o[h]||o[g]&&a)||!l(n.name))return null;const c={};for(const e of i)n.attributes[e]&&(c[e]=n.attributes[e]);return(0,s.createElement)(r,{key:t,name:n.name,isSelected:n.isSelected,clientId:n.clientId,setAttributes:n.setAttributes,__unstableParentLayout:n.__unstableParentLayout,...c})})),(0,s.createElement)(t,{key:"edit",...n})]}),"withBlockEditHooks");(0,m.addFilter)("editor.BlockEdit","core/editor/hooks",t)}([is,Ms,Ns,Dm,rh,vh,Eh,Wh,Xh,Qh].filter(Boolean)),function(e){const t=(0,p.createHigherOrderComponent)((t=>n=>{const[o,r]=(0,u.useState)(Array(e.length).fill(void 0));return[...e.map(((e,t)=>{const{hasSupport:o,attributeKeys:l=[],useBlockProps:i}=e,a={};for(const e of l)n.attributes[e]&&(a[e]=n.attributes[e]);return Object.keys(a).length&&o(n.name)?(0,s.createElement)(kl,{key:t,index:t,useBlockProps:i,setAllWrapperProps:r,name:n.name,...a}):null})),(0,s.createElement)(t,{key:"edit",...n,wrapperProps:o.filter(Boolean).reduce(((e,t)=>({...e,...t,className:ml()(e.className,t.className),style:{...e.style,...t.style}})),n.wrapperProps||{})})]}),"withBlockListBlockHooks");(0,m.addFilter)("editor.BlockListBlock","core/editor/hooks",t)}([is,Dm,Pd,xm,rh,yp,Bp,Hu,vh,xh]),pg=[is,Ms,Rs,Ns,Hu,Pd,Dm,yp,Bp],(0,m.addFilter)("blocks.getSaveContent.extraProps","core/editor/hooks",(function(e,t,n){return pg.reduce(((e,o)=>{const{hasSupport:r,attributeKeys:l=[],addSaveProps:i}=o,s={};for(const e of l)n[e]&&(s[e]=n[e]);return Object.keys(s).length&&r(t)?i(e,t,s):e}),e)}),0),(0,m.addFilter)("blocks.getSaveContent.extraProps","core/editor/hooks",(e=>(e.hasOwnProperty("className")&&!e.className&&delete e.className,e)));const mg=([e,...t])=>e.toUpperCase()+t.join(""),hg=e=>(0,p.createHigherOrderComponent)((t=>n=>(0,s.createElement)(t,{...n,colors:e})),"withCustomColorPalette"),gg=()=>(0,p.createHigherOrderComponent)((e=>t=>{const[n,o,r]=Ar("color.palette.custom","color.palette.theme","color.palette.default"),l=(0,u.useMemo)((()=>[...n||[],...o||[],...r||[]]),[n,o,r]);return(0,s.createElement)(e,{...t,colors:l})}),"withEditorColorPalette");function fg(e,t){const{kebabCase:n}=ie(_l.privateApis),o=e.reduce(((e,t)=>({...e,..."string"==typeof t?{[t]:n(t)}:t})),{});return(0,p.compose)([t,e=>class extends u.Component{constructor(e){super(e),this.setters=this.createSetters(),this.colorUtils={getMostReadableColor:this.getMostReadableColor.bind(this)},this.state={}}getMostReadableColor(e){const{colors:t}=this.props;return function(e,t){const n=Vc(t),o=({color:e})=>n.contrast(e),r=Math.max(...e.map(o));return e.find((e=>o(e)===r)).color}(t,e)}createSetters(){return Object.keys(o).reduce(((e,t)=>{const n=mg(t),o=`custom${n}`;return e[`set${n}`]=this.createSetColor(t,o),e}),{})}createSetColor(e,t){return n=>{const o=Kc(this.props.colors,n);this.props.setAttributes({[e]:o&&o.slug?o.slug:void 0,[t]:o&&o.slug?void 0:n})}}static getDerivedStateFromProps({attributes:e,colors:t},n){return Object.entries(o).reduce(((o,[r,l])=>{const i=Wc(t,e[r],e[`custom${mg(r)}`]),s=n[r],a=s?.color;return a===i.color&&s?o[r]=s:o[r]={...i,class:Zc(l,i.slug)},o}),{})}render(){return(0,s.createElement)(e,{...this.props,colors:void 0,...this.state,...this.setters,colorUtils:this.colorUtils})}}])}function bg(e){return(...t)=>{const n=hg(e);return(0,p.createHigherOrderComponent)(fg(t,n),"withCustomColors")}}function vg(...e){const t=gg();return(0,p.createHigherOrderComponent)(fg(e,t),"withColors")}const kg=function(e){const[t,n]=Ar("typography.fontSizes","typography.customFontSize");return(0,s.createElement)(_l.FontSizePicker,{...e,fontSizes:t,disableCustomFontSizes:!n})},_g=[],yg=([e,...t])=>e.toUpperCase()+t.join(""),Eg=(...e)=>{const t=e.reduce(((e,t)=>(e[t]=`custom${yg(t)}`,e)),{});return(0,p.createHigherOrderComponent)((0,p.compose)([(0,p.createHigherOrderComponent)((e=>t=>{const[n]=Ar("typography.fontSizes");return(0,s.createElement)(e,{...t,fontSizes:n||_g})}),"withFontSizes"),e=>class extends u.Component{constructor(e){super(e),this.setters=this.createSetters(),this.state={}}createSetters(){return Object.entries(t).reduce(((e,[t,n])=>(e[`set${yg(t)}`]=this.createSetFontSize(t,n),e)),{})}createSetFontSize(e,t){return n=>{const o=this.props.fontSizes?.find((({size:e})=>e===Number(n)));this.props.setAttributes({[e]:o&&o.slug?o.slug:void 0,[t]:o&&o.slug?void 0:n})}}static getDerivedStateFromProps({attributes:e,fontSizes:n},o){const r=(t,n)=>!o[n]||(e[n]?e[n]!==o[n].slug:o[n].size!==e[t]);if(!Object.values(t).some(r))return null;const l=Object.entries(t).filter((([e,t])=>r(t,e))).reduce(((t,[o,r])=>{const l=e[o],i=Ep(n,l,e[r]);return t[o]={...i,class:Sp(l)},t}),{});return{...o,...l}}render(){return(0,s.createElement)(e,{...this.props,fontSizes:void 0,...this.state,...this.setters})}}]),"withFontSizes")},wg=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z"})),Sg=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M7.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z"})),Cg=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z"})),xg=[{icon:wg,title:(0,x.__)("Align text left"),align:"left"},{icon:Sg,title:(0,x.__)("Align text center"),align:"center"},{icon:Cg,title:(0,x.__)("Align text right"),align:"right"}],Bg={placement:"bottom-start"};const Ig=function({value:e,onChange:t,alignmentControls:n=xg,label:o=(0,x.__)("Align text"),describedBy:r=(0,x.__)("Change text alignment"),isCollapsed:l=!0,isToolbar:i}){function a(n){return()=>t(e===n?void 0:n)}const c=n.find((t=>t.align===e)),u=i?_l.ToolbarGroup:_l.ToolbarDropdownMenu,d=i?{isCollapsed:l}:{toggleProps:{describedBy:r},popoverProps:Bg};return(0,s.createElement)(u,{icon:c?c.icon:(0,x.isRTL)()?Cg:wg,label:o,controls:n.map((t=>{const{align:n}=t,o=e===n;return{...t,isActive:o,role:l?"menuitemradio":void 0,onClick:a(n)}})),...d})},Tg=e=>(0,s.createElement)(Ig,{...e,isToolbar:!1}),Mg=e=>(0,s.createElement)(Ig,{...e,isToolbar:!0});var Pg=n(9681),Rg=n.n(Pg);function Ng(e){return e.toLowerCase()}var Lg=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],Ag=/[^A-Z0-9]+/gi;function Og(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}const Dg=e=>e.name||"",zg=e=>e.title,Vg=e=>e.description||"",Fg=e=>e.keywords||[],Hg=e=>e.category,Gg=()=>null;function Ug(e=""){return function(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,o=void 0===n?Lg:n,r=t.stripRegexp,l=void 0===r?Ag:r,i=t.transform,s=void 0===i?Ng:i,a=t.delimiter,c=void 0===a?" ":a,u=Og(Og(e,o,"$1\0$2"),l,"\0"),d=0,p=u.length;"\0"===u.charAt(d);)d++;for(;"\0"===u.charAt(p-1);)p--;return u.slice(d,p).split("\0").map(s).join(c)}(e,{splitRegexp:[/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu,/([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu],stripRegexp:/(\p{C}|\p{P}|\p{S})+/giu}).split(" ").filter(Boolean)}function $g(e=""){return e=(e=(e=Rg()(e)).replace(/^\//,"")).toLowerCase()}const jg=(e="")=>Ug($g(e)),Wg=(e,t,n,o)=>{if(0===jg(o).length)return e;return Kg(e,o,{getCategory:e=>t.find((({slug:t})=>t===e.category))?.title,getCollection:e=>n[e.name.split("/")[0]]?.title})},Kg=(e=[],t="",n={})=>{if(0===jg(t).length)return e;const o=e.map((e=>[e,Zg(e,t,n)])).filter((([,e])=>e>0));return o.sort((([,e],[,t])=>t-e)),o.map((([e])=>e))};function Zg(e,t,n={}){const{getName:o=Dg,getTitle:r=zg,getDescription:l=Vg,getKeywords:i=Fg,getCategory:s=Hg,getCollection:a=Gg}=n,c=o(e),u=r(e),d=l(e),p=i(e),m=s(e),h=a(e),g=$g(t),f=$g(u);let b=0;if(g===f)b+=30;else if(f.startsWith(g))b+=20;else{const e=[c,u,d,...p,m,h].join(" ");0===((e,t)=>e.filter((e=>!jg(t).some((t=>t.includes(e))))))(Ug(g),e).length&&(b+=10)}if(0!==b&&c.startsWith("core/")){b+=c!==e.id?1:2}return b}const qg=(e,t)=>{const[n]=(0,d.useSelect)((t=>[t(Nr).getInserterItems(e)]),[e]),[o,r]=(0,d.useSelect)((e=>{const{getCategories:t,getCollections:n}=e(c.store);return[t(),n()]}),[]);return[n,o,r,(0,u.useCallback)((({name:e,initialAttributes:n,innerBlocks:o,syncStatus:r,content:l},i)=>{const s="unsynced"===r?(0,c.parse)(l,{__unstableSkipMigrationLogs:!0}):(0,c.createBlock)(e,n,(0,c.createBlocksFromInnerBlocksTemplate)(o));t(s,void 0,i)}),[t])]},Yg=(e,t)=>t?(e.sort((({id:e},{id:n})=>{let o=t.indexOf(e),r=t.indexOf(n);return o<0&&(o=t.length),r<0&&(r=t.length),o-r})),e):e,Xg=()=>{};const Qg={name:"blocks",className:"block-editor-autocompleters__block",triggerPrefix:"/",useItems(e){const{rootClientId:t,selectedBlockName:n,prioritizedBlocks:o}=(0,d.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockName:n,getBlockListSettings:o,getBlockRootClientId:r}=e(Nr),l=t(),i=r(l);return{selectedBlockName:l?n(l):null,rootClientId:i,prioritizedBlocks:o(i)?.prioritizedInserterBlocks}}),[]),[r,l,i]=qg(t,Xg),a=(0,u.useMemo)((()=>(e.trim()?Wg(r,l,i,e):Yg(ne(r,"frecency","desc"),o)).filter((e=>e.name!==n)).slice(0,9)),[e,n,r,l,i,o]);return[(0,u.useMemo)((()=>a.map((e=>{const{title:t,icon:n,isDisabled:o}=e;return{key:`block-${e.id}`,value:e,label:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(qh,{key:"icon",icon:n,showColors:!0}),t),isDisabled:o}}))),[a])]},allowContext:(e,t)=>!(/\S/.test(e)||/\S/.test(t)),getOptionCompletion(e){const{name:t,initialAttributes:n,innerBlocks:o,syncStatus:r,content:l}=e;return{action:"replace",value:"unsynced"===r?(0,c.parse)(l,{__unstableSkipMigrationLogs:!0}):(0,c.createBlock)(t,n,(0,c.createBlocksFromInnerBlocksTemplate)(o))}}},Jg=window.wp.apiFetch;var ef=n.n(Jg);const tf=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"}));const nf={name:"links",className:"block-editor-autocompleters__link",triggerPrefix:"[[",options:async e=>{let t=await ef()({path:(0,Ds.addQueryArgs)("/wp/v2/search",{per_page:10,search:e,type:"post",order_by:"menu_order"})});return t=t.filter((e=>""!==e.title)),t},getOptionKeywords:e=>[...e.title.split(/\s+/)],getOptionLabel:e=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Ti,{key:"icon",icon:"page"===e.subtype?la:tf}),e.title),getOptionCompletion:e=>(0,s.createElement)("a",{href:e.url},e.title)},of=[];function rf({completers:e=of}){const{name:t}=y();return(0,u.useMemo)((()=>{let n=[...e,nf];return(t===(0,c.getDefaultBlockName)()||(0,c.getBlockSupport)(t,"__experimentalSlashInserter",!1))&&(n=[...n,Qg]),(0,m.hasFilter)("editor.Autocomplete.completers")&&(n===e&&(n=n.map((e=>({...e})))),n=(0,m.applyFilters)("editor.Autocomplete.completers",n,t)),n}),[e,t])}const lf=function(e){return(0,s.createElement)(_l.Autocomplete,{...e,completers:rf(e)})},sf=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z"}));const af=function({isActive:e,label:t=(0,x.__)("Toggle full height"),onToggle:n,isDisabled:o}){return(0,s.createElement)(_l.ToolbarButton,{isActive:e,icon:sf,label:t,onClick:()=>n(!e),disabled:o})},cf=()=>{};const uf=function(e){const{label:t=(0,x.__)("Change matrix alignment"),onChange:n=cf,value:o="center",isDisabled:r}=e,l=(0,s.createElement)(_l.__experimentalAlignmentMatrixControl.Icon,{value:o});return(0,s.createElement)(_l.Dropdown,{popoverProps:{placement:"bottom-start"},renderToggle:({onToggle:e,isOpen:n})=>(0,s.createElement)(_l.ToolbarButton,{onClick:e,"aria-haspopup":"true","aria-expanded":n,onKeyDown:t=>{n||t.keyCode!==zs.DOWN||(t.preventDefault(),e())},label:t,icon:l,showTooltip:!0,disabled:r}),renderContent:()=>(0,s.createElement)(_l.__experimentalAlignmentMatrixControl,{hasFocusBorder:!1,onChange:n,value:o})})};function df({clientId:e,maximumLength:t,context:n}){const o=(0,d.useSelect)((t=>{if(!e)return null;const{getBlockName:o,getBlockAttributes:r}=t(Nr),{getBlockType:l,getActiveBlockVariation:i}=t(c.store),s=o(e),a=l(s);if(!a)return null;const u=r(e),d=(0,c.__experimentalGetBlockLabel)(a,u,n);if(d!==a.title)return d;const p=i(s,u);return p?.title||a.title}),[e,n]);if(!o)return null;if(t&&t>0&&o.length>t){const e="...";return o.slice(0,t-e.length)+e}return o}function pf({clientId:e,maximumLength:t,context:n}){return df({clientId:e,maximumLength:t,context:n})}const mf=function({rootLabelText:e}){const{selectBlock:t,clearSelectedBlock:n}=(0,d.useDispatch)(Nr),{clientId:o,parents:r,hasSelection:l}=(0,d.useSelect)((e=>{const{getSelectionStart:t,getSelectedBlockClientId:n,getEnabledBlockParents:o}=ie(e(Nr)),r=n();return{parents:o(r),clientId:r,hasSelection:!!t().clientId}}),[]),i=e||(0,x.__)("Document");return(0,s.createElement)("ul",{className:"block-editor-block-breadcrumb",role:"list","aria-label":(0,x.__)("Block breadcrumb")},(0,s.createElement)("li",{className:l?void 0:"block-editor-block-breadcrumb__current","aria-current":l?void 0:"true"},l&&(0,s.createElement)(_l.Button,{className:"block-editor-block-breadcrumb__button",variant:"tertiary",onClick:n},i),!l&&i,!!o&&(0,s.createElement)(Ti,{icon:qs,className:"block-editor-block-breadcrumb__separator"})),r.map((e=>(0,s.createElement)("li",{key:e},(0,s.createElement)(_l.Button,{className:"block-editor-block-breadcrumb__button",variant:"tertiary",onClick:()=>t(e)},(0,s.createElement)(pf,{clientId:e,maximumLength:35})),(0,s.createElement)(Ti,{icon:qs,className:"block-editor-block-breadcrumb__separator"})))),!!o&&(0,s.createElement)("li",{className:"block-editor-block-breadcrumb__current","aria-current":"true"},(0,s.createElement)(pf,{clientId:o,maximumLength:35})))};function hf(e){return(0,d.useSelect)((t=>{const{__unstableHasActiveBlockOverlayActive:n}=t(Nr);return n(e)}),[e])}const gf=(0,u.createContext)({});function ff({value:e,children:t}){const n=(0,u.useContext)(gf),o=(0,u.useMemo)((()=>({...n,...e})),[n,e]);return(0,s.createElement)(gf.Provider,{value:o,children:t})}const bf=gf,vf={},kf=(0,_l.withFilters)("editor.BlockEdit")((e=>{const{name:t}=e,n=(0,c.getBlockType)(t);if(!n)return null;const o=n.edit||n.save;return(0,s.createElement)(o,{...e})})),_f=e=>{const{attributes:t={},name:n}=e,o=(0,c.getBlockType)(n),r=(0,u.useContext)(bf),l=(0,u.useMemo)((()=>o&&o.usesContext?Object.fromEntries(Object.entries(r).filter((([e])=>o.usesContext.includes(e)))):vf),[o,r]);if(!o)return null;if(o.apiVersion>1)return(0,s.createElement)(kf,{...e,context:l});const i=(0,c.hasBlockSupport)(o,"className",!0)?(0,c.getBlockDefaultClassName)(n):null,a=ml()(i,t.className,e.className);return(0,s.createElement)(kf,{...e,context:l,className:a})};function yf({mayDisplayControls:e,mayDisplayParentControls:t,blockEditingMode:n,...o}){const{name:r,isSelected:l,clientId:i,attributes:a={},__unstableLayoutClassNames:d}=o,{layout:p=null,metadata:m={}}=a,{bindings:v}=m,k=(0,c.hasBlockSupport)(r,"layout",!1)||(0,c.hasBlockSupport)(r,"__experimentalLayout",!1);return(0,s.createElement)(_,{value:(0,u.useMemo)((()=>({name:r,isSelected:l,clientId:i,layout:k?p:null,__unstableLayoutClassNames:d,[h]:e,[g]:t,[f]:n,[b]:v})),[r,l,i,k,p,d,e,t,n,v])},(0,s.createElement)(_f,{...o}))}const Ef=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));const wf=function({className:e,actions:t,children:n,secondaryActions:o}){return(0,s.createElement)("div",{style:{display:"contents",all:"initial"}},(0,s.createElement)("div",{className:ml()(e,"block-editor-warning")},(0,s.createElement)("div",{className:"block-editor-warning__contents"},(0,s.createElement)("p",{className:"block-editor-warning__message"},n),(u.Children.count(t)>0||o)&&(0,s.createElement)("div",{className:"block-editor-warning__actions"},u.Children.count(t)>0&&u.Children.map(t,((e,t)=>(0,s.createElement)("span",{key:t,className:"block-editor-warning__action"},e))),o&&(0,s.createElement)(_l.DropdownMenu,{className:"block-editor-warning__secondary",icon:Ef,label:(0,x.__)("More options"),popoverProps:{position:"bottom left",className:"block-editor-warning__dropdown"},noIcons:!0},(()=>(0,s.createElement)(_l.MenuGroup,null,o.map(((e,t)=>(0,s.createElement)(_l.MenuItem,{onClick:e.onClick,key:t},e.title))))))))))};var Sf=n(8021);function Cf({title:e,rawContent:t,renderedContent:n,action:o,actionText:r,className:l}){return(0,s.createElement)("div",{className:l},(0,s.createElement)("div",{className:"block-editor-block-compare__content"},(0,s.createElement)("h2",{className:"block-editor-block-compare__heading"},e),(0,s.createElement)("div",{className:"block-editor-block-compare__html"},t),(0,s.createElement)("div",{className:"block-editor-block-compare__preview edit-post-visual-editor"},(0,s.createElement)(u.RawHTML,null,(0,As.safeHTML)(n)))),(0,s.createElement)("div",{className:"block-editor-block-compare__action"},(0,s.createElement)(_l.Button,{variant:"secondary",tabIndex:"0",onClick:o},r)))}const xf=function({block:e,onKeep:t,onConvert:n,convertor:o,convertButtonText:r}){const l=(i=o(e),(Array.isArray(i)?i:[i]).map((e=>(0,c.getSaveContent)(e.name,e.attributes,e.innerBlocks))).join(""));var i;const a=(u=e.originalContent,d=l,(0,Sf.JJ)(u,d).map(((e,t)=>{const n=ml()({"block-editor-block-compare__added":e.added,"block-editor-block-compare__removed":e.removed});return(0,s.createElement)("span",{key:t,className:n},e.value)})));var u,d;return(0,s.createElement)("div",{className:"block-editor-block-compare__wrapper"},(0,s.createElement)(Cf,{title:(0,x.__)("Current"),className:"block-editor-block-compare__current",action:t,actionText:(0,x.__)("Convert to HTML"),rawContent:e.originalContent,renderedContent:e.originalContent}),(0,s.createElement)(Cf,{title:(0,x.__)("After Conversion"),className:"block-editor-block-compare__converted",action:n,actionText:r,rawContent:a,renderedContent:l}))},Bf=e=>(0,c.rawHandler)({HTML:e.originalContent});function If({clientId:e}){const{block:t,canInsertHTMLBlock:n,canInsertClassicBlock:o}=(0,d.useSelect)((t=>{const{canInsertBlockType:n,getBlock:o,getBlockRootClientId:r}=t(Nr),l=r(e);return{block:o(e),canInsertHTMLBlock:n("core/html",l),canInsertClassicBlock:n("core/freeform",l)}}),[e]),{replaceBlock:r}=(0,d.useDispatch)(Nr),[l,i]=(0,u.useState)(!1),a=(0,u.useCallback)((()=>i(!1)),[]),p=(0,u.useMemo)((()=>({toClassic(){const e=(0,c.createBlock)("core/freeform",{content:t.originalContent});return r(t.clientId,e)},toHTML(){const e=(0,c.createBlock)("core/html",{content:t.originalContent});return r(t.clientId,e)},toBlocks(){const e=Bf(t);return r(t.clientId,e)},toRecoveredBlock(){const e=(0,c.createBlock)(t.name,t.attributes,t.innerBlocks);return r(t.clientId,e)}})),[t,r]),m=(0,u.useMemo)((()=>[{title:(0,x._x)("Resolve","imperative verb"),onClick:()=>i(!0)},n&&{title:(0,x.__)("Convert to HTML"),onClick:p.toHTML},o&&{title:(0,x.__)("Convert to Classic Block"),onClick:p.toClassic}].filter(Boolean)),[n,o,p]);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(wf,{actions:[(0,s.createElement)(_l.Button,{key:"recover",onClick:p.toRecoveredBlock,variant:"primary"},(0,x.__)("Attempt Block Recovery"))],secondaryActions:m},(0,x.__)("This block contains unexpected or invalid content.")),l&&(0,s.createElement)(_l.Modal,{title:(0,x.__)("Resolve Block"),onRequestClose:a,className:"block-editor-block-compare"},(0,s.createElement)(xf,{block:t,onKeep:p.toHTML,onConvert:p.toBlocks,convertor:Bf,convertButtonText:(0,x.__)("Convert to Blocks")})))}const Tf=(0,s.createElement)(wf,{className:"block-editor-block-list__block-crash-warning"},(0,x.__)("This block has encountered an error and cannot be previewed.")),Mf=()=>Tf;class Pf extends u.Component{constructor(){super(...arguments),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?this.props.fallback:this.props.children}}const Rf=Pf;var Nf=n(4132);const Lf=function({clientId:e}){const[t,n]=(0,u.useState)(""),o=(0,d.useSelect)((t=>t(Nr).getBlock(e)),[e]),{updateBlock:r}=(0,d.useDispatch)(Nr);return(0,u.useEffect)((()=>{n((0,c.getBlockContent)(o))}),[o]),(0,s.createElement)(Nf.A,{className:"block-editor-block-list__block-html-textarea",value:t,onBlur:()=>{const l=(0,c.getBlockType)(o.name);if(!l)return;const i=(0,c.getBlockAttributes)(l,t,o.attributes),s=t||(0,c.getSaveContent)(l,i),[a]=t?(0,c.validateBlock)({...o,attributes:i,originalContent:s}):[!0];r(e,{attributes:i,originalContent:s,isValid:a}),t||n(s)},onChange:e=>n(e.target.value)})};var Af=Xf(),Of=e=>Kf(e,Af),Df=Xf();Of.write=e=>Kf(e,Df);var zf=Xf();Of.onStart=e=>Kf(e,zf);var Vf=Xf();Of.onFrame=e=>Kf(e,Vf);var Ff=Xf();Of.onFinish=e=>Kf(e,Ff);var Hf=[];Of.setTimeout=(e,t)=>{let n=Of.now()+t,o=()=>{let e=Hf.findIndex((e=>e.cancel==o));~e&&Hf.splice(e,1),jf-=~e?1:0},r={time:n,handler:e,cancel:o};return Hf.splice(Gf(n),0,r),jf+=1,Zf(),r};var Gf=e=>~(~Hf.findIndex((t=>t.time>e))||~Hf.length);Of.cancel=e=>{zf.delete(e),Vf.delete(e),Ff.delete(e),Af.delete(e),Df.delete(e)},Of.sync=e=>{Wf=!0,Of.batchedUpdates(e),Wf=!1},Of.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function o(...e){t=e,Of.onStart(n)}return o.handler=e,o.cancel=()=>{zf.delete(n),t=null},o};var Uf=typeof window<"u"?window.requestAnimationFrame:()=>{};Of.use=e=>Uf=e,Of.now=typeof performance<"u"?()=>performance.now():Date.now,Of.batchedUpdates=e=>e(),Of.catch=console.error,Of.frameLoop="always",Of.advance=()=>{"demand"!==Of.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):Yf()};var $f=-1,jf=0,Wf=!1;function Kf(e,t){Wf?(t.delete(e),e(0)):(t.add(e),Zf())}function Zf(){$f<0&&($f=0,"demand"!==Of.frameLoop&&Uf(qf))}function qf(){~$f&&(Uf(qf),Of.batchedUpdates(Yf))}function Yf(){let e=$f;$f=Of.now();let t=Gf($f);t&&(Qf(Hf.splice(0,t),(e=>e.handler())),jf-=t),jf?(zf.flush(),Af.flush(e?Math.min(64,$f-e):16.667),Vf.flush(),Df.flush(),Ff.flush()):$f=-1}function Xf(){let e=new Set,t=e;return{add(n){jf+=t!=e||e.has(n)?0:1,e.add(n)},delete:n=>(jf-=t==e&&e.has(n)?1:0,e.delete(n)),flush(n){t.size&&(e=new Set,jf-=t.size,Qf(t,(t=>t(n)&&e.add(t))),jf+=e.size,t=e)}}}function Qf(e,t){e.forEach((e=>{try{t(e)}catch(e){Of.catch(e)}}))}var Jf=Object.defineProperty,eb={};function tb(){}((e,t)=>{for(var n in t)Jf(e,n,{get:t[n],enumerable:!0})})(eb,{assign:()=>gb,colors:()=>pb,createStringInterpolator:()=>ab,skipAnimation:()=>mb,to:()=>cb,willAdvance:()=>hb});var nb={arr:Array.isArray,obj:e=>!!e&&"Object"===e.constructor.name,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,und:e=>void 0===e};function ob(e,t){if(nb.arr(e)){if(!nb.arr(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return e===t}var rb=(e,t)=>e.forEach(t);function lb(e,t,n){if(nb.arr(e))for(let o=0;o<e.length;o++)t.call(n,e[o],`${o}`);else for(let o in e)e.hasOwnProperty(o)&&t.call(n,e[o],o)}var ib=e=>nb.und(e)?[]:nb.arr(e)?e:[e];function sb(e,t){if(e.size){let n=Array.from(e);e.clear(),rb(n,t)}}var ab,cb,ub=(e,...t)=>sb(e,(e=>e(...t))),db=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),pb=null,mb=!1,hb=tb,gb=e=>{e.to&&(cb=e.to),e.now&&(Of.now=e.now),void 0!==e.colors&&(pb=e.colors),null!=e.skipAnimation&&(mb=e.skipAnimation),e.createStringInterpolator&&(ab=e.createStringInterpolator),e.requestAnimationFrame&&Of.use(e.requestAnimationFrame),e.batchedUpdates&&(Of.batchedUpdates=e.batchedUpdates),e.willAdvance&&(hb=e.willAdvance),e.frameLoop&&(Of.frameLoop=e.frameLoop)},fb=new Set,bb=[],vb=[],kb=0,_b={get idle(){return!fb.size&&!bb.length},start(e){kb>e.priority?(fb.add(e),Of.onStart(yb)):(Eb(e),Of(Sb))},advance:Sb,sort(e){if(kb)Of.onFrame((()=>_b.sort(e)));else{let t=bb.indexOf(e);~t&&(bb.splice(t,1),wb(e))}},clear(){bb=[],fb.clear()}};function yb(){fb.forEach(Eb),fb.clear(),Of(Sb)}function Eb(e){bb.includes(e)||wb(e)}function wb(e){bb.splice(function(e,t){let n=e.findIndex(t);return n<0?e.length:n}(bb,(t=>t.priority>e.priority)),0,e)}function Sb(e){let t=vb;for(let n=0;n<bb.length;n++){let o=bb[n];kb=o.priority,o.idle||(hb(o),o.advance(e),o.idle||t.push(o))}return kb=0,(vb=bb).length=0,(bb=t).length>0}var Cb="[-+]?\\d*\\.?\\d+",xb=Cb+"%";function Bb(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var Ib=new RegExp("rgb"+Bb(Cb,Cb,Cb)),Tb=new RegExp("rgba"+Bb(Cb,Cb,Cb,Cb)),Mb=new RegExp("hsl"+Bb(Cb,xb,xb)),Pb=new RegExp("hsla"+Bb(Cb,xb,xb,Cb)),Rb=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,Nb=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,Lb=/^#([0-9a-fA-F]{6})$/,Ab=/^#([0-9a-fA-F]{8})$/;function Ob(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Db(e,t,n){let o=n<.5?n*(1+t):n+t-n*t,r=2*n-o,l=Ob(r,o,e+1/3),i=Ob(r,o,e),s=Ob(r,o,e-1/3);return Math.round(255*l)<<24|Math.round(255*i)<<16|Math.round(255*s)<<8}function zb(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function Vb(e){return(parseFloat(e)%360+360)%360/360}function Fb(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function Hb(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function Gb(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=Lb.exec(e))?parseInt(t[1]+"ff",16)>>>0:pb&&void 0!==pb[e]?pb[e]:(t=Ib.exec(e))?(zb(t[1])<<24|zb(t[2])<<16|zb(t[3])<<8|255)>>>0:(t=Tb.exec(e))?(zb(t[1])<<24|zb(t[2])<<16|zb(t[3])<<8|Fb(t[4]))>>>0:(t=Rb.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=Ab.exec(e))?parseInt(t[1],16)>>>0:(t=Nb.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=Mb.exec(e))?(255|Db(Vb(t[1]),Hb(t[2]),Hb(t[3])))>>>0:(t=Pb.exec(e))?(Db(Vb(t[1]),Hb(t[2]),Hb(t[3]))|Fb(t[4]))>>>0:null}(e);return null===t?e:(t=t||0,`rgba(${(4278190080&t)>>>24}, ${(16711680&t)>>>16}, ${(65280&t)>>>8}, ${(255&t)/255})`)}var Ub=(e,t,n)=>{if(nb.fun(e))return e;if(nb.arr(e))return Ub({range:e,output:t,extrapolate:n});if(nb.str(e.output[0]))return ab(e);let o=e,r=o.output,l=o.range||[0,1],i=o.extrapolateLeft||o.extrapolate||"extend",s=o.extrapolateRight||o.extrapolate||"extend",a=o.easing||(e=>e);return e=>{let t=function(e,t){for(var n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}(e,l);return function(e,t,n,o,r,l,i,s,a){let c=a?a(e):e;if(c<t){if("identity"===i)return c;"clamp"===i&&(c=t)}if(c>n){if("identity"===s)return c;"clamp"===s&&(c=n)}return o===r?o:t===n?e<=t?o:r:(t===-1/0?c=-c:n===1/0?c-=t:c=(c-t)/(n-t),c=l(c),o===-1/0?c=-c:r===1/0?c+=o:c=c*(r-o)+o,c)}(e,l[t],l[t+1],r[t],r[t+1],a,i,s,o.map)}};var $b=1.70158,jb=1.525*$b,Wb=$b+1,Kb=2*Math.PI/3,Zb=2*Math.PI/4.5,qb=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,Yb={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>0===e?0:Math.pow(2,10*e-10),easeOutExpo:e=>1===e?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>0===e?0:1===e?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>Wb*e*e*e-$b*e*e,easeOutBack:e=>1+Wb*Math.pow(e-1,3)+$b*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*(2*(jb+1)*e-jb)/2:(Math.pow(2*e-2,2)*((jb+1)*(2*e-2)+jb)+2)/2,easeInElastic:e=>0===e?0:1===e?1:-Math.pow(2,10*e-10)*Math.sin((10*e-10.75)*Kb),easeOutElastic:e=>0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin((10*e-.75)*Kb)+1,easeInOutElastic:e=>0===e?0:1===e?1:e<.5?-Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*Zb)/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*Zb)/2+1,easeInBounce:e=>1-qb(1-e),easeOutBounce:qb,easeInOutBounce:e=>e<.5?(1-qb(1-2*e))/2:(1+qb(2*e-1))/2,steps:(e,t="end")=>n=>{let o=(n="end"===t?Math.min(n,.999):Math.max(n,.001))*e;return((e,t,n)=>Math.min(Math.max(n,e),t))(0,1,("end"===t?Math.floor(o):Math.ceil(o))/e)}},Xb=Symbol.for("FluidValue.get"),Qb=Symbol.for("FluidValue.observers"),Jb=e=>Boolean(e&&e[Xb]),ev=e=>e&&e[Xb]?e[Xb]():e,tv=e=>e[Qb]||null;function nv(e,t){let n=e[Qb];n&&n.forEach((e=>{!function(e,t){e.eventObserved?e.eventObserved(t):e(t)}(e,t)}))}var ov=class{[Xb];[Qb];constructor(e){if(!e&&!(e=this.get))throw Error("Unknown getter");rv(this,e)}},rv=(e,t)=>av(e,Xb,t);function lv(e,t){if(e[Xb]){let n=e[Qb];n||av(e,Qb,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function iv(e,t){let n=e[Qb];if(n&&n.has(t)){let o=n.size-1;o?n.delete(t):e[Qb]=null,e.observerRemoved&&e.observerRemoved(o,t)}}var sv,av=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),cv=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,uv=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,dv=new RegExp(`(${cv.source})(%|[a-z]+)`,"i"),pv=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,mv=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,hv=e=>{let[t,n]=gv(e);if(!t||db())return e;let o=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(o)return o.trim();if(n&&n.startsWith("--")){return window.getComputedStyle(document.documentElement).getPropertyValue(n)||e}return n&&mv.test(n)?hv(n):n||e},gv=e=>{let t=mv.exec(e);if(!t)return[,];let[,n,o]=t;return[n,o]},fv=(e,t,n,o,r)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(o)}, ${r})`,bv=e=>{sv||(sv=pb?new RegExp(`(${Object.keys(pb).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map((e=>ev(e).replace(mv,hv).replace(uv,Gb).replace(sv,Gb))),n=t.map((e=>e.match(cv).map(Number))),o=n[0].map(((e,t)=>n.map((e=>{if(!(t in e))throw Error('The arity of each "output" value must be equal');return e[t]})))).map((t=>Ub({...e,output:t})));return e=>{let n=!dv.test(t[0])&&t.find((e=>dv.test(e)))?.replace(cv,""),r=0;return t[0].replace(cv,(()=>`${o[r++](e)}${n||""}`)).replace(pv,fv)}},vv="react-spring: ",kv=e=>{let t=e,n=!1;if("function"!=typeof t)throw new TypeError(`${vv}once requires a function parameter`);return(...e)=>{n||(t(...e),n=!0)}},_v=kv(console.warn);kv(console.warn);function yv(e){return nb.str(e)&&("#"==e[0]||/\d/.test(e)||!db()&&mv.test(e)||e in(pb||{}))}new WeakMap;new Set,new WeakMap,new WeakMap,new WeakMap;var Ev=db()?s.useEffect:s.useLayoutEffect;function wv(){let e=(0,s.useState)()[1],t=(()=>{let e=(0,s.useRef)(!1);return Ev((()=>(e.current=!0,()=>{e.current=!1})),[]),e})();return()=>{t.current&&e(Math.random())}}var Sv=[];var Cv=Symbol.for("Animated:node"),xv=e=>e&&e[Cv],Bv=(e,t)=>((e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}))(e,Cv,t),Iv=e=>e&&e[Cv]&&e[Cv].getPayload(),Tv=class{payload;constructor(){Bv(this,this)}getPayload(){return this.payload||[]}},Mv=class extends Tv{constructor(e){super(),this._value=e,nb.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(e){return new Mv(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return nb.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value!==e&&(this._value=e,!0)}reset(){let{done:e}=this;this.done=!1,nb.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},Pv=class extends Mv{_string=null;_toString;constructor(e){super(0),this._toString=Ub({output:[e,e]})}static create(e){return new Pv(e)}getValue(){return this._string??(this._string=this._toString(this._value))}setValue(e){if(nb.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else{if(!super.setValue(e))return!1;this._string=null}return!0}reset(e){e&&(this._toString=Ub({output:[this.getValue(),e]})),this._value=0,super.reset()}},Rv={dependencies:null},Nv=class extends Tv{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){let t={};return lb(this.source,((n,o)=>{(e=>!!e&&e[Cv]===e)(n)?t[o]=n.getValue(e):Jb(n)?t[o]=ev(n):e||(t[o]=n)})),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&rb(this.payload,(e=>e.reset()))}_makePayload(e){if(e){let t=new Set;return lb(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){Rv.dependencies&&Jb(e)&&Rv.dependencies.add(e);let t=Iv(e);t&&rb(t,(e=>this.add(e)))}},Lv=class extends Nv{constructor(e){super(e)}static create(e){return new Lv(e)}getValue(){return this.source.map((e=>e.getValue()))}setValue(e){let t=this.getPayload();return e.length==t.length?t.map(((t,n)=>t.setValue(e[n]))).some(Boolean):(super.setValue(e.map(Av)),!0)}};function Av(e){return(yv(e)?Pv:Mv).create(e)}function Ov(e){let t=xv(e);return t?t.constructor:nb.arr(e)?Lv:yv(e)?Pv:Mv}var Dv=(e,t)=>{let n=!nb.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,s.forwardRef)(((o,r)=>{let l=(0,s.useRef)(null),i=n&&(0,s.useCallback)((e=>{l.current=function(e,t){return e&&(nb.fun(e)?e(t):e.current=t),t}(r,e)}),[r]),[a,c]=function(e,t){let n=new Set;return Rv.dependencies=n,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new Nv(e),Rv.dependencies=null,[e,n]}(o,t),u=wv(),d=()=>{let e=l.current;n&&!e||!1===(!!e&&t.applyAnimatedValues(e,a.getValue(!0)))&&u()},p=new zv(d,c),m=(0,s.useRef)();Ev((()=>(m.current=p,rb(c,(e=>lv(e,p))),()=>{m.current&&(rb(m.current.deps,(e=>iv(e,m.current))),Of.cancel(m.current.update))}))),(0,s.useEffect)(d,[]),(e=>{(0,s.useEffect)(e,Sv)})((()=>()=>{let e=m.current;rb(e.deps,(t=>iv(t,e)))}));let h=t.getComponentProps(a.getValue());return s.createElement(e,{...h,ref:i})}))},zv=class{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&Of.write(this.update)}};var Vv=Symbol.for("AnimatedComponent"),Fv=e=>nb.str(e)?e:e&&nb.str(e.displayName)?e.displayName:nb.fun(e)&&e.name||null;function Hv(e,...t){return nb.fun(e)?e(...t):e}var Gv=(e,t)=>!0===e||!!(t&&e&&(nb.fun(e)?e(t):ib(e).includes(t))),Uv=(e,t)=>nb.obj(e)?t&&e[t]:e,$v=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,jv=e=>e,Wv=(e,t=jv)=>{let n=Kv;e.default&&!0!==e.default&&(e=e.default,n=Object.keys(e));let o={};for(let r of n){let n=t(e[r],r);nb.und(n)||(o[r]=n)}return o},Kv=["config","onProps","onStart","onChange","onPause","onResume","onRest"],Zv={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 qv(e){let t=function(e){let t={},n=0;if(lb(e,((e,o)=>{Zv[o]||(t[o]=e,n++)})),n)return t}(e);if(t){let n={to:t};return lb(e,((e,o)=>o in t||(n[o]=e))),n}return{...e}}function Yv(e){return e=ev(e),nb.arr(e)?e.map(Yv):yv(e)?eb.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function Xv(e){return nb.fun(e)||nb.arr(e)&&nb.obj(e[0])}var Qv={tension:170,friction:26,mass:1,damping:1,easing:Yb.linear,clamp:!1},Jv=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,Qv)}};function ek(e,t){if(nb.und(t.decay)){let n=!nb.und(t.tension)||!nb.und(t.friction);(n||!nb.und(t.frequency)||!nb.und(t.damping)||!nb.und(t.mass))&&(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}else e.duration=void 0}var tk=[],nk=class{changed=!1;values=tk;toValues=null;fromValues=tk;to;from;config=new Jv;immediate=!1};function ok(e,{key:t,props:n,defaultProps:o,state:r,actions:l}){return new Promise(((i,s)=>{let a,c,u=Gv(n.cancel??o?.cancel,t);if(u)m();else{nb.und(n.pause)||(r.paused=Gv(n.pause,t));let e=o?.pause;!0!==e&&(e=r.paused||Gv(e,t)),a=Hv(n.delay||0,t),e?(r.resumeQueue.add(p),l.pause()):(l.resume(),p())}function d(){r.resumeQueue.add(p),r.timeouts.delete(c),c.cancel(),a=c.time-Of.now()}function p(){a>0&&!eb.skipAnimation?(r.delayed=!0,c=Of.setTimeout(m,a),r.pauseQueue.add(d),r.timeouts.add(c)):m()}function m(){r.delayed&&(r.delayed=!1),r.pauseQueue.delete(d),r.timeouts.delete(c),e<=(r.cancelId||0)&&(u=!0);try{l.start({...n,callId:e,cancel:u},i)}catch(e){s(e)}}}))}var rk=(e,t)=>1==t.length?t[0]:t.some((e=>e.cancelled))?sk(e.get()):t.every((e=>e.noop))?lk(e.get()):ik(e.get(),t.every((e=>e.finished))),lk=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),ik=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),sk=e=>({value:e,cancelled:!0,finished:!1});function ak(e,t,n,o){let{callId:r,parentId:l,onRest:i}=t,{asyncTo:s,promise:a}=n;return l||e!==s||t.reset?n.promise=(async()=>{n.asyncId=r,n.asyncTo=e;let c,u,d,p=Wv(t,((e,t)=>"onRest"===t?void 0:e)),m=new Promise(((e,t)=>(c=e,u=t))),h=e=>{let t=r<=(n.cancelId||0)&&sk(o)||r!==n.asyncId&&ik(o,!1);if(t)throw e.result=t,u(e),e},g=(e,t)=>{let l=new uk,i=new dk;return(async()=>{if(eb.skipAnimation)throw ck(n),i.result=ik(o,!1),u(i),i;h(l);let s=nb.obj(e)?{...e}:{...t,to:e};s.parentId=r,lb(p,((e,t)=>{nb.und(s[t])&&(s[t]=e)}));let a=await o.start(s);return h(l),n.paused&&await new Promise((e=>{n.resumeQueue.add(e)})),a})()};if(eb.skipAnimation)return ck(n),ik(o,!1);try{let t;t=nb.arr(e)?(async e=>{for(let t of e)await g(t)})(e):Promise.resolve(e(g,o.stop.bind(o))),await Promise.all([t.then(c),m]),d=ik(o.get(),!0,!1)}catch(e){if(e instanceof uk)d=e.result;else{if(!(e instanceof dk))throw e;d=e.result}}finally{r==n.asyncId&&(n.asyncId=l,n.asyncTo=l?s:void 0,n.promise=l?a:void 0)}return nb.fun(i)&&Of.batchedUpdates((()=>{i(d,o,o.item)})),d})():a}function ck(e,t){sb(e.timeouts,(e=>e.cancel())),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}var uk=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},dk=class extends Error{result;constructor(){super("SkipAnimationSignal")}},pk=e=>e instanceof hk,mk=1,hk=class extends ov{id=mk++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=xv(this);return e&&e.getValue()}to(...e){return eb.to(this,e)}interpolate(...e){return _v(`${vv}The "interpolate" function is deprecated in v9 (use "to" instead)`),eb.to(this,e)}toJSON(){return this.get()}observerAdded(e){1==e&&this._attach()}observerRemoved(e){0==e&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){nv(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||_b.sort(this),nv(this,{type:"priority",parent:this,priority:e})}},gk=Symbol.for("SpringPhase"),fk=e=>(1&e[gk])>0,bk=e=>(2&e[gk])>0,vk=e=>(4&e[gk])>0,kk=(e,t)=>t?e[gk]|=3:e[gk]&=-3,_k=(e,t)=>t?e[gk]|=4:e[gk]&=-5,yk=class extends hk{key;animation=new nk;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,t){if(super(),!nb.und(e)||!nb.und(t)){let n=nb.obj(e)?{...e}:{...t,from:e};nb.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(bk(this)||this._state.asyncTo)||vk(this)}get goal(){return ev(this.animation.to)}get velocity(){let e=xv(this);return e instanceof Mv?e.lastVelocity||0:e.getPayload().map((e=>e.lastVelocity||0))}get hasAnimated(){return fk(this)}get isAnimating(){return bk(this)}get isPaused(){return vk(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,n=!1,o=this.animation,{config:r,toValues:l}=o,i=Iv(o.to);!i&&Jb(o.to)&&(l=ib(ev(o.to))),o.values.forEach(((s,a)=>{if(s.done)return;let c=s.constructor==Pv?1:i?i[a].lastPosition:l[a],u=o.immediate,d=c;if(!u){if(d=s.lastPosition,r.tension<=0)return void(s.done=!0);let t,n=s.elapsedTime+=e,l=o.fromValues[a],i=null!=s.v0?s.v0:s.v0=nb.arr(r.velocity)?r.velocity[a]:r.velocity,p=r.precision||(l==c?.005:Math.min(1,.001*Math.abs(c-l)));if(nb.und(r.duration))if(r.decay){let e=!0===r.decay?.998:r.decay,o=Math.exp(-(1-e)*n);d=l+i/(1-e)*(1-o),u=Math.abs(s.lastPosition-d)<=p,t=i*o}else{t=null==s.lastVelocity?i:s.lastVelocity;let n,o=r.restVelocity||p/10,a=r.clamp?0:r.bounce,m=!nb.und(a),h=l==c?s.v0>0:l<c,g=!1,f=1,b=Math.ceil(e/f);for(let e=0;e<b&&(n=Math.abs(t)>o,n||(u=Math.abs(c-d)<=p,!u));++e){m&&(g=d==c||d>c==h,g&&(t=-t*a,d=c)),t+=(1e-6*-r.tension*(d-c)+.001*-r.friction*t)/r.mass*f,d+=t*f}}else{let o=1;r.duration>0&&(this._memoizedDuration!==r.duration&&(this._memoizedDuration=r.duration,s.durationProgress>0&&(s.elapsedTime=r.duration*s.durationProgress,n=s.elapsedTime+=e)),o=(r.progress||0)+n/this._memoizedDuration,o=o>1?1:o<0?0:o,s.durationProgress=o),d=l+r.easing(o)*(c-l),t=(d-s.lastPosition)/e,u=1==o}s.lastVelocity=t,Number.isNaN(d)&&(console.warn("Got NaN while animating:",this),u=!0)}i&&!i[a].done&&(u=!1),u?s.done=!0:t=!1,s.setValue(d,r.round)&&(n=!0)}));let s=xv(this),a=s.getValue();if(t){let e=ev(o.to);a===e&&!n||r.decay?n&&r.decay&&this._onChange(a):(s.setValue(e),this._onChange(e)),this._stop()}else n&&this._onChange(a)}set(e){return Of.batchedUpdates((()=>{this._stop(),this._focus(e),this._set(e)})),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(bk(this)){let{to:e,config:t}=this.animation;Of.batchedUpdates((()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()}))}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let n;return nb.und(e)?(n=this.queue||[],this.queue=[]):n=[nb.obj(e)?e:{...t,to:e}],Promise.all(n.map((e=>this._update(e)))).then((e=>rk(this,e)))}stop(e){let{to:t}=this.animation;return this._focus(this.get()),ck(this._state,e&&this._lastCallId),Of.batchedUpdates((()=>this._stop(t,e))),this}reset(){this._update({reset:!0})}eventObserved(e){"change"==e.type?this._start():"priority"==e.type&&(this.priority=e.priority+1)}_prepareNode(e){let t=this.key||"",{to:n,from:o}=e;n=nb.obj(n)?n[t]:n,(null==n||Xv(n))&&(n=void 0),o=nb.obj(o)?o[t]:o,null==o&&(o=void 0);let r={to:n,from:o};return fk(this)||(e.reverse&&([n,o]=[o,n]),o=ev(o),nb.und(o)?xv(this)||this._set(n):this._set(o)),r}_update({...e},t){let{key:n,defaultProps:o}=this;e.default&&Object.assign(o,Wv(e,((e,t)=>/^on/.test(t)?Uv(e,n):e))),Bk(this,e,"onProps"),Ik(this,"onProps",e,this);let r=this._prepareNode(e);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?");let l=this._state;return ok(++this._lastCallId,{key:n,props:e,defaultProps:o,state:l,actions:{pause:()=>{vk(this)||(_k(this,!0),ub(l.pauseQueue),Ik(this,"onPause",ik(this,Ek(this,this.animation.to)),this))},resume:()=>{vk(this)&&(_k(this,!1),bk(this)&&this._resume(),ub(l.resumeQueue),Ik(this,"onResume",ik(this,Ek(this,this.animation.to)),this))},start:this._merge.bind(this,r)}}).then((n=>{if(e.loop&&n.finished&&(!t||!n.noop)){let t=wk(e);if(t)return this._update(t,!0)}return n}))}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(sk(this));let o=!nb.und(e.to),r=!nb.und(e.from);if(o||r){if(!(t.callId>this._lastToId))return n(sk(this));this._lastToId=t.callId}let{key:l,defaultProps:i,animation:s}=this,{to:a,from:c}=s,{to:u=a,from:d=c}=e;r&&!o&&(!t.default||nb.und(u))&&(u=d),t.reverse&&([u,d]=[d,u]);let p=!ob(d,c);p&&(s.from=d),d=ev(d);let m=!ob(u,a);m&&this._focus(u);let h=Xv(t.to),{config:g}=s,{decay:f,velocity:b}=g;(o||r)&&(g.velocity=0),t.config&&!h&&function(e,t,n){n&&(ek(n={...n},t),t={...n,...t}),ek(e,t),Object.assign(e,t);for(let t in Qv)null==e[t]&&(e[t]=Qv[t]);let{mass:o,frequency:r,damping:l}=e;nb.und(r)||(r<.01&&(r=.01),l<0&&(l=0),e.tension=Math.pow(2*Math.PI/r,2)*o,e.friction=4*Math.PI*l*o/r)}(g,Hv(t.config,l),t.config!==i.config?Hv(i.config,l):void 0);let v=xv(this);if(!v||nb.und(u))return n(ik(this,!0));let k=nb.und(t.reset)?r&&!t.default:!nb.und(d)&&Gv(t.reset,l),_=k?d:this.get(),y=Yv(u),E=nb.num(y)||nb.arr(y)||yv(y),w=!h&&(!E||Gv(i.immediate||t.immediate,l));if(m){let e=Ov(u);if(e!==v.constructor){if(!w)throw Error(`Cannot animate between ${v.constructor.name} and ${e.name}, as the "to" prop suggests`);v=this._set(y)}}let S=v.constructor,C=Jb(u),x=!1;if(!C){let e=k||!fk(this)&&p;(m||e)&&(x=ob(Yv(_),y),C=!x),(!ob(s.immediate,w)&&!w||!ob(g.decay,f)||!ob(g.velocity,b))&&(C=!0)}if(x&&bk(this)&&(s.changed&&!k?C=!0:C||this._stop(a)),!h&&((C||Jb(a))&&(s.values=v.getPayload(),s.toValues=Jb(u)?null:S==Pv?[1]:ib(y)),s.immediate!=w&&(s.immediate=w,!w&&!k&&this._set(a)),C)){let{onRest:e}=s;rb(xk,(e=>Bk(this,t,e)));let o=ik(this,Ek(this,a));ub(this._pendingCalls,o),this._pendingCalls.add(n),s.changed&&Of.batchedUpdates((()=>{s.changed=!k,e?.(o,this),k?Hv(i.onRest,o):s.onStart?.(o,this)}))}k&&this._set(_),h?n(ak(t.to,t,this._state,this)):C?this._start():bk(this)&&!m?this._pendingCalls.add(n):n(lk(_))}_focus(e){let t=this.animation;e!==t.to&&(tv(this)&&this._detach(),t.to=e,tv(this)&&this._attach())}_attach(){let e=0,{to:t}=this.animation;Jb(t)&&(lv(t,this),pk(t)&&(e=t.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;Jb(e)&&iv(e,this)}_set(e,t=!0){let n=ev(e);if(!nb.und(n)){let e=xv(this);if(!e||!ob(n,e.getValue())){let o=Ov(n);e&&e.constructor==o?e.setValue(n):Bv(this,o.create(n)),e&&Of.batchedUpdates((()=>{this._onChange(n,t)}))}}return xv(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,Ik(this,"onStart",ik(this,Ek(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),Hv(this.animation.onChange,e,this)),Hv(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){let e=this.animation;xv(this).reset(ev(e.to)),e.immediate||(e.fromValues=e.values.map((e=>e.lastPosition))),bk(this)||(kk(this,!0),vk(this)||this._resume())}_resume(){eb.skipAnimation?this.finish():_b.start(this)}_stop(e,t){if(bk(this)){kk(this,!1);let n=this.animation;rb(n.values,(e=>{e.done=!0})),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),nv(this,{type:"idle",parent:this});let o=t?sk(this.get()):ik(this.get(),Ek(this,e??n.to));ub(this._pendingCalls,o),n.changed&&(n.changed=!1,Ik(this,"onRest",o,this))}}};function Ek(e,t){let n=Yv(t);return ob(Yv(e.get()),n)}function wk(e,t=e.loop,n=e.to){let o=Hv(t);if(o){let r=!0!==o&&qv(o),l=(r||e).reverse,i=!r||r.reset;return Sk({...e,loop:t,default:!1,pause:void 0,to:!l||Xv(n)?n:void 0,from:i?e.from:void 0,reset:i,...r})}}function Sk(e){let{to:t,from:n}=e=qv(e),o=new Set;return nb.obj(t)&&Ck(t,o),nb.obj(n)&&Ck(n,o),e.keys=o.size?Array.from(o):null,e}function Ck(e,t){lb(e,((e,n)=>null!=e&&t.add(n)))}var xk=["onStart","onRest","onChange","onPause","onResume"];function Bk(e,t,n){e.animation[n]=t[n]!==$v(t,n)?Uv(t[n],e.key):void 0}function Ik(e,t,...n){e.animation[t]?.(...n),e.defaultProps[t]?.(...n)}var Tk=["onStart","onChange","onRest"],Mk=1,Pk=class{id=Mk++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,t){this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every((e=>e.idle&&!e.isDelayed&&!e.isPaused))}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each(((t,n)=>e[n]=t.get())),e}set(e){for(let t in e){let n=e[t];nb.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(Sk(e)),this}start(e){let{queue:t}=this;return e?t=ib(e).map(Sk):this.queue=[],this._flush?this._flush(this,t):(Ok(this,t),Rk(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){let n=this.springs;rb(ib(t),(t=>n[t].stop(!!e)))}else ck(this._state,this._lastAsyncId),this.each((t=>t.stop(!!e)));return this}pause(e){if(nb.und(e))this.start({pause:!0});else{let t=this.springs;rb(ib(e),(e=>t[e].pause()))}return this}resume(e){if(nb.und(e))this.start({pause:!1});else{let t=this.springs;rb(ib(e),(e=>t[e].resume()))}return this}each(e){lb(this.springs,e)}_onFrame(){let{onStart:e,onChange:t,onRest:n}=this._events,o=this._active.size>0,r=this._changed.size>0;(o&&!this._started||r&&!this._started)&&(this._started=!0,sb(e,(([e,t])=>{t.value=this.get(),e(t,this,this._item)})));let l=!o&&this._started,i=r||l&&n.size?this.get():null;r&&t.size&&sb(t,(([e,t])=>{t.value=i,e(t,this,this._item)})),l&&(this._started=!1,sb(n,(([e,t])=>{t.value=i,e(t,this,this._item)})))}eventObserved(e){if("change"==e.type)this._changed.add(e.parent),e.idle||this._active.add(e.parent);else{if("idle"!=e.type)return;this._active.delete(e.parent)}Of.onFrame(this._onFrame)}};function Rk(e,t){return Promise.all(t.map((t=>Nk(e,t)))).then((t=>rk(e,t)))}async function Nk(e,t,n){let{keys:o,to:r,from:l,loop:i,onRest:s,onResolve:a}=t,c=nb.obj(t.default)&&t.default;i&&(t.loop=!1),!1===r&&(t.to=null),!1===l&&(t.from=null);let u=nb.arr(r)||nb.fun(r)?r:void 0;u?(t.to=void 0,t.onRest=void 0,c&&(c.onRest=void 0)):rb(Tk,(n=>{let o=t[n];if(nb.fun(o)){let r=e._events[n];t[n]=({finished:e,cancelled:t})=>{let n=r.get(o);n?(e||(n.finished=!1),t&&(n.cancelled=!0)):r.set(o,{value:null,finished:e||!1,cancelled:t||!1})},c&&(c[n]=t[n])}}));let d=e._state;t.pause===!d.paused?(d.paused=t.pause,ub(t.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(t.pause=!0);let p=(o||Object.keys(e.springs)).map((n=>e.springs[n].start(t))),m=!0===t.cancel||!0===$v(t,"cancel");(u||m&&d.asyncId)&&p.push(ok(++e._lastAsyncId,{props:t,state:d,actions:{pause:tb,resume:tb,start(t,n){m?(ck(d,e._lastAsyncId),n(sk(e))):(t.onRest=s,n(ak(u,t,d,e)))}}})),d.paused&&await new Promise((e=>{d.resumeQueue.add(e)}));let h=rk(e,await Promise.all(p));if(i&&h.finished&&(!n||!h.noop)){let n=wk(t,i,r);if(n)return Ok(e,[n]),Nk(e,n,!0)}return a&&Of.batchedUpdates((()=>a(h,e,e.item))),h}function Lk(e,t){let n=new yk;return n.key=e,t&&lv(n,t),n}function Ak(e,t,n){t.keys&&rb(t.keys,(o=>{(e[o]||(e[o]=n(o)))._prepareNode(t)}))}function Ok(e,t){rb(t,(t=>{Ak(e.springs,t,(t=>Lk(t,e)))}))}var Dk=({children:e,...t})=>{let n=(0,s.useContext)(zk),o=t.pause||!!n.pause,r=t.immediate||!!n.immediate;t=function(e,t){let[n]=(0,s.useState)((()=>({inputs:t,result:e()}))),o=(0,s.useRef)(),r=o.current,l=r;return l?Boolean(t&&l.inputs&&function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(t,l.inputs))||(l={inputs:t,result:e()}):l=n,(0,s.useEffect)((()=>{o.current=l,r==n&&(n.inputs=n.result=void 0)}),[l]),l.result}((()=>({pause:o,immediate:r})),[o,r]);let{Provider:l}=zk;return s.createElement(l,{value:t},e)},zk=function(e,t){return Object.assign(e,s.createContext(t)),e.Provider._context=e,e.Consumer._context=e,e}(Dk,{});Dk.Provider=zk.Provider,Dk.Consumer=zk.Consumer;var Vk=class extends hk{constructor(e,t){super(),this.source=e,this.calc=Ub(...t);let n=this._get(),o=Ov(n);Bv(this,o.create(n))}key;idle=!0;calc;_active=new Set;advance(e){let t=this._get();ob(t,this.get())||(xv(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&Hk(this._active)&&Gk(this)}_get(){let e=nb.arr(this.source)?this.source.map(ev):ib(ev(this.source));return this.calc(...e)}_start(){this.idle&&!Hk(this._active)&&(this.idle=!1,rb(Iv(this),(e=>{e.done=!1})),eb.skipAnimation?(Of.batchedUpdates((()=>this.advance())),Gk(this)):_b.start(this))}_attach(){let e=1;rb(ib(this.source),(t=>{Jb(t)&&lv(t,this),pk(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))})),this.priority=e,this._start()}_detach(){rb(ib(this.source),(e=>{Jb(e)&&iv(e,this)})),this._active.clear(),Gk(this)}eventObserved(e){"change"==e.type?e.idle?this.advance():(this._active.add(e.parent),this._start()):"idle"==e.type?this._active.delete(e.parent):"priority"==e.type&&(this.priority=ib(this.source).reduce(((e,t)=>Math.max(e,(pk(t)?t.priority:0)+1)),0))}};function Fk(e){return!1!==e.idle}function Hk(e){return!e.size||Array.from(e).every(Fk)}function Gk(e){e.idle||(e.idle=!0,rb(Iv(e),(e=>{e.done=!0})),nv(e,{type:"idle",parent:e}))}eb.assign({createStringInterpolator:bv,to:(e,t)=>new Vk(e,t)});_b.advance;const Uk=window.ReactDOM;var $k=/^--/;function jk(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||$k.test(e)||Kk.hasOwnProperty(e)&&Kk[e]?(""+t).trim():t+"px"}var Wk={};var Kk={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Zk=["Webkit","Ms","Moz","O"];Kk=Object.keys(Kk).reduce(((e,t)=>(Zk.forEach((n=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(n,t)]=e[t])),e)),Kk);var qk=/^(matrix|translate|scale|rotate|skew)/,Yk=/^(translate)/,Xk=/^(rotate|skew)/,Qk=(e,t)=>nb.num(e)&&0!==e?e+t:e,Jk=(e,t)=>nb.arr(e)?e.every((e=>Jk(e,t))):nb.num(e)?e===t:parseFloat(e)===t,e_=class extends Nv{constructor({x:e,y:t,z:n,...o}){let r=[],l=[];(e||t||n)&&(r.push([e||0,t||0,n||0]),l.push((e=>[`translate3d(${e.map((e=>Qk(e,"px"))).join(",")})`,Jk(e,0)]))),lb(o,((e,t)=>{if("transform"===t)r.push([e||""]),l.push((e=>[e,""===e]));else if(qk.test(t)){if(delete o[t],nb.und(e))return;let n=Yk.test(t)?"px":Xk.test(t)?"deg":"";r.push(ib(e)),l.push("rotate3d"===t?([e,t,o,r])=>[`rotate3d(${e},${t},${o},${Qk(r,n)})`,Jk(r,0)]:e=>[`${t}(${e.map((e=>Qk(e,n))).join(",")})`,Jk(e,t.startsWith("scale")?1:0)])}})),r.length&&(o.transform=new t_(r,l)),super(o)}},t_=class extends ov{constructor(e,t){super(),this.inputs=e,this.transforms=t}_value=null;get(){return this._value||(this._value=this._get())}_get(){let e="",t=!0;return rb(this.inputs,((n,o)=>{let r=ev(n[0]),[l,i]=this.transforms[o](nb.arr(r)?r:n.map(ev));e+=" "+l,t=t&&i})),t?"none":e}observerAdded(e){1==e&&rb(this.inputs,(e=>rb(e,(e=>Jb(e)&&lv(e,this)))))}observerRemoved(e){0==e&&rb(this.inputs,(e=>rb(e,(e=>Jb(e)&&iv(e,this)))))}eventObserved(e){"change"==e.type&&(this._value=null),nv(this,e)}};eb.assign({batchedUpdates:Uk.unstable_batchedUpdates,createStringInterpolator:bv,colors:{transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199}});var n_=((e,{applyAnimatedValues:t=(()=>!1),createAnimatedStyle:n=(e=>new Nv(e)),getComponentProps:o=(e=>e)}={})=>{let r={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:o},l=e=>{let t=Fv(e)||"Anonymous";return(e=nb.str(e)?l[e]||(l[e]=Dv(e,r)):e[Vv]||(e[Vv]=Dv(e,r))).displayName=`Animated(${t})`,e};return lb(e,((t,n)=>{nb.arr(e)&&(n=Fv(t)),l[n]=l(t)})),{animated:l}})(["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"],{applyAnimatedValues:function(e,t){if(!e.nodeType||!e.setAttribute)return!1;let n="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName,{style:o,children:r,scrollTop:l,scrollLeft:i,viewBox:s,...a}=t,c=Object.values(a),u=Object.keys(a).map((t=>n||e.hasAttribute(t)?t:Wk[t]||(Wk[t]=t.replace(/([A-Z])/g,(e=>"-"+e.toLowerCase())))));void 0!==r&&(e.textContent=r);for(let t in o)if(o.hasOwnProperty(t)){let n=jk(t,o[t]);$k.test(t)?e.style.setProperty(t,n):e.style[t]=n}u.forEach(((t,n)=>{e.setAttribute(t,c[n])})),void 0!==l&&(e.scrollTop=l),void 0!==i&&(e.scrollLeft=i),void 0!==s&&e.setAttribute("viewBox",s)},createAnimatedStyle:e=>new e_(e),getComponentProps:({scrollTop:e,scrollLeft:t,...n})=>n}),o_=n_.animated;function r_(e){return{top:e.offsetTop,left:e.offsetLeft}}const l_=function({triggerAnimationOnChange:e,clientId:t}){const n=(0,u.useRef)(),{isTyping:o,getGlobalBlockCount:r,isBlockSelected:l,isFirstMultiSelectedBlock:i,isBlockMultiSelected:s,isAncestorMultiSelected:a}=(0,d.useSelect)(Nr),{previous:c,prevRect:p}=(0,u.useMemo)((()=>({previous:n.current&&r_(n.current),prevRect:n.current&&n.current.getBoundingClientRect()})),[e]);return(0,u.useLayoutEffect)((()=>{if(!c||!n.current)return;const e=(0,As.getScrollContainer)(n.current),u=l(t),d=u||i(t);function m(){if(d&&p){const t=n.current.getBoundingClientRect().top-p.top;t&&(e.scrollTop+=t)}}if(window.matchMedia("(prefers-reduced-motion: reduce)").matches||o()||r()>200)return void m();const h=u||s(t)||a(t)?"1":"",g=new Pk({x:0,y:0,config:{mass:5,tension:2e3,friction:200},onChange({value:e}){if(!n.current)return;let{x:t,y:o}=e;t=Math.round(t),o=Math.round(o);const r=0===t&&0===o;n.current.style.transformOrigin="center center",n.current.style.transform=r?null:`translate3d(${t}px,${o}px,0)`,n.current.style.zIndex=h,m()}});n.current.style.transform=void 0;const f=r_(n.current),b=Math.round(c.left-f.left),v=Math.round(c.top-f.top);return g.start({x:0,y:0,from:{x:b,y:v}}),()=>{g.stop(),g.set({x:0,y:0})}}),[c,p,t,o,r,l,i,s,a]),n},i_=(0,u.createContext)({}),s_=".block-editor-block-list__block",a_=".block-list-appender",c_=".block-editor-button-block-appender";function u_(e,t){return e.closest(s_)===t.closest(s_)}function d_(e,t){return t.closest([s_,a_,c_].join(","))===e}function p_(e){for(;e&&e.nodeType!==e.ELEMENT_NODE;)e=e.parentNode;if(!e)return;const t=e.closest(s_);return t?t.id.slice(6):void 0}function m_({clientId:e,initialPosition:t}){const n=(0,u.useRef)(),{isBlockSelected:o,isMultiSelecting:r}=(0,d.useSelect)(Nr);return(0,u.useEffect)((()=>{if(!o(e)||r())return;if(null==t)return;if(!n.current)return;const{ownerDocument:l}=n.current;if(d_(n.current,l.activeElement))return;const i=As.focus.tabbable.find(n.current).filter((e=>(0,As.isTextField)(e))),s=-1===t,a=i[s?i.length-1:0]||n.current;if(d_(n.current,a)){if(!n.current.getAttribute("contenteditable")){const e=As.focus.tabbable.findNext(n.current);if(e&&d_(n.current,e)&&(0,As.isFormElement)(e))return void e.focus()}(0,As.placeCaretAtHorizontalEdge)(a,s)}else n.current.focus()}),[t,e]),n}function h_(e){if(e.defaultPrevented)return;const t="mouseover"===e.type?"add":"remove";e.preventDefault(),e.currentTarget.classList[t]("is-hovered")}function g_({isEnabled:e}){return(0,p.useRefEffect)((t=>{if(e)return t.addEventListener("mouseout",h_),t.addEventListener("mouseover",h_),()=>{t.removeEventListener("mouseout",h_),t.removeEventListener("mouseover",h_),t.classList.remove("is-hovered")}}),[e])}function f_(e){const{isBlockSelected:t}=(0,d.useSelect)(Nr),{selectBlock:n,selectionChange:o}=(0,d.useDispatch)(Nr);return(0,p.useRefEffect)((r=>{function l(l){r.parentElement.closest('[contenteditable="true"]')||(t(e)?l.target.isContentEditable||o(e):d_(r,l.target)&&n(e))}return r.addEventListener("focusin",l),()=>{r.removeEventListener("focusin",l)}}),[t,n])}function b_({clientId:e,isSelected:t}){const{getBlockRootClientId:n,getBlockIndex:o}=(0,d.useSelect)(Nr),{insertAfterBlock:r,removeBlock:l}=(0,d.useDispatch)(Nr);return(0,p.useRefEffect)((n=>{if(t)return n.addEventListener("keydown",o),n.addEventListener("dragstart",i),()=>{n.removeEventListener("keydown",o),n.removeEventListener("dragstart",i)};function o(t){const{keyCode:o,target:i}=t;o!==zs.ENTER&&o!==zs.BACKSPACE&&o!==zs.DELETE||i!==n||(0,As.isTextField)(i)||(t.preventDefault(),o===zs.ENTER?r(e):l(e))}function i(e){e.preventDefault()}}),[e,t,n,o,r,l])}function v_(e){const{isNavigationMode:t,isBlockSelected:n}=(0,d.useSelect)(Nr),{setNavigationMode:o,selectBlock:r}=(0,d.useDispatch)(Nr);return(0,p.useRefEffect)((l=>{function i(l){t()&&!l.defaultPrevented&&(l.preventDefault(),n(e)?o(!1):r(e))}return l.addEventListener("mousedown",i),()=>{l.removeEventListener("mousedown",i)}}),[e,t,n,o])}function k_(){const e=(0,u.useContext)(Kw);return(0,p.useRefEffect)((t=>{if(e)return e.observe(t),()=>{e.unobserve(t)}}),[e])}function __({clientId:e="",isEnabled:t=!0}={}){const{getEnabledClientIdsTree:n}=ie((0,d.useSelect)(Nr));return(0,p.useRefEffect)((o=>{if(!t)return;const r=t=>{(t.target===o||t.target.classList.contains("is-root-container"))&&(t.defaultPrevented||(t.preventDefault(),n(e).forEach((({clientId:e})=>{const t=o.querySelector(`[data-block="${e}"]`);t&&(t.classList.remove("has-editable-outline"),t.offsetWidth,t.classList.add("has-editable-outline"))}))))};return o.addEventListener("click",r),()=>o.removeEventListener("click",r)}),[t])}function y_(e={},{__unstableIsHtml:t}={}){const{clientId:n,className:o,wrapperProps:r={},isAligned:l,index:i,mode:s,name:a,blockApiVersion:c,blockTitle:d,isSelected:m,isSubtreeDisabled:h,isOutlineEnabled:g,hasOverlay:f,initialPosition:v,blockEditingMode:k,isHighlighted:_,isMultiSelected:E,isPartiallySelected:w,isReusable:S,isDragging:C,hasChildSelected:B,removeOutline:I,isBlockMovingMode:T,canInsertMovingBlock:M,isEditingDisabled:P,hasEditableOutline:R,isTemporarilyEditingAsBlocks:N,defaultClassName:L,templateLock:A}=(0,u.useContext)(i_),O=(0,x.sprintf)((0,x.__)("Block: %s"),d),D="html"!==s||t?"":"-visual",z=(0,p.useMergeRefs)([e.ref,m_({clientId:n,initialPosition:v}),gd(n),f_(n),b_({clientId:n,isSelected:m}),v_(n),g_({isEnabled:g}),k_(),l_({triggerAnimationOnChange:i,clientId:n}),(0,p.useDisabled)({isDisabled:!f}),__({clientId:n,isEnabled:"core/block"===a||"contentOnly"===A})]),V=y(),F=!!V[b]&&eg(a)?{"--wp-admin-theme-color":"var(--wp-bound-block-color)"}:{};return c<2&&V.clientId,{tabIndex:"disabled"===k?-1:0,...r,...e,ref:z,id:`block-${n}${D}`,role:"document","aria-label":O,"data-block":n,"data-type":a,"data-title":d,inert:h?"true":void 0,className:ml()("block-editor-block-list__block",{"wp-block":!l,"has-block-overlay":f,"is-selected":m,"is-highlighted":_,"is-multi-selected":E,"is-partially-selected":w,"is-reusable":S,"is-dragging":C,"has-child-selected":B,"remove-outline":I,"is-block-moving-mode":T,"can-insert-moving-block":M,"is-editing-disabled":P,"has-editable-outline":R,"is-content-locked-temporarily-editing-as-blocks":N},o,e.className,r.className,L),style:{...r.style,...e.style,...F}}}function E_({children:e,isHtml:t,...n}){return(0,s.createElement)("div",{...y_(n,{__unstableIsHtml:t})},e)}function w_({block:{__unstableBlockSource:e},mode:t,isLocked:n,canRemove:o,clientId:r,isSelected:l,isSelectionEnabled:i,className:a,__unstableLayoutClassNames:p,name:m,isValid:h,attributes:g,wrapperProps:f,setAttributes:b,onReplace:v,onInsertBlocksAfter:k,onMerge:_,toggleSelection:y}){var E;const{mayDisplayControls:w,mayDisplayParentControls:S,themeSupportsLayout:C,...x}=(0,u.useContext)(i_),{removeBlock:B}=(0,d.useDispatch)(Nr),I=(0,u.useCallback)((()=>B(r)),[r]),T=Ui()||{};let M=(0,s.createElement)(yf,{name:m,isSelected:l,attributes:g,setAttributes:b,insertBlocksAfter:n?void 0:k,onReplace:o?v:void 0,onRemove:o?I:void 0,mergeBlocks:o?_:void 0,clientId:r,isSelectionEnabled:i,toggleSelection:y,__unstableLayoutClassNames:p,__unstableParentLayout:Object.keys(T).length?T:void 0,mayDisplayControls:w,mayDisplayParentControls:S,blockEditingMode:x.blockEditingMode});const P=(0,c.getBlockType)(m);P?.getEditWrapperProps&&(f=function(e,t){const n={...e,...t};return e?.hasOwnProperty("className")&&t?.hasOwnProperty("className")&&(n.className=ml()(e.className,t.className)),e?.hasOwnProperty("style")&&t?.hasOwnProperty("style")&&(n.style={...e.style,...t.style}),n}(f,P.getEditWrapperProps(g)));const R=f&&!!f["data-align"]&&!C,N=a?.includes("is-position-sticky");let L;if(R&&(M=(0,s.createElement)("div",{className:ml()("wp-block",N&&a),"data-align":f["data-align"]},M)),h)L="html"===t?(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{style:{display:"none"}},M),(0,s.createElement)(E_,{isHtml:!0},(0,s.createElement)(Lf,{clientId:r}))):P?.apiVersion>1?M:(0,s.createElement)(E_,null,M);else{const t=e?(0,c.serializeRawBlock)(e):(0,c.getSaveContent)(P,g);L=(0,s.createElement)(E_,{className:"has-warning"},(0,s.createElement)(If,{clientId:r}),(0,s.createElement)(u.RawHTML,null,(0,As.safeHTML)(t)))}const{"data-align":A,...O}=null!==(E=f)&&void 0!==E?E:{};return O.className=ml()(O.className,A&&C&&`align${A}`,!(A&&N)&&a),(0,s.createElement)(i_.Provider,{value:{wrapperProps:O,isAligned:R,...x}},(0,s.createElement)(Rf,{fallback:(0,s.createElement)(E_,{className:"has-warning"},(0,s.createElement)(Mf,null))},L))}y_.save=c.__unstableGetBlockProps;const S_=(0,d.withDispatch)(((e,t,n)=>{const{updateBlockAttributes:o,insertBlocks:r,mergeBlocks:l,replaceBlocks:i,toggleSelection:s,__unstableMarkLastChangeAsPersistent:a,moveBlocksToPosition:u,removeBlock:d}=e(Nr);return{setAttributes(e){const{getMultiSelectedBlockClientIds:r}=n.select(Nr),l=r(),{clientId:i}=t,s=l.length?l:[i];o(s,e)},onInsertBlocks(e,n){const{rootClientId:o}=t;r(e,n,o)},onInsertBlocksAfter(e){const{clientId:o,rootClientId:l}=t,{getBlockIndex:i}=n.select(Nr),s=i(o);r(e,s+1,l)},onMerge(e){const{clientId:o,rootClientId:i}=t,{getPreviousBlockClientId:s,getNextBlockClientId:a,getBlock:p,getBlockAttributes:m,getBlockName:h,getBlockOrder:g,getBlockIndex:f,getBlockRootClientId:b,canInsertBlockType:v}=n.select(Nr);function k(e,t=!0){const o=b(e),l=g(e),[i]=l;1===l.length&&(0,c.isUnmodifiedBlock)(p(i))?d(e):n.batch((()=>{if(v(h(i),o))u([i],e,o,f(e));else{const n=(0,c.switchToBlockType)(p(i),(0,c.getDefaultBlockName)());n&&n.length&&(r(n,f(e),o,t),d(i,!1))}!g(e).length&&(0,c.isUnmodifiedBlock)(p(e))&&d(e,!1)}))}if(e){if(i){const e=a(i);if(e){if(h(i)!==h(e))return void l(i,e);{const t=m(i),o=m(e);if(Object.keys(t).every((e=>t[e]===o[e])))return void n.batch((()=>{u(g(e),e,i),d(e,!1)}))}}}const e=a(o);if(!e)return;g(e).length?k(e,!1):l(o,e)}else{const e=s(o);if(e)l(e,o);else if(i){const e=s(i);if(e&&h(i)===h(e)){const t=m(i),o=m(e);if(Object.keys(t).every((e=>t[e]===o[e])))return void n.batch((()=>{u(g(i),i,e),d(i,!1)}))}k(i)}else d(o)}},onReplace(e,n,o){e.length&&!(0,c.isUnmodifiedDefaultBlock)(e[e.length-1])&&a();const r=1===e?.length&&Array.isArray(e[0])?e[0]:e;i([t.clientId],r,n,o)},toggleSelection(e){s(e)}}}));w_=(0,p.compose)(S_,(0,_l.withFilters)("editor.BlockListBlock"))(w_);const C_=(0,u.memo)((function(e){const{clientId:t,rootClientId:n}=e,o=(0,d.useSelect)((e=>{const{isBlockSelected:o,getBlockMode:r,isSelectionEnabled:l,getTemplateLock:i,getBlockWithoutAttributes:s,getBlockAttributes:a,canRemoveBlock:u,canMoveBlock:d,getSettings:p,__unstableGetTemporarilyEditingAsBlocks:m,getBlockEditingMode:h,getBlockName:g,isFirstMultiSelectedBlock:f,getMultiSelectedBlockClientIds:b,hasSelectedInnerBlock:v,getBlockIndex:k,isTyping:_,isBlockMultiSelected:y,isBlockSubtreeDisabled:E,isBlockHighlighted:w,__unstableIsFullySelected:S,__unstableSelectionHasUnmergeableBlock:C,isBlockBeingDragged:x,isDragging:B,hasBlockMovingClientId:I,canInsertBlockType:T,__unstableHasActiveBlockOverlayActive:M,__unstableGetEditorMode:P,getSelectedBlocksInitialCaretPosition:R}=ie(e(Nr)),N=s(t);if(!N)return;const{hasBlockSupport:L,getActiveBlockVariation:A}=e(c.store),O=o(t),D=u(t,n),z=d(t,n),V=a(t),{name:F,isValid:H}=N,G=(0,c.getBlockType)(F),U=A(F,V),{outlineMode:$,supportsLayout:j}=p(),W=y(t),K=v(t,!0),Z=_(),q=G?.apiVersion>1,Y=I(),X=h(t);return{mode:r(t),isSelectionEnabled:l(),isLocked:!!i(n),templateLock:i(t),canRemove:D,canMove:z,blockWithoutAttributes:N,name:F,attributes:V,isValid:H,isSelected:O,themeSupportsLayout:j,isTemporarilyEditingAsBlocks:m()===t,blockEditingMode:X,mayDisplayControls:O||f(t)&&b().every((e=>g(e)===F)),mayDisplayParentControls:L(g(t),"__experimentalExposeControlsToChildren",!1)&&v(t),index:k(t),blockApiVersion:G?.apiVersion||1,blockTitle:U?.title||G?.title,isSubtreeDisabled:"disabled"===X&&E(t),isOutlineEnabled:$,hasOverlay:M(t)&&!B(),initialPosition:O&&"edit"===P()?R():void 0,isHighlighted:w(t),isMultiSelected:W,isPartiallySelected:W&&!S()&&!C(),isReusable:(0,c.isReusableBlock)(G),isDragging:x(t),hasChildSelected:K,removeOutline:O&&$&&Z,isBlockMovingMode:!!Y,canInsertMovingBlock:Y&&T(g(Y),n),isEditingDisabled:"disabled"===X,hasEditableOutline:"disabled"!==X&&"disabled"===h(n),className:q?V.className:void 0,defaultClassName:q?(0,c.getBlockDefaultClassName)(F):void 0}}),[t,n]),{mode:r,isSelectionEnabled:l,isLocked:i,canRemove:a,canMove:p,blockWithoutAttributes:m,name:h,attributes:g,isValid:f,isSelected:b,themeSupportsLayout:v,isTemporarilyEditingAsBlocks:k,blockEditingMode:_,mayDisplayControls:y,mayDisplayParentControls:E,index:w,blockApiVersion:S,blockTitle:C,isSubtreeDisabled:x,isOutlineEnabled:B,hasOverlay:I,initialPosition:T,isHighlighted:M,isMultiSelected:P,isPartiallySelected:R,isReusable:N,isDragging:L,hasChildSelected:A,removeOutline:O,isBlockMovingMode:D,canInsertMovingBlock:z,templateLock:V,isEditingDisabled:F,hasEditableOutline:H,className:G,defaultClassName:U}=o,$=(0,u.useMemo)((()=>({...m,attributes:g})),[m,g]);if(!o)return null;const j={clientId:t,className:G,index:w,mode:r,name:h,blockApiVersion:S,blockTitle:C,isSelected:b,isSubtreeDisabled:x,isOutlineEnabled:B,hasOverlay:I,initialPosition:T,blockEditingMode:_,isHighlighted:M,isMultiSelected:P,isPartiallySelected:R,isReusable:N,isDragging:L,hasChildSelected:A,removeOutline:O,isBlockMovingMode:D,canInsertMovingBlock:z,templateLock:V,isEditingDisabled:F,hasEditableOutline:H,isTemporarilyEditingAsBlocks:k,defaultClassName:U,mayDisplayControls:y,mayDisplayParentControls:E,themeSupportsLayout:v};return(0,s.createElement)(i_.Provider,{value:j},(0,s.createElement)(w_,{...e,mode:r,isSelectionEnabled:l,isLocked:i,canRemove:a,canMove:p,block:$,name:h,attributes:g,isValid:f,isSelected:b}))})),x_=window.wp.htmlEntities,B_=[(0,u.createInterpolateElement)((0,x.__)("While writing, you can press <kbd>/</kbd> to quickly insert new blocks."),{kbd:(0,s.createElement)("kbd",null)}),(0,u.createInterpolateElement)((0,x.__)("Indent a list by pressing <kbd>space</kbd> at the beginning of a line."),{kbd:(0,s.createElement)("kbd",null)}),(0,u.createInterpolateElement)((0,x.__)("Outdent a list by pressing <kbd>backspace</kbd> at the beginning of a line."),{kbd:(0,s.createElement)("kbd",null)}),(0,x.__)("Drag files into the editor to automatically insert media blocks."),(0,x.__)("Change a block's type by pressing the block icon on the toolbar.")];const I_=function(){const[e]=(0,u.useState)(Math.floor(Math.random()*B_.length));return(0,s.createElement)(_l.Tip,null,B_[e])},T_=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})),M_=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"}));const P_=function({title:e,icon:t,description:n,blockType:o,className:r}){o&&(w()("`blockType` property in `BlockCard component`",{since:"5.7",alternative:"`title, icon and description` properties"}),({title:e,icon:t,description:n}=o));const{parentNavBlockClientId:l}=(0,d.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockParentsByBlockName:n}=e(Nr);return{parentNavBlockClientId:n(t(),"core/navigation",!0)[0]}}),[]),{selectBlock:i}=(0,d.useDispatch)(Nr);return(0,s.createElement)("div",{className:ml()("block-editor-block-card",r)},l&&(0,s.createElement)(_l.Button,{onClick:()=>i(l),label:(0,x.__)("Go to parent Navigation block"),style:{minWidth:24,padding:0},icon:(0,x.isRTL)()?T_:M_,size:"small"}),(0,s.createElement)(qh,{icon:t,showColors:!0}),(0,s.createElement)("div",{className:"block-editor-block-card__content"},(0,s.createElement)("h2",{className:"block-editor-block-card__title"},e),n&&(0,s.createElement)("span",{className:"block-editor-block-card__description"},n)))},R_=(0,p.createHigherOrderComponent)((e=>(0,d.withRegistry)((({useSubRegistry:t=!0,registry:n,...o})=>{if(!t)return(0,s.createElement)(e,{registry:n,...o});const[r,l]=(0,u.useState)(null);return(0,u.useEffect)((()=>{const e=(0,d.createRegistry)({},n);e.registerStore(oe,Rr),l(e)}),[n]),r?(0,s.createElement)(d.RegistryProvider,{value:r},(0,s.createElement)(e,{registry:r,...o})):null}))),"withRegistryProvider"),N_=()=>{};function L_({clientId:e=null,value:t,selection:n,onChange:o=N_,onInput:r=N_}){const l=(0,d.useRegistry)(),{resetBlocks:i,resetSelection:s,replaceInnerBlocks:a,setHasControlledInnerBlocks:p,__unstableMarkNextChangeAsNotPersistent:m}=l.dispatch(Nr),{getBlockName:h,getBlocks:g,getSelectionStart:f,getSelectionEnd:b}=l.select(Nr),v=(0,d.useSelect)((t=>!e||t(Nr).areInnerBlocksControlled(e)),[e]),k=(0,u.useRef)({incoming:null,outgoing:[]}),_=(0,u.useRef)(!1),y=()=>{t&&(m(),e?l.batch((()=>{p(e,!0);const n=t.map((e=>(0,c.cloneBlock)(e)));_.current&&(k.current.incoming=n),m(),a(e,n)})):(_.current&&(k.current.incoming=t),i(t)))},E=(0,u.useRef)(r),w=(0,u.useRef)(o);(0,u.useEffect)((()=>{E.current=r,w.current=o}),[r,o]),(0,u.useEffect)((()=>{k.current.outgoing.includes(t)?k.current.outgoing[k.current.outgoing.length-1]===t&&(k.current.outgoing=[]):g(e)!==t&&(k.current.outgoing=[],y(),n&&s(n.selectionStart,n.selectionEnd,n.initialPosition))}),[t,e]),(0,u.useEffect)((()=>{v||(k.current.outgoing=[],y())}),[v]),(0,u.useEffect)((()=>{const{getSelectedBlocksInitialCaretPosition:t,isLastBlockChangePersistent:n,__unstableIsLastBlockChangeIgnored:o,areInnerBlocksControlled:r}=l.select(Nr);let i=g(e),s=n(),a=!1;_.current=!0;const c=l.subscribe((()=>{if(null!==e&&null===h(e))return;if(!(!e||r(e)))return;const l=n(),c=g(e),u=c!==i;if(i=c,u&&(k.current.incoming||o()))return k.current.incoming=null,void(s=l);if(u||a&&!u&&l&&!s){s=l,k.current.outgoing.push(i);const e=s?w.current:E.current,n=wn.has(i);n&&wn.delete(i),e(i,{selection:{selectionStart:f(),selectionEnd:b(),initialPosition:t()},undoIgnore:n})}a=u}),Nr);return()=>{_.current=!1,c()}}),[l,e]),(0,u.useEffect)((()=>()=>{m(),e?(p(e,!1),m(),a(e,[])):i([])}),[])}const A_=window.wp.keyboardShortcuts;function O_(){return null}O_.Register=function(){const{registerShortcut:e}=(0,d.useDispatch)(A_.store);return(0,u.useEffect)((()=>{e({name:"core/block-editor/duplicate",category:"block",description:(0,x.__)("Duplicate the selected block(s)."),keyCombination:{modifier:"primaryShift",character:"d"}}),e({name:"core/block-editor/remove",category:"block",description:(0,x.__)("Remove the selected block(s)."),keyCombination:{modifier:"access",character:"z"}}),e({name:"core/block-editor/insert-before",category:"block",description:(0,x.__)("Insert a new block before the selected block(s)."),keyCombination:{modifier:"primaryAlt",character:"t"}}),e({name:"core/block-editor/insert-after",category:"block",description:(0,x.__)("Insert a new block after the selected block(s)."),keyCombination:{modifier:"primaryAlt",character:"y"}}),e({name:"core/block-editor/delete-multi-selection",category:"block",description:(0,x.__)("Delete selection."),keyCombination:{character:"del"},aliases:[{character:"backspace"}]}),e({name:"core/block-editor/select-all",category:"selection",description:(0,x.__)("Select all text when typing. Press again to select all blocks."),keyCombination:{modifier:"primary",character:"a"}}),e({name:"core/block-editor/unselect",category:"selection",description:(0,x.__)("Clear selection."),keyCombination:{character:"escape"}}),e({name:"core/block-editor/multi-text-selection",category:"selection",description:(0,x.__)("Select text across multiple blocks."),keyCombination:{modifier:"shift",character:"arrow"}}),e({name:"core/block-editor/focus-toolbar",category:"global",description:(0,x.__)("Navigate to the nearest toolbar."),keyCombination:{modifier:"alt",character:"F10"}}),e({name:"core/block-editor/move-up",category:"block",description:(0,x.__)("Move the selected block(s) up."),keyCombination:{modifier:"secondary",character:"t"}}),e({name:"core/block-editor/move-down",category:"block",description:(0,x.__)("Move the selected block(s) down."),keyCombination:{modifier:"secondary",character:"y"}})}),[e]),null};const D_=O_,z_=R_((e=>{const{children:t,settings:n,stripExperimentalSettings:o=!1}=e,{__experimentalUpdateSettings:r}=ie((0,d.useDispatch)(Nr));return(0,u.useEffect)((()=>{r({...n,__internalIsInitialized:!0},{stripExperimentalSettings:o,reset:!0})}),[n,o,r]),L_(e),(0,s.createElement)(_l.SlotFillProvider,{passthrough:!0},!n?.__unstableIsPreviewMode&&(0,s.createElement)(D_.Register,null),(0,s.createElement)(hd,null,t))})),V_=e=>(0,s.createElement)(z_,{...e,stripExperimentalSettings:!0},e.children);function F_(){const{getSettings:e,hasSelectedBlock:t,hasMultiSelection:n}=(0,d.useSelect)(Nr),{clearSelectedBlock:o}=(0,d.useDispatch)(Nr),{clearBlockSelection:r}=e();return(0,p.useRefEffect)((e=>{if(r)return e.addEventListener("mousedown",l),()=>{e.removeEventListener("mousedown",l)};function l(r){(t()||n())&&r.target===e&&o()}}),[t,n,o,r])}function H_(e){return(0,s.createElement)("div",{ref:F_(),...e})}function G_(e){const{isMultiSelecting:t,getMultiSelectedBlockClientIds:n,hasMultiSelection:o,getSelectedBlockClientId:r,getSelectedBlocksInitialCaretPosition:l,__unstableIsFullySelected:i}=e(Nr);return{isMultiSelecting:t(),multiSelectedBlockClientIds:n(),hasMultiSelection:o(),selectedBlockClientId:r(),initialPosition:l(),isFullSelection:i()}}function U_(){const{initialPosition:e,isMultiSelecting:t,multiSelectedBlockClientIds:n,hasMultiSelection:o,selectedBlockClientId:r,isFullSelection:l}=(0,d.useSelect)(G_,[]);return(0,p.useRefEffect)((r=>{const{ownerDocument:i}=r,{defaultView:s}=i;if(null==e)return;if(!o||t)return;const{length:a}=n;a<2||l&&(r.contentEditable=!0,r.focus(),s.getSelection().removeAllRanges())}),[o,t,n,r,e,l])}function $_(e,t,n,o){let r,l=As.focus.focusable.find(n);return t&&l.reverse(),l=l.slice(l.indexOf(e)+1),o&&(r=e.getBoundingClientRect()),l.find((function(e){if(!(e.closest("[inert]")||1===e.children.length&&u_(e,e.firstElementChild)&&"true"===e.firstElementChild.getAttribute("contenteditable"))){if(!As.focus.tabbable.isTabbableIndex(e))return!1;if(e.isContentEditable&&"true"!==e.contentEditable)return!1;if(o){const t=e.getBoundingClientRect();if(t.left>=r.right||t.right<=r.left)return!1}return!0}}))}function j_(){const{getMultiSelectedBlocksStartClientId:e,getMultiSelectedBlocksEndClientId:t,getSettings:n,hasMultiSelection:o,__unstableIsFullySelected:r}=(0,d.useSelect)(Nr),{selectBlock:l}=(0,d.useDispatch)(Nr);return(0,p.useRefEffect)((i=>{let s;function a(){s=null}function c(a){if(a.defaultPrevented)return;const{keyCode:c,target:u,shiftKey:d,ctrlKey:p,altKey:m,metaKey:h}=a,g=c===zs.UP,f=c===zs.DOWN,b=c===zs.LEFT,v=c===zs.RIGHT,k=g||b,_=b||v,y=g||f,E=_||y,w=d||p||m||h,S=y?As.isVerticalEdge:As.isHorizontalEdge,{ownerDocument:C}=i,{defaultView:x}=C;if(!E)return;if(o()){if(d)return;if(!r())return;return a.preventDefault(),void(k?l(e()):l(t(),-1))}if(!function(e,t,n){const o=t===zs.UP||t===zs.DOWN,{tagName:r}=e,l=e.getAttribute("type");if(o&&!n)return"INPUT"!==r||!["date","datetime-local","month","number","range","time","week"].includes(l);if("INPUT"===r)return["button","checkbox","number","color","file","image","radio","reset","submit"].includes(l);return"TEXTAREA"!==r}(u,c,w))return;y?s||(s=(0,As.computeCaretRect)(x)):s=null;const B=(0,As.isRTL)(u)?!k:k,{keepCaretInsideBlock:I}=n();if(d)(function(e,t){const n=$_(e,t,i);return n&&p_(n)})(u,k)&&S(u,k)&&(i.contentEditable=!0,i.focus());else if(!y||!(0,As.isVerticalEdge)(u,k)||m&&!(0,As.isHorizontalEdge)(u,B)||I){if(_&&x.getSelection().isCollapsed&&(0,As.isHorizontalEdge)(u,B)&&!I){const e=$_(u,B,i);(0,As.placeCaretAtHorizontalEdge)(e,k),a.preventDefault()}}else{const e=$_(u,k,i,!0);e&&((0,As.placeCaretAtVerticalEdge)(e,m?!k:k,m?void 0:s),a.preventDefault())}}return i.addEventListener("mousedown",a),i.addEventListener("keydown",c),()=>{i.removeEventListener("mousedown",a),i.removeEventListener("keydown",c)}}),[])}function W_(){const{getBlockOrder:e,getSelectedBlockClientIds:t,getBlockRootClientId:n}=(0,d.useSelect)(Nr),{multiSelect:o,selectBlock:r}=(0,d.useDispatch)(Nr),l=(0,A_.__unstableUseShortcutEventMatch)();return(0,p.useRefEffect)((i=>{function s(s){if(!l("core/block-editor/select-all",s))return;const a=t();if(a.length<2&&!(0,As.isEntirelySelected)(s.target))return;s.preventDefault();const[c]=a,u=n(c),d=e(u);a.length!==d.length?o(d[0],d[d.length-1]):u&&(i.ownerDocument.defaultView.getSelection().removeAllRanges(),r(u))}return i.addEventListener("keydown",s),()=>{i.removeEventListener("keydown",s)}}),[])}function K_(e,t){e.contentEditable=t,t&&e.focus()}function Z_(){const{startMultiSelect:e,stopMultiSelect:t}=(0,d.useDispatch)(Nr),{isSelectionEnabled:n,hasSelectedBlock:o,isDraggingBlocks:r,isMultiSelecting:l}=(0,d.useSelect)(Nr);return(0,p.useRefEffect)((i=>{const{ownerDocument:s}=i,{defaultView:a}=s;let c,u;function d(){t(),a.removeEventListener("mouseup",d),u=a.requestAnimationFrame((()=>{if(!o())return;K_(i,!1);const e=a.getSelection();if(e.rangeCount){const t=e.getRangeAt(0),{commonAncestorContainer:n}=t,o=t.cloneRange();c.contains(n)&&(c.focus(),e.removeAllRanges(),e.addRange(o))}}))}function p({buttons:t,target:o,relatedTarget:s}){o.contains(s)||r()||1===t&&(l()||i!==o&&"true"===o.getAttribute("contenteditable")&&n()&&(c=o,e(),a.addEventListener("mouseup",d),K_(i,!0)))}return i.addEventListener("mouseout",p),()=>{i.removeEventListener("mouseout",p),a.removeEventListener("mouseup",d),a.cancelAnimationFrame(u)}}),[e,t,n,o])}function q_(e,t){e.contentEditable!==String(t)&&(e.contentEditable=t,t&&e.focus())}function Y_(e){const t=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;return t?.closest("[data-wp-block-attribute-key]")}function X_(){const{multiSelect:e,selectBlock:t,selectionChange:n}=(0,d.useDispatch)(Nr),{getBlockParents:o,getBlockSelectionStart:r,isMultiSelecting:l}=(0,d.useSelect)(Nr);return(0,p.useRefEffect)((i=>{const{ownerDocument:s}=i,{defaultView:a}=s;function c(s){const c=a.getSelection();if(!c.rangeCount)return;const u=function(e){const{anchorNode:t,anchorOffset:n}=e;return t.nodeType===t.TEXT_NODE||0===n?t:t.childNodes[n-1]}(c),d=function(e){const{focusNode:t,focusOffset:n}=e;return t.nodeType===t.TEXT_NODE||n===t.childNodes.length?t:t.childNodes[n]}(c);if(!i.contains(u)||!i.contains(d))return;const p=s.shiftKey&&"mouseup"===s.type;if(c.isCollapsed&&!p){if("true"===i.contentEditable&&!l()){q_(i,!1);let e=u.nodeType===u.ELEMENT_NODE?u:u.parentElement;e=e?.closest("[contenteditable]"),e?.focus()}return}let m=p_(u),h=p_(d);if(p){const e=r(),t=p_(s.target),n=t!==h;(m===h&&c.isCollapsed||!h||n)&&(h=t),m!==e&&(m=e)}if(void 0===m&&void 0===h)return void q_(i,!1);if(m===h)l()?e(m,m):t(m);else{const t=[...o(m),m],r=[...o(h),h],l=function(e,t){let n=0;for(;e[n]===t[n];)n++;return n}(t,r);if(t[l]!==m||r[l]!==h)return void e(t[l],r[l]);const i=Y_(u),s=Y_(d);if(i&&s){var g,f;const e=c.getRangeAt(0),t=(0,Y.create)({element:i,range:e,__unstableIsEditableTree:!0}),o=(0,Y.create)({element:s,range:e,__unstableIsEditableTree:!0}),r=null!==(g=t.start)&&void 0!==g?g:t.end,l=null!==(f=o.start)&&void 0!==f?f:o.end;n({start:{clientId:m,attributeKey:i.dataset.wpBlockAttributeKey,offset:r},end:{clientId:h,attributeKey:s.dataset.wpBlockAttributeKey,offset:l}})}else e(m,h)}}return s.addEventListener("selectionchange",c),a.addEventListener("mouseup",c),()=>{s.removeEventListener("selectionchange",c),a.removeEventListener("mouseup",c)}}),[e,t,n,o])}function Q_(){const{selectBlock:e}=(0,d.useDispatch)(Nr),{isSelectionEnabled:t,getBlockSelectionStart:n,hasMultiSelection:o}=(0,d.useSelect)(Nr);return(0,p.useRefEffect)((r=>{function l(l){if(!t()||0!==l.button)return;const i=n(),s=p_(l.target);l.shiftKey?i!==s&&(r.contentEditable=!0,r.focus()):o()&&e(s)}return r.addEventListener("mousedown",l),()=>{r.removeEventListener("mousedown",l)}}),[e,t,n,o])}function J_(){const{__unstableIsFullySelected:e,getSelectedBlockClientIds:t,__unstableIsSelectionMergeable:n,hasMultiSelection:o}=(0,d.useSelect)(Nr),{replaceBlocks:r,__unstableSplitSelection:l,removeBlocks:i,__unstableDeleteSelection:s,__unstableExpandSelection:a}=(0,d.useDispatch)(Nr);return(0,p.useRefEffect)((u=>{function d(e){"true"===u.contentEditable&&e.preventDefault()}function p(d){d.defaultPrevented||o()&&(d.keyCode===zs.ENTER?(u.contentEditable=!1,d.preventDefault(),e()?r(t(),(0,c.createBlock)((0,c.getDefaultBlockName)())):l()):d.keyCode===zs.BACKSPACE||d.keyCode===zs.DELETE?(u.contentEditable=!1,d.preventDefault(),e()?i(t()):n()?s(d.keyCode===zs.DELETE):a()):1!==d.key.length||d.metaKey||d.ctrlKey||(u.contentEditable=!1,n()?s(d.keyCode===zs.DELETE):(d.preventDefault(),u.ownerDocument.defaultView.getSelection().removeAllRanges())))}function m(e){o()&&(u.contentEditable=!1,n()?s():(e.preventDefault(),u.ownerDocument.defaultView.getSelection().removeAllRanges()))}return u.addEventListener("beforeinput",d),u.addEventListener("keydown",p),u.addEventListener("compositionstart",m),()=>{u.removeEventListener("beforeinput",d),u.removeEventListener("keydown",p),u.removeEventListener("compositionstart",m)}}),[])}function ey(){const{getBlockName:e}=(0,d.useSelect)(Nr),{getBlockType:t}=(0,d.useSelect)(c.store),{createSuccessNotice:n}=(0,d.useDispatch)(Os.store);return(0,u.useCallback)(((o,r)=>{let l="";if(1===r.length){const n=r[0],i=t(e(n))?.title;l="copy"===o?(0,x.sprintf)((0,x.__)('Copied "%s" to clipboard.'),i):(0,x.sprintf)((0,x.__)('Moved "%s" to clipboard.'),i)}else l="copy"===o?(0,x.sprintf)((0,x._n)("Copied %d block to clipboard.","Copied %d blocks to clipboard.",r.length),r.length):(0,x.sprintf)((0,x._n)("Moved %d block to clipboard.","Moved %d blocks to clipboard.",r.length),r.length);n(l,{type:"snackbar"})}),[])}function ty({clipboardData:e}){let t="",n="";try{t=e.getData("text/plain"),n=e.getData("text/html")}catch(t){try{n=e.getData("Text")}catch(e){return}}n=function(e){const t="\x3c!--StartFragment--\x3e",n=e.indexOf(t);if(!(n>-1))return e;const o=(e=e.substring(n+20)).indexOf("\x3c!--EndFragment--\x3e");return o>-1&&(e=e.substring(0,o)),e}(n),n=function(e){const t="<meta charset='utf-8'>";return e.startsWith(t)?e.slice(22):e}(n);const o=(0,As.getFilesFromDataTransfer)(e);return o.length&&!function(e,t){if(t&&1===e?.length&&0===e[0].type.indexOf("image/")){const e=/<\s*img\b/gi;if(1!==t.match(e)?.length)return!0;const n=/<\s*img\b[^>]*\bsrc="file:\/\//i;if(t.match(n))return!0}return!1}(o,n)?{files:o}:{html:n,plainText:t,files:[]}}const ny=Symbol("requiresWrapperOnCopy");function oy(e,t,n){let o=t;const[r]=t;if(r){if(n.select(c.store).getBlockType(r.name)[ny]){const{getBlockRootClientId:e,getBlockName:t,getBlockAttributes:l}=n.select(Nr),i=e(r.clientId),s=t(i);s&&(o=(0,c.createBlock)(s,l(i),o))}}const l=(0,c.serialize)(o);e.clipboardData.setData("text/plain",function(e){e=e.replace(/<br>/g,"\n");return(0,As.__unstableStripHTML)(e).trim().replace(/\n\n+/g,"\n\n")}(l)),e.clipboardData.setData("text/html",l)}function ry(e,t){const{plainText:n,html:o,files:r}=ty(e);let l=[];if(r.length){const e=(0,c.getBlockTransforms)("from");l=r.reduce(((t,n)=>{const o=(0,c.findTransform)(e,(e=>"files"===e.type&&e.isMatch([n])));return o&&t.push(o.transform([n])),t}),[]).flat()}else l=(0,c.pasteHandler)({HTML:o,plainText:n,mode:"BLOCKS",canUserUseUnfilteredHTML:t});return l}function ly(){const e=(0,d.useRegistry)(),{getBlocksByClientId:t,getSelectedBlockClientIds:n,hasMultiSelection:o,getSettings:r,__unstableIsFullySelected:l,__unstableIsSelectionCollapsed:i,__unstableIsSelectionMergeable:s,__unstableGetSelectedBlocksWithPartialSelection:a,canInsertBlockType:c}=(0,d.useSelect)(Nr),{flashBlock:u,removeBlocks:m,replaceBlocks:h,__unstableDeleteSelection:g,__unstableExpandSelection:f,insertBlocks:b}=(0,d.useDispatch)(Nr),v=ey();return(0,p.useRefEffect)((d=>{function p(p){if(p.defaultPrevented)return;const k=n();if(0===k.length)return;if(!o()){const{target:e}=p,{ownerDocument:t}=e;if("copy"===p.type||"cut"===p.type?(0,As.documentHasUncollapsedSelection)(t):(0,As.documentHasSelection)(t))return}if(!d.contains(p.target.ownerDocument.activeElement))return;p.preventDefault();const _=s(),y=i()||l(),E=!y&&!_;if("copy"===p.type||"cut"===p.type)if(1===k.length&&u(k[0]),E)f();else{let n;if(v(p.type,k),y)n=t(k);else{const[e,o]=a();n=[e,...t(k.slice(1,k.length-1)),o]}oy(p,n,e)}if("cut"===p.type)y&&!E?m(k):(p.target.ownerDocument.activeElement.contentEditable=!1,g());else if("paste"===p.type){const{__experimentalCanUserUseUnfilteredHTML:e}=r(),t=ry(p,e);if(1===k.length){const[e]=k;if(t.every((t=>c(t.name,e))))return void b(t,void 0,e)}h(k,t,t.length-1,-1)}}return d.ownerDocument.addEventListener("copy",p),d.ownerDocument.addEventListener("cut",p),d.ownerDocument.addEventListener("paste",p),()=>{d.ownerDocument.removeEventListener("copy",p),d.ownerDocument.removeEventListener("cut",p),d.ownerDocument.removeEventListener("paste",p)}}),[])}function iy(){const[e,t,n]=function(){const e=(0,u.useRef)(),t=(0,u.useRef)(),n=(0,u.useRef)(),{hasMultiSelection:o,getSelectedBlockClientId:r,getBlockCount:l}=(0,d.useSelect)(Nr),{setNavigationMode:i,setLastFocus:a}=ie((0,d.useDispatch)(Nr)),c=(0,d.useSelect)((e=>e(Nr).isNavigationMode()),[]),{getLastFocus:m}=ie((0,d.useSelect)(Nr)),h=c?void 0:"0",g=(0,u.useRef)();function f(t){if(g.current)g.current=null;else if(o())e.current.focus();else if(r())m()?.current.focus();else{i(!0);const n=e.current.ownerDocument===t.target.ownerDocument?e.current:e.current.ownerDocument.defaultView.frameElement,o=t.target.compareDocumentPosition(n)&t.target.DOCUMENT_POSITION_FOLLOWING,r=As.focus.tabbable.find(e.current);r.length&&(o?r[0]:r[r.length-1]).focus()}}const b=(0,s.createElement)("div",{ref:t,tabIndex:h,onFocus:f}),v=(0,s.createElement)("div",{ref:n,tabIndex:h,onFocus:f}),k=(0,p.useRefEffect)((s=>{function c(e){if(e.defaultPrevented)return;if(e.keyCode===zs.ESCAPE&&!o())return e.preventDefault(),void i(!0);if(e.keyCode!==zs.TAB)return;const l=e.shiftKey,a=l?"findPrevious":"findNext";if(!o()&&!r())return void(e.target===s&&i(!0));const c=As.focus.tabbable[a](e.target),u=e.target.closest("[data-block]"),d=u&&c&&(u_(u,c)||d_(u,c));if((0,As.isFormElement)(c)&&d)return;const p=l?t:n;g.current=!0,p.current.focus({preventScroll:!0})}function u(e){a({...m(),current:e.target});const{ownerDocument:t}=s;e.relatedTarget||t.activeElement!==t.body||0!==l()||s.focus()}function d(o){if(o.keyCode!==zs.TAB)return;if("region"===o.target?.getAttribute("role"))return;if(e.current===o.target)return;const r=o.shiftKey?"findPrevious":"findNext",l=As.focus.tabbable[r](o.target);l!==t.current&&l!==n.current||(o.preventDefault(),l.focus({preventScroll:!0}))}const{ownerDocument:p}=s,{defaultView:h}=p;return h.addEventListener("keydown",d),s.addEventListener("keydown",c),s.addEventListener("focusout",u),()=>{h.removeEventListener("keydown",d),s.removeEventListener("keydown",c),s.removeEventListener("focusout",u)}}),[]);return[b,(0,p.useMergeRefs)([e,k]),v]}(),o=(0,d.useSelect)((e=>e(Nr).hasMultiSelection()),[]);return[e,(0,p.useMergeRefs)([t,ly(),J_(),Z_(),X_(),Q_(),U_(),W_(),j_(),(0,p.useRefEffect)((e=>{if(e.tabIndex=0,o)return e.classList.add("has-multi-selection"),e.setAttribute("aria-label",(0,x.__)("Multiple selected blocks")),()=>{e.classList.remove("has-multi-selection"),e.removeAttribute("aria-label")}}),[o])]),n]}const sy=(0,u.forwardRef)((function({children:e,...t},n){const[o,r,l]=iy();return(0,s.createElement)(s.Fragment,null,o,(0,s.createElement)("div",{...t,ref:(0,p.useMergeRefs)([r,n]),className:ml()(t.className,"block-editor-writing-flow")},e),l)}));let ay=null;function cy(e,t,n){const o={};for(const t in e)o[t]=e[t];if(e instanceof n.contentDocument.defaultView.MouseEvent){const e=n.getBoundingClientRect();o.clientX+=e.left,o.clientY+=e.top}const r=new t(e.type,o);o.defaultPrevented&&r.preventDefault();!n.dispatchEvent(r)&&e.preventDefault()}function uy(e){return(0,p.useRefEffect)((()=>{const{defaultView:t}=e;if(!t)return;const{frameElement:n}=t,o=e.documentElement,r=["dragover","mousemove"],l={};for(const e of r)l[e]=e=>{const t=Object.getPrototypeOf(e).constructor.name;cy(e,window[t],n)},o.addEventListener(e,l[e]);return()=>{for(const e of r)o.removeEventListener(e,l[e])}}))}function dy({contentRef:e,children:t,tabIndex:n=0,scale:o=1,frameSize:r=0,expand:l=!1,readonly:i,forwardedRef:a,...c}){const{resolvedAssets:m,isPreviewMode:h}=(0,d.useSelect)((e=>{const t=e(Nr).getSettings();return{resolvedAssets:t.__unstableResolvedAssets,isPreviewMode:t.__unstableIsPreviewMode}}),[]),{styles:g="",scripts:f=""}=m,[b,v]=(0,u.useState)(),[k,_]=(0,u.useState)([]),y=F_(),[E,w,S]=iy(),[C,{height:B}]=(0,p.useResizeObserver)(),I=(0,p.useRefEffect)((e=>{let t;function n(e){e.preventDefault()}function o(){const{contentDocument:o,ownerDocument:r}=e,{documentElement:l}=o;t=o,y(l),_(Array.from(r.body.classList).filter((e=>e.startsWith("admin-color-")||e.startsWith("post-type-")||"wp-embed-responsive"===e))),o.dir=r.dir;for(const e of ay||(ay=Array.from(document.styleSheets).reduce(((e,t)=>{try{t.cssRules}catch(t){return e}const{ownerNode:n,cssRules:o}=t;if(null===n)return e;if(!o)return e;if("wp-reset-editor-styles-css"===n.id)return e;if(!n.id)return e;if(function e(t){return Array.from(t).find((({selectorText:t,conditionText:n,cssRules:o})=>n?e(o):t&&(t.includes(".editor-styles-wrapper")||t.includes(".wp-block"))))}(o)){const t="STYLE"===n.tagName;if(t){const t=n.id.replace("-inline-css","-css"),o=document.getElementById(t);o&&e.push(o.cloneNode(!0))}if(e.push(n.cloneNode(!0)),!t){const t=n.id.replace("-css","-inline-css"),o=document.getElementById(t);o&&e.push(o.cloneNode(!0))}}return e}),[]),ay))o.getElementById(e.id)||(o.head.appendChild(e.cloneNode(!0)),h||console.warn(`${e.id} was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,e));t.addEventListener("dragover",n,!1),t.addEventListener("drop",n,!1)}return e._load=()=>{v(e.contentDocument)},e.addEventListener("load",o),()=>{delete e._load,e.removeEventListener("load",o),t?.removeEventListener("dragover",n),t?.removeEventListener("drop",n)}}),[]),T=(0,p.useDisabled)({isDisabled:!i}),M=(0,p.useMergeRefs)([uy(b),e,y,w,T]),P=`<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset="utf-8">\n\t\t<script>window.frameElement._load()<\/script>\n\t\t<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>\n\t\t${g}\n\t\t${f}\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()<\/script>\n\t</body>\n</html>`,[R,N]=(0,u.useMemo)((()=>{const e=URL.createObjectURL(new window.Blob([P],{type:"text/html"}));return[e,()=>URL.revokeObjectURL(e)]}),[P]);(0,u.useEffect)((()=>N),[N]);const L=B*(1-o)/2;return(0,s.createElement)(s.Fragment,null,n>=0&&E,(0,s.createElement)("iframe",{...c,style:{border:0,...c.style,height:l?B:c.style?.height,marginTop:1!==o?-L+r:c.style?.marginTop,marginBottom:1!==o?-L+r:c.style?.marginBottom,transform:1!==o?`scale( ${o} )`:c.style?.transform,transition:"all .3s"},ref:(0,p.useMergeRefs)([a,I]),tabIndex:n,src:R,title:(0,x.__)("Editor canvas"),onKeyDown:e=>{c.onKeyDown?c.onKeyDown(e):e.currentTarget.ownerDocument!==e.target.ownerDocument&&(e.stopPropagation(),cy(e,window.KeyboardEvent,e.currentTarget))}},b&&(0,u.createPortal)((0,s.createElement)("body",{ref:M,className:ml()("block-editor-iframe__body","editor-styles-wrapper",...k)},C,(0,s.createElement)(_l.__experimentalStyleProvider,{document:b},t)),b.documentElement)),n>=0&&S)}const py=(0,u.forwardRef)((function(e,t){return(0,d.useSelect)((e=>e(Nr).getSettings().__internalIsInitialized),[])?(0,s.createElement)(dy,{...e,forwardedRef:t}):null}));var my=n(4529);const hy=my,gy=(my.stringify,my.fromJSON,my.plugin,my.parse,my.list,my.document,my.comment,my.atRule,my.rule,my.decl,my.root,my.CssSyntaxError);my.Declaration,my.Container,my.Processor,my.Document,my.Comment,my.Warning,my.AtRule,my.Result,my.Input,my.Rule,my.Root,my.Node;var fy=n(8036),by=n.n(fy),vy=n(5404),ky=n.n(vy);const _y=new WeakMap;const yy=(e,t="")=>e.map((e=>{if(_y.has(e))return _y.get(e);const n=function({css:e,ignoredSelectors:t=[],baseURL:n},o=""){if(!o&&!n)return e;try{return hy([o&&by()(o,{ignoredSelectors:[...t,o]}),n&&ky()({rootUrl:n})].filter(Boolean)).process(e,{}).css}catch(e){return e instanceof gy?console.warn("wp.blockEditor.transformStyles Failed to transform CSS.",e.message+"\n"+e.showSourceCode(!1)):console.warn("wp.blockEditor.transformStyles Failed to transform CSS.",e),null}}(e,t);return _y.set(e,n),n}));function Ey(e,t){return(0,u.useCallback)((e=>{if(!e)return;const{ownerDocument:n}=e,{defaultView:o,body:r}=n,l=t?n.querySelector(t):r;let i;if(l)i=o?.getComputedStyle(l,null).getPropertyValue("background-color");else{const e=n.createElement("div");e.classList.add("editor-styles-wrapper"),r.appendChild(e),i=o?.getComputedStyle(e,null).getPropertyValue("background-color"),r.removeChild(e)}const s=Vc(i);s.luminance()>.5||0===s.alpha()?r.classList.remove("is-dark-theme"):r.classList.add("is-dark-theme")}),[e,t])}function wy({styles:e,scope:t}){const n=(0,d.useSelect)((e=>ie(e(Nr)).getStyleOverrides()),[]),[o,r]=(0,u.useMemo)((()=>{const o=Object.values(null!=e?e:[]);for(const[e,t]of n){const n=o.findIndex((({id:t})=>e===t)),r={...t,id:e};-1===n?o.push(r):o[n]=r}return[yy(o.filter((e=>e?.css)),t),o.filter((e=>"svgs"===e.__unstableType)).map((e=>e.assets)).join("")]}),[e,n,t]);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("style",{ref:Ey(o,t)}),o.map(((e,t)=>(0,s.createElement)("style",{key:t},e))),(0,s.createElement)(_l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 0 0",width:"0",height:"0",role:"none",style:{visibility:"hidden",position:"absolute",left:"-9999px",overflow:"hidden"},dangerouslySetInnerHTML:{__html:r}}))}let Sy;Hc([Gc,jc]);const Cy=2e3,xy=[];function By({viewportWidth:e,containerWidth:t,minHeight:n,additionalStyles:o=xy}){e||(e=t);const[r,{height:l}]=(0,p.useResizeObserver)(),{styles:i}=(0,d.useSelect)((e=>({styles:e(Nr).getSettings().styles})),[]),a=(0,u.useMemo)((()=>i?[...i,{css:"body{height:auto;overflow:hidden;border:none;padding:0;}",__unstableType:"presets"},...o]:i),[i,o]);Sy=Sy||(0,u.memo)(Xw);const c=t/e,m=l?t/(l*c):0;return(0,s.createElement)(_l.Disabled,{className:"block-editor-block-preview__content",style:{transform:`scale(${c})`,aspectRatio:m,maxHeight:l>Cy?Cy*c:void 0,minHeight:n}},(0,s.createElement)(py,{contentRef:(0,p.useRefEffect)((e=>{const{ownerDocument:{documentElement:t}}=e;t.classList.add("block-editor-block-preview__content-iframe"),t.style.position="absolute",t.style.width="100%",e.style.boxSizing="border-box",e.style.position="absolute",e.style.width="100%"}),[]),"aria-hidden":!0,tabIndex:-1,style:{position:"absolute",width:e,height:l,pointerEvents:"none",maxHeight:Cy,minHeight:0!==c&&c<1&&n?n/c:n}},(0,s.createElement)(wy,{styles:a}),r,(0,s.createElement)(Sy,{renderAppender:!1})))}function Iy(e){const[t,{width:n}]=(0,p.useResizeObserver)();return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{style:{position:"relative",width:"100%",height:0}},t),(0,s.createElement)("div",{className:"block-editor-block-preview__container"},!!n&&(0,s.createElement)(By,{...e,containerWidth:n})))}const Ty=(0,u.memo)((function({blocks:e,viewportWidth:t=1200,minHeight:n,additionalStyles:o=[],__experimentalMinHeight:r,__experimentalPadding:l}){r&&(n=r,w()("The __experimentalMinHeight prop",{since:"6.2",version:"6.4",alternative:"minHeight"})),l&&(o=[...o,{css:`body { padding: ${l}px; }`}],w()("The __experimentalPadding prop of BlockPreview",{since:"6.2",version:"6.4",alternative:"additionalStyles"}));const i=(0,d.useSelect)((e=>e(Nr).getSettings()),[]),a=(0,u.useMemo)((()=>({...i,focusMode:!1,__unstableIsPreviewMode:!0})),[i]),c=(0,u.useMemo)((()=>Array.isArray(e)?e:[e]),[e]);return e&&0!==e.length?(0,s.createElement)(z_,{value:c,settings:a},(0,s.createElement)(Iy,{viewportWidth:t,minHeight:n,additionalStyles:o})):null}));function My({blocks:e,props:t={},layout:n}){const o=(0,d.useSelect)((e=>e(Nr).getSettings()),[]),r=(0,u.useMemo)((()=>({...o,styles:void 0,focusMode:!1,__unstableIsPreviewMode:!0})),[o]),l=(0,p.useDisabled)(),i=(0,p.useMergeRefs)([t.ref,l]),a=(0,u.useMemo)((()=>Array.isArray(e)?e:[e]),[e]),c=(0,s.createElement)(z_,{value:a,settings:r},(0,s.createElement)(wy,null),(0,s.createElement)(Jw,{renderAppender:!1,layout:n}));return{...t,ref:i,className:ml()(t.className,"block-editor-block-preview__live-content","components-disabled"),children:e?.length?c:null}}const Py=function({item:e}){var t;const{name:n,title:o,icon:r,description:l,initialAttributes:i,example:a}=e,d=(0,c.isReusableBlock)(e),p=(0,u.useMemo)((()=>a?(0,c.getBlockFromExample)(n,{attributes:{...a.attributes,...i},innerBlocks:a.innerBlocks}):(0,c.createBlock)(n,i)),[n,a,i]);return(0,s.createElement)("div",{className:"block-editor-inserter__preview-container"},(0,s.createElement)("div",{className:"block-editor-inserter__preview"},d||a?(0,s.createElement)("div",{className:"block-editor-inserter__preview-content"},(0,s.createElement)(Ty,{blocks:p,viewportWidth:null!==(t=a?.viewportWidth)&&void 0!==t?t:500,additionalStyles:[{css:"body { padding: 24px; }"}]})):(0,s.createElement)("div",{className:"block-editor-inserter__preview-content-missing"},(0,x.__)("No preview available."))),!d&&(0,s.createElement)(P_,{title:o,icon:r,description:l}))},{CompositeItemV2:Ry}=ie(_l.privateApis);const Ny=(0,u.forwardRef)((function({isFirst:e,as:t,children:n,...o},r){return(0,s.createElement)(Ry,{ref:r,role:"option",accessibleWhenDisabled:!0,...o,render:o=>{const r={...o,tabIndex:e?0:o.tabIndex};return t?(0,s.createElement)(t,{...r},n):"function"==typeof n?n(r):(0,s.createElement)(_l.Button,{...r},n)}})})),Ly=(0,s.createElement)(Z.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M8 7h2V5H8v2zm0 6h2v-2H8v2zm0 6h2v-2H8v2zm6-14v2h2V5h-2zm0 8h2v-2h-2v2zm0 6h2v-2h-2v2z"}));function Ay({count:e,icon:t,isPattern:n,fadeWhenDisabled:o}){const r=n&&(0,x.__)("Pattern");return(0,s.createElement)("div",{className:"block-editor-block-draggable-chip-wrapper"},(0,s.createElement)("div",{className:"block-editor-block-draggable-chip","data-testid":"block-draggable-chip"},(0,s.createElement)(_l.Flex,{justify:"center",className:"block-editor-block-draggable-chip__content"},(0,s.createElement)(_l.FlexItem,null,t?(0,s.createElement)(qh,{icon:t}):r||(0,x.sprintf)((0,x._n)("%d block","%d blocks",e),e)),(0,s.createElement)(_l.FlexItem,null,(0,s.createElement)(qh,{icon:Ly})),o&&(0,s.createElement)(_l.FlexItem,{className:"block-editor-block-draggable-chip__disabled"},(0,s.createElement)("span",{className:"block-editor-block-draggable-chip__disabled-icon"})))))}const Oy=({isEnabled:e,blocks:t,icon:n,children:o,pattern:r})=>{const l={type:"inserter",blocks:t},i=(0,d.useSelect)((e=>{const{getBlockType:n}=e(c.store);return 1===t.length&&n(t[0].name)?.icon}),[t]),{startDragging:a,stopDragging:u}=ie((0,d.useDispatch)(Nr));return(0,s.createElement)(_l.Draggable,{__experimentalTransferDataType:"wp-blocks",transferData:l,onDragStart:e=>{a();const n=r?.type===Fn.user&&"unsynced"!==r?.syncStatus?[(0,c.createBlock)("core/block",{ref:r.id})]:t;e.dataTransfer.setData("text/html",(0,c.serialize)(n))},onDragEnd:()=>{u()},__experimentalDragComponent:(0,s.createElement)(Ay,{count:t.length,icon:n||!r&&i,isPattern:!!r})},(({onDraggableStart:t,onDraggableEnd:n})=>o({draggable:e,onDragStart:e?t:void 0,onDragEnd:e?n:void 0})))};const Dy=(0,u.memo)((function({className:e,isFirst:t,item:n,onSelect:o,onHover:r,isDraggable:l,...i}){const a=(0,u.useRef)(!1),d=n.icon?{backgroundColor:n.icon.background,color:n.icon.foreground}:{},p=(0,u.useMemo)((()=>[(0,c.createBlock)(n.name,n.initialAttributes,(0,c.createBlocksFromInnerBlocksTemplate)(n.innerBlocks))]),[n.name,n.initialAttributes,n.innerBlocks]),m=(0,c.isReusableBlock)(n)&&"unsynced"!==n.syncStatus||(0,c.isTemplatePart)(n);return(0,s.createElement)(Oy,{isEnabled:l&&!n.isDisabled,blocks:p,icon:n.icon},(({draggable:l,onDragStart:c,onDragEnd:u})=>(0,s.createElement)("div",{className:ml()("block-editor-block-types-list__list-item",{"is-synced":m}),draggable:l,onDragStart:e=>{a.current=!0,c&&(r(null),c(e))},onDragEnd:e=>{a.current=!1,u&&u(e)}},(0,s.createElement)(Ny,{isFirst:t,className:ml()("block-editor-block-types-list__item",e),disabled:n.isDisabled,onClick:e=>{e.preventDefault(),o(n,(0,zs.isAppleOS)()?e.metaKey:e.ctrlKey),r(null)},onKeyDown:e=>{const{keyCode:t}=e;t===zs.ENTER&&(e.preventDefault(),o(n,(0,zs.isAppleOS)()?e.metaKey:e.ctrlKey),r(null))},onMouseEnter:()=>{a.current||r(n)},onMouseLeave:()=>r(null),...i},(0,s.createElement)("span",{className:"block-editor-block-types-list__item-icon",style:d},(0,s.createElement)(qh,{icon:n.icon,showColors:!0})),(0,s.createElement)("span",{className:"block-editor-block-types-list__item-title"},(0,s.createElement)(_l.__experimentalTruncate,{numberOfLines:3},n.title))))))}));const zy=(0,u.forwardRef)((function(e,t){const[n,o]=(0,u.useState)(!1);return(0,u.useEffect)((()=>{n&&(0,vo.speak)((0,x.__)("Use left and right arrow keys to move through blocks"))}),[n]),(0,s.createElement)("div",{ref:t,role:"listbox","aria-orientation":"horizontal",onFocus:()=>{o(!0)},onBlur:e=>{!e.currentTarget.contains(e.relatedTarget)&&o(!1)},...e})})),{CompositeGroupV2:Vy}=ie(_l.privateApis);const Fy=(0,u.forwardRef)((function(e,t){return(0,s.createElement)(Vy,{role:"presentation",ref:t,...e})}));const Hy=function e({items:t=[],onSelect:n,onHover:o=(()=>{}),children:r,label:l,isDraggable:i=!0}){const a="block-editor-block-types-list",u=(0,p.useInstanceId)(e,a);return(0,s.createElement)(zy,{className:a,"aria-label":l},function(e,t){const n=[];for(let o=0,r=e.length;o<r;o+=t)n.push(e.slice(o,o+t));return n}(t,3).map(((e,t)=>(0,s.createElement)(Fy,{key:t},e.map(((e,r)=>(0,s.createElement)(Dy,{key:e.id,item:e,className:(0,c.getBlockMenuDefaultClassName)(e.id),onSelect:n,onHover:o,isDraggable:i&&!e.isDisabled,isFirst:0===t&&0===r,rowId:`${u}-${t}`})))))),r)};const Gy=function({title:e,icon:t,children:n}){return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"block-editor-inserter__panel-header"},(0,s.createElement)("h2",{className:"block-editor-inserter__panel-title"},e),(0,s.createElement)(_l.Icon,{icon:t})),(0,s.createElement)("div",{className:"block-editor-inserter__panel-content"},n))},{CompositeV2:Uy,useCompositeStoreV2:$y}=ie(_l.privateApis);const jy=function({children:e}){const t=$y({focusShift:!0,focusWrap:"horizontal"});return(0,s.createElement)(Uy,{store:t,render:(0,s.createElement)(s.Fragment,null)},e)},Wy=[];const Ky=function({rootClientId:e,onInsert:t,onHover:n,showMostUsedBlocks:o}){const[r,l,i,a]=qg(e,t),c=(0,u.useMemo)((()=>ne(r,"frecency","desc").slice(0,6)),[r]),d=(0,u.useMemo)((()=>r.filter((e=>!e.category))),[r]),m=(0,u.useMemo)((()=>(0,p.pipe)((e=>e.filter((e=>e.category&&"reusable"!==e.category))),(e=>e.reduce(((e,t)=>{const{category:n}=t;return e[n]||(e[n]=[]),e[n].push(t),e}),{})))(r)),[r]),h=(0,u.useMemo)((()=>{const e={...i};return Object.keys(i).forEach((t=>{e[t]=r.filter((e=>(e=>e.name.split("/")[0])(e)===t)),0===e[t].length&&delete e[t]})),e}),[r,i]);(0,u.useEffect)((()=>()=>n(null)),[]);const g=(0,p.useAsyncList)(l),f=l.length===g.length,b=(0,u.useMemo)((()=>Object.entries(i)),[i]),v=(0,p.useAsyncList)(f?b:Wy);return(0,s.createElement)(jy,null,(0,s.createElement)("div",null,o&&!!c.length&&(0,s.createElement)(Gy,{title:(0,x._x)("Most used","blocks")},(0,s.createElement)(Hy,{items:c,onSelect:a,onHover:n,label:(0,x._x)("Most used","blocks")})),g.map((e=>{const t=m[e.slug];return t&&t.length?(0,s.createElement)(Gy,{key:e.slug,title:e.title,icon:e.icon},(0,s.createElement)(Hy,{items:t,onSelect:a,onHover:n,label:e.title})):null})),f&&d.length>0&&(0,s.createElement)(Gy,{className:"block-editor-inserter__uncategorized-blocks-panel",title:(0,x.__)("Uncategorized")},(0,s.createElement)(Hy,{items:d,onSelect:a,onHover:n,label:(0,x.__)("Uncategorized")})),v.map((([e,t])=>{const o=h[e];return o&&o.length?(0,s.createElement)(Gy,{key:e,title:t.title,icon:t.icon},(0,s.createElement)(Hy,{items:o,onSelect:a,onHover:n,label:t.title})):null}))))};function Zy({selectedCategory:e,patternCategories:t,onClickCategory:n}){const o="block-editor-block-patterns-explorer__sidebar";return(0,s.createElement)("div",{className:`${o}__categories-list`},t.map((({name:t,label:r})=>(0,s.createElement)(_l.Button,{key:t,label:r,className:`${o}__categories-list__item`,isPressed:e===t,onClick:()=>{n(t)}},r))))}function qy({searchValue:e,setSearchValue:t}){return(0,s.createElement)("div",{className:"block-editor-block-patterns-explorer__search"},(0,s.createElement)(_l.SearchControl,{__nextHasNoMarginBottom:!0,onChange:t,value:e,label:(0,x.__)("Search for patterns"),placeholder:(0,x.__)("Search")}))}const Yy=function({selectedCategory:e,patternCategories:t,onClickCategory:n,searchValue:o,setSearchValue:r}){return(0,s.createElement)("div",{className:"block-editor-block-patterns-explorer__sidebar"},(0,s.createElement)(qy,{searchValue:o,setSearchValue:r}),!o&&(0,s.createElement)(Zy,{selectedCategory:e,patternCategories:t,onClickCategory:n}))};function Xy({currentPage:e,numPages:t,changePage:n,totalItems:o}){return(0,s.createElement)(_l.__experimentalVStack,{className:"block-editor-patterns__grid-pagination-wrapper"},(0,s.createElement)(_l.__experimentalText,{variant:"muted"},(0,x.sprintf)((0,x._n)("%s item","%s items",o),o)),t>1&&(0,s.createElement)(_l.__experimentalHStack,{expanded:!1,spacing:3,justify:"flex-start",className:"block-editor-patterns__grid-pagination"},(0,s.createElement)(_l.__experimentalHStack,{expanded:!1,spacing:1,className:"block-editor-patterns__grid-pagination-previous"},(0,s.createElement)(_l.Button,{variant:"tertiary",onClick:()=>n(1),disabled:1===e,"aria-label":(0,x.__)("First page"),__experimentalIsFocusable:!0},(0,s.createElement)("span",null,"«")),(0,s.createElement)(_l.Button,{variant:"tertiary",onClick:()=>n(e-1),disabled:1===e,"aria-label":(0,x.__)("Previous page"),__experimentalIsFocusable:!0},(0,s.createElement)("span",null,"‹"))),(0,s.createElement)(_l.__experimentalText,{variant:"muted"},(0,x.sprintf)((0,x._x)("%1$s of %2$s","paging"),e,t)),(0,s.createElement)(_l.__experimentalHStack,{expanded:!1,spacing:1,className:"block-editor-patterns__grid-pagination-next"},(0,s.createElement)(_l.Button,{variant:"tertiary",onClick:()=>n(e+1),disabled:e===t,"aria-label":(0,x.__)("Next page"),__experimentalIsFocusable:!0},(0,s.createElement)("span",null,"›")),(0,s.createElement)(_l.Button,{variant:"tertiary",onClick:()=>n(t),disabled:e===t,"aria-label":(0,x.__)("Last page"),size:"default",__experimentalIsFocusable:!0},(0,s.createElement)("span",null,"»")))))}const{CompositeV2:Qy,CompositeItemV2:Jy,useCompositeStoreV2:eE}=ie(_l.privateApis),tE=({showTooltip:e,title:t,children:n})=>e?(0,s.createElement)(_l.Tooltip,{text:t},n):(0,s.createElement)(s.Fragment,null,n);function nE({id:e,isDraggable:t,pattern:n,onClick:o,onHover:r,showTooltip:l}){const[i,a]=(0,u.useState)(!1),{blocks:c,viewportWidth:d}=n,m=`block-editor-block-patterns-list__item-description-${(0,p.useInstanceId)(nE)}`;return(0,s.createElement)(Oy,{isEnabled:t,blocks:c,pattern:n},(({draggable:t,onDragStart:u,onDragEnd:p})=>(0,s.createElement)("div",{className:"block-editor-block-patterns-list__list-item",draggable:t,onDragStart:e=>{a(!0),u&&(r?.(null),u(e))},onDragEnd:e=>{a(!1),p&&p(e)}},(0,s.createElement)(tE,{showTooltip:l&&!n.type!==Fn.user,title:n.title},(0,s.createElement)(Jy,{render:(0,s.createElement)("div",{role:"option","aria-label":n.title,"aria-describedby":n.description?m:void 0,className:ml()("block-editor-block-patterns-list__item",{"block-editor-block-patterns-list__list-item-synced":n.type===Fn.user&&!n.syncStatus})}),id:e,onClick:()=>{o(n,c),r?.(null)},onMouseEnter:()=>{i||r?.(n)},onMouseLeave:()=>r?.(null)},(0,s.createElement)(Ty,{blocks:c,viewportWidth:d}),(0,s.createElement)(_l.__experimentalHStack,{className:"block-editor-patterns__pattern-details"},n.type===Fn.user&&!n.syncStatus&&(0,s.createElement)("div",{className:"block-editor-patterns__pattern-icon-wrapper"},(0,s.createElement)(Ti,{className:"block-editor-patterns__pattern-icon",icon:q})),(!l||n.type===Fn.user)&&(0,s.createElement)("div",{className:"block-editor-block-patterns-list__item-title"},n.title)),!!n.description&&(0,s.createElement)(_l.VisuallyHidden,{id:m},n.description))))))}function oE(){return(0,s.createElement)("div",{className:"block-editor-block-patterns-list__item is-placeholder"})}const rE=(0,u.forwardRef)((function({isDraggable:e,blockPatterns:t,shownPatterns:n,onHover:o,onClickPattern:r,orientation:l,label:i=(0,x.__)("Block patterns"),showTitlesAsTooltip:a,pagingProps:c},d){const p=eE({orientation:l}),{setActiveId:m}=p;return(0,u.useEffect)((()=>{m(void 0)}),[m,n,t]),(0,s.createElement)(Qy,{store:p,role:"listbox",className:"block-editor-block-patterns-list","aria-label":i,ref:d},t.map((t=>n.includes(t)?(0,s.createElement)(nE,{key:t.name,id:t.name,pattern:t,onClick:r,onHover:o,isDraggable:e,showTooltip:a}):(0,s.createElement)(oE,{key:t.name}))),c&&(0,s.createElement)(Xy,{...c}))}));const lE=function({rootClientId:e="",insertionIndex:t,clientId:n,isAppender:o,onSelect:r,shouldFocusBlock:l=!0,selectBlockOnInsert:i=!0}){const{getSelectedBlock:s}=(0,d.useSelect)(Nr),{destinationRootClientId:a,destinationIndex:p}=(0,d.useSelect)((r=>{const{getSelectedBlockClientId:l,getBlockRootClientId:i,getBlockIndex:s,getBlockOrder:a}=r(Nr),c=l();let u,d=e;return void 0!==t?u=t:n?u=s(n):!o&&c?(d=i(c),u=s(c)+1):u=a(d).length,{destinationRootClientId:d,destinationIndex:u}}),[e,t,n,o]),{replaceBlocks:m,insertBlocks:h,showInsertionPoint:g,hideInsertionPoint:f}=(0,d.useDispatch)(Nr),b=(0,u.useCallback)(((e,t,n=!1)=>{const u=s();!o&&u&&(0,c.isUnmodifiedDefaultBlock)(u)?m(u.clientId,e,null,l||n?0:null,t):h(e,p,a,i,l||n?0:null,t);const d=Array.isArray(e)?e.length:1,g=(0,x.sprintf)((0,x._n)("%d block added.","%d blocks added.",d),d);(0,vo.speak)(g),r&&r(e)}),[o,s,m,h,a,p,r,l,i]),v=(0,u.useCallback)((e=>{e?g(a,p):f()}),[g,f,a,p]);return[a,b,v]},iE=(e,t)=>{const{patternCategories:n,patterns:o,userPatternCategories:r}=(0,d.useSelect)((e=>{const{__experimentalGetAllowedPatterns:n,getSettings:o}=e(Nr),{__experimentalUserPatternCategories:r,__experimentalBlockPatternCategories:l}=o();return{patterns:n(t),userPatternCategories:r,patternCategories:l}}),[t]),l=(0,u.useMemo)((()=>{const e=[...n];return r?.forEach((t=>{e.find((e=>e.name===t.name))||e.push(t)})),e}),[n,r]),{createSuccessNotice:i}=(0,d.useDispatch)(Os.store),s=(0,u.useCallback)(((t,n)=>{const o=t.type===Fn.user&&"unsynced"!==t.syncStatus?[(0,c.createBlock)("core/block",{ref:t.id})]:n;e((null!=o?o:[]).map((e=>(0,c.cloneBlock)(e))),t.name),i((0,x.sprintf)((0,x.__)('Block pattern "%s" inserted.'),t.title),{type:"snackbar",id:"block-pattern-inserted-notice"})}),[i,e]);return[o,l,s]},sE=20,aE=5;function cE(e,t,n,o=""){const[r,l]=(0,u.useState)(1),i=(0,p.usePrevious)(t),s=(0,p.usePrevious)(o);i===t&&s===o||1===r||l(1);const a=e.length,c=r-1,d=(0,u.useMemo)((()=>e.slice(c*sE,c*sE+sE)),[c,e]),m=(0,p.useAsyncList)(d,{step:aE}),h=Math.ceil(e.length/sE);return(0,u.useEffect)((function(){const e=(0,As.getScrollContainer)(n?.current);e?.scrollTo(0,0)}),[t,n]),{totalItems:a,categoryPatterns:d,categoryPatternsAsyncList:m,numPages:h,changePage:e=>{const t=(0,As.getScrollContainer)(n?.current);t?.scrollTo(0,0),l(e)},currentPage:r}}function uE({filterValue:e,filteredBlockPatternsLength:t}){return e?(0,s.createElement)(_l.__experimentalHeading,{level:2,lineHeight:"48px",className:"block-editor-block-patterns-explorer__search-results-count"},(0,x.sprintf)((0,x._n)("%d pattern found","%d patterns found",t),t)):null}const dE=function({searchValue:e,selectedCategory:t,patternCategories:n,rootClientId:o}){const r=(0,u.useRef)(),l=(0,p.useDebounce)(vo.speak,500),[i,a]=lE({rootClientId:o,shouldFocusBlock:!0}),[c,,d]=iE(a,i),m=(0,u.useMemo)((()=>n.map((e=>e.name))),[n]),h=(0,u.useMemo)((()=>{const n=c.filter((e=>{if(t===Gn.name)return!0;if(t===Un.name&&e.type===Fn.user)return!0;if("uncategorized"===t){const t=e.categories.some((e=>m.includes(e)));return!e.categories?.length||!t}return e.categories?.includes(t)}));return e?Kg(n,e):n}),[e,c,t,m]);(0,u.useEffect)((()=>{if(!e)return;const t=h.length,n=(0,x.sprintf)((0,x._n)("%d result found.","%d results found.",t),t);l(n)}),[e,l,h.length]);const g=cE(h,t,r),[f,b]=(0,u.useState)(e);e!==f&&(b(e),g.changePage(1));const v=!!h?.length;return(0,s.createElement)("div",{className:"block-editor-block-patterns-explorer__list",ref:r},(0,s.createElement)(uE,{filterValue:e,filteredBlockPatternsLength:h.length}),(0,s.createElement)(jy,null,v&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(rE,{shownPatterns:g.categoryPatternsAsyncList,blockPatterns:g.categoryPatterns,onClickPattern:d,isDraggable:!1}),(0,s.createElement)(Xy,{...g}))))};function pE(e,t="all"){const[n,o]=iE(void 0,e),r=(0,u.useMemo)((()=>"all"===t?n:n.filter((e=>!$n(e,t)))),[t,n]),l=(0,u.useMemo)((()=>{const e=o.filter((e=>r.some((t=>t.categories?.includes(e.name))))).sort(((e,t)=>e.label.localeCompare(t.label)));return r.some((e=>!function(e,t){return!(!e.categories||!e.categories.length)&&e.categories.some((e=>t.some((t=>t.name===e))))}(e,o)))&&!e.find((e=>"uncategorized"===e.name))&&e.push({name:"uncategorized",label:(0,x._x)("Uncategorized")}),r.some((e=>e.type===Fn.user))&&e.unshift(Un),r.length>0&&e.unshift({name:Gn.name,label:Gn.label}),(0,vo.speak)((0,x.sprintf)((0,x._n)("%d category button displayed.","%d category buttons displayed.",e.length),e.length)),e}),[o,r]);return l}function mE({initialCategory:e,rootClientId:t}){const[n,o]=(0,u.useState)(""),[r,l]=(0,u.useState)("all"),[i,a]=(0,u.useState)(e?.name),c=pE(t,r);return(0,s.createElement)("div",{className:"block-editor-block-patterns-explorer"},(0,s.createElement)(Yy,{selectedCategory:i,patternCategories:c,onClickCategory:a,searchValue:n,setSearchValue:o,patternSourceFilter:r,setPatternSourceFilter:l}),(0,s.createElement)(dE,{searchValue:n,selectedCategory:i,patternCategories:c,patternSourceFilter:r,rootClientId:t}))}const hE=function({onModalClose:e,...t}){return(0,s.createElement)(_l.Modal,{title:(0,x.__)("Patterns"),onRequestClose:e,isFullScreen:!0},(0,s.createElement)(mE,{...t}))};function gE({title:e}){return(0,s.createElement)(_l.__experimentalVStack,{spacing:0},(0,s.createElement)(_l.__experimentalView,null,(0,s.createElement)(_l.__experimentalSpacer,{marginBottom:0,paddingX:4,paddingY:3},(0,s.createElement)(_l.__experimentalHStack,{spacing:2},(0,s.createElement)(_l.__experimentalNavigatorBackButton,{style:{minWidth:24,padding:0},icon:(0,x.isRTL)()?T_:M_,isSmall:!0,"aria-label":(0,x.__)("Navigate to the previous view")}),(0,s.createElement)(_l.__experimentalSpacer,null,(0,s.createElement)(_l.__experimentalHeading,{level:5},e))))))}function fE({categories:e,children:t}){return(0,s.createElement)(_l.__experimentalNavigatorProvider,{initialPath:"/",className:"block-editor-inserter__mobile-tab-navigation"},(0,s.createElement)(_l.__experimentalNavigatorScreen,{path:"/"},(0,s.createElement)(_l.__experimentalItemGroup,null,e.map((e=>(0,s.createElement)(_l.__experimentalNavigatorButton,{key:e.name,path:`/category/${e.name}`,as:_l.__experimentalItem,isAction:!0},(0,s.createElement)(_l.__experimentalHStack,null,(0,s.createElement)(_l.FlexBlock,null,e.label),(0,s.createElement)(Ti,{icon:(0,x.isRTL)()?M_:T_}))))))),e.map((e=>(0,s.createElement)(_l.__experimentalNavigatorScreen,{key:e.name,path:`/category/${e.name}`},(0,s.createElement)(gE,{title:(0,x.__)("Back")}),t(e)))))}const bE=e=>"all"!==e,vE=e=>e.name===Un.name;function kE({setPatternSyncFilter:e,setPatternSourceFilter:t,patternSyncFilter:n,patternSourceFilter:o,scrollContainerRef:r,category:l}){const i=l.name===Un.name?Fn.user:o,a=bE(i),c=vE(l),d=(0,u.useMemo)((()=>[{value:"all",label:(0,x._x)("All","patterns")},{value:Hn.full,label:(0,x._x)("Synced","patterns"),disabled:a},{value:Hn.unsynced,label:(0,x._x)("Not synced","patterns"),disabled:a}]),[a]),p=(0,u.useMemo)((()=>[{value:"all",label:(0,x._x)("All","patterns"),disabled:c},{value:Fn.directory,label:(0,x.__)("Pattern Directory"),disabled:c},{value:Fn.theme,label:(0,x.__)("Theme & Plugins"),disabled:c},{value:Fn.user,label:(0,x.__)("User")}]),[c]);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.DropdownMenu,{popoverProps:{placement:"right-end"},label:"Filter patterns",icon:(0,s.createElement)(Ti,{icon:(0,s.createElement)(_l.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(_l.Path,{d:"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z",fill:"#1E1E1E"}))})},(()=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.MenuGroup,{label:(0,x.__)("Source")},(0,s.createElement)(_l.MenuItemsChoice,{choices:p,onSelect:n=>{var o;t(o=n),bE(o)&&e("all"),r.current?.scrollTo(0,0)},value:i})),(0,s.createElement)(_l.MenuGroup,{label:(0,x.__)("Type")},(0,s.createElement)(_l.MenuItemsChoice,{choices:d,onSelect:t=>{e(t),r.current?.scrollTo(0,0)},value:n})),(0,s.createElement)("div",{className:"block-editor-tool-selector__help"},(0,u.createInterpolateElement)((0,x.__)("Patterns are available from the <Link>WordPress.org Pattern Directory</Link>, bundled in the active theme, or created by users on this site. Only patterns created on this site can be synced."),{Link:(0,s.createElement)(_l.ExternalLink,{href:(0,x.__)("https://wordpress.org/patterns/")})}))))))}const _E=()=>{};function yE({rootClientId:e,onInsert:t,onHover:n=_E,category:o,showTitlesAsTooltip:r}){const[l,,i]=iE(t,e),[a,c]=(0,u.useState)("all"),[d,p]=(0,u.useState)("all"),m=pE(e,d),h=(0,u.useRef)(),g=(0,u.useMemo)((()=>l.filter((e=>!$n(e,d,a)&&(o.name===Gn.name||(o.name===Un.name&&e.type===Fn.user||("uncategorized"===o.name?!e.categories||!e.categories.some((e=>m.some((t=>t.name===e)))):e.categories?.includes(o.name))))))),[l,m,o.name,d,a]),f=cE(g,o,h),{changePage:b}=f;(0,u.useEffect)((()=>()=>n(null)),[]);const v=(0,u.useCallback)((e=>{c(e),b(1)}),[c,b]),k=(0,u.useCallback)((e=>{p(e),b(1)}),[p,b]);return(0,s.createElement)("div",{className:"block-editor-inserter__patterns-category-panel"},(0,s.createElement)(_l.__experimentalVStack,{spacing:2,className:"block-editor-inserter__patterns-category-panel-header"},(0,s.createElement)(_l.__experimentalHStack,null,(0,s.createElement)(_l.FlexBlock,null,(0,s.createElement)(_l.__experimentalHeading,{level:4,as:"div"},o.label)),(0,s.createElement)(kE,{patternSyncFilter:a,patternSourceFilter:d,setPatternSyncFilter:v,setPatternSourceFilter:k,scrollContainerRef:h,category:o})),!g.length&&(0,s.createElement)(_l.__experimentalText,{variant:"muted",className:"block-editor-inserter__patterns-category-no-results"},(0,x.__)("No results found"))),g.length>0&&(0,s.createElement)(rE,{ref:h,shownPatterns:f.categoryPatternsAsyncList,blockPatterns:f.categoryPatterns,onClickPattern:i,onHover:n,label:o.label,orientation:"vertical",category:o.name,isDraggable:!0,showTitlesAsTooltip:r,patternFilter:d,pagingProps:f}))}const EE=function({onSelectCategory:e,selectedCategory:t,onInsert:n,rootClientId:o}){const[r,l]=(0,u.useState)(!1),i=pE(o),a=t||i[0],c=(0,p.useViewportMatch)("medium","<");return(0,s.createElement)(s.Fragment,null,!c&&(0,s.createElement)("div",{className:"block-editor-inserter__block-patterns-tabs-container"},(0,s.createElement)("nav",{"aria-label":(0,x.__)("Block pattern categories"),className:"block-editor-inserter__block-patterns-tabs"},(0,s.createElement)(_l.__experimentalItemGroup,{role:"list"},i.map((n=>(0,s.createElement)(_l.__experimentalItem,{role:"listitem",key:n.name,onClick:()=>e(n),className:n===t?"block-editor-inserter__patterns-category block-editor-inserter__patterns-selected-category":"block-editor-inserter__patterns-category","aria-label":n.label,"aria-current":n===t?"true":void 0},(0,s.createElement)(_l.__experimentalHStack,null,(0,s.createElement)(_l.FlexBlock,null,n.label),(0,s.createElement)(Ti,{icon:(0,x.isRTL)()?M_:T_}))))),(0,s.createElement)("div",{role:"listitem"},(0,s.createElement)(_l.Button,{className:"block-editor-inserter__patterns-explore-button",onClick:()=>l(!0),variant:"secondary"},(0,x.__)("Explore all patterns")))))),c&&(0,s.createElement)(fE,{categories:i},(e=>(0,s.createElement)(yE,{key:e.name,onInsert:n,rootClientId:o,category:e,showTitlesAsTooltip:!1}))),r&&(0,s.createElement)(hE,{initialCategory:a,patternCategories:i,onModalClose:()=>l(!1),rootClientId:o}))};function wE({rootClientId:e,onInsert:t,onHover:n,category:o,showTitlesAsTooltip:r,patternFilter:l}){const i=(0,u.useRef)();return(0,u.useEffect)((()=>{const e=setTimeout((()=>{const[e]=As.focus.tabbable.find(i.current);e?.focus()}));return()=>clearTimeout(e)}),[o]),(0,s.createElement)("div",{ref:i,className:"block-editor-inserter__patterns-category-dialog"},(0,s.createElement)(yE,{key:o.name,rootClientId:e,onInsert:t,onHover:n,category:o,showTitlesAsTooltip:r,patternFilter:l}))}function SE(e){const[t,n]=(0,u.useState)([]),o=(0,d.useSelect)((e=>ie(e(Nr)).getInserterMediaCategories()),[]),{canInsertImage:r,canInsertVideo:l,canInsertAudio:i}=(0,d.useSelect)((t=>{const{canInsertBlockType:n}=t(Nr);return{canInsertImage:n("core/image",e),canInsertVideo:n("core/video",e),canInsertAudio:n("core/audio",e)}}),[e]);return(0,u.useEffect)((()=>{(async()=>{const e=[];if(!o)return;const t=new Map(await Promise.all(o.map((async e=>{if(e.isExternalResource)return[e.name,!0];let t=[];try{t=await e.fetch({per_page:1})}catch(e){}return[e.name,!!t.length]})))),s={image:r,video:l,audio:i};o.forEach((n=>{s[n.mediaType]&&t.get(n.name)&&e.push(n)})),e.length&&n(e)})()}),[r,l,i,o]),t}const CE=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})),xE={image:"img",video:"video",audio:"audio"};function BE(e,t){const n={id:e.id||void 0,caption:e.caption||void 0},o=e.url,r=e.alt||void 0;"image"===t?(n.url=o,n.alt=r):["video","audio"].includes(t)&&(n.src=o);const l=xE[t],i=(0,s.createElement)(l,{src:e.previewUrl||o,alt:r,controls:"audio"===t||void 0,inert:"true",onError:({currentTarget:t})=>{t.src===e.previewUrl&&(t.src=o)}});return[(0,c.createBlock)(`core/${t}`,n),i]}const IE=["image"],TE=25,ME={position:"bottom left",className:"block-editor-inserter__media-list__item-preview-options__popover"},{CompositeItemV2:PE}=ie(_l.privateApis);function RE({category:e,media:t}){if(!e.getReportUrl)return null;const n=e.getReportUrl(t);return(0,s.createElement)(_l.DropdownMenu,{className:"block-editor-inserter__media-list__item-preview-options",label:(0,x.__)("Options"),popoverProps:ME,icon:Ef},(()=>(0,s.createElement)(_l.MenuGroup,null,(0,s.createElement)(_l.MenuItem,{onClick:()=>window.open(n,"_blank").focus(),icon:CE},(0,x.sprintf)((0,x.__)("Report %s"),e.mediaType)))))}function NE({onClose:e,onSubmit:t}){return(0,s.createElement)(_l.Modal,{title:(0,x.__)("Insert external image"),onRequestClose:e,className:"block-editor-inserter-media-tab-media-preview-inserter-external-image-modal"},(0,s.createElement)(_l.__experimentalVStack,{spacing:3},(0,s.createElement)("p",null,(0,x.__)("This image cannot be uploaded to your Media Library, but it can still be inserted as an external image.")),(0,s.createElement)("p",null,(0,x.__)("External images can be removed by the external provider without warning and could even have legal compliance issues related to privacy legislation."))),(0,s.createElement)(_l.Flex,{className:"block-editor-block-lock-modal__actions",justify:"flex-end",expanded:!1},(0,s.createElement)(_l.FlexItem,null,(0,s.createElement)(_l.Button,{variant:"tertiary",onClick:e},(0,x.__)("Cancel"))),(0,s.createElement)(_l.FlexItem,null,(0,s.createElement)(_l.Button,{variant:"primary",onClick:t},(0,x.__)("Insert")))))}function LE({media:e,onClick:t,category:n}){const[o,r]=(0,u.useState)(!1),[l,i]=(0,u.useState)(!1),[a,p]=(0,u.useState)(!1),[m,h]=(0,u.useMemo)((()=>BE(e,n.mediaType)),[e,n.mediaType]),{createErrorNotice:g,createSuccessNotice:f}=(0,d.useDispatch)(Os.store),b=(0,d.useSelect)((e=>e(Nr).getSettings().mediaUpload),[]),v=(0,u.useCallback)((e=>{if(a)return;const n=(0,c.cloneBlock)(e),{id:o,url:l,caption:i}=n.attributes;o?t(n):(p(!0),window.fetch(l).then((e=>e.blob())).then((e=>{b({filesList:[e],additionalData:{caption:i},onFileChange([e]){(0,Ls.isBlobURL)(e.url)||(t({...n,attributes:{...n.attributes,id:e.id,url:e.url}}),f((0,x.__)("Image uploaded and inserted."),{type:"snackbar"}),p(!1))},allowedTypes:IE,onError(e){g(e,{type:"snackbar"}),p(!1)}})})).catch((()=>{r(!0),p(!1)})))}),[a,t,b,g,f]),k="string"==typeof e.title?e.title:e.title?.rendered||(0,x.__)("no title");let _;if(k.length>TE){const e="...";_=k.slice(0,TE-e.length)+e}const y=(0,u.useCallback)((()=>i(!0)),[]),E=(0,u.useCallback)((()=>i(!1)),[]);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Oy,{isEnabled:!0,blocks:[m]},(({draggable:t,onDragStart:o,onDragEnd:r})=>(0,s.createElement)("div",{className:ml()("block-editor-inserter__media-list__list-item",{"is-hovered":l}),draggable:t,onDragStart:o,onDragEnd:r},(0,s.createElement)("div",{onMouseEnter:y,onMouseLeave:E},(0,s.createElement)(_l.Tooltip,{text:_||k},(0,s.createElement)(PE,{render:(0,s.createElement)("div",{"aria-label":k,role:"option",className:"block-editor-inserter__media-list__item"}),onClick:()=>v(m)},(0,s.createElement)("div",{className:"block-editor-inserter__media-list__item-preview"},h,a&&(0,s.createElement)("div",{className:"block-editor-inserter__media-list__item-preview-spinner"},(0,s.createElement)(_l.Spinner,null))))),!a&&(0,s.createElement)(RE,{category:n,media:e}))))),o&&(0,s.createElement)(NE,{onClose:()=>r(!1),onSubmit:()=>{t((0,c.cloneBlock)(m)),f((0,x.__)("Image inserted."),{type:"snackbar"}),r(!1)}}))}const{CompositeV2:AE,useCompositeStoreV2:OE}=ie(_l.privateApis);const DE=function({mediaList:e,category:t,onClick:n,label:o=(0,x.__)("Media List")}){const r=OE();return(0,s.createElement)(AE,{store:r,role:"listbox",className:"block-editor-inserter__media-list","aria-label":o},e.map(((e,o)=>(0,s.createElement)(LE,{key:e.id||e.sourceId||o,media:e,category:t,onClick:n}))))};const zE=function(){return(0,s.createElement)("div",{className:"block-editor-inserter__no-results"},(0,s.createElement)(Ti,{className:"block-editor-inserter__no-results-icon",icon:Zh}),(0,s.createElement)("p",null,(0,x.__)("No results found.")))},VE=10;function FE({rootClientId:e,onInsert:t,category:n}){const o=(0,u.useRef)();return(0,u.useEffect)((()=>{const e=setTimeout((()=>{const[e]=As.focus.tabbable.find(o.current);e?.focus()}));return()=>clearTimeout(e)}),[n]),(0,s.createElement)("div",{ref:o,className:"block-editor-inserter__media-dialog"},(0,s.createElement)(HE,{rootClientId:e,onInsert:t,category:n}))}function HE({rootClientId:e,onInsert:t,category:n}){const[o,r,l]=(0,p.useDebouncedInput)(),{mediaList:i,isLoading:a}=function(e,t={}){const[n,o]=(0,u.useState)(),[r,l]=(0,u.useState)(!1),i=(0,u.useRef)();return(0,u.useEffect)((()=>{(async()=>{const n=JSON.stringify({category:e.name,...t});i.current=n,l(!0),o([]);const r=await(e.fetch?.(t));n===i.current&&(o(r),l(!1))})()}),[e.name,...Object.values(t)]),{mediaList:n,isLoading:r}}(n,{per_page:l?20:VE,search:l}),c="block-editor-inserter__media-panel",d=n.labels.search_items||(0,x.__)("Search");return(0,s.createElement)("div",{className:c},(0,s.createElement)(_l.SearchControl,{className:`${c}-search`,onChange:r,value:o,label:d,placeholder:d}),a&&(0,s.createElement)("div",{className:`${c}-spinner`},(0,s.createElement)(_l.Spinner,null)),!a&&!i?.length&&(0,s.createElement)(zE,null),!a&&!!i?.length&&(0,s.createElement)(DE,{rootClientId:e,onClick:t,mediaList:i,category:n}))}const GE=["image","video","audio"];const UE=function({rootClientId:e,selectedCategory:t,onSelectCategory:n,onInsert:o}){const r=SE(e),l=(0,p.useViewportMatch)("medium","<"),i="block-editor-inserter__media-tabs",a=(0,u.useCallback)((e=>{if(!e?.url)return;const[t]=BE(e,e.type);o(t)}),[o]),c=(0,u.useMemo)((()=>r.map((e=>({...e,label:e.labels.name})))),[r]);return(0,s.createElement)(s.Fragment,null,!l&&(0,s.createElement)("div",{className:`${i}-container`},(0,s.createElement)("nav",{"aria-label":(0,x.__)("Media categories")},(0,s.createElement)(_l.__experimentalItemGroup,{role:"list",className:i},r.map((e=>(0,s.createElement)(_l.__experimentalItem,{role:"listitem",key:e.name,onClick:()=>n(e),className:ml()(`${i}__media-category`,{"is-selected":t===e}),"aria-label":e.labels.name,"aria-current":e===t?"true":void 0},(0,s.createElement)(_l.__experimentalHStack,null,(0,s.createElement)(_l.FlexBlock,null,e.labels.name),(0,s.createElement)(Ti,{icon:(0,x.isRTL)()?M_:T_}))))),(0,s.createElement)("div",{role:"listitem"},(0,s.createElement)(Us,null,(0,s.createElement)(Gs,{multiple:!1,onSelect:a,allowedTypes:GE,render:({open:e})=>(0,s.createElement)(_l.Button,{onClick:t=>{t.target.focus(),e()},className:"block-editor-inserter__media-library-button",variant:"secondary","data-unstable-ignore-focus-outside-for-relatedtarget":".media-modal"},(0,x.__)("Open Media Library"))})))))),l&&(0,s.createElement)(fE,{categories:c},(t=>(0,s.createElement)(HE,{onInsert:o,rootClientId:e,category:t}))))},{Fill:$E,Slot:jE}=(0,_l.createSlotFill)("__unstableInserterMenuExtension");$E.Slot=jE;const WE=$E,KE=[];const ZE=function({filterValue:e,onSelect:t,onHover:n,onHoverPattern:o,rootClientId:r,clientId:l,isAppender:i,__experimentalInsertionIndex:a,maxBlockPatterns:c,maxBlockTypes:m,showBlockDirectory:h=!1,isDraggable:g=!0,shouldFocusBlock:f=!0,prioritizePatterns:b,selectBlockOnInsert:v}){const k=(0,p.useDebounce)(vo.speak,500),{prioritizedBlocks:_}=(0,d.useSelect)((e=>{const t=e(Nr).getBlockListSettings(r);return{prioritizedBlocks:t?.prioritizedInserterBlocks||KE}}),[r]),[y,E]=lE({onSelect:t,rootClientId:r,clientId:l,isAppender:i,insertionIndex:a,shouldFocusBlock:f,selectBlockOnInsert:v}),[w,S,C,B]=qg(y,E),[I,,T]=iE(E,y),M=(0,u.useMemo)((()=>{if(0===c)return[];const t=Kg(I,e);return void 0!==c?t.slice(0,c):t}),[e,I,c]);let P=m;b&&M.length>2&&(P=0);const R=(0,u.useMemo)((()=>{if(0===P)return[];let t=ne(w.filter((e=>"core/block"!==e.name)),"frecency","desc");!e&&_.length&&(t=Yg(t,_));const n=Wg(t,S,C,e);return void 0!==P?n.slice(0,P):n}),[e,w,S,C,P,_]);(0,u.useEffect)((()=>{if(!e)return;const t=R.length+M.length,n=(0,x.sprintf)((0,x._n)("%d result found.","%d results found.",t),t);k(n)}),[e,k,R,M]);const N=(0,p.useAsyncList)(R,{step:9}),L=(0,p.useAsyncList)(N.length===R.length?M:KE),A=R.length>0||M.length>0,O=!!R.length&&(0,s.createElement)(Gy,{title:(0,s.createElement)(_l.VisuallyHidden,null,(0,x.__)("Blocks"))},(0,s.createElement)(Hy,{items:N,onSelect:B,onHover:n,label:(0,x.__)("Blocks"),isDraggable:g})),D=!!M.length&&(0,s.createElement)(Gy,{title:(0,s.createElement)(_l.VisuallyHidden,null,(0,x.__)("Block patterns"))},(0,s.createElement)("div",{className:"block-editor-inserter__quick-inserter-patterns"},(0,s.createElement)(rE,{shownPatterns:L,blockPatterns:M,onClickPattern:T,onHover:o,isDraggable:g})));return(0,s.createElement)(jy,null,!h&&!A&&(0,s.createElement)(zE,null),b?D:O,!!R.length&&!!M.length&&(0,s.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"}),b?O:D,h&&(0,s.createElement)(WE.Slot,{fillProps:{onSelect:B,onHover:n,filterValue:e,hasItems:A,rootClientId:y}},(e=>e.length?e:A?null:(0,s.createElement)(zE,null))))},{Tabs:qE}=ie(_l.privateApis),YE={name:"blocks",title:(0,x.__)("Blocks")},XE={name:"patterns",title:(0,x.__)("Patterns")},QE={name:"media",title:(0,x.__)("Media")};const JE=function({showPatterns:e=!1,showMedia:t=!1,onSelect:n,tabsContents:o}){const r=[YE,e&&XE,t&&QE].filter(Boolean);return(0,s.createElement)("div",{className:"block-editor-inserter__tabs"},(0,s.createElement)(qE,{onSelect:n},(0,s.createElement)(qE.TabList,null,r.map((e=>(0,s.createElement)(qE.Tab,{key:e.name,tabId:e.name},e.title)))),r.map((e=>(0,s.createElement)(qE.TabPanel,{key:e.name,tabId:e.name,focusable:!1},o[e.name])))))};const ew=(0,u.forwardRef)((function({rootClientId:e,clientId:t,isAppender:n,__experimentalInsertionIndex:o,onSelect:r,showInserterHelpPanel:l,showMostUsedBlocks:i,__experimentalFilterValue:a="",shouldFocusBlock:c=!0},m){const[h,g,f]=(0,p.useDebouncedInput)(a),[b,v]=(0,u.useState)(null),[k,_]=(0,u.useState)(null),[y,E]=(0,u.useState)("all"),[w,S]=(0,u.useState)(null),[C,B]=(0,u.useState)(null),[I,T,M]=lE({rootClientId:e,clientId:t,isAppender:n,insertionIndex:o,shouldFocusBlock:c}),{showPatterns:P}=(0,d.useSelect)((e=>{const{hasAllowedPatterns:t}=ie(e(Nr));return{showPatterns:t(I)}}),[I]),R=SE(I).length>0,N=(0,u.useCallback)(((e,t,n)=>{T(e,t,n),r()}),[T,r]),L=(0,u.useCallback)(((e,t)=>{T(e,{patternName:t}),r()}),[T,r]),A=(0,u.useCallback)((e=>{M(!!e),v(e)}),[M,v]),O=(0,u.useCallback)((e=>{M(!!e)}),[M]),D=(0,u.useCallback)(((e,t)=>{_(e),E(t)}),[_]),z=(0,u.useMemo)((()=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"block-editor-inserter__block-list"},(0,s.createElement)(Ky,{rootClientId:I,onInsert:N,onHover:A,showMostUsedBlocks:i})),l&&(0,s.createElement)("div",{className:"block-editor-inserter__tips"},(0,s.createElement)(_l.VisuallyHidden,{as:"h2"},(0,x.__)("A tip for using the block editor")),(0,s.createElement)(I_,null)))),[I,N,A,i,l]),V=(0,u.useMemo)((()=>(0,s.createElement)(EE,{rootClientId:I,onInsert:L,onSelectCategory:D,selectedCategory:k})),[I,L,D,k]),F=(0,u.useMemo)((()=>(0,s.createElement)(UE,{rootClientId:I,selectedCategory:w,onSelectCategory:S,onInsert:N})),[I,N,w,S]),H=(0,u.useMemo)((()=>({blocks:z,patterns:V,media:F})),[z,F,V]),G=(0,u.useRef)();(0,u.useImperativeHandle)(m,(()=>({focusSearch:()=>{G.current.focus()}})));const U="patterns"===C&&!f&&k,$=!f&&(P||R),j="media"===C&&!f&&w;return(0,s.createElement)("div",{className:"block-editor-inserter__menu"},(0,s.createElement)("div",{className:ml()("block-editor-inserter__main-area",{"show-as-tabs":$})},(0,s.createElement)(_l.SearchControl,{__nextHasNoMarginBottom:!0,className:"block-editor-inserter__search",onChange:e=>{b&&v(null),g(e)},value:h,label:(0,x.__)("Search for blocks and patterns"),placeholder:(0,x.__)("Search"),ref:G}),!!f&&(0,s.createElement)("div",{className:"block-editor-inserter__no-tab-container"},(0,s.createElement)(ZE,{filterValue:f,onSelect:r,onHover:A,onHoverPattern:O,rootClientId:e,clientId:t,isAppender:n,__experimentalInsertionIndex:o,showBlockDirectory:!0,shouldFocusBlock:c})),$&&(0,s.createElement)(JE,{showPatterns:P,showMedia:R,onSelect:e=>{"patterns"!==e&&_(null),B(e)},tabsContents:H}),!f&&!$&&(0,s.createElement)("div",{className:"block-editor-inserter__no-tab-container"},z)),j&&(0,s.createElement)(FE,{rootClientId:I,onInsert:N,category:w}),l&&b&&(0,s.createElement)(_l.Popover,{className:"block-editor-inserter__preview-container__popover",placement:"right-start",offset:16,focusOnMount:!1,animate:!1},(0,s.createElement)(Py,{item:b})),U&&(0,s.createElement)(wE,{rootClientId:I,onInsert:L,onHover:O,category:k,patternFilter:y,showTitlesAsTooltip:!0}))}));function tw({onSelect:e,rootClientId:t,clientId:n,isAppender:o,prioritizePatterns:r,selectBlockOnInsert:l,hasSearch:i=!0}){const[a,c]=(0,u.useState)(""),[p,m]=lE({onSelect:e,rootClientId:t,clientId:n,isAppender:o,selectBlockOnInsert:l}),[h]=qg(p,m),[g]=iE(m,p),{setInserterIsOpened:f,insertionIndex:b}=(0,d.useSelect)((e=>{const{getSettings:t,getBlockIndex:o,getBlockCount:r}=e(Nr),l=t(),i=o(n),s=r();return{setInserterIsOpened:l.__experimentalSetIsInserterOpened,insertionIndex:-1===i?s:i}}),[n]),v=g.length&&(!!a||r),k=i&&(v&&g.length>6||h.length>6);(0,u.useEffect)((()=>{f&&f(!1)}),[f]);let _=0;return v&&(_=r?4:2),(0,s.createElement)("div",{className:ml()("block-editor-inserter__quick-inserter",{"has-search":k,"has-expand":f})},k&&(0,s.createElement)(_l.SearchControl,{__nextHasNoMarginBottom:!0,className:"block-editor-inserter__search",value:a,onChange:e=>{c(e)},label:(0,x.__)("Search for blocks and patterns"),placeholder:(0,x.__)("Search")}),(0,s.createElement)("div",{className:"block-editor-inserter__quick-inserter-results"},(0,s.createElement)(ZE,{filterValue:a,onSelect:e,rootClientId:t,clientId:n,isAppender:o,maxBlockPatterns:_,maxBlockTypes:6,isDraggable:!1,prioritizePatterns:r,selectBlockOnInsert:l})),f&&(0,s.createElement)(_l.Button,{className:"block-editor-inserter__quick-inserter-expand",onClick:()=>{f({rootClientId:t,insertionIndex:b,filterValue:a})},"aria-label":(0,x.__)("Browse all. This will open the main inserter panel in the editor toolbar.")},(0,x.__)("Browse all")))}const nw=({onToggle:e,disabled:t,isOpen:n,blockTitle:o,hasSingleBlockType:r,toggleProps:l={},prioritizePatterns:i})=>{const{as:a=_l.Button,label:c,onClick:u,...d}=l;let p=c;return!p&&r?p=(0,x.sprintf)((0,x._x)("Add %s","directly add the only allowed block"),o):!p&&i?p=(0,x.__)("Add pattern"):p||(p=(0,x._x)("Add block","Generic label for block inserter button")),(0,s.createElement)(a,{icon:na,label:p,tooltipPosition:"bottom",onClick:function(t){e&&e(t),u&&u(t)},className:"block-editor-inserter__toggle","aria-haspopup":!r&&"true","aria-expanded":!r&&n,disabled:t,...d})};class ow extends u.Component{constructor(){super(...arguments),this.onToggle=this.onToggle.bind(this),this.renderToggle=this.renderToggle.bind(this),this.renderContent=this.renderContent.bind(this)}onToggle(e){const{onToggle:t}=this.props;t&&t(e)}renderToggle({onToggle:e,isOpen:t}){const{disabled:n,blockTitle:o,hasSingleBlockType:r,directInsertBlock:l,toggleProps:i,hasItems:s,renderToggle:a=nw,prioritizePatterns:c}=this.props;return a({onToggle:e,isOpen:t,disabled:n||!s,blockTitle:o,hasSingleBlockType:r,directInsertBlock:l,toggleProps:i,prioritizePatterns:c})}renderContent({onClose:e}){const{rootClientId:t,clientId:n,isAppender:o,showInserterHelpPanel:r,__experimentalIsQuick:l,prioritizePatterns:i,onSelectOrClose:a,selectBlockOnInsert:c}=this.props;return l?(0,s.createElement)(tw,{onSelect:t=>{const n=Array.isArray(t)&&t?.length?t[0]:t;a&&"function"==typeof a&&a(n),e()},rootClientId:t,clientId:n,isAppender:o,prioritizePatterns:i,selectBlockOnInsert:c}):(0,s.createElement)(ew,{onSelect:()=>{e()},rootClientId:t,clientId:n,isAppender:o,showInserterHelpPanel:r})}render(){const{position:e,hasSingleBlockType:t,directInsertBlock:n,insertOnlyAllowedBlock:o,__experimentalIsQuick:r,onSelectOrClose:l}=this.props;return t||n?this.renderToggle({onToggle:o}):(0,s.createElement)(_l.Dropdown,{className:"block-editor-inserter",contentClassName:ml()("block-editor-inserter__popover",{"is-quick":r}),popoverProps:{position:e,shift:!0},onToggle:this.onToggle,expandOnMobile:!0,headerTitle:(0,x.__)("Add a block"),renderToggle:this.renderToggle,renderContent:this.renderContent,onClose:l})}}const rw=(0,p.compose)([(0,d.withSelect)(((e,{clientId:t,rootClientId:n,shouldDirectInsert:o=!0})=>{const{getBlockRootClientId:r,hasInserterItems:l,getAllowedBlocks:i,getDirectInsertBlock:s,getSettings:a}=e(Nr),{getBlockVariations:u}=e(c.store),d=i(n=n||r(t)||void 0),p=o&&s(n),m=a(),h=1===d?.length&&0===u(d[0].name,"inserter")?.length;let g=!1;return h&&(g=d[0]),{hasItems:l(n),hasSingleBlockType:h,blockTitle:g?g.title:"",allowedBlockType:g,directInsertBlock:p,rootClientId:n,prioritizePatterns:m.__experimentalPreferPatternsOnRoot&&!n}})),(0,d.withDispatch)(((e,t,{select:n})=>({insertOnlyAllowedBlock(){const{rootClientId:o,clientId:r,isAppender:l,hasSingleBlockType:i,allowedBlockType:s,directInsertBlock:a,onSelectOrClose:u,selectBlockOnInsert:d}=t;if(!i&&!a)return;const{insertBlock:p}=e(Nr);let m;if(a){const e=function(e){const{getBlock:t,getPreviousBlockClientId:l}=n(Nr);if(!e||!r&&!o)return{};const i={};let s={};if(r){const e=t(r),n=t(l(r));e?.name===n?.name&&(s=n?.attributes||{})}else{const e=t(o);if(e?.innerBlocks?.length){const t=e.innerBlocks[e.innerBlocks.length-1];a&&a?.name===t.name&&(s=t.attributes)}}return e.forEach((e=>{s.hasOwnProperty(e)&&(i[e]=s[e])})),i}(a.attributesToCopy);m=(0,c.createBlock)(a.name,{...a.attributes||{},...e})}else m=(0,c.createBlock)(s.name);p(m,function(){const{getBlockIndex:e,getBlockSelectionEnd:t,getBlockOrder:i,getBlockRootClientId:s}=n(Nr);if(r)return e(r);const a=t();return!l&&a&&s(a)===o?e(a)+1:i(o).length}(),o,d),u&&u({clientId:m?.clientId});const h=(0,x.sprintf)((0,x.__)("%s block added"),s.title);(0,vo.speak)(h)}}))),(0,p.ifCondition)((({hasItems:e,isAppender:t,rootClientId:n,clientId:o})=>e||!t&&!n&&!o))])(ow),lw=(0,u.forwardRef)(((e,t)=>(0,s.createElement)(rw,{ref:t,...e}))),iw="\ufeff";function sw({rootClientId:e}){const{showPrompt:t,isLocked:n,placeholder:o}=(0,d.useSelect)((t=>{const{getBlockCount:n,getSettings:o,getTemplateLock:r}=t(Nr),l=!n(e),{bodyPlaceholder:i}=o();return{showPrompt:l,isLocked:!!r(e),placeholder:i}}),[e]),{insertDefaultBlock:r,startTyping:l}=(0,d.useDispatch)(Nr);if(n)return null;const i=(0,x_.decodeEntities)(o)||(0,x.__)("Type / to choose a block"),a=()=>{r(void 0,e),l()};return(0,s.createElement)("div",{"data-root-client-id":e||"",className:ml()("block-editor-default-block-appender",{"has-visible-prompt":t})},(0,s.createElement)("p",{tabIndex:"0",role:"button","aria-label":(0,x.__)("Add default block"),className:"block-editor-default-block-appender__content",onKeyDown:e=>{zs.ENTER!==e.keyCode&&zs.SPACE!==e.keyCode||a()},onClick:()=>a(),onFocus:()=>{t&&a()}},t?i:iw),(0,s.createElement)(lw,{rootClientId:e,position:"bottom right",isAppender:!0,__experimentalIsQuick:!0}))}function aw({rootClientId:e,className:t,onFocus:n,tabIndex:o},r){return(0,s.createElement)(lw,{position:"bottom center",rootClientId:e,__experimentalIsQuick:!0,renderToggle:({onToggle:e,disabled:l,isOpen:i,blockTitle:a,hasSingleBlockType:c})=>{let u;u=c?(0,x.sprintf)((0,x._x)("Add %s","directly add the only allowed block"),a):(0,x._x)("Add block","Generic label for block inserter button");const d=!c;let p=(0,s.createElement)(_l.Button,{ref:r,onFocus:n,tabIndex:o,className:ml()(t,"block-editor-button-block-appender"),onClick:e,"aria-haspopup":d?"true":void 0,"aria-expanded":d?i:void 0,disabled:l,label:u},!c&&(0,s.createElement)(_l.VisuallyHidden,{as:"span"},u),(0,s.createElement)(Ti,{icon:na}));return(d||c)&&(p=(0,s.createElement)(_l.Tooltip,{text:u},p)),p},isAppender:!0})}const cw=(0,u.forwardRef)(((e,t)=>(w()("wp.blockEditor.ButtonBlockerAppender",{alternative:"wp.blockEditor.ButtonBlockAppender",since:"5.9"}),aw(e,t)))),uw=(0,u.forwardRef)(aw);function dw({rootClientId:e}){return(0,d.useSelect)((t=>t(Nr).canInsertBlockType((0,c.getDefaultBlockName)(),e)))?(0,s.createElement)(sw,{rootClientId:e}):(0,s.createElement)(uw,{rootClientId:e,className:"block-list-appender__toggle"})}function pw({rootClientId:e,CustomAppender:t,className:n,tagName:o="div"}){const r=(0,d.useSelect)((t=>{const{getBlockInsertionPoint:n,isBlockInsertionPointVisible:o,getBlockCount:r}=t(Nr),l=n();return o()&&e===l?.rootClientId&&0===r(e)}),[e]);return(0,s.createElement)(o,{tabIndex:-1,className:ml()("block-list-appender wp-block",n,{"is-drag-over":r}),contentEditable:!1,"data-block":!0},t?(0,s.createElement)(t,null):(0,s.createElement)(dw,{rootClientId:e}))}const mw=Number.MAX_SAFE_INTEGER;(0,u.createContext)();const hw=function({previousClientId:e,nextClientId:t,children:n,__unstablePopoverSlot:o,__unstableContentRef:r,operation:l="insert",nearestSide:i="right",...a}){const[c,p]=(0,u.useReducer)((e=>(e+1)%mw),0),{orientation:m,rootClientId:h,isVisible:g}=(0,d.useSelect)((n=>{const{getBlockListSettings:o,getBlockRootClientId:r,isBlockVisible:l}=n(Nr),i=r(null!=e?e:t);return{orientation:o(i)?.orientation||"vertical",rootClientId:i,isVisible:l(e)&&l(t)}}),[e,t]),f=bd(e),b=bd(t),v="vertical"===m,k=(0,u.useMemo)((()=>{if(c<0||!f&&!b||!g)return;return{contextElement:"group"===l?b||f:f||b,getBoundingClientRect(){const e=f?f.getBoundingClientRect():null,t=b?b.getBoundingClientRect():null;let n=0,o=0,r=0,s=0;if("group"===l){const l=t||e;o=l.top,r=0,s=l.bottom-l.top,n="left"===i?l.left-2:l.right-2}else v?(o=e?e.bottom:t.top,r=e?e.width:t.width,s=t&&e?t.top-e.bottom:0,n=e?e.left:t.left):(o=e?e.top:t.top,s=e?e.height:t.height,(0,x.isRTL)()?(n=t?t.right:e.left,r=e&&t?e.left-t.right:0):(n=e?e.right:t.left,r=e&&t?t.left-e.right:0));return new window.DOMRect(n,o,r,s)}}}),[f,b,c,v,g,l,i]),_=hm(r);return(0,u.useLayoutEffect)((()=>{if(!f)return;const e=new window.MutationObserver(p);return e.observe(f,{attributes:!0}),()=>{e.disconnect()}}),[f]),(0,u.useLayoutEffect)((()=>{if(!b)return;const e=new window.MutationObserver(p);return e.observe(b,{attributes:!0}),()=>{e.disconnect()}}),[b]),(0,u.useLayoutEffect)((()=>{if(f)return f.ownerDocument.defaultView.addEventListener("resize",p),()=>{f.ownerDocument.defaultView?.removeEventListener("resize",p)}}),[f]),(f||b)&&g?(0,s.createElement)(_l.Popover,{ref:_,animate:!1,anchor:k,focusOnMount:!1,__unstableSlotName:o,inline:!o,key:t+"--"+h,...a,className:ml()("block-editor-block-popover","block-editor-block-popover__inbetween",a.className),resize:!1,flip:!1,placement:"overlay",variant:"unstyled"},(0,s.createElement)("div",{className:"block-editor-block-popover__inbetween-container"},n)):null},gw={hide:{opacity:0,scaleY:.75},show:{opacity:1,scaleY:1},exit:{opacity:0,scaleY:.9}};const fw=function({__unstablePopoverSlot:e,__unstableContentRef:t}){const{clientId:n}=(0,d.useSelect)((e=>{const{getBlockOrder:t,getBlockInsertionPoint:n}=e(Nr),o=n(),r=t(o.rootClientId);return r.length?{clientId:r[o.index]}:{}}),[]),o=(0,p.useReducedMotion)();return(0,s.createElement)(fm,{clientId:n,__unstableCoverTarget:!0,__unstablePopoverSlot:e,__unstableContentRef:t,className:"block-editor-block-popover__drop-zone"},(0,s.createElement)(_l.__unstableMotion.div,{"data-testid":"block-popover-drop-zone",initial:o?gw.show:gw.hide,animate:gw.show,exit:o?gw.show:gw.exit,className:"block-editor-block-popover__drop-zone-foreground"}))},bw=(0,u.createContext)();function vw({__unstablePopoverSlot:e,__unstableContentRef:t,operation:n="insert",nearestSide:o="right"}){const{selectBlock:r,hideInsertionPoint:l}=(0,d.useDispatch)(Nr),i=(0,u.useContext)(bw),a=(0,u.useRef)(),{orientation:c,previousClientId:m,nextClientId:h,rootClientId:g,isInserterShown:f,isDistractionFree:b,isNavigationMode:v}=(0,d.useSelect)((e=>{const{getBlockOrder:t,getBlockListSettings:n,getBlockInsertionPoint:o,isBlockBeingDragged:r,getPreviousBlockClientId:l,getNextBlockClientId:i,getSettings:s,isNavigationMode:a}=e(Nr),c=o(),u=t(c.rootClientId);if(!u.length)return{};let d=u[c.index-1],p=u[c.index];for(;r(d);)d=l(d);for(;r(p);)p=i(p);const m=s();return{previousClientId:d,nextClientId:p,orientation:n(c.rootClientId)?.orientation||"vertical",rootClientId:c.rootClientId,isNavigationMode:a(),isDistractionFree:m.isDistractionFree,isInserterShown:c?.__unstableWithInserter}}),[]),{getBlockEditingMode:k}=(0,d.useSelect)(Nr),_=(0,p.useReducedMotion)();const y={start:{opacity:0,scale:0},rest:{opacity:1,scale:1,transition:{delay:f?.5:0,type:"tween"}},hover:{opacity:1,scale:1,transition:{delay:.5,type:"tween"}}},E={start:{scale:_?1:0},rest:{scale:1,transition:{delay:.4,type:"tween"}}};if(b&&!v)return null;const w="horizontal"===c||"group"===n?"is-horizontal":"is-vertical",S=ml()("block-editor-block-list__insertion-point",w);return(0,s.createElement)(hw,{previousClientId:m,nextClientId:h,__unstablePopoverSlot:e,__unstableContentRef:t,operation:n,nearestSide:o},(0,s.createElement)(_l.__unstableMotion.div,{layout:!_,initial:_?"rest":"start",animate:"rest",whileHover:"hover",whileTap:"pressed",exit:"start",ref:a,tabIndex:-1,onClick:function(e){e.target===a.current&&h&&"disabled"!==k(h)&&r(h,-1)},onFocus:function(e){e.target!==a.current&&(i.current=!0)},className:ml()(S,{"is-with-inserter":f}),onHoverEnd:function(e){e.target!==a.current||i.current||l()}},(0,s.createElement)(_l.__unstableMotion.div,{variants:y,className:"block-editor-block-list__insertion-point-indicator","data-testid":"block-list-insertion-point-indicator"}),f&&(0,s.createElement)(_l.__unstableMotion.div,{variants:E,className:ml()("block-editor-block-list__insertion-point-inserter")},(0,s.createElement)(lw,{position:"bottom center",clientId:h,rootClientId:g,__experimentalIsQuick:!0,onToggle:e=>{i.current=e},onSelectOrClose:()=>{i.current=!1}}))))}function kw(e){const{insertionPoint:t,isVisible:n,isBlockListEmpty:o}=(0,d.useSelect)((e=>{const{getBlockInsertionPoint:t,isBlockInsertionPointVisible:n,getBlockCount:o}=e(Nr),r=t();return{insertionPoint:r,isVisible:n(),isBlockListEmpty:0===o(r?.rootClientId)}}),[]);return!n||o?null:"replace"===t.operation?(0,s.createElement)(fw,{key:`${t.rootClientId}-${t.index}`,...e}):(0,s.createElement)(vw,{operation:t.operation,nearestSide:t.nearestSide,...e})}function _w(){const e=(0,u.useContext)(bw),t=(0,d.useSelect)((e=>e(Nr).getSettings().isDistractionFree||"zoom-out"===e(Nr).__unstableGetEditorMode()),[]),{getBlockListSettings:n,getBlockIndex:o,isMultiSelecting:r,getSelectedBlockClientIds:l,getTemplateLock:i,__unstableIsWithinBlockOverlay:s,getBlockEditingMode:a,getBlockName:c}=(0,d.useSelect)(Nr),{showInsertionPoint:m,hideInsertionPoint:h}=(0,d.useDispatch)(Nr);return(0,p.useRefEffect)((u=>{if(!t)return u.addEventListener("mousemove",d),()=>{u.removeEventListener("mousemove",d)};function d(t){if(e.current)return;if(t.target.nodeType===t.target.TEXT_NODE)return;if(r())return;if(!t.target.classList.contains("block-editor-block-list__layout"))return void h();let u;if(!t.target.classList.contains("is-root-container")){u=(t.target.getAttribute("data-block")?t.target:t.target.closest("[data-block]")).getAttribute("data-block")}if(i(u)||"disabled"===a(u)||"core/block"===c(u))return;const d=n(u)?.orientation||"vertical",p=t.clientY,g=t.clientX;let f=Array.from(t.target.children).find((e=>{const t=e.getBoundingClientRect();return e.classList.contains("wp-block")&&"vertical"===d&&t.top>p||e.classList.contains("wp-block")&&"horizontal"===d&&((0,x.isRTL)()?t.right<g:t.left>g)}));if(!f)return void h();if(!f.id&&(f=f.firstElementChild,!f))return void h();const b=f.id.slice(6);if(!b||s(b))return;if(l().includes(b))return;const v=f.getBoundingClientRect();if("horizontal"===d&&(t.clientY>v.bottom||t.clientY<v.top)||"vertical"===d&&(t.clientX>v.right||t.clientX<v.left))return void h();const k=o(b);0!==k?m(u,k,{__unstableWithInserter:!0}):h()}}),[e,n,o,r,m,h,l,t])}const yw=(0,p.createHigherOrderComponent)((e=>t=>{const{clientId:n}=y();return(0,s.createElement)(e,{...t,clientId:n})}),"withClientId"),Ew=yw((({clientId:e,showSeparator:t,isFloating:n,onAddBlock:o,isToggle:r})=>(0,s.createElement)(uw,{className:ml()({"block-list-appender__toggle":r}),rootClientId:e,showSeparator:t,isFloating:n,onAddBlock:o}))),ww=(0,p.compose)([yw,(0,d.withSelect)(((e,{clientId:t})=>{const{getBlockOrder:n}=e(Nr),o=n(t);return{lastBlockClientId:o[o.length-1]}}))])((({clientId:e})=>(0,s.createElement)(sw,{rootClientId:e}))),Sw=new WeakMap;function Cw(e,t,n,o,r,l,i,s,a,c,p,m){const{updateBlockListSettings:h}=(0,d.useDispatch)(Nr),g=(0,d.useRegistry)(),f=function(e){const[t,n]=(0,u.useState)(e);return js()(t,e)||n(e),t}(n),b=(0,u.useMemo)((()=>o),o),v=void 0===a||"contentOnly"===t?t:a;(0,u.useLayoutEffect)((()=>{const t={allowedBlocks:f,prioritizedInserterBlocks:b,templateLock:v};if(void 0!==c&&(t.__experimentalCaptureToolbars=c),void 0!==p)t.orientation=p;else{const e=Vi(m?.type);t.orientation=e.getOrientation(m)}void 0!==i&&(w()("__experimentalDefaultBlock",{alternative:"defaultBlock",since:"6.3",version:"6.4"}),t.defaultBlock=i),void 0!==r&&(t.defaultBlock=r),void 0!==s&&(w()("__experimentalDirectInsert",{alternative:"directInsert",since:"6.3",version:"6.4"}),t.directInsert=s),void 0!==l&&(t.directInsert=l),Sw.get(g)||Sw.set(g,[]),Sw.get(g).push([e,t]),window.queueMicrotask((()=>{Sw.get(g)?.length&&g.batch((()=>{Sw.get(g).forEach((e=>{h(...e)})),Sw.set(g,[])}))}))}),[e,f,b,v,r,l,i,s,c,p,h,m,g])}function xw(e,t,n,o,r,l,i,s,a){return u=>{const{srcRootClientId:d,srcClientIds:p,type:m,blocks:h}=function(e){let t={srcRootClientId:null,srcClientIds:null,srcIndex:null,type:null,blocks:null};if(!e.dataTransfer)return t;try{t=Object.assign(t,JSON.parse(e.dataTransfer.getData("wp-blocks")))}catch(e){return t}return t}(u);if("inserter"===m){i();const e=h.map((e=>(0,c.cloneBlock)(e)));l(e,!0,null)}if("block"===m){const i=n(p[0]);if(d===e&&i===t)return;if(p.includes(e)||o(p).some((t=>t===e)))return;if("group"===s){const e=p.map((e=>a(e)));return void l(e,!0,null,p)}const c=d===e,u=p.length;r(p,d,c&&i<t?t-u:t)}}}function Bw(e,t,n={}){const{operation:o="insert",nearestSide:r="right"}=n,{canInsertBlockType:l,getBlockIndex:i,getClientIdsOfDescendants:s,getBlockOrder:a,getBlocksByClientId:p,getSettings:m,getBlock:h,isGroupable:g}=(0,d.useSelect)(Nr),{getGroupingBlockName:f}=(0,d.useSelect)(c.store),{insertBlocks:b,moveBlocksToPosition:v,updateBlockAttributes:k,clearSelectedBlock:_,replaceBlocks:y,removeBlocks:E}=(0,d.useDispatch)(Nr),w=(0,d.useRegistry)(),S=(0,u.useCallback)(((n,i=!0,s=0,u=[])=>{Array.isArray(n)||(n=[n]);const d=a(e)[t],p=n.map((e=>e.clientId)),m=g([...p,d]);if("replace"===o)y(d,n,void 0,s);else if("group"===o&&m){const t=h(d);"left"===r?n.push(t):n.unshift(t);const o=n.map((e=>(0,c.createBlock)(e.name,e.attributes,e.innerBlocks))),i=n.every((e=>"core/image"===e.name)),a=l("core/gallery",e),p=(0,c.createBlock)(i&&a?"core/gallery":f(),{layout:{type:"flex",flexWrap:i&&a?null:"nowrap"}},o);y([d,...u],p,void 0,s)}else b(n,t,e,i,s)}),[a,e,t,g,o,y,h,r,l,f,b]),C=(0,u.useCallback)(((n,r,l)=>{if("replace"===o){const o=p(n),r=a(e)[t];w.batch((()=>{E(n,!1),y(r,o,void 0,0)}))}else v(n,r,e,l)}),[o,a,p,v,w,E,y,t,e]),x=xw(e,t,i,s,C,S,_,o,h),B=function(e,t,n,o,r){return l=>{if(!t().mediaUpload)return;const i=(0,c.findTransform)((0,c.getBlockTransforms)("from"),(t=>"files"===t.type&&o(t.blockName,e)&&t.isMatch(l)));if(i){const e=i.transform(l,n);r(e)}}}(e,m,k,l,S),I=function(e){return t=>{const n=(0,c.pasteHandler)({HTML:t,mode:"BLOCKS"});n.length&&e(n)}}(S);return e=>{const t=(0,As.getFilesFromDataTransfer)(e.dataTransfer),n=e.dataTransfer.getData("text/html");n?I(n):t.length?B(t):x(e)}}function Iw(e,t,n=["top","bottom","left","right"]){let o,r;return n.forEach((n=>{const l=function(e,t,n){const o="top"===n||"bottom"===n,{x:r,y:l}=e,i=o?r:l,s=o?l:r,a=o?t.left:t.top,c=o?t.right:t.bottom,u=t[n];let d;return d=i>=a&&i<=c?i:i<c?a:c,Math.sqrt((i-d)**2+(s-u)**2)}(e,t,n);(void 0===o||l<o)&&(o=l,r=n)})),[o,r]}function Tw(e,t){return t.left<=e.x&&t.right>=e.x&&t.top<=e.y&&t.bottom>=e.y}const Mw=30,Pw=120,Rw=120;function Nw(e,t,n,o){let r=!0;if(t){const e=t?.map((({name:e})=>e));r=n.every((t=>e?.includes(t)))}const l=n.map((t=>e(t))).every((e=>{const[t]=e?.parent||[];return!t||t===o}));return r&&l}function Lw({dropZoneElement:e,rootClientId:t="",parentClientId:n="",isDisabled:o=!1}={}){const r=(0,d.useRegistry)(),[l,i]=(0,u.useState)({index:null,operation:"insert"}),{getBlockType:s}=(0,d.useSelect)(c.store),{getBlockListSettings:a,getBlocks:m,getBlockIndex:h,getDraggedBlockClientIds:g,getBlockNamesByClientId:f,getAllowedBlocks:b,isDragging:v}=ie((0,d.useSelect)(Nr)),{showInsertionPoint:k,hideInsertionPoint:_,startDragging:y,stopDragging:E}=ie((0,d.useDispatch)(Nr)),w=Bw("before"===l.operation||"after"===l.operation?n:t,l.index,{operation:l.operation,nearestSide:l.nearestSide}),S=(0,p.useThrottle)((0,u.useCallback)(((o,l)=>{v()||y();const u=b(t),d=f([t])[0],p=f(g());if(!Nw(s,u,p,d))return;const _=m(t);if(0===_.length)return void r.batch((()=>{i({index:0,operation:"insert"}),k(t,0,{operation:"insert"})}));const E=_.map((e=>{const t=e.clientId;return{isUnmodifiedDefaultBlock:(0,c.isUnmodifiedDefaultBlock)(e),getBoundingClientRect:()=>l.getElementById(`block-${t}`).getBoundingClientRect(),blockIndex:h(t),blockOrientation:a(t)?.orientation}})),[w,S,C]=function(e,t,n="vertical",o={}){const r="horizontal"===n?["left","right"]:["top","bottom"];let l=0,i="before",s=1/0,a=null,c="right";const{dropZoneElement:u,parentBlockOrientation:d,rootBlockIndex:p=0}=o;if(u&&"horizontal"!==d){const e=u.getBoundingClientRect(),[n,o]=Iw(t,e,["top","bottom"]);if(e.height>Pw&&n<Mw){if("top"===o)return[p,"before"];if("bottom"===o)return[p+1,"after"]}}const m=(0,x.isRTL)();if(u&&"horizontal"===d){const e=u.getBoundingClientRect(),[n,o]=Iw(t,e,["left","right"]);if(e.width>Rw&&n<Mw){if(m&&"right"===o||!m&&"left"===o)return[p,"before"];if(m&&"left"===o||!m&&"right"===o)return[p+1,"after"]}}e.forEach((({isUnmodifiedDefaultBlock:e,getBoundingClientRect:o,blockIndex:u,blockOrientation:d})=>{const p=o();let[h,g]=Iw(t,p,r);const[f,b]=Iw(t,p,["left","right"]),v=Tw(t,p);e&&v?h=0:"vertical"===n&&"horizontal"!==d&&(v&&f<Mw||!v&&function(e,t){return t.top<=e.y&&t.bottom>=e.y}(t,p))&&(a=u,c=b),h<s&&(i="bottom"===g||!m&&"right"===g||m&&"left"===g?"after":"before",s=h,l=u)}));const h=l+("after"===i?1:-1),g=!!e[l]?.isUnmodifiedDefaultBlock,f=!!e[h]?.isUnmodifiedDefaultBlock;if(null!==a)return[a,"group",c];if(!g&&!f)return["after"===i?l+1:l,"insert"];return[g?l:h,"replace"]}(E,{x:o.clientX,y:o.clientY},a(t)?.orientation,{dropZoneElement:e,parentBlockClientId:n,parentBlockOrientation:n?a(n)?.orientation:void 0,rootBlockIndex:h(t)});r.batch((()=>{i({index:w,operation:S,nearestSide:C});const e=["before","after"].includes(S)?n:t;k(e,w,{operation:S,nearestSide:C})}))}),[b,t,f,g,s,m,a,e,n,h,r,k,v,y]),200);return(0,p.__experimentalUseDropZone)({dropZoneElement:e,isDisabled:o,onDrop:w,onDragOver(e){S(e,e.currentTarget.ownerDocument)},onDragLeave(){S.cancel(),_()},onDragEnd(){S.cancel(),E(),_()}})}const Aw={};function Ow({children:e,clientId:t}){const n=function(e){return(0,d.useSelect)((t=>{const n=t(Nr).getBlock(e);if(!n)return;const o=t(c.store).getBlockType(n.name);return o&&0!==Object.keys(o.providesContext).length?Object.fromEntries(Object.entries(o.providesContext).map((([e,t])=>[e,n.attributes[t]]))):void 0}),[e])}(t);return(0,s.createElement)(ff,{value:n},e)}const Dw=(0,u.memo)(Jw);function zw(e){const{clientId:t,allowedBlocks:n,prioritizedInserterBlocks:o,defaultBlock:r,directInsert:l,__experimentalDefaultBlock:i,__experimentalDirectInsert:a,template:p,templateLock:m,wrapperRef:h,templateInsertUpdatesSelection:g,__experimentalCaptureToolbars:f,__experimentalAppenderTagName:b,renderAppender:v,orientation:k,placeholder:_,layout:y,name:E,blockType:w,parentLock:S,defaultLayout:x}=e;Cw(t,S,n,o,r,l,i,a,m,f,k,y),function(e,t,n,o){const{getBlocks:r,getSelectedBlocksInitialCaretPosition:l,isBlockSelected:i}=(0,d.useSelect)(Nr),{replaceInnerBlocks:s,__unstableMarkNextChangeAsNotPersistent:a}=(0,d.useDispatch)(Nr),p=(0,u.useRef)(null);(0,u.useLayoutEffect)((()=>{let u=!1;return window.queueMicrotask((()=>{if(u)return;const d=r(e),m=0===d.length||"all"===n||"contentOnly"===n,h=!C()(t,p.current);if(!m||!h)return;p.current=t;const g=(0,c.synchronizeBlocksWithTemplate)(d,t);C()(g,d)||(a(),s(e,g,0===d.length&&o&&0!==g.length&&i(e),l()))})),()=>{u=!0}}),[t,n,e])}(t,p,m,g);const B=(0,c.getBlockSupport)(E,"layout")||(0,c.getBlockSupport)(E,"__experimentalLayout")||Aw,{allowSizingOnChildren:I=!1}=B,T=y||B,M=(0,u.useMemo)((()=>({...x,...T,...I&&{allowSizingOnChildren:!0}})),[x,T,I]),P=(0,s.createElement)(Dw,{rootClientId:t,renderAppender:v,__experimentalAppenderTagName:b,layout:M,wrapperRef:h,placeholder:_});return 0===Object.keys(w.providesContext).length?P:(0,s.createElement)(Ow,{clientId:t},P)}function Vw(e){return L_(e),(0,s.createElement)(zw,{...e})}const Fw=(0,u.forwardRef)(((e,t)=>{const n=Hw({ref:t},e);return(0,s.createElement)("div",{className:"block-editor-inner-blocks"},(0,s.createElement)("div",{...n}))}));function Hw(e={},t={}){const{__unstableDisableLayoutClassNames:n,__unstableDisableDropZone:o,dropZoneElement:r}=t,{clientId:l,layout:i=null,__unstableLayoutClassNames:a=""}=y(),u=(0,d.useSelect)((e=>{if(!l)return{};const{getBlockName:t,isBlockSelected:n,hasSelectedInnerBlock:o,__unstableGetEditorMode:r,getTemplateLock:i,getBlockRootClientId:s,getBlockEditingMode:a,getBlockSettings:u,isDragging:d}=ie(e(Nr)),{hasBlockSupport:p,getBlockType:m}=e(c.store),h=t(l),g="navigation"===r(),f=a(l),b=s(l),[v]=u(l,"layout");return{__experimentalCaptureToolbars:p(h,"__experimentalExposeControlsToChildren",!1),hasOverlay:"core/template"!==h&&!n(l)&&!o(l,!0)&&g&&!d(),name:h,blockType:m(h),parentLock:i(b),parentClientId:b,isDropZoneDisabled:"disabled"===f,defaultLayout:v}}),[l]),{__experimentalCaptureToolbars:m,hasOverlay:h,name:g,blockType:f,parentLock:b,parentClientId:v,isDropZoneDisabled:k,defaultLayout:_}=u,E=Lw({dropZoneElement:r,rootClientId:l,parentClientId:v,isDisabled:k}),w=(0,p.useMergeRefs)([e.ref,o?null:E]),S={__experimentalCaptureToolbars:m,layout:i,name:g,blockType:f,parentLock:b,defaultLayout:_,...t},C=S.value&&S.onChange?Vw:zw;return{...e,ref:w,className:ml()(e.className,"block-editor-block-list__layout",n?"":a,{"has-overlay":h}),children:l?(0,s.createElement)(C,{...S,clientId:l}):(0,s.createElement)(Jw,{...t})}}Hw.save=c.__unstableGetInnerBlocksProps,Fw.DefaultBlockAppender=ww,Fw.ButtonBlockAppender=Ew,Fw.Content=()=>Hw.save().children;const Gw=Fw,Uw=new Set([zs.UP,zs.RIGHT,zs.DOWN,zs.LEFT,zs.ENTER,zs.BACKSPACE]);function $w(){const e=(0,d.useSelect)((e=>e(Nr).isTyping()),[]),{stopTyping:t}=(0,d.useDispatch)(Nr);return(0,p.useRefEffect)((n=>{if(!e)return;const{ownerDocument:o}=n;let r,l;function i(e){const{clientX:n,clientY:o}=e;r&&l&&(r!==n||l!==o)&&t(),r=n,l=o}return o.addEventListener("mousemove",i),()=>{o.removeEventListener("mousemove",i)}}),[e,t])}function jw(){const{isTyping:e,hasInlineToolbar:t}=(0,d.useSelect)((e=>{const{isTyping:t,getSettings:n}=e(Nr);return{isTyping:t(),hasInlineToolbar:n().hasInlineToolbar}}),[]),{startTyping:n,stopTyping:o}=(0,d.useDispatch)(Nr),r=$w(),l=(0,p.useRefEffect)((r=>{const{ownerDocument:l}=r,{defaultView:i}=l,s=i.getSelection();if(e){let c;function u(e){const{target:t}=e;c=i.setTimeout((()=>{(0,As.isTextField)(t)||o()}))}function d(e){const{keyCode:t}=e;t!==zs.ESCAPE&&t!==zs.TAB||o()}function p(){s.isCollapsed||o()}return r.addEventListener("focus",u),r.addEventListener("keydown",d),t||l.addEventListener("selectionchange",p),()=>{i.clearTimeout(c),r.removeEventListener("focus",u),r.removeEventListener("keydown",d),l.removeEventListener("selectionchange",p)}}function a(e){const{type:t,target:o}=e;(0,As.isTextField)(o)&&r.contains(o)&&("keydown"!==t||function(e){const{keyCode:t,shiftKey:n}=e;return!n&&Uw.has(t)}(e))&&n()}return r.addEventListener("keypress",a),r.addEventListener("keydown",a),()=>{r.removeEventListener("keypress",a),r.removeEventListener("keydown",a)}}),[e,t,n,o]);return(0,p.useMergeRefs)([r,l])}const Ww=function({children:e}){return(0,s.createElement)("div",{ref:jw()},e)},Kw=(0,u.createContext)(),Zw=new WeakMap;function qw({className:e,...t}){const n=(0,p.useViewportMatch)("medium"),{isOutlineMode:o,isFocusMode:r,editorMode:l}=(0,d.useSelect)((e=>{const{getSettings:t,__unstableGetEditorMode:n}=e(Nr),{outlineMode:o,focusMode:r}=t();return{isOutlineMode:o,isFocusMode:r,editorMode:n()}}),[]),i=(0,d.useRegistry)(),{setBlockVisibility:a}=(0,d.useDispatch)(Nr),c=(0,p.useDebounce)((0,u.useCallback)((()=>{const e={};Zw.get(i).forEach((([t,n])=>{e[t]=n})),a(e)}),[i]),300,{trailing:!0}),m=(0,u.useMemo)((()=>{const{IntersectionObserver:e}=window;if(e)return new e((e=>{Zw.get(i)||Zw.set(i,[]);for(const t of e){const e=t.target.getAttribute("data-block");Zw.get(i).push([e,t.isIntersecting])}c()}))}),[]),h=Hw({ref:(0,p.useMergeRefs)([F_(),_w(),jw()]),className:ml()("is-root-container",e,{"is-outline-mode":o,"is-focus-mode":r&&n,"is-navigate-mode":"navigation"===l})},t);return(0,s.createElement)(Kw.Provider,{value:m},(0,s.createElement)("div",{...h}))}function Yw({clientId:e}){const{stopEditingAsBlocks:t}=ie((0,d.useDispatch)(Nr)),n=(0,d.useSelect)((t=>{const{isBlockSelected:n,hasSelectedInnerBlock:o}=t(Nr);return n(e)||o(e,!0)}),[e]);return(0,u.useEffect)((()=>{n||t(e)}),[n,e,t]),null}function Xw(e){return(0,s.createElement)(_,{value:v},(0,s.createElement)(qw,{...e}))}function Qw({placeholder:e,rootClientId:t,renderAppender:n,__experimentalAppenderTagName:o,layout:r=Fi}){const l=!1!==n,i=!!n,{order:a,selectedBlocks:c,visibleBlocks:u,temporarilyEditingAsBlocks:p,shouldRenderAppender:m}=(0,d.useSelect)((e=>{const{getBlockOrder:n,getSelectedBlockClientId:o,getSelectedBlockClientIds:r,__unstableGetVisibleBlocks:s,__unstableGetTemporarilyEditingAsBlocks:a,getTemplateLock:c,getBlockEditingMode:u,__unstableGetEditorMode:d}=e(Nr),p=o();return{order:n(t),selectedBlocks:r(),visibleBlocks:s(),temporarilyEditingAsBlocks:a(),shouldRenderAppender:l&&(i?!c(t)&&"disabled"!==u(t)&&"zoom-out"!==d():t===p||!t&&!p)}}),[t,l,i]);return(0,s.createElement)(Gi,{value:r},a.map((e=>(0,s.createElement)(d.AsyncModeProvider,{key:e,value:!u.has(e)&&!c.includes(e)},(0,s.createElement)(C_,{rootClientId:t,clientId:e})))),a.length<1&&e,!!p&&(0,s.createElement)(Yw,{clientId:p}),m&&(0,s.createElement)(pw,{tagName:o,rootClientId:t,CustomAppender:n}))}function Jw(e){return(0,s.createElement)(d.AsyncModeProvider,{value:!1},(0,s.createElement)(Qw,{...e}))}const eS={placement:"top-start"},tS={...eS,flip:!1,shift:!0},nS={...eS,flip:!0,shift:!1};function oS(e,t,n,o,r){if(!e||!t)return tS;const l=n?.scrollTop||0,i=t.getBoundingClientRect(),s=l+e.getBoundingClientRect().top,a=e.ownerDocument.documentElement.clientHeight,c=s+o,u=i.top>c,d=i.height>a-o;return r||!u&&!d?nS:tS}function rS({contentElement:e,clientId:t}){const n=bd(t),[o,r]=(0,u.useState)(0),{blockIndex:l,isSticky:i}=(0,d.useSelect)((e=>{const{getBlockIndex:n,getBlockAttributes:o}=e(Nr);return{blockIndex:n(t),isSticky:gh(o(t))}}),[t]),s=(0,u.useMemo)((()=>{if(e)return(0,As.getScrollContainer)(e)}),[e]),[a,c]=(0,u.useState)((()=>oS(e,n,s,o,i))),m=(0,p.useRefEffect)((e=>{r(e.offsetHeight)}),[]),h=(0,u.useCallback)((()=>c(oS(e,n,s,o,i))),[e,n,s,o]);return(0,u.useLayoutEffect)(h,[l,h]),(0,u.useLayoutEffect)((()=>{if(!e||!n)return;const t=e?.ownerDocument?.defaultView;let o;t?.addEventHandler?.("resize",h);const r=n?.ownerDocument?.defaultView;return r.ResizeObserver&&(o=new r.ResizeObserver(h),o.observe(n)),()=>{t?.removeEventHandler?.("resize",h),o&&o.disconnect()}}),[h,e,n]),{...a,ref:m}}function lS(e){const t=(0,d.useSelect)((t=>{const{getBlockRootClientId:n,getBlockParents:o,__experimentalGetBlockListSettingsForBlocks:r,isBlockInsertionPointVisible:l,getBlockInsertionPoint:i,getBlockOrder:s,hasMultiSelection:a,getLastMultiSelectedBlockClientId:c}=t(Nr),u=o(e),d=r(u),p=u.find((e=>d[e]?.__experimentalCaptureToolbars));let m=!1;if(l()){const t=i();m=s(t.rootClientId)[t.index]===e}return{capturingClientId:p,isInsertionPointVisible:m,lastClientId:a()?c():null,rootClientId:n(e)}}),[e]);return t}function iS({clientId:e,__unstableContentRef:t}){const{capturingClientId:n,isInsertionPointVisible:o,lastClientId:r,rootClientId:l}=lS(e),i=rS({contentElement:t?.current,clientId:e});return(0,s.createElement)(fm,{clientId:n||e,__unstableCoverTarget:!0,bottomClientId:r,className:ml()("block-editor-block-list__block-side-inserter-popover",{"is-insertion-point-visible":o}),__unstableContentRef:t,resize:!1,shift:!1,...i},(0,s.createElement)("div",{className:"block-editor-block-list__empty-block-inserter"},(0,s.createElement)(lw,{position:"bottom right",rootClientId:l,clientId:e,__experimentalIsQuick:!0})))}const sS=({appendToOwnerDocument:e,children:t,clientIds:n,cloneClassname:o,elementId:r,onDragStart:l,onDragEnd:i,fadeWhenDisabled:a=!1,dragComponent:m})=>{const{srcRootClientId:h,isDraggable:g,icon:f,visibleInserter:b,getBlockType:v}=(0,d.useSelect)((e=>{const{canMoveBlocks:t,getBlockRootClientId:o,getBlockName:r,getBlockAttributes:l,isBlockInsertionPointVisible:i}=e(Nr),{getBlockType:s,getActiveBlockVariation:a}=e(c.store),u=o(n[0]),d=r(n[0]),p=a(d,l(n[0]));return{srcRootClientId:u,isDraggable:t(n,u),icon:p?.icon||s(d)?.icon,visibleInserter:i(),getBlockType:s}}),[n]),k=(0,u.useRef)(!1),[_,y,E]=function(){const e=(0,u.useRef)(null),t=(0,u.useRef)(null),n=(0,u.useRef)(null),o=(0,u.useRef)(null);return(0,u.useEffect)((()=>()=>{o.current&&(clearInterval(o.current),o.current=null)}),[]),[(0,u.useCallback)((r=>{e.current=r.clientY,n.current=(0,As.getScrollContainer)(r.target),o.current=setInterval((()=>{if(n.current&&t.current){const e=n.current.scrollTop+t.current;n.current.scroll({top:e})}}),25)}),[]),(0,u.useCallback)((o=>{if(!n.current)return;const r=n.current.offsetHeight,l=e.current-n.current.offsetTop,i=o.clientY-n.current.offsetTop;if(o.clientY>l){const e=Math.max(r-l-50,0),n=Math.max(i-l-50,0),o=0===e||0===n?0:n/e;t.current=25*o}else if(o.clientY<l){const e=Math.max(l-50,0),n=Math.max(l-i-50,0),o=0===e||0===n?0:n/e;t.current=-25*o}else t.current=0}),[]),()=>{e.current=null,n.current=null,o.current&&(clearInterval(o.current),o.current=null)}]}(),{getAllowedBlocks:w,getBlockNamesByClientId:S,getBlockRootClientId:C}=(0,d.useSelect)(Nr),{startDraggingBlocks:x,stopDraggingBlocks:B}=(0,d.useDispatch)(Nr);(0,u.useEffect)((()=>()=>{k.current&&B()}),[]);const I=fd(n[0]),T=I.current?.closest("body");if((0,u.useEffect)((()=>{if(!T||!a)return;const e=(0,p.throttle)((e=>{if(!e.target.closest("[data-block]"))return;const t=S(n),o=e.target.closest("[data-block]").getAttribute("data-block"),r=w(o),l=S([o])[0];let i;if(0===r?.length){const e=C(o),n=S([e])[0],r=w(e);i=Nw(v,r,t,n)}else i=Nw(v,r,t,l);i||b?window?.document?.body?.classList?.remove("block-draggable-invalid-drag-token"):window?.document?.body?.classList?.add("block-draggable-invalid-drag-token")}),200);return T.addEventListener("dragover",e),()=>{T.removeEventListener("dragover",e)}}),[n,T,a,w,S,C,v,b]),!g)return t({draggable:!1});const M={type:"block",srcClientIds:n,srcRootClientId:h};return(0,s.createElement)(_l.Draggable,{appendToOwnerDocument:e,cloneClassname:o,__experimentalTransferDataType:"wp-blocks",transferData:M,onDragStart:e=>{window.requestAnimationFrame((()=>{x(n),k.current=!0,_(e),l&&l()}))},onDragOver:y,onDragEnd:()=>{B(),k.current=!1,E(),i&&i()},__experimentalDragComponent:void 0!==m?m:(0,s.createElement)(Ay,{count:n.length,icon:f,fadeWhenDisabled:!0}),elementId:r},(({onDraggableStart:e,onDraggableEnd:n})=>t({draggable:!0,onDragStart:e,onDragEnd:n})))},aS=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),cS=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),uS=(e,t)=>"up"===e?"horizontal"===t?(0,x.isRTL)()?"right":"left":"up":"down"===e?"horizontal"===t?(0,x.isRTL)()?"left":"right":"down":null;function dS(e,t,n,o,r,l,i){const s=n+1;if(e>1)return function(e,t,n,o,r,l){const i=t+1;if(n&&o)return(0,x.__)("All blocks are selected, and cannot be moved");if(r>0&&!o){const t=uS("down",l);if("down"===t)return(0,x.sprintf)((0,x.__)("Move %1$d blocks from position %2$d down by one place"),e,i);if("left"===t)return(0,x.sprintf)((0,x.__)("Move %1$d blocks from position %2$d left by one place"),e,i);if("right"===t)return(0,x.sprintf)((0,x.__)("Move %1$d blocks from position %2$d right by one place"),e,i)}if(r>0&&o){const e=uS("down",l);if("down"===e)return(0,x.__)("Blocks cannot be moved down as they are already at the bottom");if("left"===e)return(0,x.__)("Blocks cannot be moved left as they are already are at the leftmost position");if("right"===e)return(0,x.__)("Blocks cannot be moved right as they are already are at the rightmost position")}if(r<0&&!n){const t=uS("up",l);if("up"===t)return(0,x.sprintf)((0,x.__)("Move %1$d blocks from position %2$d up by one place"),e,i);if("left"===t)return(0,x.sprintf)((0,x.__)("Move %1$d blocks from position %2$d left by one place"),e,i);if("right"===t)return(0,x.sprintf)((0,x.__)("Move %1$d blocks from position %2$d right by one place"),e,i)}if(r<0&&n){const e=uS("up",l);if("up"===e)return(0,x.__)("Blocks cannot be moved up as they are already at the top");if("left"===e)return(0,x.__)("Blocks cannot be moved left as they are already are at the leftmost position");if("right"===e)return(0,x.__)("Blocks cannot be moved right as they are already are at the rightmost position")}}(e,n,o,r,l,i);if(o&&r)return(0,x.sprintf)((0,x.__)("Block %s is the only block, and cannot be moved"),t);if(l>0&&!r){const e=uS("down",i);if("down"===e)return(0,x.sprintf)((0,x.__)("Move %1$s block from position %2$d down to position %3$d"),t,s,s+1);if("left"===e)return(0,x.sprintf)((0,x.__)("Move %1$s block from position %2$d left to position %3$d"),t,s,s+1);if("right"===e)return(0,x.sprintf)((0,x.__)("Move %1$s block from position %2$d right to position %3$d"),t,s,s+1)}if(l>0&&r){const e=uS("down",i);if("down"===e)return(0,x.sprintf)((0,x.__)("Block %1$s is at the end of the content and can’t be moved down"),t);if("left"===e)return(0,x.sprintf)((0,x.__)("Block %1$s is at the end of the content and can’t be moved left"),t);if("right"===e)return(0,x.sprintf)((0,x.__)("Block %1$s is at the end of the content and can’t be moved right"),t)}if(l<0&&!o){const e=uS("up",i);if("up"===e)return(0,x.sprintf)((0,x.__)("Move %1$s block from position %2$d up to position %3$d"),t,s,s-1);if("left"===e)return(0,x.sprintf)((0,x.__)("Move %1$s block from position %2$d left to position %3$d"),t,s,s-1);if("right"===e)return(0,x.sprintf)((0,x.__)("Move %1$s block from position %2$d right to position %3$d"),t,s,s-1)}if(l<0&&o){const e=uS("up",i);if("up"===e)return(0,x.sprintf)((0,x.__)("Block %1$s is at the beginning of the content and can’t be moved up"),t);if("left"===e)return(0,x.sprintf)((0,x.__)("Block %1$s is at the beginning of the content and can’t be moved left"),t);if("right"===e)return(0,x.sprintf)((0,x.__)("Block %1$s is at the beginning of the content and can’t be moved right"),t)}}const pS=(e,t)=>"up"===e?"horizontal"===t?(0,x.isRTL)()?T_:M_:aS:"down"===e?"horizontal"===t?(0,x.isRTL)()?M_:T_:cS:null,mS=(e,t)=>"up"===e?"horizontal"===t?(0,x.isRTL)()?(0,x.__)("Move right"):(0,x.__)("Move left"):(0,x.__)("Move up"):"down"===e?"horizontal"===t?(0,x.isRTL)()?(0,x.__)("Move left"):(0,x.__)("Move right"):(0,x.__)("Move down"):null,hS=(0,u.forwardRef)((({clientIds:e,direction:t,orientation:n,...o},r)=>{const l=(0,p.useInstanceId)(hS),i=Array.isArray(e)?e:[e],a=i.length,{blockType:u,isDisabled:m,rootClientId:h,isFirst:g,isLast:f,firstIndex:b,orientation:v="vertical"}=(0,d.useSelect)((e=>{const{getBlockIndex:o,getBlockRootClientId:r,getBlockOrder:l,getBlock:s,getBlockListSettings:a}=e(Nr),u=i[0],d=r(u),p=o(u),m=o(i[i.length-1]),h=l(d),g=s(u),f=0===p,b=m===h.length-1,{orientation:v}=a(d)||{};return{blockType:g?(0,c.getBlockType)(g.name):null,isDisabled:"up"===t?f:b,rootClientId:d,firstIndex:p,isFirst:f,isLast:b,orientation:n||v}}),[e,t]),{moveBlocksDown:k,moveBlocksUp:_}=(0,d.useDispatch)(Nr),y="up"===t?_:k,E=`block-editor-block-mover-button__description-${l}`;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.Button,{ref:r,className:ml()("block-editor-block-mover-button",`is-${t}-button`),icon:pS(t,v),label:mS(t,v),"aria-describedby":E,...o,onClick:m?null:t=>{y(e,h),o.onClick&&o.onClick(t)},disabled:m,__experimentalIsFocusable:!0}),(0,s.createElement)(_l.VisuallyHidden,{id:E},dS(a,u&&u.title,b,g,f,"up"===t?-1:1,v)))})),gS=(0,u.forwardRef)(((e,t)=>(0,s.createElement)(hS,{direction:"up",ref:t,...e}))),fS=(0,u.forwardRef)(((e,t)=>(0,s.createElement)(hS,{direction:"down",ref:t,...e})));const bS=function({clientIds:e,hideDragHandle:t}){const{canMove:n,rootClientId:o,isFirst:r,isLast:l,orientation:i}=(0,d.useSelect)((t=>{const{getBlockIndex:n,getBlockListSettings:o,canMoveBlocks:r,getBlockOrder:l,getBlockRootClientId:i}=t(Nr),s=Array.isArray(e)?e:[e],a=s[0],c=i(a),u=n(a),d=n(s[s.length-1]),p=l(c);return{canMove:r(e,c),rootClientId:c,isFirst:0===u,isLast:d===p.length-1,orientation:o(c)?.orientation}}),[e]);if(!n||r&&l&&!o)return null;const a=(0,x.__)("Drag");return(0,s.createElement)(_l.ToolbarGroup,{className:ml()("block-editor-block-mover",{"is-horizontal":"horizontal"===i})},!t&&(0,s.createElement)(sS,{clientIds:e,fadeWhenDisabled:!0},(e=>(0,s.createElement)(_l.Button,{icon:Ly,className:"block-editor-block-mover__drag-handle","aria-hidden":"true",label:a,tabIndex:"-1",...e}))),(0,s.createElement)("div",{className:"block-editor-block-mover__move-button-container"},(0,s.createElement)(_l.ToolbarItem,null,(t=>(0,s.createElement)(gS,{clientIds:e,...t}))),(0,s.createElement)(_l.ToolbarItem,null,(t=>(0,s.createElement)(fS,{clientIds:e,...t})))))},{clearTimeout:vS,setTimeout:kS}=window,_S=200;function yS({ref:e,isFocused:t,highlightParent:n,debounceTimeout:o=_S}){const{getSelectedBlockClientId:r,getBlockRootClientId:l}=(0,d.useSelect)(Nr),{toggleBlockHighlight:i}=(0,d.useDispatch)(Nr),s=(0,u.useRef)(),a=(0,d.useSelect)((e=>e(Nr).getSettings().isDistractionFree),[]),c=e=>{if(e&&a)return;const t=r(),o=n?l(t):t;i(o,e)},p=()=>{const n=e?.current&&e.current.matches(":hover");return!t&&!n},m=()=>{const e=s.current;e&&vS&&vS(e)};return(0,u.useEffect)((()=>()=>{c(!1),m()}),[]),{debouncedShowGestures:e=>{e&&e.stopPropagation(),m(),c(!0)},debouncedHideGestures:e=>{e&&e.stopPropagation(),m(),s.current=kS((()=>{p()&&c(!1)}),o)}}}function ES({ref:e,highlightParent:t=!1,debounceTimeout:n=_S}){const[o,r]=(0,u.useState)(!1),{debouncedShowGestures:l,debouncedHideGestures:i}=yS({ref:e,debounceTimeout:n,isFocused:o,highlightParent:t}),s=(0,u.useRef)(!1),a=()=>e?.current&&e.current.contains(e.current.ownerDocument.activeElement);return(0,u.useEffect)((()=>{const t=e.current,n=()=>{a()&&(r(!0),l())},o=()=>{a()||(r(!1),i())};return t&&!s.current&&(t.addEventListener("focus",n,!0),t.addEventListener("blur",o,!0),s.current=!0),()=>{t&&(t.removeEventListener("focus",n),t.removeEventListener("blur",o))}}),[e,s,r,l,i]),{onMouseMove:l,onMouseLeave:i}}function wS(){const{selectBlock:e}=(0,d.useDispatch)(Nr),{firstParentClientId:t,isVisible:n}=(0,d.useSelect)((e=>{const{getBlockName:t,getBlockParents:n,getSelectedBlockClientId:o,getBlockEditingMode:r}=e(Nr),{hasBlockSupport:l}=e(c.store),i=n(o()),s=i[i.length-1],a=t(s),u=(0,c.getBlockType)(a);return{firstParentClientId:s,isVisible:s&&"default"===r(s)&&l(u,"__experimentalParentSelector",!0)}}),[]),o=ih(t),r=(0,u.useRef)(),l=ES({ref:r,highlightParent:!0});return n?(0,s.createElement)("div",{className:"block-editor-block-parent-selector",key:t,ref:r,...l},(0,s.createElement)(_l.ToolbarButton,{className:"block-editor-block-parent-selector__button",onClick:()=>e(t),label:(0,x.sprintf)((0,x.__)("Select parent block: %s"),o?.title),showTooltip:!0,icon:(0,s.createElement)(qh,{icon:o?.icon})})):null}const SS=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"}));function CS({blocks:e}){return(0,s.createElement)("div",{className:"block-editor-block-switcher__popover__preview__parent"},(0,s.createElement)("div",{className:"block-editor-block-switcher__popover__preview__container"},(0,s.createElement)(_l.Popover,{className:"block-editor-block-switcher__preview__popover",placement:"bottom-start",focusOnMount:!1},(0,s.createElement)("div",{className:"block-editor-block-switcher__preview"},(0,s.createElement)("div",{className:"block-editor-block-switcher__preview-title"},(0,x.__)("Preview")),(0,s.createElement)(Ty,{viewportWidth:500,blocks:e})))))}const xS={};function BS({item:e,onSelect:t,setHoveredTransformItemName:n}){const{name:o,icon:r,title:l}=e;return(0,s.createElement)(_l.MenuItem,{className:(0,c.getBlockMenuDefaultClassName)(o),onClick:e=>{e.preventDefault(),t(o)},onMouseLeave:()=>n(null),onMouseEnter:()=>n(o)},(0,s.createElement)(qh,{icon:r,showColors:!0}),l)}const IS=({transformations:e,onSelect:t,blocks:n})=>{const[o,r]=(0,u.useState)();return(0,s.createElement)(s.Fragment,null,o&&(0,s.createElement)(CS,{blocks:(0,c.cloneBlock)(n[0],e.find((({name:e})=>e===o)).attributes)}),e?.map((e=>(0,s.createElement)(BS,{key:e.name,item:e,onSelect:t,setHoveredTransformItemName:r}))))};function TS({restTransformations:e,onSelect:t,setHoveredTransformItemName:n}){return e.map((e=>(0,s.createElement)(MS,{key:e.name,item:e,onSelect:t,setHoveredTransformItemName:n})))}function MS({item:e,onSelect:t,setHoveredTransformItemName:n}){const{name:o,icon:r,title:l,isDisabled:i}=e;return(0,s.createElement)(_l.MenuItem,{className:(0,c.getBlockMenuDefaultClassName)(o),onClick:e=>{e.preventDefault(),t(o)},disabled:i,onMouseLeave:()=>n(null),onMouseEnter:()=>n(o)},(0,s.createElement)(qh,{icon:r,showColors:!0}),l)}const PS=({className:e,possibleBlockTransformations:t,possibleBlockVariationTransformations:n,onSelect:o,onSelectVariation:r,blocks:l})=>{const[i,a]=(0,u.useState)(),{priorityTextTransformations:d,restTransformations:p}=function(e){const t={"core/paragraph":1,"core/heading":2,"core/list":3,"core/quote":4},n=(0,u.useMemo)((()=>{const n=Object.keys(t),o=e.reduce(((e,t)=>{const{name:o}=t;return n.includes(o)?e.priorityTextTransformations.push(t):e.restTransformations.push(t),e}),{priorityTextTransformations:[],restTransformations:[]});if(1===o.priorityTextTransformations.length&&"core/quote"===o.priorityTextTransformations[0].name){const e=o.priorityTextTransformations.pop();o.restTransformations.push(e)}return o}),[e]);return n.priorityTextTransformations.sort((({name:e},{name:n})=>t[e]<t[n]?-1:1)),n}(t),m=d.length&&p.length,h=!!p.length&&(0,s.createElement)(TS,{restTransformations:p,onSelect:o,setHoveredTransformItemName:a});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.MenuGroup,{label:(0,x.__)("Transform to"),className:e},i&&(0,s.createElement)(CS,{blocks:(0,c.switchToBlockType)(l,i)}),!!n?.length&&(0,s.createElement)(IS,{transformations:n,blocks:l,onSelect:r}),d.map((e=>(0,s.createElement)(MS,{key:e.name,item:e,onSelect:o,setHoveredTransformItemName:a}))),!m&&h),!!m&&(0,s.createElement)(_l.MenuGroup,{className:e},h))};function RS(e,t,n){const o=new(vp())(e);return t&&o.remove("is-style-"+t.name),o.add("is-style-"+n.name),o.value}function NS(e){return e?.find((e=>e.isDefault))}function LS({clientId:e,onSwitch:t}){const{styles:n,block:o,blockType:r,className:l}=(0,d.useSelect)((t=>{const{getBlock:n}=t(Nr),o=n(e);if(!o)return{};const r=(0,c.getBlockType)(o.name),{getBlockStyles:l}=t(c.store);return{block:o,blockType:r,styles:l(o.name),className:o.attributes.className||""}}),[e]),{updateBlockAttributes:i}=(0,d.useDispatch)(Nr),s=function(e){return e&&0!==e.length?NS(e)?e:[{name:"default",label:(0,x._x)("Default","block style"),isDefault:!0},...e]:[]}(n),a=function(e,t){for(const n of new(vp())(t).values()){if(-1===n.indexOf("is-style-"))continue;const t=n.substring(9),o=e?.find((({name:e})=>e===t));if(o)return o}return NS(e)}(s,l),p=function(e,t){return(0,u.useMemo)((()=>{const n=t?.example,o=t?.name;return n&&o?(0,c.getBlockFromExample)(o,{attributes:n.attributes,innerBlocks:n.innerBlocks}):e?(0,c.cloneBlock)(e):void 0}),[t?.example?e?.name:e,t])}(o,r);return{onSelect:n=>{const o=RS(l,a,n);i(e,{className:o}),t()},stylesToRender:s,activeStyle:a,genericPreviewBlock:p,className:l}}const AS=()=>{};function OS({clientId:e,onSwitch:t=AS}){const{onSelect:n,stylesToRender:o,activeStyle:r}=LS({clientId:e,onSwitch:t});return o&&0!==o.length?(0,s.createElement)(s.Fragment,null,o.map((e=>{const t=e.label||e.name;return(0,s.createElement)(_l.MenuItem,{key:e.name,icon:r.name===e.name?uu:null,onClick:()=>n(e)},(0,s.createElement)(_l.__experimentalText,{as:"span",limit:18,ellipsizeMode:"tail",truncate:!0},t))}))):null}function DS({hoveredBlock:e,onSwitch:t}){const{clientId:n}=e;return(0,s.createElement)(_l.MenuGroup,{label:(0,x.__)("Styles"),className:"block-editor-block-switcher__styles__menugroup"},(0,s.createElement)(OS,{clientId:n,onSwitch:t}))}const zS=(e,t,n=new Set)=>{const{clientId:o,name:r,innerBlocks:l=[]}=e;if(!n.has(o)){if(r===t)return e;for(const e of l){const o=zS(e,t,n);if(o)return o}}},VS=(e,t)=>{const n=((e,t)=>{const n=(0,c.__experimentalGetBlockAttributesNamesByRole)(e,"content");return n?.length?n.reduce(((e,n)=>(t[n]&&(e[n]=t[n]),e)),{}):t})(t.name,t.attributes);e.attributes={...e.attributes,...n}},FS=(e,t)=>(0,u.useMemo)((()=>e.reduce(((e,n)=>{const o=((e,t)=>{const n=t.map((e=>(0,c.cloneBlock)(e))),o=new Set;for(const t of e){let e=!1;for(const r of n){const n=zS(r,t.name,o);if(n){e=!0,o.add(n.clientId),VS(n,t);break}}if(!e)return}return n})(t,n.blocks);return o&&e.push({...n,transformedBlocks:o}),e}),[])),[e,t]),{CompositeV2:HS,CompositeItemV2:GS,useCompositeStoreV2:US}=ie(_l.privateApis);function $S({patterns:e,onSelect:t}){return(0,s.createElement)("div",{className:"block-editor-block-switcher__popover__preview__parent"},(0,s.createElement)("div",{className:"block-editor-block-switcher__popover__preview__container"},(0,s.createElement)(_l.Popover,{className:"block-editor-block-switcher__preview__popover",position:"bottom right"},(0,s.createElement)("div",{className:"block-editor-block-switcher__preview is-pattern-list-preview"},(0,s.createElement)(jS,{patterns:e,onSelect:t})))))}function jS({patterns:e,onSelect:t}){const n=US();return(0,s.createElement)(HS,{store:n,role:"listbox",className:"block-editor-block-switcher__preview-patterns-container","aria-label":(0,x.__)("Patterns list")},e.map((e=>(0,s.createElement)(WS,{key:e.name,pattern:e,onSelect:t}))))}function WS({pattern:e,onSelect:t}){const n="block-editor-block-switcher__preview-patterns-container",o=(0,p.useInstanceId)(WS,`${n}-list__item-description`);return(0,s.createElement)("div",{className:`${n}-list__list-item`},(0,s.createElement)(GS,{render:(0,s.createElement)("div",{role:"option","aria-label":e.title,"aria-describedby":e.description?o:void 0,className:`${n}-list__item`}),onClick:()=>t(e.transformedBlocks)},(0,s.createElement)(Ty,{blocks:e.transformedBlocks,viewportWidth:e.viewportWidth||500}),(0,s.createElement)("div",{className:`${n}-list__item-title`},e.title)),!!e.description&&(0,s.createElement)(_l.VisuallyHidden,{id:o},e.description))}const KS=function({blocks:e,patterns:t,onSelect:n}){const[o,r]=(0,u.useState)(!1),l=FS(t,e);return l.length?(0,s.createElement)(_l.MenuGroup,{className:"block-editor-block-switcher__pattern__transforms__menugroup"},o&&(0,s.createElement)($S,{patterns:l,onSelect:n}),(0,s.createElement)(_l.MenuItem,{onClick:e=>{e.preventDefault(),r(!o)},icon:T_},(0,x.__)("Patterns"))):null};function ZS({onClose:e,clientIds:t,hasBlockStyles:n,canRemove:o}){const{replaceBlocks:r,multiSelect:l,updateBlockAttributes:i}=(0,d.useDispatch)(Nr),{possibleBlockTransformations:a,patterns:p,blocks:m}=(0,d.useSelect)((e=>{const{getBlocksByClientId:n,getBlockRootClientId:o,getBlockTransformItems:r,__experimentalGetPatternTransformItems:l}=e(Nr),i=o(Array.isArray(t)?t[0]:t),s=n(t);return{blocks:s,possibleBlockTransformations:r(s,i),patterns:l(s,i)}}),[t]),h=function({clientIds:e,blocks:t}){const{activeBlockVariation:n,blockVariationTransformations:o}=(0,d.useSelect)((n=>{const{getBlockRootClientId:o,getBlockAttributes:r,canRemoveBlocks:l}=n(Nr),{getActiveBlockVariation:i,getBlockVariations:s}=n(c.store),a=o(Array.isArray(e)?e[0]:e),u=l(e,a);if(1!==t.length||!u)return xS;const[d]=t;return{blockVariationTransformations:s(d.name,"transform"),activeBlockVariation:i(d.name,r(d.clientId))}}),[e,t]);return(0,u.useMemo)((()=>o?.filter((({name:e})=>e!==n?.name))),[o,n])}({clientIds:t,blocks:m});function g(e){e.length>1&&l(e[0].clientId,e[e.length-1].clientId)}const f=1===m.length&&(0,c.isTemplatePart)(m[0]),b=!!a.length&&o&&!f,v=!!h?.length,k=!!p?.length&&o,_=b||v;return n||_||k?(0,s.createElement)("div",{className:"block-editor-block-switcher__container"},k&&(0,s.createElement)(KS,{blocks:m,patterns:p,onSelect:n=>{!function(e){r(t,e),g(e)}(n),e()}}),_&&(0,s.createElement)(PS,{className:"block-editor-block-switcher__transforms__menugroup",possibleBlockTransformations:a,possibleBlockVariationTransformations:h,blocks:m,onSelect:n=>{!function(e){const n=(0,c.switchToBlockType)(m,e);r(t,n),g(n)}(n),e()},onSelectVariation:t=>{!function(e){i(m[0].clientId,{...h.find((({name:t})=>t===e)).attributes})}(t),e()}}),n&&(0,s.createElement)(DS,{hoveredBlock:m[0],onSwitch:e})):(0,s.createElement)("p",{className:"block-editor-block-switcher__no-transforms"},(0,x.__)("No transforms."))}const qS=({clientIds:e})=>{const{canRemove:t,hasBlockStyles:n,icon:o,invalidBlocks:r,isReusable:l,isTemplate:i}=(0,d.useSelect)((t=>{const{getBlockRootClientId:n,getBlocksByClientId:o,getBlockAttributes:r,canRemoveBlocks:l}=t(Nr),{getBlockStyles:i,getBlockType:s,getActiveBlockVariation:a}=t(c.store),u=o(e);if(!u.length||u.some((e=>!e)))return{invalidBlocks:!0};const d=n(Array.isArray(e)?e[0]:e),[{name:p}]=u,m=1===u.length,h=s(p);let g;if(m){const t=a(p,r(e[0]));g=t?.icon||h.icon}else{g=1===new Set(u.map((({name:e})=>e))).size?h.icon:SS}return{canRemove:l(e,d),hasBlockStyles:m&&!!i(p)?.length,icon:g,isReusable:m&&(0,c.isReusableBlock)(u[0]),isTemplate:m&&(0,c.isTemplatePart)(u[0])}}),[e]),a=df({clientId:e?.[0],maximumLength:35});if(r)return null;const u=1===e.length,p=u?a:(0,x.__)("Multiple blocks selected");if(!n&&!t)return(0,s.createElement)(_l.ToolbarGroup,null,(0,s.createElement)(_l.ToolbarButton,{disabled:!0,className:"block-editor-block-switcher__no-switcher-icon",title:p,icon:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(qh,{icon:o,showColors:!0}),(l||i)&&(0,s.createElement)("span",{className:"block-editor-block-switcher__toggle-text"},a))}));const m=u?(0,x.__)("Change block type or style"):(0,x.sprintf)((0,x._n)("Change type of %d block","Change type of %d blocks",e.length),e.length);return(0,s.createElement)(_l.ToolbarGroup,null,(0,s.createElement)(_l.ToolbarItem,null,(r=>(0,s.createElement)(_l.DropdownMenu,{className:"block-editor-block-switcher",label:p,popoverProps:{placement:"bottom-start",className:"block-editor-block-switcher__popover"},icon:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(qh,{icon:o,className:"block-editor-block-switcher__toggle",showColors:!0}),(l||i)&&(0,s.createElement)("span",{className:"block-editor-block-switcher__toggle-text"},a)),toggleProps:{describedBy:m,...r},menuProps:{orientation:"both"}},(({onClose:o})=>(0,s.createElement)(ZS,{onClose:o,clientIds:e,hasBlockStyles:n,canRemove:t}))))))},{Fill:YS,Slot:XS}=(0,_l.createSlotFill)("__unstableBlockToolbarLastItem");YS.Slot=XS;const QS=YS,JS="align",eC="__experimentalBorder",tC="color",nC="customClassName",oC="typography.__experimentalFontFamily",rC="typography.fontSize",lC="layout",iC=["shadow",...["typography.lineHeight",rC,"typography.__experimentalFontStyle","typography.__experimentalFontWeight",oC,"typography.textColumns","typography.__experimentalTextDecoration","typography.__experimentalTextTransform","typography.__experimentalWritingMode","typography.__experimentalLetterSpacing"],eC,tC,"spacing"];const sC={align:e=>(0,c.hasBlockSupport)(e,JS),borderColor:e=>function(e,t="any"){if("web"!==u.Platform.OS)return!1;const n=(0,c.getBlockSupport)(e,eC);return!0===n||("any"===t?!!(n?.color||n?.radius||n?.width||n?.style):!!n?.[t])}(e,"color"),backgroundColor:e=>{const t=(0,c.getBlockSupport)(e,tC);return t&&!1!==t.background},textColor:e=>{const t=(0,c.getBlockSupport)(e,tC);return t&&!1!==t.text},gradient:e=>{const t=(0,c.getBlockSupport)(e,tC);return null!==t&&"object"==typeof t&&!!t.gradients},className:e=>(0,c.hasBlockSupport)(e,nC,!0),fontFamily:e=>(0,c.hasBlockSupport)(e,oC),fontSize:e=>(0,c.hasBlockSupport)(e,rC),layout:e=>(0,c.hasBlockSupport)(e,lC),style:e=>iC.some((t=>(0,c.hasBlockSupport)(e,t)))};function aC(e,t){return Object.entries(sC).reduce(((n,[o,r])=>(r(e.name)&&r(t.name)&&(n[o]=e.attributes[o]),n)),{})}function cC(e,t,n){for(let o=0;o<Math.min(t.length,e.length);o+=1)n(e[o].clientId,aC(t[o],e[o])),cC(e[o].innerBlocks,t[o].innerBlocks,n)}function uC(){const e=(0,d.useRegistry)(),{updateBlockAttributes:t}=(0,d.useDispatch)(Nr),{createSuccessNotice:n,createWarningNotice:o,createErrorNotice:r}=(0,d.useDispatch)(Os.store);return(0,u.useCallback)((async l=>{let i="";try{if(!window.navigator.clipboard)return void r((0,x.__)("Unable to paste styles. This feature is only available on secure (https) sites in supporting browsers."),{type:"snackbar"});i=await window.navigator.clipboard.readText()}catch(e){return void r((0,x.__)("Unable to paste styles. Please allow browser clipboard permissions before continuing."),{type:"snackbar"})}if(!i||!function(e){try{const t=(0,c.parse)(e,{__unstableSkipMigrationLogs:!0,__unstableSkipAutop:!0});return 1!==t.length||"core/freeform"!==t[0].name}catch(e){return!1}}(i))return void o((0,x.__)("Unable to paste styles. Block styles couldn't be found within the copied content."),{type:"snackbar"});const s=(0,c.parse)(i);if(1===s.length?e.batch((()=>{cC(l,l.map((()=>s[0])),t)})):e.batch((()=>{cC(l,s,t)})),1===l.length){const e=(0,c.getBlockType)(l[0].name)?.title;n((0,x.sprintf)((0,x.__)("Pasted styles to %s."),e),{type:"snackbar"})}else n((0,x.sprintf)((0,x.__)("Pasted styles to %d blocks."),l.length),{type:"snackbar"})}),[e.batch,t,n,o,r])}function dC({clientIds:e,children:t,__experimentalUpdateSelection:n}){const{getDefaultBlockName:o,getGroupingBlockName:r}=(0,d.useSelect)(c.store),l=(0,d.useSelect)((t=>{const{canInsertBlockType:n,getBlockRootClientId:r,getBlocksByClientId:l,getDirectInsertBlock:i,canMoveBlocks:s,canRemoveBlocks:a}=t(Nr),u=l(e),d=r(e[0]),p=n(o(),d),m=d?i(d):null;return{canMove:s(e,d),canRemove:a(e,d),canInsertBlock:p||!!m,canCopyStyles:u.every((e=>!!e&&((0,c.hasBlockSupport)(e.name,"color")||(0,c.hasBlockSupport)(e.name,"typography")))),canDuplicate:u.every((e=>!!e&&(0,c.hasBlockSupport)(e.name,"multiple",!0)&&n(e.name,d)))}}),[e,o]),{getBlocksByClientId:i,getBlocks:s}=(0,d.useSelect)(Nr),{canMove:a,canRemove:u,canInsertBlock:p,canCopyStyles:m,canDuplicate:h}=l,{removeBlocks:g,replaceBlocks:f,duplicateBlocks:b,insertAfterBlock:v,insertBeforeBlock:k,flashBlock:_,setBlockMovingClientId:y,setNavigationMode:E,selectBlock:w}=(0,d.useDispatch)(Nr),S=ey(),C=uC();return t({canCopyStyles:m,canDuplicate:h,canInsertBlock:p,canMove:a,canRemove:u,onDuplicate:()=>b(e,n),onRemove:()=>g(e,n),onInsertBefore(){const t=Array.isArray(e)?e[0]:t;k(t)},onInsertAfter(){const t=Array.isArray(e)?e[e.length-1]:t;v(t)},onMoveTo(){E(!0),w(e[0]),y(e[0])},onGroup(){if(!e.length)return;const t=r(),n=(0,c.switchToBlockType)(i(e),t);n&&f(e,n)},onUngroup(){if(!e.length)return;const t=s(e[0]);t.length&&f(e,t)},onCopy(){1===e.length&&_(e[0]),S("copy",e)},async onPasteStyles(){await C(i(e))}})}const pC=function({clientId:e}){const t=(0,d.useSelect)((t=>t(Nr).getBlock(e)),[e]),{replaceBlocks:n}=(0,d.useDispatch)(Nr);return t&&"core/html"===t.name?(0,s.createElement)(_l.MenuItem,{onClick:()=>n(e,(0,c.rawHandler)({HTML:(0,c.getBlockContent)(t)}))},(0,x.__)("Convert to Blocks")):null},{Fill:mC,Slot:hC}=(0,_l.createSlotFill)("__unstableBlockSettingsMenuFirstItem");mC.Slot=hC;const gC=mC,fC={className:"block-editor-block-settings-menu__popover",placement:"bottom-start"};function bC({clientIds:e,onCopy:t,label:n}){const{getBlocksByClientId:o}=(0,d.useSelect)(Nr),r=(0,p.useCopyToClipboard)((()=>(0,c.serialize)(o(e))),t),l=n||(0,x.__)("Copy");return(0,s.createElement)(_l.MenuItem,{ref:r},l)}function vC({parentClientId:e,parentBlockType:t}){const n=(0,p.useViewportMatch)("medium","<"),{selectBlock:o}=(0,d.useDispatch)(Nr),r=(0,u.useRef)(),l=ES({ref:r,highlightParent:!0});return n?(0,s.createElement)(_l.MenuItem,{...l,ref:r,icon:(0,s.createElement)(qh,{icon:t.icon}),onClick:()=>o(e)},(0,x.sprintf)((0,x.__)("Select parent block (%s)"),t.title)):null}function kC({block:e,clientIds:t,__experimentalSelectBlock:n,children:o,__unstableDisplayLocation:r,...l}){const i=e?.clientId,a=Array.isArray(t)?t:[t],m=a.length,h=a[0],{firstParentClientId:g,onlyBlock:f,parentBlockType:b,previousBlockClientId:v,selectedBlockClientIds:k}=(0,d.useSelect)((e=>{const{getBlockCount:t,getBlockName:n,getBlockRootClientId:o,getPreviousBlockClientId:r,getSelectedBlockClientIds:l,getBlockAttributes:i}=e(Nr),{getActiveBlockVariation:s}=e(c.store),a=o(h),u=a&&n(a);return{firstParentClientId:a,onlyBlock:1===t(a),parentBlockType:a&&(s(u,i(a))||(0,c.getBlockType)(u)),previousBlockClientId:r(h),selectedBlockClientIds:l()}}),[h]),{getBlockOrder:_,getSelectedBlockClientIds:y}=(0,d.useSelect)(Nr),E=(0,d.useSelect)((e=>ie(e(Nr)).getOpenedBlockSettingsMenu()),[]),{setOpenedBlockSettingsMenu:w}=ie((0,d.useDispatch)(Nr)),S=(0,d.useSelect)((e=>{const{getShortcutRepresentation:t}=e(A_.store);return{duplicate:t("core/block-editor/duplicate"),remove:t("core/block-editor/remove"),insertAfter:t("core/block-editor/insert-after"),insertBefore:t("core/block-editor/insert-before")}}),[]),C=(0,A_.__unstableUseShortcutEventMatch)(),B=k.length>0,I=(0,u.useCallback)((async e=>{if(n){const t=await e;t&&t[0]&&n(t[0],!1)}}),[n]),T=(0,u.useCallback)((()=>{if(n){let e=v||g;e||(e=_()[0]);const t=B&&0===y().length;n(e,t)}}),[n,v,g,_,B,y]),M=k?.includes(g),P=i?E===i||!1:void 0,R=(0,u.useCallback)((e=>{e&&E!==i?w(i):!e&&E&&E===i&&w(void 0)}),[i,E,w]);return(0,s.createElement)(dC,{clientIds:t,__experimentalUpdateSelection:!n},(({canCopyStyles:e,canDuplicate:n,canInsertBlock:i,canMove:a,canRemove:c,onDuplicate:d,onInsertAfter:v,onInsertBefore:k,onRemove:_,onCopy:y,onPasteStyles:E,onMoveTo:B})=>(0,s.createElement)(_l.DropdownMenu,{icon:Ef,label:(0,x.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:fC,open:P,onToggle:R,noIcons:!0,menuProps:{onKeyDown(e){e.defaultPrevented||(C("core/block-editor/remove",e)&&c?(e.preventDefault(),T(_())):C("core/block-editor/duplicate",e)&&n?(e.preventDefault(),I(d())):C("core/block-editor/insert-after",e)&&i?(e.preventDefault(),w(void 0),v()):C("core/block-editor/insert-before",e)&&i&&(e.preventDefault(),w(void 0),k()))}},...l},(({onClose:l})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.MenuGroup,null,(0,s.createElement)(gC.Slot,{fillProps:{onClose:l}}),!M&&!!g&&(0,s.createElement)(vC,{parentClientId:g,parentBlockType:b}),1===m&&(0,s.createElement)(pC,{clientId:h}),(0,s.createElement)(bC,{clientIds:t,onCopy:y}),n&&(0,s.createElement)(_l.MenuItem,{onClick:(0,p.pipe)(l,d,I),shortcut:S.duplicate},(0,x.__)("Duplicate")),i&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.MenuItem,{onClick:(0,p.pipe)(l,k),shortcut:S.insertBefore},(0,x.__)("Add before")),(0,s.createElement)(_l.MenuItem,{onClick:(0,p.pipe)(l,v),shortcut:S.insertAfter},(0,x.__)("Add after")))),e&&(0,s.createElement)(_l.MenuGroup,null,(0,s.createElement)(bC,{clientIds:t,onCopy:y,label:(0,x.__)("Copy styles")}),(0,s.createElement)(_l.MenuItem,{onClick:E},(0,x.__)("Paste styles"))),(0,s.createElement)(jh.Slot,{fillProps:{onClose:l,canMove:a,onMoveTo:B,onlyBlock:f,count:m,firstBlockClientId:h},clientIds:t,__unstableDisplayLocation:r}),"function"==typeof o?o({onClose:l}):u.Children.map((e=>(0,u.cloneElement)(e,{onClose:l}))),c&&(0,s.createElement)(_l.MenuGroup,null,(0,s.createElement)(_l.MenuItem,{onClick:(0,p.pipe)(l,_,T),shortcut:S.remove},(0,x.__)("Delete"))))))))}const _C=kC;const yC=function({clientIds:e,...t}){return(0,s.createElement)(_l.ToolbarGroup,null,(0,s.createElement)(_l.ToolbarItem,null,(n=>(0,s.createElement)(_C,{clientIds:e,toggleProps:n,...t}))))};function EC({clientId:e}){const{canLock:t,isLocked:n}=Th(e),[o,r]=(0,u.useReducer)((e=>!e),!1),l=(0,u.useRef)(!1);if((0,u.useEffect)((()=>{n&&(l.current=!0)}),[n]),!n&&!l.current)return null;let i=n?(0,x.__)("Unlock"):(0,x.__)("Lock");return!t&&n&&(i=(0,x.__)("Locked")),(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.ToolbarGroup,{className:"block-editor-block-lock-toolbar"},(0,s.createElement)(_l.ToolbarButton,{accessibleWhenDisabled:!0,disabled:!t,icon:n?Rh:Mh,label:i,onClick:r,"aria-expanded":o,"aria-haspopup":"dialog"})),o&&(0,s.createElement)(Ah,{clientId:e,onClose:r}))}const wC=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.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"})),SC=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M4 6.5h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4V16h5a.5.5 0 0 0 .5-.5v-7A.5.5 0 0 0 9 8H4V6.5Zm16 0h-5a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h5V16h-5a.5.5 0 0 1-.5-.5v-7A.5.5 0 0 1 15 8h5V6.5Z"})),CC=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M17.5 4v5a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V4H8v5a.5.5 0 0 0 .5.5h7A.5.5 0 0 0 16 9V4h1.5Zm0 16v-5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v5H8v-5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v5h1.5Z"})),xC={group:{type:"constrained"},row:{type:"flex",flexWrap:"nowrap"},stack:{type:"flex",orientation:"vertical"}};const BC=function(){const{blocksSelection:e,clientIds:t,groupingBlockName:n,isGroupable:o}=Bh(),{replaceBlocks:r}=(0,d.useDispatch)(Nr),{canRemove:l,variations:i}=(0,d.useSelect)((e=>{const{canRemoveBlocks:o}=e(Nr),{getBlockVariations:r}=e(c.store);return{canRemove:o(t),variations:r(n,"transform")}}),[t,n]),a=o=>{const l=(0,c.switchToBlockType)(e,n);"string"!=typeof o&&(o="group"),l&&l.length>0&&(l[0].attributes.layout=xC[o],r(t,l))};if(!o||!l)return null;const u=!!i.find((({name:e})=>"group-row"===e)),p=!!i.find((({name:e})=>"group-stack"===e));return(0,s.createElement)(_l.ToolbarGroup,null,(0,s.createElement)(_l.ToolbarButton,{icon:wC,label:(0,x._x)("Group","verb"),onClick:a}),u&&(0,s.createElement)(_l.ToolbarButton,{icon:SC,label:(0,x._x)("Row","single horizontal line"),onClick:()=>a("row")}),p&&(0,s.createElement)(_l.ToolbarButton,{icon:CC,label:(0,x._x)("Stack","verb"),onClick:()=>a("stack")}))};function IC({clientIds:e}){const t=1===e.length?e[0]:void 0,n=(0,d.useSelect)((e=>!!t&&"html"===e(Nr).getBlockMode(t)),[t]),{toggleBlockMode:o}=(0,d.useDispatch)(Nr);return n?(0,s.createElement)(_l.ToolbarGroup,null,(0,s.createElement)(_l.ToolbarButton,{onClick:()=>{o(t)}},(0,x.__)("Edit visually"))):null}const TC=(0,u.createContext)("");function MC(e){return Array.from(e.querySelectorAll("[data-toolbar-item]:not([disabled])"))}function PC(e){return e.contains(e.ownerDocument.activeElement)}function RC({toolbarRef:e,focusOnMount:t,isAccessibleToolbar:n,defaultIndex:o,onIndexChange:r,shouldUseKeyboardFocusShortcut:l,focusEditorOnEscape:i}){const[s]=(0,u.useState)(t),[a]=(0,u.useState)(o),c=(0,u.useCallback)((()=>{!function(e){const[t]=As.focus.tabbable.find(e);t&&t.focus({preventScroll:!0})}(e.current)}),[e]);(0,A_.useShortcut)("core/block-editor/focus-toolbar",(()=>{l&&c()})),(0,u.useEffect)((()=>{s&&c()}),[n,s,c]),(0,u.useEffect)((()=>{const t=e.current;let n=0;return s||PC(t)||(n=window.requestAnimationFrame((()=>{const e=MC(t),n=a||0;e[n]&&PC(t)&&e[n].focus({preventScroll:!0})}))),()=>{if(window.cancelAnimationFrame(n),!r||!t)return;const e=MC(t).findIndex((e=>0===e.tabIndex));r(e)}}),[a,s,r,e]);const{getLastFocus:p}=ie((0,d.useSelect)(Nr));(0,u.useEffect)((()=>{const t=e.current;if(i){const e=e=>{const t=p();e.keyCode===zs.ESCAPE&&t?.current&&(e.preventDefault(),t.current.focus())};return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}}),[i,p,e])}function NC({children:e,focusOnMount:t,focusEditorOnEscape:n=!1,shouldUseKeyboardFocusShortcut:o=!0,__experimentalInitialIndex:r,__experimentalOnIndexChange:l,...i}){const a=(0,u.useRef)(),c=function(e){const[t,n]=(0,u.useState)(!0),o=(0,u.useCallback)((()=>{const t=!As.focus.tabbable.find(e.current).some((e=>!("toolbarItem"in e.dataset)));t||w()("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"}),n(t)}),[e]);return(0,u.useLayoutEffect)((()=>{const t=new window.MutationObserver(o);return t.observe(e.current,{childList:!0,subtree:!0}),()=>t.disconnect()}),[o,t,e]),t}(a);return RC({toolbarRef:a,focusOnMount:t,defaultIndex:r,onIndexChange:l,isAccessibleToolbar:c,shouldUseKeyboardFocusShortcut:o,focusEditorOnEscape:n}),c?(0,s.createElement)(_l.Toolbar,{label:i["aria-label"],ref:a,...i},e):(0,s.createElement)(_l.NavigableMenu,{orientation:"horizontal",role:"toolbar",ref:a,...i},e)}function LC(e="default"){const t=yl[e]?.Slot,n=(0,_l.__experimentalUseSlotFills)(t?.__unstableName);return t?!!n?.length:null}const AC=(0,s.createElement)(Z.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd"},(0,s.createElement)(Z.Path,{d:"M5 19L8 16L5 19Z"}),(0,s.createElement)(Z.Path,{d:"M16 8L19 5L16 8Z"}),(0,s.createElement)(Z.G,null,(0,s.createElement)(Z.Path,{d:"M5 19L8 16"}),(0,s.createElement)(Z.Path,{d:"M9.30003 17.3C9.523 17.5237 9.78794 17.7013 10.0797 17.8224C10.3714 17.9435 10.6842 18.0059 11 18.0059C11.3159 18.0059 11.6287 17.9435 11.9204 17.8224C12.2121 17.7013 12.4771 17.5237 12.7 17.3L15 15L9.00003 9L6.70003 11.3C6.47629 11.523 6.29876 11.7879 6.17763 12.0796C6.05649 12.3714 5.99414 12.6841 5.99414 13C5.99414 13.3159 6.05649 13.6286 6.17763 13.9204C6.29876 14.2121 6.47629 14.477 6.70003 14.7L9.30003 17.3Z"}),(0,s.createElement)(Z.Path,{d:"M16 8L19 5"}),(0,s.createElement)(Z.Path,{d:"M9 9.00003L15 15L17.3 12.7C17.5237 12.4771 17.7013 12.2121 17.8224 11.9204C17.9435 11.6287 18.0059 11.3159 18.0059 11C18.0059 10.6842 17.9435 10.3714 17.8224 10.0797C17.7013 9.78794 17.5237 9.523 17.3 9.30003L14.7 6.70003C14.477 6.47629 14.2121 6.29876 13.9204 6.17763C13.6286 6.05649 13.3159 5.99414 13 5.99414C12.6841 5.99414 12.3714 6.05649 12.0796 6.17763C11.7879 6.29876 11.523 6.47629 11.3 6.70003L9 9.00003Z"})));function OC(){return(0,s.createElement)(_l.ToolbarGroup,null,(0,s.createElement)(_l.ToolbarItem,{as:"div","aria-label":(0,x._x)("Connected","block toolbar button label"),className:"block-editor-block-bindings-toolbar-indicator"},(0,s.createElement)(_l.Icon,{icon:AC,size:24})))}function DC({hideDragHandle:e,focusOnMount:t,__experimentalInitialIndex:n,__experimentalOnIndexChange:o,variant:r="unstyled"}){const{blockClientId:l,blockClientIds:i,isDefaultEditingMode:a,blockType:m,blockName:h,shouldShowVisualToolbar:g,showParentSelector:f,isUsingBindings:b}=(0,d.useSelect)((e=>{const{getBlockName:t,getBlockMode:n,getBlockParents:o,getSelectedBlockClientIds:r,isBlockValid:l,getBlockRootClientId:i,getBlockEditingMode:s,getBlockAttributes:a}=e(Nr),u=r(),d=u[0],p=i(d),m=o(d),h=m[m.length-1],g=t(h),f=(0,c.getBlockType)(g),b="default"===s(d),v=t(d),k=u.every((e=>l(e))),_=u.every((e=>"visual"===n(e))),y=!!a(d)?.metadata?.bindings;return{blockClientId:d,blockClientIds:u,isDefaultEditingMode:b,blockName:v,blockType:d&&(0,c.getBlockType)(v),shouldShowVisualToolbar:k&&_,rootClientId:p,showParentSelector:f&&"default"===s(h)&&(0,c.hasBlockSupport)(f,"__experimentalParentSelector",!0)&&1===u.length&&b,isUsingBindings:y}}),[]),v=(0,u.useRef)(null),k=(0,u.useRef)(),_=ES({ref:k}),y=!(0,p.useViewportMatch)("medium","<"),E=m&&(0,c.hasBlockSupport)(m,"__experimentalToolbar",!0),w=function(){let e=!1;for(const t in yl)LC(t)&&(e=!0);return e}();if(!E||!a&&!w)return null;const S=i.length>1,C=(0,c.isReusableBlock)(m)||(0,c.isTemplatePart)(m),B=ml()("block-editor-block-contextual-toolbar",{"has-parent":f}),I=ml()("block-editor-block-toolbar",{"is-synced":C});return(0,s.createElement)(NC,{focusEditorOnEscape:!0,className:B,"aria-label":(0,x.__)("Block tools"),variant:"toolbar"===r?void 0:r,focusOnMount:t,__experimentalInitialIndex:n,__experimentalOnIndexChange:o,key:l},(0,s.createElement)("div",{ref:v,className:I},!S&&y&&a&&(0,s.createElement)(wS,null),b&&eg(h)&&(0,s.createElement)(OC,null),(g||S)&&a&&(0,s.createElement)("div",{ref:k,..._},(0,s.createElement)(_l.ToolbarGroup,{className:"block-editor-block-toolbar__block-controls"},(0,s.createElement)(qS,{clientIds:i}),!S&&(0,s.createElement)(EC,{clientId:l}),(0,s.createElement)(bS,{clientIds:i,hideDragHandle:e}))),g&&S&&(0,s.createElement)(BC,null),g&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Bl.Slot,{group:"parent",className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(Bl.Slot,{group:"block",className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(Bl.Slot,{className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(Bl.Slot,{group:"inline",className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(Bl.Slot,{group:"other",className:"block-editor-block-toolbar__slot"}),(0,s.createElement)(TC.Provider,{value:m?.name},(0,s.createElement)(QS.Slot,null))),(0,s.createElement)(IC,{clientIds:i}),a&&(0,s.createElement)(yC,{clientIds:i})))}function zC({hideDragHandle:e,variant:t}){return(0,s.createElement)(DC,{hideDragHandle:e,variant:t,focusOnMount:void 0,__experimentalInitialIndex:void 0,__experimentalOnIndexChange:void 0})}function VC({clientId:e,isTyping:t,__unstableContentRef:n}){const{capturingClientId:o,isInsertionPointVisible:r,lastClientId:l}=lS(e),i=(0,u.useRef)();(0,u.useEffect)((()=>{i.current=void 0}),[e]);const{stopTyping:a}=(0,d.useDispatch)(Nr),c=(0,u.useRef)(!1);(0,A_.useShortcut)("core/block-editor/focus-toolbar",(()=>{c.current=!0,a(!0)})),(0,u.useEffect)((()=>{c.current=!1}));const p=rS({contentElement:n?.current,clientId:e});return!t&&(0,s.createElement)(fm,{clientId:o||e,bottomClientId:l,className:ml()("block-editor-block-list__block-popover",{"is-insertion-point-visible":r}),resize:!1,...p},(0,s.createElement)(DC,{focusOnMount:c.current,__experimentalInitialIndex:i.current,__experimentalOnIndexChange:e=>{i.current=e},variant:"toolbar"}))}const FC=function({clientId:e,rootClientId:t}){const n=(0,d.useSelect)((n=>{const{getBlock:o,getBlockIndex:r,hasBlockMovingClientId:l,getBlockListSettings:i,__unstableGetEditorMode:s}=n(Nr),{getActiveBlockVariation:a,getBlockType:u}=n(c.store),d=r(e),{name:p,attributes:m}=o(e),h=u(p),g=i(t)?.orientation,f=a(p,m);return{blockMovingMode:l(),editorMode:s(),icon:f?.icon||h.icon,label:(0,c.__experimentalGetAccessibleBlockLabel)(h,m,d+1,g)}}),[e,t]),{label:o,icon:r,blockMovingMode:l,editorMode:i}=n,{setNavigationMode:a,removeBlock:p}=(0,d.useDispatch)(Nr),m=(0,u.useRef)();(0,u.useEffect)((()=>{m.current.focus(),(0,vo.speak)(o)}),[o]);const h=bd(e),{hasBlockMovingClientId:g,getBlockIndex:f,getBlockRootClientId:b,getClientIdsOfDescendants:v,getSelectedBlockClientId:k,getMultiSelectedBlocksEndClientId:_,getPreviousBlockClientId:y,getNextBlockClientId:E}=(0,d.useSelect)(Nr),{selectBlock:w,clearSelectedBlock:S,setBlockMovingClientId:C,moveBlockToPosition:B}=(0,d.useDispatch)(Nr),I=ml()("block-editor-block-list__block-selection-button",{"is-block-moving-mode":!!l}),T=(0,x.__)("Drag");return(0,s.createElement)("div",{className:I},(0,s.createElement)(_l.Flex,{justify:"center",className:"block-editor-block-list__block-selection-button__content"},(0,s.createElement)(_l.FlexItem,null,(0,s.createElement)(qh,{icon:r,showColors:!0})),(0,s.createElement)(_l.FlexItem,null,"zoom-out"===i&&(0,s.createElement)(bS,{clientIds:[e],hideDragHandle:!0}),"navigation"===i&&(0,s.createElement)(sS,{clientIds:[e]},(e=>(0,s.createElement)(_l.Button,{icon:Ly,className:"block-selection-button_drag-handle","aria-hidden":"true",label:T,tabIndex:"-1",...e})))),(0,s.createElement)(_l.FlexItem,null,(0,s.createElement)(_l.Button,{ref:m,onClick:"navigation"===i?()=>a(!1):void 0,onKeyDown:function(t){const{keyCode:n}=t,o=n===zs.UP,r=n===zs.DOWN,l=n===zs.LEFT,s=n===zs.RIGHT,c=n===zs.TAB,u=n===zs.ESCAPE,d=n===zs.ENTER,m=n===zs.SPACE,x=t.shiftKey;if(u&&"navigation"===i)return a(!1),void t.preventDefault();if(n===zs.BACKSPACE||n===zs.DELETE)return p(e),void t.preventDefault();const I=k(),T=_(),M=y(T||I),P=E(T||I),R=c&&x||o,N=c&&!x||r,L=l,A=s;let O;if(R)O=M;else if(N)O=P;else if(L){var D;O=null!==(D=b(I))&&void 0!==D?D:I}else if(A){var z;O=null!==(z=v(I)[0])&&void 0!==z?z:I}const V=g();if(u&&V&&!t.defaultPrevented&&(C(null),t.preventDefault()),(d||m)&&V){const e=b(V),t=b(I),n=f(V);let o=f(I);n<o&&e===t&&(o-=1),B(V,e,t,o),w(V),C(null)}if((!V||I!==V||!A)&&(N||R||L||A))if(O)t.preventDefault(),w(O);else if(c&&I){let e;if(N){e=h;do{e=As.focus.tabbable.findNext(e)}while(e&&h.contains(e));e||(e=h.ownerDocument.defaultView.frameElement,e=As.focus.tabbable.findNext(e))}else e=As.focus.tabbable.findPrevious(h);e&&(t.preventDefault(),e.focus(),S())}},label:o,showTooltip:!1,className:"block-selection-button_select-button"},(0,s.createElement)(pf,{clientId:e,maximumLength:35})))))};function HC({clientId:e,__unstableContentRef:t}){const{capturingClientId:n,isInsertionPointVisible:o,lastClientId:r,rootClientId:l}=lS(e),i=rS({contentElement:t?.current,clientId:e});return(0,s.createElement)(fm,{clientId:n||e,bottomClientId:r,className:ml()("block-editor-block-list__block-popover",{"is-insertion-point-visible":o}),resize:!1,...i},(0,s.createElement)(FC,{clientId:e,rootClientId:l}))}const GC=function({__unstableContentRef:e}){const[t,n]=(0,u.useState)(!1),o=(0,d.useSelect)((e=>e(Nr).getBlockOrder()),[]);return(0,u.useEffect)((()=>{const e=setTimeout((()=>{n(!0)}),500);return()=>{clearTimeout(e)}}),[]),t?o.map(((t,n)=>n===o.length-1?null:(0,s.createElement)(hw,{key:t,previousClientId:t,nextClientId:o[n+1],__unstableContentRef:e},(0,s.createElement)("div",{className:"block-editor-block-list__insertion-point-inserter is-with-inserter"},(0,s.createElement)(lw,{position:"bottom center",clientId:o[n+1],__experimentalIsQuick:!0}))))):null};function UC(e){const{getSelectedBlockClientId:t,getFirstMultiSelectedBlockClientId:n,getBlock:o,getSettings:r,hasMultiSelection:l,__unstableGetEditorMode:i,isTyping:s}=e(Nr),a=t()||n(),{name:u="",attributes:d={}}=o(a)||{},p=i(),m=a&&u,h=(0,c.isUnmodifiedDefaultBlock)({name:u,attributes:d}),g=a&&!s()&&"edit"===p&&(0,c.isUnmodifiedDefaultBlock)({name:u,attributes:d}),f=m&&!l()&&("navigation"===p||"zoom-out"===p);return{clientId:a,hasFixedToolbar:r().hasFixedToolbar,isTyping:s(),isZoomOutMode:"zoom-out"===p,showEmptyBlockSideInserter:g,showBreadcrumb:!g&&f,showBlockToolbar:!r().hasFixedToolbar&&!g&&m&&!h&&!f}}function $C({children:e,__unstableContentRef:t,...n}){const{clientId:o,hasFixedToolbar:r,isTyping:l,isZoomOutMode:i,showEmptyBlockSideInserter:a,showBreadcrumb:c,showBlockToolbar:p}=(0,d.useSelect)(UC,[]),m=(0,A_.__unstableUseShortcutEventMatch)(),{getSelectedBlockClientIds:h,getBlockRootClientId:g}=(0,d.useSelect)(Nr),{duplicateBlocks:f,removeBlocks:b,insertAfterBlock:v,insertBeforeBlock:k,selectBlock:_,moveBlocksUp:y,moveBlocksDown:E}=(0,d.useDispatch)(Nr);const w=hm(t),S=hm(t);return(0,s.createElement)("div",{...n,onKeyDown:function(e){if(!e.defaultPrevented)if(m("core/block-editor/move-up",e)){const t=h();if(t.length){e.preventDefault();const n=g(t[0]);y(t,n)}}else if(m("core/block-editor/move-down",e)){const t=h();if(t.length){e.preventDefault();const n=g(t[0]);E(t,n)}}else if(m("core/block-editor/duplicate",e)){const t=h();t.length&&(e.preventDefault(),f(t))}else if(m("core/block-editor/remove",e)){const t=h();t.length&&(e.preventDefault(),b(t))}else if(m("core/block-editor/insert-after",e)){const t=h();t.length&&(e.preventDefault(),v(t[t.length-1]))}else if(m("core/block-editor/insert-before",e)){const t=h();t.length&&(e.preventDefault(),k(t[0]))}else if(m("core/block-editor/unselect",e)){if(e.target.closest("[role=toolbar]"))return;const t=h();t.length>1&&(e.preventDefault(),_(t[0]))}}},(0,s.createElement)(bw.Provider,{value:(0,u.useRef)(!1)},!l&&(0,s.createElement)(kw,{__unstableContentRef:t}),a&&(0,s.createElement)(iS,{__unstableContentRef:t,clientId:o}),p&&(0,s.createElement)(VC,{__unstableContentRef:t,clientId:o,isTyping:l}),c&&(0,s.createElement)(HC,{__unstableContentRef:t,clientId:o}),!i&&!r&&(0,s.createElement)(_l.Popover.Slot,{name:"block-toolbar",ref:w}),e,(0,s.createElement)(_l.Popover.Slot,{name:"__unstable-block-tools-after",ref:S}),i&&(0,s.createElement)(GC,{__unstableContentRef:t})))}function jC({shouldIframe:e=!0,height:t="300px",children:n=(0,s.createElement)(Xw,null),styles:o,contentRef:r,iframeProps:l}){const i=$w(),a=F_(),c=(0,u.useRef)(),d=(0,p.useMergeRefs)([r,a,c]);return e?(0,s.createElement)($C,{__unstableContentRef:c,style:{height:t,display:"flex"}},(0,s.createElement)(py,{...l,ref:i,contentRef:d,style:{...l?.style},name:"editor-canvas"},(0,s.createElement)(wy,{styles:o}),n)):(0,s.createElement)($C,{__unstableContentRef:c,style:{height:t,display:"flex"}},(0,s.createElement)(wy,{styles:o,scope:".editor-styles-wrapper"}),(0,s.createElement)(sy,{ref:d,className:"editor-styles-wrapper",tabIndex:-1,style:{height:"100%",width:"100%"}},n))}const WC=function({children:e,height:t,styles:n}){return(0,s.createElement)(jC,{height:t,styles:n},e)},KC=()=>(0,s.createElement)(_l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},(0,s.createElement)(_l.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"})),ZC=({style:e,className:t})=>(0,s.createElement)("div",{className:"block-library-colors-selector__icon-container"},(0,s.createElement)("div",{className:`${t} block-library-colors-selector__state-selection`,style:e},(0,s.createElement)(KC,null))),qC=({TextColor:e,BackgroundColor:t})=>({onToggle:n,isOpen:o})=>(0,s.createElement)(_l.ToolbarGroup,null,(0,s.createElement)(_l.ToolbarButton,{className:"components-toolbar__control block-library-colors-selector__toggle",label:(0,x.__)("Open Colors Selector"),onClick:n,onKeyDown:e=>{o||e.keyCode!==zs.DOWN||(e.preventDefault(),n())},icon:(0,s.createElement)(t,null,(0,s.createElement)(e,null,(0,s.createElement)(ZC,null)))})),YC=({children:e,...t})=>(w()("wp.blockEditor.BlockColorsStyleSelector",{alternative:"block supports API",since:"6.1",version:"6.3"}),(0,s.createElement)(_l.Dropdown,{popoverProps:{placement:"bottom-start"},className:"block-library-colors-selector",contentClassName:"block-library-colors-selector__popover",renderToggle:qC(t),renderContent:()=>e})),XC=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z"})),QC=(0,u.createContext)({}),JC=()=>(0,u.useContext)(QC);function ex({children:e,...t}){const n=(0,u.useRef)();return(0,u.useEffect)((()=>{n.current&&(n.current.textContent=n.current.textContent)}),[e]),(0,s.createElement)("div",{hidden:!0,...t,ref:n},e)}const tx=(0,u.forwardRef)((({nestingLevel:e,blockCount:t,clientId:n,...o},r)=>{const{insertedBlock:l,setInsertedBlock:i}=JC(),a=(0,p.useInstanceId)(tx),c=(0,d.useSelect)((e=>{const{getTemplateLock:t,__unstableGetEditorMode:o}=e(Nr);return!!t(n)||"zoom-out"===o()}),[n]),m=df({clientId:n,context:"list-view"}),h=df({clientId:l?.clientId,context:"list-view"});if((0,u.useEffect)((()=>{h?.length&&(0,vo.speak)((0,x.sprintf)((0,x.__)("%s block inserted"),h),"assertive")}),[h]),c)return null;const g=`list-view-appender__${a}`,f=(0,x.sprintf)((0,x.__)("Append to %1$s block at position %2$d, Level %3$d"),m,t+1,e);return(0,s.createElement)("div",{className:"list-view-appender"},(0,s.createElement)(lw,{ref:r,rootClientId:n,position:"bottom right",isAppender:!0,selectBlockOnInsert:!1,shouldDirectInsert:!1,__experimentalIsQuick:!0,...o,toggleProps:{"aria-describedby":g},onSelectOrClose:e=>{e?.clientId&&i(e)}}),(0,s.createElement)(ex,{id:g},f))})),nx=o_(_l.__experimentalTreeGridRow),ox=(0,u.forwardRef)((({isDragged:e,isSelected:t,position:n,level:o,rowCount:r,children:l,className:i,path:a,...c},u)=>{const d=l_({clientId:c["data-block"],enableAnimation:!0,triggerAnimationOnChange:a}),m=(0,p.useMergeRefs)([u,d]);return(0,s.createElement)(nx,{ref:m,className:ml()("block-editor-list-view-leaf",i),level:o,positionInSet:n,setSize:r,isExpanded:void 0,...c},l)})),rx=ox;const lx=(0,s.createElement)(Z.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M10.97 10.159a3.382 3.382 0 0 0-2.857.955l1.724 1.723-2.836 2.913L7 17h1.25l2.913-2.837 1.723 1.723a3.38 3.38 0 0 0 .606-.825c.33-.63.446-1.343.35-2.032L17 10.695 13.305 7l-2.334 3.159Z"})),ix=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z"}));function sx({onClick:e}){return(0,s.createElement)("span",{className:"block-editor-list-view__expander",onClick:t=>e(t,{forceToggle:!0}),"aria-hidden":"true","data-testid":"list-view-expander"},(0,s.createElement)(Ti,{icon:(0,x.isRTL)()?Zs:qs}))}const ax=3;function cx(e){if("core/image"===e.name)return e.attributes?.url?{url:e.attributes.url,alt:e.attributes.alt,clientId:e.clientId}:void 0}function ux(e,t){const n=cx(e);return n?[n]:t?[]:function(e){if("core/gallery"!==e.name||!e.innerBlocks)return[];const t=[];for(const n of e.innerBlocks){const e=cx(n);if(e&&t.push(e),t.length>=ax)return t}return t}(e)}const dx=(0,u.forwardRef)((function({className:e,block:{clientId:t,name:n},onClick:o,onContextMenu:r,onMouseDown:l,onToggleExpanded:i,tabIndex:a,onFocus:p,onDragStart:m,onDragEnd:h,draggable:g,isExpanded:f,ariaLabel:b,ariaDescribedBy:v,updateFocusAndSelection:k},_){const y=ih(t),E=df({clientId:t,context:"list-view"}),{isLocked:w}=Th(t),{canInsertBlockType:S,getSelectedBlockClientIds:C,getPreviousBlockClientId:B,getBlockRootClientId:I,getBlockOrder:T,getBlocksByClientId:M,getBlockAttributes:P,canRemoveBlocks:R}=(0,d.useSelect)(Nr),{duplicateBlocks:N,multiSelect:L,removeBlocks:A}=(0,d.useDispatch)(Nr),O=(0,A_.__unstableUseShortcutEventMatch)(),D="sticky"===y?.positionType,z=function({clientId:e,isExpanded:t}){const{block:n}=(0,d.useSelect)((t=>({block:t(Nr).getBlock(e)})),[e]);return(0,u.useMemo)((()=>ux(n,t)),[n,t])}({clientId:t,isExpanded:f}),{rootClientId:V}=JC(),F=P(t)?.metadata?.bindings,H=y?.positionLabel?(0,x.sprintf)((0,x.__)("Position: %1$s"),y.positionLabel):"";function G(){const e=C(),n=e.includes(t),o=n?e[0]:t,r=I(o);return{blocksToUpdate:n?e:[t],firstBlockClientId:o,firstBlockRootClientId:r,selectedBlockClientIds:e}}return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.Button,{className:ml()("block-editor-list-view-block-select-button",e),onClick:o,onContextMenu:r,onKeyDown:async function(e){if(e.keyCode===zs.ENTER||e.keyCode===zs.SPACE)o(e);else if(e.keyCode===zs.BACKSPACE||e.keyCode===zs.DELETE||O("core/block-editor/remove",e)){var t;const{blocksToUpdate:e,firstBlockClientId:n,firstBlockRootClientId:o,selectedBlockClientIds:r}=G();if(!R(e,o))return;let l=null!==(t=B(n))&&void 0!==t?t:o;A(e,!1);const i=r.length>0&&0===C().length;l||(l=T()[0]),k(l,i)}else if(O("core/block-editor/duplicate",e)){if(e.defaultPrevented)return;e.preventDefault();const{blocksToUpdate:t,firstBlockRootClientId:n}=G(),o=M(t).every((e=>!!e&&(0,c.hasBlockSupport)(e.name,"multiple",!0)&&S(e.name,n)));if(o){const e=await N(t,!1);e?.length&&k(e[0],!1)}}else if(O("core/block-editor/select-all",e)){if(e.defaultPrevented)return;e.preventDefault();const{firstBlockRootClientId:t,selectedBlockClientIds:n}=G(),o=T(t);if(!o.length)return;if(js()(n,o)&&t&&t!==V)return void k(t,!0);L(o[0],o[o.length-1],null)}},onMouseDown:l,ref:_,tabIndex:a,onFocus:p,onDragStart:e=>{e.dataTransfer.clearData(),m?.(e)},onDragEnd:h,draggable:g,href:`#block-${t}`,"aria-label":b,"aria-describedby":v,"aria-expanded":f},(0,s.createElement)(sx,{onClick:i}),(0,s.createElement)(qh,{icon:y?.icon,showColors:!0,context:"list-view"}),(0,s.createElement)(_l.__experimentalHStack,{alignment:"center",className:"block-editor-list-view-block-select-button__label-wrapper",justify:"flex-start",spacing:1},(0,s.createElement)("span",{className:"block-editor-list-view-block-select-button__title"},(0,s.createElement)(_l.__experimentalTruncate,{ellipsizeMode:"auto"},E)),y?.anchor&&(0,s.createElement)("span",{className:"block-editor-list-view-block-select-button__anchor-wrapper"},(0,s.createElement)(_l.__experimentalTruncate,{className:"block-editor-list-view-block-select-button__anchor",ellipsizeMode:"auto"},y.anchor)),F&&eg(n)&&(0,s.createElement)("span",{className:"block-editor-list-view-block-select-button__bindings"},(0,s.createElement)(Ti,{icon:AC})),H&&D&&(0,s.createElement)(_l.Tooltip,{text:H},(0,s.createElement)(Ti,{icon:lx})),z.length?(0,s.createElement)("span",{className:"block-editor-list-view-block-select-button__images","aria-hidden":!0},z.map(((e,t)=>(0,s.createElement)("span",{className:"block-editor-list-view-block-select-button__image",key:e.clientId,style:{backgroundImage:`url(${e.url})`,zIndex:z.length-t}})))):null,w&&(0,s.createElement)("span",{className:"block-editor-list-view-block-select-button__lock"},(0,s.createElement)(Ti,{icon:ix})))))})),px=(0,u.forwardRef)((({onClick:e,onToggleExpanded:t,block:n,isSelected:o,position:r,siblingBlockCount:l,level:i,isExpanded:a,selectedClientIds:c,...u},p)=>{const{clientId:m}=n,{blockMovingClientId:h,selectedBlockInBlockEditor:g}=(0,d.useSelect)((e=>{const{hasBlockMovingClientId:t,getSelectedBlockClientId:n}=e(Nr);return{blockMovingClientId:t(),selectedBlockInBlockEditor:n()}}),[]),{AdditionalBlockContent:f,insertedBlock:b,setInsertedBlock:v}=JC(),k=h&&g===m,_=ml()("block-editor-list-view-block-contents",{"is-dropping-before":k}),y=c.includes(m)?c:[m];return(0,s.createElement)(s.Fragment,null,f&&(0,s.createElement)(f,{block:n,insertedBlock:b,setInsertedBlock:v}),(0,s.createElement)(sS,{appendToOwnerDocument:!0,clientIds:y,cloneClassname:"block-editor-list-view-draggable-chip"},(({draggable:c,onDragStart:d,onDragEnd:m})=>(0,s.createElement)(dx,{ref:p,className:_,block:n,onClick:e,onToggleExpanded:t,isSelected:o,position:r,siblingBlockCount:l,level:i,draggable:c,onDragStart:d,onDragEnd:m,isExpanded:a,...u}))))})),mx=px;function hx(e,t){const n=()=>{const n=t?.querySelector(`[role=row][data-block="${e}"]`);return n?As.focus.focusable.find(n)[0]:null};let o=n();o?o.focus():window.requestAnimationFrame((()=>{o=n(),o&&o.focus()}))}const gx=(0,u.memo)((function e({block:{clientId:t},displacement:n,isAfterDraggedBlocks:o,isDragged:r,isNesting:l,isSelected:i,isBranchSelected:a,selectBlock:m,position:h,level:g,rowCount:f,siblingBlockCount:b,showBlockMovers:v,path:k,isExpanded:_,selectedClientIds:y,isSyncedBranch:E}){const w=(0,u.useRef)(null),S=(0,u.useRef)(null),C=(0,u.useRef)(null),[B,I]=(0,u.useState)(!1),[T,M]=(0,u.useState)(),{isLocked:P,canEdit:R,canMove:N}=Th(t),L=i&&y[0]===t,A=i&&y[y.length-1]===t,{toggleBlockHighlight:O}=(0,d.useDispatch)(Nr),D=ih(t),z=D?.name||D?.title||(0,x.__)("Untitled"),{block:V,blockName:F,blockEditingMode:H}=(0,d.useSelect)((e=>{const{getBlock:n,getBlockName:o,getBlockEditingMode:r}=e(Nr);return{block:n(t),blockName:o(t),blockEditingMode:r(t)}}),[t]),G=(0,d.useSelect)((e=>e(Nr).getSettings().allowRightClickOverrides),[]),U=(0,c.hasBlockSupport)(F,"__experimentalToolbar",!0)&&"default"===H,$=`list-view-block-select-button__${(0,p.useInstanceId)(e)}`,{expand:j,collapse:W,BlockSettingsMenu:K,listViewInstanceId:Z,expandedState:q,setInsertedBlock:Y,treeGridElementRef:X}=JC(),Q=(0,u.useCallback)((()=>{I(!0),O(t,!0)}),[t,I,O]),J=(0,u.useCallback)((()=>{I(!1),O(t,!1)}),[t,I,O]),ee=(0,u.useCallback)((e=>{m(e,t),e.preventDefault()}),[t,m]),te=(0,u.useCallback)(((e,t)=>{t&&m(void 0,e,null,null),hx(e,X?.current)}),[m,X]),ne=(0,u.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),!0===_?W(t):!1===_&&j(t)}),[t,j,W,_]),oe=(0,u.useCallback)((e=>{U&&G&&(C.current?.click(),M(new window.DOMRect(e.clientX,e.clientY,0,0)),e.preventDefault())}),[G,C,U]),re=(0,u.useCallback)((e=>{G&&2===e.button&&e.preventDefault()}),[G]),le=(0,u.useMemo)((()=>{const{ownerDocument:e}=S?.current||{};if(T&&e)return{ownerDocument:e,getBoundingClientRect:()=>T}}),[T]),ie=(0,u.useCallback)((()=>{M(void 0)}),[M]);if(function({isSelected:e,selectedClientIds:t,rowItemRef:n}){const o=1===t.length;(0,u.useLayoutEffect)((()=>{if(!e||!o||!n.current)return;const t=(0,As.getScrollContainer)(n.current),{ownerDocument:r}=n.current;if(t===r.body||t===r.documentElement||!t)return;const l=n.current.getBoundingClientRect(),i=t.getBoundingClientRect();(l.top<i.top||l.bottom>i.bottom)&&n.current.scrollIntoView()}),[e,o,n])}({isSelected:i,rowItemRef:S,selectedClientIds:y}),!V)return null;const se=((e,t,n)=>(0,x.sprintf)((0,x.__)("Block %1$d of %2$d, Level %3$d"),e,t,n))(h,b,g),ae=P?(0,x.sprintf)((0,x.__)("%s (locked)"),z):z,ce=(0,x.sprintf)((0,x.__)("Options for %s"),z),ue=v&&b>0,de=ml()("block-editor-list-view-block__mover-cell",{"is-visible":B||i}),pe=ml()("block-editor-list-view-block__menu-cell",{"is-visible":B||L});let me;ue?me=2:U||(me=3);const he=ml()({"is-selected":i,"is-first-selected":L,"is-last-selected":A,"is-branch-selected":a,"is-synced-branch":E,"is-dragging":r,"has-single-cell":!U,"is-synced":D?.isSynced,"is-draggable":N,"is-displacement-normal":"normal"===n,"is-displacement-up":"up"===n,"is-displacement-down":"down"===n,"is-after-dragged-blocks":o,"is-nesting":l}),ge=y.includes(t)?y:[t],fe=i&&1===y.length;return(0,s.createElement)(rx,{className:he,isDragged:r,onKeyDown:e=>{e.keyCode===zs.ESCAPE&&!e.defaultPrevented&&y.length>0&&(e.stopPropagation(),e.preventDefault(),m(e,void 0))},onMouseEnter:Q,onMouseLeave:J,onFocus:Q,onBlur:J,level:g,position:h,rowCount:f,path:k,id:`list-view-${Z}-block-${t}`,"data-block":t,"data-expanded":R?_:void 0,ref:S},(0,s.createElement)(_l.__experimentalTreeGridCell,{className:"block-editor-list-view-block__contents-cell",colSpan:me,ref:w,"aria-selected":!!i},(({ref:e,tabIndex:t,onFocus:n})=>(0,s.createElement)("div",{className:"block-editor-list-view-block__contents-container"},(0,s.createElement)(mx,{block:V,onClick:ee,onContextMenu:oe,onMouseDown:re,onToggleExpanded:ne,isSelected:i,position:h,siblingBlockCount:b,level:g,ref:e,tabIndex:fe?0:t,onFocus:n,isExpanded:R?_:void 0,selectedClientIds:y,ariaLabel:ae,ariaDescribedBy:$,updateFocusAndSelection:te}),(0,s.createElement)(ex,{id:$},se)))),ue&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.__experimentalTreeGridCell,{className:de,withoutGridItem:!0},(0,s.createElement)(_l.__experimentalTreeGridItem,null,(({ref:e,tabIndex:n,onFocus:o})=>(0,s.createElement)(gS,{orientation:"vertical",clientIds:[t],ref:e,tabIndex:n,onFocus:o}))),(0,s.createElement)(_l.__experimentalTreeGridItem,null,(({ref:e,tabIndex:n,onFocus:o})=>(0,s.createElement)(fS,{orientation:"vertical",clientIds:[t],ref:e,tabIndex:n,onFocus:o}))))),U&&K&&(0,s.createElement)(_l.__experimentalTreeGridCell,{className:pe,"aria-selected":!!i,ref:C},(({ref:e,tabIndex:t,onFocus:n})=>(0,s.createElement)(K,{clientIds:ge,block:V,icon:Ef,label:ce,popoverProps:{anchor:le},toggleProps:{ref:e,className:"block-editor-list-view-block__menu",tabIndex:t,onClick:ie,onFocus:n},disableOpenOnArrowDown:!0,expand:j,expandedState:q,setInsertedBlock:Y,__experimentalSelectBlock:te}))))}));function fx(e,t,n,o){var r;const l=n?.includes(e.clientId);if(l)return 0;return(null!==(r=t[e.clientId])&&void 0!==r?r:o)?1+e.innerBlocks.reduce(bx(t,n,o),0):1}const bx=(e,t,n)=>(o,r)=>{var l;const i=t?.includes(r.clientId);if(i)return o;return(null!==(l=e[r.clientId])&&void 0!==l?l:n)&&r.innerBlocks.length>0?o+fx(r,e,t,n):o+1},vx=()=>{};const kx=(0,u.memo)((function e(t){const{blocks:n,selectBlock:o=vx,showBlockMovers:r,selectedClientIds:l,level:i=1,path:a="",isBranchSelected:c=!1,listPosition:u=0,fixedListWindow:p,isExpanded:m,parentId:h,shouldShowInnerBlocks:g=!0,isSyncedBranch:f=!1,showAppender:b=!0}=t,v=ih(h),k=f||!!v?.isSynced,_=(0,d.useSelect)((e=>!h||e(Nr).canEditBlock(h)),[h]),{blockDropPosition:y,blockDropTargetIndex:E,firstDraggedBlockIndex:w,blockIndexes:S,expandedState:C,draggedClientIds:x}=JC();if(!_)return null;const B=b&&1===i,I=n.filter(Boolean),T=I.length,M=B?T+1:T;let P=u;return(0,s.createElement)(s.Fragment,null,I.map(((t,n)=>{var u;const{clientId:h,innerBlocks:f}=t;n>0&&(P+=fx(I[n-1],C,x,m));const b=!!x?.includes(h),{displacement:v,isAfterDraggedBlocks:_,isNesting:B}=function({blockIndexes:e,blockDropTargetIndex:t,blockDropPosition:n,clientId:o,firstDraggedBlockIndex:r,isDragged:l}){let i,s,a;if(!l){s=!1;const l=e[o];a=l>r,null!=t&&void 0!==r?void 0!==l&&(i=l>=r&&l<t?"up":l<r&&l>=t?"down":"normal",s="number"==typeof t&&t-1===l&&"inside"===n):null===t&&void 0!==r?i=void 0!==l&&l>=r?"up":"normal":null!=t&&void 0===r?void 0!==l&&(i=l<t?"normal":"down"):null===t&&(i="normal")}return{displacement:i,isNesting:s,isAfterDraggedBlocks:a}}({blockIndexes:S,blockDropTargetIndex:E,blockDropPosition:y,clientId:h,firstDraggedBlockIndex:w,isDragged:b}),{itemInView:R}=p,N=R(P),L=n+1,A=a.length>0?`${a}_${L}`:`${L}`,O=!!f?.length,D=O&&g?null!==(u=C[h])&&void 0!==u?u:m:void 0,z=((e,t)=>Array.isArray(t)&&t.length?-1!==t.indexOf(e):t===e)(h,l),V=c||z&&O,F=b||N||z&&h===l[0];return(0,s.createElement)(d.AsyncModeProvider,{key:h,value:!z},F&&(0,s.createElement)(gx,{block:t,selectBlock:o,isSelected:z,isBranchSelected:V,isDragged:b,level:i,position:L,rowCount:M,siblingBlockCount:T,showBlockMovers:r,path:A,isExpanded:!b&&D,listPosition:P,selectedClientIds:l,isSyncedBranch:k,displacement:v,isAfterDraggedBlocks:_,isNesting:B}),!F&&(0,s.createElement)("tr",null,(0,s.createElement)("td",{className:"block-editor-list-view-placeholder"})),O&&D&&!b&&(0,s.createElement)(e,{parentId:h,blocks:f,selectBlock:o,showBlockMovers:r,level:i+1,path:A,listPosition:P+1,fixedListWindow:p,isBranchSelected:V,selectedClientIds:l,isExpanded:m,isSyncedBranch:k}))})),B&&(0,s.createElement)(_l.__experimentalTreeGridRow,{level:i,setSize:M,positionInSet:M,isExpanded:!0},(0,s.createElement)(_l.__experimentalTreeGridCell,null,(e=>(0,s.createElement)(tx,{clientId:h,nestingLevel:i,blockCount:T,...e})))))}));function _x({draggedBlockClientId:e,listViewRef:t,blockDropTarget:n}){const o=ih(e),r=df({clientId:e,context:"list-view"}),{rootClientId:l,clientId:i,dropPosition:a}=n||{},[c,d]=(0,u.useMemo)((()=>{if(!t.current)return[];return[l?t.current.querySelector(`[data-block="${l}"]`):void 0,i?t.current.querySelector(`[data-block="${i}"]`):void 0]}),[t,l,i]),p=d||c,m=(0,x.isRTL)(),h=(0,u.useCallback)(((e,t)=>{if(!p)return 0;let n=p.offsetWidth;const o=(0,As.getScrollContainer)(p,"horizontal"),r=p.ownerDocument,l=o===r.body||o===r.documentElement;if(o&&!l){const r=o.getBoundingClientRect(),l=(0,x.isRTL)()?r.right-e.right:e.left-r.left,i=o.clientWidth;if(i<n+l&&(n=i-l),!m&&e.left+t<r.left)return n-=r.left-e.left,n;if(m&&e.right-t>r.right)return n-=e.right-r.right,n}return n-t}),[m,p]),g=(0,u.useMemo)((()=>{if(!p)return{};const e=p.getBoundingClientRect();return{width:h(e,0)}}),[h,p]),f=(0,u.useMemo)((()=>{if(!p)return{};const e=(0,As.getScrollContainer)(p),t=p.ownerDocument,n=e===t.body||e===t.documentElement;if(e&&!n){const t=e.getBoundingClientRect(),n=p.getBoundingClientRect(),o=m?t.right-n.right:n.left-t.left;if(!m&&t.left>n.left)return{transform:`translateX( ${o}px )`};if(m&&t.right<n.right)return{transform:`translateX( ${-1*o}px )`}}return{}}),[m,p]),b=(0,u.useMemo)((()=>{if(!c)return 1;const e=parseInt(c.getAttribute("aria-level"),10);return e?e+1:1}),[c]),v=(0,u.useMemo)((()=>!!p&&p.classList.contains("is-branch-selected")),[p]),k=(0,u.useMemo)((()=>{if(p&&("top"===a||"bottom"===a||"inside"===a))return{contextElement:p,getBoundingClientRect(){const e=p.getBoundingClientRect();let t=e.left,n=0;const o=(0,As.getScrollContainer)(p,"horizontal"),r=p.ownerDocument,l=o===r.body||o===r.documentElement;if(o&&!l){const e=o.getBoundingClientRect(),n=m?o.offsetWidth-o.clientWidth:0;t<e.left+n&&(t=e.left+n)}n="top"===a?e.top-2*e.height:e.top;const i=h(e,0),s=e.height;return new window.DOMRect(t,n,i,s)}}}),[p,a,h,m]);return p?(0,s.createElement)(_l.Popover,{animate:!1,anchor:k,focusOnMount:!1,className:"block-editor-list-view-drop-indicator--preview",variant:"unstyled",flip:!1,resize:!0},(0,s.createElement)("div",{style:g,className:ml()("block-editor-list-view-drop-indicator__line",{"block-editor-list-view-drop-indicator__line--darker":v})},(0,s.createElement)("div",{className:"block-editor-list-view-leaf","aria-level":b},(0,s.createElement)("div",{className:ml()("block-editor-list-view-block-select-button","block-editor-list-view-block-contents"),style:f},(0,s.createElement)(sx,{onClick:()=>{}}),(0,s.createElement)(qh,{icon:o?.icon,showColors:!0,context:"list-view"}),(0,s.createElement)(_l.__experimentalHStack,{alignment:"center",className:"block-editor-list-view-block-select-button__label-wrapper",justify:"flex-start",spacing:1},(0,s.createElement)("span",{className:"block-editor-list-view-block-select-button__title"},(0,s.createElement)(_l.__experimentalTruncate,{ellipsizeMode:"auto"},r)))),(0,s.createElement)("div",{className:"block-editor-list-view-block__menu-cell"})))):null}function yx(){const{clearSelectedBlock:e,multiSelect:t,selectBlock:n}=(0,d.useDispatch)(Nr),{getBlockName:o,getBlockParents:r,getBlockSelectionStart:l,getSelectedBlockClientIds:i,hasMultiSelection:s,hasSelectedBlock:a}=(0,d.useSelect)(Nr),{getBlockType:p}=(0,d.useSelect)(c.store);return{updateBlockSelection:(0,u.useCallback)((async(c,u,d,m)=>{if(!c?.shiftKey&&c?.keyCode!==zs.ESCAPE)return void n(u,m);c.preventDefault();const h="keydown"===c.type&&c.keyCode===zs.ESCAPE,g="keydown"===c.type&&(c.keyCode===zs.UP||c.keyCode===zs.DOWN||c.keyCode===zs.HOME||c.keyCode===zs.END);if(!g&&!a()&&!s())return void n(u,null);const f=i(),b=[...r(u),u];if((h||g&&!f.some((e=>b.includes(e))))&&await e(),!h){let e=l(),n=u;g&&(a()||s()||(e=u),d&&(n=d));const o=r(e),i=r(n),{start:c,end:p}=function(e,t,n,o){const r=[...n,e],l=[...o,t],i=Math.min(r.length,l.length)-1;return{start:r[i],end:l[i]}}(e,n,o,i);await t(c,p,null)}const v=i();if((c.keyCode===zs.HOME||c.keyCode===zs.END)&&v.length>1)return;const k=f.filter((e=>!v.includes(e)));let _;if(1===k.length){const e=p(o(k[0]))?.title;e&&(_=(0,x.sprintf)((0,x.__)("%s deselected."),e))}else k.length>1&&(_=(0,x.sprintf)((0,x.__)("%s blocks deselected."),k.length));_&&(0,vo.speak)(_,"assertive")}),[e,o,p,r,l,i,s,a,t,n])}}const Ex=28;function wx(e,t){const n=e[t+1];return n&&n.isDraggedBlock?wx(e,t+1):n}const Sx=["top","bottom"];function Cx(e,t,n=!1){let o,r,l,i,s;for(let n=0;n<e.length;n++){const a=e[n];if(a.isDraggedBlock)continue;const c=a.element.getBoundingClientRect(),[u,d]=Iw(t,c,Sx),p=Tw(t,c);if(void 0===l||u<l||p){l=u;const t=e.indexOf(a),n=e[t-1];if("top"===d&&n&&n.rootClientId===a.rootClientId&&!n.isDraggedBlock?(r=n,o="bottom",i=n.element.getBoundingClientRect(),s=t-1):(r=a,o=d,i=c,s=t),p)break}}if(!r)return;const a=function(e,t){const n=[];let o=e;for(;o;)n.push({...o}),o=t.find((e=>e.clientId===o.rootClientId));return n}(r,e),c="bottom"===o;if(c&&r.canInsertDraggedBlocksAsChild&&(r.innerBlockCount>0&&r.isExpanded||function(e,t,n=1,o=!1){const r=o?t.right-n*Ex:t.left+n*Ex;return(o?e.x<r-Ex:e.x>r+Ex)&&e.y<t.bottom}(t,i,a.length,n))){const e=r.isExpanded?0:r.innerBlockCount||0;return{rootClientId:r.clientId,clientId:r.clientId,blockIndex:e,dropPosition:"inside"}}if(c&&r.rootClientId&&function(e,t,n=1,o=!1){const r=o?t.right-n*Ex:t.left+n*Ex;return o?e.x>r:e.x<r}(t,i,a.length,n)){const l=wx(e,s),c=r.nestingLevel,u=l?l.nestingLevel:1;if(c&&u){const d=function(e,t,n=1,o=!1){const r=o?t.right-n*Ex:t.left+n*Ex,l=o?r-e.x:e.x-r,i=Math.round(l/Ex);return Math.abs(i)}(t,i,a.length,n),p=Math.max(Math.min(d,c-u),0);if(a[p]){let t=r.blockIndex;if(a[p].nestingLevel===l?.nestingLevel)t=l?.blockIndex;else for(let n=s;n>=0;n--){const o=e[n];if(o.rootClientId===a[p].rootClientId){t=o.blockIndex+1;break}}return{rootClientId:a[p].rootClientId,clientId:r.clientId,blockIndex:t,dropPosition:o}}}}if(!r.canInsertDraggedBlocksAsSibling)return;const u=c?1:0;return{rootClientId:r.rootClientId,clientId:r.clientId,blockIndex:r.blockIndex+u,dropPosition:o}}const xx={leading:!1,trailing:!0};function Bx({selectBlock:e}){const t=(0,d.useRegistry)(),{getBlockOrder:n,getBlockRootClientId:o,getBlocksByClientId:r,getPreviousBlockClientId:l,getSelectedBlockClientIds:i,getSettings:s,canInsertBlockType:a,canRemoveBlocks:c}=(0,d.useSelect)(Nr),{flashBlock:u,removeBlocks:m,replaceBlocks:h,insertBlocks:g}=(0,d.useDispatch)(Nr),f=ey();return(0,p.useRefEffect)((d=>{function p(t,n){n&&e(void 0,t,null,null),hx(t,d)}function b(e){if(e.defaultPrevented)return;if(!d.contains(e.target.ownerDocument.activeElement))return;const b=e.target.ownerDocument.activeElement?.closest("[role=row]"),v=b?.dataset?.block;if(!v)return;const{blocksToUpdate:k,firstBlockClientId:_,firstBlockRootClientId:y,originallySelectedBlockClientIds:E}=function(e){const t=i(),n=t.includes(e),r=n?t[0]:e;return{blocksToUpdate:n?t:[e],firstBlockClientId:r,firstBlockRootClientId:o(r),originallySelectedBlockClientIds:t}}(v);if(0!==k.length){if(e.preventDefault(),"copy"===e.type||"cut"===e.type){1===k.length&&u(k[0]),f(e.type,k);oy(e,r(k),t)}if("cut"===e.type){var w;if(!c(k,y))return;let e=null!==(w=l(_))&&void 0!==w?w:y;m(k,!1);const t=E.length>0&&0===i().length;e||(e=n()[0]),p(e,t)}else if("paste"===e.type){const{__experimentalCanUserUseUnfilteredHTML:t}=s(),n=ry(e,t);if(1===k.length){const[e]=k;if(n.every((t=>a(t.name,e))))return g(n,void 0,e),void p(n[0]?.clientId,!1)}h(k,n,n.length-1,-1),p(n[0]?.clientId,!1)}}}return d.ownerDocument.addEventListener("copy",b),d.ownerDocument.addEventListener("cut",b),d.ownerDocument.addEventListener("paste",b),()=>{d.ownerDocument.removeEventListener("copy",b),d.ownerDocument.removeEventListener("cut",b),d.ownerDocument.removeEventListener("paste",b)}}),[])}const Ix=(e,t)=>Array.isArray(t.clientIds)?{...e,...t.clientIds.reduce(((e,n)=>({...e,[n]:"expand"===t.type})),{})}:e;const Tx=(0,u.forwardRef)((function e({id:t,blocks:n,dropZoneElement:o,showBlockMovers:r=!1,isExpanded:l=!1,showAppender:i=!1,blockSettingsMenu:a=kC,rootClientId:c,description:m,onSelect:h,additionalBlockContent:g},f){n&&w()("`blocks` property in `wp.blockEditor.__experimentalListView`",{since:"6.3",alternative:"`rootClientId` property"});const b=(0,p.useInstanceId)(e),{clientIdsTree:v,draggedClientIds:k,selectedClientIds:_}=function({blocks:e,rootClientId:t}){return(0,d.useSelect)((n=>{const{getDraggedBlockClientIds:o,getSelectedBlockClientIds:r,getEnabledClientIdsTree:l}=ie(n(Nr));return{selectedClientIds:r(),draggedClientIds:o(),clientIdsTree:null!=e?e:l(t)}}),[e,t])}({blocks:n,rootClientId:c}),y=function(e){const t=(0,u.useMemo)((()=>{const t={};let n=0;const o=e=>{e.forEach((e=>{t[e.clientId]=n,n++,e.innerBlocks.length>0&&o(e.innerBlocks)}))};return o(e),t}),[e]);return t}(v),{getBlock:E}=(0,d.useSelect)(Nr),{visibleBlockCount:S,shouldShowInnerBlocks:C}=(0,d.useSelect)((e=>{const{getGlobalBlockCount:t,getClientIdsOfDescendants:n,__unstableGetEditorMode:o}=e(Nr),r=k?.length>0?n(k).length+1:0;return{visibleBlockCount:t()-r,shouldShowInnerBlocks:"zoom-out"!==o()}}),[k]),{updateBlockSelection:B}=yx(),[I,T]=(0,u.useReducer)(Ix,{}),[M,P]=(0,u.useState)(null),{setSelectedTreeId:R}=function({firstSelectedBlockClientId:e,setExpandedState:t}){const[n,o]=(0,u.useState)(null),{selectedBlockParentClientIds:r}=(0,d.useSelect)((t=>{const{getBlockParents:n}=t(Nr);return{selectedBlockParentClientIds:n(e,!1)}}),[e]);return(0,u.useEffect)((()=>{n!==e&&r?.length&&t({type:"expand",clientIds:r})}),[e,r,n,t]),{setSelectedTreeId:o}}({firstSelectedBlockClientId:_[0],setExpandedState:T}),N=(0,u.useCallback)(((e,t,n)=>{B(e,t,null,n),R(t),h&&h(E(t))}),[R,B,h,E]),{ref:L,target:A}=function({dropZoneElement:e,expandedState:t,setExpandedState:n}){const{getBlockRootClientId:o,getBlockIndex:r,getBlockCount:l,getDraggedBlockClientIds:i,canInsertBlocks:s}=(0,d.useSelect)(Nr),[a,c]=(0,u.useState)(),{rootClientId:m,blockIndex:h}=a||{},g=Bw(m,h),f=(0,x.isRTL)(),b=(0,p.usePrevious)(m),v=(0,u.useCallback)(((e,t)=>{const{rootClientId:o}=t||{};o&&("inside"!==t?.dropPosition||e[o]||n({type:"expand",clientIds:[o]}))}),[n]),k=(0,p.useThrottle)(v,500,xx);(0,u.useEffect)((()=>{"inside"===a?.dropPosition&&b===a?.rootClientId?k(t,a):k.cancel()}),[t,b,a,k]);const _=i(),y=(0,p.useThrottle)((0,u.useCallback)(((e,t)=>{const n={x:e.clientX,y:e.clientY},i=!!_?.length,a=Cx(Array.from(t.querySelectorAll("[data-block]")).map((e=>{const t=e.dataset.block,n="true"===e.dataset.expanded,a=e.classList.contains("is-dragging"),c=parseInt(e.getAttribute("aria-level"),10),u=o(t);return{clientId:t,isExpanded:n,rootClientId:u,blockIndex:r(t),element:e,nestingLevel:c||void 0,isDraggedBlock:!!i&&a,innerBlockCount:l(t),canInsertDraggedBlocksAsSibling:!i||s(_,u),canInsertDraggedBlocksAsChild:!i||s(_,t)}})),n,f);a&&c(a)}),[s,_,l,r,o,f]),50);return{ref:(0,p.__experimentalUseDropZone)({dropZoneElement:e,onDrop(e){y.cancel(),a&&g(e),c(void 0)},onDragLeave(){y.cancel(),c(null)},onDragOver(e){y(e,e.currentTarget)},onDragEnd(){y.cancel(),c(void 0)}}),target:a}}({dropZoneElement:o,expandedState:I,setExpandedState:T}),O=(0,u.useRef)(),D=Bx({selectBlock:N}),z=(0,p.useMergeRefs)([D,O,L,f]);(0,u.useEffect)((()=>{_?.length&&hx(_[0],O?.current)}),[]);const V=(0,u.useCallback)((e=>{e&&T({type:"expand",clientIds:[e]})}),[T]),F=(0,u.useCallback)((e=>{e&&T({type:"collapse",clientIds:[e]})}),[T]),H=(0,u.useCallback)((e=>{V(e?.dataset?.block)}),[V]),G=(0,u.useCallback)((e=>{F(e?.dataset?.block)}),[F]),U=(0,u.useCallback)(((e,t,n)=>{e.shiftKey&&B(e,t?.dataset?.block,n?.dataset?.block)}),[B]),$=k?.[0],{blockDropTargetIndex:j,blockDropPosition:W,firstDraggedBlockIndex:K}=(0,u.useMemo)((()=>{let e,t;if(A?.clientId){const t=y[A.clientId];e=void 0===t||"top"===A?.dropPosition?t:t+1}else null===A&&(e=null);if($){const e=y[$];t=void 0===e||"top"===A?.dropPosition?e:e+1}return{blockDropTargetIndex:e,blockDropPosition:A?.dropPosition,firstDraggedBlockIndex:t}}),[A,y,$]),Z=(0,u.useMemo)((()=>({blockDropPosition:W,blockDropTargetIndex:j,blockIndexes:y,draggedClientIds:k,expandedState:I,expand:V,firstDraggedBlockIndex:K,collapse:F,BlockSettingsMenu:a,listViewInstanceId:b,AdditionalBlockContent:g,insertedBlock:M,setInsertedBlock:P,treeGridElementRef:O,rootClientId:c})),[W,j,y,k,I,V,K,F,a,b,g,M,P,c]),[q]=(0,p.__experimentalUseFixedWindowList)(O,36,S,{expandedState:I,useWindowing:!0,windowOverscan:40});if(!v.length&&!i)return null;const Y=m&&`block-editor-list-view-description-${b}`;return(0,s.createElement)(d.AsyncModeProvider,{value:!0},(0,s.createElement)(_x,{draggedBlockClientId:$,listViewRef:O,blockDropTarget:A}),m&&(0,s.createElement)(_l.VisuallyHidden,{id:Y},m),(0,s.createElement)(_l.__experimentalTreeGrid,{id:t,className:ml()("block-editor-list-view-tree",{"is-dragging":k?.length>0&&void 0!==j}),"aria-label":(0,x.__)("Block navigation structure"),ref:z,onCollapseRow:G,onExpandRow:H,onFocusRow:U,applicationAriaLabel:(0,x.__)("Block navigation structure"),"aria-describedby":Y,style:{"--wp-admin--list-view-dragged-items-height":k?.length?36*(k.length-1)+"px":null}},(0,s.createElement)(QC.Provider,{value:Z},(0,s.createElement)(kx,{blocks:v,parentId:c,selectBlock:N,showBlockMovers:r,fixedListWindow:q,selectedClientIds:_,isExpanded:l,shouldShowInnerBlocks:C,showAppender:i}))))})),Mx=(0,u.forwardRef)(((e,t)=>(0,s.createElement)(Tx,{ref:t,...e,showAppender:!1,rootClientId:null,onSelect:null,additionalBlockContent:null,blockSettingsMenu:void 0})));function Px({isEnabled:e,onToggle:t,isOpen:n,innerRef:o,...r}){return(0,s.createElement)(_l.Button,{...r,ref:o,icon:XC,"aria-expanded":n,"aria-haspopup":"true",onClick:e?t:void 0,label:(0,x.__)("List view"),className:"block-editor-block-navigation","aria-disabled":!e})}const Rx=(0,u.forwardRef)((function({isDisabled:e,...t},n){w()("wp.blockEditor.BlockNavigationDropdown",{since:"6.1",alternative:"wp.components.Dropdown and wp.blockEditor.ListView"});const o=(0,d.useSelect)((e=>!!e(Nr).getBlockCount()),[])&&!e;return(0,s.createElement)(_l.Dropdown,{contentClassName:"block-editor-block-navigation__popover",popoverProps:{placement:"bottom-start"},renderToggle:({isOpen:e,onToggle:r})=>(0,s.createElement)(Px,{...t,innerRef:n,isOpen:e,onToggle:r,isEnabled:o}),renderContent:()=>(0,s.createElement)("div",{className:"block-editor-block-navigation__container"},(0,s.createElement)("p",{className:"block-editor-block-navigation__label"},(0,x.__)("List view")),(0,s.createElement)(Mx,null))})}));function Nx({genericPreviewBlock:e,style:t,className:n,activeStyle:o}){const r=(0,c.getBlockType)(e.name)?.example,l=RS(n,o,t),i=(0,u.useMemo)((()=>({...e,title:t.label||t.name,description:t.description,initialAttributes:{...e.attributes,className:l+" block-editor-block-styles__block-preview-container"},example:r})),[e,l]);return(0,s.createElement)(Py,{item:i})}const Lx=()=>{};const Ax=function({clientId:e,onSwitch:t=Lx,onHoverClassName:n=Lx}){const{onSelect:o,stylesToRender:r,activeStyle:l,genericPreviewBlock:i,className:a}=LS({clientId:e,onSwitch:t}),[c,d]=(0,u.useState)(null),m=(0,p.useViewportMatch)("medium","<");if(!r||0===r.length)return null;const h=(0,p.debounce)(d,250),g=e=>{var t;c!==e?(h(e),n(null!==(t=e?.name)&&void 0!==t?t:null)):h.cancel()};return(0,s.createElement)("div",{className:"block-editor-block-styles"},(0,s.createElement)("div",{className:"block-editor-block-styles__variants"},r.map((e=>{const t=e.label||e.name;return(0,s.createElement)(_l.Button,{__next40pxDefaultSize:!0,className:ml()("block-editor-block-styles__item",{"is-active":l.name===e.name}),key:e.name,variant:"secondary",label:t,onMouseEnter:()=>g(e),onFocus:()=>g(e),onMouseLeave:()=>g(null),onBlur:()=>g(null),onClick:()=>(e=>{o(e),n(null),d(null),h.cancel()})(e),"aria-current":l.name===e.name},(0,s.createElement)(_l.__experimentalTruncate,{numberOfLines:1,className:"block-editor-block-styles__item-text"},t))}))),c&&!m&&(0,s.createElement)(_l.Popover,{placement:"left-start",offset:34,focusOnMount:!1},(0,s.createElement)("div",{className:"block-editor-block-styles__preview-panel",onMouseLeave:()=>g(null)},(0,s.createElement)(Nx,{activeStyle:l,className:a,genericPreviewBlock:i,style:c}))))},Ox={0:(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z"})),1:(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M17.6 7c-.6.9-1.5 1.7-2.6 2v1h2v7h2V7h-1.4zM11 11H7V7H5v10h2v-4h4v4h2V7h-2v4z"})),2:(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M9 11.1H5v-4H3v10h2v-4h4v4h2v-10H9v4zm8 4c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6v1.5h8v-2H17z"})),3:(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.3 1.7c-.4-.4-1-.7-1.6-.8v-.1c.6-.2 1.1-.5 1.5-.9.3-.4.5-.8.5-1.3 0-.4-.1-.8-.3-1.1-.2-.3-.5-.6-.8-.8-.4-.2-.8-.4-1.2-.5-.6-.1-1.1-.2-1.6-.2-.6 0-1.3.1-1.8.3s-1.1.5-1.6.9l1.2 1.4c.4-.2.7-.4 1.1-.6.3-.2.7-.3 1.1-.3.4 0 .8.1 1.1.3.3.2.4.5.4.8 0 .4-.2.7-.6.9-.7.3-1.5.5-2.2.4v1.6c.5 0 1 0 1.5.1.3.1.7.2 1 .3.2.1.4.2.5.4s.1.4.1.6c0 .3-.2.7-.5.8-.4.2-.9.3-1.4.3s-1-.1-1.4-.3c-.4-.2-.8-.4-1.2-.7L13 15.6c.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.6 0 1.1-.1 1.6-.2.4-.1.9-.2 1.3-.5.4-.2.7-.5.9-.9.2-.4.3-.8.3-1.2 0-.6-.3-1.1-.7-1.5z"})),4:(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M20 13V7h-3l-4 6v2h5v2h2v-2h1v-2h-1zm-2 0h-2.8L18 9v4zm-9-2H5V7H3v10h2v-4h4v4h2V7H9v4z"})),5:(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M9 11H5V7H3v10h2v-4h4v4h2V7H9v4zm11.7 1.2c-.2-.3-.5-.7-.8-.9-.3-.3-.7-.5-1.1-.6-.5-.1-.9-.2-1.4-.2-.2 0-.5.1-.7.1-.2.1-.5.1-.7.2l.1-1.9h4.3V7H14l-.3 5 1 .6.5-.2.4-.1c.1-.1.3-.1.4-.1h.5c.5 0 1 .1 1.4.4.4.2.6.7.6 1.1 0 .4-.2.8-.6 1.1-.4.3-.9.4-1.4.4-.4 0-.9-.1-1.3-.3-.4-.2-.7-.4-1.1-.7 0 0-1.1 1.4-1 1.5.5.4 1 .8 1.6 1 .7.3 1.5.4 2.3.4.5 0 1-.1 1.5-.3s.9-.4 1.3-.7c.4-.3.7-.7.9-1.1s.3-.9.3-1.4-.1-1-.3-1.4z"})),6:(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M20.7 12.4c-.2-.3-.4-.6-.7-.9s-.6-.5-1-.6c-.4-.2-.8-.2-1.2-.2-.5 0-.9.1-1.3.3s-.8.5-1.2.8c0-.5 0-.9.2-1.4l.6-.9c.2-.2.5-.4.8-.5.6-.2 1.3-.2 1.9 0 .3.1.6.3.8.5 0 0 1.3-1.3 1.3-1.4-.4-.3-.9-.6-1.4-.8-.6-.2-1.3-.3-2-.3-.6 0-1.1.1-1.7.4-.5.2-1 .5-1.4.9-.4.4-.8 1-1 1.6-.3.7-.4 1.5-.4 2.3s.1 1.5.3 2.1c.2.6.6 1.1 1 1.5.4.4.9.7 1.4.9 1 .3 2 .3 3 0 .4-.1.8-.3 1.2-.6.3-.3.6-.6.8-1 .2-.5.3-.9.3-1.4s-.1-.9-.3-1.3zm-2 2.1c-.1.2-.3.4-.4.5-.1.1-.3.2-.5.2-.2.1-.4.1-.6.1-.2.1-.5 0-.7-.1-.2 0-.3-.2-.5-.3-.1-.2-.3-.4-.4-.6-.2-.3-.3-.7-.3-1 .3-.3.6-.5 1-.7.3-.1.7-.2 1-.2.4 0 .8.1 1.1.3.3.3.4.7.4 1.1 0 .2 0 .5-.1.7zM9 11H5V7H3v10h2v-4h4v4h2V7H9v4z"}))};function Dx({level:e}){return Ox[e]?(0,s.createElement)(_l.Icon,{icon:Ox[e]}):null}const zx=[1,2,3,4,5,6],Vx={className:"block-library-heading-level-dropdown"};function Fx({options:e=zx,value:t,onChange:n}){return(0,s.createElement)(_l.ToolbarDropdownMenu,{popoverProps:Vx,icon:(0,s.createElement)(Dx,{level:t}),label:(0,x.__)("Change level"),controls:e.map((e=>{{const o=e===t;return{icon:(0,s.createElement)(Dx,{level:e,isPressed:o}),title:0===e?(0,x.__)("Paragraph"):(0,x.sprintf)((0,x.__)("Heading %d"),e),isActive:o,onClick(){n(e)},role:"menuitemradio"}}}))})}const Hx=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"}));const Gx=function({icon:e=Hx,label:t=(0,x.__)("Choose variation"),instructions:n=(0,x.__)("Select a variation to start with."),variations:o,onSelect:r,allowSkip:l}){const i=ml()("block-editor-block-variation-picker",{"has-many-variations":o.length>4});return(0,s.createElement)(_l.Placeholder,{icon:e,label:t,instructions:n,className:i},(0,s.createElement)("ul",{className:"block-editor-block-variation-picker__variations",role:"list","aria-label":(0,x.__)("Block variations")},o.map((e=>(0,s.createElement)("li",{key:e.name},(0,s.createElement)(_l.Button,{variant:"secondary",icon:e.icon&&e.icon.src?e.icon.src:e.icon,iconSize:48,onClick:()=>r(e),className:"block-editor-block-variation-picker__variation",label:e.description||e.title}),(0,s.createElement)("span",{className:"block-editor-block-variation-picker__variation-label"},e.title))))),l&&(0,s.createElement)("div",{className:"block-editor-block-variation-picker__skip"},(0,s.createElement)(_l.Button,{variant:"link",onClick:()=>r()},(0,x.__)("Skip"))))},Ux=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z",fillRule:"evenodd",clipRule:"evenodd"})),$x="carousel",jx="grid",Wx=({onBlockPatternSelect:e})=>(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__actions"},(0,s.createElement)(_l.Button,{variant:"primary",onClick:e},(0,x.__)("Choose"))),Kx=({handlePrevious:e,handleNext:t,activeSlide:n,totalSlides:o})=>(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__navigation"},(0,s.createElement)(_l.Button,{icon:M_,label:(0,x.__)("Previous pattern"),onClick:e,disabled:0===n,__experimentalIsFocusable:!0}),(0,s.createElement)(_l.Button,{icon:T_,label:(0,x.__)("Next pattern"),onClick:t,disabled:n===o-1,__experimentalIsFocusable:!0})),Zx=({viewMode:e,setViewMode:t,handlePrevious:n,handleNext:o,activeSlide:r,totalSlides:l,onBlockPatternSelect:i})=>{const a=e===$x,c=(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__display-controls"},(0,s.createElement)(_l.Button,{icon:Xi,label:(0,x.__)("Carousel view"),onClick:()=>t($x),isPressed:a}),(0,s.createElement)(_l.Button,{icon:Ux,label:(0,x.__)("Grid view"),onClick:()=>t(jx),isPressed:e===jx}));return(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__toolbar"},a&&(0,s.createElement)(Kx,{handlePrevious:n,handleNext:o,activeSlide:r,totalSlides:l}),c,a&&(0,s.createElement)(Wx,{onBlockPatternSelect:i}))};const qx=function(e,t,n){return(0,d.useSelect)((o=>{const{getBlockRootClientId:r,getPatternsByBlockTypes:l,__experimentalGetAllowedPatterns:i}=o(Nr),s=r(e);return n?i(s).filter(n):l(t,s)}),[e,t,n])},{CompositeV2:Yx,CompositeItemV2:Xx,useCompositeStoreV2:Qx}=ie(_l.privateApis),Jx=({viewMode:e,activeSlide:t,patterns:n,onBlockPatternSelect:o,showTitles:r})=>{const l=Qx(),i="block-editor-block-pattern-setup__container";if(e===$x){const e=new Map([[t,"active-slide"],[t-1,"previous-slide"],[t+1,"next-slide"]]);return(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__carousel"},(0,s.createElement)("div",{className:i},(0,s.createElement)("div",{className:"carousel-container"},n.map(((n,o)=>(0,s.createElement)(tB,{active:o===t,className:e.get(o)||"",key:n.name,pattern:n}))))))}return(0,s.createElement)("div",{className:"block-editor-block-pattern-setup__grid"},(0,s.createElement)(Yx,{store:l,role:"listbox",className:i,"aria-label":(0,x.__)("Patterns list")},n.map((e=>(0,s.createElement)(eB,{key:e.name,pattern:e,onSelect:o,showTitles:r})))))};function eB({pattern:e,onSelect:t,showTitles:n}){const o="block-editor-block-pattern-setup-list",{blocks:r,description:l,viewportWidth:i=700}=e,a=(0,p.useInstanceId)(eB,`${o}__item-description`);return(0,s.createElement)("div",{className:`${o}__list-item`},(0,s.createElement)(Xx,{render:(0,s.createElement)("div",{"aria-describedby":l?a:void 0,"aria-label":e.title,className:`${o}__item`}),id:`${o}__pattern__${e.name}`,role:"option",onClick:()=>t(r)},(0,s.createElement)(Ty,{blocks:r,viewportWidth:i}),n&&(0,s.createElement)("div",{className:`${o}__item-title`},e.title),!!l&&(0,s.createElement)(_l.VisuallyHidden,{id:a},l)))}function tB({active:e,className:t,pattern:n,minHeight:o}){const{blocks:r,title:l,description:i}=n,a=(0,p.useInstanceId)(tB,"block-editor-block-pattern-setup-list__item-description");return(0,s.createElement)("div",{"aria-hidden":!e,role:"img",className:`pattern-slide ${t}`,"aria-label":l,"aria-describedby":i?a:void 0},(0,s.createElement)(Ty,{blocks:r,minHeight:o}),!!i&&(0,s.createElement)(_l.VisuallyHidden,{id:a},i))}const nB=({clientId:e,blockName:t,filterPatternsFn:n,onBlockPatternSelect:o,initialViewMode:r=$x,showTitles:l=!1})=>{const[i,a]=(0,u.useState)(r),[p,m]=(0,u.useState)(0),{replaceBlock:h}=(0,d.useDispatch)(Nr),g=qx(e,t,n);if(!g?.length)return null;const f=o||(t=>{const n=t.map((e=>(0,c.cloneBlock)(e)));h(e,n)});return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:`block-editor-block-pattern-setup view-mode-${i}`},(0,s.createElement)(Jx,{viewMode:i,activeSlide:p,patterns:g,onBlockPatternSelect:f,showTitles:l}),(0,s.createElement)(Zx,{viewMode:i,setViewMode:a,activeSlide:p,totalSlides:g.length,handleNext:()=>{m((e=>Math.min(e+1,g.length-1)))},handlePrevious:()=>{m((e=>Math.max(e-1,0)))},onBlockPatternSelect:()=>{f(g[p].blocks)}})))};function oB({className:e,onSelectVariation:t,selectedValue:n,variations:o}){return(0,s.createElement)("fieldset",{className:e},(0,s.createElement)(_l.VisuallyHidden,{as:"legend"},(0,x.__)("Transform to variation")),o.map((e=>(0,s.createElement)(_l.Button,{key:e.name,icon:(0,s.createElement)(qh,{icon:e.icon,showColors:!0}),isPressed:n===e.name,label:n===e.name?e.title:(0,x.sprintf)((0,x.__)("Transform to %s"),e.title),onClick:()=>t(e.name),"aria-label":e.title,showTooltip:!0}))))}function rB({className:e,onSelectVariation:t,selectedValue:n,variations:o}){const r=o.map((({name:e,title:t,description:n})=>({value:e,label:t,info:n})));return(0,s.createElement)(_l.DropdownMenu,{className:e,label:(0,x.__)("Transform to variation"),text:(0,x.__)("Transform to variation"),popoverProps:{position:"bottom center",className:`${e}__popover`},icon:cS,toggleProps:{iconPosition:"right"}},(()=>(0,s.createElement)("div",{className:`${e}__container`},(0,s.createElement)(_l.MenuGroup,null,(0,s.createElement)(_l.MenuItemsChoice,{choices:r,value:n,onSelect:t})))))}function lB({className:e,onSelectVariation:t,selectedValue:n,variations:o}){return(0,s.createElement)("div",{className:e},(0,s.createElement)(_l.__experimentalToggleGroupControl,{label:(0,x.__)("Transform to variation"),value:n,hideLabelFromVision:!0,onChange:t,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0},o.map((e=>(0,s.createElement)(_l.__experimentalToggleGroupControlOptionIcon,{key:e.name,icon:e.icon,value:e.name,label:n===e.name?e.title:(0,x.sprintf)((0,x.__)("Transform to %s"),e.title)})))))}const iB=function({blockClientId:e}){const{updateBlockAttributes:t}=(0,d.useDispatch)(Nr),{activeBlockVariation:n,variations:o}=(0,d.useSelect)((t=>{const{getActiveBlockVariation:n,getBlockVariations:o}=t(c.store),{getBlockName:r,getBlockAttributes:l}=t(Nr),i=e&&r(e);return{activeBlockVariation:n(i,l(e)),variations:i&&o(i,"transform")}}),[e]),r=n?.name,l=(0,u.useMemo)((()=>{const e=new Set;return!!o&&(o.forEach((t=>{t.icon&&e.add(t.icon?.src||t.icon)})),e.size===o.length)}),[o]);if(!o?.length)return null;const i=o.length>5,a=l?i?oB:lB:rB;return(0,s.createElement)(a,{className:"block-editor-block-variation-transforms",onSelectVariation:n=>{t(e,{...o.find((({name:e})=>e===n)).attributes})},selectedValue:r,variations:o})},sB=(0,p.createHigherOrderComponent)((e=>t=>{const[n,o]=Ar("color.palette","color.custom"),{colors:r=n,disableCustomColors:l=!o}=t,i=r&&r.length>0||!l;return(0,s.createElement)(e,{...t,colors:r,disableCustomColors:l,hasColorsToChoose:i})}),"withColorContext"),aB=sB(_l.ColorPalette);function cB({onChange:e,value:t,...n}){return(0,s.createElement)(Xu,{...n,onColorChange:e,colorValue:t,gradients:[],disableCustomGradients:!0})}const uB=window.wp.date,dB=new Date(2022,0,25);function pB({format:e,defaultFormat:t,onChange:n}){return(0,s.createElement)("fieldset",{className:"block-editor-date-format-picker"},(0,s.createElement)(_l.VisuallyHidden,{as:"legend"},(0,x.__)("Date format")),(0,s.createElement)(_l.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Default format"),help:`${(0,x.__)("Example:")} ${(0,uB.dateI18n)(t,dB)}`,checked:!e,onChange:e=>n(e?null:t)}),e&&(0,s.createElement)(mB,{format:e,onChange:n}))}function mB({format:e,onChange:t}){var n;const o=[...new Set(["Y-m-d",(0,x._x)("n/j/Y","short date format"),(0,x._x)("n/j/Y g:i A","short date format with time"),(0,x._x)("M j, Y","medium date format"),(0,x._x)("M j, Y g:i A","medium date format with time"),(0,x._x)("F j, Y","long date format"),(0,x._x)("M j","short date format without the year")])],r=o.map(((e,t)=>({key:`suggested-${t}`,name:(0,uB.dateI18n)(e,dB),format:e}))),l={key:"custom",name:(0,x.__)("Custom"),className:"block-editor-date-format-picker__custom-format-select-control__custom-option",__experimentalHint:(0,x.__)("Enter your own date format")},[i,a]=(0,u.useState)((()=>!!e&&!o.includes(e)));return(0,s.createElement)(_l.__experimentalVStack,null,(0,s.createElement)(_l.CustomSelectControl,{__nextUnconstrainedWidth:!0,label:(0,x.__)("Choose a format"),options:[...r,l],value:i?l:null!==(n=r.find((t=>t.format===e)))&&void 0!==n?n:l,onChange:({selectedItem:e})=>{e===l?a(!0):(a(!1),t(e.format))}}),i&&(0,s.createElement)(_l.TextControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Custom format"),hideLabelFromVision:!0,help:(0,u.createInterpolateElement)((0,x.__)("Enter a date or time <Link>format string</Link>."),{Link:(0,s.createElement)(_l.ExternalLink,{href:(0,x.__)("https://wordpress.org/documentation/article/customize-date-and-time-format/")})}),value:e,onChange:e=>t(e)}))}const hB=({setting:e,children:t,panelId:n,...o})=>(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:()=>!!e.colorValue||!!e.gradientValue,label:e.label,onDeselect:()=>{e.colorValue?e.onColorChange():e.gradientValue&&e.onGradientChange()},isShownByDefault:void 0===e.isShownByDefault||e.isShownByDefault,...o,className:"block-editor-tools-panel-color-gradient-settings__item",panelId:n,resetAllFilter:e.resetAllFilter},t),gB=({colorValue:e,label:t})=>(0,s.createElement)(_l.__experimentalHStack,{justify:"flex-start"},(0,s.createElement)(_l.ColorIndicator,{className:"block-editor-panel-color-gradient-settings__color-indicator",colorValue:e}),(0,s.createElement)(_l.FlexItem,{className:"block-editor-panel-color-gradient-settings__color-name",title:t},t)),fB=e=>({onToggle:t,isOpen:n})=>{const{colorValue:o,label:r}=e,l={onClick:t,className:ml()("block-editor-panel-color-gradient-settings__dropdown",{"is-open":n}),"aria-expanded":n};return(0,s.createElement)(_l.Button,{...l},(0,s.createElement)(gB,{colorValue:o,label:r}))};function bB({colors:e,disableCustomColors:t,disableCustomGradients:n,enableAlpha:o,gradients:r,settings:l,__experimentalIsRenderedInSidebar:i,...a}){let c;return i&&(c={placement:"left-start",offset:36,shift:!0}),(0,s.createElement)(s.Fragment,null,l.map(((l,u)=>{var d;const p={clearable:!1,colorValue:l.colorValue,colors:e,disableCustomColors:t,disableCustomGradients:n,enableAlpha:o,gradientValue:l.gradientValue,gradients:r,label:l.label,onColorChange:l.onColorChange,onGradientChange:l.onGradientChange,showTitle:!1,__experimentalIsRenderedInSidebar:i,...l},m={colorValue:null!==(d=l.gradientValue)&&void 0!==d?d:l.colorValue,label:l.label};return l&&(0,s.createElement)(hB,{key:u,setting:l,...a},(0,s.createElement)(_l.Dropdown,{popoverProps:c,className:"block-editor-tools-panel-color-gradient-settings__dropdown",renderToggle:fB(m),renderContent:()=>(0,s.createElement)(_l.__experimentalDropdownContentWrapper,{paddingSize:"none"},(0,s.createElement)("div",{className:"block-editor-panel-color-gradient-settings__dropdown-content"},(0,s.createElement)(Xu,{...p})))}))})))}const vB=["colors","disableCustomColors","gradients","disableCustomGradients"],kB=({className:e,colors:t,gradients:n,disableCustomColors:o,disableCustomGradients:r,children:l,settings:i,title:a,showTitle:c=!0,__experimentalIsRenderedInSidebar:u,enableAlpha:m})=>{const h=(0,p.useInstanceId)(kB),{batch:g}=(0,d.useRegistry)();return t&&0!==t.length||n&&0!==n.length||!o||!r||!i?.every((e=>(!e.colors||0===e.colors.length)&&(!e.gradients||0===e.gradients.length)&&(void 0===e.disableCustomColors||e.disableCustomColors)&&(void 0===e.disableCustomGradients||e.disableCustomGradients)))?(0,s.createElement)(_l.__experimentalToolsPanel,{className:ml()("block-editor-panel-color-gradient-settings",e),label:c?a:void 0,resetAll:()=>{g((()=>{i.forEach((({colorValue:e,gradientValue:t,onColorChange:n,onGradientChange:o})=>{e?n():t&&o()}))}))},panelId:h,__experimentalFirstVisibleItemClass:"first",__experimentalLastVisibleItemClass:"last"},(0,s.createElement)(bB,{settings:i,panelId:h,colors:t,gradients:n,disableCustomColors:o,disableCustomGradients:r,__experimentalIsRenderedInSidebar:u,enableAlpha:m}),!!l&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.__experimentalSpacer,{marginY:4})," ",l)):null},_B=e=>{const t=qc();return(0,s.createElement)(kB,{...t,...e})},yB=e=>vB.every((t=>e.hasOwnProperty(t)))?(0,s.createElement)(kB,{...e}):(0,s.createElement)(_B,{...e});const EB=(0,u.createContext)({}),wB=()=>(0,u.useContext)(EB);function SB({id:e,url:t,naturalWidth:n,naturalHeight:o,onFinishEditing:r,onSaveImage:l,children:i}){const a=function({url:e,naturalWidth:t,naturalHeight:n}){const[o,r]=(0,u.useState)(),[l,i]=(0,u.useState)(),[s,a]=(0,u.useState)({x:0,y:0}),[c,d]=(0,u.useState)(100),[p,h]=(0,u.useState)(0),g=t/n,[f,b]=(0,u.useState)(g),v=(0,u.useCallback)((()=>{const t=(p+90)%360;let n=g;if(p%180==90&&(n=1/g),0===t)return r(),h(t),b(g),void a((e=>({x:-e.y*n,y:e.x*n})));const o=new window.Image;o.src=e,o.onload=function(e){const o=document.createElement("canvas");let l=0,i=0;t%180?(o.width=e.target.height,o.height=e.target.width):(o.width=e.target.width,o.height=e.target.height),90!==t&&180!==t||(l=o.width),270!==t&&180!==t||(i=o.height);const s=o.getContext("2d");s.translate(l,i),s.rotate(t*Math.PI/180),s.drawImage(e.target,0,0),o.toBlob((e=>{r(URL.createObjectURL(e)),h(t),b(o.width/o.height),a((e=>({x:-e.y*n,y:e.x*n})))}))};const l=(0,m.applyFilters)("media.crossOrigin",void 0,e);"string"==typeof l&&(o.crossOrigin=l)}),[p,g,e]);return(0,u.useMemo)((()=>({editedUrl:o,setEditedUrl:r,crop:l,setCrop:i,position:s,setPosition:a,zoom:c,setZoom:d,rotation:p,setRotation:h,rotateClockwise:v,aspect:f,setAspect:b,defaultAspect:g})),[o,l,s,c,p,v,f,g])}({url:t,naturalWidth:n,naturalHeight:o}),c=function({crop:e,rotation:t,url:n,id:o,onSaveImage:r,onFinishEditing:l}){const{createErrorNotice:i}=(0,d.useDispatch)(Os.store),[s,a]=(0,u.useState)(!1),c=(0,u.useCallback)((()=>{a(!1),l()}),[l]),p=(0,u.useCallback)((()=>{a(!0);const s=[];t>0&&s.push({type:"rotate",args:{angle:t}}),(e.width<99.9||e.height<99.9)&&s.push({type:"crop",args:{left:e.x,top:e.y,width:e.width,height:e.height}}),ef()({path:`/wp/v2/media/${o}/edit`,method:"POST",data:{src:n,modifiers:s}}).then((e=>{r({id:e.id,url:e.source_url})})).catch((e=>{i((0,x.sprintf)((0,x.__)("Could not edit image. %s"),(0,As.__unstableStripHTML)(e.message)),{id:"image-editing-error",type:"snackbar"})})).finally((()=>{a(!1),l()}))}),[e,t,o,n,r,i,l]);return(0,u.useMemo)((()=>({isInProgress:s,apply:p,cancel:c})),[s,p,c])}({id:e,url:t,onSaveImage:l,onFinishEditing:r,...a}),p=(0,u.useMemo)((()=>({...a,...c})),[a,c]);return(0,s.createElement)(EB.Provider,{value:p},i)}
/*! *****************************************************************************
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.
***************************************************************************** */
var CB=function(e,t){return CB=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},CB(e,t)};var xB=function(){return xB=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},xB.apply(this,arguments)};Object.create;Object.create;var BB=n(7520),IB=n.n(BB);function TB(e,t,n,o,r){void 0===r&&(r=0);var l=OB(t.width,t.height,r),i=l.width,s=l.height;return{x:MB(e.x,i,n.width,o),y:MB(e.y,s,n.height,o)}}function MB(e,t,n,o){var r=t*o/2-n/2;return DB(e,-r,r)}function PB(e,t){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function RB(e,t){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI}function NB(e,t){return Math.min(e,Math.max(0,t))}function LB(e,t){return t}function AB(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function OB(e,t,n){var o=n*Math.PI/180;return{width:Math.abs(Math.cos(o)*e)+Math.abs(Math.sin(o)*t),height:Math.abs(Math.sin(o)*e)+Math.abs(Math.cos(o)*t)}}function DB(e,t,n){return Math.min(Math.max(e,t),n)}function zB(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter((function(e){return"string"==typeof e&&e.length>0})).join(" ").trim()}var VB=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.imageRef=a().createRef(),n.videoRef=a().createRef(),n.containerRef=null,n.styleRef=null,n.containerRect=null,n.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},n.dragStartPosition={x:0,y:0},n.dragStartCrop={x:0,y:0},n.gestureZoomStart=0,n.gestureRotationStart=0,n.isTouching=!1,n.lastPinchDistance=0,n.lastPinchRotation=0,n.rafDragTimeout=null,n.rafPinchTimeout=null,n.wheelTimer=null,n.currentDoc="undefined"!=typeof document?document:null,n.currentWindow="undefined"!=typeof window?window:null,n.resizeObserver=null,n.state={cropSize:null,hasWheelJustStarted:!1},n.initResizeObserver=function(){if(void 0!==window.ResizeObserver&&n.containerRef){var e=!0;n.resizeObserver=new window.ResizeObserver((function(t){e?e=!1:n.computeSizes()})),n.resizeObserver.observe(n.containerRef)}},n.preventZoomSafari=function(e){return e.preventDefault()},n.cleanEvents=function(){n.currentDoc&&(n.currentDoc.removeEventListener("mousemove",n.onMouseMove),n.currentDoc.removeEventListener("mouseup",n.onDragStopped),n.currentDoc.removeEventListener("touchmove",n.onTouchMove),n.currentDoc.removeEventListener("touchend",n.onDragStopped),n.currentDoc.removeEventListener("gesturemove",n.onGestureMove),n.currentDoc.removeEventListener("gestureend",n.onGestureEnd))},n.clearScrollEvent=function(){n.containerRef&&n.containerRef.removeEventListener("wheel",n.onWheel),n.wheelTimer&&clearTimeout(n.wheelTimer)},n.onMediaLoad=function(){var e=n.computeSizes();e&&(n.emitCropData(),n.setInitialCrop(e)),n.props.onMediaLoaded&&n.props.onMediaLoaded(n.mediaSize)},n.setInitialCrop=function(e){if(n.props.initialCroppedAreaPercentages){var t=function(e,t,n,o,r,l){var i=OB(t.width,t.height,n),s=DB(o.width/i.width*(100/e.width),r,l);return{crop:{x:s*i.width/2-o.width/2-i.width*s*(e.x/100),y:s*i.height/2-o.height/2-i.height*s*(e.y/100)},zoom:s}}(n.props.initialCroppedAreaPercentages,n.mediaSize,n.props.rotation,e,n.props.minZoom,n.props.maxZoom),o=t.crop,r=t.zoom;n.props.onCropChange(o),n.props.onZoomChange&&n.props.onZoomChange(r)}else if(n.props.initialCroppedAreaPixels){var l=function(e,t,n,o,r,l){void 0===n&&(n=0);var i=OB(t.naturalWidth,t.naturalHeight,n),s=DB(function(e,t,n){var o=function(e){return e.width>e.height?e.width/e.naturalWidth:e.height/e.naturalHeight}(t);return n.height>n.width?n.height/(e.height*o):n.width/(e.width*o)}(e,t,o),r,l),a=o.height>o.width?o.height/e.height:o.width/e.width;return{crop:{x:((i.width-e.width)/2-e.x)*a,y:((i.height-e.height)/2-e.y)*a},zoom:s}}(n.props.initialCroppedAreaPixels,n.mediaSize,n.props.rotation,e,n.props.minZoom,n.props.maxZoom);o=l.crop,r=l.zoom;n.props.onCropChange(o),n.props.onZoomChange&&n.props.onZoomChange(r)}},n.computeSizes=function(){var e,t,o,r,l,i,s=n.imageRef.current||n.videoRef.current;if(s&&n.containerRef){n.containerRect=n.containerRef.getBoundingClientRect();var a=n.containerRect.width/n.containerRect.height,c=(null===(e=n.imageRef.current)||void 0===e?void 0:e.naturalWidth)||(null===(t=n.videoRef.current)||void 0===t?void 0:t.videoWidth)||0,u=(null===(o=n.imageRef.current)||void 0===o?void 0:o.naturalHeight)||(null===(r=n.videoRef.current)||void 0===r?void 0:r.videoHeight)||0,d=c/u,p=void 0;if(s.offsetWidth<c||s.offsetHeight<u)switch(n.props.objectFit){default:case"contain":p=a>d?{width:n.containerRect.height*d,height:n.containerRect.height}:{width:n.containerRect.width,height:n.containerRect.width/d};break;case"horizontal-cover":p={width:n.containerRect.width,height:n.containerRect.width/d};break;case"vertical-cover":p={width:n.containerRect.height*d,height:n.containerRect.height};break;case"auto-cover":p=c>u?{width:n.containerRect.width,height:n.containerRect.width/d}:{width:n.containerRect.height*d,height:n.containerRect.height}}else p={width:s.offsetWidth,height:s.offsetHeight};n.mediaSize=xB(xB({},p),{naturalWidth:c,naturalHeight:u}),n.props.setMediaSize&&n.props.setMediaSize(n.mediaSize);var m=n.props.cropSize?n.props.cropSize:function(e,t,n,o,r,l){void 0===l&&(l=0);var i=OB(e,t,l),s=i.width,a=i.height,c=Math.min(s,n),u=Math.min(a,o);return c>u*r?{width:u*r,height:u}:{width:c,height:c/r}}(n.mediaSize.width,n.mediaSize.height,n.containerRect.width,n.containerRect.height,n.props.aspect,n.props.rotation);return(null===(l=n.state.cropSize)||void 0===l?void 0:l.height)===m.height&&(null===(i=n.state.cropSize)||void 0===i?void 0:i.width)===m.width||n.props.onCropSizeChange&&n.props.onCropSizeChange(m),n.setState({cropSize:m},n.recomputeCropPosition),n.props.setCropSize&&n.props.setCropSize(m),m}},n.onMouseDown=function(e){n.currentDoc&&(e.preventDefault(),n.currentDoc.addEventListener("mousemove",n.onMouseMove),n.currentDoc.addEventListener("mouseup",n.onDragStopped),n.onDragStart(t.getMousePoint(e)))},n.onMouseMove=function(e){return n.onDrag(t.getMousePoint(e))},n.onTouchStart=function(e){n.currentDoc&&(n.isTouching=!0,n.props.onTouchRequest&&!n.props.onTouchRequest(e)||(n.currentDoc.addEventListener("touchmove",n.onTouchMove,{passive:!1}),n.currentDoc.addEventListener("touchend",n.onDragStopped),2===e.touches.length?n.onPinchStart(e):1===e.touches.length&&n.onDragStart(t.getTouchPoint(e.touches[0]))))},n.onTouchMove=function(e){e.preventDefault(),2===e.touches.length?n.onPinchMove(e):1===e.touches.length&&n.onDrag(t.getTouchPoint(e.touches[0]))},n.onGestureStart=function(e){n.currentDoc&&(e.preventDefault(),n.currentDoc.addEventListener("gesturechange",n.onGestureMove),n.currentDoc.addEventListener("gestureend",n.onGestureEnd),n.gestureZoomStart=n.props.zoom,n.gestureRotationStart=n.props.rotation)},n.onGestureMove=function(e){if(e.preventDefault(),!n.isTouching){var o=t.getMousePoint(e),r=n.gestureZoomStart-1+e.scale;if(n.setNewZoom(r,o,{shouldUpdatePosition:!0}),n.props.onRotationChange){var l=n.gestureRotationStart+e.rotation;n.props.onRotationChange(l)}}},n.onGestureEnd=function(e){n.cleanEvents()},n.onDragStart=function(e){var t,o,r=e.x,l=e.y;n.dragStartPosition={x:r,y:l},n.dragStartCrop=xB({},n.props.crop),null===(o=(t=n.props).onInteractionStart)||void 0===o||o.call(t)},n.onDrag=function(e){var t=e.x,o=e.y;n.currentWindow&&(n.rafDragTimeout&&n.currentWindow.cancelAnimationFrame(n.rafDragTimeout),n.rafDragTimeout=n.currentWindow.requestAnimationFrame((function(){if(n.state.cropSize&&void 0!==t&&void 0!==o){var e=t-n.dragStartPosition.x,r=o-n.dragStartPosition.y,l={x:n.dragStartCrop.x+e,y:n.dragStartCrop.y+r},i=n.props.restrictPosition?TB(l,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):l;n.props.onCropChange(i)}})))},n.onDragStopped=function(){var e,t;n.isTouching=!1,n.cleanEvents(),n.emitCropData(),null===(t=(e=n.props).onInteractionEnd)||void 0===t||t.call(e)},n.onWheel=function(e){if(n.currentWindow&&(!n.props.onWheelRequest||n.props.onWheelRequest(e))){e.preventDefault();var o=t.getMousePoint(e),r=IB()(e).pixelY,l=n.props.zoom-r*n.props.zoomSpeed/200;n.setNewZoom(l,o,{shouldUpdatePosition:!0}),n.state.hasWheelJustStarted||n.setState({hasWheelJustStarted:!0},(function(){var e,t;return null===(t=(e=n.props).onInteractionStart)||void 0===t?void 0:t.call(e)})),n.wheelTimer&&clearTimeout(n.wheelTimer),n.wheelTimer=n.currentWindow.setTimeout((function(){return n.setState({hasWheelJustStarted:!1},(function(){var e,t;return null===(t=(e=n.props).onInteractionEnd)||void 0===t?void 0:t.call(e)}))}),250)}},n.getPointOnContainer=function(e){var t=e.x,o=e.y;if(!n.containerRect)throw new Error("The Cropper is not mounted");return{x:n.containerRect.width/2-(t-n.containerRect.left),y:n.containerRect.height/2-(o-n.containerRect.top)}},n.getPointOnMedia=function(e){var t=e.x,o=e.y,r=n.props,l=r.crop,i=r.zoom;return{x:(t+l.x)/i,y:(o+l.y)/i}},n.setNewZoom=function(e,t,o){var r=(void 0===o?{}:o).shouldUpdatePosition,l=void 0===r||r;if(n.state.cropSize&&n.props.onZoomChange){var i=DB(e,n.props.minZoom,n.props.maxZoom);if(l){var s=n.getPointOnContainer(t),a=n.getPointOnMedia(s),c={x:a.x*i-s.x,y:a.y*i-s.y},u=n.props.restrictPosition?TB(c,n.mediaSize,n.state.cropSize,i,n.props.rotation):c;n.props.onCropChange(u)}n.props.onZoomChange(i)}},n.getCropData=function(){return n.state.cropSize?function(e,t,n,o,r,l,i){void 0===l&&(l=0),void 0===i&&(i=!0);var s=i?NB:LB,a=OB(t.width,t.height,l),c=OB(t.naturalWidth,t.naturalHeight,l),u={x:s(100,((a.width-n.width/r)/2-e.x/r)/a.width*100),y:s(100,((a.height-n.height/r)/2-e.y/r)/a.height*100),width:s(100,n.width/a.width*100/r),height:s(100,n.height/a.height*100/r)},d=Math.round(s(c.width,u.width*c.width/100)),p=Math.round(s(c.height,u.height*c.height/100)),m=c.width>=c.height*o?{width:Math.round(p*o),height:p}:{width:d,height:Math.round(d/o)};return{croppedAreaPercentages:u,croppedAreaPixels:xB(xB({},m),{x:Math.round(s(c.width-m.width,u.x*c.width/100)),y:Math.round(s(c.height-m.height,u.y*c.height/100))})}}(n.props.restrictPosition?TB(n.props.crop,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):n.props.crop,n.mediaSize,n.state.cropSize,n.getAspect(),n.props.zoom,n.props.rotation,n.props.restrictPosition):null},n.emitCropData=function(){var e=n.getCropData();if(e){var t=e.croppedAreaPercentages,o=e.croppedAreaPixels;n.props.onCropComplete&&n.props.onCropComplete(t,o),n.props.onCropAreaChange&&n.props.onCropAreaChange(t,o)}},n.emitCropAreaChange=function(){var e=n.getCropData();if(e){var t=e.croppedAreaPercentages,o=e.croppedAreaPixels;n.props.onCropAreaChange&&n.props.onCropAreaChange(t,o)}},n.recomputeCropPosition=function(){if(n.state.cropSize){var e=n.props.restrictPosition?TB(n.props.crop,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):n.props.crop;n.props.onCropChange(e),n.emitCropData()}},n}return function(e,t){function n(){this.constructor=e}CB(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.componentDidMount=function(){this.currentDoc&&this.currentWindow&&(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),void 0===window.ResizeObserver&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=".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",this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef))},t.prototype.componentWillUnmount=function(){var e,t;this.currentDoc&&this.currentWindow&&(void 0===window.ResizeObserver&&this.currentWindow.removeEventListener("resize",this.computeSizes),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&(null===(t=this.styleRef.parentNode)||void 0===t||t.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},t.prototype.componentDidUpdate=function(e){var t,n,o,r,l,i,s,a,c;e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():(null===(t=e.cropSize)||void 0===t?void 0:t.height)!==(null===(n=this.props.cropSize)||void 0===n?void 0:n.height)||(null===(o=e.cropSize)||void 0===o?void 0:o.width)!==(null===(r=this.props.cropSize)||void 0===r?void 0:r.width)?this.computeSizes():(null===(l=e.crop)||void 0===l?void 0:l.x)===(null===(i=this.props.crop)||void 0===i?void 0:i.x)&&(null===(s=e.crop)||void 0===s?void 0:s.y)===(null===(a=this.props.crop)||void 0===a?void 0:a.y)||this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video&&(null===(c=this.videoRef.current)||void 0===c||c.load())},t.prototype.getAspect=function(){var e=this.props,t=e.cropSize,n=e.aspect;return t?t.width/t.height:n},t.prototype.onPinchStart=function(e){var n=t.getTouchPoint(e.touches[0]),o=t.getTouchPoint(e.touches[1]);this.lastPinchDistance=PB(n,o),this.lastPinchRotation=RB(n,o),this.onDragStart(AB(n,o))},t.prototype.onPinchMove=function(e){var n=this;if(this.currentDoc&&this.currentWindow){var o=t.getTouchPoint(e.touches[0]),r=t.getTouchPoint(e.touches[1]),l=AB(o,r);this.onDrag(l),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame((function(){var e=PB(o,r),t=n.props.zoom*(e/n.lastPinchDistance);n.setNewZoom(t,l,{shouldUpdatePosition:!1}),n.lastPinchDistance=e;var i=RB(o,r),s=n.props.rotation+(i-n.lastPinchRotation);n.props.onRotationChange&&n.props.onRotationChange(s),n.lastPinchRotation=i}))}},t.prototype.render=function(){var e=this,t=this.props,n=t.image,o=t.video,r=t.mediaProps,l=t.transform,i=t.crop,s=i.x,c=i.y,u=t.rotation,d=t.zoom,p=t.cropShape,m=t.showGrid,h=t.style,g=h.containerStyle,f=h.cropAreaStyle,b=h.mediaStyle,v=t.classes,k=v.containerClassName,_=v.cropAreaClassName,y=v.mediaClassName,E=t.objectFit;return a().createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(t){return e.containerRef=t},"data-testid":"container",style:g,className:zB("reactEasyCrop_Container",k)},n?a().createElement("img",xB({alt:"",className:zB("reactEasyCrop_Image","contain"===E&&"reactEasyCrop_Contain","horizontal-cover"===E&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===E&&"reactEasyCrop_Cover_Vertical","auto-cover"===E&&(this.mediaSize.naturalWidth>this.mediaSize.naturalHeight?"reactEasyCrop_Cover_Horizontal":"reactEasyCrop_Cover_Vertical"),y)},r,{src:n,ref:this.imageRef,style:xB(xB({},b),{transform:l||"translate(".concat(s,"px, ").concat(c,"px) rotate(").concat(u,"deg) scale(").concat(d,")")}),onLoad:this.onMediaLoad})):o&&a().createElement("video",xB({autoPlay:!0,loop:!0,muted:!0,className:zB("reactEasyCrop_Video","contain"===E&&"reactEasyCrop_Contain","horizontal-cover"===E&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===E&&"reactEasyCrop_Cover_Vertical","auto-cover"===E&&(this.mediaSize.naturalWidth>this.mediaSize.naturalHeight?"reactEasyCrop_Cover_Horizontal":"reactEasyCrop_Cover_Vertical"),y)},r,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:xB(xB({},b),{transform:l||"translate(".concat(s,"px, ").concat(c,"px) rotate(").concat(u,"deg) scale(").concat(d,")")}),controls:!1}),(Array.isArray(o)?o:[{src:o}]).map((function(e){return a().createElement("source",xB({key:e.src},e))}))),this.state.cropSize&&a().createElement("div",{style:xB(xB({},f),{width:this.state.cropSize.width,height:this.state.cropSize.height}),"data-testid":"cropper",className:zB("reactEasyCrop_CropArea","round"===p&&"reactEasyCrop_CropAreaRound",m&&"reactEasyCrop_CropAreaGrid",_)}))},t.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:3,minZoom:1,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0},t.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},t.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},t}(a().Component);const FB=100,HB=300,GB={placement:"bottom-start"};function UB({url:e,width:t,height:n,clientWidth:o,naturalHeight:r,naturalWidth:l,borderProps:i}){const{isInProgress:a,editedUrl:c,position:u,zoom:d,aspect:p,setPosition:m,setCrop:h,setZoom:g,rotation:f}=wB();let b=n||o*r/l;return f%180==90&&(b=o*l/r),(0,s.createElement)("div",{className:ml()("wp-block-image__crop-area",i?.className,{"is-applying":a}),style:{...i?.style,width:t||o,height:b}},(0,s.createElement)(VB,{image:c||e,disabled:a,minZoom:FB/100,maxZoom:HB/100,crop:u,zoom:d/100,aspect:p,onCropChange:e=>{m(e)},onCropComplete:e=>{h(e)},onZoomChange:e=>{g(100*e)}}),a&&(0,s.createElement)(_l.Spinner,null))}const $B=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"}));function jB(){const{isInProgress:e,zoom:t,setZoom:n}=wB();return(0,s.createElement)(_l.Dropdown,{contentClassName:"wp-block-image__zoom",popoverProps:GB,renderToggle:({isOpen:t,onToggle:n})=>(0,s.createElement)(_l.ToolbarButton,{icon:$B,label:(0,x.__)("Zoom"),onClick:n,"aria-expanded":t,disabled:e}),renderContent:()=>(0,s.createElement)(_l.RangeControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Zoom"),min:FB,max:HB,value:Math.round(t),onChange:n})})}const WB=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"}));function KB({aspectRatios:e,isDisabled:t,label:n,onClick:o,value:r}){return(0,s.createElement)(_l.MenuGroup,{label:n},e.map((({title:e,aspect:n})=>(0,s.createElement)(_l.MenuItem,{key:n,disabled:t,onClick:()=>{o(n)},role:"menuitemradio",isSelected:n===r,icon:n===r?uu:void 0},e))))}function ZB({toggleProps:e}){const{isInProgress:t,aspect:n,setAspect:o,defaultAspect:r}=wB();return(0,s.createElement)(_l.DropdownMenu,{icon:WB,label:(0,x.__)("Aspect Ratio"),popoverProps:GB,toggleProps:e,className:"wp-block-image__aspect-ratio"},(({onClose:e})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(KB,{isDisabled:t,onClick:t=>{o(t),e()},value:n,aspectRatios:[{title:(0,x.__)("Original"),aspect:r},{title:(0,x.__)("Square"),aspect:1}]}),(0,s.createElement)(KB,{label:(0,x.__)("Landscape"),isDisabled:t,onClick:t=>{o(t),e()},value:n,aspectRatios:[{title:(0,x.__)("16:9"),aspect:16/9},{title:(0,x.__)("4:3"),aspect:4/3},{title:(0,x.__)("3:2"),aspect:1.5}]}),(0,s.createElement)(KB,{label:(0,x.__)("Portrait"),isDisabled:t,onClick:t=>{o(t),e()},value:n,aspectRatios:[{title:(0,x.__)("9:16"),aspect:9/16},{title:(0,x.__)("3:4"),aspect:3/4},{title:(0,x.__)("2:3"),aspect:2/3}]}))))}const qB=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"}));function YB(){const{isInProgress:e,rotateClockwise:t}=wB();return(0,s.createElement)(_l.ToolbarButton,{icon:qB,label:(0,x.__)("Rotate"),onClick:t,disabled:e})}function XB(){const{isInProgress:e,apply:t,cancel:n}=wB();return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.ToolbarButton,{onClick:t,disabled:e},(0,x.__)("Apply")),(0,s.createElement)(_l.ToolbarButton,{onClick:n},(0,x.__)("Cancel")))}function QB({id:e,url:t,width:n,height:o,clientWidth:r,naturalHeight:l,naturalWidth:i,onSaveImage:a,onFinishEditing:c,borderProps:u}){return(0,s.createElement)(SB,{id:e,url:t,naturalWidth:i,naturalHeight:l,onSaveImage:a,onFinishEditing:c},(0,s.createElement)(UB,{borderProps:u,url:t,width:n,height:o,clientWidth:r,naturalHeight:l,naturalWidth:i}),(0,s.createElement)(Bl,null,(0,s.createElement)(_l.ToolbarGroup,null,(0,s.createElement)(jB,null),(0,s.createElement)(_l.ToolbarItem,null,(e=>(0,s.createElement)(ZB,{toggleProps:e}))),(0,s.createElement)(YB,null)),(0,s.createElement)(_l.ToolbarGroup,null,(0,s.createElement)(XB,null))))}const JB=[25,50,75,100],eI=()=>{};function tI({imageSizeHelp:e,imageWidth:t,imageHeight:n,imageSizeOptions:o=[],isResizable:r=!0,slug:l,width:i,height:a,onChange:c,onChangeImage:d=eI}){const{currentHeight:p,currentWidth:m,updateDimension:h,updateDimensions:g}=function(e,t,n,o,r){var l,i;const[s,a]=(0,u.useState)(null!==(l=null!=t?t:o)&&void 0!==l?l:""),[c,d]=(0,u.useState)(null!==(i=null!=e?e:n)&&void 0!==i?i:"");return(0,u.useEffect)((()=>{void 0===t&&void 0!==o&&a(o),void 0===e&&void 0!==n&&d(n)}),[o,n]),(0,u.useEffect)((()=>{void 0!==t&&Number.parseInt(t)!==Number.parseInt(s)&&a(t),void 0!==e&&Number.parseInt(e)!==Number.parseInt(c)&&d(e)}),[t,e]),{currentHeight:c,currentWidth:s,updateDimension:(e,t)=>{const n=""===t?void 0:parseInt(t,10);"width"===e?a(n):d(n),r({[e]:n})},updateDimensions:(e,t)=>{d(null!=e?e:n),a(null!=t?t:o),r({height:e,width:t})}}}(a,i,n,t,c);return(0,s.createElement)(s.Fragment,null,o&&o.length>0&&(0,s.createElement)(_l.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Resolution"),value:l,options:o,onChange:d,help:e,size:"__unstable-large"}),r&&(0,s.createElement)("div",{className:"block-editor-image-size-control"},(0,s.createElement)(_l.__experimentalHStack,{align:"baseline",spacing:"3"},(0,s.createElement)(_l.__experimentalNumberControl,{className:"block-editor-image-size-control__width",label:(0,x.__)("Width"),value:m,min:1,onChange:e=>h("width",e),size:"__unstable-large"}),(0,s.createElement)(_l.__experimentalNumberControl,{className:"block-editor-image-size-control__height",label:(0,x.__)("Height"),value:p,min:1,onChange:e=>h("height",e),size:"__unstable-large"})),(0,s.createElement)(_l.__experimentalHStack,null,(0,s.createElement)(_l.ButtonGroup,{"aria-label":(0,x.__)("Image size presets")},JB.map((e=>{const o=Math.round(t*(e/100)),r=Math.round(n*(e/100)),l=m===o&&p===r;return(0,s.createElement)(_l.Button,{key:e,size:"small",variant:l?"primary":void 0,isPressed:l,onClick:()=>g(r,o)},e,"%")}))),(0,s.createElement)(_l.Button,{size:"small",onClick:()=>g()},(0,x.__)("Reset")))))}function nI({url:e,urlLabel:t,className:n}){const o=ml()(n,"block-editor-url-popover__link-viewer-url");return e?(0,s.createElement)(_l.ExternalLink,{className:o,href:e},t||(0,Ds.filterURLForDisplay)((0,Ds.safeDecodeURI)(e))):(0,s.createElement)("span",{className:o})}const{__experimentalPopoverLegacyPositionToPlacement:oI}=ie(_l.privateApis),rI=(0,u.forwardRef)((({additionalControls:e,children:t,renderSettings:n,placement:o,focusOnMount:r="firstElement",position:l,...i},a)=>{let c;void 0!==l&&w()("`position` prop in wp.blockEditor.URLPopover",{since:"6.2",alternative:"`placement` prop"}),void 0!==o?c=o:void 0!==l&&(c=oI(l)),c=c||"bottom";const[d,p]=(0,u.useState)(!1),m=!!n&&d;return(0,s.createElement)(_l.Popover,{ref:a,className:"block-editor-url-popover",focusOnMount:r,placement:c,shift:!0,variant:"toolbar",...i},(0,s.createElement)("div",{className:"block-editor-url-popover__input-container"},(0,s.createElement)("div",{className:"block-editor-url-popover__row"},t,!!n&&(0,s.createElement)(_l.Button,{className:"block-editor-url-popover__settings-toggle",icon:cS,label:(0,x.__)("Link settings"),onClick:()=>{p(!d)},"aria-expanded":d,size:"compact"}))),m&&(0,s.createElement)("div",{className:"block-editor-url-popover__settings"},n()),e&&!m&&(0,s.createElement)("div",{className:"block-editor-url-popover__additional-controls"},e))}));rI.LinkEditor=function({autocompleteRef:e,className:t,onChangeInputValue:n,value:o,...r}){return(0,s.createElement)("form",{className:ml()("block-editor-url-popover__link-editor",t),...r},(0,s.createElement)(ta,{__nextHasNoMarginBottom:!0,value:o,onChange:n,autocompleteRef:e}),(0,s.createElement)(_l.Button,{icon:Ks,label:(0,x.__)("Apply"),type:"submit",size:"compact"}))},rI.LinkViewer=function({className:e,linkClassName:t,onEditLinkClick:n,url:o,urlLabel:r,...l}){return(0,s.createElement)("div",{className:ml()("block-editor-url-popover__link-viewer",e),...l},(0,s.createElement)(nI,{url:o,urlLabel:r,className:t}),n&&(0,s.createElement)(_l.Button,{icon:La,label:(0,x.__)("Edit"),onClick:n,size:"compact"}))};const lI=rI,iI=()=>{},sI=({src:e,onChange:t,onSubmit:n,onClose:o,popoverAnchor:r})=>(0,s.createElement)(lI,{anchor:r,onClose:o},(0,s.createElement)("form",{className:"block-editor-media-placeholder__url-input-form",onSubmit:n},(0,s.createElement)("input",{className:"block-editor-media-placeholder__url-input-field",type:"text","aria-label":(0,x.__)("URL"),placeholder:(0,x.__)("Paste or type URL"),onChange:t,value:e}),(0,s.createElement)(_l.Button,{className:"block-editor-media-placeholder__url-input-submit-button",icon:Ks,label:(0,x.__)("Apply"),type:"submit"}))),aI=({isURLInputVisible:e,src:t,onChangeSrc:n,onSubmitSrc:o,openURLInput:r,closeURLInput:l})=>{const[i,a]=(0,u.useState)(null);return(0,s.createElement)("div",{className:"block-editor-media-placeholder__url-input-container",ref:a},(0,s.createElement)(_l.Button,{className:"block-editor-media-placeholder__button",onClick:r,isPressed:e,variant:"tertiary"},(0,x.__)("Insert from URL")),e&&(0,s.createElement)(sI,{src:t,onChange:n,onSubmit:o,onClose:l,popoverAnchor:i}))};const cI=(0,_l.withFilters)("editor.MediaPlaceholder")((function({value:e={},allowedTypes:t,className:n,icon:o,labels:r={},mediaPreview:l,notices:i,isAppender:a,accept:p,addToGallery:m,multiple:h=!1,handleUpload:g=!0,disableDropZone:f,disableMediaButtons:b,onError:v,onSelect:k,onCancel:_,onSelectURL:y,onToggleFeaturedImage:E,onDoubleClick:S,onFilesPreUpload:C=iI,onHTMLDrop:B,children:I,mediaLibraryButton:T,placeholder:M,style:P}){B&&w()("wp.blockEditor.MediaPlaceholder onHTMLDrop prop",{since:"6.2",version:"6.4"});const R=(0,d.useSelect)((e=>{const{getSettings:t}=e(Nr);return t().mediaUpload}),[]),[N,L]=(0,u.useState)(""),[A,O]=(0,u.useState)(!1);(0,u.useEffect)((()=>{var t;L(null!==(t=e?.src)&&void 0!==t?t:"")}),[e?.src]);const D=e=>{L(e.target.value)},z=()=>{O(!0)},V=()=>{O(!1)},F=e=>{e.preventDefault(),N&&y&&(y(N),V())},H=n=>{if(!g)return k(n);let o;if(C(n),h)if(m){let t=[];o=n=>{const o=(null!=e?e:[]).filter((e=>e.id?!t.some((({id:t})=>Number(t)===Number(e.id))):!t.some((({urlSlug:t})=>e.url.includes(t)))));k(o.concat(n)),t=n.map((e=>{const t=e.url.lastIndexOf("."),n=e.url.slice(0,t);return{id:e.id,urlSlug:n}}))}}else o=k;else o=([e])=>k(e);R({allowedTypes:t,filesList:n,onFileChange:o,onError:v})};async function G(e){const n=(0,c.pasteHandler)({HTML:e});return await async function(e){if(!e||!Array.isArray(e))return;const n=function e(t){return t.flatMap((t=>"core/image"!==t.name&&"core/audio"!==t.name&&"core/video"!==t.name||!t.attributes.url?e(t.innerBlocks):[t]))}(e);if(!n.length)return;const o=await Promise.all(n.map((e=>e.attributes.id?e.attributes:new Promise(((n,o)=>{window.fetch(e.attributes.url).then((e=>e.blob())).then((r=>R({filesList:[r],additionalData:{title:e.attributes.title,alt_text:e.attributes.alt,caption:e.attributes.caption},onFileChange:([e])=>{e.id&&n(e)},allowedTypes:t,onError:o}))).catch((()=>n(e.attributes.url)))}))))).catch((e=>v(e)));k(h?o:o[0])}(n)}const U=e=>{H(e.target.files)},$=null!=M?M:e=>{let{instructions:c,title:u}=r;if(R||y||(c=(0,x.__)("To edit this block, you need permission to upload media.")),void 0===c||void 0===u){const e=null!=t?t:[],[n]=e,o=1===e.length,r=o&&"audio"===n,l=o&&"image"===n,i=o&&"video"===n;void 0===c&&R&&(c=(0,x.__)("Upload a media file or pick one from your media library."),r?c=(0,x.__)("Upload an audio file, pick one from your media library, or add one with a URL."):l?c=(0,x.__)("Upload an image file, pick one from your media library, or add one with a URL."):i&&(c=(0,x.__)("Upload a video file, pick one from your media library, or add one with a URL."))),void 0===u&&(u=(0,x.__)("Media"),r?u=(0,x.__)("Audio"):l?u=(0,x.__)("Image"):i&&(u=(0,x.__)("Video")))}const d=ml()("block-editor-media-placeholder",n,{"is-appender":a});return(0,s.createElement)(_l.Placeholder,{icon:o,label:u,instructions:c,className:d,notices:i,onDoubleClick:S,preview:l,style:P},e,I)},j=()=>f?null:(0,s.createElement)(_l.DropZone,{onFilesDrop:H,onHTMLDrop:G}),W=()=>_&&(0,s.createElement)(_l.Button,{className:"block-editor-media-placeholder__cancel-button",title:(0,x.__)("Cancel"),variant:"link",onClick:_},(0,x.__)("Cancel")),K=()=>y&&(0,s.createElement)(aI,{isURLInputVisible:A,src:N,onChangeSrc:D,onSubmitSrc:F,openURLInput:z,closeURLInput:V}),Z=()=>E&&(0,s.createElement)("div",{className:"block-editor-media-placeholder__url-input-container"},(0,s.createElement)(_l.Button,{className:"block-editor-media-placeholder__button",onClick:E,variant:"tertiary"},(0,x.__)("Use featured image")));return b?(0,s.createElement)(Us,null,j()):(0,s.createElement)(Us,{fallback:$(K())},(()=>{const n=null!=T?T:({open:e})=>(0,s.createElement)(_l.Button,{variant:"tertiary",onClick:()=>{e()}},(0,x.__)("Media Library")),o=(0,s.createElement)(Gs,{addToGallery:m,gallery:h&&!(!t||0===t.length)&&t.every((e=>"image"===e||e.startsWith("image/"))),multiple:h,onSelect:k,allowedTypes:t,mode:"browse",value:Array.isArray(e)?e.map((({id:e})=>e)):e.id,render:n});if(R&&a)return(0,s.createElement)(s.Fragment,null,j(),(0,s.createElement)(_l.FormFileUpload,{onChange:U,accept:p,multiple:!!h,render:({openFileDialog:e})=>{const t=(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.Button,{variant:"primary",className:ml()("block-editor-media-placeholder__button","block-editor-media-placeholder__upload-button"),onClick:e},(0,x.__)("Upload")),o,K(),Z(),W());return $(t)}}));if(R){const e=(0,s.createElement)(s.Fragment,null,j(),(0,s.createElement)(_l.FormFileUpload,{variant:"primary",className:ml()("block-editor-media-placeholder__button","block-editor-media-placeholder__upload-button"),onChange:U,accept:p,multiple:!!h},(0,x.__)("Upload")),o,K(),Z(),W());return $(e)}return $(o)})())})),uI=({colorSettings:e,...t})=>{const n=e.map((e=>{if(!e)return e;const{value:t,onChange:n,...o}=e;return{...o,colorValue:t,onColorChange:n}}));return(0,s.createElement)(yB,{settings:n,gradients:[],disableCustomGradients:!0,...t})},dI={placement:"bottom-start"},pI=()=>(0,s.createElement)(s.Fragment,null,["bold","italic","link","unknown"].map((e=>(0,s.createElement)(_l.Slot,{name:`RichText.ToolbarControls.${e}`,key:e}))),(0,s.createElement)(_l.Slot,{name:"RichText.ToolbarControls"},(e=>{if(!e.length)return null;const t=e.map((([{props:e}])=>e)).some((({isActive:e})=>e));return(0,s.createElement)(_l.ToolbarItem,null,(n=>(0,s.createElement)(_l.DropdownMenu,{icon:cS,label:(0,x.__)("More"),toggleProps:{...n,className:ml()(n.className,{"is-pressed":t}),describedBy:(0,x.__)("Displays more block tools")},controls:ne(e.map((([{props:e}])=>e)),"title"),popoverProps:dI})))})));function mI({editableContentElement:e,activeFormats:t}){const n=t[t.length-1],o=n?.type,r=(0,d.useSelect)((e=>e(Y.store).getFormatType(o)),[o]),l=(0,Y.useAnchor)({editableContentElement:e,settings:r});return(0,s.createElement)(hI,{popoverAnchor:l})}function hI({popoverAnchor:e}){return(0,s.createElement)(_l.Popover,{placement:"top",focusOnMount:!1,anchor:e,className:"block-editor-rich-text__inline-format-toolbar",__unstableSlotName:"block-toolbar"},(0,s.createElement)(NC,{className:"block-editor-rich-text__inline-format-toolbar-group","aria-label":(0,x.__)("Format tools")},(0,s.createElement)(_l.ToolbarGroup,null,(0,s.createElement)(pI,null))))}const gI=({inline:e,editableContentElement:t,value:n})=>{const o=(0,d.useSelect)((e=>e(Nr).getSettings().hasInlineToolbar),[]);if(e)return(0,s.createElement)(hI,{popoverAnchor:t});if(o){const e=(0,Y.getActiveFormats)(n);return(0,Y.isCollapsed)(n)&&!e.length?null:(0,s.createElement)(mI,{editableContentElement:t,activeFormats:e})}return(0,s.createElement)(Bl,{group:"inline"},(0,s.createElement)(pI,null))};function fI(){const{didAutomaticChange:e,getSettings:t}=(0,d.useSelect)(Nr);return(0,p.useRefEffect)((n=>{function o(n){const{keyCode:o}=n;if(n.defaultPrevented)return;if(o!==zs.DELETE&&o!==zs.BACKSPACE&&o!==zs.ESCAPE)return;const{__experimentalUndo:r}=t();r&&e()&&(n.preventDefault(),r())}return n.addEventListener("keydown",o),()=>{n.removeEventListener("keydown",o)}}),[])}function bI(e){if(!0===e||"p"===e||"li"===e)return!0===e?"p":e}function vI({allowedFormats:e,disableFormats:t}){return t?vI.EMPTY_ARRAY:e}function kI({value:e,pastedBlocks:t=[],onReplace:n,onSplit:o}){if(!n||!o)return;const{start:r=0,end:l=0}=e,i={...e,start:r,end:l},s=[],[a,c]=(0,Y.split)(i),u=t.length>0;let d=-1;const p=(0,Y.isEmpty)(a)&&!(0,Y.isEmpty)(c);u&&(0,Y.isEmpty)(a)||(s.push(o((0,Y.toHTMLString)({value:a}),!p)),d+=1),u&&(s.push(...t),d+=t.length),u&&(0,Y.isEmpty)(c)||s.push(o((0,Y.toHTMLString)({value:c}),p));n(s,u?d:1,u?-1:0)}function _I(e){const t=(0,u.useRef)(e);return t.current=e,(0,p.useRefEffect)((e=>{function n(e){const{isSelected:n,disableFormats:o,onChange:r,value:l,formatTypes:i,tagName:s,onReplace:a,onSplit:u,__unstableEmbedURLOnPaste:d,pastePlainText:p}=t.current;if(!n)return;const{plainText:m,html:h,files:g}=ty(e);if(e.preventDefault(),window.console.log("Received HTML:\n\n",h),window.console.log("Received plain text:\n\n",m),o)return void r((0,Y.insert)(l,m));function f(e){const t=i.reduce(((e,{__unstablePasteRule:t})=>(t&&e===l&&(e=t(l,{html:h,plainText:m})),e)),l);if(t!==l)r(t);else{const t=(0,Y.create)({html:e});!function(e,t){if(t?.length){let n=e.formats.length;for(;n--;)e.formats[n]=[...t,...e.formats[n]||[]]}}(t,l.activeFormats),r((0,Y.insert)(l,t))}}if("true"===e.clipboardData.getData("rich-text"))return void f(h);if(p)return void r((0,Y.insert)(l,(0,Y.create)({text:m})));if(g?.length){window.console.log("Received items:\n\n",g);const e=(0,c.getBlockTransforms)("from"),t=g.reduce(((t,n)=>{const o=(0,c.findTransform)(e,(e=>"files"===e.type&&e.isMatch([n])));return o&&t.push(o.transform([n])),t}),[]).flat();if(!t.length)return;return void(a&&(0,Y.isEmpty)(l)?a(t):kI({value:l,pastedBlocks:t,onReplace:a,onSplit:u}))}let b=a&&u?"AUTO":"INLINE";const v=m.trim();d&&(0,Y.isEmpty)(l)&&(0,Ds.isURL)(v)&&/^https?:/.test(v)&&(b="BLOCKS");const k=(0,c.pasteHandler)({HTML:h,plainText:m,mode:b,tagName:s});"string"==typeof k?f(k):k.length>0&&(a&&(0,Y.isEmpty)(l)?a(k,k.length-1,-1):kI({value:l,pastedBlocks:k,onReplace:a,onSplit:u}))}return e.addEventListener("paste",n),()=>{e.removeEventListener("paste",n)}}),[])}vI.EMPTY_ARRAY=[];const yI=["`",'"',"'","“”","‘’"];function EI(e){const{__unstableMarkLastChangeAsPersistent:t,__unstableMarkAutomaticChange:n}=(0,d.useDispatch)(Nr),o=(0,u.useRef)(e);return o.current=e,(0,p.useRefEffect)((e=>{function r(r){const{inputType:l,data:i}=r,{value:s,onChange:a}=o.current;if("insertText"!==l)return;if((0,Y.isCollapsed)(s))return;const c=(0,m.applyFilters)("blockEditor.wrapSelectionSettings",yI).find((([e,t])=>e===i||t===i));if(!c)return;const[u,d=u]=c,p=s.start,h=s.end+u.length;let g=(0,Y.insert)(s,u,p,p);g=(0,Y.insert)(g,d,h,h),t(),a(g),n();const f={};for(const e in r)f[e]=r[e];f.data=d;const{ownerDocument:b}=e,{defaultView:v}=b,k=new v.InputEvent("input",f);window.queueMicrotask((()=>{r.target.dispatchEvent(k)})),r.preventDefault()}return e.addEventListener("beforeinput",r),()=>{e.removeEventListener("beforeinput",r)}}),[])}function wI(e){let t=e.length;for(;t--;){const n=_o(e[t].attributes);if(n)return e[t].attributes[n]=e[t].attributes[n].toString().replace(ko,""),[e[t].clientId,n,0,0];const o=wI(e[t].innerBlocks);if(o)return o}return[]}function SI(e){const{__unstableMarkLastChangeAsPersistent:t,__unstableMarkAutomaticChange:n}=(0,d.useDispatch)(Nr),o=(0,u.useRef)(e);return o.current=e,(0,p.useRefEffect)((e=>{function r(){const{getValue:e,onReplace:t,selectionChange:r}=o.current;if(!t)return;const l=e(),{start:i,text:s}=l;if(" "!==s.slice(i-1,i))return;const a=s.slice(0,i).trim(),u=(0,c.getBlockTransforms)("from").filter((({type:e})=>"prefix"===e)),d=(0,c.findTransform)(u,(({prefix:e})=>a===e));if(!d)return;const p=(0,Y.toHTMLString)({value:(0,Y.insert)(l,ko,0,i)}),m=d.transform(p);return r(...wI([m])),t([m]),n(),!0}function l(e){const{inputType:l,type:i}=e,{getValue:s,onChange:a,__unstableAllowPrefixTransformations:c,formatTypes:u}=o.current;if("insertText"!==l&&"compositionend"!==i)return;if(c&&r())return;const d=s(),p=u.reduce(((e,{__unstableInputRule:t})=>(t&&(e=t(e)),e)),function(e){const t="tales of gutenberg",{start:n,text:o}=e;return n<18||o.slice(n-18,n).toLowerCase()!==t?e:(0,Y.insert)(e," 🐡🐢🦀🐤🦋🐘🐧🐹🦁🦄🦍🐼🐿🎃🐴🐝🐆🦕🦔🌱🍇π🍌🐉💧🥨🌌🍂🍠🥦🥚🥝🎟🥥🥒🛵🥖🍒🍯🎾🎲🐺🐚🐮⌛️")}(d));p!==d&&(t(),a({...p,activeFormats:d.activeFormats}),n())}return e.addEventListener("input",l),e.addEventListener("compositionend",l),()=>{e.removeEventListener("input",l),e.removeEventListener("compositionend",l)}}),[])}function CI(e){const t=(0,u.useRef)(e);return t.current=e,(0,p.useRefEffect)((e=>{function n(e){const{keyCode:n}=e;if(e.defaultPrevented)return;const{value:o,onMerge:r,onRemove:l}=t.current;if(n===zs.DELETE||n===zs.BACKSPACE){const{start:t,end:i,text:s}=o,a=n===zs.BACKSPACE,c=o.activeFormats&&!!o.activeFormats.length;if(!(0,Y.isCollapsed)(o)||c||a&&0!==t||!a&&i!==s.length)return;r?r(!a):l&&(0,Y.isEmpty)(o)&&a&&l(!a),e.preventDefault()}}return e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}}),[])}function xI(e){const t=(0,d.useRegistry)(),{__unstableMarkAutomaticChange:n}=(0,d.useDispatch)(Nr),o=(0,u.useRef)(e);return o.current=e,(0,p.useRefEffect)((e=>{function r(e){if("true"!==e.target.contentEditable)return;if(e.defaultPrevented)return;if(e.keyCode!==zs.ENTER)return;const{removeEditorOnlyFormats:r,value:l,onReplace:i,onSplit:s,onChange:a,disableLineBreaks:u,onSplitAtEnd:d,onSplitAtDoubleLineEnd:p}=o.current;e.preventDefault();const m={...l};m.formats=r(l);const h=i&&s;if(i){const e=(0,c.getBlockTransforms)("from").filter((({type:e})=>"enter"===e)),t=(0,c.findTransform)(e,(e=>e.regExp.test(m.text)));if(t)return i([t.transform({content:m.text})]),void n()}const{text:g,start:f,end:b}=m;e.shiftKey?u||a((0,Y.insert)(m,"\n")):h?kI({value:m,onReplace:i,onSplit:s}):d&&f===b&&b===g.length?d():p&&f===b&&b===g.length&&"\n\n"===g.slice(-2)?t.batch((()=>{m.start=m.end-2,a((0,Y.remove)(m)),p()})):u||a((0,Y.insert)(m,"\n"))}return e.addEventListener("keydown",r),()=>{e.removeEventListener("keydown",r)}}),[])}function BI(e){return e(Y.store).getFormatTypes()}const II=new Set(["a","audio","button","details","embed","iframe","input","label","select","textarea","video"]);function TI(e,t){return"object"!=typeof e?{[t]:e}:Object.fromEntries(Object.entries(e).map((([e,n])=>[`${t}.${e}`,n])))}function MI(e,t){return e[t]?e[t]:Object.keys(e).filter((e=>e.startsWith(t+"."))).reduce(((n,o)=>(n[o.slice(t.length+1)]=e[o],n)),{})}function PI(e){return(0,p.useRefEffect)((t=>{function n(t){for(const n of e.current)n(t)}return t.addEventListener("keydown",n),()=>{t.removeEventListener("keydown",n)}}),[])}function RI(e){return(0,p.useRefEffect)((t=>{function n(t){for(const n of e.current)n(t)}return t.addEventListener("input",n),()=>{t.removeEventListener("input",n)}}),[])}function NI(){const{__unstableMarkLastChangeAsPersistent:e}=(0,d.useDispatch)(Nr);return(0,p.useRefEffect)((t=>{function n(t){"insertReplacementText"===t.inputType&&e()}return t.addEventListener("beforeinput",n),()=>{t.removeEventListener("beforeinput",n)}}),[])}function LI(){const{isMultiSelecting:e}=(0,d.useSelect)(Nr);return(0,p.useRefEffect)((t=>{function n(){if(!e())return;const n=t.parentElement.closest('[contenteditable="true"]');n&&n.focus()}return t.addEventListener("focus",n),()=>{t.removeEventListener("focus",n)}}),[])}const AI={},OI=Symbol("usesContext");function DI({onChange:e,onFocus:t,value:n,forwardedRef:o,settings:r}){const{name:l,edit:i,[OI]:a}=r,c=(0,u.useContext)(bf),d=(0,u.useMemo)((()=>a?Object.fromEntries(Object.entries(c).filter((([e])=>a.includes(e)))):AI),[a,c]);if(!i)return null;const p=(0,Y.getActiveFormat)(n,l),m=void 0!==p,h=(0,Y.getActiveObject)(n),g=void 0!==h&&h.type===l;return(0,s.createElement)(i,{key:l,isActive:m,activeAttributes:m&&p.attributes||{},isObjectActive:g,activeObjectAttributes:g&&h.attributes||{},value:n,onChange:e,onFocus:t,contentRef:o,context:d})}function zI({formatTypes:e,...t}){return e.map((e=>(0,s.createElement)(DI,{settings:e,...t,key:e.name})))}function VI({value:e,tagName:t,multiline:n,format:o,...r}){if(KI.isEmpty(e)){const t=bI(n);e=t?(0,s.createElement)(t,null):null}else Array.isArray(e)?(w()("wp.blockEditor.RichText value prop as children type",{since:"6.1",version:"6.3",alternative:"value prop as string",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),e=(0,s.createElement)(u.RawHTML,null,c.children.toHTML(e))):e="string"==typeof e?(0,s.createElement)(u.RawHTML,null,e):(0,s.createElement)(u.RawHTML,null,e.toHTMLString());return t?(0,s.createElement)(t,{...r},e):e}const FI=(0,u.forwardRef)((function({children:e,identifier:t,tagName:n="div",value:o="",onChange:r,multiline:l,...i},a){w()("wp.blockEditor.RichText multiline prop",{since:"6.1",version:"6.3",alternative:"nested blocks (InnerBlocks)",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/nested-blocks-inner-blocks/"});const{clientId:c}=y(),{selectionChange:u}=(0,d.useDispatch)(Nr),p=bI(l),m=`</${p}>${o=o||`<${p}></${p}>`}<${p}>`.split(`</${p}><${p}>`);function h(e){r(`<${p}>${e.join(`</${p}><${p}>`)}</${p}>`)}return m.shift(),m.pop(),(0,s.createElement)(n,{ref:a},m.map(((e,n)=>(0,s.createElement)(UI,{key:n,identifier:`${t}-${n}`,tagName:p,value:e,onChange:e=>{const t=m.slice();t[n]=e,h(t)},isSelected:void 0,onSplit:e=>e,onReplace:e=>{const o=m.slice();o.splice(n,1,...e),h(o),u(c,`${t}-${n+1}`,0,0)},onMerge:e=>{const o=m.slice();let r=0;if(e){if(!o[n+1])return;o.splice(n,2,o[n]+o[n+1]),r=o[n].length-1}else{if(!o[n-1])return;o.splice(n-1,2,o[n-1]+o[n]),r=o[n-1].length-1}h(o),u(c,`${t}-${n-(e?0:1)}`,r,r)},...i}))))}));const HI=(0,u.createContext)(),GI=(0,u.createContext)();function UI({children:e,tagName:t="div",value:n="",onChange:o,isSelected:r,multiline:l,inlineToolbar:i,wrapperClassName:a,autocompleters:m,onReplace:h,placeholder:g,allowedFormats:f,withoutInteractiveFormatting:v,onRemove:k,onMerge:_,onSplit:E,__unstableOnSplitAtEnd:w,__unstableOnSplitAtDoubleLineEnd:S,identifier:C,preserveWhiteSpace:x,__unstablePastePlainText:B,__unstableEmbedURLOnPaste:I,__unstableDisableFormats:T,disableLineBreaks:M,__unstableAllowPrefixTransformations:P,disableEditing:R,...N},L){N=function(e){const{__unstableMobileNoFocusOnMount:t,deleteEnter:n,placeholderTextColor:o,textAlign:r,selectionColor:l,tagsToEliminate:i,disableEditingMenu:s,fontSize:a,fontFamily:c,fontWeight:u,fontStyle:d,minWidth:p,maxWidth:m,setRef:h,disableSuggestions:g,disableAutocorrection:f,...b}=e;return b}(N);const A=(0,u.useRef)(),O=y(),{clientId:D,isSelected:z,name:V}=O,F=O[b],{selectionStart:H,selectionEnd:G,isSelected:U}=(0,d.useSelect)((e=>{if(!z)return{isSelected:!1};const{getSelectionStart:t,getSelectionEnd:n}=e(Nr),o=t(),l=n();let i;return void 0===r?i=o.clientId===D&&l.clientId===D&&o.attributeKey===C:r&&(i=o.clientId===D),{selectionStart:i?o.offset:void 0,selectionEnd:i?l.offset:void 0,isSelected:i}}),[D,C,r,z]),$=(0,d.useSelect)((e=>{let t=!1;if(F&&eg(V)){const n=(0,c.getBlockType)(V).attributes,{getBlockBindingsSource:o}=ie(e(c.store));for(const[e,r]of Object.entries(F)){if("rich-text"!==n?.[e]?.source)break;const l=o(r.source);if(!l||l.lockAttributesEditing){t=!0;break}}}return t}),[F,V]),j=R||$,{getSelectionStart:W,getSelectionEnd:K,getBlockRootClientId:Z}=(0,d.useSelect)(Nr),{selectionChange:q}=(0,d.useDispatch)(Nr),X=vI({allowedFormats:f,disableFormats:T}),Q=!X||X.length>0,J=(0,u.useCallback)(((e,t)=>{const n={},o=void 0===e&&void 0===t;if("number"==typeof e||o){if(void 0===t&&Z(D)!==Z(K().clientId))return;n.start={clientId:D,attributeKey:C,offset:e}}if("number"==typeof t||o){if(void 0===e&&Z(D)!==Z(W().clientId))return;n.end={clientId:D,attributeKey:C,offset:t}}q(n)}),[D,C]),{formatTypes:ee,prepareHandlers:te,valueHandlers:ne,changeHandlers:oe,dependencies:re}=function({clientId:e,identifier:t,withoutInteractiveFormatting:n,allowedFormats:o}){const r=(0,d.useSelect)(BI,[]),l=(0,u.useMemo)((()=>r.filter((({name:e,interactive:t,tagName:r})=>!(o&&!o.includes(e)||n&&(t||II.has(r)))))),[r,o,n]),i=(0,d.useSelect)((n=>l.reduce(((o,r)=>r.__experimentalGetPropsForEditableTreePreparation?{...o,...TI(r.__experimentalGetPropsForEditableTreePreparation(n,{richTextIdentifier:t,blockClientId:e}),r.name)}:o),{})),[l,e,t]),s=(0,d.useDispatch)(),a=[],c=[],p=[],m=[];for(const e in i)m.push(i[e]);return l.forEach((n=>{if(n.__experimentalCreatePrepareEditableTree){const o=n.__experimentalCreatePrepareEditableTree(MI(i,n.name),{richTextIdentifier:t,blockClientId:e});n.__experimentalCreateOnChangeEditableValue?c.push(o):a.push(o)}if(n.__experimentalCreateOnChangeEditableValue){let o={};n.__experimentalGetPropsForEditableTreeChangeHandler&&(o=n.__experimentalGetPropsForEditableTreeChangeHandler(s,{richTextIdentifier:t,blockClientId:e}));const r=MI(i,n.name);p.push(n.__experimentalCreateOnChangeEditableValue({..."object"==typeof r?r:{},...o},{richTextIdentifier:t,blockClientId:e}))}})),{formatTypes:l,prepareHandlers:a,valueHandlers:c,changeHandlers:p,dependencies:m}}({clientId:D,identifier:C,withoutInteractiveFormatting:v,allowedFormats:X});function le(e){return ee.forEach((t=>{t.__experimentalCreatePrepareEditableTree&&(e=(0,Y.removeFormat)(e,t.name,0,e.text.length))})),e.formats}const{value:se,getValue:ae,onChange:ce,ref:ue}=(0,Y.__unstableUseRichText)({value:n,onChange(e,{__unstableFormats:t,__unstableText:n}){o(e),Object.values(oe).forEach((e=>{e(t,n)}))},selectionStart:H,selectionEnd:G,onSelectionChange:J,placeholder:g,__unstableIsSelected:U,__unstableDisableFormats:T,preserveWhiteSpace:x,__unstableDependencies:[...re,t],__unstableAfterParse:function(e){return ne.reduce(((t,n)=>n(t,e.text)),e.formats)},__unstableBeforeSerialize:le,__unstableAddInvisibleFormats:function(e){return te.reduce(((t,n)=>n(t,e.text)),e.formats)}}),de=function(e){return(0,_l.__unstableUseAutocompleteProps)({...e,completers:rf(e)})}({onReplace:h,completers:m,record:se,onChange:ce});!function({html:e,value:t}){const n=(0,u.useRef)(),o=!!t.activeFormats?.length,{__unstableMarkLastChangeAsPersistent:r}=(0,d.useDispatch)(Nr);(0,u.useLayoutEffect)((()=>{if(n.current){if(n.current!==t.text){const e=window.setTimeout((()=>{r()}),1e3);return n.current=t.text,()=>{window.clearTimeout(e)}}r()}else n.current=t.text}),[e,o])}({html:n,value:se});const pe=(0,u.useRef)(new Set),me=(0,u.useRef)(new Set);function he(){A.current?.focus()}const ge=t;return(0,s.createElement)(s.Fragment,null,U&&(0,s.createElement)(HI.Provider,{value:pe},(0,s.createElement)(GI.Provider,{value:me},(0,s.createElement)(_l.Popover.__unstableSlotNameProvider,{value:"__unstable-block-tools-after"},e&&e({value:se,onChange:ce,onFocus:he}),(0,s.createElement)(zI,{value:se,onChange:ce,onFocus:he,formatTypes:ee,forwardedRef:A})))),U&&Q&&(0,s.createElement)(gI,{inline:i,editableContentElement:A.current,value:se}),(0,s.createElement)(ge,{role:"textbox","aria-multiline":!M,"aria-label":g,"aria-readonly":j,...N,...de,ref:(0,p.useMergeRefs)([ue,L,de.ref,N.ref,EI({value:se,onChange:ce}),SI({getValue:ae,onChange:ce,__unstableAllowPrefixTransformations:P,formatTypes:ee,onReplace:h,selectionChange:q}),NI(),(0,p.useRefEffect)((e=>{function t(e){(zs.isKeyboardEvent.primary(e,"z")||zs.isKeyboardEvent.primary(e,"y")||zs.isKeyboardEvent.primaryShift(e,"z"))&&e.preventDefault()}return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[]),PI(pe),RI(me),fI(),_I({isSelected:U,disableFormats:T,onChange:ce,value:se,formatTypes:ee,tagName:t,onReplace:h,onSplit:E,__unstableEmbedURLOnPaste:I,pastePlainText:B}),CI({value:se,onMerge:_,onRemove:k}),xI({removeEditorOnlyFormats:le,value:se,onReplace:h,onSplit:E,onChange:ce,disableLineBreaks:M,onSplitAtEnd:w,onSplitAtDoubleLineEnd:S}),LI(),A]),contentEditable:!j,suppressContentEditableWarning:!0,className:ml()("block-editor-rich-text__editable",N.className,"rich-text"),tabIndex:0!==N.tabIndex||j?N.tabIndex:null,"data-wp-block-attribute-key":C}))}const $I=(jI=(0,u.forwardRef)(UI),(0,u.forwardRef)(((e,t)=>{let n=e.value,o=e.onChange;Array.isArray(n)&&(w()("wp.blockEditor.RichText value prop as children type",{since:"6.1",version:"6.3",alternative:"value prop as string",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),n=c.children.toHTML(e.value),o=t=>e.onChange(c.children.fromDOM((0,Y.__unstableCreateElement)(document,t).childNodes)));const r=e.multiline?FI:jI,l=(0,p.useInstanceId)(r);return(0,s.createElement)(r,{...e,identifier:e.identifier||l,value:n,onChange:o,ref:t})})));var jI;$I.Content=VI,$I.isEmpty=e=>!e||0===e.length;const WI=(0,u.forwardRef)(((e,t)=>(0,s.createElement)($I,{ref:t,...e,disableEditing:!1})));WI.Content=VI,WI.isEmpty=e=>!e||0===e.length;const KI=WI,ZI=(0,u.forwardRef)(((e,t)=>(0,s.createElement)(KI,{ref:t,...e,__unstableDisableFormats:!0})));ZI.Content=({value:e="",tagName:t="div",...n})=>(0,s.createElement)(t,{...n},e);const qI=ZI,YI=(0,u.forwardRef)((({__experimentalVersion:e,...t},n)=>{if(2===e)return(0,s.createElement)(qI,{ref:n,...t});const{className:o,onChange:r,...l}=t;return(0,s.createElement)(Nf.A,{ref:n,className:ml()("block-editor-plain-text",o),onChange:e=>r(e.target.value),...l})}));function XI({property:e,viewport:t,desc:n}){const o=(0,p.useInstanceId)(XI),r=n||(0,x.sprintf)((0,x._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."),e,t.label);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("span",{"aria-describedby":`rbc-desc-${o}`},t.label),(0,s.createElement)(_l.VisuallyHidden,{as:"span",id:`rbc-desc-${o}`},r))}const QI=function(e){const{title:t,property:n,toggleLabel:o,onIsResponsiveChange:r,renderDefaultControl:l,renderResponsiveControls:i,isResponsive:a=!1,defaultLabel:c={id:"all",label:(0,x._x)("All","screen sizes")},viewports:d=[{id:"small",label:(0,x.__)("Small screens")},{id:"medium",label:(0,x.__)("Medium screens")},{id:"large",label:(0,x.__)("Large screens")}]}=e;if(!t||!n||!l)return null;const p=o||(0,x.sprintf)((0,x.__)("Use the same %s on all screensizes."),n),m=(0,x.__)("Toggle between using the same value for all screen sizes or using a unique value per screen size."),h=l((0,s.createElement)(XI,{property:n,viewport:c}),c);return(0,s.createElement)("fieldset",{className:"block-editor-responsive-block-control"},(0,s.createElement)("legend",{className:"block-editor-responsive-block-control__title"},t),(0,s.createElement)("div",{className:"block-editor-responsive-block-control__inner"},(0,s.createElement)(_l.ToggleControl,{__nextHasNoMarginBottom:!0,className:"block-editor-responsive-block-control__toggle",label:p,checked:!a,onChange:r,help:m}),(0,s.createElement)("div",{className:ml()("block-editor-responsive-block-control__group",{"is-responsive":a})},!a&&h,a&&(i?i(d):d.map((e=>(0,s.createElement)(u.Fragment,{key:e.id},l((0,s.createElement)(XI,{property:n,viewport:e}),e))))))))};function JI({character:e,type:t,onUse:n}){const o=(0,u.useContext)(HI),r=(0,u.useRef)();return r.current=n,(0,u.useEffect)((()=>{function n(n){zs.isKeyboardEvent[t](n,e)&&(r.current(),n.preventDefault())}return o.current.add(n),()=>{o.current.delete(n)}}),[e,t]),null}function eT({name:e,shortcutType:t,shortcutCharacter:n,...o}){let r,l="RichText.ToolbarControls";return e&&(l+=`.${e}`),t&&n&&(r=zs.displayShortcut[t](n)),(0,s.createElement)(_l.Fill,{name:l},(0,s.createElement)(_l.ToolbarButton,{...o,shortcut:r}))}function tT({inputType:e,onInput:t}){const n=(0,u.useContext)(GI),o=(0,u.useRef)();return o.current=t,(0,u.useEffect)((()=>{function t(t){t.inputType===e&&(o.current(),t.preventDefault())}return n.current.add(t),()=>{n.current.delete(t)}}),[e]),null}const nT=(0,s.createElement)(_l.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,s.createElement)(_l.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"}));const oT=(0,u.forwardRef)((function(e,t){const n=(0,d.useSelect)((e=>e(Nr).__unstableGetEditorMode()),[]),{__unstableSetEditorMode:o}=(0,d.useDispatch)(Nr);return(0,s.createElement)(_l.Dropdown,{renderToggle:({isOpen:o,onToggle:r})=>(0,s.createElement)(_l.Button,{...e,ref:t,icon:"navigation"===n?nT:La,"aria-expanded":o,"aria-haspopup":"true",onClick:r,label:(0,x.__)("Tools")}),popoverProps:{placement:"bottom-start"},renderContent:()=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.NavigableMenu,{role:"menu","aria-label":(0,x.__)("Tools")},(0,s.createElement)(_l.MenuItemsChoice,{value:"navigation"===n?"navigation":"edit",onSelect:o,choices:[{value:"edit",label:(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Ti,{icon:La}),(0,x.__)("Edit"))},{value:"navigation",label:(0,s.createElement)(s.Fragment,null,nT,(0,x.__)("Select"))}]})),(0,s.createElement)("div",{className:"block-editor-tool-selector__help"},(0,x.__)("Tools provide different interactions for selecting, navigating, and editing blocks. Toggle between select and edit by pressing Escape and Enter.")))})}));function rT({units:e,...t}){const[n]=Ar("spacing.units"),o=(0,_l.__experimentalUseCustomUnits)({availableUnits:n||["%","px","em","rem","vw"],units:e});return(0,s.createElement)(_l.__experimentalUnitControl,{units:o,...t})}const lT=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"}));class iT extends u.Component{constructor(){super(...arguments),this.toggle=this.toggle.bind(this),this.submitLink=this.submitLink.bind(this),this.state={expanded:!1}}toggle(){this.setState({expanded:!this.state.expanded})}submitLink(e){e.preventDefault(),this.toggle()}render(){const{url:e,onChange:t}=this.props,{expanded:n}=this.state,o=e?(0,x.__)("Edit link"):(0,x.__)("Insert link");return(0,s.createElement)("div",{className:"block-editor-url-input__button"},(0,s.createElement)(_l.Button,{icon:ru,label:o,onClick:this.toggle,className:"components-toolbar__control",isPressed:!!e}),n&&(0,s.createElement)("form",{className:"block-editor-url-input__button-modal",onSubmit:this.submitLink},(0,s.createElement)("div",{className:"block-editor-url-input__button-modal-line"},(0,s.createElement)(_l.Button,{className:"block-editor-url-input__back",icon:lT,label:(0,x.__)("Close"),onClick:this.toggle}),(0,s.createElement)(ta,{__nextHasNoMarginBottom:!0,value:e||"",onChange:t}),(0,s.createElement)(_l.Button,{icon:Ks,label:(0,x.__)("Submit"),type:"submit"}))))}}const sT=iT,aT=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.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-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),cT="none",uT="custom",dT="media",pT="attachment",mT=["noreferrer","noopener"],hT=({linkDestination:e,onChangeUrl:t,url:n,mediaType:o="image",mediaUrl:r,mediaLink:l,linkTarget:i,linkClass:a,rel:c,showLightboxSetting:d,lightboxEnabled:p,onSetLightbox:m,resetLightbox:h})=>{const[g,f]=(0,u.useState)(!1),[b,v]=(0,u.useState)(null),[k,_]=(0,u.useState)(!1),[y,E]=(0,u.useState)(null),w=(0,u.useRef)(null),S=(0,u.useRef)();(0,u.useEffect)((()=>{if(!S.current)return;(As.focus.focusable.find(S.current)[0]||S.current).focus()}),[k,n,p]);const C=()=>{e!==dT&&e!==pT||E(""),_(!0)},B=()=>{_(!1)},I=()=>{const e=[{linkDestination:dT,title:(0,x.__)("Link to image file"),url:"image"===o?r:void 0,icon:aT}];return"image"===o&&l&&e.push({linkDestination:pT,title:(0,x.__)("Link to attachment page"),url:"image"===o?l:void 0,icon:la}),e},T=(0,s.createElement)(_l.__experimentalVStack,{spacing:"3"},(0,s.createElement)(_l.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Open in new tab"),onChange:e=>{const n=(e=>{const t=e?"_blank":void 0;let n;if(t){const e=(null!=c?c:"").split(" ");mT.forEach((t=>{e.includes(t)||e.push(t)})),n=e.join(" ")}else{const e=(null!=c?c:"").split(" ").filter((e=>!1===mT.includes(e)));n=e.length?e.join(" "):void 0}return{linkTarget:t,rel:n}})(e);t(n)},checked:"_blank"===i}),(0,s.createElement)(_l.TextControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Link rel"),value:null!=c?c:"",onChange:e=>{t({rel:e})}}),(0,s.createElement)(_l.TextControl,{__nextHasNoMarginBottom:!0,label:(0,x.__)("Link CSS class"),value:a||"",onChange:e=>{t({linkClass:e})}})),M=null!==y?y:n,P=!p||p&&!d,R=!M&&P,N=(I().find((t=>t.linkDestination===e))||{}).title;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.ToolbarButton,{icon:ru,className:"components-toolbar__control",label:(0,x.__)("Link"),"aria-expanded":g,onClick:()=>{f(!0)},ref:v,isActive:!!n||p&&d}),g&&(0,s.createElement)(lI,{ref:S,anchor:b,onFocusOutside:e=>{const t=w.current;t&&t.contains(e.target)||(f(!1),E(null),B())},onClose:()=>{E(null),B(),f(!1)},renderSettings:P?()=>T:null,additionalControls:R&&(0,s.createElement)(_l.NavigableMenu,null,I().map((e=>(0,s.createElement)(_l.MenuItem,{key:e.linkDestination,icon:e.icon,iconPosition:"left",onClick:()=>{E(null),(e=>{const n=I();let o;o=e?(n.find((t=>t.url===e))||{linkDestination:uT}).linkDestination:cT,t({linkDestination:o,href:e})})(e.url),B()}},e.title))),d&&(0,s.createElement)(_l.MenuItem,{key:"expand-on-click",className:"block-editor-url-popover__expand-on-click",icon:sf,info:(0,x.__)("Scale the image with a lightbox effect."),iconPosition:"left",onClick:()=>{E(null),t({linkDestination:cT,href:""}),m(!0),B()}},(0,x.__)("Expand on click"))),offset:13},p&&d&&!n&&!k?(0,s.createElement)("div",{className:"block-editor-url-popover__expand-on-click"},(0,s.createElement)(Ti,{icon:sf}),(0,s.createElement)("div",{className:"text"},(0,s.createElement)("p",null,(0,x.__)("Expand on click")),(0,s.createElement)("p",{className:"description"},(0,x.__)("Scales the image with a lightbox effect"))),(0,s.createElement)(_l.Button,{icon:Aa,label:(0,x.__)("Disable expand on click"),onClick:()=>{m(!1)},size:"compact"})):!n||k?(0,s.createElement)(lI.LinkEditor,{className:"block-editor-format-toolbar__link-container-content",value:M,onChangeInputValue:E,onSubmit:e=>{if(y){const e=I().find((e=>e.url===y))?.linkDestination||uT;t({href:y,linkDestination:e,lightbox:{enabled:!1}})}B(),E(null),e.preventDefault()},autocompleteRef:w}):n&&!k?(0,s.createElement)(s.Fragment,null,(0,s.createElement)(lI.LinkViewer,{className:"block-editor-format-toolbar__link-container-content",url:n,onEditLinkClick:C,urlLabel:N}),(0,s.createElement)(_l.Button,{icon:Aa,label:(0,x.__)("Remove link"),onClick:()=>{t({linkDestination:cT,href:""}),h()},size:"compact"})):void 0))};function gT(){return w()("wp.blockEditor.PreviewOptions",{version:"6.5"}),null}function fT(e){const[t,n]=(0,u.useState)(window.innerWidth);(0,u.useEffect)((()=>{if("Desktop"===e)return;const t=()=>n(window.innerWidth);return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}}),[e]);const o=e=>{let n;switch(e){case"Tablet":n=780;break;case"Mobile":n=360;break;default:return null}return n<t?n:t};return(e=>{const t="Mobile"===e?"768px":"1024px",n=(window.innerHeight<800?36:72)+"px",r="auto";switch(e){case"Tablet":case"Mobile":return{width:o(e),marginTop:n,marginBottom:n,marginLeft:r,marginRight:r,height:t,borderRadius:"2px 2px 2px 2px",border:"1px solid #ddd",overflowY:"auto"};default:return{marginLeft:r,marginRight:r}}})(e)}const bT=(0,d.withSelect)((e=>({selectedBlockClientId:e(Nr).getBlockSelectionStart()})))((({selectedBlockClientId:e})=>{const t=fd(e);return e?(0,s.createElement)(_l.Button,{variant:"secondary",className:"block-editor-skip-to-selected-block",onClick:()=>{t.current.focus()}},(0,x.__)("Skip to the selected block")):null})),vT=window.wp.wordcount;const kT=(0,d.withSelect)((e=>{const{getMultiSelectedBlocks:t}=e(Nr);return{blocks:t()}}))((function({blocks:e}){const t=(0,vT.count)((0,c.serialize)(e),"words");return(0,s.createElement)("div",{className:"block-editor-multi-selection-inspector__card"},(0,s.createElement)(qh,{icon:SS,showColors:!0}),(0,s.createElement)("div",{className:"block-editor-multi-selection-inspector__card-content"},(0,s.createElement)("div",{className:"block-editor-multi-selection-inspector__card-title"},(0,x.sprintf)((0,x._n)("%d Block","%d Blocks",e.length),e.length)),(0,s.createElement)("div",{className:"block-editor-multi-selection-inspector__card-description"},(0,x.sprintf)((0,x._n)("%d word selected.","%d words selected.",t),t))))}));function _T({blockName:e}){const{preferredStyle:t,onUpdatePreferredStyleVariations:n,styles:o}=(0,d.useSelect)((t=>{var n;const o=t(Nr).getSettings().__experimentalPreferredStyleVariations;return{preferredStyle:o?.value?.[e],onUpdatePreferredStyleVariations:null!==(n=o?.onChange)&&void 0!==n?n:null,styles:t(c.store).getBlockStyles(e)}}),[e]),r=(0,u.useMemo)((()=>[{label:(0,x.__)("Not set"),value:""},...o.map((({label:e,name:t})=>({label:e,value:t})))]),[o]),l=(0,u.useMemo)((()=>NS(o)?.name),[o]),i=(0,u.useCallback)((t=>{n(e,t)}),[e,n]);return t&&t!==l?n&&(0,s.createElement)("div",{className:"default-style-picker__default-switcher"},(0,s.createElement)(_l.SelectControl,{__nextHasNoMarginBottom:!0,options:r,value:t||"",label:(0,x.__)("Default Style"),onChange:i})):null}const yT=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{fillRule:"evenodd",d:"M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",clipRule:"evenodd"})),ET=(0,s.createElement)(Z.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(Z.Path,{d:"M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z"})),wT={name:"settings",title:(0,x.__)("Settings"),value:"settings",icon:yT,className:"block-editor-block-inspector__tab-item"},ST={name:"styles",title:(0,x.__)("Styles"),value:"styles",icon:ET,className:"block-editor-block-inspector__tab-item"},CT={name:"list",title:(0,x.__)("List View"),value:"list-view",icon:XC,className:"block-editor-block-inspector__tab-item"},xT=()=>{const e=(0,_l.__experimentalUseSlotFills)(xs.slotName);return Boolean(e&&e.length)?(0,s.createElement)(_l.PanelBody,{className:"block-editor-block-inspector__advanced",title:(0,x.__)("Advanced"),initialOpen:!1},(0,s.createElement)(Bs.Slot,{group:"advanced"})):null},BT=()=>{const[e,t]=(0,u.useState)(),{multiSelectedBlocks:n}=(0,d.useSelect)((e=>{const{getBlocksByClientId:t,getSelectedBlockClientIds:n}=e(Nr);return{multiSelectedBlocks:t(n())}}),[]);return(0,u.useLayoutEffect)((()=>{void 0===e&&t(n.some((({attributes:e})=>!!e?.style?.position?.type)))}),[e,n,t]),(0,s.createElement)(_l.PanelBody,{className:"block-editor-block-inspector__position",title:(0,x.__)("Position"),initialOpen:null!=e&&e},(0,s.createElement)(Bs.Slot,{group:"position"}))},IT=()=>{const e=(0,_l.__experimentalUseSlotFills)(vs.position.Slot.__unstableName);return Boolean(e&&e.length)?(0,s.createElement)(BT,null):null},TT=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"})),MT="isInspectorControlsTabsHintVisible";function PT(){const e=(0,d.useSelect)((e=>{var t;return null===(t=e(Ws.store).get("core",MT))||void 0===t||t}),[]),t=(0,u.useRef)(),{set:n}=(0,d.useDispatch)(Ws.store);return e?(0,s.createElement)("div",{ref:t,className:"block-editor-inspector-controls-tabs__hint"},(0,s.createElement)("div",{className:"block-editor-inspector-controls-tabs__hint-content"},(0,x.__)("Looking for other block settings? They've moved to the styles tab.")),(0,s.createElement)(_l.Button,{className:"block-editor-inspector-controls-tabs__hint-dismiss",icon:TT,iconSize:"16",label:(0,x.__)("Dismiss hint"),onClick:()=>{const e=As.focus.tabbable.findPrevious(t.current);e?.focus(),n("core",MT,!1)},showTooltip:!1})):null}const RT=({showAdvancedControls:e=!1})=>(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Bs.Slot,null),(0,s.createElement)(IT,null),e&&(0,s.createElement)("div",null,(0,s.createElement)(xT,null)),(0,s.createElement)(PT,null)),NT=({blockName:e,clientId:t,hasBlockStyles:n})=>{const o=zu({blockName:e});return(0,s.createElement)(s.Fragment,null,n&&(0,s.createElement)("div",null,(0,s.createElement)(_l.PanelBody,{title:(0,x.__)("Styles")},(0,s.createElement)(Ax,{clientId:t}),(0,c.hasBlockSupport)(e,"defaultStylePicker",!0)&&(0,s.createElement)(_T,{blockName:e}))),(0,s.createElement)(Bs.Slot,{group:"color",label:(0,x.__)("Color"),className:"color-block-support-panel__inner-wrapper"}),(0,s.createElement)(Bs.Slot,{group:"background",label:(0,x.__)("Background")}),(0,s.createElement)(Bs.Slot,{group:"filter"}),(0,s.createElement)(Bs.Slot,{group:"typography",label:(0,x.__)("Typography")}),(0,s.createElement)(Bs.Slot,{group:"dimensions",label:(0,x.__)("Dimensions")}),(0,s.createElement)(Bs.Slot,{group:"border",label:o}),(0,s.createElement)(Bs.Slot,{group:"styles"}))},LT=["core/navigation"],AT=e=>!LT.includes(e),{Tabs:OT}=ie(_l.privateApis);function DT({blockName:e,clientId:t,hasBlockStyles:n,tabs:o}){const r=AT(e)?void 0:CT.name;return(0,s.createElement)("div",{className:"block-editor-block-inspector__tabs"},(0,s.createElement)(OT,{initialTabId:r,key:t},(0,s.createElement)(OT.TabList,null,o.map((e=>(0,s.createElement)(OT.Tab,{key:e.name,tabId:e.name,render:(0,s.createElement)(_l.Button,{icon:e.icon,label:e.title,className:e.className})})))),(0,s.createElement)(OT.TabPanel,{tabId:wT.name,focusable:!1},(0,s.createElement)(RT,{showAdvancedControls:!!e})),(0,s.createElement)(OT.TabPanel,{tabId:ST.name,focusable:!1},(0,s.createElement)(NT,{blockName:e,clientId:t,hasBlockStyles:n})),(0,s.createElement)(OT.TabPanel,{tabId:CT.name,focusable:!1},(0,s.createElement)(Bs.Slot,{group:"list"}))))}const zT=[];function VT(e){const t=[],{border:n,color:o,default:r,dimensions:l,list:i,position:s,styles:a,typography:c,effects:u}=vs,p=AT(e),m=(0,_l.__experimentalUseSlotFills)(i.Slot.__unstableName),h=!p&&!!m&&m.length,g=[...(0,_l.__experimentalUseSlotFills)(n.Slot.__unstableName)||[],...(0,_l.__experimentalUseSlotFills)(o.Slot.__unstableName)||[],...(0,_l.__experimentalUseSlotFills)(l.Slot.__unstableName)||[],...(0,_l.__experimentalUseSlotFills)(a.Slot.__unstableName)||[],...(0,_l.__experimentalUseSlotFills)(c.Slot.__unstableName)||[],...(0,_l.__experimentalUseSlotFills)(u.Slot.__unstableName)||[]].length,f=(0,_l.__experimentalUseSlotFills)(xs.slotName)||[],b=[...(0,_l.__experimentalUseSlotFills)(r.Slot.__unstableName)||[],...(0,_l.__experimentalUseSlotFills)(s.Slot.__unstableName)||[],...h&&g>1?f:[]];h&&t.push(CT),b.length&&t.push(wT),g&&t.push(ST);const v=function(e,t={}){return void 0!==t[e]?t[e]:void 0===t.default||t.default}(e,(0,d.useSelect)((e=>e(Nr).getSettings().blockInspectorTabs),[]));return v?t:zT}const{createPrivateSlotFill:FT}=ie(_l.privateApis),{Fill:HT,Slot:GT}=FT("BlockInformation"),UT=e=>y()[h]?(0,s.createElement)(HT,{...e}):null;UT.Slot=e=>(0,s.createElement)(GT,{...e});const $T=UT;function jT({clientIds:e}){return e.length?(0,s.createElement)(_l.__experimentalVStack,{spacing:1},e.map((e=>(0,s.createElement)(WT,{key:e,clientId:e})))):null}function WT({clientId:e}){const{name:t,icon:n,isSelected:o}=(0,d.useSelect)((t=>{const{getBlockName:n,getBlockAttributes:o,isBlockSelected:r,hasSelectedInnerBlock:l}=t(Nr),{getBlockType:i}=t(c.store),s=i(n(e)),a=o(e);return{name:s&&(0,c.__experimentalGetBlockLabel)(s,a,"list-view"),icon:s?.icon,isSelected:r(e)||l(e,!0)}}),[e]),{selectBlock:r}=(0,d.useDispatch)(Nr);return(0,s.createElement)(_l.Button,{isPressed:o,onClick:()=>r(e)},(0,s.createElement)(_l.Flex,null,(0,s.createElement)(_l.FlexItem,null,(0,s.createElement)(qh,{icon:n})),(0,s.createElement)(_l.FlexBlock,{style:{textAlign:"left"}},(0,s.createElement)(_l.__experimentalTruncate,null,t))))}function KT({topLevelLockedBlock:e}){const t=(0,d.useSelect)((t=>{const{getClientIdsOfDescendants:n,getBlockName:o,getBlockEditingMode:r}=t(Nr);return n(e).filter((e=>"core/list-item"!==o(e)&&"contentOnly"===r(e)))}),[e]),n=ih(e);return(0,s.createElement)("div",{className:"block-editor-block-inspector"},(0,s.createElement)(P_,{...n,className:n.isSynced&&"is-synced"}),(0,s.createElement)(iB,{blockClientId:e}),(0,s.createElement)($T.Slot,null),t.length>0&&(0,s.createElement)(_l.PanelBody,{title:(0,x.__)("Content")},(0,s.createElement)(jT,{clientIds:t})))}const ZT=({animate:e,wrapper:t,children:n})=>e?t(n):n,qT=({blockInspectorAnimationSettings:e,selectedBlockClientId:t,children:n})=>{const o=e&&"leftToRight"===e.enterDirection?-50:50;return(0,s.createElement)(_l.__unstableMotion.div,{animate:{x:0,opacity:1,transition:{ease:"easeInOut",duration:.14}},initial:{x:o,opacity:0},key:t},n)},YT=({clientId:e,blockName:t})=>{const n=VT(t),o=n?.length>1,r=(0,d.useSelect)((e=>{const{getBlockStyles:n}=e(c.store),o=n(t);return o&&o.length>0}),[t]),l=ih(e),i=zu({blockName:t});return(0,s.createElement)("div",{className:"block-editor-block-inspector"},(0,s.createElement)(P_,{...l,className:l.isSynced&&"is-synced"}),(0,s.createElement)(iB,{blockClientId:e}),(0,s.createElement)($T.Slot,null),o&&(0,s.createElement)(DT,{hasBlockStyles:r,clientId:e,blockName:t,tabs:n}),!o&&(0,s.createElement)(s.Fragment,null,r&&(0,s.createElement)("div",null,(0,s.createElement)(_l.PanelBody,{title:(0,x.__)("Styles")},(0,s.createElement)(Ax,{clientId:e}),(0,c.hasBlockSupport)(t,"defaultStylePicker",!0)&&(0,s.createElement)(_T,{blockName:t}))),(0,s.createElement)(Bs.Slot,null),(0,s.createElement)(Bs.Slot,{group:"list"}),(0,s.createElement)(Bs.Slot,{group:"color",label:(0,x.__)("Color"),className:"color-block-support-panel__inner-wrapper"}),(0,s.createElement)(Bs.Slot,{group:"typography",label:(0,x.__)("Typography")}),(0,s.createElement)(Bs.Slot,{group:"dimensions",label:(0,x.__)("Dimensions")}),(0,s.createElement)(Bs.Slot,{group:"border",label:i}),(0,s.createElement)(Bs.Slot,{group:"styles"}),(0,s.createElement)(Bs.Slot,{group:"background",label:(0,x.__)("Background")}),(0,s.createElement)(IT,null),(0,s.createElement)("div",null,(0,s.createElement)(xT,null))),(0,s.createElement)(bT,{key:"back"}))},XT=({showNoBlockSelectedMessage:e=!0})=>{const{count:t,selectedBlockName:n,selectedBlockClientId:o,blockType:r,topLevelLockedBlock:l}=(0,d.useSelect)((e=>{const{getSelectedBlockClientId:t,getSelectedBlockCount:n,getBlockName:o,__unstableGetContentLockingParent:r,getTemplateLock:l}=e(Nr),i=t(),s=i&&o(i),a=s&&(0,c.getBlockType)(s);return{count:n(),selectedBlockClientId:i,selectedBlockName:s,blockType:a,topLevelLockedBlock:r(i)||("contentOnly"===l(i)||"core/block"===s?i:void 0)}}),[]),i=VT(r?.name),a=i?.length>1,u=function(e,t){return(0,d.useSelect)((t=>{if(e){const n=t(Nr).getSettings().blockInspectorAnimation,o=n?.animationParent,{getSelectedBlockClientId:r,getBlockParentsByBlockName:l}=t(Nr);return l(r(),o,!0)[0]||e.name===o?n?.[e.name]:null}return null}),[t,e])}(r,o),p=zu({blockName:n});if(t>1)return(0,s.createElement)("div",{className:"block-editor-block-inspector"},(0,s.createElement)(kT,null),a?(0,s.createElement)(DT,{tabs:i}):(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Bs.Slot,null),(0,s.createElement)(Bs.Slot,{group:"color",label:(0,x.__)("Color"),className:"color-block-support-panel__inner-wrapper"}),(0,s.createElement)(Bs.Slot,{group:"typography",label:(0,x.__)("Typography")}),(0,s.createElement)(Bs.Slot,{group:"dimensions",label:(0,x.__)("Dimensions")}),(0,s.createElement)(Bs.Slot,{group:"border",label:p}),(0,s.createElement)(Bs.Slot,{group:"styles"})));const m=n===(0,c.getUnregisteredTypeHandlerName)();return r&&o&&!m?l?(0,s.createElement)(KT,{topLevelLockedBlock:l}):(0,s.createElement)(ZT,{animate:u,wrapper:e=>(0,s.createElement)(qT,{blockInspectorAnimationSettings:u,selectedBlockClientId:o},e)},(0,s.createElement)(YT,{clientId:o,blockName:r.name})):e?(0,s.createElement)("span",{className:"block-editor-block-inspector__no-blocks"},(0,x.__)("No block selected.")):null},QT=()=>(w()("__unstableUseClipboardHandler",{alternative:"BlockCanvas or WritingFlow",since:"6.4",version:"6.7"}),ly());function JT(e){return w()("CopyHandler",{alternative:"BlockCanvas or WritingFlow",since:"6.4",version:"6.7"}),(0,s.createElement)("div",{...e,ref:ly()})}const eM=()=>{};const tM=(0,u.forwardRef)((function({rootClientId:e,clientId:t,isAppender:n,showInserterHelpPanel:o,showMostUsedBlocks:r=!1,__experimentalInsertionIndex:l,__experimentalFilterValue:i,onSelect:a=eM,shouldFocusBlock:c=!1},u){const{destinationRootClientId:p}=(0,d.useSelect)((n=>{const{getBlockRootClientId:o}=n(Nr);return{destinationRootClientId:e||o(t)||void 0}}),[t,e]);return(0,s.createElement)(ew,{onSelect:a,rootClientId:p,clientId:t,isAppender:n,showInserterHelpPanel:o,showMostUsedBlocks:r,__experimentalInsertionIndex:l,__experimentalFilterValue:i,shouldFocusBlock:c,ref:u})}));function nM(){return w()("wp.blockEditor.MultiSelectScrollIntoView",{hint:"This behaviour is now built-in.",since:"5.8"}),null}const oM=-1!==window.navigator.userAgent.indexOf("Trident"),rM=new Set([zs.UP,zs.DOWN,zs.LEFT,zs.RIGHT]),lM=.75;function iM(){const e=(0,d.useSelect)((e=>e(Nr).hasSelectedBlock()),[]);return(0,p.useRefEffect)((t=>{if(!e)return;const{ownerDocument:n}=t,{defaultView:o}=n;let r,l,i;function s(){r||(r=o.requestAnimationFrame((()=>{p(),r=null})))}function a(e){l&&o.cancelAnimationFrame(l),l=o.requestAnimationFrame((()=>{c(e),l=null}))}function c({keyCode:e}){if(!m())return;const r=(0,As.computeCaretRect)(o);if(!r)return;if(!i)return void(i=r);if(rM.has(e))return void(i=r);const l=r.top-i.top;if(0===l)return;const s=(0,As.getScrollContainer)(t);if(!s)return;const a=s===n.body||s===n.documentElement,c=a?o.scrollY:s.scrollTop,u=a?0:s.getBoundingClientRect().top,d=a?i.top/o.innerHeight:(i.top-u)/(o.innerHeight-u);if(0===c&&d<lM&&function(){const e=t.querySelectorAll('[contenteditable="true"]');return e[e.length-1]===n.activeElement}())return void(i=r);const p=a?o.innerHeight:s.clientHeight;i.top+i.height>u+p||i.top<u?i=r:a?o.scrollBy(0,l):s.scrollTop+=l}function u(){n.addEventListener("selectionchange",d)}function d(){n.removeEventListener("selectionchange",d),p()}function p(){m()&&(i=(0,As.computeCaretRect)(o))}function m(){return t.contains(n.activeElement)&&n.activeElement.isContentEditable}return o.addEventListener("scroll",s,!0),o.addEventListener("resize",s,!0),t.addEventListener("keydown",a),t.addEventListener("keyup",c),t.addEventListener("mousedown",u),t.addEventListener("touchstart",u),()=>{o.removeEventListener("scroll",s,!0),o.removeEventListener("resize",s,!0),t.removeEventListener("keydown",a),t.removeEventListener("keyup",c),t.removeEventListener("mousedown",u),t.removeEventListener("touchstart",u),n.removeEventListener("selectionchange",d),o.cancelAnimationFrame(r),o.cancelAnimationFrame(l)}}),[e])}const sM=oM?e=>e.children:function({children:e}){return(0,s.createElement)("div",{ref:iM(),className:"block-editor__typewriter"},e)},aM=(0,u.createContext)({});function cM({children:e,uniqueId:t,blockName:n=""}){const o=(0,u.useContext)(aM),{name:r}=y();n=n||r;const l=(0,u.useMemo)((()=>function(e,t,n){const o={...e,[t]:e[t]?new Set(e[t]):new Set};return o[t].add(n),o}(o,n,t)),[o,n,t]);return(0,s.createElement)(aM.Provider,{value:l},e)}function uM(e,t=""){const n=(0,u.useContext)(aM),{name:o}=y();return t=t||o,Boolean(n[t]?.has(e))}const dM=e=>(w()("wp.blockEditor.__experimentalRecursionProvider",{since:"6.5",alternative:"wp.blockEditor.RecursionProvider"}),(0,s.createElement)(cM,{...e})),pM=(...e)=>(w()("wp.blockEditor.__experimentalUseHasRecursion",{since:"6.5",alternative:"wp.blockEditor.useHasRecursion"}),uM(...e)),mM=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.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"}));function hM({title:e,help:t,actions:n=[],onClose:o}){return(0,s.createElement)(_l.__experimentalVStack,{className:"block-editor-inspector-popover-header",spacing:4},(0,s.createElement)(_l.__experimentalHStack,{alignment:"center"},(0,s.createElement)(_l.__experimentalHeading,{className:"block-editor-inspector-popover-header__heading",level:2,size:13},e),(0,s.createElement)(_l.__experimentalSpacer,null),n.map((({label:e,icon:t,onClick:n})=>(0,s.createElement)(_l.Button,{key:e,className:"block-editor-inspector-popover-header__action",label:e,icon:t,variant:!t&&"tertiary",onClick:n},!t&&e))),o&&(0,s.createElement)(_l.Button,{className:"block-editor-inspector-popover-header__action",label:(0,x.__)("Close"),icon:mM,onClick:o})),t&&(0,s.createElement)(_l.__experimentalText,null,t))}const gM=(0,u.forwardRef)((function({onClose:e,onChange:t,...n},o){return(0,s.createElement)("div",{ref:o,className:"block-editor-publish-date-time-picker"},(0,s.createElement)(hM,{title:(0,x.__)("Publish"),actions:[{label:(0,x.__)("Now"),onClick:()=>t?.(null)}],onClose:e}),(0,s.createElement)(_l.DateTimePicker,{startOfWeek:(0,uB.getSettings)().l10n.startOfWeek,onChange:t,...n}))})),fM=window.wp.commands,bM=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z"})),vM=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{d:"M18 4h-7c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7zm-5 5c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h1V9H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-1h-1.5v1z"})),kM=(0,s.createElement)(Z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(Z.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})),_M=()=>{const{replaceBlocks:e,multiSelect:t}=(0,d.useDispatch)(Nr),{blocks:n,clientIds:o,canRemove:r,possibleBlockTransformations:l}=(0,d.useSelect)((e=>{const{getBlockRootClientId:t,getBlockTransformItems:n,getSelectedBlockClientIds:o,getBlocksByClientId:r,canRemoveBlocks:l}=e(Nr),i=o(),s=r(i),a=t(i[0]);return{blocks:s,clientIds:i,possibleBlockTransformations:n(s,a),canRemove:l(i,a)}}),[]),i=1===n.length&&(0,c.isTemplatePart)(n[0]);function a(r){const l=(0,c.switchToBlockType)(n,r);var i;e(o,l),(i=l).length>1&&t(i[0].clientId,i[i.length-1].clientId)}const u=!!l.length&&r&&!i;if(!o||o.length<1||!u)return{isLoading:!1,commands:[]};return{isLoading:!1,commands:l.map((e=>{const{name:t,title:n,icon:o}=e;return{name:"core/block-editor/transform-to-"+t.replace("/","-"),label:(0,x.sprintf)((0,x.__)("Transform to %s"),n),icon:(0,s.createElement)(qh,{icon:o}),callback:({close:e})=>{a(t),e()}}}))}},yM=()=>{const{clientIds:e}=(0,d.useSelect)((e=>{const{getSelectedBlockClientIds:t}=e(Nr);return{clientIds:t()}}),[]),{getBlockRootClientId:t,canMoveBlocks:n,getBlockCount:o}=(0,d.useSelect)(Nr),{setBlockMovingClientId:r,setNavigationMode:l,selectBlock:i}=(0,d.useDispatch)(Nr);if(!e||e.length<1)return{isLoading:!1,commands:[]};const s=t(e[0]),a=[];return n(e,s)&&1!==o(s)&&a.push({name:"move-to",label:(0,x.__)("Move to"),callback:()=>{l(!0),i(e[0]),r(e[0])},icon:bM}),{isLoading:!1,commands:a.map((e=>({...e,name:"core/block-editor/action-"+e.name,callback:({close:t})=>{e.callback(),t()}})))}},EM=()=>{const{clientIds:e,isUngroupable:t,isGroupable:n}=(0,d.useSelect)((e=>{const{getSelectedBlockClientIds:t,isUngroupable:n,isGroupable:o}=e(Nr);return{clientIds:t(),isUngroupable:n(),isGroupable:o()}}),[]),{canInsertBlockType:o,getBlockRootClientId:r,getBlocksByClientId:l,canRemoveBlocks:i}=(0,d.useSelect)(Nr),{getDefaultBlockName:s,getGroupingBlockName:a}=(0,d.useSelect)(c.store),u=l(e),{removeBlocks:p,replaceBlocks:m,duplicateBlocks:h,insertAfterBlock:g,insertBeforeBlock:f}=(0,d.useDispatch)(Nr),b=()=>{if(!u.length)return;const t=a(),n=(0,c.switchToBlockType)(u,t);n&&m(e,n)},v=()=>{if(!u.length)return;const t=u[0].innerBlocks;t.length&&m(e,t)};if(!e||e.length<1)return{isLoading:!1,commands:[]};const k=r(e[0]),_=o(s(),k),y=u.every((e=>!!e&&(0,c.hasBlockSupport)(e.name,"multiple",!0)&&o(e.name,k))),E=i(e,k),w=[];return y&&w.push({name:"duplicate",label:(0,x.__)("Duplicate"),callback:()=>h(e,!0),icon:SS}),_&&w.push({name:"add-before",label:(0,x.__)("Add before"),callback:()=>{const t=Array.isArray(e)?e[0]:t;f(t)},icon:na},{name:"add-after",label:(0,x.__)("Add after"),callback:()=>{const t=Array.isArray(e)?e[e.length-1]:t;g(t)},icon:na}),n&&w.push({name:"Group",label:(0,x.__)("Group"),callback:b,icon:wC}),t&&w.push({name:"ungroup",label:(0,x.__)("Ungroup"),callback:v,icon:vM}),E&&w.push({name:"remove",label:(0,x.__)("Delete"),callback:()=>p(e,!0),icon:kM}),{isLoading:!1,commands:w.map((e=>({...e,name:"core/block-editor/action-"+e.name,callback:({close:t})=>{e.callback(),t()}})))}},wM=()=>{(0,fM.useCommandLoader)({name:"core/block-editor/blockTransforms",hook:_M}),(0,fM.useCommandLoader)({name:"core/block-editor/blockActions",hook:yM}),(0,fM.useCommandLoader)({name:"core/block-editor/blockQuickActions",hook:EM,context:"block-selection-edit"})},SM="isResuableBlocksrRenameHintVisible";function CM(){const e=(0,d.useSelect)((e=>{var t;return null===(t=e(Ws.store).get("core",SM))||void 0===t||t}),[]),t=(0,u.useRef)(),{set:n}=(0,d.useDispatch)(Ws.store);return e?(0,s.createElement)("div",{ref:t,className:"reusable-blocks-menu-items__rename-hint"},(0,s.createElement)("div",{className:"reusable-blocks-menu-items__rename-hint-content"},(0,x.__)("Reusable blocks are now synced patterns. A synced pattern will behave in exactly the same way as a reusable block.")),(0,s.createElement)(_l.Button,{className:"reusable-blocks-menu-items__rename-hint-dismiss",icon:TT,iconSize:"16",label:(0,x.__)("Dismiss hint"),onClick:()=>{const e=As.focus.tabbable.findPrevious(t.current);e?.focus(),n("core",SM,!1)},showTooltip:!1})):null}const xM={button:"wp-element-button",caption:"wp-element-caption"},BM=e=>xM[e]?xM[e]:"",IM=()=>"",TM={__experimentalBorder:"border",color:"color",spacing:"spacing",typography:"typography"};function MM(e){const t="var:";if(e?.startsWith?.(t)){return`var(--wp--${e.slice(4).split("|").join("--")})`}return e}function PM(e={},t,n){const{kebabCase:o}=ie(_l.privateApis);let r=[];return Object.keys(e).forEach((l=>{const i=t+o(l.replace("/","-")),s=e[l];if(s instanceof Object){const e=i+n;r=[...r,...PM(s,e,n)]}else r.push(`${i}: ${s}`)})),r}const RM=(e,t)=>{const n={};return Object.entries(e).forEach((([e,o])=>{if("root"===e||!t?.[e])return;const r="string"==typeof o;if(r||Object.entries(o).forEach((([o,r])=>{if("root"===o||!t?.[e][o])return;const l=NM({[e]:{[o]:t[e][o]}});n[r]=[...n[r]||[],...l],delete t[e][o]})),r||o.root){const l=r?o:o.root,i=NM({[e]:t[e]});n[l]=[...n[l]||[],...i],delete t[e]}})),n};function NM(e={},t="",n,o={},r=!0){const{kebabCase:l}=ie(_l.privateApis),i=qr===t,s=Object.entries(c.__EXPERIMENTAL_STYLE_PROPERTY).reduce(((t,[o,{value:r,properties:s,useEngine:a,rootOnly:c}])=>{if(c&&!i)return t;const u=r;if("elements"===u[0]||a)return t;const d=Wn(e,u);if("--wp--style--root--padding"===o&&("string"==typeof d||!n))return t;if(s&&"string"!=typeof d)Object.entries(s).forEach((e=>{const[n,o]=e;if(!Wn(d,[o],!1))return;const r=n.startsWith("--")?n:l(n);t.push(`${r}: ${MM(Wn(d,[o]))}`)}));else if(Wn(e,u,!1)){const n=o.startsWith("--")?o:l(o);t.push(`${n}: ${MM(Wn(e,u))}`)}return t}),[]);return(0,Ri.getCSSRules)(e).forEach((e=>{if(i&&(n||!r)&&e.key.startsWith("padding"))return;const t=e.key.startsWith("--")?e.key:l(e.key);let a=e.value;if("string"!=typeof a&&a?.ref){const e=a.ref.split(".");if(a=Wn(o,e),!a||a?.ref)return}"font-size"===t&&(a=Wr({size:a},Zr(o?.settings))),"aspect-ratio"===t&&s.push("min-height: unset"),s.push(`${t}: ${a}`)})),s}function LM({layoutDefinitions:e=Al,style:t,selector:n,hasBlockGapSupport:o,hasFallbackGapSupport:r,fallbackGapValue:l}){let i="",s=o?oi(t?.spacing?.blockGap):"";if(r&&(n===qr?s=s||"0.5em":!o&&l&&(s=l)),s&&e&&(Object.values(e).forEach((({className:e,name:t,spacingStyles:r})=>{(o||"flex"===t||"grid"===t)&&r?.length&&r.forEach((t=>{const r=[];if(t.rules&&Object.entries(t.rules).forEach((([e,t])=>{r.push(`${e}: ${t||s}`)})),r.length){let l="";l=o?n===qr?`:where(${n} .${e})${t?.selector||""}`:`${n}-${e}${t?.selector||""}`:n===qr?`:where(.${e}${t?.selector||""})`:`:where(${n}.${e}${t?.selector||""})`,i+=`${l} { ${r.join("; ")}; }`}}))})),n===qr&&o&&(i+=`${n} { --wp--style--block-gap: ${s}; }`)),n===qr&&e){const t=["block","flex","grid"];Object.values(e).forEach((({className:e,displayMode:o,baseStyles:r})=>{o&&t.includes(o)&&(i+=`${n} .${e} { display:${o}; }`),r?.length&&r.forEach((t=>{const o=[];if(t.rules&&Object.entries(t.rules).forEach((([e,t])=>{o.push(`${e}: ${t}`)})),o.length){i+=`${`${n} .${e}${t?.selector||""}`} { ${o.join("; ")}; }`}}))}))}return i}const AM=["border","color","dimensions","spacing","typography","filter","outline","shadow"];function OM(e){if(!e)return{};const t=Object.entries(e).filter((([e])=>AM.includes(e))).map((([e,t])=>[e,JSON.parse(JSON.stringify(t))]));return Object.fromEntries(t)}const DM=(e,t)=>{var n;const o=[];if(!e?.settings)return o;const r=e=>{let t={};return Yr.forEach((({path:n})=>{const o=Wn(e,n,!1);!1!==o&&(t=jn(t,n,o))})),t},l=r(e.settings),i=e.settings?.custom;return(Object.keys(l).length>0||i)&&o.push({presets:l,custom:i,selector:qr}),Object.entries(null!==(n=e.settings?.blocks)&&void 0!==n?n:{}).forEach((([e,n])=>{const l=r(n),i=n.custom;(Object.keys(l).length>0||i)&&o.push({presets:l,custom:i,selector:t[e]?.selector})})),o},zM=(e,t)=>{const n=DM(e,t);let o="";return n.forEach((({presets:t,custom:n,selector:r})=>{const l=function(e={},t){const{kebabCase:n}=ie(_l.privateApis);return Yr.reduce(((o,{path:r,valueKey:l,valueFunc:i,cssVarInfix:s})=>{const a=Wn(e,r,[]);return["default","theme","custom"].forEach((e=>{a[e]&&a[e].forEach((e=>{l&&!i?o.push(`--wp--preset--${s}--${n(e.slug)}: ${e[l]}`):i&&"function"==typeof i&&o.push(`--wp--preset--${s}--${n(e.slug)}: ${i(e,t)}`)}))})),o}),[])}(t,e?.settings),i=PM(n,"--wp--custom--","--");i.length>0&&l.push(...i),l.length>0&&(o+=`${r}{${l.join(";")};}`)})),o},VM=(e,t,n,o,r=!1,l=!0)=>{const i=((e,t)=>{var n;const o=[];if(!e?.styles)return o;const r=OM(e.styles);return r&&o.push({styles:r,selector:qr}),Object.entries(c.__EXPERIMENTAL_ELEMENTS).forEach((([t,n])=>{e.styles?.elements?.[t]&&o.push({styles:e.styles?.elements?.[t],selector:n})})),Object.entries(null!==(n=e.styles?.blocks)&&void 0!==n?n:{}).forEach((([e,n])=>{var r;const l=OM(n);if(n?.variations){const e={};Object.keys(n.variations).forEach((t=>{e[t]=OM(n.variations[t])})),l.variations=e}l&&t?.[e]?.selector&&o.push({duotoneSelector:t[e].duotoneSelector,fallbackGapValue:t[e].fallbackGapValue,hasLayoutSupport:t[e].hasLayoutSupport,selector:t[e].selector,styles:l,featureSelectors:t[e].featureSelectors,styleVariationSelectors:t[e].styleVariationSelectors}),Object.entries(null!==(r=n?.elements)&&void 0!==r?r:{}).forEach((([n,r])=>{r&&t?.[e]&&c.__EXPERIMENTAL_ELEMENTS[n]&&o.push({styles:r,selector:t[e]?.selector.split(",").map((e=>c.__EXPERIMENTAL_ELEMENTS[n].split(",").map((t=>e+" "+t)))).join(",")})}))})),o})(e,t),s=DM(e,t),a=e?.settings?.useRootPaddingAwareAlignments,{contentSize:u,wideSize:d}=e?.settings?.layout||{};let p="body {margin: 0;";if(u&&(p+=` --wp--style--global--content-size: ${u};`),d&&(p+=` --wp--style--global--wide-size: ${d};`),a&&l&&(p+="padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }\n\t\t\t.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding:not(.wp-block-block)) { padding-right: 0; padding-left: 0; }\n\t\t\t.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }\n\t\t\t.has-global-padding :where(.has-global-padding:not(.wp-block-block)) > .alignfull { margin-right: 0; margin-left: 0; }\n\t\t\t.has-global-padding > .alignfull:where(:not(.has-global-padding):not(.is-layout-flex):not(.is-layout-grid)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;"),p+="}",i.forEach((({selector:t,duotoneSelector:i,styles:s,fallbackGapValue:c,hasLayoutSupport:u,featureSelectors:d,styleVariationSelectors:m})=>{if(d){const e=RM(d,s);Object.entries(e).forEach((([e,t])=>{if(t.length){const n=t.join(";");p+=`${e}{${n};}`}}))}if(m&&Object.entries(m).forEach((([t,n])=>{const o=s?.variations?.[t];if(o){if(d){const e=RM(d,o);Object.entries(e).forEach((([e,t])=>{if(t.length){const o=function(e,t){const n=e.split(","),o=[];return n.forEach((e=>{o.push(`${t.trim()}${e.trim()}`)})),o.join(", ")}(e,n),r=t.join(";");p+=`${o}{${r};}`}}))}const t=NM(o,n,a,e);t.length&&(p+=`${n}{${t.join(";")};}`)}})),i){const e={};s?.filter&&(e.filter=s.filter,delete s.filter);const t=NM(e);t.length&&(p+=`${i}{${t.join(";")};}`)}r||qr!==t&&!u||(p+=LM({style:s,selector:t,hasBlockGapSupport:n,hasFallbackGapSupport:o,fallbackGapValue:c}));const h=NM(s,t,a,e,l);h?.length&&(p+=`${t}{${h.join(";")};}`);const g=Object.entries(s).filter((([e])=>e.startsWith(":")));g?.length&&g.forEach((([e,n])=>{const o=NM(n);if(!o?.length)return;const r=`${t.split(",").map((t=>t+e)).join(",")}{${o.join(";")};}`;p+=r}))})),p+=".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }",p+=".wp-site-blocks > .alignright { float: right; margin-left: 2em; }",p+=".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }",n){const t=oi(e?.styles?.spacing?.blockGap)||"0.5em";p+=`:where(.wp-site-blocks) > * { margin-block-start: ${t}; margin-block-end: 0; }`,p+=":where(.wp-site-blocks) > :first-child:first-child { margin-block-start: 0; }",p+=":where(.wp-site-blocks) > :last-child:last-child { margin-block-end: 0; }"}return s.forEach((({selector:e,presets:t})=>{qr===e&&(e="");const n=function(e="*",t={}){const{kebabCase:n}=ie(_l.privateApis);return Yr.reduce(((o,{path:r,cssVarInfix:l,classes:i})=>{if(!i)return o;const s=Wn(t,r,[]);return["default","theme","custom"].forEach((t=>{s[t]&&s[t].forEach((({slug:t})=>{i.forEach((({classSuffix:r,propertyName:i})=>{const s=`.has-${n(t)}-${r}`,a=e.split(",").map((e=>`${e}${s}`)).join(","),c=`var(--wp--preset--${l}--${n(t)})`;o+=`${a}{${i}: ${c} !important;}`}))}))})),o}),"")}(e,t);n.length>0&&(p+=n)})),p};function FM(e,t){return DM(e,t).flatMap((({presets:e})=>function(e={}){return Yr.filter((e=>"duotone"===e.path.at(-1))).flatMap((t=>{const n=Wn(e,t.path,{});return["default","theme"].filter((e=>n[e])).flatMap((e=>n[e].map((e=>Um(`wp-duotone-${e.slug}`,e.colors))))).join("")}))}(e)))}const HM=(e,t)=>{const n={};return e.forEach((e=>{const o=e.name,r=$m(e);let l=$m(e,"filter.duotone");if(!l){const t=$m(e),n=(0,c.getBlockSupport)(e,"color.__experimentalDuotone",!1);l=n&&tl(t,n)}const i=!!e?.supports?.layout||!!e?.supports?.__experimentalLayout,s=e?.supports?.spacing?.blockGap?.__experimentalDefault,a=t(o),u={};a?.length&&a.forEach((e=>{const t=function(e,t){const n=`.is-style-${e}`;if(!t)return n;const o=/((?::\([^)]+\))?\s*)([^\s:]+)/,r=(e,t,o)=>t+o+n;return t.split(",").map((e=>e.replace(o,r))).join(",")}(e.name,r);u[e.name]=t}));const d=((e,t)=>{if(e?.selectors&&Object.keys(e.selectors).length>0)return e.selectors;const n={root:t};return Object.entries(TM).forEach((([t,o])=>{const r=$m(e,t);r&&(n[o]=r)})),n})(e,r);n[o]={duotoneSelector:l,fallbackGapValue:s,featureSelectors:Object.keys(d).length?d:void 0,hasLayoutSupport:i,name:o,selector:r,styleVariationSelectors:Object.keys(u).length?u:void 0}})),n};function GM(e,t){let n="";return e.split("&").forEach((e=>{if(!e.includes("{"))n+=`${t}{${e.trim()}}`;else{const o=e.replace("}","").split("{");if(2!==o.length)return;const[r,l]=o,i=r.startsWith(" ")?tl(t,r):function(e,t){return e.includes(",")?e.split(",").map((e=>e+t)).join(","):e+t}(t,r);n+=`${i}{${l.trim()}}`}})),n}function UM(e={}){const[t]=sl("spacing.blockGap"),n=null!==t,o=!n,r=(0,d.useSelect)((e=>{const{getSettings:t}=e(Nr);return!!t().disableLayoutStyles})),l=(0,u.useContext)(bf),i=void 0!==l?.templateSlug,{getBlockStyles:s}=(0,d.useSelect)(c.store);return(0,u.useMemo)((()=>{var t;if(!e?.styles||!e?.settings)return[];const l=(a=e,a.styles?.blocks?.["core/separator"]&&a.styles?.blocks?.["core/separator"].color?.background&&!a.styles?.blocks?.["core/separator"].color?.text&&!a.styles?.blocks?.["core/separator"].border?.color?{...a,styles:{...a.styles,blocks:{...a.styles.blocks,"core/separator":{...a.styles.blocks["core/separator"],color:{...a.styles.blocks["core/separator"].color,text:a.styles?.blocks["core/separator"].color.background}}}}}:a);var a;const u=HM((0,c.getBlockTypes)(),s),d=zM(l,u),p=VM(l,u,n,o,r,i),m=FM(l,u),h=[{css:d,isGlobalStyles:!0},{css:p,isGlobalStyles:!0},{css:null!==(t=l.styles.css)&&void 0!==t?t:"",isGlobalStyles:!0},{assets:m,__unstableType:"svg",isGlobalStyles:!0}];return(0,c.getBlockTypes)().forEach((e=>{if(l.styles.blocks[e.name]?.css){const t=u[e.name].selector;h.push({css:GM(l.styles.blocks[e.name]?.css,t),isGlobalStyles:!0})}})),[h,l.settings]}),[n,o,e,r,i,s])}function $M(){const{merged:e}=(0,u.useContext)(ol);return UM(e)}function jM(e,t,n){return"core/image"===e&&n?.lightbox?.allowEditing||!!t?.lightbox}function WM({onChange:e,value:t,inheritedValue:n,panelId:o}){const r=()=>{e(void 0)};let l=!1;return n?.lightbox?.enabled&&(l=n.lightbox.enabled),(0,s.createElement)(s.Fragment,null,(0,s.createElement)(_l.__experimentalToolsPanel,{label:(0,x._x)("Settings","Image settings"),resetAll:r,panelId:o,dropdownMenuProps:Qr},(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:()=>!!t?.lightbox,label:(0,x.__)("Expand on click"),onDeselect:r,isShownByDefault:!0,panelId:o},(0,s.createElement)(_l.ToggleControl,{label:(0,x.__)("Expand on click"),checked:l,onChange:t=>{e({enabled:t})}}))))}function KM({value:e,onChange:t,inheritedValue:n=e}){const[o,r]=(0,u.useState)(null),l=n?.css;return(0,s.createElement)(_l.__experimentalVStack,{spacing:3},o&&(0,s.createElement)(_l.Notice,{status:"error",onRemove:()=>r(null)},o),(0,s.createElement)(_l.TextareaControl,{label:(0,x.__)("Additional CSS"),__nextHasNoMarginBottom:!0,value:l,onChange:n=>function(n){if(t({...e,css:n}),o){const[e]=yy([{css:n}],".editor-styles-wrapper");e&&r(null)}}(n),onBlur:function(e){if(!e?.target?.value)return void r(null);const[t]=yy([{css:e.target.value}],".editor-styles-wrapper");r(null===t?(0,x.__)("There is an error with your CSS structure."):null)},className:"block-editor-global-styles-advanced-panel__custom-css-input",spellCheck:!1}))}const ZM=new Map,qM=[],YM={caption:(0,x.__)("Caption"),link:(0,x.__)("Link"),button:(0,x.__)("Button"),heading:(0,x.__)("Heading"),h1:(0,x.__)("H1"),h2:(0,x.__)("H2"),h3:(0,x.__)("H3"),h4:(0,x.__)("H4"),h5:(0,x.__)("H5"),h6:(0,x.__)("H6"),"settings.color":(0,x.__)("Color"),"settings.typography":(0,x.__)("Typography"),"styles.color":(0,x.__)("Colors"),"styles.spacing":(0,x.__)("Spacing"),"styles.typography":(0,x.__)("Typography")},XM=function(e,t){var n,o,r=0;function l(){var l,i,s=n,a=arguments.length;e:for(;s;){if(s.args.length===arguments.length){for(i=0;i<a;i++)if(s.args[i]!==arguments[i]){s=s.next;continue e}return s!==n&&(s===o&&(o=s.prev),s.prev.next=s.next,s.next&&(s.next.prev=s.prev),s.next=n,s.prev=null,n.prev=s,n=s),s.val}s=s.next}for(l=new Array(a),i=0;i<a;i++)l[i]=arguments[i];return s={args:l,val:e.apply(null,l)},n?(n.prev=s,s.next=n):o=s,r===t.maxSize?(o=o.prev).next=null:r++,n=s,s.val}return t=t||{},l.clear=function(){n=null,o=null,r=0},l}((()=>(0,c.getBlockTypes)().reduce(((e,{name:t,title:n})=>(e[t]=n,e)),{}))),QM=e=>null!==e&&"object"==typeof e;function JM(e,t,n=""){if(!QM(e)&&!QM(t))return e!==t?n.split(".").slice(0,2).join("."):void 0;e=QM(e)?e:{},t=QM(t)?t:{};const o=new Set([...Object.keys(e),...Object.keys(t)]);let r=[];for(const l of o){const o=n?n+"."+l:l,i=JM(e[l],t[l],o);i&&(r=r.concat(i))}return r}function eP(e,t){const n=JSON.stringify({next:e,previous:t});if(ZM.has(n))return ZM.get(n);const o=JM({styles:{color:e?.styles?.color,typography:e?.styles?.typography,spacing:e?.styles?.spacing},blocks:e?.styles?.blocks,elements:e?.styles?.elements,settings:e?.settings},{styles:{color:t?.styles?.color,typography:t?.styles?.typography,spacing:t?.styles?.spacing},blocks:t?.styles?.blocks,elements:t?.styles?.elements,settings:t?.settings});if(!o.length)return ZM.set(n,qM),qM;const r=[...new Set(o)].reduce(((e,t)=>{const n=function(e){if(YM[e])return YM[e];const t=e.split(".");if("blocks"===t?.[0]){const e=XM()?.[t[1]];return e||t[1]}return"elements"===t?.[0]?YM[t[1]]||t[1]:void 0}(t);return n&&e.push([t.split(".")[0],n]),e}),[]);return ZM.set(n,r),r}function tP(e,t,n={}){let o=eP(e,t);const r=o.length,{maxResults:l}=n;return r?(l&&r>l&&(o=o.slice(0,l)),Object.entries(o.reduce(((e,t)=>{const n=e[t[0]]||[];return n.includes(t[1])||(e[t[0]]=[...n,t[1]]),e}),{})).map((([e,t])=>{const n=t.length,o=t.join((0,x.__)(", "));switch(e){case"blocks":return(0,x.sprintf)((0,x._n)("%s block.","%s blocks.",n),o);case"elements":return(0,x.sprintf)((0,x._n)("%s element.","%s elements.",n),o);case"settings":return(0,x.sprintf)((0,x.__)("%s settings."),o);case"styles":return(0,x.sprintf)((0,x.__)("%s styles."),o);default:return(0,x.sprintf)((0,x.__)("%s."),o)}}))):qM}function nP(e,t,n){if(null==e||!1===e)return;if(Array.isArray(e))return oP(e,t,n);switch(typeof e){case"string":case"number":return}const{type:o,props:r}=e;switch(o){case u.StrictMode:case u.Fragment:return oP(r.children,t,n);case u.RawHTML:return;case Gw.Content:return rP(t,n);case VI:return void t.push(r.value)}switch(typeof o){case"string":return void 0!==r.children?oP(r.children,t,n):void 0;case"function":return nP(o.prototype&&"function"==typeof o.prototype.render?new o(r).render():o(r),t,n)}}function oP(e,...t){e=Array.isArray(e)?e:[e];for(let n=0;n<e.length;n++)nP(e[n],...t)}function rP(e,t){for(let n=0;n<t.length;n++){const{name:o,attributes:r,innerBlocks:l}=t[n];nP((0,c.getSaveElement)(o,r,(0,s.createElement)(Gw.Content,null)),e,l)}}const lP=[{value:"fill",label:(0,x._x)("Fill","Scale option for dimensions control"),help:(0,x.__)("Fill the space by stretching the content.")},{value:"contain",label:(0,x._x)("Contain","Scale option for dimensions control"),help:(0,x.__)("Fit the content to the space without clipping.")},{value:"cover",label:(0,x._x)("Cover","Scale option for dimensions control"),help:(0,x.__)("Fill the space by clipping what doesn't fit.")},{value:"none",label:(0,x._x)("None","Scale option for dimensions control"),help:(0,x.__)("Do not adjust the sizing of the content. Content that is too large will be clipped, and content that is too small will have additional padding.")},{value:"scale-down",label:(0,x._x)("Scale down","Scale option for dimensions control"),help:(0,x.__)("Scale down the content to fit the space if it is too big. Content that is too small will have additional padding.")}];function iP({panelId:e,value:t,onChange:n,options:o=lP,defaultValue:r=lP[0].value,isShownByDefault:l=!0}){const i=null!=t?t:"fill",a=(0,u.useMemo)((()=>o.reduce(((e,t)=>(e[t.value]=t.help,e)),{})),[o]);return(0,s.createElement)(_l.__experimentalToolsPanelItem,{label:(0,x.__)("Scale"),isShownByDefault:l,hasValue:()=>i!==r,onDeselect:()=>n(r),panelId:e},(0,s.createElement)(_l.__experimentalToggleGroupControl,{label:(0,x.__)("Scale"),isBlock:!0,help:a[i],value:i,onChange:n,size:"__unstable-large"},o.map((e=>(0,s.createElement)(_l.__experimentalToggleGroupControlOption,{key:e.value,...e})))))}function sP(){return sP=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},sP.apply(this,arguments)}function aP(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var cP=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,uP=aP((function(e){return cP.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}));var dP=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(t);try{n.insertRule(e,n.cssRules.length)}catch(e){0}}else t.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach((function(e){return e.parentNode&&e.parentNode.removeChild(e)})),this.tags=[],this.ctr=0},e}(),pP=Math.abs,mP=String.fromCharCode,hP=Object.assign;function gP(e){return e.trim()}function fP(e,t,n){return e.replace(t,n)}function bP(e,t){return e.indexOf(t)}function vP(e,t){return 0|e.charCodeAt(t)}function kP(e,t,n){return e.slice(t,n)}function _P(e){return e.length}function yP(e){return e.length}function EP(e,t){return t.push(e),e}var wP=1,SP=1,CP=0,xP=0,BP=0,IP="";function TP(e,t,n,o,r,l,i){return{value:e,root:t,parent:n,type:o,props:r,children:l,line:wP,column:SP,length:i,return:""}}function MP(e,t){return hP(TP("",null,null,"",null,null,0),e,{length:-e.length},t)}function PP(){return BP=xP>0?vP(IP,--xP):0,SP--,10===BP&&(SP=1,wP--),BP}function RP(){return BP=xP<CP?vP(IP,xP++):0,SP++,10===BP&&(SP=1,wP++),BP}function NP(){return vP(IP,xP)}function LP(){return xP}function AP(e,t){return kP(IP,e,t)}function OP(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function DP(e){return wP=SP=1,CP=_P(IP=e),xP=0,[]}function zP(e){return IP="",e}function VP(e){return gP(AP(xP-1,GP(91===e?e+2:40===e?e+1:e)))}function FP(e){for(;(BP=NP())&&BP<33;)RP();return OP(e)>2||OP(BP)>3?"":" "}function HP(e,t){for(;--t&&RP()&&!(BP<48||BP>102||BP>57&&BP<65||BP>70&&BP<97););return AP(e,LP()+(t<6&&32==NP()&&32==RP()))}function GP(e){for(;RP();)switch(BP){case e:return xP;case 34:case 39:34!==e&&39!==e&&GP(BP);break;case 40:41===e&&GP(e);break;case 92:RP()}return xP}function UP(e,t){for(;RP()&&e+BP!==57&&(e+BP!==84||47!==NP()););return"/*"+AP(t,xP-1)+"*"+mP(47===e?e:RP())}function $P(e){for(;!OP(NP());)RP();return AP(e,xP)}var jP="-ms-",WP="-moz-",KP="-webkit-",ZP="comm",qP="rule",YP="decl",XP="@keyframes";function QP(e,t){for(var n="",o=yP(e),r=0;r<o;r++)n+=t(e[r],r,e,t)||"";return n}function JP(e,t,n,o){switch(e.type){case"@import":case YP:return e.return=e.return||e.value;case ZP:return"";case XP:return e.return=e.value+"{"+QP(e.children,o)+"}";case qP:e.value=e.props.join(",")}return _P(n=QP(e.children,o))?e.return=e.value+"{"+n+"}":""}function eR(e){return zP(tR("",null,null,null,[""],e=DP(e),0,[0],e))}function tR(e,t,n,o,r,l,i,s,a){for(var c=0,u=0,d=i,p=0,m=0,h=0,g=1,f=1,b=1,v=0,k="",_=r,y=l,E=o,w=k;f;)switch(h=v,v=RP()){case 40:if(108!=h&&58==vP(w,d-1)){-1!=bP(w+=fP(VP(v),"&","&\f"),"&\f")&&(b=-1);break}case 34:case 39:case 91:w+=VP(v);break;case 9:case 10:case 13:case 32:w+=FP(h);break;case 92:w+=HP(LP()-1,7);continue;case 47:switch(NP()){case 42:case 47:EP(oR(UP(RP(),LP()),t,n),a);break;default:w+="/"}break;case 123*g:s[c++]=_P(w)*b;case 125*g:case 59:case 0:switch(v){case 0:case 125:f=0;case 59+u:m>0&&_P(w)-d&&EP(m>32?rR(w+";",o,n,d-1):rR(fP(w," ","")+";",o,n,d-2),a);break;case 59:w+=";";default:if(EP(E=nR(w,t,n,c,u,r,s,k,_=[],y=[],d),l),123===v)if(0===u)tR(w,t,E,E,_,l,d,s,y);else switch(99===p&&110===vP(w,3)?100:p){case 100:case 109:case 115:tR(e,E,E,o&&EP(nR(e,E,E,0,0,r,s,k,r,_=[],d),y),r,y,d,s,o?_:y);break;default:tR(w,E,E,E,[""],y,0,s,y)}}c=u=m=0,g=b=1,k=w="",d=i;break;case 58:d=1+_P(w),m=h;default:if(g<1)if(123==v)--g;else if(125==v&&0==g++&&125==PP())continue;switch(w+=mP(v),v*g){case 38:b=u>0?1:(w+="\f",-1);break;case 44:s[c++]=(_P(w)-1)*b,b=1;break;case 64:45===NP()&&(w+=VP(RP())),p=NP(),u=d=_P(k=w+=$P(LP())),v++;break;case 45:45===h&&2==_P(w)&&(g=0)}}return l}function nR(e,t,n,o,r,l,i,s,a,c,u){for(var d=r-1,p=0===r?l:[""],m=yP(p),h=0,g=0,f=0;h<o;++h)for(var b=0,v=kP(e,d+1,d=pP(g=i[h])),k=e;b<m;++b)(k=gP(g>0?p[b]+" "+v:fP(v,/&\f/g,p[b])))&&(a[f++]=k);return TP(e,t,n,0===r?qP:s,a,c,u)}function oR(e,t,n){return TP(e,t,n,ZP,mP(BP),kP(e,2,-2),0)}function rR(e,t,n,o){return TP(e,t,n,YP,kP(e,0,o),kP(e,o+1,-1),o)}var lR=function(e,t,n){for(var o=0,r=0;o=r,r=NP(),38===o&&12===r&&(t[n]=1),!OP(r);)RP();return AP(e,xP)},iR=function(e,t){return zP(function(e,t){var n=-1,o=44;do{switch(OP(o)){case 0:38===o&&12===NP()&&(t[n]=1),e[n]+=lR(xP-1,t,n);break;case 2:e[n]+=VP(o);break;case 4:if(44===o){e[++n]=58===NP()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=mP(o)}}while(o=RP());return e}(DP(e),t))},sR=new WeakMap,aR=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,o=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||sR.get(n))&&!o){sR.set(e,!0);for(var r=[],l=iR(t,r),i=n.props,s=0,a=0;s<l.length;s++)for(var c=0;c<i.length;c++,a++)e.props[a]=r[s]?l[s].replace(/&\f/g,i[c]):i[c]+" "+l[s]}}},cR=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function uR(e,t){switch(function(e,t){return 45^vP(e,0)?(((t<<2^vP(e,0))<<2^vP(e,1))<<2^vP(e,2))<<2^vP(e,3):0}(e,t)){case 5103:return KP+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return KP+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return KP+e+WP+e+jP+e+e;case 6828:case 4268:return KP+e+jP+e+e;case 6165:return KP+e+jP+"flex-"+e+e;case 5187:return KP+e+fP(e,/(\w+).+(:[^]+)/,KP+"box-$1$2"+jP+"flex-$1$2")+e;case 5443:return KP+e+jP+"flex-item-"+fP(e,/flex-|-self/,"")+e;case 4675:return KP+e+jP+"flex-line-pack"+fP(e,/align-content|flex-|-self/,"")+e;case 5548:return KP+e+jP+fP(e,"shrink","negative")+e;case 5292:return KP+e+jP+fP(e,"basis","preferred-size")+e;case 6060:return KP+"box-"+fP(e,"-grow","")+KP+e+jP+fP(e,"grow","positive")+e;case 4554:return KP+fP(e,/([^-])(transform)/g,"$1"+KP+"$2")+e;case 6187:return fP(fP(fP(e,/(zoom-|grab)/,KP+"$1"),/(image-set)/,KP+"$1"),e,"")+e;case 5495:case 3959:return fP(e,/(image-set\([^]*)/,KP+"$1$`$1");case 4968:return fP(fP(e,/(.+:)(flex-)?(.*)/,KP+"box-pack:$3"+jP+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+KP+e+e;case 4095:case 3583:case 4068:case 2532:return fP(e,/(.+)-inline(.+)/,KP+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(_P(e)-1-t>6)switch(vP(e,t+1)){case 109:if(45!==vP(e,t+4))break;case 102:return fP(e,/(.+:)(.+)-([^]+)/,"$1"+KP+"$2-$3$1"+WP+(108==vP(e,t+3)?"$3":"$2-$3"))+e;case 115:return~bP(e,"stretch")?uR(fP(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==vP(e,t+1))break;case 6444:switch(vP(e,_P(e)-3-(~bP(e,"!important")&&10))){case 107:return fP(e,":",":"+KP)+e;case 101:return fP(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+KP+(45===vP(e,14)?"inline-":"")+"box$3$1"+KP+"$2$3$1"+jP+"$2box$3")+e}break;case 5936:switch(vP(e,t+11)){case 114:return KP+e+jP+fP(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return KP+e+jP+fP(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return KP+e+jP+fP(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return KP+e+jP+e+e}return e}var dR=[function(e,t,n,o){if(e.length>-1&&!e.return)switch(e.type){case YP:e.return=uR(e.value,e.length);break;case XP:return QP([MP(e,{value:fP(e.value,"@","@"+KP)})],o);case qP:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=t.exec(e))?e[0]:e}(t,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return QP([MP(e,{props:[fP(t,/:(read-\w+)/,":-moz-$1")]})],o);case"::placeholder":return QP([MP(e,{props:[fP(t,/:(plac\w+)/,":"+KP+"input-$1")]}),MP(e,{props:[fP(t,/:(plac\w+)/,":-moz-$1")]}),MP(e,{props:[fP(t,/:(plac\w+)/,jP+"input-$1")]})],o)}return""}))}}];const pR=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var o=e.stylisPlugins||dR;var r,l,i={},s=[];r=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)i[t[n]]=!0;s.push(e)}));var a,c,u,d,p=[JP,(d=function(e){a.insert(e)},function(e){e.root||(e=e.return)&&d(e)})],m=(c=[aR,cR].concat(o,p),u=yP(c),function(e,t,n,o){for(var r="",l=0;l<u;l++)r+=c[l](e,t,n,o)||"";return r});l=function(e,t,n,o){a=n,function(e){QP(eR(e),m)}(e?e+"{"+t.styles+"}":t.styles),o&&(h.inserted[t.name]=!0)};var h={key:t,sheet:new dP({key:t,container:r,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:i,registered:{},insert:l};return h.sheet.hydrate(s),h};const mR=function(e){for(var t,n=0,o=0,r=e.length;r>=4;++o,r-=4)t=1540483477*(65535&(t=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)};const hR={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function gR(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var fR=/[A-Z]|^ms/g,bR=/_EMO_([^_]+?)_([^]*?)_EMO_/g,vR=function(e){return 45===e.charCodeAt(1)},kR=function(e){return null!=e&&"boolean"!=typeof e},_R=gR((function(e){return vR(e)?e:e.replace(fR,"-$&").toLowerCase()})),yR=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(bR,(function(e,t,n){return wR={name:t,styles:n,next:wR},t}))}return 1===hR[e]||vR(e)||"number"!=typeof t||0===t?t:t+"px"};function ER(e,t,n){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return wR={name:n.name,styles:n.styles,next:wR},n.name;if(void 0!==n.styles){var o=n.next;if(void 0!==o)for(;void 0!==o;)wR={name:o.name,styles:o.styles,next:wR},o=o.next;return n.styles+";"}return function(e,t,n){var o="";if(Array.isArray(n))for(var r=0;r<n.length;r++)o+=ER(e,t,n[r])+";";else for(var l in n){var i=n[l];if("object"!=typeof i)null!=t&&void 0!==t[i]?o+=l+"{"+t[i]+"}":kR(i)&&(o+=_R(l)+":"+yR(l,i)+";");else if(!Array.isArray(i)||"string"!=typeof i[0]||null!=t&&void 0!==t[i[0]]){var s=ER(e,t,i);switch(l){case"animation":case"animationName":o+=_R(l)+":"+s+";";break;default:o+=l+"{"+s+"}"}}else for(var a=0;a<i.length;a++)kR(i[a])&&(o+=_R(l)+":"+yR(l,i[a])+";")}return o}(e,t,n);case"function":if(void 0!==e){var r=wR,l=n(e);return wR=r,ER(e,t,l)}}if(null==t)return n;var i=t[n];return void 0!==i?i:n}var wR,SR=/label:\s*([^\s;\n{]+)\s*(;|$)/g;var CR=!!s.useInsertionEffect&&s.useInsertionEffect,xR=CR||function(e){return e()},BR=(0,s.createContext)("undefined"!=typeof HTMLElement?pR({key:"css"}):null);BR.Provider;var IR=function(e){return(0,s.forwardRef)((function(t,n){var o=(0,s.useContext)(BR);return e(t,o,n)}))},TR=(0,s.createContext)({});var MR=function(e,t,n){var o=e.key+"-"+t.name;!1===n&&void 0===e.registered[o]&&(e.registered[o]=t.styles)},PR=uP,RR=function(e){return"theme"!==e},NR=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?PR:RR},LR=function(e,t,n){var o;if(t){var r=t.shouldForwardProp;o=e.__emotion_forwardProp&&r?function(t){return e.__emotion_forwardProp(t)&&r(t)}:r}return"function"!=typeof o&&n&&(o=e.__emotion_forwardProp),o},AR=function(e){var t=e.cache,n=e.serialized,o=e.isStringTag;MR(t,n,o);xR((function(){return function(e,t,n){MR(e,t,n);var o=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var r=t;do{e.insert(t===r?"."+o:"",r,e.sheet,!0),r=r.next}while(void 0!==r)}}(t,n,o)}));return null};const OR=function e(t,n){var o,r,l=t.__emotion_real===t,i=l&&t.__emotion_base||t;void 0!==n&&(o=n.label,r=n.target);var a=LR(t,n,l),c=a||NR(i),u=!c("as");return function(){var d=arguments,p=l&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==o&&p.push("label:"+o+";"),null==d[0]||void 0===d[0].raw)p.push.apply(p,d);else{0,p.push(d[0][0]);for(var m=d.length,h=1;h<m;h++)p.push(d[h],d[0][h])}var g=IR((function(e,t,n){var o=u&&e.as||i,l="",d=[],m=e;if(null==e.theme){for(var h in m={},e)m[h]=e[h];m.theme=(0,s.useContext)(TR)}"string"==typeof e.className?l=function(e,t,n){var o="";return n.split(" ").forEach((function(n){void 0!==e[n]?t.push(e[n]+";"):o+=n+" "})),o}(t.registered,d,e.className):null!=e.className&&(l=e.className+" ");var g=function(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var o=!0,r="";wR=void 0;var l=e[0];null==l||void 0===l.raw?(o=!1,r+=ER(n,t,l)):r+=l[0];for(var i=1;i<e.length;i++)r+=ER(n,t,e[i]),o&&(r+=l[i]);SR.lastIndex=0;for(var s,a="";null!==(s=SR.exec(r));)a+="-"+s[1];return{name:mR(r)+a,styles:r,next:wR}}(p.concat(d),t.registered,m);l+=t.key+"-"+g.name,void 0!==r&&(l+=" "+r);var f=u&&void 0===a?NR(o):c,b={};for(var v in e)u&&"as"===v||f(v)&&(b[v]=e[v]);return b.className=l,b.ref=n,(0,s.createElement)(s.Fragment,null,(0,s.createElement)(AR,{cache:t,serialized:g,isStringTag:"string"==typeof o}),(0,s.createElement)(o,b))}));return g.displayName=void 0!==o?o:"Styled("+("string"==typeof i?i:i.displayName||i.name||"Component")+")",g.defaultProps=t.defaultProps,g.__emotion_real=g,g.__emotion_base=i,g.__emotion_styles=p,g.__emotion_forwardProp=a,Object.defineProperty(g,"toString",{value:function(){return"."+r}}),g.withComponent=function(t,o){return e(t,sP({},n,o,{shouldForwardProp:LR(g,o,!0)})).apply(void 0,p)},g}};const DR=OR(_l.__experimentalToolsPanelItem,{target:"ef8pe3d0"})({name:"957xgf",styles:"grid-column:span 1"});function zR({panelId:e,value:t={},onChange:n=(()=>{}),units:o,isShownByDefault:r=!0}){var l,i;const a="auto"===t.width?"":null!==(l=t.width)&&void 0!==l?l:"",c="auto"===t.height?"":null!==(i=t.height)&&void 0!==i?i:"",u=e=>o=>{const r={...t};o?r[e]=o:delete r[e],n(r)};return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(DR,{label:(0,x.__)("Width"),isShownByDefault:r,hasValue:()=>""!==a,onDeselect:u("width"),panelId:e},(0,s.createElement)(_l.__experimentalUnitControl,{label:(0,x.__)("Width"),placeholder:(0,x.__)("Auto"),labelPosition:"top",units:o,min:0,value:a,onChange:u("width"),size:"__unstable-large"})),(0,s.createElement)(DR,{label:(0,x.__)("Height"),isShownByDefault:r,hasValue:()=>""!==c,onDeselect:u("height"),panelId:e},(0,s.createElement)(_l.__experimentalUnitControl,{label:(0,x.__)("Height"),placeholder:(0,x.__)("Auto"),labelPosition:"top",units:o,min:0,value:c,onChange:u("height"),size:"__unstable-large"})))}const VR=function({panelId:e,value:t={},onChange:n=(()=>{}),aspectRatioOptions:o,defaultAspectRatio:r="auto",scaleOptions:l,defaultScale:i="fill",unitsOptions:a}){const c=void 0===t.width||"auto"===t.width?null:t.width,d=void 0===t.height||"auto"===t.height?null:t.height,p=void 0===t.aspectRatio||"auto"===t.aspectRatio?null:t.aspectRatio,m=void 0===t.scale||"fill"===t.scale?null:t.scale,[h,g]=(0,u.useState)(m),[f,b]=(0,u.useState)(p),v=c&&d?"custom":f,k=p||c&&d;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Qp,{panelId:e,options:o,defaultValue:r,value:v,onChange:e=>{const o={...t};b(e="auto"===e?null:e),e?o.aspectRatio=e:delete o.aspectRatio,e?h?o.scale=h:(o.scale=i,g(i)):delete o.scale,"custom"!==e&&c&&d&&delete o.height,n(o)}}),(0,s.createElement)(zR,{panelId:e,units:a,value:{width:c,height:d},onChange:({width:e,height:o})=>{const r={...t};o="auto"===o?null:o,(e="auto"===e?null:e)?r.width=e:delete r.width,o?r.height=o:delete r.height,e&&o?delete r.aspectRatio:f&&(r.aspectRatio=f),f||!!e==!!o?h?r.scale=h:(r.scale=i,g(i)):delete r.scale,n(r)}}),k&&(0,s.createElement)(iP,{panelId:e,options:l,defaultValue:i,value:h,onChange:e=>{const o={...t};g(e="fill"===e?null:e),e?o.scale=e:delete o.scale,n(o)}}))},FR=[{label:(0,x._x)("Thumbnail","Image size option for resolution control"),value:"thumbnail"},{label:(0,x._x)("Medium","Image size option for resolution control"),value:"medium"},{label:(0,x._x)("Large","Image size option for resolution control"),value:"large"},{label:(0,x._x)("Full Size","Image size option for resolution control"),value:"full"}];const HR={};le(HR,{...i,ExperimentalBlockCanvas:jC,ExperimentalBlockEditorProvider:z_,getDuotoneFilter:Um,getRichTextValues:function(e=[]){c.__unstableGetBlockProps.skipFilters=!0;const t=[];return rP(t,e),c.__unstableGetBlockProps.skipFilters=!1,t.map((e=>e instanceof Y.RichTextData?e:Y.RichTextData.fromHTMLString(e)))},PrivateInserter:rw,PrivateQuickInserter:tw,PrivateListView:Tx,ResizableBoxPopover:function({clientId:e,resizableBoxProps:t,...n}){return(0,s.createElement)(fm,{clientId:e,__unstableCoverTarget:!0,__unstablePopoverSlot:"__unstable-block-tools-after",shift:!1,...n},(0,s.createElement)(_l.ResizableBox,{...t}))},BlockInfo:$T,useCanBlockToolbarBeFocused:function(){return(0,d.useSelect)((e=>{const{__unstableGetEditorMode:t,getBlock:n,getSettings:o,getSelectedBlockClientId:r,getFirstMultiSelectedBlockClientId:l}=ie(e(Nr)),i=l()||r(),s=(0,c.isUnmodifiedDefaultBlock)(n(i)||{});return!!i&&(o().hasFixedToolbar||"edit"===t()&&!s)}),[])},cleanEmptyObject:hl,useStyleOverride:bl,BlockQuickNavigation:jT,LayoutStyle:function({layout:e={},css:t,...n}){const o=Vi(e.type),[r]=Ar("spacing.blockGap"),l=null!==r;if(o){if(t)return(0,s.createElement)("style",null,t);const r=o.getLayoutStyle?.({hasBlockGapSupport:l,layout:e,...n});if(r)return(0,s.createElement)("style",null,r)}return null},BlockRemovalWarningModal:function({rules:e}){const{clientIds:t,selectPrevious:n,blockNamesForPrompt:o,messageType:r}=(0,d.useSelect)((e=>ie(e(Nr)).getRemovalPromptData())),{clearBlockRemovalPrompt:l,setBlockRemovalRules:i,privateRemoveBlocks:a}=ie((0,d.useDispatch)(Nr));if((0,u.useEffect)((()=>(i(e),()=>{i()})),[e,i]),!o)return;const c="templates"===r?(0,x._n)("Deleting this block will stop your post or page content from displaying on this template. It is not recommended.","Deleting these blocks will stop your post or page content from displaying on this template. It is not recommended.",o.length):(0,x._n)("Deleting this block could break patterns on your site that have content linked to it. Are you sure you want to delete it?","Deleting these blocks could break patterns on your site that have content linked to them. Are you sure you want to delete them?",o.length);return(0,s.createElement)(_l.Modal,{title:(0,x.__)("Be careful!"),onRequestClose:l,size:"medium"},(0,s.createElement)("p",null,c),(0,s.createElement)(_l.__experimentalHStack,{justify:"right"},(0,s.createElement)(_l.Button,{variant:"tertiary",onClick:l},(0,x.__)("Cancel")),(0,s.createElement)(_l.Button,{variant:"primary",onClick:()=>{a(t,n,!0),l()}},(0,x.__)("Delete"))))},useLayoutClasses:yh,useLayoutStyles:function(e={},t,n){const{layout:o={},style:r={}}=e,l=o?.inherit||o?.contentSize||o?.wideSize?{...o,type:"constrained"}:o||{},i=Vi(l?.type||"default"),[s]=Ar("spacing.blockGap"),a=null!==s,c=i?.getLayoutStyle?.({blockName:t,selector:n,layout:o,style:r,hasBlockGapSupport:a});return c},DimensionsTool:VR,ResolutionTool:function({panelId:e,value:t,onChange:n,options:o=FR,defaultValue:r=FR[0].value,isShownByDefault:l=!0}){const i=null!=t?t:r;return(0,s.createElement)(_l.__experimentalToolsPanelItem,{hasValue:()=>i!==r,label:(0,x.__)("Resolution"),onDeselect:()=>n(r),isShownByDefault:l,panelId:e},(0,s.createElement)(_l.SelectControl,{label:(0,x.__)("Resolution"),value:i,options:o,onChange:n,help:(0,x.__)("Select the size of the source image."),size:"__unstable-large"}))},ReusableBlocksRenameHint:CM,useReusableBlocksRenameHint:function(){return(0,d.useSelect)((e=>{var t;return null===(t=e(Ws.store).get("core",SM))||void 0===t||t}),[])},usesContextKey:OI,useFlashEditableBlocks:__,selectBlockPatternsKey:X,requiresWrapperOnCopy:ny,PrivateRichText:$I})})(),(window.wp=window.wp||{}).blockEditor=o})();/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 2321:
/***/ ((module) => {
/**
* Checks if the block is experimental based on the metadata loaded
* from block.json.
*
* This function is in a separate file and uses the older JS syntax so
* that it can be imported in both:
* – block-library/src/index.js
* – block-library/src/babel-plugin.js
*
* @param {Object} metadata Parsed block.json metadata.
* @return {boolean} Is the block experimental?
*/
module.exports = function isBlockMetadataExperimental(metadata) {
return metadata && '__experimental' in metadata && metadata.__experimental !== false;
};
/***/ }),
/***/ 1668:
/***/ ((module, exports) => {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var classNames = (function () {
// don't inherit from Object so we can skip hasOwnProperty check later
// http://stackoverflow.com/questions/15518328/creating-js-object-with-object-createnull#answer-21079232
function StorageObject() {}
StorageObject.prototype = Object.create(null);
function _parseArray (resultSet, array) {
var length = array.length;
for (var i = 0; i < length; ++i) {
_parse(resultSet, array[i]);
}
}
var hasOwn = {}.hasOwnProperty;
function _parseNumber (resultSet, num) {
resultSet[num] = true;
}
function _parseObject (resultSet, object) {
if (object.toString !== Object.prototype.toString && !object.toString.toString().includes('[native code]')) {
resultSet[object.toString()] = true;
return;
}
for (var k in object) {
if (hasOwn.call(object, k)) {
// set value to false instead of deleting it to avoid changing object structure
// https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/#de-referencing-misconceptions
resultSet[k] = !!object[k];
}
}
}
var SPACE = /\s+/;
function _parseString (resultSet, str) {
var array = str.split(SPACE);
var length = array.length;
for (var i = 0; i < length; ++i) {
resultSet[array[i]] = true;
}
}
function _parse (resultSet, arg) {
if (!arg) return;
var argType = typeof arg;
// 'foo bar'
if (argType === 'string') {
_parseString(resultSet, arg);
// ['foo', 'bar', ...]
} else if (Array.isArray(arg)) {
_parseArray(resultSet, arg);
// { 'foo': true, ... }
} else if (argType === 'object') {
_parseObject(resultSet, arg);
// '130'
} else if (argType === 'number') {
_parseNumber(resultSet, arg);
}
}
function _classNames () {
// don't leak arguments
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
var len = arguments.length;
var args = Array(len);
for (var i = 0; i < len; i++) {
args[i] = arguments[i];
}
var classSet = new StorageObject();
_parseArray(classSet, args);
var list = [];
for (var k in classSet) {
if (classSet[k]) {
list.push(k)
}
}
return list.join(' ');
}
return _classNames;
})();
if ( true && module.exports) {
classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}());
/***/ }),
/***/ 5755:
/***/ ((module, exports) => {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
var nativeCodeString = '[native code]';
function classNames() {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
if (arg.length) {
var inner = classNames.apply(null, arg);
if (inner) {
classes.push(inner);
}
}
} else if (argType === 'object') {
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
classes.push(arg.toString());
continue;
}
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if ( true && module.exports) {
classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}());
/***/ }),
/***/ 7734:
/***/ ((module) => {
"use strict";
// do not edit .js files directly - edit src/index.jst
var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
module.exports = function equal(a, b) {
if (a === b) return true;
if (a && b && typeof a == 'object' && typeof b == 'object') {
if (a.constructor !== b.constructor) return false;
var length, i, keys;
if (Array.isArray(a)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (!equal(a[i], b[i])) return false;
return true;
}
if ((a instanceof Map) && (b instanceof Map)) {
if (a.size !== b.size) return false;
for (i of a.entries())
if (!b.has(i[0])) return false;
for (i of a.entries())
if (!equal(i[1], b.get(i[0]))) return false;
return true;
}
if ((a instanceof Set) && (b instanceof Set)) {
if (a.size !== b.size) return false;
for (i of a.entries())
if (!b.has(i[0])) return false;
return true;
}
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (a[i] !== b[i]) return false;
return true;
}
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) return false;
for (i = length; i-- !== 0;)
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
for (i = length; i-- !== 0;) {
var key = keys[i];
if (!equal(a[key], b[key])) return false;
}
return true;
}
// true if both NaN, false otherwise
return a!==a && b!==b;
};
/***/ }),
/***/ 9681:
/***/ ((module) => {
var characterMap = {
"À": "A",
"Á": "A",
"Â": "A",
"Ã": "A",
"Ä": "A",
"Å": "A",
"Ấ": "A",
"Ắ": "A",
"Ẳ": "A",
"Ẵ": "A",
"Ặ": "A",
"Æ": "AE",
"Ầ": "A",
"Ằ": "A",
"Ȃ": "A",
"Ả": "A",
"Ạ": "A",
"Ẩ": "A",
"Ẫ": "A",
"Ậ": "A",
"Ç": "C",
"Ḉ": "C",
"È": "E",
"É": "E",
"Ê": "E",
"Ë": "E",
"Ế": "E",
"Ḗ": "E",
"Ề": "E",
"Ḕ": "E",
"Ḝ": "E",
"Ȇ": "E",
"Ẻ": "E",
"Ẽ": "E",
"Ẹ": "E",
"Ể": "E",
"Ễ": "E",
"Ệ": "E",
"Ì": "I",
"Í": "I",
"Î": "I",
"Ï": "I",
"Ḯ": "I",
"Ȋ": "I",
"Ỉ": "I",
"Ị": "I",
"Ð": "D",
"Ñ": "N",
"Ò": "O",
"Ó": "O",
"Ô": "O",
"Õ": "O",
"Ö": "O",
"Ø": "O",
"Ố": "O",
"Ṍ": "O",
"Ṓ": "O",
"Ȏ": "O",
"Ỏ": "O",
"Ọ": "O",
"Ổ": "O",
"Ỗ": "O",
"Ộ": "O",
"Ờ": "O",
"Ở": "O",
"Ỡ": "O",
"Ớ": "O",
"Ợ": "O",
"Ù": "U",
"Ú": "U",
"Û": "U",
"Ü": "U",
"Ủ": "U",
"Ụ": "U",
"Ử": "U",
"Ữ": "U",
"Ự": "U",
"Ý": "Y",
"à": "a",
"á": "a",
"â": "a",
"ã": "a",
"ä": "a",
"å": "a",
"ấ": "a",
"ắ": "a",
"ẳ": "a",
"ẵ": "a",
"ặ": "a",
"æ": "ae",
"ầ": "a",
"ằ": "a",
"ȃ": "a",
"ả": "a",
"ạ": "a",
"ẩ": "a",
"ẫ": "a",
"ậ": "a",
"ç": "c",
"ḉ": "c",
"è": "e",
"é": "e",
"ê": "e",
"ë": "e",
"ế": "e",
"ḗ": "e",
"ề": "e",
"ḕ": "e",
"ḝ": "e",
"ȇ": "e",
"ẻ": "e",
"ẽ": "e",
"ẹ": "e",
"ể": "e",
"ễ": "e",
"ệ": "e",
"ì": "i",
"í": "i",
"î": "i",
"ï": "i",
"ḯ": "i",
"ȋ": "i",
"ỉ": "i",
"ị": "i",
"ð": "d",
"ñ": "n",
"ò": "o",
"ó": "o",
"ô": "o",
"õ": "o",
"ö": "o",
"ø": "o",
"ố": "o",
"ṍ": "o",
"ṓ": "o",
"ȏ": "o",
"ỏ": "o",
"ọ": "o",
"ổ": "o",
"ỗ": "o",
"ộ": "o",
"ờ": "o",
"ở": "o",
"ỡ": "o",
"ớ": "o",
"ợ": "o",
"ù": "u",
"ú": "u",
"û": "u",
"ü": "u",
"ủ": "u",
"ụ": "u",
"ử": "u",
"ữ": "u",
"ự": "u",
"ý": "y",
"ÿ": "y",
"Ā": "A",
"ā": "a",
"Ă": "A",
"ă": "a",
"Ą": "A",
"ą": "a",
"Ć": "C",
"ć": "c",
"Ĉ": "C",
"ĉ": "c",
"Ċ": "C",
"ċ": "c",
"Č": "C",
"č": "c",
"C̆": "C",
"c̆": "c",
"Ď": "D",
"ď": "d",
"Đ": "D",
"đ": "d",
"Ē": "E",
"ē": "e",
"Ĕ": "E",
"ĕ": "e",
"Ė": "E",
"ė": "e",
"Ę": "E",
"ę": "e",
"Ě": "E",
"ě": "e",
"Ĝ": "G",
"Ǵ": "G",
"ĝ": "g",
"ǵ": "g",
"Ğ": "G",
"ğ": "g",
"Ġ": "G",
"ġ": "g",
"Ģ": "G",
"ģ": "g",
"Ĥ": "H",
"ĥ": "h",
"Ħ": "H",
"ħ": "h",
"Ḫ": "H",
"ḫ": "h",
"Ĩ": "I",
"ĩ": "i",
"Ī": "I",
"ī": "i",
"Ĭ": "I",
"ĭ": "i",
"Į": "I",
"į": "i",
"İ": "I",
"ı": "i",
"IJ": "IJ",
"ij": "ij",
"Ĵ": "J",
"ĵ": "j",
"Ķ": "K",
"ķ": "k",
"Ḱ": "K",
"ḱ": "k",
"K̆": "K",
"k̆": "k",
"Ĺ": "L",
"ĺ": "l",
"Ļ": "L",
"ļ": "l",
"Ľ": "L",
"ľ": "l",
"Ŀ": "L",
"ŀ": "l",
"Ł": "l",
"ł": "l",
"Ḿ": "M",
"ḿ": "m",
"M̆": "M",
"m̆": "m",
"Ń": "N",
"ń": "n",
"Ņ": "N",
"ņ": "n",
"Ň": "N",
"ň": "n",
"ʼn": "n",
"N̆": "N",
"n̆": "n",
"Ō": "O",
"ō": "o",
"Ŏ": "O",
"ŏ": "o",
"Ő": "O",
"ő": "o",
"Œ": "OE",
"œ": "oe",
"P̆": "P",
"p̆": "p",
"Ŕ": "R",
"ŕ": "r",
"Ŗ": "R",
"ŗ": "r",
"Ř": "R",
"ř": "r",
"R̆": "R",
"r̆": "r",
"Ȓ": "R",
"ȓ": "r",
"Ś": "S",
"ś": "s",
"Ŝ": "S",
"ŝ": "s",
"Ş": "S",
"Ș": "S",
"ș": "s",
"ş": "s",
"Š": "S",
"š": "s",
"Ţ": "T",
"ţ": "t",
"ț": "t",
"Ț": "T",
"Ť": "T",
"ť": "t",
"Ŧ": "T",
"ŧ": "t",
"T̆": "T",
"t̆": "t",
"Ũ": "U",
"ũ": "u",
"Ū": "U",
"ū": "u",
"Ŭ": "U",
"ŭ": "u",
"Ů": "U",
"ů": "u",
"Ű": "U",
"ű": "u",
"Ų": "U",
"ų": "u",
"Ȗ": "U",
"ȗ": "u",
"V̆": "V",
"v̆": "v",
"Ŵ": "W",
"ŵ": "w",
"Ẃ": "W",
"ẃ": "w",
"X̆": "X",
"x̆": "x",
"Ŷ": "Y",
"ŷ": "y",
"Ÿ": "Y",
"Y̆": "Y",
"y̆": "y",
"Ź": "Z",
"ź": "z",
"Ż": "Z",
"ż": "z",
"Ž": "Z",
"ž": "z",
"ſ": "s",
"ƒ": "f",
"Ơ": "O",
"ơ": "o",
"Ư": "U",
"ư": "u",
"Ǎ": "A",
"ǎ": "a",
"Ǐ": "I",
"ǐ": "i",
"Ǒ": "O",
"ǒ": "o",
"Ǔ": "U",
"ǔ": "u",
"Ǖ": "U",
"ǖ": "u",
"Ǘ": "U",
"ǘ": "u",
"Ǚ": "U",
"ǚ": "u",
"Ǜ": "U",
"ǜ": "u",
"Ứ": "U",
"ứ": "u",
"Ṹ": "U",
"ṹ": "u",
"Ǻ": "A",
"ǻ": "a",
"Ǽ": "AE",
"ǽ": "ae",
"Ǿ": "O",
"ǿ": "o",
"Þ": "TH",
"þ": "th",
"Ṕ": "P",
"ṕ": "p",
"Ṥ": "S",
"ṥ": "s",
"X́": "X",
"x́": "x",
"Ѓ": "Г",
"ѓ": "г",
"Ќ": "К",
"ќ": "к",
"A̋": "A",
"a̋": "a",
"E̋": "E",
"e̋": "e",
"I̋": "I",
"i̋": "i",
"Ǹ": "N",
"ǹ": "n",
"Ồ": "O",
"ồ": "o",
"Ṑ": "O",
"ṑ": "o",
"Ừ": "U",
"ừ": "u",
"Ẁ": "W",
"ẁ": "w",
"Ỳ": "Y",
"ỳ": "y",
"Ȁ": "A",
"ȁ": "a",
"Ȅ": "E",
"ȅ": "e",
"Ȉ": "I",
"ȉ": "i",
"Ȍ": "O",
"ȍ": "o",
"Ȑ": "R",
"ȑ": "r",
"Ȕ": "U",
"ȕ": "u",
"B̌": "B",
"b̌": "b",
"Č̣": "C",
"č̣": "c",
"Ê̌": "E",
"ê̌": "e",
"F̌": "F",
"f̌": "f",
"Ǧ": "G",
"ǧ": "g",
"Ȟ": "H",
"ȟ": "h",
"J̌": "J",
"ǰ": "j",
"Ǩ": "K",
"ǩ": "k",
"M̌": "M",
"m̌": "m",
"P̌": "P",
"p̌": "p",
"Q̌": "Q",
"q̌": "q",
"Ř̩": "R",
"ř̩": "r",
"Ṧ": "S",
"ṧ": "s",
"V̌": "V",
"v̌": "v",
"W̌": "W",
"w̌": "w",
"X̌": "X",
"x̌": "x",
"Y̌": "Y",
"y̌": "y",
"A̧": "A",
"a̧": "a",
"B̧": "B",
"b̧": "b",
"Ḑ": "D",
"ḑ": "d",
"Ȩ": "E",
"ȩ": "e",
"Ɛ̧": "E",
"ɛ̧": "e",
"Ḩ": "H",
"ḩ": "h",
"I̧": "I",
"i̧": "i",
"Ɨ̧": "I",
"ɨ̧": "i",
"M̧": "M",
"m̧": "m",
"O̧": "O",
"o̧": "o",
"Q̧": "Q",
"q̧": "q",
"U̧": "U",
"u̧": "u",
"X̧": "X",
"x̧": "x",
"Z̧": "Z",
"z̧": "z",
"й":"и",
"Й":"И",
"ё":"е",
"Ё":"Е",
};
var chars = Object.keys(characterMap).join('|');
var allAccents = new RegExp(chars, 'g');
var firstAccent = new RegExp(chars, '');
function matcher(match) {
return characterMap[match];
}
var removeAccents = function(string) {
return string.replace(allAccents, matcher);
};
var hasAccents = function(string) {
return !!string.match(firstAccent);
};
module.exports = removeAccents;
module.exports.has = hasAccents;
module.exports.remove = removeAccents;
/***/ })
/******/ });
/************************************************************************/
/******/ // 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](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (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 */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (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.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
__experimentalGetCoreBlocks: () => (/* binding */ __experimentalGetCoreBlocks),
__experimentalRegisterExperimentalCoreBlocks: () => (/* binding */ __experimentalRegisterExperimentalCoreBlocks),
registerCoreBlocks: () => (/* binding */ registerCoreBlocks)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/archives/index.js
var archives_namespaceObject = {};
__webpack_require__.r(archives_namespaceObject);
__webpack_require__.d(archives_namespaceObject, {
init: () => (init),
metadata: () => (metadata),
name: () => (archives_name),
settings: () => (settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/avatar/index.js
var avatar_namespaceObject = {};
__webpack_require__.r(avatar_namespaceObject);
__webpack_require__.d(avatar_namespaceObject, {
init: () => (avatar_init),
metadata: () => (avatar_metadata),
name: () => (avatar_name),
settings: () => (avatar_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/audio/index.js
var build_module_audio_namespaceObject = {};
__webpack_require__.r(build_module_audio_namespaceObject);
__webpack_require__.d(build_module_audio_namespaceObject, {
init: () => (audio_init),
metadata: () => (audio_metadata),
name: () => (audio_name),
settings: () => (audio_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/button/index.js
var build_module_button_namespaceObject = {};
__webpack_require__.r(build_module_button_namespaceObject);
__webpack_require__.d(build_module_button_namespaceObject, {
init: () => (button_init),
metadata: () => (button_metadata),
name: () => (button_name),
settings: () => (button_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/buttons/index.js
var build_module_buttons_namespaceObject = {};
__webpack_require__.r(build_module_buttons_namespaceObject);
__webpack_require__.d(build_module_buttons_namespaceObject, {
init: () => (buttons_init),
metadata: () => (buttons_metadata),
name: () => (buttons_name),
settings: () => (buttons_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/calendar/index.js
var build_module_calendar_namespaceObject = {};
__webpack_require__.r(build_module_calendar_namespaceObject);
__webpack_require__.d(build_module_calendar_namespaceObject, {
init: () => (calendar_init),
metadata: () => (calendar_metadata),
name: () => (calendar_name),
settings: () => (calendar_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/categories/index.js
var categories_namespaceObject = {};
__webpack_require__.r(categories_namespaceObject);
__webpack_require__.d(categories_namespaceObject, {
init: () => (categories_init),
metadata: () => (categories_metadata),
name: () => (categories_name),
settings: () => (categories_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/freeform/index.js
var freeform_namespaceObject = {};
__webpack_require__.r(freeform_namespaceObject);
__webpack_require__.d(freeform_namespaceObject, {
init: () => (freeform_init),
metadata: () => (freeform_metadata),
name: () => (freeform_name),
settings: () => (freeform_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/code/index.js
var build_module_code_namespaceObject = {};
__webpack_require__.r(build_module_code_namespaceObject);
__webpack_require__.d(build_module_code_namespaceObject, {
init: () => (code_init),
metadata: () => (code_metadata),
name: () => (code_name),
settings: () => (code_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/column/index.js
var build_module_column_namespaceObject = {};
__webpack_require__.r(build_module_column_namespaceObject);
__webpack_require__.d(build_module_column_namespaceObject, {
init: () => (column_init),
metadata: () => (column_metadata),
name: () => (column_name),
settings: () => (column_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/columns/index.js
var build_module_columns_namespaceObject = {};
__webpack_require__.r(build_module_columns_namespaceObject);
__webpack_require__.d(build_module_columns_namespaceObject, {
init: () => (columns_init),
metadata: () => (columns_metadata),
name: () => (columns_name),
settings: () => (columns_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/comments/index.js
var comments_namespaceObject = {};
__webpack_require__.r(comments_namespaceObject);
__webpack_require__.d(comments_namespaceObject, {
init: () => (comments_init),
metadata: () => (comments_metadata),
name: () => (comments_name),
settings: () => (comments_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/comment-author-avatar/index.js
var build_module_comment_author_avatar_namespaceObject = {};
__webpack_require__.r(build_module_comment_author_avatar_namespaceObject);
__webpack_require__.d(build_module_comment_author_avatar_namespaceObject, {
init: () => (comment_author_avatar_init),
metadata: () => (comment_author_avatar_metadata),
name: () => (comment_author_avatar_name),
settings: () => (comment_author_avatar_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/comment-author-name/index.js
var build_module_comment_author_name_namespaceObject = {};
__webpack_require__.r(build_module_comment_author_name_namespaceObject);
__webpack_require__.d(build_module_comment_author_name_namespaceObject, {
init: () => (comment_author_name_init),
metadata: () => (comment_author_name_metadata),
name: () => (comment_author_name_name),
settings: () => (comment_author_name_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/comment-content/index.js
var build_module_comment_content_namespaceObject = {};
__webpack_require__.r(build_module_comment_content_namespaceObject);
__webpack_require__.d(build_module_comment_content_namespaceObject, {
init: () => (comment_content_init),
metadata: () => (comment_content_metadata),
name: () => (comment_content_name),
settings: () => (comment_content_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/comment-date/index.js
var comment_date_namespaceObject = {};
__webpack_require__.r(comment_date_namespaceObject);
__webpack_require__.d(comment_date_namespaceObject, {
init: () => (comment_date_init),
metadata: () => (comment_date_metadata),
name: () => (comment_date_name),
settings: () => (comment_date_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/comment-edit-link/index.js
var build_module_comment_edit_link_namespaceObject = {};
__webpack_require__.r(build_module_comment_edit_link_namespaceObject);
__webpack_require__.d(build_module_comment_edit_link_namespaceObject, {
init: () => (comment_edit_link_init),
metadata: () => (comment_edit_link_metadata),
name: () => (comment_edit_link_name),
settings: () => (comment_edit_link_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/comment-reply-link/index.js
var build_module_comment_reply_link_namespaceObject = {};
__webpack_require__.r(build_module_comment_reply_link_namespaceObject);
__webpack_require__.d(build_module_comment_reply_link_namespaceObject, {
init: () => (comment_reply_link_init),
metadata: () => (comment_reply_link_metadata),
name: () => (comment_reply_link_name),
settings: () => (comment_reply_link_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/comment-template/index.js
var comment_template_namespaceObject = {};
__webpack_require__.r(comment_template_namespaceObject);
__webpack_require__.d(comment_template_namespaceObject, {
init: () => (comment_template_init),
metadata: () => (comment_template_metadata),
name: () => (comment_template_name),
settings: () => (comment_template_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/comments-pagination-previous/index.js
var comments_pagination_previous_namespaceObject = {};
__webpack_require__.r(comments_pagination_previous_namespaceObject);
__webpack_require__.d(comments_pagination_previous_namespaceObject, {
init: () => (comments_pagination_previous_init),
metadata: () => (comments_pagination_previous_metadata),
name: () => (comments_pagination_previous_name),
settings: () => (comments_pagination_previous_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/comments-pagination/index.js
var comments_pagination_namespaceObject = {};
__webpack_require__.r(comments_pagination_namespaceObject);
__webpack_require__.d(comments_pagination_namespaceObject, {
init: () => (comments_pagination_init),
metadata: () => (comments_pagination_metadata),
name: () => (comments_pagination_name),
settings: () => (comments_pagination_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/comments-pagination-next/index.js
var comments_pagination_next_namespaceObject = {};
__webpack_require__.r(comments_pagination_next_namespaceObject);
__webpack_require__.d(comments_pagination_next_namespaceObject, {
init: () => (comments_pagination_next_init),
metadata: () => (comments_pagination_next_metadata),
name: () => (comments_pagination_next_name),
settings: () => (comments_pagination_next_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/comments-pagination-numbers/index.js
var comments_pagination_numbers_namespaceObject = {};
__webpack_require__.r(comments_pagination_numbers_namespaceObject);
__webpack_require__.d(comments_pagination_numbers_namespaceObject, {
init: () => (comments_pagination_numbers_init),
metadata: () => (comments_pagination_numbers_metadata),
name: () => (comments_pagination_numbers_name),
settings: () => (comments_pagination_numbers_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/comments-title/index.js
var comments_title_namespaceObject = {};
__webpack_require__.r(comments_title_namespaceObject);
__webpack_require__.d(comments_title_namespaceObject, {
init: () => (comments_title_init),
metadata: () => (comments_title_metadata),
name: () => (comments_title_name),
settings: () => (comments_title_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/cover/index.js
var build_module_cover_namespaceObject = {};
__webpack_require__.r(build_module_cover_namespaceObject);
__webpack_require__.d(build_module_cover_namespaceObject, {
init: () => (cover_init),
metadata: () => (cover_metadata),
name: () => (cover_name),
settings: () => (cover_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/details/index.js
var build_module_details_namespaceObject = {};
__webpack_require__.r(build_module_details_namespaceObject);
__webpack_require__.d(build_module_details_namespaceObject, {
init: () => (details_init),
metadata: () => (details_metadata),
name: () => (details_name),
settings: () => (details_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/embed/index.js
var embed_namespaceObject = {};
__webpack_require__.r(embed_namespaceObject);
__webpack_require__.d(embed_namespaceObject, {
init: () => (embed_init),
metadata: () => (embed_metadata),
name: () => (embed_name),
settings: () => (embed_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/file/index.js
var build_module_file_namespaceObject = {};
__webpack_require__.r(build_module_file_namespaceObject);
__webpack_require__.d(build_module_file_namespaceObject, {
init: () => (file_init),
metadata: () => (file_metadata),
name: () => (file_name),
settings: () => (file_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/form/index.js
var build_module_form_namespaceObject = {};
__webpack_require__.r(build_module_form_namespaceObject);
__webpack_require__.d(build_module_form_namespaceObject, {
init: () => (form_init),
metadata: () => (form_metadata),
name: () => (form_name),
settings: () => (form_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/form-input/index.js
var form_input_namespaceObject = {};
__webpack_require__.r(form_input_namespaceObject);
__webpack_require__.d(form_input_namespaceObject, {
init: () => (form_input_init),
metadata: () => (form_input_metadata),
name: () => (form_input_name),
settings: () => (form_input_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/form-submit-button/index.js
var form_submit_button_namespaceObject = {};
__webpack_require__.r(form_submit_button_namespaceObject);
__webpack_require__.d(form_submit_button_namespaceObject, {
init: () => (form_submit_button_init),
metadata: () => (form_submit_button_metadata),
name: () => (form_submit_button_name),
settings: () => (form_submit_button_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/form-submission-notification/index.js
var form_submission_notification_namespaceObject = {};
__webpack_require__.r(form_submission_notification_namespaceObject);
__webpack_require__.d(form_submission_notification_namespaceObject, {
init: () => (form_submission_notification_init),
metadata: () => (form_submission_notification_metadata),
name: () => (form_submission_notification_name),
settings: () => (form_submission_notification_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/gallery/index.js
var build_module_gallery_namespaceObject = {};
__webpack_require__.r(build_module_gallery_namespaceObject);
__webpack_require__.d(build_module_gallery_namespaceObject, {
init: () => (gallery_init),
metadata: () => (gallery_metadata),
name: () => (gallery_name),
settings: () => (gallery_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/group/index.js
var build_module_group_namespaceObject = {};
__webpack_require__.r(build_module_group_namespaceObject);
__webpack_require__.d(build_module_group_namespaceObject, {
init: () => (group_init),
metadata: () => (group_metadata),
name: () => (group_name),
settings: () => (group_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/heading/index.js
var build_module_heading_namespaceObject = {};
__webpack_require__.r(build_module_heading_namespaceObject);
__webpack_require__.d(build_module_heading_namespaceObject, {
init: () => (heading_init),
metadata: () => (heading_metadata),
name: () => (heading_name),
settings: () => (heading_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/home-link/index.js
var home_link_namespaceObject = {};
__webpack_require__.r(home_link_namespaceObject);
__webpack_require__.d(home_link_namespaceObject, {
init: () => (home_link_init),
metadata: () => (home_link_metadata),
name: () => (home_link_name),
settings: () => (home_link_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/html/index.js
var build_module_html_namespaceObject = {};
__webpack_require__.r(build_module_html_namespaceObject);
__webpack_require__.d(build_module_html_namespaceObject, {
init: () => (html_init),
metadata: () => (html_metadata),
name: () => (html_name),
settings: () => (html_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/image/index.js
var build_module_image_namespaceObject = {};
__webpack_require__.r(build_module_image_namespaceObject);
__webpack_require__.d(build_module_image_namespaceObject, {
init: () => (image_init),
metadata: () => (image_metadata),
name: () => (image_name),
settings: () => (image_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/latest-comments/index.js
var latest_comments_namespaceObject = {};
__webpack_require__.r(latest_comments_namespaceObject);
__webpack_require__.d(latest_comments_namespaceObject, {
init: () => (latest_comments_init),
metadata: () => (latest_comments_metadata),
name: () => (latest_comments_name),
settings: () => (latest_comments_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/latest-posts/index.js
var latest_posts_namespaceObject = {};
__webpack_require__.r(latest_posts_namespaceObject);
__webpack_require__.d(latest_posts_namespaceObject, {
init: () => (latest_posts_init),
metadata: () => (latest_posts_metadata),
name: () => (latest_posts_name),
settings: () => (latest_posts_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/list/index.js
var build_module_list_namespaceObject = {};
__webpack_require__.r(build_module_list_namespaceObject);
__webpack_require__.d(build_module_list_namespaceObject, {
init: () => (list_init),
metadata: () => (list_metadata),
name: () => (list_name),
settings: () => (list_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/list-item/index.js
var build_module_list_item_namespaceObject = {};
__webpack_require__.r(build_module_list_item_namespaceObject);
__webpack_require__.d(build_module_list_item_namespaceObject, {
init: () => (list_item_init),
metadata: () => (list_item_metadata),
name: () => (list_item_name),
settings: () => (list_item_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/loginout/index.js
var loginout_namespaceObject = {};
__webpack_require__.r(loginout_namespaceObject);
__webpack_require__.d(loginout_namespaceObject, {
init: () => (loginout_init),
metadata: () => (loginout_metadata),
name: () => (loginout_name),
settings: () => (loginout_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/media-text/index.js
var media_text_namespaceObject = {};
__webpack_require__.r(media_text_namespaceObject);
__webpack_require__.d(media_text_namespaceObject, {
init: () => (media_text_init),
metadata: () => (media_text_metadata),
name: () => (media_text_name),
settings: () => (media_text_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/missing/index.js
var missing_namespaceObject = {};
__webpack_require__.r(missing_namespaceObject);
__webpack_require__.d(missing_namespaceObject, {
init: () => (missing_init),
metadata: () => (missing_metadata),
name: () => (missing_name),
settings: () => (missing_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/more/index.js
var build_module_more_namespaceObject = {};
__webpack_require__.r(build_module_more_namespaceObject);
__webpack_require__.d(build_module_more_namespaceObject, {
init: () => (more_init),
metadata: () => (more_metadata),
name: () => (more_name),
settings: () => (more_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/navigation/index.js
var build_module_navigation_namespaceObject = {};
__webpack_require__.r(build_module_navigation_namespaceObject);
__webpack_require__.d(build_module_navigation_namespaceObject, {
init: () => (navigation_init),
metadata: () => (navigation_metadata),
name: () => (navigation_name),
settings: () => (navigation_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/navigation-link/index.js
var navigation_link_namespaceObject = {};
__webpack_require__.r(navigation_link_namespaceObject);
__webpack_require__.d(navigation_link_namespaceObject, {
init: () => (navigation_link_init),
metadata: () => (navigation_link_metadata),
name: () => (navigation_link_name),
settings: () => (navigation_link_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/navigation-submenu/index.js
var navigation_submenu_namespaceObject = {};
__webpack_require__.r(navigation_submenu_namespaceObject);
__webpack_require__.d(navigation_submenu_namespaceObject, {
init: () => (navigation_submenu_init),
metadata: () => (navigation_submenu_metadata),
name: () => (navigation_submenu_name),
settings: () => (navigation_submenu_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/nextpage/index.js
var nextpage_namespaceObject = {};
__webpack_require__.r(nextpage_namespaceObject);
__webpack_require__.d(nextpage_namespaceObject, {
init: () => (nextpage_init),
metadata: () => (nextpage_metadata),
name: () => (nextpage_name),
settings: () => (nextpage_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/pattern/index.js
var pattern_namespaceObject = {};
__webpack_require__.r(pattern_namespaceObject);
__webpack_require__.d(pattern_namespaceObject, {
init: () => (pattern_init),
metadata: () => (pattern_metadata),
name: () => (pattern_name),
settings: () => (pattern_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/page-list/index.js
var page_list_namespaceObject = {};
__webpack_require__.r(page_list_namespaceObject);
__webpack_require__.d(page_list_namespaceObject, {
init: () => (page_list_init),
metadata: () => (page_list_metadata),
name: () => (page_list_name),
settings: () => (page_list_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/page-list-item/index.js
var page_list_item_namespaceObject = {};
__webpack_require__.r(page_list_item_namespaceObject);
__webpack_require__.d(page_list_item_namespaceObject, {
init: () => (page_list_item_init),
metadata: () => (page_list_item_metadata),
name: () => (page_list_item_name),
settings: () => (page_list_item_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/paragraph/index.js
var build_module_paragraph_namespaceObject = {};
__webpack_require__.r(build_module_paragraph_namespaceObject);
__webpack_require__.d(build_module_paragraph_namespaceObject, {
init: () => (paragraph_init),
metadata: () => (paragraph_metadata),
name: () => (paragraph_name),
settings: () => (paragraph_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-author/index.js
var build_module_post_author_namespaceObject = {};
__webpack_require__.r(build_module_post_author_namespaceObject);
__webpack_require__.d(build_module_post_author_namespaceObject, {
init: () => (post_author_init),
metadata: () => (post_author_metadata),
name: () => (post_author_name),
settings: () => (post_author_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-author-name/index.js
var post_author_name_namespaceObject = {};
__webpack_require__.r(post_author_name_namespaceObject);
__webpack_require__.d(post_author_name_namespaceObject, {
init: () => (post_author_name_init),
metadata: () => (post_author_name_metadata),
name: () => (post_author_name_name),
settings: () => (post_author_name_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-author-biography/index.js
var post_author_biography_namespaceObject = {};
__webpack_require__.r(post_author_biography_namespaceObject);
__webpack_require__.d(post_author_biography_namespaceObject, {
init: () => (post_author_biography_init),
metadata: () => (post_author_biography_metadata),
name: () => (post_author_biography_name),
settings: () => (post_author_biography_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-comment/index.js
var post_comment_namespaceObject = {};
__webpack_require__.r(post_comment_namespaceObject);
__webpack_require__.d(post_comment_namespaceObject, {
init: () => (post_comment_init),
metadata: () => (post_comment_metadata),
name: () => (post_comment_name),
settings: () => (post_comment_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-comments-count/index.js
var build_module_post_comments_count_namespaceObject = {};
__webpack_require__.r(build_module_post_comments_count_namespaceObject);
__webpack_require__.d(build_module_post_comments_count_namespaceObject, {
init: () => (post_comments_count_init),
metadata: () => (post_comments_count_metadata),
name: () => (post_comments_count_name),
settings: () => (post_comments_count_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-comments-form/index.js
var build_module_post_comments_form_namespaceObject = {};
__webpack_require__.r(build_module_post_comments_form_namespaceObject);
__webpack_require__.d(build_module_post_comments_form_namespaceObject, {
init: () => (post_comments_form_init),
metadata: () => (post_comments_form_metadata),
name: () => (post_comments_form_name),
settings: () => (post_comments_form_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-comments-link/index.js
var post_comments_link_namespaceObject = {};
__webpack_require__.r(post_comments_link_namespaceObject);
__webpack_require__.d(post_comments_link_namespaceObject, {
init: () => (post_comments_link_init),
metadata: () => (post_comments_link_metadata),
name: () => (post_comments_link_name),
settings: () => (post_comments_link_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-content/index.js
var build_module_post_content_namespaceObject = {};
__webpack_require__.r(build_module_post_content_namespaceObject);
__webpack_require__.d(build_module_post_content_namespaceObject, {
init: () => (post_content_init),
metadata: () => (post_content_metadata),
name: () => (post_content_name),
settings: () => (post_content_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-date/index.js
var build_module_post_date_namespaceObject = {};
__webpack_require__.r(build_module_post_date_namespaceObject);
__webpack_require__.d(build_module_post_date_namespaceObject, {
init: () => (post_date_init),
metadata: () => (post_date_metadata),
name: () => (post_date_name),
settings: () => (post_date_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-excerpt/index.js
var build_module_post_excerpt_namespaceObject = {};
__webpack_require__.r(build_module_post_excerpt_namespaceObject);
__webpack_require__.d(build_module_post_excerpt_namespaceObject, {
init: () => (post_excerpt_init),
metadata: () => (post_excerpt_metadata),
name: () => (post_excerpt_name),
settings: () => (post_excerpt_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-featured-image/index.js
var build_module_post_featured_image_namespaceObject = {};
__webpack_require__.r(build_module_post_featured_image_namespaceObject);
__webpack_require__.d(build_module_post_featured_image_namespaceObject, {
init: () => (post_featured_image_init),
metadata: () => (post_featured_image_metadata),
name: () => (post_featured_image_name),
settings: () => (post_featured_image_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-navigation-link/index.js
var post_navigation_link_namespaceObject = {};
__webpack_require__.r(post_navigation_link_namespaceObject);
__webpack_require__.d(post_navigation_link_namespaceObject, {
init: () => (post_navigation_link_init),
metadata: () => (post_navigation_link_metadata),
name: () => (post_navigation_link_name),
settings: () => (post_navigation_link_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-template/index.js
var post_template_namespaceObject = {};
__webpack_require__.r(post_template_namespaceObject);
__webpack_require__.d(post_template_namespaceObject, {
init: () => (post_template_init),
metadata: () => (post_template_metadata),
name: () => (post_template_name),
settings: () => (post_template_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-terms/index.js
var build_module_post_terms_namespaceObject = {};
__webpack_require__.r(build_module_post_terms_namespaceObject);
__webpack_require__.d(build_module_post_terms_namespaceObject, {
init: () => (post_terms_init),
metadata: () => (post_terms_metadata),
name: () => (post_terms_name),
settings: () => (post_terms_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-time-to-read/index.js
var post_time_to_read_namespaceObject = {};
__webpack_require__.r(post_time_to_read_namespaceObject);
__webpack_require__.d(post_time_to_read_namespaceObject, {
init: () => (post_time_to_read_init),
metadata: () => (post_time_to_read_metadata),
name: () => (post_time_to_read_name),
settings: () => (post_time_to_read_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-title/index.js
var post_title_namespaceObject = {};
__webpack_require__.r(post_title_namespaceObject);
__webpack_require__.d(post_title_namespaceObject, {
init: () => (post_title_init),
metadata: () => (post_title_metadata),
name: () => (post_title_name),
settings: () => (post_title_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/preformatted/index.js
var build_module_preformatted_namespaceObject = {};
__webpack_require__.r(build_module_preformatted_namespaceObject);
__webpack_require__.d(build_module_preformatted_namespaceObject, {
init: () => (preformatted_init),
metadata: () => (preformatted_metadata),
name: () => (preformatted_name),
settings: () => (preformatted_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/pullquote/index.js
var build_module_pullquote_namespaceObject = {};
__webpack_require__.r(build_module_pullquote_namespaceObject);
__webpack_require__.d(build_module_pullquote_namespaceObject, {
init: () => (pullquote_init),
metadata: () => (pullquote_metadata),
name: () => (pullquote_name),
settings: () => (pullquote_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query/index.js
var query_namespaceObject = {};
__webpack_require__.r(query_namespaceObject);
__webpack_require__.d(query_namespaceObject, {
init: () => (query_init),
metadata: () => (query_metadata),
name: () => (query_name),
settings: () => (query_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-no-results/index.js
var query_no_results_namespaceObject = {};
__webpack_require__.r(query_no_results_namespaceObject);
__webpack_require__.d(query_no_results_namespaceObject, {
init: () => (query_no_results_init),
metadata: () => (query_no_results_metadata),
name: () => (query_no_results_name),
settings: () => (query_no_results_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-pagination/index.js
var build_module_query_pagination_namespaceObject = {};
__webpack_require__.r(build_module_query_pagination_namespaceObject);
__webpack_require__.d(build_module_query_pagination_namespaceObject, {
init: () => (query_pagination_init),
metadata: () => (query_pagination_metadata),
name: () => (query_pagination_name),
settings: () => (query_pagination_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-pagination-next/index.js
var build_module_query_pagination_next_namespaceObject = {};
__webpack_require__.r(build_module_query_pagination_next_namespaceObject);
__webpack_require__.d(build_module_query_pagination_next_namespaceObject, {
init: () => (query_pagination_next_init),
metadata: () => (query_pagination_next_metadata),
name: () => (query_pagination_next_name),
settings: () => (query_pagination_next_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-pagination-numbers/index.js
var build_module_query_pagination_numbers_namespaceObject = {};
__webpack_require__.r(build_module_query_pagination_numbers_namespaceObject);
__webpack_require__.d(build_module_query_pagination_numbers_namespaceObject, {
init: () => (query_pagination_numbers_init),
metadata: () => (query_pagination_numbers_metadata),
name: () => (query_pagination_numbers_name),
settings: () => (query_pagination_numbers_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-pagination-previous/index.js
var build_module_query_pagination_previous_namespaceObject = {};
__webpack_require__.r(build_module_query_pagination_previous_namespaceObject);
__webpack_require__.d(build_module_query_pagination_previous_namespaceObject, {
init: () => (query_pagination_previous_init),
metadata: () => (query_pagination_previous_metadata),
name: () => (query_pagination_previous_name),
settings: () => (query_pagination_previous_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-title/index.js
var query_title_namespaceObject = {};
__webpack_require__.r(query_title_namespaceObject);
__webpack_require__.d(query_title_namespaceObject, {
init: () => (query_title_init),
metadata: () => (query_title_metadata),
name: () => (query_title_name),
settings: () => (query_title_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/quote/index.js
var build_module_quote_namespaceObject = {};
__webpack_require__.r(build_module_quote_namespaceObject);
__webpack_require__.d(build_module_quote_namespaceObject, {
init: () => (quote_init),
metadata: () => (quote_metadata),
name: () => (quote_name),
settings: () => (quote_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/block/index.js
var block_namespaceObject = {};
__webpack_require__.r(block_namespaceObject);
__webpack_require__.d(block_namespaceObject, {
init: () => (block_init),
metadata: () => (block_metadata),
name: () => (block_name),
settings: () => (block_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/read-more/index.js
var read_more_namespaceObject = {};
__webpack_require__.r(read_more_namespaceObject);
__webpack_require__.d(read_more_namespaceObject, {
init: () => (read_more_init),
metadata: () => (read_more_metadata),
name: () => (read_more_name),
settings: () => (read_more_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/rss/index.js
var build_module_rss_namespaceObject = {};
__webpack_require__.r(build_module_rss_namespaceObject);
__webpack_require__.d(build_module_rss_namespaceObject, {
init: () => (rss_init),
metadata: () => (rss_metadata),
name: () => (rss_name),
settings: () => (rss_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/search/index.js
var build_module_search_namespaceObject = {};
__webpack_require__.r(build_module_search_namespaceObject);
__webpack_require__.d(build_module_search_namespaceObject, {
init: () => (search_init),
metadata: () => (search_metadata),
name: () => (search_name),
settings: () => (search_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/separator/index.js
var build_module_separator_namespaceObject = {};
__webpack_require__.r(build_module_separator_namespaceObject);
__webpack_require__.d(build_module_separator_namespaceObject, {
init: () => (separator_init),
metadata: () => (separator_metadata),
name: () => (separator_name),
settings: () => (separator_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/shortcode/index.js
var build_module_shortcode_namespaceObject = {};
__webpack_require__.r(build_module_shortcode_namespaceObject);
__webpack_require__.d(build_module_shortcode_namespaceObject, {
init: () => (shortcode_init),
metadata: () => (shortcode_metadata),
name: () => (shortcode_name),
settings: () => (shortcode_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/site-logo/index.js
var build_module_site_logo_namespaceObject = {};
__webpack_require__.r(build_module_site_logo_namespaceObject);
__webpack_require__.d(build_module_site_logo_namespaceObject, {
init: () => (site_logo_init),
metadata: () => (site_logo_metadata),
name: () => (site_logo_name),
settings: () => (site_logo_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/site-tagline/index.js
var site_tagline_namespaceObject = {};
__webpack_require__.r(site_tagline_namespaceObject);
__webpack_require__.d(site_tagline_namespaceObject, {
init: () => (site_tagline_init),
metadata: () => (site_tagline_metadata),
name: () => (site_tagline_name),
settings: () => (site_tagline_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/site-title/index.js
var site_title_namespaceObject = {};
__webpack_require__.r(site_title_namespaceObject);
__webpack_require__.d(site_title_namespaceObject, {
init: () => (site_title_init),
metadata: () => (site_title_metadata),
name: () => (site_title_name),
settings: () => (site_title_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/social-link/index.js
var social_link_namespaceObject = {};
__webpack_require__.r(social_link_namespaceObject);
__webpack_require__.d(social_link_namespaceObject, {
init: () => (social_link_init),
metadata: () => (social_link_metadata),
name: () => (social_link_name),
settings: () => (social_link_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/social-links/index.js
var social_links_namespaceObject = {};
__webpack_require__.r(social_links_namespaceObject);
__webpack_require__.d(social_links_namespaceObject, {
init: () => (social_links_init),
metadata: () => (social_links_metadata),
name: () => (social_links_name),
settings: () => (social_links_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/spacer/index.js
var spacer_namespaceObject = {};
__webpack_require__.r(spacer_namespaceObject);
__webpack_require__.d(spacer_namespaceObject, {
init: () => (spacer_init),
metadata: () => (spacer_metadata),
name: () => (spacer_name),
settings: () => (spacer_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/table/index.js
var build_module_table_namespaceObject = {};
__webpack_require__.r(build_module_table_namespaceObject);
__webpack_require__.d(build_module_table_namespaceObject, {
init: () => (table_init),
metadata: () => (table_metadata),
name: () => (table_name),
settings: () => (table_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/table-of-contents/index.js
var build_module_table_of_contents_namespaceObject = {};
__webpack_require__.r(build_module_table_of_contents_namespaceObject);
__webpack_require__.d(build_module_table_of_contents_namespaceObject, {
init: () => (table_of_contents_init),
metadata: () => (table_of_contents_metadata),
name: () => (table_of_contents_name),
settings: () => (table_of_contents_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/tag-cloud/index.js
var tag_cloud_namespaceObject = {};
__webpack_require__.r(tag_cloud_namespaceObject);
__webpack_require__.d(tag_cloud_namespaceObject, {
init: () => (tag_cloud_init),
metadata: () => (tag_cloud_metadata),
name: () => (tag_cloud_name),
settings: () => (tag_cloud_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/template-part/index.js
var template_part_namespaceObject = {};
__webpack_require__.r(template_part_namespaceObject);
__webpack_require__.d(template_part_namespaceObject, {
init: () => (template_part_init),
metadata: () => (template_part_metadata),
name: () => (template_part_name),
settings: () => (template_part_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/term-description/index.js
var build_module_term_description_namespaceObject = {};
__webpack_require__.r(build_module_term_description_namespaceObject);
__webpack_require__.d(build_module_term_description_namespaceObject, {
init: () => (term_description_init),
metadata: () => (term_description_metadata),
name: () => (term_description_name),
settings: () => (term_description_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/text-columns/index.js
var text_columns_namespaceObject = {};
__webpack_require__.r(text_columns_namespaceObject);
__webpack_require__.d(text_columns_namespaceObject, {
init: () => (text_columns_init),
metadata: () => (text_columns_metadata),
name: () => (text_columns_name),
settings: () => (text_columns_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/verse/index.js
var build_module_verse_namespaceObject = {};
__webpack_require__.r(build_module_verse_namespaceObject);
__webpack_require__.d(build_module_verse_namespaceObject, {
init: () => (verse_init),
metadata: () => (verse_metadata),
name: () => (verse_name),
settings: () => (verse_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/video/index.js
var build_module_video_namespaceObject = {};
__webpack_require__.r(build_module_video_namespaceObject);
__webpack_require__.d(build_module_video_namespaceObject, {
init: () => (video_init),
metadata: () => (video_metadata),
name: () => (video_name),
settings: () => (video_settings)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/footnotes/index.js
var footnotes_namespaceObject = {};
__webpack_require__.r(footnotes_namespaceObject);
__webpack_require__.d(footnotes_namespaceObject, {
init: () => (footnotes_init),
metadata: () => (footnotes_metadata),
name: () => (footnotes_name),
settings: () => (footnotes_settings)
});
;// CONCATENATED MODULE: external ["wp","blocks"]
const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
;// CONCATENATED MODULE: external "React"
const external_React_namespaceObject = window["React"];
;// CONCATENATED MODULE: external ["wp","primitives"]
const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/archive.js
/**
* WordPress dependencies
*/
const archive = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M11.934 7.406a1 1 0 0 0 .914.594H19a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5h5.764a.5.5 0 0 1 .447.276l.723 1.63Zm1.064-1.216a.5.5 0 0 0 .462.31H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.764a2 2 0 0 1 1.789 1.106l.445 1.084ZM8.5 10.5h7V12h-7v-1.5Zm7 3.5h-7v1.5h7V14Z"
}));
/* harmony default export */ const library_archive = (archive);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/utils/init-block.js
/**
* WordPress dependencies
*/
/**
* Function to register an individual block.
*
* @param {Object} block The block to be registered.
*
* @return {WPBlockType | undefined} The block, if it has been successfully registered;
* otherwise `undefined`.
*/
function initBlock(block) {
if (!block) {
return;
}
const {
metadata,
settings,
name
} = block;
return (0,external_wp_blocks_namespaceObject.registerBlockType)({
name,
...metadata
}, settings);
}
;// CONCATENATED MODULE: external ["wp","components"]
const external_wp_components_namespaceObject = window["wp"]["components"];
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// CONCATENATED MODULE: external ["wp","blockEditor"]
const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
;// CONCATENATED MODULE: external ["wp","serverSideRender"]
const external_wp_serverSideRender_namespaceObject = window["wp"]["serverSideRender"];
var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/archives/edit.js
/**
* WordPress dependencies
*/
function ArchivesEdit({
attributes,
setAttributes
}) {
const {
showLabel,
showPostCounts,
displayAsDropdown,
type
} = attributes;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display as dropdown'),
checked: displayAsDropdown,
onChange: () => setAttributes({
displayAsDropdown: !displayAsDropdown
})
}), displayAsDropdown && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show label'),
checked: showLabel,
onChange: () => setAttributes({
showLabel: !showLabel
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show post counts'),
checked: showPostCounts,
onChange: () => setAttributes({
showPostCounts: !showPostCounts
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Group by:'),
options: [{
label: (0,external_wp_i18n_namespaceObject.__)('Year'),
value: 'yearly'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Month'),
value: 'monthly'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Week'),
value: 'weekly'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Day'),
value: 'daily'
}],
value: type,
onChange: value => setAttributes({
type: value
})
}))), (0,external_React_namespaceObject.createElement)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)()
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, null, (0,external_React_namespaceObject.createElement)((external_wp_serverSideRender_default()), {
block: "core/archives",
skipBlockSupportAttributes: true,
attributes: attributes
}))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/archives/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/archives",
title: "Archives",
category: "widgets",
description: "Display a date archive of your posts.",
textdomain: "default",
attributes: {
displayAsDropdown: {
type: "boolean",
"default": false
},
showLabel: {
type: "boolean",
"default": true
},
showPostCounts: {
type: "boolean",
"default": false
},
type: {
type: "string",
"default": "monthly"
}
},
supports: {
align: true,
html: false,
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-archives-editor"
};
const {
name: archives_name
} = metadata;
const settings = {
icon: library_archive,
example: {},
edit: ArchivesEdit
};
const init = () => initBlock({
name: archives_name,
metadata,
settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js
/**
* WordPress dependencies
*/
const commentAuthorAvatar = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",
clipRule: "evenodd"
}));
/* harmony default export */ const comment_author_avatar = (commentAuthorAvatar);
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__(5755);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
;// CONCATENATED MODULE: external ["wp","url"]
const external_wp_url_namespaceObject = window["wp"]["url"];
;// CONCATENATED MODULE: external ["wp","coreData"]
const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
;// CONCATENATED MODULE: external ["wp","data"]
const external_wp_data_namespaceObject = window["wp"]["data"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/avatar/hooks.js
/**
* WordPress dependencies
*/
function getAvatarSizes(sizes) {
const minSize = sizes ? sizes[0] : 24;
const maxSize = sizes ? sizes[sizes.length - 1] : 96;
const maxSizeBuffer = Math.floor(maxSize * 2.5);
return {
minSize,
maxSize: maxSizeBuffer
};
}
function useDefaultAvatar() {
const {
avatarURL: defaultAvatarUrl
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
const {
__experimentalDiscussionSettings
} = getSettings();
return __experimentalDiscussionSettings;
});
return defaultAvatarUrl;
}
function useCommentAvatar({
commentId
}) {
const [avatars] = (0,external_wp_coreData_namespaceObject.useEntityProp)('root', 'comment', 'author_avatar_urls', commentId);
const [authorName] = (0,external_wp_coreData_namespaceObject.useEntityProp)('root', 'comment', 'author_name', commentId);
const avatarUrls = avatars ? Object.values(avatars) : null;
const sizes = avatars ? Object.keys(avatars) : null;
const {
minSize,
maxSize
} = getAvatarSizes(sizes);
const defaultAvatar = useDefaultAvatar();
return {
src: avatarUrls ? avatarUrls[avatarUrls.length - 1] : defaultAvatar,
minSize,
maxSize,
// translators: %s is the Author name.
alt: authorName ?
// translators: %s is the Author name.
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('%s Avatar'), authorName) : (0,external_wp_i18n_namespaceObject.__)('Default Avatar')
};
}
function useUserAvatar({
userId,
postId,
postType
}) {
const {
authorDetails
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditedEntityRecord,
getUser
} = select(external_wp_coreData_namespaceObject.store);
if (userId) {
return {
authorDetails: getUser(userId)
};
}
const _authorId = getEditedEntityRecord('postType', postType, postId)?.author;
return {
authorDetails: _authorId ? getUser(_authorId) : null
};
}, [postType, postId, userId]);
const avatarUrls = authorDetails?.avatar_urls ? Object.values(authorDetails.avatar_urls) : null;
const sizes = authorDetails?.avatar_urls ? Object.keys(authorDetails.avatar_urls) : null;
const {
minSize,
maxSize
} = getAvatarSizes(sizes);
const defaultAvatar = useDefaultAvatar();
return {
src: avatarUrls ? avatarUrls[avatarUrls.length - 1] : defaultAvatar,
minSize,
maxSize,
alt: authorDetails ?
// translators: %s is the Author name.
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('%s Avatar'), authorDetails?.name) : (0,external_wp_i18n_namespaceObject.__)('Default Avatar')
};
}
;// CONCATENATED MODULE: external ["wp","element"]
const external_wp_element_namespaceObject = window["wp"]["element"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/avatar/user-control.js
/**
* WordPress dependencies
*/
const AUTHORS_QUERY = {
who: 'authors',
per_page: -1,
_fields: 'id,name',
context: 'view'
};
function UserControl({
value,
onChange
}) {
const [filteredAuthorsList, setFilteredAuthorsList] = (0,external_wp_element_namespaceObject.useState)();
const authorsList = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getUsers
} = select(external_wp_coreData_namespaceObject.store);
return getUsers(AUTHORS_QUERY);
}, []);
if (!authorsList) {
return null;
}
const options = authorsList.map(author => {
return {
label: author.name,
value: author.id
};
});
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('User'),
help: (0,external_wp_i18n_namespaceObject.__)('Select the avatar user to display, if it is blank it will use the post/page author.'),
value: value,
onChange: onChange,
options: filteredAuthorsList || options,
onFilterValueChange: inputValue => setFilteredAuthorsList(options.filter(option => option.label.toLowerCase().startsWith(inputValue.toLowerCase())))
});
}
/* harmony default export */ const user_control = (UserControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/avatar/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const AvatarInspectorControls = ({
setAttributes,
avatar,
attributes,
selectUser
}) => (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Image size'),
onChange: newSize => setAttributes({
size: newSize
}),
min: avatar.minSize,
max: avatar.maxSize,
initialPosition: attributes?.size,
value: attributes?.size
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link to user profile'),
onChange: () => setAttributes({
isLink: !attributes.isLink
}),
checked: attributes.isLink
}), attributes.isLink && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: attributes.linkTarget === '_blank'
}), selectUser && (0,external_React_namespaceObject.createElement)(user_control, {
value: attributes?.userId,
onChange: value => {
setAttributes({
userId: value
});
}
})));
const ResizableAvatar = ({
setAttributes,
attributes,
avatar,
blockProps,
isSelected
}) => {
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes);
const doubledSizedSrc = (0,external_wp_url_namespaceObject.addQueryArgs)((0,external_wp_url_namespaceObject.removeQueryArgs)(avatar?.src, ['s']), {
s: attributes?.size * 2
});
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ResizableBox, {
size: {
width: attributes.size,
height: attributes.size
},
showHandle: isSelected,
onResizeStop: (event, direction, elt, delta) => {
setAttributes({
size: parseInt(attributes.size + (delta.height || delta.width), 10)
});
},
lockAspectRatio: true,
enable: {
top: false,
right: !(0,external_wp_i18n_namespaceObject.isRTL)(),
bottom: true,
left: (0,external_wp_i18n_namespaceObject.isRTL)()
},
minWidth: avatar.minSize,
maxWidth: avatar.maxSize
}, (0,external_React_namespaceObject.createElement)("img", {
src: doubledSizedSrc,
alt: avatar.alt,
className: classnames_default()('avatar', 'avatar-' + attributes.size, 'photo', 'wp-block-avatar__image', borderProps.className),
style: borderProps.style
})));
};
const CommentEdit = ({
attributes,
context,
setAttributes,
isSelected
}) => {
const {
commentId
} = context;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const avatar = useCommentAvatar({
commentId
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(AvatarInspectorControls, {
avatar: avatar,
setAttributes: setAttributes,
attributes: attributes,
selectUser: false
}), attributes.isLink ? (0,external_React_namespaceObject.createElement)("a", {
href: "#avatar-pseudo-link",
className: "wp-block-avatar__link",
onClick: event => event.preventDefault()
}, (0,external_React_namespaceObject.createElement)(ResizableAvatar, {
attributes: attributes,
avatar: avatar,
blockProps: blockProps,
isSelected: isSelected,
setAttributes: setAttributes
})) : (0,external_React_namespaceObject.createElement)(ResizableAvatar, {
attributes: attributes,
avatar: avatar,
blockProps: blockProps,
isSelected: isSelected,
setAttributes: setAttributes
}));
};
const UserEdit = ({
attributes,
context,
setAttributes,
isSelected
}) => {
const {
postId,
postType
} = context;
const avatar = useUserAvatar({
userId: attributes?.userId,
postId,
postType
});
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(AvatarInspectorControls, {
selectUser: true,
attributes: attributes,
avatar: avatar,
setAttributes: setAttributes
}), attributes.isLink ? (0,external_React_namespaceObject.createElement)("a", {
href: "#avatar-pseudo-link",
className: "wp-block-avatar__link",
onClick: event => event.preventDefault()
}, (0,external_React_namespaceObject.createElement)(ResizableAvatar, {
attributes: attributes,
avatar: avatar,
blockProps: blockProps,
isSelected: isSelected,
setAttributes: setAttributes
})) : (0,external_React_namespaceObject.createElement)(ResizableAvatar, {
attributes: attributes,
avatar: avatar,
blockProps: blockProps,
isSelected: isSelected,
setAttributes: setAttributes
}));
};
function Edit(props) {
// Don't show the Comment Edit controls if we have a comment ID set, or if we're in the Site Editor (where it is `null`).
if (props?.context?.commentId || props?.context?.commentId === null) {
return (0,external_React_namespaceObject.createElement)(CommentEdit, {
...props
});
}
return (0,external_React_namespaceObject.createElement)(UserEdit, {
...props
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/avatar/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const avatar_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/avatar",
title: "Avatar",
category: "theme",
description: "Add a user\u2019s avatar.",
textdomain: "default",
attributes: {
userId: {
type: "number"
},
size: {
type: "number",
"default": 96
},
isLink: {
type: "boolean",
"default": false
},
linkTarget: {
type: "string",
"default": "_self"
}
},
usesContext: ["postType", "postId", "commentId"],
supports: {
html: false,
align: true,
alignWide: false,
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
__experimentalBorder: {
__experimentalSkipSerialization: true,
radius: true,
width: true,
color: true,
style: true,
__experimentalDefaultControls: {
radius: true
}
},
color: {
text: false,
background: false,
__experimentalDuotone: "img"
},
interactivity: {
clientNavigation: true
}
},
selectors: {
border: ".wp-block-avatar img"
},
editorStyle: "wp-block-avatar-editor",
style: "wp-block-avatar"
};
const {
name: avatar_name
} = avatar_metadata;
const avatar_settings = {
icon: comment_author_avatar,
edit: Edit
};
const avatar_init = () => initBlock({
name: avatar_name,
metadata: avatar_metadata,
settings: avatar_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/audio.js
/**
* WordPress dependencies
*/
const audio = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.7 4.3c-1.2 0-2.8 0-3.8 1-.6.6-.9 1.5-.9 2.6V14c-.6-.6-1.5-1-2.5-1C8.6 13 7 14.6 7 16.5S8.6 20 10.5 20c1.5 0 2.8-1 3.3-2.3.5-.8.7-1.8.7-2.5V7.9c0-.7.2-1.2.5-1.6.6-.6 1.8-.6 2.8-.6h.3V4.3h-.4z"
}));
/* harmony default export */ const library_audio = (audio);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/audio/deprecated.js
/**
* WordPress dependencies
*/
/* harmony default export */ const deprecated = ([{
attributes: {
src: {
type: 'string',
source: 'attribute',
selector: 'audio',
attribute: 'src'
},
caption: {
type: 'string',
source: 'html',
selector: 'figcaption'
},
id: {
type: 'number'
},
autoplay: {
type: 'boolean',
source: 'attribute',
selector: 'audio',
attribute: 'autoplay'
},
loop: {
type: 'boolean',
source: 'attribute',
selector: 'audio',
attribute: 'loop'
},
preload: {
type: 'string',
source: 'attribute',
selector: 'audio',
attribute: 'preload'
}
},
supports: {
align: true
},
save({
attributes
}) {
const {
autoplay,
caption,
loop,
preload,
src
} = attributes;
return (0,external_React_namespaceObject.createElement)("figure", null, (0,external_React_namespaceObject.createElement)("audio", {
controls: "controls",
src: src,
autoPlay: autoplay,
loop: loop,
preload: preload
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: caption
}));
}
}]);
;// CONCATENATED MODULE: external ["wp","blob"]
const external_wp_blob_namespaceObject = window["wp"]["blob"];
;// CONCATENATED MODULE: external ["wp","notices"]
const external_wp_notices_namespaceObject = window["wp"]["notices"];
// EXTERNAL MODULE: ./node_modules/classnames/dedupe.js
var dedupe = __webpack_require__(1668);
var dedupe_default = /*#__PURE__*/__webpack_require__.n(dedupe);
;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js
/**
* 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 {(...args: any[]) => any} F
*
* @param {F} fn Function to memoize.
* @param {MemizeOptions} [options] Options object.
*
* @return {((...args: Parameters<F>) => ReturnType<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;
};
// 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;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/constants.js
const ASPECT_RATIOS = [
// Common video resolutions.
{
ratio: '2.33',
className: 'wp-embed-aspect-21-9'
}, {
ratio: '2.00',
className: 'wp-embed-aspect-18-9'
}, {
ratio: '1.78',
className: 'wp-embed-aspect-16-9'
}, {
ratio: '1.33',
className: 'wp-embed-aspect-4-3'
},
// Vertical video and instagram square video support.
{
ratio: '1.00',
className: 'wp-embed-aspect-1-1'
}, {
ratio: '0.56',
className: 'wp-embed-aspect-9-16'
}, {
ratio: '0.50',
className: 'wp-embed-aspect-1-2'
}];
const WP_EMBED_TYPE = 'wp-embed';
;// CONCATENATED MODULE: external ["wp","privateApis"]
const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/lock-unlock.js
/**
* WordPress dependencies
*/
const {
lock,
unlock
} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/block-library');
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/util.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const util_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/embed",
title: "Embed",
category: "embed",
description: "Add a block that displays content pulled from other sites, like Twitter or YouTube.",
textdomain: "default",
attributes: {
url: {
type: "string",
__experimentalRole: "content"
},
caption: {
type: "rich-text",
source: "rich-text",
selector: "figcaption",
__experimentalRole: "content"
},
type: {
type: "string",
__experimentalRole: "content"
},
providerNameSlug: {
type: "string",
__experimentalRole: "content"
},
allowResponsive: {
type: "boolean",
"default": true
},
responsive: {
type: "boolean",
"default": false,
__experimentalRole: "content"
},
previewable: {
type: "boolean",
"default": true,
__experimentalRole: "content"
}
},
supports: {
align: true,
spacing: {
margin: true
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-embed-editor",
style: "wp-block-embed"
};
const {
name: DEFAULT_EMBED_BLOCK
} = util_metadata;
/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */
/**
* Returns the embed block's information by matching the provided service provider
*
* @param {string} provider The embed block's provider
* @return {WPBlockVariation} The embed block's information
*/
const getEmbedInfoByProvider = provider => (0,external_wp_blocks_namespaceObject.getBlockVariations)(DEFAULT_EMBED_BLOCK)?.find(({
name
}) => name === provider);
/**
* Returns true if any of the regular expressions match the URL.
*
* @param {string} url The URL to test.
* @param {Array} patterns The list of regular expressions to test agains.
* @return {boolean} True if any of the regular expressions match the URL.
*/
const matchesPatterns = (url, patterns = []) => patterns.some(pattern => url.match(pattern));
/**
* Finds the block variation that should be used for the URL,
* based on the provided URL and the variation's patterns.
*
* @param {string} url The URL to test.
* @return {WPBlockVariation} The block variation that should be used for this URL
*/
const findMoreSuitableBlock = url => (0,external_wp_blocks_namespaceObject.getBlockVariations)(DEFAULT_EMBED_BLOCK)?.find(({
patterns
}) => matchesPatterns(url, patterns));
const isFromWordPress = html => html && html.includes('class="wp-embedded-content"');
const getPhotoHtml = photo => {
// If full image url not found use thumbnail.
const imageUrl = photo.url || photo.thumbnail_url;
// 100% width for the preview so it fits nicely into the document, some "thumbnails" are
// actually the full size photo.
const photoPreview = (0,external_React_namespaceObject.createElement)("p", null, (0,external_React_namespaceObject.createElement)("img", {
src: imageUrl,
alt: photo.title,
width: "100%"
}));
return (0,external_wp_element_namespaceObject.renderToString)(photoPreview);
};
/**
* Creates a more suitable embed block based on the passed in props
* and attributes generated from an embed block's preview.
*
* We require `attributesFromPreview` to be generated from the latest attributes
* and preview, and because of the way the react lifecycle operates, we can't
* guarantee that the attributes contained in the block's props are the latest
* versions, so we require that these are generated separately.
* See `getAttributesFromPreview` in the generated embed edit component.
*
* @param {Object} props The block's props.
* @param {Object} [attributesFromPreview] Attributes generated from the block's most up to date preview.
* @return {Object|undefined} A more suitable embed block if one exists.
*/
const createUpgradedEmbedBlock = (props, attributesFromPreview = {}) => {
const {
preview,
attributes = {}
} = props;
const {
url,
providerNameSlug,
type,
...restAttributes
} = attributes;
if (!url || !(0,external_wp_blocks_namespaceObject.getBlockType)(DEFAULT_EMBED_BLOCK)) return;
const matchedBlock = findMoreSuitableBlock(url);
// WordPress blocks can work on multiple sites, and so don't have patterns,
// so if we're in a WordPress block, assume the user has chosen it for a WordPress URL.
const isCurrentBlockWP = providerNameSlug === 'wordpress' || type === WP_EMBED_TYPE;
// If current block is not WordPress and a more suitable block found
// that is different from the current one, create the new matched block.
const shouldCreateNewBlock = !isCurrentBlockWP && matchedBlock && (matchedBlock.attributes.providerNameSlug !== providerNameSlug || !providerNameSlug);
if (shouldCreateNewBlock) {
return (0,external_wp_blocks_namespaceObject.createBlock)(DEFAULT_EMBED_BLOCK, {
url,
...restAttributes,
...matchedBlock.attributes
});
}
const wpVariation = (0,external_wp_blocks_namespaceObject.getBlockVariations)(DEFAULT_EMBED_BLOCK)?.find(({
name
}) => name === 'wordpress');
// We can't match the URL for WordPress embeds, we have to check the HTML instead.
if (!wpVariation || !preview || !isFromWordPress(preview.html) || isCurrentBlockWP) {
return;
}
// This is not the WordPress embed block so transform it into one.
return (0,external_wp_blocks_namespaceObject.createBlock)(DEFAULT_EMBED_BLOCK, {
url,
...wpVariation.attributes,
// By now we have the preview, but when the new block first renders, it
// won't have had all the attributes set, and so won't get the correct
// type and it won't render correctly. So, we pass through the current attributes
// here so that the initial render works when we switch to the WordPress
// block. This only affects the WordPress block because it can't be
// rendered in the usual Sandbox (it has a sandbox of its own) and it
// relies on the preview to set the correct render type.
...attributesFromPreview
});
};
/**
* Determine if the block already has an aspect ratio class applied.
*
* @param {string} existingClassNames Existing block classes.
* @return {boolean} True or false if the classnames contain an aspect ratio class.
*/
const hasAspectRatioClass = existingClassNames => {
if (!existingClassNames) {
return false;
}
return ASPECT_RATIOS.some(({
className
}) => existingClassNames.includes(className));
};
/**
* Removes all previously set aspect ratio related classes and return the rest
* existing class names.
*
* @param {string} existingClassNames Any existing class names.
* @return {string} The class names without any aspect ratio related class.
*/
const removeAspectRatioClasses = existingClassNames => {
if (!existingClassNames) {
// Avoids extraneous work and also, by returning the same value as
// received, ensures the post is not dirtied by a change of the block
// attribute from `undefined` to an emtpy string.
return existingClassNames;
}
const aspectRatioClassNames = ASPECT_RATIOS.reduce((accumulator, {
className
}) => {
accumulator[className] = false;
return accumulator;
}, {
'wp-has-aspect-ratio': false
});
return dedupe_default()(existingClassNames, aspectRatioClassNames);
};
/**
* Returns class names with any relevant responsive aspect ratio names.
*
* @param {string} html The preview HTML that possibly contains an iframe with width and height set.
* @param {string} existingClassNames Any existing class names.
* @param {boolean} allowResponsive If the responsive class names should be added, or removed.
* @return {string} Deduped class names.
*/
function getClassNames(html, existingClassNames, allowResponsive = true) {
if (!allowResponsive) {
return removeAspectRatioClasses(existingClassNames);
}
const previewDocument = document.implementation.createHTMLDocument('');
previewDocument.body.innerHTML = html;
const iframe = previewDocument.body.querySelector('iframe');
// If we have a fixed aspect iframe, and it's a responsive embed block.
if (iframe && iframe.height && iframe.width) {
const aspectRatio = (iframe.width / iframe.height).toFixed(2);
// Given the actual aspect ratio, find the widest ratio to support it.
for (let ratioIndex = 0; ratioIndex < ASPECT_RATIOS.length; ratioIndex++) {
const potentialRatio = ASPECT_RATIOS[ratioIndex];
if (aspectRatio >= potentialRatio.ratio) {
// Evaluate the difference between actual aspect ratio and closest match.
// If the difference is too big, do not scale the embed according to aspect ratio.
const ratioDiff = aspectRatio - potentialRatio.ratio;
if (ratioDiff > 0.1) {
// No close aspect ratio match found.
return removeAspectRatioClasses(existingClassNames);
}
// Close aspect ratio match found.
return dedupe_default()(removeAspectRatioClasses(existingClassNames), potentialRatio.className, 'wp-has-aspect-ratio');
}
}
}
return existingClassNames;
}
/**
* Fallback behaviour for unembeddable URLs.
* 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 fallback(url, onReplace) {
const link = (0,external_React_namespaceObject.createElement)("a", {
href: url
}, url);
onReplace((0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: (0,external_wp_element_namespaceObject.renderToString)(link)
}));
}
/***
* Gets block attributes based on the preview and responsive state.
*
* @param {Object} preview The preview data.
* @param {string} title The block's title, e.g. Twitter.
* @param {Object} currentClassNames The block's current class names.
* @param {boolean} isResponsive Boolean indicating if the block supports responsive content.
* @param {boolean} allowResponsive Apply responsive classes to fixed size content.
* @return {Object} Attributes and values.
*/
const getAttributesFromPreview = memize((preview, title, currentClassNames, isResponsive, allowResponsive = true) => {
if (!preview) {
return {};
}
const attributes = {};
// Some plugins only return HTML with no type info, so default this to 'rich'.
let {
type = 'rich'
} = preview;
// If we got a provider name from the API, use it for the slug, otherwise we use the title,
// because not all embed code gives us a provider name.
const {
html,
provider_name: providerName
} = preview;
const {
kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
const providerNameSlug = kebabCase((providerName || title).toLowerCase());
if (isFromWordPress(html)) {
type = WP_EMBED_TYPE;
}
if (html || 'photo' === type) {
attributes.type = type;
attributes.providerNameSlug = providerNameSlug;
}
// Aspect ratio classes are removed when the embed URL is updated.
// If the embed already has an aspect ratio class, that means the URL has not changed.
// Which also means no need to regenerate it with getClassNames.
if (hasAspectRatioClass(currentClassNames)) {
return attributes;
}
attributes.className = getClassNames(html, currentClassNames, isResponsive && allowResponsive);
return attributes;
});
/**
* Returns the attributes derived from the preview, merged with the current attributes.
*
* @param {Object} currentAttributes The current attributes of the block.
* @param {Object} preview The preview data.
* @param {string} title The block's title, e.g. Twitter.
* @param {boolean} isResponsive Boolean indicating if the block supports responsive content.
* @return {Object} Merged attributes.
*/
const getMergedAttributesWithPreview = (currentAttributes, preview, title, isResponsive) => {
const {
allowResponsive,
className
} = currentAttributes;
return {
...currentAttributes,
...getAttributesFromPreview(preview, title, className, isResponsive, allowResponsive)
};
};
;// CONCATENATED MODULE: external ["wp","compose"]
const external_wp_compose_namespaceObject = window["wp"]["compose"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/caption.js
/**
* WordPress dependencies
*/
const caption = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M6 5.5h12a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5ZM4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6Zm4 10h2v-1.5H8V16Zm5 0h-2v-1.5h2V16Zm1 0h2v-1.5h-2V16Z"
}));
/* harmony default export */ const library_caption = (caption);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/utils/caption.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
PrivateRichText: RichText
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function Caption({
key = 'caption',
attributes,
setAttributes,
isSelected,
insertBlocksAfter,
placeholder = (0,external_wp_i18n_namespaceObject.__)('Add caption'),
label = (0,external_wp_i18n_namespaceObject.__)('Caption text'),
showToolbarButton = true,
className,
disableEditing
}) {
const caption = attributes[key];
const prevCaption = (0,external_wp_compose_namespaceObject.usePrevious)(caption);
const isCaptionEmpty = RichText.isEmpty(caption);
const isPrevCaptionEmpty = RichText.isEmpty(prevCaption);
const [showCaption, setShowCaption] = (0,external_wp_element_namespaceObject.useState)(!isCaptionEmpty);
// We need to show the caption when changes come from
// history navigation(undo/redo).
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isCaptionEmpty && isPrevCaptionEmpty) {
setShowCaption(true);
}
}, [isCaptionEmpty, isPrevCaptionEmpty]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isSelected && isCaptionEmpty) {
setShowCaption(false);
}
}, [isSelected, isCaptionEmpty]);
// Focus the caption when we click to add one.
const ref = (0,external_wp_element_namespaceObject.useCallback)(node => {
if (node && isCaptionEmpty) {
node.focus();
}
}, [isCaptionEmpty]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, showToolbarButton && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: () => {
setShowCaption(!showCaption);
if (showCaption && caption) {
setAttributes({
caption: undefined
});
}
},
icon: library_caption,
isPressed: showCaption,
label: showCaption ? (0,external_wp_i18n_namespaceObject.__)('Remove caption') : (0,external_wp_i18n_namespaceObject.__)('Add caption')
})), showCaption && (!RichText.isEmpty(caption) || isSelected) && (0,external_React_namespaceObject.createElement)(RichText, {
identifier: key,
tagName: "figcaption",
className: classnames_default()(className, (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption')),
ref: ref,
"aria-label": label,
placeholder: placeholder,
value: caption,
onChange: value => setAttributes({
caption: value
}),
inlineToolbar: true,
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)())),
disableEditing: disableEditing
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/audio/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ALLOWED_MEDIA_TYPES = ['audio'];
function AudioEdit({
attributes,
className,
setAttributes,
onReplace,
isSelected: isSingleSelected,
insertBlocksAfter
}) {
const {
id,
autoplay,
loop,
preload,
src
} = attributes;
const isTemporaryAudio = !id && (0,external_wp_blob_namespaceObject.isBlobURL)(src);
const {
getSettings
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!id && (0,external_wp_blob_namespaceObject.isBlobURL)(src)) {
const file = (0,external_wp_blob_namespaceObject.getBlobByURL)(src);
if (file) {
getSettings().mediaUpload({
filesList: [file],
onFileChange: ([media]) => onSelectAudio(media),
onError: e => onUploadError(e),
allowedTypes: ALLOWED_MEDIA_TYPES
});
}
}
}, []);
function toggleAttribute(attribute) {
return newValue => {
setAttributes({
[attribute]: newValue
});
};
}
function onSelectURL(newSrc) {
// Set the block's src from the edit component's state, and switch off
// the editing UI.
if (newSrc !== src) {
// Check if there's an embed block that handles this URL.
const embedBlock = createUpgradedEmbedBlock({
attributes: {
url: newSrc
}
});
if (undefined !== embedBlock && onReplace) {
onReplace(embedBlock);
return;
}
setAttributes({
src: newSrc,
id: undefined
});
}
}
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
function onUploadError(message) {
createErrorNotice(message, {
type: 'snackbar'
});
}
function getAutoplayHelp(checked) {
return checked ? (0,external_wp_i18n_namespaceObject.__)('Autoplay may cause usability issues for some users.') : null;
}
function onSelectAudio(media) {
if (!media || !media.url) {
// In this case there was an error and we should continue in the editing state
// previous attributes should be removed because they may be temporary blob urls.
setAttributes({
src: undefined,
id: undefined,
caption: undefined
});
return;
}
// Sets the block's attribute and updates the edit component from the
// selected media, then switches off the editing UI.
setAttributes({
src: media.url,
id: media.id,
caption: media.caption
});
}
const classes = classnames_default()(className, {
'is-transient': isTemporaryAudio
});
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classes
});
if (!src) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: library_audio
}),
onSelect: onSelectAudio,
onSelectURL: onSelectURL,
accept: "audio/*",
allowedTypes: ALLOWED_MEDIA_TYPES,
value: attributes,
onError: onUploadError
}));
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, isSingleSelected && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, {
mediaId: id,
mediaURL: src,
allowedTypes: ALLOWED_MEDIA_TYPES,
accept: "audio/*",
onSelect: onSelectAudio,
onSelectURL: onSelectURL,
onError: onUploadError
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Autoplay'),
onChange: toggleAttribute('autoplay'),
checked: autoplay,
help: getAutoplayHelp
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Loop'),
onChange: toggleAttribute('loop'),
checked: loop
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject._x)('Preload', 'noun; Audio block parameter'),
value: preload || ''
// `undefined` is required for the preload attribute to be unset.
,
onChange: value => setAttributes({
preload: value || undefined
}),
options: [{
value: '',
label: (0,external_wp_i18n_namespaceObject.__)('Browser default')
}, {
value: 'auto',
label: (0,external_wp_i18n_namespaceObject.__)('Auto')
}, {
value: 'metadata',
label: (0,external_wp_i18n_namespaceObject.__)('Metadata')
}, {
value: 'none',
label: (0,external_wp_i18n_namespaceObject._x)('None', 'Preload value')
}]
}))), (0,external_React_namespaceObject.createElement)("figure", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, {
isDisabled: !isSingleSelected
}, (0,external_React_namespaceObject.createElement)("audio", {
controls: "controls",
src: src
})), isTemporaryAudio && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_React_namespaceObject.createElement)(Caption, {
attributes: attributes,
setAttributes: setAttributes,
isSelected: isSingleSelected,
insertBlocksAfter: insertBlocksAfter,
label: (0,external_wp_i18n_namespaceObject.__)('Audio caption text'),
showToolbarButton: isSingleSelected
})));
}
/* harmony default export */ const edit = (AudioEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/audio/save.js
/**
* WordPress dependencies
*/
function save({
attributes
}) {
const {
autoplay,
caption,
loop,
preload,
src
} = attributes;
return src && (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, (0,external_React_namespaceObject.createElement)("audio", {
controls: "controls",
src: src,
autoPlay: autoplay,
loop: loop,
preload: preload
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: caption,
className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption')
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/audio/transforms.js
/**
* WordPress dependencies
*/
const transforms = {
from: [{
type: 'files',
isMatch(files) {
return files.length === 1 && files[0].type.indexOf('audio/') === 0;
},
transform(files) {
const file = files[0];
// We don't need to upload the media directly here
// It's already done as part of the `componentDidMount`
// in the audio block.
const block = (0,external_wp_blocks_namespaceObject.createBlock)('core/audio', {
src: (0,external_wp_blob_namespaceObject.createBlobURL)(file)
});
return block;
}
}, {
type: 'shortcode',
tag: 'audio',
attributes: {
src: {
type: 'string',
shortcode: ({
named: {
src,
mp3,
m4a,
ogg,
wav,
wma
}
}) => {
return src || mp3 || m4a || ogg || wav || wma;
}
},
loop: {
type: 'string',
shortcode: ({
named: {
loop
}
}) => {
return loop;
}
},
autoplay: {
type: 'string',
shortcode: ({
named: {
autoplay
}
}) => {
return autoplay;
}
},
preload: {
type: 'string',
shortcode: ({
named: {
preload
}
}) => {
return preload;
}
}
}
}]
};
/* harmony default export */ const audio_transforms = (transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/audio/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const audio_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/audio",
title: "Audio",
category: "media",
description: "Embed a simple audio player.",
keywords: ["music", "sound", "podcast", "recording"],
textdomain: "default",
attributes: {
src: {
type: "string",
source: "attribute",
selector: "audio",
attribute: "src",
__experimentalRole: "content"
},
caption: {
type: "rich-text",
source: "rich-text",
selector: "figcaption",
__experimentalRole: "content"
},
id: {
type: "number",
__experimentalRole: "content"
},
autoplay: {
type: "boolean",
source: "attribute",
selector: "audio",
attribute: "autoplay"
},
loop: {
type: "boolean",
source: "attribute",
selector: "audio",
attribute: "loop"
},
preload: {
type: "string",
source: "attribute",
selector: "audio",
attribute: "preload"
}
},
supports: {
anchor: true,
align: true,
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-audio-editor",
style: "wp-block-audio"
};
const {
name: audio_name
} = audio_metadata;
const audio_settings = {
icon: library_audio,
example: {
attributes: {
src: 'https://upload.wikimedia.org/wikipedia/commons/d/dd/Armstrong_Small_Step.ogg'
},
viewportWidth: 350
},
transforms: audio_transforms,
deprecated: deprecated,
edit: edit,
save: save
};
const audio_init = () => initBlock({
name: audio_name,
metadata: audio_metadata,
settings: audio_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/button.js
/**
* WordPress dependencies
*/
const button_button = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z"
}));
/* harmony default export */ const library_button = (button_button);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/utils/migrate-font-family.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
cleanEmptyObject
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
/**
* Migrates the current style.typography.fontFamily attribute,
* whose value was "var:preset|font-family|helvetica-arial",
* to the style.fontFamily attribute, whose value will be "helvetica-arial".
*
* @param {Object} attributes The current attributes
* @return {Object} The updated attributes.
*/
/* harmony default export */ function migrate_font_family(attributes) {
if (!attributes?.style?.typography?.fontFamily) {
return attributes;
}
const {
fontFamily,
...typography
} = attributes.style.typography;
return {
...attributes,
style: cleanEmptyObject({
...attributes.style,
typography
}),
fontFamily: fontFamily.split('|').pop()
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/button/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const migrateBorderRadius = attributes => {
const {
borderRadius,
...newAttributes
} = attributes;
// We have to check old property `borderRadius` and if
// `styles.border.radius` is a `number`
const oldBorderRadius = [borderRadius, newAttributes.style?.border?.radius].find(possibleBorderRadius => {
return typeof possibleBorderRadius === 'number' && possibleBorderRadius !== 0;
});
if (!oldBorderRadius) {
return newAttributes;
}
return {
...newAttributes,
style: {
...newAttributes.style,
border: {
...newAttributes.style?.border,
radius: `${oldBorderRadius}px`
}
}
};
};
function migrateAlign(attributes) {
if (!attributes.align) {
return attributes;
}
const {
align,
...otherAttributes
} = attributes;
return {
...otherAttributes,
className: classnames_default()(otherAttributes.className, `align${attributes.align}`)
};
}
const migrateCustomColorsAndGradients = attributes => {
if (!attributes.customTextColor && !attributes.customBackgroundColor && !attributes.customGradient) {
return attributes;
}
const style = {
color: {}
};
if (attributes.customTextColor) {
style.color.text = attributes.customTextColor;
}
if (attributes.customBackgroundColor) {
style.color.background = attributes.customBackgroundColor;
}
if (attributes.customGradient) {
style.color.gradient = attributes.customGradient;
}
const {
customTextColor,
customBackgroundColor,
customGradient,
...restAttributes
} = attributes;
return {
...restAttributes,
style
};
};
const oldColorsMigration = attributes => {
const {
color,
textColor,
...restAttributes
} = {
...attributes,
customTextColor: attributes.textColor && '#' === attributes.textColor[0] ? attributes.textColor : undefined,
customBackgroundColor: attributes.color && '#' === attributes.color[0] ? attributes.color : undefined
};
return migrateCustomColorsAndGradients(restAttributes);
};
const blockAttributes = {
url: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'href'
},
title: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'title'
},
text: {
type: 'string',
source: 'html',
selector: 'a'
}
};
const v11 = {
attributes: {
url: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'href'
},
title: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'title'
},
text: {
type: 'string',
source: 'html',
selector: 'a'
},
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'target'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'rel'
},
placeholder: {
type: 'string'
},
backgroundColor: {
type: 'string'
},
textColor: {
type: 'string'
},
gradient: {
type: 'string'
},
width: {
type: 'number'
}
},
supports: {
anchor: true,
align: true,
alignWide: false,
color: {
__experimentalSkipSerialization: true,
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
typography: {
fontSize: true,
__experimentalFontFamily: true,
__experimentalDefaultControls: {
fontSize: true
}
},
reusable: false,
spacing: {
__experimentalSkipSerialization: true,
padding: ['horizontal', 'vertical'],
__experimentalDefaultControls: {
padding: true
}
},
__experimentalBorder: {
radius: true,
__experimentalSkipSerialization: true,
__experimentalDefaultControls: {
radius: true
}
},
__experimentalSelector: '.wp-block-button__link'
},
save({
attributes,
className
}) {
const {
fontSize,
linkTarget,
rel,
style,
text,
title,
url,
width
} = attributes;
if (!text) {
return null;
}
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes);
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetColorClassesAndStyles)(attributes);
const spacingProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetSpacingClassesAndStyles)(attributes);
const buttonClasses = classnames_default()('wp-block-button__link', colorProps.className, borderProps.className, {
// For backwards compatibility add style that isn't provided via
// block support.
'no-border-radius': style?.border?.radius === 0
});
const buttonStyle = {
...borderProps.style,
...colorProps.style,
...spacingProps.style
};
// The use of a `title` attribute here is soft-deprecated, but still applied
// if it had already been assigned, for the sake of backward-compatibility.
// A title will no longer be assigned for new or updated button block links.
const wrapperClasses = classnames_default()(className, {
[`has-custom-width wp-block-button__width-${width}`]: width,
[`has-custom-font-size`]: fontSize || style?.typography?.fontSize
});
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: wrapperClasses
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "a",
className: buttonClasses,
href: url,
title: title,
style: buttonStyle,
value: text,
target: linkTarget,
rel: rel
}));
}
};
const v10 = {
attributes: {
url: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'href'
},
title: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'title'
},
text: {
type: 'string',
source: 'html',
selector: 'a'
},
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'target'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'rel'
},
placeholder: {
type: 'string'
},
backgroundColor: {
type: 'string'
},
textColor: {
type: 'string'
},
gradient: {
type: 'string'
},
width: {
type: 'number'
}
},
supports: {
anchor: true,
align: true,
alignWide: false,
color: {
__experimentalSkipSerialization: true,
gradients: true
},
typography: {
fontSize: true,
__experimentalFontFamily: true
},
reusable: false,
spacing: {
__experimentalSkipSerialization: true,
padding: ['horizontal', 'vertical'],
__experimentalDefaultControls: {
padding: true
}
},
__experimentalBorder: {
radius: true,
__experimentalSkipSerialization: true
},
__experimentalSelector: '.wp-block-button__link'
},
save({
attributes,
className
}) {
const {
fontSize,
linkTarget,
rel,
style,
text,
title,
url,
width
} = attributes;
if (!text) {
return null;
}
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes);
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetColorClassesAndStyles)(attributes);
const spacingProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetSpacingClassesAndStyles)(attributes);
const buttonClasses = classnames_default()('wp-block-button__link', colorProps.className, borderProps.className, {
// For backwards compatibility add style that isn't provided via
// block support.
'no-border-radius': style?.border?.radius === 0
});
const buttonStyle = {
...borderProps.style,
...colorProps.style,
...spacingProps.style
};
// The use of a `title` attribute here is soft-deprecated, but still applied
// if it had already been assigned, for the sake of backward-compatibility.
// A title will no longer be assigned for new or updated button block links.
const wrapperClasses = classnames_default()(className, {
[`has-custom-width wp-block-button__width-${width}`]: width,
[`has-custom-font-size`]: fontSize || style?.typography?.fontSize
});
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: wrapperClasses
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "a",
className: buttonClasses,
href: url,
title: title,
style: buttonStyle,
value: text,
target: linkTarget,
rel: rel
}));
},
migrate: migrate_font_family,
isEligible({
style
}) {
return style?.typography?.fontFamily;
}
};
const deprecated_deprecated = [v11, v10, {
supports: {
anchor: true,
align: true,
alignWide: false,
color: {
__experimentalSkipSerialization: true,
gradients: true
},
typography: {
fontSize: true,
__experimentalFontFamily: true
},
reusable: false,
__experimentalSelector: '.wp-block-button__link'
},
attributes: {
...blockAttributes,
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'target'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'rel'
},
placeholder: {
type: 'string'
},
backgroundColor: {
type: 'string'
},
textColor: {
type: 'string'
},
gradient: {
type: 'string'
},
width: {
type: 'number'
}
},
isEligible({
style
}) {
return typeof style?.border?.radius === 'number';
},
save({
attributes,
className
}) {
const {
fontSize,
linkTarget,
rel,
style,
text,
title,
url,
width
} = attributes;
if (!text) {
return null;
}
const borderRadius = style?.border?.radius;
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetColorClassesAndStyles)(attributes);
const buttonClasses = classnames_default()('wp-block-button__link', colorProps.className, {
'no-border-radius': style?.border?.radius === 0
});
const buttonStyle = {
borderRadius: borderRadius ? borderRadius : undefined,
...colorProps.style
};
// The use of a `title` attribute here is soft-deprecated, but still applied
// if it had already been assigned, for the sake of backward-compatibility.
// A title will no longer be assigned for new or updated button block links.
const wrapperClasses = classnames_default()(className, {
[`has-custom-width wp-block-button__width-${width}`]: width,
[`has-custom-font-size`]: fontSize || style?.typography?.fontSize
});
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: wrapperClasses
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "a",
className: buttonClasses,
href: url,
title: title,
style: buttonStyle,
value: text,
target: linkTarget,
rel: rel
}));
},
migrate: (0,external_wp_compose_namespaceObject.compose)(migrate_font_family, migrateBorderRadius)
}, {
supports: {
anchor: true,
align: true,
alignWide: false,
color: {
__experimentalSkipSerialization: true
},
reusable: false,
__experimentalSelector: '.wp-block-button__link'
},
attributes: {
...blockAttributes,
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'target'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'rel'
},
placeholder: {
type: 'string'
},
borderRadius: {
type: 'number'
},
backgroundColor: {
type: 'string'
},
textColor: {
type: 'string'
},
gradient: {
type: 'string'
},
style: {
type: 'object'
},
width: {
type: 'number'
}
},
save({
attributes,
className
}) {
const {
borderRadius,
linkTarget,
rel,
text,
title,
url,
width
} = attributes;
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetColorClassesAndStyles)(attributes);
const buttonClasses = classnames_default()('wp-block-button__link', colorProps.className, {
'no-border-radius': borderRadius === 0
});
const buttonStyle = {
borderRadius: borderRadius ? borderRadius + 'px' : undefined,
...colorProps.style
};
// The use of a `title` attribute here is soft-deprecated, but still applied
// if it had already been assigned, for the sake of backward-compatibility.
// A title will no longer be assigned for new or updated button block links.
const wrapperClasses = classnames_default()(className, {
[`has-custom-width wp-block-button__width-${width}`]: width
});
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: wrapperClasses
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "a",
className: buttonClasses,
href: url,
title: title,
style: buttonStyle,
value: text,
target: linkTarget,
rel: rel
}));
},
migrate: (0,external_wp_compose_namespaceObject.compose)(migrate_font_family, migrateBorderRadius)
}, {
supports: {
anchor: true,
align: true,
alignWide: false,
color: {
__experimentalSkipSerialization: true
},
reusable: false,
__experimentalSelector: '.wp-block-button__link'
},
attributes: {
...blockAttributes,
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'target'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'rel'
},
placeholder: {
type: 'string'
},
borderRadius: {
type: 'number'
},
backgroundColor: {
type: 'string'
},
textColor: {
type: 'string'
},
gradient: {
type: 'string'
},
style: {
type: 'object'
},
width: {
type: 'number'
}
},
save({
attributes,
className
}) {
const {
borderRadius,
linkTarget,
rel,
text,
title,
url,
width
} = attributes;
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetColorClassesAndStyles)(attributes);
const buttonClasses = classnames_default()('wp-block-button__link', colorProps.className, {
'no-border-radius': borderRadius === 0
});
const buttonStyle = {
borderRadius: borderRadius ? borderRadius + 'px' : undefined,
...colorProps.style
};
// The use of a `title` attribute here is soft-deprecated, but still applied
// if it had already been assigned, for the sake of backward-compatibility.
// A title will no longer be assigned for new or updated button block links.
const wrapperClasses = classnames_default()(className, {
[`has-custom-width wp-block-button__width-${width}`]: width
});
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: wrapperClasses
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "a",
className: buttonClasses,
href: url,
title: title,
style: buttonStyle,
value: text,
target: linkTarget,
rel: rel
}));
},
migrate: (0,external_wp_compose_namespaceObject.compose)(migrate_font_family, migrateBorderRadius)
}, {
supports: {
align: true,
alignWide: false,
color: {
gradients: true
}
},
attributes: {
...blockAttributes,
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'target'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'rel'
},
placeholder: {
type: 'string'
},
borderRadius: {
type: 'number'
},
backgroundColor: {
type: 'string'
},
textColor: {
type: 'string'
},
gradient: {
type: 'string'
},
style: {
type: 'object'
}
},
save({
attributes
}) {
const {
borderRadius,
linkTarget,
rel,
text,
title,
url
} = attributes;
const buttonClasses = classnames_default()('wp-block-button__link', {
'no-border-radius': borderRadius === 0
});
const buttonStyle = {
borderRadius: borderRadius ? borderRadius + 'px' : undefined
};
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "a",
className: buttonClasses,
href: url,
title: title,
style: buttonStyle,
value: text,
target: linkTarget,
rel: rel
});
},
migrate: migrateBorderRadius
}, {
supports: {
align: true,
alignWide: false
},
attributes: {
...blockAttributes,
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'target'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'rel'
},
placeholder: {
type: 'string'
},
borderRadius: {
type: 'number'
},
backgroundColor: {
type: 'string'
},
textColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
customTextColor: {
type: 'string'
},
customGradient: {
type: 'string'
},
gradient: {
type: 'string'
}
},
isEligible: attributes => !!attributes.customTextColor || !!attributes.customBackgroundColor || !!attributes.customGradient || !!attributes.align,
migrate: (0,external_wp_compose_namespaceObject.compose)(migrateBorderRadius, migrateCustomColorsAndGradients, migrateAlign),
save({
attributes
}) {
const {
backgroundColor,
borderRadius,
customBackgroundColor,
customTextColor,
customGradient,
linkTarget,
gradient,
rel,
text,
textColor,
title,
url
} = attributes;
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const backgroundClass = !customGradient && (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const gradientClass = (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(gradient);
const buttonClasses = classnames_default()('wp-block-button__link', {
'has-text-color': textColor || customTextColor,
[textClass]: textClass,
'has-background': backgroundColor || customBackgroundColor || customGradient || gradient,
[backgroundClass]: backgroundClass,
'no-border-radius': borderRadius === 0,
[gradientClass]: gradientClass
});
const buttonStyle = {
background: customGradient ? customGradient : undefined,
backgroundColor: backgroundClass || customGradient || gradient ? undefined : customBackgroundColor,
color: textClass ? undefined : customTextColor,
borderRadius: borderRadius ? borderRadius + 'px' : undefined
};
// The use of a `title` attribute here is soft-deprecated, but still applied
// if it had already been assigned, for the sake of backward-compatibility.
// A title will no longer be assigned for new or updated button block links.
return (0,external_React_namespaceObject.createElement)("div", null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "a",
className: buttonClasses,
href: url,
title: title,
style: buttonStyle,
value: text,
target: linkTarget,
rel: rel
}));
}
}, {
attributes: {
...blockAttributes,
align: {
type: 'string',
default: 'none'
},
backgroundColor: {
type: 'string'
},
textColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
customTextColor: {
type: 'string'
},
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'target'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'rel'
},
placeholder: {
type: 'string'
}
},
isEligible(attribute) {
return attribute.className && attribute.className.includes('is-style-squared');
},
migrate(attributes) {
let newClassName = attributes.className;
if (newClassName) {
newClassName = newClassName.replace(/is-style-squared[\s]?/, '').trim();
}
return migrateBorderRadius(migrateCustomColorsAndGradients({
...attributes,
className: newClassName ? newClassName : undefined,
borderRadius: 0
}));
},
save({
attributes
}) {
const {
backgroundColor,
customBackgroundColor,
customTextColor,
linkTarget,
rel,
text,
textColor,
title,
url
} = attributes;
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const buttonClasses = classnames_default()('wp-block-button__link', {
'has-text-color': textColor || customTextColor,
[textClass]: textClass,
'has-background': backgroundColor || customBackgroundColor,
[backgroundClass]: backgroundClass
});
const buttonStyle = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
color: textClass ? undefined : customTextColor
};
return (0,external_React_namespaceObject.createElement)("div", null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "a",
className: buttonClasses,
href: url,
title: title,
style: buttonStyle,
value: text,
target: linkTarget,
rel: rel
}));
}
}, {
attributes: {
...blockAttributes,
align: {
type: 'string',
default: 'none'
},
backgroundColor: {
type: 'string'
},
textColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
customTextColor: {
type: 'string'
}
},
migrate: oldColorsMigration,
save({
attributes
}) {
const {
url,
text,
title,
backgroundColor,
textColor,
customBackgroundColor,
customTextColor
} = attributes;
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const buttonClasses = classnames_default()('wp-block-button__link', {
'has-text-color': textColor || customTextColor,
[textClass]: textClass,
'has-background': backgroundColor || customBackgroundColor,
[backgroundClass]: backgroundClass
});
const buttonStyle = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
color: textClass ? undefined : customTextColor
};
return (0,external_React_namespaceObject.createElement)("div", null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "a",
className: buttonClasses,
href: url,
title: title,
style: buttonStyle,
value: text
}));
}
}, {
attributes: {
...blockAttributes,
color: {
type: 'string'
},
textColor: {
type: 'string'
},
align: {
type: 'string',
default: 'none'
}
},
save({
attributes
}) {
const {
url,
text,
title,
align,
color,
textColor
} = attributes;
const buttonStyle = {
backgroundColor: color,
color: textColor
};
const linkClass = 'wp-block-button__link';
return (0,external_React_namespaceObject.createElement)("div", {
className: `align${align}`
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "a",
className: linkClass,
href: url,
title: title,
style: buttonStyle,
value: text
}));
},
migrate: oldColorsMigration
}, {
attributes: {
...blockAttributes,
color: {
type: 'string'
},
textColor: {
type: 'string'
},
align: {
type: 'string',
default: 'none'
}
},
save({
attributes
}) {
const {
url,
text,
title,
align,
color,
textColor
} = attributes;
return (0,external_React_namespaceObject.createElement)("div", {
className: `align${align}`,
style: {
backgroundColor: color
}
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "a",
href: url,
title: title,
style: {
color: textColor
},
value: text
}));
},
migrate: oldColorsMigration
}];
/* harmony default export */ const button_deprecated = (deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/button/constants.js
const NEW_TAB_REL = 'noreferrer noopener';
const NEW_TAB_TARGET = '_blank';
const NOFOLLOW_REL = 'nofollow';
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/button/get-updated-link-attributes.js
/**
* Internal dependencies
*/
/**
* WordPress dependencies
*/
/**
* Updates the link attributes.
*
* @param {Object} attributes The current block attributes.
* @param {string} attributes.rel The current link rel attribute.
* @param {string} attributes.url The current link url.
* @param {boolean} attributes.opensInNewTab Whether the link should open in a new window.
* @param {boolean} attributes.nofollow Whether the link should be marked as nofollow.
*/
function getUpdatedLinkAttributes({
rel = '',
url = '',
opensInNewTab,
nofollow
}) {
let newLinkTarget;
// Since `rel` is editable attribute, we need to check for existing values and proceed accordingly.
let updatedRel = rel;
if (opensInNewTab) {
newLinkTarget = NEW_TAB_TARGET;
updatedRel = updatedRel?.includes(NEW_TAB_REL) ? updatedRel : updatedRel + ` ${NEW_TAB_REL}`;
} else {
const relRegex = new RegExp(`\\b${NEW_TAB_REL}\\s*`, 'g');
updatedRel = updatedRel?.replace(relRegex, '').trim();
}
if (nofollow) {
updatedRel = updatedRel?.includes(NOFOLLOW_REL) ? updatedRel : updatedRel + ` ${NOFOLLOW_REL}`;
} else {
const relRegex = new RegExp(`\\b${NOFOLLOW_REL}\\s*`, 'g');
updatedRel = updatedRel?.replace(relRegex, '').trim();
}
return {
url: (0,external_wp_url_namespaceObject.prependHTTP)(url),
linkTarget: newLinkTarget,
rel: updatedRel || undefined
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/utils/remove-anchor-tag.js
/**
* Removes anchor tags from a string.
*
* @param {string} value The value to remove anchor tags from.
*
* @return {string} The value with anchor tags removed.
*/
function removeAnchorTag(value) {
// To do: Refactor this to use rich text's removeFormat instead.
return value.toString().replace(/<\/?a[^>]*>/g, '');
}
;// CONCATENATED MODULE: external ["wp","keycodes"]
const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js
/**
* WordPress dependencies
*/
const link_link = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"
}));
/* harmony default export */ const library_link = (link_link);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link-off.js
/**
* WordPress dependencies
*/
const linkOff = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"
}));
/* harmony default export */ const link_off = (linkOff);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/button/edit.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/**
* WordPress dependencies
*/
const LINK_SETTINGS = [...external_wp_blockEditor_namespaceObject.__experimentalLinkControl.DEFAULT_LINK_SETTINGS, {
id: 'nofollow',
title: (0,external_wp_i18n_namespaceObject.__)('Mark as nofollow')
}];
function useEnter(props) {
const {
replaceBlocks,
selectionChange
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
getBlock,
getBlockRootClientId,
getBlockIndex
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.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 || event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) {
return;
}
const {
content,
clientId
} = propsRef.current;
if (content.length) {
return;
}
event.preventDefault();
const topParentListBlock = getBlock(getBlockRootClientId(clientId));
const blockIndex = getBlockIndex(clientId);
const head = (0,external_wp_blocks_namespaceObject.cloneBlock)({
...topParentListBlock,
innerBlocks: topParentListBlock.innerBlocks.slice(0, blockIndex)
});
const middle = (0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)());
const after = topParentListBlock.innerBlocks.slice(blockIndex + 1);
const tail = after.length ? [(0,external_wp_blocks_namespaceObject.cloneBlock)({
...topParentListBlock,
innerBlocks: after
})] : [];
replaceBlocks(topParentListBlock.clientId, [head, middle, ...tail], 1);
// We manually change the selection here because we are replacing
// a different block than the selected one.
selectionChange(middle.clientId);
}
element.addEventListener('keydown', onKeyDown);
return () => {
element.removeEventListener('keydown', onKeyDown);
};
}, []);
}
function WidthPanel({
selectedWidth,
setAttributes
}) {
function handleChange(newWidth) {
// Check if we are toggling the width off
const width = selectedWidth === newWidth ? undefined : newWidth;
// Update attributes.
setAttributes({
width
});
}
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Width settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ButtonGroup, {
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Button width')
}, [25, 50, 75, 100].map(widthValue => {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
key: widthValue,
size: "small",
variant: widthValue === selectedWidth ? 'primary' : undefined,
onClick: () => handleChange(widthValue)
}, widthValue, "%");
})));
}
function ButtonEdit(props) {
const {
attributes,
setAttributes,
className,
isSelected,
onReplace,
mergeBlocks,
clientId
} = props;
const {
tagName,
textAlign,
linkTarget,
placeholder,
rel,
style,
text,
url,
width,
metadata
} = attributes;
const TagName = tagName || 'a';
function onKeyDown(event) {
if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'k')) {
startEditing(event);
} else if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primaryShift(event, 'k')) {
unlink();
richTextRef.current?.focus();
}
}
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes);
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseColorProps)(attributes);
const spacingProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetSpacingClassesAndStyles)(attributes);
const shadowProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetShadowClassesAndStyles)(attributes);
const ref = (0,external_wp_element_namespaceObject.useRef)();
const richTextRef = (0,external_wp_element_namespaceObject.useRef)();
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([setPopoverAnchor, ref]),
onKeyDown
});
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
const [isEditingURL, setIsEditingURL] = (0,external_wp_element_namespaceObject.useState)(false);
const isURLSet = !!url;
const opensInNewTab = linkTarget === NEW_TAB_TARGET;
const nofollow = !!rel?.includes(NOFOLLOW_REL);
const isLinkTag = 'a' === TagName;
function startEditing(event) {
event.preventDefault();
setIsEditingURL(true);
}
function unlink() {
setAttributes({
url: undefined,
linkTarget: undefined,
rel: undefined
});
setIsEditingURL(false);
}
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isSelected) {
setIsEditingURL(false);
}
}, [isSelected]);
// Memoize link value to avoid overriding the LinkControl's internal state.
// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/51256.
const linkValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
url,
opensInNewTab,
nofollow
}), [url, opensInNewTab, nofollow]);
const useEnterRef = useEnter({
content: text,
clientId
});
const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([useEnterRef, richTextRef]);
const {
lockUrlControls = false
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!isSelected) {
return {};
}
const blockBindingsSource = unlock(select(external_wp_blocks_namespaceObject.store)).getBlockBindingsSource(metadata?.bindings?.url?.source);
return {
lockUrlControls: !!metadata?.bindings?.url && (!blockBindingsSource || blockBindingsSource?.lockAttributesEditing)
};
}, [isSelected]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", {
...blockProps,
className: classnames_default()(blockProps.className, {
[`has-custom-width wp-block-button__width-${width}`]: width,
[`has-custom-font-size`]: blockProps.style.fontSize
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
ref: mergedRef,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Button text'),
placeholder: placeholder || (0,external_wp_i18n_namespaceObject.__)('Add text…'),
value: text,
onChange: value => setAttributes({
text: removeAnchorTag(value)
}),
withoutInteractiveFormatting: true,
className: classnames_default()(className, 'wp-block-button__link', colorProps.className, borderProps.className, {
[`has-text-align-${textAlign}`]: textAlign,
// For backwards compatibility add style that isn't
// provided via block support.
'no-border-radius': style?.border?.radius === 0
}, (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('button')),
style: {
...borderProps.style,
...colorProps.style,
...spacingProps.style,
...shadowProps.style
},
onSplit: value => (0,external_wp_blocks_namespaceObject.createBlock)('core/button', {
...attributes,
text: value
}),
onReplace: onReplace,
onMerge: mergeBlocks,
identifier: "text"
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, blockEditingMode === 'default' && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
}), !isURLSet && isLinkTag && !lockUrlControls && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
name: "link",
icon: library_link,
title: (0,external_wp_i18n_namespaceObject.__)('Link'),
shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k'),
onClick: startEditing
}), isURLSet && isLinkTag && !lockUrlControls && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
name: "link",
icon: link_off,
title: (0,external_wp_i18n_namespaceObject.__)('Unlink'),
shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('k'),
onClick: unlink,
isActive: true
})), isLinkTag && isSelected && (isEditingURL || isURLSet) && !lockUrlControls && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
placement: "bottom",
onClose: () => {
setIsEditingURL(false);
richTextRef.current?.focus();
},
anchor: popoverAnchor,
focusOnMount: isEditingURL ? 'firstElement' : false,
__unstableSlotName: '__unstable-block-tools-after',
shift: true
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl, {
value: linkValue,
onChange: ({
url: newURL,
opensInNewTab: newOpensInNewTab,
nofollow: newNofollow
}) => setAttributes(getUpdatedLinkAttributes({
rel,
url: newURL,
opensInNewTab: newOpensInNewTab,
nofollow: newNofollow
})),
onRemove: () => {
unlink();
richTextRef.current?.focus();
},
forceIsEditingLink: isEditingURL,
settings: LINK_SETTINGS
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(WidthPanel, {
selectedWidth: width,
setAttributes: setAttributes
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, isLinkTag && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link rel'),
value: rel || '',
onChange: newRel => setAttributes({
rel: newRel
})
})));
}
/* harmony default export */ const button_edit = (ButtonEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/button/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function save_save({
attributes,
className
}) {
const {
tagName,
type,
textAlign,
fontSize,
linkTarget,
rel,
style,
text,
title,
url,
width
} = attributes;
if (external_wp_blockEditor_namespaceObject.RichText.isEmpty(text)) {
return null;
}
const TagName = tagName || 'a';
const isButtonTag = 'button' === TagName;
const buttonType = type || 'button';
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes);
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetColorClassesAndStyles)(attributes);
const spacingProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetSpacingClassesAndStyles)(attributes);
const shadowProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetShadowClassesAndStyles)(attributes);
const buttonClasses = classnames_default()('wp-block-button__link', colorProps.className, borderProps.className, {
[`has-text-align-${textAlign}`]: textAlign,
// For backwards compatibility add style that isn't provided via
// block support.
'no-border-radius': style?.border?.radius === 0
}, (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('button'));
const buttonStyle = {
...borderProps.style,
...colorProps.style,
...spacingProps.style,
...shadowProps.style
};
// The use of a `title` attribute here is soft-deprecated, but still applied
// if it had already been assigned, for the sake of backward-compatibility.
// A title will no longer be assigned for new or updated button block links.
const wrapperClasses = classnames_default()(className, {
[`has-custom-width wp-block-button__width-${width}`]: width,
[`has-custom-font-size`]: fontSize || style?.typography?.fontSize
});
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: wrapperClasses
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: TagName,
type: isButtonTag ? buttonType : null,
className: buttonClasses,
href: isButtonTag ? null : url,
title: title,
style: buttonStyle,
value: text,
target: isButtonTag ? null : linkTarget,
rel: isButtonTag ? null : rel
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/button/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const button_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/button",
title: "Button",
category: "design",
parent: ["core/buttons"],
description: "Prompt visitors to take action with a button-style link.",
keywords: ["link"],
textdomain: "default",
attributes: {
tagName: {
type: "string",
"enum": ["a", "button"],
"default": "a"
},
type: {
type: "string",
"default": "button"
},
textAlign: {
type: "string"
},
url: {
type: "string",
source: "attribute",
selector: "a",
attribute: "href",
__experimentalRole: "content"
},
title: {
type: "string",
source: "attribute",
selector: "a,button",
attribute: "title",
__experimentalRole: "content"
},
text: {
type: "rich-text",
source: "rich-text",
selector: "a,button",
__experimentalRole: "content"
},
linkTarget: {
type: "string",
source: "attribute",
selector: "a",
attribute: "target",
__experimentalRole: "content"
},
rel: {
type: "string",
source: "attribute",
selector: "a",
attribute: "rel",
__experimentalRole: "content"
},
placeholder: {
type: "string"
},
backgroundColor: {
type: "string"
},
textColor: {
type: "string"
},
gradient: {
type: "string"
},
width: {
type: "number"
}
},
supports: {
anchor: true,
align: false,
alignWide: false,
color: {
__experimentalSkipSerialization: true,
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
reusable: false,
shadow: {
__experimentalSkipSerialization: true
},
spacing: {
__experimentalSkipSerialization: true,
padding: ["horizontal", "vertical"],
__experimentalDefaultControls: {
padding: true
}
},
__experimentalBorder: {
color: true,
radius: true,
style: true,
width: true,
__experimentalSkipSerialization: true,
__experimentalDefaultControls: {
color: true,
radius: true,
style: true,
width: true
}
},
__experimentalSelector: ".wp-block-button .wp-block-button__link",
interactivity: {
clientNavigation: true
}
},
styles: [{
name: "fill",
label: "Fill",
isDefault: true
}, {
name: "outline",
label: "Outline"
}],
editorStyle: "wp-block-button-editor",
style: "wp-block-button"
};
const {
name: button_name
} = button_metadata;
const button_settings = {
icon: library_button,
example: {
attributes: {
className: 'is-style-fill',
text: (0,external_wp_i18n_namespaceObject.__)('Call to Action')
}
},
edit: button_edit,
save: save_save,
deprecated: button_deprecated,
merge: (a, {
text = ''
}) => ({
...a,
text: (a.text || '') + text
})
};
const button_init = () => initBlock({
name: button_name,
metadata: button_metadata,
settings: button_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/buttons.js
/**
* WordPress dependencies
*/
const buttons = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M14.5 17.5H9.5V16H14.5V17.5Z M14.5 8H9.5V6.5H14.5V8Z M7 3.5H17C18.1046 3.5 19 4.39543 19 5.5V9C19 10.1046 18.1046 11 17 11H7C5.89543 11 5 10.1046 5 9V5.5C5 4.39543 5.89543 3.5 7 3.5ZM17 5H7C6.72386 5 6.5 5.22386 6.5 5.5V9C6.5 9.27614 6.72386 9.5 7 9.5H17C17.2761 9.5 17.5 9.27614 17.5 9V5.5C17.5 5.22386 17.2761 5 17 5Z M7 13H17C18.1046 13 19 13.8954 19 15V18.5C19 19.6046 18.1046 20.5 17 20.5H7C5.89543 20.5 5 19.6046 5 18.5V15C5 13.8954 5.89543 13 7 13ZM17 14.5H7C6.72386 14.5 6.5 14.7239 6.5 15V18.5C6.5 18.7761 6.72386 19 7 19H17C17.2761 19 17.5 18.7761 17.5 18.5V15C17.5 14.7239 17.2761 14.5 17 14.5Z"
}));
/* harmony default export */ const library_buttons = (buttons);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/buttons/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* @param {Object} attributes Block's attributes.
*/
const migrateWithLayout = attributes => {
if (!!attributes.layout) {
return attributes;
}
const {
contentJustification,
orientation,
...updatedAttributes
} = attributes;
if (contentJustification || orientation) {
Object.assign(updatedAttributes, {
layout: {
type: 'flex',
...(contentJustification && {
justifyContent: contentJustification
}),
...(orientation && {
orientation
})
}
});
}
return updatedAttributes;
};
const buttons_deprecated_deprecated = [{
attributes: {
contentJustification: {
type: 'string'
},
orientation: {
type: 'string',
default: 'horizontal'
}
},
supports: {
anchor: true,
align: ['wide', 'full'],
__experimentalExposeControlsToChildren: true,
spacing: {
blockGap: true,
margin: ['top', 'bottom'],
__experimentalDefaultControls: {
blockGap: true
}
}
},
isEligible: ({
contentJustification,
orientation
}) => !!contentJustification || !!orientation,
migrate: migrateWithLayout,
save({
attributes: {
contentJustification,
orientation
}
}) {
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classnames_default()({
[`is-content-justification-${contentJustification}`]: contentJustification,
'is-vertical': orientation === 'vertical'
})
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
}
}, {
supports: {
align: ['center', 'left', 'right'],
anchor: true
},
save() {
return (0,external_React_namespaceObject.createElement)("div", null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
},
isEligible({
align
}) {
return align && ['center', 'left', 'right'].includes(align);
},
migrate(attributes) {
return migrateWithLayout({
...attributes,
align: undefined,
// Floating Buttons blocks shouldn't have been supported in the
// first place. Most users using them probably expected them to
// act like content justification controls, so these blocks are
// migrated to use content justification.
// As for center-aligned Buttons blocks, the content justification
// equivalent will create an identical end result in most cases.
contentJustification: attributes.align
});
}
}];
/* harmony default export */ const buttons_deprecated = (buttons_deprecated_deprecated);
;// CONCATENATED MODULE: external ["wp","richText"]
const external_wp_richText_namespaceObject = window["wp"]["richText"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/utils/get-transformed-metadata.js
/**
* WordPress dependencies
*/
/**
* Transform the metadata attribute with only the values and bindings specified by each transform.
* Returns `undefined` if the input metadata is falsy.
*
* @param {Object} metadata Original metadata attribute from the block that is being transformed.
* @param {Object} newBlockName Name of the final block after the transformation.
* @param {Function} bindingsCallback Optional callback to transform the `bindings` property object.
* @return {Object|undefined} New metadata object only with the relevant properties.
*/
function getTransformedMetadata(metadata, newBlockName, bindingsCallback) {
if (!metadata) {
return;
}
const {
supports
} = (0,external_wp_blocks_namespaceObject.getBlockType)(newBlockName);
// Fixed until an opt-in mechanism is implemented.
const BLOCK_BINDINGS_SUPPORTED_BLOCKS = ['core/paragraph', 'core/heading', 'core/image', 'core/button'];
// The metadata properties that should be preserved after the transform.
const transformSupportedProps = [];
// If it support bindings, and there is a transform bindings callback, add the `id` and `bindings` properties.
if (BLOCK_BINDINGS_SUPPORTED_BLOCKS.includes(newBlockName) && bindingsCallback) {
transformSupportedProps.push('id', 'bindings');
}
// If it support block naming (true by default), add the `name` property.
if (supports.renaming !== false) {
transformSupportedProps.push('name');
}
// Return early if no supported properties.
if (!transformSupportedProps.length) {
return;
}
const newMetadata = Object.entries(metadata).reduce((obj, [prop, value]) => {
// If prop is not supported, don't add it to the new metadata object.
if (!transformSupportedProps.includes(prop)) {
return obj;
}
obj[prop] = prop === 'bindings' ? bindingsCallback(value) : value;
return obj;
}, {});
// Return undefined if object is empty.
return Object.keys(newMetadata).length ? newMetadata : undefined;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/buttons/transforms.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const transforms_transforms = {
from: [{
type: 'block',
isMultiBlock: true,
blocks: ['core/button'],
transform: buttons =>
// Creates the buttons block.
(0,external_wp_blocks_namespaceObject.createBlock)('core/buttons', {},
// Loop the selected buttons.
buttons.map(attributes =>
// Create singular button in the buttons block.
(0,external_wp_blocks_namespaceObject.createBlock)('core/button', attributes)))
}, {
type: 'block',
isMultiBlock: true,
blocks: ['core/paragraph'],
transform: buttons =>
// Creates the buttons block.
(0,external_wp_blocks_namespaceObject.createBlock)('core/buttons', {},
// Loop the selected buttons.
buttons.map(attributes => {
const {
content,
metadata
} = attributes;
const element = (0,external_wp_richText_namespaceObject.__unstableCreateElement)(document, content);
// Remove any HTML tags.
const text = element.innerText || '';
// Get first url.
const link = element.querySelector('a');
const url = link?.getAttribute('href');
// Create singular button in the buttons block.
return (0,external_wp_blocks_namespaceObject.createBlock)('core/button', {
text,
url,
metadata: getTransformedMetadata(metadata, 'core/button', ({
content: contentBinding
}) => ({
text: contentBinding
}))
});
})),
isMatch: paragraphs => {
return paragraphs.every(attributes => {
const element = (0,external_wp_richText_namespaceObject.__unstableCreateElement)(document, attributes.content);
const text = element.innerText || '';
const links = element.querySelectorAll('a');
return text.length <= 30 && links.length <= 1;
});
}
}]
};
/* harmony default export */ const buttons_transforms = (transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/buttons/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const DEFAULT_BLOCK = {
name: 'core/button',
attributesToCopy: ['backgroundColor', 'border', 'className', 'fontFamily', 'fontSize', 'gradient', 'style', 'textColor', 'width']
};
function ButtonsEdit({
attributes,
className
}) {
var _layout$orientation;
const {
fontSize,
layout,
style
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()(className, {
'has-custom-font-size': fontSize || style?.typography?.fontSize
})
});
const {
preferredStyle,
hasButtonVariations
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const preferredStyleVariations = select(external_wp_blockEditor_namespaceObject.store).getSettings().__experimentalPreferredStyleVariations;
const buttonVariations = select(external_wp_blocks_namespaceObject.store).getBlockVariations('core/button', 'inserter');
return {
preferredStyle: preferredStyleVariations?.value?.['core/button'],
hasButtonVariations: buttonVariations.length > 0
};
}, []);
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
defaultBlock: DEFAULT_BLOCK,
// This check should be handled by the `Inserter` internally to be consistent across all blocks that use it.
directInsert: !hasButtonVariations,
template: [['core/button', {
className: preferredStyle && `is-style-${preferredStyle}`
}]],
templateInsertUpdatesSelection: true,
orientation: (_layout$orientation = layout?.orientation) !== null && _layout$orientation !== void 0 ? _layout$orientation : 'horizontal'
});
return (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
});
}
/* harmony default export */ const buttons_edit = (ButtonsEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/buttons/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function buttons_save_save({
attributes,
className
}) {
const {
fontSize,
style
} = attributes;
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classnames_default()(className, {
'has-custom-font-size': fontSize || style?.typography?.fontSize
})
});
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
return (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/buttons/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const buttons_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/buttons",
title: "Buttons",
category: "design",
allowedBlocks: ["core/button"],
description: "Prompt visitors to take action with a group of button-style links.",
keywords: ["link"],
textdomain: "default",
supports: {
anchor: true,
align: ["wide", "full"],
html: false,
__experimentalExposeControlsToChildren: true,
spacing: {
blockGap: true,
margin: ["top", "bottom"],
__experimentalDefaultControls: {
blockGap: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
layout: {
allowSwitching: false,
allowInheriting: false,
"default": {
type: "flex"
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-buttons-editor",
style: "wp-block-buttons"
};
const {
name: buttons_name
} = buttons_metadata;
const buttons_settings = {
icon: library_buttons,
example: {
innerBlocks: [{
name: 'core/button',
attributes: {
text: (0,external_wp_i18n_namespaceObject.__)('Find out more')
}
}, {
name: 'core/button',
attributes: {
text: (0,external_wp_i18n_namespaceObject.__)('Contact us')
}
}]
},
deprecated: buttons_deprecated,
transforms: buttons_transforms,
edit: buttons_edit,
save: buttons_save_save
};
const buttons_init = () => initBlock({
name: buttons_name,
metadata: buttons_metadata,
settings: buttons_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/calendar.js
/**
* WordPress dependencies
*/
const calendar = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_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.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z"
}));
/* harmony default export */ const library_calendar = (calendar);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/calendar/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Returns the year and month of a specified date.
*
* @see `WP_REST_Posts_Controller::prepare_date_response()`.
*
* @param {string} date Date in `ISO8601/RFC3339` format.
* @return {Object} Year and date of the specified date.
*/
const getYearMonth = memize(date => {
if (!date) {
return {};
}
const dateObj = new Date(date);
return {
year: dateObj.getFullYear(),
month: dateObj.getMonth() + 1
};
});
function CalendarEdit({
attributes
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const {
date,
hasPosts,
hasPostsResolved
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEntityRecords,
hasFinishedResolution
} = select(external_wp_coreData_namespaceObject.store);
const singlePublishedPostQuery = {
status: 'publish',
per_page: 1
};
const posts = getEntityRecords('postType', 'post', singlePublishedPostQuery);
const postsResolved = hasFinishedResolution('getEntityRecords', ['postType', 'post', singlePublishedPostQuery]);
let _date;
// FIXME: @wordpress/block-library should not depend on @wordpress/editor.
// Blocks can be loaded into a *non-post* block editor.
// eslint-disable-next-line @wordpress/data-no-store-string-literals
const editorSelectors = select('core/editor');
if (editorSelectors) {
const postType = editorSelectors.getEditedPostAttribute('type');
// Dates are used to overwrite year and month used on the calendar.
// This overwrite should only happen for 'post' post types.
// For other post types the calendar always displays the current month.
if (postType === 'post') {
_date = editorSelectors.getEditedPostAttribute('date');
}
}
return {
date: _date,
hasPostsResolved: postsResolved,
hasPosts: postsResolved && posts?.length === 1
};
}, []);
if (!hasPosts) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
icon: library_calendar,
label: (0,external_wp_i18n_namespaceObject.__)('Calendar')
}, !hasPostsResolved ? (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null) : (0,external_wp_i18n_namespaceObject.__)('No published posts found.')));
}
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, null, (0,external_React_namespaceObject.createElement)((external_wp_serverSideRender_default()), {
block: "core/calendar",
attributes: {
...attributes,
...getYearMonth(date)
}
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/calendar/transforms.js
/**
* WordPress dependencies
*/
const calendar_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/archives'],
transform: () => (0,external_wp_blocks_namespaceObject.createBlock)('core/calendar')
}],
to: [{
type: 'block',
blocks: ['core/archives'],
transform: () => (0,external_wp_blocks_namespaceObject.createBlock)('core/archives')
}]
};
/* harmony default export */ const calendar_transforms = (calendar_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/calendar/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const calendar_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/calendar",
title: "Calendar",
category: "widgets",
description: "A calendar of your site\u2019s posts.",
keywords: ["posts", "archive"],
textdomain: "default",
attributes: {
month: {
type: "integer"
},
year: {
type: "integer"
}
},
supports: {
align: true,
color: {
link: true,
__experimentalSkipSerialization: ["text", "background"],
__experimentalDefaultControls: {
background: true,
text: true
},
__experimentalSelector: "table, th"
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-calendar"
};
const {
name: calendar_name
} = calendar_metadata;
const calendar_settings = {
icon: library_calendar,
example: {},
edit: CalendarEdit,
transforms: calendar_transforms
};
const calendar_init = () => initBlock({
name: calendar_name,
metadata: calendar_metadata,
settings: calendar_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/category.js
/**
* WordPress dependencies
*/
const category = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",
fillRule: "evenodd",
clipRule: "evenodd"
}));
/* harmony default export */ const library_category = (category);
;// CONCATENATED MODULE: external ["wp","htmlEntities"]
const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pin.js
/**
* WordPress dependencies
*/
const pin = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z"
}));
/* harmony default export */ const library_pin = (pin);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/categories/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function CategoriesEdit({
attributes: {
displayAsDropdown,
showHierarchy,
showPostCounts,
showOnlyTopLevel,
showEmpty
},
setAttributes,
className
}) {
const selectId = (0,external_wp_compose_namespaceObject.useInstanceId)(CategoriesEdit, 'blocks-category-select');
const query = {
per_page: -1,
hide_empty: !showEmpty,
context: 'view'
};
if (showOnlyTopLevel) {
query.parent = 0;
}
const {
records: categories,
isResolving
} = (0,external_wp_coreData_namespaceObject.useEntityRecords)('taxonomy', 'category', query);
const getCategoriesList = parentId => {
if (!categories?.length) {
return [];
}
if (parentId === null) {
return categories;
}
return categories.filter(({
parent
}) => parent === parentId);
};
const toggleAttribute = attributeName => newValue => setAttributes({
[attributeName]: newValue
});
const renderCategoryName = name => !name ? (0,external_wp_i18n_namespaceObject.__)('(Untitled)') : (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(name).trim();
const renderCategoryList = () => {
const parentId = showHierarchy ? 0 : null;
const categoriesList = getCategoriesList(parentId);
return categoriesList.map(category => renderCategoryListItem(category));
};
const renderCategoryListItem = category => {
const childCategories = getCategoriesList(category.id);
const {
id,
link,
count,
name
} = category;
return (0,external_React_namespaceObject.createElement)("li", {
key: id,
className: `cat-item cat-item-${id}`
}, (0,external_React_namespaceObject.createElement)("a", {
href: link,
target: "_blank",
rel: "noreferrer noopener"
}, renderCategoryName(name)), showPostCounts && ` (${count})`, showHierarchy && !!childCategories.length && (0,external_React_namespaceObject.createElement)("ul", {
className: "children"
}, childCategories.map(childCategory => renderCategoryListItem(childCategory))));
};
const renderCategoryDropdown = () => {
const parentId = showHierarchy ? 0 : null;
const categoriesList = getCategoriesList(parentId);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
as: "label",
htmlFor: selectId
}, (0,external_wp_i18n_namespaceObject.__)('Categories')), (0,external_React_namespaceObject.createElement)("select", {
id: selectId
}, (0,external_React_namespaceObject.createElement)("option", null, (0,external_wp_i18n_namespaceObject.__)('Select Category')), categoriesList.map(category => renderCategoryDropdownItem(category, 0))));
};
const renderCategoryDropdownItem = (category, level) => {
const {
id,
count,
name
} = category;
const childCategories = getCategoriesList(id);
return [(0,external_React_namespaceObject.createElement)("option", {
key: id,
className: `level-${level}`
}, Array.from({
length: level * 3
}).map(() => '\xa0'), renderCategoryName(name), showPostCounts && ` (${count})`), showHierarchy && !!childCategories.length && childCategories.map(childCategory => renderCategoryDropdownItem(childCategory, level + 1))];
};
const TagName = !!categories?.length && !displayAsDropdown && !isResolving ? 'ul' : 'div';
const classes = classnames_default()(className, {
'wp-block-categories-list': !!categories?.length && !displayAsDropdown && !isResolving,
'wp-block-categories-dropdown': !!categories?.length && displayAsDropdown && !isResolving
});
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classes
});
return (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display as dropdown'),
checked: displayAsDropdown,
onChange: toggleAttribute('displayAsDropdown')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show post counts'),
checked: showPostCounts,
onChange: toggleAttribute('showPostCounts')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show only top level categories'),
checked: showOnlyTopLevel,
onChange: toggleAttribute('showOnlyTopLevel')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show empty categories'),
checked: showEmpty,
onChange: toggleAttribute('showEmpty')
}), !showOnlyTopLevel && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show hierarchy'),
checked: showHierarchy,
onChange: toggleAttribute('showHierarchy')
}))), isResolving && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
icon: library_pin,
label: (0,external_wp_i18n_namespaceObject.__)('Categories')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)), !isResolving && categories?.length === 0 && (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Your site does not have any posts, so there is nothing to display here at the moment.')), !isResolving && categories?.length > 0 && (displayAsDropdown ? renderCategoryDropdown() : renderCategoryList()));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/categories/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const categories_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/categories",
title: "Categories List",
category: "widgets",
description: "Display a list of all categories.",
textdomain: "default",
attributes: {
displayAsDropdown: {
type: "boolean",
"default": false
},
showHierarchy: {
type: "boolean",
"default": false
},
showPostCounts: {
type: "boolean",
"default": false
},
showOnlyTopLevel: {
type: "boolean",
"default": false
},
showEmpty: {
type: "boolean",
"default": false
}
},
supports: {
align: true,
html: false,
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-categories-editor",
style: "wp-block-categories"
};
const {
name: categories_name
} = categories_metadata;
const categories_settings = {
icon: library_category,
example: {},
edit: CategoriesEdit
};
const categories_init = () => initBlock({
name: categories_name,
metadata: categories_metadata,
settings: categories_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/classic.js
/**
* WordPress dependencies
*/
const classic = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M20 6H4c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H4c-.3 0-.5-.2-.5-.5V8c0-.3.2-.5.5-.5h16c.3 0 .5.2.5.5v9zM10 10H8v2h2v-2zm-5 2h2v-2H5v2zm8-2h-2v2h2v-2zm-5 6h8v-2H8v2zm6-4h2v-2h-2v2zm3 0h2v-2h-2v2zm0 4h2v-2h-2v2zM5 16h2v-2H5v2z"
}));
/* harmony default export */ const library_classic = (classic);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/freeform/convert-to-blocks-button.js
/**
* WordPress dependencies
*/
const ConvertToBlocksButton = ({
clientId
}) => {
const {
replaceBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const block = (0,external_wp_data_namespaceObject.useSelect)(select => {
return select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId);
}, [clientId]);
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: () => replaceBlocks(block.clientId, (0,external_wp_blocks_namespaceObject.rawHandler)({
HTML: (0,external_wp_blocks_namespaceObject.serialize)(block)
}))
}, (0,external_wp_i18n_namespaceObject.__)('Convert to blocks'));
};
/* harmony default export */ const convert_to_blocks_button = (ConvertToBlocksButton);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/fullscreen.js
/**
* WordPress dependencies
*/
const fullscreen = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z"
}));
/* harmony default export */ const library_fullscreen = (fullscreen);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/freeform/modal.js
/**
* WordPress dependencies
*/
function ModalAuxiliaryActions({
onClick,
isModalFullScreen
}) {
// 'small' to match the rules in editor.scss.
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<');
if (isMobileViewport) {
return null;
}
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
onClick: onClick,
icon: library_fullscreen,
isPressed: isModalFullScreen,
label: isModalFullScreen ? (0,external_wp_i18n_namespaceObject.__)('Exit fullscreen') : (0,external_wp_i18n_namespaceObject.__)('Enter fullscreen')
});
}
function ClassicEdit(props) {
const styles = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings().styles);
(0,external_wp_element_namespaceObject.useEffect)(() => {
const {
baseURL,
suffix,
settings
} = window.wpEditorL10n.tinymce;
window.tinymce.EditorManager.overrideDefaults({
base_url: baseURL,
suffix
});
window.wp.oldEditor.initialize(props.id, {
tinymce: {
...settings,
setup(editor) {
editor.on('init', () => {
const doc = editor.getDoc();
styles.forEach(({
css
}) => {
const styleEl = doc.createElement('style');
styleEl.innerHTML = css;
doc.head.appendChild(styleEl);
});
});
}
}
});
return () => {
window.wp.oldEditor.remove(props.id);
};
}, []);
return (0,external_React_namespaceObject.createElement)("textarea", {
...props
});
}
function ModalEdit(props) {
const {
clientId,
attributes: {
content
},
setAttributes,
onReplace
} = props;
const [isOpen, setOpen] = (0,external_wp_element_namespaceObject.useState)(false);
const [isModalFullScreen, setIsModalFullScreen] = (0,external_wp_element_namespaceObject.useState)(false);
const id = `editor-${clientId}`;
const onClose = () => content ? setOpen(false) : onReplace([]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: () => setOpen(true)
}, (0,external_wp_i18n_namespaceObject.__)('Edit')))), content && (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, content), (isOpen || !content) && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Classic Editor'),
onRequestClose: onClose,
shouldCloseOnClickOutside: false,
overlayClassName: "block-editor-freeform-modal",
isFullScreen: isModalFullScreen,
className: "block-editor-freeform-modal__content",
headerActions: (0,external_React_namespaceObject.createElement)(ModalAuxiliaryActions, {
onClick: () => setIsModalFullScreen(!isModalFullScreen),
isModalFullScreen: isModalFullScreen
})
}, (0,external_React_namespaceObject.createElement)(ClassicEdit, {
id: id,
defaultValue: content
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
className: "block-editor-freeform-modal__actions",
justify: "flex-end",
expanded: false
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: onClose
}, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: () => {
setAttributes({
content: window.wp.oldEditor.getContent(id)
});
setOpen(false);
}
}, (0,external_wp_i18n_namespaceObject.__)('Save'))))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/freeform/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
wp
} = window;
function isTmceEmpty(editor) {
// When tinyMce is empty the content seems to be:
// <p><br data-mce-bogus="1"></p>
// avoid expensive checks for large documents
const body = editor.getBody();
if (body.childNodes.length > 1) {
return false;
} else if (body.childNodes.length === 0) {
return true;
}
if (body.childNodes[0].childNodes.length > 1) {
return false;
}
return /^\n?$/.test(body.innerText || body.textContent);
}
function FreeformEdit(props) {
const {
clientId
} = props;
const canRemove = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).canRemoveBlock(clientId), [clientId]);
const [isIframed, setIsIframed] = (0,external_wp_element_namespaceObject.useState)(false);
const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
setIsIframed(element.ownerDocument !== document);
}, []);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, canRemove && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(convert_to_blocks_button, {
clientId: clientId
}))), (0,external_React_namespaceObject.createElement)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({
ref
})
}, isIframed ? (0,external_React_namespaceObject.createElement)(ModalEdit, {
...props
}) : (0,external_React_namespaceObject.createElement)(edit_ClassicEdit, {
...props
})));
}
function edit_ClassicEdit({
clientId,
attributes: {
content
},
setAttributes,
onReplace
}) {
const {
getMultiSelectedBlockClientIds
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const didMount = (0,external_wp_element_namespaceObject.useRef)(false);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!didMount.current) {
return;
}
const editor = window.tinymce.get(`editor-${clientId}`);
const currentContent = editor?.getContent();
if (currentContent !== content) {
editor.setContent(content || '');
}
}, [content]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
const {
baseURL,
suffix
} = window.wpEditorL10n.tinymce;
didMount.current = true;
window.tinymce.EditorManager.overrideDefaults({
base_url: baseURL,
suffix
});
function onSetup(editor) {
let bookmark;
if (content) {
editor.on('loadContent', () => editor.setContent(content));
}
editor.on('blur', () => {
bookmark = editor.selection.getBookmark(2, true);
// There is an issue with Chrome and the editor.focus call in core at https://core.trac.wordpress.org/browser/trunk/src/js/_enqueues/lib/link.js#L451.
// This causes a scroll to the top of editor content on return from some content updating dialogs so tracking
// scroll position until this is fixed in core.
const scrollContainer = document.querySelector('.interface-interface-skeleton__content');
const scrollPosition = scrollContainer.scrollTop;
// Only update attributes if we aren't multi-selecting blocks.
// Updating during multi-selection can overwrite attributes of other blocks.
if (!getMultiSelectedBlockClientIds()?.length) {
setAttributes({
content: editor.getContent()
});
}
editor.once('focus', () => {
if (bookmark) {
editor.selection.moveToBookmark(bookmark);
if (scrollContainer.scrollTop !== scrollPosition) {
scrollContainer.scrollTop = scrollPosition;
}
}
});
return false;
});
editor.on('mousedown touchstart', () => {
bookmark = null;
});
const debouncedOnChange = (0,external_wp_compose_namespaceObject.debounce)(() => {
const value = editor.getContent();
if (value !== editor._lastChange) {
editor._lastChange = value;
setAttributes({
content: value
});
}
}, 250);
editor.on('Paste Change input Undo Redo', debouncedOnChange);
// We need to cancel the debounce call because when we remove
// the editor (onUnmount) this callback is executed in
// another tick. This results in setting the content to empty.
editor.on('remove', debouncedOnChange.cancel);
editor.on('keydown', event => {
if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'z')) {
// Prevent the gutenberg undo kicking in so TinyMCE undo stack works as expected.
event.stopPropagation();
}
if ((event.keyCode === external_wp_keycodes_namespaceObject.BACKSPACE || event.keyCode === external_wp_keycodes_namespaceObject.DELETE) && isTmceEmpty(editor)) {
// Delete the block.
onReplace([]);
event.preventDefault();
event.stopImmediatePropagation();
}
const {
altKey
} = event;
/*
* Prevent Mousetrap from kicking in: TinyMCE already uses its own
* `alt+f10` shortcut to focus its toolbar.
*/
if (altKey && event.keyCode === external_wp_keycodes_namespaceObject.F10) {
event.stopPropagation();
}
});
editor.on('init', () => {
const rootNode = editor.getBody();
// Create the toolbar by refocussing the editor.
if (rootNode.ownerDocument.activeElement === rootNode) {
rootNode.blur();
editor.focus();
}
});
}
function initialize() {
const {
settings
} = window.wpEditorL10n.tinymce;
wp.oldEditor.initialize(`editor-${clientId}`, {
tinymce: {
...settings,
inline: true,
content_css: false,
fixed_toolbar_container: `#toolbar-${clientId}`,
setup: onSetup
}
});
}
function onReadyStateChange() {
if (document.readyState === 'complete') {
initialize();
}
}
if (document.readyState === 'complete') {
initialize();
} else {
document.addEventListener('readystatechange', onReadyStateChange);
}
return () => {
document.removeEventListener('readystatechange', onReadyStateChange);
wp.oldEditor.remove(`editor-${clientId}`);
};
}, []);
function focus() {
const editor = window.tinymce.get(`editor-${clientId}`);
if (editor) {
editor.focus();
}
}
function onToolbarKeyDown(event) {
// Prevent WritingFlow from kicking in and allow arrows navigation on the toolbar.
event.stopPropagation();
// Prevent Mousetrap from moving focus to the top toolbar when pressing `alt+f10` on this block toolbar.
event.nativeEvent.stopImmediatePropagation();
}
// Disable reasons:
//
// jsx-a11y/no-static-element-interactions
// - the toolbar itself is non-interactive, but must capture events
// from the KeyboardShortcuts component to stop their propagation.
/* eslint-disable jsx-a11y/no-static-element-interactions */
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", {
key: "toolbar",
id: `toolbar-${clientId}`,
className: "block-library-classic__toolbar",
onClick: focus,
"data-placeholder": (0,external_wp_i18n_namespaceObject.__)('Classic'),
onKeyDown: onToolbarKeyDown
}), (0,external_React_namespaceObject.createElement)("div", {
key: "editor",
id: `editor-${clientId}`,
className: "wp-block-freeform block-library-rich-text__tinymce"
}));
/* eslint-enable jsx-a11y/no-static-element-interactions */
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/freeform/save.js
/**
* WordPress dependencies
*/
function freeform_save_save({
attributes
}) {
const {
content
} = attributes;
return (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, content);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/freeform/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const freeform_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/freeform",
title: "Classic",
category: "text",
description: "Use the classic WordPress editor.",
textdomain: "default",
attributes: {
content: {
type: "string",
source: "raw"
}
},
supports: {
className: false,
customClassName: false,
reusable: false
},
editorStyle: "wp-block-freeform-editor"
};
const {
name: freeform_name
} = freeform_metadata;
const freeform_settings = {
icon: library_classic,
edit: FreeformEdit,
save: freeform_save_save
};
const freeform_init = () => initBlock({
name: freeform_name,
metadata: freeform_metadata,
settings: freeform_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/code.js
/**
* WordPress dependencies
*/
const code = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"
}));
/* harmony default export */ const library_code = (code);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/code/edit.js
/**
* WordPress dependencies
*/
function CodeEdit({
attributes,
setAttributes,
onRemove,
insertBlocksAfter,
mergeBlocks
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
return (0,external_React_namespaceObject.createElement)("pre", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: "code",
identifier: "content",
value: attributes.content,
onChange: content => setAttributes({
content
}),
onRemove: onRemove,
onMerge: mergeBlocks,
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write code…'),
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Code'),
preserveWhiteSpace: true,
__unstablePastePlainText: true,
__unstableOnSplitAtDoubleLineEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()))
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/code/utils.js
/**
* WordPress dependencies
*/
/**
* Escapes ampersands, shortcodes, and links.
*
* @param {string} content The content of a code block.
* @return {string} The given content with some characters escaped.
*/
function utils_escape(content) {
return (0,external_wp_compose_namespaceObject.pipe)(escapeOpeningSquareBrackets, escapeProtocolInIsolatedUrls)(content || '');
}
/**
* Returns the given content with all opening shortcode characters converted
* into their HTML entity counterpart (i.e. [ => [). For instance, a
* shortcode like [embed] becomes [embed]
*
* This function replicates the escaping of HTML tags, where a tag like
* <strong> becomes <strong>.
*
* @param {string} content The content of a code block.
* @return {string} The given content with its opening shortcode characters
* converted into their HTML entity counterpart
* (i.e. [ => [)
*/
function escapeOpeningSquareBrackets(content) {
return content.replace(/\[/g, '[');
}
/**
* Converts the first two forward slashes of any isolated URL into their HTML
* counterparts (i.e. // => //). For instance, https://youtube.com/watch?x
* becomes https://youtube.com/watch?x.
*
* An isolated URL is a URL that sits in its own line, surrounded only by spacing
* characters.
*
* See https://github.com/WordPress/wordpress-develop/blob/5.1.1/src/wp-includes/class-wp-embed.php#L403
*
* @param {string} content The content of a code block.
* @return {string} The given content with its ampersands converted into
* their HTML entity counterpart (i.e. & => &)
*/
function escapeProtocolInIsolatedUrls(content) {
return content.replace(/^(\s*https?:)\/\/([^\s<>"]+\s*)$/m, '$1//$2');
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/code/save.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function code_save_save({
attributes
}) {
return (0,external_React_namespaceObject.createElement)("pre", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "code"
// To do: `escape` encodes characters in shortcodes and URLs to
// prevent embedding in PHP. Ideally checks for the code block,
// or pre/code tags, should be made on the PHP side?
,
value: utils_escape(typeof attributes.content === 'string' ? attributes.content : attributes.content.toHTMLString({
preserveWhiteSpace: true
}))
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/code/transforms.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const code_transforms_transforms = {
from: [{
type: 'enter',
regExp: /^```$/,
transform: () => (0,external_wp_blocks_namespaceObject.createBlock)('core/code')
}, {
type: 'block',
blocks: ['core/paragraph'],
transform: ({
content,
metadata
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/code', {
content,
metadata: getTransformedMetadata(metadata, 'core/code')
})
}, {
type: 'block',
blocks: ['core/html'],
transform: ({
content: text,
metadata
}) => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/code', {
// The HTML is plain text (with plain line breaks), so
// convert it to rich text.
content: (0,external_wp_richText_namespaceObject.toHTMLString)({
value: (0,external_wp_richText_namespaceObject.create)({
text
})
}),
metadata: getTransformedMetadata(metadata, 'core/code')
});
}
}, {
type: 'raw',
isMatch: node => node.nodeName === 'PRE' && node.children.length === 1 && node.firstChild.nodeName === 'CODE',
schema: {
pre: {
children: {
code: {
children: {
'#text': {}
}
}
}
}
}
}],
to: [{
type: 'block',
blocks: ['core/paragraph'],
transform: ({
content,
metadata
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content,
metadata: getTransformedMetadata(metadata, 'core/paragraph')
})
}]
};
/* harmony default export */ const code_transforms = (code_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/code/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const code_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/code",
title: "Code",
category: "text",
description: "Display code snippets that respect your spacing and tabs.",
textdomain: "default",
attributes: {
content: {
type: "rich-text",
source: "rich-text",
selector: "code",
__unstablePreserveWhiteSpace: true
}
},
supports: {
align: ["wide"],
anchor: true,
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
spacing: {
margin: ["top", "bottom"],
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true,
__experimentalDefaultControls: {
width: true,
color: true
}
},
color: {
text: true,
background: true,
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-code"
};
const {
name: code_name
} = code_metadata;
const code_settings = {
icon: library_code,
example: {
attributes: {
/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */
// translators: Preserve \n markers for line breaks
content: (0,external_wp_i18n_namespaceObject.__)('// A “block” is the abstract term used\n// to describe units of markup that\n// when composed together, form the\n// content or layout of a page.\nregisterBlockType( name, settings );')
/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */
}
},
merge(attributes, attributesToMerge) {
return {
content: attributes.content + '\n\n' + attributesToMerge.content
};
},
transforms: code_transforms,
edit: CodeEdit,
save: code_save_save
};
const code_init = () => initBlock({
name: code_name,
metadata: code_metadata,
settings: code_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/column.js
/**
* WordPress dependencies
*/
const column = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M19 6H6c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zM6 17.5c-.3 0-.5-.2-.5-.5V8c0-.3.2-.5.5-.5h3v10H6zm13.5-.5c0 .3-.2.5-.5.5h-3v-10h3c.3 0 .5.2.5.5v9z"
}));
/* harmony default export */ const library_column = (column);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/column/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const column_deprecated_deprecated = [{
attributes: {
verticalAlignment: {
type: 'string'
},
width: {
type: 'number',
min: 0,
max: 100
}
},
isEligible({
width
}) {
return isFinite(width);
},
migrate(attributes) {
return {
...attributes,
width: `${attributes.width}%`
};
},
save({
attributes
}) {
const {
verticalAlignment,
width
} = attributes;
const wrapperClasses = classnames_default()({
[`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment
});
const style = {
flexBasis: width + '%'
};
return (0,external_React_namespaceObject.createElement)("div", {
className: wrapperClasses,
style: style
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
}
}];
/* harmony default export */ const column_deprecated = (column_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/column/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function ColumnEdit({
attributes: {
verticalAlignment,
width,
templateLock,
allowedBlocks
},
setAttributes,
clientId
}) {
const classes = classnames_default()('block-core-columns', {
[`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment
});
const [availableUnits] = (0,external_wp_blockEditor_namespaceObject.useSettings)('spacing.units');
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: availableUnits || ['%', 'px', 'em', 'rem', 'vw']
});
const {
columnsIds,
hasChildBlocks,
rootClientId
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockOrder,
getBlockRootClientId
} = select(external_wp_blockEditor_namespaceObject.store);
const rootId = getBlockRootClientId(clientId);
return {
hasChildBlocks: getBlockOrder(clientId).length > 0,
rootClientId: rootId,
columnsIds: getBlockOrder(rootId)
};
}, [clientId]);
const {
updateBlockAttributes
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const updateAlignment = value => {
// Update own alignment.
setAttributes({
verticalAlignment: value
});
// Reset parent Columns block.
updateBlockAttributes(rootClientId, {
verticalAlignment: null
});
};
const widthWithUnit = Number.isFinite(width) ? width + '%' : width;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classes,
style: widthWithUnit ? {
flexBasis: widthWithUnit
} : undefined
});
const columnsCount = columnsIds.length;
const currentColumnPosition = columnsIds.indexOf(clientId) + 1;
const label = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Block label (i.e. "Block: Column"), 2: Position of the selected block, 3: Total number of sibling blocks of the same type */
(0,external_wp_i18n_namespaceObject.__)('%1$s (%2$d of %3$d)'), blockProps['aria-label'], currentColumnPosition, columnsCount);
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({
...blockProps,
'aria-label': label
}, {
templateLock,
allowedBlocks,
renderAppender: hasChildBlocks ? undefined : external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockVerticalAlignmentToolbar, {
onChange: updateAlignment,
value: verticalAlignment,
controls: ['top', 'center', 'bottom', 'stretch']
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Width'),
labelPosition: "edge",
__unstableInputWidth: "80px",
value: width || '',
onChange: nextWidth => {
nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth;
setAttributes({
width: nextWidth
});
},
units: units
}))), (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
}));
}
/* harmony default export */ const column_edit = (ColumnEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/column/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function column_save_save({
attributes
}) {
const {
verticalAlignment,
width
} = attributes;
const wrapperClasses = classnames_default()({
[`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment
});
let style;
if (width && /\d/.test(width)) {
// Numbers are handled for backward compatibility as they can be still provided with templates.
let flexBasis = Number.isFinite(width) ? width + '%' : width;
// In some cases we need to round the width to a shorter float.
if (!Number.isFinite(width) && width?.endsWith('%')) {
const multiplier = 1000000000000;
// Shrink the number back to a reasonable float.
flexBasis = Math.round(Number.parseFloat(width) * multiplier) / multiplier + '%';
}
style = {
flexBasis
};
}
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: wrapperClasses,
style
});
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
return (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/column/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const column_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/column",
title: "Column",
category: "design",
parent: ["core/columns"],
description: "A single column within a columns block.",
textdomain: "default",
attributes: {
verticalAlignment: {
type: "string"
},
width: {
type: "string"
},
allowedBlocks: {
type: "array"
},
templateLock: {
type: ["string", "boolean"],
"enum": ["all", "insert", "contentOnly", false]
}
},
supports: {
__experimentalOnEnter: true,
anchor: true,
reusable: false,
html: false,
color: {
gradients: true,
heading: true,
button: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
shadow: true,
spacing: {
blockGap: true,
padding: true,
__experimentalDefaultControls: {
padding: true,
blockGap: true
}
},
__experimentalBorder: {
color: true,
style: true,
width: true,
__experimentalDefaultControls: {
color: true,
style: true,
width: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
layout: true,
interactivity: {
clientNavigation: true
}
}
};
const {
name: column_name
} = column_metadata;
const column_settings = {
icon: library_column,
edit: column_edit,
save: column_save_save,
deprecated: column_deprecated
};
const column_init = () => initBlock({
name: column_name,
metadata: column_metadata,
settings: column_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/columns.js
/**
* WordPress dependencies
*/
const columns = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M15 7.5h-5v10h5v-10Zm1.5 0v10H19a.5.5 0 0 0 .5-.5V8a.5.5 0 0 0-.5-.5h-2.5ZM6 7.5h2.5v10H6a.5.5 0 0 1-.5-.5V8a.5.5 0 0 1 .5-.5ZM6 6h13a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2Z"
}));
/* harmony default export */ const library_columns = (columns);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Given an HTML string for a deprecated columns inner block, returns the
* column index to which the migrated inner block should be assigned. Returns
* undefined if the inner block was not assigned to a column.
*
* @param {string} originalContent Deprecated Columns inner block HTML.
*
* @return {number | undefined} Column to which inner block is to be assigned.
*/
function getDeprecatedLayoutColumn(originalContent) {
let {
doc
} = getDeprecatedLayoutColumn;
if (!doc) {
doc = document.implementation.createHTMLDocument('');
getDeprecatedLayoutColumn.doc = doc;
}
let columnMatch;
doc.body.innerHTML = originalContent;
for (const classListItem of doc.body.firstChild.classList) {
if (columnMatch = classListItem.match(/^layout-column-(\d+)$/)) {
return Number(columnMatch[1]) - 1;
}
}
}
const migrateCustomColors = attributes => {
if (!attributes.customTextColor && !attributes.customBackgroundColor) {
return attributes;
}
const style = {
color: {}
};
if (attributes.customTextColor) {
style.color.text = attributes.customTextColor;
}
if (attributes.customBackgroundColor) {
style.color.background = attributes.customBackgroundColor;
}
const {
customTextColor,
customBackgroundColor,
...restAttributes
} = attributes;
return {
...restAttributes,
style,
isStackedOnMobile: true
};
};
/* harmony default export */ const columns_deprecated = ([{
attributes: {
verticalAlignment: {
type: 'string'
},
backgroundColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
customTextColor: {
type: 'string'
},
textColor: {
type: 'string'
}
},
migrate: migrateCustomColors,
save({
attributes
}) {
const {
verticalAlignment,
backgroundColor,
customBackgroundColor,
textColor,
customTextColor
} = attributes;
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const className = classnames_default()({
'has-background': backgroundColor || customBackgroundColor,
'has-text-color': textColor || customTextColor,
[backgroundClass]: backgroundClass,
[textClass]: textClass,
[`are-vertically-aligned-${verticalAlignment}`]: verticalAlignment
});
const style = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
color: textClass ? undefined : customTextColor
};
return (0,external_React_namespaceObject.createElement)("div", {
className: className ? className : undefined,
style: style
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
}
}, {
attributes: {
columns: {
type: 'number',
default: 2
}
},
isEligible(attributes, innerBlocks) {
// Since isEligible is called on every valid instance of the
// Columns block and a deprecation is the unlikely case due to
// its subsequent migration, optimize for the `false` condition
// by performing a naive, inaccurate pass at inner blocks.
const isFastPassEligible = innerBlocks.some(innerBlock => /layout-column-\d+/.test(innerBlock.originalContent));
if (!isFastPassEligible) {
return false;
}
// Only if the fast pass is considered eligible is the more
// accurate, durable, slower condition performed.
return innerBlocks.some(innerBlock => getDeprecatedLayoutColumn(innerBlock.originalContent) !== undefined);
},
migrate(attributes, innerBlocks) {
const columns = innerBlocks.reduce((accumulator, innerBlock) => {
const {
originalContent
} = innerBlock;
let columnIndex = getDeprecatedLayoutColumn(originalContent);
if (columnIndex === undefined) {
columnIndex = 0;
}
if (!accumulator[columnIndex]) {
accumulator[columnIndex] = [];
}
accumulator[columnIndex].push(innerBlock);
return accumulator;
}, []);
const migratedInnerBlocks = columns.map(columnBlocks => (0,external_wp_blocks_namespaceObject.createBlock)('core/column', {}, columnBlocks));
const {
columns: ignoredColumns,
...restAttributes
} = attributes;
return [{
...restAttributes,
isStackedOnMobile: true
}, migratedInnerBlocks];
},
save({
attributes
}) {
const {
columns
} = attributes;
return (0,external_React_namespaceObject.createElement)("div", {
className: `has-${columns}-columns`
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
}
}, {
attributes: {
columns: {
type: 'number',
default: 2
}
},
migrate(attributes, innerBlocks) {
const {
columns,
...restAttributes
} = attributes;
attributes = {
...restAttributes,
isStackedOnMobile: true
};
return [attributes, innerBlocks];
},
save({
attributes
}) {
const {
verticalAlignment,
columns
} = attributes;
const wrapperClasses = classnames_default()(`has-${columns}-columns`, {
[`are-vertically-aligned-${verticalAlignment}`]: verticalAlignment
});
return (0,external_React_namespaceObject.createElement)("div", {
className: wrapperClasses
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
}
}]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/utils.js
/**
* Returns a column width attribute value rounded to standard precision.
* Returns `undefined` if the value is not a valid finite number.
*
* @param {?number} value Raw value.
*
* @return {number} Value rounded to standard precision.
*/
const toWidthPrecision = value => {
const unitlessValue = parseFloat(value);
return Number.isFinite(unitlessValue) ? parseFloat(unitlessValue.toFixed(2)) : undefined;
};
/**
* Returns an effective width for a given block. An effective width is equal to
* its attribute value if set, or a computed value assuming equal distribution.
*
* @param {WPBlock} block Block object.
* @param {number} totalBlockCount Total number of blocks in Columns.
*
* @return {number} Effective column width.
*/
function getEffectiveColumnWidth(block, totalBlockCount) {
const {
width = 100 / totalBlockCount
} = block.attributes;
return toWidthPrecision(width);
}
/**
* Returns the total width occupied by the given set of column blocks.
*
* @param {WPBlock[]} blocks Block objects.
* @param {?number} totalBlockCount Total number of blocks in Columns.
* Defaults to number of blocks passed.
*
* @return {number} Total width occupied by blocks.
*/
function getTotalColumnsWidth(blocks, totalBlockCount = blocks.length) {
return blocks.reduce((sum, block) => sum + getEffectiveColumnWidth(block, totalBlockCount), 0);
}
/**
* Returns an object of `clientId` → `width` of effective column widths.
*
* @param {WPBlock[]} blocks Block objects.
* @param {?number} totalBlockCount Total number of blocks in Columns.
* Defaults to number of blocks passed.
*
* @return {Object<string,number>} Column widths.
*/
function getColumnWidths(blocks, totalBlockCount = blocks.length) {
return blocks.reduce((accumulator, block) => {
const width = getEffectiveColumnWidth(block, totalBlockCount);
return Object.assign(accumulator, {
[block.clientId]: width
});
}, {});
}
/**
* Returns an object of `clientId` → `width` of column widths as redistributed
* proportional to their current widths, constrained or expanded to fit within
* the given available width.
*
* @param {WPBlock[]} blocks Block objects.
* @param {number} availableWidth Maximum width to fit within.
* @param {?number} totalBlockCount Total number of blocks in Columns.
* Defaults to number of blocks passed.
*
* @return {Object<string,number>} Redistributed column widths.
*/
function getRedistributedColumnWidths(blocks, availableWidth, totalBlockCount = blocks.length) {
const totalWidth = getTotalColumnsWidth(blocks, totalBlockCount);
return Object.fromEntries(Object.entries(getColumnWidths(blocks, totalBlockCount)).map(([clientId, width]) => {
const newWidth = availableWidth * width / totalWidth;
return [clientId, toWidthPrecision(newWidth)];
}));
}
/**
* Returns true if column blocks within the provided set are assigned with
* explicit widths, or false otherwise.
*
* @param {WPBlock[]} blocks Block objects.
*
* @return {boolean} Whether columns have explicit widths.
*/
function hasExplicitPercentColumnWidths(blocks) {
return blocks.every(block => {
const blockWidth = block.attributes.width;
return Number.isFinite(blockWidth?.endsWith?.('%') ? parseFloat(blockWidth) : blockWidth);
});
}
/**
* Returns a copy of the given set of blocks with new widths assigned from the
* provided object of redistributed column widths.
*
* @param {WPBlock[]} blocks Block objects.
* @param {Object<string,number>} widths Redistributed column widths.
*
* @return {WPBlock[]} blocks Mapped block objects.
*/
function getMappedColumnWidths(blocks, widths) {
return blocks.map(block => ({
...block,
attributes: {
...block.attributes,
width: `${widths[block.clientId]}%`
}
}));
}
/**
* Returns an array with columns widths values, parsed or no depends on `withParsing` flag.
*
* @param {WPBlock[]} blocks Block objects.
* @param {?boolean} withParsing Whether value has to be parsed.
*
* @return {Array<number,string>} Column widths.
*/
function getWidths(blocks, withParsing = true) {
return blocks.map(innerColumn => {
const innerColumnWidth = innerColumn.attributes.width || 100 / blocks.length;
return withParsing ? parseFloat(innerColumnWidth) : innerColumnWidth;
});
}
/**
* Returns a column width with unit.
*
* @param {string} width Column width.
* @param {string} unit Column width unit.
*
* @return {string} Column width with unit.
*/
function getWidthWithUnit(width, unit) {
width = 0 > parseFloat(width) ? '0' : width;
if (isPercentageUnit(unit)) {
width = Math.min(width, 100);
}
return `${width}${unit}`;
}
/**
* Returns a boolean whether passed unit is percentage
*
* @param {string} unit Column width unit.
*
* @return {boolean} Whether unit is '%'.
*/
function isPercentageUnit(unit) {
return unit === '%';
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ColumnsEditContainer({
attributes,
setAttributes,
clientId
}) {
const {
isStackedOnMobile,
verticalAlignment,
templateLock
} = attributes;
const {
count,
canInsertColumnBlock,
minCount
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canInsertBlockType,
canRemoveBlock,
getBlocks,
getBlockCount
} = select(external_wp_blockEditor_namespaceObject.store);
const innerBlocks = getBlocks(clientId);
// Get the indexes of columns for which removal is prevented.
// The highest index will be used to determine the minimum column count.
const preventRemovalBlockIndexes = innerBlocks.reduce((acc, block, index) => {
if (!canRemoveBlock(block.clientId)) {
acc.push(index);
}
return acc;
}, []);
return {
count: getBlockCount(clientId),
canInsertColumnBlock: canInsertBlockType('core/column', clientId),
minCount: Math.max(...preventRemovalBlockIndexes) + 1
};
}, [clientId]);
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
getBlocks,
getBlockOrder
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const {
updateBlockAttributes,
replaceInnerBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const classes = classnames_default()({
[`are-vertically-aligned-${verticalAlignment}`]: verticalAlignment,
[`is-not-stacked-on-mobile`]: !isStackedOnMobile
});
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classes
});
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
orientation: 'horizontal',
renderAppender: false,
templateLock
});
/**
* Update all child Column blocks with a new vertical alignment setting
* based on whatever alignment is passed in. This allows change to parent
* to overide anything set on a individual column basis.
*
* @param {string} newVerticalAlignment The vertical alignment setting.
*/
function updateAlignment(newVerticalAlignment) {
const innerBlockClientIds = getBlockOrder(clientId);
// Update own and child Column block vertical alignments.
// This is a single action; the batching prevents creating multiple history records.
registry.batch(() => {
setAttributes({
verticalAlignment: newVerticalAlignment
});
updateBlockAttributes(innerBlockClientIds, {
verticalAlignment: newVerticalAlignment
});
});
}
/**
* Updates the column count, including necessary revisions to child Column
* blocks to grant required or redistribute available space.
*
* @param {number} previousColumns Previous column count.
* @param {number} newColumns New column count.
*/
function updateColumns(previousColumns, newColumns) {
let innerBlocks = getBlocks(clientId);
const hasExplicitWidths = hasExplicitPercentColumnWidths(innerBlocks);
// Redistribute available width for existing inner blocks.
const isAddingColumn = newColumns > previousColumns;
if (isAddingColumn && hasExplicitWidths) {
// If adding a new column, assign width to the new column equal to
// as if it were `1 / columns` of the total available space.
const newColumnWidth = toWidthPrecision(100 / newColumns);
// Redistribute in consideration of pending block insertion as
// constraining the available working width.
const widths = getRedistributedColumnWidths(innerBlocks, 100 - newColumnWidth);
innerBlocks = [...getMappedColumnWidths(innerBlocks, widths), ...Array.from({
length: newColumns - previousColumns
}).map(() => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/column', {
width: `${newColumnWidth}%`
});
})];
} else if (isAddingColumn) {
innerBlocks = [...innerBlocks, ...Array.from({
length: newColumns - previousColumns
}).map(() => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/column');
})];
} else if (newColumns < previousColumns) {
// The removed column will be the last of the inner blocks.
innerBlocks = innerBlocks.slice(0, -(previousColumns - newColumns));
if (hasExplicitWidths) {
// Redistribute as if block is already removed.
const widths = getRedistributedColumnWidths(innerBlocks, 100);
innerBlocks = getMappedColumnWidths(innerBlocks, widths);
}
}
replaceInnerBlocks(clientId, innerBlocks);
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockVerticalAlignmentToolbar, {
onChange: updateAlignment,
value: verticalAlignment
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, canInsertColumnBlock && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Columns'),
value: count,
onChange: value => updateColumns(count, Math.max(minCount, value)),
min: Math.max(1, minCount),
max: Math.max(6, count)
}), count > 6 && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
status: "warning",
isDismissible: false
}, (0,external_wp_i18n_namespaceObject.__)('This column count exceeds the recommended amount and may cause visual breakage.'))), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Stack on mobile'),
checked: isStackedOnMobile,
onChange: () => setAttributes({
isStackedOnMobile: !isStackedOnMobile
})
}))), (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
}));
}
function Placeholder({
clientId,
name,
setAttributes
}) {
const {
blockType,
defaultVariation,
variations
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockVariations,
getBlockType,
getDefaultBlockVariation
} = select(external_wp_blocks_namespaceObject.store);
return {
blockType: getBlockType(name),
defaultVariation: getDefaultBlockVariation(name, 'block'),
variations: getBlockVariations(name, 'block')
};
}, [name]);
const {
replaceInnerBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockVariationPicker, {
icon: blockType?.icon?.src,
label: blockType?.title,
variations: variations,
onSelect: (nextVariation = defaultVariation) => {
if (nextVariation.attributes) {
setAttributes(nextVariation.attributes);
}
if (nextVariation.innerBlocks) {
replaceInnerBlocks(clientId, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(nextVariation.innerBlocks), true);
}
},
allowSkip: true
}));
}
const ColumnsEdit = props => {
const {
clientId
} = props;
const hasInnerBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlocks(clientId).length > 0, [clientId]);
const Component = hasInnerBlocks ? ColumnsEditContainer : Placeholder;
return (0,external_React_namespaceObject.createElement)(Component, {
...props
});
};
/* harmony default export */ const columns_edit = (ColumnsEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function columns_save_save({
attributes
}) {
const {
isStackedOnMobile,
verticalAlignment
} = attributes;
const className = classnames_default()({
[`are-vertically-aligned-${verticalAlignment}`]: verticalAlignment,
[`is-not-stacked-on-mobile`]: !isStackedOnMobile
});
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
});
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
return (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/variations.js
/**
* WordPress dependencies
*/
/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */
/**
* Template option choices for predefined columns layouts.
*
* @type {WPBlockVariation[]}
*/
const variations = [{
name: 'one-column-full',
title: (0,external_wp_i18n_namespaceObject.__)('100'),
description: (0,external_wp_i18n_namespaceObject.__)('One column'),
icon: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
width: "48",
height: "48",
viewBox: "0 0 48 48",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "m39.0625 14h-30.0625v20.0938h30.0625zm-30.0625-2c-1.10457 0-2 .8954-2 2v20.0938c0 1.1045.89543 2 2 2h30.0625c1.1046 0 2-.8955 2-2v-20.0938c0-1.1046-.8954-2-2-2z"
})),
innerBlocks: [['core/column']],
scope: ['block']
}, {
name: 'two-columns-equal',
title: (0,external_wp_i18n_namespaceObject.__)('50 / 50'),
description: (0,external_wp_i18n_namespaceObject.__)('Two columns; equal split'),
icon: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
width: "48",
height: "48",
viewBox: "0 0 48 48",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H25V34H39ZM23 34H9V14H23V34Z"
})),
isDefault: true,
innerBlocks: [['core/column'], ['core/column']],
scope: ['block']
}, {
name: 'two-columns-one-third-two-thirds',
title: (0,external_wp_i18n_namespaceObject.__)('33 / 66'),
description: (0,external_wp_i18n_namespaceObject.__)('Two columns; one-third, two-thirds split'),
icon: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
width: "48",
height: "48",
viewBox: "0 0 48 48",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H20V34H39ZM18 34H9V14H18V34Z"
})),
innerBlocks: [['core/column', {
width: '33.33%'
}], ['core/column', {
width: '66.66%'
}]],
scope: ['block']
}, {
name: 'two-columns-two-thirds-one-third',
title: (0,external_wp_i18n_namespaceObject.__)('66 / 33'),
description: (0,external_wp_i18n_namespaceObject.__)('Two columns; two-thirds, one-third split'),
icon: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
width: "48",
height: "48",
viewBox: "0 0 48 48",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H30V34H39ZM28 34H9V14H28V34Z"
})),
innerBlocks: [['core/column', {
width: '66.66%'
}], ['core/column', {
width: '33.33%'
}]],
scope: ['block']
}, {
name: 'three-columns-equal',
title: (0,external_wp_i18n_namespaceObject.__)('33 / 33 / 33'),
description: (0,external_wp_i18n_namespaceObject.__)('Three columns; equal split'),
icon: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
width: "48",
height: "48",
viewBox: "0 0 48 48",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
fillRule: "evenodd",
d: "M41 14a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h30a2 2 0 0 0 2-2V14zM28.5 34h-9V14h9v20zm2 0V14H39v20h-8.5zm-13 0H9V14h8.5v20z"
})),
innerBlocks: [['core/column'], ['core/column'], ['core/column']],
scope: ['block']
}, {
name: 'three-columns-wider-center',
title: (0,external_wp_i18n_namespaceObject.__)('25 / 50 / 25'),
description: (0,external_wp_i18n_namespaceObject.__)('Three columns; wide center column'),
icon: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
width: "48",
height: "48",
viewBox: "0 0 48 48",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
fillRule: "evenodd",
d: "M41 14a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h30a2 2 0 0 0 2-2V14zM31 34H17V14h14v20zm2 0V14h6v20h-6zm-18 0H9V14h6v20z"
})),
innerBlocks: [['core/column', {
width: '25%'
}], ['core/column', {
width: '50%'
}], ['core/column', {
width: '25%'
}]],
scope: ['block']
}];
/* harmony default export */ const columns_variations = (variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/transforms.js
/**
* WordPress dependencies
*/
const MAXIMUM_SELECTED_BLOCKS = 6;
const columns_transforms_transforms = {
from: [{
type: 'block',
isMultiBlock: true,
blocks: ['*'],
__experimentalConvert: blocks => {
const columnWidth = +(100 / blocks.length).toFixed(2);
const innerBlocksTemplate = blocks.map(({
name,
attributes,
innerBlocks
}) => ['core/column', {
width: `${columnWidth}%`
}, [[name, {
...attributes
}, innerBlocks]]]);
return (0,external_wp_blocks_namespaceObject.createBlock)('core/columns', {}, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(innerBlocksTemplate));
},
isMatch: ({
length: selectedBlocksLength
}, blocks) => {
// If a user is trying to transform a single Columns block, skip
// the transformation. Enabling this functiontionality creates
// nested Columns blocks resulting in an unintuitive user experience.
// Multiple Columns blocks can still be transformed.
if (blocks.length === 1 && blocks[0].name === 'core/columns') {
return false;
}
return selectedBlocksLength && selectedBlocksLength <= MAXIMUM_SELECTED_BLOCKS;
}
}, {
type: 'block',
blocks: ['core/media-text'],
priority: 1,
transform: (attributes, innerBlocks) => {
const {
align,
backgroundColor,
textColor,
style,
mediaAlt: alt,
mediaId: id,
mediaPosition,
mediaSizeSlug: sizeSlug,
mediaType,
mediaUrl: url,
mediaWidth,
verticalAlignment
} = attributes;
let media;
if (mediaType === 'image' || !mediaType) {
const imageAttrs = {
id,
alt,
url,
sizeSlug
};
const linkAttrs = {
href: attributes.href,
linkClass: attributes.linkClass,
linkDestination: attributes.linkDestination,
linkTarget: attributes.linkTarget,
rel: attributes.rel
};
media = ['core/image', {
...imageAttrs,
...linkAttrs
}];
} else {
media = ['core/video', {
id,
src: url
}];
}
const innerBlocksTemplate = [['core/column', {
width: `${mediaWidth}%`
}, [media]], ['core/column', {
width: `${100 - mediaWidth}%`
}, innerBlocks]];
if (mediaPosition === 'right') {
innerBlocksTemplate.reverse();
}
return (0,external_wp_blocks_namespaceObject.createBlock)('core/columns', {
align,
backgroundColor,
textColor,
style,
verticalAlignment
}, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(innerBlocksTemplate));
}
}],
ungroup: (attributes, innerBlocks) => innerBlocks.flatMap(innerBlock => innerBlock.innerBlocks)
};
/* harmony default export */ const columns_transforms = (columns_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const columns_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/columns",
title: "Columns",
category: "design",
allowedBlocks: ["core/column"],
description: "Display content in multiple columns, with blocks added to each column.",
textdomain: "default",
attributes: {
verticalAlignment: {
type: "string"
},
isStackedOnMobile: {
type: "boolean",
"default": true
},
templateLock: {
type: ["string", "boolean"],
"enum": ["all", "insert", "contentOnly", false]
}
},
supports: {
anchor: true,
align: ["wide", "full"],
html: false,
color: {
gradients: true,
link: true,
heading: true,
button: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
blockGap: {
__experimentalDefault: "2em",
sides: ["horizontal", "vertical"]
},
margin: ["top", "bottom"],
padding: true,
__experimentalDefaultControls: {
padding: true,
blockGap: true
}
},
layout: {
allowSwitching: false,
allowInheriting: false,
allowEditing: false,
"default": {
type: "flex",
flexWrap: "nowrap"
}
},
__experimentalBorder: {
color: true,
radius: true,
style: true,
width: true,
__experimentalDefaultControls: {
color: true,
radius: true,
style: true,
width: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
},
shadow: true
},
editorStyle: "wp-block-columns-editor",
style: "wp-block-columns"
};
const {
name: columns_name
} = columns_metadata;
const columns_settings = {
icon: library_columns,
variations: columns_variations,
example: {
viewportWidth: 600,
// Columns collapse "@media (max-width: 599px)".
innerBlocks: [{
name: 'core/column',
innerBlocks: [{
name: 'core/paragraph',
attributes: {
/* translators: example text. */
content: (0,external_wp_i18n_namespaceObject.__)('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et eros eu felis.')
}
}, {
name: 'core/image',
attributes: {
url: 'https://s.w.org/images/core/5.3/Windbuchencom.jpg'
}
}, {
name: 'core/paragraph',
attributes: {
/* translators: example text. */
content: (0,external_wp_i18n_namespaceObject.__)('Suspendisse commodo neque lacus, a dictum orci interdum et.')
}
}]
}, {
name: 'core/column',
innerBlocks: [{
name: 'core/paragraph',
attributes: {
/* translators: example text. */
content: (0,external_wp_i18n_namespaceObject.__)('Etiam et egestas lorem. Vivamus sagittis sit amet dolor quis lobortis. Integer sed fermentum arcu, id vulputate lacus. Etiam fermentum sem eu quam hendrerit.')
}
}, {
name: 'core/paragraph',
attributes: {
/* translators: example text. */
content: (0,external_wp_i18n_namespaceObject.__)('Nam risus massa, ullamcorper consectetur eros fermentum, porta aliquet ligula. Sed vel mauris nec enim.')
}
}]
}]
},
deprecated: columns_deprecated,
edit: columns_edit,
save: columns_save_save,
transforms: columns_transforms
};
const columns_init = () => initBlock({
name: columns_name,
metadata: columns_metadata,
settings: columns_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-comments.js
/**
* WordPress dependencies
*/
const postComments = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M14 10.1V4c0-.6-.4-1-1-1H5c-.6 0-1 .4-1 1v8.3c0 .3.2.7.6.8.1.1.2.1.3.1.2 0 .5-.1.6-.3l1.8-1.8H13c.6 0 1-.4 1-1zm-1.5-.5H6.7l-1.2 1.2V4.5h7v5.1zM19 12h-8c-.6 0-1 .4-1 1v6.1c0 .6.4 1 1 1h5.7l1.8 1.8c.1.2.4.3.6.3.1 0 .2 0 .3-.1.4-.1.6-.5.6-.8V13c0-.6-.4-1-1-1zm-.5 7.8l-1.2-1.2h-5.8v-5.1h7v6.3z"
}));
/* harmony default export */ const post_comments = (postComments);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments/deprecated.js
/**
* WordPress dependencies
*/
// v1: Deprecate the initial version of the block which was called "Comments
// Query Loop" instead of "Comments".
const v1 = {
attributes: {
tagName: {
type: 'string',
default: 'div'
}
},
apiVersion: 3,
supports: {
align: ['wide', 'full'],
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
}
},
save({
attributes: {
tagName: Tag
}
}) {
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save();
const {
className
} = blockProps;
const classes = className?.split(' ') || [];
// The ID of the previous version of the block
// didn't have the `wp-block-comments` class,
// so we need to remove it here in order to mimic it.
const newClasses = classes?.filter(cls => cls !== 'wp-block-comments');
const newBlockProps = {
...blockProps,
className: newClasses.join(' ')
};
return (0,external_React_namespaceObject.createElement)(Tag, {
...newBlockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
}
};
/* harmony default export */ const comments_deprecated = ([v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments/edit/comments-inspector-controls.js
/**
* WordPress dependencies
*/
function CommentsInspectorControls({
attributes: {
tagName
},
setAttributes
}) {
const htmlElementMessages = {
section: (0,external_wp_i18n_namespaceObject.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element."),
aside: (0,external_wp_i18n_namespaceObject.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.")
};
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('HTML element'),
options: [{
label: (0,external_wp_i18n_namespaceObject.__)('Default (<div>)'),
value: 'div'
}, {
label: '<section>',
value: 'section'
}, {
label: '<aside>',
value: 'aside'
}],
value: tagName,
onChange: value => setAttributes({
tagName: value
}),
help: htmlElementMessages[tagName]
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comments-form/form.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const CommentsFormPlaceholder = () => {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CommentsFormPlaceholder);
return (0,external_React_namespaceObject.createElement)("div", {
className: "comment-respond"
}, (0,external_React_namespaceObject.createElement)("h3", {
className: "comment-reply-title"
}, (0,external_wp_i18n_namespaceObject.__)('Leave a Reply')), (0,external_React_namespaceObject.createElement)("form", {
noValidate: true,
className: "comment-form",
onSubmit: event => event.preventDefault()
}, (0,external_React_namespaceObject.createElement)("p", null, (0,external_React_namespaceObject.createElement)("label", {
htmlFor: `comment-${instanceId}`
}, (0,external_wp_i18n_namespaceObject.__)('Comment')), (0,external_React_namespaceObject.createElement)("textarea", {
id: `comment-${instanceId}`,
name: "comment",
cols: "45",
rows: "8",
readOnly: true
})), (0,external_React_namespaceObject.createElement)("p", {
className: "form-submit wp-block-button"
}, (0,external_React_namespaceObject.createElement)("input", {
name: "submit",
type: "submit",
className: classnames_default()('wp-block-button__link', (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('button')),
label: (0,external_wp_i18n_namespaceObject.__)('Post Comment'),
value: (0,external_wp_i18n_namespaceObject.__)('Post Comment'),
"aria-disabled": "true"
}))));
};
const CommentsForm = ({
postId,
postType
}) => {
const [commentStatus, setCommentStatus] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'comment_status', postId);
const isSiteEditor = postType === undefined || postId === undefined;
const {
defaultCommentStatus
} = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings().__experimentalDiscussionSettings);
const postTypeSupportsComments = (0,external_wp_data_namespaceObject.useSelect)(select => postType ? !!select(external_wp_coreData_namespaceObject.store).getPostType(postType)?.supports.comments : false);
if (!isSiteEditor && 'open' !== commentStatus) {
if ('closed' === commentStatus) {
const actions = [(0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
key: "enableComments",
onClick: () => setCommentStatus('open'),
variant: "primary"
}, (0,external_wp_i18n_namespaceObject._x)('Enable comments', 'action that affects the current post'))];
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
actions: actions
}, (0,external_wp_i18n_namespaceObject.__)('Post Comments Form block: Comments are not enabled for this item.'));
} else if (!postTypeSupportsComments) {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Post type (i.e. "post", "page") */
(0,external_wp_i18n_namespaceObject.__)('Post Comments Form block: Comments are not enabled for this post type (%s).'), postType));
} else if ('open' !== defaultCommentStatus) {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Post Comments Form block: Comments are not enabled.'));
}
}
return (0,external_React_namespaceObject.createElement)(CommentsFormPlaceholder, null);
};
/* harmony default export */ const post_comments_form_form = (CommentsForm);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments/edit/placeholder.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PostCommentsPlaceholder({
postType,
postId
}) {
let [postTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'title', postId);
postTitle = postTitle || (0,external_wp_i18n_namespaceObject.__)('Post Title');
const {
avatarURL
} = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings().__experimentalDiscussionSettings);
return (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-comments__legacy-placeholder",
inert: "true"
}, (0,external_React_namespaceObject.createElement)("h3", null, /* translators: %s: Post title. */
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('One response to %s'), postTitle)), (0,external_React_namespaceObject.createElement)("div", {
className: "navigation"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "alignleft"
}, (0,external_React_namespaceObject.createElement)("a", {
href: "#top"
}, "\xAB ", (0,external_wp_i18n_namespaceObject.__)('Older Comments'))), (0,external_React_namespaceObject.createElement)("div", {
className: "alignright"
}, (0,external_React_namespaceObject.createElement)("a", {
href: "#top"
}, (0,external_wp_i18n_namespaceObject.__)('Newer Comments'), " \xBB"))), (0,external_React_namespaceObject.createElement)("ol", {
className: "commentlist"
}, (0,external_React_namespaceObject.createElement)("li", {
className: "comment even thread-even depth-1"
}, (0,external_React_namespaceObject.createElement)("article", {
className: "comment-body"
}, (0,external_React_namespaceObject.createElement)("footer", {
className: "comment-meta"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "comment-author vcard"
}, (0,external_React_namespaceObject.createElement)("img", {
alt: (0,external_wp_i18n_namespaceObject.__)('Commenter Avatar'),
src: avatarURL,
className: "avatar avatar-32 photo",
height: "32",
width: "32",
loading: "lazy"
}), (0,external_React_namespaceObject.createElement)("b", {
className: "fn"
}, (0,external_React_namespaceObject.createElement)("a", {
href: "#top",
className: "url"
}, (0,external_wp_i18n_namespaceObject.__)('A WordPress Commenter'))), ' ', (0,external_React_namespaceObject.createElement)("span", {
className: "says"
}, (0,external_wp_i18n_namespaceObject.__)('says'), ":")), (0,external_React_namespaceObject.createElement)("div", {
className: "comment-metadata"
}, (0,external_React_namespaceObject.createElement)("a", {
href: "#top"
}, (0,external_React_namespaceObject.createElement)("time", {
dateTime: "2000-01-01T00:00:00+00:00"
}, (0,external_wp_i18n_namespaceObject.__)('January 1, 2000 at 00:00 am'))), ' ', (0,external_React_namespaceObject.createElement)("span", {
className: "edit-link"
}, (0,external_React_namespaceObject.createElement)("a", {
className: "comment-edit-link",
href: "#top"
}, (0,external_wp_i18n_namespaceObject.__)('Edit'))))), (0,external_React_namespaceObject.createElement)("div", {
className: "comment-content"
}, (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Hi, this is a comment.'), (0,external_React_namespaceObject.createElement)("br", null), (0,external_wp_i18n_namespaceObject.__)('To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.'), (0,external_React_namespaceObject.createElement)("br", null), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Commenter avatars come from <a>Gravatar</a>.'), {
a:
// eslint-disable-next-line jsx-a11y/anchor-has-content
(0,external_React_namespaceObject.createElement)("a", {
href: "https://gravatar.com/"
})
}))), (0,external_React_namespaceObject.createElement)("div", {
className: "reply"
}, (0,external_React_namespaceObject.createElement)("a", {
className: "comment-reply-link",
href: "#top",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Reply to A WordPress Commenter')
}, (0,external_wp_i18n_namespaceObject.__)('Reply')))))), (0,external_React_namespaceObject.createElement)("div", {
className: "navigation"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "alignleft"
}, (0,external_React_namespaceObject.createElement)("a", {
href: "#top"
}, "\xAB ", (0,external_wp_i18n_namespaceObject.__)('Older Comments'))), (0,external_React_namespaceObject.createElement)("div", {
className: "alignright"
}, (0,external_React_namespaceObject.createElement)("a", {
href: "#top"
}, (0,external_wp_i18n_namespaceObject.__)('Newer Comments'), " \xBB"))), (0,external_React_namespaceObject.createElement)(post_comments_form_form, {
postId: postId,
postType: postType
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments/edit/comments-legacy.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function CommentsLegacy({
attributes,
setAttributes,
context: {
postType,
postId
}
}) {
const {
textAlign
} = attributes;
const actions = [(0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
key: "convert",
onClick: () => void setAttributes({
legacy: false
}),
variant: "primary"
}, (0,external_wp_i18n_namespaceObject.__)('Switch to editable mode'))];
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
actions: actions
}, (0,external_wp_i18n_namespaceObject.__)('Comments block: You’re currently using the legacy version of the block. ' + 'The following is just a placeholder - the final styling will likely look different. ' + 'For a better representation and more customization options, ' + 'switch the block to its editable mode.')), (0,external_React_namespaceObject.createElement)(PostCommentsPlaceholder, {
postId: postId,
postType: postType
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments/edit/template.js
const TEMPLATE = [['core/comments-title'], ['core/comment-template', {}, [['core/columns', {}, [['core/column', {
width: '40px'
}, [['core/avatar', {
size: 40,
style: {
border: {
radius: '20px'
}
}
}]]], ['core/column', {}, [['core/comment-author-name', {
fontSize: 'small'
}], ['core/group', {
layout: {
type: 'flex'
},
style: {
spacing: {
margin: {
top: '0px',
bottom: '0px'
}
}
}
}, [['core/comment-date', {
fontSize: 'small'
}], ['core/comment-edit-link', {
fontSize: 'small'
}]]], ['core/comment-content'], ['core/comment-reply-link', {
fontSize: 'small'
}]]]]]]], ['core/comments-pagination'], ['core/post-comments-form']];
/* harmony default export */ const template = (TEMPLATE);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments/edit/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function CommentsEdit(props) {
const {
attributes,
setAttributes
} = props;
const {
tagName: TagName,
legacy
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: template
});
if (legacy) {
return (0,external_React_namespaceObject.createElement)(CommentsLegacy, {
...props
});
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(CommentsInspectorControls, {
attributes: attributes,
setAttributes: setAttributes
}), (0,external_React_namespaceObject.createElement)(TagName, {
...innerBlocksProps
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments/save.js
/**
* WordPress dependencies
*/
function comments_save_save({
attributes: {
tagName: Tag,
legacy
}
}) {
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save();
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
// The legacy version is dynamic (i.e. PHP rendered) and doesn't allow inner
// blocks, so nothing is saved in that case.
return legacy ? null : (0,external_React_namespaceObject.createElement)(Tag, {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comments_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/comments",
title: "Comments",
category: "theme",
description: "An advanced block that allows displaying post comments using different visual configurations.",
textdomain: "default",
attributes: {
tagName: {
type: "string",
"default": "div"
},
legacy: {
type: "boolean",
"default": false
}
},
supports: {
align: ["wide", "full"],
html: false,
color: {
gradients: true,
heading: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
}
},
editorStyle: "wp-block-comments-editor",
usesContext: ["postId", "postType"]
};
const {
name: comments_name
} = comments_metadata;
const comments_settings = {
icon: post_comments,
edit: CommentsEdit,
save: comments_save_save,
deprecated: comments_deprecated
};
const comments_init = () => initBlock({
name: comments_name,
metadata: comments_metadata,
settings: comments_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-author-avatar/edit.js
/**
* WordPress dependencies
*/
function edit_Edit({
attributes,
context: {
commentId
},
setAttributes,
isSelected
}) {
const {
height,
width
} = attributes;
const [avatars] = (0,external_wp_coreData_namespaceObject.useEntityProp)('root', 'comment', 'author_avatar_urls', commentId);
const [authorName] = (0,external_wp_coreData_namespaceObject.useEntityProp)('root', 'comment', 'author_name', commentId);
const avatarUrls = avatars ? Object.values(avatars) : null;
const sizes = avatars ? Object.keys(avatars) : null;
const minSize = sizes ? sizes[0] : 24;
const maxSize = sizes ? sizes[sizes.length - 1] : 96;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const spacingProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetSpacingClassesAndStyles)(attributes);
const maxSizeBuffer = Math.floor(maxSize * 2.5);
const {
avatarURL
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
const {
__experimentalDiscussionSettings
} = getSettings();
return __experimentalDiscussionSettings;
});
const inspectorControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Avatar Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Image size'),
onChange: newWidth => setAttributes({
width: newWidth,
height: newWidth
}),
min: minSize,
max: maxSizeBuffer,
initialPosition: width,
value: width
})));
const resizableAvatar = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ResizableBox, {
size: {
width,
height
},
showHandle: isSelected,
onResizeStop: (event, direction, elt, delta) => {
setAttributes({
height: parseInt(height + delta.height, 10),
width: parseInt(width + delta.width, 10)
});
},
lockAspectRatio: true,
enable: {
top: false,
right: !(0,external_wp_i18n_namespaceObject.isRTL)(),
bottom: true,
left: (0,external_wp_i18n_namespaceObject.isRTL)()
},
minWidth: minSize,
maxWidth: maxSizeBuffer
}, (0,external_React_namespaceObject.createElement)("img", {
src: avatarUrls ? avatarUrls[avatarUrls.length - 1] : avatarURL,
alt: `${authorName} ${(0,external_wp_i18n_namespaceObject.__)('Avatar')}`,
...blockProps
}));
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, inspectorControls, (0,external_React_namespaceObject.createElement)("div", {
...spacingProps
}, resizableAvatar));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-author-avatar/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comment_author_avatar_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: "fse",
name: "core/comment-author-avatar",
title: "Comment Author Avatar (deprecated)",
category: "theme",
ancestor: ["core/comment-template"],
description: "This block is deprecated. Please use the Avatar block instead.",
textdomain: "default",
attributes: {
width: {
type: "number",
"default": 96
},
height: {
type: "number",
"default": 96
}
},
usesContext: ["commentId"],
supports: {
html: false,
inserter: false,
__experimentalBorder: {
radius: true,
width: true,
color: true,
style: true
},
color: {
background: true,
text: false,
__experimentalDefaultControls: {
background: true
}
},
spacing: {
__experimentalSkipSerialization: true,
margin: true,
padding: true
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: comment_author_avatar_name
} = comment_author_avatar_metadata;
const comment_author_avatar_settings = {
icon: comment_author_avatar,
edit: edit_Edit
};
const comment_author_avatar_init = () => initBlock({
name: comment_author_avatar_name,
metadata: comment_author_avatar_metadata,
settings: comment_author_avatar_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment-author-name.js
/**
* WordPress dependencies
*/
const commentAuthorName = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z",
fillRule: "evenodd",
clipRule: "evenodd"
}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M15 15V15C15 13.8954 14.1046 13 13 13L11 13C9.89543 13 9 13.8954 9 15V15",
fillRule: "evenodd",
clipRule: "evenodd"
}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Circle, {
cx: "12",
cy: "9",
r: "2",
fillRule: "evenodd",
clipRule: "evenodd"
}));
/* harmony default export */ const comment_author_name = (commentAuthorName);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-author-name/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Renders the `core/comment-author-name` block on the editor.
*
* @param {Object} props React props.
* @param {Object} props.setAttributes Callback for updating block attributes.
* @param {Object} props.attributes Block attributes.
* @param {string} props.attributes.isLink Whether the author name should be linked.
* @param {string} props.attributes.linkTarget Target of the link.
* @param {string} props.attributes.textAlign Text alignment.
* @param {Object} props.context Inherited context.
* @param {string} props.context.commentId The comment ID.
*
* @return {JSX.Element} React element.
*/
function comment_author_name_edit_Edit({
attributes: {
isLink,
linkTarget,
textAlign
},
context: {
commentId
},
setAttributes
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
let displayName = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEntityRecord
} = select(external_wp_coreData_namespaceObject.store);
const comment = getEntityRecord('root', 'comment', commentId);
const authorName = comment?.author_name; // eslint-disable-line camelcase
if (comment && !authorName) {
var _user$name;
const user = getEntityRecord('root', 'user', comment.author);
return (_user$name = user?.name) !== null && _user$name !== void 0 ? _user$name : (0,external_wp_i18n_namespaceObject.__)('Anonymous');
}
return authorName !== null && authorName !== void 0 ? authorName : '';
}, [commentId]);
const blockControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: newAlign => setAttributes({
textAlign: newAlign
})
}));
const inspectorControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link to authors URL'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
}), isLink && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: linkTarget === '_blank'
})));
if (!commentId || !displayName) {
displayName = (0,external_wp_i18n_namespaceObject._x)('Comment Author', 'block title');
}
const displayAuthor = isLink ? (0,external_React_namespaceObject.createElement)("a", {
href: "#comment-author-pseudo-link",
onClick: event => event.preventDefault()
}, displayName) : displayName;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, inspectorControls, blockControls, (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, displayAuthor));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-author-name/deprecated.js
/**
* Internal dependencies
*/
const deprecated_v1 = {
attributes: {
isLink: {
type: 'boolean',
default: false
},
linkTarget: {
type: 'string',
default: '_self'
}
},
supports: {
html: false,
color: {
gradients: true,
link: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalLetterSpacing: true
}
},
save() {
return null;
},
migrate: migrate_font_family,
isEligible({
style
}) {
return style?.typography?.fontFamily;
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const comment_author_name_deprecated = ([deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-author-name/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comment_author_name_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/comment-author-name",
title: "Comment Author Name",
category: "theme",
ancestor: ["core/comment-template"],
description: "Displays the name of the author of the comment.",
textdomain: "default",
attributes: {
isLink: {
type: "boolean",
"default": true
},
linkTarget: {
type: "string",
"default": "_self"
},
textAlign: {
type: "string"
}
},
usesContext: ["commentId"],
supports: {
html: false,
spacing: {
margin: true,
padding: true
},
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: comment_author_name_name
} = comment_author_name_metadata;
const comment_author_name_settings = {
icon: comment_author_name,
edit: comment_author_name_edit_Edit,
deprecated: comment_author_name_deprecated
};
const comment_author_name_init = () => initBlock({
name: comment_author_name_name,
metadata: comment_author_name_metadata,
settings: comment_author_name_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment-content.js
/**
* WordPress dependencies
*/
const commentContent = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M6.68822 16.625L5.5 17.8145L5.5 5.5L18.5 5.5L18.5 16.625L6.68822 16.625ZM7.31 18.125L19 18.125C19.5523 18.125 20 17.6773 20 17.125L20 5C20 4.44772 19.5523 4 19 4H5C4.44772 4 4 4.44772 4 5V19.5247C4 19.8173 4.16123 20.086 4.41935 20.2237C4.72711 20.3878 5.10601 20.3313 5.35252 20.0845L7.31 18.125ZM16 9.99997H8V8.49997H16V9.99997ZM8 14H13V12.5H8V14Z"
}));
/* harmony default export */ const comment_content = (commentContent);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-content/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Renders the `core/comment-content` block on the editor.
*
* @param {Object} props React props.
* @param {Object} props.setAttributes Callback for updating block attributes.
* @param {Object} props.attributes Block attributes.
* @param {string} props.attributes.textAlign The `textAlign` attribute.
* @param {Object} props.context Inherited context.
* @param {string} props.context.commentId The comment ID.
*
* @return {JSX.Element} React element.
*/
function comment_content_edit_Edit({
setAttributes,
attributes: {
textAlign
},
context: {
commentId
}
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const [content] = (0,external_wp_coreData_namespaceObject.useEntityProp)('root', 'comment', 'content', commentId);
const blockControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: newAlign => setAttributes({
textAlign: newAlign
})
}));
if (!commentId || !content) {
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, blockControls, (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject._x)('Comment Content', 'block title'))));
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, blockControls, (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, null, (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, {
key: "html"
}, content.rendered))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-content/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comment_content_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/comment-content",
title: "Comment Content",
category: "theme",
ancestor: ["core/comment-template"],
description: "Displays the contents of a comment.",
textdomain: "default",
usesContext: ["commentId"],
attributes: {
textAlign: {
type: "string"
}
},
supports: {
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
spacing: {
padding: ["horizontal", "vertical"],
__experimentalDefaultControls: {
padding: true
}
},
html: false
}
};
const {
name: comment_content_name
} = comment_content_metadata;
const comment_content_settings = {
icon: comment_content,
edit: comment_content_edit_Edit
};
const comment_content_init = () => initBlock({
name: comment_content_name,
metadata: comment_content_metadata,
settings: comment_content_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-date.js
/**
* WordPress dependencies
*/
const postDate = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M11.696 13.972c.356-.546.599-.958.728-1.235a1.79 1.79 0 00.203-.783c0-.264-.077-.47-.23-.618-.148-.153-.354-.23-.618-.23-.295 0-.569.07-.82.212a3.413 3.413 0 00-.738.571l-.147-1.188c.289-.234.59-.41.903-.526.313-.117.66-.175 1.041-.175.375 0 .695.08.959.24.264.153.46.362.59.626.135.265.203.556.203.876 0 .362-.08.734-.24 1.115-.154.381-.427.87-.82 1.466l-.756 1.152H14v1.106h-4l1.696-2.609z"
}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M19.5 7h-15v12a.5.5 0 00.5.5h14a.5.5 0 00.5-.5V7zM3 7V5a2 2 0 012-2h14a2 2 0 012 2v14a2 2 0 01-2 2H5a2 2 0 01-2-2V7z"
}));
/* harmony default export */ const post_date = (postDate);
;// CONCATENATED MODULE: external ["wp","date"]
const external_wp_date_namespaceObject = window["wp"]["date"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-date/edit.js
/**
* WordPress dependencies
*/
/**
* Renders the `core/comment-date` block on the editor.
*
* @param {Object} props React props.
* @param {Object} props.setAttributes Callback for updating block attributes.
* @param {Object} props.attributes Block attributes.
* @param {string} props.attributes.format Format of the date.
* @param {string} props.attributes.isLink Whether the author name should be linked.
* @param {Object} props.context Inherited context.
* @param {string} props.context.commentId The comment ID.
*
* @return {JSX.Element} React element.
*/
function comment_date_edit_Edit({
attributes: {
format,
isLink
},
context: {
commentId
},
setAttributes
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
let [date] = (0,external_wp_coreData_namespaceObject.useEntityProp)('root', 'comment', 'date', commentId);
const [siteFormat = (0,external_wp_date_namespaceObject.getSettings)().formats.date] = (0,external_wp_coreData_namespaceObject.useEntityProp)('root', 'site', 'date_format');
const inspectorControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalDateFormatPicker, {
format: format,
defaultFormat: siteFormat,
onChange: nextFormat => setAttributes({
format: nextFormat
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link to comment'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
})));
if (!commentId || !date) {
date = (0,external_wp_i18n_namespaceObject._x)('Comment Date', 'block title');
}
let commentDate = date instanceof Date ? (0,external_React_namespaceObject.createElement)("time", {
dateTime: (0,external_wp_date_namespaceObject.dateI18n)('c', date)
}, (0,external_wp_date_namespaceObject.dateI18n)(format || siteFormat, date)) : (0,external_React_namespaceObject.createElement)("time", null, date);
if (isLink) {
commentDate = (0,external_React_namespaceObject.createElement)("a", {
href: "#comment-date-pseudo-link",
onClick: event => event.preventDefault()
}, commentDate);
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, inspectorControls, (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, commentDate));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-date/deprecated.js
/**
* Internal dependencies
*/
const comment_date_deprecated_v1 = {
attributes: {
format: {
type: 'string'
},
isLink: {
type: 'boolean',
default: false
}
},
supports: {
html: false,
color: {
gradients: true,
link: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalLetterSpacing: true
}
},
save() {
return null;
},
migrate: migrate_font_family,
isEligible({
style
}) {
return style?.typography?.fontFamily;
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const comment_date_deprecated = ([comment_date_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-date/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comment_date_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/comment-date",
title: "Comment Date",
category: "theme",
ancestor: ["core/comment-template"],
description: "Displays the date on which the comment was posted.",
textdomain: "default",
attributes: {
format: {
type: "string"
},
isLink: {
type: "boolean",
"default": true
}
},
usesContext: ["commentId"],
supports: {
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: comment_date_name
} = comment_date_metadata;
const comment_date_settings = {
icon: post_date,
edit: comment_date_edit_Edit,
deprecated: comment_date_deprecated
};
const comment_date_init = () => initBlock({
name: comment_date_name,
metadata: comment_date_metadata,
settings: comment_date_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment-edit-link.js
/**
* WordPress dependencies
*/
const commentEditLink = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m6.249 11.065.44-.44h3.186l-1.5 1.5H7.31l-1.957 1.96A.792.792 0 0 1 4 13.524V5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v1.5L12.5 8V5.5h-7v6.315l.749-.75ZM20 19.75H7v-1.5h13v1.5Zm0-12.653-8.967 9.064L8 17l.867-2.935L17.833 5 20 7.097Z"
}));
/* harmony default export */ const comment_edit_link = (commentEditLink);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-edit-link/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function comment_edit_link_edit_Edit({
attributes: {
linkTarget,
textAlign
},
setAttributes
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const blockControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: newAlign => setAttributes({
textAlign: newAlign
})
}));
const inspectorControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: linkTarget === '_blank'
})));
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, blockControls, inspectorControls, (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("a", {
href: "#edit-comment-pseudo-link",
onClick: event => event.preventDefault()
}, (0,external_wp_i18n_namespaceObject.__)('Edit'))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-edit-link/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comment_edit_link_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/comment-edit-link",
title: "Comment Edit Link",
category: "theme",
ancestor: ["core/comment-template"],
description: "Displays a link to edit the comment in the WordPress Dashboard. This link is only visible to users with the edit comment capability.",
textdomain: "default",
usesContext: ["commentId"],
attributes: {
linkTarget: {
type: "string",
"default": "_self"
},
textAlign: {
type: "string"
}
},
supports: {
html: false,
color: {
link: true,
gradients: true,
text: false,
__experimentalDefaultControls: {
background: true,
link: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: comment_edit_link_name
} = comment_edit_link_metadata;
const comment_edit_link_settings = {
icon: comment_edit_link,
edit: comment_edit_link_edit_Edit
};
const comment_edit_link_init = () => initBlock({
name: comment_edit_link_name,
metadata: comment_edit_link_metadata,
settings: comment_edit_link_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment-reply-link.js
/**
* WordPress dependencies
*/
const commentReplyLink = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M6.68822 10.625L6.24878 11.0649L5.5 11.8145L5.5 5.5L12.5 5.5V8L14 6.5V5C14 4.44772 13.5523 4 13 4H5C4.44772 4 4 4.44771 4 5V13.5247C4 13.8173 4.16123 14.086 4.41935 14.2237C4.72711 14.3878 5.10601 14.3313 5.35252 14.0845L7.31 12.125H8.375L9.875 10.625H7.31H6.68822ZM14.5605 10.4983L11.6701 13.75H16.9975C17.9963 13.75 18.7796 14.1104 19.3553 14.7048C19.9095 15.2771 20.2299 16.0224 20.4224 16.7443C20.7645 18.0276 20.7543 19.4618 20.7487 20.2544C20.7481 20.345 20.7475 20.4272 20.7475 20.4999L19.2475 20.5001C19.2475 20.4191 19.248 20.3319 19.2484 20.2394V20.2394C19.2526 19.4274 19.259 18.2035 18.973 17.1307C18.8156 16.5401 18.586 16.0666 18.2778 15.7483C17.9909 15.4521 17.5991 15.25 16.9975 15.25H11.8106L14.5303 17.9697L13.4696 19.0303L8.96956 14.5303L13.4394 9.50171L14.5605 10.4983Z"
}));
/* harmony default export */ const comment_reply_link = (commentReplyLink);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-reply-link/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Renders the `core/comment-reply-link` block on the editor.
*
* @param {Object} props React props.
* @param {Object} props.setAttributes Callback for updating block attributes.
* @param {Object} props.attributes Block attributes.
* @param {string} props.attributes.textAlign The `textAlign` attribute.
*
* @return {JSX.Element} React element.
*/
function comment_reply_link_edit_Edit({
setAttributes,
attributes: {
textAlign
}
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const blockControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: newAlign => setAttributes({
textAlign: newAlign
})
}));
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, blockControls, (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("a", {
href: "#comment-reply-pseudo-link",
onClick: event => event.preventDefault()
}, (0,external_wp_i18n_namespaceObject.__)('Reply'))));
}
/* harmony default export */ const comment_reply_link_edit = (comment_reply_link_edit_Edit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-reply-link/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comment_reply_link_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/comment-reply-link",
title: "Comment Reply Link",
category: "theme",
ancestor: ["core/comment-template"],
description: "Displays a link to reply to a comment.",
textdomain: "default",
usesContext: ["commentId"],
attributes: {
textAlign: {
type: "string"
}
},
supports: {
color: {
gradients: true,
link: true,
text: false,
__experimentalDefaultControls: {
background: true,
link: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
html: false
}
};
const {
name: comment_reply_link_name
} = comment_reply_link_metadata;
const comment_reply_link_settings = {
edit: comment_reply_link_edit,
icon: comment_reply_link
};
const comment_reply_link_init = () => initBlock({
name: comment_reply_link_name,
metadata: comment_reply_link_metadata,
settings: comment_reply_link_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
/**
* WordPress dependencies
*/
const layout = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_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 */ const library_layout = (layout);
;// CONCATENATED MODULE: external ["wp","apiFetch"]
const 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/block-library/build-module/comment-template/hooks.js
/**
* WordPress dependencies
*/
// This is limited by WP REST API
const MAX_COMMENTS_PER_PAGE = 100;
/**
* Return an object with the query args needed to fetch the default page of
* comments.
*
* @param {Object} props Hook props.
* @param {number} props.postId ID of the post that contains the comments.
* discussion settings.
*
* @return {Object} Query args to retrieve the comments.
*/
const useCommentQueryArgs = ({
postId
}) => {
// Initialize the query args that are not going to change.
const queryArgs = {
status: 'approve',
order: 'asc',
context: 'embed',
parent: 0,
_embed: 'children'
};
// Get the Discussion settings that may be needed to query the comments.
const {
pageComments,
commentsPerPage,
defaultCommentsPage: defaultPage
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
const {
__experimentalDiscussionSettings
} = getSettings();
return __experimentalDiscussionSettings;
});
// WP REST API doesn't allow fetching more than max items limit set per single page of data.
// As for the editor performance is more important than completeness of data and fetching only the
// max allowed for single page should be enough for the purpose of design and laying out the page.
// Fetching over the limit would return an error here but would work with backend query.
const perPage = pageComments ? Math.min(commentsPerPage, MAX_COMMENTS_PER_PAGE) : MAX_COMMENTS_PER_PAGE;
// Get the number of the default page.
const page = useDefaultPageIndex({
defaultPage,
postId,
perPage,
queryArgs
});
// Merge, memoize and return all query arguments, unless the default page's
// number is not known yet.
return (0,external_wp_element_namespaceObject.useMemo)(() => {
return page ? {
...queryArgs,
post: postId,
per_page: perPage,
page
} : null;
}, [postId, perPage, page]);
};
/**
* Return the index of the default page, depending on whether `defaultPage` is
* `newest` or `oldest`. In the first case, the only way to know the page's
* index is by using the `X-WP-TotalPages` header, which forces to make an
* additional request.
*
* @param {Object} props Hook props.
* @param {string} props.defaultPage Page shown by default (newest/oldest).
* @param {number} props.postId ID of the post that contains the comments.
* @param {number} props.perPage The number of comments included per page.
* @param {Object} props.queryArgs Other query args.
*
* @return {number} Index of the default comments page.
*/
const useDefaultPageIndex = ({
defaultPage,
postId,
perPage,
queryArgs
}) => {
// Store the default page indices.
const [defaultPages, setDefaultPages] = (0,external_wp_element_namespaceObject.useState)({});
const key = `${postId}_${perPage}`;
const page = defaultPages[key] || 0;
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Do nothing if the page is already known or not the newest page.
if (page || defaultPage !== 'newest') {
return;
}
// We need to fetch comments to know the index. Use HEAD and limit
// fields just to ID, to make this call as light as possible.
external_wp_apiFetch_default()({
path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/comments', {
...queryArgs,
post: postId,
per_page: perPage,
_fields: 'id'
}),
method: 'HEAD',
parse: false
}).then(res => {
const pages = parseInt(res.headers.get('X-WP-TotalPages'));
setDefaultPages({
...defaultPages,
[key]: pages <= 1 ? 1 : pages // If there are 0 pages, it means that there are no comments, but there is no 0th page.
});
});
}, [defaultPage, postId, perPage, setDefaultPages]);
// The oldest one is always the first one.
return defaultPage === 'newest' ? page : 1;
};
/**
* Generate a tree structure of comment IDs from a list of comment entities. The
* children of each comment are obtained from `_embedded`.
*
* @typedef {{ commentId: number, children: CommentNode }} CommentNode
*
* @param {Object[]} topLevelComments List of comment entities.
* @return {{ commentTree: CommentNode[]}} Tree of comment IDs.
*/
const useCommentTree = topLevelComments => {
const commentTree = (0,external_wp_element_namespaceObject.useMemo)(() => topLevelComments?.map(({
id,
_embedded
}) => {
const [children] = _embedded?.children || [[]];
return {
commentId: id,
children: children.map(child => ({
commentId: child.id
}))
};
}), [topLevelComments]);
return commentTree;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-template/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const edit_TEMPLATE = [['core/avatar'], ['core/comment-author-name'], ['core/comment-date'], ['core/comment-content'], ['core/comment-reply-link'], ['core/comment-edit-link']];
/**
* Function that returns a comment structure that will be rendered with default placehoders.
*
* Each comment has a `commentId` property that is always a negative number in
* case of the placeholders. This is to ensure that the comment does not
* conflict with the actual (real) comments.
*
* @param {Object} settings Discussion Settings.
* @param {number} [settings.perPage] - Comments per page setting or block attribute.
* @param {boolean} [settings.pageComments] - Enable break comments into pages setting.
* @param {boolean} [settings.threadComments] - Enable threaded (nested) comments setting.
* @param {number} [settings.threadCommentsDepth] - Level deep of threaded comments.
*
* @typedef {{id: null, children: EmptyComment[]}} EmptyComment
* @return {EmptyComment[]} Inner blocks of the Comment Template
*/
const getCommentsPlaceholder = ({
perPage,
pageComments,
threadComments,
threadCommentsDepth
}) => {
// Limit commentsDepth to 3
const commentsDepth = !threadComments ? 1 : Math.min(threadCommentsDepth, 3);
const buildChildrenComment = commentsLevel => {
// Render children comments until commentsDepth is reached
if (commentsLevel < commentsDepth) {
const nextLevel = commentsLevel + 1;
return [{
commentId: -(commentsLevel + 3),
children: buildChildrenComment(nextLevel)
}];
}
return [];
};
// Add the first comment and its children
const placeholderComments = [{
commentId: -1,
children: buildChildrenComment(1)
}];
// Add a second comment unless the break comments setting is active and set to less than 2, and there is one nested comment max
if ((!pageComments || perPage >= 2) && commentsDepth < 3) {
placeholderComments.push({
commentId: -2,
children: []
});
}
// Add a third comment unless the break comments setting is active and set to less than 3, and there aren't nested comments
if ((!pageComments || perPage >= 3) && commentsDepth < 2) {
placeholderComments.push({
commentId: -3,
children: []
});
}
// In case that the value is set but larger than 3 we truncate it to 3.
return placeholderComments;
};
/**
* Component which renders the inner blocks of the Comment Template.
*
* @param {Object} props Component props.
* @param {Array} [props.comment] - A comment object.
* @param {Array} [props.activeCommentId] - The ID of the comment that is currently active.
* @param {Array} [props.setActiveCommentId] - The setter for activeCommentId.
* @param {Array} [props.firstCommentId] - ID of the first comment in the array.
* @param {Array} [props.blocks] - Array of blocks returned from
* getBlocks() in parent .
* @return {Element} Inner blocks of the Comment Template
*/
function CommentTemplateInnerBlocks({
comment,
activeCommentId,
setActiveCommentId,
firstCommentId,
blocks
}) {
const {
children,
...innerBlocksProps
} = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({}, {
template: edit_TEMPLATE
});
return (0,external_React_namespaceObject.createElement)("li", {
...innerBlocksProps
}, comment.commentId === (activeCommentId || firstCommentId) ? children : null, (0,external_React_namespaceObject.createElement)(MemoizedCommentTemplatePreview, {
blocks: blocks,
commentId: comment.commentId,
setActiveCommentId: setActiveCommentId,
isHidden: comment.commentId === (activeCommentId || firstCommentId)
}), comment?.children?.length > 0 ? (0,external_React_namespaceObject.createElement)(CommentsList, {
comments: comment.children,
activeCommentId: activeCommentId,
setActiveCommentId: setActiveCommentId,
blocks: blocks,
firstCommentId: firstCommentId
}) : null);
}
const CommentTemplatePreview = ({
blocks,
commentId,
setActiveCommentId,
isHidden
}) => {
const blockPreviewProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBlockPreview)({
blocks
});
const handleOnClick = () => {
setActiveCommentId(commentId);
};
// We have to hide the preview block if the `comment` props points to
// the curently active block!
// Or, to put it differently, every preview block is visible unless it is the
// currently active block - in this case we render its inner blocks.
const style = {
display: isHidden ? 'none' : undefined
};
return (0,external_React_namespaceObject.createElement)("div", {
...blockPreviewProps,
tabIndex: 0,
role: "button",
style: style
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
,
onClick: handleOnClick,
onKeyPress: handleOnClick
});
};
const MemoizedCommentTemplatePreview = (0,external_wp_element_namespaceObject.memo)(CommentTemplatePreview);
/**
* Component that renders a list of (nested) comments. It is called recursively.
*
* @param {Object} props Component props.
* @param {Array} [props.comments] - Array of comment objects.
* @param {Array} [props.blockProps] - Props from parent's `useBlockProps()`.
* @param {Array} [props.activeCommentId] - The ID of the comment that is currently active.
* @param {Array} [props.setActiveCommentId] - The setter for activeCommentId.
* @param {Array} [props.blocks] - Array of blocks returned from getBlocks() in parent.
* @param {Object} [props.firstCommentId] - The ID of the first comment in the array of
* comment objects.
* @return {Element} List of comments.
*/
const CommentsList = ({
comments,
blockProps,
activeCommentId,
setActiveCommentId,
blocks,
firstCommentId
}) => (0,external_React_namespaceObject.createElement)("ol", {
...blockProps
}, comments && comments.map(({
commentId,
...comment
}, index) => (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, {
key: comment.commentId || index,
value: {
// If the commentId is negative it means that this comment is a
// "placeholder" and that the block is most likely being used in the
// site editor. In this case, we have to set the commentId to `null`
// because otherwise the (non-existent) comment with a negative ID
// would be reqested from the REST API.
commentId: commentId < 0 ? null : commentId
}
}, (0,external_React_namespaceObject.createElement)(CommentTemplateInnerBlocks, {
comment: {
commentId,
...comment
},
activeCommentId: activeCommentId,
setActiveCommentId: setActiveCommentId,
blocks: blocks,
firstCommentId: firstCommentId
}))));
function CommentTemplateEdit({
clientId,
context: {
postId
}
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const [activeCommentId, setActiveCommentId] = (0,external_wp_element_namespaceObject.useState)();
const {
commentOrder,
threadCommentsDepth,
threadComments,
commentsPerPage,
pageComments
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
return getSettings().__experimentalDiscussionSettings;
});
const commentQuery = useCommentQueryArgs({
postId
});
const {
topLevelComments,
blocks
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEntityRecords
} = select(external_wp_coreData_namespaceObject.store);
const {
getBlocks
} = select(external_wp_blockEditor_namespaceObject.store);
return {
// Request only top-level comments. Replies are embedded.
topLevelComments: commentQuery ? getEntityRecords('root', 'comment', commentQuery) : null,
blocks: getBlocks(clientId)
};
}, [clientId, commentQuery]);
// Generate a tree structure of comment IDs.
let commentTree = useCommentTree(
// Reverse the order of top comments if needed.
commentOrder === 'desc' && topLevelComments ? [...topLevelComments].reverse() : topLevelComments);
if (!topLevelComments) {
return (0,external_React_namespaceObject.createElement)("p", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null));
}
if (!postId) {
commentTree = getCommentsPlaceholder({
perPage: commentsPerPage,
pageComments,
threadComments,
threadCommentsDepth
});
}
if (!commentTree.length) {
return (0,external_React_namespaceObject.createElement)("p", {
...blockProps
}, (0,external_wp_i18n_namespaceObject.__)('No results found.'));
}
return (0,external_React_namespaceObject.createElement)(CommentsList, {
comments: commentTree,
blockProps: blockProps,
blocks: blocks,
activeCommentId: activeCommentId,
setActiveCommentId: setActiveCommentId,
firstCommentId: commentTree[0]?.commentId
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-template/save.js
/**
* WordPress dependencies
*/
function CommentTemplateSave() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comment-template/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comment_template_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/comment-template",
title: "Comment Template",
category: "design",
parent: ["core/comments"],
description: "Contains the block elements used to display a comment, like the title, date, author, avatar and more.",
textdomain: "default",
usesContext: ["postId"],
supports: {
align: true,
html: false,
reusable: false,
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-comment-template"
};
const {
name: comment_template_name
} = comment_template_metadata;
const comment_template_settings = {
icon: library_layout,
edit: CommentTemplateEdit,
save: CommentTemplateSave
};
const comment_template_init = () => initBlock({
name: comment_template_name,
metadata: comment_template_metadata,
settings: comment_template_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/query-pagination-previous.js
/**
* WordPress dependencies
*/
const queryPaginationPrevious = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M16 10.5v3h3v-3h-3zm-5 3h3v-3h-3v3zM7 9l-3 3 3 3 1-1-2-2 2-2-1-1z"
}));
/* harmony default export */ const query_pagination_previous = (queryPaginationPrevious);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments-pagination-previous/edit.js
/**
* WordPress dependencies
*/
const arrowMap = {
none: '',
arrow: '←',
chevron: '«'
};
function CommentsPaginationPreviousEdit({
attributes: {
label
},
setAttributes,
context: {
'comments/paginationArrow': paginationArrow
}
}) {
const displayArrow = arrowMap[paginationArrow];
return (0,external_React_namespaceObject.createElement)("a", {
href: "#comments-pagination-previous-pseudo-link",
onClick: event => event.preventDefault(),
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)()
}, displayArrow && (0,external_React_namespaceObject.createElement)("span", {
className: `wp-block-comments-pagination-previous-arrow is-arrow-${paginationArrow}`
}, displayArrow), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.PlainText, {
__experimentalVersion: 2,
tagName: "span",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Older comments page link'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Older Comments'),
value: label,
onChange: newLabel => setAttributes({
label: newLabel
})
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments-pagination-previous/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comments_pagination_previous_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/comments-pagination-previous",
title: "Comments Previous Page",
category: "theme",
parent: ["core/comments-pagination"],
description: "Displays the previous comment's page link.",
textdomain: "default",
attributes: {
label: {
type: "string"
}
},
usesContext: ["postId", "comments/paginationArrow"],
supports: {
reusable: false,
html: false,
color: {
gradients: true,
text: false,
__experimentalDefaultControls: {
background: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: comments_pagination_previous_name
} = comments_pagination_previous_metadata;
const comments_pagination_previous_settings = {
icon: query_pagination_previous,
edit: CommentsPaginationPreviousEdit
};
const comments_pagination_previous_init = () => initBlock({
name: comments_pagination_previous_name,
metadata: comments_pagination_previous_metadata,
settings: comments_pagination_previous_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/query-pagination.js
/**
* WordPress dependencies
*/
const queryPagination = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 13.5h6v-3H4v3zm8 0h3v-3h-3v3zm5-3v3h3v-3h-3z"
}));
/* harmony default export */ const query_pagination = (queryPagination);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments-pagination/comments-pagination-arrow-controls.js
/**
* WordPress dependencies
*/
function CommentsPaginationArrowControls({
value,
onChange
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Arrow'),
value: value,
onChange: onChange,
help: (0,external_wp_i18n_namespaceObject.__)('A decorative arrow appended to the next and previous comments link.'),
isBlock: true
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "none",
label: (0,external_wp_i18n_namespaceObject._x)('None', 'Arrow option for Comments Pagination Next/Previous blocks')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "arrow",
label: (0,external_wp_i18n_namespaceObject._x)('Arrow', 'Arrow option for Comments Pagination Next/Previous blocks')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "chevron",
label: (0,external_wp_i18n_namespaceObject._x)('Chevron', 'Arrow option for Comments Pagination Next/Previous blocks')
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments-pagination/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comments_pagination_edit_TEMPLATE = [['core/comments-pagination-previous'], ['core/comments-pagination-numbers'], ['core/comments-pagination-next']];
function QueryPaginationEdit({
attributes: {
paginationArrow
},
setAttributes,
clientId
}) {
const hasNextPreviousBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlocks
} = select(external_wp_blockEditor_namespaceObject.store);
const innerBlocks = getBlocks(clientId);
/**
* Show the `paginationArrow` control only if a
* Comments Pagination Next or Comments Pagination Previous
* block exists.
*/
return innerBlocks?.find(innerBlock => {
return ['core/comments-pagination-previous', 'core/comments-pagination-next'].includes(innerBlock.name);
});
}, []);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: comments_pagination_edit_TEMPLATE
});
// Get the Discussion settings
const pageComments = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
const {
__experimentalDiscussionSettings
} = getSettings();
return __experimentalDiscussionSettings?.pageComments;
}, []);
// If paging comments is not enabled in the Discussion Settings then hide the pagination
// controls. We don't want to remove them from the template so that when the user enables
// paging comments, the controls will be visible.
if (!pageComments) {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Comments Pagination block: paging comments is disabled in the Discussion Settings'));
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, hasNextPreviousBlocks && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(CommentsPaginationArrowControls, {
value: paginationArrow,
onChange: value => {
setAttributes({
paginationArrow: value
});
}
}))), (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments-pagination/save.js
/**
* WordPress dependencies
*/
function comments_pagination_save_save() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments-pagination/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comments_pagination_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/comments-pagination",
title: "Comments Pagination",
category: "theme",
parent: ["core/comments"],
allowedBlocks: ["core/comments-pagination-previous", "core/comments-pagination-numbers", "core/comments-pagination-next"],
description: "Displays a paginated navigation to next/previous set of comments, when applicable.",
textdomain: "default",
attributes: {
paginationArrow: {
type: "string",
"default": "none"
}
},
providesContext: {
"comments/paginationArrow": "paginationArrow"
},
supports: {
align: true,
reusable: false,
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
layout: {
allowSwitching: false,
allowInheriting: false,
"default": {
type: "flex"
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-comments-pagination-editor",
style: "wp-block-comments-pagination"
};
const {
name: comments_pagination_name
} = comments_pagination_metadata;
const comments_pagination_settings = {
icon: query_pagination,
edit: QueryPaginationEdit,
save: comments_pagination_save_save
};
const comments_pagination_init = () => initBlock({
name: comments_pagination_name,
metadata: comments_pagination_metadata,
settings: comments_pagination_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/query-pagination-next.js
/**
* WordPress dependencies
*/
const queryPaginationNext = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M5 13.5h3v-3H5v3zm5 0h3v-3h-3v3zM17 9l-1 1 2 2-2 2 1 1 3-3-3-3z"
}));
/* harmony default export */ const query_pagination_next = (queryPaginationNext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments-pagination-next/edit.js
/**
* WordPress dependencies
*/
const edit_arrowMap = {
none: '',
arrow: '→',
chevron: '»'
};
function CommentsPaginationNextEdit({
attributes: {
label
},
setAttributes,
context: {
'comments/paginationArrow': paginationArrow
}
}) {
const displayArrow = edit_arrowMap[paginationArrow];
return (0,external_React_namespaceObject.createElement)("a", {
href: "#comments-pagination-next-pseudo-link",
onClick: event => event.preventDefault(),
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)()
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.PlainText, {
__experimentalVersion: 2,
tagName: "span",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Newer comments page link'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Newer Comments'),
value: label,
onChange: newLabel => setAttributes({
label: newLabel
})
}), displayArrow && (0,external_React_namespaceObject.createElement)("span", {
className: `wp-block-comments-pagination-next-arrow is-arrow-${paginationArrow}`
}, displayArrow));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments-pagination-next/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comments_pagination_next_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/comments-pagination-next",
title: "Comments Next Page",
category: "theme",
parent: ["core/comments-pagination"],
description: "Displays the next comment's page link.",
textdomain: "default",
attributes: {
label: {
type: "string"
}
},
usesContext: ["postId", "comments/paginationArrow"],
supports: {
reusable: false,
html: false,
color: {
gradients: true,
text: false,
__experimentalDefaultControls: {
background: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: comments_pagination_next_name
} = comments_pagination_next_metadata;
const comments_pagination_next_settings = {
icon: query_pagination_next,
edit: CommentsPaginationNextEdit
};
const comments_pagination_next_init = () => initBlock({
name: comments_pagination_next_name,
metadata: comments_pagination_next_metadata,
settings: comments_pagination_next_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/query-pagination-numbers.js
/**
* WordPress dependencies
*/
const queryPaginationNumbers = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 13.5h6v-3H4v3zm8.2-2.5.8-.3V14h1V9.3l-2.2.7.4 1zm7.1-1.2c-.5-.6-1.2-.5-1.7-.4-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5h2.7v-1h-.9c.3-.6.8-1.4.9-2.1 0-.3-.1-.8-.3-1.1z"
}));
/* harmony default export */ const query_pagination_numbers = (queryPaginationNumbers);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments-pagination-numbers/edit.js
/**
* WordPress dependencies
*/
const PaginationItem = ({
content,
tag: Tag = 'a',
extraClass = ''
}) => Tag === 'a' ? (0,external_React_namespaceObject.createElement)(Tag, {
className: `page-numbers ${extraClass}`,
href: "#comments-pagination-numbers-pseudo-link",
onClick: event => event.preventDefault()
}, content) : (0,external_React_namespaceObject.createElement)(Tag, {
className: `page-numbers ${extraClass}`
}, content);
function CommentsPaginationNumbersEdit() {
return (0,external_React_namespaceObject.createElement)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)()
}, (0,external_React_namespaceObject.createElement)(PaginationItem, {
content: "1"
}), (0,external_React_namespaceObject.createElement)(PaginationItem, {
content: "2"
}), (0,external_React_namespaceObject.createElement)(PaginationItem, {
content: "3",
tag: "span",
extraClass: "current"
}), (0,external_React_namespaceObject.createElement)(PaginationItem, {
content: "4"
}), (0,external_React_namespaceObject.createElement)(PaginationItem, {
content: "5"
}), (0,external_React_namespaceObject.createElement)(PaginationItem, {
content: "...",
tag: "span",
extraClass: "dots"
}), (0,external_React_namespaceObject.createElement)(PaginationItem, {
content: "8"
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments-pagination-numbers/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comments_pagination_numbers_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/comments-pagination-numbers",
title: "Comments Page Numbers",
category: "theme",
parent: ["core/comments-pagination"],
description: "Displays a list of page numbers for comments pagination.",
textdomain: "default",
usesContext: ["postId"],
supports: {
reusable: false,
html: false,
color: {
gradients: true,
text: false,
__experimentalDefaultControls: {
background: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: comments_pagination_numbers_name
} = comments_pagination_numbers_metadata;
const comments_pagination_numbers_settings = {
icon: query_pagination_numbers,
edit: CommentsPaginationNumbersEdit
};
const comments_pagination_numbers_init = () => initBlock({
name: comments_pagination_numbers_name,
metadata: comments_pagination_numbers_metadata,
settings: comments_pagination_numbers_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/title.js
/**
* WordPress dependencies
*/
const title = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m4 5.5h2v6.5h1.5v-6.5h2v-1.5h-5.5zm16 10.5h-16v-1.5h16zm-7 4h-9v-1.5h9z"
}));
/* harmony default export */ const library_title = (title);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments-title/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function comments_title_edit_Edit({
attributes: {
textAlign,
showPostTitle,
showCommentsCount,
level
},
setAttributes,
context: {
postType,
postId
}
}) {
const TagName = 'h' + level;
const [commentsCount, setCommentsCount] = (0,external_wp_element_namespaceObject.useState)();
const [rawTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'title', postId);
const isSiteEditor = typeof postId === 'undefined';
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const {
threadCommentsDepth,
threadComments,
commentsPerPage,
pageComments
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
return getSettings().__experimentalDiscussionSettings;
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (isSiteEditor) {
// Match the number of comments that will be shown in the comment-template/edit.js placeholder
const nestedCommentsNumber = threadComments ? Math.min(threadCommentsDepth, 3) - 1 : 0;
const topLevelCommentsNumber = pageComments ? commentsPerPage : 3;
const commentsNumber = parseInt(nestedCommentsNumber) + parseInt(topLevelCommentsNumber);
setCommentsCount(Math.min(commentsNumber, 3));
return;
}
const currentPostId = postId;
external_wp_apiFetch_default()({
path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/comments', {
post: postId,
_fields: 'id'
}),
method: 'HEAD',
parse: false
}).then(res => {
// Stale requests will have the `currentPostId` of an older closure.
if (currentPostId === postId) {
setCommentsCount(parseInt(res.headers.get('X-WP-Total')));
}
}).catch(() => {
setCommentsCount(0);
});
}, [postId]);
const blockControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: newAlign => setAttributes({
textAlign: newAlign
})
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.HeadingLevelDropdown, {
value: level,
onChange: newLevel => setAttributes({
level: newLevel
})
}));
const inspectorControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show post title'),
checked: showPostTitle,
onChange: value => setAttributes({
showPostTitle: value
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show comments count'),
checked: showCommentsCount,
onChange: value => setAttributes({
showCommentsCount: value
})
})));
const postTitle = isSiteEditor ? (0,external_wp_i18n_namespaceObject.__)('“Post Title”') : `"${rawTitle}"`;
let placeholder;
if (showCommentsCount && commentsCount !== undefined) {
if (showPostTitle) {
if (commentsCount === 1) {
/* translators: %s: Post title. */
placeholder = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('One response to %s'), postTitle);
} else {
placeholder = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Number of comments, 2: Post title. */
(0,external_wp_i18n_namespaceObject._n)('%1$s response to %2$s', '%1$s responses to %2$s', commentsCount), commentsCount, postTitle);
}
} else if (commentsCount === 1) {
placeholder = (0,external_wp_i18n_namespaceObject.__)('One response');
} else {
placeholder = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Number of comments. */
(0,external_wp_i18n_namespaceObject._n)('%s response', '%s responses', commentsCount), commentsCount);
}
} else if (showPostTitle) {
if (commentsCount === 1) {
/* translators: %s: Post title. */
placeholder = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Response to %s'), postTitle);
} else {
/* translators: %s: Post title. */
placeholder = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Responses to %s'), postTitle);
}
} else if (commentsCount === 1) {
placeholder = (0,external_wp_i18n_namespaceObject.__)('Response');
} else {
placeholder = (0,external_wp_i18n_namespaceObject.__)('Responses');
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, blockControls, inspectorControls, (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, placeholder));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments-title/deprecated.js
/**
* Internal dependencies
*/
const deprecated_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/comments-title",
title: "Comments Title",
category: "theme",
ancestor: ["core/comments"],
description: "Displays a title with the number of comments.",
textdomain: "default",
usesContext: ["postId", "postType"],
attributes: {
textAlign: {
type: "string"
},
showPostTitle: {
type: "boolean",
"default": true
},
showCommentsCount: {
type: "boolean",
"default": true
},
level: {
type: "number",
"default": 2
}
},
supports: {
anchor: false,
align: true,
html: false,
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true
},
color: {
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true,
__experimentalFontFamily: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
attributes,
supports
} = deprecated_metadata;
/* harmony default export */ const comments_title_deprecated = ([{
attributes: {
...attributes,
singleCommentLabel: {
type: 'string'
},
multipleCommentsLabel: {
type: 'string'
}
},
supports,
migrate: oldAttributes => {
const {
singleCommentLabel,
multipleCommentsLabel,
...newAttributes
} = oldAttributes;
return newAttributes;
},
isEligible: ({
multipleCommentsLabel,
singleCommentLabel
}) => multipleCommentsLabel || singleCommentLabel,
save: () => null
}]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/comments-title/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const comments_title_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/comments-title",
title: "Comments Title",
category: "theme",
ancestor: ["core/comments"],
description: "Displays a title with the number of comments.",
textdomain: "default",
usesContext: ["postId", "postType"],
attributes: {
textAlign: {
type: "string"
},
showPostTitle: {
type: "boolean",
"default": true
},
showCommentsCount: {
type: "boolean",
"default": true
},
level: {
type: "number",
"default": 2
}
},
supports: {
anchor: false,
align: true,
html: false,
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true
},
color: {
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true,
__experimentalFontFamily: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: comments_title_name
} = comments_title_metadata;
const comments_title_settings = {
icon: library_title,
edit: comments_title_edit_Edit,
deprecated: comments_title_deprecated
};
const comments_title_init = () => initBlock({
name: comments_title_name,
metadata: comments_title_metadata,
settings: comments_title_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cover.js
/**
* WordPress dependencies
*/
const cover = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_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-.8h6.2v8.9l2.5-3.1 2.5 3.1V4.5h2.2c.4 0 .8.4.8.8v13.4z"
}));
/* harmony default export */ const library_cover = (cover);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/shared.js
/**
* WordPress dependencies
*/
const POSITION_CLASSNAMES = {
'top left': 'is-position-top-left',
'top center': 'is-position-top-center',
'top right': 'is-position-top-right',
'center left': 'is-position-center-left',
'center center': 'is-position-center-center',
center: 'is-position-center-center',
'center right': 'is-position-center-right',
'bottom left': 'is-position-bottom-left',
'bottom center': 'is-position-bottom-center',
'bottom right': 'is-position-bottom-right'
};
const IMAGE_BACKGROUND_TYPE = 'image';
const VIDEO_BACKGROUND_TYPE = 'video';
const COVER_MIN_HEIGHT = 50;
const COVER_MAX_HEIGHT = 1000;
const COVER_DEFAULT_HEIGHT = 300;
const DEFAULT_FOCAL_POINT = {
x: 0.5,
y: 0.5
};
const shared_ALLOWED_MEDIA_TYPES = ['image', 'video'];
function mediaPosition({
x,
y
} = DEFAULT_FOCAL_POINT) {
return `${Math.round(x * 100)}% ${Math.round(y * 100)}%`;
}
function dimRatioToClass(ratio) {
return ratio === 50 || ratio === undefined ? null : 'has-background-dim-' + 10 * Math.round(ratio / 10);
}
function attributesFromMedia(media) {
if (!media || !media.url) {
return {
url: undefined,
id: undefined
};
}
if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) {
media.type = (0,external_wp_blob_namespaceObject.getBlobTypeByURL)(media.url);
}
let mediaType;
// For media selections originated from a file upload.
if (media.media_type) {
if (media.media_type === IMAGE_BACKGROUND_TYPE) {
mediaType = IMAGE_BACKGROUND_TYPE;
} else {
// only images and videos are accepted so if the media_type is not an image we can assume it is a video.
// Videos contain the media type of 'file' in the object returned from the rest api.
mediaType = VIDEO_BACKGROUND_TYPE;
}
} else {
// For media selections originated from existing files in the media library.
if (media.type !== IMAGE_BACKGROUND_TYPE && media.type !== VIDEO_BACKGROUND_TYPE) {
return;
}
mediaType = media.type;
}
return {
url: media.url,
id: media.id,
alt: media?.alt,
backgroundType: mediaType,
...(mediaType === VIDEO_BACKGROUND_TYPE ? {
hasParallax: undefined
} : {})
};
}
/**
* Checks of the contentPosition is the center (default) position.
*
* @param {string} contentPosition The current content position.
* @return {boolean} Whether the contentPosition is center.
*/
function isContentPositionCenter(contentPosition) {
return !contentPosition || contentPosition === 'center center' || contentPosition === 'center';
}
/**
* Retrieves the className for the current contentPosition.
* The default position (center) will not have a className.
*
* @param {string} contentPosition The current content position.
* @return {string} The className assigned to the contentPosition.
*/
function getPositionClassName(contentPosition) {
/*
* Only render a className if the contentPosition is not center (the default).
*/
if (isContentPositionCenter(contentPosition)) return '';
return POSITION_CLASSNAMES[contentPosition];
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function backgroundImageStyles(url) {
return url ? {
backgroundImage: `url(${url})`
} : {};
}
/**
* Original function to determine the background opacity classname
*
* Used in deprecations: v1-7.
*
* @param {number} ratio ratio to use for opacity.
* @return {string} background opacity class .
*/
function dimRatioToClassV1(ratio) {
return ratio === 0 || ratio === 50 || !ratio ? null : 'has-background-dim-' + 10 * Math.round(ratio / 10);
}
function migrateDimRatio(attributes) {
return {
...attributes,
dimRatio: !attributes.url ? 100 : attributes.dimRatio
};
}
function migrateTag(attributes) {
if (!attributes.tagName) {
attributes = {
...attributes,
tagName: 'div'
};
}
return {
...attributes
};
}
const deprecated_blockAttributes = {
url: {
type: 'string'
},
id: {
type: 'number'
},
hasParallax: {
type: 'boolean',
default: false
},
dimRatio: {
type: 'number',
default: 50
},
overlayColor: {
type: 'string'
},
customOverlayColor: {
type: 'string'
},
backgroundType: {
type: 'string',
default: 'image'
},
focalPoint: {
type: 'object'
}
};
const v8ToV11BlockAttributes = {
url: {
type: 'string'
},
id: {
type: 'number'
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: ''
},
hasParallax: {
type: 'boolean',
default: false
},
isRepeated: {
type: 'boolean',
default: false
},
dimRatio: {
type: 'number',
default: 100
},
overlayColor: {
type: 'string'
},
customOverlayColor: {
type: 'string'
},
backgroundType: {
type: 'string',
default: 'image'
},
focalPoint: {
type: 'object'
},
minHeight: {
type: 'number'
},
minHeightUnit: {
type: 'string'
},
gradient: {
type: 'string'
},
customGradient: {
type: 'string'
},
contentPosition: {
type: 'string'
},
isDark: {
type: 'boolean',
default: true
},
allowedBlocks: {
type: 'array'
},
templateLock: {
type: ['string', 'boolean'],
enum: ['all', 'insert', false]
}
};
const v12BlockAttributes = {
...v8ToV11BlockAttributes,
useFeaturedImage: {
type: 'boolean',
default: false
},
tagName: {
type: 'string',
default: 'div'
}
};
const v7toV11BlockSupports = {
anchor: true,
align: true,
html: false,
spacing: {
padding: true,
__experimentalDefaultControls: {
padding: true
}
},
color: {
__experimentalDuotone: '> .wp-block-cover__image-background, > .wp-block-cover__video-background',
text: false,
background: false
}
};
const v12BlockSupports = {
...v7toV11BlockSupports,
spacing: {
padding: true,
margin: ['top', 'bottom'],
blockGap: true,
__experimentalDefaultControls: {
padding: true,
blockGap: true
}
},
__experimentalBorder: {
color: true,
radius: true,
style: true,
width: true,
__experimentalDefaultControls: {
color: true,
radius: true,
style: true,
width: true
}
},
color: {
__experimentalDuotone: '> .wp-block-cover__image-background, > .wp-block-cover__video-background',
heading: true,
text: true,
background: false,
__experimentalSkipSerialization: ['gradients'],
enableContrastChecker: false
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
layout: {
allowJustification: false
}
};
// Deprecation for blocks that does not have the aria-label when the image background is fixed or repeated.
const v13 = {
attributes: v12BlockAttributes,
supports: v12BlockSupports,
save({
attributes
}) {
const {
backgroundType,
gradient,
contentPosition,
customGradient,
customOverlayColor,
dimRatio,
focalPoint,
useFeaturedImage,
hasParallax,
isDark,
isRepeated,
overlayColor,
url,
alt,
id,
minHeight: minHeightProp,
minHeightUnit,
tagName: Tag
} = attributes;
const overlayColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayColor);
const gradientClass = (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(gradient);
const minHeight = minHeightProp && minHeightUnit ? `${minHeightProp}${minHeightUnit}` : minHeightProp;
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
const isImgElement = !(hasParallax || isRepeated);
const style = {
minHeight: minHeight || undefined
};
const bgStyle = {
backgroundColor: !overlayColorClass ? customOverlayColor : undefined,
background: customGradient ? customGradient : undefined
};
const objectPosition =
// prettier-ignore
focalPoint && isImgElement ? mediaPosition(focalPoint) : undefined;
const backgroundImage = url ? `url(${url})` : undefined;
const backgroundPosition = mediaPosition(focalPoint);
const classes = classnames_default()({
'is-light': !isDark,
'has-parallax': hasParallax,
'is-repeated': isRepeated,
'has-custom-content-position': !isContentPositionCenter(contentPosition)
}, getPositionClassName(contentPosition));
const imgClasses = classnames_default()('wp-block-cover__image-background', id ? `wp-image-${id}` : null, {
'has-parallax': hasParallax,
'is-repeated': isRepeated
});
const gradientValue = gradient || customGradient;
return (0,external_React_namespaceObject.createElement)(Tag, {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes,
style
})
}, (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()('wp-block-cover__background', overlayColorClass, dimRatioToClass(dimRatio), {
'has-background-dim': dimRatio !== undefined,
// For backwards compatibility. Former versions of the Cover Block applied
// `.wp-block-cover__gradient-background` in the presence of
// media, a gradient and a dim.
'wp-block-cover__gradient-background': url && gradientValue && dimRatio !== 0,
'has-background-gradient': gradientValue,
[gradientClass]: gradientClass
}),
style: bgStyle
}), !useFeaturedImage && isImageBackground && url && (isImgElement ? (0,external_React_namespaceObject.createElement)("img", {
className: imgClasses,
alt: alt,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}) : (0,external_React_namespaceObject.createElement)("div", {
role: "img",
className: imgClasses,
style: {
backgroundPosition,
backgroundImage
}
})), isVideoBackground && url && (0,external_React_namespaceObject.createElement)("video", {
className: classnames_default()('wp-block-cover__video-background', 'intrinsic-ignore'),
autoPlay: true,
muted: true,
loop: true,
playsInline: true,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}), (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-cover__inner-container'
})
}));
}
};
// Deprecation for blocks to prevent auto overlay color from overriding previously set values.
const v12 = {
attributes: v12BlockAttributes,
supports: v12BlockSupports,
isEligible(attributes) {
return attributes.customOverlayColor !== undefined || attributes.overlayColor !== undefined;
},
migrate(attributes) {
return {
...attributes,
isUserOverlayColor: true
};
},
save({
attributes
}) {
const {
backgroundType,
gradient,
contentPosition,
customGradient,
customOverlayColor,
dimRatio,
focalPoint,
useFeaturedImage,
hasParallax,
isDark,
isRepeated,
overlayColor,
url,
alt,
id,
minHeight: minHeightProp,
minHeightUnit,
tagName: Tag
} = attributes;
const overlayColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayColor);
const gradientClass = (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(gradient);
const minHeight = minHeightProp && minHeightUnit ? `${minHeightProp}${minHeightUnit}` : minHeightProp;
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
const isImgElement = !(hasParallax || isRepeated);
const style = {
minHeight: minHeight || undefined
};
const bgStyle = {
backgroundColor: !overlayColorClass ? customOverlayColor : undefined,
background: customGradient ? customGradient : undefined
};
const objectPosition =
// prettier-ignore
focalPoint && isImgElement ? mediaPosition(focalPoint) : undefined;
const backgroundImage = url ? `url(${url})` : undefined;
const backgroundPosition = mediaPosition(focalPoint);
const classes = classnames_default()({
'is-light': !isDark,
'has-parallax': hasParallax,
'is-repeated': isRepeated,
'has-custom-content-position': !isContentPositionCenter(contentPosition)
}, getPositionClassName(contentPosition));
const imgClasses = classnames_default()('wp-block-cover__image-background', id ? `wp-image-${id}` : null, {
'has-parallax': hasParallax,
'is-repeated': isRepeated
});
const gradientValue = gradient || customGradient;
return (0,external_React_namespaceObject.createElement)(Tag, {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes,
style
})
}, (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()('wp-block-cover__background', overlayColorClass, dimRatioToClass(dimRatio), {
'has-background-dim': dimRatio !== undefined,
// For backwards compatibility. Former versions of the Cover Block applied
// `.wp-block-cover__gradient-background` in the presence of
// media, a gradient and a dim.
'wp-block-cover__gradient-background': url && gradientValue && dimRatio !== 0,
'has-background-gradient': gradientValue,
[gradientClass]: gradientClass
}),
style: bgStyle
}), !useFeaturedImage && isImageBackground && url && (isImgElement ? (0,external_React_namespaceObject.createElement)("img", {
className: imgClasses,
alt: alt,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}) : (0,external_React_namespaceObject.createElement)("div", {
role: "img",
className: imgClasses,
style: {
backgroundPosition,
backgroundImage
}
})), isVideoBackground && url && (0,external_React_namespaceObject.createElement)("video", {
className: classnames_default()('wp-block-cover__video-background', 'intrinsic-ignore'),
autoPlay: true,
muted: true,
loop: true,
playsInline: true,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}), (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-cover__inner-container'
})
}));
}
};
// Deprecation for blocks that does not have a HTML tag option.
const deprecated_v11 = {
attributes: v8ToV11BlockAttributes,
supports: v7toV11BlockSupports,
save({
attributes
}) {
const {
backgroundType,
gradient,
contentPosition,
customGradient,
customOverlayColor,
dimRatio,
focalPoint,
useFeaturedImage,
hasParallax,
isDark,
isRepeated,
overlayColor,
url,
alt,
id,
minHeight: minHeightProp,
minHeightUnit
} = attributes;
const overlayColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayColor);
const gradientClass = (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(gradient);
const minHeight = minHeightProp && minHeightUnit ? `${minHeightProp}${minHeightUnit}` : minHeightProp;
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
const isImgElement = !(hasParallax || isRepeated);
const style = {
minHeight: minHeight || undefined
};
const bgStyle = {
backgroundColor: !overlayColorClass ? customOverlayColor : undefined,
background: customGradient ? customGradient : undefined
};
const objectPosition =
// prettier-ignore
focalPoint && isImgElement ? mediaPosition(focalPoint) : undefined;
const backgroundImage = url ? `url(${url})` : undefined;
const backgroundPosition = mediaPosition(focalPoint);
const classes = classnames_default()({
'is-light': !isDark,
'has-parallax': hasParallax,
'is-repeated': isRepeated,
'has-custom-content-position': !isContentPositionCenter(contentPosition)
}, getPositionClassName(contentPosition));
const imgClasses = classnames_default()('wp-block-cover__image-background', id ? `wp-image-${id}` : null, {
'has-parallax': hasParallax,
'is-repeated': isRepeated
});
const gradientValue = gradient || customGradient;
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes,
style
})
}, (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()('wp-block-cover__background', overlayColorClass, dimRatioToClass(dimRatio), {
'has-background-dim': dimRatio !== undefined,
// For backwards compatibility. Former versions of the Cover Block applied
// `.wp-block-cover__gradient-background` in the presence of
// media, a gradient and a dim.
'wp-block-cover__gradient-background': url && gradientValue && dimRatio !== 0,
'has-background-gradient': gradientValue,
[gradientClass]: gradientClass
}),
style: bgStyle
}), !useFeaturedImage && isImageBackground && url && (isImgElement ? (0,external_React_namespaceObject.createElement)("img", {
className: imgClasses,
alt: alt,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}) : (0,external_React_namespaceObject.createElement)("div", {
role: "img",
className: imgClasses,
style: {
backgroundPosition,
backgroundImage
}
})), isVideoBackground && url && (0,external_React_namespaceObject.createElement)("video", {
className: classnames_default()('wp-block-cover__video-background', 'intrinsic-ignore'),
autoPlay: true,
muted: true,
loop: true,
playsInline: true,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}), (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-cover__inner-container'
})
}));
},
migrate: migrateTag
};
// Deprecation for blocks that renders fixed background as backgroud from the main block container.
const deprecated_v10 = {
attributes: v8ToV11BlockAttributes,
supports: v7toV11BlockSupports,
save({
attributes
}) {
const {
backgroundType,
gradient,
contentPosition,
customGradient,
customOverlayColor,
dimRatio,
focalPoint,
useFeaturedImage,
hasParallax,
isDark,
isRepeated,
overlayColor,
url,
alt,
id,
minHeight: minHeightProp,
minHeightUnit
} = attributes;
const overlayColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayColor);
const gradientClass = (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(gradient);
const minHeight = minHeightProp && minHeightUnit ? `${minHeightProp}${minHeightUnit}` : minHeightProp;
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
const isImgElement = !(hasParallax || isRepeated);
const style = {
...(isImageBackground && !isImgElement && !useFeaturedImage ? backgroundImageStyles(url) : {}),
minHeight: minHeight || undefined
};
const bgStyle = {
backgroundColor: !overlayColorClass ? customOverlayColor : undefined,
background: customGradient ? customGradient : undefined
};
const objectPosition =
// prettier-ignore
focalPoint && isImgElement ? `${Math.round(focalPoint.x * 100)}% ${Math.round(focalPoint.y * 100)}%` : undefined;
const classes = classnames_default()({
'is-light': !isDark,
'has-parallax': hasParallax,
'is-repeated': isRepeated,
'has-custom-content-position': !isContentPositionCenter(contentPosition)
}, getPositionClassName(contentPosition));
const gradientValue = gradient || customGradient;
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes,
style
})
}, (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()('wp-block-cover__background', overlayColorClass, dimRatioToClass(dimRatio), {
'has-background-dim': dimRatio !== undefined,
// For backwards compatibility. Former versions of the Cover Block applied
// `.wp-block-cover__gradient-background` in the presence of
// media, a gradient and a dim.
'wp-block-cover__gradient-background': url && gradientValue && dimRatio !== 0,
'has-background-gradient': gradientValue,
[gradientClass]: gradientClass
}),
style: bgStyle
}), !useFeaturedImage && isImageBackground && isImgElement && url && (0,external_React_namespaceObject.createElement)("img", {
className: classnames_default()('wp-block-cover__image-background', id ? `wp-image-${id}` : null),
alt: alt,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}), isVideoBackground && url && (0,external_React_namespaceObject.createElement)("video", {
className: classnames_default()('wp-block-cover__video-background', 'intrinsic-ignore'),
autoPlay: true,
muted: true,
loop: true,
playsInline: true,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}), (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-cover__inner-container'
})
}));
},
migrate: migrateTag
};
// Deprecation for blocks with `minHeightUnit` set but no `minHeight`.
const v9 = {
attributes: v8ToV11BlockAttributes,
supports: v7toV11BlockSupports,
save({
attributes
}) {
const {
backgroundType,
gradient,
contentPosition,
customGradient,
customOverlayColor,
dimRatio,
focalPoint,
hasParallax,
isDark,
isRepeated,
overlayColor,
url,
alt,
id,
minHeight: minHeightProp,
minHeightUnit
} = attributes;
const overlayColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayColor);
const gradientClass = (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(gradient);
const minHeight = minHeightUnit ? `${minHeightProp}${minHeightUnit}` : minHeightProp;
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
const isImgElement = !(hasParallax || isRepeated);
const style = {
...(isImageBackground && !isImgElement ? backgroundImageStyles(url) : {}),
minHeight: minHeight || undefined
};
const bgStyle = {
backgroundColor: !overlayColorClass ? customOverlayColor : undefined,
background: customGradient ? customGradient : undefined
};
const objectPosition =
// prettier-ignore
focalPoint && isImgElement ? `${Math.round(focalPoint.x * 100)}% ${Math.round(focalPoint.y * 100)}%` : undefined;
const classes = classnames_default()({
'is-light': !isDark,
'has-parallax': hasParallax,
'is-repeated': isRepeated,
'has-custom-content-position': !isContentPositionCenter(contentPosition)
}, getPositionClassName(contentPosition));
const gradientValue = gradient || customGradient;
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes,
style
})
}, (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()('wp-block-cover__background', overlayColorClass, dimRatioToClass(dimRatio), {
'has-background-dim': dimRatio !== undefined,
// For backwards compatibility. Former versions of the Cover Block applied
// `.wp-block-cover__gradient-background` in the presence of
// media, a gradient and a dim.
'wp-block-cover__gradient-background': url && gradientValue && dimRatio !== 0,
'has-background-gradient': gradientValue,
[gradientClass]: gradientClass
}),
style: bgStyle
}), isImageBackground && isImgElement && url && (0,external_React_namespaceObject.createElement)("img", {
className: classnames_default()('wp-block-cover__image-background', id ? `wp-image-${id}` : null),
alt: alt,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}), isVideoBackground && url && (0,external_React_namespaceObject.createElement)("video", {
className: classnames_default()('wp-block-cover__video-background', 'intrinsic-ignore'),
autoPlay: true,
muted: true,
loop: true,
playsInline: true,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}), (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-cover__inner-container'
})
}));
},
migrate: migrateTag
};
// v8: deprecated to remove duplicated gradient classes and swap `wp-block-cover__gradient-background` for `wp-block-cover__background`.
const v8 = {
attributes: v8ToV11BlockAttributes,
supports: v7toV11BlockSupports,
save({
attributes
}) {
const {
backgroundType,
gradient,
contentPosition,
customGradient,
customOverlayColor,
dimRatio,
focalPoint,
hasParallax,
isDark,
isRepeated,
overlayColor,
url,
alt,
id,
minHeight: minHeightProp,
minHeightUnit
} = attributes;
const overlayColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayColor);
const gradientClass = (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(gradient);
const minHeight = minHeightUnit ? `${minHeightProp}${minHeightUnit}` : minHeightProp;
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
const isImgElement = !(hasParallax || isRepeated);
const style = {
...(isImageBackground && !isImgElement ? backgroundImageStyles(url) : {}),
minHeight: minHeight || undefined
};
const bgStyle = {
backgroundColor: !overlayColorClass ? customOverlayColor : undefined,
background: customGradient ? customGradient : undefined
};
const objectPosition =
// prettier-ignore
focalPoint && isImgElement ? `${Math.round(focalPoint.x * 100)}% ${Math.round(focalPoint.y * 100)}%` : undefined;
const classes = classnames_default()({
'is-light': !isDark,
'has-parallax': hasParallax,
'is-repeated': isRepeated,
'has-custom-content-position': !isContentPositionCenter(contentPosition)
}, getPositionClassName(contentPosition));
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes,
style
})
}, (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()(overlayColorClass, dimRatioToClass(dimRatio), 'wp-block-cover__gradient-background', gradientClass, {
'has-background-dim': dimRatio !== undefined,
'has-background-gradient': gradient || customGradient,
[gradientClass]: !url && gradientClass
}),
style: bgStyle
}), isImageBackground && isImgElement && url && (0,external_React_namespaceObject.createElement)("img", {
className: classnames_default()('wp-block-cover__image-background', id ? `wp-image-${id}` : null),
alt: alt,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}), isVideoBackground && url && (0,external_React_namespaceObject.createElement)("video", {
className: classnames_default()('wp-block-cover__video-background', 'intrinsic-ignore'),
autoPlay: true,
muted: true,
loop: true,
playsInline: true,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}), (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-cover__inner-container'
})
}));
},
migrate: migrateTag
};
const v7 = {
attributes: {
...deprecated_blockAttributes,
isRepeated: {
type: 'boolean',
default: false
},
minHeight: {
type: 'number'
},
minHeightUnit: {
type: 'string'
},
gradient: {
type: 'string'
},
customGradient: {
type: 'string'
},
contentPosition: {
type: 'string'
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: ''
}
},
supports: v7toV11BlockSupports,
save({
attributes
}) {
const {
backgroundType,
gradient,
contentPosition,
customGradient,
customOverlayColor,
dimRatio,
focalPoint,
hasParallax,
isRepeated,
overlayColor,
url,
alt,
id,
minHeight: minHeightProp,
minHeightUnit
} = attributes;
const overlayColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayColor);
const gradientClass = (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(gradient);
const minHeight = minHeightUnit ? `${minHeightProp}${minHeightUnit}` : minHeightProp;
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
const isImgElement = !(hasParallax || isRepeated);
const style = {
...(isImageBackground && !isImgElement ? backgroundImageStyles(url) : {}),
backgroundColor: !overlayColorClass ? customOverlayColor : undefined,
background: customGradient && !url ? customGradient : undefined,
minHeight: minHeight || undefined
};
const objectPosition =
// prettier-ignore
focalPoint && isImgElement ? `${Math.round(focalPoint.x * 100)}% ${Math.round(focalPoint.y * 100)}%` : undefined;
const classes = classnames_default()(dimRatioToClassV1(dimRatio), overlayColorClass, {
'has-background-dim': dimRatio !== 0,
'has-parallax': hasParallax,
'is-repeated': isRepeated,
'has-background-gradient': gradient || customGradient,
[gradientClass]: !url && gradientClass,
'has-custom-content-position': !isContentPositionCenter(contentPosition)
}, getPositionClassName(contentPosition));
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes,
style
})
}, url && (gradient || customGradient) && dimRatio !== 0 && (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()('wp-block-cover__gradient-background', gradientClass),
style: customGradient ? {
background: customGradient
} : undefined
}), isImageBackground && isImgElement && url && (0,external_React_namespaceObject.createElement)("img", {
className: classnames_default()('wp-block-cover__image-background', id ? `wp-image-${id}` : null),
alt: alt,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}), isVideoBackground && url && (0,external_React_namespaceObject.createElement)("video", {
className: classnames_default()('wp-block-cover__video-background', 'intrinsic-ignore'),
autoPlay: true,
muted: true,
loop: true,
playsInline: true,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-cover__inner-container"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null)));
},
migrate: (0,external_wp_compose_namespaceObject.compose)(migrateDimRatio, migrateTag)
};
const v6 = {
attributes: {
...deprecated_blockAttributes,
isRepeated: {
type: 'boolean',
default: false
},
minHeight: {
type: 'number'
},
minHeightUnit: {
type: 'string'
},
gradient: {
type: 'string'
},
customGradient: {
type: 'string'
},
contentPosition: {
type: 'string'
}
},
supports: {
align: true
},
save({
attributes
}) {
const {
backgroundType,
gradient,
contentPosition,
customGradient,
customOverlayColor,
dimRatio,
focalPoint,
hasParallax,
isRepeated,
overlayColor,
url,
minHeight: minHeightProp,
minHeightUnit
} = attributes;
const overlayColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayColor);
const gradientClass = (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(gradient);
const minHeight = minHeightUnit ? `${minHeightProp}${minHeightUnit}` : minHeightProp;
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
const style = isImageBackground ? backgroundImageStyles(url) : {};
const videoStyle = {};
if (!overlayColorClass) {
style.backgroundColor = customOverlayColor;
}
if (customGradient && !url) {
style.background = customGradient;
}
style.minHeight = minHeight || undefined;
let positionValue;
if (focalPoint) {
positionValue = `${Math.round(focalPoint.x * 100)}% ${Math.round(focalPoint.y * 100)}%`;
if (isImageBackground && !hasParallax) {
style.backgroundPosition = positionValue;
}
if (isVideoBackground) {
videoStyle.objectPosition = positionValue;
}
}
const classes = classnames_default()(dimRatioToClassV1(dimRatio), overlayColorClass, {
'has-background-dim': dimRatio !== 0,
'has-parallax': hasParallax,
'is-repeated': isRepeated,
'has-background-gradient': gradient || customGradient,
[gradientClass]: !url && gradientClass,
'has-custom-content-position': !isContentPositionCenter(contentPosition)
}, getPositionClassName(contentPosition));
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes,
style
})
}, url && (gradient || customGradient) && dimRatio !== 0 && (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()('wp-block-cover__gradient-background', gradientClass),
style: customGradient ? {
background: customGradient
} : undefined
}), isVideoBackground && url && (0,external_React_namespaceObject.createElement)("video", {
className: "wp-block-cover__video-background",
autoPlay: true,
muted: true,
loop: true,
playsInline: true,
src: url,
style: videoStyle
}), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-cover__inner-container"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null)));
},
migrate: (0,external_wp_compose_namespaceObject.compose)(migrateDimRatio, migrateTag)
};
const v5 = {
attributes: {
...deprecated_blockAttributes,
minHeight: {
type: 'number'
},
gradient: {
type: 'string'
},
customGradient: {
type: 'string'
}
},
supports: {
align: true
},
save({
attributes
}) {
const {
backgroundType,
gradient,
customGradient,
customOverlayColor,
dimRatio,
focalPoint,
hasParallax,
overlayColor,
url,
minHeight
} = attributes;
const overlayColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayColor);
const gradientClass = (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(gradient);
const style = backgroundType === IMAGE_BACKGROUND_TYPE ? backgroundImageStyles(url) : {};
if (!overlayColorClass) {
style.backgroundColor = customOverlayColor;
}
if (focalPoint && !hasParallax) {
style.backgroundPosition = `${Math.round(focalPoint.x * 100)}% ${Math.round(focalPoint.y * 100)}%`;
}
if (customGradient && !url) {
style.background = customGradient;
}
style.minHeight = minHeight || undefined;
const classes = classnames_default()(dimRatioToClassV1(dimRatio), overlayColorClass, {
'has-background-dim': dimRatio !== 0,
'has-parallax': hasParallax,
'has-background-gradient': customGradient,
[gradientClass]: !url && gradientClass
});
return (0,external_React_namespaceObject.createElement)("div", {
className: classes,
style: style
}, url && (gradient || customGradient) && dimRatio !== 0 && (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()('wp-block-cover__gradient-background', gradientClass),
style: customGradient ? {
background: customGradient
} : undefined
}), VIDEO_BACKGROUND_TYPE === backgroundType && url && (0,external_React_namespaceObject.createElement)("video", {
className: "wp-block-cover__video-background",
autoPlay: true,
muted: true,
loop: true,
src: url
}), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-cover__inner-container"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null)));
},
migrate: (0,external_wp_compose_namespaceObject.compose)(migrateDimRatio, migrateTag)
};
const v4 = {
attributes: {
...deprecated_blockAttributes,
minHeight: {
type: 'number'
},
gradient: {
type: 'string'
},
customGradient: {
type: 'string'
}
},
supports: {
align: true
},
save({
attributes
}) {
const {
backgroundType,
gradient,
customGradient,
customOverlayColor,
dimRatio,
focalPoint,
hasParallax,
overlayColor,
url,
minHeight
} = attributes;
const overlayColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayColor);
const gradientClass = (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(gradient);
const style = backgroundType === IMAGE_BACKGROUND_TYPE ? backgroundImageStyles(url) : {};
if (!overlayColorClass) {
style.backgroundColor = customOverlayColor;
}
if (focalPoint && !hasParallax) {
style.backgroundPosition = `${focalPoint.x * 100}% ${focalPoint.y * 100}%`;
}
if (customGradient && !url) {
style.background = customGradient;
}
style.minHeight = minHeight || undefined;
const classes = classnames_default()(dimRatioToClassV1(dimRatio), overlayColorClass, {
'has-background-dim': dimRatio !== 0,
'has-parallax': hasParallax,
'has-background-gradient': customGradient,
[gradientClass]: !url && gradientClass
});
return (0,external_React_namespaceObject.createElement)("div", {
className: classes,
style: style
}, url && (gradient || customGradient) && dimRatio !== 0 && (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()('wp-block-cover__gradient-background', gradientClass),
style: customGradient ? {
background: customGradient
} : undefined
}), VIDEO_BACKGROUND_TYPE === backgroundType && url && (0,external_React_namespaceObject.createElement)("video", {
className: "wp-block-cover__video-background",
autoPlay: true,
muted: true,
loop: true,
src: url
}), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-cover__inner-container"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null)));
},
migrate: (0,external_wp_compose_namespaceObject.compose)(migrateDimRatio, migrateTag)
};
const v3 = {
attributes: {
...deprecated_blockAttributes,
title: {
type: 'string',
source: 'html',
selector: 'p'
},
contentAlign: {
type: 'string',
default: 'center'
}
},
supports: {
align: true
},
save({
attributes
}) {
const {
backgroundType,
contentAlign,
customOverlayColor,
dimRatio,
focalPoint,
hasParallax,
overlayColor,
title,
url
} = attributes;
const overlayColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayColor);
const style = backgroundType === IMAGE_BACKGROUND_TYPE ? backgroundImageStyles(url) : {};
if (!overlayColorClass) {
style.backgroundColor = customOverlayColor;
}
if (focalPoint && !hasParallax) {
style.backgroundPosition = `${focalPoint.x * 100}% ${focalPoint.y * 100}%`;
}
const classes = classnames_default()(dimRatioToClassV1(dimRatio), overlayColorClass, {
'has-background-dim': dimRatio !== 0,
'has-parallax': hasParallax,
[`has-${contentAlign}-content`]: contentAlign !== 'center'
});
return (0,external_React_namespaceObject.createElement)("div", {
className: classes,
style: style
}, VIDEO_BACKGROUND_TYPE === backgroundType && url && (0,external_React_namespaceObject.createElement)("video", {
className: "wp-block-cover__video-background",
autoPlay: true,
muted: true,
loop: true,
src: url
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(title) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "p",
className: "wp-block-cover-text",
value: title
}));
},
migrate(attributes) {
const newAttribs = {
...attributes,
dimRatio: !attributes.url ? 100 : attributes.dimRatio,
tagName: !attributes.tagName ? 'div' : attributes.tagName
};
const {
title,
contentAlign,
...restAttributes
} = newAttribs;
return [restAttributes, [(0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: attributes.title,
align: attributes.contentAlign,
fontSize: 'large',
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write title…')
})]];
}
};
const v2 = {
attributes: {
...deprecated_blockAttributes,
title: {
type: 'string',
source: 'html',
selector: 'p'
},
contentAlign: {
type: 'string',
default: 'center'
},
align: {
type: 'string'
}
},
supports: {
className: false
},
save({
attributes
}) {
const {
url,
title,
hasParallax,
dimRatio,
align,
contentAlign,
overlayColor,
customOverlayColor
} = attributes;
const overlayColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayColor);
const style = backgroundImageStyles(url);
if (!overlayColorClass) {
style.backgroundColor = customOverlayColor;
}
const classes = classnames_default()('wp-block-cover-image', dimRatioToClassV1(dimRatio), overlayColorClass, {
'has-background-dim': dimRatio !== 0,
'has-parallax': hasParallax,
[`has-${contentAlign}-content`]: contentAlign !== 'center'
}, align ? `align${align}` : null);
return (0,external_React_namespaceObject.createElement)("div", {
className: classes,
style: style
}, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(title) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "p",
className: "wp-block-cover-image-text",
value: title
}));
},
migrate(attributes) {
const newAttribs = {
...attributes,
dimRatio: !attributes.url ? 100 : attributes.dimRatio,
tagName: !attributes.tagName ? 'div' : attributes.tagName
};
const {
title,
contentAlign,
align,
...restAttributes
} = newAttribs;
return [restAttributes, [(0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: attributes.title,
align: attributes.contentAlign,
fontSize: 'large',
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write title…')
})]];
}
};
const cover_deprecated_v1 = {
attributes: {
...deprecated_blockAttributes,
title: {
type: 'string',
source: 'html',
selector: 'h2'
},
align: {
type: 'string'
},
contentAlign: {
type: 'string',
default: 'center'
}
},
supports: {
className: false
},
save({
attributes
}) {
const {
url,
title,
hasParallax,
dimRatio,
align
} = attributes;
const style = backgroundImageStyles(url);
const classes = classnames_default()('wp-block-cover-image', dimRatioToClassV1(dimRatio), {
'has-background-dim': dimRatio !== 0,
'has-parallax': hasParallax
}, align ? `align${align}` : null);
return (0,external_React_namespaceObject.createElement)("section", {
className: classes,
style: style
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "h2",
value: title
}));
},
migrate(attributes) {
const newAttribs = {
...attributes,
dimRatio: !attributes.url ? 100 : attributes.dimRatio,
tagName: !attributes.tagName ? 'div' : attributes.tagName
};
const {
title,
contentAlign,
align,
...restAttributes
} = newAttribs;
return [restAttributes, [(0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: attributes.title,
align: attributes.contentAlign,
fontSize: 'large',
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write title…')
})]];
}
};
/* harmony default export */ const cover_deprecated = ([v13, v12, deprecated_v11, deprecated_v10, v9, v8, v7, v6, v5, v4, v3, v2, cover_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/edit/inspector-controls.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
cleanEmptyObject: inspector_controls_cleanEmptyObject
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function CoverHeightInput({
onChange,
onUnitChange,
unit = 'px',
value = ''
}) {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(external_wp_components_namespaceObject.__experimentalUnitControl);
const inputId = `block-cover-height-input-${instanceId}`;
const isPx = unit === 'px';
const [availableUnits] = (0,external_wp_blockEditor_namespaceObject.useSettings)('spacing.units');
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: availableUnits || ['px', 'em', 'rem', 'vw', 'vh'],
defaultValues: {
px: 430,
'%': 20,
em: 20,
rem: 20,
vw: 20,
vh: 50
}
});
const handleOnChange = unprocessedValue => {
const inputValue = unprocessedValue !== '' ? parseFloat(unprocessedValue) : undefined;
if (isNaN(inputValue) && inputValue !== undefined) {
return;
}
onChange(inputValue);
};
const computedValue = (0,external_wp_element_namespaceObject.useMemo)(() => {
const [parsedQuantity] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value);
return [parsedQuantity, unit].join('');
}, [unit, value]);
const min = isPx ? COVER_MIN_HEIGHT : 0;
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Minimum height of cover'),
id: inputId,
isResetValueOnUnitChange: true,
min: min,
onChange: handleOnChange,
onUnitChange: onUnitChange,
__unstableInputWidth: '80px',
units: units,
value: computedValue
});
}
function CoverInspectorControls({
attributes,
setAttributes,
clientId,
setOverlayColor,
coverRef,
currentSettings,
updateDimRatio,
onClearMedia
}) {
const {
useFeaturedImage,
dimRatio,
focalPoint,
hasParallax,
isRepeated,
minHeight,
minHeightUnit,
alt,
tagName
} = attributes;
const {
isVideoBackground,
isImageBackground,
mediaElement,
url,
overlayColor
} = currentSettings;
const {
gradientValue,
setGradient
} = (0,external_wp_blockEditor_namespaceObject.__experimentalUseGradient)();
const toggleParallax = () => {
setAttributes({
hasParallax: !hasParallax,
...(!hasParallax ? {
focalPoint: undefined
} : {})
});
};
const toggleIsRepeated = () => {
setAttributes({
isRepeated: !isRepeated
});
};
const showFocalPointPicker = isVideoBackground || isImageBackground && (!hasParallax || isRepeated);
const imperativeFocalPointPreview = value => {
const [styleOfRef, property] = mediaElement.current ? [mediaElement.current.style, 'objectPosition'] : [coverRef.current.style, 'backgroundPosition'];
styleOfRef[property] = mediaPosition(value);
};
const colorGradientSettings = (0,external_wp_blockEditor_namespaceObject.__experimentalUseMultipleOriginColorsAndGradients)();
const htmlElementMessages = {
header: (0,external_wp_i18n_namespaceObject.__)('The <header> element should represent introductory content, typically a group of introductory or navigational aids.'),
main: (0,external_wp_i18n_namespaceObject.__)('The <main> element should be used for the primary content of your document only.'),
section: (0,external_wp_i18n_namespaceObject.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element."),
article: (0,external_wp_i18n_namespaceObject.__)('The <article> element should represent a self-contained, syndicatable portion of the document.'),
aside: (0,external_wp_i18n_namespaceObject.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."),
footer: (0,external_wp_i18n_namespaceObject.__)('The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).')
};
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, !!url && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, isImageBackground && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Fixed background'),
checked: hasParallax,
onChange: toggleParallax
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Repeated background'),
checked: isRepeated,
onChange: toggleIsRepeated
})), showFocalPointPicker && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FocalPointPicker, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Focal point'),
url: url,
value: focalPoint,
onDragStart: imperativeFocalPointPreview,
onDrag: imperativeFocalPointPreview,
onChange: newFocalPoint => setAttributes({
focalPoint: newFocalPoint
})
}), !useFeaturedImage && url && !isVideoBackground && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextareaControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Alternative text'),
value: alt,
onChange: newAlt => setAttributes({
alt: newAlt
}),
help: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
href: "https://www.w3.org/WAI/tutorials/images/decision-tree"
}, (0,external_wp_i18n_namespaceObject.__)('Describe the purpose of the image.')), (0,external_React_namespaceObject.createElement)("br", null), (0,external_wp_i18n_namespaceObject.__)('Leave empty if decorative.'))
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "secondary",
size: "small",
className: "block-library-cover__reset-button",
onClick: onClearMedia
}, (0,external_wp_i18n_namespaceObject.__)('Clear Media'))))), colorGradientSettings.hasColorsOrGradients && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "color"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientSettingsDropdown, {
__experimentalIsRenderedInSidebar: true,
settings: [{
colorValue: overlayColor.color,
gradientValue,
label: (0,external_wp_i18n_namespaceObject.__)('Overlay'),
onColorChange: setOverlayColor,
onGradientChange: setGradient,
isShownByDefault: true,
resetAllFilter: () => ({
overlayColor: undefined,
customOverlayColor: undefined,
gradient: undefined,
customGradient: undefined
})
}],
panelId: clientId,
...colorGradientSettings
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => {
// If there's a media background the dimRatio will be
// defaulted to 50 whereas it will be 100 for colors.
return dimRatio === undefined ? false : dimRatio !== (url ? 50 : 100);
},
label: (0,external_wp_i18n_namespaceObject.__)('Overlay opacity'),
onDeselect: () => updateDimRatio(url ? 50 : 100),
resetAllFilter: () => ({
dimRatio: url ? 50 : 100
}),
isShownByDefault: true,
panelId: clientId
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Overlay opacity'),
value: dimRatio,
onChange: newDimRatio => updateDimRatio(newDimRatio),
min: 0,
max: 100,
step: 10,
required: true,
__next40pxDefaultSize: true
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "dimensions"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!minHeight,
label: (0,external_wp_i18n_namespaceObject.__)('Minimum height'),
onDeselect: () => setAttributes({
minHeight: undefined,
minHeightUnit: undefined
}),
resetAllFilter: () => ({
minHeight: undefined,
minHeightUnit: undefined
}),
isShownByDefault: true,
panelId: clientId
}, (0,external_React_namespaceObject.createElement)(CoverHeightInput, {
value: attributes?.style?.dimensions?.aspectRatio ? '' : minHeight,
unit: minHeightUnit,
onChange: newMinHeight => setAttributes({
minHeight: newMinHeight,
style: inspector_controls_cleanEmptyObject({
...attributes?.style,
dimensions: {
...attributes?.style?.dimensions,
aspectRatio: undefined // Reset aspect ratio when minHeight is set.
}
})
}),
onUnitChange: nextUnit => setAttributes({
minHeightUnit: nextUnit
})
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('HTML element'),
options: [{
label: (0,external_wp_i18n_namespaceObject.__)('Default (<div>)'),
value: 'div'
}, {
label: '<header>',
value: 'header'
}, {
label: '<main>',
value: 'main'
}, {
label: '<section>',
value: 'section'
}, {
label: '<article>',
value: 'article'
}, {
label: '<aside>',
value: 'aside'
}, {
label: '<footer>',
value: 'footer'
}],
value: tagName,
onChange: value => setAttributes({
tagName: value
}),
help: htmlElementMessages[tagName]
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/edit/block-controls.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
cleanEmptyObject: block_controls_cleanEmptyObject
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function CoverBlockControls({
attributes,
setAttributes,
onSelectMedia,
currentSettings,
toggleUseFeaturedImage
}) {
const {
contentPosition,
id,
useFeaturedImage,
minHeight,
minHeightUnit
} = attributes;
const {
hasInnerBlocks,
url
} = currentSettings;
const [prevMinHeightValue, setPrevMinHeightValue] = (0,external_wp_element_namespaceObject.useState)(minHeight);
const [prevMinHeightUnit, setPrevMinHeightUnit] = (0,external_wp_element_namespaceObject.useState)(minHeightUnit);
const isMinFullHeight = minHeightUnit === 'vh' && minHeight === 100 && !attributes?.style?.dimensions?.aspectRatio;
const toggleMinFullHeight = () => {
if (isMinFullHeight) {
// If there aren't previous values, take the default ones.
if (prevMinHeightUnit === 'vh' && prevMinHeightValue === 100) {
return setAttributes({
minHeight: undefined,
minHeightUnit: undefined
});
}
// Set the previous values of height.
return setAttributes({
minHeight: prevMinHeightValue,
minHeightUnit: prevMinHeightUnit
});
}
setPrevMinHeightValue(minHeight);
setPrevMinHeightUnit(minHeightUnit);
// Set full height, and clear any aspect ratio value.
return setAttributes({
minHeight: 100,
minHeightUnit: 'vh',
style: block_controls_cleanEmptyObject({
...attributes?.style,
dimensions: {
...attributes?.style?.dimensions,
aspectRatio: undefined // Reset aspect ratio when minHeight is set.
}
})
});
};
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockAlignmentMatrixControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Change content position'),
value: contentPosition,
onChange: nextPosition => setAttributes({
contentPosition: nextPosition
}),
isDisabled: !hasInnerBlocks
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockFullHeightAligmentControl, {
isActive: isMinFullHeight,
onToggle: toggleMinFullHeight,
isDisabled: !hasInnerBlocks
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, {
mediaId: id,
mediaURL: url,
allowedTypes: shared_ALLOWED_MEDIA_TYPES,
accept: "image/*,video/*",
onSelect: onSelectMedia,
onToggleFeaturedImage: toggleUseFeaturedImage,
useFeaturedImage: useFeaturedImage,
name: !url ? (0,external_wp_i18n_namespaceObject.__)('Add Media') : (0,external_wp_i18n_namespaceObject.__)('Replace')
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/edit/cover-placeholder.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function CoverPlaceholder({
disableMediaButtons = false,
children,
onSelectMedia,
onError,
style,
toggleUseFeaturedImage
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: library_cover
}),
labels: {
title: (0,external_wp_i18n_namespaceObject.__)('Cover'),
instructions: (0,external_wp_i18n_namespaceObject.__)('Drag and drop onto this block, upload, or select existing media from your library.')
},
onSelect: onSelectMedia,
accept: "image/*,video/*",
allowedTypes: shared_ALLOWED_MEDIA_TYPES,
disableMediaButtons: disableMediaButtons,
onToggleFeaturedImage: toggleUseFeaturedImage,
onError: onError,
style: style
}, children);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/edit/resizable-cover-popover.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const RESIZABLE_BOX_ENABLE_OPTION = {
top: false,
right: false,
bottom: true,
left: false,
topRight: false,
bottomRight: false,
bottomLeft: false,
topLeft: false
};
const {
ResizableBoxPopover
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function ResizableCoverPopover({
className,
height,
minHeight,
onResize,
onResizeStart,
onResizeStop,
showHandle,
size,
width,
...props
}) {
const [isResizing, setIsResizing] = (0,external_wp_element_namespaceObject.useState)(false);
const dimensions = (0,external_wp_element_namespaceObject.useMemo)(() => ({
height,
minHeight,
width
}), [minHeight, height, width]);
const resizableBoxProps = {
className: classnames_default()(className, {
'is-resizing': isResizing
}),
enable: RESIZABLE_BOX_ENABLE_OPTION,
onResizeStart: (_event, _direction, elt) => {
onResizeStart(elt.clientHeight);
onResize(elt.clientHeight);
},
onResize: (_event, _direction, elt) => {
onResize(elt.clientHeight);
if (!isResizing) {
setIsResizing(true);
}
},
onResizeStop: (_event, _direction, elt) => {
onResizeStop(elt.clientHeight);
setIsResizing(false);
},
showHandle,
size,
__experimentalShowTooltip: true,
__experimentalTooltipProps: {
axis: 'y',
position: 'bottom',
isVisible: isResizing
}
};
return (0,external_React_namespaceObject.createElement)(ResizableBoxPopover, {
className: "block-library-cover__resizable-box-popover",
__unstableRefreshSize: dimensions,
resizableBoxProps: resizableBoxProps,
...props
});
}
;// 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<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.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));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])}
;// CONCATENATED MODULE: ./node_modules/fast-average-color/dist/index.esm.js
/*! Fast Average Color | © 2022 Denis Seleznev | MIT License | https://github.com/fast-average-color/fast-average-color */
function toHex(num) {
var str = num.toString(16);
return str.length === 1 ? '0' + str : str;
}
function arrayToHex(arr) {
return '#' + arr.map(toHex).join('');
}
function isDark(color) {
// http://www.w3.org/TR/AERT#color-contrast
var result = (color[0] * 299 + color[1] * 587 + color[2] * 114) / 1000;
return result < 128;
}
function prepareIgnoredColor(color) {
if (!color) {
return [];
}
return isRGBArray(color) ? color : [color];
}
function isRGBArray(value) {
return Array.isArray(value[0]);
}
function isIgnoredColor(data, index, ignoredColor) {
for (var i = 0; i < ignoredColor.length; i++) {
if (isIgnoredColorAsNumbers(data, index, ignoredColor[i])) {
return true;
}
}
return false;
}
function isIgnoredColorAsNumbers(data, index, ignoredColor) {
switch (ignoredColor.length) {
case 3:
// [red, green, blue]
if (isIgnoredRGBColor(data, index, ignoredColor)) {
return true;
}
break;
case 4:
// [red, green, blue, alpha]
if (isIgnoredRGBAColor(data, index, ignoredColor)) {
return true;
}
break;
case 5:
// [red, green, blue, alpha, threshold]
if (isIgnoredRGBAColorWithThreshold(data, index, ignoredColor)) {
return true;
}
break;
default:
return false;
}
}
function isIgnoredRGBColor(data, index, ignoredColor) {
// Ignore if the pixel are transparent.
if (data[index + 3] !== 255) {
return true;
}
if (data[index] === ignoredColor[0] &&
data[index + 1] === ignoredColor[1] &&
data[index + 2] === ignoredColor[2]) {
return true;
}
return false;
}
function isIgnoredRGBAColor(data, index, ignoredColor) {
if (data[index + 3] && ignoredColor[3]) {
return data[index] === ignoredColor[0] &&
data[index + 1] === ignoredColor[1] &&
data[index + 2] === ignoredColor[2] &&
data[index + 3] === ignoredColor[3];
}
// Ignore rgb components if the pixel are fully transparent.
return data[index + 3] === ignoredColor[3];
}
function inRange(colorComponent, ignoredColorComponent, value) {
return colorComponent >= (ignoredColorComponent - value) &&
colorComponent <= (ignoredColorComponent + value);
}
function isIgnoredRGBAColorWithThreshold(data, index, ignoredColor) {
var redIgnored = ignoredColor[0];
var greenIgnored = ignoredColor[1];
var blueIgnored = ignoredColor[2];
var alphaIgnored = ignoredColor[3];
var threshold = ignoredColor[4];
var alphaData = data[index + 3];
var alphaInRange = inRange(alphaData, alphaIgnored, threshold);
if (!alphaIgnored) {
return alphaInRange;
}
if (!alphaData && alphaInRange) {
return true;
}
if (inRange(data[index], redIgnored, threshold) &&
inRange(data[index + 1], greenIgnored, threshold) &&
inRange(data[index + 2], blueIgnored, threshold) &&
alphaInRange) {
return true;
}
return false;
}
function dominantAlgorithm(arr, len, options) {
var colorHash = {};
var divider = 24;
var ignoredColor = options.ignoredColor;
var step = options.step;
var max = [0, 0, 0, 0, 0];
for (var i = 0; i < len; i += step) {
var red = arr[i];
var green = arr[i + 1];
var blue = arr[i + 2];
var alpha = arr[i + 3];
if (ignoredColor && isIgnoredColor(arr, i, ignoredColor)) {
continue;
}
var key = Math.round(red / divider) + ',' +
Math.round(green / divider) + ',' +
Math.round(blue / divider);
if (colorHash[key]) {
colorHash[key] = [
colorHash[key][0] + red * alpha,
colorHash[key][1] + green * alpha,
colorHash[key][2] + blue * alpha,
colorHash[key][3] + alpha,
colorHash[key][4] + 1
];
}
else {
colorHash[key] = [red * alpha, green * alpha, blue * alpha, alpha, 1];
}
if (max[4] < colorHash[key][4]) {
max = colorHash[key];
}
}
var redTotal = max[0];
var greenTotal = max[1];
var blueTotal = max[2];
var alphaTotal = max[3];
var count = max[4];
return alphaTotal ? [
Math.round(redTotal / alphaTotal),
Math.round(greenTotal / alphaTotal),
Math.round(blueTotal / alphaTotal),
Math.round(alphaTotal / count)
] : options.defaultColor;
}
function simpleAlgorithm(arr, len, options) {
var redTotal = 0;
var greenTotal = 0;
var blueTotal = 0;
var alphaTotal = 0;
var count = 0;
var ignoredColor = options.ignoredColor;
var step = options.step;
for (var i = 0; i < len; i += step) {
var alpha = arr[i + 3];
var red = arr[i] * alpha;
var green = arr[i + 1] * alpha;
var blue = arr[i + 2] * alpha;
if (ignoredColor && isIgnoredColor(arr, i, ignoredColor)) {
continue;
}
redTotal += red;
greenTotal += green;
blueTotal += blue;
alphaTotal += alpha;
count++;
}
return alphaTotal ? [
Math.round(redTotal / alphaTotal),
Math.round(greenTotal / alphaTotal),
Math.round(blueTotal / alphaTotal),
Math.round(alphaTotal / count)
] : options.defaultColor;
}
function sqrtAlgorithm(arr, len, options) {
var redTotal = 0;
var greenTotal = 0;
var blueTotal = 0;
var alphaTotal = 0;
var count = 0;
var ignoredColor = options.ignoredColor;
var step = options.step;
for (var i = 0; i < len; i += step) {
var red = arr[i];
var green = arr[i + 1];
var blue = arr[i + 2];
var alpha = arr[i + 3];
if (ignoredColor && isIgnoredColor(arr, i, ignoredColor)) {
continue;
}
redTotal += red * red * alpha;
greenTotal += green * green * alpha;
blueTotal += blue * blue * alpha;
alphaTotal += alpha;
count++;
}
return alphaTotal ? [
Math.round(Math.sqrt(redTotal / alphaTotal)),
Math.round(Math.sqrt(greenTotal / alphaTotal)),
Math.round(Math.sqrt(blueTotal / alphaTotal)),
Math.round(alphaTotal / count)
] : options.defaultColor;
}
function getDefaultColor(options) {
return getOption(options, 'defaultColor', [0, 0, 0, 0]);
}
function getOption(options, name, defaultValue) {
return (options[name] === undefined ? defaultValue : options[name]);
}
var MIN_SIZE = 10;
var MAX_SIZE = 100;
function isSvg(filename) {
return filename.search(/\.svg(\?|$)/i) !== -1;
}
function getOriginalSize(resource) {
if (isInstanceOfHTMLImageElement(resource)) {
var width = resource.naturalWidth;
var height = resource.naturalHeight;
// For SVG images with only viewBox attribute
if (!resource.naturalWidth && isSvg(resource.src)) {
width = height = MAX_SIZE;
}
return {
width: width,
height: height,
};
}
if (isInstanceOfHTMLVideoElement(resource)) {
return {
width: resource.videoWidth,
height: resource.videoHeight
};
}
return {
width: resource.width,
height: resource.height
};
}
function getSrc(resource) {
if (isInstanceOfHTMLCanvasElement(resource)) {
return 'canvas';
}
if (isInstanceOfOffscreenCanvas(resource)) {
return 'offscreencanvas';
}
if (isInstanceOfImageBitmap(resource)) {
return 'imagebitmap';
}
return resource.src;
}
function isInstanceOfHTMLImageElement(resource) {
return typeof HTMLImageElement !== 'undefined' && resource instanceof HTMLImageElement;
}
var hasOffscreenCanvas = typeof OffscreenCanvas !== 'undefined';
function isInstanceOfOffscreenCanvas(resource) {
return hasOffscreenCanvas && resource instanceof OffscreenCanvas;
}
function isInstanceOfHTMLVideoElement(resource) {
return typeof HTMLVideoElement !== 'undefined' && resource instanceof HTMLVideoElement;
}
function isInstanceOfHTMLCanvasElement(resource) {
return typeof HTMLCanvasElement !== 'undefined' && resource instanceof HTMLCanvasElement;
}
function isInstanceOfImageBitmap(resource) {
return typeof ImageBitmap !== 'undefined' && resource instanceof ImageBitmap;
}
function prepareSizeAndPosition(originalSize, options) {
var srcLeft = getOption(options, 'left', 0);
var srcTop = getOption(options, 'top', 0);
var srcWidth = getOption(options, 'width', originalSize.width);
var srcHeight = getOption(options, 'height', originalSize.height);
var destWidth = srcWidth;
var destHeight = srcHeight;
if (options.mode === 'precision') {
return {
srcLeft: srcLeft,
srcTop: srcTop,
srcWidth: srcWidth,
srcHeight: srcHeight,
destWidth: destWidth,
destHeight: destHeight
};
}
var factor;
if (srcWidth > srcHeight) {
factor = srcWidth / srcHeight;
destWidth = MAX_SIZE;
destHeight = Math.round(destWidth / factor);
}
else {
factor = srcHeight / srcWidth;
destHeight = MAX_SIZE;
destWidth = Math.round(destHeight / factor);
}
if (destWidth > srcWidth || destHeight > srcHeight ||
destWidth < MIN_SIZE || destHeight < MIN_SIZE) {
destWidth = srcWidth;
destHeight = srcHeight;
}
return {
srcLeft: srcLeft,
srcTop: srcTop,
srcWidth: srcWidth,
srcHeight: srcHeight,
destWidth: destWidth,
destHeight: destHeight
};
}
var isWebWorkers = typeof window === 'undefined';
function makeCanvas() {
if (isWebWorkers) {
return hasOffscreenCanvas ? new OffscreenCanvas(1, 1) : null;
}
return document.createElement('canvas');
}
var ERROR_PREFIX = 'FastAverageColor: ';
function getError(message) {
return Error(ERROR_PREFIX + message);
}
function outputError(error, silent) {
if (!silent) {
console.error(error);
}
}
var FastAverageColor = /** @class */ (function () {
function FastAverageColor() {
this.canvas = null;
this.ctx = null;
}
/**
* Get asynchronously the average color from not loaded image.
*/
FastAverageColor.prototype.getColorAsync = function (resource, options) {
if (!resource) {
return Promise.reject(getError('call .getColorAsync() without resource.'));
}
if (typeof resource === 'string') {
// Web workers
if (typeof Image === 'undefined') {
return Promise.reject(getError('resource as string is not supported in this environment'));
}
var img = new Image();
img.crossOrigin = options && options.crossOrigin || '';
img.src = resource;
return this.bindImageEvents(img, options);
}
else if (isInstanceOfHTMLImageElement(resource) && !resource.complete) {
return this.bindImageEvents(resource, options);
}
else {
var result = this.getColor(resource, options);
return result.error ? Promise.reject(result.error) : Promise.resolve(result);
}
};
/**
* Get the average color from images, videos and canvas.
*/
FastAverageColor.prototype.getColor = function (resource, options) {
options = options || {};
var defaultColor = getDefaultColor(options);
if (!resource) {
var error = getError('call .getColor(null) without resource');
outputError(error, options.silent);
return this.prepareResult(defaultColor, error);
}
var originalSize = getOriginalSize(resource);
var size = prepareSizeAndPosition(originalSize, options);
if (!size.srcWidth || !size.srcHeight || !size.destWidth || !size.destHeight) {
var error = getError("incorrect sizes for resource \"".concat(getSrc(resource), "\""));
outputError(error, options.silent);
return this.prepareResult(defaultColor, error);
}
if (!this.canvas) {
this.canvas = makeCanvas();
if (!this.canvas) {
var error = getError('OffscreenCanvas is not supported in this browser');
outputError(error, options.silent);
return this.prepareResult(defaultColor, error);
}
}
if (!this.ctx) {
this.ctx = this.canvas.getContext('2d', { willReadFrequently: true });
if (!this.ctx) {
var error = getError('Canvas Context 2D is not supported in this browser');
outputError(error, options.silent);
return this.prepareResult(defaultColor);
}
this.ctx.imageSmoothingEnabled = false;
}
this.canvas.width = size.destWidth;
this.canvas.height = size.destHeight;
try {
this.ctx.clearRect(0, 0, size.destWidth, size.destHeight);
this.ctx.drawImage(resource, size.srcLeft, size.srcTop, size.srcWidth, size.srcHeight, 0, 0, size.destWidth, size.destHeight);
var bitmapData = this.ctx.getImageData(0, 0, size.destWidth, size.destHeight).data;
return this.prepareResult(this.getColorFromArray4(bitmapData, options));
}
catch (originalError) {
var error = getError("security error (CORS) for resource ".concat(getSrc(resource), ".\nDetails: https://developer.mozilla.org/en/docs/Web/HTML/CORS_enabled_image"));
outputError(error, options.silent);
!options.silent && console.error(originalError);
return this.prepareResult(defaultColor, error);
}
};
/**
* Get the average color from a array when 1 pixel is 4 bytes.
*/
FastAverageColor.prototype.getColorFromArray4 = function (arr, options) {
options = options || {};
var bytesPerPixel = 4;
var arrLength = arr.length;
var defaultColor = getDefaultColor(options);
if (arrLength < bytesPerPixel) {
return defaultColor;
}
var len = arrLength - arrLength % bytesPerPixel;
var step = (options.step || 1) * bytesPerPixel;
var algorithm;
switch (options.algorithm || 'sqrt') {
case 'simple':
algorithm = simpleAlgorithm;
break;
case 'sqrt':
algorithm = sqrtAlgorithm;
break;
case 'dominant':
algorithm = dominantAlgorithm;
break;
default:
throw getError("".concat(options.algorithm, " is unknown algorithm"));
}
return algorithm(arr, len, {
defaultColor: defaultColor,
ignoredColor: prepareIgnoredColor(options.ignoredColor),
step: step
});
};
/**
* Get color data from value ([r, g, b, a]).
*/
FastAverageColor.prototype.prepareResult = function (value, error) {
var rgb = value.slice(0, 3);
var rgba = [value[0], value[1], value[2], value[3] / 255];
var isDarkColor = isDark(value);
return {
value: [value[0], value[1], value[2], value[3]],
rgb: 'rgb(' + rgb.join(',') + ')',
rgba: 'rgba(' + rgba.join(',') + ')',
hex: arrayToHex(rgb),
hexa: arrayToHex(value),
isDark: isDarkColor,
isLight: !isDarkColor,
error: error,
};
};
/**
* Destroy the instance.
*/
FastAverageColor.prototype.destroy = function () {
if (this.canvas) {
this.canvas.width = 1;
this.canvas.height = 1;
this.canvas = null;
}
this.ctx = null;
};
FastAverageColor.prototype.bindImageEvents = function (resource, options) {
var _this = this;
return new Promise(function (resolve, reject) {
var onload = function () {
unbindEvents();
var result = _this.getColor(resource, options);
if (result.error) {
reject(result.error);
}
else {
resolve(result);
}
};
var onerror = function () {
unbindEvents();
reject(getError("Error loading image \"".concat(resource.src, "\".")));
};
var onabort = function () {
unbindEvents();
reject(getError("Image \"".concat(resource.src, "\" loading aborted")));
};
var unbindEvents = function () {
resource.removeEventListener('load', onload);
resource.removeEventListener('error', onerror);
resource.removeEventListener('abort', onabort);
};
resource.addEventListener('load', onload);
resource.addEventListener('error', onerror);
resource.addEventListener('abort', onabort);
});
};
return FastAverageColor;
}());
;// CONCATENATED MODULE: external ["wp","hooks"]
const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/edit/color-utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* @typedef {import('colord').RgbaColor} RgbaColor
*/
k([names]);
/**
* Fallback color when the average color can't be computed. The image may be
* rendering as transparent, and most sites have a light color background.
*/
const DEFAULT_BACKGROUND_COLOR = '#FFF';
/**
* Default dim color specified in style.css.
*/
const DEFAULT_OVERLAY_COLOR = '#000';
/**
* Performs a Porter Duff composite source over operation on two rgba colors.
*
* @see {@link https://www.w3.org/TR/compositing-1/#porterduffcompositingoperators_srcover}
*
* @param {RgbaColor} source Source color.
* @param {RgbaColor} dest Destination color.
*
* @return {RgbaColor} Composite color.
*/
function compositeSourceOver(source, dest) {
return {
r: source.r * source.a + dest.r * dest.a * (1 - source.a),
g: source.g * source.a + dest.g * dest.a * (1 - source.a),
b: source.b * source.a + dest.b * dest.a * (1 - source.a),
a: source.a + dest.a * (1 - source.a)
};
}
/**
* Retrieves the FastAverageColor singleton.
*
* @return {FastAverageColor} The FastAverageColor singleton.
*/
function retrieveFastAverageColor() {
if (!retrieveFastAverageColor.fastAverageColor) {
retrieveFastAverageColor.fastAverageColor = new FastAverageColor();
}
return retrieveFastAverageColor.fastAverageColor;
}
/**
* Computes the average color of an image.
*
* @param {string} url The url of the image.
*
* @return {Promise<string>} Promise of an average color as a hex string.
*/
const getMediaColor = memize(async url => {
if (!url) {
return DEFAULT_BACKGROUND_COLOR;
}
// making the default color rgb for compat with FAC
const {
r,
g,
b,
a
} = w(DEFAULT_BACKGROUND_COLOR).toRgb();
try {
const imgCrossOrigin = (0,external_wp_hooks_namespaceObject.applyFilters)('media.crossOrigin', undefined, url);
const color = await retrieveFastAverageColor().getColorAsync(url, {
// The default color is white, which is the color
// that is returned if there's an error.
// colord returns alpga 0-1, FAC needs 0-255
defaultColor: [r, g, b, a * 255],
// Errors that come up don't reject the promise,
// so error logging has to be silenced
// with this option.
silent: "production" === 'production',
crossOrigin: imgCrossOrigin
});
return color.hex;
} catch (error) {
// If there's an error return the fallback color.
return DEFAULT_BACKGROUND_COLOR;
}
});
/**
* Computes if the color combination of the overlay and background color is dark.
*
* @param {number} dimRatio Opacity of the overlay between 0 and 100.
* @param {string} overlayColor CSS color string for the overlay.
* @param {string} backgroundColor CSS color string for the background.
*
* @return {boolean} true if the color combination composite result is dark.
*/
function compositeIsDark(dimRatio, overlayColor, backgroundColor) {
// Opacity doesn't matter if you're overlaying the same color on top of itself.
// And background doesn't matter when overlay is fully opaque.
if (overlayColor === backgroundColor || dimRatio === 100) {
return w(overlayColor).isDark();
}
const overlay = w(overlayColor).alpha(dimRatio / 100).toRgb();
const background = w(backgroundColor).toRgb();
const composite = compositeSourceOver(overlay, background);
return w(composite).isDark();
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/edit/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function getInnerBlocksTemplate(attributes) {
return [['core/paragraph', {
align: 'center',
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write title…'),
...attributes
}]];
}
/**
* Is the URL a temporary blob URL? A blob URL is one that is used temporarily while
* the media (image or video) is being uploaded and will not have an id allocated yet.
*
* @param {number} id The id of the media.
* @param {string} url The url of the media.
*
* @return {boolean} Is the URL a Blob URL.
*/
const isTemporaryMedia = (id, url) => !id && (0,external_wp_blob_namespaceObject.isBlobURL)(url);
function CoverEdit({
attributes,
clientId,
isSelected,
overlayColor,
setAttributes,
setOverlayColor,
toggleSelection,
context: {
postId,
postType
}
}) {
const {
contentPosition,
id,
url: originalUrl,
backgroundType: originalBackgroundType,
useFeaturedImage,
dimRatio,
focalPoint,
hasParallax,
isDark,
isRepeated,
minHeight,
minHeightUnit,
alt,
allowedBlocks,
templateLock,
tagName: TagName = 'div',
isUserOverlayColor
} = attributes;
const [featuredImage] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'featured_media', postId);
const {
__unstableMarkNextChangeAsNotPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const media = (0,external_wp_data_namespaceObject.useSelect)(select => featuredImage && select(external_wp_coreData_namespaceObject.store).getMedia(featuredImage, {
context: 'view'
}), [featuredImage]);
const mediaUrl = media?.source_url;
// User can change the featured image outside of the block, but we still
// need to update the block when that happens. This effect should only
// run when the featured image changes in that case. All other cases are
// handled in their respective callbacks.
(0,external_wp_element_namespaceObject.useEffect)(() => {
(async () => {
if (!useFeaturedImage) {
return;
}
const averageBackgroundColor = await getMediaColor(mediaUrl);
let newOverlayColor = overlayColor.color;
if (!isUserOverlayColor) {
newOverlayColor = averageBackgroundColor;
__unstableMarkNextChangeAsNotPersistent();
setOverlayColor(newOverlayColor);
}
const newIsDark = compositeIsDark(dimRatio, newOverlayColor, averageBackgroundColor);
__unstableMarkNextChangeAsNotPersistent();
setAttributes({
isDark: newIsDark
});
})();
// Disable reason: Update the block only when the featured image changes.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [mediaUrl]);
// instead of destructuring the attributes
// we define the url and background type
// depending on the value of the useFeaturedImage flag
// to preview in edit the dynamic featured image
const url = useFeaturedImage ? mediaUrl :
// Ensure the url is not malformed due to sanitization through `wp_kses`.
originalUrl?.replaceAll('&', '&');
const backgroundType = useFeaturedImage ? IMAGE_BACKGROUND_TYPE : originalBackgroundType;
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const {
gradientClass,
gradientValue
} = (0,external_wp_blockEditor_namespaceObject.__experimentalUseGradient)();
const onSelectMedia = async newMedia => {
const mediaAttributes = attributesFromMedia(newMedia);
const isImage = [newMedia?.type, newMedia?.media_type].includes(IMAGE_BACKGROUND_TYPE);
const averageBackgroundColor = await getMediaColor(isImage ? newMedia?.url : undefined);
let newOverlayColor = overlayColor.color;
if (!isUserOverlayColor) {
newOverlayColor = averageBackgroundColor;
setOverlayColor(newOverlayColor);
// Make undo revert the next setAttributes and the previous setOverlayColor.
__unstableMarkNextChangeAsNotPersistent();
}
// Only set a new dimRatio if there was no previous media selected
// to avoid resetting to 50 if it has been explicitly set to 100.
// See issue #52835 for context.
const newDimRatio = originalUrl === undefined && dimRatio === 100 ? 50 : dimRatio;
const newIsDark = compositeIsDark(newDimRatio, newOverlayColor, averageBackgroundColor);
setAttributes({
...mediaAttributes,
focalPoint: undefined,
useFeaturedImage: undefined,
dimRatio: newDimRatio,
isDark: newIsDark
});
};
const onClearMedia = () => {
let newOverlayColor = overlayColor.color;
if (!isUserOverlayColor) {
newOverlayColor = DEFAULT_OVERLAY_COLOR;
setOverlayColor(undefined);
// Make undo revert the next setAttributes and the previous setOverlayColor.
__unstableMarkNextChangeAsNotPersistent();
}
const newIsDark = compositeIsDark(dimRatio, newOverlayColor, DEFAULT_BACKGROUND_COLOR);
setAttributes({
url: undefined,
id: undefined,
backgroundType: undefined,
focalPoint: undefined,
hasParallax: undefined,
isRepeated: undefined,
useFeaturedImage: undefined,
isDark: newIsDark
});
};
const onSetOverlayColor = async newOverlayColor => {
const averageBackgroundColor = await getMediaColor(url);
const newIsDark = compositeIsDark(dimRatio, newOverlayColor, averageBackgroundColor);
setOverlayColor(newOverlayColor);
// Make undo revert the next setAttributes and the previous setOverlayColor.
__unstableMarkNextChangeAsNotPersistent();
setAttributes({
isUserOverlayColor: true,
isDark: newIsDark
});
};
const onUpdateDimRatio = async newDimRatio => {
const averageBackgroundColor = await getMediaColor(url);
const newIsDark = compositeIsDark(newDimRatio, overlayColor.color, averageBackgroundColor);
setAttributes({
dimRatio: newDimRatio,
isDark: newIsDark
});
};
const onUploadError = message => {
createErrorNotice(message, {
type: 'snackbar'
});
};
const isUploadingMedia = isTemporaryMedia(id, url);
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
const [resizeListener, {
height,
width
}] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
const resizableBoxDimensions = (0,external_wp_element_namespaceObject.useMemo)(() => {
return {
height: minHeightUnit === 'px' ? minHeight : 'auto',
width: 'auto'
};
}, [minHeight, minHeightUnit]);
const minHeightWithUnit = minHeight && minHeightUnit ? `${minHeight}${minHeightUnit}` : minHeight;
const isImgElement = !(hasParallax || isRepeated);
const style = {
minHeight: minHeightWithUnit || undefined
};
const backgroundImage = url ? `url(${url})` : undefined;
const backgroundPosition = mediaPosition(focalPoint);
const bgStyle = {
backgroundColor: overlayColor.color
};
const mediaStyle = {
objectPosition: focalPoint && isImgElement ? mediaPosition(focalPoint) : undefined
};
const hasBackground = !!(url || overlayColor.color || gradientValue);
const hasInnerBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId).innerBlocks.length > 0, [clientId]);
const ref = (0,external_wp_element_namespaceObject.useRef)();
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
ref
});
// Check for fontSize support before we pass a fontSize attribute to the innerBlocks.
const [fontSizes] = (0,external_wp_blockEditor_namespaceObject.useSettings)('typography.fontSizes');
const hasFontSizes = fontSizes?.length > 0;
const innerBlocksTemplate = getInnerBlocksTemplate({
fontSize: hasFontSizes ? 'large' : undefined
});
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({
className: 'wp-block-cover__inner-container'
}, {
// Avoid template sync when the `templateLock` value is `all` or `contentOnly`.
// See: https://github.com/WordPress/gutenberg/pull/45632
template: !hasInnerBlocks ? innerBlocksTemplate : undefined,
templateInsertUpdatesSelection: true,
allowedBlocks,
templateLock,
dropZoneElement: ref.current
});
const mediaElement = (0,external_wp_element_namespaceObject.useRef)();
const currentSettings = {
isVideoBackground,
isImageBackground,
mediaElement,
hasInnerBlocks,
url,
isImgElement,
overlayColor
};
const toggleUseFeaturedImage = async () => {
const newUseFeaturedImage = !useFeaturedImage;
const averageBackgroundColor = newUseFeaturedImage ? await getMediaColor(mediaUrl) : DEFAULT_BACKGROUND_COLOR;
const newOverlayColor = !isUserOverlayColor ? averageBackgroundColor : overlayColor.color;
if (!isUserOverlayColor) {
if (newUseFeaturedImage) {
setOverlayColor(newOverlayColor);
} else {
setOverlayColor(undefined);
}
// Make undo revert the next setAttributes and the previous setOverlayColor.
__unstableMarkNextChangeAsNotPersistent();
}
const newDimRatio = dimRatio === 100 ? 50 : dimRatio;
const newIsDark = compositeIsDark(newDimRatio, newOverlayColor, averageBackgroundColor);
setAttributes({
id: undefined,
url: undefined,
useFeaturedImage: newUseFeaturedImage,
dimRatio: newDimRatio,
backgroundType: useFeaturedImage ? IMAGE_BACKGROUND_TYPE : undefined,
isDark: newIsDark
});
};
const blockControls = (0,external_React_namespaceObject.createElement)(CoverBlockControls, {
attributes: attributes,
setAttributes: setAttributes,
onSelectMedia: onSelectMedia,
currentSettings: currentSettings,
toggleUseFeaturedImage: toggleUseFeaturedImage
});
const inspectorControls = (0,external_React_namespaceObject.createElement)(CoverInspectorControls, {
attributes: attributes,
setAttributes: setAttributes,
clientId: clientId,
setOverlayColor: onSetOverlayColor,
coverRef: ref,
currentSettings: currentSettings,
toggleUseFeaturedImage: toggleUseFeaturedImage,
updateDimRatio: onUpdateDimRatio,
onClearMedia: onClearMedia
});
const resizableCoverProps = {
className: 'block-library-cover__resize-container',
clientId,
height,
minHeight: minHeightWithUnit,
onResizeStart: () => {
setAttributes({
minHeightUnit: 'px'
});
toggleSelection(false);
},
onResize: value => {
setAttributes({
minHeight: value
});
},
onResizeStop: newMinHeight => {
toggleSelection(true);
setAttributes({
minHeight: newMinHeight
});
},
// Hide the resize handle if an aspect ratio is set, as the aspect ratio takes precedence.
showHandle: !attributes.style?.dimensions?.aspectRatio ? true : false,
size: resizableBoxDimensions,
width
};
if (!useFeaturedImage && !hasInnerBlocks && !hasBackground) {
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, blockControls, inspectorControls, isSelected && (0,external_React_namespaceObject.createElement)(ResizableCoverPopover, {
...resizableCoverProps
}), (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps,
className: classnames_default()('is-placeholder', blockProps.className),
style: {
...blockProps.style,
minHeight: minHeightWithUnit || undefined
}
}, resizeListener, (0,external_React_namespaceObject.createElement)(CoverPlaceholder, {
onSelectMedia: onSelectMedia,
onError: onUploadError,
toggleUseFeaturedImage: toggleUseFeaturedImage
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-cover__placeholder-background-options"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ColorPalette, {
disableCustomColors: true,
value: overlayColor.color,
onChange: onSetOverlayColor,
clearable: false
})))));
}
const classes = classnames_default()({
'is-dark-theme': isDark,
'is-light': !isDark,
'is-transient': isUploadingMedia,
'has-parallax': hasParallax,
'is-repeated': isRepeated,
'has-custom-content-position': !isContentPositionCenter(contentPosition)
}, getPositionClassName(contentPosition));
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, blockControls, inspectorControls, (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps,
className: classnames_default()(classes, blockProps.className),
style: {
...style,
...blockProps.style
},
"data-url": url
}, resizeListener, (!useFeaturedImage || url) && (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()('wp-block-cover__background', dimRatioToClass(dimRatio), {
[overlayColor.class]: overlayColor.class,
'has-background-dim': dimRatio !== undefined,
// For backwards compatibility. Former versions of the Cover Block applied
// `.wp-block-cover__gradient-background` in the presence of
// media, a gradient and a dim.
'wp-block-cover__gradient-background': url && gradientValue && dimRatio !== 0,
'has-background-gradient': gradientValue,
[gradientClass]: gradientClass
}),
style: {
backgroundImage: gradientValue,
...bgStyle
}
}), !url && useFeaturedImage && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
className: "wp-block-cover__image--placeholder-image",
withIllustration: true
}), url && isImageBackground && (isImgElement ? (0,external_React_namespaceObject.createElement)("img", {
ref: mediaElement,
className: "wp-block-cover__image-background",
alt: alt,
src: url,
style: mediaStyle
}) : (0,external_React_namespaceObject.createElement)("div", {
ref: mediaElement,
role: alt ? 'img' : undefined,
"aria-label": alt ? alt : undefined,
className: classnames_default()(classes, 'wp-block-cover__image-background'),
style: {
backgroundImage,
backgroundPosition
}
})), url && isVideoBackground && (0,external_React_namespaceObject.createElement)("video", {
ref: mediaElement,
className: "wp-block-cover__video-background",
autoPlay: true,
muted: true,
loop: true,
src: url,
style: mediaStyle
}), isUploadingMedia && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_React_namespaceObject.createElement)(CoverPlaceholder, {
disableMediaButtons: true,
onSelectMedia: onSelectMedia,
onError: onUploadError,
toggleUseFeaturedImage: toggleUseFeaturedImage
}), (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
})), isSelected && (0,external_React_namespaceObject.createElement)(ResizableCoverPopover, {
...resizableCoverProps
}));
}
/* harmony default export */ const cover_edit = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_blockEditor_namespaceObject.withColors)({
overlayColor: 'background-color'
})])(CoverEdit));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function cover_save_save({
attributes
}) {
const {
backgroundType,
gradient,
contentPosition,
customGradient,
customOverlayColor,
dimRatio,
focalPoint,
useFeaturedImage,
hasParallax,
isDark,
isRepeated,
overlayColor,
url,
alt,
id,
minHeight: minHeightProp,
minHeightUnit,
tagName: Tag
} = attributes;
const overlayColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayColor);
const gradientClass = (0,external_wp_blockEditor_namespaceObject.__experimentalGetGradientClass)(gradient);
const minHeight = minHeightProp && minHeightUnit ? `${minHeightProp}${minHeightUnit}` : minHeightProp;
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
const isImgElement = !(hasParallax || isRepeated);
const style = {
minHeight: minHeight || undefined
};
const bgStyle = {
backgroundColor: !overlayColorClass ? customOverlayColor : undefined,
background: customGradient ? customGradient : undefined
};
const objectPosition =
// prettier-ignore
focalPoint && isImgElement ? mediaPosition(focalPoint) : undefined;
const backgroundImage = url ? `url(${url})` : undefined;
const backgroundPosition = mediaPosition(focalPoint);
const classes = classnames_default()({
'is-light': !isDark,
'has-parallax': hasParallax,
'is-repeated': isRepeated,
'has-custom-content-position': !isContentPositionCenter(contentPosition)
}, getPositionClassName(contentPosition));
const imgClasses = classnames_default()('wp-block-cover__image-background', id ? `wp-image-${id}` : null, {
'has-parallax': hasParallax,
'is-repeated': isRepeated
});
const gradientValue = gradient || customGradient;
return (0,external_React_namespaceObject.createElement)(Tag, {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes,
style
})
}, (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()('wp-block-cover__background', overlayColorClass, dimRatioToClass(dimRatio), {
'has-background-dim': dimRatio !== undefined,
// For backwards compatibility. Former versions of the Cover Block applied
// `.wp-block-cover__gradient-background` in the presence of
// media, a gradient and a dim.
'wp-block-cover__gradient-background': url && gradientValue && dimRatio !== 0,
'has-background-gradient': gradientValue,
[gradientClass]: gradientClass
}),
style: bgStyle
}), !useFeaturedImage && isImageBackground && url && (isImgElement ? (0,external_React_namespaceObject.createElement)("img", {
className: imgClasses,
alt: alt,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}) : (0,external_React_namespaceObject.createElement)("div", {
role: alt ? 'img' : undefined,
"aria-label": alt ? alt : undefined,
className: imgClasses,
style: {
backgroundPosition,
backgroundImage
}
})), isVideoBackground && url && (0,external_React_namespaceObject.createElement)("video", {
className: classnames_default()('wp-block-cover__video-background', 'intrinsic-ignore'),
autoPlay: true,
muted: true,
loop: true,
playsInline: true,
src: url,
style: {
objectPosition
},
"data-object-fit": "cover",
"data-object-position": objectPosition
}), (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-cover__inner-container'
})
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/transforms.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
cleanEmptyObject: transforms_cleanEmptyObject
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const cover_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/image'],
transform: ({
caption,
url,
alt,
align,
id,
anchor,
style
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/cover', {
dimRatio: 50,
url,
alt,
align,
id,
anchor,
style: {
color: {
duotone: style?.color?.duotone
}
}
}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: caption,
fontSize: 'large',
align: 'center'
})])
}, {
type: 'block',
blocks: ['core/video'],
transform: ({
caption,
src,
align,
id,
anchor
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/cover', {
dimRatio: 50,
url: src,
align,
id,
backgroundType: VIDEO_BACKGROUND_TYPE,
anchor
}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: caption,
fontSize: 'large',
align: 'center'
})])
}, {
type: 'block',
blocks: ['core/group'],
transform: (attributes, innerBlocks) => {
const {
align,
anchor,
backgroundColor,
gradient,
style
} = attributes;
// If the Group block being transformed has a Cover block as its
// only child return that Cover block.
if (innerBlocks?.length === 1 && innerBlocks[0]?.name === 'core/cover') {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/cover', innerBlocks[0].attributes, innerBlocks[0].innerBlocks);
}
// If no background or gradient color is provided, default to 50% opacity.
// This matches the styling of a Cover block with a background image,
// in the state where a background image has been removed.
const dimRatio = backgroundColor || gradient || style?.color?.background || style?.color?.gradient ? undefined : 50;
// Move the background or gradient color to the parent Cover block.
const parentAttributes = {
align,
anchor,
dimRatio,
overlayColor: backgroundColor,
customOverlayColor: style?.color?.background,
gradient,
customGradient: style?.color?.gradient
};
const attributesWithoutBackgroundColors = {
...attributes,
backgroundColor: undefined,
gradient: undefined,
style: transforms_cleanEmptyObject({
...attributes?.style,
color: style?.color ? {
...style?.color,
background: undefined,
gradient: undefined
} : undefined
})
};
// Preserve the block by nesting it within the Cover block,
// instead of converting the Group block directly to the Cover block.
return (0,external_wp_blocks_namespaceObject.createBlock)('core/cover', parentAttributes, [(0,external_wp_blocks_namespaceObject.createBlock)('core/group', attributesWithoutBackgroundColors, innerBlocks)]);
}
}],
to: [{
type: 'block',
blocks: ['core/image'],
isMatch: ({
backgroundType,
url,
overlayColor,
customOverlayColor,
gradient,
customGradient
}) => {
if (url) {
// If a url exists the transform could happen if that URL represents an image background.
return backgroundType === IMAGE_BACKGROUND_TYPE;
}
// If a url is not set the transform could happen if the cover has no background color or gradient;
return !overlayColor && !customOverlayColor && !gradient && !customGradient;
},
transform: ({
title,
url,
alt,
align,
id,
anchor,
style
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/image', {
caption: title,
url,
alt,
align,
id,
anchor,
style: {
color: {
duotone: style?.color?.duotone
}
}
})
}, {
type: 'block',
blocks: ['core/video'],
isMatch: ({
backgroundType,
url,
overlayColor,
customOverlayColor,
gradient,
customGradient
}) => {
if (url) {
// If a url exists the transform could happen if that URL represents a video background.
return backgroundType === VIDEO_BACKGROUND_TYPE;
}
// If a url is not set the transform could happen if the cover has no background color or gradient;
return !overlayColor && !customOverlayColor && !gradient && !customGradient;
},
transform: ({
title,
url,
align,
id,
anchor
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/video', {
caption: title,
src: url,
id,
align,
anchor
})
}, {
type: 'block',
blocks: ['core/group'],
isMatch: ({
url,
useFeaturedImage
}) => {
// If the Cover block uses background media, skip this transform,
// and instead use the Group block's default transform.
if (url || useFeaturedImage) {
return false;
}
return true;
},
transform: (attributes, innerBlocks) => {
// Convert Cover overlay colors to comparable Group background colors.
const transformedColorAttributes = {
backgroundColor: attributes?.overlayColor,
gradient: attributes?.gradient,
style: transforms_cleanEmptyObject({
...attributes?.style,
color: attributes?.customOverlayColor || attributes?.customGradient || attributes?.style?.color ? {
background: attributes?.customOverlayColor,
gradient: attributes?.customGradient,
...attributes?.style?.color
} : undefined
})
};
// If the Cover block contains only a single Group block as a direct child,
// then attempt to merge the Cover's background colors with the child Group block,
// and remove the Cover block as the wrapper.
if (innerBlocks?.length === 1 && innerBlocks[0]?.name === 'core/group') {
const groupAttributes = transforms_cleanEmptyObject(innerBlocks[0].attributes || {});
// If the Group block contains any kind of background color or gradient,
// skip merging Cover background colors, and preserve the Group block's colors.
if (groupAttributes?.backgroundColor || groupAttributes?.gradient || groupAttributes?.style?.color?.background || groupAttributes?.style?.color?.gradient) {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/group', groupAttributes, innerBlocks[0]?.innerBlocks);
}
return (0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
...transformedColorAttributes,
...groupAttributes,
style: transforms_cleanEmptyObject({
...groupAttributes?.style,
color: transformedColorAttributes?.style?.color || groupAttributes?.style?.color ? {
...transformedColorAttributes?.style?.color,
...groupAttributes?.style?.color
} : undefined
})
}, innerBlocks[0]?.innerBlocks);
}
// In all other cases, transform the Cover block directly to a Group block.
return (0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
...attributes,
...transformedColorAttributes
}, innerBlocks);
}
}]
};
/* harmony default export */ const cover_transforms = (cover_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/variations.js
/**
* WordPress dependencies
*/
const variations_variations = [{
name: 'cover',
title: (0,external_wp_i18n_namespaceObject.__)('Cover'),
description: (0,external_wp_i18n_namespaceObject.__)('Add an image or video with a text overlay.'),
attributes: {
layout: {
type: 'constrained'
}
},
isDefault: true,
icon: library_cover
}];
/* harmony default export */ const cover_variations = (variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const cover_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/cover",
title: "Cover",
category: "media",
description: "Add an image or video with a text overlay.",
textdomain: "default",
attributes: {
url: {
type: "string"
},
useFeaturedImage: {
type: "boolean",
"default": false
},
id: {
type: "number"
},
alt: {
type: "string",
"default": ""
},
hasParallax: {
type: "boolean",
"default": false
},
isRepeated: {
type: "boolean",
"default": false
},
dimRatio: {
type: "number",
"default": 100
},
overlayColor: {
type: "string"
},
customOverlayColor: {
type: "string"
},
isUserOverlayColor: {
type: "boolean"
},
backgroundType: {
type: "string",
"default": "image"
},
focalPoint: {
type: "object"
},
minHeight: {
type: "number"
},
minHeightUnit: {
type: "string"
},
gradient: {
type: "string"
},
customGradient: {
type: "string"
},
contentPosition: {
type: "string"
},
isDark: {
type: "boolean",
"default": true
},
allowedBlocks: {
type: "array"
},
templateLock: {
type: ["string", "boolean"],
"enum": ["all", "insert", "contentOnly", false]
},
tagName: {
type: "string",
"default": "div"
}
},
usesContext: ["postId", "postType"],
supports: {
anchor: true,
align: true,
html: false,
spacing: {
padding: true,
margin: ["top", "bottom"],
blockGap: true,
__experimentalDefaultControls: {
padding: true,
blockGap: true
}
},
__experimentalBorder: {
color: true,
radius: true,
style: true,
width: true,
__experimentalDefaultControls: {
color: true,
radius: true,
style: true,
width: true
}
},
color: {
__experimentalDuotone: "> .wp-block-cover__image-background, > .wp-block-cover__video-background",
heading: true,
text: true,
background: false,
__experimentalSkipSerialization: ["gradients"],
enableContrastChecker: false
},
dimensions: {
aspectRatio: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
layout: {
allowJustification: false
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-cover-editor",
style: "wp-block-cover"
};
const {
name: cover_name
} = cover_metadata;
const cover_settings = {
icon: library_cover,
example: {
attributes: {
customOverlayColor: '#065174',
dimRatio: 40,
url: 'https://s.w.org/images/core/5.3/Windbuchencom.jpg'
},
innerBlocks: [{
name: 'core/paragraph',
attributes: {
content: (0,external_wp_i18n_namespaceObject.__)('<strong>Snow Patrol</strong>'),
align: 'center',
style: {
typography: {
fontSize: 48
},
color: {
text: 'white'
}
}
}
}]
},
transforms: cover_transforms,
save: cover_save_save,
edit: cover_edit,
deprecated: cover_deprecated,
variations: cover_variations
};
const cover_init = () => initBlock({
name: cover_name,
metadata: cover_metadata,
settings: cover_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/details.js
/**
* WordPress dependencies
*/
const details = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 16h10v1.5H4V16Zm0-4.5h16V13H4v-1.5ZM10 7h10v1.5H10V7Z",
fillRule: "evenodd",
clipRule: "evenodd"
}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m4 5.25 4 2.5-4 2.5v-5Z"
}));
/* harmony default export */ const library_details = (details);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/details/edit.js
/**
* WordPress dependencies
*/
const details_edit_TEMPLATE = [['core/paragraph', {
placeholder: (0,external_wp_i18n_namespaceObject.__)('Type / to add a hidden block')
}]];
function DetailsEdit({
attributes,
setAttributes,
clientId
}) {
const {
showContent,
summary
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: details_edit_TEMPLATE,
__experimentalCaptureToolbars: true
});
// Check if either the block or the inner blocks are selected.
const hasSelection = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
isBlockSelected,
hasSelectedInnerBlock
} = select(external_wp_blockEditor_namespaceObject.store);
/* Sets deep to true to also find blocks inside the details content block. */
return hasSelectedInnerBlock(clientId, true) || isBlockSelected(clientId);
}, [clientId]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Open by default'),
checked: showContent,
onChange: () => setAttributes({
showContent: !showContent
})
}))), (0,external_React_namespaceObject.createElement)("details", {
...innerBlocksProps,
open: hasSelection || showContent
}, (0,external_React_namespaceObject.createElement)("summary", {
onClick: event => event.preventDefault()
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Write summary'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write summary…'),
allowedFormats: [],
withoutInteractiveFormatting: true,
value: summary,
onChange: newSummary => setAttributes({
summary: newSummary
})
})), innerBlocksProps.children));
}
/* harmony default export */ const details_edit = (DetailsEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/details/save.js
/**
* WordPress dependencies
*/
function details_save_save({
attributes
}) {
const {
showContent
} = attributes;
const summary = attributes.summary ? attributes.summary : 'Details';
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save();
return (0,external_React_namespaceObject.createElement)("details", {
...blockProps,
open: showContent
}, (0,external_React_namespaceObject.createElement)("summary", null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: summary
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/details/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const details_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/details",
title: "Details",
category: "text",
description: "Hide and show additional content.",
keywords: ["accordion", "summary", "toggle", "disclosure"],
textdomain: "default",
attributes: {
showContent: {
type: "boolean",
"default": false
},
summary: {
type: "rich-text",
source: "rich-text",
selector: "summary"
}
},
supports: {
align: ["wide", "full"],
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
__experimentalBorder: {
color: true,
width: true,
style: true
},
html: false,
spacing: {
margin: true,
padding: true,
blockGap: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
layout: {
allowEditing: false
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-details-editor",
style: "wp-block-details"
};
const {
name: details_name
} = details_metadata;
const details_settings = {
icon: library_details,
example: {
attributes: {
summary: 'La Mancha',
showContent: true
},
innerBlocks: [{
name: 'core/paragraph',
attributes: {
content: (0,external_wp_i18n_namespaceObject.__)('In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.')
}
}]
},
save: details_save_save,
edit: details_edit
};
const details_init = () => initBlock({
name: details_name,
metadata: details_metadata,
settings: details_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js
/**
* WordPress dependencies
*/
const pencil = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"
}));
/* harmony default export */ const library_pencil = (pencil);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js
/**
* Internal dependencies
*/
/* harmony default export */ const library_edit = (library_pencil);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/embed-controls.js
/**
* WordPress dependencies
*/
function getResponsiveHelp(checked) {
return checked ? (0,external_wp_i18n_namespaceObject.__)('This embed will preserve its aspect ratio when the browser is resized.') : (0,external_wp_i18n_namespaceObject.__)('This embed may not preserve its aspect ratio when the browser is resized.');
}
const EmbedControls = ({
blockSupportsResponsive,
showEditButton,
themeSupportsResponsive,
allowResponsive,
toggleResponsive,
switchBackToURLInput
}) => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, showEditButton && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
className: "components-toolbar__control",
label: (0,external_wp_i18n_namespaceObject.__)('Edit URL'),
icon: library_edit,
onClick: switchBackToURLInput
}))), themeSupportsResponsive && blockSupportsResponsive && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Media settings'),
className: "blocks-responsive"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Resize for smaller devices'),
checked: allowResponsive,
help: getResponsiveHelp,
onChange: toggleResponsive
}))));
/* harmony default export */ const embed_controls = (EmbedControls);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/icons.js
/**
* WordPress dependencies
*/
const embedContentIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_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.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zm-6-9.5L16 12l-2.5 2.8 1.1 1L18 12l-3.5-3.5-1 1zm-3 0l-1-1L6 12l3.5 3.8 1.1-1L8 12l2.5-2.5z"
}));
const embedAudioIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_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.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zM13.2 7.7c-.4.4-.7 1.1-.7 1.9v3.7c-.4-.3-.8-.4-1.3-.4-1.2 0-2.2 1-2.2 2.2 0 1.2 1 2.2 2.2 2.2.5 0 1-.2 1.4-.5.9-.6 1.4-1.6 1.4-2.6V9.6c0-.4.1-.6.2-.8.3-.3 1-.3 1.6-.3h.2V7h-.2c-.7 0-1.8 0-2.6.7z"
}));
const embedPhotoIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_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-2zM9.2 4.5H19c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V9.8l4.6-5.3zm9.8 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"
}));
const embedVideoIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_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.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zM10 15l5-3-5-3v6z"
}));
const embedTwitterIcon = {
foreground: '#1da1f2',
src: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.G, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M22.23 5.924c-.736.326-1.527.547-2.357.646.847-.508 1.498-1.312 1.804-2.27-.793.47-1.67.812-2.606.996C18.325 4.498 17.258 4 16.078 4c-2.266 0-4.103 1.837-4.103 4.103 0 .322.036.635.106.935-3.41-.17-6.433-1.804-8.457-4.287-.353.607-.556 1.312-.556 2.064 0 1.424.724 2.68 1.825 3.415-.673-.022-1.305-.207-1.86-.514v.052c0 1.988 1.415 3.647 3.293 4.023-.344.095-.707.145-1.08.145-.265 0-.522-.026-.773-.074.522 1.63 2.038 2.817 3.833 2.85-1.404 1.1-3.174 1.757-5.096 1.757-.332 0-.66-.02-.98-.057 1.816 1.164 3.973 1.843 6.29 1.843 7.547 0 11.675-6.252 11.675-11.675 0-.178-.004-.355-.012-.53.802-.578 1.497-1.3 2.047-2.124z"
})))
};
const embedYouTubeIcon = {
foreground: '#ff0000',
src: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M21.8 8s-.195-1.377-.795-1.984c-.76-.797-1.613-.8-2.004-.847-2.798-.203-6.996-.203-6.996-.203h-.01s-4.197 0-6.996.202c-.39.046-1.242.05-2.003.846C2.395 6.623 2.2 8 2.2 8S2 9.62 2 11.24v1.517c0 1.618.2 3.237.2 3.237s.195 1.378.795 1.985c.76.797 1.76.77 2.205.855 1.6.153 6.8.2 6.8.2s4.203-.005 7-.208c.392-.047 1.244-.05 2.005-.847.6-.607.795-1.985.795-1.985s.2-1.618.2-3.237v-1.517C22 9.62 21.8 8 21.8 8zM9.935 14.595v-5.62l5.403 2.82-5.403 2.8z"
}))
};
const embedFacebookIcon = {
foreground: '#3b5998',
src: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M20 3H4c-.6 0-1 .4-1 1v16c0 .5.4 1 1 1h8.6v-7h-2.3v-2.7h2.3v-2c0-2.3 1.4-3.6 3.5-3.6 1 0 1.8.1 2.1.1v2.4h-1.4c-1.1 0-1.3.5-1.3 1.3v1.7h2.7l-.4 2.8h-2.3v7H20c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1z"
}))
};
const embedInstagramIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.G, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M12 4.622c2.403 0 2.688.01 3.637.052.877.04 1.354.187 1.67.31.42.163.72.358 1.036.673.315.315.51.615.673 1.035.123.317.27.794.31 1.67.043.95.052 1.235.052 3.638s-.01 2.688-.052 3.637c-.04.877-.187 1.354-.31 1.67-.163.42-.358.72-.673 1.036-.315.315-.615.51-1.035.673-.317.123-.794.27-1.67.31-.95.043-1.234.052-3.638.052s-2.688-.01-3.637-.052c-.877-.04-1.354-.187-1.67-.31-.42-.163-.72-.358-1.036-.673-.315-.315-.51-.615-.673-1.035-.123-.317-.27-.794-.31-1.67-.043-.95-.052-1.235-.052-3.638s.01-2.688.052-3.637c.04-.877.187-1.354.31-1.67.163-.42.358-.72.673-1.036.315-.315.615-.51 1.035-.673.317-.123.794-.27 1.67-.31.95-.043 1.235-.052 3.638-.052M12 3c-2.444 0-2.75.01-3.71.054s-1.613.196-2.185.418c-.592.23-1.094.538-1.594 1.04-.5.5-.807 1-1.037 1.593-.223.572-.375 1.226-.42 2.184C3.01 9.25 3 9.555 3 12s.01 2.75.054 3.71.196 1.613.418 2.186c.23.592.538 1.094 1.038 1.594s1.002.808 1.594 1.038c.572.222 1.227.375 2.185.418.96.044 1.266.054 3.71.054s2.75-.01 3.71-.054 1.613-.196 2.186-.418c.592-.23 1.094-.538 1.594-1.038s.808-1.002 1.038-1.594c.222-.572.375-1.227.418-2.185.044-.96.054-1.266.054-3.71s-.01-2.75-.054-3.71-.196-1.613-.418-2.186c-.23-.592-.538-1.094-1.038-1.594s-1.002-.808-1.594-1.038c-.572-.222-1.227-.375-2.185-.418C14.75 3.01 14.445 3 12 3zm0 4.378c-2.552 0-4.622 2.07-4.622 4.622s2.07 4.622 4.622 4.622 4.622-2.07 4.622-4.622S14.552 7.378 12 7.378zM12 15c-1.657 0-3-1.343-3-3s1.343-3 3-3 3 1.343 3 3-1.343 3-3 3zm4.804-8.884c-.596 0-1.08.484-1.08 1.08s.484 1.08 1.08 1.08c.596 0 1.08-.484 1.08-1.08s-.483-1.08-1.08-1.08z"
})));
const embedWordPressIcon = {
foreground: '#0073AA',
src: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.G, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M12.158 12.786l-2.698 7.84c.806.236 1.657.365 2.54.365 1.047 0 2.05-.18 2.986-.51-.024-.037-.046-.078-.065-.123l-2.762-7.57zM3.008 12c0 3.56 2.07 6.634 5.068 8.092L3.788 8.342c-.5 1.117-.78 2.354-.78 3.658zm15.06-.454c0-1.112-.398-1.88-.74-2.48-.456-.74-.883-1.368-.883-2.11 0-.825.627-1.595 1.51-1.595.04 0 .078.006.116.008-1.598-1.464-3.73-2.36-6.07-2.36-3.14 0-5.904 1.613-7.512 4.053.21.008.41.012.58.012.94 0 2.395-.114 2.395-.114.484-.028.54.684.057.74 0 0-.487.058-1.03.086l3.275 9.74 1.968-5.902-1.4-3.838c-.485-.028-.944-.085-.944-.085-.486-.03-.43-.77.056-.742 0 0 1.484.114 2.368.114.94 0 2.397-.114 2.397-.114.486-.028.543.684.058.74 0 0-.488.058-1.03.086l3.25 9.665.897-2.997c.456-1.17.684-2.137.684-2.907zm1.82-3.86c.04.286.06.593.06.924 0 .912-.17 1.938-.683 3.22l-2.746 7.94c2.672-1.558 4.47-4.454 4.47-7.77 0-1.564-.4-3.033-1.1-4.314zM12 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10z"
})))
};
const embedSpotifyIcon = {
foreground: '#1db954',
src: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2m4.586 14.424c-.18.295-.563.387-.857.207-2.35-1.434-5.305-1.76-8.786-.963-.335.077-.67-.133-.746-.47-.077-.334.132-.67.47-.745 3.808-.87 7.076-.496 9.712 1.115.293.18.386.563.206.857M17.81 13.7c-.226.367-.706.482-1.072.257-2.687-1.652-6.785-2.13-9.965-1.166-.413.127-.848-.106-.973-.517-.125-.413.108-.848.52-.973 3.632-1.102 8.147-.568 11.234 1.328.366.226.48.707.256 1.072m.105-2.835C14.692 8.95 9.375 8.775 6.297 9.71c-.493.15-1.016-.13-1.166-.624-.148-.495.13-1.017.625-1.167 3.532-1.073 9.404-.866 13.115 1.337.445.264.59.838.327 1.282-.264.443-.838.59-1.282.325"
}))
};
const embedFlickrIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "m6.5 7c-2.75 0-5 2.25-5 5s2.25 5 5 5 5-2.25 5-5-2.25-5-5-5zm11 0c-2.75 0-5 2.25-5 5s2.25 5 5 5 5-2.25 5-5-2.25-5-5-5z"
}));
const embedVimeoIcon = {
foreground: '#1ab7ea',
src: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.G, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M22.396 7.164c-.093 2.026-1.507 4.8-4.245 8.32C15.323 19.16 12.93 21 10.97 21c-1.214 0-2.24-1.12-3.08-3.36-.56-2.052-1.118-4.105-1.68-6.158-.622-2.24-1.29-3.36-2.004-3.36-.156 0-.7.328-1.634.98l-.978-1.26c1.027-.903 2.04-1.806 3.037-2.71C6 3.95 7.03 3.328 7.716 3.265c1.62-.156 2.616.95 2.99 3.32.404 2.558.685 4.148.84 4.77.468 2.12.982 3.18 1.543 3.18.435 0 1.09-.687 1.963-2.064.872-1.376 1.34-2.422 1.402-3.142.125-1.187-.343-1.782-1.4-1.782-.5 0-1.013.115-1.542.34 1.023-3.35 2.977-4.976 5.862-4.883 2.14.063 3.148 1.45 3.024 4.16z"
})))
};
const embedRedditIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M22 12.068a2.184 2.184 0 0 0-2.186-2.186c-.592 0-1.13.233-1.524.609-1.505-1.075-3.566-1.774-5.86-1.864l1.004-4.695 3.261.699A1.56 1.56 0 1 0 18.255 3c-.61-.001-1.147.357-1.398.877l-3.638-.77a.382.382 0 0 0-.287.053.348.348 0 0 0-.161.251l-1.112 5.233c-2.33.072-4.426.77-5.95 1.864a2.201 2.201 0 0 0-1.523-.61 2.184 2.184 0 0 0-.896 4.176c-.036.215-.053.43-.053.663 0 3.37 3.924 6.111 8.763 6.111s8.763-2.724 8.763-6.11c0-.216-.017-.449-.053-.664A2.207 2.207 0 0 0 22 12.068Zm-15.018 1.56a1.56 1.56 0 0 1 3.118 0c0 .86-.699 1.558-1.559 1.558-.86.018-1.559-.699-1.559-1.559Zm8.728 4.139c-1.076 1.075-3.119 1.147-3.71 1.147-.61 0-2.652-.09-3.71-1.147a.4.4 0 0 1 0-.573.4.4 0 0 1 .574 0c.68.68 2.114.914 3.136.914 1.022 0 2.473-.233 3.136-.914a.4.4 0 0 1 .574 0 .436.436 0 0 1 0 .573Zm-.287-2.563a1.56 1.56 0 0 1 0-3.118c.86 0 1.56.699 1.56 1.56 0 .841-.7 1.558-1.56 1.558Z"
}));
const embedTumblrIcon = {
foreground: '#35465c',
src: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M19 3H5a2 2 0 00-2 2v14c0 1.1.9 2 2 2h14a2 2 0 002-2V5a2 2 0 00-2-2zm-5.69 14.66c-2.72 0-3.1-1.9-3.1-3.16v-3.56H8.49V8.99c1.7-.62 2.54-1.99 2.64-2.87 0-.06.06-.41.06-.58h1.9v3.1h2.17v2.3h-2.18v3.1c0 .47.13 1.3 1.2 1.26h1.1v2.36c-1.01.02-2.07 0-2.07 0z"
}))
};
const embedAmazonIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M18.42 14.58c-.51-.66-1.05-1.23-1.05-2.5V7.87c0-1.8.15-3.45-1.2-4.68-1.05-1.02-2.79-1.35-4.14-1.35-2.6 0-5.52.96-6.12 4.14-.06.36.18.54.4.57l2.66.3c.24-.03.42-.27.48-.5.24-1.12 1.17-1.63 2.2-1.63.56 0 1.22.21 1.55.7.4.56.33 1.31.33 1.97v.36c-1.59.18-3.66.27-5.16.93a4.63 4.63 0 0 0-2.93 4.44c0 2.82 1.8 4.23 4.1 4.23 1.95 0 3.03-.45 4.53-1.98.51.72.66 1.08 1.59 1.83.18.09.45.09.63-.1v.04l2.1-1.8c.24-.21.2-.48.03-.75zm-5.4-1.2c-.45.75-1.14 1.23-1.92 1.23-1.05 0-1.65-.81-1.65-1.98 0-2.31 2.1-2.73 4.08-2.73v.6c0 1.05.03 1.92-.5 2.88z"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M21.69 19.2a17.62 17.62 0 0 1-21.6-1.57c-.23-.2 0-.5.28-.33a23.88 23.88 0 0 0 20.93 1.3c.45-.19.84.3.39.6z"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M22.8 17.96c-.36-.45-2.22-.2-3.1-.12-.23.03-.3-.18-.05-.36 1.5-1.05 3.96-.75 4.26-.39.3.36-.1 2.82-1.5 4.02-.21.18-.42.1-.3-.15.3-.8 1.02-2.58.69-3z"
}));
const embedAnimotoIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "m.0206909 21 19.8160091-13.07806 3.5831 6.20826z",
fill: "#4bc7ee"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "m23.7254 19.0205-10.1074-17.18468c-.6421-1.114428-1.7087-1.114428-2.3249 0l-11.2931 19.16418h22.5655c1.279 0 1.8019-.8905 1.1599-1.9795z",
fill: "#d4cdcb"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "m.0206909 21 15.2439091-16.38571 4.3029 7.32271z",
fill: "#c3d82e"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "m13.618 1.83582c-.6421-1.114428-1.7087-1.114428-2.3249 0l-11.2931 19.16418 15.2646-16.38573z",
fill: "#e4ecb0"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "m.0206909 21 19.5468091-9.063 1.6621 2.8344z",
fill: "#209dbd"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "m.0206909 21 17.9209091-11.82623 1.6259 2.76323z",
fill: "#7cb3c9"
}));
const embedDailymotionIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M11.903 16.568c-1.82 0-3.124-1.281-3.124-2.967a2.987 2.987 0 0 1 2.989-2.989c1.663 0 2.944 1.304 2.944 3.034 0 1.663-1.281 2.922-2.81 2.922ZM17.997 3l-3.308.73v5.107c-.809-1.034-2.045-1.37-3.505-1.37-1.529 0-2.9.561-4.023 1.662-1.259 1.214-1.933 2.764-1.933 4.495 0 1.888.72 3.506 2.113 4.742 1.056.944 2.314 1.415 3.775 1.415 1.438 0 2.517-.382 3.573-1.415v1.415h3.308V3Z",
fill: "#333436"
}));
const embedPinterestIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M12.289,2C6.617,2,3.606,5.648,3.606,9.622c0,1.846,1.025,4.146,2.666,4.878c0.25,0.111,0.381,0.063,0.439-0.169 c0.044-0.175,0.267-1.029,0.365-1.428c0.032-0.128,0.017-0.237-0.091-0.362C6.445,11.911,6.01,10.75,6.01,9.668 c0-2.777,2.194-5.464,5.933-5.464c3.23,0,5.49,2.108,5.49,5.122c0,3.407-1.794,5.768-4.13,5.768c-1.291,0-2.257-1.021-1.948-2.277 c0.372-1.495,1.089-3.112,1.089-4.191c0-0.967-0.542-1.775-1.663-1.775c-1.319,0-2.379,1.309-2.379,3.059 c0,1.115,0.394,1.869,0.394,1.869s-1.302,5.279-1.54,6.261c-0.405,1.666,0.053,4.368,0.094,4.604 c0.021,0.126,0.167,0.169,0.25,0.063c0.129-0.165,1.699-2.419,2.142-4.051c0.158-0.59,0.817-2.995,0.817-2.995 c0.43,0.784,1.681,1.446,3.013,1.446c3.963,0,6.822-3.494,6.822-7.833C20.394,5.112,16.849,2,12.289,2"
}));
const embedWolframIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
viewBox: "0 0 44 44"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M32.59521,22.001l4.31885-4.84473-6.34131-1.38379.646-6.459-5.94336,2.61035L22,6.31934l-3.27344,5.60351L12.78418,9.3125l.645,6.458L7.08643,17.15234,11.40479,21.999,7.08594,26.84375l6.34131,1.38379-.64551,6.458,5.94287-2.60938L22,37.68066l3.27344-5.60351,5.94287,2.61035-.64551-6.458,6.34277-1.38183Zm.44385,2.75244L30.772,23.97827l-1.59558-2.07391,1.97888.735Zm-8.82147,6.1579L22.75,33.424V30.88977l1.52228-2.22168ZM18.56226,13.48816,19.819,15.09534l-2.49219-.88642L15.94037,12.337Zm6.87719.00116,2.62043-1.15027-1.38654,1.86981L24.183,15.0946Zm3.59357,2.6029-1.22546,1.7381.07525-2.73486,1.44507-1.94867ZM22,29.33008l-2.16406-3.15686L22,23.23688l2.16406,2.93634Zm-4.25458-9.582-.10528-3.836,3.60986,1.284v3.73242Zm5.00458-2.552,3.60986-1.284-.10528,3.836L22.75,20.92853Zm-7.78174-1.10559-.29352-2.94263,1.44245,1.94739.07519,2.73321Zm2.30982,5.08319,3.50817,1.18164-2.16247,2.9342-3.678-1.08447Zm2.4486,7.49285L21.25,30.88977v2.53485L19.78052,30.91Zm3.48707-6.31121,3.50817-1.18164,2.33228,3.03137-3.678,1.08447Zm10.87219-4.28113-2.714,3.04529L28.16418,19.928l1.92176-2.72565ZM24.06036,12.81769l-2.06012,2.6322-2.059-2.63318L22,9.292ZM9.91455,18.07227l4.00079-.87195,1.921,2.72735-3.20794,1.19019Zm2.93024,4.565,1.9801-.73462L13.228,23.97827l-2.26838.77429Zm-1.55591,3.58819L13.701,25.4021l2.64935.78058-2.14447.67853Zm3.64868,1.977L18.19,27.17334l.08313,3.46332L14.52979,32.2793Zm10.7876,2.43549.08447-3.464,3.25165,1.03052.407,4.07684Zm4.06824-3.77478-2.14545-.68,2.65063-.781,2.41266.825Z"
}));
const embedPocketCastsIcon = {
foreground: '#f43e37',
src: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M24,12A12,12,0,1,1,12,0,12,12,0,0,1,24,12Z"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M2.67,12a9.33,9.33,0,0,1,18.66,0H19a7,7,0,1,0-7,7v2.33A9.33,9.33,0,0,1,2.67,12ZM12,17.6A5.6,5.6,0,1,1,17.6,12h-2A3.56,3.56,0,1,0,12,15.56Z",
fill: "#fff"
}))
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/embed-loading.js
/**
* WordPress dependencies
*/
const EmbedLoading = () => (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-embed is-loading"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null));
/* harmony default export */ const embed_loading = (EmbedLoading);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/embed-placeholder.js
/**
* WordPress dependencies
*/
const EmbedPlaceholder = ({
icon,
label,
value,
onSubmit,
onChange,
cannotEmbed,
fallback,
tryAgain
}) => {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: icon,
showColors: true
}),
label: label,
className: "wp-block-embed",
instructions: (0,external_wp_i18n_namespaceObject.__)('Paste a link to the content you want to display on your site.')
}, (0,external_React_namespaceObject.createElement)("form", {
onSubmit: onSubmit
}, (0,external_React_namespaceObject.createElement)("input", {
type: "url",
value: value || '',
className: "components-placeholder__input",
"aria-label": label,
placeholder: (0,external_wp_i18n_namespaceObject.__)('Enter URL to embed here…'),
onChange: onChange
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
type: "submit"
}, (0,external_wp_i18n_namespaceObject._x)('Embed', 'button label'))), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-embed__learn-more"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/embeds/')
}, (0,external_wp_i18n_namespaceObject.__)('Learn more about embeds'))), cannotEmbed && (0,external_React_namespaceObject.createElement)("div", {
className: "components-placeholder__error"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "components-placeholder__instructions"
}, (0,external_wp_i18n_namespaceObject.__)('Sorry, this content could not be embedded.')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "secondary",
onClick: tryAgain
}, (0,external_wp_i18n_namespaceObject._x)('Try again', 'button label')), ' ', (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "secondary",
onClick: fallback
}, (0,external_wp_i18n_namespaceObject._x)('Convert to link', 'button label'))));
};
/* harmony default export */ const embed_placeholder = (EmbedPlaceholder);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/wp-embed-preview.js
/**
* WordPress dependencies
*/
/** @typedef {import('react').SyntheticEvent} SyntheticEvent */
const attributeMap = {
class: 'className',
frameborder: 'frameBorder',
marginheight: 'marginHeight',
marginwidth: 'marginWidth'
};
function WpEmbedPreview({
html
}) {
const ref = (0,external_wp_element_namespaceObject.useRef)();
const props = (0,external_wp_element_namespaceObject.useMemo)(() => {
const doc = new window.DOMParser().parseFromString(html, 'text/html');
const iframe = doc.querySelector('iframe');
const iframeProps = {};
if (!iframe) return iframeProps;
Array.from(iframe.attributes).forEach(({
name,
value
}) => {
if (name === 'style') return;
iframeProps[attributeMap[name] || name] = value;
});
return iframeProps;
}, [html]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
const {
ownerDocument
} = ref.current;
const {
defaultView
} = ownerDocument;
/**
* Checks for WordPress embed events signaling the height change when
* iframe content loads or iframe's window is resized. The event is
* sent from WordPress core via the window.postMessage API.
*
* References:
* window.postMessage:
* https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
* WordPress core embed-template on load:
* https://github.com/WordPress/WordPress/blob/HEAD/wp-includes/js/wp-embed-template.js#L143
* WordPress core embed-template on resize:
* https://github.com/WordPress/WordPress/blob/HEAD/wp-includes/js/wp-embed-template.js#L187
*
* @param {MessageEvent} event Message event.
*/
function resizeWPembeds({
data: {
secret,
message,
value
} = {}
}) {
if (message !== 'height' || secret !== props['data-secret']) {
return;
}
ref.current.height = value;
}
defaultView.addEventListener('message', resizeWPembeds);
return () => {
defaultView.removeEventListener('message', resizeWPembeds);
};
}, []);
return (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-embed__wrapper"
}, (0,external_React_namespaceObject.createElement)("iframe", {
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_compose_namespaceObject.useFocusableIframe)()]),
title: props.title,
...props
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/embed-preview.js
/**
* Internal dependencies
*/
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
class EmbedPreview extends external_wp_element_namespaceObject.Component {
constructor() {
super(...arguments);
this.hideOverlay = this.hideOverlay.bind(this);
this.state = {
interactive: false
};
}
static getDerivedStateFromProps(nextProps, state) {
if (!nextProps.isSelected && state.interactive) {
// We only want to change this when the block is not selected, because changing it when
// the block becomes selected makes the overlap disappear too early. Hiding the overlay
// happens on mouseup when the overlay is clicked.
return {
interactive: false
};
}
return null;
}
hideOverlay() {
// This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop
// changing, because that happens on mouse down, and the overlay immediately disappears,
// and the mouse event can end up in the preview content. We can't use onClick on
// the overlay to hide it either, because then the editor misses the mouseup event, and
// thinks we're multi-selecting blocks.
this.setState({
interactive: true
});
}
render() {
const {
preview,
previewable,
url,
type,
caption,
onCaptionChange,
isSelected,
className,
icon,
label,
insertBlocksAfter
} = this.props;
const {
scripts
} = preview;
const {
interactive
} = this.state;
const html = 'photo' === type ? getPhotoHtml(preview) : preview.html;
const parsedHost = new URL(url).host.split('.');
const parsedHostBaseUrl = parsedHost.splice(parsedHost.length - 2, parsedHost.length - 1).join('.');
const iframeTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: host providing embed content e.g: www.youtube.com
(0,external_wp_i18n_namespaceObject.__)('Embedded content from %s'), parsedHostBaseUrl);
const sandboxClassnames = dedupe_default()(type, className, 'wp-block-embed__wrapper');
// Disabled because the overlay div doesn't actually have a role or functionality
// as far as the user is concerned. We're just catching the first click so that
// the block can be selected without interacting with the embed preview that the overlay covers.
/* eslint-disable jsx-a11y/no-static-element-interactions */
const embedWrapper = 'wp-embed' === type ? (0,external_React_namespaceObject.createElement)(WpEmbedPreview, {
html: html
}) : (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-embed__wrapper"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SandBox, {
html: html,
scripts: scripts,
title: iframeTitle,
type: sandboxClassnames,
onFocus: this.hideOverlay
}), !interactive && (0,external_React_namespaceObject.createElement)("div", {
className: "block-library-embed__interactive-overlay",
onMouseUp: this.hideOverlay
}));
/* eslint-enable jsx-a11y/no-static-element-interactions */
return (0,external_React_namespaceObject.createElement)("figure", {
className: dedupe_default()(className, 'wp-block-embed', {
'is-type-video': 'video' === type
})
}, previewable ? embedWrapper : (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: icon,
showColors: true
}),
label: label
}, (0,external_React_namespaceObject.createElement)("p", {
className: "components-placeholder__error"
}, (0,external_React_namespaceObject.createElement)("a", {
href: url
}, url)), (0,external_React_namespaceObject.createElement)("p", {
className: "components-placeholder__error"
}, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: host providing embed content e.g: www.youtube.com */
(0,external_wp_i18n_namespaceObject.__)("Embedded content from %s can't be previewed in the editor."), parsedHostBaseUrl))), (!external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) || isSelected) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "caption",
tagName: "figcaption",
className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Add caption'),
value: caption,
onChange: onCaptionChange,
inlineToolbar: true,
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()))
}));
}
}
/* harmony default export */ const embed_preview = (EmbedPreview);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/edit.js
/**
* Internal dependencies
*/
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const EmbedEdit = props => {
const {
attributes: {
providerNameSlug,
previewable,
responsive,
url: attributesUrl
},
attributes,
isSelected,
onReplace,
setAttributes,
insertBlocksAfter,
onFocus
} = props;
const defaultEmbedInfo = {
title: (0,external_wp_i18n_namespaceObject._x)('Embed', 'block title'),
icon: embedContentIcon
};
const {
icon,
title
} = getEmbedInfoByProvider(providerNameSlug) || defaultEmbedInfo;
const [url, setURL] = (0,external_wp_element_namespaceObject.useState)(attributesUrl);
const [isEditingURL, setIsEditingURL] = (0,external_wp_element_namespaceObject.useState)(false);
const {
invalidateResolution
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const {
preview,
fetching,
themeSupportsResponsive,
cannotEmbed
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEmbedPreview,
isPreviewEmbedFallback,
isRequestingEmbedPreview,
getThemeSupports
} = select(external_wp_coreData_namespaceObject.store);
if (!attributesUrl) {
return {
fetching: false,
cannotEmbed: false
};
}
const embedPreview = getEmbedPreview(attributesUrl);
const previewIsFallback = isPreviewEmbedFallback(attributesUrl);
// The external oEmbed provider does not exist. We got no type info and no html.
const badEmbedProvider = embedPreview?.html === false && embedPreview?.type === undefined;
// Some WordPress URLs that can't be embedded will cause the API to return
// a valid JSON response with no HTML and `data.status` set to 404, rather
// than generating a fallback response as other embeds do.
const wordpressCantEmbed = embedPreview?.data?.status === 404;
const validPreview = !!embedPreview && !badEmbedProvider && !wordpressCantEmbed;
return {
preview: validPreview ? embedPreview : undefined,
fetching: isRequestingEmbedPreview(attributesUrl),
themeSupportsResponsive: getThemeSupports()['responsive-embeds'],
cannotEmbed: !validPreview || previewIsFallback
};
}, [attributesUrl]);
/**
* Returns the attributes derived from the preview, merged with the current attributes.
*
* @return {Object} Merged attributes.
*/
const getMergedAttributes = () => getMergedAttributesWithPreview(attributes, preview, title, responsive);
const toggleResponsive = () => {
const {
allowResponsive,
className
} = attributes;
const {
html
} = preview;
const newAllowResponsive = !allowResponsive;
setAttributes({
allowResponsive: newAllowResponsive,
className: getClassNames(html, className, responsive && newAllowResponsive)
});
};
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (preview?.html || !cannotEmbed || fetching) {
return;
}
// At this stage, we're not fetching the preview and know it can't be embedded,
// so try removing any trailing slash, and resubmit.
const newURL = attributesUrl.replace(/\/$/, '');
setURL(newURL);
setIsEditingURL(false);
setAttributes({
url: newURL
});
}, [preview?.html, attributesUrl, cannotEmbed, fetching, setAttributes]);
// Try a different provider in case the embed url is not supported.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!cannotEmbed || fetching || !url) {
return;
}
// Until X provider is supported in WordPress, as a workaround we use Twitter provider.
if ((0,external_wp_url_namespaceObject.getAuthority)(url) === 'x.com') {
const newURL = new URL(url);
newURL.host = 'twitter.com';
setAttributes({
url: newURL.toString()
});
}
}, [url, cannotEmbed, fetching, setAttributes]);
// Handle incoming preview.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (preview && !isEditingURL) {
// When obtaining an incoming preview,
// we set the attributes derived from the preview data.
const mergedAttributes = getMergedAttributes();
setAttributes(mergedAttributes);
if (onReplace) {
const upgradedBlock = createUpgradedEmbedBlock(props, mergedAttributes);
if (upgradedBlock) {
onReplace(upgradedBlock);
}
}
}
}, [preview, isEditingURL]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
if (fetching) {
return (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.View, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(embed_loading, null));
}
// translators: %s: type of embed e.g: "YouTube", "Twitter", etc. "Embed" is used when no specific type exists
const label = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('%s URL'), title);
// No preview, or we can't embed the current URL, or we've clicked the edit button.
const showEmbedPlaceholder = !preview || cannotEmbed || isEditingURL;
if (showEmbedPlaceholder) {
return (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.View, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(embed_placeholder, {
icon: icon,
label: label,
onFocus: onFocus,
onSubmit: event => {
if (event) {
event.preventDefault();
}
// If the embed URL was changed, we need to reset the aspect ratio class.
// To do this we have to remove the existing ratio class so it can be recalculated.
const blockClass = removeAspectRatioClasses(attributes.className);
setIsEditingURL(false);
setAttributes({
url,
className: blockClass
});
},
value: url,
cannotEmbed: cannotEmbed,
onChange: event => setURL(event.target.value),
fallback: () => fallback(url, onReplace),
tryAgain: () => {
invalidateResolution('getEmbedPreview', [url]);
}
}));
}
// Even though we set attributes that get derived from the preview,
// we don't access them directly because for the initial render,
// the `setAttributes` call will not have taken effect. If we're
// rendering responsive content, setting the responsive classes
// after the preview has been rendered can result in unwanted
// clipping or scrollbars. The `getAttributesFromPreview` function
// that `getMergedAttributes` uses is memoized so that we're not
// calculating them on every render.
const {
caption,
type,
allowResponsive,
className: classFromPreview
} = getMergedAttributes();
const className = classnames_default()(classFromPreview, props.className);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(embed_controls, {
showEditButton: preview && !cannotEmbed,
themeSupportsResponsive: themeSupportsResponsive,
blockSupportsResponsive: responsive,
allowResponsive: allowResponsive,
toggleResponsive: toggleResponsive,
switchBackToURLInput: () => setIsEditingURL(true)
}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.View, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(embed_preview, {
preview: preview,
previewable: previewable,
className: className,
url: url,
type: type,
caption: caption,
onCaptionChange: value => setAttributes({
caption: value
}),
isSelected: isSelected,
icon: icon,
label: label,
insertBlocksAfter: insertBlocksAfter
})));
};
/* harmony default export */ const embed_edit = (EmbedEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function embed_save_save({
attributes
}) {
const {
url,
caption,
type,
providerNameSlug
} = attributes;
if (!url) {
return null;
}
const className = dedupe_default()('wp-block-embed', {
[`is-type-${type}`]: type,
[`is-provider-${providerNameSlug}`]: providerNameSlug,
[`wp-block-embed-${providerNameSlug}`]: providerNameSlug
});
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
})
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-embed__wrapper"
}, `\n${url}\n` /* URL needs to be on its own line. */), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'),
tagName: "figcaption",
value: caption
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/transforms.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const transforms_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/embed",
title: "Embed",
category: "embed",
description: "Add a block that displays content pulled from other sites, like Twitter or YouTube.",
textdomain: "default",
attributes: {
url: {
type: "string",
__experimentalRole: "content"
},
caption: {
type: "rich-text",
source: "rich-text",
selector: "figcaption",
__experimentalRole: "content"
},
type: {
type: "string",
__experimentalRole: "content"
},
providerNameSlug: {
type: "string",
__experimentalRole: "content"
},
allowResponsive: {
type: "boolean",
"default": true
},
responsive: {
type: "boolean",
"default": false,
__experimentalRole: "content"
},
previewable: {
type: "boolean",
"default": true,
__experimentalRole: "content"
}
},
supports: {
align: true,
spacing: {
margin: true
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-embed-editor",
style: "wp-block-embed"
};
const {
name: EMBED_BLOCK
} = transforms_metadata;
/**
* Default transforms for generic embeds.
*/
const embed_transforms_transforms = {
from: [{
type: 'raw',
isMatch: node => node.nodeName === 'P' && /^\s*(https?:\/\/\S+)\s*$/i.test(node.textContent) && node.textContent?.match(/https/gi)?.length === 1,
transform: node => {
return (0,external_wp_blocks_namespaceObject.createBlock)(EMBED_BLOCK, {
url: node.textContent.trim()
});
}
}],
to: [{
type: 'block',
blocks: ['core/paragraph'],
isMatch: ({
url
}) => !!url,
transform: ({
url,
caption
}) => {
let value = `<a href="${url}">${url}</a>`;
if (caption?.trim()) {
value += `<br />${caption}`;
}
return (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: value
});
}
}]
};
/* harmony default export */ const embed_transforms = (embed_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/variations.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */
/**
* The embed provider services.
*
* @type {WPBlockVariation[]}
*/
const embed_variations_variations = [{
name: 'twitter',
title: 'Twitter',
icon: embedTwitterIcon,
keywords: ['tweet', (0,external_wp_i18n_namespaceObject.__)('social')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed a tweet.'),
patterns: [/^https?:\/\/(www\.)?twitter\.com\/.+/i],
attributes: {
providerNameSlug: 'twitter',
responsive: true
}
}, {
name: 'youtube',
title: 'YouTube',
icon: embedYouTubeIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('music'), (0,external_wp_i18n_namespaceObject.__)('video')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed a YouTube video.'),
patterns: [/^https?:\/\/((m|www)\.)?youtube\.com\/.+/i, /^https?:\/\/youtu\.be\/.+/i],
attributes: {
providerNameSlug: 'youtube',
responsive: true
}
}, {
// Deprecate Facebook Embed per FB policy
// See: https://developers.facebook.com/docs/plugins/oembed-legacy
name: 'facebook',
title: 'Facebook',
icon: embedFacebookIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('social')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed a Facebook post.'),
scope: ['block'],
patterns: [],
attributes: {
providerNameSlug: 'facebook',
previewable: false,
responsive: true
}
}, {
// Deprecate Instagram per FB policy
// See: https://developers.facebook.com/docs/instagram/oembed-legacy
name: 'instagram',
title: 'Instagram',
icon: embedInstagramIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('image'), (0,external_wp_i18n_namespaceObject.__)('social')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed an Instagram post.'),
scope: ['block'],
patterns: [],
attributes: {
providerNameSlug: 'instagram',
responsive: true
}
}, {
name: 'wordpress',
title: 'WordPress',
icon: embedWordPressIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('post'), (0,external_wp_i18n_namespaceObject.__)('blog')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed a WordPress post.'),
attributes: {
providerNameSlug: 'wordpress'
}
}, {
name: 'soundcloud',
title: 'SoundCloud',
icon: embedAudioIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('music'), (0,external_wp_i18n_namespaceObject.__)('audio')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed SoundCloud content.'),
patterns: [/^https?:\/\/(www\.)?soundcloud\.com\/.+/i],
attributes: {
providerNameSlug: 'soundcloud',
responsive: true
}
}, {
name: 'spotify',
title: 'Spotify',
icon: embedSpotifyIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('music'), (0,external_wp_i18n_namespaceObject.__)('audio')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed Spotify content.'),
patterns: [/^https?:\/\/(open|play)\.spotify\.com\/.+/i],
attributes: {
providerNameSlug: 'spotify',
responsive: true
}
}, {
name: 'flickr',
title: 'Flickr',
icon: embedFlickrIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('image')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed Flickr content.'),
patterns: [/^https?:\/\/(www\.)?flickr\.com\/.+/i, /^https?:\/\/flic\.kr\/.+/i],
attributes: {
providerNameSlug: 'flickr',
responsive: true
}
}, {
name: 'vimeo',
title: 'Vimeo',
icon: embedVimeoIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('video')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed a Vimeo video.'),
patterns: [/^https?:\/\/(www\.)?vimeo\.com\/.+/i],
attributes: {
providerNameSlug: 'vimeo',
responsive: true
}
}, {
name: 'animoto',
title: 'Animoto',
icon: embedAnimotoIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed an Animoto video.'),
patterns: [/^https?:\/\/(www\.)?(animoto|video214)\.com\/.+/i],
attributes: {
providerNameSlug: 'animoto',
responsive: true
}
}, {
name: 'cloudup',
title: 'Cloudup',
icon: embedContentIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed Cloudup content.'),
patterns: [/^https?:\/\/cloudup\.com\/.+/i],
attributes: {
providerNameSlug: 'cloudup',
responsive: true
}
}, {
// Deprecated since CollegeHumor content is now powered by YouTube.
name: 'collegehumor',
title: 'CollegeHumor',
icon: embedVideoIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed CollegeHumor content.'),
scope: ['block'],
patterns: [],
attributes: {
providerNameSlug: 'collegehumor',
responsive: true
}
}, {
name: 'crowdsignal',
title: 'Crowdsignal',
icon: embedContentIcon,
keywords: ['polldaddy', (0,external_wp_i18n_namespaceObject.__)('survey')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed Crowdsignal (formerly Polldaddy) content.'),
patterns: [/^https?:\/\/((.+\.)?polldaddy\.com|poll\.fm|.+\.crowdsignal\.net|.+\.survey\.fm)\/.+/i],
attributes: {
providerNameSlug: 'crowdsignal',
responsive: true
}
}, {
name: 'dailymotion',
title: 'Dailymotion',
icon: embedDailymotionIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('video')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed a Dailymotion video.'),
patterns: [/^https?:\/\/(www\.)?dailymotion\.com\/.+/i],
attributes: {
providerNameSlug: 'dailymotion',
responsive: true
}
}, {
name: 'imgur',
title: 'Imgur',
icon: embedPhotoIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed Imgur content.'),
patterns: [/^https?:\/\/(.+\.)?imgur\.com\/.+/i],
attributes: {
providerNameSlug: 'imgur',
responsive: true
}
}, {
name: 'issuu',
title: 'Issuu',
icon: embedContentIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed Issuu content.'),
patterns: [/^https?:\/\/(www\.)?issuu\.com\/.+/i],
attributes: {
providerNameSlug: 'issuu',
responsive: true
}
}, {
name: 'kickstarter',
title: 'Kickstarter',
icon: embedContentIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed Kickstarter content.'),
patterns: [/^https?:\/\/(www\.)?kickstarter\.com\/.+/i, /^https?:\/\/kck\.st\/.+/i],
attributes: {
providerNameSlug: 'kickstarter',
responsive: true
}
}, {
name: 'mixcloud',
title: 'Mixcloud',
icon: embedAudioIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('music'), (0,external_wp_i18n_namespaceObject.__)('audio')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed Mixcloud content.'),
patterns: [/^https?:\/\/(www\.)?mixcloud\.com\/.+/i],
attributes: {
providerNameSlug: 'mixcloud',
responsive: true
}
}, {
name: 'pocket-casts',
title: 'Pocket Casts',
icon: embedPocketCastsIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('podcast'), (0,external_wp_i18n_namespaceObject.__)('audio')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed a podcast player from Pocket Casts.'),
patterns: [/^https:\/\/pca.st\/\w+/i],
attributes: {
providerNameSlug: 'pocket-casts',
responsive: true
}
}, {
name: 'reddit',
title: 'Reddit',
icon: embedRedditIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed a Reddit thread.'),
patterns: [/^https?:\/\/(www\.)?reddit\.com\/.+/i],
attributes: {
providerNameSlug: 'reddit',
responsive: true
}
}, {
name: 'reverbnation',
title: 'ReverbNation',
icon: embedAudioIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed ReverbNation content.'),
patterns: [/^https?:\/\/(www\.)?reverbnation\.com\/.+/i],
attributes: {
providerNameSlug: 'reverbnation',
responsive: true
}
}, {
name: 'screencast',
title: 'Screencast',
icon: embedVideoIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed Screencast content.'),
patterns: [/^https?:\/\/(www\.)?screencast\.com\/.+/i],
attributes: {
providerNameSlug: 'screencast',
responsive: true
}
}, {
name: 'scribd',
title: 'Scribd',
icon: embedContentIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed Scribd content.'),
patterns: [/^https?:\/\/(www\.)?scribd\.com\/.+/i],
attributes: {
providerNameSlug: 'scribd',
responsive: true
}
}, {
name: 'slideshare',
title: 'Slideshare',
icon: embedContentIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed Slideshare content.'),
patterns: [/^https?:\/\/(.+?\.)?slideshare\.net\/.+/i],
attributes: {
providerNameSlug: 'slideshare',
responsive: true
}
}, {
name: 'smugmug',
title: 'SmugMug',
icon: embedPhotoIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed SmugMug content.'),
patterns: [/^https?:\/\/(.+\.)?smugmug\.com\/.*/i],
attributes: {
providerNameSlug: 'smugmug',
previewable: false,
responsive: true
}
}, {
name: 'speaker-deck',
title: 'Speaker Deck',
icon: embedContentIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed Speaker Deck content.'),
patterns: [/^https?:\/\/(www\.)?speakerdeck\.com\/.+/i],
attributes: {
providerNameSlug: 'speaker-deck',
responsive: true
}
}, {
name: 'tiktok',
title: 'TikTok',
icon: embedVideoIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('video')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed a TikTok video.'),
patterns: [/^https?:\/\/(www\.)?tiktok\.com\/.+/i],
attributes: {
providerNameSlug: 'tiktok',
responsive: true
}
}, {
name: 'ted',
title: 'TED',
icon: embedVideoIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed a TED video.'),
patterns: [/^https?:\/\/(www\.|embed\.)?ted\.com\/.+/i],
attributes: {
providerNameSlug: 'ted',
responsive: true
}
}, {
name: 'tumblr',
title: 'Tumblr',
icon: embedTumblrIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('social')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed a Tumblr post.'),
patterns: [/^https?:\/\/(.+)\.tumblr\.com\/.+/i],
attributes: {
providerNameSlug: 'tumblr',
responsive: true
}
}, {
name: 'videopress',
title: 'VideoPress',
icon: embedVideoIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('video')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed a VideoPress video.'),
patterns: [/^https?:\/\/videopress\.com\/.+/i],
attributes: {
providerNameSlug: 'videopress',
responsive: true
}
}, {
name: 'wordpress-tv',
title: 'WordPress.tv',
icon: embedVideoIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed a WordPress.tv video.'),
patterns: [/^https?:\/\/wordpress\.tv\/.+/i],
attributes: {
providerNameSlug: 'wordpress-tv',
responsive: true
}
}, {
name: 'amazon-kindle',
title: 'Amazon Kindle',
icon: embedAmazonIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('ebook')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed Amazon Kindle content.'),
patterns: [/^https?:\/\/([a-z0-9-]+\.)?(amazon|amzn)(\.[a-z]{2,4})+\/.+/i, /^https?:\/\/(www\.)?(a\.co|z\.cn)\/.+/i],
attributes: {
providerNameSlug: 'amazon-kindle'
}
}, {
name: 'pinterest',
title: 'Pinterest',
icon: embedPinterestIcon,
keywords: [(0,external_wp_i18n_namespaceObject.__)('social'), (0,external_wp_i18n_namespaceObject.__)('bookmark')],
description: (0,external_wp_i18n_namespaceObject.__)('Embed Pinterest pins, boards, and profiles.'),
patterns: [/^https?:\/\/([a-z]{2}|www)\.pinterest\.com(\.(au|mx))?\/.*/i],
attributes: {
providerNameSlug: 'pinterest'
}
}, {
name: 'wolfram-cloud',
title: 'Wolfram',
icon: embedWolframIcon,
description: (0,external_wp_i18n_namespaceObject.__)('Embed Wolfram notebook content.'),
patterns: [/^https?:\/\/(www\.)?wolframcloud\.com\/obj\/.+/i],
attributes: {
providerNameSlug: 'wolfram-cloud',
responsive: true
}
}];
/**
* Add `isActive` function to all `embed` variations, if not defined.
* `isActive` function is used to find a variation match from a created
* Block by providing its attributes.
*/
embed_variations_variations.forEach(variation => {
if (variation.isActive) return;
variation.isActive = (blockAttributes, variationAttributes) => blockAttributes.providerNameSlug === variationAttributes.providerNameSlug;
});
/* harmony default export */ const embed_variations = (embed_variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/deprecated.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const embed_deprecated_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/embed",
title: "Embed",
category: "embed",
description: "Add a block that displays content pulled from other sites, like Twitter or YouTube.",
textdomain: "default",
attributes: {
url: {
type: "string",
__experimentalRole: "content"
},
caption: {
type: "rich-text",
source: "rich-text",
selector: "figcaption",
__experimentalRole: "content"
},
type: {
type: "string",
__experimentalRole: "content"
},
providerNameSlug: {
type: "string",
__experimentalRole: "content"
},
allowResponsive: {
type: "boolean",
"default": true
},
responsive: {
type: "boolean",
"default": false,
__experimentalRole: "content"
},
previewable: {
type: "boolean",
"default": true,
__experimentalRole: "content"
}
},
supports: {
align: true,
spacing: {
margin: true
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-embed-editor",
style: "wp-block-embed"
};
/**
* WordPress dependencies
*/
const {
attributes: embed_deprecated_blockAttributes
} = embed_deprecated_metadata;
// In #41140 support was added to global styles for caption elements which added a `wp-element-caption` classname
// to the embed figcaption element.
const deprecated_v2 = {
attributes: embed_deprecated_blockAttributes,
save({
attributes
}) {
const {
url,
caption,
type,
providerNameSlug
} = attributes;
if (!url) {
return null;
}
const className = classnames_default()('wp-block-embed', {
[`is-type-${type}`]: type,
[`is-provider-${providerNameSlug}`]: providerNameSlug,
[`wp-block-embed-${providerNameSlug}`]: providerNameSlug
});
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
})
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-embed__wrapper"
}, `\n${url}\n` /* URL needs to be on its own line. */), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: caption
}));
}
};
const embed_deprecated_v1 = {
attributes: embed_deprecated_blockAttributes,
save({
attributes: {
url,
caption,
type,
providerNameSlug
}
}) {
if (!url) {
return null;
}
const embedClassName = classnames_default()('wp-block-embed', {
[`is-type-${type}`]: type,
[`is-provider-${providerNameSlug}`]: providerNameSlug
});
return (0,external_React_namespaceObject.createElement)("figure", {
className: embedClassName
}, `\n${url}\n` /* URL needs to be on its own line. */, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: caption
}));
}
};
const embed_deprecated_deprecated = [deprecated_v2, embed_deprecated_v1];
/* harmony default export */ const embed_deprecated = (embed_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/index.js
/**
* Internal dependencies
*/
const embed_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/embed",
title: "Embed",
category: "embed",
description: "Add a block that displays content pulled from other sites, like Twitter or YouTube.",
textdomain: "default",
attributes: {
url: {
type: "string",
__experimentalRole: "content"
},
caption: {
type: "rich-text",
source: "rich-text",
selector: "figcaption",
__experimentalRole: "content"
},
type: {
type: "string",
__experimentalRole: "content"
},
providerNameSlug: {
type: "string",
__experimentalRole: "content"
},
allowResponsive: {
type: "boolean",
"default": true
},
responsive: {
type: "boolean",
"default": false,
__experimentalRole: "content"
},
previewable: {
type: "boolean",
"default": true,
__experimentalRole: "content"
}
},
supports: {
align: true,
spacing: {
margin: true
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-embed-editor",
style: "wp-block-embed"
};
const {
name: embed_name
} = embed_metadata;
const embed_settings = {
icon: embedContentIcon,
edit: embed_edit,
save: embed_save_save,
transforms: embed_transforms,
variations: embed_variations,
deprecated: embed_deprecated
};
const embed_init = () => initBlock({
name: embed_name,
metadata: embed_metadata,
settings: embed_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/file.js
/**
* WordPress dependencies
*/
const file = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"
}));
/* harmony default export */ const library_file = (file);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
// Version of the file block without PR#43050 removing the translated aria-label.
const deprecated_v3 = {
attributes: {
id: {
type: 'number'
},
href: {
type: 'string'
},
fileId: {
type: 'string',
source: 'attribute',
selector: 'a:not([download])',
attribute: 'id'
},
fileName: {
type: 'string',
source: 'html',
selector: 'a:not([download])'
},
textLinkHref: {
type: 'string',
source: 'attribute',
selector: 'a:not([download])',
attribute: 'href'
},
textLinkTarget: {
type: 'string',
source: 'attribute',
selector: 'a:not([download])',
attribute: 'target'
},
showDownloadButton: {
type: 'boolean',
default: true
},
downloadButtonText: {
type: 'string',
source: 'html',
selector: 'a[download]'
},
displayPreview: {
type: 'boolean'
},
previewHeight: {
type: 'number',
default: 600
}
},
supports: {
anchor: true,
align: true
},
save({
attributes
}) {
const {
href,
fileId,
fileName,
textLinkHref,
textLinkTarget,
showDownloadButton,
downloadButtonText,
displayPreview,
previewHeight
} = attributes;
const pdfEmbedLabel = external_wp_blockEditor_namespaceObject.RichText.isEmpty(fileName) ? (0,external_wp_i18n_namespaceObject.__)('PDF embed') : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: filename. */
(0,external_wp_i18n_namespaceObject.__)('Embed of %s.'), fileName);
const hasFilename = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(fileName);
// Only output an `aria-describedby` when the element it's referring to is
// actually rendered.
const describedById = hasFilename ? fileId : undefined;
return href && (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, displayPreview && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("object", {
className: "wp-block-file__embed",
data: href,
type: "application/pdf",
style: {
width: '100%',
height: `${previewHeight}px`
},
"aria-label": pdfEmbedLabel
})), hasFilename && (0,external_React_namespaceObject.createElement)("a", {
id: describedById,
href: textLinkHref,
target: textLinkTarget,
rel: textLinkTarget ? 'noreferrer noopener' : undefined
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: fileName
})), showDownloadButton && (0,external_React_namespaceObject.createElement)("a", {
href: href,
className: classnames_default()('wp-block-file__button', (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('button')),
download: true,
"aria-describedby": describedById
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: downloadButtonText
})));
}
};
// In #41239 the button was made an element button which added a `wp-element-button` classname
// to the download link element.
const file_deprecated_v2 = {
attributes: {
id: {
type: 'number'
},
href: {
type: 'string'
},
fileId: {
type: 'string',
source: 'attribute',
selector: 'a:not([download])',
attribute: 'id'
},
fileName: {
type: 'string',
source: 'html',
selector: 'a:not([download])'
},
textLinkHref: {
type: 'string',
source: 'attribute',
selector: 'a:not([download])',
attribute: 'href'
},
textLinkTarget: {
type: 'string',
source: 'attribute',
selector: 'a:not([download])',
attribute: 'target'
},
showDownloadButton: {
type: 'boolean',
default: true
},
downloadButtonText: {
type: 'string',
source: 'html',
selector: 'a[download]'
},
displayPreview: {
type: 'boolean'
},
previewHeight: {
type: 'number',
default: 600
}
},
supports: {
anchor: true,
align: true
},
save({
attributes
}) {
const {
href,
fileId,
fileName,
textLinkHref,
textLinkTarget,
showDownloadButton,
downloadButtonText,
displayPreview,
previewHeight
} = attributes;
const pdfEmbedLabel = external_wp_blockEditor_namespaceObject.RichText.isEmpty(fileName) ? (0,external_wp_i18n_namespaceObject.__)('PDF embed') : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: filename. */
(0,external_wp_i18n_namespaceObject.__)('Embed of %s.'), fileName);
const hasFilename = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(fileName);
// Only output an `aria-describedby` when the element it's referring to is
// actually rendered.
const describedById = hasFilename ? fileId : undefined;
return href && (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, displayPreview && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("object", {
className: "wp-block-file__embed",
data: href,
type: "application/pdf",
style: {
width: '100%',
height: `${previewHeight}px`
},
"aria-label": pdfEmbedLabel
})), hasFilename && (0,external_React_namespaceObject.createElement)("a", {
id: describedById,
href: textLinkHref,
target: textLinkTarget,
rel: textLinkTarget ? 'noreferrer noopener' : undefined
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: fileName
})), showDownloadButton && (0,external_React_namespaceObject.createElement)("a", {
href: href,
className: "wp-block-file__button",
download: true,
"aria-describedby": describedById
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: downloadButtonText
})));
}
};
// Version of the file block without PR#28062 accessibility fix.
const file_deprecated_v1 = {
attributes: {
id: {
type: 'number'
},
href: {
type: 'string'
},
fileName: {
type: 'string',
source: 'html',
selector: 'a:not([download])'
},
textLinkHref: {
type: 'string',
source: 'attribute',
selector: 'a:not([download])',
attribute: 'href'
},
textLinkTarget: {
type: 'string',
source: 'attribute',
selector: 'a:not([download])',
attribute: 'target'
},
showDownloadButton: {
type: 'boolean',
default: true
},
downloadButtonText: {
type: 'string',
source: 'html',
selector: 'a[download]'
},
displayPreview: {
type: 'boolean'
},
previewHeight: {
type: 'number',
default: 600
}
},
supports: {
anchor: true,
align: true
},
save({
attributes
}) {
const {
href,
fileName,
textLinkHref,
textLinkTarget,
showDownloadButton,
downloadButtonText,
displayPreview,
previewHeight
} = attributes;
const pdfEmbedLabel = external_wp_blockEditor_namespaceObject.RichText.isEmpty(fileName) ? (0,external_wp_i18n_namespaceObject.__)('PDF embed') : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: filename. */
(0,external_wp_i18n_namespaceObject.__)('Embed of %s.'), fileName);
return href && (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, displayPreview && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("object", {
className: "wp-block-file__embed",
data: href,
type: "application/pdf",
style: {
width: '100%',
height: `${previewHeight}px`
},
"aria-label": pdfEmbedLabel
})), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(fileName) && (0,external_React_namespaceObject.createElement)("a", {
href: textLinkHref,
target: textLinkTarget,
rel: textLinkTarget ? 'noreferrer noopener' : undefined
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: fileName
})), showDownloadButton && (0,external_React_namespaceObject.createElement)("a", {
href: href,
className: "wp-block-file__button",
download: true
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: downloadButtonText
})));
}
};
const file_deprecated_deprecated = [deprecated_v3, file_deprecated_v2, file_deprecated_v1];
/* harmony default export */ const file_deprecated = (file_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/inspector.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function FileBlockInspector({
hrefs,
openInNewWindow,
showDownloadButton,
changeLinkDestinationOption,
changeOpenInNewWindow,
changeShowDownloadButton,
displayPreview,
changeDisplayPreview,
previewHeight,
changePreviewHeight
}) {
const {
href,
textLinkHref,
attachmentPage
} = hrefs;
let linkDestinationOptions = [{
value: href,
label: (0,external_wp_i18n_namespaceObject.__)('URL')
}];
if (attachmentPage) {
linkDestinationOptions = [{
value: href,
label: (0,external_wp_i18n_namespaceObject.__)('Media file')
}, {
value: attachmentPage,
label: (0,external_wp_i18n_namespaceObject.__)('Attachment page')
}];
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, href.endsWith('.pdf') && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('PDF settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show inline embed'),
help: displayPreview ? (0,external_wp_i18n_namespaceObject.__)("Note: Most phone and tablet browsers won't display embedded PDFs.") : null,
checked: !!displayPreview,
onChange: changeDisplayPreview
}), displayPreview && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Height in pixels'),
min: MIN_PREVIEW_HEIGHT,
max: Math.max(MAX_PREVIEW_HEIGHT, previewHeight),
value: previewHeight,
onChange: changePreviewHeight
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link to'),
value: textLinkHref,
options: linkDestinationOptions,
onChange: changeLinkDestinationOption
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
checked: openInNewWindow,
onChange: changeOpenInNewWindow
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show download button'),
checked: showDownloadButton,
onChange: changeShowDownloadButton
}))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/utils/index.js
/**
* Uses a combination of user agent matching and feature detection to determine whether
* the current browser supports rendering PDFs inline.
*
* @return {boolean} Whether or not the browser supports inline PDFs.
*/
const browserSupportsPdfs = () => {
// Most mobile devices include "Mobi" in their UA.
if (window.navigator.userAgent.indexOf('Mobi') > -1) {
return false;
}
// Android tablets are the noteable exception.
if (window.navigator.userAgent.indexOf('Android') > -1) {
return false;
}
// iPad pretends to be a Mac.
if (window.navigator.userAgent.indexOf('Macintosh') > -1 && window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2) {
return false;
}
// IE only supports PDFs when there's an ActiveX object available for it.
if (!!(window.ActiveXObject || 'ActiveXObject' in window) && !(createActiveXObject('AcroPDF.PDF') || createActiveXObject('PDF.PdfCtrl'))) {
return false;
}
return true;
};
/**
* Helper function for creating ActiveX objects, catching any errors that are thrown
* when it's generated.
*
* @param {string} type The name of the ActiveX object to create.
* @return {window.ActiveXObject|undefined} The generated ActiveXObject, or null if it failed.
*/
const createActiveXObject = type => {
let ax;
try {
ax = new window.ActiveXObject(type);
} catch (e) {
ax = undefined;
}
return ax;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const MIN_PREVIEW_HEIGHT = 200;
const MAX_PREVIEW_HEIGHT = 2000;
function ClipboardToolbarButton({
text,
disabled
}) {
const {
createNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, () => {
createNotice('info', (0,external_wp_i18n_namespaceObject.__)('Copied URL to clipboard.'), {
isDismissible: true,
type: 'snackbar'
});
});
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
className: "components-clipboard-toolbar-button",
ref: ref,
disabled: disabled
}, (0,external_wp_i18n_namespaceObject.__)('Copy URL'));
}
function FileEdit({
attributes,
isSelected,
setAttributes,
clientId
}) {
const {
id,
fileName,
href,
textLinkHref,
textLinkTarget,
showDownloadButton,
downloadButtonText,
displayPreview,
previewHeight
} = attributes;
const {
getSettings
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const {
media
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({
media: id === undefined ? undefined : select(external_wp_coreData_namespaceObject.store).getMedia(id)
}), [id]);
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const {
toggleSelection
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Upload a file drag-and-dropped into the editor.
if ((0,external_wp_blob_namespaceObject.isBlobURL)(href)) {
const file = (0,external_wp_blob_namespaceObject.getBlobByURL)(href);
getSettings().mediaUpload({
filesList: [file],
onFileChange: ([newMedia]) => onSelectFile(newMedia),
onError: onUploadError
});
(0,external_wp_blob_namespaceObject.revokeBlobURL)(href);
}
if (external_wp_blockEditor_namespaceObject.RichText.isEmpty(downloadButtonText)) {
setAttributes({
downloadButtonText: (0,external_wp_i18n_namespaceObject._x)('Download', 'button label')
});
}
}, []);
function onSelectFile(newMedia) {
if (!newMedia || !newMedia.url) {
return;
}
const isPdf = newMedia.url.endsWith('.pdf');
setAttributes({
href: newMedia.url,
fileName: newMedia.title,
textLinkHref: newMedia.url,
id: newMedia.id,
displayPreview: isPdf ? true : undefined,
previewHeight: isPdf ? 600 : undefined,
fileId: `wp-block-file--media-${clientId}`
});
}
function onUploadError(message) {
setAttributes({
href: undefined
});
createErrorNotice(message, {
type: 'snackbar'
});
}
function changeLinkDestinationOption(newHref) {
// Choose Media File or Attachment Page (when file is in Media Library).
setAttributes({
textLinkHref: newHref
});
}
function changeOpenInNewWindow(newValue) {
setAttributes({
textLinkTarget: newValue ? '_blank' : false
});
}
function changeShowDownloadButton(newValue) {
setAttributes({
showDownloadButton: newValue
});
}
function changeDisplayPreview(newValue) {
setAttributes({
displayPreview: newValue
});
}
function handleOnResizeStop(event, direction, elt, delta) {
toggleSelection(true);
const newHeight = parseInt(previewHeight + delta.height, 10);
setAttributes({
previewHeight: newHeight
});
}
function changePreviewHeight(newValue) {
const newHeight = Math.max(parseInt(newValue, 10), MIN_PREVIEW_HEIGHT);
setAttributes({
previewHeight: newHeight
});
}
const attachmentPage = media && media.link;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()((0,external_wp_blob_namespaceObject.isBlobURL)(href) && (0,external_wp_components_namespaceObject.__unstableGetAnimateClassName)({
type: 'loading'
}), {
'is-transient': (0,external_wp_blob_namespaceObject.isBlobURL)(href)
})
});
const displayPreviewInEditor = browserSupportsPdfs() && displayPreview;
if (!href) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: library_file
}),
labels: {
title: (0,external_wp_i18n_namespaceObject.__)('File'),
instructions: (0,external_wp_i18n_namespaceObject.__)('Upload a file or pick one from your media library.')
},
onSelect: onSelectFile,
onError: onUploadError,
accept: "*"
}));
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(FileBlockInspector, {
hrefs: {
href,
textLinkHref,
attachmentPage
},
openInNewWindow: !!textLinkTarget,
showDownloadButton,
changeLinkDestinationOption,
changeOpenInNewWindow,
changeShowDownloadButton,
displayPreview,
changeDisplayPreview,
previewHeight,
changePreviewHeight
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, {
mediaId: id,
mediaURL: href,
accept: "*",
onSelect: onSelectFile,
onError: onUploadError
}), (0,external_React_namespaceObject.createElement)(ClipboardToolbarButton, {
text: href,
disabled: (0,external_wp_blob_namespaceObject.isBlobURL)(href)
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, displayPreviewInEditor && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ResizableBox, {
size: {
height: previewHeight
},
minHeight: MIN_PREVIEW_HEIGHT,
maxHeight: MAX_PREVIEW_HEIGHT,
minWidth: "100%",
grid: [10, 10],
enable: {
top: false,
right: false,
bottom: true,
left: false,
topRight: false,
bottomRight: false,
bottomLeft: false,
topLeft: false
},
onResizeStart: () => toggleSelection(false),
onResizeStop: handleOnResizeStop,
showHandle: isSelected
}, (0,external_React_namespaceObject.createElement)("object", {
className: "wp-block-file__preview",
data: href,
type: "application/pdf",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Embed of the selected PDF file.')
}), !isSelected && (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-file__preview-overlay"
})), (0,external_React_namespaceObject.createElement)("div", {
className: 'wp-block-file__content-wrapper'
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: "a",
value: fileName,
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write file name…'),
withoutInteractiveFormatting: true,
onChange: text => setAttributes({
fileName: removeAnchorTag(text)
}),
href: textLinkHref
}), showDownloadButton && (0,external_React_namespaceObject.createElement)("div", {
className: 'wp-block-file__button-richtext-wrapper'
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: "div" // Must be block-level or else cursor disappears.
,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Download button text'),
className: classnames_default()('wp-block-file__button', (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('button')),
value: downloadButtonText,
withoutInteractiveFormatting: true,
placeholder: (0,external_wp_i18n_namespaceObject.__)('Add text…'),
onChange: text => setAttributes({
downloadButtonText: removeAnchorTag(text)
})
})))));
}
/* harmony default export */ const file_edit = (FileEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function file_save_save({
attributes
}) {
const {
href,
fileId,
fileName,
textLinkHref,
textLinkTarget,
showDownloadButton,
downloadButtonText,
displayPreview,
previewHeight
} = attributes;
const pdfEmbedLabel = external_wp_blockEditor_namespaceObject.RichText.isEmpty(fileName) ? 'PDF embed' :
// To do: use toPlainText, but we need ensure it's RichTextData. See
// https://github.com/WordPress/gutenberg/pull/56710.
fileName.toString();
const hasFilename = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(fileName);
// Only output an `aria-describedby` when the element it's referring to is
// actually rendered.
const describedById = hasFilename ? fileId : undefined;
return href && (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, displayPreview && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("object", {
className: "wp-block-file__embed",
data: href,
type: "application/pdf",
style: {
width: '100%',
height: `${previewHeight}px`
},
"aria-label": pdfEmbedLabel
})), hasFilename && (0,external_React_namespaceObject.createElement)("a", {
id: describedById,
href: textLinkHref,
target: textLinkTarget,
rel: textLinkTarget ? 'noreferrer noopener' : undefined
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: fileName
})), showDownloadButton && (0,external_React_namespaceObject.createElement)("a", {
href: href,
className: classnames_default()('wp-block-file__button', (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('button')),
download: true,
"aria-describedby": describedById
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: downloadButtonText
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/transforms.js
/**
* WordPress dependencies
*/
const file_transforms_transforms = {
from: [{
type: 'files',
isMatch(files) {
return files.length > 0;
},
// We define a lower priorty (higher number) than the default of 10. This
// ensures that the File block is only created as a fallback.
priority: 15,
transform: files => {
const blocks = [];
files.forEach(file => {
const blobURL = (0,external_wp_blob_namespaceObject.createBlobURL)(file);
// File will be uploaded in componentDidMount()
blocks.push((0,external_wp_blocks_namespaceObject.createBlock)('core/file', {
href: blobURL,
fileName: file.name,
textLinkHref: blobURL
}));
});
return blocks;
}
}, {
type: 'block',
blocks: ['core/audio'],
transform: attributes => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/file', {
href: attributes.src,
fileName: attributes.caption,
textLinkHref: attributes.src,
id: attributes.id,
anchor: attributes.anchor
});
}
}, {
type: 'block',
blocks: ['core/video'],
transform: attributes => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/file', {
href: attributes.src,
fileName: attributes.caption,
textLinkHref: attributes.src,
id: attributes.id,
anchor: attributes.anchor
});
}
}, {
type: 'block',
blocks: ['core/image'],
transform: attributes => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/file', {
href: attributes.url,
fileName: attributes.caption || (0,external_wp_url_namespaceObject.getFilename)(attributes.url),
textLinkHref: attributes.url,
id: attributes.id,
anchor: attributes.anchor
});
}
}],
to: [{
type: 'block',
blocks: ['core/audio'],
isMatch: ({
id
}) => {
if (!id) {
return false;
}
const {
getMedia
} = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store);
const media = getMedia(id);
return !!media && media.mime_type.includes('audio');
},
transform: attributes => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/audio', {
src: attributes.href,
caption: attributes.fileName,
id: attributes.id,
anchor: attributes.anchor
});
}
}, {
type: 'block',
blocks: ['core/video'],
isMatch: ({
id
}) => {
if (!id) {
return false;
}
const {
getMedia
} = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store);
const media = getMedia(id);
return !!media && media.mime_type.includes('video');
},
transform: attributes => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/video', {
src: attributes.href,
caption: attributes.fileName,
id: attributes.id,
anchor: attributes.anchor
});
}
}, {
type: 'block',
blocks: ['core/image'],
isMatch: ({
id
}) => {
if (!id) {
return false;
}
const {
getMedia
} = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store);
const media = getMedia(id);
return !!media && media.mime_type.includes('image');
},
transform: attributes => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', {
url: attributes.href,
caption: attributes.fileName,
id: attributes.id,
anchor: attributes.anchor
});
}
}]
};
/* harmony default export */ const file_transforms = (file_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const file_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/file",
title: "File",
category: "media",
description: "Add a link to a downloadable file.",
keywords: ["document", "pdf", "download"],
textdomain: "default",
attributes: {
id: {
type: "number"
},
href: {
type: "string"
},
fileId: {
type: "string",
source: "attribute",
selector: "a:not([download])",
attribute: "id"
},
fileName: {
type: "rich-text",
source: "rich-text",
selector: "a:not([download])"
},
textLinkHref: {
type: "string",
source: "attribute",
selector: "a:not([download])",
attribute: "href"
},
textLinkTarget: {
type: "string",
source: "attribute",
selector: "a:not([download])",
attribute: "target"
},
showDownloadButton: {
type: "boolean",
"default": true
},
downloadButtonText: {
type: "rich-text",
source: "rich-text",
selector: "a[download]"
},
displayPreview: {
type: "boolean"
},
previewHeight: {
type: "number",
"default": 600
}
},
supports: {
anchor: true,
align: true,
spacing: {
margin: true,
padding: true
},
color: {
gradients: true,
link: true,
text: false,
__experimentalDefaultControls: {
background: true,
link: true
}
},
interactivity: true
},
editorStyle: "wp-block-file-editor",
style: "wp-block-file"
};
const {
name: file_name
} = file_metadata;
const file_settings = {
icon: library_file,
example: {
attributes: {
href: 'https://upload.wikimedia.org/wikipedia/commons/d/dd/Armstrong_Small_Step.ogg',
fileName: (0,external_wp_i18n_namespaceObject._x)('Armstrong_Small_Step', 'Name of the file')
}
},
transforms: file_transforms,
deprecated: file_deprecated,
edit: file_edit,
save: file_save_save
};
const file_init = () => initBlock({
name: file_name,
metadata: file_metadata,
settings: file_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form/utils.js
/**
* WordPress dependencies
*/
const formSubmissionNotificationSuccess = ['core/form-submission-notification', {
type: 'success'
}, [['core/paragraph', {
content: '<mark style="background-color:rgba(0, 0, 0, 0);color:#345C00" class="has-inline-color">' + (0,external_wp_i18n_namespaceObject.__)('Your form has been submitted successfully') + '</mark>'
}]]];
const formSubmissionNotificationError = ['core/form-submission-notification', {
type: 'error'
}, [['core/paragraph', {
content: '<mark style="background-color:rgba(0, 0, 0, 0);color:#CF2E2E" class="has-inline-color">' + (0,external_wp_i18n_namespaceObject.__)('There was an error submitting your form.') + '</mark>'
}]]];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const form_edit_TEMPLATE = [formSubmissionNotificationSuccess, formSubmissionNotificationError, ['core/form-input', {
type: 'text',
label: (0,external_wp_i18n_namespaceObject.__)('Name'),
required: true
}], ['core/form-input', {
type: 'email',
label: (0,external_wp_i18n_namespaceObject.__)('Email'),
required: true
}], ['core/form-input', {
type: 'textarea',
label: (0,external_wp_i18n_namespaceObject.__)('Comment'),
required: true
}], ['core/form-submit-button', {}]];
const form_edit_Edit = ({
attributes,
setAttributes,
clientId
}) => {
const {
action,
method,
email,
submissionMethod
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const {
hasInnerBlocks
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlock
} = select(external_wp_blockEditor_namespaceObject.store);
const block = getBlock(clientId);
return {
hasInnerBlocks: !!(block && block.innerBlocks.length)
};
}, [clientId]);
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: form_edit_TEMPLATE,
renderAppender: hasInnerBlocks ? undefined : external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl
// __nextHasNoMarginBottom
// size={ '__unstable-large' }
, {
label: (0,external_wp_i18n_namespaceObject.__)('Submissions method'),
options: [
// TODO: Allow plugins to add their own submission methods.
{
label: (0,external_wp_i18n_namespaceObject.__)('Send email'),
value: 'email'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('- Custom -'),
value: 'custom'
}],
value: submissionMethod,
onChange: value => setAttributes({
submissionMethod: value
}),
help: submissionMethod === 'custom' ? (0,external_wp_i18n_namespaceObject.__)('Select the method to use for form submissions. Additional options for the "custom" mode can be found in the "Advanced" section.') : (0,external_wp_i18n_namespaceObject.__)('Select the method to use for form submissions.')
}), submissionMethod === 'email' && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
autoComplete: "off",
label: (0,external_wp_i18n_namespaceObject.__)('Email for form submissions'),
value: email,
required: true,
onChange: value => {
setAttributes({
email: value
});
setAttributes({
action: `mailto:${value}`
});
setAttributes({
method: 'post'
});
},
help: (0,external_wp_i18n_namespaceObject.__)('The email address where form submissions will be sent. Separate multiple email addresses with a comma.')
}))), submissionMethod !== 'email' && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Method'),
options: [{
label: 'Get',
value: 'get'
}, {
label: 'Post',
value: 'post'
}],
value: method,
onChange: value => setAttributes({
method: value
}),
help: (0,external_wp_i18n_namespaceObject.__)('Select the method to use for form submissions.')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
autoComplete: "off",
label: (0,external_wp_i18n_namespaceObject.__)('Form action'),
value: action,
onChange: newVal => {
setAttributes({
action: newVal
});
},
help: (0,external_wp_i18n_namespaceObject.__)('The URL where the form should be submitted.')
})), (0,external_React_namespaceObject.createElement)("form", {
...innerBlocksProps,
className: "wp-block-form",
encType: submissionMethod === 'email' ? 'text/plain' : null
}));
};
/* harmony default export */ const form_edit = (form_edit_Edit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form/save.js
/**
* WordPress dependencies
*/
const Save = ({
attributes
}) => {
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save();
const {
submissionMethod
} = attributes;
return (0,external_React_namespaceObject.createElement)("form", {
...blockProps,
className: "wp-block-form",
encType: submissionMethod === 'email' ? 'text/plain' : null
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
};
/* harmony default export */ const form_save = (Save);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form/variations.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const form_variations_variations = [{
name: 'comment-form',
title: (0,external_wp_i18n_namespaceObject.__)('Experimental Comment form'),
description: (0,external_wp_i18n_namespaceObject.__)('A comment form for posts and pages.'),
attributes: {
submissionMethod: 'custom',
action: '{SITE_URL}/wp-comments-post.php',
method: 'post',
anchor: 'comment-form'
},
isDefault: false,
innerBlocks: [['core/form-input', {
type: 'text',
name: 'author',
label: (0,external_wp_i18n_namespaceObject.__)('Name'),
required: true,
visibilityPermissions: 'logged-out'
}], ['core/form-input', {
type: 'email',
name: 'email',
label: (0,external_wp_i18n_namespaceObject.__)('Email'),
required: true,
visibilityPermissions: 'logged-out'
}], ['core/form-input', {
type: 'textarea',
name: 'comment',
label: (0,external_wp_i18n_namespaceObject.__)('Comment'),
required: true,
visibilityPermissions: 'all'
}], ['core/form-submit-button', {}]],
scope: ['inserter', 'transform'],
isActive: blockAttributes => !blockAttributes?.type || blockAttributes?.type === 'text'
}, {
name: 'wp-privacy-form',
title: (0,external_wp_i18n_namespaceObject.__)('Experimental privacy request form'),
keywords: ['GDPR'],
description: (0,external_wp_i18n_namespaceObject.__)('A form to request data exports and/or deletion.'),
attributes: {
submissionMethod: 'custom',
action: '',
method: 'post',
anchor: 'gdpr-form'
},
isDefault: false,
innerBlocks: [formSubmissionNotificationSuccess, formSubmissionNotificationError, ['core/paragraph', {
content: (0,external_wp_i18n_namespaceObject.__)('To request an export or deletion of your personal data on this site, please fill-in the form below. You can define the type of request you wish to perform, and your email address. Once the form is submitted, you will receive a confirmation email with instructions on the next steps.')
}], ['core/form-input', {
type: 'email',
name: 'email',
label: (0,external_wp_i18n_namespaceObject.__)('Enter your email address.'),
required: true,
visibilityPermissions: 'all'
}], ['core/form-input', {
type: 'checkbox',
name: 'export_personal_data',
label: (0,external_wp_i18n_namespaceObject.__)('Request data export'),
required: false,
visibilityPermissions: 'all'
}], ['core/form-input', {
type: 'checkbox',
name: 'remove_personal_data',
label: (0,external_wp_i18n_namespaceObject.__)('Request data deletion'),
required: false,
visibilityPermissions: 'all'
}], ['core/form-submit-button', {}], ['core/form-input', {
type: 'hidden',
name: 'wp-action',
value: 'wp_privacy_send_request'
}], ['core/form-input', {
type: 'hidden',
name: 'wp-privacy-request',
value: '1'
}]],
scope: ['inserter', 'transform'],
isActive: blockAttributes => !blockAttributes?.type || blockAttributes?.type === 'text'
}];
/* harmony default export */ const form_variations = (form_variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form/index.js
/**
* Internal dependencies
*/
const form_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: true,
name: "core/form",
title: "Form",
category: "common",
allowedBlocks: ["core/paragraph", "core/heading", "core/form-input", "core/form-submit-button", "core/form-submission-notification", "core/group", "core/columns"],
description: "A form.",
keywords: ["container", "wrapper", "row", "section"],
textdomain: "default",
icon: "feedback",
attributes: {
submissionMethod: {
type: "string",
"default": "email"
},
method: {
type: "string",
"default": "post"
},
action: {
type: "string"
},
email: {
type: "string"
}
},
supports: {
anchor: true,
className: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalTextDecoration: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalDefaultControls: {
fontSize: true
}
},
__experimentalSelector: "form"
},
viewScript: "file:./view.min.js"
};
/**
* WordPress dependencies
*/
const {
name: form_name
} = form_metadata;
const form_settings = {
edit: form_edit,
save: form_save,
variations: form_variations
};
const form_init = () => {
// Prevent adding forms inside forms.
const DISALLOWED_PARENTS = ['core/form'];
(0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'core/block-library/preventInsertingFormIntoAnotherForm', (canInsert, blockType, rootClientId, {
getBlock,
getBlockParentsByBlockName
}) => {
if (blockType.name !== 'core/form') {
return canInsert;
}
for (const disallowedParentType of DISALLOWED_PARENTS) {
const hasDisallowedParent = getBlock(rootClientId)?.name === disallowedParentType || getBlockParentsByBlockName(rootClientId, disallowedParentType).length;
if (hasDisallowedParent) {
return false;
}
}
return true;
});
return initBlock({
name: form_name,
metadata: form_metadata,
settings: form_settings
});
};
// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
var remove_accents = __webpack_require__(9681);
var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
;// CONCATENATED MODULE: external ["wp","dom"]
const external_wp_dom_namespaceObject = window["wp"]["dom"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form-input/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const getNameFromLabelV1 = content => {
return remove_accents_default()((0,external_wp_dom_namespaceObject.__unstableStripHTML)(content))
// Convert anything that's not a letter or number to a hyphen.
.replace(/[^\p{L}\p{N}]+/gu, '-')
// Convert to lowercase
.toLowerCase()
// Remove any remaining leading or trailing hyphens.
.replace(/(^-+)|(-+$)/g, '');
};
// Version without wrapper div in saved markup
// See: https://github.com/WordPress/gutenberg/pull/56507
const form_input_deprecated_v1 = {
attributes: {
type: {
type: 'string',
default: 'text'
},
name: {
type: 'string'
},
label: {
type: 'string',
default: 'Label',
selector: '.wp-block-form-input__label-content',
source: 'html',
__experimentalRole: 'content'
},
inlineLabel: {
type: 'boolean',
default: false
},
required: {
type: 'boolean',
default: false,
selector: '.wp-block-form-input__input',
source: 'attribute',
attribute: 'required'
},
placeholder: {
type: 'string',
selector: '.wp-block-form-input__input',
source: 'attribute',
attribute: 'placeholder',
__experimentalRole: 'content'
},
value: {
type: 'string',
default: '',
selector: 'input',
source: 'attribute',
attribute: 'value'
},
visibilityPermissions: {
type: 'string',
default: 'all'
}
},
supports: {
className: false,
anchor: true,
reusable: false,
spacing: {
margin: ['top', 'bottom']
},
__experimentalBorder: {
radius: true,
__experimentalSkipSerialization: true,
__experimentalDefaultControls: {
radius: true
}
}
},
save({
attributes
}) {
const {
type,
name,
label,
inlineLabel,
required,
placeholder,
value
} = attributes;
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes);
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetColorClassesAndStyles)(attributes);
const inputStyle = {
...borderProps.style,
...colorProps.style
};
const inputClasses = classnames_default()('wp-block-form-input__input', colorProps.className, borderProps.className);
const TagName = type === 'textarea' ? 'textarea' : 'input';
if ('hidden' === type) {
return (0,external_React_namespaceObject.createElement)("input", {
type: type,
name: name,
value: value
});
}
/* eslint-disable jsx-a11y/label-has-associated-control */
return (0,external_React_namespaceObject.createElement)("label", {
className: classnames_default()('wp-block-form-input__label', {
'is-label-inline': inlineLabel
})
}, (0,external_React_namespaceObject.createElement)("span", {
className: "wp-block-form-input__label-content"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: label
})), (0,external_React_namespaceObject.createElement)(TagName, {
className: inputClasses,
type: 'textarea' === type ? undefined : type,
name: name || getNameFromLabelV1(label),
required: required,
"aria-required": required,
placeholder: placeholder || undefined,
style: inputStyle
}));
/* eslint-enable jsx-a11y/label-has-associated-control */
}
};
const form_input_deprecated_deprecated = [form_input_deprecated_v1];
/* harmony default export */ const form_input_deprecated = (form_input_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form-input/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function InputFieldBlock({
attributes,
setAttributes,
className
}) {
const {
type,
name,
label,
inlineLabel,
required,
placeholder,
value
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const ref = (0,external_wp_element_namespaceObject.useRef)();
const TagName = type === 'textarea' ? 'textarea' : 'input';
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes);
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseColorProps)(attributes);
if (ref.current) {
ref.current.focus();
}
const controls = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, 'hidden' !== type && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Input settings')
}, 'checkbox' !== type && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Inline label'),
checked: inlineLabel,
onChange: newVal => {
setAttributes({
inlineLabel: newVal
});
}
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Required'),
checked: required,
onChange: newVal => {
setAttributes({
required: newVal
});
}
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
autoComplete: "off",
label: (0,external_wp_i18n_namespaceObject.__)('Name'),
value: name,
onChange: newVal => {
setAttributes({
name: newVal
});
},
help: (0,external_wp_i18n_namespaceObject.__)('Affects the "name" atribute of the input element, and is used as a name for the form submission results.')
})));
if ('hidden' === type) {
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, controls, (0,external_React_namespaceObject.createElement)("input", {
type: "hidden",
className: classnames_default()(className, 'wp-block-form-input__input', colorProps.className, borderProps.className),
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Value'),
value: value,
onChange: event => setAttributes({
value: event.target.value
})
}));
}
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, controls, (0,external_React_namespaceObject.createElement)("span", {
className: classnames_default()('wp-block-form-input__label', {
'is-label-inline': inlineLabel || 'checkbox' === type
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: "span",
className: "wp-block-form-input__label-content",
value: label,
onChange: newLabel => setAttributes({
label: newLabel
}),
"aria-label": label ? (0,external_wp_i18n_namespaceObject.__)('Label') : (0,external_wp_i18n_namespaceObject.__)('Empty label'),
"data-empty": label ? false : true,
placeholder: (0,external_wp_i18n_namespaceObject.__)('Type the label for this input')
}), (0,external_React_namespaceObject.createElement)(TagName, {
type: 'textarea' === type ? undefined : type,
className: classnames_default()(className, 'wp-block-form-input__input', colorProps.className, borderProps.className),
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Optional placeholder text')
// We hide the placeholder field's placeholder when there is a value. This
// stops screen readers from reading the placeholder field's placeholder
// which is confusing.
,
placeholder: placeholder ? undefined : (0,external_wp_i18n_namespaceObject.__)('Optional placeholder…'),
value: placeholder,
onChange: event => setAttributes({
placeholder: event.target.value
}),
"aria-required": required,
style: {
...borderProps.style,
...colorProps.style
}
})));
}
/* harmony default export */ const form_input_edit = (InputFieldBlock);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form-input/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Get the name attribute from a content string.
*
* @param {string} content The block content.
*
* @return {string} Returns the slug.
*/
const getNameFromLabel = content => {
return remove_accents_default()((0,external_wp_dom_namespaceObject.__unstableStripHTML)(content))
// Convert anything that's not a letter or number to a hyphen.
.replace(/[^\p{L}\p{N}]+/gu, '-')
// Convert to lowercase
.toLowerCase()
// Remove any remaining leading or trailing hyphens.
.replace(/(^-+)|(-+$)/g, '');
};
function form_input_save_save({
attributes
}) {
const {
type,
name,
label,
inlineLabel,
required,
placeholder,
value
} = attributes;
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes);
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetColorClassesAndStyles)(attributes);
const inputStyle = {
...borderProps.style,
...colorProps.style
};
const inputClasses = classnames_default()('wp-block-form-input__input', colorProps.className, borderProps.className);
const TagName = type === 'textarea' ? 'textarea' : 'input';
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save();
if ('hidden' === type) {
return (0,external_React_namespaceObject.createElement)("input", {
type: type,
name: name,
value: value
});
}
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("label", {
className: classnames_default()('wp-block-form-input__label', {
'is-label-inline': inlineLabel
})
}, (0,external_React_namespaceObject.createElement)("span", {
className: "wp-block-form-input__label-content"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: label
})), (0,external_React_namespaceObject.createElement)(TagName, {
className: inputClasses,
type: 'textarea' === type ? undefined : type,
name: name || getNameFromLabel(label),
required: required,
"aria-required": required,
placeholder: placeholder || undefined,
style: inputStyle
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form-input/variations.js
/**
* WordPress dependencies
*/
const form_input_variations_variations = [{
name: 'text',
title: (0,external_wp_i18n_namespaceObject.__)('Text Input'),
icon: 'edit-page',
description: (0,external_wp_i18n_namespaceObject.__)('A generic text input.'),
attributes: {
type: 'text'
},
isDefault: true,
scope: ['inserter', 'transform'],
isActive: blockAttributes => !blockAttributes?.type || blockAttributes?.type === 'text'
}, {
name: 'textarea',
title: (0,external_wp_i18n_namespaceObject.__)('Textarea Input'),
icon: 'testimonial',
description: (0,external_wp_i18n_namespaceObject.__)('A textarea input to allow entering multiple lines of text.'),
attributes: {
type: 'textarea'
},
isDefault: true,
scope: ['inserter', 'transform'],
isActive: blockAttributes => blockAttributes?.type === 'textarea'
}, {
name: 'checkbox',
title: (0,external_wp_i18n_namespaceObject.__)('Checkbox Input'),
description: (0,external_wp_i18n_namespaceObject.__)('A simple checkbox input.'),
icon: 'forms',
attributes: {
type: 'checkbox',
inlineLabel: true
},
isDefault: true,
scope: ['inserter', 'transform'],
isActive: blockAttributes => blockAttributes?.type === 'checkbox'
}, {
name: 'email',
title: (0,external_wp_i18n_namespaceObject.__)('Email Input'),
icon: 'email',
description: (0,external_wp_i18n_namespaceObject.__)('Used for email addresses.'),
attributes: {
type: 'email'
},
isDefault: true,
scope: ['inserter', 'transform'],
isActive: blockAttributes => blockAttributes?.type === 'email'
}, {
name: 'url',
title: (0,external_wp_i18n_namespaceObject.__)('URL Input'),
icon: 'admin-site',
description: (0,external_wp_i18n_namespaceObject.__)('Used for URLs.'),
attributes: {
type: 'url'
},
isDefault: true,
scope: ['inserter', 'transform'],
isActive: blockAttributes => blockAttributes?.type === 'url'
}, {
name: 'tel',
title: (0,external_wp_i18n_namespaceObject.__)('Telephone Input'),
icon: 'phone',
description: (0,external_wp_i18n_namespaceObject.__)('Used for phone numbers.'),
attributes: {
type: 'tel'
},
isDefault: true,
scope: ['inserter', 'transform'],
isActive: blockAttributes => blockAttributes?.type === 'tel'
}, {
name: 'number',
title: (0,external_wp_i18n_namespaceObject.__)('Number Input'),
icon: 'edit-page',
description: (0,external_wp_i18n_namespaceObject.__)('A numeric input.'),
attributes: {
type: 'number'
},
isDefault: true,
scope: ['inserter', 'transform'],
isActive: blockAttributes => blockAttributes?.type === 'number'
}];
/* harmony default export */ const form_input_variations = (form_input_variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form-input/index.js
/**
* Internal dependencies
*/
const form_input_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: true,
name: "core/form-input",
title: "Input Field",
category: "common",
ancestor: ["core/form"],
description: "The basic building block for forms.",
keywords: ["input", "form"],
textdomain: "default",
icon: "forms",
attributes: {
type: {
type: "string",
"default": "text"
},
name: {
type: "string"
},
label: {
type: "rich-text",
"default": "Label",
selector: ".wp-block-form-input__label-content",
source: "rich-text",
__experimentalRole: "content"
},
inlineLabel: {
type: "boolean",
"default": false
},
required: {
type: "boolean",
"default": false,
selector: ".wp-block-form-input__input",
source: "attribute",
attribute: "required"
},
placeholder: {
type: "string",
selector: ".wp-block-form-input__input",
source: "attribute",
attribute: "placeholder",
__experimentalRole: "content"
},
value: {
type: "string",
"default": "",
selector: "input",
source: "attribute",
attribute: "value"
},
visibilityPermissions: {
type: "string",
"default": "all"
}
},
supports: {
anchor: true,
reusable: false,
spacing: {
margin: ["top", "bottom"]
},
__experimentalBorder: {
radius: true,
__experimentalSkipSerialization: true,
__experimentalDefaultControls: {
radius: true
}
}
},
style: ["wp-block-form-input"]
};
const {
name: form_input_name
} = form_input_metadata;
const form_input_settings = {
deprecated: form_input_deprecated,
edit: form_input_edit,
save: form_input_save_save,
variations: form_input_variations
};
const form_input_init = () => initBlock({
name: form_input_name,
metadata: form_input_metadata,
settings: form_input_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form-submit-button/edit.js
/**
* WordPress dependencies
*/
const form_submit_button_edit_TEMPLATE = [['core/buttons', {}, [['core/button', {
text: (0,external_wp_i18n_namespaceObject.__)('Submit'),
tagName: 'button',
type: 'submit'
}]]]];
const form_submit_button_edit_Edit = () => {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: form_submit_button_edit_TEMPLATE,
templateLock: 'all'
});
return (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-form-submit-wrapper",
...innerBlocksProps
});
};
/* harmony default export */ const form_submit_button_edit = (form_submit_button_edit_Edit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form-submit-button/save.js
/**
* WordPress dependencies
*/
const save_Save = () => {
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save();
return (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-form-submit-wrapper",
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
};
/* harmony default export */ const form_submit_button_save = (save_Save);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form-submit-button/index.js
/**
* Internal dependencies
*/
const form_submit_button_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: true,
name: "core/form-submit-button",
title: "Form Submit Button",
category: "common",
icon: "button",
ancestor: ["core/form"],
allowedBlocks: ["core/buttons", "core/button"],
description: "A submission button for forms.",
keywords: ["submit", "button", "form"],
textdomain: "default",
style: ["wp-block-form-submit-button"]
};
const {
name: form_submit_button_name
} = form_submit_button_metadata;
const form_submit_button_settings = {
edit: form_submit_button_edit,
save: form_submit_button_save
};
const form_submit_button_init = () => initBlock({
name: form_submit_button_name,
metadata: form_submit_button_metadata,
settings: form_submit_button_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/group.js
/**
* WordPress dependencies
*/
const group = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_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 */ const library_group = (group);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form-submission-notification/edit.js
/**
* WordPress dependencies
*/
/**
* External dependencies
*/
const form_submission_notification_edit_TEMPLATE = [['core/paragraph', {
content: (0,external_wp_i18n_namespaceObject.__)("Enter the message you wish displayed for form submission error/success, and select the type of the message (success/error) from the block's options.")
}]];
const form_submission_notification_edit_Edit = ({
attributes,
clientId
}) => {
const {
type
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()('wp-block-form-submission-notification', {
[`form-notification-type-${type}`]: type
})
});
const {
hasInnerBlocks
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlock
} = select(external_wp_blockEditor_namespaceObject.store);
const block = getBlock(clientId);
return {
hasInnerBlocks: !!(block && block.innerBlocks.length)
};
}, [clientId]);
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: form_submission_notification_edit_TEMPLATE,
renderAppender: hasInnerBlocks ? undefined : external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender
});
return (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps,
"data-message-success": (0,external_wp_i18n_namespaceObject.__)('Submission success notification'),
"data-message-error": (0,external_wp_i18n_namespaceObject.__)('Submission error notification')
});
};
/* harmony default export */ const form_submission_notification_edit = (form_submission_notification_edit_Edit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form-submission-notification/save.js
/**
* WordPress dependencies
*/
/**
* External dependencies
*/
function form_submission_notification_save_save({
attributes
}) {
const {
type
} = attributes;
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classnames_default()('wp-block-form-submission-notification', {
[`form-notification-type-${type}`]: type
})
}))
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form-submission-notification/variations.js
/**
* WordPress dependencies
*/
const form_submission_notification_variations_variations = [{
name: 'form-submission-success',
title: (0,external_wp_i18n_namespaceObject.__)('Form Submission Success'),
description: (0,external_wp_i18n_namespaceObject.__)('Success message for form submissions.'),
attributes: {
type: 'success'
},
isDefault: true,
innerBlocks: [['core/paragraph', {
content: (0,external_wp_i18n_namespaceObject.__)('Your form has been submitted successfully.'),
backgroundColor: '#00D084',
textColor: '#000000',
style: {
elements: {
link: {
color: {
text: '#000000'
}
}
}
}
}]],
scope: ['inserter', 'transform'],
isActive: blockAttributes => !blockAttributes?.type || blockAttributes?.type === 'success'
}, {
name: 'form-submission-error',
title: (0,external_wp_i18n_namespaceObject.__)('Form Submission Error'),
description: (0,external_wp_i18n_namespaceObject.__)('Error/failure message for form submissions.'),
attributes: {
type: 'error'
},
isDefault: false,
innerBlocks: [['core/paragraph', {
content: (0,external_wp_i18n_namespaceObject.__)('There was an error submitting your form.'),
backgroundColor: '#CF2E2E',
textColor: '#FFFFFF',
style: {
elements: {
link: {
color: {
text: '#FFFFFF'
}
}
}
}
}]],
scope: ['inserter', 'transform'],
isActive: blockAttributes => !blockAttributes?.type || blockAttributes?.type === 'error'
}];
/* harmony default export */ const form_submission_notification_variations = (form_submission_notification_variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/form-submission-notification/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const form_submission_notification_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: true,
name: "core/form-submission-notification",
title: "Form Submission Notification",
category: "common",
ancestor: ["core/form"],
description: "Provide a notification message after the form has been submitted.",
keywords: ["form", "feedback", "notification", "message"],
textdomain: "default",
icon: "feedback",
attributes: {
type: {
type: "string",
"default": "success"
}
}
};
const {
name: form_submission_notification_name
} = form_submission_notification_metadata;
const form_submission_notification_settings = {
icon: library_group,
edit: form_submission_notification_edit,
save: form_submission_notification_save_save,
variations: form_submission_notification_variations
};
const form_submission_notification_init = () => initBlock({
name: form_submission_notification_name,
metadata: form_submission_notification_metadata,
settings: form_submission_notification_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/gallery.js
/**
* WordPress dependencies
*/
const gallery = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M16.375 4.5H4.625a.125.125 0 0 0-.125.125v8.254l2.859-1.54a.75.75 0 0 1 .68-.016l2.384 1.142 2.89-2.074a.75.75 0 0 1 .874 0l2.313 1.66V4.625a.125.125 0 0 0-.125-.125Zm.125 9.398-2.75-1.975-2.813 2.02a.75.75 0 0 1-.76.067l-2.444-1.17L4.5 14.583v1.792c0 .069.056.125.125.125h11.75a.125.125 0 0 0 .125-.125v-2.477ZM4.625 3C3.728 3 3 3.728 3 4.625v11.75C3 17.273 3.728 18 4.625 18h11.75c.898 0 1.625-.727 1.625-1.625V4.625C18 3.728 17.273 3 16.375 3H4.625ZM20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z",
fillRule: "evenodd",
clipRule: "evenodd"
}));
/* harmony default export */ const library_gallery = (gallery);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/constants.js
const LINK_DESTINATION_NONE = 'none';
const LINK_DESTINATION_MEDIA = 'media';
const LINK_DESTINATION_ATTACHMENT = 'attachment';
const LINK_DESTINATION_MEDIA_WP_CORE = 'file';
const LINK_DESTINATION_ATTACHMENT_WP_CORE = 'post';
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/shared.js
/**
* WordPress dependencies
*/
function defaultColumnsNumber(imageCount) {
return imageCount ? Math.min(3, imageCount) : 3;
}
const pickRelevantMediaFiles = (image, sizeSlug = 'large') => {
const imageProps = Object.fromEntries(Object.entries(image !== null && image !== void 0 ? image : {}).filter(([key]) => ['alt', 'id', 'link'].includes(key)));
imageProps.url = image?.sizes?.[sizeSlug]?.url || image?.media_details?.sizes?.[sizeSlug]?.source_url || image?.url || image?.source_url;
const fullUrl = image?.sizes?.full?.url || image?.media_details?.sizes?.full?.source_url;
if (fullUrl) {
imageProps.fullUrl = fullUrl;
}
return imageProps;
};
function getGalleryBlockV2Enabled() {
// We want to fail early here, at least during beta testing phase, to ensure
// there aren't instances where undefined values cause false negatives.
if (!window.wp || typeof window.wp.galleryBlockV2Enabled !== 'boolean') {
throw 'window.wp.galleryBlockV2Enabled is not defined';
}
return window.wp.galleryBlockV2Enabled;
}
/**
* The new gallery block format is not compatible with the use_BalanceTags option
* in WP versions <= 5.8 https://core.trac.wordpress.org/ticket/54130. The
* window.wp.galleryBlockV2Enabled flag is set in lib/compat.php. This method
* can be removed when minimum supported WP version >=5.9.
*/
function isGalleryV2Enabled() {
if (external_wp_element_namespaceObject.Platform.isNative) {
return getGalleryBlockV2Enabled();
}
return true;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DEPRECATED_LINK_DESTINATION_MEDIA = 'file';
const DEPRECATED_LINK_DESTINATION_ATTACHMENT = 'post';
/**
* Original function to determine default number of columns from a block's
* attributes.
*
* Used in deprecations: v1-6, for versions of the gallery block that didn't use inner blocks.
*
* @param {Object} attributes Block attributes.
* @return {number} Default number of columns for the gallery.
*/
function defaultColumnsNumberV1(attributes) {
return Math.min(3, attributes?.images?.length);
}
/**
* Original function to determine new href and linkDestination values for an image block from the
* supplied Gallery link destination.
*
* Used in deprecations: v1-6.
*
* @param {Object} image Gallery image.
* @param {string} destination Gallery's selected link destination.
* @return {Object} New attributes to assign to image block.
*/
function getHrefAndDestination(image, destination) {
// Need to determine the URL that the selected destination maps to.
// Gutenberg and WordPress use different constants so the new link
// destination also needs to be tweaked.
switch (destination) {
case DEPRECATED_LINK_DESTINATION_MEDIA:
return {
href: image?.source_url || image?.url,
// eslint-disable-line camelcase
linkDestination: LINK_DESTINATION_MEDIA
};
case DEPRECATED_LINK_DESTINATION_ATTACHMENT:
return {
href: image?.link,
linkDestination: LINK_DESTINATION_ATTACHMENT
};
case LINK_DESTINATION_MEDIA:
return {
href: image?.source_url || image?.url,
// eslint-disable-line camelcase
linkDestination: LINK_DESTINATION_MEDIA
};
case LINK_DESTINATION_ATTACHMENT:
return {
href: image?.link,
linkDestination: LINK_DESTINATION_ATTACHMENT
};
case LINK_DESTINATION_NONE:
return {
href: undefined,
linkDestination: LINK_DESTINATION_NONE
};
}
return {};
}
function runV2Migration(attributes) {
let linkTo = attributes.linkTo ? attributes.linkTo : 'none';
if (linkTo === 'post') {
linkTo = 'attachment';
} else if (linkTo === 'file') {
linkTo = 'media';
}
const imageBlocks = attributes.images.map(image => {
return getImageBlock(image, attributes.sizeSlug, linkTo);
});
const {
images,
ids,
...restAttributes
} = attributes;
return [{
...restAttributes,
linkTo,
allowResize: false
}, imageBlocks];
}
/**
* Gets an Image block from gallery image data
*
* Used to migrate Galleries to nested Image InnerBlocks.
*
* @param {Object} image Image properties.
* @param {string} sizeSlug Gallery sizeSlug attribute.
* @param {string} linkTo Gallery linkTo attribute.
* @return {Object} Image block.
*/
function getImageBlock(image, sizeSlug, linkTo) {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', {
...(image.id && {
id: parseInt(image.id)
}),
url: image.url,
alt: image.alt,
caption: image.caption,
sizeSlug,
...getHrefAndDestination(image, linkTo)
});
}
// In #41140 support was added to global styles for caption elements which added a `wp-element-caption` classname
// to the gallery figcaption element.
const deprecated_v7 = {
attributes: {
images: {
type: 'array',
default: [],
source: 'query',
selector: '.blocks-gallery-item',
query: {
url: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src'
},
fullUrl: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'data-full-url'
},
link: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'data-link'
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: ''
},
id: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'data-id'
},
caption: {
type: 'string',
source: 'html',
selector: '.blocks-gallery-item__caption'
}
}
},
ids: {
type: 'array',
items: {
type: 'number'
},
default: []
},
shortCodeTransforms: {
type: 'array',
default: [],
items: {
type: 'object'
}
},
columns: {
type: 'number',
minimum: 1,
maximum: 8
},
caption: {
type: 'string',
source: 'html',
selector: '.blocks-gallery-caption'
},
imageCrop: {
type: 'boolean',
default: true
},
fixedHeight: {
type: 'boolean',
default: true
},
linkTarget: {
type: 'string'
},
linkTo: {
type: 'string'
},
sizeSlug: {
type: 'string',
default: 'large'
},
allowResize: {
type: 'boolean',
default: false
}
},
save({
attributes
}) {
const {
caption,
columns,
imageCrop
} = attributes;
const className = classnames_default()('has-nested-images', {
[`columns-${columns}`]: columns !== undefined,
[`columns-default`]: columns === undefined,
'is-cropped': imageCrop
});
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
});
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
return (0,external_React_namespaceObject.createElement)("figure", {
...innerBlocksProps
}, innerBlocksProps.children, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
className: "blocks-gallery-caption",
value: caption
}));
}
};
const deprecated_v6 = {
attributes: {
images: {
type: 'array',
default: [],
source: 'query',
selector: '.blocks-gallery-item',
query: {
url: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src'
},
fullUrl: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'data-full-url'
},
link: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'data-link'
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: ''
},
id: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'data-id'
},
caption: {
type: 'string',
source: 'html',
selector: '.blocks-gallery-item__caption'
}
}
},
ids: {
type: 'array',
items: {
type: 'number'
},
default: []
},
columns: {
type: 'number',
minimum: 1,
maximum: 8
},
caption: {
type: 'string',
source: 'html',
selector: '.blocks-gallery-caption'
},
imageCrop: {
type: 'boolean',
default: true
},
fixedHeight: {
type: 'boolean',
default: true
},
linkTo: {
type: 'string'
},
sizeSlug: {
type: 'string',
default: 'large'
}
},
supports: {
anchor: true,
align: true
},
save({
attributes
}) {
const {
images,
columns = defaultColumnsNumberV1(attributes),
imageCrop,
caption,
linkTo
} = attributes;
const className = `columns-${columns} ${imageCrop ? 'is-cropped' : ''}`;
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
})
}, (0,external_React_namespaceObject.createElement)("ul", {
className: "blocks-gallery-grid"
}, images.map(image => {
let href;
switch (linkTo) {
case DEPRECATED_LINK_DESTINATION_MEDIA:
href = image.fullUrl || image.url;
break;
case DEPRECATED_LINK_DESTINATION_ATTACHMENT:
href = image.link;
break;
}
const img = (0,external_React_namespaceObject.createElement)("img", {
src: image.url,
alt: image.alt,
"data-id": image.id,
"data-full-url": image.fullUrl,
"data-link": image.link,
className: image.id ? `wp-image-${image.id}` : null
});
return (0,external_React_namespaceObject.createElement)("li", {
key: image.id || image.url,
className: "blocks-gallery-item"
}, (0,external_React_namespaceObject.createElement)("figure", null, href ? (0,external_React_namespaceObject.createElement)("a", {
href: href
}, img) : img, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(image.caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
className: "blocks-gallery-item__caption",
value: image.caption
})));
})), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
className: "blocks-gallery-caption",
value: caption
}));
},
migrate(attributes) {
if (isGalleryV2Enabled()) {
return runV2Migration(attributes);
}
return attributes;
}
};
const deprecated_v5 = {
attributes: {
images: {
type: 'array',
default: [],
source: 'query',
selector: '.blocks-gallery-item',
query: {
url: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src'
},
fullUrl: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'data-full-url'
},
link: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'data-link'
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: ''
},
id: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'data-id'
},
caption: {
type: 'string',
source: 'html',
selector: '.blocks-gallery-item__caption'
}
}
},
ids: {
type: 'array',
items: {
type: 'number'
},
default: []
},
columns: {
type: 'number',
minimum: 1,
maximum: 8
},
caption: {
type: 'string',
source: 'html',
selector: '.blocks-gallery-caption'
},
imageCrop: {
type: 'boolean',
default: true
},
linkTo: {
type: 'string',
default: 'none'
},
sizeSlug: {
type: 'string',
default: 'large'
}
},
supports: {
align: true
},
isEligible({
linkTo
}) {
return !linkTo || linkTo === 'attachment' || linkTo === 'media';
},
migrate(attributes) {
if (isGalleryV2Enabled()) {
return runV2Migration(attributes);
}
let linkTo = attributes.linkTo;
if (!attributes.linkTo) {
linkTo = 'none';
} else if (attributes.linkTo === 'attachment') {
linkTo = 'post';
} else if (attributes.linkTo === 'media') {
linkTo = 'file';
}
return {
...attributes,
linkTo
};
},
save({
attributes
}) {
const {
images,
columns = defaultColumnsNumberV1(attributes),
imageCrop,
caption,
linkTo
} = attributes;
return (0,external_React_namespaceObject.createElement)("figure", {
className: `columns-${columns} ${imageCrop ? 'is-cropped' : ''}`
}, (0,external_React_namespaceObject.createElement)("ul", {
className: "blocks-gallery-grid"
}, images.map(image => {
let href;
switch (linkTo) {
case 'media':
href = image.fullUrl || image.url;
break;
case 'attachment':
href = image.link;
break;
}
const img = (0,external_React_namespaceObject.createElement)("img", {
src: image.url,
alt: image.alt,
"data-id": image.id,
"data-full-url": image.fullUrl,
"data-link": image.link,
className: image.id ? `wp-image-${image.id}` : null
});
return (0,external_React_namespaceObject.createElement)("li", {
key: image.id || image.url,
className: "blocks-gallery-item"
}, (0,external_React_namespaceObject.createElement)("figure", null, href ? (0,external_React_namespaceObject.createElement)("a", {
href: href
}, img) : img, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(image.caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
className: "blocks-gallery-item__caption",
value: image.caption
})));
})), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
className: "blocks-gallery-caption",
value: caption
}));
}
};
const deprecated_v4 = {
attributes: {
images: {
type: 'array',
default: [],
source: 'query',
selector: '.blocks-gallery-item',
query: {
url: {
source: 'attribute',
selector: 'img',
attribute: 'src'
},
fullUrl: {
source: 'attribute',
selector: 'img',
attribute: 'data-full-url'
},
link: {
source: 'attribute',
selector: 'img',
attribute: 'data-link'
},
alt: {
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: ''
},
id: {
source: 'attribute',
selector: 'img',
attribute: 'data-id'
},
caption: {
type: 'string',
source: 'html',
selector: '.blocks-gallery-item__caption'
}
}
},
ids: {
type: 'array',
default: []
},
columns: {
type: 'number'
},
caption: {
type: 'string',
source: 'html',
selector: '.blocks-gallery-caption'
},
imageCrop: {
type: 'boolean',
default: true
},
linkTo: {
type: 'string',
default: 'none'
}
},
supports: {
align: true
},
isEligible({
ids
}) {
return ids && ids.some(id => typeof id === 'string');
},
migrate(attributes) {
var _attributes$ids;
if (isGalleryV2Enabled()) {
return runV2Migration(attributes);
}
return {
...attributes,
ids: ((_attributes$ids = attributes.ids) !== null && _attributes$ids !== void 0 ? _attributes$ids : []).map(id => {
const parsedId = parseInt(id, 10);
return Number.isInteger(parsedId) ? parsedId : null;
})
};
},
save({
attributes
}) {
const {
images,
columns = defaultColumnsNumberV1(attributes),
imageCrop,
caption,
linkTo
} = attributes;
return (0,external_React_namespaceObject.createElement)("figure", {
className: `columns-${columns} ${imageCrop ? 'is-cropped' : ''}`
}, (0,external_React_namespaceObject.createElement)("ul", {
className: "blocks-gallery-grid"
}, images.map(image => {
let href;
switch (linkTo) {
case 'media':
href = image.fullUrl || image.url;
break;
case 'attachment':
href = image.link;
break;
}
const img = (0,external_React_namespaceObject.createElement)("img", {
src: image.url,
alt: image.alt,
"data-id": image.id,
"data-full-url": image.fullUrl,
"data-link": image.link,
className: image.id ? `wp-image-${image.id}` : null
});
return (0,external_React_namespaceObject.createElement)("li", {
key: image.id || image.url,
className: "blocks-gallery-item"
}, (0,external_React_namespaceObject.createElement)("figure", null, href ? (0,external_React_namespaceObject.createElement)("a", {
href: href
}, img) : img, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(image.caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
className: "blocks-gallery-item__caption",
value: image.caption
})));
})), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
className: "blocks-gallery-caption",
value: caption
}));
}
};
const gallery_deprecated_v3 = {
attributes: {
images: {
type: 'array',
default: [],
source: 'query',
selector: 'ul.wp-block-gallery .blocks-gallery-item',
query: {
url: {
source: 'attribute',
selector: 'img',
attribute: 'src'
},
fullUrl: {
source: 'attribute',
selector: 'img',
attribute: 'data-full-url'
},
alt: {
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: ''
},
id: {
source: 'attribute',
selector: 'img',
attribute: 'data-id'
},
link: {
source: 'attribute',
selector: 'img',
attribute: 'data-link'
},
caption: {
type: 'string',
source: 'html',
selector: 'figcaption'
}
}
},
ids: {
type: 'array',
default: []
},
columns: {
type: 'number'
},
imageCrop: {
type: 'boolean',
default: true
},
linkTo: {
type: 'string',
default: 'none'
}
},
supports: {
align: true
},
save({
attributes
}) {
const {
images,
columns = defaultColumnsNumberV1(attributes),
imageCrop,
linkTo
} = attributes;
return (0,external_React_namespaceObject.createElement)("ul", {
className: `columns-${columns} ${imageCrop ? 'is-cropped' : ''}`
}, images.map(image => {
let href;
switch (linkTo) {
case 'media':
href = image.fullUrl || image.url;
break;
case 'attachment':
href = image.link;
break;
}
const img = (0,external_React_namespaceObject.createElement)("img", {
src: image.url,
alt: image.alt,
"data-id": image.id,
"data-full-url": image.fullUrl,
"data-link": image.link,
className: image.id ? `wp-image-${image.id}` : null
});
return (0,external_React_namespaceObject.createElement)("li", {
key: image.id || image.url,
className: "blocks-gallery-item"
}, (0,external_React_namespaceObject.createElement)("figure", null, href ? (0,external_React_namespaceObject.createElement)("a", {
href: href
}, img) : img, image.caption && image.caption.length > 0 && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: image.caption
})));
}));
},
migrate(attributes) {
if (isGalleryV2Enabled()) {
return runV2Migration(attributes);
}
return attributes;
}
};
const gallery_deprecated_v2 = {
attributes: {
images: {
type: 'array',
default: [],
source: 'query',
selector: 'ul.wp-block-gallery .blocks-gallery-item',
query: {
url: {
source: 'attribute',
selector: 'img',
attribute: 'src'
},
alt: {
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: ''
},
id: {
source: 'attribute',
selector: 'img',
attribute: 'data-id'
},
link: {
source: 'attribute',
selector: 'img',
attribute: 'data-link'
},
caption: {
type: 'string',
source: 'html',
selector: 'figcaption'
}
}
},
columns: {
type: 'number'
},
imageCrop: {
type: 'boolean',
default: true
},
linkTo: {
type: 'string',
default: 'none'
}
},
isEligible({
images,
ids
}) {
return images && images.length > 0 && (!ids && images || ids && images && ids.length !== images.length || images.some((id, index) => {
if (!id && ids[index] !== null) {
return true;
}
return parseInt(id, 10) !== ids[index];
}));
},
migrate(attributes) {
var _attributes$images;
if (isGalleryV2Enabled()) {
return runV2Migration(attributes);
}
return {
...attributes,
ids: ((_attributes$images = attributes.images) !== null && _attributes$images !== void 0 ? _attributes$images : []).map(({
id
}) => {
if (!id) {
return null;
}
return parseInt(id, 10);
})
};
},
supports: {
align: true
},
save({
attributes
}) {
const {
images,
columns = defaultColumnsNumberV1(attributes),
imageCrop,
linkTo
} = attributes;
return (0,external_React_namespaceObject.createElement)("ul", {
className: `columns-${columns} ${imageCrop ? 'is-cropped' : ''}`
}, images.map(image => {
let href;
switch (linkTo) {
case 'media':
href = image.url;
break;
case 'attachment':
href = image.link;
break;
}
const img = (0,external_React_namespaceObject.createElement)("img", {
src: image.url,
alt: image.alt,
"data-id": image.id,
"data-link": image.link,
className: image.id ? `wp-image-${image.id}` : null
});
return (0,external_React_namespaceObject.createElement)("li", {
key: image.id || image.url,
className: "blocks-gallery-item"
}, (0,external_React_namespaceObject.createElement)("figure", null, href ? (0,external_React_namespaceObject.createElement)("a", {
href: href
}, img) : img, image.caption && image.caption.length > 0 && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: image.caption
})));
}));
}
};
const gallery_deprecated_v1 = {
attributes: {
images: {
type: 'array',
default: [],
source: 'query',
selector: 'div.wp-block-gallery figure.blocks-gallery-image img',
query: {
url: {
source: 'attribute',
attribute: 'src'
},
alt: {
source: 'attribute',
attribute: 'alt',
default: ''
},
id: {
source: 'attribute',
attribute: 'data-id'
}
}
},
columns: {
type: 'number'
},
imageCrop: {
type: 'boolean',
default: true
},
linkTo: {
type: 'string',
default: 'none'
},
align: {
type: 'string',
default: 'none'
}
},
supports: {
align: true
},
save({
attributes
}) {
const {
images,
columns = defaultColumnsNumberV1(attributes),
align,
imageCrop,
linkTo
} = attributes;
const className = classnames_default()(`columns-${columns}`, {
alignnone: align === 'none',
'is-cropped': imageCrop
});
return (0,external_React_namespaceObject.createElement)("div", {
className: className
}, images.map(image => {
let href;
switch (linkTo) {
case 'media':
href = image.url;
break;
case 'attachment':
href = image.link;
break;
}
const img = (0,external_React_namespaceObject.createElement)("img", {
src: image.url,
alt: image.alt,
"data-id": image.id
});
return (0,external_React_namespaceObject.createElement)("figure", {
key: image.id || image.url,
className: "blocks-gallery-image"
}, href ? (0,external_React_namespaceObject.createElement)("a", {
href: href
}, img) : img);
}));
},
migrate(attributes) {
if (isGalleryV2Enabled()) {
return runV2Migration(attributes);
}
return attributes;
}
};
/* harmony default export */ const gallery_deprecated = ([deprecated_v7, deprecated_v6, deprecated_v5, deprecated_v4, gallery_deprecated_v3, gallery_deprecated_v2, gallery_deprecated_v1]);
;// CONCATENATED MODULE: external ["wp","viewport"]
const external_wp_viewport_namespaceObject = window["wp"]["viewport"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/shared-icon.js
/**
* WordPress dependencies
*/
const sharedIcon = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: library_gallery
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/constants.js
const constants_MIN_SIZE = 20;
const constants_LINK_DESTINATION_NONE = 'none';
const constants_LINK_DESTINATION_MEDIA = 'media';
const constants_LINK_DESTINATION_ATTACHMENT = 'attachment';
const LINK_DESTINATION_CUSTOM = 'custom';
const constants_NEW_TAB_REL = ['noreferrer', 'noopener'];
const constants_ALLOWED_MEDIA_TYPES = ['image'];
const MEDIA_ID_NO_FEATURED_IMAGE_SET = 0;
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/utils.js
/**
* Internal dependencies
*/
/**
* Determines new href and linkDestination values for an Image block from the
* supplied Gallery link destination, or falls back to the Image blocks link.
*
* @param {Object} image Gallery image.
* @param {string} galleryDestination Gallery's selected link destination.
* @param {Object} imageDestination Image blocks attributes.
* @return {Object} New attributes to assign to image block.
*/
function utils_getHrefAndDestination(image, galleryDestination, imageDestination) {
// Gutenberg and WordPress use different constants so if image_default_link_type
// option is set we need to map from the WP Core values.
switch (imageDestination ? imageDestination : galleryDestination) {
case LINK_DESTINATION_MEDIA_WP_CORE:
case LINK_DESTINATION_MEDIA:
return {
href: image?.source_url || image?.url,
// eslint-disable-line camelcase
linkDestination: constants_LINK_DESTINATION_MEDIA
};
case LINK_DESTINATION_ATTACHMENT_WP_CORE:
case LINK_DESTINATION_ATTACHMENT:
return {
href: image?.link,
linkDestination: constants_LINK_DESTINATION_ATTACHMENT
};
case LINK_DESTINATION_NONE:
return {
href: undefined,
linkDestination: constants_LINK_DESTINATION_NONE
};
}
return {};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/utils.js
/**
* Internal dependencies
*/
/**
* Evaluates a CSS aspect-ratio property value as a number.
*
* Degenerate or invalid ratios behave as 'auto'. And 'auto' ratios return NaN.
*
* @see https://drafts.csswg.org/css-sizing-4/#aspect-ratio
*
* @param {string} value CSS aspect-ratio property value.
* @return {number} Numerical aspect ratio or NaN if invalid.
*/
function evalAspectRatio(value) {
const [width, height = 1] = value.split('/').map(Number);
const aspectRatio = width / height;
return aspectRatio === Infinity || aspectRatio === 0 ? NaN : aspectRatio;
}
function removeNewTabRel(currentRel) {
let newRel = currentRel;
if (currentRel !== undefined && newRel) {
constants_NEW_TAB_REL.forEach(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 (!newRel) {
newRel = undefined;
}
}
return newRel;
}
/**
* Helper to get the link target settings to be stored.
*
* @param {boolean} value The new link target value.
* @param {Object} attributes Block attributes.
* @param {Object} attributes.rel Image block's rel attribute.
*
* @return {Object} Updated link target settings.
*/
function getUpdatedLinkTargetSettings(value, {
rel
}) {
const linkTarget = value ? '_blank' : undefined;
let updatedRel;
if (!linkTarget && !rel) {
updatedRel = undefined;
} else {
updatedRel = removeNewTabRel(rel);
}
return {
linkTarget,
rel: updatedRel
};
}
/**
* Determines new Image block attributes size selection.
*
* @param {Object} image Media file object for gallery image.
* @param {string} size Selected size slug to apply.
*/
function getImageSizeAttributes(image, size) {
const url = image?.media_details?.sizes?.[size]?.source_url;
if (url) {
return {
url,
width: undefined,
height: undefined,
sizeSlug: size
};
}
return {};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/gallery.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Gallery(props) {
const {
attributes,
isSelected,
setAttributes,
mediaPlaceholder,
insertBlocksAfter,
blockProps,
__unstableLayoutClassNames: layoutClassNames,
isContentLocked,
multiGallerySelection
} = props;
const {
align,
columns,
imageCrop
} = attributes;
return (0,external_React_namespaceObject.createElement)("figure", {
...blockProps,
className: classnames_default()(blockProps.className, layoutClassNames, 'blocks-gallery-grid', {
[`align${align}`]: align,
[`columns-${columns}`]: columns !== undefined,
[`columns-default`]: columns === undefined,
'is-cropped': imageCrop
})
}, blockProps.children, isSelected && !blockProps.children && (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.View, {
className: "blocks-gallery-media-placeholder-wrapper"
}, mediaPlaceholder), (0,external_React_namespaceObject.createElement)(Caption, {
attributes: attributes,
setAttributes: setAttributes,
isSelected: isSelected,
insertBlocksAfter: insertBlocksAfter,
showToolbarButton: !multiGallerySelection && !isContentLocked,
className: "blocks-gallery-caption",
label: (0,external_wp_i18n_namespaceObject.__)('Gallery caption text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Add gallery caption')
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/use-image-sizes.js
/**
* WordPress dependencies
*/
/**
* Calculates the image sizes that are avaible for the current gallery images in order to
* populate the 'Resolution' selector.
*
* @param {Array} images Basic image block data taken from current gallery innerBlock
* @param {boolean} isSelected Is the block currently selected in the editor.
* @param {Function} getSettings Block editor store selector.
*
* @return {Array} An array of image size options.
*/
function useImageSizes(images, isSelected, getSettings) {
return (0,external_wp_element_namespaceObject.useMemo)(() => getImageSizing(), [images, isSelected]);
function getImageSizing() {
if (!images || images.length === 0) {
return;
}
const {
imageSizes
} = getSettings();
let resizedImages = {};
if (isSelected) {
resizedImages = images.reduce((currentResizedImages, img) => {
if (!img.id) {
return currentResizedImages;
}
const sizes = imageSizes.reduce((currentSizes, size) => {
const defaultUrl = img.sizes?.[size.slug]?.url;
const mediaDetailsUrl = img.media_details?.sizes?.[size.slug]?.source_url;
return {
...currentSizes,
[size.slug]: defaultUrl || mediaDetailsUrl
};
}, {});
return {
...currentResizedImages,
[parseInt(img.id, 10)]: sizes
};
}, {});
}
const resizedImageSizes = Object.values(resizedImages);
return imageSizes.filter(({
slug
}) => resizedImageSizes.some(sizes => sizes[slug])).map(({
name,
slug
}) => ({
value: slug,
label: name
}));
}
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/use-get-new-images.js
/**
* WordPress dependencies
*/
/**
* Keeps track of images already in the gallery to allow new innerBlocks to be identified. This
* is required so default gallery attributes can be applied without overwriting any custom
* attributes applied to existing images.
*
* @param {Array} images Basic image block data taken from current gallery innerBlock
* @param {Array} imageData The related image data for each of the current gallery images.
*
* @return {Array} An array of any new images that have been added to the gallery.
*/
function useGetNewImages(images, imageData) {
const [currentImages, setCurrentImages] = (0,external_wp_element_namespaceObject.useState)([]);
return (0,external_wp_element_namespaceObject.useMemo)(() => getNewImages(), [images, imageData]);
function getNewImages() {
let imagesUpdated = false;
// First lets check if any images have been deleted.
const newCurrentImages = currentImages.filter(currentImg => images.find(img => {
return currentImg.clientId === img.clientId;
}));
if (newCurrentImages.length < currentImages.length) {
imagesUpdated = true;
}
// Now lets see if we have any images hydrated from saved content and if so
// add them to currentImages state.
images.forEach(image => {
if (image.fromSavedContent && !newCurrentImages.find(currentImage => currentImage.id === image.id)) {
imagesUpdated = true;
newCurrentImages.push(image);
}
});
// Now check for any new images that have been added to InnerBlocks and for which
// we have the imageData we need for setting default block attributes.
const newImages = images.filter(image => !newCurrentImages.find(currentImage => image.clientId && currentImage.clientId === image.clientId) && imageData?.find(img => img.id === image.id) && !image.fromSavedConent);
if (imagesUpdated || newImages?.length > 0) {
setCurrentImages([...newCurrentImages, ...newImages]);
}
return newImages.length > 0 ? newImages : null;
}
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/use-get-media.js
/**
* WordPress dependencies
*/
const EMPTY_IMAGE_MEDIA = [];
/**
* Retrieves the extended media info for each gallery image from the store. This is used to
* determine which image size options are available for the current gallery.
*
* @param {Array} innerBlockImages An array of the innerBlock images currently in the gallery.
*
* @return {Array} An array of media info options for each gallery image.
*/
function useGetMedia(innerBlockImages) {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
var _select$getMediaItems;
const imageIds = innerBlockImages.map(imageBlock => imageBlock.attributes.id).filter(id => id !== undefined);
if (imageIds.length === 0) {
return EMPTY_IMAGE_MEDIA;
}
return (_select$getMediaItems = select(external_wp_coreData_namespaceObject.store).getMediaItems({
include: imageIds.join(','),
per_page: -1,
orderby: 'include'
})) !== null && _select$getMediaItems !== void 0 ? _select$getMediaItems : EMPTY_IMAGE_MEDIA;
}, [innerBlockImages]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/gap-styles.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
useStyleOverride
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function GapStyles({
blockGap,
clientId
}) {
// --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default
// gap on the gallery.
const fallbackValue = `var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )`;
let gapValue = fallbackValue;
let column = fallbackValue;
let row;
// Check for the possibility of split block gap values. See: https://github.com/WordPress/gutenberg/pull/37736
if (!!blockGap) {
row = typeof blockGap === 'string' ? (0,external_wp_blockEditor_namespaceObject.__experimentalGetGapCSSValue)(blockGap) : (0,external_wp_blockEditor_namespaceObject.__experimentalGetGapCSSValue)(blockGap?.top) || fallbackValue;
column = typeof blockGap === 'string' ? (0,external_wp_blockEditor_namespaceObject.__experimentalGetGapCSSValue)(blockGap) : (0,external_wp_blockEditor_namespaceObject.__experimentalGetGapCSSValue)(blockGap?.left) || fallbackValue;
gapValue = row === column ? row : `${row} ${column}`;
}
// The unstable gallery gap calculation requires a real value (such as `0px`) and not `0`.
const gap = `#block-${clientId} {
--wp--style--unstable-gallery-gap: ${column === '0' ? '0px' : column};
gap: ${gapValue}
}`;
useStyleOverride({
css: gap
});
return null;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const MAX_COLUMNS = 8;
const linkOptions = [{
value: LINK_DESTINATION_ATTACHMENT,
label: (0,external_wp_i18n_namespaceObject.__)('Attachment Page')
}, {
value: LINK_DESTINATION_MEDIA,
label: (0,external_wp_i18n_namespaceObject.__)('Media File')
}, {
value: LINK_DESTINATION_NONE,
label: (0,external_wp_i18n_namespaceObject._x)('None', 'Media item link option')
}];
const edit_ALLOWED_MEDIA_TYPES = ['image'];
const PLACEHOLDER_TEXT = external_wp_element_namespaceObject.Platform.isNative ? (0,external_wp_i18n_namespaceObject.__)('Add media') : (0,external_wp_i18n_namespaceObject.__)('Drag images, upload new ones or select files from your library.');
const MOBILE_CONTROL_PROPS_RANGE_CONTROL = external_wp_element_namespaceObject.Platform.isNative ? {
type: 'stepper'
} : {};
const EMPTY_ARRAY = [];
function GalleryEdit(props) {
const {
setAttributes,
attributes,
className,
clientId,
isSelected,
insertBlocksAfter,
isContentLocked,
onFocus
} = props;
const {
columns,
imageCrop,
randomOrder,
linkTarget,
linkTo,
sizeSlug
} = attributes;
const {
__unstableMarkNextChangeAsNotPersistent,
replaceInnerBlocks,
updateBlockAttributes,
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
createSuccessNotice,
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const {
getBlock,
getSettings,
preferredStyle,
innerBlockImages,
blockWasJustInserted,
multiGallerySelection
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _getBlock$innerBlocks;
const {
getBlockName,
getMultiSelectedBlockClientIds,
getSettings: _getSettings,
getBlock: _getBlock,
wasBlockJustInserted
} = select(external_wp_blockEditor_namespaceObject.store);
const preferredStyleVariations = _getSettings().__experimentalPreferredStyleVariations;
const multiSelectedClientIds = getMultiSelectedBlockClientIds();
return {
getBlock: _getBlock,
getSettings: _getSettings,
preferredStyle: preferredStyleVariations?.value?.['core/image'],
innerBlockImages: (_getBlock$innerBlocks = _getBlock(clientId)?.innerBlocks) !== null && _getBlock$innerBlocks !== void 0 ? _getBlock$innerBlocks : EMPTY_ARRAY,
blockWasJustInserted: wasBlockJustInserted(clientId, 'inserter_menu'),
multiGallerySelection: multiSelectedClientIds.length && multiSelectedClientIds.every(_clientId => getBlockName(_clientId) === 'core/gallery')
};
}, [clientId]);
const images = (0,external_wp_element_namespaceObject.useMemo)(() => innerBlockImages?.map(block => ({
clientId: block.clientId,
id: block.attributes.id,
url: block.attributes.url,
attributes: block.attributes,
fromSavedContent: Boolean(block.originalContent)
})), [innerBlockImages]);
const imageData = useGetMedia(innerBlockImages);
const newImages = useGetNewImages(images, imageData);
(0,external_wp_element_namespaceObject.useEffect)(() => {
newImages?.forEach(newImage => {
// Update the images data without creating new undo levels.
__unstableMarkNextChangeAsNotPersistent();
updateBlockAttributes(newImage.clientId, {
...buildImageAttributes(newImage.attributes),
id: newImage.id,
align: undefined
});
});
}, [newImages]);
const imageSizeOptions = useImageSizes(imageData, isSelected, getSettings);
/**
* Determines the image attributes that should be applied to an image block
* after the gallery updates.
*
* The gallery will receive the full collection of images when a new image
* is added. As a result we need to reapply the image's original settings if
* it already existed in the gallery. If the image is in fact new, we need
* to apply the gallery's current settings to the image.
*
* @param {Object} imageAttributes Media object for the actual image.
* @return {Object} Attributes to set on the new image block.
*/
function buildImageAttributes(imageAttributes) {
const image = imageAttributes.id ? imageData.find(({
id
}) => id === imageAttributes.id) : null;
let newClassName;
if (imageAttributes.className && imageAttributes.className !== '') {
newClassName = imageAttributes.className;
} else {
newClassName = preferredStyle ? `is-style-${preferredStyle}` : undefined;
}
let newLinkTarget;
if (imageAttributes.linkTarget || imageAttributes.rel) {
// When transformed from image blocks, the link destination and rel attributes are inherited.
newLinkTarget = {
linkTarget: imageAttributes.linkTarget,
rel: imageAttributes.rel
};
} else {
// When an image is added, update the link destination and rel attributes according to the gallery settings
newLinkTarget = getUpdatedLinkTargetSettings(linkTarget, attributes);
}
return {
...pickRelevantMediaFiles(image, sizeSlug),
...utils_getHrefAndDestination(image, linkTo, imageAttributes?.linkDestination),
...newLinkTarget,
className: newClassName,
sizeSlug,
caption: imageAttributes.caption || image.caption?.raw,
alt: imageAttributes.alt || image.alt_text
};
}
function isValidFileType(file) {
// It's necessary to retrieve the media type from the raw image data for already-uploaded images on native.
const nativeFileData = external_wp_element_namespaceObject.Platform.isNative && file.id ? imageData.find(({
id
}) => id === file.id) : null;
const mediaTypeSelector = nativeFileData ? nativeFileData?.media_type : file.type;
return edit_ALLOWED_MEDIA_TYPES.some(mediaType => mediaTypeSelector?.indexOf(mediaType) === 0) || file.url?.indexOf('blob:') === 0;
}
function updateImages(selectedImages) {
const newFileUploads = Object.prototype.toString.call(selectedImages) === '[object FileList]';
const imageArray = newFileUploads ? Array.from(selectedImages).map(file => {
if (!file.url) {
return pickRelevantMediaFiles({
url: (0,external_wp_blob_namespaceObject.createBlobURL)(file)
});
}
return file;
}) : selectedImages;
if (!imageArray.every(isValidFileType)) {
createErrorNotice((0,external_wp_i18n_namespaceObject.__)('If uploading to a gallery all files need to be image formats'), {
id: 'gallery-upload-invalid-file',
type: 'snackbar'
});
}
const processedImages = imageArray.filter(file => file.url || isValidFileType(file)).map(file => {
if (!file.url) {
return pickRelevantMediaFiles({
url: (0,external_wp_blob_namespaceObject.createBlobURL)(file)
});
}
return file;
});
// Because we are reusing existing innerImage blocks any reordering
// done in the media library will be lost so we need to reapply that ordering
// once the new image blocks are merged in with existing.
const newOrderMap = processedImages.reduce((result, image, index) => (result[image.id] = index, result), {});
const existingImageBlocks = !newFileUploads ? innerBlockImages.filter(block => processedImages.find(img => img.id === block.attributes.id)) : innerBlockImages;
const newImageList = processedImages.filter(img => !existingImageBlocks.find(existingImg => img.id === existingImg.attributes.id));
const newBlocks = newImageList.map(image => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', {
id: image.id,
url: image.url,
caption: image.caption,
alt: image.alt
});
});
replaceInnerBlocks(clientId, existingImageBlocks.concat(newBlocks).sort((a, b) => newOrderMap[a.attributes.id] - newOrderMap[b.attributes.id]));
// Select the first block to scroll into view when new blocks are added.
if (newBlocks?.length > 0) {
selectBlock(newBlocks[0].clientId);
}
}
function onUploadError(message) {
createErrorNotice(message, {
type: 'snackbar'
});
}
function setLinkTo(value) {
setAttributes({
linkTo: value
});
const changedAttributes = {};
const blocks = [];
getBlock(clientId).innerBlocks.forEach(block => {
blocks.push(block.clientId);
const image = block.attributes.id ? imageData.find(({
id
}) => id === block.attributes.id) : null;
changedAttributes[block.clientId] = utils_getHrefAndDestination(image, value);
});
updateBlockAttributes(blocks, changedAttributes, true);
const linkToText = [...linkOptions].find(linkType => linkType.value === value);
createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: image size settings */
(0,external_wp_i18n_namespaceObject.__)('All gallery image links updated to: %s'), linkToText.label), {
id: 'gallery-attributes-linkTo',
type: 'snackbar'
});
}
function setColumnsNumber(value) {
setAttributes({
columns: value
});
}
function toggleImageCrop() {
setAttributes({
imageCrop: !imageCrop
});
}
function toggleRandomOrder() {
setAttributes({
randomOrder: !randomOrder
});
}
function toggleOpenInNewTab(openInNewTab) {
const newLinkTarget = openInNewTab ? '_blank' : undefined;
setAttributes({
linkTarget: newLinkTarget
});
const changedAttributes = {};
const blocks = [];
getBlock(clientId).innerBlocks.forEach(block => {
blocks.push(block.clientId);
changedAttributes[block.clientId] = getUpdatedLinkTargetSettings(newLinkTarget, block.attributes);
});
updateBlockAttributes(blocks, changedAttributes, true);
const noticeText = openInNewTab ? (0,external_wp_i18n_namespaceObject.__)('All gallery images updated to open in new tab') : (0,external_wp_i18n_namespaceObject.__)('All gallery images updated to not open in new tab');
createSuccessNotice(noticeText, {
id: 'gallery-attributes-openInNewTab',
type: 'snackbar'
});
}
function updateImagesSize(newSizeSlug) {
setAttributes({
sizeSlug: newSizeSlug
});
const changedAttributes = {};
const blocks = [];
getBlock(clientId).innerBlocks.forEach(block => {
blocks.push(block.clientId);
const image = block.attributes.id ? imageData.find(({
id
}) => id === block.attributes.id) : null;
changedAttributes[block.clientId] = getImageSizeAttributes(image, newSizeSlug);
});
updateBlockAttributes(blocks, changedAttributes, true);
const imageSize = imageSizeOptions.find(size => size.value === newSizeSlug);
createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: image size settings */
(0,external_wp_i18n_namespaceObject.__)('All gallery image sizes updated to: %s'), imageSize.label), {
id: 'gallery-attributes-sizeSlug',
type: 'snackbar'
});
}
(0,external_wp_element_namespaceObject.useEffect)(() => {
// linkTo attribute must be saved so blocks don't break when changing image_default_link_type in options.php.
if (!linkTo) {
__unstableMarkNextChangeAsNotPersistent();
setAttributes({
linkTo: window?.wp?.media?.view?.settings?.defaultProps?.link || LINK_DESTINATION_NONE
});
}
}, [linkTo]);
const hasImages = !!images.length;
const hasImageIds = hasImages && images.some(image => !!image.id);
const imagesUploading = images.some(img => !external_wp_element_namespaceObject.Platform.isNative ? !img.id && img.url?.indexOf('blob:') === 0 : img.url?.indexOf('file:') === 0);
// MediaPlaceholder props are different between web and native hence, we provide a platform-specific set.
const mediaPlaceholderProps = external_wp_element_namespaceObject.Platform.select({
web: {
addToGallery: false,
disableMediaButtons: imagesUploading,
value: {}
},
native: {
addToGallery: hasImageIds,
isAppender: hasImages,
disableMediaButtons: hasImages && !isSelected || imagesUploading,
value: hasImageIds ? images : {},
autoOpenMediaUpload: !hasImages && isSelected && blockWasJustInserted,
onFocus
}
});
const mediaPlaceholder = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
handleUpload: false,
icon: sharedIcon,
labels: {
title: (0,external_wp_i18n_namespaceObject.__)('Gallery'),
instructions: PLACEHOLDER_TEXT
},
onSelect: updateImages,
accept: "image/*",
allowedTypes: edit_ALLOWED_MEDIA_TYPES,
multiple: true,
onError: onUploadError,
...mediaPlaceholderProps
});
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()(className, 'has-nested-images')
});
const nativeInnerBlockProps = external_wp_element_namespaceObject.Platform.isNative && {
marginHorizontal: 0,
marginVertical: 0
};
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
orientation: 'horizontal',
renderAppender: false,
...nativeInnerBlockProps
});
if (!hasImages) {
return (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.View, {
...innerBlocksProps
}, innerBlocksProps.children, mediaPlaceholder);
}
const hasLinkTo = linkTo && linkTo !== 'none';
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, images.length > 1 && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Columns'),
value: columns ? columns : defaultColumnsNumber(images.length),
onChange: setColumnsNumber,
min: 1,
max: Math.min(MAX_COLUMNS, images.length),
...MOBILE_CONTROL_PROPS_RANGE_CONTROL,
required: true,
__next40pxDefaultSize: true
}), imageSizeOptions?.length > 0 && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Resolution'),
help: (0,external_wp_i18n_namespaceObject.__)('Select the size of the source images.'),
value: sizeSlug,
options: imageSizeOptions,
onChange: updateImagesSize,
hideCancelButton: true,
size: "__unstable-large"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link to'),
value: linkTo,
onChange: setLinkTo,
options: linkOptions,
hideCancelButton: true,
size: "__unstable-large"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Crop images to fit'),
checked: !!imageCrop,
onChange: toggleImageCrop
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Randomize order'),
checked: !!randomOrder,
onChange: toggleRandomOrder
}), hasLinkTo && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open images in new tab'),
checked: linkTarget === '_blank',
onChange: toggleOpenInNewTab
}), external_wp_element_namespaceObject.Platform.isWeb && !imageSizeOptions && hasImageIds && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, {
className: 'gallery-image-sizes'
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, null, (0,external_wp_i18n_namespaceObject.__)('Resolution')), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.View, {
className: 'gallery-image-sizes__loading'
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_wp_i18n_namespaceObject.__)('Loading options…'))))), external_wp_element_namespaceObject.Platform.isWeb && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !multiGallerySelection && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, {
allowedTypes: edit_ALLOWED_MEDIA_TYPES,
accept: "image/*",
handleUpload: false,
onSelect: updateImages,
name: (0,external_wp_i18n_namespaceObject.__)('Add'),
multiple: true,
mediaIds: images.filter(image => image.id).map(image => image.id),
addToGallery: hasImageIds
})), (0,external_React_namespaceObject.createElement)(GapStyles, {
blockGap: attributes.style?.spacing?.blockGap,
clientId: clientId
})), (0,external_React_namespaceObject.createElement)(Gallery, {
...props,
isContentLocked: isContentLocked,
images: images,
mediaPlaceholder: !hasImages || external_wp_element_namespaceObject.Platform.isNative ? mediaPlaceholder : undefined,
blockProps: innerBlocksProps,
insertBlocksAfter: insertBlocksAfter,
multiGallerySelection: multiGallerySelection
}));
}
/* harmony default export */ const gallery_edit = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_viewport_namespaceObject.withViewportMatch)({
isNarrow: '< small'
})])(GalleryEdit));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/v1/shared.js
const shared_pickRelevantMediaFiles = (image, sizeSlug = 'large') => {
const imageProps = Object.fromEntries(Object.entries(image !== null && image !== void 0 ? image : {}).filter(([key]) => ['alt', 'id', 'link', 'caption'].includes(key)));
imageProps.url = image?.sizes?.[sizeSlug]?.url || image?.media_details?.sizes?.[sizeSlug]?.source_url || image?.url;
const fullUrl = image?.sizes?.full?.url || image?.media_details?.sizes?.full?.source_url;
if (fullUrl) {
imageProps.fullUrl = fullUrl;
}
return imageProps;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/image.js
/**
* WordPress dependencies
*/
const image_image = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_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-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"
}));
/* harmony default export */ const library_image = (image_image);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
/**
* WordPress dependencies
*/
const chevronLeft = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_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 */ const chevron_left = (chevronLeft);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
/**
* WordPress dependencies
*/
const chevronRight = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_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 */ const chevron_right = (chevronRight);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
/**
* WordPress dependencies
*/
const closeSmall = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.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 */ const close_small = (closeSmall);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/v1/constants.js
const v1_constants_LINK_DESTINATION_NONE = 'none';
const v1_constants_LINK_DESTINATION_MEDIA = 'file';
const v1_constants_LINK_DESTINATION_ATTACHMENT = 'post';
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/v1/gallery-image.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const isTemporaryImage = (id, url) => !id && (0,external_wp_blob_namespaceObject.isBlobURL)(url);
class GalleryImage extends external_wp_element_namespaceObject.Component {
constructor() {
super(...arguments);
this.onSelectImage = this.onSelectImage.bind(this);
this.onRemoveImage = this.onRemoveImage.bind(this);
this.bindContainer = this.bindContainer.bind(this);
this.onEdit = this.onEdit.bind(this);
this.onSelectImageFromLibrary = this.onSelectImageFromLibrary.bind(this);
this.onSelectCustomURL = this.onSelectCustomURL.bind(this);
this.state = {
isEditing: false
};
}
bindContainer(ref) {
this.container = ref;
}
onSelectImage() {
if (!this.props.isSelected) {
this.props.onSelect();
}
}
onRemoveImage(event) {
if (this.container === this.container.ownerDocument.activeElement && this.props.isSelected && [external_wp_keycodes_namespaceObject.BACKSPACE, external_wp_keycodes_namespaceObject.DELETE].indexOf(event.keyCode) !== -1) {
event.preventDefault();
this.props.onRemove();
}
}
onEdit() {
this.setState({
isEditing: true
});
}
componentDidUpdate() {
const {
image,
url,
__unstableMarkNextChangeAsNotPersistent
} = this.props;
if (image && !url) {
__unstableMarkNextChangeAsNotPersistent();
this.props.setAttributes({
url: image.source_url,
alt: image.alt_text
});
}
}
deselectOnBlur() {
this.props.onDeselect();
}
onSelectImageFromLibrary(media) {
const {
setAttributes,
id,
url,
alt,
caption,
sizeSlug
} = this.props;
if (!media || !media.url) {
return;
}
let mediaAttributes = shared_pickRelevantMediaFiles(media, sizeSlug);
// If the current image is temporary but an alt text was meanwhile
// written by the user, make sure the text is not overwritten.
if (isTemporaryImage(id, url)) {
if (alt) {
const {
alt: omittedAlt,
...restMediaAttributes
} = mediaAttributes;
mediaAttributes = restMediaAttributes;
}
}
// If a caption text was meanwhile written by the user,
// make sure the text is not overwritten by empty captions.
if (caption && !mediaAttributes.caption) {
const {
caption: omittedCaption,
...restMediaAttributes
} = mediaAttributes;
mediaAttributes = restMediaAttributes;
}
setAttributes(mediaAttributes);
this.setState({
isEditing: false
});
}
onSelectCustomURL(newURL) {
const {
setAttributes,
url
} = this.props;
if (newURL !== url) {
setAttributes({
url: newURL,
id: undefined
});
this.setState({
isEditing: false
});
}
}
render() {
const {
url,
alt,
id,
linkTo,
link,
isFirstItem,
isLastItem,
isSelected,
caption,
onRemove,
onMoveForward,
onMoveBackward,
setAttributes,
'aria-label': ariaLabel
} = this.props;
const {
isEditing
} = this.state;
let href;
switch (linkTo) {
case v1_constants_LINK_DESTINATION_MEDIA:
href = url;
break;
case v1_constants_LINK_DESTINATION_ATTACHMENT:
href = link;
break;
}
const img =
// Disable reason: Image itself is not meant to be interactive, but should
// direct image selection and unfocus caption fields.
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
(0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("img", {
src: url,
alt: alt,
"data-id": id,
onKeyDown: this.onRemoveImage,
tabIndex: "0",
"aria-label": ariaLabel,
ref: this.bindContainer
}), (0,external_wp_blob_namespaceObject.isBlobURL)(url) && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null))
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */;
const className = classnames_default()({
'is-selected': isSelected,
'is-transient': (0,external_wp_blob_namespaceObject.isBlobURL)(url)
});
return (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
(0,external_React_namespaceObject.createElement)("figure", {
className: className,
onClick: this.onSelectImage,
onFocus: this.onSelectImage
}, !isEditing && (href ? (0,external_React_namespaceObject.createElement)("a", {
href: href
}, img) : img), isEditing && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
labels: {
title: (0,external_wp_i18n_namespaceObject.__)('Edit gallery image')
},
icon: library_image,
onSelect: this.onSelectImageFromLibrary,
onSelectURL: this.onSelectCustomURL,
accept: "image/*",
allowedTypes: ['image'],
value: {
id,
src: url
}
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ButtonGroup, {
className: "block-library-gallery-item__inline-menu is-left"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
icon: chevron_left,
onClick: isFirstItem ? undefined : onMoveBackward,
label: (0,external_wp_i18n_namespaceObject.__)('Move image backward'),
"aria-disabled": isFirstItem,
disabled: !isSelected
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
icon: chevron_right,
onClick: isLastItem ? undefined : onMoveForward,
label: (0,external_wp_i18n_namespaceObject.__)('Move image forward'),
"aria-disabled": isLastItem,
disabled: !isSelected
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ButtonGroup, {
className: "block-library-gallery-item__inline-menu is-right"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
icon: library_edit,
onClick: this.onEdit,
label: (0,external_wp_i18n_namespaceObject.__)('Replace image'),
disabled: !isSelected
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
icon: close_small,
onClick: onRemove,
label: (0,external_wp_i18n_namespaceObject.__)('Remove image'),
disabled: !isSelected
})), !isEditing && (isSelected || caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: "figcaption",
className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'),
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Image caption text'),
placeholder: isSelected ? (0,external_wp_i18n_namespaceObject.__)('Add caption') : null,
value: caption,
onChange: newCaption => setAttributes({
caption: newCaption
}),
inlineToolbar: true
}))
);
}
}
/* harmony default export */ const gallery_image = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => {
const {
getMedia
} = select(external_wp_coreData_namespaceObject.store);
const {
id
} = ownProps;
return {
image: id ? getMedia(parseInt(id, 10)) : null
};
}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
const {
__unstableMarkNextChangeAsNotPersistent
} = dispatch(external_wp_blockEditor_namespaceObject.store);
return {
__unstableMarkNextChangeAsNotPersistent
};
})])(GalleryImage));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/v1/gallery.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const gallery_Gallery = props => {
const {
attributes,
isSelected,
setAttributes,
selectedImage,
mediaPlaceholder,
onMoveBackward,
onMoveForward,
onRemoveImage,
onSelectImage,
onDeselectImage,
onSetImageAttributes,
insertBlocksAfter,
blockProps
} = props;
const {
align,
columns = defaultColumnsNumberV1(attributes),
caption,
imageCrop,
images
} = attributes;
return (0,external_React_namespaceObject.createElement)("figure", {
...blockProps,
className: classnames_default()(blockProps.className, {
[`align${align}`]: align,
[`columns-${columns}`]: columns,
'is-cropped': imageCrop
})
}, (0,external_React_namespaceObject.createElement)("ul", {
className: "blocks-gallery-grid"
}, images.map((img, index) => {
const ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: the order number of the image. 2: the total number of images. */
(0,external_wp_i18n_namespaceObject.__)('image %1$d of %2$d in gallery'), index + 1, images.length);
return (0,external_React_namespaceObject.createElement)("li", {
className: "blocks-gallery-item",
key: img.id ? `${img.id}-${index}` : img.url
}, (0,external_React_namespaceObject.createElement)(gallery_image, {
url: img.url,
alt: img.alt,
id: img.id,
isFirstItem: index === 0,
isLastItem: index + 1 === images.length,
isSelected: isSelected && selectedImage === index,
onMoveBackward: onMoveBackward(index),
onMoveForward: onMoveForward(index),
onRemove: onRemoveImage(index),
onSelect: onSelectImage(index),
onDeselect: onDeselectImage(index),
setAttributes: attrs => onSetImageAttributes(index, attrs),
caption: img.caption,
"aria-label": ariaLabel,
sizeSlug: attributes.sizeSlug
}));
})), mediaPlaceholder, (0,external_React_namespaceObject.createElement)(RichTextVisibilityHelper, {
isHidden: !isSelected && external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption),
tagName: "figcaption",
className: classnames_default()('blocks-gallery-caption', (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption')),
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Gallery caption text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write gallery caption…'),
value: caption,
onChange: value => setAttributes({
caption: value
}),
inlineToolbar: true,
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()))
}));
};
function RichTextVisibilityHelper({
isHidden,
...richTextProps
}) {
return isHidden ? (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
as: external_wp_blockEditor_namespaceObject.RichText,
...richTextProps
}) : (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
...richTextProps
});
}
/* harmony default export */ const v1_gallery = (gallery_Gallery);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/v1/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const edit_MAX_COLUMNS = 8;
const edit_linkOptions = [{
value: v1_constants_LINK_DESTINATION_ATTACHMENT,
label: (0,external_wp_i18n_namespaceObject.__)('Attachment Page')
}, {
value: v1_constants_LINK_DESTINATION_MEDIA,
label: (0,external_wp_i18n_namespaceObject.__)('Media File')
}, {
value: v1_constants_LINK_DESTINATION_NONE,
label: (0,external_wp_i18n_namespaceObject.__)('None')
}];
const v1_edit_ALLOWED_MEDIA_TYPES = ['image'];
const edit_PLACEHOLDER_TEXT = external_wp_element_namespaceObject.Platform.select({
web: (0,external_wp_i18n_namespaceObject.__)('Drag images, upload new ones or select files from your library.'),
native: (0,external_wp_i18n_namespaceObject.__)('ADD MEDIA')
});
const edit_MOBILE_CONTROL_PROPS_RANGE_CONTROL = external_wp_element_namespaceObject.Platform.select({
web: {},
native: {
type: 'stepper'
}
});
function edit_GalleryEdit(props) {
const {
attributes,
clientId,
isSelected,
noticeUI,
noticeOperations,
onFocus
} = props;
const {
columns = defaultColumnsNumberV1(attributes),
imageCrop,
images,
linkTo,
sizeSlug
} = attributes;
const [selectedImage, setSelectedImage] = (0,external_wp_element_namespaceObject.useState)();
const [attachmentCaptions, setAttachmentCaptions] = (0,external_wp_element_namespaceObject.useState)();
const {
__unstableMarkNextChangeAsNotPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
imageSizes,
mediaUpload,
getMedia,
wasBlockJustInserted
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const settings = select(external_wp_blockEditor_namespaceObject.store).getSettings();
return {
imageSizes: settings.imageSizes,
mediaUpload: settings.mediaUpload,
getMedia: select(external_wp_coreData_namespaceObject.store).getMedia,
wasBlockJustInserted: select(external_wp_blockEditor_namespaceObject.store).wasBlockJustInserted(clientId, 'inserter_menu')
};
});
const resizedImages = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (isSelected) {
var _attributes$ids;
return ((_attributes$ids = attributes.ids) !== null && _attributes$ids !== void 0 ? _attributes$ids : []).reduce((currentResizedImages, id) => {
if (!id) {
return currentResizedImages;
}
const image = getMedia(id);
const sizes = imageSizes.reduce((currentSizes, size) => {
const defaultUrl = image?.sizes?.[size.slug]?.url;
const mediaDetailsUrl = image?.media_details?.sizes?.[size.slug]?.source_url;
return {
...currentSizes,
[size.slug]: defaultUrl || mediaDetailsUrl
};
}, {});
return {
...currentResizedImages,
[parseInt(id, 10)]: sizes
};
}, {});
}
return {};
}, [isSelected, attributes.ids, imageSizes]);
function onFocusGalleryCaption() {
setSelectedImage();
}
function setAttributes(newAttrs) {
if (newAttrs.ids) {
throw new Error('The "ids" attribute should not be changed directly. It is managed automatically when "images" attribute changes');
}
if (newAttrs.images) {
newAttrs = {
...newAttrs,
// Unlike images[ n ].id which is a string, always ensure the
// ids array contains numbers as per its attribute type.
ids: newAttrs.images.map(({
id
}) => parseInt(id, 10))
};
}
props.setAttributes(newAttrs);
}
function onSelectImage(index) {
return () => {
setSelectedImage(index);
};
}
function onDeselectImage() {
return () => {
setSelectedImage();
};
}
function onMove(oldIndex, newIndex) {
const newImages = [...images];
newImages.splice(newIndex, 1, images[oldIndex]);
newImages.splice(oldIndex, 1, images[newIndex]);
setSelectedImage(newIndex);
setAttributes({
images: newImages
});
}
function onMoveForward(oldIndex) {
return () => {
if (oldIndex === images.length - 1) {
return;
}
onMove(oldIndex, oldIndex + 1);
};
}
function onMoveBackward(oldIndex) {
return () => {
if (oldIndex === 0) {
return;
}
onMove(oldIndex, oldIndex - 1);
};
}
function onRemoveImage(index) {
return () => {
const newImages = images.filter((img, i) => index !== i);
setSelectedImage();
setAttributes({
images: newImages,
columns: attributes.columns ? Math.min(newImages.length, attributes.columns) : attributes.columns
});
};
}
function selectCaption(newImage) {
// The image id in both the images and attachmentCaptions arrays is a
// string, so ensure comparison works correctly by converting the
// newImage.id to a string.
const newImageId = newImage.id.toString();
const currentImage = images.find(({
id
}) => id === newImageId);
const currentImageCaption = currentImage ? currentImage.caption : newImage.caption;
if (!attachmentCaptions) {
return currentImageCaption;
}
const attachment = attachmentCaptions.find(({
id
}) => id === newImageId);
// If the attachment caption is updated.
if (attachment && attachment.caption !== newImage.caption) {
return newImage.caption;
}
return currentImageCaption;
}
function onSelectImages(newImages) {
setAttachmentCaptions(newImages.map(newImage => ({
// Store the attachmentCaption id as a string for consistency
// with the type of the id in the images attribute.
id: newImage.id.toString(),
caption: newImage.caption
})));
setAttributes({
images: newImages.map(newImage => ({
...shared_pickRelevantMediaFiles(newImage, sizeSlug),
caption: selectCaption(newImage, images, attachmentCaptions),
// The id value is stored in a data attribute, so when the
// block is parsed it's converted to a string. Converting
// to a string here ensures it's type is consistent.
id: newImage.id.toString()
})),
columns: attributes.columns ? Math.min(newImages.length, attributes.columns) : attributes.columns
});
}
function onUploadError(message) {
noticeOperations.removeAllNotices();
noticeOperations.createErrorNotice(message);
}
function setLinkTo(value) {
setAttributes({
linkTo: value
});
}
function setColumnsNumber(value) {
setAttributes({
columns: value
});
}
function toggleImageCrop() {
setAttributes({
imageCrop: !imageCrop
});
}
function getImageCropHelp(checked) {
return checked ? (0,external_wp_i18n_namespaceObject.__)('Thumbnails are cropped to align.') : (0,external_wp_i18n_namespaceObject.__)('Thumbnails are not cropped.');
}
function setImageAttributes(index, newAttributes) {
if (!images[index]) {
return;
}
setAttributes({
images: [...images.slice(0, index), {
...images[index],
...newAttributes
}, ...images.slice(index + 1)]
});
}
function getImagesSizeOptions() {
const resizedImageSizes = Object.values(resizedImages);
return imageSizes.filter(({
slug
}) => resizedImageSizes.some(sizes => sizes[slug])).map(({
name,
slug
}) => ({
value: slug,
label: name
}));
}
function updateImagesSize(newSizeSlug) {
const updatedImages = (images !== null && images !== void 0 ? images : []).map(image => {
if (!image.id) {
return image;
}
const url = resizedImages[parseInt(image.id, 10)]?.[newSizeSlug];
return {
...image,
...(url && {
url
})
};
});
setAttributes({
images: updatedImages,
sizeSlug: newSizeSlug
});
}
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (external_wp_element_namespaceObject.Platform.OS === 'web' && images && images.length > 0 && images.every(({
url
}) => (0,external_wp_blob_namespaceObject.isBlobURL)(url))) {
const filesList = images.map(({
url
}) => (0,external_wp_blob_namespaceObject.getBlobByURL)(url));
images.forEach(({
url
}) => (0,external_wp_blob_namespaceObject.revokeBlobURL)(url));
mediaUpload({
filesList,
onFileChange: onSelectImages,
allowedTypes: ['image']
});
}
}, []);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Deselect images when deselecting the block.
if (!isSelected) {
setSelectedImage();
}
}, [isSelected]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// linkTo attribute must be saved so blocks don't break when changing
// image_default_link_type in options.php.
if (!linkTo) {
__unstableMarkNextChangeAsNotPersistent();
setAttributes({
linkTo: window?.wp?.media?.view?.settings?.defaultProps?.link || v1_constants_LINK_DESTINATION_NONE
});
}
}, [linkTo]);
const hasImages = !!images.length;
const hasImageIds = hasImages && images.some(image => !!image.id);
const mediaPlaceholder = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
addToGallery: hasImageIds,
isAppender: hasImages,
disableMediaButtons: hasImages && !isSelected,
icon: !hasImages && sharedIcon,
labels: {
title: !hasImages && (0,external_wp_i18n_namespaceObject.__)('Gallery'),
instructions: !hasImages && edit_PLACEHOLDER_TEXT
},
onSelect: onSelectImages,
accept: "image/*",
allowedTypes: v1_edit_ALLOWED_MEDIA_TYPES,
multiple: true,
value: hasImageIds ? images : {},
onError: onUploadError,
notices: hasImages ? undefined : noticeUI,
onFocus: onFocus,
autoOpenMediaUpload: !hasImages && isSelected && wasBlockJustInserted
});
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
if (!hasImages) {
return (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.View, {
...blockProps
}, mediaPlaceholder);
}
const imageSizeOptions = getImagesSizeOptions();
const shouldShowSizeOptions = hasImages && imageSizeOptions.length > 0;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, images.length > 1 && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Columns'),
value: columns,
onChange: setColumnsNumber,
min: 1,
max: Math.min(edit_MAX_COLUMNS, images.length),
...edit_MOBILE_CONTROL_PROPS_RANGE_CONTROL,
required: true
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Crop images'),
checked: !!imageCrop,
onChange: toggleImageCrop,
help: getImageCropHelp
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link to'),
value: linkTo,
onChange: setLinkTo,
options: edit_linkOptions,
hideCancelButton: true
}), shouldShowSizeOptions && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Image size'),
value: sizeSlug,
options: imageSizeOptions,
onChange: updateImagesSize,
hideCancelButton: true
}))), noticeUI, (0,external_React_namespaceObject.createElement)(v1_gallery, {
...props,
selectedImage: selectedImage,
mediaPlaceholder: mediaPlaceholder,
onMoveBackward: onMoveBackward,
onMoveForward: onMoveForward,
onRemoveImage: onRemoveImage,
onSelectImage: onSelectImage,
onDeselectImage: onDeselectImage,
onSetImageAttributes: setImageAttributes,
blockProps: blockProps
// This prop is used by gallery.native.js.
,
onFocusGalleryCaption: onFocusGalleryCaption
}));
}
/* harmony default export */ const v1_edit = ((0,external_wp_compose_namespaceObject.compose)([external_wp_components_namespaceObject.withNotices, (0,external_wp_viewport_namespaceObject.withViewportMatch)({
isNarrow: '< small'
})])(edit_GalleryEdit));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/edit-wrapper.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/*
* Using a wrapper around the logic to load the edit for v1 of Gallery block
* or the refactored version with InnerBlocks. This is to prevent conditional
* use of hooks lint errors if adding this logic to the top of the edit component.
*/
function GalleryEditWrapper(props) {
if (!isGalleryV2Enabled()) {
return (0,external_React_namespaceObject.createElement)(v1_edit, {
...props
});
}
return (0,external_React_namespaceObject.createElement)(gallery_edit, {
...props
});
}
/* harmony default export */ const edit_wrapper = ((0,external_wp_compose_namespaceObject.compose)([external_wp_components_namespaceObject.withNotices])(GalleryEditWrapper));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/v1/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function saveV1({
attributes
}) {
const {
images,
columns = defaultColumnsNumberV1(attributes),
imageCrop,
caption,
linkTo
} = attributes;
const className = `columns-${columns} ${imageCrop ? 'is-cropped' : ''}`;
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
})
}, (0,external_React_namespaceObject.createElement)("ul", {
className: "blocks-gallery-grid"
}, images.map(image => {
let href;
switch (linkTo) {
case v1_constants_LINK_DESTINATION_MEDIA:
href = image.fullUrl || image.url;
break;
case v1_constants_LINK_DESTINATION_ATTACHMENT:
href = image.link;
break;
}
const img = (0,external_React_namespaceObject.createElement)("img", {
src: image.url,
alt: image.alt,
"data-id": image.id,
"data-full-url": image.fullUrl,
"data-link": image.link,
className: image.id ? `wp-image-${image.id}` : null
});
return (0,external_React_namespaceObject.createElement)("li", {
key: image.id || image.url,
className: "blocks-gallery-item"
}, (0,external_React_namespaceObject.createElement)("figure", null, href ? (0,external_React_namespaceObject.createElement)("a", {
href: href
}, img) : img, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(image.caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
className: classnames_default()('blocks-gallery-item__caption', (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption')),
value: image.caption
})));
})), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
className: classnames_default()('blocks-gallery-caption', (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption')),
value: caption
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function saveWithInnerBlocks({
attributes
}) {
if (!isGalleryV2Enabled()) {
return saveV1({
attributes
});
}
const {
caption,
columns,
imageCrop
} = attributes;
const className = classnames_default()('has-nested-images', {
[`columns-${columns}`]: columns !== undefined,
[`columns-default`]: columns === undefined,
'is-cropped': imageCrop
});
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
});
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
return (0,external_React_namespaceObject.createElement)("figure", {
...innerBlocksProps
}, innerBlocksProps.children, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
className: classnames_default()('blocks-gallery-caption', (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption')),
value: caption
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/transforms.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const parseShortcodeIds = ids => {
if (!ids) {
return [];
}
return ids.split(',').map(id => parseInt(id, 10));
};
/**
* Third party block plugins don't have an easy way to detect if the
* innerBlocks version of the Gallery is running when they run a
* 3rdPartyBlock -> GalleryBlock transform so this tranform filter
* will handle this. Once the innerBlocks version is the default
* in a core release, this could be deprecated and removed after
* plugin authors have been given time to update transforms.
*
* @typedef {Object} Attributes
* @typedef {Object} Block
* @property {Attributes} attributes The attributes of the block.
* @param {Block} block The transformed block.
* @return {Block} The transformed block.
*/
function updateThirdPartyTransformToGallery(block) {
if (isGalleryV2Enabled() && block.name === 'core/gallery' && block.attributes?.images.length > 0) {
const innerBlocks = block.attributes.images.map(({
url,
id,
alt
}) => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', {
url,
id: id ? parseInt(id, 10) : null,
alt,
sizeSlug: block.attributes.sizeSlug,
linkDestination: block.attributes.linkDestination
});
});
delete block.attributes.ids;
delete block.attributes.images;
block.innerBlocks = innerBlocks;
}
return block;
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/gallery/update-third-party-transform-to', updateThirdPartyTransformToGallery);
/**
* Third party block plugins don't have an easy way to detect if the
* innerBlocks version of the Gallery is running when they run a
* GalleryBlock -> 3rdPartyBlock transform so this transform filter
* will handle this. Once the innerBlocks version is the default
* in a core release, this could be deprecated and removed after
* plugin authors have been given time to update transforms.
*
* @typedef {Object} Attributes
* @typedef {Object} Block
* @property {Attributes} attributes The attributes of the block.
* @param {Block} toBlock The block to transform to.
* @param {Block[]} fromBlocks The blocks to transform from.
* @return {Block} The transformed block.
*/
function updateThirdPartyTransformFromGallery(toBlock, fromBlocks) {
const from = Array.isArray(fromBlocks) ? fromBlocks : [fromBlocks];
const galleryBlock = from.find(transformedBlock => transformedBlock.name === 'core/gallery' && transformedBlock.innerBlocks.length > 0 && !transformedBlock.attributes.images?.length > 0 && !toBlock.name.includes('core/'));
if (galleryBlock) {
const images = galleryBlock.innerBlocks.map(({
attributes: {
url,
id,
alt
}
}) => ({
url,
id: id ? parseInt(id, 10) : null,
alt
}));
const ids = images.map(({
id
}) => id);
galleryBlock.attributes.images = images;
galleryBlock.attributes.ids = ids;
}
return toBlock;
}
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/gallery/update-third-party-transform-from', updateThirdPartyTransformFromGallery);
const gallery_transforms_transforms = {
from: [{
type: 'block',
isMultiBlock: true,
blocks: ['core/image'],
transform: attributes => {
// Init the align and size from the first item which may be either the placeholder or an image.
let {
align,
sizeSlug
} = attributes[0];
// Loop through all the images and check if they have the same align and size.
align = attributes.every(attribute => attribute.align === align) ? align : undefined;
sizeSlug = attributes.every(attribute => attribute.sizeSlug === sizeSlug) ? sizeSlug : undefined;
const validImages = attributes.filter(({
url
}) => url);
if (isGalleryV2Enabled()) {
const innerBlocks = validImages.map(image => {
// Gallery images can't currently be resized so make sure height and width are undefined.
image.width = undefined;
image.height = undefined;
return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', image);
});
return (0,external_wp_blocks_namespaceObject.createBlock)('core/gallery', {
align,
sizeSlug
}, innerBlocks);
}
return (0,external_wp_blocks_namespaceObject.createBlock)('core/gallery', {
images: validImages.map(({
id,
url,
alt,
caption
}) => ({
id: id.toString(),
url,
alt,
caption
})),
ids: validImages.map(({
id
}) => parseInt(id, 10)),
align,
sizeSlug
});
}
}, {
type: 'shortcode',
tag: 'gallery',
transform({
named: {
ids,
columns = 3,
link,
orderby
}
}) {
const imageIds = parseShortcodeIds(ids).map(id => parseInt(id, 10));
let linkTo = LINK_DESTINATION_NONE;
if (link === 'post') {
linkTo = LINK_DESTINATION_ATTACHMENT;
} else if (link === 'file') {
linkTo = LINK_DESTINATION_MEDIA;
}
const galleryBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/gallery', {
columns: parseInt(columns, 10),
linkTo,
randomOrder: orderby === 'rand'
}, imageIds.map(imageId => (0,external_wp_blocks_namespaceObject.createBlock)('core/image', {
id: imageId
})));
return galleryBlock;
},
isMatch({
named
}) {
return undefined !== named.ids;
}
}, {
// When created by drag and dropping multiple files on an insertion point. Because multiple
// files must not be transformed to a gallery when dropped within a gallery there is another transform
// within the image block to handle that case. Therefore this transform has to have priority 1
// set so that it overrrides the image block transformation when mulitple images are dropped outside
// of a gallery block.
type: 'files',
priority: 1,
isMatch(files) {
return files.length !== 1 && files.every(file => file.type.indexOf('image/') === 0);
},
transform(files) {
if (isGalleryV2Enabled()) {
const innerBlocks = files.map(file => (0,external_wp_blocks_namespaceObject.createBlock)('core/image', {
url: (0,external_wp_blob_namespaceObject.createBlobURL)(file)
}));
return (0,external_wp_blocks_namespaceObject.createBlock)('core/gallery', {}, innerBlocks);
}
const block = (0,external_wp_blocks_namespaceObject.createBlock)('core/gallery', {
images: files.map(file => pickRelevantMediaFiles({
url: (0,external_wp_blob_namespaceObject.createBlobURL)(file)
}))
});
return block;
}
}],
to: [{
type: 'block',
blocks: ['core/image'],
transform: ({
align,
images,
ids,
sizeSlug
}, innerBlocks) => {
if (isGalleryV2Enabled()) {
if (innerBlocks.length > 0) {
return innerBlocks.map(({
attributes: {
url,
alt,
caption,
title,
href,
rel,
linkClass,
id,
sizeSlug: imageSizeSlug,
linkDestination,
linkTarget,
anchor,
className
}
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/image', {
align,
url,
alt,
caption,
title,
href,
rel,
linkClass,
id,
sizeSlug: imageSizeSlug,
linkDestination,
linkTarget,
anchor,
className
}));
}
return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', {
align
});
}
if (images.length > 0) {
return images.map(({
url,
alt,
caption
}, index) => (0,external_wp_blocks_namespaceObject.createBlock)('core/image', {
id: ids[index],
url,
alt,
caption,
align,
sizeSlug
}));
}
return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', {
align
});
}
}]
};
/* harmony default export */ const gallery_transforms = (gallery_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const gallery_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/gallery",
title: "Gallery",
category: "media",
allowedBlocks: ["core/image"],
description: "Display multiple images in a rich gallery.",
keywords: ["images", "photos"],
textdomain: "default",
attributes: {
images: {
type: "array",
"default": [],
source: "query",
selector: ".blocks-gallery-item",
query: {
url: {
type: "string",
source: "attribute",
selector: "img",
attribute: "src"
},
fullUrl: {
type: "string",
source: "attribute",
selector: "img",
attribute: "data-full-url"
},
link: {
type: "string",
source: "attribute",
selector: "img",
attribute: "data-link"
},
alt: {
type: "string",
source: "attribute",
selector: "img",
attribute: "alt",
"default": ""
},
id: {
type: "string",
source: "attribute",
selector: "img",
attribute: "data-id"
},
caption: {
type: "rich-text",
source: "rich-text",
selector: ".blocks-gallery-item__caption"
}
}
},
ids: {
type: "array",
items: {
type: "number"
},
"default": []
},
shortCodeTransforms: {
type: "array",
items: {
type: "object"
},
"default": []
},
columns: {
type: "number",
minimum: 1,
maximum: 8
},
caption: {
type: "rich-text",
source: "rich-text",
selector: ".blocks-gallery-caption"
},
imageCrop: {
type: "boolean",
"default": true
},
randomOrder: {
type: "boolean",
"default": false
},
fixedHeight: {
type: "boolean",
"default": true
},
linkTarget: {
type: "string"
},
linkTo: {
type: "string"
},
sizeSlug: {
type: "string",
"default": "large"
},
allowResize: {
type: "boolean",
"default": false
}
},
providesContext: {
allowResize: "allowResize",
imageCrop: "imageCrop",
fixedHeight: "fixedHeight"
},
supports: {
anchor: true,
align: true,
html: false,
units: ["px", "em", "rem", "vh", "vw"],
spacing: {
margin: true,
padding: true,
blockGap: ["horizontal", "vertical"],
__experimentalSkipSerialization: ["blockGap"],
__experimentalDefaultControls: {
blockGap: true,
margin: false,
padding: false
}
},
color: {
text: false,
background: true,
gradients: true
},
layout: {
allowSwitching: false,
allowInheriting: false,
allowEditing: false,
"default": {
type: "flex"
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-gallery-editor",
style: "wp-block-gallery"
};
const {
name: gallery_name
} = gallery_metadata;
const gallery_settings = {
icon: library_gallery,
example: {
attributes: {
columns: 2
},
innerBlocks: [{
name: 'core/image',
attributes: {
url: 'https://s.w.org/images/core/5.3/Glacial_lakes%2C_Bhutan.jpg'
}
}, {
name: 'core/image',
attributes: {
url: 'https://s.w.org/images/core/5.3/Sediment_off_the_Yucatan_Peninsula.jpg'
}
}]
},
transforms: gallery_transforms,
edit: edit_wrapper,
save: saveWithInnerBlocks,
deprecated: gallery_deprecated
};
const gallery_init = () => initBlock({
name: gallery_name,
metadata: gallery_metadata,
settings: gallery_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const migrateAttributes = attributes => {
if (!attributes.tagName) {
attributes = {
...attributes,
tagName: 'div'
};
}
if (!attributes.customTextColor && !attributes.customBackgroundColor) {
return attributes;
}
const style = {
color: {}
};
if (attributes.customTextColor) {
style.color.text = attributes.customTextColor;
}
if (attributes.customBackgroundColor) {
style.color.background = attributes.customBackgroundColor;
}
const {
customTextColor,
customBackgroundColor,
...restAttributes
} = attributes;
return {
...restAttributes,
style
};
};
const group_deprecated_deprecated = [
// Version with default layout.
{
attributes: {
tagName: {
type: 'string',
default: 'div'
},
templateLock: {
type: ['string', 'boolean'],
enum: ['all', 'insert', false]
}
},
supports: {
__experimentalOnEnter: true,
__experimentalSettings: true,
align: ['wide', 'full'],
anchor: true,
ariaLabel: true,
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: ['top', 'bottom'],
padding: true,
blockGap: true,
__experimentalDefaultControls: {
padding: true,
blockGap: true
}
},
__experimentalBorder: {
color: true,
radius: true,
style: true,
width: true,
__experimentalDefaultControls: {
color: true,
radius: true,
style: true,
width: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalDefaultControls: {
fontSize: true
}
},
layout: true
},
save({
attributes: {
tagName: Tag
}
}) {
return (0,external_React_namespaceObject.createElement)(Tag, {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(external_wp_blockEditor_namespaceObject.useBlockProps.save())
});
},
isEligible: ({
layout
}) => !layout || layout.inherit || layout.contentSize && layout.type !== 'constrained',
migrate: attributes => {
const {
layout = null
} = attributes;
if (!layout) {
return attributes;
}
if (layout.inherit || layout.contentSize) {
return {
...attributes,
layout: {
...layout,
type: 'constrained'
}
};
}
}
},
// Version of the block with the double div.
{
attributes: {
tagName: {
type: 'string',
default: 'div'
},
templateLock: {
type: ['string', 'boolean'],
enum: ['all', 'insert', false]
}
},
supports: {
align: ['wide', 'full'],
anchor: true,
color: {
gradients: true,
link: true
},
spacing: {
padding: true
},
__experimentalBorder: {
radius: true
}
},
save({
attributes
}) {
const {
tagName: Tag
} = attributes;
return (0,external_React_namespaceObject.createElement)(Tag, {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-group__inner-container"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null)));
}
},
// Version of the block without global styles support
{
attributes: {
backgroundColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
textColor: {
type: 'string'
},
customTextColor: {
type: 'string'
}
},
supports: {
align: ['wide', 'full'],
anchor: true,
html: false
},
migrate: migrateAttributes,
save({
attributes
}) {
const {
backgroundColor,
customBackgroundColor,
textColor,
customTextColor
} = attributes;
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const className = classnames_default()(backgroundClass, textClass, {
'has-text-color': textColor || customTextColor,
'has-background': backgroundColor || customBackgroundColor
});
const styles = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
color: textClass ? undefined : customTextColor
};
return (0,external_React_namespaceObject.createElement)("div", {
className: className,
style: styles
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-group__inner-container"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null)));
}
},
// Version of the group block with a bug that made text color class not applied.
{
attributes: {
backgroundColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
textColor: {
type: 'string'
},
customTextColor: {
type: 'string'
}
},
migrate: migrateAttributes,
supports: {
align: ['wide', 'full'],
anchor: true,
html: false
},
save({
attributes
}) {
const {
backgroundColor,
customBackgroundColor,
textColor,
customTextColor
} = attributes;
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const className = classnames_default()(backgroundClass, {
'has-text-color': textColor || customTextColor,
'has-background': backgroundColor || customBackgroundColor
});
const styles = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
color: textClass ? undefined : customTextColor
};
return (0,external_React_namespaceObject.createElement)("div", {
className: className,
style: styles
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-group__inner-container"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null)));
}
},
// v1 of group block. Deprecated to add an inner-container div around `InnerBlocks.Content`.
{
attributes: {
backgroundColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
}
},
supports: {
align: ['wide', 'full'],
anchor: true,
html: false
},
migrate: migrateAttributes,
save({
attributes
}) {
const {
backgroundColor,
customBackgroundColor
} = attributes;
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const className = classnames_default()(backgroundClass, {
'has-background': backgroundColor || customBackgroundColor
});
const styles = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor
};
return (0,external_React_namespaceObject.createElement)("div", {
className: className,
style: styles
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
}
}];
/* harmony default export */ const group_deprecated = (group_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/placeholder.js
/**
* WordPress dependencies
*/
/**
* Returns a custom variation icon.
*
* @param {string} name The block variation name.
*
* @return {JSX.Element} The SVG element.
*/
const getGroupPlaceholderIcons = (name = 'group') => {
const icons = {
group: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
width: "44",
height: "32",
viewBox: "0 0 44 32"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M42 0H2C.9 0 0 .9 0 2v28c0 1.1.9 2 2 2h40c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2z"
})),
'group-row': (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
width: "44",
height: "32",
viewBox: "0 0 44 32"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M42 0H23.5c-.6 0-1 .4-1 1v30c0 .6.4 1 1 1H42c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zM20.5 0H2C.9 0 0 .9 0 2v28c0 1.1.9 2 2 2h18.5c.6 0 1-.4 1-1V1c0-.6-.4-1-1-1z"
})),
'group-stack': (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
width: "44",
height: "32",
viewBox: "0 0 44 32"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M42 0H2C.9 0 0 .9 0 2v12.5c0 .6.4 1 1 1h42c.6 0 1-.4 1-1V2c0-1.1-.9-2-2-2zm1 16.5H1c-.6 0-1 .4-1 1V30c0 1.1.9 2 2 2h40c1.1 0 2-.9 2-2V17.5c0-.6-.4-1-1-1z"
})),
'group-grid': (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
width: "44",
height: "32",
viewBox: "0 0 44 32"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "m20.30137,-0.00025l-18.9728,0c-0.86524,0.07234 -1.41711,0.79149 -1.41711,1.89149l0,12.64468c0,0.6 0.73401,0.96383 1.0304,0.96383l19.67469,0.03617c0.29639,0 1.0304,-0.4 1.0304,-1l-0.03576,-12.7532c0,-1.1 -0.76644,-1.78297 -1.30983,-1.78297zm0.52975,16.60851l-19.99654,-0.03617c-0.29639,0 -0.92312,0.36383 -0.92312,0.96383l-0.03576,12.68085c0,1.1 0.8022,1.81915 1.34559,1.81915l19.00857,0c0.54339,0 1.45287,-0.71915 1.45287,-1.81915l0,-12.53617c0,-0.6 -0.5552,-1.07234 -0.8516,-1.07234z"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "m42.73056,-0.03617l-18.59217,0c-0.84788,0.07234 -1.38868,0.79149 -1.38868,1.89149l0,12.64468c0,0.6 0.71928,0.96383 1.00973,0.96383l19.27997,0.03617c0.29045,0 1.00973,-0.4 1.00973,-1l-0.03504,-12.7532c0,-1.1 -0.75106,-1.78297 -1.28355,-1.78297zm0.51912,16.60851l-19.59537,-0.03617c-0.29045,0 -0.9046,0.36383 -0.9046,0.96383l-0.03504,12.68085c0,1.1 0.78611,1.81915 1.31859,1.81915l18.62721,0c0.53249,0 1.42372,-0.71915 1.42372,-1.81915l0,-12.53617c0,-0.6 -0.54407,-1.07234 -0.83451,-1.07234z"
}))
};
return icons?.[name];
};
/**
* A custom hook to tell the Group block whether to show the variation placeholder.
*
* @param {Object} props Arguments to pass to hook.
* @param {Object} [props.attributes] The block's attributes.
* @param {string} [props.usedLayoutType] The block's current layout type.
* @param {boolean} [props.hasInnerBlocks] Whether the block has inner blocks.
*
* @return {[boolean, Function]} A state value and setter function.
*/
function useShouldShowPlaceHolder({
attributes = {
style: undefined,
backgroundColor: undefined,
textColor: undefined,
fontSize: undefined
},
usedLayoutType = '',
hasInnerBlocks = false
}) {
const {
style,
backgroundColor,
textColor,
fontSize
} = attributes;
/*
* Shows the placeholder when no known styles are set,
* or when a non-default layout has been selected.
* Should the Group block support more style presets in the
* future, e.g., attributes.spacingSize, we can add them to the
* condition.
*/
const [showPlaceholder, setShowPlaceholder] = (0,external_wp_element_namespaceObject.useState)(!hasInnerBlocks && !backgroundColor && !fontSize && !textColor && !style && usedLayoutType !== 'flex' && usedLayoutType !== 'grid');
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!!hasInnerBlocks || !!backgroundColor || !!fontSize || !!textColor || !!style || usedLayoutType === 'flex') {
setShowPlaceholder(false);
}
}, [backgroundColor, fontSize, textColor, style, usedLayoutType, hasInnerBlocks]);
return [showPlaceholder, setShowPlaceholder];
}
/**
* Display group variations if none is selected.
*
* @param {Object} props Component props.
* @param {string} props.name The block's name.
* @param {Function} props.onSelect Function to set block's attributes.
*
* @return {JSX.Element} The placeholder.
*/
function GroupPlaceHolder({
name,
onSelect
}) {
const variations = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockVariations(name, 'block'), [name]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: 'wp-block-group__placeholder'
});
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
instructions: (0,external_wp_i18n_namespaceObject.__)('Group blocks together. Select a layout:')
}, (0,external_React_namespaceObject.createElement)("ul", {
role: "list",
className: "wp-block-group-placeholder__variations",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Block variations')
}, variations.map(variation => (0,external_React_namespaceObject.createElement)("li", {
key: variation.name
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
icon: getGroupPlaceholderIcons(variation.name),
iconSize: 44,
onClick: () => onSelect(variation),
className: "wp-block-group-placeholder__variation-button",
label: `${variation.title}: ${variation.description}`
}))))));
}
/* harmony default export */ const placeholder = (GroupPlaceHolder);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Render inspector controls for the Group block.
*
* @param {Object} props Component props.
* @param {string} props.tagName The HTML tag name.
* @param {Function} props.onSelectTagName onChange function for the SelectControl.
*
* @return {JSX.Element} The control group.
*/
function GroupEditControls({
tagName,
onSelectTagName
}) {
const htmlElementMessages = {
header: (0,external_wp_i18n_namespaceObject.__)('The <header> element should represent introductory content, typically a group of introductory or navigational aids.'),
main: (0,external_wp_i18n_namespaceObject.__)('The <main> element should be used for the primary content of your document only. '),
section: (0,external_wp_i18n_namespaceObject.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element."),
article: (0,external_wp_i18n_namespaceObject.__)('The <article> element should represent a self-contained, syndicatable portion of the document.'),
aside: (0,external_wp_i18n_namespaceObject.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."),
footer: (0,external_wp_i18n_namespaceObject.__)('The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).')
};
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('HTML element'),
options: [{
label: (0,external_wp_i18n_namespaceObject.__)('Default (<div>)'),
value: 'div'
}, {
label: '<header>',
value: 'header'
}, {
label: '<main>',
value: 'main'
}, {
label: '<section>',
value: 'section'
}, {
label: '<article>',
value: 'article'
}, {
label: '<aside>',
value: 'aside'
}, {
label: '<footer>',
value: 'footer'
}],
value: tagName,
onChange: onSelectTagName,
help: htmlElementMessages[tagName]
}));
}
function GroupEdit({
attributes,
name,
setAttributes,
clientId
}) {
const {
hasInnerBlocks,
themeSupportsLayout
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlock,
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
const block = getBlock(clientId);
return {
hasInnerBlocks: !!(block && block.innerBlocks.length),
themeSupportsLayout: getSettings()?.supportsLayout
};
}, [clientId]);
const {
tagName: TagName = 'div',
templateLock,
allowedBlocks,
layout = {}
} = attributes;
// Layout settings.
const {
type = 'default'
} = layout;
const layoutSupportEnabled = themeSupportsLayout || type === 'flex' || type === 'grid';
// Hooks.
const ref = (0,external_wp_element_namespaceObject.useRef)();
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
ref
});
const [showPlaceholder, setShowPlaceholder] = useShouldShowPlaceHolder({
attributes,
usedLayoutType: type,
hasInnerBlocks
});
// Default to the regular appender being rendered.
let renderAppender;
if (showPlaceholder) {
// In the placeholder state, ensure the appender is not rendered.
// This is needed because `...innerBlocksProps` is used in the placeholder
// state so that blocks can dragged onto the placeholder area
// from both the list view and in the editor canvas.
renderAppender = false;
} else if (!hasInnerBlocks) {
// When there is no placeholder, but the block is also empty,
// use the larger button appender.
renderAppender = external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender;
}
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(layoutSupportEnabled ? blockProps : {
className: 'wp-block-group__inner-container'
}, {
dropZoneElement: ref.current,
templateLock,
allowedBlocks,
renderAppender
});
const {
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const selectVariation = nextVariation => {
setAttributes(nextVariation.attributes);
selectBlock(clientId, -1);
setShowPlaceholder(false);
};
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(GroupEditControls, {
tagName: TagName,
onSelectTagName: value => setAttributes({
tagName: value
})
}), showPlaceholder && (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.View, null, innerBlocksProps.children, (0,external_React_namespaceObject.createElement)(placeholder, {
name: name,
onSelect: selectVariation
})), layoutSupportEnabled && !showPlaceholder && (0,external_React_namespaceObject.createElement)(TagName, {
...innerBlocksProps
}), !layoutSupportEnabled && !showPlaceholder && (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
})));
}
/* harmony default export */ const group_edit = (GroupEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/save.js
/**
* WordPress dependencies
*/
function group_save_save({
attributes: {
tagName: Tag
}
}) {
return (0,external_React_namespaceObject.createElement)(Tag, {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(external_wp_blockEditor_namespaceObject.useBlockProps.save())
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/transforms.js
/**
* WordPress dependencies
*/
const group_transforms_transforms = {
from: [{
type: 'block',
isMultiBlock: true,
blocks: ['*'],
__experimentalConvert(blocks) {
const alignments = ['wide', 'full'];
// Determine the widest setting of all the blocks to be grouped
const widestAlignment = blocks.reduce((accumulator, block) => {
const {
align
} = block.attributes;
return alignments.indexOf(align) > alignments.indexOf(accumulator) ? align : accumulator;
}, undefined);
// Clone the Blocks to be Grouped
// Failing to create new block references causes the original blocks
// to be replaced in the switchToBlockType call thereby meaning they
// are removed both from their original location and within the
// new group block.
const groupInnerBlocks = blocks.map(block => {
return (0,external_wp_blocks_namespaceObject.createBlock)(block.name, block.attributes, block.innerBlocks);
});
return (0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
align: widestAlignment,
layout: {
type: 'constrained'
}
}, groupInnerBlocks);
}
}]
};
/* harmony default export */ const group_transforms = (group_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/row.js
/**
* WordPress dependencies
*/
const row = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 6.5h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4V16h5a.5.5 0 0 0 .5-.5v-7A.5.5 0 0 0 9 8H4V6.5Zm16 0h-5a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h5V16h-5a.5.5 0 0 1-.5-.5v-7A.5.5 0 0 1 15 8h5V6.5Z"
}));
/* harmony default export */ const library_row = (row);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stack.js
/**
* WordPress dependencies
*/
const stack = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.5 4v5a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V4H8v5a.5.5 0 0 0 .5.5h7A.5.5 0 0 0 16 9V4h1.5Zm0 16v-5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v5H8v-5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v5h1.5Z"
}));
/* harmony default export */ const library_stack = (stack);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/grid.js
/**
* WordPress dependencies
*/
const grid = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z",
fillRule: "evenodd",
clipRule: "evenodd"
}));
/* harmony default export */ const library_grid = (grid);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/variations.js
/**
* WordPress dependencies
*/
const group_variations_variations = [{
name: 'group',
title: (0,external_wp_i18n_namespaceObject.__)('Group'),
description: (0,external_wp_i18n_namespaceObject.__)('Gather blocks in a container.'),
attributes: {
layout: {
type: 'constrained'
}
},
isDefault: true,
scope: ['block', 'inserter', 'transform'],
isActive: blockAttributes => !blockAttributes.layout || !blockAttributes.layout?.type || blockAttributes.layout?.type === 'default' || blockAttributes.layout?.type === 'constrained',
icon: library_group
}, {
name: 'group-row',
title: (0,external_wp_i18n_namespaceObject._x)('Row', 'single horizontal line'),
description: (0,external_wp_i18n_namespaceObject.__)('Arrange blocks horizontally.'),
attributes: {
layout: {
type: 'flex',
flexWrap: 'nowrap'
}
},
scope: ['block', 'inserter', 'transform'],
isActive: blockAttributes => blockAttributes.layout?.type === 'flex' && (!blockAttributes.layout?.orientation || blockAttributes.layout?.orientation === 'horizontal'),
icon: library_row
}, {
name: 'group-stack',
title: (0,external_wp_i18n_namespaceObject.__)('Stack'),
description: (0,external_wp_i18n_namespaceObject.__)('Arrange blocks vertically.'),
attributes: {
layout: {
type: 'flex',
orientation: 'vertical'
}
},
scope: ['block', 'inserter', 'transform'],
isActive: blockAttributes => blockAttributes.layout?.type === 'flex' && blockAttributes.layout?.orientation === 'vertical',
icon: library_stack
}];
if (window?.__experimentalEnableGroupGridVariation) {
group_variations_variations.push({
name: 'group-grid',
title: (0,external_wp_i18n_namespaceObject.__)('Grid'),
description: (0,external_wp_i18n_namespaceObject.__)('Arrange blocks in a grid.'),
attributes: {
layout: {
type: 'grid'
}
},
scope: ['block', 'inserter', 'transform'],
isActive: blockAttributes => blockAttributes.layout?.type === 'grid',
icon: library_grid
});
}
/* harmony default export */ const group_variations = (group_variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const group_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/group",
title: "Group",
category: "design",
description: "Gather blocks in a layout container.",
keywords: ["container", "wrapper", "row", "section"],
textdomain: "default",
attributes: {
tagName: {
type: "string",
"default": "div"
},
templateLock: {
type: ["string", "boolean"],
"enum": ["all", "insert", "contentOnly", false]
},
allowedBlocks: {
type: "array"
}
},
supports: {
__experimentalOnEnter: true,
__experimentalOnMerge: true,
__experimentalSettings: true,
align: ["wide", "full"],
anchor: true,
ariaLabel: true,
html: false,
background: {
backgroundImage: true,
backgroundSize: true,
__experimentalDefaultControls: {
backgroundImage: true
}
},
color: {
gradients: true,
heading: true,
button: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: ["top", "bottom"],
padding: true,
blockGap: true,
__experimentalDefaultControls: {
padding: true,
blockGap: true
}
},
dimensions: {
minHeight: true
},
__experimentalBorder: {
color: true,
radius: true,
style: true,
width: true,
__experimentalDefaultControls: {
color: true,
radius: true,
style: true,
width: true
}
},
position: {
sticky: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
layout: {
allowSizingOnChildren: true
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-group-editor",
style: "wp-block-group"
};
const {
name: group_name
} = group_metadata;
const group_settings = {
icon: library_group,
example: {
attributes: {
style: {
color: {
text: '#000000',
background: '#ffffff'
}
}
},
innerBlocks: [{
name: 'core/paragraph',
attributes: {
customTextColor: '#cf2e2e',
fontSize: 'large',
content: (0,external_wp_i18n_namespaceObject.__)('One.')
}
}, {
name: 'core/paragraph',
attributes: {
customTextColor: '#ff6900',
fontSize: 'large',
content: (0,external_wp_i18n_namespaceObject.__)('Two.')
}
}, {
name: 'core/paragraph',
attributes: {
customTextColor: '#fcb900',
fontSize: 'large',
content: (0,external_wp_i18n_namespaceObject.__)('Three.')
}
}, {
name: 'core/paragraph',
attributes: {
customTextColor: '#00d084',
fontSize: 'large',
content: (0,external_wp_i18n_namespaceObject.__)('Four.')
}
}, {
name: 'core/paragraph',
attributes: {
customTextColor: '#0693e3',
fontSize: 'large',
content: (0,external_wp_i18n_namespaceObject.__)('Five.')
}
}, {
name: 'core/paragraph',
attributes: {
customTextColor: '#9b51e0',
fontSize: 'large',
content: (0,external_wp_i18n_namespaceObject.__)('Six.')
}
}]
},
transforms: group_transforms,
edit: group_edit,
save: group_save_save,
deprecated: group_deprecated,
variations: group_variations
};
const group_init = () => initBlock({
name: group_name,
metadata: group_metadata,
settings: group_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/heading.js
/**
* WordPress dependencies
*/
const heading = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M6 5V18.5911L12 13.8473L18 18.5911V5H6Z"
}));
/* harmony default export */ const library_heading = (heading);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const blockSupports = {
className: false,
anchor: true
};
const heading_deprecated_blockAttributes = {
align: {
type: 'string'
},
content: {
type: 'string',
source: 'html',
selector: 'h1,h2,h3,h4,h5,h6',
default: ''
},
level: {
type: 'number',
default: 2
},
placeholder: {
type: 'string'
}
};
const deprecated_migrateCustomColors = attributes => {
if (!attributes.customTextColor) {
return attributes;
}
const style = {
color: {
text: attributes.customTextColor
}
};
const {
customTextColor,
...restAttributes
} = attributes;
return {
...restAttributes,
style
};
};
const TEXT_ALIGN_OPTIONS = ['left', 'right', 'center'];
const migrateTextAlign = attributes => {
const {
align,
...rest
} = attributes;
return TEXT_ALIGN_OPTIONS.includes(align) ? {
...rest,
textAlign: align
} : attributes;
};
const heading_deprecated_v1 = {
supports: blockSupports,
attributes: {
...heading_deprecated_blockAttributes,
customTextColor: {
type: 'string'
},
textColor: {
type: 'string'
}
},
migrate: attributes => deprecated_migrateCustomColors(migrateTextAlign(attributes)),
save({
attributes
}) {
const {
align,
level,
content,
textColor,
customTextColor
} = attributes;
const tagName = 'h' + level;
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const className = classnames_default()({
[textClass]: textClass
});
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
className: className ? className : undefined,
tagName: tagName,
style: {
textAlign: align,
color: textClass ? undefined : customTextColor
},
value: content
});
}
};
const heading_deprecated_v2 = {
attributes: {
...heading_deprecated_blockAttributes,
customTextColor: {
type: 'string'
},
textColor: {
type: 'string'
}
},
migrate: attributes => deprecated_migrateCustomColors(migrateTextAlign(attributes)),
save({
attributes
}) {
const {
align,
content,
customTextColor,
level,
textColor
} = attributes;
const tagName = 'h' + level;
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const className = classnames_default()({
[textClass]: textClass,
[`has-text-align-${align}`]: align
});
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
className: className ? className : undefined,
tagName: tagName,
style: {
color: textClass ? undefined : customTextColor
},
value: content
});
},
supports: blockSupports
};
const heading_deprecated_v3 = {
supports: blockSupports,
attributes: {
...heading_deprecated_blockAttributes,
customTextColor: {
type: 'string'
},
textColor: {
type: 'string'
}
},
migrate: attributes => deprecated_migrateCustomColors(migrateTextAlign(attributes)),
save({
attributes
}) {
const {
align,
content,
customTextColor,
level,
textColor
} = attributes;
const tagName = 'h' + level;
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const className = classnames_default()({
[textClass]: textClass,
'has-text-color': textColor || customTextColor,
[`has-text-align-${align}`]: align
});
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
className: className ? className : undefined,
tagName: tagName,
style: {
color: textClass ? undefined : customTextColor
},
value: content
});
}
};
const heading_deprecated_v4 = {
supports: {
align: ['wide', 'full'],
anchor: true,
className: false,
color: {
link: true
},
fontSize: true,
lineHeight: true,
__experimentalSelector: {
'core/heading/h1': 'h1',
'core/heading/h2': 'h2',
'core/heading/h3': 'h3',
'core/heading/h4': 'h4',
'core/heading/h5': 'h5',
'core/heading/h6': 'h6'
},
__unstablePasteTextInline: true
},
attributes: heading_deprecated_blockAttributes,
isEligible: ({
align
}) => TEXT_ALIGN_OPTIONS.includes(align),
migrate: migrateTextAlign,
save({
attributes
}) {
const {
align,
content,
level
} = attributes;
const TagName = 'h' + level;
const className = classnames_default()({
[`has-text-align-${align}`]: align
});
return (0,external_React_namespaceObject.createElement)(TagName, {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: content
}));
}
};
// This deprecation covers the serialization of the `wp-block-heading` class
// into the block's markup after className support was enabled.
const heading_deprecated_v5 = {
supports: {
align: ['wide', 'full'],
anchor: true,
className: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalDefaultControls: {
fontSize: true,
fontAppearance: true,
textTransform: true
}
},
__experimentalSelector: 'h1,h2,h3,h4,h5,h6',
__unstablePasteTextInline: true,
__experimentalSlashInserter: true
},
attributes: {
textAlign: {
type: 'string'
},
content: {
type: 'string',
source: 'html',
selector: 'h1,h2,h3,h4,h5,h6',
default: '',
__experimentalRole: 'content'
},
level: {
type: 'number',
default: 2
},
placeholder: {
type: 'string'
}
},
save({
attributes
}) {
const {
textAlign,
content,
level
} = attributes;
const TagName = 'h' + level;
const className = classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
});
return (0,external_React_namespaceObject.createElement)(TagName, {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: content
}));
}
};
const heading_deprecated_deprecated = [heading_deprecated_v5, heading_deprecated_v4, heading_deprecated_v3, heading_deprecated_v2, heading_deprecated_v1];
/* harmony default export */ const heading_deprecated = (heading_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/autogenerate-anchors.js
/**
* External dependencies
*/
/**
* Object map tracking anchors.
*
* @type {Record<string, string | null>}
*/
const autogenerate_anchors_anchors = {};
/**
* Returns the text without markup.
*
* @param {string} text The text.
*
* @return {string} The text without markup.
*/
const getTextWithoutMarkup = text => {
const dummyElement = document.createElement('div');
dummyElement.innerHTML = text;
return dummyElement.innerText;
};
/**
* Get the slug from the content.
*
* @param {string} content The block content.
*
* @return {string} Returns the slug.
*/
const getSlug = content => {
// Get the slug.
return remove_accents_default()(getTextWithoutMarkup(content))
// Convert anything that's not a letter or number to a hyphen.
.replace(/[^\p{L}\p{N}]+/gu, '-')
// Convert to lowercase
.toLowerCase()
// Remove any remaining leading or trailing hyphens.
.replace(/(^-+)|(-+$)/g, '');
};
/**
* Generate the anchor for a heading.
*
* @param {string} clientId The block ID.
* @param {string} content The block content.
*
* @return {string|null} Return the heading anchor.
*/
const generateAnchor = (clientId, content) => {
const slug = getSlug(content);
// If slug is empty, then return null.
// Returning null instead of an empty string allows us to check again when the content changes.
if ('' === slug) {
return null;
}
delete autogenerate_anchors_anchors[clientId];
let anchor = slug;
let i = 0;
// If the anchor already exists in another heading, append -i.
while (Object.values(autogenerate_anchors_anchors).includes(anchor)) {
i += 1;
anchor = slug + '-' + i;
}
return anchor;
};
/**
* Set the anchor for a heading.
*
* @param {string} clientId The block ID.
* @param {string|null} anchor The block anchor.
*/
const setAnchor = (clientId, anchor) => {
autogenerate_anchors_anchors[clientId] = anchor;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function HeadingEdit({
attributes,
setAttributes,
mergeBlocks,
onReplace,
style,
clientId
}) {
const {
textAlign,
content,
level,
placeholder,
anchor
} = attributes;
const tagName = 'h' + level;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
}),
style
});
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
const {
canGenerateAnchors
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getGlobalBlockCount,
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
const settings = getSettings();
return {
canGenerateAnchors: !!settings.generateAnchors || getGlobalBlockCount('core/table-of-contents') > 0
};
}, []);
const {
__unstableMarkNextChangeAsNotPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
// Initially set anchor for headings that have content but no anchor set.
// This is used when transforming a block to heading, or for legacy anchors.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!canGenerateAnchors) {
return;
}
if (!anchor && content) {
// This side-effect should not create an undo level.
__unstableMarkNextChangeAsNotPersistent();
setAttributes({
anchor: generateAnchor(clientId, content)
});
}
setAnchor(clientId, anchor);
// Remove anchor map when block unmounts.
return () => setAnchor(clientId, null);
}, [anchor, content, clientId, canGenerateAnchors]);
const onContentChange = value => {
const newAttrs = {
content: value
};
if (canGenerateAnchors && (!anchor || !value || generateAnchor(clientId, content) === anchor)) {
newAttrs.anchor = generateAnchor(clientId, value);
}
setAttributes(newAttrs);
};
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, blockEditingMode === 'default' && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.HeadingLevelDropdown, {
value: level,
onChange: newLevel => setAttributes({
level: newLevel
})
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "content",
tagName: tagName,
value: content,
onChange: onContentChange,
onMerge: mergeBlocks,
onSplit: (value, isOriginal) => {
let block;
if (isOriginal || value) {
block = (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
...attributes,
content: value
});
} else {
var _getDefaultBlockName;
block = (0,external_wp_blocks_namespaceObject.createBlock)((_getDefaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)()) !== null && _getDefaultBlockName !== void 0 ? _getDefaultBlockName : 'core/heading');
}
if (isOriginal) {
block.clientId = clientId;
}
return block;
},
onReplace: onReplace,
onRemove: () => onReplace([]),
placeholder: placeholder || (0,external_wp_i18n_namespaceObject.__)('Heading'),
textAlign: textAlign,
...(external_wp_element_namespaceObject.Platform.isNative && {
deleteEnter: true
}),
...blockProps
}));
}
/* harmony default export */ const heading_edit = (HeadingEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function heading_save_save({
attributes
}) {
const {
textAlign,
content,
level
} = attributes;
const TagName = 'h' + level;
const className = classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
});
return (0,external_React_namespaceObject.createElement)(TagName, {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: content
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/shared.js
/**
* Given a node name string for a heading node, returns its numeric level.
*
* @param {string} nodeName Heading node name.
*
* @return {number} Heading level.
*/
function getLevelFromHeadingNodeName(nodeName) {
return Number(nodeName.substr(1));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/transforms.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const heading_transforms_transforms = {
from: [{
type: 'block',
isMultiBlock: true,
blocks: ['core/paragraph'],
transform: attributes => attributes.map(({
content,
anchor,
align: textAlign,
metadata
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
content,
anchor,
textAlign,
metadata: getTransformedMetadata(metadata, 'core/heading', ({
content: contentBinding
}) => ({
content: contentBinding
}))
}))
}, {
type: 'raw',
selector: 'h1,h2,h3,h4,h5,h6',
schema: ({
phrasingContentSchema,
isPaste
}) => {
const schema = {
children: phrasingContentSchema,
attributes: isPaste ? [] : ['style', 'id']
};
return {
h1: schema,
h2: schema,
h3: schema,
h4: schema,
h5: schema,
h6: schema
};
},
transform(node) {
const attributes = (0,external_wp_blocks_namespaceObject.getBlockAttributes)('core/heading', node.outerHTML);
const {
textAlign
} = node.style || {};
attributes.level = getLevelFromHeadingNodeName(node.nodeName);
if (textAlign === 'left' || textAlign === 'center' || textAlign === 'right') {
attributes.align = textAlign;
}
return (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', attributes);
}
}, ...[1, 2, 3, 4, 5, 6].map(level => ({
type: 'prefix',
prefix: Array(level + 1).join('#'),
transform(content) {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
level,
content
});
}
})), ...[1, 2, 3, 4, 5, 6].map(level => ({
type: 'enter',
regExp: new RegExp(`^/(h|H)${level}$`),
transform: () => (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
level
})
}))],
to: [{
type: 'block',
isMultiBlock: true,
blocks: ['core/paragraph'],
transform: attributes => attributes.map(({
content,
textAlign: align,
metadata
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content,
align,
metadata: getTransformedMetadata(metadata, 'core/paragraph', ({
content: contentBinding
}) => ({
content: contentBinding
}))
}))
}]
};
/* harmony default export */ const heading_transforms = (heading_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const heading_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/heading",
title: "Heading",
category: "text",
description: "Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.",
keywords: ["title", "subtitle"],
textdomain: "default",
attributes: {
textAlign: {
type: "string"
},
content: {
type: "rich-text",
source: "rich-text",
selector: "h1,h2,h3,h4,h5,h6",
__experimentalRole: "content"
},
level: {
type: "number",
"default": 2
},
placeholder: {
type: "string"
}
},
supports: {
align: ["wide", "full"],
anchor: true,
className: true,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalWritingMode: true,
__experimentalDefaultControls: {
fontSize: true
}
},
__unstablePasteTextInline: true,
__experimentalSlashInserter: true,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-heading-editor",
style: "wp-block-heading"
};
const {
name: heading_name
} = heading_metadata;
const heading_settings = {
icon: library_heading,
example: {
attributes: {
content: (0,external_wp_i18n_namespaceObject.__)('Code is Poetry'),
level: 2
}
},
__experimentalLabel(attributes, {
context
}) {
const {
content,
level
} = attributes;
const customName = attributes?.metadata?.name;
const hasContent = content?.length > 0;
// In the list view, use the block's content as the label.
// If the content is empty, fall back to the default label.
if (context === 'list-view' && (customName || hasContent)) {
return customName || content;
}
if (context === 'accessibility') {
return !hasContent ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. %s: heading level. */
(0,external_wp_i18n_namespaceObject.__)('Level %s. Empty.'), level) : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: heading level. 2: heading content. */
(0,external_wp_i18n_namespaceObject.__)('Level %1$s. %2$s'), level, content);
}
},
transforms: heading_transforms,
deprecated: heading_deprecated,
merge(attributes, attributesToMerge) {
return {
content: (attributes.content || '') + (attributesToMerge.content || '')
};
},
edit: heading_edit,
save: heading_save_save
};
const heading_init = () => initBlock({
name: heading_name,
metadata: heading_metadata,
settings: heading_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/home.js
/**
* WordPress dependencies
*/
const home = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"
}));
/* harmony default export */ const library_home = (home);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/home-link/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const preventDefault = event => event.preventDefault();
function HomeEdit({
attributes,
setAttributes,
context
}) {
const {
homeUrl
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getUnstableBase // Site index.
} = select(external_wp_coreData_namespaceObject.store);
return {
homeUrl: getUnstableBase()?.home
};
}, []);
const {
__unstableMarkNextChangeAsNotPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
textColor,
backgroundColor,
style
} = context;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()('wp-block-navigation-item', {
'has-text-color': !!textColor || !!style?.color?.text,
[`has-${textColor}-color`]: !!textColor,
'has-background': !!backgroundColor || !!style?.color?.background,
[`has-${backgroundColor}-background-color`]: !!backgroundColor
}),
style: {
color: style?.color?.text,
backgroundColor: style?.color?.background
}
});
const {
label
} = attributes;
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (label === undefined) {
__unstableMarkNextChangeAsNotPersistent();
setAttributes({
label: (0,external_wp_i18n_namespaceObject.__)('Home')
});
}
}, [label]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("a", {
className: "wp-block-home-link__content wp-block-navigation-item__content",
href: homeUrl,
onClick: preventDefault
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "label",
className: "wp-block-home-link__label",
value: label,
onChange: labelValue => {
setAttributes({
label: labelValue
});
},
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Home link text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Add home link'),
withoutInteractiveFormatting: true,
allowedFormats: ['core/bold', 'core/italic', 'core/image', 'core/strikethrough']
}))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/home-link/save.js
/**
* WordPress dependencies
*/
function home_link_save_save() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/home-link/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const home_link_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/home-link",
category: "design",
parent: ["core/navigation"],
title: "Home Link",
description: "Create a link that always points to the homepage of the site. Usually not necessary if there is already a site title link present in the header.",
textdomain: "default",
attributes: {
label: {
type: "string"
}
},
usesContext: ["textColor", "customTextColor", "backgroundColor", "customBackgroundColor", "fontSize", "customFontSize", "style"],
supports: {
reusable: false,
html: false,
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-home-link-editor",
style: "wp-block-home-link"
};
const {
name: home_link_name
} = home_link_metadata;
const home_link_settings = {
icon: library_home,
edit: HomeEdit,
save: home_link_save_save,
example: {
attributes: {
label: (0,external_wp_i18n_namespaceObject._x)('Home Link', 'block example')
}
}
};
const home_link_init = () => initBlock({
name: home_link_name,
metadata: home_link_metadata,
settings: home_link_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/html.js
/**
* WordPress dependencies
*/
const html = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4.8 11.4H2.1V9H1v6h1.1v-2.6h2.7V15h1.1V9H4.8v2.4zm1.9-1.3h1.7V15h1.1v-4.9h1.7V9H6.7v1.1zM16.2 9l-1.5 2.7L13.3 9h-.9l-.8 6h1.1l.5-4 1.5 2.8 1.5-2.8.5 4h1.1L17 9h-.8zm3.8 5V9h-1.1v6h3.6v-1H20z"
}));
/* harmony default export */ const library_html = (html);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/html/preview.js
/**
* WordPress dependencies
*/
// Default styles used to unset some of the styles
// that might be inherited from the editor style.
const DEFAULT_STYLES = `
html,body,:root {
margin: 0 !important;
padding: 0 !important;
overflow: visible !important;
min-height: auto !important;
}
`;
function HTMLEditPreview({
content,
isSelected
}) {
const settingStyles = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings().styles);
const styles = (0,external_wp_element_namespaceObject.useMemo)(() => [DEFAULT_STYLES, ...(0,external_wp_blockEditor_namespaceObject.transformStyles)(settingStyles.filter(style => style.css))], [settingStyles]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SandBox, {
html: content,
styles: styles,
title: (0,external_wp_i18n_namespaceObject.__)('Custom HTML Preview'),
tabIndex: -1
}), !isSelected && (0,external_React_namespaceObject.createElement)("div", {
className: "block-library-html__preview-overlay"
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/html/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function HTMLEdit({
attributes,
setAttributes,
isSelected
}) {
const [isPreview, setIsPreview] = (0,external_wp_element_namespaceObject.useState)();
const isDisabled = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.Disabled.Context);
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(HTMLEdit, 'html-edit-desc');
function switchToPreview() {
setIsPreview(true);
}
function switchToHTML() {
setIsPreview(false);
}
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: 'block-library-html__edit',
'aria-describedby': isPreview ? instanceId : undefined
});
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
className: "components-tab-button",
isPressed: !isPreview,
onClick: switchToHTML
}, "HTML"), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
className: "components-tab-button",
isPressed: isPreview,
onClick: switchToPreview
}, (0,external_wp_i18n_namespaceObject.__)('Preview')))), isPreview || isDisabled ? (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(HTMLEditPreview, {
content: attributes.content,
isSelected: isSelected
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
id: instanceId
}, (0,external_wp_i18n_namespaceObject.__)('HTML preview is not yet fully accessible. Please switch screen reader to virtualized mode to navigate the below iFrame.'))) : (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.PlainText, {
value: attributes.content,
onChange: content => setAttributes({
content
}),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write HTML…'),
"aria-label": (0,external_wp_i18n_namespaceObject.__)('HTML')
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/html/save.js
/**
* WordPress dependencies
*/
function html_save_save({
attributes
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, attributes.content);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/html/transforms.js
/**
* WordPress dependencies
*/
const html_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/code'],
transform: ({
content: html
}) => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/html', {
// The code block may output HTML formatting, so convert it
// to plain text.
content: (0,external_wp_richText_namespaceObject.create)({
html
}).text
});
}
}]
};
/* harmony default export */ const html_transforms = (html_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/html/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const html_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/html",
title: "Custom HTML",
category: "widgets",
description: "Add custom HTML code and preview it as you edit.",
keywords: ["embed"],
textdomain: "default",
attributes: {
content: {
type: "string",
source: "raw"
}
},
supports: {
customClassName: false,
className: false,
html: false,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-html-editor"
};
const {
name: html_name
} = html_metadata;
const html_settings = {
icon: library_html,
example: {
attributes: {
content: '<marquee>' + (0,external_wp_i18n_namespaceObject.__)('Welcome to the wonderful world of blocks…') + '</marquee>'
}
},
edit: HTMLEdit,
save: html_save_save,
transforms: html_transforms
};
const html_init = () => initBlock({
name: html_name,
metadata: html_metadata,
settings: html_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Deprecation for adding the `wp-image-${id}` class to the image block for
* responsive images.
*
* @see https://github.com/WordPress/gutenberg/pull/4898
*/
const image_deprecated_v1 = {
attributes: {
url: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src'
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: ''
},
caption: {
type: 'array',
source: 'children',
selector: 'figcaption'
},
href: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'href'
},
id: {
type: 'number'
},
align: {
type: 'string'
},
width: {
type: 'number'
},
height: {
type: 'number'
}
},
save({
attributes
}) {
const {
url,
alt,
caption,
align,
href,
width,
height
} = attributes;
const extraImageProps = width || height ? {
width,
height
} : {};
const image = (0,external_React_namespaceObject.createElement)("img", {
src: url,
alt: alt,
...extraImageProps
});
let figureStyle = {};
if (width) {
figureStyle = {
width
};
} else if (align === 'left' || align === 'right') {
figureStyle = {
maxWidth: '50%'
};
}
return (0,external_React_namespaceObject.createElement)("figure", {
className: align ? `align${align}` : null,
style: figureStyle
}, href ? (0,external_React_namespaceObject.createElement)("a", {
href: href
}, image) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: caption
}));
}
};
/**
* Deprecation for adding the `is-resized` class to the image block to fix
* captions on resized images.
*
* @see https://github.com/WordPress/gutenberg/pull/6496
*/
const image_deprecated_v2 = {
attributes: {
url: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src'
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: ''
},
caption: {
type: 'array',
source: 'children',
selector: 'figcaption'
},
href: {
type: 'string',
source: 'attribute',
selector: 'a',
attribute: 'href'
},
id: {
type: 'number'
},
align: {
type: 'string'
},
width: {
type: 'number'
},
height: {
type: 'number'
}
},
save({
attributes
}) {
const {
url,
alt,
caption,
align,
href,
width,
height,
id
} = attributes;
const image = (0,external_React_namespaceObject.createElement)("img", {
src: url,
alt: alt,
className: id ? `wp-image-${id}` : null,
width: width,
height: height
});
return (0,external_React_namespaceObject.createElement)("figure", {
className: align ? `align${align}` : null
}, href ? (0,external_React_namespaceObject.createElement)("a", {
href: href
}, image) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: caption
}));
}
};
/**
* Deprecation for image floats including a wrapping div.
*
* @see https://github.com/WordPress/gutenberg/pull/7721
*/
const image_deprecated_v3 = {
attributes: {
url: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src'
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: ''
},
caption: {
type: 'array',
source: 'children',
selector: 'figcaption'
},
href: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'href'
},
id: {
type: 'number'
},
align: {
type: 'string'
},
width: {
type: 'number'
},
height: {
type: 'number'
},
linkDestination: {
type: 'string',
default: 'none'
}
},
save({
attributes
}) {
const {
url,
alt,
caption,
align,
href,
width,
height,
id
} = attributes;
const classes = classnames_default()({
[`align${align}`]: align,
'is-resized': width || height
});
const image = (0,external_React_namespaceObject.createElement)("img", {
src: url,
alt: alt,
className: id ? `wp-image-${id}` : null,
width: width,
height: height
});
return (0,external_React_namespaceObject.createElement)("figure", {
className: classes
}, href ? (0,external_React_namespaceObject.createElement)("a", {
href: href
}, image) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: caption
}));
}
};
/**
* Deprecation for removing the outer div wrapper around aligned images.
*
* @see https://github.com/WordPress/gutenberg/pull/38657
*/
const image_deprecated_v4 = {
attributes: {
align: {
type: 'string'
},
url: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src'
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: ''
},
caption: {
type: 'string',
source: 'html',
selector: 'figcaption'
},
title: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'title'
},
href: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'href'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'rel'
},
linkClass: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'class'
},
id: {
type: 'number'
},
width: {
type: 'number'
},
height: {
type: 'number'
},
sizeSlug: {
type: 'string'
},
linkDestination: {
type: 'string'
},
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'target'
}
},
supports: {
anchor: true
},
save({
attributes
}) {
const {
url,
alt,
caption,
align,
href,
rel,
linkClass,
width,
height,
id,
linkTarget,
sizeSlug,
title
} = attributes;
const newRel = !rel ? undefined : rel;
const classes = classnames_default()({
[`align${align}`]: align,
[`size-${sizeSlug}`]: sizeSlug,
'is-resized': width || height
});
const image = (0,external_React_namespaceObject.createElement)("img", {
src: url,
alt: alt,
className: id ? `wp-image-${id}` : null,
width: width,
height: height,
title: title
});
const figure = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, href ? (0,external_React_namespaceObject.createElement)("a", {
className: linkClass,
href: href,
target: linkTarget,
rel: newRel
}, image) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: caption
}));
if ('left' === align || 'right' === align || 'center' === align) {
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, (0,external_React_namespaceObject.createElement)("figure", {
className: classes
}, figure));
}
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes
})
}, figure);
}
};
/**
* Deprecation for moving existing border radius styles onto the inner img
* element where new border block support styles must be applied.
* It will also add a new `.has-custom-border` class for existing blocks
* with border radii set. This class is required to improve caption position
* and styling when an image within a gallery has a custom border or
* rounded corners.
*
* @see https://github.com/WordPress/gutenberg/pull/31366
*/
const image_deprecated_v5 = {
attributes: {
align: {
type: 'string'
},
url: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src'
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: ''
},
caption: {
type: 'string',
source: 'html',
selector: 'figcaption'
},
title: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'title'
},
href: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'href'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'rel'
},
linkClass: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'class'
},
id: {
type: 'number'
},
width: {
type: 'number'
},
height: {
type: 'number'
},
sizeSlug: {
type: 'string'
},
linkDestination: {
type: 'string'
},
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'target'
}
},
supports: {
anchor: true,
color: {
__experimentalDuotone: 'img',
text: false,
background: false
},
__experimentalBorder: {
radius: true,
__experimentalDefaultControls: {
radius: true
}
},
__experimentalStyle: {
spacing: {
margin: '0 0 1em 0'
}
}
},
save({
attributes
}) {
const {
url,
alt,
caption,
align,
href,
rel,
linkClass,
width,
height,
id,
linkTarget,
sizeSlug,
title
} = attributes;
const newRel = !rel ? undefined : rel;
const classes = classnames_default()({
[`align${align}`]: align,
[`size-${sizeSlug}`]: sizeSlug,
'is-resized': width || height
});
const image = (0,external_React_namespaceObject.createElement)("img", {
src: url,
alt: alt,
className: id ? `wp-image-${id}` : null,
width: width,
height: height,
title: title
});
const figure = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, href ? (0,external_React_namespaceObject.createElement)("a", {
className: linkClass,
href: href,
target: linkTarget,
rel: newRel
}, image) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: caption
}));
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes
})
}, figure);
}
};
/**
* Deprecation for adding width and height as style rules on the inner img.
*
* @see https://github.com/WordPress/gutenberg/pull/31366
*/
const image_deprecated_v6 = {
attributes: {
align: {
type: 'string'
},
url: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src',
__experimentalRole: 'content'
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: '',
__experimentalRole: 'content'
},
caption: {
type: 'string',
source: 'html',
selector: 'figcaption',
__experimentalRole: 'content'
},
title: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'title',
__experimentalRole: 'content'
},
href: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'href',
__experimentalRole: 'content'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'rel'
},
linkClass: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'class'
},
id: {
type: 'number',
__experimentalRole: 'content'
},
width: {
type: 'number'
},
height: {
type: 'number'
},
aspectRatio: {
type: 'string'
},
scale: {
type: 'string'
},
sizeSlug: {
type: 'string'
},
linkDestination: {
type: 'string'
},
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'target'
}
},
supports: {
anchor: true,
color: {
text: false,
background: false
},
filter: {
duotone: true
},
__experimentalBorder: {
color: true,
radius: true,
width: true,
__experimentalSkipSerialization: true,
__experimentalDefaultControls: {
color: true,
radius: true,
width: true
}
}
},
migrate(attributes) {
const {
height,
width
} = attributes;
return {
...attributes,
width: typeof width === 'number' ? `${width}px` : width,
height: typeof height === 'number' ? `${height}px` : height
};
},
save({
attributes
}) {
const {
url,
alt,
caption,
align,
href,
rel,
linkClass,
width,
height,
aspectRatio,
scale,
id,
linkTarget,
sizeSlug,
title
} = attributes;
const newRel = !rel ? undefined : rel;
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes);
const classes = classnames_default()({
[`align${align}`]: align,
[`size-${sizeSlug}`]: sizeSlug,
'is-resized': width || height,
'has-custom-border': !!borderProps.className || borderProps.style && Object.keys(borderProps.style).length > 0
});
const imageClasses = classnames_default()(borderProps.className, {
[`wp-image-${id}`]: !!id
});
const image = (0,external_React_namespaceObject.createElement)("img", {
src: url,
alt: alt,
className: imageClasses || undefined,
style: {
...borderProps.style,
aspectRatio,
objectFit: scale
},
width: width,
height: height,
title: title
});
const figure = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, href ? (0,external_React_namespaceObject.createElement)("a", {
className: linkClass,
href: href,
target: linkTarget,
rel: newRel
}, image) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'),
tagName: "figcaption",
value: caption
}));
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes
})
}, figure);
}
};
/**
* Deprecation for converting to string width and height block attributes and
* removing the width and height img element attributes which are not needed
* as they get added by the TODO hook.
*
* @see https://github.com/WordPress/gutenberg/pull/53274
*/
const image_deprecated_v7 = {
attributes: {
align: {
type: 'string'
},
url: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src',
__experimentalRole: 'content'
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: '',
__experimentalRole: 'content'
},
caption: {
type: 'string',
source: 'html',
selector: 'figcaption',
__experimentalRole: 'content'
},
title: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'title',
__experimentalRole: 'content'
},
href: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'href',
__experimentalRole: 'content'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'rel'
},
linkClass: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'class'
},
id: {
type: 'number',
__experimentalRole: 'content'
},
width: {
type: 'number'
},
height: {
type: 'number'
},
aspectRatio: {
type: 'string'
},
scale: {
type: 'string'
},
sizeSlug: {
type: 'string'
},
linkDestination: {
type: 'string'
},
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'target'
}
},
supports: {
anchor: true,
color: {
text: false,
background: false
},
filter: {
duotone: true
},
__experimentalBorder: {
color: true,
radius: true,
width: true,
__experimentalSkipSerialization: true,
__experimentalDefaultControls: {
color: true,
radius: true,
width: true
}
}
},
migrate({
width,
height,
...attributes
}) {
return {
...attributes,
width: `${width}px`,
height: `${height}px`
};
},
save({
attributes
}) {
const {
url,
alt,
caption,
align,
href,
rel,
linkClass,
width,
height,
aspectRatio,
scale,
id,
linkTarget,
sizeSlug,
title
} = attributes;
const newRel = !rel ? undefined : rel;
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes);
const classes = classnames_default()({
[`align${align}`]: align,
[`size-${sizeSlug}`]: sizeSlug,
'is-resized': width || height,
'has-custom-border': !!borderProps.className || borderProps.style && Object.keys(borderProps.style).length > 0
});
const imageClasses = classnames_default()(borderProps.className, {
[`wp-image-${id}`]: !!id
});
const image = (0,external_React_namespaceObject.createElement)("img", {
src: url,
alt: alt,
className: imageClasses || undefined,
style: {
...borderProps.style,
aspectRatio,
objectFit: scale,
width,
height
},
width: width,
height: height,
title: title
});
const figure = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, href ? (0,external_React_namespaceObject.createElement)("a", {
className: linkClass,
href: href,
target: linkTarget,
rel: newRel
}, image) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'),
tagName: "figcaption",
value: caption
}));
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes
})
}, figure);
}
};
const deprecated_v8 = {
attributes: {
align: {
type: 'string'
},
behaviors: {
type: 'object'
},
url: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'src',
__experimentalRole: 'content'
},
alt: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'alt',
default: '',
__experimentalRole: 'content'
},
caption: {
type: 'string',
source: 'html',
selector: 'figcaption',
__experimentalRole: 'content'
},
title: {
type: 'string',
source: 'attribute',
selector: 'img',
attribute: 'title',
__experimentalRole: 'content'
},
href: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'href',
__experimentalRole: 'content'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'rel'
},
linkClass: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'class'
},
id: {
type: 'number',
__experimentalRole: 'content'
},
width: {
type: 'string'
},
height: {
type: 'string'
},
aspectRatio: {
type: 'string'
},
scale: {
type: 'string'
},
sizeSlug: {
type: 'string'
},
linkDestination: {
type: 'string'
},
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'figure > a',
attribute: 'target'
}
},
supports: {
anchor: true,
color: {
text: false,
background: false
},
filter: {
duotone: true
},
__experimentalBorder: {
color: true,
radius: true,
width: true,
__experimentalSkipSerialization: true,
__experimentalDefaultControls: {
color: true,
radius: true,
width: true
}
}
},
migrate({
width,
height,
...attributes
}) {
// We need to perform a check here because in cases
// where attributes are added dynamically to blocks,
// block invalidation overrides the isEligible() method
// and forces the migration to run, so it's not guaranteed
// that `behaviors` or `behaviors.lightbox` will be defined.
if (!attributes.behaviors?.lightbox) {
return attributes;
}
const {
behaviors: {
lightbox: {
enabled
}
}
} = attributes;
const newAttributes = {
...attributes,
lightbox: {
enabled
}
};
delete newAttributes.behaviors;
return newAttributes;
},
isEligible(attributes) {
return !!attributes.behaviors;
},
save({
attributes
}) {
const {
url,
alt,
caption,
align,
href,
rel,
linkClass,
width,
height,
aspectRatio,
scale,
id,
linkTarget,
sizeSlug,
title
} = attributes;
const newRel = !rel ? undefined : rel;
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes);
const classes = classnames_default()({
[`align${align}`]: align,
[`size-${sizeSlug}`]: sizeSlug,
'is-resized': width || height,
'has-custom-border': !!borderProps.className || borderProps.style && Object.keys(borderProps.style).length > 0
});
const imageClasses = classnames_default()(borderProps.className, {
[`wp-image-${id}`]: !!id
});
const image = (0,external_React_namespaceObject.createElement)("img", {
src: url,
alt: alt,
className: imageClasses || undefined,
style: {
...borderProps.style,
aspectRatio,
objectFit: scale,
width,
height
},
title: title
});
const figure = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, href ? (0,external_React_namespaceObject.createElement)("a", {
className: linkClass,
href: href,
target: linkTarget,
rel: newRel
}, image) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'),
tagName: "figcaption",
value: caption
}));
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes
})
}, figure);
}
};
/* harmony default export */ const image_deprecated = ([deprecated_v8, image_deprecated_v7, image_deprecated_v6, image_deprecated_v5, image_deprecated_v4, image_deprecated_v3, image_deprecated_v2, image_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plugins.js
/**
* WordPress dependencies
*/
const plugins = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z"
}));
/* harmony default export */ const library_plugins = (plugins);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/crop.js
/**
* WordPress dependencies
*/
const crop = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M18 20v-2h2v-1.5H7.75a.25.25 0 0 1-.25-.25V4H6v2H4v1.5h2v8.75c0 .966.784 1.75 1.75 1.75h8.75v2H18ZM9.273 7.5h6.977a.25.25 0 0 1 .25.25v6.977H18V7.75A1.75 1.75 0 0 0 16.25 6H9.273v1.5Z"
}));
/* harmony default export */ const library_crop = (crop);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/overlay-text.js
/**
* WordPress dependencies
*/
const overlayText = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12-9.8c.4 0 .8-.3.9-.7l1.1-3h3.6l.5 1.7h1.9L13 9h-2.2l-3.4 9.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v12H20V6c0-1.1-.9-2-2-2zm-6 7l1.4 3.9h-2.7L12 11z"
}));
/* harmony default export */ const overlay_text = (overlayText);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js
/**
* WordPress dependencies
*/
const upload = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_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 */ const library_upload = (upload);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/use-client-width.js
/**
* WordPress dependencies
*/
function useClientWidth(ref, dependencies) {
const [clientWidth, setClientWidth] = (0,external_wp_element_namespaceObject.useState)();
function calculateClientWidth() {
setClientWidth(ref.current?.clientWidth);
}
(0,external_wp_element_namespaceObject.useEffect)(calculateClientWidth, dependencies);
(0,external_wp_element_namespaceObject.useEffect)(() => {
const {
defaultView
} = ref.current.ownerDocument;
defaultView.addEventListener('resize', calculateClientWidth);
return () => {
defaultView.removeEventListener('resize', calculateClientWidth);
};
}, []);
return clientWidth;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/utils/constants.js
// The following dropdown menu props aim to provide a consistent offset and
// placement for ToolsPanel menus for block controls to match color popovers.
const TOOLSPANEL_DROPDOWNMENU_PROPS = {
popoverProps: {
placement: 'left-start',
offset: 259 // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
}
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module constants
*/
const {
DimensionsTool,
ResolutionTool
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const scaleOptions = [{
value: 'cover',
label: (0,external_wp_i18n_namespaceObject._x)('Cover', 'Scale option for dimensions control'),
help: (0,external_wp_i18n_namespaceObject.__)('Image covers the space evenly.')
}, {
value: 'contain',
label: (0,external_wp_i18n_namespaceObject._x)('Contain', 'Scale option for dimensions control'),
help: (0,external_wp_i18n_namespaceObject.__)('Image is contained without distortion.')
}];
// If the image has a href, wrap in an <a /> tag to trigger any inherited link element styles.
const ImageWrapper = ({
href,
children
}) => {
if (!href) {
return children;
}
return (0,external_React_namespaceObject.createElement)("a", {
href: href,
onClick: event => event.preventDefault(),
"aria-disabled": true,
style: {
// When the Image block is linked,
// it's wrapped with a disabled <a /> tag.
// Restore cursor style so it doesn't appear 'clickable'
// and remove pointer events. Safari needs the display property.
pointerEvents: 'none',
cursor: 'default',
display: 'inline'
}
}, children);
};
function image_Image({
temporaryURL,
attributes,
setAttributes,
isSingleSelected,
insertBlocksAfter,
onReplace,
onSelectImage,
onSelectURL,
onUploadError,
containerRef,
context,
clientId,
blockEditingMode
}) {
const {
url = '',
alt,
align,
id,
href,
rel,
linkClass,
linkDestination,
title,
width,
height,
aspectRatio,
scale,
linkTarget,
sizeSlug,
lightbox,
metadata
} = attributes;
// The only supported unit is px, so we can parseInt to strip the px here.
const numericWidth = width ? parseInt(width, 10) : undefined;
const numericHeight = height ? parseInt(height, 10) : undefined;
const imageRef = (0,external_wp_element_namespaceObject.useRef)();
const {
allowResize = true
} = context;
const {
getBlock,
getSettings
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const image = (0,external_wp_data_namespaceObject.useSelect)(select => id && isSingleSelected ? select(external_wp_coreData_namespaceObject.store).getMedia(id, {
context: 'view'
}) : null, [id, isSingleSelected]);
const {
canInsertCover,
imageEditing,
imageSizes,
maxWidth
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockRootClientId,
canInsertBlockType
} = select(external_wp_blockEditor_namespaceObject.store);
const rootClientId = getBlockRootClientId(clientId);
const settings = getSettings();
return {
imageEditing: settings.imageEditing,
imageSizes: settings.imageSizes,
maxWidth: settings.maxWidth,
canInsertCover: canInsertBlockType('core/cover', rootClientId)
};
}, [clientId]);
const {
replaceBlocks,
toggleSelection
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
createErrorNotice,
createSuccessNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
const isWideAligned = ['wide', 'full'].includes(align);
const [{
loadedNaturalWidth,
loadedNaturalHeight
}, setLoadedNaturalSize] = (0,external_wp_element_namespaceObject.useState)({});
const [isEditingImage, setIsEditingImage] = (0,external_wp_element_namespaceObject.useState)(false);
const [externalBlob, setExternalBlob] = (0,external_wp_element_namespaceObject.useState)();
const clientWidth = useClientWidth(containerRef, [align]);
const hasNonContentControls = blockEditingMode === 'default';
const isContentOnlyMode = blockEditingMode === 'contentOnly';
const isResizable = allowResize && hasNonContentControls && !isWideAligned && isLargeViewport;
const imageSizeOptions = imageSizes.filter(({
slug
}) => image?.media_details?.sizes?.[slug]?.source_url).map(({
name,
slug
}) => ({
value: slug,
label: name
}));
// If an image is externally hosted, try to fetch the image data. This may
// fail if the image host doesn't allow CORS with the domain. If it works,
// we can enable a button in the toolbar to upload the image.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isExternalImage(id, url) || !isSingleSelected || !getSettings().mediaUpload) {
setExternalBlob();
return;
}
if (externalBlob) return;
window
// Avoid cache, which seems to help avoid CORS problems.
.fetch(url.includes('?') ? url : url + '?').then(response => response.blob()).then(blob => setExternalBlob(blob))
// Do nothing, cannot upload.
.catch(() => {});
}, [id, url, isSingleSelected, externalBlob]);
// Get naturalWidth and naturalHeight from image ref, and fall back to loaded natural
// width and height. This resolves an issue in Safari where the loaded natural
// width and height is otherwise lost when switching between alignments.
// See: https://github.com/WordPress/gutenberg/pull/37210.
const {
naturalWidth,
naturalHeight
} = (0,external_wp_element_namespaceObject.useMemo)(() => {
return {
naturalWidth: imageRef.current?.naturalWidth || loadedNaturalWidth || undefined,
naturalHeight: imageRef.current?.naturalHeight || loadedNaturalHeight || undefined
};
}, [loadedNaturalWidth, loadedNaturalHeight, imageRef.current?.complete]);
function onResizeStart() {
toggleSelection(false);
}
function onResizeStop() {
toggleSelection(true);
}
function onImageError() {
// Check if there's an embed block that handles this URL, e.g., instagram URL.
// See: https://github.com/WordPress/gutenberg/pull/11472
const embedBlock = createUpgradedEmbedBlock({
attributes: {
url
}
});
if (undefined !== embedBlock) {
onReplace(embedBlock);
}
}
function onSetHref(props) {
setAttributes(props);
}
function onSetLightbox(enable) {
if (enable && !lightboxSetting?.enabled) {
setAttributes({
lightbox: {
enabled: true
}
});
} else if (!enable && lightboxSetting?.enabled) {
setAttributes({
lightbox: {
enabled: false
}
});
} else {
setAttributes({
lightbox: undefined
});
}
}
function resetLightbox() {
// When deleting a link from an image while lightbox settings
// are enabled by default, we should disable the lightbox,
// otherwise the resulting UX looks like a mistake.
// See https://github.com/WordPress/gutenberg/pull/59890/files#r1532286123.
if (lightboxSetting?.enabled && lightboxSetting?.allowEditing) {
setAttributes({
lightbox: {
enabled: false
}
});
} else {
setAttributes({
lightbox: undefined
});
}
}
function onSetTitle(value) {
// This is the HTML title attribute, separate from the media object
// title.
setAttributes({
title: value
});
}
function updateAlt(newAlt) {
setAttributes({
alt: newAlt
});
}
function updateImage(newSizeSlug) {
const newUrl = image?.media_details?.sizes?.[newSizeSlug]?.source_url;
if (!newUrl) {
return null;
}
setAttributes({
url: newUrl,
sizeSlug: newSizeSlug
});
}
function uploadExternal() {
const {
mediaUpload
} = getSettings();
if (!mediaUpload) {
return;
}
mediaUpload({
filesList: [externalBlob],
onFileChange([img]) {
onSelectImage(img);
if ((0,external_wp_blob_namespaceObject.isBlobURL)(img.url)) {
return;
}
setExternalBlob();
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Image uploaded.'), {
type: 'snackbar'
});
},
allowedTypes: constants_ALLOWED_MEDIA_TYPES,
onError(message) {
createErrorNotice(message, {
type: 'snackbar'
});
}
});
}
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isSingleSelected) {
setIsEditingImage(false);
}
}, [isSingleSelected]);
const canEditImage = id && naturalWidth && naturalHeight && imageEditing;
const allowCrop = isSingleSelected && canEditImage && !isEditingImage;
function switchToCover() {
replaceBlocks(clientId, (0,external_wp_blocks_namespaceObject.switchToBlockType)(getBlock(clientId), 'core/cover'));
}
// TODO: Can allow more units after figuring out how they should interact
// with the ResizableBox and ImageEditor components. Calculations later on
// for those components are currently assuming px units.
const dimensionsUnitsOptions = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: ['px']
});
const [lightboxSetting] = (0,external_wp_blockEditor_namespaceObject.useSettings)('lightbox');
const showLightboxSetting =
// If a block-level override is set, we should give users the option to
// remove that override, even if the lightbox UI is disabled in the settings.
!!lightbox && lightbox?.enabled !== lightboxSetting?.enabled || lightboxSetting?.allowEditing;
const lightboxChecked = !!lightbox?.enabled || !lightbox && !!lightboxSetting?.enabled;
const dimensionsControl = (0,external_React_namespaceObject.createElement)(DimensionsTool, {
value: {
width,
height,
scale,
aspectRatio
},
onChange: ({
width: newWidth,
height: newHeight,
scale: newScale,
aspectRatio: newAspectRatio
}) => {
// Rebuilding the object forces setting `undefined`
// for values that are removed since setAttributes
// doesn't do anything with keys that aren't set.
setAttributes({
// CSS includes `height: auto`, but we need
// `width: auto` to fix the aspect ratio when
// only height is set due to the width and
// height attributes set via the server.
width: !newWidth && newHeight ? 'auto' : newWidth,
height: newHeight,
scale: newScale,
aspectRatio: newAspectRatio
});
},
defaultScale: "cover",
defaultAspectRatio: "auto",
scaleOptions: scaleOptions,
unitsOptions: dimensionsUnitsOptions
});
const resetAll = () => {
setAttributes({
alt: undefined,
width: undefined,
height: undefined,
scale: undefined,
aspectRatio: undefined,
lightbox: undefined
});
};
const sizeControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
label: (0,external_wp_i18n_namespaceObject.__)('Settings'),
resetAll: resetAll,
dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS
}, isResizable && dimensionsControl));
const {
lockUrlControls = false,
lockHrefControls = false,
lockAltControls = false,
lockAltControlsMessage,
lockTitleControls = false,
lockTitleControlsMessage,
lockCaption = false
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!isSingleSelected) {
return {};
}
const {
getBlockBindingsSource
} = unlock(select(external_wp_blocks_namespaceObject.store));
const {
getBlockParentsByBlockName
} = unlock(select(external_wp_blockEditor_namespaceObject.store));
const {
url: urlBinding,
alt: altBinding,
title: titleBinding
} = metadata?.bindings || {};
const hasParentPattern = getBlockParentsByBlockName(clientId, 'core/block').length > 0;
const urlBindingSource = getBlockBindingsSource(urlBinding?.source);
const altBindingSource = getBlockBindingsSource(altBinding?.source);
const titleBindingSource = getBlockBindingsSource(titleBinding?.source);
return {
lockUrlControls: !!urlBinding && (!urlBindingSource || urlBindingSource?.lockAttributesEditing),
lockHrefControls:
// Disable editing the link of the URL if the image is inside a pattern instance.
// This is a temporary solution until we support overriding the link on the frontend.
hasParentPattern,
lockCaption:
// Disable editing the caption if the image is inside a pattern instance.
// This is a temporary solution until we support overriding the caption on the frontend.
hasParentPattern,
lockAltControls: !!altBinding && (!altBindingSource || altBindingSource?.lockAttributesEditing),
lockAltControlsMessage: altBindingSource?.label ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Label of the bindings source. */
(0,external_wp_i18n_namespaceObject.__)('Connected to %s'), altBindingSource.label) : (0,external_wp_i18n_namespaceObject.__)('Connected to dynamic data'),
lockTitleControls: !!titleBinding && (!titleBindingSource || titleBindingSource?.lockAttributesEditing),
lockTitleControlsMessage: titleBindingSource?.label ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Label of the bindings source. */
(0,external_wp_i18n_namespaceObject.__)('Connected to %s'), titleBindingSource.label) : (0,external_wp_i18n_namespaceObject.__)('Connected to dynamic data')
};
}, [clientId, isSingleSelected, metadata?.bindings]);
const controls = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, isSingleSelected && !isEditingImage && !lockHrefControls && !lockUrlControls && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalImageURLInputUI, {
url: href || '',
onChangeUrl: onSetHref,
linkDestination: linkDestination,
mediaUrl: image && image.source_url || url,
mediaLink: image && image.link,
linkTarget: linkTarget,
linkClass: linkClass,
rel: rel,
showLightboxSetting: showLightboxSetting,
lightboxEnabled: lightboxChecked,
onSetLightbox: onSetLightbox,
resetLightbox: resetLightbox
}), allowCrop && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: () => setIsEditingImage(true),
icon: library_crop,
label: (0,external_wp_i18n_namespaceObject.__)('Crop')
}), isSingleSelected && canInsertCover && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: overlay_text,
label: (0,external_wp_i18n_namespaceObject.__)('Add text over image'),
onClick: switchToCover
})), isSingleSelected && !isEditingImage && !lockUrlControls && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, {
mediaId: id,
mediaURL: url,
allowedTypes: constants_ALLOWED_MEDIA_TYPES,
accept: "image/*",
onSelect: onSelectImage,
onSelectURL: onSelectURL,
onError: onUploadError
})), isSingleSelected && externalBlob && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: uploadExternal,
icon: library_upload,
label: (0,external_wp_i18n_namespaceObject.__)('Upload to Media Library')
}))), isContentOnlyMode &&
// Add some extra controls for content attributes when content only mode is active.
// With content only mode active, the inspector is hidden, so users need another way
// to edit these attributes.
(0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: {
position: 'bottom right'
},
renderToggle: ({
isOpen,
onToggle
}) => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: onToggle,
"aria-haspopup": "true",
"aria-expanded": isOpen,
onKeyDown: event => {
if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
event.preventDefault();
onToggle();
}
}
}, (0,external_wp_i18n_namespaceObject._x)('Alt', 'Alternative text for an image. Block toolbar label, a low character count is preferred.')),
renderContent: () => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextareaControl, {
className: "wp-block-image__toolbar_content_textarea",
label: (0,external_wp_i18n_namespaceObject.__)('Alternative text'),
value: alt || '',
onChange: updateAlt,
disabled: lockAltControls,
help: lockAltControls ? (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, lockAltControlsMessage) : (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
href: "https://www.w3.org/WAI/tutorials/images/decision-tree"
}, (0,external_wp_i18n_namespaceObject.__)('Describe the purpose of the image.')), (0,external_React_namespaceObject.createElement)("br", null), (0,external_wp_i18n_namespaceObject.__)('Leave empty if decorative.')),
__nextHasNoMarginBottom: true
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: {
position: 'bottom right'
},
renderToggle: ({
isOpen,
onToggle
}) => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: onToggle,
"aria-haspopup": "true",
"aria-expanded": isOpen,
onKeyDown: event => {
if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
event.preventDefault();
onToggle();
}
}
}, (0,external_wp_i18n_namespaceObject.__)('Title')),
renderContent: () => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
className: "wp-block-image__toolbar_content_textarea",
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Title attribute'),
value: title || '',
onChange: onSetTitle,
disabled: lockTitleControls,
help: lockTitleControls ? (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, lockTitleControlsMessage) : (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Describe the role of this image on the page.'), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
href: "https://www.w3.org/TR/html52/dom.html#the-title-attribute"
}, (0,external_wp_i18n_namespaceObject.__)('(Note: many devices and browsers do not display this text.)')))
})
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
label: (0,external_wp_i18n_namespaceObject.__)('Settings'),
resetAll: resetAll,
dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS
}, isSingleSelected && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Alternative text'),
isShownByDefault: true,
hasValue: () => !!alt,
onDeselect: () => setAttributes({
alt: undefined
})
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextareaControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Alternative text'),
value: alt || '',
onChange: updateAlt,
readOnly: lockAltControls,
help: lockAltControls ? (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, lockAltControlsMessage) : (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
href: "https://www.w3.org/WAI/tutorials/images/decision-tree"
}, (0,external_wp_i18n_namespaceObject.__)('Describe the purpose of the image.')), (0,external_React_namespaceObject.createElement)("br", null), (0,external_wp_i18n_namespaceObject.__)('Leave empty if decorative.')),
__nextHasNoMarginBottom: true
})), isResizable && dimensionsControl, !!imageSizeOptions.length && (0,external_React_namespaceObject.createElement)(ResolutionTool, {
value: sizeSlug,
onChange: updateImage,
options: imageSizeOptions
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Title attribute'),
value: title || '',
onChange: onSetTitle,
readOnly: lockTitleControls,
help: lockTitleControls ? (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, lockTitleControlsMessage) : (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Describe the role of this image on the page.'), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
href: "https://www.w3.org/TR/html52/dom.html#the-title-attribute"
}, (0,external_wp_i18n_namespaceObject.__)('(Note: many devices and browsers do not display this text.)')))
})));
const filename = (0,external_wp_url_namespaceObject.getFilename)(url);
let defaultedAlt;
if (alt) {
defaultedAlt = alt;
} else if (filename) {
defaultedAlt = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: file name */
(0,external_wp_i18n_namespaceObject.__)('This image has an empty alt attribute; its file name is %s'), filename);
} else {
defaultedAlt = (0,external_wp_i18n_namespaceObject.__)('This image has an empty alt attribute');
}
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes);
const shadowProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetShadowClassesAndStyles)(attributes);
const isRounded = attributes.className?.includes('is-style-rounded');
let img =
// Disable reason: Image itself is not meant to be interactive, but
// should direct focus to block.
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
(0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("img", {
src: temporaryURL || url,
alt: defaultedAlt,
onError: () => onImageError(),
onLoad: event => {
setLoadedNaturalSize({
loadedNaturalWidth: event.target?.naturalWidth,
loadedNaturalHeight: event.target?.naturalHeight
});
},
ref: imageRef,
className: borderProps.className,
style: {
width: width && height || aspectRatio ? '100%' : undefined,
height: width && height || aspectRatio ? '100%' : undefined,
objectFit: scale,
...borderProps.style,
...shadowProps.style
}
}), temporaryURL && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null))
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */;
// clientWidth needs to be a number for the image Cropper to work, but sometimes it's 0
// So we try using the imageRef width first and fallback to clientWidth.
const fallbackClientWidth = imageRef.current?.width || clientWidth;
if (canEditImage && isEditingImage) {
img = (0,external_React_namespaceObject.createElement)(ImageWrapper, {
href: href
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalImageEditor, {
id: id,
url: url,
width: numericWidth,
height: numericHeight,
clientWidth: fallbackClientWidth,
naturalHeight: naturalHeight,
naturalWidth: naturalWidth,
onSaveImage: imageAttributes => setAttributes(imageAttributes),
onFinishEditing: () => {
setIsEditingImage(false);
},
borderProps: isRounded ? undefined : borderProps
}));
} else if (!isResizable) {
img = (0,external_React_namespaceObject.createElement)("div", {
style: {
width,
height,
aspectRatio
}
}, (0,external_React_namespaceObject.createElement)(ImageWrapper, {
href: href
}, img));
} else {
const numericRatio = aspectRatio && evalAspectRatio(aspectRatio);
const customRatio = numericWidth / numericHeight;
const naturalRatio = naturalWidth / naturalHeight;
const ratio = numericRatio || customRatio || naturalRatio || 1;
const currentWidth = !numericWidth && numericHeight ? numericHeight * ratio : numericWidth;
const currentHeight = !numericHeight && numericWidth ? numericWidth / ratio : numericHeight;
const minWidth = naturalWidth < naturalHeight ? constants_MIN_SIZE : constants_MIN_SIZE * ratio;
const minHeight = naturalHeight < naturalWidth ? constants_MIN_SIZE : constants_MIN_SIZE / ratio;
// With the current implementation of ResizableBox, an image needs an
// explicit pixel value for the max-width. In absence of being able to
// set the content-width, this max-width is currently dictated by the
// vanilla editor style. The following variable adds a buffer to this
// vanilla style, so 3rd party themes have some wiggleroom. This does,
// in most cases, allow you to scale the image beyond the width of the
// main column, though not infinitely.
// @todo It would be good to revisit this once a content-width variable
// becomes available.
const maxWidthBuffer = maxWidth * 2.5;
let showRightHandle = false;
let showLeftHandle = false;
/* eslint-disable no-lonely-if */
// See https://github.com/WordPress/gutenberg/issues/7584.
if (align === 'center') {
// When the image is centered, show both handles.
showRightHandle = true;
showLeftHandle = true;
} else if ((0,external_wp_i18n_namespaceObject.isRTL)()) {
// In RTL mode the image is on the right by default.
// Show the right handle and hide the left handle only when it is
// aligned left. Otherwise always show the left handle.
if (align === 'left') {
showRightHandle = true;
} else {
showLeftHandle = true;
}
} else {
// Show the left handle and hide the right handle only when the
// image is aligned right. Otherwise always show the right handle.
if (align === 'right') {
showLeftHandle = true;
} else {
showRightHandle = true;
}
}
/* eslint-enable no-lonely-if */
img = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ResizableBox, {
style: {
display: 'block',
objectFit: scale,
aspectRatio: !width && !height && aspectRatio ? aspectRatio : undefined
},
size: {
width: currentWidth !== null && currentWidth !== void 0 ? currentWidth : 'auto',
height: currentHeight !== null && currentHeight !== void 0 ? currentHeight : 'auto'
},
showHandle: isSingleSelected,
minWidth: minWidth,
maxWidth: maxWidthBuffer,
minHeight: minHeight,
maxHeight: maxWidthBuffer / ratio,
lockAspectRatio: ratio,
enable: {
top: false,
right: showRightHandle,
bottom: true,
left: showLeftHandle
},
onResizeStart: onResizeStart,
onResizeStop: (event, direction, elt) => {
onResizeStop();
// Since the aspect ratio is locked when resizing, we can
// use the width of the resized element to calculate the
// height in CSS to prevent stretching when the max-width
// is reached.
setAttributes({
width: `${elt.offsetWidth}px`,
height: 'auto',
aspectRatio: ratio === naturalRatio ? undefined : String(ratio)
});
},
resizeRatio: align === 'center' ? 2 : 1
}, (0,external_React_namespaceObject.createElement)(ImageWrapper, {
href: href
}, img));
}
if (!url && !temporaryURL) {
// Add all controls if the image attributes are connected.
return metadata?.bindings ? controls : sizeControls;
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !temporaryURL && controls, img, (0,external_React_namespaceObject.createElement)(Caption, {
attributes: attributes,
setAttributes: setAttributes,
isSelected: isSingleSelected,
insertBlocksAfter: insertBlocksAfter,
label: (0,external_wp_i18n_namespaceObject.__)('Image caption text'),
showToolbarButton: isSingleSelected && hasNonContentControls,
disableEditing: lockCaption
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module constants
*/
const edit_pickRelevantMediaFiles = (image, size) => {
const imageProps = Object.fromEntries(Object.entries(image !== null && image !== void 0 ? image : {}).filter(([key]) => ['alt', 'id', 'link', 'caption'].includes(key)));
imageProps.url = image?.sizes?.[size]?.url || image?.media_details?.sizes?.[size]?.source_url || image.url;
return imageProps;
};
/**
* Is the URL a temporary blob URL? A blob URL is one that is used temporarily
* while the image is being uploaded and will not have an id yet allocated.
*
* @param {number=} id The id of the image.
* @param {string=} url The url of the image.
*
* @return {boolean} Is the URL a Blob URL
*/
const edit_isTemporaryImage = (id, url) => !id && (0,external_wp_blob_namespaceObject.isBlobURL)(url);
/**
* Is the url for the image hosted externally. An externally hosted image has no
* id and is not a blob url.
*
* @param {number=} id The id of the image.
* @param {string=} url The url of the image.
*
* @return {boolean} Is the url an externally hosted url?
*/
const isExternalImage = (id, url) => url && !id && !(0,external_wp_blob_namespaceObject.isBlobURL)(url);
/**
* Checks if WP generated the specified image size. Size generation is skipped
* when the image is smaller than the said size.
*
* @param {Object} image
* @param {string} size
*
* @return {boolean} Whether or not it has default image size.
*/
function hasSize(image, size) {
var _image$sizes$size, _image$media_details$;
return 'url' in ((_image$sizes$size = image?.sizes?.[size]) !== null && _image$sizes$size !== void 0 ? _image$sizes$size : {}) || 'source_url' in ((_image$media_details$ = image?.media_details?.sizes?.[size]) !== null && _image$media_details$ !== void 0 ? _image$media_details$ : {});
}
function ImageEdit({
attributes,
setAttributes,
isSelected: isSingleSelected,
className,
insertBlocksAfter,
onReplace,
context,
clientId
}) {
const {
url = '',
alt,
caption,
id,
width,
height,
sizeSlug,
aspectRatio,
scale,
align,
metadata
} = attributes;
const [temporaryURL, setTemporaryURL] = (0,external_wp_element_namespaceObject.useState)();
const altRef = (0,external_wp_element_namespaceObject.useRef)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
altRef.current = alt;
}, [alt]);
const captionRef = (0,external_wp_element_namespaceObject.useRef)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
captionRef.current = caption;
}, [caption]);
const {
__unstableMarkNextChangeAsNotPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (['wide', 'full'].includes(align)) {
__unstableMarkNextChangeAsNotPersistent();
setAttributes({
width: undefined,
height: undefined,
aspectRatio: undefined,
scale: undefined
});
}
}, [align]);
const ref = (0,external_wp_element_namespaceObject.useRef)();
const {
getSettings
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
function onUploadError(message) {
createErrorNotice(message, {
type: 'snackbar'
});
setAttributes({
src: undefined,
id: undefined,
url: undefined
});
setTemporaryURL(undefined);
}
function onSelectImage(media) {
if (!media || !media.url) {
setAttributes({
url: undefined,
alt: undefined,
id: undefined,
title: undefined,
caption: undefined
});
return;
}
if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) {
setTemporaryURL(media.url);
return;
}
setTemporaryURL();
const {
imageDefaultSize
} = getSettings();
// Try to use the previous selected image size if its available
// otherwise try the default image size or fallback to "full"
let newSize = 'full';
if (sizeSlug && hasSize(media, sizeSlug)) {
newSize = sizeSlug;
} else if (hasSize(media, imageDefaultSize)) {
newSize = imageDefaultSize;
}
let mediaAttributes = edit_pickRelevantMediaFiles(media, newSize);
// If a caption text was meanwhile written by the user,
// make sure the text is not overwritten by empty captions.
if (captionRef.current && !mediaAttributes.caption) {
const {
caption: omittedCaption,
...restMediaAttributes
} = mediaAttributes;
mediaAttributes = restMediaAttributes;
}
let additionalAttributes;
// Reset the dimension attributes if changing to a different image.
if (!media.id || media.id !== id) {
additionalAttributes = {
sizeSlug: newSize
};
} else {
// Keep the same url when selecting the same file, so "Resolution"
// option is not changed.
additionalAttributes = {
url
};
}
// Check if default link setting should be used.
let linkDestination = attributes.linkDestination;
if (!linkDestination) {
// Use the WordPress option to determine the proper default.
// The constants used in Gutenberg do not match WP options so a little more complicated than ideal.
// TODO: fix this in a follow up PR, requires updating media-text and ui component.
switch (window?.wp?.media?.view?.settings?.defaultProps?.link || constants_LINK_DESTINATION_NONE) {
case 'file':
case constants_LINK_DESTINATION_MEDIA:
linkDestination = constants_LINK_DESTINATION_MEDIA;
break;
case 'post':
case constants_LINK_DESTINATION_ATTACHMENT:
linkDestination = constants_LINK_DESTINATION_ATTACHMENT;
break;
case LINK_DESTINATION_CUSTOM:
linkDestination = LINK_DESTINATION_CUSTOM;
break;
case constants_LINK_DESTINATION_NONE:
linkDestination = constants_LINK_DESTINATION_NONE;
break;
}
}
// Check if the image is linked to it's media.
let href;
switch (linkDestination) {
case constants_LINK_DESTINATION_MEDIA:
href = media.url;
break;
case constants_LINK_DESTINATION_ATTACHMENT:
href = media.link;
break;
}
mediaAttributes.href = href;
setAttributes({
...mediaAttributes,
...additionalAttributes,
linkDestination
});
}
function onSelectURL(newURL) {
if (newURL !== url) {
setAttributes({
url: newURL,
id: undefined,
sizeSlug: getSettings().imageDefaultSize
});
}
}
let isTemp = edit_isTemporaryImage(id, url);
// Upload a temporary image on mount.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isTemp) {
return;
}
const file = (0,external_wp_blob_namespaceObject.getBlobByURL)(url);
if (file) {
const {
mediaUpload
} = getSettings();
if (!mediaUpload) {
return;
}
mediaUpload({
filesList: [file],
onFileChange: ([img]) => {
onSelectImage(img);
},
allowedTypes: constants_ALLOWED_MEDIA_TYPES,
onError: message => {
isTemp = false;
onUploadError(message);
}
});
}
}, []);
// If an image is temporary, revoke the Blob url when it is uploaded (and is
// no longer temporary).
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (isTemp) {
setTemporaryURL(url);
return;
}
(0,external_wp_blob_namespaceObject.revokeBlobURL)(temporaryURL);
}, [isTemp, url]);
const isExternal = isExternalImage(id, url);
const src = isExternal ? url : undefined;
const mediaPreview = !!url && (0,external_React_namespaceObject.createElement)("img", {
alt: (0,external_wp_i18n_namespaceObject.__)('Edit image'),
title: (0,external_wp_i18n_namespaceObject.__)('Edit image'),
className: 'edit-image-preview',
src: url
});
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes);
const shadowProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetShadowClassesAndStyles)(attributes);
const classes = classnames_default()(className, {
'is-transient': temporaryURL,
'is-resized': !!width || !!height,
[`size-${sizeSlug}`]: sizeSlug,
'has-custom-border': !!borderProps.className || borderProps.style && Object.keys(borderProps.style).length > 0
});
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
ref,
className: classes
});
// Much of this description is duplicated from MediaPlaceholder.
const {
lockUrlControls = false,
lockUrlControlsMessage
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!isSingleSelected) {
return {};
}
const blockBindingsSource = unlock(select(external_wp_blocks_namespaceObject.store)).getBlockBindingsSource(metadata?.bindings?.url?.source);
return {
lockUrlControls: !!metadata?.bindings?.url && (!blockBindingsSource || blockBindingsSource?.lockAttributesEditing),
lockUrlControlsMessage: blockBindingsSource?.label ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Label of the bindings source. */
(0,external_wp_i18n_namespaceObject.__)('Connected to %s'), blockBindingsSource.label) : (0,external_wp_i18n_namespaceObject.__)('Connected to dynamic data')
};
}, [isSingleSelected]);
const placeholder = content => {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
className: classnames_default()('block-editor-media-placeholder', {
[borderProps.className]: !!borderProps.className && !isSingleSelected
}),
withIllustration: true,
icon: lockUrlControls ? library_plugins : library_image,
label: (0,external_wp_i18n_namespaceObject.__)('Image'),
instructions: !lockUrlControls && (0,external_wp_i18n_namespaceObject.__)('Upload an image file, pick one from your media library, or add one with a URL.'),
style: {
aspectRatio: !(width && height) && aspectRatio ? aspectRatio : undefined,
width: height && aspectRatio ? '100%' : width,
height: width && aspectRatio ? '100%' : height,
objectFit: scale,
...borderProps.style,
...shadowProps.style
}
}, lockUrlControls ? (0,external_React_namespaceObject.createElement)("span", {
className: 'block-bindings-media-placeholder-message'
}, lockUrlControlsMessage) : content);
};
return (0,external_React_namespaceObject.createElement)("figure", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(image_Image, {
temporaryURL: temporaryURL,
attributes: attributes,
setAttributes: setAttributes,
isSingleSelected: isSingleSelected,
insertBlocksAfter: insertBlocksAfter,
onReplace: onReplace,
onSelectImage: onSelectImage,
onSelectURL: onSelectURL,
onUploadError: onUploadError,
containerRef: ref,
context: context,
clientId: clientId,
blockEditingMode: blockEditingMode
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: library_image
}),
onSelect: onSelectImage,
onSelectURL: onSelectURL,
onError: onUploadError,
placeholder: placeholder,
accept: "image/*",
allowedTypes: constants_ALLOWED_MEDIA_TYPES,
value: {
id,
src
},
mediaPreview: mediaPreview,
disableMediaButtons: temporaryURL || url
}));
}
/* harmony default export */ const image_edit = (ImageEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function image_save_save({
attributes
}) {
const {
url,
alt,
caption,
align,
href,
rel,
linkClass,
width,
height,
aspectRatio,
scale,
id,
linkTarget,
sizeSlug,
title
} = attributes;
const newRel = !rel ? undefined : rel;
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes);
const shadowProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetShadowClassesAndStyles)(attributes);
const classes = classnames_default()({
// All other align classes are handled by block supports.
// `{ align: 'none' }` is unique to transforms for the image block.
alignnone: 'none' === align,
[`size-${sizeSlug}`]: sizeSlug,
'is-resized': width || height,
'has-custom-border': !!borderProps.className || borderProps.style && Object.keys(borderProps.style).length > 0
});
const imageClasses = classnames_default()(borderProps.className, {
[`wp-image-${id}`]: !!id
});
const image = (0,external_React_namespaceObject.createElement)("img", {
src: url,
alt: alt,
className: imageClasses || undefined,
style: {
...borderProps.style,
...shadowProps.style,
aspectRatio,
objectFit: scale,
width,
height
},
title: title
});
const figure = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, href ? (0,external_React_namespaceObject.createElement)("a", {
className: linkClass,
href: href,
target: linkTarget,
rel: newRel
}, image) : image, !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'),
tagName: "figcaption",
value: caption
}));
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classes
})
}, figure);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/transforms.js
/**
* WordPress dependencies
*/
function stripFirstImage(attributes, {
shortcode
}) {
const {
body
} = document.implementation.createHTMLDocument('');
body.innerHTML = shortcode.content;
let nodeToRemove = body.querySelector('img');
// If an image has parents, find the topmost node to remove.
while (nodeToRemove && nodeToRemove.parentNode && nodeToRemove.parentNode !== body) {
nodeToRemove = nodeToRemove.parentNode;
}
if (nodeToRemove) {
nodeToRemove.parentNode.removeChild(nodeToRemove);
}
return body.innerHTML.trim();
}
function getFirstAnchorAttributeFormHTML(html, attributeName) {
const {
body
} = document.implementation.createHTMLDocument('');
body.innerHTML = html;
const {
firstElementChild
} = body;
if (firstElementChild && firstElementChild.nodeName === 'A') {
return firstElementChild.getAttribute(attributeName) || undefined;
}
}
const imageSchema = {
img: {
attributes: ['src', 'alt', 'title'],
classes: ['alignleft', 'aligncenter', 'alignright', 'alignnone', /^wp-image-\d+$/]
}
};
const schema = ({
phrasingContentSchema
}) => ({
figure: {
require: ['img'],
children: {
...imageSchema,
a: {
attributes: ['href', 'rel', 'target'],
children: imageSchema
},
figcaption: {
children: phrasingContentSchema
}
}
}
});
const image_transforms_transforms = {
from: [{
type: 'raw',
isMatch: node => node.nodeName === 'FIGURE' && !!node.querySelector('img'),
schema,
transform: node => {
// Search both figure and image classes. Alignment could be
// set on either. ID is set on the image.
const className = node.className + ' ' + node.querySelector('img').className;
const alignMatches = /(?:^|\s)align(left|center|right)(?:$|\s)/.exec(className);
const anchor = node.id === '' ? undefined : node.id;
const align = alignMatches ? alignMatches[1] : undefined;
const idMatches = /(?:^|\s)wp-image-(\d+)(?:$|\s)/.exec(className);
const id = idMatches ? Number(idMatches[1]) : undefined;
const anchorElement = node.querySelector('a');
const linkDestination = anchorElement && anchorElement.href ? 'custom' : undefined;
const href = anchorElement && anchorElement.href ? anchorElement.href : undefined;
const rel = anchorElement && anchorElement.rel ? anchorElement.rel : undefined;
const linkClass = anchorElement && anchorElement.className ? anchorElement.className : undefined;
const attributes = (0,external_wp_blocks_namespaceObject.getBlockAttributes)('core/image', node.outerHTML, {
align,
id,
linkDestination,
href,
rel,
linkClass,
anchor
});
return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', attributes);
}
}, {
// Note: when dragging and dropping multiple files onto a gallery this overrides the
// gallery transform in order to add new images to the gallery instead of
// creating a new gallery.
type: 'files',
isMatch(files) {
// The following check is intended to catch non-image files when dropped together with images.
if (files.some(file => file.type.indexOf('image/') === 0) && files.some(file => file.type.indexOf('image/') !== 0)) {
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.dispatch)(external_wp_notices_namespaceObject.store);
createErrorNotice((0,external_wp_i18n_namespaceObject.__)('If uploading to a gallery all files need to be image formats'), {
id: 'gallery-transform-invalid-file',
type: 'snackbar'
});
}
return files.every(file => file.type.indexOf('image/') === 0);
},
transform(files) {
const blocks = files.map(file => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', {
url: (0,external_wp_blob_namespaceObject.createBlobURL)(file)
});
});
return blocks;
}
}, {
type: 'shortcode',
tag: 'caption',
attributes: {
url: {
type: 'string',
source: 'attribute',
attribute: 'src',
selector: 'img'
},
alt: {
type: 'string',
source: 'attribute',
attribute: 'alt',
selector: 'img'
},
caption: {
shortcode: stripFirstImage
},
href: {
shortcode: (attributes, {
shortcode
}) => {
return getFirstAnchorAttributeFormHTML(shortcode.content, 'href');
}
},
rel: {
shortcode: (attributes, {
shortcode
}) => {
return getFirstAnchorAttributeFormHTML(shortcode.content, 'rel');
}
},
linkClass: {
shortcode: (attributes, {
shortcode
}) => {
return getFirstAnchorAttributeFormHTML(shortcode.content, 'class');
}
},
id: {
type: 'number',
shortcode: ({
named: {
id
}
}) => {
if (!id) {
return;
}
return parseInt(id.replace('attachment_', ''), 10);
}
},
align: {
type: 'string',
shortcode: ({
named: {
align = 'alignnone'
}
}) => {
return align.replace('align', '');
}
}
}
}]
};
/* harmony default export */ const image_transforms = (image_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const image_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/image",
title: "Image",
category: "media",
usesContext: ["allowResize", "imageCrop", "fixedHeight"],
description: "Insert an image to make a visual statement.",
keywords: ["img", "photo", "picture"],
textdomain: "default",
attributes: {
url: {
type: "string",
source: "attribute",
selector: "img",
attribute: "src",
__experimentalRole: "content"
},
alt: {
type: "string",
source: "attribute",
selector: "img",
attribute: "alt",
"default": "",
__experimentalRole: "content"
},
caption: {
type: "rich-text",
source: "rich-text",
selector: "figcaption",
__experimentalRole: "content"
},
lightbox: {
type: "object",
enabled: {
type: "boolean"
}
},
title: {
type: "string",
source: "attribute",
selector: "img",
attribute: "title",
__experimentalRole: "content"
},
href: {
type: "string",
source: "attribute",
selector: "figure > a",
attribute: "href",
__experimentalRole: "content"
},
rel: {
type: "string",
source: "attribute",
selector: "figure > a",
attribute: "rel"
},
linkClass: {
type: "string",
source: "attribute",
selector: "figure > a",
attribute: "class"
},
id: {
type: "number",
__experimentalRole: "content"
},
width: {
type: "string"
},
height: {
type: "string"
},
aspectRatio: {
type: "string"
},
scale: {
type: "string"
},
sizeSlug: {
type: "string"
},
linkDestination: {
type: "string"
},
linkTarget: {
type: "string",
source: "attribute",
selector: "figure > a",
attribute: "target"
}
},
supports: {
interactivity: true,
align: ["left", "center", "right", "wide", "full"],
anchor: true,
color: {
text: false,
background: false
},
filter: {
duotone: true
},
__experimentalBorder: {
color: true,
radius: true,
width: true,
__experimentalSkipSerialization: true,
__experimentalDefaultControls: {
color: true,
radius: true,
width: true
}
},
shadow: {
__experimentalSkipSerialization: true
}
},
selectors: {
border: ".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",
shadow: ".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",
filter: {
duotone: ".wp-block-image img, .wp-block-image .components-placeholder"
}
},
styles: [{
name: "default",
label: "Default",
isDefault: true
}, {
name: "rounded",
label: "Rounded"
}],
editorStyle: "wp-block-image-editor",
style: "wp-block-image"
};
const {
name: image_name
} = image_metadata;
const image_settings = {
icon: library_image,
example: {
attributes: {
sizeSlug: 'large',
url: 'https://s.w.org/images/core/5.3/MtBlanc1.jpg',
// translators: Caption accompanying an image of the Mont Blanc, which serves as an example for the Image block.
caption: (0,external_wp_i18n_namespaceObject.__)('Mont Blanc appears—still, snowy, and serene.')
}
},
__experimentalLabel(attributes, {
context
}) {
const customName = attributes?.metadata?.name;
if (context === 'list-view' && customName) {
return customName;
}
if (context === 'accessibility') {
const {
caption,
alt,
url
} = attributes;
if (!url) {
return (0,external_wp_i18n_namespaceObject.__)('Empty');
}
if (!alt) {
return caption || '';
}
// This is intended to be read by a screen reader.
// A period simply means a pause, no need to translate it.
return alt + (caption ? '. ' + caption : '');
}
},
getEditWrapperProps(attributes) {
return {
'data-align': attributes.align
};
},
transforms: image_transforms,
edit: image_edit,
save: image_save_save,
deprecated: image_deprecated
};
const image_init = () => initBlock({
name: image_name,
metadata: image_metadata,
settings: image_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment.js
/**
* WordPress dependencies
*/
const comment = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z"
}));
/* harmony default export */ const library_comment = (comment);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-comments/edit.js
/**
* WordPress dependencies
*/
/**
* Minimum number of comments a user can show using this block.
*
* @type {number}
*/
const MIN_COMMENTS = 1;
/**
* Maximum number of comments a user can show using this block.
*
* @type {number}
*/
const MAX_COMMENTS = 100;
function LatestComments({
attributes,
setAttributes
}) {
const {
commentsToShow,
displayAvatar,
displayDate,
displayExcerpt
} = attributes;
const serverSideAttributes = {
...attributes,
style: {
...attributes?.style,
spacing: undefined
}
};
return (0,external_React_namespaceObject.createElement)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)()
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display avatar'),
checked: displayAvatar,
onChange: () => setAttributes({
displayAvatar: !displayAvatar
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display date'),
checked: displayDate,
onChange: () => setAttributes({
displayDate: !displayDate
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display excerpt'),
checked: displayExcerpt,
onChange: () => setAttributes({
displayExcerpt: !displayExcerpt
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Number of comments'),
value: commentsToShow,
onChange: value => setAttributes({
commentsToShow: value
}),
min: MIN_COMMENTS,
max: MAX_COMMENTS,
required: true
}))), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, null, (0,external_React_namespaceObject.createElement)((external_wp_serverSideRender_default()), {
block: "core/latest-comments",
attributes: serverSideAttributes
// The preview uses the site's locale to make it more true to how
// the block appears on the frontend. Setting the locale
// explicitly prevents any middleware from setting it to 'user'.
,
urlQueryArgs: {
_locale: 'site'
}
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-comments/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const latest_comments_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/latest-comments",
title: "Latest Comments",
category: "widgets",
description: "Display a list of your most recent comments.",
keywords: ["recent comments"],
textdomain: "default",
attributes: {
commentsToShow: {
type: "number",
"default": 5,
minimum: 1,
maximum: 100
},
displayAvatar: {
type: "boolean",
"default": true
},
displayDate: {
type: "boolean",
"default": true
},
displayExcerpt: {
type: "boolean",
"default": true
}
},
supports: {
align: true,
html: false,
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-latest-comments-editor",
style: "wp-block-latest-comments"
};
const {
name: latest_comments_name
} = latest_comments_metadata;
const latest_comments_settings = {
icon: library_comment,
example: {},
edit: LatestComments
};
const latest_comments_init = () => initBlock({
name: latest_comments_name,
metadata: latest_comments_metadata,
settings: latest_comments_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-list.js
/**
* WordPress dependencies
*/
const postList = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M18 5.5H6a.5.5 0 0 0-.5.5v12a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5V6a.5.5 0 0 0-.5-.5ZM6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm1 5h1.5v1.5H7V9Zm1.5 4.5H7V15h1.5v-1.5ZM10 9h7v1.5h-7V9Zm7 4.5h-7V15h7v-1.5Z"
}));
/* harmony default export */ const post_list = (postList);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-posts/deprecated.js
/**
* Internal dependencies
*/
const latest_posts_deprecated_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/latest-posts",
title: "Latest Posts",
category: "widgets",
description: "Display a list of your most recent posts.",
keywords: ["recent posts"],
textdomain: "default",
attributes: {
categories: {
type: "array",
items: {
type: "object"
}
},
selectedAuthor: {
type: "number"
},
postsToShow: {
type: "number",
"default": 5
},
displayPostContent: {
type: "boolean",
"default": false
},
displayPostContentRadio: {
type: "string",
"default": "excerpt"
},
excerptLength: {
type: "number",
"default": 55
},
displayAuthor: {
type: "boolean",
"default": false
},
displayPostDate: {
type: "boolean",
"default": false
},
postLayout: {
type: "string",
"default": "list"
},
columns: {
type: "number",
"default": 3
},
order: {
type: "string",
"default": "desc"
},
orderBy: {
type: "string",
"default": "date"
},
displayFeaturedImage: {
type: "boolean",
"default": false
},
featuredImageAlign: {
type: "string",
"enum": ["left", "center", "right"]
},
featuredImageSizeSlug: {
type: "string",
"default": "thumbnail"
},
featuredImageSizeWidth: {
type: "number",
"default": null
},
featuredImageSizeHeight: {
type: "number",
"default": null
},
addLinkToFeaturedImage: {
type: "boolean",
"default": false
}
},
supports: {
align: true,
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-latest-posts-editor",
style: "wp-block-latest-posts"
};
const {
attributes: deprecated_attributes
} = latest_posts_deprecated_metadata;
/* harmony default export */ const latest_posts_deprecated = ([{
attributes: {
...deprecated_attributes,
categories: {
type: 'string'
}
},
supports: {
align: true,
html: false
},
migrate: oldAttributes => {
// This needs the full category object, not just the ID.
return {
...oldAttributes,
categories: [{
id: Number(oldAttributes.categories)
}]
};
},
isEligible: ({
categories
}) => categories && 'string' === typeof categories,
save: () => null
}]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list.js
/**
* WordPress dependencies
*/
const list = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"
}));
/* harmony default export */ const library_list = (list);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-posts/constants.js
const MIN_EXCERPT_LENGTH = 10;
const MAX_EXCERPT_LENGTH = 100;
const MAX_POSTS_COLUMNS = 6;
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-posts/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module Constants
*/
const CATEGORIES_LIST_QUERY = {
per_page: -1,
context: 'view'
};
const USERS_LIST_QUERY = {
per_page: -1,
has_published_posts: ['post'],
context: 'view'
};
function getFeaturedImageDetails(post, size) {
var _image$media_details$;
const image = post._embedded?.['wp:featuredmedia']?.['0'];
return {
url: (_image$media_details$ = image?.media_details?.sizes?.[size]?.source_url) !== null && _image$media_details$ !== void 0 ? _image$media_details$ : image?.source_url,
alt: image?.alt_text
};
}
function LatestPostsEdit({
attributes,
setAttributes
}) {
var _categoriesList$reduc;
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(LatestPostsEdit);
const {
postsToShow,
order,
orderBy,
categories,
selectedAuthor,
displayFeaturedImage,
displayPostContentRadio,
displayPostContent,
displayPostDate,
displayAuthor,
postLayout,
columns,
excerptLength,
featuredImageAlign,
featuredImageSizeSlug,
featuredImageSizeWidth,
featuredImageSizeHeight,
addLinkToFeaturedImage
} = attributes;
const {
imageSizes,
latestPosts,
defaultImageWidth,
defaultImageHeight,
categoriesList,
authorList
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _settings$imageDimens, _settings$imageDimens2;
const {
getEntityRecords,
getUsers
} = select(external_wp_coreData_namespaceObject.store);
const settings = select(external_wp_blockEditor_namespaceObject.store).getSettings();
const catIds = categories && categories.length > 0 ? categories.map(cat => cat.id) : [];
const latestPostsQuery = Object.fromEntries(Object.entries({
categories: catIds,
author: selectedAuthor,
order,
orderby: orderBy,
per_page: postsToShow,
_embed: 'wp:featuredmedia'
}).filter(([, value]) => typeof value !== 'undefined'));
return {
defaultImageWidth: (_settings$imageDimens = settings.imageDimensions?.[featuredImageSizeSlug]?.width) !== null && _settings$imageDimens !== void 0 ? _settings$imageDimens : 0,
defaultImageHeight: (_settings$imageDimens2 = settings.imageDimensions?.[featuredImageSizeSlug]?.height) !== null && _settings$imageDimens2 !== void 0 ? _settings$imageDimens2 : 0,
imageSizes: settings.imageSizes,
latestPosts: getEntityRecords('postType', 'post', latestPostsQuery),
categoriesList: getEntityRecords('taxonomy', 'category', CATEGORIES_LIST_QUERY),
authorList: getUsers(USERS_LIST_QUERY)
};
}, [featuredImageSizeSlug, postsToShow, order, orderBy, categories, selectedAuthor]);
// If a user clicks to a link prevent redirection and show a warning.
const {
createWarningNotice,
removeNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
let noticeId;
const showRedirectionPreventedNotice = event => {
event.preventDefault();
// Remove previous warning if any, to show one at a time per block.
removeNotice(noticeId);
noticeId = `block-library/core/latest-posts/redirection-prevented/${instanceId}`;
createWarningNotice((0,external_wp_i18n_namespaceObject.__)('Links are disabled in the editor.'), {
id: noticeId,
type: 'snackbar'
});
};
const imageSizeOptions = imageSizes.filter(({
slug
}) => slug !== 'full').map(({
name,
slug
}) => ({
value: slug,
label: name
}));
const categorySuggestions = (_categoriesList$reduc = categoriesList?.reduce((accumulator, category) => ({
...accumulator,
[category.name]: category
}), {})) !== null && _categoriesList$reduc !== void 0 ? _categoriesList$reduc : {};
const selectCategories = tokens => {
const hasNoSuggestion = tokens.some(token => typeof token === 'string' && !categorySuggestions[token]);
if (hasNoSuggestion) {
return;
}
// Categories that are already will be objects, while new additions will be strings (the name).
// allCategories nomalizes the array so that they are all objects.
const allCategories = tokens.map(token => {
return typeof token === 'string' ? categorySuggestions[token] : token;
});
// We do nothing if the category is not selected
// from suggestions.
if (allCategories.includes(null)) {
return false;
}
setAttributes({
categories: allCategories
});
};
const hasPosts = !!latestPosts?.length;
const inspectorControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Post content')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Post content'),
checked: displayPostContent,
onChange: value => setAttributes({
displayPostContent: value
})
}), displayPostContent && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RadioControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Show:'),
selected: displayPostContentRadio,
options: [{
label: (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
value: 'excerpt'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Full post'),
value: 'full_post'
}],
onChange: value => setAttributes({
displayPostContentRadio: value
})
}), displayPostContent && displayPostContentRadio === 'excerpt' && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Max number of words'),
value: excerptLength,
onChange: value => setAttributes({
excerptLength: value
}),
min: MIN_EXCERPT_LENGTH,
max: MAX_EXCERPT_LENGTH
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Post meta')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display author name'),
checked: displayAuthor,
onChange: value => setAttributes({
displayAuthor: value
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display post date'),
checked: displayPostDate,
onChange: value => setAttributes({
displayPostDate: value
})
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Featured image')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display featured image'),
checked: displayFeaturedImage,
onChange: value => setAttributes({
displayFeaturedImage: value
})
}), displayFeaturedImage && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalImageSizeControl, {
onChange: value => {
const newAttrs = {};
if (value.hasOwnProperty('width')) {
newAttrs.featuredImageSizeWidth = value.width;
}
if (value.hasOwnProperty('height')) {
newAttrs.featuredImageSizeHeight = value.height;
}
setAttributes(newAttrs);
},
slug: featuredImageSizeSlug,
width: featuredImageSizeWidth,
height: featuredImageSizeHeight,
imageWidth: defaultImageWidth,
imageHeight: defaultImageHeight,
imageSizeOptions: imageSizeOptions,
imageSizeHelp: (0,external_wp_i18n_namespaceObject.__)('Select the size of the source image.'),
onChangeImage: value => setAttributes({
featuredImageSizeSlug: value,
featuredImageSizeWidth: undefined,
featuredImageSizeHeight: undefined
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, {
className: "editor-latest-posts-image-alignment-control"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, null, (0,external_wp_i18n_namespaceObject.__)('Image alignment')), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar, {
value: featuredImageAlign,
onChange: value => setAttributes({
featuredImageAlign: value
}),
controls: ['left', 'center', 'right'],
isCollapsed: false
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Add link to featured image'),
checked: addLinkToFeaturedImage,
onChange: value => setAttributes({
addLinkToFeaturedImage: value
})
}))), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Sorting and filtering')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.QueryControls, {
order,
orderBy,
numberOfItems: postsToShow,
onOrderChange: value => setAttributes({
order: value
}),
onOrderByChange: value => setAttributes({
orderBy: value
}),
onNumberOfItemsChange: value => setAttributes({
postsToShow: value
}),
categorySuggestions: categorySuggestions,
onCategoryChange: selectCategories,
selectedCategories: categories,
onAuthorChange: value => setAttributes({
selectedAuthor: '' !== value ? Number(value) : undefined
}),
authorList: authorList !== null && authorList !== void 0 ? authorList : [],
selectedAuthorId: selectedAuthor
}), postLayout === 'grid' && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Columns'),
value: columns,
onChange: value => setAttributes({
columns: value
}),
min: 2,
max: !hasPosts ? MAX_POSTS_COLUMNS : Math.min(MAX_POSTS_COLUMNS, latestPosts.length),
required: true
})));
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
'wp-block-latest-posts__list': true,
'is-grid': postLayout === 'grid',
'has-dates': displayPostDate,
'has-author': displayAuthor,
[`columns-${columns}`]: postLayout === 'grid'
})
});
if (!hasPosts) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, inspectorControls, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
icon: library_pin,
label: (0,external_wp_i18n_namespaceObject.__)('Latest Posts')
}, !Array.isArray(latestPosts) ? (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null) : (0,external_wp_i18n_namespaceObject.__)('No posts found.')));
}
// Removing posts from display should be instant.
const displayPosts = latestPosts.length > postsToShow ? latestPosts.slice(0, postsToShow) : latestPosts;
const layoutControls = [{
icon: library_list,
title: (0,external_wp_i18n_namespaceObject.__)('List view'),
onClick: () => setAttributes({
postLayout: 'list'
}),
isActive: postLayout === 'list'
}, {
icon: library_grid,
title: (0,external_wp_i18n_namespaceObject.__)('Grid view'),
onClick: () => setAttributes({
postLayout: 'grid'
}),
isActive: postLayout === 'grid'
}];
const dateFormat = (0,external_wp_date_namespaceObject.getSettings)().formats.date;
return (0,external_React_namespaceObject.createElement)("div", null, inspectorControls, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, {
controls: layoutControls
})), (0,external_React_namespaceObject.createElement)("ul", {
...blockProps
}, displayPosts.map(post => {
const titleTrimmed = post.title.rendered.trim();
let excerpt = post.excerpt.rendered;
const currentAuthor = authorList?.find(author => author.id === post.author);
const excerptElement = document.createElement('div');
excerptElement.innerHTML = excerpt;
excerpt = excerptElement.textContent || excerptElement.innerText || '';
const {
url: imageSourceUrl,
alt: featuredImageAlt
} = getFeaturedImageDetails(post, featuredImageSizeSlug);
const imageClasses = classnames_default()({
'wp-block-latest-posts__featured-image': true,
[`align${featuredImageAlign}`]: !!featuredImageAlign
});
const renderFeaturedImage = displayFeaturedImage && imageSourceUrl;
const featuredImage = renderFeaturedImage && (0,external_React_namespaceObject.createElement)("img", {
src: imageSourceUrl,
alt: featuredImageAlt,
style: {
maxWidth: featuredImageSizeWidth,
maxHeight: featuredImageSizeHeight
}
});
const needsReadMore = excerptLength < excerpt.trim().split(' ').length && post.excerpt.raw === '';
const postExcerpt = needsReadMore ? (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, excerpt.trim().split(' ', excerptLength).join(' '), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Hidden accessibility text: Post title */
(0,external_wp_i18n_namespaceObject.__)('… <a>Read more<span>: %1$s</span></a>'), titleTrimmed || (0,external_wp_i18n_namespaceObject.__)('(no title)')), {
a:
// eslint-disable-next-line jsx-a11y/anchor-has-content
(0,external_React_namespaceObject.createElement)("a", {
className: "wp-block-latest-posts__read-more",
href: post.link,
rel: "noopener noreferrer",
onClick: showRedirectionPreventedNotice
}),
span: (0,external_React_namespaceObject.createElement)("span", {
className: "screen-reader-text"
})
})) : excerpt;
return (0,external_React_namespaceObject.createElement)("li", {
key: post.id
}, renderFeaturedImage && (0,external_React_namespaceObject.createElement)("div", {
className: imageClasses
}, addLinkToFeaturedImage ? (0,external_React_namespaceObject.createElement)("a", {
className: "wp-block-latest-posts__post-title",
href: post.link,
rel: "noreferrer noopener",
onClick: showRedirectionPreventedNotice
}, featuredImage) : featuredImage), (0,external_React_namespaceObject.createElement)("a", {
href: post.link,
rel: "noreferrer noopener",
dangerouslySetInnerHTML: !!titleTrimmed ? {
__html: titleTrimmed
} : undefined,
onClick: showRedirectionPreventedNotice
}, !titleTrimmed ? (0,external_wp_i18n_namespaceObject.__)('(no title)') : null), displayAuthor && currentAuthor && (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-latest-posts__post-author"
}, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: byline. %s: current author. */
(0,external_wp_i18n_namespaceObject.__)('by %s'), currentAuthor.name)), displayPostDate && post.date_gmt && (0,external_React_namespaceObject.createElement)("time", {
dateTime: (0,external_wp_date_namespaceObject.format)('c', post.date_gmt),
className: "wp-block-latest-posts__post-date"
}, (0,external_wp_date_namespaceObject.dateI18n)(dateFormat, post.date_gmt)), displayPostContent && displayPostContentRadio === 'excerpt' && (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-latest-posts__post-excerpt"
}, postExcerpt), displayPostContent && displayPostContentRadio === 'full_post' && (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-latest-posts__post-full-content",
dangerouslySetInnerHTML: {
__html: post.content.raw.trim()
}
}));
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-posts/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const latest_posts_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/latest-posts",
title: "Latest Posts",
category: "widgets",
description: "Display a list of your most recent posts.",
keywords: ["recent posts"],
textdomain: "default",
attributes: {
categories: {
type: "array",
items: {
type: "object"
}
},
selectedAuthor: {
type: "number"
},
postsToShow: {
type: "number",
"default": 5
},
displayPostContent: {
type: "boolean",
"default": false
},
displayPostContentRadio: {
type: "string",
"default": "excerpt"
},
excerptLength: {
type: "number",
"default": 55
},
displayAuthor: {
type: "boolean",
"default": false
},
displayPostDate: {
type: "boolean",
"default": false
},
postLayout: {
type: "string",
"default": "list"
},
columns: {
type: "number",
"default": 3
},
order: {
type: "string",
"default": "desc"
},
orderBy: {
type: "string",
"default": "date"
},
displayFeaturedImage: {
type: "boolean",
"default": false
},
featuredImageAlign: {
type: "string",
"enum": ["left", "center", "right"]
},
featuredImageSizeSlug: {
type: "string",
"default": "thumbnail"
},
featuredImageSizeWidth: {
type: "number",
"default": null
},
featuredImageSizeHeight: {
type: "number",
"default": null
},
addLinkToFeaturedImage: {
type: "boolean",
"default": false
}
},
supports: {
align: true,
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-latest-posts-editor",
style: "wp-block-latest-posts"
};
const {
name: latest_posts_name
} = latest_posts_metadata;
const latest_posts_settings = {
icon: post_list,
example: {},
edit: LatestPostsEdit,
deprecated: latest_posts_deprecated
};
const latest_posts_init = () => initBlock({
name: latest_posts_name,
metadata: latest_posts_metadata,
settings: latest_posts_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/utils.js
/**
* WordPress dependencies
*/
const LIST_STYLES = {
A: 'upper-alpha',
a: 'lower-alpha',
I: 'upper-roman',
i: 'lower-roman'
};
function createListBlockFromDOMElement(listElement) {
const type = listElement.getAttribute('type');
const listAttributes = {
ordered: 'OL' === listElement.tagName,
anchor: listElement.id === '' ? undefined : listElement.id,
start: listElement.getAttribute('start') ? parseInt(listElement.getAttribute('start'), 10) : undefined,
reversed: listElement.hasAttribute('reversed') ? true : undefined,
type: type && LIST_STYLES[type] ? LIST_STYLES[type] : undefined
};
const innerBlocks = Array.from(listElement.children).map(listItem => {
const children = Array.from(listItem.childNodes).filter(node => node.nodeType !== node.TEXT_NODE || node.textContent.trim().length !== 0);
children.reverse();
const [nestedList, ...nodes] = children;
const hasNestedList = nestedList?.tagName === 'UL' || nestedList?.tagName === 'OL';
if (!hasNestedList) {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', {
content: listItem.innerHTML
});
}
const htmlNodes = nodes.map(node => {
if (node.nodeType === node.TEXT_NODE) {
return node.textContent;
}
return node.outerHTML;
});
htmlNodes.reverse();
const childAttributes = {
content: htmlNodes.join('').trim()
};
const childInnerBlocks = [createListBlockFromDOMElement(nestedList)];
return (0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', childAttributes, childInnerBlocks);
});
return (0,external_wp_blocks_namespaceObject.createBlock)('core/list', listAttributes, innerBlocks);
}
function migrateToListV2(attributes) {
const {
values,
start,
reversed,
ordered,
type,
...otherAttributes
} = attributes;
const list = document.createElement(ordered ? 'ol' : 'ul');
list.innerHTML = values;
if (start) {
list.setAttribute('start', start);
}
if (reversed) {
list.setAttribute('reversed', true);
}
if (type) {
list.setAttribute('type', type);
}
const [listBlock] = (0,external_wp_blocks_namespaceObject.rawHandler)({
HTML: list.outerHTML
});
return [{
...otherAttributes,
...listBlock.attributes
}, listBlock.innerBlocks];
}
function migrateTypeToInlineStyle(attributes) {
const {
type
} = attributes;
if (type && LIST_STYLES[type]) {
return {
...attributes,
type: LIST_STYLES[type]
};
}
return attributes;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/deprecated.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const v0 = {
attributes: {
ordered: {
type: 'boolean',
default: false,
__experimentalRole: 'content'
},
values: {
type: 'string',
source: 'html',
selector: 'ol,ul',
multiline: 'li',
__unstableMultilineWrapperTags: ['ol', 'ul'],
default: '',
__experimentalRole: 'content'
},
type: {
type: 'string'
},
start: {
type: 'number'
},
reversed: {
type: 'boolean'
},
placeholder: {
type: 'string'
}
},
supports: {
anchor: true,
className: false,
typography: {
fontSize: true,
__experimentalFontFamily: true
},
color: {
gradients: true,
link: true
},
__unstablePasteTextInline: true,
__experimentalSelector: 'ol,ul',
__experimentalSlashInserter: true
},
save({
attributes
}) {
const {
ordered,
values,
type,
reversed,
start
} = attributes;
const TagName = ordered ? 'ol' : 'ul';
return (0,external_React_namespaceObject.createElement)(TagName, {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
type,
reversed,
start
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: values,
multiline: "li"
}));
},
migrate: migrate_font_family,
isEligible({
style
}) {
return style?.typography?.fontFamily;
}
};
const list_deprecated_v1 = {
attributes: {
ordered: {
type: 'boolean',
default: false,
__experimentalRole: 'content'
},
values: {
type: 'string',
source: 'html',
selector: 'ol,ul',
multiline: 'li',
__unstableMultilineWrapperTags: ['ol', 'ul'],
default: '',
__experimentalRole: 'content'
},
type: {
type: 'string'
},
start: {
type: 'number'
},
reversed: {
type: 'boolean'
},
placeholder: {
type: 'string'
}
},
supports: {
anchor: true,
className: false,
typography: {
fontSize: true,
__experimentalFontFamily: true,
lineHeight: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalDefaultControls: {
fontSize: true
}
},
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
__unstablePasteTextInline: true,
__experimentalSelector: 'ol,ul',
__experimentalSlashInserter: true
},
save({
attributes
}) {
const {
ordered,
values,
type,
reversed,
start
} = attributes;
const TagName = ordered ? 'ol' : 'ul';
return (0,external_React_namespaceObject.createElement)(TagName, {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
type,
reversed,
start
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: values,
multiline: "li"
}));
},
migrate: migrateToListV2
};
// In #53301 changed to use the inline style instead of type attribute.
const list_deprecated_v2 = {
attributes: {
ordered: {
type: 'boolean',
default: false,
__experimentalRole: 'content'
},
values: {
type: 'string',
source: 'html',
selector: 'ol,ul',
multiline: 'li',
__unstableMultilineWrapperTags: ['ol', 'ul'],
default: '',
__experimentalRole: 'content'
},
type: {
type: 'string'
},
start: {
type: 'number'
},
reversed: {
type: 'boolean'
},
placeholder: {
type: 'string'
}
},
supports: {
anchor: true,
className: false,
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
__unstablePasteTextInline: true,
__experimentalSelector: 'ol,ul',
__experimentalSlashInserter: true
},
isEligible({
type
}) {
return !!type;
},
save({
attributes
}) {
const {
ordered,
type,
reversed,
start
} = attributes;
const TagName = ordered ? 'ol' : 'ul';
return (0,external_React_namespaceObject.createElement)(TagName, {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
type,
reversed,
start
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
},
migrate: migrateTypeToInlineStyle
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const list_deprecated = ([list_deprecated_v2, list_deprecated_v1, v0]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-outdent-rtl.js
/**
* WordPress dependencies
*/
const formatOutdentRTL = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M20 5.5H4V4H20V5.5ZM12 12.5H4V11H12V12.5ZM20 20V18.5H4V20H20ZM15.4697 14.9697L18.4393 12L15.4697 9.03033L16.5303 7.96967L20.0303 11.4697L20.5607 12L20.0303 12.5303L16.5303 16.0303L15.4697 14.9697Z"
}));
/* harmony default export */ const format_outdent_rtl = (formatOutdentRTL);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-outdent.js
/**
* WordPress dependencies
*/
const formatOutdent = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-4-4.6l-4 4 4 4 1-1-3-3 3-3-1-1z"
}));
/* harmony default export */ const format_outdent = (formatOutdent);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js
/**
* WordPress dependencies
*/
const formatListBulletsRTL = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"
}));
/* harmony default export */ const format_list_bullets_rtl = (formatListBulletsRTL);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js
/**
* WordPress dependencies
*/
const formatListBullets = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
}));
/* harmony default export */ const format_list_bullets = (formatListBullets);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-numbered-rtl.js
/**
* WordPress dependencies
*/
const formatListNumberedRTL = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M3.8 15.8h8.9v-1.5H3.8v1.5zm0-7h8.9V7.2H3.8v1.6zm14.7-2.1V10h1V5.3l-2.2.7.3 1 .9-.3zm1.2 6.1c-.5-.6-1.2-.5-1.7-.4-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5H20v-1h-.9c.3-.6.8-1.4.9-2.1 0-.3 0-.8-.3-1.1z"
}));
/* harmony default export */ const format_list_numbered_rtl = (formatListNumberedRTL);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-numbered.js
/**
* WordPress dependencies
*/
const formatListNumbered = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM5 6.7V10h1V5.3L3.8 6l.4 1 .8-.3zm-.4 5.7c-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5h2.7v-1h-1c.3-.6.8-1.4.9-2.1.1-.3 0-.8-.2-1.1-.5-.6-1.3-.5-1.7-.4z"
}));
/* harmony default export */ const format_list_numbered = (formatListNumbered);
;// CONCATENATED MODULE: external ["wp","deprecated"]
const 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-library/build-module/list/ordered-list-settings.js
/**
* WordPress dependencies
*/
const OrderedListSettings = ({
setAttributes,
reversed,
start,
type
}) => (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Ordered list settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Start value'),
type: "number",
onChange: value => {
const int = parseInt(value, 10);
setAttributes({
// It should be possible to unset the value,
// e.g. with an empty string.
start: isNaN(int) ? undefined : int
});
},
value: Number.isInteger(start) ? start.toString(10) : '',
step: "1"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Numbering style'),
options: [{
label: (0,external_wp_i18n_namespaceObject.__)('Numbers'),
value: 'decimal'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Uppercase letters'),
value: 'upper-alpha'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Lowercase letters'),
value: 'lower-alpha'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Uppercase Roman numerals'),
value: 'upper-roman'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Lowercase Roman numerals'),
value: 'lower-roman'
}],
value: type,
onChange: newValue => setAttributes({
type: newValue
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Reverse list numbering'),
checked: reversed || false,
onChange: value => {
setAttributes({
// Unset the attribute if not reversed.
reversed: value || undefined
});
}
})));
/* harmony default export */ const ordered_list_settings = (OrderedListSettings);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/tag-name.js
/**
* WordPress dependencies
*/
function TagName(props, ref) {
const {
ordered,
...extraProps
} = props;
const Tag = ordered ? 'ol' : 'ul';
return (0,external_React_namespaceObject.createElement)(Tag, {
ref: ref,
...extraProps
});
}
/* harmony default export */ const tag_name = ((0,external_wp_element_namespaceObject.forwardRef)(TagName));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const list_edit_TEMPLATE = [['core/list-item']];
const NATIVE_MARGIN_SPACING = 8;
/**
* At the moment, deprecations don't handle create blocks from attributes
* (like when using CPT templates). For this reason, this hook is necessary
* to avoid breaking templates using the old list block format.
*
* @param {Object} attributes Block attributes.
* @param {string} clientId Block client ID.
*/
function useMigrateOnLoad(attributes, clientId) {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
updateBlockAttributes,
replaceInnerBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// As soon as the block is loaded, migrate it to the new version.
if (!attributes.values) {
return;
}
const [newAttributes, newInnerBlocks] = migrateToListV2(attributes);
external_wp_deprecated_default()('Value attribute on the list block', {
since: '6.0',
version: '6.5',
alternative: 'inner blocks'
});
registry.batch(() => {
updateBlockAttributes(clientId, newAttributes);
replaceInnerBlocks(clientId, newInnerBlocks);
});
}, [attributes.values]);
}
function useOutdentList(clientId) {
const {
replaceBlocks,
selectionChange
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
getBlockRootClientId,
getBlockAttributes,
getBlock
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
return (0,external_wp_element_namespaceObject.useCallback)(() => {
const parentBlockId = getBlockRootClientId(clientId);
const parentBlockAttributes = getBlockAttributes(parentBlockId);
// Create a new parent block without the inner blocks.
const newParentBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', parentBlockAttributes);
const {
innerBlocks
} = getBlock(clientId);
// Replace the parent block with a new parent block without inner blocks,
// and make the inner blocks siblings of the parent.
replaceBlocks([parentBlockId], [newParentBlock, ...innerBlocks]);
// Select the last child of the list being outdent.
selectionChange(innerBlocks[innerBlocks.length - 1].clientId);
}, [clientId]);
}
function IndentUI({
clientId
}) {
const outdentList = useOutdentList(clientId);
const canOutdent = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockRootClientId,
getBlockName
} = select(external_wp_blockEditor_namespaceObject.store);
return getBlockName(getBlockRootClientId(clientId)) === 'core/list-item';
}, [clientId]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_outdent_rtl : format_outdent,
title: (0,external_wp_i18n_namespaceObject.__)('Outdent'),
describedBy: (0,external_wp_i18n_namespaceObject.__)('Outdent list item'),
disabled: !canOutdent,
onClick: outdentList
}));
}
function list_edit_Edit({
attributes,
setAttributes,
clientId,
style
}) {
const {
ordered,
type,
reversed,
start
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
style: {
...(external_wp_element_namespaceObject.Platform.isNative && style),
listStyleType: ordered && type !== 'decimal' ? type : undefined
}
});
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: list_edit_TEMPLATE,
templateLock: false,
templateInsertUpdatesSelection: true,
...(external_wp_element_namespaceObject.Platform.isNative && {
marginVertical: NATIVE_MARGIN_SPACING,
marginHorizontal: NATIVE_MARGIN_SPACING,
renderAppender: false
}),
__experimentalCaptureToolbars: true
});
useMigrateOnLoad(attributes, clientId);
const controls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_bullets_rtl : format_list_bullets,
title: (0,external_wp_i18n_namespaceObject.__)('Unordered'),
describedBy: (0,external_wp_i18n_namespaceObject.__)('Convert to unordered list'),
isActive: ordered === false,
onClick: () => {
setAttributes({
ordered: false
});
}
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_list_numbered_rtl : format_list_numbered,
title: (0,external_wp_i18n_namespaceObject.__)('Ordered'),
describedBy: (0,external_wp_i18n_namespaceObject.__)('Convert to ordered list'),
isActive: ordered === true,
onClick: () => {
setAttributes({
ordered: true
});
}
}), (0,external_React_namespaceObject.createElement)(IndentUI, {
clientId: clientId
}));
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(tag_name, {
ordered: ordered,
reversed: reversed,
start: start,
...innerBlocksProps
}), controls, ordered && (0,external_React_namespaceObject.createElement)(ordered_list_settings, {
setAttributes,
reversed,
start,
type
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/save.js
/**
* WordPress dependencies
*/
function list_save_save({
attributes
}) {
const {
ordered,
type,
reversed,
start
} = attributes;
const TagName = ordered ? 'ol' : 'ul';
return (0,external_React_namespaceObject.createElement)(TagName, {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
reversed,
start,
style: {
listStyleType: ordered && type !== 'decimal' ? type : undefined
}
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/transforms.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function getListContentSchema({
phrasingContentSchema
}) {
const listContentSchema = {
...phrasingContentSchema,
ul: {},
ol: {
attributes: ['type', 'start', 'reversed']
}
};
// Recursion is needed.
// Possible: ul > li > ul.
// Impossible: ul > ul.
['ul', 'ol'].forEach(tag => {
listContentSchema[tag].children = {
li: {
children: listContentSchema
}
};
});
return listContentSchema;
}
function getListContentFlat(blocks) {
return blocks.flatMap(({
name,
attributes,
innerBlocks = []
}) => {
if (name === 'core/list-item') {
return [attributes.content, ...getListContentFlat(innerBlocks)];
}
return getListContentFlat(innerBlocks);
});
}
const list_transforms_transforms = {
from: [{
type: 'block',
isMultiBlock: true,
blocks: ['core/paragraph', 'core/heading'],
transform: blockAttributes => {
let childBlocks = [];
if (blockAttributes.length > 1) {
childBlocks = blockAttributes.map(({
content
}) => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', {
content
});
});
} else if (blockAttributes.length === 1) {
const value = (0,external_wp_richText_namespaceObject.create)({
html: blockAttributes[0].content
});
childBlocks = (0,external_wp_richText_namespaceObject.split)(value, '\n').map(result => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', {
content: (0,external_wp_richText_namespaceObject.toHTMLString)({
value: result
})
});
});
}
return (0,external_wp_blocks_namespaceObject.createBlock)('core/list', {
anchor: blockAttributes.anchor
}, childBlocks);
}
}, {
type: 'raw',
selector: 'ol,ul',
schema: args => ({
ol: getListContentSchema(args).ol,
ul: getListContentSchema(args).ul
}),
transform: createListBlockFromDOMElement
}, ...['*', '-'].map(prefix => ({
type: 'prefix',
prefix,
transform(content) {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/list', {}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', {
content
})]);
}
})), ...['1.', '1)'].map(prefix => ({
type: 'prefix',
prefix,
transform(content) {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/list', {
ordered: true
}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/list-item', {
content
})]);
}
}))],
to: [...['core/paragraph', 'core/heading'].map(block => ({
type: 'block',
blocks: [block],
transform: (_attributes, childBlocks) => {
return getListContentFlat(childBlocks).map(content => (0,external_wp_blocks_namespaceObject.createBlock)(block, {
content
}));
}
}))]
};
/* harmony default export */ const list_transforms = (list_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const list_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/list",
title: "List",
category: "text",
allowedBlocks: ["core/list-item"],
description: "Create a bulleted or numbered list.",
keywords: ["bullet list", "ordered list", "numbered list"],
textdomain: "default",
attributes: {
ordered: {
type: "boolean",
"default": false,
__experimentalRole: "content"
},
values: {
type: "string",
source: "html",
selector: "ol,ul",
multiline: "li",
__unstableMultilineWrapperTags: ["ol", "ul"],
"default": "",
__experimentalRole: "content"
},
type: {
type: "string"
},
start: {
type: "number"
},
reversed: {
type: "boolean"
},
placeholder: {
type: "string"
}
},
supports: {
anchor: true,
className: false,
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
__unstablePasteTextInline: true,
__experimentalSelector: "ol,ul",
__experimentalOnMerge: true,
__experimentalSlashInserter: true,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-list-editor",
style: "wp-block-list"
};
const {
name: list_name
} = list_metadata;
const list_settings = {
icon: library_list,
example: {
innerBlocks: [{
name: 'core/list-item',
attributes: {
content: (0,external_wp_i18n_namespaceObject.__)('Alice.')
}
}, {
name: 'core/list-item',
attributes: {
content: (0,external_wp_i18n_namespaceObject.__)('The White Rabbit.')
}
}, {
name: 'core/list-item',
attributes: {
content: (0,external_wp_i18n_namespaceObject.__)('The Cheshire Cat.')
}
}, {
name: 'core/list-item',
attributes: {
content: (0,external_wp_i18n_namespaceObject.__)('The Mad Hatter.')
}
}, {
name: 'core/list-item',
attributes: {
content: (0,external_wp_i18n_namespaceObject.__)('The Queen of Hearts.')
}
}]
},
transforms: list_transforms,
edit: list_edit_Edit,
save: list_save_save,
deprecated: list_deprecated
};
const list_init = () => initBlock({
name: list_name,
metadata: list_metadata,
settings: list_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-item.js
/**
* WordPress dependencies
*/
const listItem = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12 11v1.5h8V11h-8zm-6-1c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
}));
/* harmony default export */ const list_item = (listItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-indent-rtl.js
/**
* WordPress dependencies
*/
const formatIndentRTL = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M20 5.5H4V4H20V5.5ZM12 12.5H4V11H12V12.5ZM20 20V18.5H4V20H20ZM20.0303 9.03033L17.0607 12L20.0303 14.9697L18.9697 16.0303L15.4697 12.5303L14.9393 12L15.4697 11.4697L18.9697 7.96967L20.0303 9.03033Z"
}));
/* harmony default export */ const format_indent_rtl = (formatIndentRTL);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-indent.js
/**
* WordPress dependencies
*/
const formatIndent = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-8-3.5l3 3-3 3 1 1 4-4-4-4-1 1z"
}));
/* harmony default export */ const format_indent = (formatIndent);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/hooks/use-indent-list-item.js
/**
* WordPress dependencies
*/
function useIndentListItem(clientId) {
const {
replaceBlocks,
selectionChange,
multiSelect
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
getBlock,
getPreviousBlockClientId,
getSelectionStart,
getSelectionEnd,
hasMultiSelection,
getMultiSelectedBlockClientIds
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
return (0,external_wp_element_namespaceObject.useCallback)(() => {
const _hasMultiSelection = hasMultiSelection();
const clientIds = _hasMultiSelection ? getMultiSelectedBlockClientIds() : [clientId];
const clonedBlocks = clientIds.map(_clientId => (0,external_wp_blocks_namespaceObject.cloneBlock)(getBlock(_clientId)));
const previousSiblingId = getPreviousBlockClientId(clientId);
const newListItem = (0,external_wp_blocks_namespaceObject.cloneBlock)(getBlock(previousSiblingId));
// If the sibling has no innerBlocks, create a new `list` block.
if (!newListItem.innerBlocks?.length) {
newListItem.innerBlocks = [(0,external_wp_blocks_namespaceObject.createBlock)('core/list')];
}
// A list item usually has one `list`, but it's possible to have
// more. So we need to preserve the previous `list` blocks and
// merge the new blocks to the last `list`.
newListItem.innerBlocks[newListItem.innerBlocks.length - 1].innerBlocks.push(...clonedBlocks);
// We get the selection start/end here, because when
// we replace blocks, the selection is updated too.
const selectionStart = getSelectionStart();
const selectionEnd = getSelectionEnd();
// Replace the previous sibling of the block being indented and the indented blocks,
// with a new block whose attributes are equal to the ones of the previous sibling and
// whose descendants are the children of the previous sibling, followed by the indented blocks.
replaceBlocks([previousSiblingId, ...clientIds], [newListItem]);
if (!_hasMultiSelection) {
selectionChange(clonedBlocks[0].clientId, selectionEnd.attributeKey, selectionEnd.clientId === selectionStart.clientId ? selectionStart.offset : selectionEnd.offset, selectionEnd.offset);
} else {
multiSelect(clonedBlocks[0].clientId, clonedBlocks[clonedBlocks.length - 1].clientId);
}
}, [clientId]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/hooks/use-outdent-list-item.js
/**
* WordPress dependencies
*/
function useOutdentListItem() {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
moveBlocksToPosition,
removeBlock,
insertBlock,
updateBlockListSettings
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
getBlockRootClientId,
getBlockName,
getBlockOrder,
getBlockIndex,
getSelectedBlockClientIds,
getBlock,
getBlockListSettings
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
function getParentListItemId(id) {
const listId = getBlockRootClientId(id);
const parentListItemId = getBlockRootClientId(listId);
if (!parentListItemId) return;
if (getBlockName(parentListItemId) !== 'core/list-item') return;
return parentListItemId;
}
return (0,external_wp_element_namespaceObject.useCallback)((clientIds = getSelectedBlockClientIds()) => {
if (!Array.isArray(clientIds)) {
clientIds = [clientIds];
}
if (!clientIds.length) return;
const firstClientId = clientIds[0];
// Can't outdent if it's not a list item.
if (getBlockName(firstClientId) !== 'core/list-item') return;
const parentListItemId = getParentListItemId(firstClientId);
// Can't outdent if it's at the top level.
if (!parentListItemId) return;
const parentListId = getBlockRootClientId(firstClientId);
const lastClientId = clientIds[clientIds.length - 1];
const order = getBlockOrder(parentListId);
const followingListItems = order.slice(getBlockIndex(lastClientId) + 1);
registry.batch(() => {
if (followingListItems.length) {
let nestedListId = getBlockOrder(firstClientId)[0];
if (!nestedListId) {
const nestedListBlock = (0,external_wp_blocks_namespaceObject.cloneBlock)(getBlock(parentListId), {}, []);
nestedListId = nestedListBlock.clientId;
insertBlock(nestedListBlock, 0, firstClientId, false);
// Immediately update the block list settings, otherwise
// blocks can't be moved here due to canInsert checks.
updateBlockListSettings(nestedListId, getBlockListSettings(parentListId));
}
moveBlocksToPosition(followingListItems, parentListId, nestedListId);
}
moveBlocksToPosition(clientIds, parentListId, getBlockRootClientId(parentListItemId), getBlockIndex(parentListItemId) + 1);
if (!getBlockOrder(parentListId).length) {
const shouldSelectParent = false;
removeBlock(parentListId, shouldSelectParent);
}
});
}, []);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/hooks/use-enter.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function use_enter_useEnter(props) {
const {
replaceBlocks,
selectionChange
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
getBlock,
getBlockRootClientId,
getBlockIndex,
getBlockName
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const propsRef = (0,external_wp_element_namespaceObject.useRef)(props);
propsRef.current = props;
const outdentListItem = useOutdentListItem();
return (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
function onKeyDown(event) {
if (event.defaultPrevented || event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) {
return;
}
const {
content,
clientId
} = propsRef.current;
if (content.length) {
return;
}
event.preventDefault();
const canOutdent = getBlockName(getBlockRootClientId(getBlockRootClientId(propsRef.current.clientId))) === 'core/list-item';
if (canOutdent) {
outdentListItem();
return;
}
// Here we are in top level list so we need to split.
const topParentListBlock = getBlock(getBlockRootClientId(clientId));
const blockIndex = getBlockIndex(clientId);
const head = (0,external_wp_blocks_namespaceObject.cloneBlock)({
...topParentListBlock,
innerBlocks: topParentListBlock.innerBlocks.slice(0, blockIndex)
});
const middle = (0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)());
// Last list item might contain a `list` block innerBlock
// In that case append remaining innerBlocks blocks.
const after = [...(topParentListBlock.innerBlocks[blockIndex].innerBlocks[0]?.innerBlocks || []), ...topParentListBlock.innerBlocks.slice(blockIndex + 1)];
const tail = after.length ? [(0,external_wp_blocks_namespaceObject.cloneBlock)({
...topParentListBlock,
innerBlocks: after
})] : [];
replaceBlocks(topParentListBlock.clientId, [head, middle, ...tail], 1);
// We manually change the selection here because we are replacing
// a different block than the selected one.
selectionChange(middle.clientId);
}
element.addEventListener('keydown', onKeyDown);
return () => {
element.removeEventListener('keydown', onKeyDown);
};
}, []);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/hooks/use-space.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useSpace(clientId) {
const {
getSelectionStart,
getSelectionEnd,
getBlockIndex
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const indentListItem = useIndentListItem(clientId);
return (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
function onKeyDown(event) {
const {
keyCode,
shiftKey,
altKey,
metaKey,
ctrlKey
} = event;
if (event.defaultPrevented || keyCode !== external_wp_keycodes_namespaceObject.SPACE ||
// Only override when no modifiers are pressed.
shiftKey || altKey || metaKey || ctrlKey) {
return;
}
if (getBlockIndex(clientId) === 0) {
return;
}
const selectionStart = getSelectionStart();
const selectionEnd = getSelectionEnd();
if (selectionStart.offset === 0 && selectionEnd.offset === 0) {
event.preventDefault();
indentListItem();
}
}
element.addEventListener('keydown', onKeyDown);
return () => {
element.removeEventListener('keydown', onKeyDown);
};
}, [clientId, indentListItem]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/hooks/use-split.js
/**
* WordPress dependencies
*/
function useSplit(clientId) {
// We can not rely on the isAfterOriginal parameter of the callback,
// because if the value after the split is empty isAfterOriginal is false
// while the value is in fact after the original. So to avoid that issue we use
// a flag where the first execution of the callback is false (it is the before value)
// and the second execution is true, it is the after value.
const isAfter = (0,external_wp_element_namespaceObject.useRef)(false);
const {
getBlock
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
return (0,external_wp_element_namespaceObject.useCallback)(value => {
const block = getBlock(clientId);
if (isAfter.current) {
return (0,external_wp_blocks_namespaceObject.cloneBlock)(block, {
content: value
});
}
isAfter.current = true;
return (0,external_wp_blocks_namespaceObject.createBlock)(block.name, {
...block.attributes,
content: value
});
}, [clientId, getBlock]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/hooks/use-merge.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useMerge(clientId, onMerge) {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
getPreviousBlockClientId,
getNextBlockClientId,
getBlockOrder,
getBlockRootClientId,
getBlockName
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const {
mergeBlocks,
moveBlocksToPosition
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const outdentListItem = useOutdentListItem();
function getTrailingId(id) {
const order = getBlockOrder(id);
if (!order.length) {
return id;
}
return getTrailingId(order[order.length - 1]);
}
function getParentListItemId(id) {
const listId = getBlockRootClientId(id);
const parentListItemId = getBlockRootClientId(listId);
if (!parentListItemId) return;
if (getBlockName(parentListItemId) !== 'core/list-item') return;
return parentListItemId;
}
/**
* Return the next list item with respect to the given list item. If none,
* return the next list item of the parent list item if it exists.
*
* @param {string} id A list item client ID.
* @return {string?} The client ID of the next list item.
*/
function _getNextId(id) {
const next = getNextBlockClientId(id);
if (next) return next;
const parentListItemId = getParentListItemId(id);
if (!parentListItemId) return;
return _getNextId(parentListItemId);
}
/**
* Given a client ID, return the client ID of the list item on the next
* line, regardless of indentation level.
*
* @param {string} id The client ID of the current list item.
* @return {string?} The client ID of the next list item.
*/
function getNextId(id) {
const order = getBlockOrder(id);
// If the list item does not have a nested list, return the next list
// item.
if (!order.length) {
return _getNextId(id);
}
// Get the first list item in the nested list.
return getBlockOrder(order[0])[0];
}
return forward => {
function mergeWithNested(clientIdA, clientIdB) {
registry.batch(() => {
// When merging a sub list item with a higher next list item, we
// also need to move any nested list items. Check if there's a
// listed list, and append its nested list items to the current
// list.
const [nestedListClientId] = getBlockOrder(clientIdB);
if (nestedListClientId) {
moveBlocksToPosition(getBlockOrder(nestedListClientId), nestedListClientId, getBlockRootClientId(clientIdA));
}
mergeBlocks(clientIdA, clientIdB);
});
}
if (forward) {
const nextBlockClientId = getNextId(clientId);
if (!nextBlockClientId) {
onMerge(forward);
return;
}
if (getParentListItemId(nextBlockClientId)) {
outdentListItem(nextBlockClientId);
} else {
mergeWithNested(clientId, nextBlockClientId);
}
} else {
// Merging is only done from the top level. For lowel levels, the
// list item is outdented instead.
const previousBlockClientId = getPreviousBlockClientId(clientId);
if (getParentListItemId(clientId)) {
outdentListItem(clientId);
} else if (previousBlockClientId) {
const trailingId = getTrailingId(previousBlockClientId);
mergeWithNested(trailingId, clientId);
} else {
onMerge(forward);
}
}
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/utils.js
/**
* WordPress dependencies
*/
function convertBlockToList(block) {
const list = (0,external_wp_blocks_namespaceObject.switchToBlockType)(block, 'core/list');
if (list) {
return list;
}
const paragraph = (0,external_wp_blocks_namespaceObject.switchToBlockType)(block, 'core/paragraph');
if (!paragraph) {
return null;
}
return (0,external_wp_blocks_namespaceObject.switchToBlockType)(paragraph, 'core/list');
}
function convertToListItems(blocks) {
const listItems = [];
for (let block of blocks) {
if (block.name === 'core/list-item') {
listItems.push(block);
} else if (block.name === 'core/list') {
listItems.push(...block.innerBlocks);
} else if (block = convertBlockToList(block)) {
for (const {
innerBlocks
} of block) {
listItems.push(...innerBlocks);
}
}
}
return listItems;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function edit_IndentUI({
clientId
}) {
const indentListItem = useIndentListItem(clientId);
const outdentListItem = useOutdentListItem();
const {
canIndent,
canOutdent
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockIndex,
getBlockRootClientId,
getBlockName
} = select(external_wp_blockEditor_namespaceObject.store);
return {
canIndent: getBlockIndex(clientId) > 0,
canOutdent: getBlockName(getBlockRootClientId(getBlockRootClientId(clientId))) === 'core/list-item'
};
}, [clientId]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_outdent_rtl : format_outdent,
title: (0,external_wp_i18n_namespaceObject.__)('Outdent'),
describedBy: (0,external_wp_i18n_namespaceObject.__)('Outdent list item'),
disabled: !canOutdent,
onClick: () => outdentListItem()
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? format_indent_rtl : format_indent,
title: (0,external_wp_i18n_namespaceObject.__)('Indent'),
describedBy: (0,external_wp_i18n_namespaceObject.__)('Indent list item'),
isDisabled: !canIndent,
onClick: () => indentListItem()
}));
}
function ListItemEdit({
attributes,
setAttributes,
onReplace,
clientId,
mergeBlocks
}) {
const {
placeholder,
content
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
renderAppender: false,
__unstableDisableDropZone: true
});
const useEnterRef = use_enter_useEnter({
content,
clientId
});
const useSpaceRef = useSpace(clientId);
const onSplit = useSplit(clientId);
const onMerge = useMerge(clientId, mergeBlocks);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("li", {
...innerBlocksProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([useEnterRef, useSpaceRef]),
identifier: "content",
tagName: "div",
onChange: nextContent => setAttributes({
content: nextContent
}),
value: content,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('List text'),
placeholder: placeholder || (0,external_wp_i18n_namespaceObject.__)('List'),
onSplit: onSplit,
onMerge: onMerge,
onReplace: onReplace ? (blocks, ...args) => {
onReplace(convertToListItems(blocks), ...args);
} : undefined
}), innerBlocksProps.children), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(edit_IndentUI, {
clientId: clientId
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/save.js
/**
* WordPress dependencies
*/
function list_item_save_save({
attributes
}) {
return (0,external_React_namespaceObject.createElement)("li", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: attributes.content
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/transforms.js
/**
* WordPress dependencies
*/
const list_item_transforms_transforms = {
to: [{
type: 'block',
blocks: ['core/paragraph'],
transform: (attributes, innerBlocks = []) => [(0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', attributes), ...innerBlocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block))]
}]
};
/* harmony default export */ const list_item_transforms = (list_item_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list-item/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const list_item_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/list-item",
title: "List item",
category: "text",
parent: ["core/list"],
allowedBlocks: ["core/list"],
description: "Create a list item.",
textdomain: "default",
attributes: {
placeholder: {
type: "string"
},
content: {
type: "rich-text",
source: "rich-text",
selector: "li",
__experimentalRole: "content"
}
},
supports: {
className: false,
__experimentalSelector: "li",
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: list_item_name
} = list_item_metadata;
const list_item_settings = {
icon: list_item,
edit: ListItemEdit,
save: list_item_save_save,
merge(attributes, attributesToMerge) {
return {
...attributes,
content: attributes.content + attributesToMerge.content
};
},
transforms: list_item_transforms,
[unlock(external_wp_blockEditor_namespaceObject.privateApis).requiresWrapperOnCopy]: true
};
const list_item_init = () => initBlock({
name: list_item_name,
metadata: list_item_metadata,
settings: list_item_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/login.js
/**
* WordPress dependencies
*/
const login = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M11 14.5l1.1 1.1 3-3 .5-.5-.6-.6-3-3-1 1 1.7 1.7H5v1.5h7.7L11 14.5zM16.8 5h-7c-1.1 0-2 .9-2 2v1.5h1.5V7c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v10c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5v-1.5H7.8V17c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2z"
}));
/* harmony default export */ const library_login = (login);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/loginout/edit.js
/**
* WordPress dependencies
*/
function LoginOutEdit({
attributes,
setAttributes
}) {
const {
displayLoginAsForm,
redirectToCurrent
} = attributes;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display login as form'),
checked: displayLoginAsForm,
onChange: () => setAttributes({
displayLoginAsForm: !displayLoginAsForm
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Redirect to current URL'),
checked: redirectToCurrent,
onChange: () => setAttributes({
redirectToCurrent: !redirectToCurrent
})
}))), (0,external_React_namespaceObject.createElement)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: 'logged-in'
})
}, (0,external_React_namespaceObject.createElement)("a", {
href: "#login-pseudo-link"
}, (0,external_wp_i18n_namespaceObject.__)('Log out'))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/loginout/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const loginout_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/loginout",
title: "Login/out",
category: "theme",
description: "Show login & logout links.",
keywords: ["login", "logout", "form"],
textdomain: "default",
attributes: {
displayLoginAsForm: {
type: "boolean",
"default": false
},
redirectToCurrent: {
type: "boolean",
"default": true
}
},
supports: {
className: true,
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: loginout_name
} = loginout_metadata;
const loginout_settings = {
icon: library_login,
edit: LoginOutEdit
};
const loginout_init = () => initBlock({
name: loginout_name,
metadata: loginout_metadata,
settings: loginout_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media-and-text.js
/**
* WordPress dependencies
*/
const mediaAndText = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M3 6v11.5h8V6H3Zm11 3h7V7.5h-7V9Zm7 3.5h-7V11h7v1.5ZM14 16h7v-1.5h-7V16Z"
}));
/* harmony default export */ const media_and_text = (mediaAndText);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/constants.js
/**
* WordPress dependencies
*/
const DEFAULT_MEDIA_SIZE_SLUG = 'full';
const WIDTH_CONSTRAINT_PERCENTAGE = 15;
const media_text_constants_LINK_DESTINATION_MEDIA = 'media';
const media_text_constants_LINK_DESTINATION_ATTACHMENT = 'attachment';
const constants_TEMPLATE = [['core/paragraph', {
placeholder: (0,external_wp_i18n_namespaceObject._x)('Content…', 'content placeholder')
}]];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const v1ToV5ImageFillStyles = (url, focalPoint) => {
return url ? {
backgroundImage: `url(${url})`,
backgroundPosition: focalPoint ? `${focalPoint.x * 100}% ${focalPoint.y * 100}%` : `50% 50%`
} : {};
};
const v6ImageFillStyles = (url, focalPoint) => {
return url ? {
backgroundImage: `url(${url})`,
backgroundPosition: focalPoint ? `${Math.round(focalPoint.x * 100)}% ${Math.round(focalPoint.y * 100)}%` : `50% 50%`
} : {};
};
const DEFAULT_MEDIA_WIDTH = 50;
const noop = () => {};
const media_text_deprecated_migrateCustomColors = attributes => {
if (!attributes.customBackgroundColor) {
return attributes;
}
const style = {
color: {
background: attributes.customBackgroundColor
}
};
const {
customBackgroundColor,
...restAttributes
} = attributes;
return {
...restAttributes,
style
};
};
// After align attribute's default was updated this function explicitly sets
// the align value for deprecated blocks to the `wide` value which was default
// for their versions of this block.
const migrateDefaultAlign = attributes => {
if (attributes.align) {
return attributes;
}
return {
...attributes,
align: 'wide'
};
};
const v0Attributes = {
align: {
type: 'string',
default: 'wide'
},
mediaAlt: {
type: 'string',
source: 'attribute',
selector: 'figure img',
attribute: 'alt',
default: ''
},
mediaPosition: {
type: 'string',
default: 'left'
},
mediaId: {
type: 'number'
},
mediaType: {
type: 'string'
},
mediaWidth: {
type: 'number',
default: 50
},
isStackedOnMobile: {
type: 'boolean',
default: false
}
};
const v4ToV5BlockAttributes = {
...v0Attributes,
isStackedOnMobile: {
type: 'boolean',
default: true
},
mediaUrl: {
type: 'string',
source: 'attribute',
selector: 'figure video,figure img',
attribute: 'src'
},
mediaLink: {
type: 'string'
},
linkDestination: {
type: 'string'
},
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'figure a',
attribute: 'target'
},
href: {
type: 'string',
source: 'attribute',
selector: 'figure a',
attribute: 'href'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'figure a',
attribute: 'rel'
},
linkClass: {
type: 'string',
source: 'attribute',
selector: 'figure a',
attribute: 'class'
},
mediaSizeSlug: {
type: 'string'
},
verticalAlignment: {
type: 'string'
},
imageFill: {
type: 'boolean'
},
focalPoint: {
type: 'object'
}
};
const v6Attributes = {
...v4ToV5BlockAttributes,
mediaAlt: {
type: 'string',
source: 'attribute',
selector: 'figure img',
attribute: 'alt',
default: '',
__experimentalRole: 'content'
},
mediaId: {
type: 'number',
__experimentalRole: 'content'
},
mediaUrl: {
type: 'string',
source: 'attribute',
selector: 'figure video,figure img',
attribute: 'src',
__experimentalRole: 'content'
},
href: {
type: 'string',
source: 'attribute',
selector: 'figure a',
attribute: 'href',
__experimentalRole: 'content'
},
mediaType: {
type: 'string',
__experimentalRole: 'content'
}
};
const v4ToV5Supports = {
anchor: true,
align: ['wide', 'full'],
html: false,
color: {
gradients: true,
link: true
}
};
const v6Supports = {
...v4ToV5Supports,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
}
};
// Version with wide as the default alignment.
// See: https://github.com/WordPress/gutenberg/pull/48404
const media_text_deprecated_v6 = {
attributes: v6Attributes,
supports: v6Supports,
save({
attributes
}) {
const {
isStackedOnMobile,
mediaAlt,
mediaPosition,
mediaType,
mediaUrl,
mediaWidth,
mediaId,
verticalAlignment,
imageFill,
focalPoint,
linkClass,
href,
linkTarget,
rel
} = attributes;
const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
const newRel = !rel ? undefined : rel;
const imageClasses = classnames_default()({
[`wp-image-${mediaId}`]: mediaId && mediaType === 'image',
[`size-${mediaSizeSlug}`]: mediaId && mediaType === 'image'
});
let image = (0,external_React_namespaceObject.createElement)("img", {
src: mediaUrl,
alt: mediaAlt,
className: imageClasses || null
});
if (href) {
image = (0,external_React_namespaceObject.createElement)("a", {
className: linkClass,
href: href,
target: linkTarget,
rel: newRel
}, image);
}
const mediaTypeRenders = {
image: () => image,
video: () => (0,external_React_namespaceObject.createElement)("video", {
controls: true,
src: mediaUrl
})
};
const className = classnames_default()({
'has-media-on-the-right': 'right' === mediaPosition,
'is-stacked-on-mobile': isStackedOnMobile,
[`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment,
'is-image-fill': imageFill
});
const backgroundStyles = imageFill ? v6ImageFillStyles(mediaUrl, focalPoint) : {};
let gridTemplateColumns;
if (mediaWidth !== DEFAULT_MEDIA_WIDTH) {
gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`;
}
const style = {
gridTemplateColumns
};
if ('right' === mediaPosition) {
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
style
})
}, (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-media-text__content'
})
}), (0,external_React_namespaceObject.createElement)("figure", {
className: "wp-block-media-text__media",
style: backgroundStyles
}, (mediaTypeRenders[mediaType] || noop)()));
}
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
style
})
}, (0,external_React_namespaceObject.createElement)("figure", {
className: "wp-block-media-text__media",
style: backgroundStyles
}, (mediaTypeRenders[mediaType] || noop)()), (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-media-text__content'
})
}));
},
migrate: migrateDefaultAlign,
isEligible(attributes, innerBlocks, {
block
}) {
const {
attributes: finalizedAttributes
} = block;
// When the align attribute defaults to none, valid block markup should
// not contain any alignment CSS class. Unfortunately, this
// deprecation's version of the block won't be invalidated due to the
// alignwide class still being in the markup. That is because the custom
// CSS classname support picks it up and adds it to the className
// attribute. At the time of parsing, the className attribute won't
// contain the alignwide class, hence the need to check the finalized
// block attributes.
return attributes.align === undefined && !!finalizedAttributes.className?.includes('alignwide');
}
};
// Version with non-rounded background position attribute for focal point.
// See: https://github.com/WordPress/gutenberg/pull/33915
const media_text_deprecated_v5 = {
attributes: v4ToV5BlockAttributes,
supports: v4ToV5Supports,
save({
attributes
}) {
const {
isStackedOnMobile,
mediaAlt,
mediaPosition,
mediaType,
mediaUrl,
mediaWidth,
mediaId,
verticalAlignment,
imageFill,
focalPoint,
linkClass,
href,
linkTarget,
rel
} = attributes;
const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
const newRel = !rel ? undefined : rel;
const imageClasses = classnames_default()({
[`wp-image-${mediaId}`]: mediaId && mediaType === 'image',
[`size-${mediaSizeSlug}`]: mediaId && mediaType === 'image'
});
let image = (0,external_React_namespaceObject.createElement)("img", {
src: mediaUrl,
alt: mediaAlt,
className: imageClasses || null
});
if (href) {
image = (0,external_React_namespaceObject.createElement)("a", {
className: linkClass,
href: href,
target: linkTarget,
rel: newRel
}, image);
}
const mediaTypeRenders = {
image: () => image,
video: () => (0,external_React_namespaceObject.createElement)("video", {
controls: true,
src: mediaUrl
})
};
const className = classnames_default()({
'has-media-on-the-right': 'right' === mediaPosition,
'is-stacked-on-mobile': isStackedOnMobile,
[`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment,
'is-image-fill': imageFill
});
const backgroundStyles = imageFill ? v1ToV5ImageFillStyles(mediaUrl, focalPoint) : {};
let gridTemplateColumns;
if (mediaWidth !== DEFAULT_MEDIA_WIDTH) {
gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`;
}
const style = {
gridTemplateColumns
};
if ('right' === mediaPosition) {
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
style
})
}, (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-media-text__content'
})
}), (0,external_React_namespaceObject.createElement)("figure", {
className: "wp-block-media-text__media",
style: backgroundStyles
}, (mediaTypeRenders[mediaType] || noop)()));
}
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
style
})
}, (0,external_React_namespaceObject.createElement)("figure", {
className: "wp-block-media-text__media",
style: backgroundStyles
}, (mediaTypeRenders[mediaType] || noop)()), (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-media-text__content'
})
}));
},
migrate: migrateDefaultAlign
};
// Version with CSS grid
// See: https://github.com/WordPress/gutenberg/pull/40806
const media_text_deprecated_v4 = {
attributes: v4ToV5BlockAttributes,
supports: v4ToV5Supports,
save({
attributes
}) {
const {
isStackedOnMobile,
mediaAlt,
mediaPosition,
mediaType,
mediaUrl,
mediaWidth,
mediaId,
verticalAlignment,
imageFill,
focalPoint,
linkClass,
href,
linkTarget,
rel
} = attributes;
const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
const newRel = !rel ? undefined : rel;
const imageClasses = classnames_default()({
[`wp-image-${mediaId}`]: mediaId && mediaType === 'image',
[`size-${mediaSizeSlug}`]: mediaId && mediaType === 'image'
});
let image = (0,external_React_namespaceObject.createElement)("img", {
src: mediaUrl,
alt: mediaAlt,
className: imageClasses || null
});
if (href) {
image = (0,external_React_namespaceObject.createElement)("a", {
className: linkClass,
href: href,
target: linkTarget,
rel: newRel
}, image);
}
const mediaTypeRenders = {
image: () => image,
video: () => (0,external_React_namespaceObject.createElement)("video", {
controls: true,
src: mediaUrl
})
};
const className = classnames_default()({
'has-media-on-the-right': 'right' === mediaPosition,
'is-stacked-on-mobile': isStackedOnMobile,
[`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment,
'is-image-fill': imageFill
});
const backgroundStyles = imageFill ? v1ToV5ImageFillStyles(mediaUrl, focalPoint) : {};
let gridTemplateColumns;
if (mediaWidth !== DEFAULT_MEDIA_WIDTH) {
gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`;
}
const style = {
gridTemplateColumns
};
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
style
})
}, (0,external_React_namespaceObject.createElement)("figure", {
className: "wp-block-media-text__media",
style: backgroundStyles
}, (mediaTypeRenders[mediaType] || noop)()), (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-media-text__content'
})
}));
},
migrate: migrateDefaultAlign
};
// Version with ad-hoc color attributes
// See: https://github.com/WordPress/gutenberg/pull/21169
const media_text_deprecated_v3 = {
attributes: {
...v0Attributes,
isStackedOnMobile: {
type: 'boolean',
default: true
},
backgroundColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
mediaLink: {
type: 'string'
},
linkDestination: {
type: 'string'
},
linkTarget: {
type: 'string',
source: 'attribute',
selector: 'figure a',
attribute: 'target'
},
href: {
type: 'string',
source: 'attribute',
selector: 'figure a',
attribute: 'href'
},
rel: {
type: 'string',
source: 'attribute',
selector: 'figure a',
attribute: 'rel'
},
linkClass: {
type: 'string',
source: 'attribute',
selector: 'figure a',
attribute: 'class'
},
verticalAlignment: {
type: 'string'
},
imageFill: {
type: 'boolean'
},
focalPoint: {
type: 'object'
}
},
migrate: (0,external_wp_compose_namespaceObject.compose)(media_text_deprecated_migrateCustomColors, migrateDefaultAlign),
save({
attributes
}) {
const {
backgroundColor,
customBackgroundColor,
isStackedOnMobile,
mediaAlt,
mediaPosition,
mediaType,
mediaUrl,
mediaWidth,
mediaId,
verticalAlignment,
imageFill,
focalPoint,
linkClass,
href,
linkTarget,
rel
} = attributes;
const newRel = !rel ? undefined : rel;
let image = (0,external_React_namespaceObject.createElement)("img", {
src: mediaUrl,
alt: mediaAlt,
className: mediaId && mediaType === 'image' ? `wp-image-${mediaId}` : null
});
if (href) {
image = (0,external_React_namespaceObject.createElement)("a", {
className: linkClass,
href: href,
target: linkTarget,
rel: newRel
}, image);
}
const mediaTypeRenders = {
image: () => image,
video: () => (0,external_React_namespaceObject.createElement)("video", {
controls: true,
src: mediaUrl
})
};
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const className = classnames_default()({
'has-media-on-the-right': 'right' === mediaPosition,
'has-background': backgroundClass || customBackgroundColor,
[backgroundClass]: backgroundClass,
'is-stacked-on-mobile': isStackedOnMobile,
[`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment,
'is-image-fill': imageFill
});
const backgroundStyles = imageFill ? v1ToV5ImageFillStyles(mediaUrl, focalPoint) : {};
let gridTemplateColumns;
if (mediaWidth !== DEFAULT_MEDIA_WIDTH) {
gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`;
}
const style = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
gridTemplateColumns
};
return (0,external_React_namespaceObject.createElement)("div", {
className: className,
style: style
}, (0,external_React_namespaceObject.createElement)("figure", {
className: "wp-block-media-text__media",
style: backgroundStyles
}, (mediaTypeRenders[mediaType] || noop)()), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-media-text__content"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null)));
}
};
// Version with stack on mobile off by default
// See: https://github.com/WordPress/gutenberg/pull/14364
const media_text_deprecated_v2 = {
attributes: {
...v0Attributes,
backgroundColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
mediaUrl: {
type: 'string',
source: 'attribute',
selector: 'figure video,figure img',
attribute: 'src'
},
verticalAlignment: {
type: 'string'
},
imageFill: {
type: 'boolean'
},
focalPoint: {
type: 'object'
}
},
migrate: (0,external_wp_compose_namespaceObject.compose)(media_text_deprecated_migrateCustomColors, migrateDefaultAlign),
save({
attributes
}) {
const {
backgroundColor,
customBackgroundColor,
isStackedOnMobile,
mediaAlt,
mediaPosition,
mediaType,
mediaUrl,
mediaWidth,
mediaId,
verticalAlignment,
imageFill,
focalPoint
} = attributes;
const mediaTypeRenders = {
image: () => (0,external_React_namespaceObject.createElement)("img", {
src: mediaUrl,
alt: mediaAlt,
className: mediaId && mediaType === 'image' ? `wp-image-${mediaId}` : null
}),
video: () => (0,external_React_namespaceObject.createElement)("video", {
controls: true,
src: mediaUrl
})
};
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const className = classnames_default()({
'has-media-on-the-right': 'right' === mediaPosition,
[backgroundClass]: backgroundClass,
'is-stacked-on-mobile': isStackedOnMobile,
[`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment,
'is-image-fill': imageFill
});
const backgroundStyles = imageFill ? v1ToV5ImageFillStyles(mediaUrl, focalPoint) : {};
let gridTemplateColumns;
if (mediaWidth !== DEFAULT_MEDIA_WIDTH) {
gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`;
}
const style = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
gridTemplateColumns
};
return (0,external_React_namespaceObject.createElement)("div", {
className: className,
style: style
}, (0,external_React_namespaceObject.createElement)("figure", {
className: "wp-block-media-text__media",
style: backgroundStyles
}, (mediaTypeRenders[mediaType] || noop)()), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-media-text__content"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null)));
}
};
// Version without the wp-image-#### class on image
// See: https://github.com/WordPress/gutenberg/pull/11922
const media_text_deprecated_v1 = {
attributes: {
...v0Attributes,
backgroundColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
mediaUrl: {
type: 'string',
source: 'attribute',
selector: 'figure video,figure img',
attribute: 'src'
}
},
migrate: migrateDefaultAlign,
save({
attributes
}) {
const {
backgroundColor,
customBackgroundColor,
isStackedOnMobile,
mediaAlt,
mediaPosition,
mediaType,
mediaUrl,
mediaWidth
} = attributes;
const mediaTypeRenders = {
image: () => (0,external_React_namespaceObject.createElement)("img", {
src: mediaUrl,
alt: mediaAlt
}),
video: () => (0,external_React_namespaceObject.createElement)("video", {
controls: true,
src: mediaUrl
})
};
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const className = classnames_default()({
'has-media-on-the-right': 'right' === mediaPosition,
[backgroundClass]: backgroundClass,
'is-stacked-on-mobile': isStackedOnMobile
});
let gridTemplateColumns;
if (mediaWidth !== DEFAULT_MEDIA_WIDTH) {
gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`;
}
const style = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
gridTemplateColumns
};
return (0,external_React_namespaceObject.createElement)("div", {
className: className,
style: style
}, (0,external_React_namespaceObject.createElement)("figure", {
className: "wp-block-media-text__media"
}, (mediaTypeRenders[mediaType] || noop)()), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-media-text__content"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null)));
}
};
/* harmony default export */ const media_text_deprecated = ([media_text_deprecated_v6, media_text_deprecated_v5, media_text_deprecated_v4, media_text_deprecated_v3, media_text_deprecated_v2, media_text_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pull-left.js
/**
* WordPress dependencies
*/
const pullLeft = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 18h6V6H4v12zm9-9.5V10h7V8.5h-7zm0 7h7V14h-7v1.5z"
}));
/* harmony default export */ const pull_left = (pullLeft);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pull-right.js
/**
* WordPress dependencies
*/
const pullRight = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M14 6v12h6V6h-6zM4 10h7V8.5H4V10zm0 5.5h7V14H4v1.5z"
}));
/* harmony default export */ const pull_right = (pullRight);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js
/**
* WordPress dependencies
*/
const media = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m7 6.5 4 2.5-4 2.5z"
}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z"
}));
/* harmony default export */ const library_media = (media);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/media-container.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Constants
*/
const media_container_ALLOWED_MEDIA_TYPES = ['image', 'video'];
const media_container_noop = () => {};
function imageFillStyles(url, focalPoint) {
return url ? {
backgroundImage: `url(${url})`,
backgroundPosition: focalPoint ? `${Math.round(focalPoint.x * 100)}% ${Math.round(focalPoint.y * 100)}%` : `50% 50%`
} : {};
}
const ResizableBoxContainer = (0,external_wp_element_namespaceObject.forwardRef)(({
isSelected,
isStackedOnMobile,
...props
}, ref) => {
const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<');
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ResizableBox, {
ref: ref,
showHandle: isSelected && (!isMobile || !isStackedOnMobile),
...props
});
});
function ToolbarEditButton({
mediaId,
mediaUrl,
onSelectMedia
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, {
mediaId: mediaId,
mediaURL: mediaUrl,
allowedTypes: media_container_ALLOWED_MEDIA_TYPES,
accept: "image/*,video/*",
onSelect: onSelectMedia
}));
}
function PlaceholderContainer({
className,
mediaUrl,
onSelectMedia
}) {
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const onUploadError = message => {
createErrorNotice(message, {
type: 'snackbar'
});
};
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: library_media
}),
labels: {
title: (0,external_wp_i18n_namespaceObject.__)('Media area')
},
className: className,
onSelect: onSelectMedia,
accept: "image/*,video/*",
allowedTypes: media_container_ALLOWED_MEDIA_TYPES,
onError: onUploadError,
disableMediaButtons: mediaUrl
});
}
function MediaContainer(props, ref) {
const {
className,
commitWidthChange,
focalPoint,
imageFill,
isSelected,
isStackedOnMobile,
mediaAlt,
mediaId,
mediaPosition,
mediaType,
mediaUrl,
mediaWidth,
onSelectMedia,
onWidthChange,
enableResize
} = props;
const isTemporaryMedia = !mediaId && (0,external_wp_blob_namespaceObject.isBlobURL)(mediaUrl);
const {
toggleSelection
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
if (mediaUrl) {
const onResizeStart = () => {
toggleSelection(false);
};
const onResize = (event, direction, elt) => {
onWidthChange(parseInt(elt.style.width));
};
const onResizeStop = (event, direction, elt) => {
toggleSelection(true);
commitWidthChange(parseInt(elt.style.width));
};
const enablePositions = {
right: enableResize && mediaPosition === 'left',
left: enableResize && mediaPosition === 'right'
};
const backgroundStyles = mediaType === 'image' && imageFill ? imageFillStyles(mediaUrl, focalPoint) : {};
const mediaTypeRenderers = {
image: () => (0,external_React_namespaceObject.createElement)("img", {
src: mediaUrl,
alt: mediaAlt
}),
video: () => (0,external_React_namespaceObject.createElement)("video", {
controls: true,
src: mediaUrl
})
};
return (0,external_React_namespaceObject.createElement)(ResizableBoxContainer, {
as: "figure",
className: classnames_default()(className, 'editor-media-container__resizer', {
'is-transient': isTemporaryMedia
}),
style: backgroundStyles,
size: {
width: mediaWidth + '%'
},
minWidth: "10%",
maxWidth: "100%",
enable: enablePositions,
onResizeStart: onResizeStart,
onResize: onResize,
onResizeStop: onResizeStop,
axis: "x",
isSelected: isSelected,
isStackedOnMobile: isStackedOnMobile,
ref: ref
}, (0,external_React_namespaceObject.createElement)(ToolbarEditButton, {
onSelectMedia: onSelectMedia,
mediaUrl: mediaUrl,
mediaId: mediaId
}), (mediaTypeRenderers[mediaType] || media_container_noop)(), isTemporaryMedia && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_React_namespaceObject.createElement)(PlaceholderContainer, {
...props
}));
}
return (0,external_React_namespaceObject.createElement)(PlaceholderContainer, {
...props
});
}
/* harmony default export */ const media_container = ((0,external_wp_element_namespaceObject.forwardRef)(MediaContainer));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// this limits the resize to a safe zone to avoid making broken layouts
const applyWidthConstraints = width => Math.max(WIDTH_CONSTRAINT_PERCENTAGE, Math.min(width, 100 - WIDTH_CONSTRAINT_PERCENTAGE));
function getImageSourceUrlBySizeSlug(image, slug) {
// eslint-disable-next-line camelcase
return image?.media_details?.sizes?.[slug]?.source_url;
}
function edit_attributesFromMedia({
attributes: {
linkDestination,
href
},
setAttributes
}) {
return media => {
if (!media || !media.url) {
setAttributes({
mediaAlt: undefined,
mediaId: undefined,
mediaType: undefined,
mediaUrl: undefined,
mediaLink: undefined,
href: undefined,
focalPoint: undefined
});
return;
}
if ((0,external_wp_blob_namespaceObject.isBlobURL)(media.url)) {
media.type = (0,external_wp_blob_namespaceObject.getBlobTypeByURL)(media.url);
}
let mediaType;
let src;
// For media selections originated from a file upload.
if (media.media_type) {
if (media.media_type === 'image') {
mediaType = 'image';
} else {
// only images and videos are accepted so if the media_type is not an image we can assume it is a video.
// video contain the media type of 'file' in the object returned from the rest api.
mediaType = 'video';
}
} else {
// For media selections originated from existing files in the media library.
mediaType = media.type;
}
if (mediaType === 'image') {
// Try the "large" size URL, falling back to the "full" size URL below.
src = media.sizes?.large?.url ||
// eslint-disable-next-line camelcase
media.media_details?.sizes?.large?.source_url;
}
let newHref = href;
if (linkDestination === media_text_constants_LINK_DESTINATION_MEDIA) {
// Update the media link.
newHref = media.url;
}
// Check if the image is linked to the attachment page.
if (linkDestination === media_text_constants_LINK_DESTINATION_ATTACHMENT) {
// Update the media link.
newHref = media.link;
}
setAttributes({
mediaAlt: media.alt,
mediaId: media.id,
mediaType,
mediaUrl: src || media.url,
mediaLink: media.link || undefined,
href: newHref,
focalPoint: undefined
});
};
}
function MediaTextEdit({
attributes,
isSelected,
setAttributes
}) {
const {
focalPoint,
href,
imageFill,
isStackedOnMobile,
linkClass,
linkDestination,
linkTarget,
mediaAlt,
mediaId,
mediaPosition,
mediaType,
mediaUrl,
mediaWidth,
rel,
verticalAlignment,
allowedBlocks
} = attributes;
const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
const {
imageSizes,
image
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
return {
image: mediaId && isSelected ? select(external_wp_coreData_namespaceObject.store).getMedia(mediaId, {
context: 'view'
}) : null,
imageSizes: getSettings()?.imageSizes
};
}, [isSelected, mediaId]);
const refMediaContainer = (0,external_wp_element_namespaceObject.useRef)();
const imperativeFocalPointPreview = value => {
const {
style
} = refMediaContainer.current.resizable;
const {
x,
y
} = value;
style.backgroundPosition = `${x * 100}% ${y * 100}%`;
};
const [temporaryMediaWidth, setTemporaryMediaWidth] = (0,external_wp_element_namespaceObject.useState)(null);
const onSelectMedia = edit_attributesFromMedia({
attributes,
setAttributes
});
const onSetHref = props => {
setAttributes(props);
};
const onWidthChange = width => {
setTemporaryMediaWidth(applyWidthConstraints(width));
};
const commitWidthChange = width => {
setAttributes({
mediaWidth: applyWidthConstraints(width)
});
setTemporaryMediaWidth(null);
};
const classNames = classnames_default()({
'has-media-on-the-right': 'right' === mediaPosition,
'is-selected': isSelected,
'is-stacked-on-mobile': isStackedOnMobile,
[`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment,
'is-image-fill': imageFill
});
const widthString = `${temporaryMediaWidth || mediaWidth}%`;
const gridTemplateColumns = 'right' === mediaPosition ? `1fr ${widthString}` : `${widthString} 1fr`;
const style = {
gridTemplateColumns,
msGridColumns: gridTemplateColumns
};
const onMediaAltChange = newMediaAlt => {
setAttributes({
mediaAlt: newMediaAlt
});
};
const onVerticalAlignmentChange = alignment => {
setAttributes({
verticalAlignment: alignment
});
};
const imageSizeOptions = imageSizes.filter(({
slug
}) => getImageSourceUrlBySizeSlug(image, slug)).map(({
name,
slug
}) => ({
value: slug,
label: name
}));
const updateImage = newMediaSizeSlug => {
const newUrl = getImageSourceUrlBySizeSlug(image, newMediaSizeSlug);
if (!newUrl) {
return null;
}
setAttributes({
mediaUrl: newUrl,
mediaSizeSlug: newMediaSizeSlug
});
};
const mediaTextGeneralSettings = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Media width'),
value: temporaryMediaWidth || mediaWidth,
onChange: commitWidthChange,
min: WIDTH_CONSTRAINT_PERCENTAGE,
max: 100 - WIDTH_CONSTRAINT_PERCENTAGE
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Stack on mobile'),
checked: isStackedOnMobile,
onChange: () => setAttributes({
isStackedOnMobile: !isStackedOnMobile
})
}), mediaType === 'image' && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Crop image to fill'),
checked: !!imageFill,
onChange: () => setAttributes({
imageFill: !imageFill
})
}), imageFill && mediaUrl && mediaType === 'image' && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FocalPointPicker, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Focal point'),
url: mediaUrl,
value: focalPoint,
onChange: value => setAttributes({
focalPoint: value
}),
onDragStart: imperativeFocalPointPreview,
onDrag: imperativeFocalPointPreview
}), mediaType === 'image' && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextareaControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Alternative text'),
value: mediaAlt,
onChange: onMediaAltChange,
help: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
href: "https://www.w3.org/WAI/tutorials/images/decision-tree"
}, (0,external_wp_i18n_namespaceObject.__)('Describe the purpose of the image.')), (0,external_React_namespaceObject.createElement)("br", null), (0,external_wp_i18n_namespaceObject.__)('Leave empty if decorative.'))
}), mediaType === 'image' && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalImageSizeControl, {
onChangeImage: updateImage,
slug: mediaSizeSlug,
imageSizeOptions: imageSizeOptions,
isResizable: false,
imageSizeHelp: (0,external_wp_i18n_namespaceObject.__)('Select the size of the source image.')
}));
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classNames,
style
});
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({
className: 'wp-block-media-text__content'
}, {
template: constants_TEMPLATE,
allowedBlocks
});
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, mediaTextGeneralSettings), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, blockEditingMode === 'default' && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockVerticalAlignmentControl, {
onChange: onVerticalAlignmentChange,
value: verticalAlignment
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: pull_left,
title: (0,external_wp_i18n_namespaceObject.__)('Show media on left'),
isActive: mediaPosition === 'left',
onClick: () => setAttributes({
mediaPosition: 'left'
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: pull_right,
title: (0,external_wp_i18n_namespaceObject.__)('Show media on right'),
isActive: mediaPosition === 'right',
onClick: () => setAttributes({
mediaPosition: 'right'
})
})), mediaType === 'image' && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalImageURLInputUI, {
url: href || '',
onChangeUrl: onSetHref,
linkDestination: linkDestination,
mediaType: mediaType,
mediaUrl: image && image.source_url,
mediaLink: image && image.link,
linkTarget: linkTarget,
linkClass: linkClass,
rel: rel
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, mediaPosition === 'right' && (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
}), (0,external_React_namespaceObject.createElement)(media_container, {
className: "wp-block-media-text__media",
onSelectMedia: onSelectMedia,
onWidthChange: onWidthChange,
commitWidthChange: commitWidthChange,
ref: refMediaContainer,
enableResize: blockEditingMode === 'default',
focalPoint,
imageFill,
isSelected,
isStackedOnMobile,
mediaAlt,
mediaId,
mediaPosition,
mediaType,
mediaUrl,
mediaWidth
}), mediaPosition !== 'right' && (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
})));
}
/* harmony default export */ const media_text_edit = (MediaTextEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const save_DEFAULT_MEDIA_WIDTH = 50;
const save_noop = () => {};
function media_text_save_save({
attributes
}) {
const {
isStackedOnMobile,
mediaAlt,
mediaPosition,
mediaType,
mediaUrl,
mediaWidth,
mediaId,
verticalAlignment,
imageFill,
focalPoint,
linkClass,
href,
linkTarget,
rel
} = attributes;
const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
const newRel = !rel ? undefined : rel;
const imageClasses = classnames_default()({
[`wp-image-${mediaId}`]: mediaId && mediaType === 'image',
[`size-${mediaSizeSlug}`]: mediaId && mediaType === 'image'
});
let image = (0,external_React_namespaceObject.createElement)("img", {
src: mediaUrl,
alt: mediaAlt,
className: imageClasses || null
});
if (href) {
image = (0,external_React_namespaceObject.createElement)("a", {
className: linkClass,
href: href,
target: linkTarget,
rel: newRel
}, image);
}
const mediaTypeRenders = {
image: () => image,
video: () => (0,external_React_namespaceObject.createElement)("video", {
controls: true,
src: mediaUrl
})
};
const className = classnames_default()({
'has-media-on-the-right': 'right' === mediaPosition,
'is-stacked-on-mobile': isStackedOnMobile,
[`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment,
'is-image-fill': imageFill
});
const backgroundStyles = imageFill ? imageFillStyles(mediaUrl, focalPoint) : {};
let gridTemplateColumns;
if (mediaWidth !== save_DEFAULT_MEDIA_WIDTH) {
gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`;
}
const style = {
gridTemplateColumns
};
if ('right' === mediaPosition) {
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
style
})
}, (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-media-text__content'
})
}), (0,external_React_namespaceObject.createElement)("figure", {
className: "wp-block-media-text__media",
style: backgroundStyles
}, (mediaTypeRenders[mediaType] || save_noop)()));
}
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
style
})
}, (0,external_React_namespaceObject.createElement)("figure", {
className: "wp-block-media-text__media",
style: backgroundStyles
}, (mediaTypeRenders[mediaType] || save_noop)()), (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save({
className: 'wp-block-media-text__content'
})
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/transforms.js
/**
* WordPress dependencies
*/
const media_text_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/image'],
transform: ({
alt,
url,
id,
anchor
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/media-text', {
mediaAlt: alt,
mediaId: id,
mediaUrl: url,
mediaType: 'image',
anchor
})
}, {
type: 'block',
blocks: ['core/video'],
transform: ({
src,
id,
anchor
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/media-text', {
mediaId: id,
mediaUrl: src,
mediaType: 'video',
anchor
})
}, {
type: 'block',
blocks: ['core/cover'],
transform: ({
align,
alt,
anchor,
backgroundType,
customGradient,
customOverlayColor,
gradient,
id,
overlayColor,
style,
textColor,
url
}, innerBlocks) => {
let additionalAttributes = {};
if (customGradient) {
additionalAttributes = {
style: {
color: {
gradient: customGradient
}
}
};
} else if (customOverlayColor) {
additionalAttributes = {
style: {
color: {
background: customOverlayColor
}
}
};
}
// Maintain custom text color block support value.
if (style?.color?.text) {
additionalAttributes.style = {
color: {
...additionalAttributes.style?.color,
text: style.color.text
}
};
}
return (0,external_wp_blocks_namespaceObject.createBlock)('core/media-text', {
align,
anchor,
backgroundColor: overlayColor,
gradient,
mediaAlt: alt,
mediaId: id,
mediaType: backgroundType,
mediaUrl: url,
textColor,
...additionalAttributes
}, innerBlocks);
}
}],
to: [{
type: 'block',
blocks: ['core/image'],
isMatch: ({
mediaType,
mediaUrl
}) => {
return !mediaUrl || mediaType === 'image';
},
transform: ({
mediaAlt,
mediaId,
mediaUrl,
anchor
}) => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/image', {
alt: mediaAlt,
id: mediaId,
url: mediaUrl,
anchor
});
}
}, {
type: 'block',
blocks: ['core/video'],
isMatch: ({
mediaType,
mediaUrl
}) => {
return !mediaUrl || mediaType === 'video';
},
transform: ({
mediaId,
mediaUrl,
anchor
}) => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/video', {
id: mediaId,
src: mediaUrl,
anchor
});
}
}, {
type: 'block',
blocks: ['core/cover'],
transform: ({
align,
anchor,
backgroundColor,
focalPoint,
gradient,
mediaAlt,
mediaId,
mediaType,
mediaUrl,
style,
textColor
}, innerBlocks) => {
const additionalAttributes = {};
// Migrate the background styles or gradient to Cover's custom
// gradient and overlay properties.
if (style?.color?.gradient) {
additionalAttributes.customGradient = style.color.gradient;
} else if (style?.color?.background) {
additionalAttributes.customOverlayColor = style.color.background;
}
// Maintain custom text color support style.
if (style?.color?.text) {
additionalAttributes.style = {
color: {
text: style.color.text
}
};
}
const coverAttributes = {
align,
alt: mediaAlt,
anchor,
backgroundType: mediaType,
dimRatio: !!mediaUrl ? 50 : 100,
focalPoint,
gradient,
id: mediaId,
overlayColor: backgroundColor,
textColor,
url: mediaUrl,
...additionalAttributes
};
return (0,external_wp_blocks_namespaceObject.createBlock)('core/cover', coverAttributes, innerBlocks);
}
}]
};
/* harmony default export */ const media_text_transforms = (media_text_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const media_text_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/media-text",
title: "Media & Text",
category: "media",
description: "Set media and words side-by-side for a richer layout.",
keywords: ["image", "video"],
textdomain: "default",
attributes: {
align: {
type: "string",
"default": "none"
},
mediaAlt: {
type: "string",
source: "attribute",
selector: "figure img",
attribute: "alt",
"default": "",
__experimentalRole: "content"
},
mediaPosition: {
type: "string",
"default": "left"
},
mediaId: {
type: "number",
__experimentalRole: "content"
},
mediaUrl: {
type: "string",
source: "attribute",
selector: "figure video,figure img",
attribute: "src",
__experimentalRole: "content"
},
mediaLink: {
type: "string"
},
linkDestination: {
type: "string"
},
linkTarget: {
type: "string",
source: "attribute",
selector: "figure a",
attribute: "target"
},
href: {
type: "string",
source: "attribute",
selector: "figure a",
attribute: "href",
__experimentalRole: "content"
},
rel: {
type: "string",
source: "attribute",
selector: "figure a",
attribute: "rel"
},
linkClass: {
type: "string",
source: "attribute",
selector: "figure a",
attribute: "class"
},
mediaType: {
type: "string",
__experimentalRole: "content"
},
mediaWidth: {
type: "number",
"default": 50
},
mediaSizeSlug: {
type: "string"
},
isStackedOnMobile: {
type: "boolean",
"default": true
},
verticalAlignment: {
type: "string"
},
imageFill: {
type: "boolean"
},
focalPoint: {
type: "object"
},
allowedBlocks: {
type: "array"
}
},
supports: {
anchor: true,
align: ["wide", "full"],
html: false,
color: {
gradients: true,
heading: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-media-text-editor",
style: "wp-block-media-text"
};
const {
name: media_text_name
} = media_text_metadata;
const media_text_settings = {
icon: media_and_text,
example: {
viewportWidth: 601,
// Columns collapse "@media (max-width: 600px)".
attributes: {
mediaType: 'image',
mediaUrl: 'https://s.w.org/images/core/5.3/Biologia_Centrali-Americana_-_Cantorchilus_semibadius_1902.jpg'
},
innerBlocks: [{
name: 'core/paragraph',
attributes: {
content: (0,external_wp_i18n_namespaceObject.__)('The wren<br>Earns his living<br>Noiselessly.')
}
}, {
name: 'core/paragraph',
attributes: {
content: (0,external_wp_i18n_namespaceObject.__)('— Kobayashi Issa (一茶)')
}
}]
},
transforms: media_text_transforms,
edit: media_text_edit,
save: media_text_save_save,
deprecated: media_text_deprecated
};
const media_text_init = () => initBlock({
name: media_text_name,
metadata: media_text_metadata,
settings: media_text_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/missing/edit.js
/**
* WordPress dependencies
*/
function MissingBlockWarning({
attributes,
convertToHTML,
clientId
}) {
const {
originalName,
originalUndelimitedContent
} = attributes;
const hasContent = !!originalUndelimitedContent;
const {
hasFreeformBlock,
hasHTMLBlock
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canInsertBlockType,
getBlockRootClientId
} = select(external_wp_blockEditor_namespaceObject.store);
return {
hasFreeformBlock: canInsertBlockType('core/freeform', getBlockRootClientId(clientId)),
hasHTMLBlock: canInsertBlockType('core/html', getBlockRootClientId(clientId))
};
}, [clientId]);
const actions = [];
let messageHTML;
const convertToHtmlButton = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
key: "convert",
onClick: convertToHTML,
variant: "primary"
}, (0,external_wp_i18n_namespaceObject.__)('Keep as HTML'));
if (hasContent && !hasFreeformBlock && !originalName) {
if (hasHTMLBlock) {
messageHTML = (0,external_wp_i18n_namespaceObject.__)('It appears you are trying to use the deprecated Classic block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely. Alternatively, you can refresh the page to use the Classic block.');
actions.push(convertToHtmlButton);
} else {
messageHTML = (0,external_wp_i18n_namespaceObject.__)('It appears you are trying to use the deprecated Classic block. You can leave this block intact, or remove it entirely. Alternatively, you can refresh the page to use the Classic block.');
}
} else if (hasContent && hasHTMLBlock) {
messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */
(0,external_wp_i18n_namespaceObject.__)('Your site doesn’t include support for the "%s" block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely.'), originalName);
actions.push(convertToHtmlButton);
} else {
messageHTML = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */
(0,external_wp_i18n_namespaceObject.__)('Your site doesn’t include support for the "%s" block. You can leave this block intact or remove it entirely.'), originalName);
}
return (0,external_React_namespaceObject.createElement)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: 'has-warning'
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
actions: actions
}, messageHTML), (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, (0,external_wp_dom_namespaceObject.safeHTML)(originalUndelimitedContent)));
}
const MissingEdit = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, {
clientId,
attributes
}) => {
const {
replaceBlock
} = dispatch(external_wp_blockEditor_namespaceObject.store);
return {
convertToHTML() {
replaceBlock(clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/html', {
content: attributes.originalUndelimitedContent
}));
}
};
})(MissingBlockWarning);
/* harmony default export */ const missing_edit = (MissingEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/missing/save.js
/**
* WordPress dependencies
*/
function missing_save_save({
attributes
}) {
// Preserve the missing block's content.
return (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, attributes.originalContent);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/missing/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const missing_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/missing",
title: "Unsupported",
category: "text",
description: "Your site doesn\u2019t include support for this block.",
textdomain: "default",
attributes: {
originalName: {
type: "string"
},
originalUndelimitedContent: {
type: "string"
},
originalContent: {
type: "string",
source: "raw"
}
},
supports: {
className: false,
customClassName: false,
inserter: false,
html: false,
reusable: false,
interactivity: {
clientNavigation: true
}
}
};
const {
name: missing_name
} = missing_metadata;
const missing_settings = {
name: missing_name,
__experimentalLabel(attributes, {
context
}) {
if (context === 'accessibility') {
const {
originalName
} = attributes;
const originalBlockType = originalName ? (0,external_wp_blocks_namespaceObject.getBlockType)(originalName) : undefined;
if (originalBlockType) {
return originalBlockType.settings.title || originalName;
}
return '';
}
},
edit: missing_edit,
save: missing_save_save
};
const missing_init = () => initBlock({
name: missing_name,
metadata: missing_metadata,
settings: missing_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more.js
/**
* WordPress dependencies
*/
const more = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 9v1.5h16V9H4zm12 5.5h4V13h-4v1.5zm-6 0h4V13h-4v1.5zm-6 0h4V13H4v1.5z"
}));
/* harmony default export */ const library_more = (more);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/more/edit.js
/**
* WordPress dependencies
*/
const DEFAULT_TEXT = (0,external_wp_i18n_namespaceObject.__)('Read more');
function MoreEdit({
attributes: {
customText,
noTeaser
},
insertBlocksAfter,
setAttributes
}) {
const onChangeInput = event => {
setAttributes({
customText: event.target.value !== '' ? event.target.value : undefined
});
};
const onKeyDown = ({
keyCode
}) => {
if (keyCode === external_wp_keycodes_namespaceObject.ENTER) {
insertBlocksAfter([(0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)())]);
}
};
const getHideExcerptHelp = checked => checked ? (0,external_wp_i18n_namespaceObject.__)('The excerpt is hidden.') : (0,external_wp_i18n_namespaceObject.__)('The excerpt is visible.');
const toggleHideExcerpt = () => setAttributes({
noTeaser: !noTeaser
});
const style = {
width: `${(customText ? customText : DEFAULT_TEXT).length + 1.2}em`
};
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Hide the excerpt on the full content page'),
checked: !!noTeaser,
onChange: toggleHideExcerpt,
help: getHideExcerptHelp
}))), (0,external_React_namespaceObject.createElement)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)()
}, (0,external_React_namespaceObject.createElement)("input", {
"aria-label": (0,external_wp_i18n_namespaceObject.__)('“Read more” link text'),
type: "text",
value: customText,
placeholder: DEFAULT_TEXT,
onChange: onChangeInput,
onKeyDown: onKeyDown,
style: style
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/more/save.js
/**
* WordPress dependencies
*/
function more_save_save({
attributes: {
customText,
noTeaser
}
}) {
const moreTag = customText ? `<!--more ${customText}-->` : '<!--more-->';
const noTeaserTag = noTeaser ? '<!--noteaser-->' : '';
return (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, [moreTag, noTeaserTag].filter(Boolean).join('\n'));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/more/transforms.js
/**
* WordPress dependencies
*/
const more_transforms_transforms = {
from: [{
type: 'raw',
schema: {
'wp-block': {
attributes: ['data-block']
}
},
isMatch: node => node.dataset && node.dataset.block === 'core/more',
transform(node) {
const {
customText,
noTeaser
} = node.dataset;
const attrs = {};
// Don't copy unless defined and not an empty string.
if (customText) {
attrs.customText = customText;
}
// Special handling for boolean.
if (noTeaser === '') {
attrs.noTeaser = true;
}
return (0,external_wp_blocks_namespaceObject.createBlock)('core/more', attrs);
}
}]
};
/* harmony default export */ const more_transforms = (more_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/more/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const more_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/more",
title: "More",
category: "design",
description: "Content before this block will be shown in the excerpt on your archives page.",
keywords: ["read more"],
textdomain: "default",
attributes: {
customText: {
type: "string"
},
noTeaser: {
type: "boolean",
"default": false
}
},
supports: {
customClassName: false,
className: false,
html: false,
multiple: false,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-more-editor"
};
const {
name: more_name
} = more_metadata;
const more_settings = {
icon: library_more,
example: {},
__experimentalLabel(attributes, {
context
}) {
const customName = attributes?.metadata?.name;
if (context === 'list-view' && customName) {
return customName;
}
if (context === 'accessibility') {
return attributes.customText;
}
},
transforms: more_transforms,
edit: MoreEdit,
save: more_save_save
};
const more_init = () => initBlock({
name: more_name,
metadata: more_metadata,
settings: more_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/navigation.js
/**
* WordPress dependencies
*/
const navigation = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z"
}));
/* harmony default export */ const library_navigation = (navigation);
;// CONCATENATED MODULE: external ["wp","a11y"]
const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
;// 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
* @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element.
*
* @return {JSX.Element} Icon component
*/
function Icon({
icon,
size = 24,
...props
}, ref) {
return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
width: size,
height: size,
...props,
ref
});
}
/* harmony default export */ const build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon));
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
/**
* WordPress dependencies
*/
const close_close = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_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 */ const library_close = (close_close);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/constants.js
const constants_DEFAULT_BLOCK = {
name: 'core/navigation-link'
};
const PRIORITIZED_INSERTER_BLOCKS = ['core/navigation-link/page', 'core/navigation-link'];
// These parameters must be kept aligned with those in
// lib/compat/wordpress-6.3/navigation-block-preloading.php
// and
// edit-site/src/components/sidebar-navigation-screen-navigation-menus/constants.js
const PRELOADED_NAVIGATION_MENUS_QUERY = {
per_page: 100,
status: ['publish', 'draft'],
order: 'desc',
orderby: 'date'
};
const SELECT_NAVIGATION_MENUS_ARGS = ['postType', 'wp_navigation', PRELOADED_NAVIGATION_MENUS_QUERY];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/use-navigation-menu.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useNavigationMenu(ref) {
const permissions = (0,external_wp_coreData_namespaceObject.useResourcePermissions)('navigation', ref);
const {
navigationMenu,
isNavigationMenuResolved,
isNavigationMenuMissing
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
return selectExistingMenu(select, ref);
}, [ref]);
const {
canCreate,
canUpdate,
canDelete,
isResolving,
hasResolved
} = permissions;
const {
records: navigationMenus,
isResolving: isResolvingNavigationMenus,
hasResolved: hasResolvedNavigationMenus
} = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', `wp_navigation`, PRELOADED_NAVIGATION_MENUS_QUERY);
const canSwitchNavigationMenu = ref ? navigationMenus?.length > 1 : navigationMenus?.length > 0;
return {
navigationMenu,
isNavigationMenuResolved,
isNavigationMenuMissing,
navigationMenus,
isResolvingNavigationMenus,
hasResolvedNavigationMenus,
canSwitchNavigationMenu,
canUserCreateNavigationMenu: canCreate,
isResolvingCanUserCreateNavigationMenu: isResolving,
hasResolvedCanUserCreateNavigationMenu: hasResolved,
canUserUpdateNavigationMenu: canUpdate,
hasResolvedCanUserUpdateNavigationMenu: ref ? hasResolved : undefined,
canUserDeleteNavigationMenu: canDelete,
hasResolvedCanUserDeleteNavigationMenu: ref ? hasResolved : undefined
};
}
function selectExistingMenu(select, ref) {
if (!ref) {
return {
isNavigationMenuResolved: false,
isNavigationMenuMissing: true
};
}
const {
getEntityRecord,
getEditedEntityRecord,
hasFinishedResolution
} = select(external_wp_coreData_namespaceObject.store);
const args = ['postType', 'wp_navigation', ref];
const navigationMenu = getEntityRecord(...args);
const editedNavigationMenu = getEditedEntityRecord(...args);
const hasResolvedNavigationMenu = hasFinishedResolution('getEditedEntityRecord', args);
// Only published Navigation posts are considered valid.
// Draft Navigation posts are valid only on the editor,
// requiring a post update to publish to show in frontend.
// To achieve that, index.php must reflect this validation only for published.
const isNavigationMenuPublishedOrDraft = editedNavigationMenu.status === 'publish' || editedNavigationMenu.status === 'draft';
return {
isNavigationMenuResolved: hasResolvedNavigationMenu,
isNavigationMenuMissing: hasResolvedNavigationMenu && (!navigationMenu || !isNavigationMenuPublishedOrDraft),
// getEditedEntityRecord will return the post regardless of status.
// Therefore if the found post is not published then we should ignore it.
navigationMenu: isNavigationMenuPublishedOrDraft ? editedNavigationMenu : null
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/use-navigation-entities.js
/**
* WordPress dependencies
*/
/**
* @typedef {Object} NavigationEntitiesData
* @property {Array|undefined} pages - a collection of WP Post entity objects of post type "Page".
* @property {boolean} isResolvingPages - indicates whether the request to fetch pages is currently resolving.
* @property {boolean} hasResolvedPages - indicates whether the request to fetch pages has finished resolving.
* @property {Array|undefined} menus - a collection of Menu entity objects.
* @property {boolean} isResolvingMenus - indicates whether the request to fetch menus is currently resolving.
* @property {boolean} hasResolvedMenus - indicates whether the request to fetch menus has finished resolving.
* @property {Array|undefined} menusItems - a collection of Menu Item entity objects for the current menuId.
* @property {boolean} hasResolvedMenuItems - indicates whether the request to fetch menuItems has finished resolving.
* @property {boolean} hasPages - indicates whether there is currently any data for pages.
* @property {boolean} hasMenus - indicates whether there is currently any data for menus.
*/
/**
* Manages fetching and resolution state for all entities required
* for the Navigation block.
*
* @param {number} menuId the menu for which to retrieve menuItem data.
* @return { NavigationEntitiesData } the entity data.
*/
function useNavigationEntities(menuId) {
const {
records: menus,
isResolving: isResolvingMenus,
hasResolved: hasResolvedMenus
} = (0,external_wp_coreData_namespaceObject.useEntityRecords)('root', 'menu', {
per_page: -1,
context: 'view'
});
const {
records: pages,
isResolving: isResolvingPages,
hasResolved: hasResolvedPages
} = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', 'page', {
parent: 0,
order: 'asc',
orderby: 'id',
per_page: -1,
context: 'view'
});
const {
records: menuItems,
hasResolved: hasResolvedMenuItems
} = (0,external_wp_coreData_namespaceObject.useEntityRecords)('root', 'menuItem', {
menus: menuId,
per_page: -1,
context: 'view'
}, {
enabled: !!menuId
});
return {
pages,
isResolvingPages,
hasResolvedPages,
hasPages: !!(hasResolvedPages && pages?.length),
menus,
isResolvingMenus,
hasResolvedMenus,
hasMenus: !!(hasResolvedMenus && menus?.length),
menuItems,
hasResolvedMenuItems
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/placeholder/placeholder-preview.js
/**
* WordPress dependencies
*/
const PlaceholderPreview = ({
isVisible = true
}) => {
return (0,external_React_namespaceObject.createElement)("div", {
"aria-hidden": !isVisible ? true : undefined,
className: "wp-block-navigation-placeholder__preview"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-navigation-placeholder__actions__indicator"
}, (0,external_React_namespaceObject.createElement)(build_module_icon, {
icon: library_navigation
}), (0,external_wp_i18n_namespaceObject.__)('Navigation')));
};
/* harmony default export */ const placeholder_preview = (PlaceholderPreview);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
/**
* WordPress dependencies
*/
const moreVertical = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
}));
/* harmony default export */ const more_vertical = (moreVertical);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/navigation-menu-selector.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function buildMenuLabel(title, id, status) {
if (!title) {
/* translators: %s is the index of the menu in the list of menus. */
return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('(no title %s)'), id);
}
if (status === 'publish') {
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title);
}
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).
(0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), status);
}
function NavigationMenuSelector({
currentMenuId,
onSelectNavigationMenu,
onSelectClassicMenu,
onCreateNew,
actionLabel,
createNavigationMenuIsSuccess,
createNavigationMenuIsError
}) {
/* translators: %s: The name of a menu. */
const createActionLabel = (0,external_wp_i18n_namespaceObject.__)("Create from '%s'");
const [isUpdatingMenuRef, setIsUpdatingMenuRef] = (0,external_wp_element_namespaceObject.useState)(false);
actionLabel = actionLabel || createActionLabel;
const {
menus: classicMenus
} = useNavigationEntities();
const {
navigationMenus,
isResolvingNavigationMenus,
hasResolvedNavigationMenus,
canUserCreateNavigationMenu,
canSwitchNavigationMenu
} = useNavigationMenu();
const [currentTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', 'wp_navigation', 'title');
const menuChoices = (0,external_wp_element_namespaceObject.useMemo)(() => {
return navigationMenus?.map(({
id,
title,
status
}, index) => {
const label = buildMenuLabel(title?.rendered, index + 1, status);
return {
value: id,
label,
ariaLabel: (0,external_wp_i18n_namespaceObject.sprintf)(actionLabel, label),
disabled: isUpdatingMenuRef || isResolvingNavigationMenus || !hasResolvedNavigationMenus
};
}) || [];
}, [navigationMenus, actionLabel, isResolvingNavigationMenus, hasResolvedNavigationMenus, isUpdatingMenuRef]);
const hasNavigationMenus = !!navigationMenus?.length;
const hasClassicMenus = !!classicMenus?.length;
const showNavigationMenus = !!canSwitchNavigationMenu;
const showClassicMenus = !!canUserCreateNavigationMenu;
const noMenuSelected = hasNavigationMenus && !currentMenuId;
const noBlockMenus = !hasNavigationMenus && hasResolvedNavigationMenus;
const menuUnavailable = hasResolvedNavigationMenus && currentMenuId === null;
let selectorLabel = '';
if (isResolvingNavigationMenus) {
selectorLabel = (0,external_wp_i18n_namespaceObject.__)('Loading…');
} else if (noMenuSelected || noBlockMenus || menuUnavailable) {
// Note: classic Menus may be available.
selectorLabel = (0,external_wp_i18n_namespaceObject.__)('Choose or create a Navigation menu');
} else {
// Current Menu's title.
selectorLabel = currentTitle;
}
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (isUpdatingMenuRef && (createNavigationMenuIsSuccess || createNavigationMenuIsError)) {
setIsUpdatingMenuRef(false);
}
}, [hasResolvedNavigationMenus, createNavigationMenuIsSuccess, canUserCreateNavigationMenu, createNavigationMenuIsError, isUpdatingMenuRef, menuUnavailable, noBlockMenus, noMenuSelected]);
const NavigationMenuSelectorDropdown = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
label: selectorLabel,
icon: more_vertical,
toggleProps: {
isSmall: true
}
}, ({
onClose
}) => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, showNavigationMenus && hasNavigationMenus && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Menus')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
value: currentMenuId,
onSelect: menuId => {
onSelectNavigationMenu(menuId);
onClose();
},
choices: menuChoices
})), showClassicMenus && hasClassicMenus && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Import Classic Menus')
}, classicMenus?.map(menu => {
const label = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(menu.name);
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: async () => {
setIsUpdatingMenuRef(true);
await onSelectClassicMenu(menu);
setIsUpdatingMenuRef(false);
onClose();
},
key: menu.id,
"aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(createActionLabel, label),
disabled: isUpdatingMenuRef || isResolvingNavigationMenus || !hasResolvedNavigationMenus
}, label);
})), canUserCreateNavigationMenu && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Tools')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: async () => {
setIsUpdatingMenuRef(true);
await onCreateNew();
setIsUpdatingMenuRef(false);
onClose();
},
disabled: isUpdatingMenuRef || isResolvingNavigationMenus || !hasResolvedNavigationMenus
}, (0,external_wp_i18n_namespaceObject.__)('Create new menu')))));
return NavigationMenuSelectorDropdown;
}
/* harmony default export */ const navigation_menu_selector = (NavigationMenuSelector);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/placeholder/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NavigationPlaceholder({
isSelected,
currentMenuId,
clientId,
canUserCreateNavigationMenu = false,
isResolvingCanUserCreateNavigationMenu,
onSelectNavigationMenu,
onSelectClassicMenu,
onCreateEmpty
}) {
const {
isResolvingMenus,
hasResolvedMenus
} = useNavigationEntities();
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isSelected) {
return;
}
if (isResolvingMenus) {
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Loading navigation block setup options…'));
}
if (hasResolvedMenus) {
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Navigation block setup options ready.'));
}
}, [hasResolvedMenus, isResolvingMenus, isSelected]);
const isResolvingActions = isResolvingMenus && isResolvingCanUserCreateNavigationMenu;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
className: "wp-block-navigation-placeholder"
}, (0,external_React_namespaceObject.createElement)(placeholder_preview, {
isVisible: !isSelected
}), (0,external_React_namespaceObject.createElement)("div", {
"aria-hidden": !isSelected ? true : undefined,
className: "wp-block-navigation-placeholder__controls"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-navigation-placeholder__actions"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-navigation-placeholder__actions__indicator"
}, (0,external_React_namespaceObject.createElement)(build_module_icon, {
icon: library_navigation
}), " ", (0,external_wp_i18n_namespaceObject.__)('Navigation')), (0,external_React_namespaceObject.createElement)("hr", null), isResolvingActions && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_React_namespaceObject.createElement)(navigation_menu_selector, {
currentMenuId: currentMenuId,
clientId: clientId,
onSelectNavigationMenu: onSelectNavigationMenu,
onSelectClassicMenu: onSelectClassicMenu
}), (0,external_React_namespaceObject.createElement)("hr", null), canUserCreateNavigationMenu && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: onCreateEmpty
}, (0,external_wp_i18n_namespaceObject.__)('Start empty'))))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/menu.js
/**
* WordPress dependencies
*/
const menu = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M5 5v1.5h14V5H5zm0 7.8h14v-1.5H5v1.5zM5 19h14v-1.5H5V19z"
}));
/* harmony default export */ const library_menu = (menu);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/overlay-menu-icon.js
/**
* WordPress dependencies
*/
function OverlayMenuIcon({
icon
}) {
if (icon === 'menu') {
return (0,external_React_namespaceObject.createElement)(build_module_icon, {
icon: library_menu
});
}
return (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
width: "24",
height: "24",
"aria-hidden": "true",
focusable: "false"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Rect, {
x: "4",
y: "7.5",
width: "16",
height: "1.5"
}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Rect, {
x: "4",
y: "15",
width: "16",
height: "1.5"
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/responsive-wrapper.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ResponsiveWrapper({
children,
id,
isOpen,
isResponsive,
onToggle,
isHiddenByDefault,
overlayBackgroundColor,
overlayTextColor,
hasIcon,
icon
}) {
if (!isResponsive) {
return children;
}
const responsiveContainerClasses = classnames_default()('wp-block-navigation__responsive-container', {
'has-text-color': !!overlayTextColor.color || !!overlayTextColor?.class,
[(0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', overlayTextColor?.slug)]: !!overlayTextColor?.slug,
'has-background': !!overlayBackgroundColor.color || overlayBackgroundColor?.class,
[(0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', overlayBackgroundColor?.slug)]: !!overlayBackgroundColor?.slug,
'is-menu-open': isOpen,
'hidden-by-default': isHiddenByDefault
});
const styles = {
color: !overlayTextColor?.slug && overlayTextColor?.color,
backgroundColor: !overlayBackgroundColor?.slug && overlayBackgroundColor?.color && overlayBackgroundColor.color
};
const openButtonClasses = classnames_default()('wp-block-navigation__responsive-container-open', {
'always-shown': isHiddenByDefault
});
const modalId = `${id}-modal`;
const dialogProps = {
className: 'wp-block-navigation__responsive-dialog',
...(isOpen && {
role: 'dialog',
'aria-modal': true,
'aria-label': (0,external_wp_i18n_namespaceObject.__)('Menu')
})
};
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !isOpen && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
"aria-haspopup": "true",
"aria-label": hasIcon && (0,external_wp_i18n_namespaceObject.__)('Open menu'),
className: openButtonClasses,
onClick: () => onToggle(true)
}, hasIcon && (0,external_React_namespaceObject.createElement)(OverlayMenuIcon, {
icon: icon
}), !hasIcon && (0,external_wp_i18n_namespaceObject.__)('Menu')), (0,external_React_namespaceObject.createElement)("div", {
className: responsiveContainerClasses,
style: styles,
id: modalId
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-navigation__responsive-close",
tabIndex: "-1"
}, (0,external_React_namespaceObject.createElement)("div", {
...dialogProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
className: "wp-block-navigation__responsive-container-close",
"aria-label": hasIcon && (0,external_wp_i18n_namespaceObject.__)('Close menu'),
onClick: () => onToggle(false)
}, hasIcon && (0,external_React_namespaceObject.createElement)(build_module_icon, {
icon: library_close
}), !hasIcon && (0,external_wp_i18n_namespaceObject.__)('Close')), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-navigation__responsive-container-content",
id: `${modalId}-content`
}, children)))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/inner-blocks.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NavigationInnerBlocks({
clientId,
hasCustomPlaceholder,
orientation,
templateLock
}) {
const {
isImmediateParentOfSelectedBlock,
selectedBlockHasChildren,
isSelected
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockCount,
hasSelectedInnerBlock,
getSelectedBlockClientId
} = select(external_wp_blockEditor_namespaceObject.store);
const selectedBlockId = getSelectedBlockClientId();
return {
isImmediateParentOfSelectedBlock: hasSelectedInnerBlock(clientId, false),
selectedBlockHasChildren: !!getBlockCount(selectedBlockId),
// This prop is already available but computing it here ensures it's
// fresh compared to isImmediateParentOfSelectedBlock.
isSelected: selectedBlockId === clientId
};
}, [clientId]);
const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', 'wp_navigation');
// When the block is selected itself or has a top level item selected that
// doesn't itself have children, show the standard appender. Else show no
// appender.
const parentOrChildHasSelection = isSelected || isImmediateParentOfSelectedBlock && !selectedBlockHasChildren;
const placeholder = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_React_namespaceObject.createElement)(placeholder_preview, null), []);
const hasMenuItems = !!blocks?.length;
// If there is a `ref` attribute pointing to a `wp_navigation` but
// that menu has no **items** (i.e. empty) then show a placeholder.
// The block must also be selected else the placeholder will display
// alongside the appender.
const showPlaceholder = !hasCustomPlaceholder && !hasMenuItems && !isSelected;
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({
className: 'wp-block-navigation__container'
}, {
value: blocks,
onInput,
onChange,
prioritizedInserterBlocks: PRIORITIZED_INSERTER_BLOCKS,
defaultBlock: constants_DEFAULT_BLOCK,
directInsert: true,
orientation,
templateLock,
// As an exception to other blocks which feature nesting, show
// the block appender even when a child block is selected.
// This should be a temporary fix, to be replaced by improvements to
// the sibling inserter.
// See https://github.com/WordPress/gutenberg/issues/37572.
renderAppender: isSelected || isImmediateParentOfSelectedBlock && !selectedBlockHasChildren ||
// Show the appender while dragging to allow inserting element between item and the appender.
parentOrChildHasSelection ? external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender : false,
placeholder: showPlaceholder ? placeholder : undefined,
__experimentalCaptureToolbars: true,
__unstableDisableLayoutClassNames: true
});
return (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/navigation-menu-name-control.js
/**
* WordPress dependencies
*/
function NavigationMenuNameControl() {
const [title, updateTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', 'wp_navigation', 'title');
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Menu name'),
value: title,
onChange: updateTitle
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/are-blocks-dirty.js
function areBlocksDirty(originalBlocks, blocks) {
return !isDeepEqual(originalBlocks, blocks, (prop, x) => {
// Skip inner blocks of page list during comparison as they
// are **always** controlled and may be updated async due to
// syncing with entity records. Left unchecked this would
// inadvertently trigger the dirty state.
if (x?.name === 'core/page-list' && prop === 'innerBlocks') {
return true;
}
});
}
/**
* Conditionally compares two candidates for deep equality.
* Provides an option to skip a given property of an object during comparison.
*
* @param {*} x 1st candidate for comparison
* @param {*} y 2nd candidate for comparison
* @param {Function|undefined} shouldSkip a function which can be used to skip a given property of an object.
* @return {boolean} whether the two candidates are deeply equal.
*/
const isDeepEqual = (x, y, shouldSkip) => {
if (x === y) {
return true;
} else if (typeof x === 'object' && x !== null && x !== undefined && typeof y === 'object' && y !== null && y !== undefined) {
if (Object.keys(x).length !== Object.keys(y).length) return false;
for (const prop in x) {
if (y.hasOwnProperty(prop)) {
// Afford skipping a given property of an object.
if (shouldSkip && shouldSkip(prop, x)) {
return true;
}
if (!isDeepEqual(x[prop], y[prop], shouldSkip)) return false;
} else return false;
}
return true;
}
return false;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/unsaved-inner-blocks.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const EMPTY_OBJECT = {};
function UnsavedInnerBlocks({
blocks,
createNavigationMenu,
hasSelection
}) {
const originalBlocks = (0,external_wp_element_namespaceObject.useRef)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Initially store the uncontrolled inner blocks for
// dirty state comparison.
if (!originalBlocks?.current) {
originalBlocks.current = blocks;
}
}, [blocks]);
// If the current inner blocks are different from the original inner blocks
// from the post content then the user has made changes to the inner blocks.
// At this point the inner blocks can be considered "dirty".
// Note: referential equality is not sufficient for comparison as the inner blocks
// of the page list are controlled and may be updated async due to syncing with
// entity records. As a result we need to perform a deep equality check skipping
// the page list's inner blocks.
const innerBlocksAreDirty = areBlocksDirty(originalBlocks?.current, blocks);
// The block will be disabled in a block preview, use this as a way of
// avoiding the side-effects of this component for block previews.
const isDisabled = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.Disabled.Context);
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({
className: 'wp-block-navigation__container'
}, {
renderAppender: hasSelection ? undefined : false,
defaultBlock: constants_DEFAULT_BLOCK,
directInsert: true
});
const {
isSaving,
hasResolvedAllNavigationMenus
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (isDisabled) {
return EMPTY_OBJECT;
}
const {
hasFinishedResolution,
isSavingEntityRecord
} = select(external_wp_coreData_namespaceObject.store);
return {
isSaving: isSavingEntityRecord('postType', 'wp_navigation'),
hasResolvedAllNavigationMenus: hasFinishedResolution('getEntityRecords', SELECT_NAVIGATION_MENUS_ARGS)
};
}, [isDisabled]);
// Automatically save the uncontrolled blocks.
(0,external_wp_element_namespaceObject.useEffect)(() => {
// The block will be disabled when used in a BlockPreview.
// In this case avoid automatic creation of a wp_navigation post.
// Otherwise the user will be spammed with lots of menus!
//
// Also ensure other navigation menus have loaded so an
// accurate name can be created.
//
// Don't try saving when another save is already
// in progress.
//
// And finally only create the menu when the block is selected,
// which is an indication they want to start editing.
if (isDisabled || isSaving || !hasResolvedAllNavigationMenus || !hasSelection || !innerBlocksAreDirty) {
return;
}
createNavigationMenu(null, blocks);
}, [blocks, createNavigationMenu, isDisabled, isSaving, hasResolvedAllNavigationMenus, innerBlocksAreDirty, hasSelection]);
const Wrapper = isSaving ? external_wp_components_namespaceObject.Disabled : 'div';
return (0,external_React_namespaceObject.createElement)(Wrapper, {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/navigation-menu-delete-control.js
/**
* WordPress dependencies
*/
function NavigationMenuDeleteControl({
onDelete
}) {
const [isConfirmModalVisible, setIsConfirmModalVisible] = (0,external_wp_element_namespaceObject.useState)(false);
const id = (0,external_wp_coreData_namespaceObject.useEntityId)('postType', 'wp_navigation');
const [title] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', 'wp_navigation', 'title');
const {
deleteEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
className: "wp-block-navigation-delete-menu-button",
variant: "secondary",
isDestructive: true,
onClick: () => {
setIsConfirmModalVisible(true);
}
}, (0,external_wp_i18n_namespaceObject.__)('Delete menu')), isConfirmModalVisible && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the name of a menu to delete */
(0,external_wp_i18n_namespaceObject.__)('Delete %s'), title),
onRequestClose: () => setIsConfirmModalVisible(false)
}, (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete this navigation menu?')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "right"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: () => {
setIsConfirmModalVisible(false);
}
}, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: () => {
deleteEntityRecord('postType', 'wp_navigation', id, {
force: true
});
onDelete(title);
}
}, (0,external_wp_i18n_namespaceObject.__)('Confirm')))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/use-navigation-notice.js
/**
* WordPress dependencies
*/
function useNavigationNotice({
name,
message = ''
} = {}) {
const noticeRef = (0,external_wp_element_namespaceObject.useRef)();
const {
createWarningNotice,
removeNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const showNotice = (0,external_wp_element_namespaceObject.useCallback)(customMsg => {
if (noticeRef.current) {
return;
}
noticeRef.current = name;
createWarningNotice(customMsg || message, {
id: noticeRef.current,
type: 'snackbar'
});
}, [noticeRef, createWarningNotice, message, name]);
const hideNotice = (0,external_wp_element_namespaceObject.useCallback)(() => {
if (!noticeRef.current) {
return;
}
removeNotice(noticeRef.current);
noticeRef.current = null;
}, [noticeRef, removeNotice]);
return [showNotice, hideNotice];
}
/* harmony default export */ const use_navigation_notice = (useNavigationNotice);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/overlay-menu-preview.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function OverlayMenuPreview({
setAttributes,
hasIcon,
icon
}) {
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show icon button'),
help: (0,external_wp_i18n_namespaceObject.__)('Configure the visual appearance of the button that toggles the overlay menu.'),
onChange: value => setAttributes({
hasIcon: value
}),
checked: hasIcon
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Icon'),
value: icon,
onChange: value => setAttributes({
icon: value
}),
isBlock: true
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "handle",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('handle'),
label: (0,external_React_namespaceObject.createElement)(OverlayMenuIcon, {
icon: "handle"
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "menu",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('menu'),
label: (0,external_React_namespaceObject.createElement)(OverlayMenuIcon, {
icon: "menu"
})
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/menu-items-to-blocks.js
/**
* WordPress dependencies
*/
/**
* Convert a flat menu item structure to a nested blocks structure.
*
* @param {Object[]} menuItems An array of menu items.
*
* @return {WPBlock[]} An array of blocks.
*/
function menuItemsToBlocks(menuItems) {
if (!menuItems) {
return null;
}
const menuTree = createDataTree(menuItems);
const blocks = mapMenuItemsToBlocks(menuTree);
return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.navigation.__unstableMenuItemsToBlocks', blocks, menuItems);
}
/**
* A recursive function that maps menu item nodes to blocks.
*
* @param {WPNavMenuItem[]} menuItems An array of WPNavMenuItem items.
* @param {number} level An integer representing the nesting level.
* @return {Object} Object containing innerBlocks and mapping.
*/
function mapMenuItemsToBlocks(menuItems, level = 0) {
let mapping = {};
// The menuItem should be in menu_order sort order.
const sortedItems = [...menuItems].sort((a, b) => a.menu_order - b.menu_order);
const innerBlocks = sortedItems.map(menuItem => {
if (menuItem.type === 'block') {
const [block] = (0,external_wp_blocks_namespaceObject.parse)(menuItem.content.raw);
if (!block) {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/freeform', {
content: menuItem.content
});
}
return block;
}
const blockType = menuItem.children?.length ? 'core/navigation-submenu' : 'core/navigation-link';
const attributes = menuItemToBlockAttributes(menuItem, blockType, level);
// If there are children recurse to build those nested blocks.
const {
innerBlocks: nestedBlocks = [],
// alias to avoid shadowing
mapping: nestedMapping = {} // alias to avoid shadowing
} = menuItem.children?.length ? mapMenuItemsToBlocks(menuItem.children, level + 1) : {};
// Update parent mapping with nested mapping.
mapping = {
...mapping,
...nestedMapping
};
// Create block with nested "innerBlocks".
const block = (0,external_wp_blocks_namespaceObject.createBlock)(blockType, attributes, nestedBlocks);
// Create mapping for menuItem -> block.
mapping[menuItem.id] = block.clientId;
return block;
});
return {
innerBlocks,
mapping
};
}
/**
* A WP nav_menu_item object.
* For more documentation on the individual fields present on a menu item please see:
* https://core.trac.wordpress.org/browser/tags/5.7.1/src/wp-includes/nav-menu.php#L789
*
* @typedef WPNavMenuItem
*
* @property {Object} title stores the raw and rendered versions of the title/label for this menu item.
* @property {Array} xfn the XFN relationships expressed in the link of this menu item.
* @property {Array} classes the HTML class attributes for this menu item.
* @property {string} attr_title the HTML title attribute for this menu item.
* @property {string} object The type of object originally represented, such as 'category', 'post', or 'attachment'.
* @property {string} object_id The DB ID of the original object this menu item represents, e.g. ID for posts and term_id for categories.
* @property {string} description The description of this menu item.
* @property {string} url The URL to which this menu item points.
* @property {string} type The family of objects originally represented, such as 'post_type' or 'taxonomy'.
* @property {string} target The target attribute of the link element for this menu item.
*/
/**
* Convert block attributes to menu item.
*
* @param {WPNavMenuItem} menuItem the menu item to be converted to block attributes.
* @param {string} blockType The block type.
* @param {number} level An integer representing the nesting level.
* @return {Object} the block attributes converted from the WPNavMenuItem item.
*/
function menuItemToBlockAttributes({
title: menuItemTitleField,
xfn,
classes,
// eslint-disable-next-line camelcase
attr_title,
object,
// eslint-disable-next-line camelcase
object_id,
description,
url,
type: menuItemTypeField,
target
}, blockType, level) {
// For historical reasons, the `core/navigation-link` variation type is `tag`
// whereas WP Core expects `post_tag` as the `object` type.
// To avoid writing a block migration we perform a conversion here.
// See also inverse equivalent in `blockAttributesToMenuItem`.
if (object && object === 'post_tag') {
object = 'tag';
}
return {
label: menuItemTitleField?.rendered || '',
...(object?.length && {
type: object
}),
kind: menuItemTypeField?.replace('_', '-') || 'custom',
url: url || '',
...(xfn?.length && xfn.join(' ').trim() && {
rel: xfn.join(' ').trim()
}),
...(classes?.length && classes.join(' ').trim() && {
className: classes.join(' ').trim()
}),
/* eslint-disable camelcase */
...(attr_title?.length && {
title: attr_title
}),
...(object_id && 'custom' !== object && {
id: object_id
}),
/* eslint-enable camelcase */
...(description?.length && {
description
}),
...(target === '_blank' && {
opensInNewTab: true
}),
...(blockType === 'core/navigation-submenu' && {
isTopLevelItem: level === 0
}),
...(blockType === 'core/navigation-link' && {
isTopLevelLink: level === 0
})
};
}
/**
* Creates a nested, hierarchical tree representation from unstructured data that
* has an inherent relationship defined between individual items.
*
* For example, by default, each element in the dataset should have an `id` and
* `parent` property where the `parent` property indicates a relationship between
* the current item and another item with a matching `id` properties.
*
* This is useful for building linked lists of data from flat data structures.
*
* @param {Array} dataset linked data to be rearranged into a hierarchical tree based on relational fields.
* @param {string} id the property which uniquely identifies each entry within the array.
* @param {*} relation the property which identifies how the current item is related to other items in the data (if at all).
* @return {Array} a nested array of parent/child relationships
*/
function createDataTree(dataset, id = 'id', relation = 'parent') {
const hashTable = Object.create(null);
const dataTree = [];
for (const data of dataset) {
hashTable[data[id]] = {
...data,
children: []
};
if (data[relation]) {
hashTable[data[relation]] = hashTable[data[relation]] || {};
hashTable[data[relation]].children = hashTable[data[relation]].children || [];
hashTable[data[relation]].children.push(hashTable[data[id]]);
} else {
dataTree.push(hashTable[data[id]]);
}
}
return dataTree;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const CLASSIC_MENU_CONVERSION_SUCCESS = 'success';
const CLASSIC_MENU_CONVERSION_ERROR = 'error';
const CLASSIC_MENU_CONVERSION_PENDING = 'pending';
const CLASSIC_MENU_CONVERSION_IDLE = 'idle';
// This is needed to ensure that multiple components using this hook
// do not import the same classic menu twice.
let classicMenuBeingConvertedId = null;
function useConvertClassicToBlockMenu(createNavigationMenu, {
throwOnError = false
} = {}) {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
editEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const [status, setStatus] = (0,external_wp_element_namespaceObject.useState)(CLASSIC_MENU_CONVERSION_IDLE);
const [error, setError] = (0,external_wp_element_namespaceObject.useState)(null);
const convertClassicMenuToBlockMenu = (0,external_wp_element_namespaceObject.useCallback)(async (menuId, menuName, postStatus = 'publish') => {
let navigationMenu;
let classicMenuItems;
// 1. Fetch the classic Menu items.
try {
classicMenuItems = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getMenuItems({
menus: menuId,
per_page: -1,
context: 'view'
});
} catch (err) {
throw new Error((0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: the name of a menu (e.g. Header navigation).
(0,external_wp_i18n_namespaceObject.__)(`Unable to fetch classic menu "%s" from API.`), menuName), {
cause: err
});
}
// Handle offline response which resolves to `null`.
if (classicMenuItems === null) {
throw new Error((0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: the name of a menu (e.g. Header navigation).
(0,external_wp_i18n_namespaceObject.__)(`Unable to fetch classic menu "%s" from API.`), menuName));
}
// 2. Convert the classic items into blocks.
const {
innerBlocks
} = menuItemsToBlocks(classicMenuItems);
// 3. Create the `wp_navigation` Post with the blocks.
try {
navigationMenu = await createNavigationMenu(menuName, innerBlocks, postStatus);
/**
* Immediately trigger editEntityRecord to change the wp_navigation post status to 'publish'.
* This status change causes the menu to be displayed on the front of the site and sets the post state to be "dirty".
* The problem being solved is if saveEditedEntityRecord was used here, the menu would be updated on the frontend and the editor _automatically_,
* without user interaction.
* If the user abandons the site editor without saving, there would still be a wp_navigation post created as draft.
*/
await editEntityRecord('postType', 'wp_navigation', navigationMenu.id, {
status: 'publish'
}, {
throwOnError: true
});
} catch (err) {
throw new Error((0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: the name of a menu (e.g. Header navigation).
(0,external_wp_i18n_namespaceObject.__)(`Unable to create Navigation Menu "%s".`), menuName), {
cause: err
});
}
return navigationMenu;
}, [createNavigationMenu, editEntityRecord, registry]);
const convert = (0,external_wp_element_namespaceObject.useCallback)(async (menuId, menuName, postStatus) => {
// Check whether this classic menu is being imported already.
if (classicMenuBeingConvertedId === menuId) {
return;
}
// Set the ID for the currently importing classic menu.
classicMenuBeingConvertedId = menuId;
if (!menuId || !menuName) {
setError('Unable to convert menu. Missing menu details.');
setStatus(CLASSIC_MENU_CONVERSION_ERROR);
return;
}
setStatus(CLASSIC_MENU_CONVERSION_PENDING);
setError(null);
return await convertClassicMenuToBlockMenu(menuId, menuName, postStatus).then(navigationMenu => {
setStatus(CLASSIC_MENU_CONVERSION_SUCCESS);
// Reset the ID for the currently importing classic menu.
classicMenuBeingConvertedId = null;
return navigationMenu;
}).catch(err => {
setError(err?.message);
// Reset the ID for the currently importing classic menu.
setStatus(CLASSIC_MENU_CONVERSION_ERROR);
// Reset the ID for the currently importing classic menu.
classicMenuBeingConvertedId = null;
// Rethrow error for debugging.
if (throwOnError) {
throw new Error((0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: the name of a menu (e.g. Header navigation).
(0,external_wp_i18n_namespaceObject.__)(`Unable to create Navigation Menu "%s".`), menuName), {
cause: err
});
}
});
}, [convertClassicMenuToBlockMenu, throwOnError]);
return {
convert,
status,
error
};
}
/* harmony default export */ const use_convert_classic_menu_to_block_menu = (useConvertClassicToBlockMenu);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/edit/utils/create-template-part-id.js
/**
* Generates a template part Id based on slug and theme inputs.
*
* @param {string} theme the template part's theme.
* @param {string} slug the template part's slug
* @return {string|null} the template part's Id.
*/
function createTemplatePartId(theme, slug) {
return theme && slug ? theme + '//' + slug : null;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/use-template-part-area-label.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// TODO: this util should perhaps be refactored somewhere like core-data.
function useTemplatePartAreaLabel(clientId) {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
// Use the lack of a clientId as an opportunity to bypass the rest
// of this hook.
if (!clientId) {
return;
}
const {
getBlock,
getBlockParentsByBlockName
} = select(external_wp_blockEditor_namespaceObject.store);
const withAscendingResults = true;
const parentTemplatePartClientIds = getBlockParentsByBlockName(clientId, 'core/template-part', withAscendingResults);
if (!parentTemplatePartClientIds?.length) {
return;
}
// FIXME: @wordpress/block-library should not depend on @wordpress/editor.
// Blocks can be loaded into a *non-post* block editor.
// This code is lifted from this file:
// packages/block-library/src/template-part/edit/advanced-controls.js
/* eslint-disable @wordpress/data-no-store-string-literals */
const definedAreas = select('core/editor').__experimentalGetDefaultTemplatePartAreas();
/* eslint-enable @wordpress/data-no-store-string-literals */
const {
getCurrentTheme,
getEditedEntityRecord
} = select(external_wp_coreData_namespaceObject.store);
for (const templatePartClientId of parentTemplatePartClientIds) {
const templatePartBlock = getBlock(templatePartClientId);
// The 'area' usually isn't stored on the block, but instead
// on the entity.
const {
theme = getCurrentTheme()?.stylesheet,
slug
} = templatePartBlock.attributes;
const templatePartEntityId = createTemplatePartId(theme, slug);
const templatePartEntity = getEditedEntityRecord('postType', 'wp_template_part', templatePartEntityId);
// Look up the `label` for the area in the defined areas so
// that an internationalized label can be used.
if (templatePartEntity?.area) {
return definedAreas.find(definedArea => definedArea.area !== 'uncategorized' && definedArea.area === templatePartEntity.area)?.label;
}
}
}, [clientId]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/use-generate-default-navigation-title.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DRAFT_MENU_PARAMS = ['postType', 'wp_navigation', {
status: 'draft',
per_page: -1
}];
const PUBLISHED_MENU_PARAMS = ['postType', 'wp_navigation', {
per_page: -1,
status: 'publish'
}];
function useGenerateDefaultNavigationTitle(clientId) {
// The block will be disabled in a block preview, use this as a way of
// avoiding the side-effects of this component for block previews.
const isDisabled = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.Disabled.Context);
// Because we can't conditionally call hooks, pass an undefined client id
// arg to bypass the expensive `useTemplateArea` code. The hook will return
// early.
const area = useTemplatePartAreaLabel(isDisabled ? undefined : clientId);
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
return (0,external_wp_element_namespaceObject.useCallback)(async () => {
// Ensure other navigation menus have loaded so an
// accurate name can be created.
if (isDisabled) {
return '';
}
const {
getEntityRecords
} = registry.resolveSelect(external_wp_coreData_namespaceObject.store);
const [draftNavigationMenus, navigationMenus] = await Promise.all([getEntityRecords(...DRAFT_MENU_PARAMS), getEntityRecords(...PUBLISHED_MENU_PARAMS)]);
const title = area ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: the name of a menu (e.g. Header navigation).
(0,external_wp_i18n_namespaceObject.__)('%s navigation'), area) :
// translators: 'navigation' as in website navigation.
(0,external_wp_i18n_namespaceObject.__)('Navigation');
// Determine how many menus start with the automatic title.
const matchingMenuTitleCount = [...draftNavigationMenus, ...navigationMenus].reduce((count, menu) => menu?.title?.raw?.startsWith(title) ? count + 1 : count, 0);
// Append a number to the end of the title if a menu with
// the same name exists.
const titleWithCount = matchingMenuTitleCount > 0 ? `${title} ${matchingMenuTitleCount + 1}` : title;
return titleWithCount || '';
}, [isDisabled, area, registry]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/use-create-navigation-menu.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const CREATE_NAVIGATION_MENU_SUCCESS = 'success';
const CREATE_NAVIGATION_MENU_ERROR = 'error';
const CREATE_NAVIGATION_MENU_PENDING = 'pending';
const CREATE_NAVIGATION_MENU_IDLE = 'idle';
function useCreateNavigationMenu(clientId) {
const [status, setStatus] = (0,external_wp_element_namespaceObject.useState)(CREATE_NAVIGATION_MENU_IDLE);
const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(null);
const [error, setError] = (0,external_wp_element_namespaceObject.useState)(null);
const {
saveEntityRecord,
editEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const generateDefaultTitle = useGenerateDefaultNavigationTitle(clientId);
// This callback uses data from the two placeholder steps and only creates
// a new navigation menu when the user completes the final step.
const create = (0,external_wp_element_namespaceObject.useCallback)(async (title = null, blocks = [], postStatus) => {
// Guard against creating Navigations without a title.
// Note you can pass no title, but if one is passed it must be
// a string otherwise the title may end up being empty.
if (title && typeof title !== 'string') {
setError('Invalid title supplied when creating Navigation Menu.');
setStatus(CREATE_NAVIGATION_MENU_ERROR);
throw new Error(`Value of supplied title argument was not a string.`);
}
setStatus(CREATE_NAVIGATION_MENU_PENDING);
setValue(null);
setError(null);
if (!title) {
title = await generateDefaultTitle().catch(err => {
setError(err?.message);
setStatus(CREATE_NAVIGATION_MENU_ERROR);
throw new Error('Failed to create title when saving new Navigation Menu.', {
cause: err
});
});
}
const record = {
title,
content: (0,external_wp_blocks_namespaceObject.serialize)(blocks),
status: postStatus
};
// Return affords ability to await on this function directly
return saveEntityRecord('postType', 'wp_navigation', record).then(response => {
setValue(response);
setStatus(CREATE_NAVIGATION_MENU_SUCCESS);
// Set the status to publish so that the Navigation block
// shows up in the multi entity save flow.
if (postStatus !== 'publish') {
editEntityRecord('postType', 'wp_navigation', response.id, {
status: 'publish'
});
}
return response;
}).catch(err => {
setError(err?.message);
setStatus(CREATE_NAVIGATION_MENU_ERROR);
throw new Error('Unable to save new Navigation Menu', {
cause: err
});
});
}, [saveEntityRecord, editEntityRecord, generateDefaultTitle]);
return {
create,
status,
value,
error,
isIdle: status === CREATE_NAVIGATION_MENU_IDLE,
isPending: status === CREATE_NAVIGATION_MENU_PENDING,
isSuccess: status === CREATE_NAVIGATION_MENU_SUCCESS,
isError: status === CREATE_NAVIGATION_MENU_ERROR
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/use-inner-blocks.js
/**
* WordPress dependencies
*/
const use_inner_blocks_EMPTY_ARRAY = [];
function useInnerBlocks(clientId) {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlock,
getBlocks,
hasSelectedInnerBlock
} = select(external_wp_blockEditor_namespaceObject.store);
// This relies on the fact that `getBlock` won't return controlled
// inner blocks, while `getBlocks` does. It might be more stable to
// introduce a selector like `getUncontrolledInnerBlocks`, just in
// case `getBlock` is fixed.
const _uncontrolledInnerBlocks = getBlock(clientId).innerBlocks;
const _hasUncontrolledInnerBlocks = !!_uncontrolledInnerBlocks?.length;
const _controlledInnerBlocks = _hasUncontrolledInnerBlocks ? use_inner_blocks_EMPTY_ARRAY : getBlocks(clientId);
return {
innerBlocks: _hasUncontrolledInnerBlocks ? _uncontrolledInnerBlocks : _controlledInnerBlocks,
hasUncontrolledInnerBlocks: _hasUncontrolledInnerBlocks,
uncontrolledInnerBlocks: _uncontrolledInnerBlocks,
controlledInnerBlocks: _controlledInnerBlocks,
isInnerBlockSelected: hasSelectedInnerBlock(clientId, true)
};
}, [clientId]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/utils.js
/**
* External dependencies
*/
function getComputedStyle(node) {
return node.ownerDocument.defaultView.getComputedStyle(node);
}
function detectColors(colorsDetectionElement, setColor, setBackground) {
if (!colorsDetectionElement) {
return;
}
setColor(getComputedStyle(colorsDetectionElement).color);
let backgroundColorNode = colorsDetectionElement;
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;
}
setBackground(backgroundColor);
}
/**
* Determine the colors for a menu.
*
* Order of priority is:
* 1: Overlay custom colors (if submenu)
* 2: Overlay theme colors (if submenu)
* 3: Custom colors
* 4: Theme colors
* 5: Global styles
*
* @param {Object} context
* @param {boolean} isSubMenu
*/
function getColors(context, isSubMenu) {
const {
textColor,
customTextColor,
backgroundColor,
customBackgroundColor,
overlayTextColor,
customOverlayTextColor,
overlayBackgroundColor,
customOverlayBackgroundColor,
style
} = context;
const colors = {};
if (isSubMenu && !!customOverlayTextColor) {
colors.customTextColor = customOverlayTextColor;
} else if (isSubMenu && !!overlayTextColor) {
colors.textColor = overlayTextColor;
} else if (!!customTextColor) {
colors.customTextColor = customTextColor;
} else if (!!textColor) {
colors.textColor = textColor;
} else if (!!style?.color?.text) {
colors.customTextColor = style.color.text;
}
if (isSubMenu && !!customOverlayBackgroundColor) {
colors.customBackgroundColor = customOverlayBackgroundColor;
} else if (isSubMenu && !!overlayBackgroundColor) {
colors.backgroundColor = overlayBackgroundColor;
} else if (!!customBackgroundColor) {
colors.customBackgroundColor = customBackgroundColor;
} else if (!!backgroundColor) {
colors.backgroundColor = backgroundColor;
} else if (!!style?.color?.background) {
colors.customTextColor = style.color.background;
}
return colors;
}
function getNavigationChildBlockProps(innerBlocksColors) {
return {
className: classnames_default()('wp-block-navigation__submenu-container', {
'has-text-color': !!(innerBlocksColors.textColor || innerBlocksColors.customTextColor),
[`has-${innerBlocksColors.textColor}-color`]: !!innerBlocksColors.textColor,
'has-background': !!(innerBlocksColors.backgroundColor || innerBlocksColors.customBackgroundColor),
[`has-${innerBlocksColors.backgroundColor}-background-color`]: !!innerBlocksColors.backgroundColor
}),
style: {
color: innerBlocksColors.customTextColor,
backgroundColor: innerBlocksColors.customBackgroundColor
}
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/manage-menus-button.js
/**
* WordPress dependencies
*/
const ManageMenusButton = ({
className = '',
disabled,
isMenuItem = false
}) => {
let ComponentName = external_wp_components_namespaceObject.Button;
if (isMenuItem) {
ComponentName = external_wp_components_namespaceObject.MenuItem;
}
return (0,external_React_namespaceObject.createElement)(ComponentName, {
variant: "link",
disabled: disabled,
className: className,
href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
post_type: 'wp_navigation'
})
}, (0,external_wp_i18n_namespaceObject.__)('Manage menus'));
};
/* harmony default export */ const manage_menus_button = (ManageMenusButton);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/deleted-navigation-warning.js
/**
* WordPress dependencies
*/
function DeletedNavigationWarning({
onCreateNew
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Navigation menu has been deleted or is unavailable. <button>Create a new menu?</button>'), {
button: (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
onClick: onCreateNew,
variant: "link"
})
}));
}
/* harmony default export */ const deleted_navigation_warning = (DeletedNavigationWarning);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/add-submenu.js
/**
* WordPress dependencies
*/
const addSubmenu = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M2 12c0 3.6 2.4 5.5 6 5.5h.5V19l3-2.5-3-2.5v2H8c-2.5 0-4.5-1.5-4.5-4s2-4.5 4.5-4.5h3.5V6H8c-3.6 0-6 2.4-6 6zm19.5-1h-8v1.5h8V11zm0 5h-8v1.5h8V16zm0-10h-8v1.5h8V6z"
}));
/* harmony default export */ const add_submenu = (addSubmenu);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js
/**
* WordPress dependencies
*/
const chevronUp = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_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 */ const chevron_up = (chevronUp);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
/**
* WordPress dependencies
*/
const chevronDown = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_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 */ const chevron_down = (chevronDown);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/leaf-more-menu.js
/**
* WordPress dependencies
*/
const POPOVER_PROPS = {
className: 'block-editor-block-settings-menu__popover',
placement: 'bottom-start'
};
const BLOCKS_THAT_CAN_BE_CONVERTED_TO_SUBMENU = ['core/navigation-link', 'core/navigation-submenu'];
function AddSubmenuItem({
block,
onClose,
expandedState,
expand,
setInsertedBlock
}) {
const {
insertBlock,
replaceBlock,
replaceInnerBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const clientId = block.clientId;
const isDisabled = !BLOCKS_THAT_CAN_BE_CONVERTED_TO_SUBMENU.includes(block.name);
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
icon: add_submenu,
disabled: isDisabled,
onClick: () => {
const updateSelectionOnInsert = false;
const newLink = (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link');
if (block.name === 'core/navigation-submenu') {
insertBlock(newLink, block.innerBlocks.length, clientId, updateSelectionOnInsert);
} else {
// Convert to a submenu if the block currently isn't one.
const newSubmenu = (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-submenu', block.attributes, block.innerBlocks);
// The following must happen as two independent actions.
// Why? Because the offcanvas editor relies on the getLastInsertedBlocksClientIds
// selector to determine which block is "active". As the UX needs the newLink to be
// the "active" block it must be the last block to be inserted.
// Therefore the Submenu is first created and **then** the newLink is inserted
// thus ensuring it is the last inserted block.
replaceBlock(clientId, newSubmenu);
replaceInnerBlocks(newSubmenu.clientId, [newLink], updateSelectionOnInsert);
}
// This call sets the local List View state for the "last inserted block".
// This is required for the Nav Block to determine whether or not to display
// the Link UI for this new block.
setInsertedBlock(newLink);
if (!expandedState[block.clientId]) {
expand(block.clientId);
}
onClose();
}
}, (0,external_wp_i18n_namespaceObject.__)('Add submenu link'));
}
function LeafMoreMenu(props) {
const {
block
} = props;
const {
clientId
} = block;
const {
moveBlocksDown,
moveBlocksUp,
removeBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const removeLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: block name */
(0,external_wp_i18n_namespaceObject.__)('Remove %s'), (0,external_wp_blockEditor_namespaceObject.BlockTitle)({
clientId,
maximumLength: 25
}));
const rootClientId = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockRootClientId
} = select(external_wp_blockEditor_namespaceObject.store);
return getBlockRootClientId(clientId);
}, [clientId]);
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
icon: more_vertical,
label: (0,external_wp_i18n_namespaceObject.__)('Options'),
className: "block-editor-block-settings-menu",
popoverProps: POPOVER_PROPS,
noIcons: true,
...props
}, ({
onClose
}) => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
icon: chevron_up,
onClick: () => {
moveBlocksUp([clientId], rootClientId);
onClose();
}
}, (0,external_wp_i18n_namespaceObject.__)('Move up')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
icon: chevron_down,
onClick: () => {
moveBlocksDown([clientId], rootClientId);
onClose();
}
}, (0,external_wp_i18n_namespaceObject.__)('Move down')), (0,external_React_namespaceObject.createElement)(AddSubmenuItem, {
block: block,
onClose: onClose,
expanded: true,
expandedState: props.expandedState,
expand: props.expand,
setInsertedBlock: props.setInsertedBlock
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => {
removeBlocks([clientId], false);
onClose();
}
}, removeLabel))));
}
;// CONCATENATED MODULE: external ["wp","escapeHtml"]
const external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/update-attributes.js
/**
* WordPress dependencies
*/
/**
* @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind
*/
/**
* Navigation Link Block Attributes
*
* @typedef {Object} WPNavigationLinkBlockAttributes
*
* @property {string} [label] Link text.
* @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.
* @property {string} [type] The type such as post, page, tag, category and other custom types.
* @property {string} [rel] The relationship of the linked URL.
* @property {number} [id] A post or term id.
* @property {boolean} [opensInNewTab] Sets link target to _blank when true.
* @property {string} [url] Link href.
* @property {string} [title] Link title attribute.
*/
/**
* Link Control onChange handler that updates block attributes when a setting is changed.
*
* @param {Object} updatedValue New block attributes to update.
* @param {Function} setAttributes Block attribute update function.
* @param {WPNavigationLinkBlockAttributes} blockAttributes Current block attributes.
*/
const updateAttributes = (updatedValue = {}, setAttributes, blockAttributes = {}) => {
const {
label: originalLabel = '',
kind: originalKind = '',
type: originalType = ''
} = blockAttributes;
const {
title: newLabel = '',
// the title of any provided Post.
url: newUrl = '',
opensInNewTab,
id,
kind: newKind = originalKind,
type: newType = originalType
} = updatedValue;
const newLabelWithoutHttp = newLabel.replace(/http(s?):\/\//gi, '');
const newUrlWithoutHttp = newUrl.replace(/http(s?):\/\//gi, '');
const useNewLabel = newLabel && newLabel !== originalLabel &&
// LinkControl without the title field relies
// on the check below. Specifically, it assumes that
// the URL is the same as a title.
// This logic a) looks suspicious and b) should really
// live in the LinkControl and not here. It's a great
// candidate for future refactoring.
newLabelWithoutHttp !== newUrlWithoutHttp;
// Unfortunately this causes the escaping model to be inverted.
// The escaped content is stored in the block attributes (and ultimately in the database),
// and then the raw data is "recovered" when outputting into the DOM.
// It would be preferable to store the **raw** data in the block attributes and escape it in JS.
// Why? Because there isn't one way to escape data. Depending on the context, you need to do
// different transforms. It doesn't make sense to me to choose one of them for the purposes of storage.
// See also:
// - https://github.com/WordPress/gutenberg/pull/41063
// - https://github.com/WordPress/gutenberg/pull/18617.
const label = useNewLabel ? (0,external_wp_escapeHtml_namespaceObject.escapeHTML)(newLabel) : originalLabel || (0,external_wp_escapeHtml_namespaceObject.escapeHTML)(newUrlWithoutHttp);
// In https://github.com/WordPress/gutenberg/pull/24670 we decided to use "tag" in favor of "post_tag"
const type = newType === 'post_tag' ? 'tag' : newType.replace('-', '_');
const isBuiltInType = ['post', 'page', 'tag', 'category'].indexOf(type) > -1;
const isCustomLink = !newKind && !isBuiltInType || newKind === 'custom';
const kind = isCustomLink ? 'custom' : newKind;
setAttributes({
// Passed `url` may already be encoded. To prevent double encoding, decodeURI is executed to revert to the original string.
...(newUrl && {
url: encodeURI((0,external_wp_url_namespaceObject.safeDecodeURI)(newUrl))
}),
...(label && {
label
}),
...(undefined !== opensInNewTab && {
opensInNewTab
}),
...(id && Number.isInteger(id) && {
id
}),
...(kind && {
kind
}),
...(type && type !== 'URL' && {
type
})
});
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js
/**
* WordPress dependencies
*/
const chevronLeftSmall = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"
}));
/* harmony default export */ const chevron_left_small = (chevronLeftSmall);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
/**
* WordPress dependencies
*/
const plus = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"
}));
/* harmony default export */ const library_plus = (plus);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/link-ui.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
PrivateQuickInserter: QuickInserter
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
/**
* Given the Link block's type attribute, return the query params to give to
* /wp/v2/search.
*
* @param {string} type Link block's type attribute.
* @param {string} kind Link block's entity of kind (post-type|taxonomy)
* @return {{ type?: string, subtype?: string }} Search query params.
*/
function getSuggestionsQuery(type, kind) {
switch (type) {
case 'post':
case 'page':
return {
type: 'post',
subtype: type
};
case 'category':
return {
type: 'term',
subtype: 'category'
};
case 'tag':
return {
type: 'term',
subtype: 'post_tag'
};
case 'post_format':
return {
type: 'post-format'
};
default:
if (kind === 'taxonomy') {
return {
type: 'term',
subtype: type
};
}
if (kind === 'post-type') {
return {
type: 'post',
subtype: type
};
}
return {
// for custom link which has no type
// always show pages as initial suggestions
initialSuggestionsSearchOptions: {
type: 'post',
subtype: 'page',
perPage: 20
}
};
}
}
function LinkUIBlockInserter({
clientId,
onBack,
onSelectBlock
}) {
const {
rootBlockClientId
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockRootClientId
} = select(external_wp_blockEditor_namespaceObject.store);
return {
rootBlockClientId: getBlockRootClientId(clientId)
};
}, [clientId]);
const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement');
const dialogTitleId = (0,external_wp_compose_namespaceObject.useInstanceId)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl, `link-ui-block-inserter__title`);
const dialogDescritionId = (0,external_wp_compose_namespaceObject.useInstanceId)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl, `link-ui-block-inserter__description`);
if (!clientId) {
return null;
}
return (0,external_React_namespaceObject.createElement)("div", {
className: "link-ui-block-inserter",
role: "dialog",
"aria-labelledby": dialogTitleId,
"aria-describedby": dialogDescritionId,
ref: focusOnMountRef
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_React_namespaceObject.createElement)("h2", {
id: dialogTitleId
}, (0,external_wp_i18n_namespaceObject.__)('Add block')), (0,external_React_namespaceObject.createElement)("p", {
id: dialogDescritionId
}, (0,external_wp_i18n_namespaceObject.__)('Choose a block to add to your Navigation.'))), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
className: "link-ui-block-inserter__back",
icon: chevron_left_small,
onClick: e => {
e.preventDefault();
onBack();
},
size: "small"
}, (0,external_wp_i18n_namespaceObject.__)('Back')), (0,external_React_namespaceObject.createElement)(QuickInserter, {
rootClientId: rootBlockClientId,
clientId: clientId,
isAppender: false,
prioritizePatterns: false,
selectBlockOnInsert: true,
hasSearch: false,
onSelect: onSelectBlock
}));
}
function LinkUI(props) {
const [addingBlock, setAddingBlock] = (0,external_wp_element_namespaceObject.useState)(false);
const [focusAddBlockButton, setFocusAddBlockButton] = (0,external_wp_element_namespaceObject.useState)(false);
const [showBackdrop, setShowBackdrop] = (0,external_wp_element_namespaceObject.useState)(true);
const {
saveEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const pagesPermissions = (0,external_wp_coreData_namespaceObject.useResourcePermissions)('pages');
const postsPermissions = (0,external_wp_coreData_namespaceObject.useResourcePermissions)('posts');
async function handleCreate(pageTitle) {
const postType = props.link.type || 'page';
const page = await saveEntityRecord('postType', postType, {
title: pageTitle,
status: 'draft'
});
return {
id: page.id,
type: postType,
// Make `title` property consistent with that in `fetchLinkSuggestions` where the `rendered` title (containing HTML entities)
// is also being decoded. By being consistent in both locations we avoid having to branch in the rendering output code.
// Ideally in the future we will update both APIs to utilise the "raw" form of the title which is better suited to edit contexts.
// e.g.
// - title.raw = "Yes & No"
// - title.rendered = "Yes & No"
// - decodeEntities( title.rendered ) = "Yes & No"
// See:
// - https://github.com/WordPress/gutenberg/pull/41063
// - https://github.com/WordPress/gutenberg/blob/a1e1fdc0e6278457e9f4fc0b31ac6d2095f5450b/packages/core-data/src/fetch/__experimental-fetch-link-suggestions.js#L212-L218
title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(page.title.rendered),
url: page.link,
kind: 'post-type'
};
}
const {
label,
url,
opensInNewTab,
type,
kind
} = props.link;
let userCanCreate = false;
if (!type || type === 'page') {
userCanCreate = pagesPermissions.canCreate;
} else if (type === 'post') {
userCanCreate = postsPermissions.canCreate;
}
// Memoize link value to avoid overriding the LinkControl's internal state.
// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/50976#issuecomment-1568226407.
const link = (0,external_wp_element_namespaceObject.useMemo)(() => ({
url,
opensInNewTab,
title: label && (0,external_wp_dom_namespaceObject.__unstableStripHTML)(label)
}), [label, opensInNewTab, url]);
const dialogTitleId = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkUI, `link-ui-link-control__title`);
const dialogDescritionId = (0,external_wp_compose_namespaceObject.useInstanceId)(LinkUI, `link-ui-link-control__description`);
// Selecting a block should close the popover and also remove the (previously) automatically inserted
// link block so that the newly selected block can be inserted in its place.
const {
onClose: onSelectBlock
} = props;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, showBackdrop && (0,external_React_namespaceObject.createElement)("div", {
className: "components-popover-pointer-events-trap",
"aria-hidden": "true",
onClick: () => setShowBackdrop(false)
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
placement: "bottom",
onClose: props.onClose,
anchor: props.anchor,
shift: true
}, !addingBlock && (0,external_React_namespaceObject.createElement)("div", {
role: "dialog",
"aria-labelledby": dialogTitleId,
"aria-describedby": dialogDescritionId
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_React_namespaceObject.createElement)("h2", {
id: dialogTitleId
}, (0,external_wp_i18n_namespaceObject.__)('Add link')), (0,external_React_namespaceObject.createElement)("p", {
id: dialogDescritionId
}, (0,external_wp_i18n_namespaceObject.__)('Search for and add a link to your Navigation.'))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl, {
hasTextControl: true,
hasRichPreviews: true,
value: link,
showInitialSuggestions: true,
withCreateSuggestion: userCanCreate,
createSuggestion: handleCreate,
createSuggestionButtonText: searchTerm => {
let format;
if (type === 'post') {
/* translators: %s: search term. */
format = (0,external_wp_i18n_namespaceObject.__)('Create draft post: <mark>%s</mark>');
} else {
/* translators: %s: search term. */
format = (0,external_wp_i18n_namespaceObject.__)('Create draft page: <mark>%s</mark>');
}
return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(format, searchTerm), {
mark: (0,external_React_namespaceObject.createElement)("mark", null)
});
},
noDirectEntry: !!type,
noURLSuggestion: !!type,
suggestionsQuery: getSuggestionsQuery(type, kind),
onChange: props.onChange,
onRemove: props.onRemove,
onCancel: props.onCancel,
renderControlBottom: () => !link?.url?.length && (0,external_React_namespaceObject.createElement)(LinkUITools, {
focusAddBlockButton: focusAddBlockButton,
setAddingBlock: () => {
setAddingBlock(true);
setFocusAddBlockButton(false);
}
})
})), addingBlock && (0,external_React_namespaceObject.createElement)(LinkUIBlockInserter, {
clientId: props.clientId,
onBack: () => {
setAddingBlock(false);
setFocusAddBlockButton(true);
},
onSelectBlock: onSelectBlock
})));
}
const LinkUITools = ({
setAddingBlock,
focusAddBlockButton
}) => {
const blockInserterAriaRole = 'listbox';
const addBlockButtonRef = (0,external_wp_element_namespaceObject.useRef)();
// Focus the add block button when the popover is opened.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (focusAddBlockButton) {
addBlockButtonRef.current?.focus();
}
}, [focusAddBlockButton]);
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
className: "link-ui-tools"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
ref: addBlockButtonRef,
icon: library_plus,
onClick: e => {
e.preventDefault();
setAddingBlock(true);
},
"aria-haspopup": blockInserterAriaRole
}, (0,external_wp_i18n_namespaceObject.__)('Add block')));
};
/* harmony default export */ const link_ui = ((/* unused pure expression or super */ null && (LinkUITools)));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/menu-inspector-controls.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* translators: %s: The name of a menu. */
const actionLabel = (0,external_wp_i18n_namespaceObject.__)("Switch to '%s'");
const BLOCKS_WITH_LINK_UI_SUPPORT = ['core/navigation-link', 'core/navigation-submenu'];
const {
PrivateListView
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function AdditionalBlockContent({
block,
insertedBlock,
setInsertedBlock
}) {
const {
updateBlockAttributes
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const supportsLinkControls = BLOCKS_WITH_LINK_UI_SUPPORT?.includes(insertedBlock?.name);
const blockWasJustInserted = insertedBlock?.clientId === block.clientId;
const showLinkControls = supportsLinkControls && blockWasJustInserted;
if (!showLinkControls) {
return null;
}
const setInsertedBlockAttributes = _insertedBlockClientId => _updatedAttributes => {
if (!_insertedBlockClientId) return;
updateBlockAttributes(_insertedBlockClientId, _updatedAttributes);
};
return (0,external_React_namespaceObject.createElement)(LinkUI, {
clientId: insertedBlock?.clientId,
link: insertedBlock?.attributes,
onClose: () => {
setInsertedBlock(null);
},
onChange: updatedValue => {
updateAttributes(updatedValue, setInsertedBlockAttributes(insertedBlock?.clientId), insertedBlock?.attributes);
setInsertedBlock(null);
},
onCancel: () => {
setInsertedBlock(null);
}
});
}
const MainContent = ({
clientId,
currentMenuId,
isLoading,
isNavigationMenuMissing,
onCreateNew
}) => {
const hasChildren = (0,external_wp_data_namespaceObject.useSelect)(select => {
return !!select(external_wp_blockEditor_namespaceObject.store).getBlockCount(clientId);
}, [clientId]);
const {
navigationMenu
} = useNavigationMenu(currentMenuId);
if (currentMenuId && isNavigationMenuMissing) {
return (0,external_React_namespaceObject.createElement)(deleted_navigation_warning, {
onCreateNew: onCreateNew
});
}
if (isLoading) {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null);
}
const description = navigationMenu ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: The name of a menu. */
(0,external_wp_i18n_namespaceObject.__)('Structure for navigation menu: %s'), navigationMenu?.title || (0,external_wp_i18n_namespaceObject.__)('Untitled menu')) : (0,external_wp_i18n_namespaceObject.__)('You have not yet created any menus. Displaying a list of your Pages');
return (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-navigation__menu-inspector-controls"
}, !hasChildren && (0,external_React_namespaceObject.createElement)("p", {
className: "wp-block-navigation__menu-inspector-controls__empty-message"
}, (0,external_wp_i18n_namespaceObject.__)('This navigation menu is empty.')), (0,external_React_namespaceObject.createElement)(PrivateListView, {
rootClientId: clientId,
isExpanded: true,
description: description,
showAppender: true,
blockSettingsMenu: LeafMoreMenu,
additionalBlockContent: AdditionalBlockContent
}));
};
const MenuInspectorControls = props => {
const {
createNavigationMenuIsSuccess,
createNavigationMenuIsError,
currentMenuId = null,
onCreateNew,
onSelectClassicMenu,
onSelectNavigationMenu,
isManageMenusButtonDisabled,
blockEditingMode
} = props;
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "list"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: null
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
className: "wp-block-navigation-off-canvas-editor__header"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
className: "wp-block-navigation-off-canvas-editor__title",
level: 2
}, (0,external_wp_i18n_namespaceObject.__)('Menu')), blockEditingMode === 'default' && (0,external_React_namespaceObject.createElement)(navigation_menu_selector, {
currentMenuId: currentMenuId,
onSelectClassicMenu: onSelectClassicMenu,
onSelectNavigationMenu: onSelectNavigationMenu,
onCreateNew: onCreateNew,
createNavigationMenuIsSuccess: createNavigationMenuIsSuccess,
createNavigationMenuIsError: createNavigationMenuIsError,
actionLabel: actionLabel,
isManageMenusButtonDisabled: isManageMenusButtonDisabled
})), (0,external_React_namespaceObject.createElement)(MainContent, {
...props
})));
};
/* harmony default export */ const menu_inspector_controls = (MenuInspectorControls);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/accessible-description.js
/**
* WordPress dependencies
*/
function AccessibleDescription({
id,
children
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_React_namespaceObject.createElement)("div", {
id: id,
className: "wp-block-navigation__description"
}, children));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/accessible-menu-description.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function AccessibleMenuDescription({
id
}) {
const [menuTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', 'wp_navigation', 'title');
/* translators: %s: Title of a Navigation Menu post. */
const description = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)(`Navigation menu: "%s"`), menuTitle);
return (0,external_React_namespaceObject.createElement)(AccessibleDescription, {
id: id
}, description);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/edit/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Navigation({
attributes,
setAttributes,
clientId,
isSelected,
className,
backgroundColor,
setBackgroundColor,
textColor,
setTextColor,
overlayBackgroundColor,
setOverlayBackgroundColor,
overlayTextColor,
setOverlayTextColor,
// These props are used by the navigation editor to override specific
// navigation block settings.
hasSubmenuIndicatorSetting = true,
customPlaceholder: CustomPlaceholder = null,
__unstableLayoutClassNames: layoutClassNames
}) {
const {
openSubmenusOnClick,
overlayMenu,
showSubmenuIcon,
templateLock,
layout: {
justifyContent,
orientation = 'horizontal',
flexWrap = 'wrap'
} = {},
hasIcon,
icon = 'handle'
} = attributes;
const ref = attributes.ref;
const setRef = (0,external_wp_element_namespaceObject.useCallback)(postId => {
setAttributes({
ref: postId
});
}, [setAttributes]);
const recursionId = `navigationMenu/${ref}`;
const hasAlreadyRendered = (0,external_wp_blockEditor_namespaceObject.useHasRecursion)(recursionId);
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
// Preload classic menus, so that they don't suddenly pop-in when viewing
// the Select Menu dropdown.
const {
menus: classicMenus
} = useNavigationEntities();
const [showNavigationMenuStatusNotice, hideNavigationMenuStatusNotice] = use_navigation_notice({
name: 'block-library/core/navigation/status'
});
const [showClassicMenuConversionNotice, hideClassicMenuConversionNotice] = use_navigation_notice({
name: 'block-library/core/navigation/classic-menu-conversion'
});
const [showNavigationMenuPermissionsNotice, hideNavigationMenuPermissionsNotice] = use_navigation_notice({
name: 'block-library/core/navigation/permissions/update'
});
const {
create: createNavigationMenu,
status: createNavigationMenuStatus,
error: createNavigationMenuError,
value: createNavigationMenuPost,
isPending: isCreatingNavigationMenu,
isSuccess: createNavigationMenuIsSuccess,
isError: createNavigationMenuIsError
} = useCreateNavigationMenu(clientId);
const createUntitledEmptyNavigationMenu = async () => {
await createNavigationMenu('');
};
const {
hasUncontrolledInnerBlocks,
uncontrolledInnerBlocks,
isInnerBlockSelected,
innerBlocks
} = useInnerBlocks(clientId);
const hasSubmenus = !!innerBlocks.find(block => block.name === 'core/navigation-submenu');
const {
replaceInnerBlocks,
selectBlock,
__unstableMarkNextChangeAsNotPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const [isResponsiveMenuOpen, setResponsiveMenuVisibility] = (0,external_wp_element_namespaceObject.useState)(false);
const [overlayMenuPreview, setOverlayMenuPreview] = (0,external_wp_element_namespaceObject.useState)(false);
const {
hasResolvedNavigationMenus,
isNavigationMenuResolved,
isNavigationMenuMissing,
canUserUpdateNavigationMenu,
hasResolvedCanUserUpdateNavigationMenu,
canUserDeleteNavigationMenu,
hasResolvedCanUserDeleteNavigationMenu,
canUserCreateNavigationMenu,
isResolvingCanUserCreateNavigationMenu,
hasResolvedCanUserCreateNavigationMenu
} = useNavigationMenu(ref);
const navMenuResolvedButMissing = hasResolvedNavigationMenus && isNavigationMenuMissing;
const {
convert: convertClassicMenu,
status: classicMenuConversionStatus,
error: classicMenuConversionError
} = use_convert_classic_menu_to_block_menu(createNavigationMenu);
const isConvertingClassicMenu = classicMenuConversionStatus === CLASSIC_MENU_CONVERSION_PENDING;
const handleUpdateMenu = (0,external_wp_element_namespaceObject.useCallback)((menuId, options = {
focusNavigationBlock: false
}) => {
const {
focusNavigationBlock
} = options;
setRef(menuId);
if (focusNavigationBlock) {
selectBlock(clientId);
}
}, [selectBlock, clientId, setRef]);
const isEntityAvailable = !isNavigationMenuMissing && isNavigationMenuResolved;
// If the block has inner blocks, but no menu id, then these blocks are either:
// - inserted via a pattern.
// - inserted directly via Code View (or otherwise).
// - from an older version of navigation block added before the block used a wp_navigation entity.
// Consider this state as 'unsaved' and offer an uncontrolled version of inner blocks,
// that automatically saves the menu as an entity when changes are made to the inner blocks.
const hasUnsavedBlocks = hasUncontrolledInnerBlocks && !isEntityAvailable;
const {
getNavigationFallbackId
} = unlock((0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store));
const navigationFallbackId = !(ref || hasUnsavedBlocks) ? getNavigationFallbackId() : null;
(0,external_wp_element_namespaceObject.useEffect)(() => {
// If:
// - there is an existing menu, OR
// - there are existing (uncontrolled) inner blocks
// ...then don't request a fallback menu.
if (ref || hasUnsavedBlocks || !navigationFallbackId) {
return;
}
/**
* This fallback displays (both in editor and on front)
* The fallback should not request a save (entity dirty state)
* nor to be undoable, hence why it is marked as non persistent
*/
__unstableMarkNextChangeAsNotPersistent();
setRef(navigationFallbackId);
}, [ref, setRef, hasUnsavedBlocks, navigationFallbackId, __unstableMarkNextChangeAsNotPersistent]);
const navRef = (0,external_wp_element_namespaceObject.useRef)();
// The standard HTML5 tag for the block wrapper.
const TagName = 'nav';
// "placeholder" shown if:
// - there is no ref attribute pointing to a Navigation Post.
// - there is no classic menu conversion process in progress.
// - there is no menu creation process in progress.
// - there are no uncontrolled blocks.
const isPlaceholder = !ref && !isCreatingNavigationMenu && !isConvertingClassicMenu && hasResolvedNavigationMenus && classicMenus?.length === 0 && !hasUncontrolledInnerBlocks;
// "loading" state:
// - there is a menu creation process in progress.
// - there is a classic menu conversion process in progress.
// OR:
// - there is a ref attribute pointing to a Navigation Post
// - the Navigation Post isn't available (hasn't resolved) yet.
const isLoading = !hasResolvedNavigationMenus || isCreatingNavigationMenu || isConvertingClassicMenu || !!(ref && !isEntityAvailable && !isConvertingClassicMenu);
const textDecoration = attributes.style?.typography?.textDecoration;
const hasBlockOverlay = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).__unstableHasActiveBlockOverlayActive(clientId), [clientId]);
const isResponsive = 'never' !== overlayMenu;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
ref: navRef,
className: classnames_default()(className, {
'items-justified-right': justifyContent === 'right',
'items-justified-space-between': justifyContent === 'space-between',
'items-justified-left': justifyContent === 'left',
'items-justified-center': justifyContent === 'center',
'is-vertical': orientation === 'vertical',
'no-wrap': flexWrap === 'nowrap',
'is-responsive': isResponsive,
'has-text-color': !!textColor.color || !!textColor?.class,
[(0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor?.slug)]: !!textColor?.slug,
'has-background': !!backgroundColor.color || backgroundColor.class,
[(0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor?.slug)]: !!backgroundColor?.slug,
[`has-text-decoration-${textDecoration}`]: textDecoration,
'block-editor-block-content-overlay': hasBlockOverlay
}, layoutClassNames),
style: {
color: !textColor?.slug && textColor?.color,
backgroundColor: !backgroundColor?.slug && backgroundColor?.color
}
});
// Turn on contrast checker for web only since it's not supported on mobile yet.
const enableContrastChecking = external_wp_element_namespaceObject.Platform.OS === 'web';
const [detectedBackgroundColor, setDetectedBackgroundColor] = (0,external_wp_element_namespaceObject.useState)();
const [detectedColor, setDetectedColor] = (0,external_wp_element_namespaceObject.useState)();
const [detectedOverlayBackgroundColor, setDetectedOverlayBackgroundColor] = (0,external_wp_element_namespaceObject.useState)();
const [detectedOverlayColor, setDetectedOverlayColor] = (0,external_wp_element_namespaceObject.useState)();
const onSelectClassicMenu = async classicMenu => {
return convertClassicMenu(classicMenu.id, classicMenu.name, 'draft');
};
const onSelectNavigationMenu = menuId => {
handleUpdateMenu(menuId);
};
(0,external_wp_element_namespaceObject.useEffect)(() => {
hideNavigationMenuStatusNotice();
if (isCreatingNavigationMenu) {
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)(`Creating Navigation Menu.`));
}
if (createNavigationMenuIsSuccess) {
handleUpdateMenu(createNavigationMenuPost?.id, {
focusNavigationBlock: true
});
showNavigationMenuStatusNotice((0,external_wp_i18n_namespaceObject.__)(`Navigation Menu successfully created.`));
}
if (createNavigationMenuIsError) {
showNavigationMenuStatusNotice((0,external_wp_i18n_namespaceObject.__)('Failed to create Navigation Menu.'));
}
}, [createNavigationMenuStatus, createNavigationMenuError, createNavigationMenuPost?.id, createNavigationMenuIsError, createNavigationMenuIsSuccess, isCreatingNavigationMenu, handleUpdateMenu, hideNavigationMenuStatusNotice, showNavigationMenuStatusNotice]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
hideClassicMenuConversionNotice();
if (classicMenuConversionStatus === CLASSIC_MENU_CONVERSION_PENDING) {
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Classic menu importing.'));
}
if (classicMenuConversionStatus === CLASSIC_MENU_CONVERSION_SUCCESS) {
showClassicMenuConversionNotice((0,external_wp_i18n_namespaceObject.__)('Classic menu imported successfully.'));
handleUpdateMenu(createNavigationMenuPost?.id, {
focusNavigationBlock: true
});
}
if (classicMenuConversionStatus === CLASSIC_MENU_CONVERSION_ERROR) {
showClassicMenuConversionNotice((0,external_wp_i18n_namespaceObject.__)('Classic menu import failed.'));
}
}, [classicMenuConversionStatus, classicMenuConversionError, hideClassicMenuConversionNotice, showClassicMenuConversionNotice, createNavigationMenuPost?.id, handleUpdateMenu]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!enableContrastChecking) {
return;
}
detectColors(navRef.current, setDetectedColor, setDetectedBackgroundColor);
const subMenuElement = navRef.current?.querySelector('[data-type="core/navigation-submenu"] [data-type="core/navigation-link"]');
if (!subMenuElement) {
return;
}
// Only detect submenu overlay colors if they have previously been explicitly set.
// This avoids the contrast checker from reporting on inherited submenu colors and
// showing the contrast warning twice.
if (overlayTextColor.color || overlayBackgroundColor.color) {
detectColors(subMenuElement, setDetectedOverlayColor, setDetectedOverlayBackgroundColor);
}
}, [enableContrastChecking, overlayTextColor.color, overlayBackgroundColor.color]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isSelected && !isInnerBlockSelected) {
hideNavigationMenuPermissionsNotice();
}
if (isSelected || isInnerBlockSelected) {
if (ref && !navMenuResolvedButMissing && hasResolvedCanUserUpdateNavigationMenu && !canUserUpdateNavigationMenu) {
showNavigationMenuPermissionsNotice((0,external_wp_i18n_namespaceObject.__)('You do not have permission to edit this Menu. Any changes made will not be saved.'));
}
if (!ref && hasResolvedCanUserCreateNavigationMenu && !canUserCreateNavigationMenu) {
showNavigationMenuPermissionsNotice((0,external_wp_i18n_namespaceObject.__)('You do not have permission to create Navigation Menus.'));
}
}
}, [isSelected, isInnerBlockSelected, canUserUpdateNavigationMenu, hasResolvedCanUserUpdateNavigationMenu, canUserCreateNavigationMenu, hasResolvedCanUserCreateNavigationMenu, ref, hideNavigationMenuPermissionsNotice, showNavigationMenuPermissionsNotice, navMenuResolvedButMissing]);
const hasManagePermissions = canUserCreateNavigationMenu || canUserUpdateNavigationMenu;
const overlayMenuPreviewClasses = classnames_default()('wp-block-navigation__overlay-menu-preview', {
open: overlayMenuPreview
});
const submenuAccessibilityNotice = !showSubmenuIcon && !openSubmenusOnClick ? (0,external_wp_i18n_namespaceObject.__)('The current menu options offer reduced accessibility for users and are not recommended. Enabling either "Open on Click" or "Show arrow" offers enhanced accessibility by allowing keyboard users to browse submenus selectively.') : '';
const isFirstRender = (0,external_wp_element_namespaceObject.useRef)(true); // Don't speak on first render.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isFirstRender.current && submenuAccessibilityNotice) {
(0,external_wp_a11y_namespaceObject.speak)(submenuAccessibilityNotice);
}
isFirstRender.current = false;
}, [submenuAccessibilityNotice]);
const overlayMenuPreviewId = (0,external_wp_compose_namespaceObject.useInstanceId)(OverlayMenuPreview, `overlay-menu-preview`);
const colorGradientSettings = (0,external_wp_blockEditor_namespaceObject.__experimentalUseMultipleOriginColorsAndGradients)();
const stylingInspectorControls = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, hasSubmenuIndicatorSetting && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Display')
}, isResponsive && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
className: overlayMenuPreviewClasses,
onClick: () => {
setOverlayMenuPreview(!overlayMenuPreview);
},
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Overlay menu controls'),
"aria-controls": overlayMenuPreviewId,
"aria-expanded": overlayMenuPreview
}, hasIcon && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(OverlayMenuIcon, {
icon: icon
}), (0,external_React_namespaceObject.createElement)(build_module_icon, {
icon: library_close
})), !hasIcon && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Menu')), (0,external_React_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Close')))), (0,external_React_namespaceObject.createElement)("div", {
id: overlayMenuPreviewId
}, overlayMenuPreview && (0,external_React_namespaceObject.createElement)(OverlayMenuPreview, {
setAttributes: setAttributes,
hasIcon: hasIcon,
icon: icon,
hidden: !overlayMenuPreview
}))), (0,external_React_namespaceObject.createElement)("h3", null, (0,external_wp_i18n_namespaceObject.__)('Overlay Menu')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Configure overlay menu'),
value: overlayMenu,
help: (0,external_wp_i18n_namespaceObject.__)('Collapses the navigation options in a menu icon opening an overlay.'),
onChange: value => setAttributes({
overlayMenu: value
}),
isBlock: true,
hideLabelFromVision: true
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "never",
label: (0,external_wp_i18n_namespaceObject.__)('Off')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "mobile",
label: (0,external_wp_i18n_namespaceObject.__)('Mobile')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "always",
label: (0,external_wp_i18n_namespaceObject.__)('Always')
})), hasSubmenus && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("h3", null, (0,external_wp_i18n_namespaceObject.__)('Submenus')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
checked: openSubmenusOnClick,
onChange: value => {
setAttributes({
openSubmenusOnClick: value,
...(value && {
showSubmenuIcon: true
}) // Make sure arrows are shown when we toggle this on.
});
},
label: (0,external_wp_i18n_namespaceObject.__)('Open on click')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
checked: showSubmenuIcon,
onChange: value => {
setAttributes({
showSubmenuIcon: value
});
},
disabled: attributes.openSubmenusOnClick,
label: (0,external_wp_i18n_namespaceObject.__)('Show arrow')
}), submenuAccessibilityNotice && (0,external_React_namespaceObject.createElement)("div", null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
spokenMessage: null,
status: "warning",
isDismissible: false
}, submenuAccessibilityNotice))))), colorGradientSettings.hasColorsOrGradients && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "color"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientSettingsDropdown, {
__experimentalIsRenderedInSidebar: true,
settings: [{
colorValue: textColor.color,
label: (0,external_wp_i18n_namespaceObject.__)('Text'),
onColorChange: setTextColor,
resetAllFilter: () => setTextColor()
}, {
colorValue: backgroundColor.color,
label: (0,external_wp_i18n_namespaceObject.__)('Background'),
onColorChange: setBackgroundColor,
resetAllFilter: () => setBackgroundColor()
}, {
colorValue: overlayTextColor.color,
label: (0,external_wp_i18n_namespaceObject.__)('Submenu & overlay text'),
onColorChange: setOverlayTextColor,
resetAllFilter: () => setOverlayTextColor()
}, {
colorValue: overlayBackgroundColor.color,
label: (0,external_wp_i18n_namespaceObject.__)('Submenu & overlay background'),
onColorChange: setOverlayBackgroundColor,
resetAllFilter: () => setOverlayBackgroundColor()
}],
panelId: clientId,
...colorGradientSettings,
gradients: [],
disableCustomGradients: true
}), enableContrastChecking && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ContrastChecker, {
backgroundColor: detectedBackgroundColor,
textColor: detectedColor
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ContrastChecker, {
backgroundColor: detectedOverlayBackgroundColor,
textColor: detectedOverlayColor
}))));
const accessibleDescriptionId = `${clientId}-desc`;
const isManageMenusButtonDisabled = !hasManagePermissions || !hasResolvedNavigationMenus;
if (hasUnsavedBlocks && !isCreatingNavigationMenu) {
return (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps,
"aria-describedby": !isPlaceholder ? accessibleDescriptionId : undefined
}, (0,external_React_namespaceObject.createElement)(AccessibleDescription, {
id: accessibleDescriptionId
}, (0,external_wp_i18n_namespaceObject.__)('Unsaved Navigation Menu.')), (0,external_React_namespaceObject.createElement)(menu_inspector_controls, {
clientId: clientId,
createNavigationMenuIsSuccess: createNavigationMenuIsSuccess,
createNavigationMenuIsError: createNavigationMenuIsError,
currentMenuId: ref,
isNavigationMenuMissing: isNavigationMenuMissing,
isManageMenusButtonDisabled: isManageMenusButtonDisabled,
onCreateNew: createUntitledEmptyNavigationMenu,
onSelectClassicMenu: onSelectClassicMenu,
onSelectNavigationMenu: onSelectNavigationMenu,
isLoading: isLoading,
blockEditingMode: blockEditingMode
}), blockEditingMode === 'default' && stylingInspectorControls, (0,external_React_namespaceObject.createElement)(ResponsiveWrapper, {
id: clientId,
onToggle: setResponsiveMenuVisibility,
isOpen: isResponsiveMenuOpen,
hasIcon: hasIcon,
icon: icon,
isResponsive: isResponsive,
isHiddenByDefault: 'always' === overlayMenu,
overlayBackgroundColor: overlayBackgroundColor,
overlayTextColor: overlayTextColor
}, (0,external_React_namespaceObject.createElement)(UnsavedInnerBlocks, {
createNavigationMenu: createNavigationMenu,
blocks: uncontrolledInnerBlocks,
hasSelection: isSelected || isInnerBlockSelected
})));
}
// Show a warning if the selected menu is no longer available.
// TODO - the user should be able to select a new one?
if (ref && isNavigationMenuMissing) {
return (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(menu_inspector_controls, {
clientId: clientId,
createNavigationMenuIsSuccess: createNavigationMenuIsSuccess,
createNavigationMenuIsError: createNavigationMenuIsError,
currentMenuId: ref,
isNavigationMenuMissing: isNavigationMenuMissing,
isManageMenusButtonDisabled: isManageMenusButtonDisabled,
onCreateNew: createUntitledEmptyNavigationMenu,
onSelectClassicMenu: onSelectClassicMenu,
onSelectNavigationMenu: onSelectNavigationMenu,
isLoading: isLoading,
blockEditingMode: blockEditingMode
}), (0,external_React_namespaceObject.createElement)(deleted_navigation_warning, {
onCreateNew: createUntitledEmptyNavigationMenu
}));
}
if (isEntityAvailable && hasAlreadyRendered) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Block cannot be rendered inside itself.')));
}
const PlaceholderComponent = CustomPlaceholder ? CustomPlaceholder : NavigationPlaceholder;
/**
* Historically the navigation block has supported custom placeholders.
* Even though the current UX tries as hard as possible not to
* end up in a placeholder state, the block continues to support
* this extensibility point, via a CustomPlaceholder.
* When CustomPlaceholder is present it becomes the default fallback
* for an empty navigation block, instead of the default fallbacks.
*
*/
if (isPlaceholder && CustomPlaceholder) {
return (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(PlaceholderComponent, {
isSelected: isSelected,
currentMenuId: ref,
clientId: clientId,
canUserCreateNavigationMenu: canUserCreateNavigationMenu,
isResolvingCanUserCreateNavigationMenu: isResolvingCanUserCreateNavigationMenu,
onSelectNavigationMenu: onSelectNavigationMenu,
onSelectClassicMenu: onSelectClassicMenu,
onCreateEmpty: createUntitledEmptyNavigationMenu
}));
}
return (0,external_React_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
kind: "postType",
type: "wp_navigation",
id: ref
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RecursionProvider, {
uniqueId: recursionId
}, (0,external_React_namespaceObject.createElement)(menu_inspector_controls, {
clientId: clientId,
createNavigationMenuIsSuccess: createNavigationMenuIsSuccess,
createNavigationMenuIsError: createNavigationMenuIsError,
currentMenuId: ref,
isNavigationMenuMissing: isNavigationMenuMissing,
isManageMenusButtonDisabled: isManageMenusButtonDisabled,
onCreateNew: createUntitledEmptyNavigationMenu,
onSelectClassicMenu: onSelectClassicMenu,
onSelectNavigationMenu: onSelectNavigationMenu,
isLoading: isLoading,
blockEditingMode: blockEditingMode
}), blockEditingMode === 'default' && stylingInspectorControls, blockEditingMode === 'default' && isEntityAvailable && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, hasResolvedCanUserUpdateNavigationMenu && canUserUpdateNavigationMenu && (0,external_React_namespaceObject.createElement)(NavigationMenuNameControl, null), hasResolvedCanUserDeleteNavigationMenu && canUserDeleteNavigationMenu && (0,external_React_namespaceObject.createElement)(NavigationMenuDeleteControl, {
onDelete: (deletedMenuTitle = '') => {
replaceInnerBlocks(clientId, []);
showNavigationMenuStatusNotice((0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: the name of a menu (e.g. Header navigation).
(0,external_wp_i18n_namespaceObject.__)('Navigation menu %s successfully deleted.'), deletedMenuTitle));
}
}), (0,external_React_namespaceObject.createElement)(manage_menus_button, {
disabled: isManageMenusButtonDisabled,
className: "wp-block-navigation-manage-menus-button"
})), (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps,
"aria-describedby": !isPlaceholder && !isLoading ? accessibleDescriptionId : undefined
}, isLoading && (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-navigation__loading-indicator-container"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, {
className: "wp-block-navigation__loading-indicator"
})), !isLoading && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(AccessibleMenuDescription, {
id: accessibleDescriptionId
}), (0,external_React_namespaceObject.createElement)(ResponsiveWrapper, {
id: clientId,
onToggle: setResponsiveMenuVisibility,
hasIcon: hasIcon,
icon: icon,
isOpen: isResponsiveMenuOpen,
isResponsive: isResponsive,
isHiddenByDefault: 'always' === overlayMenu,
overlayBackgroundColor: overlayBackgroundColor,
overlayTextColor: overlayTextColor
}, isEntityAvailable && (0,external_React_namespaceObject.createElement)(NavigationInnerBlocks, {
clientId: clientId,
hasCustomPlaceholder: !!CustomPlaceholder,
templateLock: templateLock,
orientation: orientation
}))))));
}
/* harmony default export */ const navigation_edit = ((0,external_wp_blockEditor_namespaceObject.withColors)({
textColor: 'color'
}, {
backgroundColor: 'color'
}, {
overlayBackgroundColor: 'color'
}, {
overlayTextColor: 'color'
})(Navigation));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/save.js
/**
* WordPress dependencies
*/
function navigation_save_save({
attributes
}) {
if (attributes.ref) {
// Avoid rendering inner blocks when a ref is defined.
// When this id is defined the inner blocks are loaded from the
// `wp_navigation` entity rather than the hard-coded block html.
return;
}
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/deprecated.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const TYPOGRAPHY_PRESET_DEPRECATION_MAP = {
fontStyle: 'var:preset|font-style|',
fontWeight: 'var:preset|font-weight|',
textDecoration: 'var:preset|text-decoration|',
textTransform: 'var:preset|text-transform|'
};
const migrateIdToRef = ({
navigationMenuId,
...attributes
}) => {
return {
...attributes,
ref: navigationMenuId
};
};
const deprecated_migrateWithLayout = attributes => {
if (!!attributes.layout) {
return attributes;
}
const {
itemsJustification,
orientation,
...updatedAttributes
} = attributes;
if (itemsJustification || orientation) {
Object.assign(updatedAttributes, {
layout: {
type: 'flex',
...(itemsJustification && {
justifyContent: itemsJustification
}),
...(orientation && {
orientation
})
}
});
}
return updatedAttributes;
};
const navigation_deprecated_v6 = {
attributes: {
navigationMenuId: {
type: 'number'
},
textColor: {
type: 'string'
},
customTextColor: {
type: 'string'
},
rgbTextColor: {
type: 'string'
},
backgroundColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
rgbBackgroundColor: {
type: 'string'
},
showSubmenuIcon: {
type: 'boolean',
default: true
},
openSubmenusOnClick: {
type: 'boolean',
default: false
},
overlayMenu: {
type: 'string',
default: 'mobile'
},
__unstableLocation: {
type: 'string'
},
overlayBackgroundColor: {
type: 'string'
},
customOverlayBackgroundColor: {
type: 'string'
},
overlayTextColor: {
type: 'string'
},
customOverlayTextColor: {
type: 'string'
}
},
supports: {
align: ['wide', 'full'],
anchor: true,
html: false,
inserter: true,
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalTextTransform: true,
__experimentalFontFamily: true,
__experimentalTextDecoration: true,
__experimentalDefaultControls: {
fontSize: true
}
},
spacing: {
blockGap: true,
units: ['px', 'em', 'rem', 'vh', 'vw'],
__experimentalDefaultControls: {
blockGap: true
}
},
layout: {
allowSwitching: false,
allowInheriting: false,
default: {
type: 'flex'
}
}
},
save() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
},
isEligible: ({
navigationMenuId
}) => !!navigationMenuId,
migrate: migrateIdToRef
};
const navigation_deprecated_v5 = {
attributes: {
navigationMenuId: {
type: 'number'
},
orientation: {
type: 'string',
default: 'horizontal'
},
textColor: {
type: 'string'
},
customTextColor: {
type: 'string'
},
rgbTextColor: {
type: 'string'
},
backgroundColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
rgbBackgroundColor: {
type: 'string'
},
itemsJustification: {
type: 'string'
},
showSubmenuIcon: {
type: 'boolean',
default: true
},
openSubmenusOnClick: {
type: 'boolean',
default: false
},
overlayMenu: {
type: 'string',
default: 'never'
},
__unstableLocation: {
type: 'string'
},
overlayBackgroundColor: {
type: 'string'
},
customOverlayBackgroundColor: {
type: 'string'
},
overlayTextColor: {
type: 'string'
},
customOverlayTextColor: {
type: 'string'
}
},
supports: {
align: ['wide', 'full'],
anchor: true,
html: false,
inserter: true,
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalTextTransform: true,
__experimentalFontFamily: true,
__experimentalTextDecoration: true,
__experimentalDefaultControls: {
fontSize: true
}
},
spacing: {
blockGap: true,
units: ['px', 'em', 'rem', 'vh', 'vw'],
__experimentalDefaultControls: {
blockGap: true
}
}
},
save() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
},
isEligible: ({
itemsJustification,
orientation
}) => !!itemsJustification || !!orientation,
migrate: (0,external_wp_compose_namespaceObject.compose)(migrateIdToRef, deprecated_migrateWithLayout)
};
const navigation_deprecated_v4 = {
attributes: {
orientation: {
type: 'string',
default: 'horizontal'
},
textColor: {
type: 'string'
},
customTextColor: {
type: 'string'
},
rgbTextColor: {
type: 'string'
},
backgroundColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
rgbBackgroundColor: {
type: 'string'
},
itemsJustification: {
type: 'string'
},
showSubmenuIcon: {
type: 'boolean',
default: true
},
openSubmenusOnClick: {
type: 'boolean',
default: false
},
overlayMenu: {
type: 'string',
default: 'never'
},
__unstableLocation: {
type: 'string'
},
overlayBackgroundColor: {
type: 'string'
},
customOverlayBackgroundColor: {
type: 'string'
},
overlayTextColor: {
type: 'string'
},
customOverlayTextColor: {
type: 'string'
}
},
supports: {
align: ['wide', 'full'],
anchor: true,
html: false,
inserter: true,
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalTextTransform: true,
__experimentalFontFamily: true,
__experimentalTextDecoration: true
},
spacing: {
blockGap: true,
units: ['px', 'em', 'rem', 'vh', 'vw'],
__experimentalDefaultControls: {
blockGap: true
}
}
},
save() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
},
migrate: (0,external_wp_compose_namespaceObject.compose)(migrateIdToRef, deprecated_migrateWithLayout, migrate_font_family),
isEligible({
style
}) {
return style?.typography?.fontFamily;
}
};
const migrateIsResponsive = function (attributes) {
delete attributes.isResponsive;
return {
...attributes,
overlayMenu: 'mobile'
};
};
const migrateTypographyPresets = function (attributes) {
var _attributes$style$typ;
return {
...attributes,
style: {
...attributes.style,
typography: Object.fromEntries(Object.entries((_attributes$style$typ = attributes.style.typography) !== null && _attributes$style$typ !== void 0 ? _attributes$style$typ : {}).map(([key, value]) => {
const prefix = TYPOGRAPHY_PRESET_DEPRECATION_MAP[key];
if (prefix && value.startsWith(prefix)) {
const newValue = value.slice(prefix.length);
if ('textDecoration' === key && 'strikethrough' === newValue) {
return [key, 'line-through'];
}
return [key, newValue];
}
return [key, value];
}))
}
};
};
const navigation_deprecated_deprecated = [navigation_deprecated_v6, navigation_deprecated_v5, navigation_deprecated_v4,
// Remove `isResponsive` attribute.
{
attributes: {
orientation: {
type: 'string',
default: 'horizontal'
},
textColor: {
type: 'string'
},
customTextColor: {
type: 'string'
},
rgbTextColor: {
type: 'string'
},
backgroundColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
rgbBackgroundColor: {
type: 'string'
},
itemsJustification: {
type: 'string'
},
showSubmenuIcon: {
type: 'boolean',
default: true
},
openSubmenusOnClick: {
type: 'boolean',
default: false
},
isResponsive: {
type: 'boolean',
default: 'false'
},
__unstableLocation: {
type: 'string'
},
overlayBackgroundColor: {
type: 'string'
},
customOverlayBackgroundColor: {
type: 'string'
},
overlayTextColor: {
type: 'string'
},
customOverlayTextColor: {
type: 'string'
}
},
supports: {
align: ['wide', 'full'],
anchor: true,
html: false,
inserter: true,
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalTextTransform: true,
__experimentalFontFamily: true,
__experimentalTextDecoration: true
}
},
isEligible(attributes) {
return attributes.isResponsive;
},
migrate: (0,external_wp_compose_namespaceObject.compose)(migrateIdToRef, deprecated_migrateWithLayout, migrate_font_family, migrateIsResponsive),
save() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
}, {
attributes: {
orientation: {
type: 'string'
},
textColor: {
type: 'string'
},
customTextColor: {
type: 'string'
},
rgbTextColor: {
type: 'string'
},
backgroundColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
rgbBackgroundColor: {
type: 'string'
},
itemsJustification: {
type: 'string'
},
showSubmenuIcon: {
type: 'boolean',
default: true
}
},
supports: {
align: ['wide', 'full'],
anchor: true,
html: false,
inserter: true,
fontSize: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalTextTransform: true,
color: true,
__experimentalFontFamily: true,
__experimentalTextDecoration: true
},
save() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
},
isEligible(attributes) {
if (!attributes.style || !attributes.style.typography) {
return false;
}
for (const styleAttribute in TYPOGRAPHY_PRESET_DEPRECATION_MAP) {
const attributeValue = attributes.style.typography[styleAttribute];
if (attributeValue && attributeValue.startsWith(TYPOGRAPHY_PRESET_DEPRECATION_MAP[styleAttribute])) {
return true;
}
}
return false;
},
migrate: (0,external_wp_compose_namespaceObject.compose)(migrateIdToRef, deprecated_migrateWithLayout, migrate_font_family, migrateTypographyPresets)
}, {
attributes: {
className: {
type: 'string'
},
textColor: {
type: 'string'
},
rgbTextColor: {
type: 'string'
},
backgroundColor: {
type: 'string'
},
rgbBackgroundColor: {
type: 'string'
},
fontSize: {
type: 'string'
},
customFontSize: {
type: 'number'
},
itemsJustification: {
type: 'string'
},
showSubmenuIcon: {
type: 'boolean'
}
},
isEligible(attribute) {
return attribute.rgbTextColor || attribute.rgbBackgroundColor;
},
supports: {
align: ['wide', 'full'],
anchor: true,
html: false,
inserter: true
},
migrate: (0,external_wp_compose_namespaceObject.compose)(migrateIdToRef, attributes => {
const {
rgbTextColor,
rgbBackgroundColor,
...restAttributes
} = attributes;
return {
...restAttributes,
customTextColor: attributes.textColor ? undefined : attributes.rgbTextColor,
customBackgroundColor: attributes.backgroundColor ? undefined : attributes.rgbBackgroundColor
};
}),
save() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
}];
/* harmony default export */ const navigation_deprecated = (navigation_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const navigation_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/navigation",
title: "Navigation",
category: "theme",
allowedBlocks: ["core/navigation-link", "core/search", "core/social-links", "core/page-list", "core/spacer", "core/home-link", "core/site-title", "core/site-logo", "core/navigation-submenu", "core/loginout", "core/buttons"],
description: "A collection of blocks that allow visitors to get around your site.",
keywords: ["menu", "navigation", "links"],
textdomain: "default",
attributes: {
ref: {
type: "number"
},
textColor: {
type: "string"
},
customTextColor: {
type: "string"
},
rgbTextColor: {
type: "string"
},
backgroundColor: {
type: "string"
},
customBackgroundColor: {
type: "string"
},
rgbBackgroundColor: {
type: "string"
},
showSubmenuIcon: {
type: "boolean",
"default": true
},
openSubmenusOnClick: {
type: "boolean",
"default": false
},
overlayMenu: {
type: "string",
"default": "mobile"
},
icon: {
type: "string",
"default": "handle"
},
hasIcon: {
type: "boolean",
"default": true
},
__unstableLocation: {
type: "string"
},
overlayBackgroundColor: {
type: "string"
},
customOverlayBackgroundColor: {
type: "string"
},
overlayTextColor: {
type: "string"
},
customOverlayTextColor: {
type: "string"
},
maxNestingLevel: {
type: "number",
"default": 5
},
templateLock: {
type: ["string", "boolean"],
"enum": ["all", "insert", "contentOnly", false]
}
},
providesContext: {
textColor: "textColor",
customTextColor: "customTextColor",
backgroundColor: "backgroundColor",
customBackgroundColor: "customBackgroundColor",
overlayTextColor: "overlayTextColor",
customOverlayTextColor: "customOverlayTextColor",
overlayBackgroundColor: "overlayBackgroundColor",
customOverlayBackgroundColor: "customOverlayBackgroundColor",
fontSize: "fontSize",
customFontSize: "customFontSize",
showSubmenuIcon: "showSubmenuIcon",
openSubmenusOnClick: "openSubmenusOnClick",
style: "style",
maxNestingLevel: "maxNestingLevel"
},
supports: {
align: ["wide", "full"],
ariaLabel: true,
html: false,
inserter: true,
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalTextTransform: true,
__experimentalFontFamily: true,
__experimentalLetterSpacing: true,
__experimentalTextDecoration: true,
__experimentalSkipSerialization: ["textDecoration"],
__experimentalDefaultControls: {
fontSize: true
}
},
spacing: {
blockGap: true,
units: ["px", "em", "rem", "vh", "vw"],
__experimentalDefaultControls: {
blockGap: true
}
},
layout: {
allowSwitching: false,
allowInheriting: false,
allowVerticalAlignment: false,
allowSizingOnChildren: true,
"default": {
type: "flex"
}
},
__experimentalStyle: {
elements: {
link: {
color: {
text: "inherit"
}
}
}
},
interactivity: true,
renaming: false
},
editorStyle: "wp-block-navigation-editor",
style: "wp-block-navigation"
};
const {
name: navigation_name
} = navigation_metadata;
const navigation_settings = {
icon: library_navigation,
example: {
attributes: {
overlayMenu: 'never'
},
innerBlocks: [{
name: 'core/navigation-link',
attributes: {
// translators: 'Home' as in a website's home page.
label: (0,external_wp_i18n_namespaceObject.__)('Home'),
url: 'https://make.wordpress.org/'
}
}, {
name: 'core/navigation-link',
attributes: {
// translators: 'About' as in a website's about page.
label: (0,external_wp_i18n_namespaceObject.__)('About'),
url: 'https://make.wordpress.org/'
}
}, {
name: 'core/navigation-link',
attributes: {
// translators: 'Contact' as in a website's contact page.
label: (0,external_wp_i18n_namespaceObject.__)('Contact'),
url: 'https://make.wordpress.org/'
}
}]
},
edit: navigation_edit,
save: navigation_save_save,
deprecated: navigation_deprecated
};
const navigation_init = () => initBlock({
name: navigation_name,
metadata: navigation_metadata,
settings: navigation_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/custom-link.js
/**
* WordPress dependencies
*/
const customLink = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12.5 14.5h-1V16h1c2.2 0 4-1.8 4-4s-1.8-4-4-4h-1v1.5h1c1.4 0 2.5 1.1 2.5 2.5s-1.1 2.5-2.5 2.5zm-4 1.5v-1.5h-1C6.1 14.5 5 13.4 5 12s1.1-2.5 2.5-2.5h1V8h-1c-2.2 0-4 1.8-4 4s1.8 4 4 4h1zm-1-3.2h5v-1.5h-5v1.5zM18 4H9c-1.1 0-2 .9-2 2v.5h1.5V6c0-.3.2-.5.5-.5h9c.3 0 .5.2.5.5v12c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5v-.5H7v.5c0 1.1.9 2 2 2h9c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2z"
}));
/* harmony default export */ const custom_link = (customLink);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const edit_DEFAULT_BLOCK = {
name: 'core/navigation-link'
};
/**
* A React hook to determine if it's dragging within the target element.
*
* @typedef {import('@wordpress/element').RefObject} RefObject
*
* @param {RefObject<HTMLElement>} elementRef The target elementRef object.
*
* @return {boolean} Is dragging within the target element.
*/
const useIsDraggingWithin = elementRef => {
const [isDraggingWithin, setIsDraggingWithin] = (0,external_wp_element_namespaceObject.useState)(false);
(0,external_wp_element_namespaceObject.useEffect)(() => {
const {
ownerDocument
} = elementRef.current;
function handleDragStart(event) {
// Check the first time when the dragging starts.
handleDragEnter(event);
}
// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.
function handleDragEnd() {
setIsDraggingWithin(false);
}
function handleDragEnter(event) {
// Check if the current target is inside the item element.
if (elementRef.current.contains(event.target)) {
setIsDraggingWithin(true);
} else {
setIsDraggingWithin(false);
}
}
// Bind these events to the document to catch all drag events.
// Ideally, we can also use `event.relatedTarget`, but sadly that
// doesn't work in Safari.
ownerDocument.addEventListener('dragstart', handleDragStart);
ownerDocument.addEventListener('dragend', handleDragEnd);
ownerDocument.addEventListener('dragenter', handleDragEnter);
return () => {
ownerDocument.removeEventListener('dragstart', handleDragStart);
ownerDocument.removeEventListener('dragend', handleDragEnd);
ownerDocument.removeEventListener('dragenter', handleDragEnter);
};
}, []);
return isDraggingWithin;
};
const useIsInvalidLink = (kind, type, id) => {
const isPostType = kind === 'post-type' || type === 'post' || type === 'page';
const hasId = Number.isInteger(id);
const postStatus = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!isPostType) {
return null;
}
const {
getEntityRecord
} = select(external_wp_coreData_namespaceObject.store);
return getEntityRecord('postType', type, id)?.status;
}, [isPostType, type, id]);
// Check Navigation Link validity if:
// 1. Link is 'post-type'.
// 2. It has an id.
// 3. It's neither null, nor undefined, as valid items might be either of those while loading.
// If those conditions are met, check if
// 1. The post status is published.
// 2. The Navigation Link item has no label.
// If either of those is true, invalidate.
const isInvalid = isPostType && hasId && postStatus && 'trash' === postStatus;
const isDraft = 'draft' === postStatus;
return [isInvalid, isDraft];
};
function getMissingText(type) {
let missingText = '';
switch (type) {
case 'post':
/* translators: label for missing post in navigation link block */
missingText = (0,external_wp_i18n_namespaceObject.__)('Select post');
break;
case 'page':
/* translators: label for missing page in navigation link block */
missingText = (0,external_wp_i18n_namespaceObject.__)('Select page');
break;
case 'category':
/* translators: label for missing category in navigation link block */
missingText = (0,external_wp_i18n_namespaceObject.__)('Select category');
break;
case 'tag':
/* translators: label for missing tag in navigation link block */
missingText = (0,external_wp_i18n_namespaceObject.__)('Select tag');
break;
default:
/* translators: label for missing values in navigation link block */
missingText = (0,external_wp_i18n_namespaceObject.__)('Add link');
}
return missingText;
}
function NavigationLinkEdit({
attributes,
isSelected,
setAttributes,
insertBlocksAfter,
mergeBlocks,
onReplace,
context,
clientId
}) {
const {
id,
label,
type,
url,
description,
rel,
title,
kind
} = attributes;
const [isInvalid, isDraft] = useIsInvalidLink(kind, type, id);
const {
maxNestingLevel
} = context;
const {
replaceBlock,
__unstableMarkNextChangeAsNotPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const [isLinkOpen, setIsLinkOpen] = (0,external_wp_element_namespaceObject.useState)(false);
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
const listItemRef = (0,external_wp_element_namespaceObject.useRef)(null);
const isDraggingWithin = useIsDraggingWithin(listItemRef);
const itemLabelPlaceholder = (0,external_wp_i18n_namespaceObject.__)('Add label…');
const ref = (0,external_wp_element_namespaceObject.useRef)();
// Change the label using inspector causes rich text to change focus on firefox.
// This is a workaround to keep the focus on the label field when label filed is focused we don't render the rich text.
const [isLabelFieldFocused, setIsLabelFieldFocused] = (0,external_wp_element_namespaceObject.useState)(false);
const {
innerBlocks,
isAtMaxNesting,
isTopLevelLink,
isParentOfSelectedBlock,
hasChildren
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlocks,
getBlockCount,
getBlockName,
getBlockRootClientId,
hasSelectedInnerBlock,
getBlockParentsByBlockName
} = select(external_wp_blockEditor_namespaceObject.store);
return {
innerBlocks: getBlocks(clientId),
isAtMaxNesting: getBlockParentsByBlockName(clientId, ['core/navigation-link', 'core/navigation-submenu']).length >= maxNestingLevel,
isTopLevelLink: getBlockName(getBlockRootClientId(clientId)) === 'core/navigation',
isParentOfSelectedBlock: hasSelectedInnerBlock(clientId, true),
hasChildren: !!getBlockCount(clientId)
};
}, [clientId]);
/**
* Transform to submenu block.
*/
function transformToSubmenu() {
const newSubmenu = (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-submenu', attributes, innerBlocks.length > 0 ? innerBlocks : [(0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link')]);
replaceBlock(clientId, newSubmenu);
}
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Show the LinkControl on mount if the URL is empty
// ( When adding a new menu item)
// This can't be done in the useState call because it conflicts
// with the autofocus behavior of the BlockListBlock component.
if (!url) {
setIsLinkOpen(true);
}
}, [url]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// If block has inner blocks, transform to Submenu.
if (hasChildren) {
// This side-effect should not create an undo level as those should
// only be created via user interactions.
__unstableMarkNextChangeAsNotPersistent();
transformToSubmenu();
}
}, [hasChildren]);
/**
* The hook shouldn't be necessary but due to a focus loss happening
* when selecting a suggestion in the link popover, we force close on block unselection.
*/
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isSelected) {
setIsLinkOpen(false);
}
}, [isSelected]);
// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (isLinkOpen && url) {
// Does this look like a URL and have something TLD-ish?
if ((0,external_wp_url_namespaceObject.isURL)((0,external_wp_url_namespaceObject.prependHTTP)(label)) && /^.+\.[a-z]+/.test(label)) {
// Focus and select the label text.
selectLabelText();
} else {
// Focus it (but do not select).
(0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(ref.current, true);
}
}
}, [url]);
/**
* Focus the Link label text and select it.
*/
function selectLabelText() {
ref.current.focus();
const {
ownerDocument
} = ref.current;
const {
defaultView
} = ownerDocument;
const selection = defaultView.getSelection();
const range = ownerDocument.createRange();
// Get the range of the current ref contents so we can add this range to the selection.
range.selectNodeContents(ref.current);
selection.removeAllRanges();
selection.addRange(range);
}
/**
* Removes the current link if set.
*/
function removeLink() {
// Reset all attributes that comprise the link.
// It is critical that all attributes are reset
// to their default values otherwise this may
// in advertently trigger side effects because
// the values will have "changed".
setAttributes({
url: undefined,
label: undefined,
id: undefined,
kind: undefined,
type: undefined,
opensInNewTab: false
});
// Close the link editing UI.
setIsLinkOpen(false);
}
const {
textColor,
customTextColor,
backgroundColor,
customBackgroundColor
} = getColors(context, !isTopLevelLink);
function onKeyDown(event) {
if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'k') || (!url || isDraft || isInvalid) && event.keyCode === external_wp_keycodes_namespaceObject.ENTER) {
event.preventDefault();
setIsLinkOpen(true);
}
}
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([setPopoverAnchor, listItemRef]),
className: classnames_default()('wp-block-navigation-item', {
'is-editing': isSelected || isParentOfSelectedBlock,
'is-dragging-within': isDraggingWithin,
'has-link': !!url,
'has-child': hasChildren,
'has-text-color': !!textColor || !!customTextColor,
[(0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor)]: !!textColor,
'has-background': !!backgroundColor || customBackgroundColor,
[(0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor)]: !!backgroundColor
}),
style: {
color: !textColor && customTextColor,
backgroundColor: !backgroundColor && customBackgroundColor
},
onKeyDown
});
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({
...blockProps,
className: 'remove-outline' // Remove the outline from the inner blocks container.
}, {
defaultBlock: edit_DEFAULT_BLOCK,
directInsert: true,
renderAppender: false
});
if (!url || isInvalid || isDraft) {
blockProps.onClick = () => setIsLinkOpen(true);
}
const classes = classnames_default()('wp-block-navigation-item__content', {
'wp-block-navigation-link__placeholder': !url || isInvalid || isDraft
});
const missingText = getMissingText(type);
/* translators: Whether the navigation link is Invalid or a Draft. */
const placeholderText = `(${isInvalid ? (0,external_wp_i18n_namespaceObject.__)('Invalid') : (0,external_wp_i18n_namespaceObject.__)('Draft')})`;
const tooltipText = isInvalid || isDraft ? (0,external_wp_i18n_namespaceObject.__)('This item has been deleted, or is a draft') : (0,external_wp_i18n_namespaceObject.__)('This item is missing a link');
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
name: "link",
icon: library_link,
title: (0,external_wp_i18n_namespaceObject.__)('Link'),
shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k'),
onClick: () => setIsLinkOpen(true)
}), !isAtMaxNesting && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
name: "submenu",
icon: add_submenu,
title: (0,external_wp_i18n_namespaceObject.__)('Add submenu'),
onClick: transformToSubmenu
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
value: label ? (0,external_wp_dom_namespaceObject.__unstableStripHTML)(label) : '',
onChange: labelValue => {
setAttributes({
label: labelValue
});
},
label: (0,external_wp_i18n_namespaceObject.__)('Label'),
autoComplete: "off",
onFocus: () => setIsLabelFieldFocused(true),
onBlur: () => setIsLabelFieldFocused(false)
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
value: url ? (0,external_wp_url_namespaceObject.safeDecodeURI)(url) : '',
onChange: urlValue => {
updateAttributes({
url: urlValue
}, setAttributes, attributes);
},
label: (0,external_wp_i18n_namespaceObject.__)('URL'),
autoComplete: "off"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextareaControl, {
__nextHasNoMarginBottom: true,
value: description || '',
onChange: descriptionValue => {
setAttributes({
description: descriptionValue
});
},
label: (0,external_wp_i18n_namespaceObject.__)('Description'),
help: (0,external_wp_i18n_namespaceObject.__)('The description will be displayed in the menu if the current theme supports it.')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
value: title || '',
onChange: titleValue => {
setAttributes({
title: titleValue
});
},
label: (0,external_wp_i18n_namespaceObject.__)('Title attribute'),
autoComplete: "off",
help: (0,external_wp_i18n_namespaceObject.__)('Additional information to help clarify the purpose of the link.')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
value: rel || '',
onChange: relValue => {
setAttributes({
rel: relValue
});
},
label: (0,external_wp_i18n_namespaceObject.__)('Rel attribute'),
autoComplete: "off",
help: (0,external_wp_i18n_namespaceObject.__)('The relationship of the linked URL as space-separated link types.')
}))), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("a", {
className: classes
}, !url ? (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-navigation-link__placeholder-text"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Tooltip, {
text: tooltipText
}, (0,external_React_namespaceObject.createElement)("span", null, missingText))) : (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !isInvalid && !isDraft && !isLabelFieldFocused && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
ref: ref,
identifier: "label",
className: "wp-block-navigation-item__label",
value: label,
onChange: labelValue => setAttributes({
label: labelValue
}),
onMerge: mergeBlocks,
onReplace: onReplace,
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link')),
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigation link text'),
placeholder: itemLabelPlaceholder,
withoutInteractiveFormatting: true,
allowedFormats: ['core/bold', 'core/italic', 'core/image', 'core/strikethrough'],
onClick: () => {
if (!url) {
setIsLinkOpen(true);
}
}
}), description && (0,external_React_namespaceObject.createElement)("span", {
className: "wp-block-navigation-item__description"
}, description)), (isInvalid || isDraft || isLabelFieldFocused) && (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-navigation-link__placeholder-text wp-block-navigation-link__label"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Tooltip, {
text: tooltipText
}, (0,external_React_namespaceObject.createElement)("span", {
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigation link text')
},
// Some attributes are stored in an escaped form. It's a legacy issue.
// Ideally they would be stored in a raw, unescaped form.
// Unescape is used here to "recover" the escaped characters
// so they display without encoding.
// See `updateAttributes` for more details.
`${(0,external_wp_htmlEntities_namespaceObject.decodeEntities)(label)} ${isInvalid || isDraft ? placeholderText : ''}`.trim())))), isLinkOpen && (0,external_React_namespaceObject.createElement)(LinkUI, {
clientId: clientId,
link: attributes,
onClose: () => {
// If there is no link then remove the auto-inserted block.
// This avoids empty blocks which can provided a poor UX.
if (!url) {
// Need to handle refocusing the Nav block or the inserter?
onReplace([]);
}
},
anchor: popoverAnchor,
onRemove: removeLink,
onChange: updatedValue => {
updateAttributes(updatedValue, setAttributes, attributes);
}
})), (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/save.js
/**
* WordPress dependencies
*/
function navigation_link_save_save() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js
/**
* WordPress dependencies
*/
const page = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"
}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"
}));
/* harmony default export */ const library_page = (page);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tag.js
/**
* WordPress dependencies
*/
const tag = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
}));
/* harmony default export */ const library_tag = (tag);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/custom-post-type.js
/**
* WordPress dependencies
*/
const customPostType = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4zm.8-4l.7.7 2-2V12h1V9.2l2 2 .7-.7-2-2H12v-1H9.2l2-2-.7-.7-2 2V4h-1v2.8l-2-2-.7.7 2 2H4v1h2.8l-2 2z"
}));
/* harmony default export */ const custom_post_type = (customPostType);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/hooks.js
/**
* WordPress dependencies
*/
function getIcon(variationName) {
switch (variationName) {
case 'post':
return post_list;
case 'page':
return library_page;
case 'tag':
return library_tag;
case 'category':
return library_category;
default:
return custom_post_type;
}
}
function enhanceNavigationLinkVariations(settings, name) {
if (name !== 'core/navigation-link') {
return settings;
}
// Otherwise decorate server passed variations with an icon and isActive function.
if (settings.variations) {
const isActive = (blockAttributes, variationAttributes) => {
return blockAttributes.type === variationAttributes.type;
};
const variations = settings.variations.map(variation => {
return {
...variation,
...(!variation.icon && {
icon: getIcon(variation.name)
}),
...(!variation.isActive && {
isActive
})
};
});
return {
...settings,
variations
};
}
return settings;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/transforms.js
/**
* WordPress dependencies
*/
const navigation_link_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/site-logo'],
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link');
}
}, {
type: 'block',
blocks: ['core/spacer'],
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link');
}
}, {
type: 'block',
blocks: ['core/home-link'],
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link');
}
}, {
type: 'block',
blocks: ['core/social-links'],
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link');
}
}, {
type: 'block',
blocks: ['core/search'],
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link');
}
}, {
type: 'block',
blocks: ['core/page-list'],
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link');
}
}, {
type: 'block',
blocks: ['core/buttons'],
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link');
}
}],
to: [{
type: 'block',
blocks: ['core/navigation-submenu'],
transform: (attributes, innerBlocks) => (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-submenu', attributes, innerBlocks)
}, {
type: 'block',
blocks: ['core/spacer'],
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/spacer');
}
}, {
type: 'block',
blocks: ['core/site-logo'],
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/site-logo');
}
}, {
type: 'block',
blocks: ['core/home-link'],
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/home-link');
}
}, {
type: 'block',
blocks: ['core/social-links'],
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/social-links');
}
}, {
type: 'block',
blocks: ['core/search'],
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/search', {
showLabel: false,
buttonUseIcon: true,
buttonPosition: 'button-inside'
});
}
}, {
type: 'block',
blocks: ['core/page-list'],
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/page-list');
}
}, {
type: 'block',
blocks: ['core/buttons'],
transform: ({
label,
url,
rel,
title,
opensInNewTab
}) => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/buttons', {}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/button', {
text: label,
url,
rel,
title,
linkTarget: opensInNewTab ? '_blank' : undefined
})]);
}
}]
};
/* harmony default export */ const navigation_link_transforms = (navigation_link_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const navigation_link_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/navigation-link",
title: "Custom Link",
category: "design",
parent: ["core/navigation"],
allowedBlocks: ["core/navigation-link", "core/navigation-submenu", "core/page-list"],
description: "Add a page, link, or another item to your navigation.",
textdomain: "default",
attributes: {
label: {
type: "string"
},
type: {
type: "string"
},
description: {
type: "string"
},
rel: {
type: "string"
},
id: {
type: "number"
},
opensInNewTab: {
type: "boolean",
"default": false
},
url: {
type: "string"
},
title: {
type: "string"
},
kind: {
type: "string"
},
isTopLevelLink: {
type: "boolean"
}
},
usesContext: ["textColor", "customTextColor", "backgroundColor", "customBackgroundColor", "overlayTextColor", "customOverlayTextColor", "overlayBackgroundColor", "customOverlayBackgroundColor", "fontSize", "customFontSize", "showSubmenuIcon", "maxNestingLevel", "style"],
supports: {
reusable: false,
html: false,
__experimentalSlashInserter: true,
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
renaming: false,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-navigation-link-editor",
style: "wp-block-navigation-link"
};
const {
name: navigation_link_name
} = navigation_link_metadata;
const navigation_link_settings = {
icon: custom_link,
__experimentalLabel: ({
label
}) => label,
merge(leftAttributes, {
label: rightLabel = ''
}) {
return {
...leftAttributes,
label: leftAttributes.label + rightLabel
};
},
edit: NavigationLinkEdit,
save: navigation_link_save_save,
example: {
attributes: {
label: (0,external_wp_i18n_namespaceObject._x)('Example Link', 'navigation link preview example'),
url: 'https://example.com'
}
},
deprecated: [{
isEligible(attributes) {
return attributes.nofollow;
},
attributes: {
label: {
type: 'string'
},
type: {
type: 'string'
},
nofollow: {
type: 'boolean'
},
description: {
type: 'string'
},
id: {
type: 'number'
},
opensInNewTab: {
type: 'boolean',
default: false
},
url: {
type: 'string'
}
},
migrate({
nofollow,
...rest
}) {
return {
rel: nofollow ? 'nofollow' : '',
...rest
};
},
save() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
}],
transforms: navigation_link_transforms
};
const navigation_link_init = () => {
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/navigation-link', enhanceNavigationLinkVariations);
return initBlock({
name: navigation_link_name,
metadata: navigation_link_metadata,
settings: navigation_link_settings
});
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/remove-submenu.js
/**
* WordPress dependencies
*/
const removeSubmenu = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "m13.955 20.748 8-17.5-.91-.416L19.597 6H13.5v1.5h5.411l-1.6 3.5H13.5v1.5h3.126l-1.6 3.5H13.5l.028 1.5h.812l-1.295 2.832.91.416ZM17.675 16l-.686 1.5h4.539L21.5 16h-3.825Zm2.286-5-.686 1.5H21.5V11h-1.54ZM2 12c0 3.58 2.42 5.5 6 5.5h.5V19l3-2.5-3-2.5v2H8c-2.48 0-4.5-1.52-4.5-4S5.52 7.5 8 7.5h3.5V6H8c-3.58 0-6 2.42-6 6Z"
}));
/* harmony default export */ const remove_submenu = (removeSubmenu);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-submenu/icons.js
/**
* WordPress dependencies
*/
const ItemSubmenuIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
width: "12",
height: "12",
viewBox: "0 0 12 12",
fill: "none"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M1.50002 4L6.00002 8L10.5 4",
strokeWidth: "1.5"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-submenu/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ALLOWED_BLOCKS = ['core/navigation-link', 'core/navigation-submenu', 'core/page-list'];
const navigation_submenu_edit_DEFAULT_BLOCK = {
name: 'core/navigation-link'
};
/**
* A React hook to determine if it's dragging within the target element.
*
* @typedef {import('@wordpress/element').RefObject} RefObject
*
* @param {RefObject<HTMLElement>} elementRef The target elementRef object.
*
* @return {boolean} Is dragging within the target element.
*/
const edit_useIsDraggingWithin = elementRef => {
const [isDraggingWithin, setIsDraggingWithin] = (0,external_wp_element_namespaceObject.useState)(false);
(0,external_wp_element_namespaceObject.useEffect)(() => {
const {
ownerDocument
} = elementRef.current;
function handleDragStart(event) {
// Check the first time when the dragging starts.
handleDragEnter(event);
}
// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.
function handleDragEnd() {
setIsDraggingWithin(false);
}
function handleDragEnter(event) {
// Check if the current target is inside the item element.
if (elementRef.current.contains(event.target)) {
setIsDraggingWithin(true);
} else {
setIsDraggingWithin(false);
}
}
// Bind these events to the document to catch all drag events.
// Ideally, we can also use `event.relatedTarget`, but sadly that
// doesn't work in Safari.
ownerDocument.addEventListener('dragstart', handleDragStart);
ownerDocument.addEventListener('dragend', handleDragEnd);
ownerDocument.addEventListener('dragenter', handleDragEnter);
return () => {
ownerDocument.removeEventListener('dragstart', handleDragStart);
ownerDocument.removeEventListener('dragend', handleDragEnd);
ownerDocument.removeEventListener('dragenter', handleDragEnter);
};
}, []);
return isDraggingWithin;
};
/**
* @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind
*/
/**
* Navigation Link Block Attributes
*
* @typedef {Object} WPNavigationLinkBlockAttributes
*
* @property {string} [label] Link text.
* @property {WPNavigationLinkKind} [kind] Kind is used to differentiate between term and post ids to check post draft status.
* @property {string} [type] The type such as post, page, tag, category and other custom types.
* @property {string} [rel] The relationship of the linked URL.
* @property {number} [id] A post or term id.
* @property {boolean} [opensInNewTab] Sets link target to _blank when true.
* @property {string} [url] Link href.
* @property {string} [title] Link title attribute.
*/
function NavigationSubmenuEdit({
attributes,
isSelected,
setAttributes,
mergeBlocks,
onReplace,
context,
clientId
}) {
const {
label,
type,
url,
description,
rel,
title
} = attributes;
const {
showSubmenuIcon,
maxNestingLevel,
openSubmenusOnClick
} = context;
const {
__unstableMarkNextChangeAsNotPersistent,
replaceBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const [isLinkOpen, setIsLinkOpen] = (0,external_wp_element_namespaceObject.useState)(false);
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
const listItemRef = (0,external_wp_element_namespaceObject.useRef)(null);
const isDraggingWithin = edit_useIsDraggingWithin(listItemRef);
const itemLabelPlaceholder = (0,external_wp_i18n_namespaceObject.__)('Add text…');
const ref = (0,external_wp_element_namespaceObject.useRef)();
const pagesPermissions = (0,external_wp_coreData_namespaceObject.useResourcePermissions)('pages');
const postsPermissions = (0,external_wp_coreData_namespaceObject.useResourcePermissions)('posts');
const {
parentCount,
isParentOfSelectedBlock,
isImmediateParentOfSelectedBlock,
hasChildren,
selectedBlockHasChildren,
onlyDescendantIsEmptyLink
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
hasSelectedInnerBlock,
getSelectedBlockClientId,
getBlockParentsByBlockName,
getBlock,
getBlockCount,
getBlockOrder
} = select(external_wp_blockEditor_namespaceObject.store);
let _onlyDescendantIsEmptyLink;
const selectedBlockId = getSelectedBlockClientId();
const selectedBlockChildren = getBlockOrder(selectedBlockId);
// Check for a single descendant in the submenu. If that block
// is a link block in a "placeholder" state with no label then
// we can consider as an "empty" link.
if (selectedBlockChildren?.length === 1) {
const singleBlock = getBlock(selectedBlockChildren[0]);
_onlyDescendantIsEmptyLink = singleBlock?.name === 'core/navigation-link' && !singleBlock?.attributes?.label;
}
return {
parentCount: getBlockParentsByBlockName(clientId, 'core/navigation-submenu').length,
isParentOfSelectedBlock: hasSelectedInnerBlock(clientId, true),
isImmediateParentOfSelectedBlock: hasSelectedInnerBlock(clientId, false),
hasChildren: !!getBlockCount(clientId),
selectedBlockHasChildren: !!selectedBlockChildren?.length,
onlyDescendantIsEmptyLink: _onlyDescendantIsEmptyLink
};
}, [clientId]);
const prevHasChildren = (0,external_wp_compose_namespaceObject.usePrevious)(hasChildren);
// Show the LinkControl on mount if the URL is empty
// ( When adding a new menu item)
// This can't be done in the useState call because it conflicts
// with the autofocus behavior of the BlockListBlock component.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!openSubmenusOnClick && !url) {
setIsLinkOpen(true);
}
}, []);
/**
* The hook shouldn't be necessary but due to a focus loss happening
* when selecting a suggestion in the link popover, we force close on block unselection.
*/
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isSelected) {
setIsLinkOpen(false);
}
}, [isSelected]);
// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (isLinkOpen && url) {
// Does this look like a URL and have something TLD-ish?
if ((0,external_wp_url_namespaceObject.isURL)((0,external_wp_url_namespaceObject.prependHTTP)(label)) && /^.+\.[a-z]+/.test(label)) {
// Focus and select the label text.
selectLabelText();
} else {
// Focus it (but do not select).
(0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(ref.current, true);
}
}
}, [url]);
/**
* Focus the Link label text and select it.
*/
function selectLabelText() {
ref.current.focus();
const {
ownerDocument
} = ref.current;
const {
defaultView
} = ownerDocument;
const selection = defaultView.getSelection();
const range = ownerDocument.createRange();
// Get the range of the current ref contents so we can add this range to the selection.
range.selectNodeContents(ref.current);
selection.removeAllRanges();
selection.addRange(range);
}
let userCanCreate = false;
if (!type || type === 'page') {
userCanCreate = pagesPermissions.canCreate;
} else if (type === 'post') {
userCanCreate = postsPermissions.canCreate;
}
const {
textColor,
customTextColor,
backgroundColor,
customBackgroundColor
} = getColors(context, parentCount > 0);
function onKeyDown(event) {
if (external_wp_keycodes_namespaceObject.isKeyboardEvent.primary(event, 'k')) {
event.preventDefault();
setIsLinkOpen(true);
}
}
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([setPopoverAnchor, listItemRef]),
className: classnames_default()('wp-block-navigation-item', {
'is-editing': isSelected || isParentOfSelectedBlock,
'is-dragging-within': isDraggingWithin,
'has-link': !!url,
'has-child': hasChildren,
'has-text-color': !!textColor || !!customTextColor,
[(0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor)]: !!textColor,
'has-background': !!backgroundColor || customBackgroundColor,
[(0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor)]: !!backgroundColor,
'open-on-click': openSubmenusOnClick
}),
style: {
color: !textColor && customTextColor,
backgroundColor: !backgroundColor && customBackgroundColor
},
onKeyDown
});
// Always use overlay colors for submenus.
const innerBlocksColors = getColors(context, true);
const allowedBlocks = parentCount >= maxNestingLevel ? ALLOWED_BLOCKS.filter(blockName => blockName !== 'core/navigation-submenu') : ALLOWED_BLOCKS;
const navigationChildBlockProps = getNavigationChildBlockProps(innerBlocksColors);
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(navigationChildBlockProps, {
allowedBlocks,
defaultBlock: navigation_submenu_edit_DEFAULT_BLOCK,
directInsert: true,
// Ensure block toolbar is not too far removed from item
// being edited.
// see: https://github.com/WordPress/gutenberg/pull/34615.
__experimentalCaptureToolbars: true,
renderAppender: isSelected || isImmediateParentOfSelectedBlock && !selectedBlockHasChildren ||
// Show the appender while dragging to allow inserting element between item and the appender.
hasChildren ? external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender : false
});
const ParentElement = openSubmenusOnClick ? 'button' : 'a';
function transformToLink() {
const newLinkBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link', attributes);
replaceBlock(clientId, newLinkBlock);
}
(0,external_wp_element_namespaceObject.useEffect)(() => {
// If block becomes empty, transform to Navigation Link.
if (!hasChildren && prevHasChildren) {
// This side-effect should not create an undo level as those should
// only be created via user interactions.
__unstableMarkNextChangeAsNotPersistent();
transformToLink();
}
}, [hasChildren, prevHasChildren]);
const canConvertToLink = !selectedBlockHasChildren || onlyDescendantIsEmptyLink;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, !openSubmenusOnClick && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
name: "link",
icon: library_link,
title: (0,external_wp_i18n_namespaceObject.__)('Link'),
shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('k'),
onClick: () => setIsLinkOpen(true)
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
name: "revert",
icon: remove_submenu,
title: (0,external_wp_i18n_namespaceObject.__)('Convert to Link'),
onClick: transformToLink,
className: "wp-block-navigation__submenu__revert",
isDisabled: !canConvertToLink
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
value: label || '',
onChange: labelValue => {
setAttributes({
label: labelValue
});
},
label: (0,external_wp_i18n_namespaceObject.__)('Label'),
autoComplete: "off"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
value: url || '',
onChange: urlValue => {
setAttributes({
url: urlValue
});
},
label: (0,external_wp_i18n_namespaceObject.__)('URL'),
autoComplete: "off"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextareaControl, {
__nextHasNoMarginBottom: true,
value: description || '',
onChange: descriptionValue => {
setAttributes({
description: descriptionValue
});
},
label: (0,external_wp_i18n_namespaceObject.__)('Description'),
help: (0,external_wp_i18n_namespaceObject.__)('The description will be displayed in the menu if the current theme supports it.')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
value: title || '',
onChange: titleValue => {
setAttributes({
title: titleValue
});
},
label: (0,external_wp_i18n_namespaceObject.__)('Title attribute'),
autoComplete: "off",
help: (0,external_wp_i18n_namespaceObject.__)('Additional information to help clarify the purpose of the link.')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
value: rel || '',
onChange: relValue => {
setAttributes({
rel: relValue
});
},
label: (0,external_wp_i18n_namespaceObject.__)('Rel attribute'),
autoComplete: "off",
help: (0,external_wp_i18n_namespaceObject.__)('The relationship of the linked URL as space-separated link types.')
}))), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(ParentElement, {
className: "wp-block-navigation-item__content"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
ref: ref,
identifier: "label",
className: "wp-block-navigation-item__label",
value: label,
onChange: labelValue => setAttributes({
label: labelValue
}),
onMerge: mergeBlocks,
onReplace: onReplace,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigation link text'),
placeholder: itemLabelPlaceholder,
withoutInteractiveFormatting: true,
allowedFormats: ['core/bold', 'core/italic', 'core/image', 'core/strikethrough'],
onClick: () => {
if (!openSubmenusOnClick && !url) {
setIsLinkOpen(true);
}
}
}), !openSubmenusOnClick && isLinkOpen && (0,external_React_namespaceObject.createElement)(LinkUI, {
clientId: clientId,
link: attributes,
onClose: () => setIsLinkOpen(false),
anchor: popoverAnchor,
hasCreateSuggestion: userCanCreate,
onRemove: () => {
setAttributes({
url: ''
});
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link removed.'), 'assertive');
},
onChange: updatedValue => {
updateAttributes(updatedValue, setAttributes, attributes);
}
})), (showSubmenuIcon || openSubmenusOnClick) && (0,external_React_namespaceObject.createElement)("span", {
className: "wp-block-navigation__submenu-icon"
}, (0,external_React_namespaceObject.createElement)(ItemSubmenuIcon, null)), (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-submenu/save.js
/**
* WordPress dependencies
*/
function navigation_submenu_save_save() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-submenu/transforms.js
/**
* WordPress dependencies
*/
const navigation_submenu_transforms_transforms = {
to: [{
type: 'block',
blocks: ['core/navigation-link'],
isMatch: (attributes, block) => block?.innerBlocks?.length === 0,
transform: attributes => (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link', attributes)
}, {
type: 'block',
blocks: ['core/spacer'],
isMatch: (attributes, block) => block?.innerBlocks?.length === 0,
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/spacer');
}
}, {
type: 'block',
blocks: ['core/site-logo'],
isMatch: (attributes, block) => block?.innerBlocks?.length === 0,
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/site-logo');
}
}, {
type: 'block',
blocks: ['core/home-link'],
isMatch: (attributes, block) => block?.innerBlocks?.length === 0,
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/home-link');
}
}, {
type: 'block',
blocks: ['core/social-links'],
isMatch: (attributes, block) => block?.innerBlocks?.length === 0,
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/social-links');
}
}, {
type: 'block',
blocks: ['core/search'],
isMatch: (attributes, block) => block?.innerBlocks?.length === 0,
transform: () => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/search');
}
}]
};
/* harmony default export */ const navigation_submenu_transforms = (navigation_submenu_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-submenu/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const navigation_submenu_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/navigation-submenu",
title: "Submenu",
category: "design",
parent: ["core/navigation"],
description: "Add a submenu to your navigation.",
textdomain: "default",
attributes: {
label: {
type: "string"
},
type: {
type: "string"
},
description: {
type: "string"
},
rel: {
type: "string"
},
id: {
type: "number"
},
opensInNewTab: {
type: "boolean",
"default": false
},
url: {
type: "string"
},
title: {
type: "string"
},
kind: {
type: "string"
},
isTopLevelItem: {
type: "boolean"
}
},
usesContext: ["textColor", "customTextColor", "backgroundColor", "customBackgroundColor", "overlayTextColor", "customOverlayTextColor", "overlayBackgroundColor", "customOverlayBackgroundColor", "fontSize", "customFontSize", "showSubmenuIcon", "maxNestingLevel", "openSubmenusOnClick", "style"],
supports: {
reusable: false,
html: false,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-navigation-submenu-editor",
style: "wp-block-navigation-submenu"
};
const {
name: navigation_submenu_name
} = navigation_submenu_metadata;
const navigation_submenu_settings = {
icon: ({
context
}) => {
if (context === 'list-view') {
return library_page;
}
return add_submenu;
},
__experimentalLabel(attributes, {
context
}) {
const {
label
} = attributes;
const customName = attributes?.metadata?.name;
// In the list view, use the block's menu label as the label.
// If the menu label is empty, fall back to the default label.
if (context === 'list-view' && (customName || label)) {
return attributes?.metadata?.name || label;
}
return label;
},
edit: NavigationSubmenuEdit,
save: navigation_submenu_save_save,
transforms: navigation_submenu_transforms
};
const navigation_submenu_init = () => initBlock({
name: navigation_submenu_name,
metadata: navigation_submenu_metadata,
settings: navigation_submenu_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page-break.js
/**
* WordPress dependencies
*/
const pageBreak = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.5 9V6a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v3H8V6a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v3h1.5Zm0 6.5V18a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2v-2.5H8V18a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-2.5h1.5ZM4 13h16v-1.5H4V13Z"
}));
/* harmony default export */ const page_break = (pageBreak);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/nextpage/edit.js
/**
* WordPress dependencies
*/
function NextPageEdit() {
return (0,external_React_namespaceObject.createElement)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)()
}, (0,external_React_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Page break')));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/nextpage/save.js
/**
* WordPress dependencies
*/
function nextpage_save_save() {
return (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, '<!--nextpage-->');
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/nextpage/transforms.js
/**
* WordPress dependencies
*/
const nextpage_transforms_transforms = {
from: [{
type: 'raw',
schema: {
'wp-block': {
attributes: ['data-block']
}
},
isMatch: node => node.dataset && node.dataset.block === 'core/nextpage',
transform() {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/nextpage', {});
}
}]
};
/* harmony default export */ const nextpage_transforms = (nextpage_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/nextpage/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const nextpage_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/nextpage",
title: "Page Break",
category: "design",
description: "Separate your content into a multi-page experience.",
keywords: ["next page", "pagination"],
parent: ["core/post-content"],
textdomain: "default",
supports: {
customClassName: false,
className: false,
html: false,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-nextpage-editor"
};
const {
name: nextpage_name
} = nextpage_metadata;
const nextpage_settings = {
icon: page_break,
example: {},
transforms: nextpage_transforms,
edit: NextPageEdit,
save: nextpage_save_save
};
const nextpage_init = () => initBlock({
name: nextpage_name,
metadata: nextpage_metadata,
settings: nextpage_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pattern/recursion-detector.js
/**
* THIS MODULE IS INTENTIONALLY KEPT WITHIN THE PATTERN BLOCK'S SOURCE.
*
* This is because this approach for preventing infinite loops due to
* recursively rendering blocks is specific to the way that the `core/pattern`
* block behaves in the editor. Any other block types that deal with recursion
* SHOULD USE THE STANDARD METHOD for avoiding loops:
*
* @see https://github.com/WordPress/gutenberg/pull/31455
* @see packages/block-editor/src/components/recursion-provider/README.md
*/
/**
* WordPress dependencies
*/
/**
* Naming is hard.
*
* @see useParsePatternDependencies
*
* @type {WeakMap<Object, Function>}
*/
const cachedParsers = new WeakMap();
/**
* Hook used by PatternEdit to parse block patterns. It returns a function that
* takes a pattern and returns nothing but throws an error if the pattern is
* recursive.
*
* @example
* ```js
* const parsePatternDependencies = useParsePatternDependencies();
* parsePatternDependencies( selectedPattern );
* ```
*
* @see parsePatternDependencies
*
* @return {Function} A function to parse block patterns.
*/
function useParsePatternDependencies() {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
// Instead of caching maps, go straight to the point and cache bound
// functions. Each of those functions is bound to a different Map that will
// keep track of patterns in the context of the given registry.
if (!cachedParsers.has(registry)) {
const deps = new Map();
cachedParsers.set(registry, parsePatternDependencies.bind(null, deps));
}
return cachedParsers.get(registry);
}
/**
* Parse a given pattern and traverse its contents to detect any subsequent
* patterns on which it may depend. Such occurrences will be added to an
* internal dependency graph. If a circular dependency is detected, an
* error will be thrown.
*
* EXPORTED FOR TESTING PURPOSES ONLY.
*
* @param {Map<string, Set<string>>} deps Map of pattern dependencies.
* @param {Object} pattern Pattern.
* @param {string} pattern.name Pattern name.
* @param {Array} pattern.blocks Pattern's block list.
*
* @throws {Error} If a circular dependency is detected.
*/
function parsePatternDependencies(deps, {
name,
blocks
}) {
const queue = [...blocks];
while (queue.length) {
const block = queue.shift();
for (const innerBlock of (_block$innerBlocks = block.innerBlocks) !== null && _block$innerBlocks !== void 0 ? _block$innerBlocks : []) {
var _block$innerBlocks;
queue.unshift(innerBlock);
}
if (block.name === 'core/pattern') {
registerDependency(deps, name, block.attributes.slug);
}
}
}
/**
* Declare that pattern `a` depends on pattern `b`. If a circular
* dependency is detected, an error will be thrown.
*
* EXPORTED FOR TESTING PURPOSES ONLY.
*
* @param {Map<string, Set<string>>} deps Map of pattern dependencies.
* @param {string} a Slug for pattern A.
* @param {string} b Slug for pattern B.
*
* @throws {Error} If a circular dependency is detected.
*/
function registerDependency(deps, a, b) {
if (!deps.has(a)) {
deps.set(a, new Set());
}
deps.get(a).add(b);
if (hasCycle(deps, a)) {
throw new TypeError(`Pattern ${a} has a circular dependency and cannot be rendered.`);
}
}
/**
* Determine if a given pattern has circular dependencies on other patterns.
* This will be determined by running a depth-first search on the current state
* of the graph represented by `patternDependencies`.
*
* @param {Map<string, Set<string>>} deps Map of pattern dependencies.
* @param {string} slug Pattern slug.
* @param {Set<string>} [visitedNodes] Set to track visited nodes in the graph.
* @param {Set<string>} [currentPath] Set to track and backtrack graph paths.
* @return {boolean} Whether any cycle was found.
*/
function hasCycle(deps, slug, visitedNodes = new Set(), currentPath = new Set()) {
var _deps$get;
visitedNodes.add(slug);
currentPath.add(slug);
const dependencies = (_deps$get = deps.get(slug)) !== null && _deps$get !== void 0 ? _deps$get : new Set();
for (const dependency of dependencies) {
if (!visitedNodes.has(dependency)) {
if (hasCycle(deps, dependency, visitedNodes, currentPath)) {
return true;
}
} else if (currentPath.has(dependency)) {
return true;
}
}
// Remove the current node from the current path when backtracking
currentPath.delete(slug);
return false;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pattern/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const PatternEdit = ({
attributes,
clientId
}) => {
const selectedPattern = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).__experimentalGetParsedPattern(attributes.slug), [attributes.slug]);
const currentThemeStylesheet = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.stylesheet, []);
const {
replaceBlocks,
setBlockEditingMode,
__unstableMarkNextChangeAsNotPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
getBlockRootClientId,
getBlockEditingMode
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const [hasRecursionError, setHasRecursionError] = (0,external_wp_element_namespaceObject.useState)(false);
const parsePatternDependencies = useParsePatternDependencies();
// Duplicated in packages/edit-site/src/components/start-template-options/index.js.
function injectThemeAttributeInBlockTemplateContent(block) {
if (block.innerBlocks.find(innerBlock => innerBlock.name === 'core/template-part')) {
block.innerBlocks = block.innerBlocks.map(innerBlock => {
if (innerBlock.name === 'core/template-part' && innerBlock.attributes.theme === undefined) {
innerBlock.attributes.theme = currentThemeStylesheet;
}
return innerBlock;
});
}
if (block.name === 'core/template-part' && block.attributes.theme === undefined) {
block.attributes.theme = currentThemeStylesheet;
}
return block;
}
// Run this effect when the component loads.
// This adds the Pattern's contents to the post.
// This change won't be saved.
// It will continue to pull from the pattern file unless changes are made to its respective template part.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!hasRecursionError && selectedPattern?.blocks) {
try {
parsePatternDependencies(selectedPattern);
} catch (error) {
setHasRecursionError(true);
return;
}
// We batch updates to block list settings to avoid triggering cascading renders
// for each container block included in a tree and optimize initial render.
// Since the above uses microtasks, we need to use a microtask here as well,
// because nested pattern blocks cannot be inserted if the parent block supports
// inner blocks but doesn't have blockSettings in the state.
window.queueMicrotask(() => {
const rootClientId = getBlockRootClientId(clientId);
// Clone blocks from the pattern before insertion to ensure they receive
// distinct client ids. See https://github.com/WordPress/gutenberg/issues/50628.
const clonedBlocks = selectedPattern.blocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(injectThemeAttributeInBlockTemplateContent(block)));
const rootEditingMode = getBlockEditingMode(rootClientId);
// Temporarily set the root block to default mode to allow replacing the pattern.
// This could happen when the page is disabling edits of non-content blocks.
__unstableMarkNextChangeAsNotPersistent();
setBlockEditingMode(rootClientId, 'default');
__unstableMarkNextChangeAsNotPersistent();
replaceBlocks(clientId, clonedBlocks);
// Restore the root block's original mode.
__unstableMarkNextChangeAsNotPersistent();
setBlockEditingMode(rootClientId, rootEditingMode);
});
}
}, [clientId, hasRecursionError, selectedPattern, __unstableMarkNextChangeAsNotPersistent, replaceBlocks, getBlockEditingMode, setBlockEditingMode, getBlockRootClientId]);
const props = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
if (hasRecursionError) {
return (0,external_React_namespaceObject.createElement)("div", {
...props
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: A warning in which %s is the name of a pattern.
(0,external_wp_i18n_namespaceObject.__)('Pattern "%s" cannot be rendered inside itself.'), selectedPattern?.name)));
}
return (0,external_React_namespaceObject.createElement)("div", {
...props
});
};
/* harmony default export */ const pattern_edit = (PatternEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pattern/index.js
/**
* Internal dependencies
*/
const pattern_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/pattern",
title: "Pattern placeholder",
category: "theme",
description: "Show a block pattern.",
supports: {
html: false,
inserter: false,
renaming: false,
interactivity: {
clientNavigation: true
}
},
textdomain: "default",
attributes: {
slug: {
type: "string"
}
}
};
const {
name: pattern_name
} = pattern_metadata;
const pattern_settings = {
edit: pattern_edit
};
const pattern_init = () => initBlock({
name: pattern_name,
metadata: pattern_metadata,
settings: pattern_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pages.js
/**
* WordPress dependencies
*/
const pages = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z"
}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z"
}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z"
}));
/* harmony default export */ const library_pages = (pages);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list/use-convert-to-navigation-links.js
/**
* WordPress dependencies
*/
/**
* Converts an array of pages into a nested array of navigation link blocks.
*
* @param {Array} pages An array of pages.
*
* @return {Array} A nested array of navigation link blocks.
*/
function createNavigationLinks(pages = []) {
const linkMap = {};
const navigationLinks = [];
pages.forEach(({
id,
title,
link: url,
type,
parent
}) => {
var _linkMap$id$innerBloc;
// See if a placeholder exists. This is created if children appear before parents in list.
const innerBlocks = (_linkMap$id$innerBloc = linkMap[id]?.innerBlocks) !== null && _linkMap$id$innerBloc !== void 0 ? _linkMap$id$innerBloc : [];
linkMap[id] = (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-link', {
id,
label: title.rendered,
url,
type,
kind: 'post-type'
}, innerBlocks);
if (!parent) {
navigationLinks.push(linkMap[id]);
} else {
if (!linkMap[parent]) {
// Use a placeholder if the child appears before parent in list.
linkMap[parent] = {
innerBlocks: []
};
}
// Although these variables are not referenced, they are needed to store the innerBlocks in memory.
const parentLinkInnerBlocks = linkMap[parent].innerBlocks;
parentLinkInnerBlocks.push(linkMap[id]);
}
});
return navigationLinks;
}
/**
* Finds a navigation link block by id, recursively.
* It might be possible to make this a more generic helper function.
*
* @param {Array} navigationLinks An array of navigation link blocks.
* @param {number} id The id of the navigation link to find.
*
* @return {Object|null} The navigation link block with the given id.
*/
function findNavigationLinkById(navigationLinks, id) {
for (const navigationLink of navigationLinks) {
// Is this the link we're looking for?
if (navigationLink.attributes.id === id) {
return navigationLink;
}
// If not does it have innerBlocks?
if (navigationLink.innerBlocks && navigationLink.innerBlocks.length) {
const foundNavigationLink = findNavigationLinkById(navigationLink.innerBlocks, id);
if (foundNavigationLink) {
return foundNavigationLink;
}
}
}
return null;
}
function convertToNavigationLinks(pages = [], parentPageID = null) {
let navigationLinks = createNavigationLinks(pages);
// If a parent page ID is provided, only return the children of that page.
if (parentPageID) {
const parentPage = findNavigationLinkById(navigationLinks, parentPageID);
if (parentPage && parentPage.innerBlocks) {
navigationLinks = parentPage.innerBlocks;
}
}
// Transform all links with innerBlocks into Submenus. This can't be done
// sooner because page objects have no information on their children.
const transformSubmenus = listOfLinks => {
listOfLinks.forEach((block, index, listOfLinksArray) => {
const {
attributes,
innerBlocks
} = block;
if (innerBlocks.length !== 0) {
transformSubmenus(innerBlocks);
const transformedBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/navigation-submenu', attributes, innerBlocks);
listOfLinksArray[index] = transformedBlock;
}
});
};
transformSubmenus(navigationLinks);
return navigationLinks;
}
function useConvertToNavigationLinks({
clientId,
pages,
parentClientId,
parentPageID
}) {
const {
replaceBlock,
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
return () => {
const navigationLinks = convertToNavigationLinks(pages, parentPageID);
// Replace the Page List block with the Navigation Links.
replaceBlock(clientId, navigationLinks);
// Select the Navigation block to reveal the changes.
selectBlock(parentClientId);
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list/convert-to-links-modal.js
/**
* WordPress dependencies
*/
const convertDescription = (0,external_wp_i18n_namespaceObject.__)("This navigation menu displays your website's pages. Editing it will enable you to add, delete, or reorder pages. However, new pages will no longer be added automatically.");
function ConvertToLinksModal({
onClick,
onClose,
disabled
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
onRequestClose: onClose,
title: (0,external_wp_i18n_namespaceObject.__)('Edit Page List'),
className: 'wp-block-page-list-modal',
aria: {
describedby: 'wp-block-page-list-modal__description'
}
}, (0,external_React_namespaceObject.createElement)("p", {
id: 'wp-block-page-list-modal__description'
}, convertDescription), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-page-list-modal-buttons"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: onClose
}, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
disabled: disabled,
onClick: onClick
}, (0,external_wp_i18n_namespaceObject.__)('Edit'))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// We only show the edit option when page count is <= MAX_PAGE_COUNT
// Performance of Navigation Links is not good past this value.
const MAX_PAGE_COUNT = 100;
const NOOP = () => {};
function BlockContent({
blockProps,
innerBlocksProps,
hasResolvedPages,
blockList,
pages,
parentPageID
}) {
if (!hasResolvedPages) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-page-list__loading-indicator-container"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, {
className: "wp-block-page-list__loading-indicator"
})));
}
if (pages === null) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
status: 'warning',
isDismissible: false
}, (0,external_wp_i18n_namespaceObject.__)('Page List: Cannot retrieve Pages.')));
}
if (pages.length === 0) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
status: 'info',
isDismissible: false
}, (0,external_wp_i18n_namespaceObject.__)('Page List: Cannot retrieve Pages.')));
}
if (blockList.length === 0) {
const parentPageDetails = pages.find(page => page.id === parentPageID);
if (parentPageDetails?.title?.rendered) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Page title.
(0,external_wp_i18n_namespaceObject.__)('Page List: "%s" page has no children.'), parentPageDetails.title.rendered)));
}
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
status: 'warning',
isDismissible: false
}, (0,external_wp_i18n_namespaceObject.__)('Page List: Cannot retrieve Pages.')));
}
if (pages.length > 0) {
return (0,external_React_namespaceObject.createElement)("ul", {
...innerBlocksProps
});
}
}
function PageListEdit({
context,
clientId,
attributes,
setAttributes
}) {
const {
parentPageID
} = attributes;
const [isOpen, setOpen] = (0,external_wp_element_namespaceObject.useState)(false);
const openModal = (0,external_wp_element_namespaceObject.useCallback)(() => setOpen(true), []);
const closeModal = () => setOpen(false);
const {
records: pages,
hasResolved: hasResolvedPages
} = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', 'page', {
per_page: MAX_PAGE_COUNT,
_fields: ['id', 'link', 'menu_order', 'parent', 'title', 'type'],
// TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby
// values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent
// sort.
orderby: 'menu_order',
order: 'asc'
});
const allowConvertToLinks = 'showSubmenuIcon' in context && pages?.length > 0 && pages?.length <= MAX_PAGE_COUNT;
const pagesByParentId = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (pages === null) {
return new Map();
}
// TODO: Once the REST API supports passing multiple values to
// 'orderby', this can be removed.
// https://core.trac.wordpress.org/ticket/39037
const sortedPages = pages.sort((a, b) => {
if (a.menu_order === b.menu_order) {
return a.title.rendered.localeCompare(b.title.rendered);
}
return a.menu_order - b.menu_order;
});
return sortedPages.reduce((accumulator, page) => {
const {
parent
} = page;
if (accumulator.has(parent)) {
accumulator.get(parent).push(page);
} else {
accumulator.set(parent, [page]);
}
return accumulator;
}, new Map());
}, [pages]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()('wp-block-page-list', {
'has-text-color': !!context.textColor,
[(0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', context.textColor)]: !!context.textColor,
'has-background': !!context.backgroundColor,
[(0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', context.backgroundColor)]: !!context.backgroundColor
}),
style: {
...context.style?.color
}
});
const pagesTree = (0,external_wp_element_namespaceObject.useMemo)(function makePagesTree(parentId = 0, level = 0) {
const childPages = pagesByParentId.get(parentId);
if (!childPages?.length) {
return [];
}
return childPages.reduce((tree, page) => {
const hasChildren = pagesByParentId.has(page.id);
const item = {
value: page.id,
label: '— '.repeat(level) + page.title.rendered,
rawName: page.title.rendered
};
tree.push(item);
if (hasChildren) {
tree.push(...makePagesTree(page.id, level + 1));
}
return tree;
}, []);
}, [pagesByParentId]);
const blockList = (0,external_wp_element_namespaceObject.useMemo)(function getBlockList(parentId = parentPageID) {
const childPages = pagesByParentId.get(parentId);
if (!childPages?.length) {
return [];
}
return childPages.reduce((template, page) => {
const hasChildren = pagesByParentId.has(page.id);
const pageProps = {
id: page.id,
label:
// translators: displayed when a page has an empty title.
page.title?.rendered?.trim() !== '' ? page.title?.rendered : (0,external_wp_i18n_namespaceObject.__)('(no title)'),
title: page.title?.rendered,
link: page.url,
hasChildren
};
let item = null;
const children = getBlockList(page.id);
item = (0,external_wp_blocks_namespaceObject.createBlock)('core/page-list-item', pageProps, children);
template.push(item);
return template;
}, []);
}, [pagesByParentId, parentPageID]);
const {
isNested,
hasSelectedChild,
parentClientId,
hasDraggedChild,
isChildOfNavigation
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockParentsByBlockName,
hasSelectedInnerBlock,
hasDraggedInnerBlock
} = select(external_wp_blockEditor_namespaceObject.store);
const blockParents = getBlockParentsByBlockName(clientId, 'core/navigation-submenu', true);
const navigationBlockParents = getBlockParentsByBlockName(clientId, 'core/navigation', true);
return {
isNested: blockParents.length > 0,
isChildOfNavigation: navigationBlockParents.length > 0,
hasSelectedChild: hasSelectedInnerBlock(clientId, true),
hasDraggedChild: hasDraggedInnerBlock(clientId, true),
parentClientId: navigationBlockParents[0]
};
}, [clientId]);
const convertToNavigationLinks = useConvertToNavigationLinks({
clientId,
pages,
parentClientId,
parentPageID
});
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
renderAppender: false,
__unstableDisableDropZone: true,
templateLock: isChildOfNavigation ? false : 'all',
onInput: NOOP,
onChange: NOOP,
value: blockList
});
const {
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (hasSelectedChild || hasDraggedChild) {
openModal();
selectBlock(parentClientId);
}
}, [hasSelectedChild, hasDraggedChild, parentClientId, selectBlock, openModal]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
setAttributes({
isNested
});
}, [isNested, setAttributes]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, pagesTree.length > 0 && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, {
__next40pxDefaultSize: true,
className: "editor-page-attributes__parent",
label: (0,external_wp_i18n_namespaceObject.__)('Parent'),
value: parentPageID,
options: pagesTree,
onChange: value => setAttributes({
parentPageID: value !== null && value !== void 0 ? value : 0
}),
help: (0,external_wp_i18n_namespaceObject.__)('Choose a page to show only its subpages.')
})), allowConvertToLinks && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Edit this menu')
}, (0,external_React_namespaceObject.createElement)("p", null, convertDescription), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
disabled: !hasResolvedPages,
onClick: convertToNavigationLinks
}, (0,external_wp_i18n_namespaceObject.__)('Edit')))), allowConvertToLinks && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
title: (0,external_wp_i18n_namespaceObject.__)('Edit'),
onClick: openModal
}, (0,external_wp_i18n_namespaceObject.__)('Edit'))), isOpen && (0,external_React_namespaceObject.createElement)(ConvertToLinksModal, {
onClick: convertToNavigationLinks,
onClose: closeModal,
disabled: !hasResolvedPages
})), (0,external_React_namespaceObject.createElement)(BlockContent, {
blockProps: blockProps,
innerBlocksProps: innerBlocksProps,
hasResolvedPages: hasResolvedPages,
blockList: blockList,
pages: pages,
parentPageID: parentPageID
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const page_list_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/page-list",
title: "Page List",
category: "widgets",
allowedBlocks: ["core/page-list-item"],
description: "Display a list of all pages.",
keywords: ["menu", "navigation"],
textdomain: "default",
attributes: {
parentPageID: {
type: "integer",
"default": 0
},
isNested: {
type: "boolean",
"default": false
}
},
usesContext: ["textColor", "customTextColor", "backgroundColor", "customBackgroundColor", "overlayTextColor", "customOverlayTextColor", "overlayBackgroundColor", "customOverlayBackgroundColor", "fontSize", "customFontSize", "showSubmenuIcon", "style", "openSubmenusOnClick"],
supports: {
reusable: false,
html: false,
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-page-list-editor",
style: "wp-block-page-list"
};
const {
name: page_list_name
} = page_list_metadata;
const page_list_settings = {
icon: library_pages,
example: {},
edit: PageListEdit
};
const page_list_init = () => initBlock({
name: page_list_name,
metadata: page_list_metadata,
settings: page_list_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/navigation-link/icons.js
/**
* WordPress dependencies
*/
const icons_ItemSubmenuIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
width: "12",
height: "12",
viewBox: "0 0 12 12",
fill: "none"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M1.50002 4L6.00002 8L10.5 4",
strokeWidth: "1.5"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list-item/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useFrontPageId() {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const canReadSettings = select(external_wp_coreData_namespaceObject.store).canUser('read', 'settings');
if (!canReadSettings) {
return undefined;
}
const site = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site');
return site?.show_on_front === 'page' && site?.page_on_front;
}, []);
}
function PageListItemEdit({
context,
attributes
}) {
const {
id,
label,
link,
hasChildren,
title
} = attributes;
const isNavigationChild = ('showSubmenuIcon' in context);
const frontPageId = useFrontPageId();
const innerBlocksColors = getColors(context, true);
const navigationChildBlockProps = getNavigationChildBlockProps(innerBlocksColors);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)(navigationChildBlockProps, {
className: 'wp-block-pages-list__item'
});
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps);
return (0,external_React_namespaceObject.createElement)("li", {
key: id,
className: classnames_default()('wp-block-pages-list__item', {
'has-child': hasChildren,
'wp-block-navigation-item': isNavigationChild,
'open-on-click': context.openSubmenusOnClick,
'open-on-hover-click': !context.openSubmenusOnClick && context.showSubmenuIcon,
'menu-item-home': id === frontPageId
})
}, hasChildren && context.openSubmenusOnClick ? (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("button", {
type: "button",
className: "wp-block-navigation-item__content wp-block-navigation-submenu__toggle",
"aria-expanded": "false"
}, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(label)), (0,external_React_namespaceObject.createElement)("span", {
className: "wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"
}, (0,external_React_namespaceObject.createElement)(icons_ItemSubmenuIcon, null))) : (0,external_React_namespaceObject.createElement)("a", {
className: classnames_default()('wp-block-pages-list__item__link', {
'wp-block-navigation-item__content': isNavigationChild
}),
href: link
}, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)), hasChildren && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !context.openSubmenusOnClick && context.showSubmenuIcon && (0,external_React_namespaceObject.createElement)("button", {
className: "wp-block-navigation-item__content wp-block-navigation-submenu__toggle wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon",
"aria-expanded": "false",
type: "button"
}, (0,external_React_namespaceObject.createElement)(icons_ItemSubmenuIcon, null)), (0,external_React_namespaceObject.createElement)("ul", {
...innerBlocksProps
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list-item/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const page_list_item_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/page-list-item",
title: "Page List Item",
category: "widgets",
parent: ["core/page-list"],
description: "Displays a page inside a list of all pages.",
keywords: ["page", "menu", "navigation"],
textdomain: "default",
attributes: {
id: {
type: "number"
},
label: {
type: "string"
},
title: {
type: "string"
},
link: {
type: "string"
},
hasChildren: {
type: "boolean"
}
},
usesContext: ["textColor", "customTextColor", "backgroundColor", "customBackgroundColor", "overlayTextColor", "customOverlayTextColor", "overlayBackgroundColor", "customOverlayBackgroundColor", "fontSize", "customFontSize", "showSubmenuIcon", "style", "openSubmenusOnClick"],
supports: {
reusable: false,
html: false,
lock: false,
inserter: false,
__experimentalToolbar: false,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-page-list-editor",
style: "wp-block-page-list"
};
const {
name: page_list_item_name
} = page_list_item_metadata;
const page_list_item_settings = {
__experimentalLabel: ({
label
}) => label,
icon: library_page,
example: {},
edit: PageListItemEdit
};
const page_list_item_init = () => initBlock({
name: page_list_item_name,
metadata: page_list_item_metadata,
settings: page_list_item_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/paragraph.js
/**
* WordPress dependencies
*/
const paragraph = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z"
}));
/* harmony default export */ const library_paragraph = (paragraph);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const deprecated_supports = {
className: false
};
const paragraph_deprecated_blockAttributes = {
align: {
type: 'string'
},
content: {
type: 'string',
source: 'html',
selector: 'p',
default: ''
},
dropCap: {
type: 'boolean',
default: false
},
placeholder: {
type: 'string'
},
textColor: {
type: 'string'
},
backgroundColor: {
type: 'string'
},
fontSize: {
type: 'string'
},
direction: {
type: 'string',
enum: ['ltr', 'rtl']
},
style: {
type: 'object'
}
};
const migrateCustomColorsAndFontSizes = attributes => {
if (!attributes.customTextColor && !attributes.customBackgroundColor && !attributes.customFontSize) {
return attributes;
}
const style = {};
if (attributes.customTextColor || attributes.customBackgroundColor) {
style.color = {};
}
if (attributes.customTextColor) {
style.color.text = attributes.customTextColor;
}
if (attributes.customBackgroundColor) {
style.color.background = attributes.customBackgroundColor;
}
if (attributes.customFontSize) {
style.typography = {
fontSize: attributes.customFontSize
};
}
const {
customTextColor,
customBackgroundColor,
customFontSize,
...restAttributes
} = attributes;
return {
...restAttributes,
style
};
};
const {
style,
...restBlockAttributes
} = paragraph_deprecated_blockAttributes;
const paragraph_deprecated_deprecated = [
// Version without drop cap on aligned text.
{
supports: deprecated_supports,
attributes: {
...restBlockAttributes,
customTextColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
customFontSize: {
type: 'number'
}
},
save({
attributes
}) {
const {
align,
content,
dropCap,
direction
} = attributes;
const className = classnames_default()({
'has-drop-cap': align === ((0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right') || align === 'center' ? false : dropCap,
[`has-text-align-${align}`]: align
});
return (0,external_React_namespaceObject.createElement)("p", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
dir: direction
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: content
}));
}
}, {
supports: deprecated_supports,
attributes: {
...restBlockAttributes,
customTextColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
customFontSize: {
type: 'number'
}
},
migrate: migrateCustomColorsAndFontSizes,
save({
attributes
}) {
const {
align,
content,
dropCap,
backgroundColor,
textColor,
customBackgroundColor,
customTextColor,
fontSize,
customFontSize,
direction
} = attributes;
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const fontSizeClass = (0,external_wp_blockEditor_namespaceObject.getFontSizeClass)(fontSize);
const className = classnames_default()({
'has-text-color': textColor || customTextColor,
'has-background': backgroundColor || customBackgroundColor,
'has-drop-cap': dropCap,
[`has-text-align-${align}`]: align,
[fontSizeClass]: fontSizeClass,
[textClass]: textClass,
[backgroundClass]: backgroundClass
});
const styles = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
color: textClass ? undefined : customTextColor,
fontSize: fontSizeClass ? undefined : customFontSize
};
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "p",
style: styles,
className: className ? className : undefined,
value: content,
dir: direction
});
}
}, {
supports: deprecated_supports,
attributes: {
...restBlockAttributes,
customTextColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
customFontSize: {
type: 'number'
}
},
migrate: migrateCustomColorsAndFontSizes,
save({
attributes
}) {
const {
align,
content,
dropCap,
backgroundColor,
textColor,
customBackgroundColor,
customTextColor,
fontSize,
customFontSize,
direction
} = attributes;
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const fontSizeClass = (0,external_wp_blockEditor_namespaceObject.getFontSizeClass)(fontSize);
const className = classnames_default()({
'has-text-color': textColor || customTextColor,
'has-background': backgroundColor || customBackgroundColor,
'has-drop-cap': dropCap,
[fontSizeClass]: fontSizeClass,
[textClass]: textClass,
[backgroundClass]: backgroundClass
});
const styles = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
color: textClass ? undefined : customTextColor,
fontSize: fontSizeClass ? undefined : customFontSize,
textAlign: align
};
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "p",
style: styles,
className: className ? className : undefined,
value: content,
dir: direction
});
}
}, {
supports: deprecated_supports,
attributes: {
...restBlockAttributes,
customTextColor: {
type: 'string'
},
customBackgroundColor: {
type: 'string'
},
customFontSize: {
type: 'number'
},
width: {
type: 'string'
}
},
migrate: migrateCustomColorsAndFontSizes,
save({
attributes
}) {
const {
width,
align,
content,
dropCap,
backgroundColor,
textColor,
customBackgroundColor,
customTextColor,
fontSize,
customFontSize
} = attributes;
const textClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const fontSizeClass = fontSize && `is-${fontSize}-text`;
const className = classnames_default()({
[`align${width}`]: width,
'has-background': backgroundColor || customBackgroundColor,
'has-drop-cap': dropCap,
[fontSizeClass]: fontSizeClass,
[textClass]: textClass,
[backgroundClass]: backgroundClass
});
const styles = {
backgroundColor: backgroundClass ? undefined : customBackgroundColor,
color: textClass ? undefined : customTextColor,
fontSize: fontSizeClass ? undefined : customFontSize,
textAlign: align
};
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "p",
style: styles,
className: className ? className : undefined,
value: content
});
}
}, {
supports: deprecated_supports,
attributes: {
...restBlockAttributes,
fontSize: {
type: 'number'
}
},
save({
attributes
}) {
const {
width,
align,
content,
dropCap,
backgroundColor,
textColor,
fontSize
} = attributes;
const className = classnames_default()({
[`align${width}`]: width,
'has-background': backgroundColor,
'has-drop-cap': dropCap
});
const styles = {
backgroundColor,
color: textColor,
fontSize,
textAlign: align
};
return (0,external_React_namespaceObject.createElement)("p", {
style: styles,
className: className ? className : undefined
}, content);
},
migrate(attributes) {
return migrateCustomColorsAndFontSizes({
...attributes,
customFontSize: Number.isFinite(attributes.fontSize) ? attributes.fontSize : undefined,
customTextColor: attributes.textColor && '#' === attributes.textColor[0] ? attributes.textColor : undefined,
customBackgroundColor: attributes.backgroundColor && '#' === attributes.backgroundColor[0] ? attributes.backgroundColor : undefined
});
}
}, {
supports: deprecated_supports,
attributes: {
...paragraph_deprecated_blockAttributes,
content: {
type: 'string',
source: 'html',
default: ''
}
},
save({
attributes
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, attributes.content);
},
migrate(attributes) {
return attributes;
}
}];
/* harmony default export */ const paragraph_deprecated = (paragraph_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-ltr.js
/**
* WordPress dependencies
*/
const formatLtr = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "-2 -2 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M5.52 2h7.43c.55 0 1 .45 1 1s-.45 1-1 1h-1v13c0 .55-.45 1-1 1s-1-.45-1-1V5c0-.55-.45-1-1-1s-1 .45-1 1v12c0 .55-.45 1-1 1s-1-.45-1-1v-5.96h-.43C3.02 11.04 1 9.02 1 6.52S3.02 2 5.52 2zM14 14l5-4-5-4v8z"
}));
/* harmony default export */ const format_ltr = (formatLtr);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/use-enter.js
/**
* WordPress dependencies
*/
function useOnEnter(props) {
const {
batch
} = (0,external_wp_data_namespaceObject.useRegistry)();
const {
moveBlocksToPosition,
replaceInnerBlocks,
duplicateBlocks,
insertBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
getBlockRootClientId,
getBlockIndex,
getBlockOrder,
getBlockName,
getBlock,
getNextBlockClientId,
canInsertBlockType
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.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;
}
if (event.keyCode !== external_wp_keycodes_namespaceObject.ENTER) {
return;
}
const {
content,
clientId
} = propsRef.current;
// The paragraph should be empty.
if (content.length) {
return;
}
const wrapperClientId = getBlockRootClientId(clientId);
if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(getBlockName(wrapperClientId), '__experimentalOnEnter', false)) {
return;
}
const order = getBlockOrder(wrapperClientId);
const position = order.indexOf(clientId);
// If it is the last block, exit.
if (position === order.length - 1) {
let newWrapperClientId = wrapperClientId;
while (!canInsertBlockType(getBlockName(clientId), getBlockRootClientId(newWrapperClientId))) {
newWrapperClientId = getBlockRootClientId(newWrapperClientId);
}
if (typeof newWrapperClientId === 'string') {
event.preventDefault();
moveBlocksToPosition([clientId], wrapperClientId, getBlockRootClientId(newWrapperClientId), getBlockIndex(newWrapperClientId) + 1);
}
return;
}
const defaultBlockName = (0,external_wp_blocks_namespaceObject.getDefaultBlockName)();
if (!canInsertBlockType(defaultBlockName, getBlockRootClientId(wrapperClientId))) {
return;
}
event.preventDefault();
// If it is in the middle, split the block in two.
const wrapperBlock = getBlock(wrapperClientId);
batch(() => {
duplicateBlocks([wrapperClientId]);
const blockIndex = getBlockIndex(wrapperClientId);
replaceInnerBlocks(wrapperClientId, wrapperBlock.innerBlocks.slice(0, position));
replaceInnerBlocks(getNextBlockClientId(wrapperClientId), wrapperBlock.innerBlocks.slice(position + 1));
insertBlock((0,external_wp_blocks_namespaceObject.createBlock)(defaultBlockName), blockIndex + 1, getBlockRootClientId(wrapperClientId), true);
});
}
element.addEventListener('keydown', onKeyDown);
return () => {
element.removeEventListener('keydown', onKeyDown);
};
}, []);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const edit_name = 'core/paragraph';
function ParagraphRTLControl({
direction,
setDirection
}) {
return (0,external_wp_i18n_namespaceObject.isRTL)() && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: format_ltr,
title: (0,external_wp_i18n_namespaceObject._x)('Left to right', 'editor button'),
isActive: direction === 'ltr',
onClick: () => {
setDirection(direction === 'ltr' ? undefined : 'ltr');
}
});
}
function hasDropCapDisabled(align) {
return align === ((0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right') || align === 'center';
}
function DropCapControl({
clientId,
attributes,
setAttributes
}) {
// Please do not add a useSelect call to the paragraph block unconditionally.
// Every useSelect added to a (frequently used) block will degrade load
// and type performance. By moving it within InspectorControls, the subscription is
// now only added for the selected block(s).
const [isDropCapFeatureEnabled] = (0,external_wp_blockEditor_namespaceObject.useSettings)('typography.dropCap');
if (!isDropCapFeatureEnabled) {
return null;
}
const {
align,
dropCap
} = attributes;
let helpText;
if (hasDropCapDisabled(align)) {
helpText = (0,external_wp_i18n_namespaceObject.__)('Not available for aligned text.');
} else if (dropCap) {
helpText = (0,external_wp_i18n_namespaceObject.__)('Showing large initial letter.');
} else {
helpText = (0,external_wp_i18n_namespaceObject.__)('Toggle to show a large initial letter.');
}
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!dropCap,
label: (0,external_wp_i18n_namespaceObject.__)('Drop cap'),
onDeselect: () => setAttributes({
dropCap: undefined
}),
resetAllFilter: () => ({
dropCap: undefined
}),
panelId: clientId
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Drop cap'),
checked: !!dropCap,
onChange: () => setAttributes({
dropCap: !dropCap
}),
help: helpText,
disabled: hasDropCapDisabled(align) ? true : false
}));
}
function ParagraphBlock({
attributes,
mergeBlocks,
onReplace,
onRemove,
setAttributes,
clientId
}) {
const {
align,
content,
direction,
dropCap,
placeholder
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
ref: useOnEnter({
clientId,
content
}),
className: classnames_default()({
'has-drop-cap': hasDropCapDisabled(align) ? false : dropCap,
[`has-text-align-${align}`]: align
}),
style: {
direction
}
});
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, blockEditingMode === 'default' && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: align,
onChange: newAlign => setAttributes({
align: newAlign,
dropCap: hasDropCapDisabled(newAlign) ? false : dropCap
})
}), (0,external_React_namespaceObject.createElement)(ParagraphRTLControl, {
direction: direction,
setDirection: newDirection => setAttributes({
direction: newDirection
})
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "typography"
}, (0,external_React_namespaceObject.createElement)(DropCapControl, {
clientId: clientId,
attributes: attributes,
setAttributes: setAttributes
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "content",
tagName: "p",
...blockProps,
value: content,
onChange: newContent => setAttributes({
content: newContent
}),
onSplit: (value, isOriginal) => {
let newAttributes;
if (isOriginal || value) {
newAttributes = {
...attributes,
content: value
};
}
const block = (0,external_wp_blocks_namespaceObject.createBlock)(edit_name, newAttributes);
if (isOriginal) {
block.clientId = clientId;
}
return block;
},
onMerge: mergeBlocks,
onReplace: onReplace,
onRemove: onRemove,
"aria-label": external_wp_blockEditor_namespaceObject.RichText.isEmpty(content) ? (0,external_wp_i18n_namespaceObject.__)('Empty block; start writing or type forward slash to choose a block') : (0,external_wp_i18n_namespaceObject.__)('Block: Paragraph'),
"data-empty": external_wp_blockEditor_namespaceObject.RichText.isEmpty(content),
placeholder: placeholder || (0,external_wp_i18n_namespaceObject.__)('Type / to choose a block'),
"data-custom-placeholder": placeholder ? true : undefined,
__unstableEmbedURLOnPaste: true,
__unstableAllowPrefixTransformations: true
}));
}
/* harmony default export */ const paragraph_edit = (ParagraphBlock);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function paragraph_save_save({
attributes
}) {
const {
align,
content,
dropCap,
direction
} = attributes;
const className = classnames_default()({
'has-drop-cap': align === ((0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right') || align === 'center' ? false : dropCap,
[`has-text-align-${align}`]: align
});
return (0,external_React_namespaceObject.createElement)("p", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
dir: direction
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: content
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/transforms.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
name: transforms_name
} = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/paragraph",
title: "Paragraph",
category: "text",
description: "Start with the basic building block of all narrative.",
keywords: ["text"],
textdomain: "default",
usesContext: ["postId"],
attributes: {
align: {
type: "string"
},
content: {
type: "rich-text",
source: "rich-text",
selector: "p",
__experimentalRole: "content"
},
dropCap: {
type: "boolean",
"default": false
},
placeholder: {
type: "string"
},
direction: {
type: "string",
"enum": ["ltr", "rtl"]
}
},
supports: {
anchor: true,
className: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalTextDecoration: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalWritingMode: true,
__experimentalDefaultControls: {
fontSize: true
}
},
__experimentalSelector: "p",
__unstablePasteTextInline: true,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-paragraph-editor",
style: "wp-block-paragraph"
};
const paragraph_transforms_transforms = {
from: [{
type: 'raw',
// Paragraph is a fallback and should be matched last.
priority: 20,
selector: 'p',
schema: ({
phrasingContentSchema,
isPaste
}) => ({
p: {
children: phrasingContentSchema,
attributes: isPaste ? [] : ['style', 'id']
}
}),
transform(node) {
const attributes = (0,external_wp_blocks_namespaceObject.getBlockAttributes)(transforms_name, node.outerHTML);
const {
textAlign
} = node.style || {};
if (textAlign === 'left' || textAlign === 'center' || textAlign === 'right') {
attributes.align = textAlign;
}
return (0,external_wp_blocks_namespaceObject.createBlock)(transforms_name, attributes);
}
}]
};
/* harmony default export */ const paragraph_transforms = (paragraph_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const paragraph_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/paragraph",
title: "Paragraph",
category: "text",
description: "Start with the basic building block of all narrative.",
keywords: ["text"],
textdomain: "default",
usesContext: ["postId"],
attributes: {
align: {
type: "string"
},
content: {
type: "rich-text",
source: "rich-text",
selector: "p",
__experimentalRole: "content"
},
dropCap: {
type: "boolean",
"default": false
},
placeholder: {
type: "string"
},
direction: {
type: "string",
"enum": ["ltr", "rtl"]
}
},
supports: {
anchor: true,
className: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalTextDecoration: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalWritingMode: true,
__experimentalDefaultControls: {
fontSize: true
}
},
__experimentalSelector: "p",
__unstablePasteTextInline: true,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-paragraph-editor",
style: "wp-block-paragraph"
};
const {
name: paragraph_name
} = paragraph_metadata;
const paragraph_settings = {
icon: library_paragraph,
example: {
attributes: {
content: (0,external_wp_i18n_namespaceObject.__)('In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.')
}
},
__experimentalLabel(attributes, {
context
}) {
const customName = attributes?.metadata?.name;
if (context === 'list-view' && customName) {
return customName;
}
if (context === 'accessibility') {
if (customName) {
return customName;
}
const {
content
} = attributes;
return !content || content.length === 0 ? (0,external_wp_i18n_namespaceObject.__)('Empty') : content;
}
},
transforms: paragraph_transforms,
deprecated: paragraph_deprecated,
merge(attributes, attributesToMerge) {
return {
content: (attributes.content || '') + (attributesToMerge.content || '')
};
},
edit: paragraph_edit,
save: paragraph_save_save
};
const paragraph_init = () => initBlock({
name: paragraph_name,
metadata: paragraph_metadata,
settings: paragraph_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-author.js
/**
* WordPress dependencies
*/
const postAuthor = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M10 4.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm2.25 7.5v-1A2.75 2.75 0 0011 8.25H7A2.75 2.75 0 004.25 11v1h1.5v-1c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v1h1.5zM4 20h9v-1.5H4V20zm16-4H4v-1.5h16V16z",
fillRule: "evenodd",
clipRule: "evenodd"
}));
/* harmony default export */ const post_author = (postAuthor);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const minimumUsersForCombobox = 25;
const edit_AUTHORS_QUERY = {
who: 'authors',
per_page: 100
};
function PostAuthorEdit({
isSelected,
context: {
postType,
postId,
queryId
},
attributes,
setAttributes
}) {
const isDescendentOfQueryLoop = Number.isFinite(queryId);
const {
authorId,
authorDetails,
authors
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditedEntityRecord,
getUser,
getUsers
} = select(external_wp_coreData_namespaceObject.store);
const _authorId = getEditedEntityRecord('postType', postType, postId)?.author;
return {
authorId: _authorId,
authorDetails: _authorId ? getUser(_authorId) : null,
authors: getUsers(edit_AUTHORS_QUERY)
};
}, [postType, postId]);
const {
editEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const {
textAlign,
showAvatar,
showBio,
byline,
isLink,
linkTarget
} = attributes;
const avatarSizes = [];
const authorName = authorDetails?.name || (0,external_wp_i18n_namespaceObject.__)('Post Author');
if (authorDetails?.avatar_urls) {
Object.keys(authorDetails.avatar_urls).forEach(size => {
avatarSizes.push({
value: size,
label: `${size} x ${size}`
});
});
}
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const authorOptions = authors?.length ? authors.map(({
id,
name
}) => {
return {
value: id,
label: name
};
}) : [];
const handleSelect = nextAuthorId => {
editEntityRecord('postType', postType, postId, {
author: nextAuthorId
});
};
const showCombobox = authorOptions.length >= minimumUsersForCombobox;
const showAuthorControl = !!postId && !isDescendentOfQueryLoop && authorOptions.length > 0;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, showAuthorControl && (showCombobox && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Author'),
options: authorOptions,
value: authorId,
onChange: handleSelect,
allowReset: false
}) || (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Author'),
value: authorId,
options: authorOptions,
onChange: handleSelect
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show avatar'),
checked: showAvatar,
onChange: () => setAttributes({
showAvatar: !showAvatar
})
}), showAvatar && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Avatar size'),
value: attributes.avatarSize,
options: avatarSizes,
onChange: size => {
setAttributes({
avatarSize: Number(size)
});
}
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show bio'),
checked: showBio,
onChange: () => setAttributes({
showBio: !showBio
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link author name to author page'),
checked: isLink,
onChange: () => setAttributes({
isLink: !isLink
})
}), isLink && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: linkTarget === '_blank'
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, showAvatar && authorDetails?.avatar_urls && (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-post-author__avatar"
}, (0,external_React_namespaceObject.createElement)("img", {
width: attributes.avatarSize,
src: authorDetails.avatar_urls[attributes.avatarSize],
alt: authorDetails.name
})), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-post-author__content"
}, (!external_wp_blockEditor_namespaceObject.RichText.isEmpty(byline) || isSelected) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
className: "wp-block-post-author__byline",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Post author byline text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write byline…'),
value: byline,
onChange: value => setAttributes({
byline: value
})
}), (0,external_React_namespaceObject.createElement)("p", {
className: "wp-block-post-author__name"
}, isLink ? (0,external_React_namespaceObject.createElement)("a", {
href: "#post-author-pseudo-link",
onClick: event => event.preventDefault()
}, authorName) : authorName), showBio && (0,external_React_namespaceObject.createElement)("p", {
className: "wp-block-post-author__bio",
dangerouslySetInnerHTML: {
__html: authorDetails?.description
}
}))));
}
/* harmony default export */ const post_author_edit = (PostAuthorEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_author_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-author",
title: "Author",
category: "theme",
description: "Display post author details such as name, avatar, and bio.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
},
avatarSize: {
type: "number",
"default": 48
},
showAvatar: {
type: "boolean",
"default": true
},
showBio: {
type: "boolean"
},
byline: {
type: "string"
},
isLink: {
type: "boolean",
"default": false
},
linkTarget: {
type: "string",
"default": "_self"
}
},
usesContext: ["postType", "postId", "queryId"],
supports: {
html: false,
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
color: {
gradients: true,
link: true,
__experimentalDuotone: ".wp-block-post-author__avatar img",
__experimentalDefaultControls: {
background: true,
text: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-post-author"
};
const {
name: post_author_name
} = post_author_metadata;
const post_author_settings = {
icon: post_author,
edit: post_author_edit
};
const post_author_init = () => initBlock({
name: post_author_name,
metadata: post_author_metadata,
settings: post_author_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author-name/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostAuthorNameEdit({
context: {
postType,
postId
},
attributes: {
textAlign,
isLink,
linkTarget
},
setAttributes
}) {
const {
authorName
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditedEntityRecord,
getUser
} = select(external_wp_coreData_namespaceObject.store);
const _authorId = getEditedEntityRecord('postType', postType, postId)?.author;
return {
authorName: _authorId ? getUser(_authorId) : null
};
}, [postType, postId]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const displayName = authorName?.name || (0,external_wp_i18n_namespaceObject.__)('Author Name');
const displayAuthor = isLink ? (0,external_React_namespaceObject.createElement)("a", {
href: "#author-pseudo-link",
onClick: event => event.preventDefault(),
className: "wp-block-post-author-name__link"
}, displayName) : displayName;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link to author archive'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
}), isLink && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: linkTarget === '_blank'
}))), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, " ", displayAuthor, " "));
}
/* harmony default export */ const post_author_name_edit = (PostAuthorNameEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author-name/transforms.js
/**
* WordPress dependencies
*/
const post_author_name_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/post-author'],
transform: ({
textAlign
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/post-author-name', {
textAlign
})
}],
to: [{
type: 'block',
blocks: ['core/post-author'],
transform: ({
textAlign
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/post-author', {
textAlign
})
}]
};
/* harmony default export */ const post_author_name_transforms = (post_author_name_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author-name/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_author_name_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-author-name",
title: "Author Name",
category: "theme",
description: "The author name.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
},
isLink: {
type: "boolean",
"default": false
},
linkTarget: {
type: "string",
"default": "_self"
}
},
usesContext: ["postType", "postId"],
supports: {
html: false,
spacing: {
margin: true,
padding: true
},
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: post_author_name_name
} = post_author_name_metadata;
const post_author_name_settings = {
icon: post_author,
transforms: post_author_name_transforms,
edit: post_author_name_edit
};
const post_author_name_init = () => initBlock({
name: post_author_name_name,
metadata: post_author_name_metadata,
settings: post_author_name_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author-biography/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostAuthorBiographyEdit({
context: {
postType,
postId
},
attributes: {
textAlign
},
setAttributes
}) {
const {
authorDetails
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditedEntityRecord,
getUser
} = select(external_wp_coreData_namespaceObject.store);
const _authorId = getEditedEntityRecord('postType', postType, postId)?.author;
return {
authorDetails: _authorId ? getUser(_authorId) : null
};
}, [postType, postId]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const displayAuthorBiography = authorDetails?.description || (0,external_wp_i18n_namespaceObject.__)('Author Biography');
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps,
dangerouslySetInnerHTML: {
__html: displayAuthorBiography
}
}));
}
/* harmony default export */ const post_author_biography_edit = (PostAuthorBiographyEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-author-biography/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_author_biography_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-author-biography",
title: "Author Biography",
category: "theme",
description: "The author biography.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
}
},
usesContext: ["postType", "postId"],
supports: {
spacing: {
margin: true,
padding: true
},
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: post_author_biography_name
} = post_author_biography_metadata;
const post_author_biography_settings = {
icon: post_author,
edit: post_author_biography_edit
};
const post_author_biography_init = () => initBlock({
name: post_author_biography_name,
metadata: post_author_biography_metadata,
settings: post_author_biography_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js
/**
* WordPress dependencies
*/
const blockDefault = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_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 */ const block_default = (blockDefault);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comment/edit.js
/**
* WordPress dependencies
*/
const post_comment_edit_TEMPLATE = [['core/avatar'], ['core/comment-author-name'], ['core/comment-date'], ['core/comment-content'], ['core/comment-reply-link'], ['core/comment-edit-link']];
function post_comment_edit_Edit({
attributes: {
commentId
},
setAttributes
}) {
const [commentIdInput, setCommentIdInput] = (0,external_wp_element_namespaceObject.useState)(commentId);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: post_comment_edit_TEMPLATE
});
if (!commentId) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
icon: block_default,
label: (0,external_wp_i18n_namespaceObject._x)('Post Comment', 'block title'),
instructions: (0,external_wp_i18n_namespaceObject.__)('To show a comment, input the comment ID.')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
value: commentId,
onChange: val => setCommentIdInput(parseInt(val))
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: () => {
setAttributes({
commentId: commentIdInput
});
}
}, (0,external_wp_i18n_namespaceObject.__)('Save'))));
}
return (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comment/save.js
/**
* WordPress dependencies
*/
function post_comment_save_save() {
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save();
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
return (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comment/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_comment_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: "fse",
name: "core/post-comment",
title: "Comment (deprecated)",
category: "theme",
allowedBlocks: ["core/avatar", "core/comment-author-name", "core/comment-content", "core/comment-date", "core/comment-edit-link", "core/comment-reply-link"],
description: "This block is deprecated. Please use the Comments block instead.",
textdomain: "default",
attributes: {
commentId: {
type: "number"
}
},
providesContext: {
commentId: "commentId"
},
supports: {
html: false,
inserter: false,
interactivity: {
clientNavigation: true
}
}
};
const {
name: post_comment_name
} = post_comment_metadata;
const post_comment_settings = {
icon: library_comment,
edit: post_comment_edit_Edit,
save: post_comment_save_save
};
const post_comment_init = () => initBlock({
name: post_comment_name,
metadata: post_comment_metadata,
settings: post_comment_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-comments-count.js
/**
* WordPress dependencies
*/
const postCommentsCount = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13 8H4v1.5h9V8zM4 4v1.5h16V4H4zm9 8H5c-.6 0-1 .4-1 1v8.3c0 .3.2.7.6.8.1.1.2.1.3.1.2 0 .5-.1.6-.3l1.8-1.8H13c.6 0 1-.4 1-1V13c0-.6-.4-1-1-1zm-2.2 6.6H7l1.6-2.2c.3-.4.5-.7.6-.9.1-.2.2-.4.2-.5 0-.2-.1-.3-.1-.4-.1-.1-.2-.1-.4-.1s-.4 0-.6.1c-.3.1-.5.3-.7.4l-.2.2-.2-1.2.1-.1c.3-.2.5-.3.8-.4.3-.1.6-.1.9-.1.3 0 .6.1.9.2.2.1.4.3.6.5.1.2.2.5.2.7 0 .3-.1.6-.2.9-.1.3-.4.7-.7 1.1l-.5.6h1.6v1.2z"
}));
/* harmony default export */ const post_comments_count = (postCommentsCount);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comments-count/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostCommentsCountEdit({
attributes,
context,
setAttributes
}) {
const {
textAlign
} = attributes;
const {
postId
} = context;
const [commentsCount, setCommentsCount] = (0,external_wp_element_namespaceObject.useState)();
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!postId) {
return;
}
const currentPostId = postId;
external_wp_apiFetch_default()({
path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/comments', {
post: postId
}),
parse: false
}).then(res => {
// Stale requests will have the `currentPostId` of an older closure.
if (currentPostId === postId) {
setCommentsCount(res.headers.get('X-WP-Total'));
}
});
}, [postId]);
const hasPostAndComments = postId && commentsCount !== undefined;
const blockStyles = {
...blockProps.style,
textDecoration: hasPostAndComments ? blockProps.style?.textDecoration : undefined
};
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps,
style: blockStyles
}, hasPostAndComments ? commentsCount : (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Post Comments Count block: post not found.'))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comments-count/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_comments_count_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: "fse",
name: "core/post-comments-count",
title: "Comments Count",
category: "theme",
description: "Display a post's comments count.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
}
},
usesContext: ["postId"],
supports: {
html: false,
color: {
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: post_comments_count_name
} = post_comments_count_metadata;
const post_comments_count_settings = {
icon: post_comments_count,
edit: PostCommentsCountEdit
};
const post_comments_count_init = () => initBlock({
name: post_comments_count_name,
metadata: post_comments_count_metadata,
settings: post_comments_count_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-comments-form.js
/**
* WordPress dependencies
*/
const postCommentsForm = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13 8H4v1.5h9V8zM4 4v1.5h16V4H4zm9 8H5c-.6 0-1 .4-1 1v8.3c0 .3.2.7.6.8.1.1.2.1.3.1.2 0 .5-.1.6-.3l1.8-1.8H13c.6 0 1-.4 1-1V13c0-.6-.4-1-1-1zm-.5 6.6H6.7l-1.2 1.2v-6.3h7v5.1z"
}));
/* harmony default export */ const post_comments_form = (postCommentsForm);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comments-form/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PostCommentsFormEdit({
attributes,
context,
setAttributes
}) {
const {
textAlign
} = attributes;
const {
postId,
postType
} = context;
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostCommentsFormEdit);
const instanceIdDesc = (0,external_wp_i18n_namespaceObject.sprintf)('comments-form-edit-%d-desc', instanceId);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
}),
'aria-describedby': instanceIdDesc
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(post_comments_form_form, {
postId: postId,
postType: postType
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
id: instanceIdDesc
}, (0,external_wp_i18n_namespaceObject.__)('Comments form disabled in editor.'))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comments-form/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_comments_form_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-comments-form",
title: "Comments Form",
category: "theme",
description: "Display a post's comments form.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
}
},
usesContext: ["postId", "postType"],
supports: {
html: false,
color: {
gradients: true,
heading: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalDefaultControls: {
fontSize: true
}
}
},
editorStyle: "wp-block-post-comments-form-editor",
style: ["wp-block-post-comments-form", "wp-block-buttons", "wp-block-button"]
};
const {
name: post_comments_form_name
} = post_comments_form_metadata;
const post_comments_form_settings = {
icon: post_comments_form,
edit: PostCommentsFormEdit
};
const post_comments_form_init = () => initBlock({
name: post_comments_form_name,
metadata: post_comments_form_metadata,
settings: post_comments_form_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comments-link/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostCommentsLinkEdit({
context,
attributes,
setAttributes
}) {
const {
textAlign
} = attributes;
const {
postType,
postId
} = context;
const [commentsCount, setCommentsCount] = (0,external_wp_element_namespaceObject.useState)();
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!postId) {
return;
}
const currentPostId = postId;
external_wp_apiFetch_default()({
path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/comments', {
post: postId
}),
parse: false
}).then(res => {
// Stale requests will have the `currentPostId` of an older closure.
if (currentPostId === postId) {
setCommentsCount(res.headers.get('X-WP-Total'));
}
});
}, [postId]);
const post = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId), [postType, postId]);
if (!post) {
return null;
}
const {
link
} = post;
let commentsText;
if (commentsCount !== undefined) {
const commentsNumber = parseInt(commentsCount);
if (commentsNumber === 0) {
commentsText = (0,external_wp_i18n_namespaceObject.__)('No comments');
} else {
commentsText = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Number of comments */
(0,external_wp_i18n_namespaceObject._n)('%s comment', '%s comments', commentsNumber), commentsNumber.toLocaleString());
}
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, link && commentsText !== undefined ? (0,external_React_namespaceObject.createElement)("a", {
href: link + '#comments',
onClick: event => event.preventDefault()
}, commentsText) : (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Post Comments Link block: post not found.'))));
}
/* harmony default export */ const post_comments_link_edit = (PostCommentsLinkEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-comments-link/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_comments_link_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: "fse",
name: "core/post-comments-link",
title: "Comments Link",
category: "theme",
description: "Displays the link to the current post comments.",
textdomain: "default",
usesContext: ["postType", "postId"],
attributes: {
textAlign: {
type: "string"
}
},
supports: {
html: false,
color: {
link: true,
text: false,
__experimentalDefaultControls: {
background: true,
link: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: post_comments_link_name
} = post_comments_link_metadata;
const post_comments_link_settings = {
edit: post_comments_link_edit,
icon: post_comments_count
};
const post_comments_link_init = () => initBlock({
name: post_comments_link_name,
metadata: post_comments_link_metadata,
settings: post_comments_link_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-content.js
/**
* WordPress dependencies
*/
const postContent = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 6h12V4.5H4V6Zm16 4.5H4V9h16v1.5ZM4 15h16v-1.5H4V15Zm0 4.5h16V18H4v1.5Z"
}));
/* harmony default export */ const post_content = (postContent);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/utils/hooks.js
/**
* WordPress dependencies
*/
/**
* Returns whether the current user can edit the given entity.
*
* @param {string} kind Entity kind.
* @param {string} name Entity name.
* @param {string} recordId Record's id.
*/
function useCanEditEntity(kind, name, recordId) {
return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).canUserEditEntityRecord(kind, name, recordId), [kind, name, recordId]);
}
/* harmony default export */ const hooks = ({
useCanEditEntity
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-content/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ReadOnlyContent({
layoutClassNames,
userCanEdit,
postType,
postId
}) {
const [,, content] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'content', postId);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: layoutClassNames
});
return content?.protected && !userCanEdit ? (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('This content is password protected.'))) : (0,external_React_namespaceObject.createElement)("div", {
...blockProps,
dangerouslySetInnerHTML: {
__html: content?.rendered
}
});
}
function EditableContent({
context = {}
}) {
const {
postType,
postId
} = context;
const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', postType, {
id: postId
});
const entityRecord = (0,external_wp_data_namespaceObject.useSelect)(select => {
return select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType, postId);
}, [postType, postId]);
const hasInnerBlocks = !!entityRecord?.content?.raw || blocks?.length;
const initialInnerBlocks = [['core/paragraph']];
const props = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)((0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: 'entry-content'
}), {
value: blocks,
onInput,
onChange,
template: !hasInnerBlocks ? initialInnerBlocks : undefined
});
return (0,external_React_namespaceObject.createElement)("div", {
...props
});
}
function Content(props) {
const {
context: {
queryId,
postType,
postId
} = {},
layoutClassNames
} = props;
const userCanEdit = useCanEditEntity('postType', postType, postId);
if (userCanEdit === undefined) {
return null;
}
const isDescendentOfQueryLoop = Number.isFinite(queryId);
const isEditable = userCanEdit && !isDescendentOfQueryLoop;
return isEditable ? (0,external_React_namespaceObject.createElement)(EditableContent, {
...props
}) : (0,external_React_namespaceObject.createElement)(ReadOnlyContent, {
layoutClassNames: layoutClassNames,
userCanEdit: userCanEdit,
postType: postType,
postId: postId
});
}
function edit_Placeholder({
layoutClassNames
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: layoutClassNames
});
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('This is the Content block, it will display all the blocks in any single post or page.')), (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('That might be a simple arrangement like consecutive paragraphs in a blog post, or a more elaborate composition that includes image galleries, videos, tables, columns, and any other block types.')), (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('If there are any Custom Post Types registered at your site, the Content block can display the contents of those entries as well.')));
}
function RecursionError() {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Block cannot be rendered inside itself.')));
}
function PostContentEdit({
context,
__unstableLayoutClassNames: layoutClassNames
}) {
const {
postId: contextPostId,
postType: contextPostType
} = context;
const hasAlreadyRendered = (0,external_wp_blockEditor_namespaceObject.useHasRecursion)(contextPostId);
if (contextPostId && contextPostType && hasAlreadyRendered) {
return (0,external_React_namespaceObject.createElement)(RecursionError, null);
}
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RecursionProvider, {
uniqueId: contextPostId
}, contextPostId && contextPostType ? (0,external_React_namespaceObject.createElement)(Content, {
context: context,
layoutClassNames: layoutClassNames
}) : (0,external_React_namespaceObject.createElement)(edit_Placeholder, {
layoutClassNames: layoutClassNames
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-content/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_content_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-content",
title: "Content",
category: "theme",
description: "Displays the contents of a post or page.",
textdomain: "default",
usesContext: ["postId", "postType", "queryId"],
supports: {
align: ["wide", "full"],
html: false,
layout: true,
dimensions: {
minHeight: true
},
spacing: {
blockGap: true
},
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: false,
text: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
}
},
editorStyle: "wp-block-post-content-editor"
};
const {
name: post_content_name
} = post_content_metadata;
const post_content_settings = {
icon: post_content,
edit: PostContentEdit
};
const post_content_init = () => initBlock({
name: post_content_name,
metadata: post_content_metadata,
settings: post_content_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-date/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostDateEdit({
attributes: {
textAlign,
format,
isLink,
displayType
},
context: {
postId,
postType: postTypeSlug,
queryId
},
setAttributes
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign,
[`wp-block-post-date__modified-date`]: displayType === 'modified'
})
});
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
// Memoize popoverProps to avoid returning a new object every time.
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
anchor: popoverAnchor
}), [popoverAnchor]);
const isDescendentOfQueryLoop = Number.isFinite(queryId);
const dateSettings = (0,external_wp_date_namespaceObject.getSettings)();
const [siteFormat = dateSettings.formats.date] = (0,external_wp_coreData_namespaceObject.useEntityProp)('root', 'site', 'date_format');
const [siteTimeFormat = dateSettings.formats.time] = (0,external_wp_coreData_namespaceObject.useEntityProp)('root', 'site', 'time_format');
const [date, setDate] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postTypeSlug, displayType, postId);
const postType = (0,external_wp_data_namespaceObject.useSelect)(select => postTypeSlug ? select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug) : null, [postTypeSlug]);
const dateLabel = displayType === 'date' ? (0,external_wp_i18n_namespaceObject.__)('Post Date') : (0,external_wp_i18n_namespaceObject.__)('Post Modified Date');
let postDate = date ? (0,external_React_namespaceObject.createElement)("time", {
dateTime: (0,external_wp_date_namespaceObject.dateI18n)('c', date),
ref: setPopoverAnchor
}, (0,external_wp_date_namespaceObject.dateI18n)(format || siteFormat, date)) : dateLabel;
if (isLink && date) {
postDate = (0,external_React_namespaceObject.createElement)("a", {
href: "#post-date-pseudo-link",
onClick: event => event.preventDefault()
}, postDate);
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
}), date && displayType === 'date' && !isDescendentOfQueryLoop && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: popoverProps,
renderContent: ({
onClose
}) => (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPublishDateTimePicker, {
currentDate: date,
onChange: setDate,
is12Hour: is12HourFormat(siteTimeFormat),
onClose: onClose
}),
renderToggle: ({
isOpen,
onToggle
}) => {
const openOnArrowDown = event => {
if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
event.preventDefault();
onToggle();
}
};
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
"aria-expanded": isOpen,
icon: library_edit,
title: (0,external_wp_i18n_namespaceObject.__)('Change Date'),
onClick: onToggle,
onKeyDown: openOnArrowDown
});
}
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalDateFormatPicker, {
format: format,
defaultFormat: siteFormat,
onChange: nextFormat => setAttributes({
format: nextFormat
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: postType?.labels.singular_name ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Name of the post type e.g: "post".
(0,external_wp_i18n_namespaceObject.__)('Link to %s'), postType.labels.singular_name.toLowerCase()) : (0,external_wp_i18n_namespaceObject.__)('Link to post'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display last modified date'),
onChange: value => setAttributes({
displayType: value ? 'modified' : 'date'
}),
checked: displayType === 'modified',
help: (0,external_wp_i18n_namespaceObject.__)('Only shows if the post has been modified')
}))), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, postDate));
}
function is12HourFormat(format) {
// To know if the time format is a 12 hour time, look for any of the 12 hour
// format characters: 'a', 'A', 'g', and 'h'. The character must be
// unescaped, i.e. not preceded by a '\'. Coincidentally, 'aAgh' is how I
// feel when working with regular expressions.
// https://www.php.net/manual/en/datetime.format.php
return /(?:^|[^\\])[aAgh]/.test(format);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-date/deprecated.js
/**
* Internal dependencies
*/
const post_date_deprecated_v1 = {
attributes: {
textAlign: {
type: 'string'
},
format: {
type: 'string'
},
isLink: {
type: 'boolean',
default: false
}
},
supports: {
html: false,
color: {
gradients: true,
link: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalLetterSpacing: true
}
},
save() {
return null;
},
migrate: migrate_font_family,
isEligible({
style
}) {
return style?.typography?.fontFamily;
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const post_date_deprecated = ([post_date_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-date/variations.js
/**
* WordPress dependencies
*/
const post_date_variations_variations = [{
name: 'post-date-modified',
title: (0,external_wp_i18n_namespaceObject.__)('Modified Date'),
description: (0,external_wp_i18n_namespaceObject.__)("Display a post's last updated date."),
attributes: {
displayType: 'modified'
},
scope: ['block', 'inserter'],
isActive: blockAttributes => blockAttributes.displayType === 'modified',
icon: post_date
}];
/* harmony default export */ const post_date_variations = (post_date_variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-date/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_date_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-date",
title: "Date",
category: "theme",
description: "Display the publish date for an entry such as a post or page.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
},
format: {
type: "string"
},
isLink: {
type: "boolean",
"default": false
},
displayType: {
type: "string",
"default": "date"
}
},
usesContext: ["postId", "postType", "queryId"],
supports: {
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: post_date_name
} = post_date_metadata;
const post_date_settings = {
icon: post_date,
edit: PostDateEdit,
deprecated: post_date_deprecated,
variations: post_date_variations
};
const post_date_init = () => initBlock({
name: post_date_name,
metadata: post_date_metadata,
settings: post_date_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-excerpt.js
/**
* WordPress dependencies
*/
const postExcerpt = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M8.001 3.984V9.47c0 1.518-.98 2.5-2.499 2.5h-.5v-1.5h.5c.69 0 1-.31 1-1V6.984H4v-3h4.001ZM4 20h9v-1.5H4V20Zm16-4H4v-1.5h16V16ZM13.001 3.984V9.47c0 1.518-.98 2.5-2.499 2.5h-.5v-1.5h.5c.69 0 1-.31 1-1V6.984H9v-3h4.001Z"
}));
/* harmony default export */ const post_excerpt = (postExcerpt);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-excerpt/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ELLIPSIS = '…';
function PostExcerptEditor({
attributes: {
textAlign,
moreText,
showMoreOnNewLine,
excerptLength
},
setAttributes,
isSelected,
context: {
postId,
postType,
queryId
}
}) {
const isDescendentOfQueryLoop = Number.isFinite(queryId);
const userCanEdit = useCanEditEntity('postType', postType, postId);
const [rawExcerpt, setExcerpt, {
rendered: renderedExcerpt,
protected: isProtected
} = {}] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'excerpt', postId);
/**
* Check if the post type supports excerpts.
* Add an exception and return early for the "page" post type,
* which is registered without support for the excerpt UI,
* but supports saving the excerpt to the database.
* See: https://core.trac.wordpress.org/browser/branches/6.1/src/wp-includes/post.php#L65
* Without this exception, users that have excerpts saved to the database will
* not be able to edit the excerpts.
*/
const postTypeSupportsExcerpts = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (postType === 'page') {
return true;
}
return !!select(external_wp_coreData_namespaceObject.store).getPostType(postType)?.supports?.excerpt;
}, [postType]);
/**
* The excerpt is editable if:
* - The user can edit the post
* - It is not a descendent of a Query Loop block
* - The post type supports excerpts
*/
const isEditable = userCanEdit && !isDescendentOfQueryLoop && postTypeSupportsExcerpts;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
/**
* translators: If your word count is based on single characters (e.g. East Asian characters),
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
* Do not translate into your own language.
*/
const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!');
/**
* When excerpt is editable, strip the html tags from
* rendered excerpt. This will be used if the entity's
* excerpt has been produced from the content.
*/
const strippedRenderedExcerpt = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!renderedExcerpt) return '';
const document = new window.DOMParser().parseFromString(renderedExcerpt, 'text/html');
return document.body.textContent || document.body.innerText || '';
}, [renderedExcerpt]);
if (!postType || !postId) {
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentToolbar, {
value: textAlign,
onChange: newAlign => setAttributes({
textAlign: newAlign
})
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('This block will display the excerpt.'))));
}
if (isProtected && !userCanEdit) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('The content is currently protected and does not have the available excerpt.')));
}
const readMoreLink = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
className: "wp-block-post-excerpt__more-link",
tagName: "a",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('“Read more” link text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Add "read more" link text'),
value: moreText,
onChange: newMoreText => setAttributes({
moreText: newMoreText
}),
withoutInteractiveFormatting: true
});
const excerptClassName = classnames_default()('wp-block-post-excerpt__excerpt', {
'is-inline': !showMoreOnNewLine
});
/**
* The excerpt length setting needs to be applied to both
* the raw and the rendered excerpt depending on which is being used.
*/
const rawOrRenderedExcerpt = (rawExcerpt || strippedRenderedExcerpt).trim();
let trimmedExcerpt = '';
if (wordCountType === 'words') {
trimmedExcerpt = rawOrRenderedExcerpt.split(' ', excerptLength).join(' ');
} else if (wordCountType === 'characters_excluding_spaces') {
/*
* 1. Split the excerpt at the character limit,
* then join the substrings back into one string.
* 2. Count the number of spaces in the excerpt
* by comparing the lengths of the string with and without spaces.
* 3. Add the number to the length of the visible excerpt,
* so that the spaces are excluded from the word count.
*/
const excerptWithSpaces = rawOrRenderedExcerpt.split('', excerptLength).join('');
const numberOfSpaces = excerptWithSpaces.length - excerptWithSpaces.replaceAll(' ', '').length;
trimmedExcerpt = rawOrRenderedExcerpt.split('', excerptLength + numberOfSpaces).join('');
} else if (wordCountType === 'characters_including_spaces') {
trimmedExcerpt = rawOrRenderedExcerpt.split('', excerptLength).join('');
}
const isTrimmed = trimmedExcerpt !== rawOrRenderedExcerpt;
const excerptContent = isEditable ? (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
className: excerptClassName,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Excerpt text'),
value: isSelected ? rawOrRenderedExcerpt : (!isTrimmed ? rawOrRenderedExcerpt : trimmedExcerpt + ELLIPSIS) || (0,external_wp_i18n_namespaceObject.__)('No excerpt found'),
onChange: setExcerpt,
tagName: "p"
}) : (0,external_React_namespaceObject.createElement)("p", {
className: excerptClassName
}, !isTrimmed ? rawOrRenderedExcerpt || (0,external_wp_i18n_namespaceObject.__)('No excerpt found') : trimmedExcerpt + ELLIPSIS);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentToolbar, {
value: textAlign,
onChange: newAlign => setAttributes({
textAlign: newAlign
})
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show link on new line'),
checked: showMoreOnNewLine,
onChange: newShowMoreOnNewLine => setAttributes({
showMoreOnNewLine: newShowMoreOnNewLine
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Max number of words'),
value: excerptLength,
onChange: value => {
setAttributes({
excerptLength: value
});
},
min: "10",
max: "100"
}))), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, excerptContent, !showMoreOnNewLine && ' ', showMoreOnNewLine ? (0,external_React_namespaceObject.createElement)("p", {
className: "wp-block-post-excerpt__more-text"
}, readMoreLink) : readMoreLink));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-excerpt/transforms.js
/**
* WordPress dependencies
*/
const post_excerpt_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/post-content'],
transform: () => (0,external_wp_blocks_namespaceObject.createBlock)('core/post-excerpt')
}],
to: [{
type: 'block',
blocks: ['core/post-content'],
transform: () => (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content')
}]
};
/* harmony default export */ const post_excerpt_transforms = (post_excerpt_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-excerpt/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_excerpt_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-excerpt",
title: "Excerpt",
category: "theme",
description: "Display the excerpt.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
},
moreText: {
type: "string"
},
showMoreOnNewLine: {
type: "boolean",
"default": true
},
excerptLength: {
type: "number",
"default": 55
}
},
usesContext: ["postId", "postType", "queryId"],
supports: {
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-post-excerpt-editor",
style: "wp-block-post-excerpt"
};
const {
name: post_excerpt_name
} = post_excerpt_metadata;
const post_excerpt_settings = {
icon: post_excerpt,
transforms: post_excerpt_transforms,
edit: PostExcerptEditor
};
const post_excerpt_init = () => initBlock({
name: post_excerpt_name,
metadata: post_excerpt_metadata,
settings: post_excerpt_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-featured-image.js
/**
* WordPress dependencies
*/
const postFeaturedImage = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M19 3H5c-.6 0-1 .4-1 1v7c0 .5.4 1 1 1h14c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1zM5.5 10.5v-.4l1.8-1.3 1.3.8c.3.2.7.2.9-.1L11 8.1l2.4 2.4H5.5zm13 0h-2.9l-4-4c-.3-.3-.8-.3-1.1 0L8.9 8l-1.2-.8c-.3-.2-.6-.2-.9 0l-1.3 1V4.5h13v6zM4 20h9v-1.5H4V20zm0-4h16v-1.5H4V16z"
}));
/* harmony default export */ const post_featured_image = (postFeaturedImage);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-featured-image/dimension-controls.js
/**
* WordPress dependencies
*/
const SCALE_OPTIONS = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "cover",
label: (0,external_wp_i18n_namespaceObject._x)('Cover', 'Scale option for Image dimension control')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "contain",
label: (0,external_wp_i18n_namespaceObject._x)('Contain', 'Scale option for Image dimension control')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "fill",
label: (0,external_wp_i18n_namespaceObject._x)('Fill', 'Scale option for Image dimension control')
}));
const DEFAULT_SCALE = 'cover';
const DEFAULT_SIZE = 'full';
const scaleHelp = {
cover: (0,external_wp_i18n_namespaceObject.__)('Image is scaled and cropped to fill the entire space without being distorted.'),
contain: (0,external_wp_i18n_namespaceObject.__)('Image is scaled to fill the space without clipping nor distorting.'),
fill: (0,external_wp_i18n_namespaceObject.__)('Image will be stretched and distorted to completely fill the space.')
};
const DimensionControls = ({
clientId,
attributes: {
aspectRatio,
width,
height,
scale,
sizeSlug
},
setAttributes,
imageSizeOptions = []
}) => {
const [availableUnits] = (0,external_wp_blockEditor_namespaceObject.useSettings)('spacing.units');
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: availableUnits || ['px', '%', 'vw', 'em', 'rem']
});
const onDimensionChange = (dimension, nextValue) => {
const parsedValue = parseFloat(nextValue);
/**
* If we have no value set and we change the unit,
* we don't want to set the attribute, as it would
* end up having the unit as value without any number.
*/
if (isNaN(parsedValue) && nextValue) return;
setAttributes({
[dimension]: parsedValue < 0 ? '0' : nextValue
});
};
const scaleLabel = (0,external_wp_i18n_namespaceObject._x)('Scale', 'Image scaling options');
const showScaleControl = height || aspectRatio && aspectRatio !== 'auto';
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "dimensions"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!aspectRatio,
label: (0,external_wp_i18n_namespaceObject.__)('Aspect ratio'),
onDeselect: () => setAttributes({
aspectRatio: undefined
}),
resetAllFilter: () => ({
aspectRatio: undefined
}),
isShownByDefault: true,
panelId: clientId
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Aspect ratio'),
value: aspectRatio,
options: [
// These should use the same values as AspectRatioDropdown in @wordpress/block-editor
{
label: (0,external_wp_i18n_namespaceObject.__)('Original'),
value: 'auto'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Square'),
value: '1'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('16:9'),
value: '16/9'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('4:3'),
value: '4/3'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('3:2'),
value: '3/2'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('9:16'),
value: '9/16'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('3:4'),
value: '3/4'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('2:3'),
value: '2/3'
}],
onChange: nextAspectRatio => setAttributes({
aspectRatio: nextAspectRatio
})
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "single-column",
hasValue: () => !!height,
label: (0,external_wp_i18n_namespaceObject.__)('Height'),
onDeselect: () => setAttributes({
height: undefined
}),
resetAllFilter: () => ({
height: undefined
}),
isShownByDefault: true,
panelId: clientId
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Height'),
labelPosition: "top",
value: height || '',
min: 0,
onChange: nextHeight => onDimensionChange('height', nextHeight),
units: units
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
className: "single-column",
hasValue: () => !!width,
label: (0,external_wp_i18n_namespaceObject.__)('Width'),
onDeselect: () => setAttributes({
width: undefined
}),
resetAllFilter: () => ({
width: undefined
}),
isShownByDefault: true,
panelId: clientId
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Width'),
labelPosition: "top",
value: width || '',
min: 0,
onChange: nextWidth => onDimensionChange('width', nextWidth),
units: units
})), showScaleControl && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!scale && scale !== DEFAULT_SCALE,
label: scaleLabel,
onDeselect: () => setAttributes({
scale: DEFAULT_SCALE
}),
resetAllFilter: () => ({
scale: DEFAULT_SCALE
}),
isShownByDefault: true,
panelId: clientId
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__nextHasNoMarginBottom: true,
label: scaleLabel,
value: scale,
help: scaleHelp[scale],
onChange: value => setAttributes({
scale: value
}),
isBlock: true
}, SCALE_OPTIONS)), !!imageSizeOptions.length && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!sizeSlug,
label: (0,external_wp_i18n_namespaceObject.__)('Resolution'),
onDeselect: () => setAttributes({
sizeSlug: undefined
}),
resetAllFilter: () => ({
sizeSlug: undefined
}),
isShownByDefault: false,
panelId: clientId
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Resolution'),
value: sizeSlug || DEFAULT_SIZE,
options: imageSizeOptions,
onChange: nextSizeSlug => setAttributes({
sizeSlug: nextSizeSlug
}),
help: (0,external_wp_i18n_namespaceObject.__)('Select the size of the source image.')
})));
};
/* harmony default export */ const dimension_controls = (DimensionControls);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-featured-image/utils.js
/**
* Generates the opacity/dim class based on given number.
*
* @param {number} ratio Dim/opacity number.
*
* @return {string} Generated class.
*/
function utils_dimRatioToClass(ratio) {
return ratio === undefined ? null : 'has-background-dim-' + 10 * Math.round(ratio / 10);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-featured-image/overlay.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const Overlay = ({
clientId,
attributes,
setAttributes,
overlayColor,
setOverlayColor
}) => {
const {
dimRatio
} = attributes;
const {
gradientClass,
gradientValue,
setGradient
} = (0,external_wp_blockEditor_namespaceObject.__experimentalUseGradient)();
const colorGradientSettings = (0,external_wp_blockEditor_namespaceObject.__experimentalUseMultipleOriginColorsAndGradients)();
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes);
const overlayStyles = {
backgroundColor: overlayColor.color,
backgroundImage: gradientValue,
...borderProps.style
};
if (!colorGradientSettings.hasColorsOrGradients) {
return null;
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !!dimRatio && (0,external_React_namespaceObject.createElement)("span", {
"aria-hidden": "true",
className: classnames_default()('wp-block-post-featured-image__overlay', utils_dimRatioToClass(dimRatio), {
[overlayColor.class]: overlayColor.class,
'has-background-dim': dimRatio !== undefined,
'has-background-gradient': gradientValue,
[gradientClass]: gradientClass
}, borderProps.className),
style: overlayStyles
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "color"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientSettingsDropdown, {
__experimentalIsRenderedInSidebar: true,
settings: [{
colorValue: overlayColor.color,
gradientValue,
label: (0,external_wp_i18n_namespaceObject.__)('Overlay'),
onColorChange: setOverlayColor,
onGradientChange: setGradient,
isShownByDefault: true,
resetAllFilter: () => ({
overlayColor: undefined,
customOverlayColor: undefined,
gradient: undefined,
customGradient: undefined
})
}],
panelId: clientId,
...colorGradientSettings
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => dimRatio !== undefined,
label: (0,external_wp_i18n_namespaceObject.__)('Overlay opacity'),
onDeselect: () => setAttributes({
dimRatio: 0
}),
resetAllFilter: () => ({
dimRatio: 0
}),
isShownByDefault: true,
panelId: clientId
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Overlay opacity'),
value: dimRatio,
onChange: newDimRatio => setAttributes({
dimRatio: newDimRatio
}),
min: 0,
max: 100,
step: 10,
required: true,
__next40pxDefaultSize: true
}))));
};
/* harmony default export */ const overlay = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_blockEditor_namespaceObject.withColors)({
overlayColor: 'background-color'
})])(Overlay));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-featured-image/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_featured_image_edit_ALLOWED_MEDIA_TYPES = ['image'];
function getMediaSourceUrlBySizeSlug(media, slug) {
return media?.media_details?.sizes?.[slug]?.source_url || media?.source_url;
}
const disabledClickProps = {
onClick: event => event.preventDefault(),
'aria-disabled': true
};
function PostFeaturedImageEdit({
clientId,
attributes,
setAttributes,
context: {
postId,
postType: postTypeSlug,
queryId
}
}) {
const isDescendentOfQueryLoop = Number.isFinite(queryId);
const {
isLink,
aspectRatio,
height,
width,
scale,
sizeSlug,
rel,
linkTarget,
useFirstImageFromPost
} = attributes;
const [storedFeaturedImage, setFeaturedImage] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postTypeSlug, 'featured_media', postId);
// Fallback to post content if no featured image is set.
// This is needed for the "Use first image from post" option.
const [postContent] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postTypeSlug, 'content', postId);
const featuredImage = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (storedFeaturedImage) {
return storedFeaturedImage;
}
if (!useFirstImageFromPost) {
return;
}
const imageOpener = /<!--\s+wp:(?:core\/)?image\s+(?<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\s+\/?-->).)*)?}\s+)?-->/.exec(postContent);
const imageId = imageOpener?.groups?.attrs && JSON.parse(imageOpener.groups.attrs)?.id;
return imageId;
}, [storedFeaturedImage, useFirstImageFromPost, postContent]);
const {
media,
postType,
postPermalink
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getMedia,
getPostType,
getEditedEntityRecord
} = select(external_wp_coreData_namespaceObject.store);
return {
media: featuredImage && getMedia(featuredImage, {
context: 'view'
}),
postType: postTypeSlug && getPostType(postTypeSlug),
postPermalink: getEditedEntityRecord('postType', postTypeSlug, postId)?.link
};
}, [featuredImage, postTypeSlug, postId]);
const mediaUrl = getMediaSourceUrlBySizeSlug(media, sizeSlug);
const imageSizes = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings().imageSizes, []);
const imageSizeOptions = imageSizes.filter(({
slug
}) => {
return media?.media_details?.sizes?.[slug]?.source_url;
}).map(({
name,
slug
}) => ({
value: slug,
label: name
}));
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
style: {
width,
height,
aspectRatio
}
});
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes);
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
const placeholder = content => {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
className: classnames_default()('block-editor-media-placeholder', borderProps.className),
withIllustration: true,
style: {
height: !!aspectRatio && '100%',
width: !!aspectRatio && '100%',
...borderProps.style
}
}, content);
};
const onSelectImage = value => {
if (value?.id) {
setFeaturedImage(value.id);
}
};
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const onUploadError = message => {
createErrorNotice(message, {
type: 'snackbar'
});
};
const controls = blockEditingMode === 'default' && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(overlay, {
attributes: attributes,
setAttributes: setAttributes,
clientId: clientId
}), (0,external_React_namespaceObject.createElement)(dimension_controls, {
clientId: clientId,
attributes: attributes,
setAttributes: setAttributes,
imageSizeOptions: imageSizeOptions
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: postType?.labels.singular_name ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Name of the post type e.g: "Page".
(0,external_wp_i18n_namespaceObject.__)('Link to %s'), postType.labels.singular_name) : (0,external_wp_i18n_namespaceObject.__)('Link to post'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
}), isLink && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: linkTarget === '_blank'
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link rel'),
value: rel,
onChange: newRel => setAttributes({
rel: newRel
})
})))));
let image;
/**
* A Post Featured Image block should not have image replacement
* or upload options in the following cases:
* - Is placed in a Query Loop. This is a consious decision to
* prevent content editing of different posts in Query Loop, and
* this could change in the future.
* - Is in a context where it does not have a postId (for example
* in a template or template part).
*/
if (!featuredImage && (isDescendentOfQueryLoop || !postId)) {
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, controls, (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, !!isLink ? (0,external_React_namespaceObject.createElement)("a", {
href: postPermalink,
target: linkTarget,
...disabledClickProps
}, placeholder()) : placeholder()));
}
const label = (0,external_wp_i18n_namespaceObject.__)('Add a featured image');
const imageStyles = {
...borderProps.style,
height: aspectRatio ? '100%' : height,
width: !!aspectRatio && '100%',
objectFit: !!(height || aspectRatio) && scale
};
/**
* When the post featured image block is placed in a context where:
* - It has a postId (for example in a single post)
* - It is not inside a query loop
* - It has no image assigned yet
* Then display the placeholder with the image upload option.
*/
if (!featuredImage) {
image = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
onSelect: onSelectImage,
accept: "image/*",
allowedTypes: post_featured_image_edit_ALLOWED_MEDIA_TYPES,
onError: onUploadError,
placeholder: placeholder,
mediaLibraryButton: ({
open
}) => {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
icon: library_upload,
variant: "primary",
label: label,
showTooltip: true,
tooltipPosition: "top center",
onClick: () => {
open();
}
});
}
});
} else {
// We have a Featured image so show a Placeholder if is loading.
image = !media ? placeholder() : (0,external_React_namespaceObject.createElement)("img", {
className: borderProps.className,
src: mediaUrl,
alt: media.alt_text ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The image's alt text.
(0,external_wp_i18n_namespaceObject.__)('Featured image: %s'), media.alt_text) : (0,external_wp_i18n_namespaceObject.__)('Featured image'),
style: imageStyles
});
}
/**
* When the post featured image block:
* - Has an image assigned
* - Is not inside a query loop
* Then display the image and the image replacement option.
*/
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, controls, !!media && !isDescendentOfQueryLoop && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, {
mediaId: featuredImage,
mediaURL: mediaUrl,
allowedTypes: post_featured_image_edit_ALLOWED_MEDIA_TYPES,
accept: "image/*",
onSelect: onSelectImage,
onError: onUploadError
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => setFeaturedImage(0)
}, (0,external_wp_i18n_namespaceObject.__)('Reset')))), (0,external_React_namespaceObject.createElement)("figure", {
...blockProps
}, !!isLink ? (0,external_React_namespaceObject.createElement)("a", {
href: postPermalink,
target: linkTarget,
...disabledClickProps
}, image) : image));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-featured-image/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_featured_image_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-featured-image",
title: "Featured Image",
category: "theme",
description: "Display a post's featured image.",
textdomain: "default",
attributes: {
isLink: {
type: "boolean",
"default": false
},
aspectRatio: {
type: "string"
},
width: {
type: "string"
},
height: {
type: "string"
},
scale: {
type: "string",
"default": "cover"
},
sizeSlug: {
type: "string"
},
rel: {
type: "string",
attribute: "rel",
"default": ""
},
linkTarget: {
type: "string",
"default": "_self"
},
overlayColor: {
type: "string"
},
customOverlayColor: {
type: "string"
},
dimRatio: {
type: "number",
"default": 0
},
gradient: {
type: "string"
},
customGradient: {
type: "string"
},
useFirstImageFromPost: {
type: "boolean",
"default": false
}
},
usesContext: ["postId", "postType", "queryId"],
supports: {
align: ["left", "right", "center", "wide", "full"],
color: {
__experimentalDuotone: "img, .wp-block-post-featured-image__placeholder, .components-placeholder__illustration, .components-placeholder::before",
text: false,
background: false
},
__experimentalBorder: {
color: true,
radius: true,
width: true,
__experimentalSelector: "img, .block-editor-media-placeholder, .wp-block-post-featured-image__overlay",
__experimentalSkipSerialization: true,
__experimentalDefaultControls: {
color: true,
radius: true,
width: true
}
},
html: false,
spacing: {
margin: true,
padding: true
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-post-featured-image-editor",
style: "wp-block-post-featured-image"
};
const {
name: post_featured_image_name
} = post_featured_image_metadata;
const post_featured_image_settings = {
icon: post_featured_image,
edit: PostFeaturedImageEdit
};
const post_featured_image_init = () => initBlock({
name: post_featured_image_name,
metadata: post_featured_image_metadata,
settings: post_featured_image_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-navigation-link/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function PostNavigationLinkEdit({
context: {
postType
},
attributes: {
type,
label,
showTitle,
textAlign,
linkLabel,
arrow,
taxonomy
},
setAttributes
}) {
const isNext = type === 'next';
let placeholder = isNext ? (0,external_wp_i18n_namespaceObject.__)('Next') : (0,external_wp_i18n_namespaceObject.__)('Previous');
const arrowMap = {
none: '',
arrow: isNext ? '→' : '←',
chevron: isNext ? '»' : '«'
};
const displayArrow = arrowMap[arrow];
if (showTitle) {
/* translators: Label before for next and previous post. There is a space after the colon. */
placeholder = isNext ? (0,external_wp_i18n_namespaceObject.__)('Next: ') : (0,external_wp_i18n_namespaceObject.__)('Previous: ');
}
const ariaLabel = isNext ? (0,external_wp_i18n_namespaceObject.__)('Next post') : (0,external_wp_i18n_namespaceObject.__)('Previous post');
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const taxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getTaxonomies
} = select(external_wp_coreData_namespaceObject.store);
const filteredTaxonomies = getTaxonomies({
type: postType,
per_page: -1
});
return filteredTaxonomies;
}, [postType]);
const getTaxonomyOptions = () => {
const selectOption = {
label: (0,external_wp_i18n_namespaceObject.__)('Unfiltered'),
value: ''
};
const taxonomyOptions = (taxonomies !== null && taxonomies !== void 0 ? taxonomies : []).filter(({
visibility
}) => !!visibility?.publicly_queryable).map(item => {
return {
value: item.slug,
label: item.name
};
});
return [selectOption, ...taxonomyOptions];
};
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display the title as a link'),
help: (0,external_wp_i18n_namespaceObject.__)('If you have entered a custom label, it will be prepended before the title.'),
checked: !!showTitle,
onChange: () => setAttributes({
showTitle: !showTitle
})
}), showTitle && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Include the label as part of the link'),
checked: !!linkLabel,
onChange: () => setAttributes({
linkLabel: !linkLabel
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Arrow'),
value: arrow,
onChange: value => {
setAttributes({
arrow: value
});
},
help: (0,external_wp_i18n_namespaceObject.__)('A decorative arrow for the next and previous link.'),
isBlock: true
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "none",
label: (0,external_wp_i18n_namespaceObject._x)('None', 'Arrow option for Next/Previous link')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "arrow",
label: (0,external_wp_i18n_namespaceObject._x)('Arrow', 'Arrow option for Next/Previous link')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "chevron",
label: (0,external_wp_i18n_namespaceObject._x)('Chevron', 'Arrow option for Next/Previous link')
})))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Filter by taxonomy'),
value: taxonomy,
options: getTaxonomyOptions(),
onChange: value => setAttributes({
taxonomy: value
}),
help: (0,external_wp_i18n_namespaceObject.__)('Only link to posts that have the same taxonomy terms as the current post. For example the same tags or categories.')
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentToolbar, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, !isNext && displayArrow && (0,external_React_namespaceObject.createElement)("span", {
className: `wp-block-post-navigation-link__arrow-previous is-arrow-${arrow}`
}, displayArrow), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: "a",
"aria-label": ariaLabel,
placeholder: placeholder,
value: label,
allowedFormats: ['core/bold', 'core/italic'],
onChange: newLabel => setAttributes({
label: newLabel
})
}), showTitle && (0,external_React_namespaceObject.createElement)("a", {
href: "#post-navigation-pseudo-link",
onClick: event => event.preventDefault()
}, (0,external_wp_i18n_namespaceObject.__)('An example title')), isNext && displayArrow && (0,external_React_namespaceObject.createElement)("span", {
className: `wp-block-post-navigation-link__arrow-next is-arrow-${arrow}`,
"aria-hidden": true
}, displayArrow)));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/next.js
/**
* WordPress dependencies
*/
const next = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"
}));
/* harmony default export */ const library_next = (next);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/previous.js
/**
* WordPress dependencies
*/
const previous = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z"
}));
/* harmony default export */ const library_previous = (previous);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-navigation-link/variations.js
/**
* WordPress dependencies
*/
const post_navigation_link_variations_variations = [{
isDefault: true,
name: 'post-next',
title: (0,external_wp_i18n_namespaceObject.__)('Next post'),
description: (0,external_wp_i18n_namespaceObject.__)('Displays the post link that follows the current post.'),
icon: library_next,
attributes: {
type: 'next'
},
scope: ['inserter', 'transform']
}, {
name: 'post-previous',
title: (0,external_wp_i18n_namespaceObject.__)('Previous post'),
description: (0,external_wp_i18n_namespaceObject.__)('Displays the post link that precedes the current post.'),
icon: library_previous,
attributes: {
type: 'previous'
},
scope: ['inserter', 'transform']
}];
/**
* Add `isActive` function to all `post-navigation-link` variations, if not defined.
* `isActive` function is used to find a variation match from a created
* Block by providing its attributes.
*/
post_navigation_link_variations_variations.forEach(variation => {
if (variation.isActive) return;
variation.isActive = (blockAttributes, variationAttributes) => blockAttributes.type === variationAttributes.type;
});
/* harmony default export */ const post_navigation_link_variations = (post_navigation_link_variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-navigation-link/index.js
/**
* Internal dependencies
*/
const post_navigation_link_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-navigation-link",
title: "Post Navigation Link",
category: "theme",
description: "Displays the next or previous post link that is adjacent to the current post.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
},
type: {
type: "string",
"default": "next"
},
label: {
type: "string"
},
showTitle: {
type: "boolean",
"default": false
},
linkLabel: {
type: "boolean",
"default": false
},
arrow: {
type: "string",
"default": "none"
},
taxonomy: {
type: "string",
"default": ""
}
},
usesContext: ["postType"],
supports: {
reusable: false,
html: false,
color: {
link: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalWritingMode: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-post-navigation-link"
};
const {
name: post_navigation_link_name
} = post_navigation_link_metadata;
const post_navigation_link_settings = {
edit: PostNavigationLinkEdit,
variations: post_navigation_link_variations
};
const post_navigation_link_init = () => initBlock({
name: post_navigation_link_name,
metadata: post_navigation_link_metadata,
settings: post_navigation_link_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-template/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const post_template_edit_TEMPLATE = [['core/post-title'], ['core/post-date'], ['core/post-excerpt']];
function PostTemplateInnerBlocks() {
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)({
className: 'wp-block-post'
}, {
template: post_template_edit_TEMPLATE,
__unstableDisableLayoutClassNames: true
});
return (0,external_React_namespaceObject.createElement)("li", {
...innerBlocksProps
});
}
function PostTemplateBlockPreview({
blocks,
blockContextId,
isHidden,
setActiveBlockContextId
}) {
const blockPreviewProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBlockPreview)({
blocks,
props: {
className: 'wp-block-post'
}
});
const handleOnClick = () => {
setActiveBlockContextId(blockContextId);
};
const style = {
display: isHidden ? 'none' : undefined
};
return (0,external_React_namespaceObject.createElement)("li", {
...blockPreviewProps,
tabIndex: 0
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
,
role: "button",
onClick: handleOnClick,
onKeyPress: handleOnClick,
style: style
});
}
const MemoizedPostTemplateBlockPreview = (0,external_wp_element_namespaceObject.memo)(PostTemplateBlockPreview);
function PostTemplateEdit({
setAttributes,
clientId,
context: {
query: {
perPage,
offset = 0,
postType,
order,
orderBy,
author,
search,
exclude,
sticky,
inherit,
taxQuery,
parents,
pages,
// We gather extra query args to pass to the REST API call.
// This way extenders of Query Loop can add their own query args,
// and have accurate previews in the editor.
// Noting though that these args should either be supported by the
// REST API or be handled by custom REST filters like `rest_{$this->post_type}_query`.
...restQueryArgs
} = {},
templateSlug,
previewPostType
},
attributes: {
layout
},
__unstableLayoutClassNames
}) {
const {
type: layoutType,
columnCount = 3
} = layout || {};
const [activeBlockContextId, setActiveBlockContextId] = (0,external_wp_element_namespaceObject.useState)();
const {
posts,
blocks
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEntityRecords,
getTaxonomies
} = select(external_wp_coreData_namespaceObject.store);
const {
getBlocks
} = select(external_wp_blockEditor_namespaceObject.store);
const templateCategory = inherit && templateSlug?.startsWith('category-') && getEntityRecords('taxonomy', 'category', {
context: 'view',
per_page: 1,
_fields: ['id'],
slug: templateSlug.replace('category-', '')
});
const query = {
offset: offset || 0,
order,
orderby: orderBy
};
// There is no need to build the taxQuery if we inherit.
if (taxQuery && !inherit) {
const taxonomies = getTaxonomies({
type: postType,
per_page: -1,
context: 'view'
});
// We have to build the tax query for the REST API and use as
// keys the taxonomies `rest_base` with the `term ids` as values.
const builtTaxQuery = Object.entries(taxQuery).reduce((accumulator, [taxonomySlug, terms]) => {
const taxonomy = taxonomies?.find(({
slug
}) => slug === taxonomySlug);
if (taxonomy?.rest_base) {
accumulator[taxonomy?.rest_base] = terms;
}
return accumulator;
}, {});
if (!!Object.keys(builtTaxQuery).length) {
Object.assign(query, builtTaxQuery);
}
}
if (perPage) {
query.per_page = perPage;
}
if (author) {
query.author = author;
}
if (search) {
query.search = search;
}
if (exclude?.length) {
query.exclude = exclude;
}
if (parents?.length) {
query.parent = parents;
}
// If sticky is not set, it will return all posts in the results.
// If sticky is set to `only`, it will limit the results to sticky posts only.
// If it is anything else, it will exclude sticky posts from results. For the record the value stored is `exclude`.
if (sticky) {
query.sticky = sticky === 'only';
}
// If `inherit` is truthy, adjust conditionally the query to create a better preview.
if (inherit) {
// Change the post-type if needed.
if (templateSlug?.startsWith('archive-')) {
query.postType = templateSlug.replace('archive-', '');
postType = query.postType;
} else if (templateCategory) {
query.categories = templateCategory[0]?.id;
}
}
// When we preview Query Loop blocks we should prefer the current
// block's postType, which is passed through block context.
const usedPostType = previewPostType || postType;
return {
posts: getEntityRecords('postType', usedPostType, {
...query,
...restQueryArgs
}),
blocks: getBlocks(clientId)
};
}, [perPage, offset, order, orderBy, clientId, author, search, postType, exclude, sticky, inherit, templateSlug, taxQuery, parents, restQueryArgs, previewPostType]);
const blockContexts = (0,external_wp_element_namespaceObject.useMemo)(() => posts?.map(post => ({
postType: post.type,
postId: post.id
})), [posts]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()(__unstableLayoutClassNames, {
[`columns-${columnCount}`]: layoutType === 'grid' && columnCount // Ensure column count is flagged via classname for backwards compatibility.
})
});
if (!posts) {
return (0,external_React_namespaceObject.createElement)("p", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null));
}
if (!posts.length) {
return (0,external_React_namespaceObject.createElement)("p", {
...blockProps
}, " ", (0,external_wp_i18n_namespaceObject.__)('No results found.'));
}
const setDisplayLayout = newDisplayLayout => setAttributes({
layout: {
...layout,
...newDisplayLayout
}
});
const displayLayoutControls = [{
icon: library_list,
title: (0,external_wp_i18n_namespaceObject.__)('List view'),
onClick: () => setDisplayLayout({
type: 'default'
}),
isActive: layoutType === 'default' || layoutType === 'constrained'
}, {
icon: library_grid,
title: (0,external_wp_i18n_namespaceObject.__)('Grid view'),
onClick: () => setDisplayLayout({
type: 'grid',
columnCount
}),
isActive: layoutType === 'grid'
}];
// To avoid flicker when switching active block contexts, a preview is rendered
// for each block context, but the preview for the active block context is hidden.
// This ensures that when it is displayed again, the cached rendering of the
// block preview is used, instead of having to re-render the preview from scratch.
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, {
controls: displayLayoutControls
})), (0,external_React_namespaceObject.createElement)("ul", {
...blockProps
}, blockContexts && blockContexts.map(blockContext => (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, {
key: blockContext.postId,
value: blockContext
}, blockContext.postId === (activeBlockContextId || blockContexts[0]?.postId) ? (0,external_React_namespaceObject.createElement)(PostTemplateInnerBlocks, null) : null, (0,external_React_namespaceObject.createElement)(MemoizedPostTemplateBlockPreview, {
blocks: blocks,
blockContextId: blockContext.postId,
setActiveBlockContextId: setActiveBlockContextId,
isHidden: blockContext.postId === (activeBlockContextId || blockContexts[0]?.postId)
})))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-template/save.js
/**
* WordPress dependencies
*/
function PostTemplateSave() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-template/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_template_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-template",
title: "Post Template",
category: "theme",
parent: ["core/query"],
description: "Contains the block elements used to render a post, like the title, date, featured image, content or excerpt, and more.",
textdomain: "default",
usesContext: ["queryId", "query", "displayLayout", "templateSlug", "previewPostType", "enhancedPagination"],
supports: {
reusable: false,
html: false,
align: ["wide", "full"],
layout: true,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
spacing: {
blockGap: {
__experimentalDefault: "1.25em"
},
__experimentalDefaultControls: {
blockGap: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-post-template",
editorStyle: "wp-block-post-template-editor"
};
const {
name: post_template_name
} = post_template_metadata;
const post_template_settings = {
icon: library_layout,
edit: PostTemplateEdit,
save: PostTemplateSave
};
const post_template_init = () => initBlock({
name: post_template_name,
metadata: post_template_metadata,
settings: post_template_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-categories.js
/**
* WordPress dependencies
*/
const postCategories = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M20 4H4v1.5h16V4zm-2 9h-3c-1.1 0-2 .9-2 2v3c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2zm.5 5c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5v-3c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3zM4 9.5h9V8H4v1.5zM9 13H6c-1.1 0-2 .9-2 2v3c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2zm.5 5c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-3c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3z",
fillRule: "evenodd",
clipRule: "evenodd"
}));
/* harmony default export */ const post_categories = (postCategories);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-terms/use-post-terms.js
/**
* WordPress dependencies
*/
const use_post_terms_EMPTY_ARRAY = [];
function usePostTerms({
postId,
term
}) {
const {
slug
} = term;
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const visible = term?.visibility?.publicly_queryable;
if (!visible) {
return {
postTerms: use_post_terms_EMPTY_ARRAY,
isLoading: false,
hasPostTerms: false
};
}
const {
getEntityRecords,
isResolving
} = select(external_wp_coreData_namespaceObject.store);
const taxonomyArgs = ['taxonomy', slug, {
post: postId,
per_page: -1,
context: 'view'
}];
const terms = getEntityRecords(...taxonomyArgs);
return {
postTerms: terms,
isLoading: isResolving('getEntityRecords', taxonomyArgs),
hasPostTerms: !!terms?.length
};
}, [postId, term?.visibility?.publicly_queryable, slug]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-terms/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// Allowed formats for the prefix and suffix fields.
const ALLOWED_FORMATS = ['core/bold', 'core/image', 'core/italic', 'core/link', 'core/strikethrough', 'core/text-color'];
function PostTermsEdit({
attributes,
clientId,
context,
isSelected,
setAttributes,
insertBlocksAfter
}) {
const {
term,
textAlign,
separator,
prefix,
suffix
} = attributes;
const {
postId,
postType
} = context;
const selectedTerm = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!term) return {};
const {
getTaxonomy
} = select(external_wp_coreData_namespaceObject.store);
const taxonomy = getTaxonomy(term);
return taxonomy?.visibility?.publicly_queryable ? taxonomy : {};
}, [term]);
const {
postTerms,
hasPostTerms,
isLoading
} = usePostTerms({
postId,
term: selectedTerm
});
const hasPost = postId && postType;
const blockInformation = (0,external_wp_blockEditor_namespaceObject.useBlockDisplayInformation)(clientId);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign,
[`taxonomy-${term}`]: term
})
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentToolbar, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
autoComplete: "off",
label: (0,external_wp_i18n_namespaceObject.__)('Separator'),
value: separator || '',
onChange: nextValue => {
setAttributes({
separator: nextValue
});
},
help: (0,external_wp_i18n_namespaceObject.__)('Enter character(s) used to separate terms.')
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, isLoading && hasPost && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), !isLoading && (isSelected || prefix) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
allowedFormats: ALLOWED_FORMATS,
className: "wp-block-post-terms__prefix",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Prefix'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Prefix') + ' ',
value: prefix,
onChange: value => setAttributes({
prefix: value
}),
tagName: "span"
}), (!hasPost || !term) && (0,external_React_namespaceObject.createElement)("span", null, blockInformation.title), hasPost && !isLoading && hasPostTerms && postTerms.map(postTerm => (0,external_React_namespaceObject.createElement)("a", {
key: postTerm.id,
href: postTerm.link,
onClick: event => event.preventDefault()
}, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postTerm.name))).reduce((prev, curr) => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, prev, (0,external_React_namespaceObject.createElement)("span", {
className: "wp-block-post-terms__separator"
}, separator || ' '), curr)), hasPost && !isLoading && !hasPostTerms && (selectedTerm?.labels?.no_terms || (0,external_wp_i18n_namespaceObject.__)('Term items not found.')), !isLoading && (isSelected || suffix) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
allowedFormats: ALLOWED_FORMATS,
className: "wp-block-post-terms__suffix",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Suffix'),
placeholder: ' ' + (0,external_wp_i18n_namespaceObject.__)('Suffix'),
value: suffix,
onChange: value => setAttributes({
suffix: value
}),
tagName: "span",
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()))
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-terms.js
/**
* WordPress dependencies
*/
const postTerms = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M8.1 12.3c.1.1.3.3.5.3.2.1.4.1.6.1.2 0 .4 0 .6-.1.2-.1.4-.2.5-.3l3-3c.3-.3.5-.7.5-1.1 0-.4-.2-.8-.5-1.1L9.7 3.5c-.1-.2-.3-.3-.5-.3H5c-.4 0-.8.4-.8.8v4.2c0 .2.1.4.2.5l3.7 3.6zM5.8 4.8h3.1l3.4 3.4v.1l-3 3 .5.5-.7-.5-3.3-3.4V4.8zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z"
}));
/* harmony default export */ const post_terms = (postTerms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-terms/hooks.js
/**
* WordPress dependencies
*/
const variationIconMap = {
category: post_categories,
post_tag: post_terms
};
// We add `icons` to categories and tags. The remaining ones use
// the block's default icon.
function enhanceVariations(settings, name) {
if (name !== 'core/post-terms') {
return settings;
}
const variations = settings.variations.map(variation => {
var _variationIconMap$var;
return {
...variation,
...{
icon: (_variationIconMap$var = variationIconMap[variation.name]) !== null && _variationIconMap$var !== void 0 ? _variationIconMap$var : post_categories
}
};
});
return {
...settings,
variations
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-terms/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_terms_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-terms",
title: "Post Terms",
category: "theme",
description: "Post terms.",
textdomain: "default",
attributes: {
term: {
type: "string"
},
textAlign: {
type: "string"
},
separator: {
type: "string",
"default": ", "
},
prefix: {
type: "string",
"default": ""
},
suffix: {
type: "string",
"default": ""
}
},
usesContext: ["postId", "postType"],
supports: {
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-post-terms"
};
const {
name: post_terms_name
} = post_terms_metadata;
const post_terms_settings = {
icon: post_categories,
edit: PostTermsEdit
};
const post_terms_init = () => {
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/template-part', enhanceVariations);
return initBlock({
name: post_terms_name,
metadata: post_terms_metadata,
settings: post_terms_settings
});
};
;// CONCATENATED MODULE: external ["wp","wordcount"]
const external_wp_wordcount_namespaceObject = window["wp"]["wordcount"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-time-to-read/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Average reading rate - based on average taken from
* https://irisreading.com/average-reading-speed-in-various-languages/
* (Characters/minute used for Chinese rather than words).
*/
const AVERAGE_READING_RATE = 189;
function PostTimeToReadEdit({
attributes,
setAttributes,
context
}) {
const {
textAlign
} = attributes;
const {
postId,
postType
} = context;
const [contentStructure] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'content', postId);
const [blocks] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', postType, {
id: postId
});
const minutesToReadString = (0,external_wp_element_namespaceObject.useMemo)(() => {
// Replicates the logic found in getEditedPostContent().
let content;
if (contentStructure instanceof Function) {
content = contentStructure({
blocks
});
} else if (blocks) {
// If we have parsed blocks already, they should be our source of truth.
// Parsing applies block deprecations and legacy block conversions that
// unparsed content will not have.
content = (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocks);
} else {
content = contentStructure;
}
/*
* translators: If your word count is based on single characters (e.g. East Asian characters),
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
* Do not translate into your own language.
*/
const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!');
const minutesToRead = Math.max(1, Math.round((0,external_wp_wordcount_namespaceObject.count)(content, wordCountType) / AVERAGE_READING_RATE));
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d is the number of minutes the post will take to read. */
(0,external_wp_i18n_namespaceObject._n)('%d minute', '%d minutes', minutesToRead), minutesToRead);
}, [contentStructure, blocks]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, minutesToReadString));
}
/* harmony default export */ const post_time_to_read_edit = (PostTimeToReadEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-time-to-read/icon.js
/**
* WordPress dependencies
*/
/* harmony default export */ const icon = ((0,external_React_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_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M12 3c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16.5c-4.1 0-7.5-3.4-7.5-7.5S7.9 4.5 12 4.5s7.5 3.4 7.5 7.5-3.4 7.5-7.5 7.5zM12 7l-1 5c0 .3.2.6.4.8l4.2 2.8-2.7-4.1L12 7z"
})));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-time-to-read/index.js
/**
* Internal dependencies
*/
const post_time_to_read_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: true,
name: "core/post-time-to-read",
title: "Time To Read",
category: "theme",
description: "Show minutes required to finish reading the post.",
textdomain: "default",
usesContext: ["postId", "postType"],
attributes: {
textAlign: {
type: "string"
}
},
supports: {
color: {
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
html: false,
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: post_time_to_read_name
} = post_time_to_read_metadata;
const post_time_to_read_settings = {
icon: icon,
edit: post_time_to_read_edit
};
const post_time_to_read_init = () => initBlock({
name: post_time_to_read_name,
metadata: post_time_to_read_metadata,
settings: post_time_to_read_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-title/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PostTitleEdit({
attributes: {
level,
textAlign,
isLink,
rel,
linkTarget
},
setAttributes,
context: {
postType,
postId,
queryId
},
insertBlocksAfter
}) {
const TagName = 'h' + level;
const isDescendentOfQueryLoop = Number.isFinite(queryId);
/**
* Hack: useCanEditEntity may trigger an OPTIONS request to the REST API via the canUser resolver.
* However, when the Post Title is a descendant of a Query Loop block, the title cannot be edited.
* In order to avoid these unnecessary requests, we call the hook without
* the proper data, resulting in returning early without making them.
*/
const userCanEdit = useCanEditEntity('postType', !isDescendentOfQueryLoop && postType, postId);
const [rawTitle = '', setTitle, fullTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'title', postId);
const [link] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'link', postId);
const onSplitAtEnd = () => {
insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()));
};
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const blockEditingMode = (0,external_wp_blockEditor_namespaceObject.useBlockEditingMode)();
let titleElement = (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_wp_i18n_namespaceObject.__)('Title'));
if (postType && postId) {
titleElement = userCanEdit ? (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.PlainText, {
tagName: TagName,
placeholder: (0,external_wp_i18n_namespaceObject.__)('No Title'),
value: rawTitle,
onChange: setTitle,
__experimentalVersion: 2,
__unstableOnSplitAtEnd: onSplitAtEnd,
...blockProps
}) : (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps,
dangerouslySetInnerHTML: {
__html: fullTitle?.rendered
}
});
}
if (isLink && postType && postId) {
titleElement = userCanEdit ? (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.PlainText, {
tagName: "a",
href: link,
target: linkTarget,
rel: rel,
placeholder: !rawTitle.length ? (0,external_wp_i18n_namespaceObject.__)('No Title') : null,
value: rawTitle,
onChange: setTitle,
__experimentalVersion: 2,
__unstableOnSplitAtEnd: onSplitAtEnd
})) : (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_React_namespaceObject.createElement)("a", {
href: link,
target: linkTarget,
rel: rel,
onClick: event => event.preventDefault(),
dangerouslySetInnerHTML: {
__html: fullTitle?.rendered
}
}));
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, blockEditingMode === 'default' && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.HeadingLevelDropdown, {
value: level,
onChange: newLevel => setAttributes({
level: newLevel
})
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Make title a link'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
}), isLink && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: linkTarget === '_blank'
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link rel'),
value: rel,
onChange: newRel => setAttributes({
rel: newRel
})
}))))), titleElement);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-title/deprecated.js
/**
* Internal dependencies
*/
const post_title_deprecated_v1 = {
attributes: {
textAlign: {
type: 'string'
},
level: {
type: 'number',
default: 2
},
isLink: {
type: 'boolean',
default: false
},
rel: {
type: 'string',
attribute: 'rel',
default: ''
},
linkTarget: {
type: 'string',
default: '_self'
}
},
supports: {
align: ['wide', 'full'],
html: false,
color: {
gradients: true,
link: true
},
spacing: {
margin: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true
}
},
save() {
return null;
},
migrate: migrate_font_family,
isEligible({
style
}) {
return style?.typography?.fontFamily;
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const post_title_deprecated = ([post_title_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/post-title/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const post_title_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/post-title",
title: "Title",
category: "theme",
description: "Displays the title of a post, page, or any other content-type.",
textdomain: "default",
usesContext: ["postId", "postType", "queryId"],
attributes: {
textAlign: {
type: "string"
},
level: {
type: "number",
"default": 2
},
isLink: {
type: "boolean",
"default": false
},
rel: {
type: "string",
attribute: "rel",
"default": ""
},
linkTarget: {
type: "string",
"default": "_self"
}
},
supports: {
align: ["wide", "full"],
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-post-title"
};
const {
name: post_title_name
} = post_title_metadata;
const post_title_settings = {
icon: library_title,
edit: PostTitleEdit,
deprecated: post_title_deprecated
};
const post_title_init = () => initBlock({
name: post_title_name,
metadata: post_title_metadata,
settings: post_title_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/preformatted.js
/**
* WordPress dependencies
*/
const preformatted = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v12zM7 16.5h6V15H7v1.5zm4-4h6V11h-6v1.5zM9 11H7v1.5h2V11zm6 5.5h2V15h-2v1.5z"
}));
/* harmony default export */ const library_preformatted = (preformatted);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/preformatted/edit.js
/**
* WordPress dependencies
*/
function PreformattedEdit({
attributes,
mergeBlocks,
setAttributes,
onRemove,
insertBlocksAfter,
style
}) {
const {
content
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
style
});
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: "pre",
identifier: "content",
preserveWhiteSpace: true,
value: content,
onChange: nextContent => {
setAttributes({
content: nextContent
});
},
onRemove: onRemove,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Preformatted text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write preformatted text…'),
onMerge: mergeBlocks,
...blockProps,
__unstablePastePlainText: true,
__unstableOnSplitAtDoubleLineEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()))
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/preformatted/save.js
/**
* WordPress dependencies
*/
function preformatted_save_save({
attributes
}) {
const {
content
} = attributes;
return (0,external_React_namespaceObject.createElement)("pre", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: content
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/preformatted/transforms.js
/**
* WordPress dependencies
*/
const preformatted_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/code', 'core/paragraph'],
transform: ({
content,
anchor
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/preformatted', {
content,
anchor
})
}, {
type: 'raw',
isMatch: node => node.nodeName === 'PRE' && !(node.children.length === 1 && node.firstChild.nodeName === 'CODE'),
schema: ({
phrasingContentSchema
}) => ({
pre: {
children: phrasingContentSchema
}
})
}],
to: [{
type: 'block',
blocks: ['core/paragraph'],
transform: attributes => (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', attributes)
}, {
type: 'block',
blocks: ['core/code'],
transform: attributes => (0,external_wp_blocks_namespaceObject.createBlock)('core/code', attributes)
}]
};
/* harmony default export */ const preformatted_transforms = (preformatted_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/preformatted/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const preformatted_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/preformatted",
title: "Preformatted",
category: "text",
description: "Add text that respects your spacing and tabs, and also allows styling.",
textdomain: "default",
attributes: {
content: {
type: "rich-text",
source: "rich-text",
selector: "pre",
__unstablePreserveWhiteSpace: true,
__experimentalRole: "content"
}
},
supports: {
anchor: true,
color: {
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
padding: true,
margin: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-preformatted"
};
const {
name: preformatted_name
} = preformatted_metadata;
const preformatted_settings = {
icon: library_preformatted,
example: {
attributes: {
/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */
// translators: Sample content for the Preformatted block. Can be replaced with a more locale-adequate work.
content: (0,external_wp_i18n_namespaceObject.__)('EXT. XANADU - FAINT DAWN - 1940 (MINIATURE)\nWindow, very small in the distance, illuminated.\nAll around this is an almost totally black screen. Now, as the camera moves slowly towards the window which is almost a postage stamp in the frame, other forms appear;')
/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */
}
},
transforms: preformatted_transforms,
edit: PreformattedEdit,
save: preformatted_save_save,
merge(attributes, attributesToMerge) {
return {
content: attributes.content + '\n\n' + attributesToMerge.content
};
}
};
const preformatted_init = () => initBlock({
name: preformatted_name,
metadata: preformatted_metadata,
settings: preformatted_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pullquote.js
/**
* WordPress dependencies
*/
const pullquote = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M18 8H6c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2zm.5 6c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-4c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v4zM4 4v1.5h16V4H4zm0 16h16v-1.5H4V20z"
}));
/* harmony default export */ const library_pullquote = (pullquote);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/shared.js
const SOLID_COLOR_CLASS = `is-style-solid-color`;
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const pullquote_deprecated_blockAttributes = {
value: {
type: 'string',
source: 'html',
selector: 'blockquote',
multiline: 'p'
},
citation: {
type: 'string',
source: 'html',
selector: 'cite',
default: ''
},
mainColor: {
type: 'string'
},
customMainColor: {
type: 'string'
},
textColor: {
type: 'string'
},
customTextColor: {
type: 'string'
}
};
function parseBorderColor(styleString) {
if (!styleString) {
return;
}
const matches = styleString.match(/border-color:([^;]+)[;]?/);
if (matches && matches[1]) {
return matches[1];
}
}
function multilineToInline(value) {
value = value || `<p></p>`;
const padded = `</p>${value}<p>`;
const values = padded.split(`</p><p>`);
values.shift();
values.pop();
return values.join('<br>');
}
const pullquote_deprecated_v5 = {
attributes: {
value: {
type: 'string',
source: 'html',
selector: 'blockquote',
multiline: 'p',
__experimentalRole: 'content'
},
citation: {
type: 'string',
source: 'html',
selector: 'cite',
default: '',
__experimentalRole: 'content'
},
textAlign: {
type: 'string'
}
},
save({
attributes
}) {
const {
textAlign,
citation,
value
} = attributes;
const shouldShowCitation = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation);
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
})
}, (0,external_React_namespaceObject.createElement)("blockquote", null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), shouldShowCitation && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
})));
},
migrate({
value,
...attributes
}) {
return {
value: multilineToInline(value),
...attributes
};
}
};
// TODO: this is ripe for a bit of a clean up according to the example in https://developer.wordpress.org/block-editor/reference-guides/block-api/block-deprecation/#example
const pullquote_deprecated_v4 = {
attributes: {
...pullquote_deprecated_blockAttributes
},
save({
attributes
}) {
const {
mainColor,
customMainColor,
customTextColor,
textColor,
value,
citation,
className
} = attributes;
const isSolidColorStyle = className?.includes(SOLID_COLOR_CLASS);
let figureClasses, figureStyles;
// Is solid color style
if (isSolidColorStyle) {
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', mainColor);
figureClasses = classnames_default()({
'has-background': backgroundClass || customMainColor,
[backgroundClass]: backgroundClass
});
figureStyles = {
backgroundColor: backgroundClass ? undefined : customMainColor
};
// Is normal style and a custom color is being used ( we can set a style directly with its value)
} else if (customMainColor) {
figureStyles = {
borderColor: customMainColor
};
}
const blockquoteTextColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const blockquoteClasses = classnames_default()({
'has-text-color': textColor || customTextColor,
[blockquoteTextColorClass]: blockquoteTextColorClass
});
const blockquoteStyles = blockquoteTextColorClass ? undefined : {
color: customTextColor
};
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: figureClasses,
style: figureStyles
})
}, (0,external_React_namespaceObject.createElement)("blockquote", {
className: blockquoteClasses,
style: blockquoteStyles
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
})));
},
migrate({
value,
className,
mainColor,
customMainColor,
customTextColor,
...attributes
}) {
const isSolidColorStyle = className?.includes(SOLID_COLOR_CLASS);
let style;
if (customMainColor) {
if (!isSolidColorStyle) {
// Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.
style = {
border: {
color: customMainColor
}
};
} else {
// Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.
style = {
color: {
background: customMainColor
}
};
}
}
// Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.
if (customTextColor && style) {
style.color = {
...style.color,
text: customTextColor
};
}
return {
value: multilineToInline(value),
className,
backgroundColor: isSolidColorStyle ? mainColor : undefined,
borderColor: isSolidColorStyle ? undefined : mainColor,
textAlign: isSolidColorStyle ? 'left' : undefined,
style,
...attributes
};
}
};
const pullquote_deprecated_v3 = {
attributes: {
...pullquote_deprecated_blockAttributes,
// figureStyle is an attribute that never existed.
// We are using it as a way to access the styles previously applied to the figure.
figureStyle: {
source: 'attribute',
selector: 'figure',
attribute: 'style'
}
},
save({
attributes
}) {
const {
mainColor,
customMainColor,
textColor,
customTextColor,
value,
citation,
className,
figureStyle
} = attributes;
const isSolidColorStyle = className?.includes(SOLID_COLOR_CLASS);
let figureClasses, figureStyles;
// Is solid color style
if (isSolidColorStyle) {
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', mainColor);
figureClasses = classnames_default()({
'has-background': backgroundClass || customMainColor,
[backgroundClass]: backgroundClass
});
figureStyles = {
backgroundColor: backgroundClass ? undefined : customMainColor
};
// Is normal style and a custom color is being used ( we can set a style directly with its value)
} else if (customMainColor) {
figureStyles = {
borderColor: customMainColor
};
// If normal style and a named color are being used, we need to retrieve the color value to set the style,
// as there is no expectation that themes create classes that set border colors.
} else if (mainColor) {
// Previously here we queried the color settings to know the color value
// of a named color. This made the save function impure and the block was refactored,
// because meanwhile a change in the editor made it impossible to query color settings in the save function.
// Here instead of querying the color settings to know the color value, we retrieve the value
// directly from the style previously serialized.
const borderColor = parseBorderColor(figureStyle);
figureStyles = {
borderColor
};
}
const blockquoteTextColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const blockquoteClasses = (textColor || customTextColor) && classnames_default()('has-text-color', {
[blockquoteTextColorClass]: blockquoteTextColorClass
});
const blockquoteStyles = blockquoteTextColorClass ? undefined : {
color: customTextColor
};
return (0,external_React_namespaceObject.createElement)("figure", {
className: figureClasses,
style: figureStyles
}, (0,external_React_namespaceObject.createElement)("blockquote", {
className: blockquoteClasses,
style: blockquoteStyles
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
})));
},
migrate({
value,
className,
figureStyle,
mainColor,
customMainColor,
customTextColor,
...attributes
}) {
const isSolidColorStyle = className?.includes(SOLID_COLOR_CLASS);
let style;
if (customMainColor) {
if (!isSolidColorStyle) {
// Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.
style = {
border: {
color: customMainColor
}
};
} else {
// Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.
style = {
color: {
background: customMainColor
}
};
}
}
// Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.
if (customTextColor && style) {
style.color = {
...style.color,
text: customTextColor
};
}
// If is the default style, and a main color is set,
// migrate the main color value into a custom border color.
// The custom border color value is retrieved by parsing the figure styles.
if (!isSolidColorStyle && mainColor && figureStyle) {
const borderColor = parseBorderColor(figureStyle);
if (borderColor) {
return {
value: multilineToInline(value),
...attributes,
className,
// Block supports: Set style.border.color if a deprecated block has `mainColor`, inline border CSS and is not a solid color style.
style: {
border: {
color: borderColor
}
}
};
}
}
return {
value: multilineToInline(value),
className,
backgroundColor: isSolidColorStyle ? mainColor : undefined,
borderColor: isSolidColorStyle ? undefined : mainColor,
textAlign: isSolidColorStyle ? 'left' : undefined,
style,
...attributes
};
}
};
const pullquote_deprecated_v2 = {
attributes: pullquote_deprecated_blockAttributes,
save({
attributes
}) {
const {
mainColor,
customMainColor,
textColor,
customTextColor,
value,
citation,
className
} = attributes;
const isSolidColorStyle = className?.includes(SOLID_COLOR_CLASS);
let figureClass, figureStyles;
// Is solid color style
if (isSolidColorStyle) {
figureClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', mainColor);
if (!figureClass) {
figureStyles = {
backgroundColor: customMainColor
};
}
// Is normal style and a custom color is being used ( we can set a style directly with its value)
} else if (customMainColor) {
figureStyles = {
borderColor: customMainColor
};
// Is normal style and a named color is being used, we need to retrieve the color value to set the style,
// as there is no expectation that themes create classes that set border colors.
} else if (mainColor) {
var _select$getSettings$c;
const colors = (_select$getSettings$c = (0,external_wp_data_namespaceObject.select)(external_wp_blockEditor_namespaceObject.store).getSettings().colors) !== null && _select$getSettings$c !== void 0 ? _select$getSettings$c : [];
const colorObject = (0,external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues)(colors, mainColor);
figureStyles = {
borderColor: colorObject.color
};
}
const blockquoteTextColorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', textColor);
const blockquoteClasses = textColor || customTextColor ? classnames_default()('has-text-color', {
[blockquoteTextColorClass]: blockquoteTextColorClass
}) : undefined;
const blockquoteStyle = blockquoteTextColorClass ? undefined : {
color: customTextColor
};
return (0,external_React_namespaceObject.createElement)("figure", {
className: figureClass,
style: figureStyles
}, (0,external_React_namespaceObject.createElement)("blockquote", {
className: blockquoteClasses,
style: blockquoteStyle
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
})));
},
migrate({
value,
className,
mainColor,
customMainColor,
customTextColor,
...attributes
}) {
const isSolidColorStyle = className?.includes(SOLID_COLOR_CLASS);
let style = {};
if (customMainColor) {
if (!isSolidColorStyle) {
// Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.
style = {
border: {
color: customMainColor
}
};
} else {
// Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.
style = {
color: {
background: customMainColor
}
};
}
}
// Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.
if (customTextColor && style) {
style.color = {
...style.color,
text: customTextColor
};
}
return {
value: multilineToInline(value),
className,
backgroundColor: isSolidColorStyle ? mainColor : undefined,
borderColor: isSolidColorStyle ? undefined : mainColor,
textAlign: isSolidColorStyle ? 'left' : undefined,
style,
...attributes
};
}
};
const pullquote_deprecated_v1 = {
attributes: {
...pullquote_deprecated_blockAttributes
},
save({
attributes
}) {
const {
value,
citation
} = attributes;
return (0,external_React_namespaceObject.createElement)("blockquote", null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
}));
},
migrate({
value,
...attributes
}) {
return {
value: multilineToInline(value),
...attributes
};
}
};
const deprecated_v0 = {
attributes: {
...pullquote_deprecated_blockAttributes,
citation: {
type: 'string',
source: 'html',
selector: 'footer'
},
align: {
type: 'string',
default: 'none'
}
},
save({
attributes
}) {
const {
value,
citation,
align
} = attributes;
return (0,external_React_namespaceObject.createElement)("blockquote", {
className: `align${align}`
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: value,
multiline: true
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "footer",
value: citation
}));
},
migrate({
value,
...attributes
}) {
return {
value: multilineToInline(value),
...attributes
};
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const pullquote_deprecated = ([pullquote_deprecated_v5, pullquote_deprecated_v4, pullquote_deprecated_v3, pullquote_deprecated_v2, pullquote_deprecated_v1, deprecated_v0]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/figure.js
const Figure = 'figure';
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/blockquote.js
const BlockQuote = 'blockquote';
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const isWebPlatform = external_wp_element_namespaceObject.Platform.OS === 'web';
function PullQuoteEdit({
attributes,
setAttributes,
isSelected,
insertBlocksAfter
}) {
const {
textAlign,
citation,
value
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
});
const shouldShowCitation = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) || isSelected;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)(Figure, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(BlockQuote, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "value",
tagName: "p",
value: value,
onChange: nextValue => setAttributes({
value: nextValue
}),
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Pullquote text'),
placeholder:
// translators: placeholder text used for the quote
(0,external_wp_i18n_namespaceObject.__)('Add quote'),
textAlign: "center"
}), shouldShowCitation && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "citation",
tagName: isWebPlatform ? 'cite' : undefined,
style: {
display: 'block'
},
value: citation,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Pullquote citation text'),
placeholder:
// translators: placeholder text used for the citation
(0,external_wp_i18n_namespaceObject.__)('Add citation'),
onChange: nextCitation => setAttributes({
citation: nextCitation
}),
className: "wp-block-pullquote__citation",
__unstableMobileNoFocusOnMount: true,
textAlign: "center",
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()))
}))));
}
/* harmony default export */ const pullquote_edit = (PullQuoteEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function pullquote_save_save({
attributes
}) {
const {
textAlign,
citation,
value
} = attributes;
const shouldShowCitation = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation);
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
})
})
}, (0,external_React_namespaceObject.createElement)("blockquote", null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "p",
value: value
}), shouldShowCitation && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/transforms.js
/**
* WordPress dependencies
*/
const pullquote_transforms_transforms = {
from: [{
type: 'block',
isMultiBlock: true,
blocks: ['core/paragraph'],
transform: attributes => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/pullquote', {
value: (0,external_wp_richText_namespaceObject.toHTMLString)({
value: (0,external_wp_richText_namespaceObject.join)(attributes.map(({
content
}) => (0,external_wp_richText_namespaceObject.create)({
html: content
})), '\n')
}),
anchor: attributes.anchor
});
}
}, {
type: 'block',
blocks: ['core/heading'],
transform: ({
content,
anchor
}) => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/pullquote', {
value: content,
anchor
});
}
}],
to: [{
type: 'block',
blocks: ['core/paragraph'],
transform: ({
value,
citation
}) => {
const paragraphs = [];
if (value) {
paragraphs.push((0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: value
}));
}
if (citation) {
paragraphs.push((0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: citation
}));
}
if (paragraphs.length === 0) {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: ''
});
}
return paragraphs;
}
}, {
type: 'block',
blocks: ['core/heading'],
transform: ({
value,
citation
}) => {
// If there is no pullquote content, use the citation as the
// content of the resulting heading. A nonexistent citation
// will result in an empty heading.
if (!value) {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
content: citation
});
}
const headingBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
content: value
});
if (!citation) {
return headingBlock;
}
return [headingBlock, (0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
content: citation
})];
}
}]
};
/* harmony default export */ const pullquote_transforms = (pullquote_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const pullquote_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/pullquote",
title: "Pullquote",
category: "text",
description: "Give special visual emphasis to a quote from your text.",
textdomain: "default",
attributes: {
value: {
type: "rich-text",
source: "rich-text",
selector: "p",
__experimentalRole: "content"
},
citation: {
type: "rich-text",
source: "rich-text",
selector: "cite",
__experimentalRole: "content"
},
textAlign: {
type: "string"
}
},
supports: {
anchor: true,
align: ["left", "right", "wide", "full"],
color: {
gradients: true,
background: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
__experimentalBorder: {
color: true,
radius: true,
style: true,
width: true,
__experimentalDefaultControls: {
color: true,
radius: true,
style: true,
width: true
}
},
__experimentalStyle: {
typography: {
fontSize: "1.5em",
lineHeight: "1.6"
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-pullquote-editor",
style: "wp-block-pullquote"
};
const {
name: pullquote_name
} = pullquote_metadata;
const pullquote_settings = {
icon: library_pullquote,
example: {
attributes: {
value:
// translators: Quote serving as example for the Pullquote block. Attributed to Matt Mullenweg.
(0,external_wp_i18n_namespaceObject.__)('One of the hardest things to do in technology is disrupt yourself.'),
citation: (0,external_wp_i18n_namespaceObject.__)('Matt Mullenweg')
}
},
transforms: pullquote_transforms,
edit: pullquote_edit,
save: pullquote_save_save,
deprecated: pullquote_deprecated
};
const pullquote_init = () => initBlock({
name: pullquote_name,
metadata: pullquote_metadata,
settings: pullquote_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/loop.js
/**
* WordPress dependencies
*/
const loop = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M18.1823 11.6392C18.1823 13.0804 17.0139 14.2487 15.5727 14.2487C14.3579 14.2487 13.335 13.4179 13.0453 12.2922L13.0377 12.2625L13.0278 12.2335L12.3985 10.377L12.3942 10.3785C11.8571 8.64997 10.246 7.39405 8.33961 7.39405C5.99509 7.39405 4.09448 9.29465 4.09448 11.6392C4.09448 13.9837 5.99509 15.8843 8.33961 15.8843C8.88499 15.8843 9.40822 15.781 9.88943 15.5923L9.29212 14.0697C8.99812 14.185 8.67729 14.2487 8.33961 14.2487C6.89838 14.2487 5.73003 13.0804 5.73003 11.6392C5.73003 10.1979 6.89838 9.02959 8.33961 9.02959C9.55444 9.02959 10.5773 9.86046 10.867 10.9862L10.8772 10.9836L11.4695 12.7311C11.9515 14.546 13.6048 15.8843 15.5727 15.8843C17.9172 15.8843 19.8178 13.9837 19.8178 11.6392C19.8178 9.29465 17.9172 7.39404 15.5727 7.39404C15.0287 7.39404 14.5066 7.4968 14.0264 7.6847L14.6223 9.20781C14.9158 9.093 15.2358 9.02959 15.5727 9.02959C17.0139 9.02959 18.1823 10.1979 18.1823 11.6392Z"
}));
/* harmony default export */ const library_loop = (loop);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/settings.js
/**
* WordPress dependencies
*/
const settings_settings = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"
}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"
}));
/* harmony default export */ const library_settings = (settings_settings);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/utils.js
/**
* WordPress dependencies
*/
/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */
/**
* @typedef IHasNameAndId
* @property {string|number} id The entity's id.
* @property {string} name The entity's name.
*/
/**
* The object used in Query block that contains info and helper mappings
* from an array of IHasNameAndId objects.
*
* @typedef {Object} QueryEntitiesInfo
* @property {IHasNameAndId[]} entities The array of entities.
* @property {Object<string, IHasNameAndId>} mapById Object mapping with the id as key and the entity as value.
* @property {Object<string, IHasNameAndId>} mapByName Object mapping with the name as key and the entity as value.
* @property {string[]} names Array with the entities' names.
*/
/**
* Returns a helper object with mapping from Objects that implement
* the `IHasNameAndId` interface. The returned object is used for
* integration with `FormTokenField` component.
*
* @param {IHasNameAndId[]} entities The entities to extract of helper object.
* @return {QueryEntitiesInfo} The object with the entities information.
*/
const getEntitiesInfo = entities => {
const mapping = entities?.reduce((accumulator, entity) => {
const {
mapById,
mapByName,
names
} = accumulator;
mapById[entity.id] = entity;
mapByName[entity.name] = entity;
names.push(entity.name);
return accumulator;
}, {
mapById: {},
mapByName: {},
names: []
});
return {
entities,
...mapping
};
};
/**
* Helper util to return a value from a certain path of the object.
* Path is specified as a string of properties, separated by dots,
* for example: "parent.child".
*
* @param {Object} object Input object.
* @param {string} path Path to the object property.
* @return {*} Value of the object property at the specified path.
*/
const getValueFromObjectPath = (object, path) => {
const normalizedPath = path.split('.');
let value = object;
normalizedPath.forEach(fieldName => {
value = value?.[fieldName];
});
return value;
};
/**
* Helper util to map records to add a `name` prop from a
* provided path, in order to handle all entities in the same
* fashion(implementing`IHasNameAndId` interface).
*
* @param {Object[]} entities The array of entities.
* @param {string} path The path to map a `name` property from the entity.
* @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.
*/
const mapToIHasNameAndId = (entities, path) => {
return (entities || []).map(entity => ({
...entity,
name: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(getValueFromObjectPath(entity, path))
}));
};
/**
* Returns a helper object that contains:
* 1. An `options` object from the available post types, to be passed to a `SelectControl`.
* 2. A helper map with available taxonomies per post type.
*
* @return {Object} The helper object related to post types.
*/
const usePostTypes = () => {
const postTypes = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getPostTypes
} = select(external_wp_coreData_namespaceObject.store);
const excludedPostTypes = ['attachment'];
const filteredPostTypes = getPostTypes({
per_page: -1
})?.filter(({
viewable,
slug
}) => viewable && !excludedPostTypes.includes(slug));
return filteredPostTypes;
}, []);
const postTypesTaxonomiesMap = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!postTypes?.length) return;
return postTypes.reduce((accumulator, type) => {
accumulator[type.slug] = type.taxonomies;
return accumulator;
}, {});
}, [postTypes]);
const postTypesSelectOptions = (0,external_wp_element_namespaceObject.useMemo)(() => (postTypes || []).map(({
labels,
slug
}) => ({
label: labels.singular_name,
value: slug
})), [postTypes]);
return {
postTypesTaxonomiesMap,
postTypesSelectOptions
};
};
/**
* Hook that returns the taxonomies associated with a specific post type.
*
* @param {string} postType The post type from which to retrieve the associated taxonomies.
* @return {Object[]} An array of the associated taxonomies.
*/
const useTaxonomies = postType => {
const taxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getTaxonomies
} = select(external_wp_coreData_namespaceObject.store);
const filteredTaxonomies = getTaxonomies({
type: postType,
per_page: -1,
context: 'view'
});
return filteredTaxonomies;
}, [postType]);
return taxonomies;
};
/**
* Hook that returns whether a specific post type is hierarchical.
*
* @param {string} postType The post type to check.
* @return {boolean} Whether a specific post type is hierarchical.
*/
function useIsPostTypeHierarchical(postType) {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const type = select(external_wp_coreData_namespaceObject.store).getPostType(postType);
return type?.viewable && type?.hierarchical;
}, [postType]);
}
/**
* Hook that returns the query properties' names defined by the active
* block variation, to determine which block's filters to show.
*
* @param {Object} attributes Block attributes.
* @return {string[]} An array of the query attributes.
*/
function useAllowedControls(attributes) {
return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getActiveBlockVariation('core/query', attributes)?.allowedControls, [attributes]);
}
function isControlAllowed(allowedControls, key) {
// Every controls is allowed if the list is not defined.
if (!allowedControls) {
return true;
}
return allowedControls.includes(key);
}
/**
* Clones a pattern's blocks and then recurses over that list of blocks,
* transforming them to retain some `query` attribute properties.
* For now we retain the `postType` and `inherit` properties as they are
* fundamental for the expected functionality of the block and don't affect
* its design and presentation.
*
* Returns the cloned/transformed blocks and array of existing Query Loop
* client ids for further manipulation, in order to avoid multiple recursions.
*
* @param {WPBlock[]} blocks The list of blocks to look through and transform(mutate).
* @param {Record<string,*>} queryBlockAttributes The existing Query Loop's attributes.
* @return {{ newBlocks: WPBlock[], queryClientIds: string[] }} An object with the cloned/transformed blocks and all the Query Loop clients from these blocks.
*/
const getTransformedBlocksFromPattern = (blocks, queryBlockAttributes) => {
const {
query: {
postType,
inherit
}
} = queryBlockAttributes;
const clonedBlocks = blocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block));
const queryClientIds = [];
const blocksQueue = [...clonedBlocks];
while (blocksQueue.length > 0) {
const block = blocksQueue.shift();
if (block.name === 'core/query') {
block.attributes.query = {
...block.attributes.query,
postType,
inherit
};
queryClientIds.push(block.clientId);
}
block.innerBlocks?.forEach(innerBlock => {
blocksQueue.push(innerBlock);
});
}
return {
newBlocks: clonedBlocks,
queryClientIds
};
};
/**
* Helper hook that determines if there is an active variation of the block
* and if there are available specific patterns for this variation.
* If there are, these patterns are going to be the only ones suggested to
* the user in setup and replace flow, without including the default ones
* for Query Loop.
*
* If there are no such patterns, the default ones for Query Loop are going
* to be suggested.
*
* @param {string} clientId The block's client ID.
* @param {Object} attributes The block's attributes.
* @return {string} The block name to be used in the patterns suggestions.
*/
function useBlockNameForPatterns(clientId, attributes) {
const activeVariationName = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getActiveBlockVariation('core/query', attributes)?.name, [attributes]);
const blockName = `core/query/${activeVariationName}`;
const hasActiveVariationPatterns = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!activeVariationName) {
return false;
}
const {
getBlockRootClientId,
getPatternsByBlockTypes
} = select(external_wp_blockEditor_namespaceObject.store);
const rootClientId = getBlockRootClientId(clientId);
const activePatterns = getPatternsByBlockTypes(blockName, rootClientId);
return activePatterns.length > 0;
}, [clientId, activeVariationName, blockName]);
return hasActiveVariationPatterns ? blockName : 'core/query';
}
/**
* Helper hook that determines if there is an active variation of the block
* and if there are available specific scoped `block` variations connected with
* this variation.
*
* If there are, these variations are going to be the only ones suggested
* to the user in setup flow when clicking to `start blank`, without including
* the default ones for Query Loop.
*
* If there are no such scoped `block` variations, the default ones for Query
* Loop are going to be suggested.
*
* The way we determine such variations is with the convention that they have the `namespace`
* attribute defined as an array. This array should contain the names(`name` property) of any
* variations they want to be connected to.
* For example, if we have a `Query Loop` scoped `inserter` variation with the name `products`,
* we can connect a scoped `block` variation by setting its `namespace` attribute to `['products']`.
* If the user selects this variation, the `namespace` attribute will be overridden by the
* main `inserter` variation.
*
* @param {Object} attributes The block's attributes.
* @return {WPBlockVariation[]} The block variations to be suggested in setup flow, when clicking to `start blank`.
*/
function useScopedBlockVariations(attributes) {
const {
activeVariationName,
blockVariations
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getActiveBlockVariation,
getBlockVariations
} = select(external_wp_blocks_namespaceObject.store);
return {
activeVariationName: getActiveBlockVariation('core/query', attributes)?.name,
blockVariations: getBlockVariations('core/query', 'block')
};
}, [attributes]);
const variations = (0,external_wp_element_namespaceObject.useMemo)(() => {
// Filter out the variations that have defined a `namespace` attribute,
// which means they are 'connected' to specific variations of the block.
const isNotConnected = variation => !variation.attributes?.namespace;
if (!activeVariationName) {
return blockVariations.filter(isNotConnected);
}
const connectedVariations = blockVariations.filter(variation => variation.attributes?.namespace?.includes(activeVariationName));
if (!!connectedVariations.length) {
return connectedVariations;
}
return blockVariations.filter(isNotConnected);
}, [activeVariationName, blockVariations]);
return variations;
}
/**
* Hook that returns the block patterns for a specific block type.
*
* @param {string} clientId The block's client ID.
* @param {string} name The block type name.
* @return {Object[]} An array of valid block patterns.
*/
const usePatterns = (clientId, name) => {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockRootClientId,
getPatternsByBlockTypes
} = select(external_wp_blockEditor_namespaceObject.store);
const rootClientId = getBlockRootClientId(clientId);
return getPatternsByBlockTypes(name, rootClientId);
}, [name, clientId]);
};
/**
* The object returned by useUnsupportedBlocks with info about the type of
* unsupported blocks present inside the Query block.
*
* @typedef {Object} UnsupportedBlocksInfo
* @property {boolean} hasBlocksFromPlugins True if blocks from plugins are present.
* @property {boolean} hasPostContentBlock True if a 'core/post-content' block is present.
* @property {boolean} hasUnsupportedBlocks True if there are any unsupported blocks.
*/
/**
* Hook that returns an object with information about the unsupported blocks
* present inside a Query Loop with the given `clientId`. The returned object
* contains props that are true when a certain type of unsupported block is
* present.
*
* @param {string} clientId The block's client ID.
* @return {UnsupportedBlocksInfo} The object containing the information.
*/
const useUnsupportedBlocks = clientId => {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getClientIdsOfDescendants,
getBlockName
} = select(external_wp_blockEditor_namespaceObject.store);
const blocks = {};
getClientIdsOfDescendants(clientId).forEach(descendantClientId => {
const blockName = getBlockName(descendantClientId);
/*
* Client side navigation can be true in two states:
* - supports.interactivity = true;
* - supports.interactivity.clientNavigation = true;
*/
const blockSupportsInteractivity = Object.is((0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, 'interactivity'), true);
const blockSupportsInteractivityClientNavigation = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, 'interactivity.clientNavigation');
const blockInteractivity = blockSupportsInteractivity || blockSupportsInteractivityClientNavigation;
if (!blockInteractivity) {
blocks.hasBlocksFromPlugins = true;
} else if (blockName === 'core/post-content') {
blocks.hasPostContentBlock = true;
}
});
blocks.hasUnsupportedBlocks = blocks.hasBlocksFromPlugins || blocks.hasPostContentBlock;
return blocks;
}, [clientId]);
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/query-toolbar.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function QueryToolbar({
attributes: {
query
},
setQuery,
openPatternSelectionModal,
name,
clientId
}) {
const hasPatterns = !!usePatterns(clientId, name).length;
const maxPageInputId = (0,external_wp_compose_namespaceObject.useInstanceId)(QueryToolbar, 'blocks-query-pagination-max-page-input');
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !query.inherit && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
contentClassName: "block-library-query-toolbar__popover",
renderToggle: ({
onToggle
}) => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
icon: library_settings,
label: (0,external_wp_i18n_namespaceObject.__)('Display settings'),
onClick: onToggle
}),
renderContent: () => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
__unstableInputWidth: "60px",
label: (0,external_wp_i18n_namespaceObject.__)('Items per Page'),
labelPosition: "edge",
min: 1,
max: 100,
onChange: value => {
if (isNaN(value) || value < 1 || value > 100) {
return;
}
setQuery({
perPage: value
});
},
step: "1",
value: query.perPage,
isDragEnabled: false
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
__unstableInputWidth: "60px",
label: (0,external_wp_i18n_namespaceObject.__)('Offset'),
labelPosition: "edge",
min: 0,
max: 100,
onChange: value => {
if (isNaN(value) || value < 0 || value > 100) {
return;
}
setQuery({
offset: value
});
},
step: "1",
value: query.offset,
isDragEnabled: false
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, {
id: maxPageInputId,
help: (0,external_wp_i18n_namespaceObject.__)('Limit the pages you want to show, even if the query has more results. To show all pages use 0 (zero).')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNumberControl, {
id: maxPageInputId,
__unstableInputWidth: "60px",
label: (0,external_wp_i18n_namespaceObject.__)('Max page to show'),
labelPosition: "edge",
min: 0,
onChange: value => {
if (isNaN(value) || value < 0) {
return;
}
setQuery({
pages: value
});
},
step: "1",
value: query.pages,
isDragEnabled: false
})))
})), hasPatterns && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, {
className: "wp-block-template-part__block-control-group"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: openPatternSelectionModal
}, (0,external_wp_i18n_namespaceObject.__)('Replace'))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/order-control.js
/**
* WordPress dependencies
*/
const orderOptions = [{
label: (0,external_wp_i18n_namespaceObject.__)('Newest to oldest'),
value: 'date/desc'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Oldest to newest'),
value: 'date/asc'
}, {
/* translators: label for ordering posts by title in ascending order */
label: (0,external_wp_i18n_namespaceObject.__)('A → Z'),
value: 'title/asc'
}, {
/* translators: label for ordering posts by title in descending order */
label: (0,external_wp_i18n_namespaceObject.__)('Z → A'),
value: 'title/desc'
}];
function OrderControl({
order,
orderBy,
onChange
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Order by'),
value: `${orderBy}/${order}`,
options: orderOptions,
onChange: value => {
const [newOrderBy, newOrder] = value.split('/');
onChange({
order: newOrder,
orderBy: newOrderBy
});
}
});
}
/* harmony default export */ const order_control = (OrderControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/author-control.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const author_control_AUTHORS_QUERY = {
who: 'authors',
per_page: -1,
_fields: 'id,name',
context: 'view'
};
function AuthorControl({
value,
onChange
}) {
const authorsList = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getUsers
} = select(external_wp_coreData_namespaceObject.store);
return getUsers(author_control_AUTHORS_QUERY);
}, []);
if (!authorsList) {
return null;
}
const authorsInfo = getEntitiesInfo(authorsList);
/**
* We need to normalize the value because the block operates on a
* comma(`,`) separated string value and `FormTokenFiels` needs an
* array.
*/
const normalizedValue = !value ? [] : value.toString().split(',');
// Returns only the existing authors ids. This prevents the component
// from crashing in the editor, when non existing ids are provided.
const sanitizedValue = normalizedValue.reduce((accumulator, authorId) => {
const author = authorsInfo.mapById[authorId];
if (author) {
accumulator.push({
id: authorId,
value: author.name
});
}
return accumulator;
}, []);
const getIdByValue = (entitiesMappedByName, authorValue) => {
const id = authorValue?.id || entitiesMappedByName[authorValue]?.id;
if (id) return id;
};
const onAuthorChange = newValue => {
const ids = Array.from(newValue.reduce((accumulator, author) => {
// Verify that new values point to existing entities.
const id = getIdByValue(authorsInfo.mapByName, author);
if (id) accumulator.add(id);
return accumulator;
}, new Set()));
onChange({
author: ids.join(',')
});
};
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FormTokenField, {
label: (0,external_wp_i18n_namespaceObject.__)('Authors'),
value: sanitizedValue,
suggestions: authorsInfo.names,
onChange: onAuthorChange,
__experimentalShowHowTo: false
});
}
/* harmony default export */ const author_control = (AuthorControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/parent-control.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const parent_control_EMPTY_ARRAY = [];
const BASE_QUERY = {
order: 'asc',
_fields: 'id,title',
context: 'view'
};
function ParentControl({
parents,
postType,
onChange
}) {
const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)('');
const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(parent_control_EMPTY_ARRAY);
const [suggestions, setSuggestions] = (0,external_wp_element_namespaceObject.useState)(parent_control_EMPTY_ARRAY);
const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 250);
const {
searchResults,
searchHasResolved
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!search) {
return {
searchResults: parent_control_EMPTY_ARRAY,
searchHasResolved: true
};
}
const {
getEntityRecords,
hasFinishedResolution
} = select(external_wp_coreData_namespaceObject.store);
const selectorArgs = ['postType', postType, {
...BASE_QUERY,
search,
orderby: 'relevance',
exclude: parents,
per_page: 20
}];
return {
searchResults: getEntityRecords(...selectorArgs),
searchHasResolved: hasFinishedResolution('getEntityRecords', selectorArgs)
};
}, [search, parents]);
const currentParents = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!parents?.length) return parent_control_EMPTY_ARRAY;
const {
getEntityRecords
} = select(external_wp_coreData_namespaceObject.store);
return getEntityRecords('postType', postType, {
...BASE_QUERY,
include: parents,
per_page: parents.length
});
}, [parents]);
// Update the `value` state only after the selectors are resolved
// to avoid emptying the input when we're changing parents.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!parents?.length) {
setValue(parent_control_EMPTY_ARRAY);
}
if (!currentParents?.length) return;
const currentParentsInfo = getEntitiesInfo(mapToIHasNameAndId(currentParents, 'title.rendered'));
// Returns only the existing entity ids. This prevents the component
// from crashing in the editor, when non existing ids are provided.
const sanitizedValue = parents.reduce((accumulator, id) => {
const entity = currentParentsInfo.mapById[id];
if (entity) {
accumulator.push({
id,
value: entity.name
});
}
return accumulator;
}, []);
setValue(sanitizedValue);
}, [parents, currentParents]);
const entitiesInfo = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!searchResults?.length) return parent_control_EMPTY_ARRAY;
return getEntitiesInfo(mapToIHasNameAndId(searchResults, 'title.rendered'));
}, [searchResults]);
// Update suggestions only when the query has resolved.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!searchHasResolved) return;
setSuggestions(entitiesInfo.names);
}, [entitiesInfo.names, searchHasResolved]);
const getIdByValue = (entitiesMappedByName, entity) => {
const id = entity?.id || entitiesMappedByName?.[entity]?.id;
if (id) return id;
};
const onParentChange = newValue => {
const ids = Array.from(newValue.reduce((accumulator, entity) => {
// Verify that new values point to existing entities.
const id = getIdByValue(entitiesInfo.mapByName, entity);
if (id) accumulator.add(id);
return accumulator;
}, new Set()));
setSuggestions(parent_control_EMPTY_ARRAY);
onChange({
parents: ids
});
};
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FormTokenField, {
label: (0,external_wp_i18n_namespaceObject.__)('Parents'),
value: value,
onInputChange: debouncedSearch,
suggestions: suggestions,
onChange: onParentChange,
__experimentalShowHowTo: false
});
}
/* harmony default export */ const parent_control = (ParentControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/taxonomy-controls.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const taxonomy_controls_EMPTY_ARRAY = [];
const taxonomy_controls_BASE_QUERY = {
order: 'asc',
_fields: 'id,name',
context: 'view'
};
// Helper function to get the term id based on user input in terms `FormTokenField`.
const getTermIdByTermValue = (terms, termValue) => {
// First we check for exact match by `term.id` or case sensitive `term.name` match.
const termId = termValue?.id || terms?.find(term => term.name === termValue)?.id;
if (termId) {
return termId;
}
/**
* Here we make an extra check for entered terms in a non case sensitive way,
* to match user expectations, due to `FormTokenField` behaviour that shows
* suggestions which are case insensitive.
*
* Although WP tries to discourage users to add terms with the same name (case insensitive),
* it's still possible if you manually change the name, as long as the terms have different slugs.
* In this edge case we always apply the first match from the terms list.
*/
const termValueLower = termValue.toLocaleLowerCase();
return terms?.find(term => term.name.toLocaleLowerCase() === termValueLower)?.id;
};
function TaxonomyControls({
onChange,
query
}) {
const {
postType,
taxQuery
} = query;
const taxonomies = useTaxonomies(postType);
if (!taxonomies || taxonomies.length === 0) {
return null;
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, taxonomies.map(taxonomy => {
const termIds = taxQuery?.[taxonomy.slug] || [];
const handleChange = newTermIds => onChange({
taxQuery: {
...taxQuery,
[taxonomy.slug]: newTermIds
}
});
return (0,external_React_namespaceObject.createElement)(TaxonomyItem, {
key: taxonomy.slug,
taxonomy: taxonomy,
termIds: termIds,
onChange: handleChange
});
}));
}
/**
* Renders a `FormTokenField` for a given taxonomy.
*
* @param {Object} props The props for the component.
* @param {Object} props.taxonomy The taxonomy object.
* @param {number[]} props.termIds An array with the block's term ids for the given taxonomy.
* @param {Function} props.onChange Callback `onChange` function.
* @return {JSX.Element} The rendered component.
*/
function TaxonomyItem({
taxonomy,
termIds,
onChange
}) {
const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)('');
const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(taxonomy_controls_EMPTY_ARRAY);
const [suggestions, setSuggestions] = (0,external_wp_element_namespaceObject.useState)(taxonomy_controls_EMPTY_ARRAY);
const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 250);
const {
searchResults,
searchHasResolved
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!search) {
return {
searchResults: taxonomy_controls_EMPTY_ARRAY,
searchHasResolved: true
};
}
const {
getEntityRecords,
hasFinishedResolution
} = select(external_wp_coreData_namespaceObject.store);
const selectorArgs = ['taxonomy', taxonomy.slug, {
...taxonomy_controls_BASE_QUERY,
search,
orderby: 'name',
exclude: termIds,
per_page: 20
}];
return {
searchResults: getEntityRecords(...selectorArgs),
searchHasResolved: hasFinishedResolution('getEntityRecords', selectorArgs)
};
}, [search, termIds]);
// `existingTerms` are the ones fetched from the API and their type is `{ id: number; name: string }`.
// They are used to extract the terms' names to populate the `FormTokenField` properly
// and to sanitize the provided `termIds`, by setting only the ones that exist.
const existingTerms = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!termIds?.length) return taxonomy_controls_EMPTY_ARRAY;
const {
getEntityRecords
} = select(external_wp_coreData_namespaceObject.store);
return getEntityRecords('taxonomy', taxonomy.slug, {
...taxonomy_controls_BASE_QUERY,
include: termIds,
per_page: termIds.length
});
}, [termIds]);
// Update the `value` state only after the selectors are resolved
// to avoid emptying the input when we're changing terms.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!termIds?.length) {
setValue(taxonomy_controls_EMPTY_ARRAY);
}
if (!existingTerms?.length) return;
// Returns only the existing entity ids. This prevents the component
// from crashing in the editor, when non existing ids are provided.
const sanitizedValue = termIds.reduce((accumulator, id) => {
const entity = existingTerms.find(term => term.id === id);
if (entity) {
accumulator.push({
id,
value: entity.name
});
}
return accumulator;
}, []);
setValue(sanitizedValue);
}, [termIds, existingTerms]);
// Update suggestions only when the query has resolved.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!searchHasResolved) return;
setSuggestions(searchResults.map(result => result.name));
}, [searchResults, searchHasResolved]);
const onTermsChange = newTermValues => {
const newTermIds = new Set();
for (const termValue of newTermValues) {
const termId = getTermIdByTermValue(searchResults, termValue);
if (termId) {
newTermIds.add(termId);
}
}
setSuggestions(taxonomy_controls_EMPTY_ARRAY);
onChange(Array.from(newTermIds));
};
return (0,external_React_namespaceObject.createElement)("div", {
className: "block-library-query-inspector__taxonomy-control"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FormTokenField, {
label: taxonomy.name,
value: value,
onInputChange: debouncedSearch,
suggestions: suggestions,
displayTransform: external_wp_htmlEntities_namespaceObject.decodeEntities,
onChange: onTermsChange,
__experimentalShowHowTo: false
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/sticky-control.js
/**
* WordPress dependencies
*/
const stickyOptions = [{
label: (0,external_wp_i18n_namespaceObject.__)('Include'),
value: ''
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Exclude'),
value: 'exclude'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Only'),
value: 'only'
}];
function StickyControl({
value,
onChange
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Sticky posts'),
options: stickyOptions,
value: value,
onChange: onChange,
help: (0,external_wp_i18n_namespaceObject.__)('Blog posts can be “stickied”, a feature that places them at the top of the front page of posts, keeping it there until new sticky posts are published.')
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/enhanced-pagination-control.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function EnhancedPaginationControl({
enhancedPagination,
setAttributes,
clientId
}) {
const {
hasUnsupportedBlocks
} = useUnsupportedBlocks(clientId);
let help = (0,external_wp_i18n_namespaceObject.__)('Browsing between pages requires a full page reload.');
if (enhancedPagination) {
help = (0,external_wp_i18n_namespaceObject.__)("Browsing between pages won't require a full page reload, unless non-compatible blocks are detected.");
} else if (hasUnsupportedBlocks) {
help = (0,external_wp_i18n_namespaceObject.__)("Force page reload can't be disabled because there are non-compatible blocks inside the Query block.");
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Force page reload'),
help: help,
checked: !enhancedPagination,
disabled: hasUnsupportedBlocks,
onChange: value => {
setAttributes({
enhancedPagination: !value
});
}
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/create-new-post-link.js
/**
* WordPress dependencies
*/
const CreateNewPostLink = ({
attributes: {
query: {
postType
} = {}
} = {}
}) => {
if (!postType) return null;
const newPostUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post-new.php', {
post_type: postType
});
return (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-query__create-new-link"
}, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('<a>Add new post</a>'),
// eslint-disable-next-line jsx-a11y/anchor-has-content
{
a: (0,external_React_namespaceObject.createElement)("a", {
href: newPostUrl
})
}));
};
/* harmony default export */ const create_new_post_link = (CreateNewPostLink);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
BlockInfo
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
function QueryInspectorControls(props) {
const {
attributes,
setQuery,
setDisplayLayout,
setAttributes,
clientId
} = props;
const {
query,
displayLayout,
enhancedPagination
} = attributes;
const {
order,
orderBy,
author: authorIds,
postType,
sticky,
inherit,
taxQuery,
parents
} = query;
const allowedControls = useAllowedControls(attributes);
const [showSticky, setShowSticky] = (0,external_wp_element_namespaceObject.useState)(postType === 'post');
const {
postTypesTaxonomiesMap,
postTypesSelectOptions
} = usePostTypes();
const taxonomies = useTaxonomies(postType);
const isPostTypeHierarchical = useIsPostTypeHierarchical(postType);
(0,external_wp_element_namespaceObject.useEffect)(() => {
setShowSticky(postType === 'post');
}, [postType]);
const onPostTypeChange = newValue => {
const updateQuery = {
postType: newValue
};
// We need to dynamically update the `taxQuery` property,
// by removing any not supported taxonomy from the query.
const supportedTaxonomies = postTypesTaxonomiesMap[newValue];
const updatedTaxQuery = Object.entries(taxQuery || {}).reduce((accumulator, [taxonomySlug, terms]) => {
if (supportedTaxonomies.includes(taxonomySlug)) {
accumulator[taxonomySlug] = terms;
}
return accumulator;
}, {});
updateQuery.taxQuery = !!Object.keys(updatedTaxQuery).length ? updatedTaxQuery : undefined;
if (newValue !== 'post') {
updateQuery.sticky = '';
}
// We need to reset `parents` because they are tied to each post type.
updateQuery.parents = [];
setQuery(updateQuery);
};
const [querySearch, setQuerySearch] = (0,external_wp_element_namespaceObject.useState)(query.search);
const onChangeDebounced = (0,external_wp_element_namespaceObject.useCallback)((0,external_wp_compose_namespaceObject.debounce)(() => {
if (query.search !== querySearch) {
setQuery({
search: querySearch
});
}
}, 250), [querySearch, query.search]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
onChangeDebounced();
return onChangeDebounced.cancel;
}, [querySearch, onChangeDebounced]);
const showInheritControl = isControlAllowed(allowedControls, 'inherit');
const showPostTypeControl = !inherit && isControlAllowed(allowedControls, 'postType');
const showColumnsControl = false;
const showOrderControl = !inherit && isControlAllowed(allowedControls, 'order');
const showStickyControl = !inherit && showSticky && isControlAllowed(allowedControls, 'sticky');
const showSettingsPanel = showInheritControl || showPostTypeControl || showColumnsControl || showOrderControl || showStickyControl;
const showTaxControl = !!taxonomies?.length && isControlAllowed(allowedControls, 'taxQuery');
const showAuthorControl = isControlAllowed(allowedControls, 'author');
const showSearchControl = isControlAllowed(allowedControls, 'search');
const showParentControl = isControlAllowed(allowedControls, 'parents') && isPostTypeHierarchical;
const showFiltersPanel = showTaxControl || showAuthorControl || showSearchControl || showParentControl;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(BlockInfo, null, (0,external_React_namespaceObject.createElement)(create_new_post_link, {
...props
})), showSettingsPanel && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, showInheritControl && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Inherit query from template'),
help: (0,external_wp_i18n_namespaceObject.__)('Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently.'),
checked: !!inherit,
onChange: value => setQuery({
inherit: !!value
})
}), showPostTypeControl && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
options: postTypesSelectOptions,
value: postType,
label: (0,external_wp_i18n_namespaceObject.__)('Post type'),
onChange: onPostTypeChange,
help: (0,external_wp_i18n_namespaceObject.__)('WordPress contains different types of content and they are divided into collections called “Post types”. By default there are a few different ones such as blog posts and pages, but plugins could add more.')
}), showColumnsControl && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Columns'),
value: displayLayout.columns,
onChange: value => setDisplayLayout({
columns: value
}),
min: 2,
max: Math.max(6, displayLayout.columns)
}), displayLayout.columns > 6 && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
status: "warning",
isDismissible: false
}, (0,external_wp_i18n_namespaceObject.__)('This column count exceeds the recommended amount and may cause visual breakage.'))), showOrderControl && (0,external_React_namespaceObject.createElement)(order_control, {
order,
orderBy,
onChange: setQuery
}), showStickyControl && (0,external_React_namespaceObject.createElement)(StickyControl, {
value: sticky,
onChange: value => setQuery({
sticky: value
})
}), (0,external_React_namespaceObject.createElement)(EnhancedPaginationControl, {
enhancedPagination: enhancedPagination,
setAttributes: setAttributes,
clientId: clientId
})), !inherit && showFiltersPanel && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
className: "block-library-query-toolspanel__filters",
label: (0,external_wp_i18n_namespaceObject.__)('Filters'),
resetAll: () => {
setQuery({
author: '',
parents: [],
search: '',
taxQuery: null
});
setQuerySearch('');
},
dropdownMenuProps: TOOLSPANEL_DROPDOWNMENU_PROPS
}, showTaxControl && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Taxonomies'),
hasValue: () => Object.values(taxQuery || {}).some(terms => !!terms.length),
onDeselect: () => setQuery({
taxQuery: null
})
}, (0,external_React_namespaceObject.createElement)(TaxonomyControls, {
onChange: setQuery,
query: query
})), showAuthorControl && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!authorIds,
label: (0,external_wp_i18n_namespaceObject.__)('Authors'),
onDeselect: () => setQuery({
author: ''
})
}, (0,external_React_namespaceObject.createElement)(author_control, {
value: authorIds,
onChange: setQuery
})), showSearchControl && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!querySearch,
label: (0,external_wp_i18n_namespaceObject.__)('Keyword'),
onDeselect: () => setQuerySearch('')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Keyword'),
value: querySearch,
onChange: setQuerySearch
})), showParentControl && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!parents?.length,
label: (0,external_wp_i18n_namespaceObject.__)('Parents'),
onDeselect: () => setQuery({
parents: []
})
}, (0,external_React_namespaceObject.createElement)(parent_control, {
parents: parents,
postType: postType,
onChange: setQuery
}))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/enhanced-pagination-modal.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const modalDescriptionId = 'wp-block-query-enhanced-pagination-modal__description';
function EnhancedPaginationModal({
clientId,
attributes: {
enhancedPagination
},
setAttributes
}) {
const [isOpen, setOpen] = (0,external_wp_element_namespaceObject.useState)(false);
const {
hasBlocksFromPlugins,
hasPostContentBlock,
hasUnsupportedBlocks
} = useUnsupportedBlocks(clientId);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (enhancedPagination && hasUnsupportedBlocks) {
setAttributes({
enhancedPagination: false
});
setOpen(true);
}
}, [enhancedPagination, hasUnsupportedBlocks, setAttributes]);
const closeModal = () => {
setOpen(false);
};
let notice = (0,external_wp_i18n_namespaceObject.__)('If you still want to prevent full page reloads, remove that block, then disable "Force page reload" again in the Query Block settings.');
if (hasBlocksFromPlugins) {
notice = (0,external_wp_i18n_namespaceObject.__)('Currently, avoiding full page reloads is not possible when non-interactive or non-clientNavigation compatible blocks from plugins are present inside the Query block.') + ' ' + notice;
} else if (hasPostContentBlock) {
notice = (0,external_wp_i18n_namespaceObject.__)('Currently, avoiding full page reloads is not possible when a Content block is present inside the Query block.') + ' ' + notice;
}
return isOpen && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Query block: Force page reload enabled'),
className: "wp-block-query__enhanced-pagination-modal",
aria: {
describedby: modalDescriptionId
},
role: "alertdialog",
focusOnMount: "firstElement",
isDismissible: false,
onRequestClose: closeModal
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
alignment: "right",
spacing: 5
}, (0,external_React_namespaceObject.createElement)("span", {
id: modalDescriptionId
}, notice), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: closeModal
}, (0,external_wp_i18n_namespaceObject.__)('OK'))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/query-content.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DEFAULTS_POSTS_PER_PAGE = 3;
const query_content_TEMPLATE = [['core/post-template']];
function QueryContent({
attributes,
setAttributes,
openPatternSelectionModal,
name,
clientId
}) {
const {
queryId,
query,
displayLayout,
tagName: TagName = 'div',
query: {
inherit
} = {}
} = attributes;
const {
__unstableMarkNextChangeAsNotPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(QueryContent);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: query_content_TEMPLATE
});
const {
postsPerPage
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
const {
getEntityRecord,
canUser
} = select(external_wp_coreData_namespaceObject.store);
const settingPerPage = canUser('read', 'settings') ? +getEntityRecord('root', 'site')?.posts_per_page : +getSettings().postsPerPage;
return {
postsPerPage: settingPerPage || DEFAULTS_POSTS_PER_PAGE
};
}, []);
// There are some effects running where some initialization logic is
// happening and setting some values to some attributes (ex. queryId).
// These updates can cause an `undo trap` where undoing will result in
// resetting again, so we need to mark these changes as not persistent
// with `__unstableMarkNextChangeAsNotPersistent`.
// Changes in query property (which is an object) need to be in the same callback,
// because updates are batched after the render and changes in different query properties
// would cause to override previous wanted changes.
(0,external_wp_element_namespaceObject.useEffect)(() => {
const newQuery = {};
// When we inherit from global query always need to set the `perPage`
// based on the reading settings.
if (inherit && query.perPage !== postsPerPage) {
newQuery.perPage = postsPerPage;
} else if (!query.perPage && postsPerPage) {
newQuery.perPage = postsPerPage;
}
if (!!Object.keys(newQuery).length) {
__unstableMarkNextChangeAsNotPersistent();
updateQuery(newQuery);
}
}, [query.perPage, postsPerPage, inherit]);
// We need this for multi-query block pagination.
// Query parameters for each block are scoped to their ID.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!Number.isFinite(queryId)) {
__unstableMarkNextChangeAsNotPersistent();
setAttributes({
queryId: instanceId
});
}
}, [queryId, instanceId]);
const updateQuery = newQuery => setAttributes({
query: {
...query,
...newQuery
}
});
const updateDisplayLayout = newDisplayLayout => setAttributes({
displayLayout: {
...displayLayout,
...newDisplayLayout
}
});
const htmlElementMessages = {
main: (0,external_wp_i18n_namespaceObject.__)('The <main> element should be used for the primary content of your document only. '),
section: (0,external_wp_i18n_namespaceObject.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element."),
aside: (0,external_wp_i18n_namespaceObject.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.")
};
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(EnhancedPaginationModal, {
attributes: attributes,
setAttributes: setAttributes,
clientId: clientId
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(QueryInspectorControls, {
attributes: attributes,
setQuery: updateQuery,
setDisplayLayout: updateDisplayLayout,
setAttributes: setAttributes,
clientId: clientId
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(QueryToolbar, {
name: name,
clientId: clientId,
attributes: attributes,
setQuery: updateQuery,
openPatternSelectionModal: openPatternSelectionModal
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('HTML element'),
options: [{
label: (0,external_wp_i18n_namespaceObject.__)('Default (<div>)'),
value: 'div'
}, {
label: '<main>',
value: 'main'
}, {
label: '<section>',
value: 'section'
}, {
label: '<aside>',
value: 'aside'
}],
value: TagName,
onChange: value => setAttributes({
tagName: value
}),
help: htmlElementMessages[TagName]
})), (0,external_React_namespaceObject.createElement)(TagName, {
...innerBlocksProps
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/query-placeholder.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function QueryPlaceholder({
attributes,
clientId,
name,
openPatternSelectionModal,
setAttributes
}) {
const [isStartingBlank, setIsStartingBlank] = (0,external_wp_element_namespaceObject.useState)(false);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const blockNameForPatterns = useBlockNameForPatterns(clientId, attributes);
const {
blockType,
activeBlockVariation,
hasPatterns
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getActiveBlockVariation,
getBlockType
} = select(external_wp_blocks_namespaceObject.store);
const {
getBlockRootClientId,
getPatternsByBlockTypes
} = select(external_wp_blockEditor_namespaceObject.store);
const rootClientId = getBlockRootClientId(clientId);
return {
blockType: getBlockType(name),
activeBlockVariation: getActiveBlockVariation(name, attributes),
hasPatterns: !!getPatternsByBlockTypes(blockNameForPatterns, rootClientId).length
};
}, [name, blockNameForPatterns, clientId, attributes]);
const icon = activeBlockVariation?.icon?.src || activeBlockVariation?.icon || blockType?.icon?.src;
const label = activeBlockVariation?.title || blockType?.title;
if (isStartingBlank) {
return (0,external_React_namespaceObject.createElement)(QueryVariationPicker, {
clientId: clientId,
attributes: attributes,
setAttributes: setAttributes,
icon: icon,
label: label
});
}
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
icon: icon,
label: label,
instructions: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern for the query loop or start blank.')
}, !!hasPatterns && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: openPatternSelectionModal
}, (0,external_wp_i18n_namespaceObject.__)('Choose')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "secondary",
onClick: () => {
setIsStartingBlank(true);
}
}, (0,external_wp_i18n_namespaceObject.__)('Start blank'))));
}
function QueryVariationPicker({
clientId,
attributes,
setAttributes,
icon,
label
}) {
const scopeVariations = useScopedBlockVariations(attributes);
const {
replaceInnerBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockVariationPicker, {
icon: icon,
label: label,
variations: scopeVariations,
onSelect: variation => {
if (variation.attributes) {
setAttributes({
...variation.attributes,
query: {
...variation.attributes.query,
postType: attributes.query.postType || variation.attributes.query.postType
},
namespace: attributes.namespace
});
}
if (variation.innerBlocks) {
replaceInnerBlocks(clientId, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(variation.innerBlocks), false);
}
}
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/utils/search-patterns.js
/**
* External dependencies
*/
/**
* 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 = remove_accents_default()(input);
// Trim & Lowercase.
input = input.trim().toLowerCase();
return input;
}
/**
* Get the search rank for a given pattern and a specific search term.
*
* @param {Object} pattern Pattern to rank
* @param {string} searchValue Search term
* @return {number} A pattern search rank
*/
function getPatternSearchRank(pattern, searchValue) {
const normalizedSearchValue = normalizeSearchInput(searchValue);
const normalizedTitle = normalizeSearchInput(pattern.title);
let rank = 0;
if (normalizedSearchValue === normalizedTitle) {
rank += 30;
} else if (normalizedTitle.startsWith(normalizedSearchValue)) {
rank += 20;
} else {
const searchTerms = normalizedSearchValue.split(' ');
const hasMatchedTerms = searchTerms.every(searchTerm => normalizedTitle.includes(searchTerm));
// Prefer pattern with every search word in the title.
if (hasMatchedTerms) {
rank += 10;
}
}
return rank;
}
/**
* Filters an pattern list given a search term.
*
* @param {Array} patterns Item list
* @param {string} searchValue Search input.
*
* @return {Array} Filtered pattern list.
*/
function searchPatterns(patterns = [], searchValue = '') {
if (!searchValue) {
return patterns;
}
const rankedPatterns = patterns.map(pattern => {
return [pattern, getPatternSearchRank(pattern, searchValue)];
}).filter(([, rank]) => rank > 0);
rankedPatterns.sort(([, rank1], [, rank2]) => rank2 - rank1);
return rankedPatterns.map(([pattern]) => pattern);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/pattern-selection-modal.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PatternSelectionModal({
clientId,
attributes,
setIsPatternSelectionModalOpen
}) {
const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)('');
const {
replaceBlock,
selectBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const onBlockPatternSelect = (pattern, blocks) => {
const {
newBlocks,
queryClientIds
} = getTransformedBlocksFromPattern(blocks, attributes);
replaceBlock(clientId, newBlocks);
if (queryClientIds[0]) {
selectBlock(queryClientIds[0]);
}
};
// When we preview Query Loop blocks we should prefer the current
// block's postType, which is passed through block context.
const blockPreviewContext = (0,external_wp_element_namespaceObject.useMemo)(() => ({
previewPostType: attributes.query.postType
}), [attributes.query.postType]);
const blockNameForPatterns = useBlockNameForPatterns(clientId, attributes);
const blockPatterns = usePatterns(clientId, blockNameForPatterns);
const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => {
return searchPatterns(blockPatterns, searchValue);
}, [blockPatterns, searchValue]);
const shownBlockPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredBlockPatterns);
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
overlayClassName: "block-library-query-pattern__selection-modal",
title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'),
onRequestClose: () => setIsPatternSelectionModalOpen(false),
isFullScreen: true
}, (0,external_React_namespaceObject.createElement)("div", {
className: "block-library-query-pattern__selection-content"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "block-library-query-pattern__selection-search"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, {
__nextHasNoMarginBottom: true,
onChange: setSearchValue,
value: searchValue,
label: (0,external_wp_i18n_namespaceObject.__)('Search for patterns'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Search')
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, {
value: blockPreviewContext
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
blockPatterns: filteredBlockPatterns,
shownPatterns: shownBlockPatterns,
onClickPattern: onBlockPatternSelect
}))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const QueryEdit = props => {
const {
clientId,
attributes
} = props;
const [isPatternSelectionModalOpen, setIsPatternSelectionModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
const hasInnerBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_blockEditor_namespaceObject.store).getBlocks(clientId).length, [clientId]);
const Component = hasInnerBlocks ? QueryContent : QueryPlaceholder;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(Component, {
...props,
openPatternSelectionModal: () => setIsPatternSelectionModalOpen(true)
}), isPatternSelectionModalOpen && (0,external_React_namespaceObject.createElement)(PatternSelectionModal, {
clientId: clientId,
attributes: attributes,
setIsPatternSelectionModalOpen: setIsPatternSelectionModalOpen
}));
};
/* harmony default export */ const query_edit = (QueryEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/save.js
/**
* WordPress dependencies
*/
function QuerySave({
attributes: {
tagName: Tag = 'div'
}
}) {
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save();
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
return (0,external_React_namespaceObject.createElement)(Tag, {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/icons.js
/**
* WordPress dependencies
*/
const titleDate = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 48 48"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M41 9H7v3h34V9zm-22 5H7v1h12v-1zM7 26h12v1H7v-1zm34-5H7v3h34v-3zM7 38h12v1H7v-1zm34-5H7v3h34v-3z"
}));
const titleExcerpt = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 48 48"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M41 9H7v3h34V9zm-4 5H7v1h30v-1zm4 3H7v1h34v-1zM7 20h30v1H7v-1zm0 12h30v1H7v-1zm34 3H7v1h34v-1zM7 38h30v1H7v-1zm34-11H7v3h34v-3z"
}));
const titleDateExcerpt = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 48 48"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M41 9H7v3h34V9zm-22 5H7v1h12v-1zm22 3H7v1h34v-1zM7 20h34v1H7v-1zm0 12h12v1H7v-1zm34 3H7v1h34v-1zM7 38h34v1H7v-1zm34-11H7v3h34v-3z"
}));
const imageDateTitle = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 48 48"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M7 9h34v6H7V9zm12 8H7v1h12v-1zm18 3H7v1h30v-1zm0 18H7v1h30v-1zM7 35h12v1H7v-1zm34-8H7v6h34v-6z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/variations.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const QUERY_DEFAULT_ATTRIBUTES = {
query: {
perPage: 3,
pages: 0,
offset: 0,
postType: 'post',
order: 'desc',
orderBy: 'date',
author: '',
search: '',
exclude: [],
sticky: '',
inherit: false
}
};
const query_variations_variations = [{
name: 'posts-list',
title: (0,external_wp_i18n_namespaceObject.__)('Posts List'),
description: (0,external_wp_i18n_namespaceObject.__)('Display a list of your most recent posts, excluding sticky posts.'),
icon: post_list,
attributes: {
namespace: 'core/posts-list',
query: {
perPage: 4,
pages: 1,
offset: 0,
postType: 'post',
order: 'desc',
orderBy: 'date',
author: '',
search: '',
sticky: 'exclude',
inherit: false
}
},
scope: ['inserter'],
isActive: ({
namespace,
query
}) => {
return namespace === 'core/posts-list' && query.postType === 'post';
}
}, {
name: 'title-date',
title: (0,external_wp_i18n_namespaceObject.__)('Title & Date'),
icon: titleDate,
attributes: {
...QUERY_DEFAULT_ATTRIBUTES
},
innerBlocks: [['core/post-template', {}, [['core/post-title'], ['core/post-date']]], ['core/query-pagination'], ['core/query-no-results']],
scope: ['block']
}, {
name: 'title-excerpt',
title: (0,external_wp_i18n_namespaceObject.__)('Title & Excerpt'),
icon: titleExcerpt,
attributes: {
...QUERY_DEFAULT_ATTRIBUTES
},
innerBlocks: [['core/post-template', {}, [['core/post-title'], ['core/post-excerpt']]], ['core/query-pagination'], ['core/query-no-results']],
scope: ['block']
}, {
name: 'title-date-excerpt',
title: (0,external_wp_i18n_namespaceObject.__)('Title, Date, & Excerpt'),
icon: titleDateExcerpt,
attributes: {
...QUERY_DEFAULT_ATTRIBUTES
},
innerBlocks: [['core/post-template', {}, [['core/post-title'], ['core/post-date'], ['core/post-excerpt']]], ['core/query-pagination'], ['core/query-no-results']],
scope: ['block']
}, {
name: 'image-date-title',
title: (0,external_wp_i18n_namespaceObject.__)('Image, Date, & Title'),
icon: imageDateTitle,
attributes: {
...QUERY_DEFAULT_ATTRIBUTES
},
innerBlocks: [['core/post-template', {}, [['core/post-featured-image'], ['core/post-date'], ['core/post-title']]], ['core/query-pagination'], ['core/query-no-results']],
scope: ['block']
}];
/* harmony default export */ const query_variations = (query_variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/deprecated.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
cleanEmptyObject: deprecated_cleanEmptyObject
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const migrateToTaxQuery = attributes => {
const {
query
} = attributes;
const {
categoryIds,
tagIds,
...newQuery
} = query;
if (query.categoryIds?.length || query.tagIds?.length) {
newQuery.taxQuery = {
category: !!query.categoryIds?.length ? query.categoryIds : undefined,
post_tag: !!query.tagIds?.length ? query.tagIds : undefined
};
}
return {
...attributes,
query: newQuery
};
};
const migrateColors = (attributes, innerBlocks) => {
// Remove color style attributes from the Query block.
const {
style,
backgroundColor,
gradient,
textColor,
...newAttributes
} = attributes;
const hasColorStyles = backgroundColor || gradient || textColor || style?.color || style?.elements?.link;
// If the query block doesn't currently have any color styles,
// nothing needs migrating.
if (!hasColorStyles) {
return [attributes, innerBlocks];
}
// Clean color values from style attribute object.
if (style) {
newAttributes.style = deprecated_cleanEmptyObject({
...style,
color: undefined,
elements: {
...style.elements,
link: undefined
}
});
}
// If the inner blocks are already wrapped in a single group
// block, add the color support styles to that group block.
if (hasSingleInnerGroupBlock(innerBlocks)) {
const groupBlock = innerBlocks[0];
// Create new styles for the group block.
const hasStyles = style?.color || style?.elements?.link || groupBlock.attributes.style;
const newStyles = hasStyles ? deprecated_cleanEmptyObject({
...groupBlock.attributes.style,
color: style?.color,
elements: style?.elements?.link ? {
link: style?.elements?.link
} : undefined
}) : undefined;
// Create a new Group block from the original.
const updatedGroupBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
...groupBlock.attributes,
backgroundColor,
gradient,
textColor,
style: newStyles
}, groupBlock.innerBlocks);
return [newAttributes, [updatedGroupBlock]];
}
// When we don't have a single wrapping group block for the inner
// blocks, wrap the current inner blocks in a group applying the
// color styles to that.
const newGroupBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
backgroundColor,
gradient,
textColor,
style: deprecated_cleanEmptyObject({
color: style?.color,
elements: style?.elements?.link ? {
link: style?.elements?.link
} : undefined
})
}, innerBlocks);
return [newAttributes, [newGroupBlock]];
};
const hasSingleInnerGroupBlock = (innerBlocks = []) => innerBlocks.length === 1 && innerBlocks[0].name === 'core/group';
const migrateToConstrainedLayout = attributes => {
const {
layout = null
} = attributes;
if (!layout) {
return attributes;
}
const {
inherit = null,
contentSize = null,
...newLayout
} = layout;
if (inherit || contentSize) {
return {
...attributes,
layout: {
...newLayout,
contentSize,
type: 'constrained'
}
};
}
return attributes;
};
const findPostTemplateBlock = (innerBlocks = []) => {
let foundBlock = null;
for (const block of innerBlocks) {
if (block.name === 'core/post-template') {
foundBlock = block;
break;
} else if (block.innerBlocks.length) {
foundBlock = findPostTemplateBlock(block.innerBlocks);
}
}
return foundBlock;
};
const replacePostTemplateBlock = (innerBlocks = [], replacementBlock) => {
innerBlocks.forEach((block, index) => {
if (block.name === 'core/post-template') {
innerBlocks.splice(index, 1, replacementBlock);
} else if (block.innerBlocks.length) {
block.innerBlocks = replacePostTemplateBlock(block.innerBlocks, replacementBlock);
}
});
return innerBlocks;
};
const migrateDisplayLayout = (attributes, innerBlocks) => {
const {
displayLayout = null,
...newAttributes
} = attributes;
if (!displayLayout) {
return [attributes, innerBlocks];
}
const postTemplateBlock = findPostTemplateBlock(innerBlocks);
if (!postTemplateBlock) {
return [attributes, innerBlocks];
}
const {
type,
columns
} = displayLayout;
// Convert custom displayLayout values to canonical layout types.
const updatedLayoutType = type === 'flex' ? 'grid' : 'default';
const newPostTemplateBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/post-template', {
...postTemplateBlock.attributes,
layout: {
type: updatedLayoutType,
...(columns && {
columnCount: columns
})
}
}, postTemplateBlock.innerBlocks);
return [newAttributes, replacePostTemplateBlock(innerBlocks, newPostTemplateBlock)];
};
// Version with NO wrapper `div` element.
const query_deprecated_v1 = {
attributes: {
queryId: {
type: 'number'
},
query: {
type: 'object',
default: {
perPage: null,
pages: 0,
offset: 0,
postType: 'post',
categoryIds: [],
tagIds: [],
order: 'desc',
orderBy: 'date',
author: '',
search: '',
exclude: [],
sticky: '',
inherit: true
}
},
layout: {
type: 'object',
default: {
type: 'list'
}
}
},
supports: {
html: false
},
migrate(attributes, innerBlocks) {
const withTaxQuery = migrateToTaxQuery(attributes);
const {
layout,
...restWithTaxQuery
} = withTaxQuery;
const newAttributes = {
...restWithTaxQuery,
displayLayout: withTaxQuery.layout
};
return migrateDisplayLayout(newAttributes, innerBlocks);
},
save() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
};
// Version with `categoryIds and tagIds`.
const query_deprecated_v2 = {
attributes: {
queryId: {
type: 'number'
},
query: {
type: 'object',
default: {
perPage: null,
pages: 0,
offset: 0,
postType: 'post',
categoryIds: [],
tagIds: [],
order: 'desc',
orderBy: 'date',
author: '',
search: '',
exclude: [],
sticky: '',
inherit: true
}
},
tagName: {
type: 'string',
default: 'div'
},
displayLayout: {
type: 'object',
default: {
type: 'list'
}
}
},
supports: {
align: ['wide', 'full'],
html: false,
color: {
gradients: true,
link: true
},
layout: true
},
isEligible: ({
query: {
categoryIds,
tagIds
} = {}
}) => categoryIds || tagIds,
migrate(attributes, innerBlocks) {
const withTaxQuery = migrateToTaxQuery(attributes);
const [withColorAttributes, withColorInnerBlocks] = migrateColors(withTaxQuery, innerBlocks);
const withConstrainedLayoutAttributes = migrateToConstrainedLayout(withColorAttributes);
return migrateDisplayLayout(withConstrainedLayoutAttributes, withColorInnerBlocks);
},
save({
attributes: {
tagName: Tag = 'div'
}
}) {
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save();
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
return (0,external_React_namespaceObject.createElement)(Tag, {
...innerBlocksProps
});
}
};
// Version with color support prior to moving it to the PostTemplate block.
const query_deprecated_v3 = {
attributes: {
queryId: {
type: 'number'
},
query: {
type: 'object',
default: {
perPage: null,
pages: 0,
offset: 0,
postType: 'post',
order: 'desc',
orderBy: 'date',
author: '',
search: '',
exclude: [],
sticky: '',
inherit: true,
taxQuery: null,
parents: []
}
},
tagName: {
type: 'string',
default: 'div'
},
displayLayout: {
type: 'object',
default: {
type: 'list'
}
},
namespace: {
type: 'string'
}
},
supports: {
align: ['wide', 'full'],
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
layout: true
},
isEligible(attributes) {
const {
style,
backgroundColor,
gradient,
textColor
} = attributes;
return backgroundColor || gradient || textColor || style?.color || style?.elements?.link;
},
migrate(attributes, innerBlocks) {
const [withColorAttributes, withColorInnerBlocks] = migrateColors(attributes, innerBlocks);
const withConstrainedLayoutAttributes = migrateToConstrainedLayout(withColorAttributes);
return migrateDisplayLayout(withConstrainedLayoutAttributes, withColorInnerBlocks);
},
save({
attributes: {
tagName: Tag = 'div'
}
}) {
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save();
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
return (0,external_React_namespaceObject.createElement)(Tag, {
...innerBlocksProps
});
}
};
const query_deprecated_v4 = {
attributes: {
queryId: {
type: 'number'
},
query: {
type: 'object',
default: {
perPage: null,
pages: 0,
offset: 0,
postType: 'post',
order: 'desc',
orderBy: 'date',
author: '',
search: '',
exclude: [],
sticky: '',
inherit: true,
taxQuery: null,
parents: []
}
},
tagName: {
type: 'string',
default: 'div'
},
displayLayout: {
type: 'object',
default: {
type: 'list'
}
},
namespace: {
type: 'string'
}
},
supports: {
align: ['wide', 'full'],
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
layout: true
},
save({
attributes: {
tagName: Tag = 'div'
}
}) {
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save();
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
return (0,external_React_namespaceObject.createElement)(Tag, {
...innerBlocksProps
});
},
isEligible: ({
layout
}) => layout?.inherit || layout?.contentSize && layout?.type !== 'constrained',
migrate(attributes, innerBlocks) {
const withConstrainedLayoutAttributes = migrateToConstrainedLayout(attributes);
return migrateDisplayLayout(withConstrainedLayoutAttributes, innerBlocks);
}
};
const query_deprecated_v5 = {
attributes: {
queryId: {
type: 'number'
},
query: {
type: 'object',
default: {
perPage: null,
pages: 0,
offset: 0,
postType: 'post',
order: 'desc',
orderBy: 'date',
author: '',
search: '',
exclude: [],
sticky: '',
inherit: true,
taxQuery: null,
parents: []
}
},
tagName: {
type: 'string',
default: 'div'
},
displayLayout: {
type: 'object',
default: {
type: 'list'
}
},
namespace: {
type: 'string'
}
},
supports: {
align: ['wide', 'full'],
anchor: true,
html: false,
layout: true
},
save({
attributes: {
tagName: Tag = 'div'
}
}) {
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save();
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
return (0,external_React_namespaceObject.createElement)(Tag, {
...innerBlocksProps
});
},
isEligible: ({
displayLayout
}) => {
return !!displayLayout;
},
migrate: migrateDisplayLayout
};
const query_deprecated_deprecated = [query_deprecated_v5, query_deprecated_v4, query_deprecated_v3, query_deprecated_v2, query_deprecated_v1];
/* harmony default export */ const query_deprecated = (query_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const query_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/query",
title: "Query Loop",
category: "theme",
description: "An advanced block that allows displaying post types based on different query parameters and visual configurations.",
textdomain: "default",
attributes: {
queryId: {
type: "number"
},
query: {
type: "object",
"default": {
perPage: null,
pages: 0,
offset: 0,
postType: "post",
order: "desc",
orderBy: "date",
author: "",
search: "",
exclude: [],
sticky: "",
inherit: true,
taxQuery: null,
parents: []
}
},
tagName: {
type: "string",
"default": "div"
},
namespace: {
type: "string"
},
enhancedPagination: {
type: "boolean",
"default": false
}
},
providesContext: {
queryId: "queryId",
query: "query",
displayLayout: "displayLayout",
enhancedPagination: "enhancedPagination"
},
supports: {
align: ["wide", "full"],
html: false,
layout: true,
interactivity: true
},
editorStyle: "wp-block-query-editor"
};
const {
name: query_name
} = query_metadata;
const query_settings = {
icon: library_loop,
edit: query_edit,
save: QuerySave,
variations: query_variations,
deprecated: query_deprecated
};
const query_init = () => initBlock({
name: query_name,
metadata: query_metadata,
settings: query_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-no-results/edit.js
/**
* WordPress dependencies
*/
const query_no_results_edit_TEMPLATE = [['core/paragraph', {
placeholder: (0,external_wp_i18n_namespaceObject.__)('Add text or blocks that will display when a query returns no results.')
}]];
function QueryNoResultsEdit() {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: query_no_results_edit_TEMPLATE
});
return (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-no-results/save.js
/**
* WordPress dependencies
*/
function QueryNoResultsSave() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-no-results/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const query_no_results_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/query-no-results",
title: "No results",
category: "theme",
description: "Contains the block elements used to render content when no query results are found.",
parent: ["core/query"],
textdomain: "default",
usesContext: ["queryId", "query"],
supports: {
align: true,
reusable: false,
html: false,
color: {
gradients: true,
link: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: query_no_results_name
} = query_no_results_metadata;
const query_no_results_settings = {
icon: library_loop,
edit: QueryNoResultsEdit,
save: QueryNoResultsSave
};
const query_no_results_init = () => initBlock({
name: query_no_results_name,
metadata: query_no_results_metadata,
settings: query_no_results_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-pagination/query-pagination-arrow-controls.js
/**
* WordPress dependencies
*/
function QueryPaginationArrowControls({
value,
onChange
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Arrow'),
value: value,
onChange: onChange,
help: (0,external_wp_i18n_namespaceObject.__)('A decorative arrow appended to the next and previous page link.'),
isBlock: true
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "none",
label: (0,external_wp_i18n_namespaceObject._x)('None', 'Arrow option for Query Pagination Next/Previous blocks')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "arrow",
label: (0,external_wp_i18n_namespaceObject._x)('Arrow', 'Arrow option for Query Pagination Next/Previous blocks')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
value: "chevron",
label: (0,external_wp_i18n_namespaceObject._x)('Chevron', 'Arrow option for Query Pagination Next/Previous blocks')
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-pagination/query-pagination-label-control.js
/**
* WordPress dependencies
*/
function QueryPaginationLabelControl({
value,
onChange
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show label text'),
help: (0,external_wp_i18n_namespaceObject.__)('Toggle off to hide the label text, e.g. "Next Page".'),
onChange: onChange,
checked: value === true
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-pagination/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const query_pagination_edit_TEMPLATE = [['core/query-pagination-previous'], ['core/query-pagination-numbers'], ['core/query-pagination-next']];
function edit_QueryPaginationEdit({
attributes: {
paginationArrow,
showLabel
},
setAttributes,
clientId
}) {
const hasNextPreviousBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlocks
} = select(external_wp_blockEditor_namespaceObject.store);
const innerBlocks = getBlocks(clientId);
/**
* Show the `paginationArrow` and `showLabel` controls only if a
* `QueryPaginationNext/Previous` block exists.
*/
return innerBlocks?.find(innerBlock => {
return ['core/query-pagination-next', 'core/query-pagination-previous'].includes(innerBlock.name);
});
}, [clientId]);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: query_pagination_edit_TEMPLATE
});
// Always show label text if paginationArrow is set to 'none'.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (paginationArrow === 'none' && !showLabel) {
setAttributes({
showLabel: true
});
}
}, [paginationArrow, setAttributes, showLabel]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, hasNextPreviousBlocks && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(QueryPaginationArrowControls, {
value: paginationArrow,
onChange: value => {
setAttributes({
paginationArrow: value
});
}
}), paginationArrow !== 'none' && (0,external_React_namespaceObject.createElement)(QueryPaginationLabelControl, {
value: showLabel,
onChange: value => {
setAttributes({
showLabel: value
});
}
}))), (0,external_React_namespaceObject.createElement)("nav", {
...innerBlocksProps
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-pagination/save.js
/**
* WordPress dependencies
*/
function query_pagination_save_save() {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-pagination/deprecated.js
/**
* WordPress dependencies
*/
const query_pagination_deprecated_deprecated = [
// Version with wrapper `div` element.
{
save() {
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
}
}];
/* harmony default export */ const query_pagination_deprecated = (query_pagination_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-pagination/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const query_pagination_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/query-pagination",
title: "Pagination",
category: "theme",
ancestor: ["core/query"],
allowedBlocks: ["core/query-pagination-previous", "core/query-pagination-numbers", "core/query-pagination-next"],
description: "Displays a paginated navigation to next/previous set of posts, when applicable.",
textdomain: "default",
attributes: {
paginationArrow: {
type: "string",
"default": "none"
},
showLabel: {
type: "boolean",
"default": true
}
},
usesContext: ["queryId", "query"],
providesContext: {
paginationArrow: "paginationArrow",
showLabel: "showLabel"
},
supports: {
align: true,
reusable: false,
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
layout: {
allowSwitching: false,
allowInheriting: false,
"default": {
type: "flex"
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-query-pagination-editor",
style: "wp-block-query-pagination"
};
const {
name: query_pagination_name
} = query_pagination_metadata;
const query_pagination_settings = {
icon: query_pagination,
edit: edit_QueryPaginationEdit,
save: query_pagination_save_save,
deprecated: query_pagination_deprecated
};
const query_pagination_init = () => initBlock({
name: query_pagination_name,
metadata: query_pagination_metadata,
settings: query_pagination_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-pagination-next/edit.js
/**
* WordPress dependencies
*/
const query_pagination_next_edit_arrowMap = {
none: '',
arrow: '→',
chevron: '»'
};
function QueryPaginationNextEdit({
attributes: {
label
},
setAttributes,
context: {
paginationArrow,
showLabel
}
}) {
const displayArrow = query_pagination_next_edit_arrowMap[paginationArrow];
return (0,external_React_namespaceObject.createElement)("a", {
href: "#pagination-next-pseudo-link",
onClick: event => event.preventDefault(),
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)()
}, showLabel && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.PlainText, {
__experimentalVersion: 2,
tagName: "span",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Next page link'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Next Page'),
value: label,
onChange: newLabel => setAttributes({
label: newLabel
})
}), displayArrow && (0,external_React_namespaceObject.createElement)("span", {
className: `wp-block-query-pagination-next-arrow is-arrow-${paginationArrow}`,
"aria-hidden": true
}, displayArrow));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-pagination-next/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const query_pagination_next_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/query-pagination-next",
title: "Next Page",
category: "theme",
parent: ["core/query-pagination"],
description: "Displays the next posts page link.",
textdomain: "default",
attributes: {
label: {
type: "string"
}
},
usesContext: ["queryId", "query", "paginationArrow", "showLabel", "enhancedPagination"],
supports: {
reusable: false,
html: false,
color: {
gradients: true,
text: false,
__experimentalDefaultControls: {
background: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: query_pagination_next_name
} = query_pagination_next_metadata;
const query_pagination_next_settings = {
icon: query_pagination_next,
edit: QueryPaginationNextEdit
};
const query_pagination_next_init = () => initBlock({
name: query_pagination_next_name,
metadata: query_pagination_next_metadata,
settings: query_pagination_next_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-pagination-numbers/edit.js
/**
* WordPress dependencies
*/
const createPaginationItem = (content, Tag = 'a', extraClass = '') => (0,external_React_namespaceObject.createElement)(Tag, {
key: content,
className: `page-numbers ${extraClass}`
}, content);
const previewPaginationNumbers = midSize => {
const paginationItems = [];
// First set of pagination items.
for (let i = 1; i <= midSize; i++) {
paginationItems.push(createPaginationItem(i));
}
// Current pagination item.
paginationItems.push(createPaginationItem(midSize + 1, 'span', 'current'));
// Second set of pagination items.
for (let i = 1; i <= midSize; i++) {
paginationItems.push(createPaginationItem(midSize + 1 + i));
}
// Dots.
paginationItems.push(createPaginationItem('...', 'span', 'dots'));
// Last pagination item.
paginationItems.push(createPaginationItem(midSize * 2 + 3));
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, paginationItems);
};
function QueryPaginationNumbersEdit({
attributes,
setAttributes
}) {
const {
midSize
} = attributes;
const paginationNumbers = previewPaginationNumbers(parseInt(midSize, 10));
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Number of links'),
help: (0,external_wp_i18n_namespaceObject.__)('Specify how many links can appear before and after the current page number. Links to the first, current and last page are always visible.'),
value: midSize,
onChange: value => {
setAttributes({
midSize: parseInt(value, 10)
});
},
min: 0,
max: 5,
withInputField: false
}))), (0,external_React_namespaceObject.createElement)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)()
}, paginationNumbers));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-pagination-numbers/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const query_pagination_numbers_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/query-pagination-numbers",
title: "Page Numbers",
category: "theme",
parent: ["core/query-pagination"],
description: "Displays a list of page numbers for pagination.",
textdomain: "default",
attributes: {
midSize: {
type: "number",
"default": 2
}
},
usesContext: ["queryId", "query", "enhancedPagination"],
supports: {
reusable: false,
html: false,
color: {
gradients: true,
text: false,
__experimentalDefaultControls: {
background: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-query-pagination-numbers-editor"
};
const {
name: query_pagination_numbers_name
} = query_pagination_numbers_metadata;
const query_pagination_numbers_settings = {
icon: query_pagination_numbers,
edit: QueryPaginationNumbersEdit
};
const query_pagination_numbers_init = () => initBlock({
name: query_pagination_numbers_name,
metadata: query_pagination_numbers_metadata,
settings: query_pagination_numbers_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-pagination-previous/edit.js
/**
* WordPress dependencies
*/
const query_pagination_previous_edit_arrowMap = {
none: '',
arrow: '←',
chevron: '«'
};
function QueryPaginationPreviousEdit({
attributes: {
label
},
setAttributes,
context: {
paginationArrow,
showLabel
}
}) {
const displayArrow = query_pagination_previous_edit_arrowMap[paginationArrow];
return (0,external_React_namespaceObject.createElement)("a", {
href: "#pagination-previous-pseudo-link",
onClick: event => event.preventDefault(),
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)()
}, displayArrow && (0,external_React_namespaceObject.createElement)("span", {
className: `wp-block-query-pagination-previous-arrow is-arrow-${paginationArrow}`,
"aria-hidden": true
}, displayArrow), showLabel && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.PlainText, {
__experimentalVersion: 2,
tagName: "span",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Previous page link'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Previous Page'),
value: label,
onChange: newLabel => setAttributes({
label: newLabel
})
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-pagination-previous/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const query_pagination_previous_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/query-pagination-previous",
title: "Previous Page",
category: "theme",
parent: ["core/query-pagination"],
description: "Displays the previous posts page link.",
textdomain: "default",
attributes: {
label: {
type: "string"
}
},
usesContext: ["queryId", "query", "paginationArrow", "showLabel", "enhancedPagination"],
supports: {
reusable: false,
html: false,
color: {
gradients: true,
text: false,
__experimentalDefaultControls: {
background: true
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: query_pagination_previous_name
} = query_pagination_previous_metadata;
const query_pagination_previous_settings = {
icon: query_pagination_previous,
edit: QueryPaginationPreviousEdit
};
const query_pagination_previous_init = () => initBlock({
name: query_pagination_previous_name,
metadata: query_pagination_previous_metadata,
settings: query_pagination_previous_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-title/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const SUPPORTED_TYPES = ['archive', 'search'];
function QueryTitleEdit({
attributes: {
type,
level,
textAlign,
showPrefix,
showSearchTerm
},
setAttributes
}) {
const {
archiveTypeTitle,
archiveNameLabel
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
const {
__experimentalArchiveTitleNameLabel,
__experimentalArchiveTitleTypeLabel
} = getSettings();
return {
archiveTypeTitle: __experimentalArchiveTitleTypeLabel,
archiveNameLabel: __experimentalArchiveTitleNameLabel
};
});
const TagName = `h${level}`;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()('wp-block-query-title__placeholder', {
[`has-text-align-${textAlign}`]: textAlign
})
});
if (!SUPPORTED_TYPES.includes(type)) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Provided type is not supported.')));
}
let titleElement;
if (type === 'archive') {
let title;
if (archiveTypeTitle) {
if (showPrefix) {
if (archiveNameLabel) {
title = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Archive type title e.g: "Category", 2: Label of the archive e.g: "Shoes" */
(0,external_wp_i18n_namespaceObject.__)('%1$s: %2$s'), archiveTypeTitle, archiveNameLabel);
} else {
title = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Archive type title e.g: "Category", "Tag"... */
(0,external_wp_i18n_namespaceObject.__)('%s: Name'), archiveTypeTitle);
}
} else if (archiveNameLabel) {
title = archiveNameLabel;
} else {
title = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Archive type title e.g: "Category", "Tag"... */
(0,external_wp_i18n_namespaceObject.__)('%s name'), archiveTypeTitle);
}
} else {
title = showPrefix ? (0,external_wp_i18n_namespaceObject.__)('Archive type: Name') : (0,external_wp_i18n_namespaceObject.__)('Archive title');
}
titleElement = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show archive type in title'),
onChange: () => setAttributes({
showPrefix: !showPrefix
}),
checked: showPrefix
}))), (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, title));
}
if (type === 'search') {
titleElement = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show search term in title'),
onChange: () => setAttributes({
showSearchTerm: !showSearchTerm
}),
checked: showSearchTerm
}))), (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, showSearchTerm ? (0,external_wp_i18n_namespaceObject.__)('Search results for: “search term”') : (0,external_wp_i18n_namespaceObject.__)('Search results')));
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.HeadingLevelDropdown, {
value: level,
onChange: newLevel => setAttributes({
level: newLevel
})
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), titleElement);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-title/variations.js
/**
* WordPress dependencies
*/
const query_title_variations_variations = [{
isDefault: true,
name: 'archive-title',
title: (0,external_wp_i18n_namespaceObject.__)('Archive Title'),
description: (0,external_wp_i18n_namespaceObject.__)('Display the archive title based on the queried object.'),
icon: library_title,
attributes: {
type: 'archive'
},
scope: ['inserter']
}, {
isDefault: false,
name: 'search-title',
title: (0,external_wp_i18n_namespaceObject.__)('Search Results Title'),
description: (0,external_wp_i18n_namespaceObject.__)('Display the search results title based on the queried object.'),
icon: library_title,
attributes: {
type: 'search'
},
scope: ['inserter']
}];
/**
* Add `isActive` function to all `query-title` variations, if not defined.
* `isActive` function is used to find a variation match from a created
* Block by providing its attributes.
*/
query_title_variations_variations.forEach(variation => {
if (variation.isActive) return;
variation.isActive = (blockAttributes, variationAttributes) => blockAttributes.type === variationAttributes.type;
});
/* harmony default export */ const query_title_variations = (query_title_variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-title/deprecated.js
/**
* Internal dependencies
*/
const query_title_deprecated_v1 = {
attributes: {
type: {
type: 'string'
},
textAlign: {
type: 'string'
},
level: {
type: 'number',
default: 1
}
},
supports: {
align: ['wide', 'full'],
html: false,
color: {
gradients: true
},
spacing: {
margin: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true
}
},
save() {
return null;
},
migrate: migrate_font_family,
isEligible({
style
}) {
return style?.typography?.fontFamily;
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const query_title_deprecated = ([query_title_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query-title/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const query_title_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/query-title",
title: "Query Title",
category: "theme",
description: "Display the query title.",
textdomain: "default",
attributes: {
type: {
type: "string"
},
textAlign: {
type: "string"
},
level: {
type: "number",
"default": 1
},
showPrefix: {
type: "boolean",
"default": true
},
showSearchTerm: {
type: "boolean",
"default": true
}
},
supports: {
align: ["wide", "full"],
html: false,
color: {
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-query-title"
};
const {
name: query_title_name
} = query_title_metadata;
const query_title_settings = {
icon: library_title,
edit: QueryTitleEdit,
variations: query_title_variations,
deprecated: query_title_deprecated
};
const query_title_init = () => initBlock({
name: query_title_name,
metadata: query_title_metadata,
settings: query_title_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/quote.js
/**
* WordPress dependencies
*/
const quote = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13 6v6h5.2v4c0 .8-.2 1.4-.5 1.7-.6.6-1.6.6-2.5.5h-.3v1.5h.5c1 0 2.3-.1 3.3-1 .6-.6 1-1.6 1-2.8V6H13zm-9 6h5.2v4c0 .8-.2 1.4-.5 1.7-.6.6-1.6.6-2.5.5h-.3v1.5h.5c1 0 2.3-.1 3.3-1 .6-.6 1-1.6 1-2.8V6H4v6z"
}));
/* harmony default export */ const library_quote = (quote);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/quote/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const migrateToQuoteV2 = attributes => {
const {
value,
...restAttributes
} = attributes;
return [{
...restAttributes
}, value ? (0,external_wp_blocks_namespaceObject.parseWithAttributeSchema)(value, {
type: 'array',
source: 'query',
selector: 'p',
query: {
content: {
type: 'string',
source: 'html'
}
}
}).map(({
content
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content
})) : (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph')];
};
const quote_deprecated_v3 = {
attributes: {
value: {
type: 'string',
source: 'html',
selector: 'blockquote',
multiline: 'p',
default: '',
__experimentalRole: 'content'
},
citation: {
type: 'string',
source: 'html',
selector: 'cite',
default: '',
__experimentalRole: 'content'
},
align: {
type: 'string'
}
},
supports: {
anchor: true,
__experimentalSlashInserter: true,
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalDefaultControls: {
fontSize: true,
fontAppearance: true
}
}
},
save({
attributes
}) {
const {
align,
value,
citation
} = attributes;
const className = classnames_default()({
[`has-text-align-${align}`]: align
});
return (0,external_React_namespaceObject.createElement)("blockquote", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
multiline: true,
value: value
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
}));
},
migrate: migrateToQuoteV2
};
const quote_deprecated_v2 = {
attributes: {
value: {
type: 'string',
source: 'html',
selector: 'blockquote',
multiline: 'p',
default: ''
},
citation: {
type: 'string',
source: 'html',
selector: 'cite',
default: ''
},
align: {
type: 'string'
}
},
migrate: migrateToQuoteV2,
save({
attributes
}) {
const {
align,
value,
citation
} = attributes;
return (0,external_React_namespaceObject.createElement)("blockquote", {
style: {
textAlign: align ? align : null
}
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
multiline: true,
value: value
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
}));
}
};
const quote_deprecated_v1 = {
attributes: {
value: {
type: 'string',
source: 'html',
selector: 'blockquote',
multiline: 'p',
default: ''
},
citation: {
type: 'string',
source: 'html',
selector: 'cite',
default: ''
},
align: {
type: 'string'
},
style: {
type: 'number',
default: 1
}
},
migrate(attributes) {
if (attributes.style === 2) {
const {
style,
...restAttributes
} = attributes;
return migrateToQuoteV2({
...restAttributes,
className: attributes.className ? attributes.className + ' is-style-large' : 'is-style-large'
});
}
return migrateToQuoteV2(attributes);
},
save({
attributes
}) {
const {
align,
value,
citation,
style
} = attributes;
return (0,external_React_namespaceObject.createElement)("blockquote", {
className: style === 2 ? 'is-large' : '',
style: {
textAlign: align ? align : null
}
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
multiline: true,
value: value
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
}));
}
};
const quote_deprecated_v0 = {
attributes: {
value: {
type: 'string',
source: 'html',
selector: 'blockquote',
multiline: 'p',
default: ''
},
citation: {
type: 'string',
source: 'html',
selector: 'footer',
default: ''
},
align: {
type: 'string'
},
style: {
type: 'number',
default: 1
}
},
migrate(attributes) {
if (!isNaN(parseInt(attributes.style))) {
const {
style,
...restAttributes
} = attributes;
return migrateToQuoteV2({
...restAttributes
});
}
return migrateToQuoteV2(attributes);
},
save({
attributes
}) {
const {
align,
value,
citation,
style
} = attributes;
return (0,external_React_namespaceObject.createElement)("blockquote", {
className: `blocks-quote-style-${style}`,
style: {
textAlign: align ? align : null
}
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
multiline: true,
value: value
}), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "footer",
value: citation
}));
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const quote_deprecated = ([quote_deprecated_v3, quote_deprecated_v2, quote_deprecated_v1, quote_deprecated_v0]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/quote/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const edit_isWebPlatform = external_wp_element_namespaceObject.Platform.OS === 'web';
const quote_edit_TEMPLATE = [['core/paragraph', {}]];
/**
* At the moment, deprecations don't handle create blocks from attributes
* (like when using CPT templates). For this reason, this hook is necessary
* to avoid breaking templates using the old quote block format.
*
* @param {Object} attributes Block attributes.
* @param {string} clientId Block client ID.
*/
const edit_useMigrateOnLoad = (attributes, clientId) => {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
updateBlockAttributes,
replaceInnerBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// As soon as the block is loaded, migrate it to the new version.
if (!attributes.value) {
// No need to migrate if it doesn't have the value attribute.
return;
}
const [newAttributes, newInnerBlocks] = migrateToQuoteV2(attributes);
external_wp_deprecated_default()('Value attribute on the quote block', {
since: '6.0',
version: '6.5',
alternative: 'inner blocks'
});
registry.batch(() => {
updateBlockAttributes(clientId, newAttributes);
replaceInnerBlocks(clientId, newInnerBlocks);
});
}, [attributes.value]);
};
function QuoteEdit({
attributes,
setAttributes,
insertBlocksAfter,
clientId,
className,
style
}) {
const {
align,
citation
} = attributes;
edit_useMigrateOnLoad(attributes, clientId);
const hasSelection = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
isBlockSelected,
hasSelectedInnerBlock
} = select(external_wp_blockEditor_namespaceObject.store);
return hasSelectedInnerBlock(clientId) || isBlockSelected(clientId);
}, []);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()(className, {
[`has-text-align-${align}`]: align
}),
...(!edit_isWebPlatform && {
style
})
});
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
template: quote_edit_TEMPLATE,
templateInsertUpdatesSelection: true,
__experimentalCaptureToolbars: true
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: align,
onChange: nextAlign => {
setAttributes({
align: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BlockQuotation, {
...innerBlocksProps
}, innerBlocksProps.children, (!external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) || hasSelection) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "citation",
tagName: edit_isWebPlatform ? 'cite' : undefined,
style: {
display: 'block'
},
value: citation,
onChange: nextCitation => {
setAttributes({
citation: nextCitation
});
},
__unstableMobileNoFocusOnMount: true,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Quote citation'),
placeholder:
// translators: placeholder text used for the
// citation
(0,external_wp_i18n_namespaceObject.__)('Add citation'),
className: "wp-block-quote__citation",
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)())),
...(!edit_isWebPlatform ? {
textAlign: align
} : {})
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/quote/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function quote_save_save({
attributes
}) {
const {
align,
citation
} = attributes;
const className = classnames_default()({
[`has-text-align-${align}`]: align
});
return (0,external_React_namespaceObject.createElement)("blockquote", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "cite",
value: citation
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/quote/transforms.js
/**
* WordPress dependencies
*/
const quote_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/pullquote'],
transform: ({
value,
citation,
anchor,
fontSize,
style
}) => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/quote', {
citation,
anchor,
fontSize,
style
}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: value
})]);
}
}, {
type: 'prefix',
prefix: '>',
transform: content => (0,external_wp_blocks_namespaceObject.createBlock)('core/quote', {}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content
})])
}, {
type: 'raw',
schema: () => ({
blockquote: {
children: '*'
}
}),
selector: 'blockquote',
transform: (node, handler) => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/quote',
// Don't try to parse any `cite` out of this content.
// * There may be more than one cite.
// * There may be more attribution text than just the cite.
// * If the cite is nested in the quoted text, it's wrong to
// remove it.
{}, handler({
HTML: node.innerHTML,
mode: 'BLOCKS'
}));
}
}, {
type: 'block',
isMultiBlock: true,
blocks: ['*'],
isMatch: ({}, blocks) => {
// When a single block is selected make the tranformation
// available only to specific blocks that make sense.
if (blocks.length === 1) {
return ['core/paragraph', 'core/heading', 'core/list', 'core/pullquote'].includes(blocks[0].name);
}
return !blocks.some(({
name
}) => name === 'core/quote');
},
__experimentalConvert: blocks => (0,external_wp_blocks_namespaceObject.createBlock)('core/quote', {}, blocks.map(block => (0,external_wp_blocks_namespaceObject.createBlock)(block.name, block.attributes, block.innerBlocks)))
}],
to: [{
type: 'block',
blocks: ['core/pullquote'],
isMatch: ({}, block) => {
return block.innerBlocks.every(({
name
}) => name === 'core/paragraph');
},
transform: ({
citation,
anchor,
fontSize,
style
}, innerBlocks) => {
const value = innerBlocks.map(({
attributes
}) => `${attributes.content}`).join('<br>');
return (0,external_wp_blocks_namespaceObject.createBlock)('core/pullquote', {
value,
citation,
anchor,
fontSize,
style
});
}
}, {
type: 'block',
blocks: ['core/paragraph'],
transform: ({
citation
}, innerBlocks) => external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) ? innerBlocks : [...innerBlocks, (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: citation
})]
}, {
type: 'block',
blocks: ['core/group'],
transform: ({
citation,
anchor
}, innerBlocks) => (0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
anchor
}, external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) ? innerBlocks : [...innerBlocks, (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: citation
})])
}],
ungroup: ({
citation
}, innerBlocks) => external_wp_blockEditor_namespaceObject.RichText.isEmpty(citation) ? innerBlocks : [...innerBlocks, (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: citation
})]
};
/* harmony default export */ const quote_transforms = (quote_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/quote/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const quote_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/quote",
title: "Quote",
category: "text",
description: "Give quoted text visual emphasis. \"In quoting others, we cite ourselves.\" \u2014 Julio Cort\xE1zar",
keywords: ["blockquote", "cite"],
textdomain: "default",
attributes: {
value: {
type: "string",
source: "html",
selector: "blockquote",
multiline: "p",
"default": "",
__experimentalRole: "content"
},
citation: {
type: "rich-text",
source: "rich-text",
selector: "cite",
__experimentalRole: "content"
},
align: {
type: "string"
}
},
supports: {
anchor: true,
html: false,
__experimentalOnEnter: true,
__experimentalOnMerge: true,
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
color: {
gradients: true,
heading: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
layout: {
allowEditing: false
},
spacing: {
blockGap: true
},
interactivity: {
clientNavigation: true
}
},
styles: [{
name: "default",
label: "Default",
isDefault: true
}, {
name: "plain",
label: "Plain"
}],
editorStyle: "wp-block-quote-editor",
style: "wp-block-quote"
};
const {
name: quote_name
} = quote_metadata;
const quote_settings = {
icon: library_quote,
example: {
attributes: {
citation: 'Julio Cortázar'
},
innerBlocks: [{
name: 'core/paragraph',
attributes: {
content: (0,external_wp_i18n_namespaceObject.__)('In quoting others, we cite ourselves.')
}
}]
},
transforms: quote_transforms,
edit: QuoteEdit,
save: quote_save_save,
deprecated: quote_deprecated
};
const quote_init = () => initBlock({
name: quote_name,
metadata: quote_metadata,
settings: quote_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js
/**
* WordPress dependencies
*/
const symbol = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_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 */ const library_symbol = (symbol);
;// CONCATENATED MODULE: external ["wp","patterns"]
const external_wp_patterns_namespaceObject = window["wp"]["patterns"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/block/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
useLayoutClasses
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const {
PARTIAL_SYNCING_SUPPORTED_BLOCKS
} = unlock(external_wp_patterns_namespaceObject.privateApis);
const fullAlignments = ['full', 'wide', 'left', 'right'];
function getLegacyIdMap(blocks, content, nameCount = {}) {
let idToClientIdMap = {};
for (const block of blocks) {
if (block?.innerBlocks?.length) {
idToClientIdMap = {
...idToClientIdMap,
...getLegacyIdMap(block.innerBlocks, content, nameCount)
};
}
const id = block.attributes.metadata?.id;
const clientId = block.clientId;
if (id && content?.[id]) {
idToClientIdMap[clientId] = id;
}
}
return idToClientIdMap;
}
const useInferredLayout = (blocks, parentLayout) => {
const initialInferredAlignmentRef = (0,external_wp_element_namespaceObject.useRef)();
return (0,external_wp_element_namespaceObject.useMemo)(() => {
// Exit early if the pattern's blocks haven't loaded yet.
if (!blocks?.length) {
return {};
}
let alignment = initialInferredAlignmentRef.current;
// Only track the initial alignment so that temporarily removed
// alignments can be reapplied.
if (alignment === undefined) {
const isConstrained = parentLayout?.type === 'constrained';
const hasFullAlignment = blocks.some(block => fullAlignments.includes(block.attributes.align));
alignment = isConstrained && hasFullAlignment ? 'full' : null;
initialInferredAlignmentRef.current = alignment;
}
const layout = alignment ? parentLayout : undefined;
return {
alignment,
layout
};
}, [blocks, parentLayout]);
};
function hasOverridableAttributes(block) {
return Object.keys(PARTIAL_SYNCING_SUPPORTED_BLOCKS).includes(block.name) && !!block.attributes.metadata?.bindings && Object.values(block.attributes.metadata.bindings).some(binding => binding.source === 'core/pattern-overrides');
}
function hasOverridableBlocks(blocks) {
return blocks.some(block => {
if (hasOverridableAttributes(block)) return true;
return hasOverridableBlocks(block.innerBlocks);
});
}
function getOverridableAttributes(block) {
return Object.entries(block.attributes.metadata.bindings).filter(([, binding]) => binding.source === 'core/pattern-overrides').map(([attributeKey]) => attributeKey);
}
function applyInitialContentValuesToInnerBlocks(blocks, content = {}, defaultValues, legacyIdMap) {
return blocks.map(block => {
var _legacyIdMap$block$cl;
const innerBlocks = applyInitialContentValuesToInnerBlocks(block.innerBlocks, content, defaultValues, legacyIdMap);
const metadataName = (_legacyIdMap$block$cl = legacyIdMap?.[block.clientId]) !== null && _legacyIdMap$block$cl !== void 0 ? _legacyIdMap$block$cl : block.attributes.metadata?.name;
if (!metadataName || !hasOverridableAttributes(block)) {
return {
...block,
innerBlocks
};
}
const attributes = getOverridableAttributes(block);
const newAttributes = {
...block.attributes
};
for (const attributeKey of attributes) {
var _defaultValues$metada;
(_defaultValues$metada = defaultValues[metadataName]) !== null && _defaultValues$metada !== void 0 ? _defaultValues$metada : defaultValues[metadataName] = {};
defaultValues[metadataName][attributeKey] = block.attributes[attributeKey];
const contentValues = content[metadataName];
if (contentValues?.[attributeKey] !== undefined) {
newAttributes[attributeKey] = contentValues[attributeKey];
}
}
return {
...block,
attributes: newAttributes,
innerBlocks
};
});
}
function isAttributeEqual(attribute1, attribute2) {
if (attribute1 instanceof external_wp_richText_namespaceObject.RichTextData && attribute2 instanceof external_wp_richText_namespaceObject.RichTextData) {
return attribute1.toString() === attribute2.toString();
}
return attribute1 === attribute2;
}
function getContentValuesFromInnerBlocks(blocks, defaultValues, legacyIdMap) {
/** @type {Record<string, { values: Record<string, unknown>}>} */
const content = {};
for (const block of blocks) {
var _legacyIdMap$block$cl2;
if (block.name === block_name) continue;
if (block.innerBlocks.length) {
Object.assign(content, getContentValuesFromInnerBlocks(block.innerBlocks, defaultValues, legacyIdMap));
}
const metadataName = (_legacyIdMap$block$cl2 = legacyIdMap?.[block.clientId]) !== null && _legacyIdMap$block$cl2 !== void 0 ? _legacyIdMap$block$cl2 : block.attributes.metadata?.name;
if (!metadataName || !hasOverridableAttributes(block)) {
continue;
}
const attributes = getOverridableAttributes(block);
for (const attributeKey of attributes) {
if (!isAttributeEqual(block.attributes[attributeKey], defaultValues?.[metadataName]?.[attributeKey])) {
var _content$metadataName;
(_content$metadataName = content[metadataName]) !== null && _content$metadataName !== void 0 ? _content$metadataName : content[metadataName] = {};
// TODO: We need a way to represent `undefined` in the serialized overrides.
// Also see: https://github.com/WordPress/gutenberg/pull/57249#discussion_r1452987871
content[metadataName][attributeKey] = block.attributes[attributeKey] === undefined ?
// TODO: We use an empty string to represent undefined for now until
// we support a richer format for overrides and the block binding API.
// Currently only the `linkTarget` attribute of `core/button` is affected.
'' : block.attributes[attributeKey];
}
}
}
return Object.keys(content).length > 0 ? content : undefined;
}
function setBlockEditMode(setEditMode, blocks, mode) {
blocks.forEach(block => {
const editMode = mode || (hasOverridableAttributes(block) ? 'contentOnly' : 'disabled');
setEditMode(block.clientId, editMode);
setBlockEditMode(setEditMode, block.innerBlocks,
// Disable editing for nested patterns.
block.name === block_name ? 'disabled' : mode);
});
}
function RecursionWarning() {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Block cannot be rendered inside itself.')));
}
// Wrap the main Edit function for the pattern block with a recursion wrapper
// that allows short-circuiting rendering as early as possible, before any
// of the other effects in the block edit have run.
function ReusableBlockEditRecursionWrapper(props) {
const {
ref
} = props.attributes;
const hasAlreadyRendered = (0,external_wp_blockEditor_namespaceObject.useHasRecursion)(ref);
if (hasAlreadyRendered) {
return (0,external_React_namespaceObject.createElement)(RecursionWarning, null);
}
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RecursionProvider, {
uniqueId: ref
}, (0,external_React_namespaceObject.createElement)(ReusableBlockEdit, {
...props
}));
}
function ReusableBlockEdit({
name,
attributes: {
ref,
content
},
__unstableParentLayout: parentLayout,
clientId: patternClientId,
setAttributes
}) {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
record,
editedRecord,
hasResolved
} = (0,external_wp_coreData_namespaceObject.useEntityRecord)('postType', 'wp_block', ref);
const isMissing = hasResolved && !record;
// The initial value of the `content` attribute.
const initialContent = (0,external_wp_element_namespaceObject.useRef)(content);
// The default content values from the original pattern for overridable attributes.
// Set by the `applyInitialContentValuesToInnerBlocks` function.
const defaultContent = (0,external_wp_element_namespaceObject.useRef)({});
const {
replaceInnerBlocks,
__unstableMarkNextChangeAsNotPersistent,
setBlockEditingMode
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const {
syncDerivedUpdates
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store));
const {
innerBlocks,
userCanEdit,
getBlockEditingMode,
onNavigateToEntityRecord,
editingMode,
hasPatternOverridesSource
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canUser
} = select(external_wp_coreData_namespaceObject.store);
const {
getBlocks,
getSettings,
getBlockEditingMode: _getBlockEditingMode
} = select(external_wp_blockEditor_namespaceObject.store);
const {
getBlockBindingsSource
} = unlock(select(external_wp_blocks_namespaceObject.store));
const blocks = getBlocks(patternClientId);
const canEdit = canUser('update', 'blocks', ref);
// For editing link to the site editor if the theme and user permissions support it.
return {
innerBlocks: blocks,
userCanEdit: canEdit,
getBlockEditingMode: _getBlockEditingMode,
onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord,
editingMode: _getBlockEditingMode(patternClientId),
hasPatternOverridesSource: !!getBlockBindingsSource('core/pattern-overrides')
};
}, [patternClientId, ref]);
// Sync the editing mode of the pattern block with the inner blocks.
(0,external_wp_element_namespaceObject.useEffect)(() => {
setBlockEditMode(setBlockEditingMode, innerBlocks,
// Disable editing if the pattern itself is disabled.
editingMode === 'disabled' || !hasPatternOverridesSource ? 'disabled' : undefined);
}, [editingMode, innerBlocks, setBlockEditingMode, hasPatternOverridesSource]);
const canOverrideBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => hasPatternOverridesSource && hasOverridableBlocks(innerBlocks), [hasPatternOverridesSource, innerBlocks]);
const initialBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
var _editedRecord$blocks$;
return (// Clone the blocks to generate new client IDs.
(_editedRecord$blocks$ = editedRecord.blocks?.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block))) !== null && _editedRecord$blocks$ !== void 0 ? _editedRecord$blocks$ : editedRecord.content && typeof editedRecord.content !== 'function' ? (0,external_wp_blocks_namespaceObject.parse)(editedRecord.content) : []
);
}, [editedRecord.blocks, editedRecord.content]);
const legacyIdMap = (0,external_wp_element_namespaceObject.useRef)({});
// Apply the initial overrides from the pattern block to the inner blocks.
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Build a map of clientIds to the old nano id system to provide back compat.
legacyIdMap.current = getLegacyIdMap(initialBlocks, initialContent.current);
defaultContent.current = {};
const originalEditingMode = getBlockEditingMode(patternClientId);
// Replace the contents of the blocks with the overrides.
registry.batch(() => {
setBlockEditingMode(patternClientId, 'default');
syncDerivedUpdates(() => {
const blocks = hasPatternOverridesSource ? applyInitialContentValuesToInnerBlocks(initialBlocks, initialContent.current, defaultContent.current, legacyIdMap.current) : initialBlocks;
replaceInnerBlocks(patternClientId, blocks);
});
setBlockEditingMode(patternClientId, originalEditingMode);
});
}, [hasPatternOverridesSource, __unstableMarkNextChangeAsNotPersistent, patternClientId, initialBlocks, replaceInnerBlocks, registry, getBlockEditingMode, setBlockEditingMode, syncDerivedUpdates]);
const {
alignment,
layout
} = useInferredLayout(innerBlocks, parentLayout);
const layoutClasses = useLayoutClasses({
layout
}, name);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()('block-library-block__reusable-block-container', layout && layoutClasses, {
[`align${alignment}`]: alignment
})
});
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
templateLock: 'all',
layout,
renderAppender: innerBlocks?.length ? undefined : external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender
});
// Sync the `content` attribute from the updated blocks to the pattern block.
// `syncDerivedUpdates` is used here to avoid creating an additional undo level.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!hasPatternOverridesSource) {
return;
}
const {
getBlocks
} = registry.select(external_wp_blockEditor_namespaceObject.store);
let prevBlocks = getBlocks(patternClientId);
return registry.subscribe(() => {
const blocks = getBlocks(patternClientId);
if (blocks !== prevBlocks) {
prevBlocks = blocks;
syncDerivedUpdates(() => {
setAttributes({
content: getContentValuesFromInnerBlocks(blocks, defaultContent.current, legacyIdMap.current)
});
});
}
}, external_wp_blockEditor_namespaceObject.store);
}, [hasPatternOverridesSource, syncDerivedUpdates, patternClientId, registry, setAttributes]);
const handleEditOriginal = () => {
onNavigateToEntityRecord({
postId: ref,
postType: 'wp_block'
});
};
const resetContent = () => {
if (content) {
replaceInnerBlocks(patternClientId, initialBlocks);
}
};
let children = null;
if (isMissing) {
children = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Block has been deleted or is unavailable.'));
}
if (!hasResolved) {
children = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null));
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, userCanEdit && onNavigateToEntityRecord && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: handleEditOriginal
}, (0,external_wp_i18n_namespaceObject.__)('Edit original')))), canOverrideBlocks && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: resetContent,
disabled: !content,
__experimentalIsFocusable: true
}, (0,external_wp_i18n_namespaceObject.__)('Reset')))), children === null ? (0,external_React_namespaceObject.createElement)("div", {
...innerBlocksProps
}) : (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, children));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/block/deprecated.js
const isObject = obj => typeof obj === 'object' && !Array.isArray(obj) && obj !== null;
// v2: Migrate to a more condensed version of the 'content' attribute attribute.
const block_deprecated_v2 = {
attributes: {
ref: {
type: 'number'
},
content: {
type: 'object'
}
},
supports: {
customClassName: false,
html: false,
inserter: false,
renaming: false
},
// Force this deprecation to run whenever there's a values sub-property that's an object.
//
// This could fail in the future if a block ever has binding to a `values` attribute.
// Some extra protection is added to ensure `values` is an object, but this only reduces
// the likelihood, it doesn't solve it completely.
isEligible({
content
}) {
return !!content && Object.keys(content).every(contentKey => content[contentKey].values && isObject(content[contentKey].values));
},
/*
* Old attribute format:
* content: {
* "V98q_x": {
* // The attribute values are now stored as a 'values' sub-property.
* values: { content: 'My content value' },
* // ... additional metadata, like the block name can be stored here.
* }
* }
*
* New attribute format:
* content: {
* "V98q_x": {
* content: 'My content value',
* }
* }
*/
migrate(attributes) {
const {
content,
...retainedAttributes
} = attributes;
if (content && Object.keys(content).length) {
const updatedContent = {
...content
};
for (const contentKey in content) {
updatedContent[contentKey] = content[contentKey].values;
}
return {
...retainedAttributes,
content: updatedContent
};
}
return attributes;
}
};
// v1: Rename the `overrides` attribute to the `content` attribute.
const block_deprecated_v1 = {
attributes: {
ref: {
type: 'number'
},
overrides: {
type: 'object'
}
},
supports: {
customClassName: false,
html: false,
inserter: false,
renaming: false
},
// Force this deprecation to run whenever there's an `overrides` object.
isEligible({
overrides
}) {
return !!overrides;
},
/*
* Old attribute format:
* overrides: {
* // An key is an id that represents a block.
* // The values are the attribute values of the block.
* "V98q_x": { content: 'My content value' }
* }
*
* New attribute format:
* content: {
* "V98q_x": { content: 'My content value' }
* }
*
*/
migrate(attributes) {
const {
overrides,
...retainedAttributes
} = attributes;
const content = {};
Object.keys(overrides).forEach(id => {
content[id] = overrides[id];
});
return {
...retainedAttributes,
content
};
}
};
/* harmony default export */ const block_deprecated = ([block_deprecated_v2, block_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/block/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const block_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/block",
title: "Pattern",
category: "reusable",
description: "Reuse this design across your site.",
keywords: ["reusable"],
textdomain: "default",
attributes: {
ref: {
type: "number"
},
content: {
type: "object"
}
},
supports: {
customClassName: false,
html: false,
inserter: false,
renaming: false,
interactivity: {
clientNavigation: true
}
}
};
const {
name: block_name
} = block_metadata;
const block_settings = {
deprecated: block_deprecated,
edit: ReusableBlockEditRecursionWrapper,
icon: library_symbol,
__experimentalLabel: ({
ref
}) => {
if (!ref) {
return;
}
const entity = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', 'wp_block', ref);
if (!entity?.title) {
return;
}
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entity.title);
}
};
const block_init = () => initBlock({
name: block_name,
metadata: block_metadata,
settings: block_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/read-more/edit.js
/**
* WordPress dependencies
*/
function ReadMore({
attributes: {
content,
linkTarget
},
setAttributes,
insertBlocksAfter
}) {
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: linkTarget === '_blank'
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: "a",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('“Read more” link text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Read more'),
value: content,
onChange: newValue => setAttributes({
content: newValue
}),
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)())),
withoutInteractiveFormatting: true,
...blockProps
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/read-more/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const read_more_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/read-more",
title: "Read More",
category: "theme",
description: "Displays the link of a post, page, or any other content-type.",
textdomain: "default",
attributes: {
content: {
type: "string"
},
linkTarget: {
type: "string",
"default": "_self"
}
},
usesContext: ["postId"],
supports: {
html: false,
color: {
gradients: true,
text: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalLetterSpacing: true,
__experimentalTextDecoration: true,
__experimentalDefaultControls: {
fontSize: true,
textDecoration: true
}
},
spacing: {
margin: ["top", "bottom"],
padding: true,
__experimentalDefaultControls: {
padding: true
}
},
__experimentalBorder: {
color: true,
radius: true,
width: true,
__experimentalDefaultControls: {
width: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-read-more"
};
const {
name: read_more_name
} = read_more_metadata;
const read_more_settings = {
icon: library_link,
edit: ReadMore
};
const read_more_init = () => initBlock({
name: read_more_name,
metadata: read_more_metadata,
settings: read_more_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/rss.js
/**
* WordPress dependencies
*/
const rss = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M5 10.2h-.8v1.5H5c1.9 0 3.8.8 5.1 2.1 1.4 1.4 2.1 3.2 2.1 5.1v.8h1.5V19c0-2.3-.9-4.5-2.6-6.2-1.6-1.6-3.8-2.6-6.1-2.6zm10.4-1.6C12.6 5.8 8.9 4.2 5 4.2h-.8v1.5H5c3.5 0 6.9 1.4 9.4 3.9s3.9 5.8 3.9 9.4v.8h1.5V19c0-3.9-1.6-7.6-4.4-10.4zM4 20h3v-3H4v3z"
}));
/* harmony default export */ const library_rss = (rss);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/rss/edit.js
/**
* WordPress dependencies
*/
const DEFAULT_MIN_ITEMS = 1;
const DEFAULT_MAX_ITEMS = 20;
function RSSEdit({
attributes,
setAttributes
}) {
const [isEditing, setIsEditing] = (0,external_wp_element_namespaceObject.useState)(!attributes.feedURL);
const {
blockLayout,
columns,
displayAuthor,
displayDate,
displayExcerpt,
excerptLength,
feedURL,
itemsToShow
} = attributes;
function toggleAttribute(propName) {
return () => {
const value = attributes[propName];
setAttributes({
[propName]: !value
});
};
}
function onSubmitURL(event) {
event.preventDefault();
if (feedURL) {
setAttributes({
feedURL: (0,external_wp_url_namespaceObject.prependHTTP)(feedURL)
});
setIsEditing(false);
}
}
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
if (isEditing) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
icon: library_rss,
label: "RSS"
}, (0,external_React_namespaceObject.createElement)("form", {
onSubmit: onSubmitURL,
className: "wp-block-rss__placeholder-form"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
wrap: true
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalInputControl, {
__next40pxDefaultSize: true,
placeholder: (0,external_wp_i18n_namespaceObject.__)('Enter URL here…'),
value: feedURL,
onChange: value => setAttributes({
feedURL: value
}),
className: "wp-block-rss__placeholder-input"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "primary",
type: "submit"
}, (0,external_wp_i18n_namespaceObject.__)('Use URL'))))));
}
const toolbarControls = [{
icon: library_edit,
title: (0,external_wp_i18n_namespaceObject.__)('Edit RSS URL'),
onClick: () => setIsEditing(true)
}, {
icon: library_list,
title: (0,external_wp_i18n_namespaceObject.__)('List view'),
onClick: () => setAttributes({
blockLayout: 'list'
}),
isActive: blockLayout === 'list'
}, {
icon: library_grid,
title: (0,external_wp_i18n_namespaceObject.__)('Grid view'),
onClick: () => setAttributes({
blockLayout: 'grid'
}),
isActive: blockLayout === 'grid'
}];
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, {
controls: toolbarControls
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Number of items'),
value: itemsToShow,
onChange: value => setAttributes({
itemsToShow: value
}),
min: DEFAULT_MIN_ITEMS,
max: DEFAULT_MAX_ITEMS,
required: true
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display author'),
checked: displayAuthor,
onChange: toggleAttribute('displayAuthor')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display date'),
checked: displayDate,
onChange: toggleAttribute('displayDate')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Display excerpt'),
checked: displayExcerpt,
onChange: toggleAttribute('displayExcerpt')
}), displayExcerpt && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Max number of words in excerpt'),
value: excerptLength,
onChange: value => setAttributes({
excerptLength: value
}),
min: 10,
max: 100,
required: true
}), blockLayout === 'grid' && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Columns'),
value: columns,
onChange: value => setAttributes({
columns: value
}),
min: 2,
max: 6,
required: true
}))), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, null, (0,external_React_namespaceObject.createElement)((external_wp_serverSideRender_default()), {
block: "core/rss",
attributes: attributes
}))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/rss/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const rss_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/rss",
title: "RSS",
category: "widgets",
description: "Display entries from any RSS or Atom feed.",
keywords: ["atom", "feed"],
textdomain: "default",
attributes: {
columns: {
type: "number",
"default": 2
},
blockLayout: {
type: "string",
"default": "list"
},
feedURL: {
type: "string",
"default": ""
},
itemsToShow: {
type: "number",
"default": 5
},
displayExcerpt: {
type: "boolean",
"default": false
},
displayAuthor: {
type: "boolean",
"default": false
},
displayDate: {
type: "boolean",
"default": false
},
excerptLength: {
type: "number",
"default": 55
}
},
supports: {
align: true,
html: false,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-rss-editor",
style: "wp-block-rss"
};
const {
name: rss_name
} = rss_metadata;
const rss_settings = {
icon: library_rss,
example: {
attributes: {
feedURL: 'https://wordpress.org'
}
},
edit: RSSEdit
};
const rss_init = () => initBlock({
name: rss_name,
metadata: rss_metadata,
settings: rss_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js
/**
* WordPress dependencies
*/
const search = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"
}));
/* harmony default export */ const library_search = (search);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/icons.js
/**
* WordPress dependencies
*/
const buttonOnly = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, {
x: "7",
y: "10",
width: "10",
height: "4",
rx: "1",
fill: "currentColor"
}));
const buttonOutside = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, {
x: "4.75",
y: "15.25",
width: "6.5",
height: "9.5",
transform: "rotate(-90 4.75 15.25)",
stroke: "currentColor",
strokeWidth: "1.5",
fill: "none"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, {
x: "16",
y: "10",
width: "4",
height: "4",
rx: "1",
fill: "currentColor"
}));
const buttonInside = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, {
x: "4.75",
y: "15.25",
width: "6.5",
height: "14.5",
transform: "rotate(-90 4.75 15.25)",
stroke: "currentColor",
strokeWidth: "1.5",
fill: "none"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, {
x: "14",
y: "10",
width: "4",
height: "4",
rx: "1",
fill: "currentColor"
}));
const noButton = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, {
x: "4.75",
y: "15.25",
width: "6.5",
height: "14.5",
transform: "rotate(-90 4.75 15.25)",
stroke: "currentColor",
fill: "none",
strokeWidth: "1.5"
}));
const buttonWithIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, {
x: "4.75",
y: "7.75",
width: "14.5",
height: "8.5",
rx: "1.25",
stroke: "currentColor",
fill: "none",
strokeWidth: "1.5"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, {
x: "8",
y: "11",
width: "8",
height: "2",
fill: "currentColor"
}));
const toggleLabel = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, {
x: "4.75",
y: "17.25",
width: "5.5",
height: "14.5",
transform: "rotate(-90 4.75 17.25)",
stroke: "currentColor",
fill: "none",
strokeWidth: "1.5"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, {
x: "4",
y: "7",
width: "10",
height: "2",
fill: "currentColor"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/utils.js
/**
* Constants
*/
const PC_WIDTH_DEFAULT = 50;
const PX_WIDTH_DEFAULT = 350;
const MIN_WIDTH = 220;
/**
* Returns a boolean whether passed unit is percentage
*
* @param {string} unit Block width unit.
*
* @return {boolean} Whether unit is '%'.
*/
function utils_isPercentageUnit(unit) {
return unit === '%';
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// Used to calculate border radius adjustment to avoid "fat" corners when
// button is placed inside wrapper.
const DEFAULT_INNER_PADDING = '4px';
function SearchEdit({
className,
attributes,
setAttributes,
toggleSelection,
isSelected,
clientId
}) {
const {
label,
showLabel,
placeholder,
width,
widthUnit,
align,
buttonText,
buttonPosition,
buttonUseIcon,
isSearchFieldHidden,
style
} = attributes;
const wasJustInsertedIntoNavigationBlock = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockParentsByBlockName,
wasBlockJustInserted
} = select(external_wp_blockEditor_namespaceObject.store);
return !!getBlockParentsByBlockName(clientId, 'core/navigation')?.length && wasBlockJustInserted(clientId);
}, [clientId]);
const {
__unstableMarkNextChangeAsNotPersistent
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (wasJustInsertedIntoNavigationBlock) {
// This side-effect should not create an undo level.
__unstableMarkNextChangeAsNotPersistent();
setAttributes({
showLabel: false,
buttonUseIcon: true,
buttonPosition: 'button-inside'
});
}
}, [__unstableMarkNextChangeAsNotPersistent, wasJustInsertedIntoNavigationBlock, setAttributes]);
const borderRadius = style?.border?.radius;
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes);
// Check for old deprecated numerical border radius. Done as a separate
// check so that a borderRadius style won't overwrite the longhand
// per-corner styles.
if (typeof borderRadius === 'number') {
borderProps.style.borderRadius = `${borderRadius}px`;
}
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseColorProps)(attributes);
const [fluidTypographySettings, layout] = (0,external_wp_blockEditor_namespaceObject.useSettings)('typography.fluid', 'layout');
const typographyProps = (0,external_wp_blockEditor_namespaceObject.getTypographyClassesAndStyles)(attributes, {
typography: {
fluid: fluidTypographySettings
},
layout: {
wideSize: layout?.wideSize
}
});
const unitControlInstanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(external_wp_components_namespaceObject.__experimentalUnitControl);
const unitControlInputId = `wp-block-search__width-${unitControlInstanceId}`;
const isButtonPositionInside = 'button-inside' === buttonPosition;
const isButtonPositionOutside = 'button-outside' === buttonPosition;
const hasNoButton = 'no-button' === buttonPosition;
const hasOnlyButton = 'button-only' === buttonPosition;
const searchFieldRef = (0,external_wp_element_namespaceObject.useRef)();
const buttonRef = (0,external_wp_element_namespaceObject.useRef)();
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: ['%', 'px'],
defaultValues: {
'%': PC_WIDTH_DEFAULT,
px: PX_WIDTH_DEFAULT
}
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (hasOnlyButton && !isSelected) {
setAttributes({
isSearchFieldHidden: true
});
}
}, [hasOnlyButton, isSelected, setAttributes]);
// Show the search field when width changes.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!hasOnlyButton || !isSelected) {
return;
}
setAttributes({
isSearchFieldHidden: false
});
}, [hasOnlyButton, isSelected, setAttributes, width]);
const getBlockClassNames = () => {
return classnames_default()(className, isButtonPositionInside ? 'wp-block-search__button-inside' : undefined, isButtonPositionOutside ? 'wp-block-search__button-outside' : undefined, hasNoButton ? 'wp-block-search__no-button' : undefined, hasOnlyButton ? 'wp-block-search__button-only' : undefined, !buttonUseIcon && !hasNoButton ? 'wp-block-search__text-button' : undefined, buttonUseIcon && !hasNoButton ? 'wp-block-search__icon-button' : undefined, hasOnlyButton && isSearchFieldHidden ? 'wp-block-search__searchfield-hidden' : undefined);
};
const buttonPositionControls = [{
role: 'menuitemradio',
title: (0,external_wp_i18n_namespaceObject.__)('Button outside'),
isActive: buttonPosition === 'button-outside',
icon: buttonOutside,
onClick: () => {
setAttributes({
buttonPosition: 'button-outside',
isSearchFieldHidden: false
});
}
}, {
role: 'menuitemradio',
title: (0,external_wp_i18n_namespaceObject.__)('Button inside'),
isActive: buttonPosition === 'button-inside',
icon: buttonInside,
onClick: () => {
setAttributes({
buttonPosition: 'button-inside',
isSearchFieldHidden: false
});
}
}, {
role: 'menuitemradio',
title: (0,external_wp_i18n_namespaceObject.__)('No button'),
isActive: buttonPosition === 'no-button',
icon: noButton,
onClick: () => {
setAttributes({
buttonPosition: 'no-button',
isSearchFieldHidden: false
});
}
}, {
role: 'menuitemradio',
title: (0,external_wp_i18n_namespaceObject.__)('Button only'),
isActive: buttonPosition === 'button-only',
icon: buttonOnly,
onClick: () => {
setAttributes({
buttonPosition: 'button-only',
isSearchFieldHidden: true
});
}
}];
const getButtonPositionIcon = () => {
switch (buttonPosition) {
case 'button-inside':
return buttonInside;
case 'button-outside':
return buttonOutside;
case 'no-button':
return noButton;
case 'button-only':
return buttonOnly;
}
};
const getResizableSides = () => {
if (hasOnlyButton) {
return {};
}
return {
right: align !== 'right',
left: align === 'right'
};
};
const renderTextField = () => {
// If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.
const textFieldClasses = classnames_default()('wp-block-search__input', isButtonPositionInside ? undefined : borderProps.className, typographyProps.className);
const textFieldStyles = {
...(isButtonPositionInside ? {
borderRadius
} : borderProps.style),
...typographyProps.style,
textDecoration: undefined
};
return (0,external_React_namespaceObject.createElement)("input", {
type: "search",
className: textFieldClasses,
style: textFieldStyles,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Optional placeholder text')
// We hide the placeholder field's placeholder when there is a value. This
// stops screen readers from reading the placeholder field's placeholder
// which is confusing.
,
placeholder: placeholder ? undefined : (0,external_wp_i18n_namespaceObject.__)('Optional placeholder…'),
value: placeholder,
onChange: event => setAttributes({
placeholder: event.target.value
}),
ref: searchFieldRef
});
};
const renderButton = () => {
// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.
const buttonClasses = classnames_default()('wp-block-search__button', colorProps.className, typographyProps.className, isButtonPositionInside ? undefined : borderProps.className, buttonUseIcon ? 'has-icon' : undefined, (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('button'));
const buttonStyles = {
...colorProps.style,
...typographyProps.style,
...(isButtonPositionInside ? {
borderRadius
} : borderProps.style)
};
const handleButtonClick = () => {
if (hasOnlyButton) {
setAttributes({
isSearchFieldHidden: !isSearchFieldHidden
});
}
};
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, buttonUseIcon && (0,external_React_namespaceObject.createElement)("button", {
type: "button",
className: buttonClasses,
style: buttonStyles,
"aria-label": buttonText ? (0,external_wp_dom_namespaceObject.__unstableStripHTML)(buttonText) : (0,external_wp_i18n_namespaceObject.__)('Search'),
onClick: handleButtonClick,
ref: buttonRef
}, (0,external_React_namespaceObject.createElement)(build_module_icon, {
icon: library_search
})), !buttonUseIcon && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
className: buttonClasses,
style: buttonStyles,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Button text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Add button text…'),
withoutInteractiveFormatting: true,
value: buttonText,
onChange: html => setAttributes({
buttonText: html
}),
onClick: handleButtonClick
}));
};
const controls = (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
title: (0,external_wp_i18n_namespaceObject.__)('Toggle search label'),
icon: toggleLabel,
onClick: () => {
setAttributes({
showLabel: !showLabel
});
},
className: showLabel ? 'is-pressed' : undefined
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarDropdownMenu, {
icon: getButtonPositionIcon(),
label: (0,external_wp_i18n_namespaceObject.__)('Change button position'),
controls: buttonPositionControls
}), !hasNoButton && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
title: (0,external_wp_i18n_namespaceObject.__)('Use button with icon'),
icon: buttonWithIcon,
onClick: () => {
setAttributes({
buttonUseIcon: !buttonUseIcon
});
},
className: buttonUseIcon ? 'is-pressed' : undefined
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Display Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Width'),
id: unitControlInputId
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
id: unitControlInputId,
min: utils_isPercentageUnit(widthUnit) ? 0 : MIN_WIDTH,
max: utils_isPercentageUnit(widthUnit) ? 100 : undefined,
step: 1,
onChange: newWidth => {
const filteredWidth = widthUnit === '%' && parseInt(newWidth, 10) > 100 ? 100 : newWidth;
setAttributes({
width: parseInt(filteredWidth, 10)
});
},
onUnitChange: newUnit => {
setAttributes({
width: '%' === newUnit ? PC_WIDTH_DEFAULT : PX_WIDTH_DEFAULT,
widthUnit: newUnit
});
},
__unstableInputWidth: '80px',
value: `${width}${widthUnit}`,
units: units
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ButtonGroup, {
className: "wp-block-search__components-button-group",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Percentage Width')
}, [25, 50, 75, 100].map(widthValue => {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
key: widthValue,
size: "small",
variant: widthValue === width && widthUnit === '%' ? 'primary' : undefined,
onClick: () => setAttributes({
width: widthValue,
widthUnit: '%'
})
}, widthValue, "%");
}))))));
const padBorderRadius = radius => radius ? `calc(${radius} + ${DEFAULT_INNER_PADDING})` : undefined;
const getWrapperStyles = () => {
const styles = isButtonPositionInside ? borderProps.style : {
borderRadius: borderProps.style?.borderRadius,
borderTopLeftRadius: borderProps.style?.borderTopLeftRadius,
borderTopRightRadius: borderProps.style?.borderTopRightRadius,
borderBottomLeftRadius: borderProps.style?.borderBottomLeftRadius,
borderBottomRightRadius: borderProps.style?.borderBottomRightRadius
};
const isNonZeroBorderRadius = borderRadius !== undefined && parseInt(borderRadius, 10) !== 0;
if (isButtonPositionInside && isNonZeroBorderRadius) {
// We have button inside wrapper and a border radius value to apply.
// Add default padding so we don't get "fat" corners.
//
// CSS calc() is used here to support non-pixel units. The inline
// style using calc() will only apply if both values have units.
if (typeof borderRadius === 'object') {
// Individual corner border radii present.
const {
topLeft,
topRight,
bottomLeft,
bottomRight
} = borderRadius;
return {
...styles,
borderTopLeftRadius: padBorderRadius(topLeft),
borderTopRightRadius: padBorderRadius(topRight),
borderBottomLeftRadius: padBorderRadius(bottomLeft),
borderBottomRightRadius: padBorderRadius(bottomRight)
};
}
// The inline style using calc() will only apply if both values
// supplied to calc() have units. Deprecated block's may have
// unitless integer.
const radius = Number.isInteger(borderRadius) ? `${borderRadius}px` : borderRadius;
styles.borderRadius = `calc(${radius} + ${DEFAULT_INNER_PADDING})`;
}
return styles;
};
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: getBlockClassNames(),
style: {
...typographyProps.style,
// Input opts out of text decoration.
textDecoration: undefined
}
});
const labelClassnames = classnames_default()('wp-block-search__label', typographyProps.className);
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, controls, showLabel && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
className: labelClassnames,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Label text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Add label…'),
withoutInteractiveFormatting: true,
value: label,
onChange: html => setAttributes({
label: html
}),
style: typographyProps.style
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ResizableBox, {
size: {
width: `${width}${widthUnit}`
},
className: classnames_default()('wp-block-search__inside-wrapper', isButtonPositionInside ? borderProps.className : undefined),
style: getWrapperStyles(),
minWidth: MIN_WIDTH,
enable: getResizableSides(),
onResizeStart: (event, direction, elt) => {
setAttributes({
width: parseInt(elt.offsetWidth, 10),
widthUnit: 'px'
});
toggleSelection(false);
},
onResizeStop: (event, direction, elt, delta) => {
setAttributes({
width: parseInt(width + delta.width, 10)
});
toggleSelection(true);
},
showHandle: isSelected
}, (isButtonPositionInside || isButtonPositionOutside || hasOnlyButton) && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, renderTextField(), renderButton()), hasNoButton && renderTextField()));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/variations.js
/**
* WordPress dependencies
*/
const search_variations_variations = [{
name: 'default',
isDefault: true,
attributes: {
buttonText: (0,external_wp_i18n_namespaceObject.__)('Search'),
label: (0,external_wp_i18n_namespaceObject.__)('Search')
}
}];
/* harmony default export */ const search_variations = (search_variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const search_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/search",
title: "Search",
category: "widgets",
description: "Help visitors find your content.",
keywords: ["find"],
textdomain: "default",
attributes: {
label: {
type: "string",
__experimentalRole: "content"
},
showLabel: {
type: "boolean",
"default": true
},
placeholder: {
type: "string",
"default": "",
__experimentalRole: "content"
},
width: {
type: "number"
},
widthUnit: {
type: "string"
},
buttonText: {
type: "string",
__experimentalRole: "content"
},
buttonPosition: {
type: "string",
"default": "button-outside"
},
buttonUseIcon: {
type: "boolean",
"default": false
},
query: {
type: "object",
"default": {}
},
isSearchFieldHidden: {
type: "boolean",
"default": false
}
},
supports: {
align: ["left", "center", "right"],
color: {
gradients: true,
__experimentalSkipSerialization: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
interactivity: true,
typography: {
__experimentalSkipSerialization: true,
__experimentalSelector: ".wp-block-search__label, .wp-block-search__input, .wp-block-search__button",
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
__experimentalBorder: {
color: true,
radius: true,
width: true,
__experimentalSkipSerialization: true,
__experimentalDefaultControls: {
color: true,
radius: true,
width: true
}
},
html: false
},
editorStyle: "wp-block-search-editor",
style: "wp-block-search"
};
const {
name: search_name
} = search_metadata;
const search_settings = {
icon: library_search,
example: {
attributes: {
buttonText: (0,external_wp_i18n_namespaceObject.__)('Search'),
label: (0,external_wp_i18n_namespaceObject.__)('Search')
},
viewportWidth: 400
},
variations: search_variations,
edit: SearchEdit
};
const search_init = () => initBlock({
name: search_name,
metadata: search_metadata,
settings: search_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/separator.js
/**
* WordPress dependencies
*/
const separator = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4.5 12.5v4H3V7h1.5v3.987h15V7H21v9.5h-1.5v-4h-15Z"
}));
/* harmony default export */ const library_separator = (separator);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/separator/use-deprecated-opacity.js
/**
* WordPress dependencies
*/
function useDeprecatedOpacity(opacity, currentColor, setAttributes) {
const [deprecatedOpacityWithNoColor, setDeprecatedOpacityWithNoColor] = (0,external_wp_element_namespaceObject.useState)(false);
const previousColor = (0,external_wp_compose_namespaceObject.usePrevious)(currentColor);
// A separator with no color set will always have previousColor set to undefined,
// and we need to differentiate these from those with color set that will return
// previousColor as undefined on the first render.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (opacity === 'css' && !currentColor && !previousColor) {
setDeprecatedOpacityWithNoColor(true);
}
}, [currentColor, previousColor, opacity]);
// For deprecated blocks, that have a default 0.4 css opacity set, we
// need to remove this if the current color is changed, or a color is added.
// In these instances the opacity attribute is set back to the default of
// alpha-channel which allows a new custom opacity to be set via the color picker.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (opacity === 'css' && (deprecatedOpacityWithNoColor && currentColor || previousColor && currentColor !== previousColor)) {
setAttributes({
opacity: 'alpha-channel'
});
setDeprecatedOpacityWithNoColor(false);
}
}, [deprecatedOpacityWithNoColor, currentColor, previousColor]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/separator/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function SeparatorEdit({
attributes,
setAttributes
}) {
const {
backgroundColor,
opacity,
style
} = attributes;
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseColorProps)(attributes);
const currentColor = colorProps?.style?.backgroundColor;
const hasCustomColor = !!style?.color?.background;
useDeprecatedOpacity(opacity, currentColor, setAttributes);
// The dots styles uses text for the dots, to change those dots color is
// using color, not backgroundColor.
const colorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', backgroundColor);
const className = classnames_default()({
'has-text-color': backgroundColor || currentColor,
[colorClass]: colorClass,
'has-css-opacity': opacity === 'css',
'has-alpha-channel-opacity': opacity === 'alpha-channel'
}, colorProps.className);
const styles = {
color: currentColor,
backgroundColor: currentColor
};
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.HorizontalRule, {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className,
style: hasCustomColor ? styles : undefined
})
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/separator/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function separatorSave({
attributes
}) {
const {
backgroundColor,
style,
opacity
} = attributes;
const customColor = style?.color?.background;
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetColorClassesAndStyles)(attributes);
// The hr support changing color using border-color, since border-color
// is not yet supported in the color palette, we use background-color.
// The dots styles uses text for the dots, to change those dots color is
// using color, not backgroundColor.
const colorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', backgroundColor);
const className = classnames_default()({
'has-text-color': backgroundColor || customColor,
[colorClass]: colorClass,
'has-css-opacity': opacity === 'css',
'has-alpha-channel-opacity': opacity === 'alpha-channel'
}, colorProps.className);
const styles = {
backgroundColor: colorProps?.style?.backgroundColor,
color: colorClass ? undefined : customColor
};
return (0,external_React_namespaceObject.createElement)("hr", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
style: styles
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/separator/transforms.js
/**
* WordPress dependencies
*/
const separator_transforms_transforms = {
from: [{
type: 'enter',
regExp: /^-{3,}$/,
transform: () => (0,external_wp_blocks_namespaceObject.createBlock)('core/separator')
}, {
type: 'raw',
selector: 'hr',
schema: {
hr: {}
}
}]
};
/* harmony default export */ const separator_transforms = (separator_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/separator/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const separator_deprecated_v1 = {
attributes: {
color: {
type: 'string'
},
customColor: {
type: 'string'
}
},
save({
attributes
}) {
const {
color,
customColor
} = attributes;
// the hr support changing color using border-color, since border-color
// is not yet supported in the color palette, we use background-color
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', color);
// the dots styles uses text for the dots, to change those dots color is
// using color, not backgroundColor
const colorClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', color);
const className = classnames_default()({
'has-text-color has-background': color || customColor,
[backgroundClass]: backgroundClass,
[colorClass]: colorClass
});
const style = {
backgroundColor: backgroundClass ? undefined : customColor,
color: colorClass ? undefined : customColor
};
return (0,external_React_namespaceObject.createElement)("hr", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
style
})
});
},
migrate(attributes) {
const {
color,
customColor,
...restAttributes
} = attributes;
return {
...restAttributes,
backgroundColor: color ? color : undefined,
opacity: 'css',
style: customColor ? {
color: {
background: customColor
}
} : undefined
};
}
};
/* harmony default export */ const separator_deprecated = ([separator_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/separator/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const separator_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/separator",
title: "Separator",
category: "design",
description: "Create a break between ideas or sections with a horizontal separator.",
keywords: ["horizontal-line", "hr", "divider"],
textdomain: "default",
attributes: {
opacity: {
type: "string",
"default": "alpha-channel"
}
},
supports: {
anchor: true,
align: ["center", "wide", "full"],
color: {
enableContrastChecker: false,
__experimentalSkipSerialization: true,
gradients: true,
background: true,
text: false,
__experimentalDefaultControls: {
background: true
}
},
spacing: {
margin: ["top", "bottom"]
},
interactivity: {
clientNavigation: true
}
},
styles: [{
name: "default",
label: "Default",
isDefault: true
}, {
name: "wide",
label: "Wide Line"
}, {
name: "dots",
label: "Dots"
}],
editorStyle: "wp-block-separator-editor",
style: "wp-block-separator"
};
const {
name: separator_name
} = separator_metadata;
const separator_settings = {
icon: library_separator,
example: {
attributes: {
customColor: '#065174',
className: 'is-style-wide'
}
},
transforms: separator_transforms,
edit: SeparatorEdit,
save: separatorSave,
deprecated: separator_deprecated
};
const separator_init = () => initBlock({
name: separator_name,
metadata: separator_metadata,
settings: separator_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/shortcode.js
/**
* WordPress dependencies
*/
const shortcode = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M16 4.2v1.5h2.5v12.5H16v1.5h4V4.2h-4zM4.2 19.8h4v-1.5H5.8V5.8h2.5V4.2h-4l-.1 15.6zm5.1-3.1l1.4.6 4-10-1.4-.6-4 10z"
}));
/* harmony default export */ const library_shortcode = (shortcode);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/shortcode/edit.js
/**
* WordPress dependencies
*/
function ShortcodeEdit({
attributes,
setAttributes
}) {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ShortcodeEdit);
const inputId = `blocks-shortcode-input-${instanceId}`;
return (0,external_React_namespaceObject.createElement)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: 'components-placeholder'
})
}, (0,external_React_namespaceObject.createElement)("label", {
htmlFor: inputId,
className: "components-placeholder__label"
}, (0,external_React_namespaceObject.createElement)(build_module_icon, {
icon: library_shortcode
}), (0,external_wp_i18n_namespaceObject.__)('Shortcode')), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.PlainText, {
className: "blocks-shortcode__textarea",
id: inputId,
value: attributes.text,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Shortcode text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write shortcode here…'),
onChange: text => setAttributes({
text
})
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/shortcode/save.js
/**
* WordPress dependencies
*/
function shortcode_save_save({
attributes
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, attributes.text);
}
;// CONCATENATED MODULE: external ["wp","autop"]
const external_wp_autop_namespaceObject = window["wp"]["autop"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/shortcode/transforms.js
/**
* WordPress dependencies
*/
const shortcode_transforms_transforms = {
from: [{
type: 'shortcode',
// Per "Shortcode names should be all lowercase and use all
// letters, but numbers and underscores should work fine too.
// Be wary of using hyphens (dashes), you'll be better off not
// using them." in https://codex.wordpress.org/Shortcode_API
// Require that the first character be a letter. This notably
// prevents footnote markings ([1]) from being caught as
// shortcodes.
tag: '[a-z][a-z0-9_-]*',
attributes: {
text: {
type: 'string',
shortcode: (attrs, {
content
}) => {
return (0,external_wp_autop_namespaceObject.removep)((0,external_wp_autop_namespaceObject.autop)(content));
}
}
},
priority: 20
}]
};
/* harmony default export */ const shortcode_transforms = (shortcode_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/shortcode/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const shortcode_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/shortcode",
title: "Shortcode",
category: "widgets",
description: "Insert additional custom elements with a WordPress shortcode.",
textdomain: "default",
attributes: {
text: {
type: "string",
source: "raw"
}
},
supports: {
className: false,
customClassName: false,
html: false
},
editorStyle: "wp-block-shortcode-editor"
};
const {
name: shortcode_name
} = shortcode_metadata;
const shortcode_settings = {
icon: library_shortcode,
transforms: shortcode_transforms,
edit: ShortcodeEdit,
save: shortcode_save_save
};
const shortcode_init = () => initBlock({
name: shortcode_name,
metadata: shortcode_metadata,
settings: shortcode_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/site-logo.js
/**
* WordPress dependencies
*/
const siteLogo = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12 3c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 1.5c4.1 0 7.5 3.4 7.5 7.5v.1c-1.4-.8-3.3-1.7-3.4-1.8-.2-.1-.5-.1-.8.1l-2.9 2.1L9 11.3c-.2-.1-.4 0-.6.1l-3.7 2.2c-.1-.5-.2-1-.2-1.5 0-4.2 3.4-7.6 7.5-7.6zm0 15c-3.1 0-5.7-1.9-6.9-4.5l3.7-2.2 3.5 1.2c.2.1.5 0 .7-.1l2.9-2.1c.8.4 2.5 1.2 3.5 1.9-.9 3.3-3.9 5.8-7.4 5.8z"
}));
/* harmony default export */ const site_logo = (siteLogo);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/site-logo/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module constants
*/
const site_logo_edit_ALLOWED_MEDIA_TYPES = ['image'];
const ACCEPT_MEDIA_STRING = 'image/*';
const SiteLogo = ({
alt,
attributes: {
align,
width,
height,
isLink,
linkTarget,
shouldSyncIcon
},
containerRef,
isSelected,
setAttributes,
setLogo,
logoUrl,
siteUrl,
logoId,
iconId,
setIcon,
canUserEdit
}) => {
const clientWidth = useClientWidth(containerRef, [align]);
const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
const isWideAligned = ['wide', 'full'].includes(align);
const isResizable = !isWideAligned && isLargeViewport;
const [{
naturalWidth,
naturalHeight
}, setNaturalSize] = (0,external_wp_element_namespaceObject.useState)({});
const [isEditingImage, setIsEditingImage] = (0,external_wp_element_namespaceObject.useState)(false);
const {
toggleSelection
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const classes = classnames_default()('custom-logo-link', {
'is-transient': (0,external_wp_blob_namespaceObject.isBlobURL)(logoUrl)
});
const {
imageEditing,
maxWidth,
title
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const settings = select(external_wp_blockEditor_namespaceObject.store).getSettings();
const siteEntities = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', '__unstableBase');
return {
title: siteEntities?.name,
imageEditing: settings.imageEditing,
maxWidth: settings.maxWidth
};
}, []);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Turn the `Use as site icon` toggle off if it is on but the logo and icon have
// fallen out of sync. This can happen if the toggle is saved in the `on` position,
// but changes are later made to the site icon in the Customizer.
if (shouldSyncIcon && logoId !== iconId) {
setAttributes({
shouldSyncIcon: false
});
}
}, []);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isSelected) {
setIsEditingImage(false);
}
}, [isSelected]);
function onResizeStart() {
toggleSelection(false);
}
function onResizeStop() {
toggleSelection(true);
}
const img = (0,external_React_namespaceObject.createElement)("img", {
className: "custom-logo",
src: logoUrl,
alt: alt,
onLoad: event => {
setNaturalSize({
naturalWidth: event.target.naturalWidth,
naturalHeight: event.target.naturalHeight
});
}
});
let imgWrapper = img;
// Disable reason: Image itself is not meant to be interactive, but
// should direct focus to block.
if (isLink) {
imgWrapper = /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
(0,external_React_namespaceObject.createElement)("a", {
href: siteUrl,
className: classes,
rel: "home",
title: title,
onClick: event => event.preventDefault()
}, img)
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */;
}
let imageWidthWithinContainer;
if (clientWidth && naturalWidth && naturalHeight) {
const exceedMaxWidth = naturalWidth > clientWidth;
imageWidthWithinContainer = exceedMaxWidth ? clientWidth : naturalWidth;
}
if (!isResizable || !imageWidthWithinContainer) {
return (0,external_React_namespaceObject.createElement)("div", {
style: {
width,
height
}
}, imgWrapper);
}
// Set the default width to a responsible size.
// Note that this width is also set in the attached frontend CSS file.
const defaultWidth = 120;
const currentWidth = width || defaultWidth;
const ratio = naturalWidth / naturalHeight;
const currentHeight = currentWidth / ratio;
const minWidth = naturalWidth < naturalHeight ? constants_MIN_SIZE : Math.ceil(constants_MIN_SIZE * ratio);
const minHeight = naturalHeight < naturalWidth ? constants_MIN_SIZE : Math.ceil(constants_MIN_SIZE / ratio);
// With the current implementation of ResizableBox, an image needs an
// explicit pixel value for the max-width. In absence of being able to
// set the content-width, this max-width is currently dictated by the
// vanilla editor style. The following variable adds a buffer to this
// vanilla style, so 3rd party themes have some wiggleroom. This does,
// in most cases, allow you to scale the image beyond the width of the
// main column, though not infinitely.
// @todo It would be good to revisit this once a content-width variable
// becomes available.
const maxWidthBuffer = maxWidth * 2.5;
let showRightHandle = false;
let showLeftHandle = false;
/* eslint-disable no-lonely-if */
// See https://github.com/WordPress/gutenberg/issues/7584.
if (align === 'center') {
// When the image is centered, show both handles.
showRightHandle = true;
showLeftHandle = true;
} else if ((0,external_wp_i18n_namespaceObject.isRTL)()) {
// In RTL mode the image is on the right by default.
// Show the right handle and hide the left handle only when it is
// aligned left. Otherwise always show the left handle.
if (align === 'left') {
showRightHandle = true;
} else {
showLeftHandle = true;
}
} else {
// Show the left handle and hide the right handle only when the
// image is aligned right. Otherwise always show the right handle.
if (align === 'right') {
showLeftHandle = true;
} else {
showRightHandle = true;
}
}
/* eslint-enable no-lonely-if */
const canEditImage = logoId && naturalWidth && naturalHeight && imageEditing;
const imgEdit = canEditImage && isEditingImage ? (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalImageEditor, {
id: logoId,
url: logoUrl,
width: currentWidth,
height: currentHeight,
clientWidth: clientWidth,
naturalHeight: naturalHeight,
naturalWidth: naturalWidth,
onSaveImage: imageAttributes => {
setLogo(imageAttributes.id);
},
onFinishEditing: () => {
setIsEditingImage(false);
}
}) : (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ResizableBox, {
size: {
width: currentWidth,
height: currentHeight
},
showHandle: isSelected,
minWidth: minWidth,
maxWidth: maxWidthBuffer,
minHeight: minHeight,
maxHeight: maxWidthBuffer / ratio,
lockAspectRatio: true,
enable: {
top: false,
right: showRightHandle,
bottom: true,
left: showLeftHandle
},
onResizeStart: onResizeStart,
onResizeStop: (event, direction, elt, delta) => {
onResizeStop();
setAttributes({
width: parseInt(currentWidth + delta.width, 10),
height: parseInt(currentHeight + delta.height, 10)
});
}
}, imgWrapper);
// Support the previous location for the Site Icon settings. To be removed
// when the required WP core version for Gutenberg is >= 6.5.0.
const shouldUseNewUrl = !window?.__experimentalUseCustomizerSiteLogoUrl;
const siteIconSettingsUrl = shouldUseNewUrl ? siteUrl + '/wp-admin/options-general.php' : siteUrl + '/wp-admin/customize.php?autofocus[section]=title_tagline';
const syncSiteIconHelpText = (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. To use a custom icon that is different from your site logo, use the <a>Site Icon settings</a>.'), {
a:
// eslint-disable-next-line jsx-a11y/anchor-has-content
(0,external_React_namespaceObject.createElement)("a", {
href: siteIconSettingsUrl,
target: "_blank",
rel: "noopener noreferrer"
})
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Image width'),
onChange: newWidth => setAttributes({
width: newWidth
}),
min: minWidth,
max: maxWidthBuffer,
initialPosition: Math.min(defaultWidth, maxWidthBuffer),
value: width || '',
disabled: !isResizable
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link image to home'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
}), isLink && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: linkTarget === '_blank'
})), canUserEdit && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Use as Site Icon'),
onChange: value => {
setAttributes({
shouldSyncIcon: value
});
setIcon(value ? logoId : undefined);
},
checked: !!shouldSyncIcon,
help: syncSiteIconHelpText
})))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, canEditImage && !isEditingImage && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: () => setIsEditingImage(true),
icon: library_crop,
label: (0,external_wp_i18n_namespaceObject.__)('Crop')
})), imgEdit);
};
// This is a light wrapper around MediaReplaceFlow because the block has two
// different MediaReplaceFlows, one for the inspector and one for the toolbar.
function SiteLogoReplaceFlow({
onRemoveLogo,
...mediaReplaceProps
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, {
...mediaReplaceProps,
allowedTypes: site_logo_edit_ALLOWED_MEDIA_TYPES,
accept: ACCEPT_MEDIA_STRING
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: onRemoveLogo
}, (0,external_wp_i18n_namespaceObject.__)('Reset')));
}
const InspectorLogoPreview = ({
mediaItemData = {},
itemGroupProps
}) => {
const {
alt_text: alt,
source_url: logoUrl,
slug: logoSlug,
media_details: logoMediaDetails
} = mediaItemData;
const logoLabel = logoMediaDetails?.sizes?.full?.file || logoSlug;
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
...itemGroupProps,
as: "span"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "flex-start",
as: "span"
}, (0,external_React_namespaceObject.createElement)("img", {
src: logoUrl,
alt: alt
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
as: "span"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, {
numberOfLines: 1,
className: "block-library-site-logo__inspector-media-replace-title"
}, logoLabel))));
};
function LogoEdit({
attributes,
className,
setAttributes,
isSelected
}) {
const {
width,
shouldSyncIcon
} = attributes;
const ref = (0,external_wp_element_namespaceObject.useRef)();
const {
siteLogoId,
canUserEdit,
url,
siteIconId,
mediaItemData,
isRequestingMediaItem
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canUser,
getEntityRecord,
getEditedEntityRecord
} = select(external_wp_coreData_namespaceObject.store);
const _canUserEdit = canUser('update', 'settings');
const siteSettings = _canUserEdit ? getEditedEntityRecord('root', 'site') : undefined;
const siteData = getEntityRecord('root', '__unstableBase');
const _siteLogoId = _canUserEdit ? siteSettings?.site_logo : siteData?.site_logo;
const _siteIconId = siteSettings?.site_icon;
const mediaItem = _siteLogoId && select(external_wp_coreData_namespaceObject.store).getMedia(_siteLogoId, {
context: 'view'
});
const _isRequestingMediaItem = _siteLogoId && !select(external_wp_coreData_namespaceObject.store).hasFinishedResolution('getMedia', [_siteLogoId, {
context: 'view'
}]);
return {
siteLogoId: _siteLogoId,
canUserEdit: _canUserEdit,
url: siteData?.home,
mediaItemData: mediaItem,
isRequestingMediaItem: _isRequestingMediaItem,
siteIconId: _siteIconId
};
}, []);
const {
getSettings
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
const {
editEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
const setLogo = (newValue, shouldForceSync = false) => {
// `shouldForceSync` is used to force syncing when the attribute
// may not have updated yet.
if (shouldSyncIcon || shouldForceSync) {
setIcon(newValue);
}
editEntityRecord('root', 'site', undefined, {
site_logo: newValue
});
};
const setIcon = newValue =>
// The new value needs to be `null` to reset the Site Icon.
editEntityRecord('root', 'site', undefined, {
site_icon: newValue !== null && newValue !== void 0 ? newValue : null
});
const {
alt_text: alt,
source_url: logoUrl
} = mediaItemData !== null && mediaItemData !== void 0 ? mediaItemData : {};
const onInitialSelectLogo = media => {
// Initialize the syncSiteIcon toggle. If we currently have no Site logo and no
// site icon, automatically sync the logo to the icon.
if (shouldSyncIcon === undefined) {
const shouldForceSync = !siteIconId;
setAttributes({
shouldSyncIcon: shouldForceSync
});
// Because we cannot rely on the `shouldSyncIcon` attribute to have updated by
// the time `setLogo` is called, pass an argument to force the syncing.
onSelectLogo(media, shouldForceSync);
return;
}
onSelectLogo(media);
};
const onSelectLogo = (media, shouldForceSync = false) => {
if (!media) {
return;
}
if (!media.id && media.url) {
// This is a temporary blob image.
setLogo(undefined);
return;
}
setLogo(media.id, shouldForceSync);
};
const onRemoveLogo = () => {
setLogo(null);
setAttributes({
width: undefined
});
};
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const onUploadError = message => {
createErrorNotice(message, {
type: 'snackbar'
});
};
const onFilesDrop = filesList => {
getSettings().mediaUpload({
allowedTypes: site_logo_edit_ALLOWED_MEDIA_TYPES,
filesList,
onFileChange([image]) {
if ((0,external_wp_blob_namespaceObject.isBlobURL)(image?.url)) {
return;
}
onInitialSelectLogo(image);
},
onError: onUploadError
});
};
const mediaReplaceFlowProps = {
mediaURL: logoUrl,
onSelect: onSelectLogo,
onError: onUploadError,
onRemoveLogo
};
const controls = canUserEdit && logoUrl && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(SiteLogoReplaceFlow, {
...mediaReplaceFlowProps
}));
let logoImage;
const isLoading = siteLogoId === undefined || isRequestingMediaItem;
if (isLoading) {
logoImage = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null);
}
if (!!logoUrl) {
logoImage = (0,external_React_namespaceObject.createElement)(SiteLogo, {
alt: alt,
attributes: attributes,
className: className,
containerRef: ref,
isSelected: isSelected,
setAttributes: setAttributes,
logoUrl: logoUrl,
setLogo: setLogo,
logoId: mediaItemData?.id || siteLogoId,
siteUrl: url,
setIcon: setIcon,
iconId: siteIconId,
canUserEdit: canUserEdit
});
}
const placeholder = content => {
const placeholderClassName = classnames_default()('block-editor-media-placeholder', className);
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
className: placeholderClassName,
preview: logoImage,
withIllustration: true,
style: {
width
}
}, content);
};
const classes = classnames_default()(className, {
'is-default-size': !width
});
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
ref,
className: classes
});
const label = (0,external_wp_i18n_namespaceObject.__)('Add a site logo');
const mediaInspectorPanel = (canUserEdit || logoUrl) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Media')
}, (0,external_React_namespaceObject.createElement)("div", {
className: "block-library-site-logo__inspector-media-replace-container"
}, !canUserEdit && !!logoUrl && (0,external_React_namespaceObject.createElement)(InspectorLogoPreview, {
mediaItemData: mediaItemData,
itemGroupProps: {
isBordered: true,
className: 'block-library-site-logo__inspector-readonly-logo-preview'
}
}), canUserEdit && !!logoUrl && (0,external_React_namespaceObject.createElement)(SiteLogoReplaceFlow, {
...mediaReplaceFlowProps,
name: (0,external_React_namespaceObject.createElement)(InspectorLogoPreview, {
mediaItemData: mediaItemData
}),
popoverProps: {}
}), canUserEdit && !logoUrl && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, {
onSelect: onInitialSelectLogo,
allowedTypes: site_logo_edit_ALLOWED_MEDIA_TYPES,
render: ({
open
}) => (0,external_React_namespaceObject.createElement)("div", {
className: "block-library-site-logo__inspector-upload-container"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
onClick: open,
variant: "secondary"
}, isLoading ? (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null) : (0,external_wp_i18n_namespaceObject.__)('Add media')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.DropZone, {
onFilesDrop: onFilesDrop
}))
})))));
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, controls, mediaInspectorPanel, !!logoUrl && logoImage, !logoUrl && !canUserEdit && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
className: "site-logo_placeholder"
}, !!isLoading && (0,external_React_namespaceObject.createElement)("span", {
className: "components-placeholder__preview"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null))), !logoUrl && canUserEdit && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
onSelect: onInitialSelectLogo,
accept: ACCEPT_MEDIA_STRING,
allowedTypes: site_logo_edit_ALLOWED_MEDIA_TYPES,
onError: onUploadError,
placeholder: placeholder,
mediaLibraryButton: ({
open
}) => {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
icon: library_upload,
variant: "primary",
label: label,
showTooltip: true,
tooltipPosition: "top center",
onClick: () => {
open();
}
});
}
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/site-logo/transforms.js
/**
* WordPress dependencies
*/
const site_logo_transforms_transforms = {
to: [{
type: 'block',
blocks: ['core/site-title'],
transform: ({
isLink,
linkTarget
}) => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/site-title', {
isLink,
linkTarget
});
}
}]
};
/* harmony default export */ const site_logo_transforms = (site_logo_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/site-logo/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const site_logo_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/site-logo",
title: "Site Logo",
category: "theme",
description: "Display an image to represent this site. Update this block and the changes apply everywhere.",
textdomain: "default",
attributes: {
width: {
type: "number"
},
isLink: {
type: "boolean",
"default": true
},
linkTarget: {
type: "string",
"default": "_self"
},
shouldSyncIcon: {
type: "boolean"
}
},
example: {
viewportWidth: 500,
attributes: {
width: 350,
className: "block-editor-block-types-list__site-logo-example"
}
},
supports: {
html: false,
align: true,
alignWide: false,
color: {
__experimentalDuotone: "img, .components-placeholder__illustration, .components-placeholder::before",
text: false,
background: false
},
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
interactivity: {
clientNavigation: true
}
},
styles: [{
name: "default",
label: "Default",
isDefault: true
}, {
name: "rounded",
label: "Rounded"
}],
editorStyle: "wp-block-site-logo-editor",
style: "wp-block-site-logo"
};
const {
name: site_logo_name
} = site_logo_metadata;
const site_logo_settings = {
icon: site_logo,
example: {},
edit: LogoEdit,
transforms: site_logo_transforms
};
const site_logo_init = () => initBlock({
name: site_logo_name,
metadata: site_logo_metadata,
settings: site_logo_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/site-tagline/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function SiteTaglineEdit({
attributes,
setAttributes,
insertBlocksAfter
}) {
const {
textAlign
} = attributes;
const {
canUserEdit,
tagline
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canUser,
getEntityRecord,
getEditedEntityRecord
} = select(external_wp_coreData_namespaceObject.store);
const canEdit = canUser('update', 'settings');
const settings = canEdit ? getEditedEntityRecord('root', 'site') : {};
const readOnlySettings = getEntityRecord('root', '__unstableBase');
return {
canUserEdit: canUser('update', 'settings'),
tagline: canEdit ? settings?.description : readOnlySettings?.description
};
}, []);
const {
editEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
function setTagline(newTagline) {
editEntityRecord('root', 'site', undefined, {
description: newTagline
});
}
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign,
'wp-block-site-tagline__placeholder': !canUserEdit && !tagline
})
});
const siteTaglineContent = canUserEdit ? (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
allowedFormats: [],
onChange: setTagline,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Site tagline text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write site tagline…'),
tagName: "p",
value: tagline,
disableLineBreaks: true,
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)())),
...blockProps
}) : (0,external_React_namespaceObject.createElement)("p", {
...blockProps
}, tagline || (0,external_wp_i18n_namespaceObject.__)('Site Tagline placeholder'));
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
onChange: newAlign => setAttributes({
textAlign: newAlign
}),
value: textAlign
})), siteTaglineContent);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/site-tagline/icon.js
/**
* WordPress dependencies
*/
/* harmony default export */ const site_tagline_icon = ((0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
width: "24",
height: "24"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
d: "M4 10.5h16V9H4v1.5ZM4 15h9v-1.5H4V15Z"
})));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/site-tagline/deprecated.js
/**
* Internal dependencies
*/
const site_tagline_deprecated_v1 = {
attributes: {
textAlign: {
type: 'string'
}
},
supports: {
align: ['wide', 'full'],
html: false,
color: {
gradients: true
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalTextTransform: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true
}
},
save() {
return null;
},
migrate: migrate_font_family,
isEligible({
style
}) {
return style?.typography?.fontFamily;
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const site_tagline_deprecated = ([site_tagline_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/site-tagline/index.js
/**
* Internal dependencies
*/
const site_tagline_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/site-tagline",
title: "Site Tagline",
category: "theme",
description: "Describe in a few words what the site is about. The tagline can be used in search results or when sharing on social networks even if it\u2019s not displayed in the theme design.",
keywords: ["description"],
textdomain: "default",
attributes: {
textAlign: {
type: "string"
}
},
example: {},
supports: {
align: ["wide", "full"],
html: false,
color: {
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-site-tagline-editor"
};
const {
name: site_tagline_name
} = site_tagline_metadata;
const site_tagline_settings = {
icon: site_tagline_icon,
edit: SiteTaglineEdit,
deprecated: site_tagline_deprecated
};
const site_tagline_init = () => initBlock({
name: site_tagline_name,
metadata: site_tagline_metadata,
settings: site_tagline_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/map-marker.js
/**
* WordPress dependencies
*/
const mapMarker = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12 9c-.8 0-1.5.7-1.5 1.5S11.2 12 12 12s1.5-.7 1.5-1.5S12.8 9 12 9zm0-5c-3.6 0-6.5 2.8-6.5 6.2 0 .8.3 1.8.9 3.1.5 1.1 1.2 2.3 2 3.6.7 1 3 3.8 3.2 3.9l.4.5.4-.5c.2-.2 2.6-2.9 3.2-3.9.8-1.2 1.5-2.5 2-3.6.6-1.3.9-2.3.9-3.1C18.5 6.8 15.6 4 12 4zm4.3 8.7c-.5 1-1.1 2.2-1.9 3.4-.5.7-1.7 2.2-2.4 3-.7-.8-1.9-2.3-2.4-3-.8-1.2-1.4-2.3-1.9-3.3-.6-1.4-.7-2.2-.7-2.5 0-2.6 2.2-4.7 5-4.7s5 2.1 5 4.7c0 .2-.1 1-.7 2.4z"
}));
/* harmony default export */ const map_marker = (mapMarker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/site-title/edit/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const HEADING_LEVELS = [0, 1, 2, 3, 4, 5, 6];
function SiteTitleEdit({
attributes,
setAttributes,
insertBlocksAfter
}) {
const {
level,
textAlign,
isLink,
linkTarget
} = attributes;
const {
canUserEdit,
title
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
canUser,
getEntityRecord,
getEditedEntityRecord
} = select(external_wp_coreData_namespaceObject.store);
const canEdit = canUser('update', 'settings');
const settings = canEdit ? getEditedEntityRecord('root', 'site') : {};
const readOnlySettings = getEntityRecord('root', '__unstableBase');
return {
canUserEdit: canEdit,
title: canEdit ? settings?.title : readOnlySettings?.name
};
}, []);
const {
editEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
function setTitle(newTitle) {
editEntityRecord('root', 'site', undefined, {
title: newTitle
});
}
const TagName = level === 0 ? 'p' : `h${level}`;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign,
'wp-block-site-title__placeholder': !canUserEdit && !title
})
});
const siteTitleContent = canUserEdit ? (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: isLink ? 'a' : 'span',
href: isLink ? '#site-title-pseudo-link' : undefined,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Site title text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write site title…'),
value: title,
onChange: setTitle,
allowedFormats: [],
disableLineBreaks: true,
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()))
})) : (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, isLink ? (0,external_React_namespaceObject.createElement)("a", {
href: "#site-title-pseudo-link",
onClick: event => event.preventDefault()
}, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) || (0,external_wp_i18n_namespaceObject.__)('Site Title placeholder')) : (0,external_React_namespaceObject.createElement)("span", null, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title) || (0,external_wp_i18n_namespaceObject.__)('Site Title placeholder')));
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.HeadingLevelDropdown, {
options: HEADING_LEVELS,
value: level,
onChange: newLevel => setAttributes({
level: newLevel
})
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Make title link to home'),
onChange: () => setAttributes({
isLink: !isLink
}),
checked: isLink
}), isLink && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open in new tab'),
onChange: value => setAttributes({
linkTarget: value ? '_blank' : '_self'
}),
checked: linkTarget === '_blank'
}))), siteTitleContent);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/site-title/deprecated.js
/**
* Internal dependencies
*/
const site_title_deprecated_v1 = {
attributes: {
level: {
type: 'number',
default: 1
},
textAlign: {
type: 'string'
},
isLink: {
type: 'boolean',
default: true
},
linkTarget: {
type: 'string',
default: '_self'
}
},
supports: {
align: ['wide', 'full'],
html: false,
color: {
gradients: true,
link: true
},
spacing: {
padding: true,
margin: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalTextTransform: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true
}
},
save() {
return null;
},
migrate: migrate_font_family,
isEligible({
style
}) {
return style?.typography?.fontFamily;
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const site_title_deprecated = ([site_title_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/site-title/transforms.js
/**
* WordPress dependencies
*/
const site_title_transforms_transforms = {
to: [{
type: 'block',
blocks: ['core/site-logo'],
transform: ({
isLink,
linkTarget
}) => {
return (0,external_wp_blocks_namespaceObject.createBlock)('core/site-logo', {
isLink,
linkTarget
});
}
}]
};
/* harmony default export */ const site_title_transforms = (site_title_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/site-title/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const site_title_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/site-title",
title: "Site Title",
category: "theme",
description: "Displays the name of this site. Update the block, and the changes apply everywhere it\u2019s used. This will also appear in the browser title bar and in search results.",
textdomain: "default",
attributes: {
level: {
type: "number",
"default": 1
},
textAlign: {
type: "string"
},
isLink: {
type: "boolean",
"default": true
},
linkTarget: {
type: "string",
"default": "_self"
}
},
example: {
viewportWidth: 500
},
supports: {
align: ["wide", "full"],
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true,
link: true
}
},
spacing: {
padding: true,
margin: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-site-title-editor",
style: "wp-block-site-title"
};
const {
name: site_title_name
} = site_title_metadata;
const site_title_settings = {
icon: map_marker,
example: {},
edit: SiteTitleEdit,
transforms: site_title_transforms,
deprecated: site_title_deprecated
};
const site_title_init = () => initBlock({
name: site_title_name,
metadata: site_title_metadata,
settings: site_title_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/share.js
/**
* WordPress dependencies
*/
const share = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M9 11.8l6.1-4.5c.1.4.4.7.9.7h2c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-2c-.6 0-1 .4-1 1v.4l-6.4 4.8c-.2-.1-.4-.2-.6-.2H6c-.6 0-1 .4-1 1v2c0 .6.4 1 1 1h2c.2 0 .4-.1.6-.2l6.4 4.8v.4c0 .6.4 1 1 1h2c.6 0 1-.4 1-1v-2c0-.6-.4-1-1-1h-2c-.5 0-.8.3-.9.7L9 12.2v-.4z"
}));
/* harmony default export */ const library_share = (share);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard-return.js
/**
* WordPress dependencies
*/
const keyboardReturn = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "-2 -2 24 24"
}, (0,external_React_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 */ const keyboard_return = (keyboardReturn);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/wordpress.js
/**
* WordPress dependencies
*/
const WordPressIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12.158,12.786L9.46,20.625c0.806,0.237,1.657,0.366,2.54,0.366c1.047,0,2.051-0.181,2.986-0.51 c-0.024-0.038-0.046-0.079-0.065-0.124L12.158,12.786z M3.009,12c0,3.559,2.068,6.634,5.067,8.092L3.788,8.341 C3.289,9.459,3.009,10.696,3.009,12z M18.069,11.546c0-1.112-0.399-1.881-0.741-2.48c-0.456-0.741-0.883-1.368-0.883-2.109 c0-0.826,0.627-1.596,1.51-1.596c0.04,0,0.078,0.005,0.116,0.007C16.472,3.904,14.34,3.009,12,3.009 c-3.141,0-5.904,1.612-7.512,4.052c0.211,0.007,0.41,0.011,0.579,0.011c0.94,0,2.396-0.114,2.396-0.114 C7.947,6.93,8.004,7.642,7.52,7.699c0,0-0.487,0.057-1.029,0.085l3.274,9.739l1.968-5.901l-1.401-3.838 C9.848,7.756,9.389,7.699,9.389,7.699C8.904,7.67,8.961,6.93,9.446,6.958c0,0,1.484,0.114,2.368,0.114 c0.94,0,2.397-0.114,2.397-0.114c0.485-0.028,0.542,0.684,0.057,0.741c0,0-0.488,0.057-1.029,0.085l3.249,9.665l0.897-2.996 C17.841,13.284,18.069,12.316,18.069,11.546z M19.889,7.686c0.039,0.286,0.06,0.593,0.06,0.924c0,0.912-0.171,1.938-0.684,3.22 l-2.746,7.94c2.673-1.558,4.47-4.454,4.47-7.771C20.991,10.436,20.591,8.967,19.889,7.686z M12,22C6.486,22,2,17.514,2,12 C2,6.486,6.486,2,12,2c5.514,0,10,4.486,10,10C22,17.514,17.514,22,12,22z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/fivehundredpx.js
/**
* WordPress dependencies
*/
const FivehundredpxIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M6.94026,15.1412c.00437.01213.108.29862.168.44064a6.55008,6.55008,0,1,0,6.03191-9.09557,6.68654,6.68654,0,0,0-2.58357.51467A8.53914,8.53914,0,0,0,8.21268,8.61344L8.209,8.61725V3.22948l9.0504-.00008c.32934-.0036.32934-.46353.32934-.61466s0-.61091-.33035-.61467L7.47248,2a.43.43,0,0,0-.43131.42692v7.58355c0,.24466.30476.42131.58793.4819.553.11812.68074-.05864.81617-.2457l.018-.02481A10.52673,10.52673,0,0,1,9.32258,9.258a5.35268,5.35268,0,1,1,7.58985,7.54976,5.417,5.417,0,0,1-3.80867,1.56365,5.17483,5.17483,0,0,1-2.69822-.74478l.00342-4.61111a2.79372,2.79372,0,0,1,.71372-1.78792,2.61611,2.61611,0,0,1,1.98282-.89477,2.75683,2.75683,0,0,1,1.95525.79477,2.66867,2.66867,0,0,1,.79656,1.909,2.724,2.724,0,0,1-2.75849,2.748,4.94651,4.94651,0,0,1-.86254-.13719c-.31234-.093-.44519.34058-.48892.48349-.16811.54966.08453.65862.13687.67489a3.75751,3.75751,0,0,0,1.25234.18375,3.94634,3.94634,0,1,0-2.82444-6.742,3.67478,3.67478,0,0,0-1.13028,2.584l-.00041.02323c-.0035.11667-.00579,2.881-.00644,3.78811l-.00407-.00451a6.18521,6.18521,0,0,1-1.0851-1.86092c-.10544-.27856-.34358-.22925-.66857-.12917-.14192.04372-.57386.17677-.47833.489Zm4.65165-1.08338a.51346.51346,0,0,0,.19513.31818l.02276.022a.52945.52945,0,0,0,.3517.18416.24242.24242,0,0,0,.16577-.0611c.05473-.05082.67382-.67812.73287-.738l.69041.68819a.28978.28978,0,0,0,.21437.11032.53239.53239,0,0,0,.35708-.19486c.29792-.30419.14885-.46821.07676-.54751l-.69954-.69975.72952-.73469c.16-.17311.01874-.35708-.12218-.498-.20461-.20461-.402-.25742-.52855-.14083l-.7254.72665-.73354-.73375a.20128.20128,0,0,0-.14179-.05695.54135.54135,0,0,0-.34379.19648c-.22561.22555-.274.38149-.15656.5059l.73374.7315-.72942.73072A.26589.26589,0,0,0,11.59191,14.05782Zm1.59866-9.915A8.86081,8.86081,0,0,0,9.854,4.776a.26169.26169,0,0,0-.16938.22759.92978.92978,0,0,0,.08619.42094c.05682.14524.20779.531.50006.41955a8.40969,8.40969,0,0,1,2.91968-.55484,7.87875,7.87875,0,0,1,3.086.62286,8.61817,8.61817,0,0,1,2.30562,1.49315.2781.2781,0,0,0,.18318.07586c.15529,0,.30425-.15253.43167-.29551.21268-.23861.35873-.4369.1492-.63538a8.50425,8.50425,0,0,0-2.62312-1.694A9.0177,9.0177,0,0,0,13.19058,4.14283ZM19.50945,18.6236h0a.93171.93171,0,0,0-.36642-.25406.26589.26589,0,0,0-.27613.06613l-.06943.06929A7.90606,7.90606,0,0,1,7.60639,18.505a7.57284,7.57284,0,0,1-1.696-2.51537,8.58715,8.58715,0,0,1-.5147-1.77754l-.00871-.04864c-.04939-.25873-.28755-.27684-.62981-.22448-.14234.02178-.5755.088-.53426.39969l.001.00712a9.08807,9.08807,0,0,0,15.406,4.99094c.00193-.00192.04753-.04718.0725-.07436C19.79425,19.16234,19.87422,18.98728,19.50945,18.6236Z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/amazon.js
/**
* WordPress dependencies
*/
const AmazonIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13.582,8.182C11.934,8.367,9.78,8.49,8.238,9.166c-1.781,0.769-3.03,2.337-3.03,4.644 c0,2.953,1.86,4.429,4.253,4.429c2.02,0,3.125-0.477,4.685-2.065c0.516,0.747,0.685,1.109,1.629,1.894 c0.212,0.114,0.483,0.103,0.672-0.066l0.006,0.006c0.567-0.505,1.599-1.401,2.18-1.888c0.231-0.188,0.19-0.496,0.009-0.754 c-0.52-0.718-1.072-1.303-1.072-2.634V8.305c0-1.876,0.133-3.599-1.249-4.891C15.23,2.369,13.422,2,12.04,2 C9.336,2,6.318,3.01,5.686,6.351C5.618,6.706,5.877,6.893,6.109,6.945l2.754,0.298C9.121,7.23,9.308,6.977,9.357,6.72 c0.236-1.151,1.2-1.706,2.284-1.706c0.584,0,1.249,0.215,1.595,0.738c0.398,0.584,0.346,1.384,0.346,2.061V8.182z M13.049,14.088 c-0.451,0.8-1.169,1.291-1.967,1.291c-1.09,0-1.728-0.83-1.728-2.061c0-2.42,2.171-2.86,4.227-2.86v0.615 C13.582,12.181,13.608,13.104,13.049,14.088z M20.683,19.339C18.329,21.076,14.917,22,11.979,22c-4.118,0-7.826-1.522-10.632-4.057 c-0.22-0.199-0.024-0.471,0.241-0.317c3.027,1.762,6.771,2.823,10.639,2.823c2.608,0,5.476-0.541,8.115-1.66 C20.739,18.62,21.072,19.051,20.683,19.339z M21.336,21.043c-0.194,0.163-0.379,0.076-0.293-0.139 c0.284-0.71,0.92-2.298,0.619-2.684c-0.301-0.386-1.99-0.183-2.749-0.092c-0.23,0.027-0.266-0.173-0.059-0.319 c1.348-0.946,3.555-0.673,3.811-0.356C22.925,17.773,22.599,19.986,21.336,21.043z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/bandcamp.js
/**
* WordPress dependencies
*/
const BandcampIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M15.27 17.289 3 17.289 8.73 6.711 21 6.711 15.27 17.289"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/behance.js
/**
* WordPress dependencies
*/
const BehanceIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M7.799,5.698c0.589,0,1.12,0.051,1.606,0.156c0.482,0.102,0.894,0.273,1.241,0.507c0.344,0.235,0.612,0.546,0.804,0.938 c0.188,0.387,0.281,0.871,0.281,1.443c0,0.619-0.141,1.137-0.421,1.551c-0.284,0.413-0.7,0.751-1.255,1.014 c0.756,0.218,1.317,0.601,1.689,1.146c0.374,0.549,0.557,1.205,0.557,1.975c0,0.623-0.12,1.161-0.359,1.612 c-0.241,0.457-0.569,0.828-0.973,1.114c-0.408,0.288-0.876,0.5-1.399,0.637C9.052,17.931,8.514,18,7.963,18H2V5.698H7.799 M7.449,10.668c0.481,0,0.878-0.114,1.192-0.345c0.311-0.228,0.463-0.603,0.463-1.119c0-0.286-0.051-0.523-0.152-0.707 C8.848,8.315,8.711,8.171,8.536,8.07C8.362,7.966,8.166,7.894,7.94,7.854c-0.224-0.044-0.457-0.06-0.697-0.06H4.709v2.874H7.449z M7.6,15.905c0.267,0,0.521-0.024,0.759-0.077c0.243-0.053,0.457-0.137,0.637-0.261c0.182-0.12,0.332-0.283,0.441-0.491 C9.547,14.87,9.6,14.602,9.6,14.278c0-0.633-0.18-1.084-0.533-1.357c-0.356-0.27-0.83-0.404-1.413-0.404H4.709v3.388L7.6,15.905z M16.162,15.864c0.367,0.358,0.897,0.538,1.583,0.538c0.493,0,0.92-0.125,1.277-0.374c0.354-0.248,0.571-0.514,0.654-0.79h2.155 c-0.347,1.072-0.872,1.838-1.589,2.299C19.534,18,18.67,18.23,17.662,18.23c-0.701,0-1.332-0.113-1.899-0.337 c-0.567-0.227-1.041-0.544-1.439-0.958c-0.389-0.415-0.689-0.907-0.904-1.484c-0.213-0.574-0.32-1.21-0.32-1.899 c0-0.666,0.11-1.288,0.329-1.863c0.222-0.577,0.529-1.075,0.933-1.492c0.406-0.42,0.885-0.751,1.444-0.994 c0.558-0.241,1.175-0.363,1.857-0.363c0.754,0,1.414,0.145,1.98,0.44c0.563,0.291,1.026,0.686,1.389,1.181 c0.363,0.493,0.622,1.057,0.783,1.69c0.16,0.632,0.217,1.292,0.171,1.983h-6.428C15.557,14.84,15.795,15.506,16.162,15.864 M18.973,11.184c-0.291-0.321-0.783-0.496-1.384-0.496c-0.39,0-0.714,0.066-0.973,0.2c-0.254,0.132-0.461,0.297-0.621,0.491 c-0.157,0.197-0.265,0.405-0.328,0.628c-0.063,0.217-0.101,0.413-0.111,0.587h3.98C19.478,11.969,19.265,11.509,18.973,11.184z M15.057,7.738h4.985V6.524h-4.985L15.057,7.738z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/chain.js
/**
* WordPress dependencies
*/
const ChainIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_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"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/codepen.js
/**
* WordPress dependencies
*/
const CodepenIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M22.016,8.84c-0.002-0.013-0.005-0.025-0.007-0.037c-0.005-0.025-0.008-0.048-0.015-0.072 c-0.003-0.015-0.01-0.028-0.013-0.042c-0.008-0.02-0.015-0.04-0.023-0.062c-0.007-0.015-0.013-0.028-0.02-0.042 c-0.008-0.02-0.018-0.037-0.03-0.057c-0.007-0.013-0.017-0.027-0.025-0.038c-0.012-0.018-0.023-0.035-0.035-0.052 c-0.01-0.013-0.02-0.025-0.03-0.037c-0.015-0.017-0.028-0.032-0.043-0.045c-0.01-0.012-0.022-0.023-0.035-0.035 c-0.015-0.015-0.032-0.028-0.048-0.04c-0.012-0.01-0.025-0.02-0.037-0.03c-0.005-0.003-0.01-0.008-0.015-0.012l-9.161-6.096 c-0.289-0.192-0.666-0.192-0.955,0L2.359,8.237C2.354,8.24,2.349,8.245,2.344,8.249L2.306,8.277 c-0.017,0.013-0.033,0.027-0.048,0.04C2.246,8.331,2.234,8.342,2.222,8.352c-0.015,0.015-0.028,0.03-0.042,0.047 c-0.012,0.013-0.022,0.023-0.03,0.037C2.139,8.453,2.125,8.471,2.115,8.488C2.107,8.501,2.099,8.514,2.09,8.526 C2.079,8.548,2.069,8.565,2.06,8.585C2.054,8.6,2.047,8.613,2.04,8.626C2.032,8.648,2.025,8.67,2.019,8.69 c-0.005,0.013-0.01,0.027-0.013,0.042C1.999,8.755,1.995,8.778,1.99,8.803C1.989,8.817,1.985,8.828,1.984,8.84 C1.978,8.879,1.975,8.915,1.975,8.954v6.093c0,0.037,0.003,0.075,0.008,0.112c0.002,0.012,0.005,0.025,0.007,0.038 c0.005,0.023,0.008,0.047,0.015,0.072c0.003,0.015,0.008,0.028,0.013,0.04c0.007,0.022,0.013,0.042,0.022,0.063 c0.007,0.015,0.013,0.028,0.02,0.04c0.008,0.02,0.018,0.038,0.03,0.058c0.007,0.013,0.015,0.027,0.025,0.038 c0.012,0.018,0.023,0.035,0.035,0.052c0.01,0.013,0.02,0.025,0.03,0.037c0.013,0.015,0.028,0.032,0.042,0.045 c0.012,0.012,0.023,0.023,0.035,0.035c0.015,0.013,0.032,0.028,0.048,0.04l0.038,0.03c0.005,0.003,0.01,0.007,0.013,0.01 l9.163,6.095C11.668,21.953,11.833,22,12,22c0.167,0,0.332-0.047,0.478-0.144l9.163-6.095l0.015-0.01 c0.013-0.01,0.027-0.02,0.037-0.03c0.018-0.013,0.035-0.028,0.048-0.04c0.013-0.012,0.025-0.023,0.035-0.035 c0.017-0.015,0.03-0.032,0.043-0.045c0.01-0.013,0.02-0.025,0.03-0.037c0.013-0.018,0.025-0.035,0.035-0.052 c0.008-0.013,0.018-0.027,0.025-0.038c0.012-0.02,0.022-0.038,0.03-0.058c0.007-0.013,0.013-0.027,0.02-0.04 c0.008-0.022,0.015-0.042,0.023-0.063c0.003-0.013,0.01-0.027,0.013-0.04c0.007-0.025,0.01-0.048,0.015-0.072 c0.002-0.013,0.005-0.027,0.007-0.037c0.003-0.042,0.007-0.079,0.007-0.117V8.954C22.025,8.915,22.022,8.879,22.016,8.84z M12.862,4.464l6.751,4.49l-3.016,2.013l-3.735-2.492V4.464z M11.138,4.464v4.009l-3.735,2.494L4.389,8.954L11.138,4.464z M3.699,10.562L5.853,12l-2.155,1.438V10.562z M11.138,19.536l-6.749-4.491l3.015-2.011l3.735,2.492V19.536z M12,14.035L8.953,12 L12,9.966L15.047,12L12,14.035z M12.862,19.536v-4.009l3.735-2.492l3.016,2.011L12.862,19.536z M20.303,13.438L18.147,12 l2.156-1.438L20.303,13.438z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/deviantart.js
/**
* WordPress dependencies
*/
const DeviantArtIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M 18.19 5.636 18.19 2 18.188 2 14.553 2 14.19 2.366 12.474 5.636 11.935 6 5.81 6 5.81 10.994 9.177 10.994 9.477 11.357 5.81 18.363 5.81 22 5.811 22 9.447 22 9.81 21.634 11.526 18.364 12.065 18 18.19 18 18.19 13.006 14.823 13.006 14.523 12.641 18.19 5.636z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/dribbble.js
/**
* WordPress dependencies
*/
const DribbbleIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12,22C6.486,22,2,17.514,2,12S6.486,2,12,2c5.514,0,10,4.486,10,10S17.514,22,12,22z M20.434,13.369 c-0.292-0.092-2.644-0.794-5.32-0.365c1.117,3.07,1.572,5.57,1.659,6.09C18.689,17.798,20.053,15.745,20.434,13.369z M15.336,19.876c-0.127-0.749-0.623-3.361-1.822-6.477c-0.019,0.006-0.038,0.013-0.056,0.019c-4.818,1.679-6.547,5.02-6.701,5.334 c1.448,1.129,3.268,1.803,5.243,1.803C13.183,20.555,14.311,20.313,15.336,19.876z M5.654,17.724 c0.193-0.331,2.538-4.213,6.943-5.637c0.111-0.036,0.224-0.07,0.337-0.102c-0.214-0.485-0.448-0.971-0.692-1.45 c-4.266,1.277-8.405,1.223-8.778,1.216c-0.003,0.087-0.004,0.174-0.004,0.261C3.458,14.207,4.29,16.21,5.654,17.724z M3.639,10.264 c0.382,0.005,3.901,0.02,7.897-1.041c-1.415-2.516-2.942-4.631-3.167-4.94C5.979,5.41,4.193,7.613,3.639,10.264z M9.998,3.709 c0.236,0.316,1.787,2.429,3.187,5c3.037-1.138,4.323-2.867,4.477-3.085C16.154,4.286,14.17,3.471,12,3.471 C11.311,3.471,10.641,3.554,9.998,3.709z M18.612,6.612C18.432,6.855,17,8.69,13.842,9.979c0.199,0.407,0.389,0.821,0.567,1.237 c0.063,0.148,0.124,0.295,0.184,0.441c2.842-0.357,5.666,0.215,5.948,0.275C20.522,9.916,19.801,8.065,18.612,6.612z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/dropbox.js
/**
* WordPress dependencies
*/
const DropboxIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12,6.134L6.069,9.797L2,6.54l5.883-3.843L12,6.134z M2,13.054l5.883,3.843L12,13.459L6.069,9.797L2,13.054z M12,13.459 l4.116,3.439L22,13.054l-4.069-3.257L12,13.459z M22,6.54l-5.884-3.843L12,6.134l5.931,3.663L22,6.54z M12.011,14.2l-4.129,3.426 l-1.767-1.153v1.291l5.896,3.539l5.897-3.539v-1.291l-1.769,1.153L12.011,14.2z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/etsy.js
/**
* WordPress dependencies
*/
const EtsyIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M9.16033,4.038c0-.27174.02717-.43478.48913-.43478h6.22283c1.087,0,1.68478.92391,2.11957,2.663l.35326,1.38587h1.05978C19.59511,3.712,19.75815,2,19.75815,2s-2.663.29891-4.23913.29891h-7.962L3.29076,2.163v1.1413L4.731,3.57609c1.00543.19022,1.25.40761,1.33152,1.33152,0,0,.08152,2.71739.08152,7.20109s-.08152,7.17391-.08152,7.17391c0,.81522-.32609,1.11413-1.33152,1.30435l-1.44022.27174V22l4.2663-.13587h7.11957c1.60326,0,5.32609.13587,5.32609.13587.08152-.97826.625-5.40761.70652-5.89674H19.7038L18.644,18.52174c-.84239,1.90217-2.06522,2.038-3.42391,2.038H11.1712c-1.3587,0-2.01087-.54348-2.01087-1.712V12.65217s3.0163,0,3.99457.08152c.76087.05435,1.22283.27174,1.46739,1.33152l.32609,1.413h1.16848l-.08152-3.55978.163-3.587H15.02989l-.38043,1.57609c-.24457,1.03261-.40761,1.22283-1.46739,1.33152-1.38587.13587-4.02174.1087-4.02174.1087Z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/facebook.js
/**
* WordPress dependencies
*/
const FacebookIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/feed.js
/**
* WordPress dependencies
*/
const FeedIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M2,8.667V12c5.515,0,10,4.485,10,10h3.333C15.333,14.637,9.363,8.667,2,8.667z M2,2v3.333 c9.19,0,16.667,7.477,16.667,16.667H22C22,10.955,13.045,2,2,2z M4.5,17C3.118,17,2,18.12,2,19.5S3.118,22,4.5,22S7,20.88,7,19.5 S5.882,17,4.5,17z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/flickr.js
/**
* WordPress dependencies
*/
const FlickrIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M6.5,7c-2.75,0-5,2.25-5,5s2.25,5,5,5s5-2.25,5-5S9.25,7,6.5,7z M17.5,7c-2.75,0-5,2.25-5,5s2.25,5,5,5s5-2.25,5-5 S20.25,7,17.5,7z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/foursquare.js
/**
* WordPress dependencies
*/
const FoursquareIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.573,2c0,0-9.197,0-10.668,0S5,3.107,5,3.805s0,16.948,0,16.948c0,0.785,0.422,1.077,0.66,1.172 c0.238,0.097,0.892,0.177,1.285-0.275c0,0,5.035-5.843,5.122-5.93c0.132-0.132,0.132-0.132,0.262-0.132h3.26 c1.368,0,1.588-0.977,1.732-1.552c0.078-0.318,0.692-3.428,1.225-6.122l0.675-3.368C19.56,2.893,19.14,2,17.573,2z M16.495,7.22 c-0.053,0.252-0.372,0.518-0.665,0.518c-0.293,0-4.157,0-4.157,0c-0.467,0-0.802,0.318-0.802,0.787v0.508 c0,0.467,0.337,0.798,0.805,0.798c0,0,3.197,0,3.528,0s0.655,0.362,0.583,0.715c-0.072,0.353-0.407,2.102-0.448,2.295 c-0.04,0.193-0.262,0.523-0.655,0.523c-0.33,0-2.88,0-2.88,0c-0.523,0-0.683,0.068-1.033,0.503 c-0.35,0.437-3.505,4.223-3.505,4.223c-0.032,0.035-0.063,0.027-0.063-0.015V4.852c0-0.298,0.26-0.648,0.648-0.648 c0,0,8.228,0,8.562,0c0.315,0,0.61,0.297,0.528,0.683L16.495,7.22z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/goodreads.js
/**
* WordPress dependencies
*/
const GoodreadsIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.3,17.5c-0.2,0.8-0.5,1.4-1,1.9c-0.4,0.5-1,0.9-1.7,1.2C13.9,20.9,13.1,21,12,21c-0.6,0-1.3-0.1-1.9-0.2 c-0.6-0.1-1.1-0.4-1.6-0.7c-0.5-0.3-0.9-0.7-1.2-1.2c-0.3-0.5-0.5-1.1-0.5-1.7h1.5c0.1,0.5,0.2,0.9,0.5,1.2 c0.2,0.3,0.5,0.6,0.9,0.8c0.3,0.2,0.7,0.3,1.1,0.4c0.4,0.1,0.8,0.1,1.2,0.1c1.4,0,2.5-0.4,3.1-1.2c0.6-0.8,1-2,1-3.5v-1.7h0 c-0.4,0.8-0.9,1.4-1.6,1.9c-0.7,0.5-1.5,0.7-2.4,0.7c-1,0-1.9-0.2-2.6-0.5C8.7,15,8.1,14.5,7.7,14c-0.5-0.6-0.8-1.3-1-2.1 c-0.2-0.8-0.3-1.6-0.3-2.5c0-0.9,0.1-1.7,0.4-2.5c0.3-0.8,0.6-1.5,1.1-2c0.5-0.6,1.1-1,1.8-1.4C10.3,3.2,11.1,3,12,3 c0.5,0,0.9,0.1,1.3,0.2c0.4,0.1,0.8,0.3,1.1,0.5c0.3,0.2,0.6,0.5,0.9,0.8c0.3,0.3,0.5,0.6,0.6,1h0V3.4h1.5V15 C17.6,15.9,17.5,16.7,17.3,17.5z M13.8,14.1c0.5-0.3,0.9-0.7,1.3-1.1c0.3-0.5,0.6-1,0.8-1.6c0.2-0.6,0.3-1.2,0.3-1.9 c0-0.6-0.1-1.2-0.2-1.9c-0.1-0.6-0.4-1.2-0.7-1.7c-0.3-0.5-0.7-0.9-1.3-1.2c-0.5-0.3-1.1-0.5-1.9-0.5s-1.4,0.2-1.9,0.5 c-0.5,0.3-1,0.7-1.3,1.2C8.5,6.4,8.3,7,8.1,7.6C8,8.2,7.9,8.9,7.9,9.5c0,0.6,0.1,1.3,0.2,1.9C8.3,12,8.6,12.5,8.9,13 c0.3,0.5,0.8,0.8,1.3,1.1c0.5,0.3,1.1,0.4,1.9,0.4C12.7,14.5,13.3,14.4,13.8,14.1z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/google.js
/**
* WordPress dependencies
*/
const GoogleIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12.02,10.18v3.72v0.01h5.51c-0.26,1.57-1.67,4.22-5.5,4.22c-3.31,0-6.01-2.75-6.01-6.12s2.7-6.12,6.01-6.12 c1.87,0,3.13,0.8,3.85,1.48l2.84-2.76C16.99,2.99,14.73,2,12.03,2c-5.52,0-10,4.48-10,10s4.48,10,10,10c5.77,0,9.6-4.06,9.6-9.77 c0-0.83-0.11-1.42-0.25-2.05H12.02z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/github.js
/**
* WordPress dependencies
*/
const GitHubIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/gravatar.js
/**
* WordPress dependencies
*/
const GravatarIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M10.8001 4.69937V10.6494C10.8001 11.1001 10.9791 11.5323 11.2978 11.851C11.6165 12.1697 12.0487 12.3487 12.4994 12.3487C12.9501 12.3487 13.3824 12.1697 13.7011 11.851C14.0198 11.5323 14.1988 11.1001 14.1988 10.6494V6.69089C15.2418 7.05861 16.1371 7.75537 16.7496 8.67617C17.3622 9.59698 17.6589 10.6919 17.595 11.796C17.5311 12.9001 17.1101 13.9535 16.3954 14.7975C15.6807 15.6415 14.711 16.2303 13.6325 16.4753C12.5541 16.7202 11.4252 16.608 10.4161 16.1555C9.40691 15.703 8.57217 14.9348 8.03763 13.9667C7.50308 12.9985 7.29769 11.8828 7.45242 10.7877C7.60714 9.69266 8.11359 8.67755 8.89545 7.89537C9.20904 7.57521 9.38364 7.14426 9.38132 6.69611C9.37899 6.24797 9.19994 5.81884 8.88305 5.50195C8.56616 5.18506 8.13704 5.00601 7.68889 5.00369C7.24075 5.00137 6.80979 5.17597 6.48964 5.48956C5.09907 6.8801 4.23369 8.7098 4.04094 10.6669C3.84819 12.624 4.34 14.5873 5.43257 16.2224C6.52515 17.8575 8.15088 19.0632 10.0328 19.634C11.9146 20.2049 13.9362 20.1055 15.753 19.3529C17.5699 18.6003 19.0695 17.241 19.9965 15.5066C20.9234 13.7722 21.2203 11.7701 20.8366 9.84133C20.4528 7.91259 19.4122 6.17658 17.892 4.92911C16.3717 3.68163 14.466 2.99987 12.4994 3C12.0487 3 11.6165 3.17904 11.2978 3.49773C10.9791 3.81643 10.8001 4.24867 10.8001 4.69937Z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/instagram.js
/**
* WordPress dependencies
*/
const InstagramIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12,4.622c2.403,0,2.688,0.009,3.637,0.052c0.877,0.04,1.354,0.187,1.671,0.31c0.42,0.163,0.72,0.358,1.035,0.673 c0.315,0.315,0.51,0.615,0.673,1.035c0.123,0.317,0.27,0.794,0.31,1.671c0.043,0.949,0.052,1.234,0.052,3.637 s-0.009,2.688-0.052,3.637c-0.04,0.877-0.187,1.354-0.31,1.671c-0.163,0.42-0.358,0.72-0.673,1.035 c-0.315,0.315-0.615,0.51-1.035,0.673c-0.317,0.123-0.794,0.27-1.671,0.31c-0.949,0.043-1.233,0.052-3.637,0.052 s-2.688-0.009-3.637-0.052c-0.877-0.04-1.354-0.187-1.671-0.31c-0.42-0.163-0.72-0.358-1.035-0.673 c-0.315-0.315-0.51-0.615-0.673-1.035c-0.123-0.317-0.27-0.794-0.31-1.671C4.631,14.688,4.622,14.403,4.622,12 s0.009-2.688,0.052-3.637c0.04-0.877,0.187-1.354,0.31-1.671c0.163-0.42,0.358-0.72,0.673-1.035 c0.315-0.315,0.615-0.51,1.035-0.673c0.317-0.123,0.794-0.27,1.671-0.31C9.312,4.631,9.597,4.622,12,4.622 M12,3 C9.556,3,9.249,3.01,8.289,3.054C7.331,3.098,6.677,3.25,6.105,3.472C5.513,3.702,5.011,4.01,4.511,4.511 c-0.5,0.5-0.808,1.002-1.038,1.594C3.25,6.677,3.098,7.331,3.054,8.289C3.01,9.249,3,9.556,3,12c0,2.444,0.01,2.751,0.054,3.711 c0.044,0.958,0.196,1.612,0.418,2.185c0.23,0.592,0.538,1.094,1.038,1.594c0.5,0.5,1.002,0.808,1.594,1.038 c0.572,0.222,1.227,0.375,2.185,0.418C9.249,20.99,9.556,21,12,21s2.751-0.01,3.711-0.054c0.958-0.044,1.612-0.196,2.185-0.418 c0.592-0.23,1.094-0.538,1.594-1.038c0.5-0.5,0.808-1.002,1.038-1.594c0.222-0.572,0.375-1.227,0.418-2.185 C20.99,14.751,21,14.444,21,12s-0.01-2.751-0.054-3.711c-0.044-0.958-0.196-1.612-0.418-2.185c-0.23-0.592-0.538-1.094-1.038-1.594 c-0.5-0.5-1.002-0.808-1.594-1.038c-0.572-0.222-1.227-0.375-2.185-0.418C14.751,3.01,14.444,3,12,3L12,3z M12,7.378 c-2.552,0-4.622,2.069-4.622,4.622S9.448,16.622,12,16.622s4.622-2.069,4.622-4.622S14.552,7.378,12,7.378z M12,15 c-1.657,0-3-1.343-3-3s1.343-3,3-3s3,1.343,3,3S13.657,15,12,15z M16.804,6.116c-0.596,0-1.08,0.484-1.08,1.08 s0.484,1.08,1.08,1.08c0.596,0,1.08-0.484,1.08-1.08S17.401,6.116,16.804,6.116z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/lastfm.js
/**
* WordPress dependencies
*/
const LastfmIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M 12.0002 1.5 C 6.2006 1.5 1.5 6.2011 1.5 11.9998 C 1.5 17.799 6.2006 22.5 12.0002 22.5 C 17.799 22.5 22.5 17.799 22.5 11.9998 C 22.5 6.2011 17.799 1.5 12.0002 1.5 Z M 16.1974 16.2204 C 14.8164 16.2152 13.9346 15.587 13.3345 14.1859 L 13.1816 13.8451 L 11.8541 10.8101 C 11.4271 9.7688 10.3526 9.0712 9.1801 9.0712 C 7.5695 9.0712 6.2593 10.3851 6.2593 12.001 C 6.2593 13.6165 7.5695 14.9303 9.1801 14.9303 C 10.272 14.9303 11.2651 14.3275 11.772 13.3567 C 11.7893 13.3235 11.8239 13.302 11.863 13.3038 C 11.9007 13.3054 11.9353 13.3288 11.9504 13.3632 L 12.4865 14.6046 C 12.5016 14.639 12.4956 14.6778 12.4723 14.7069 C 11.6605 15.6995 10.4602 16.2683 9.1801 16.2683 C 6.8331 16.2683 4.9234 14.3536 4.9234 12.001 C 4.9234 9.6468 6.833 7.732 9.1801 7.732 C 10.9572 7.732 12.3909 8.6907 13.1138 10.3636 C 13.1206 10.3802 13.8412 12.0708 14.4744 13.5191 C 14.8486 14.374 15.1462 14.896 16.1288 14.9292 C 17.0663 14.9613 17.7538 14.4122 17.7538 13.6485 C 17.7538 12.9691 17.3321 12.8004 16.3803 12.4822 C 14.7365 11.9398 13.845 11.3861 13.845 10.0182 C 13.845 8.6809 14.7667 7.8162 16.192 7.8162 C 17.1288 7.8162 17.8155 8.2287 18.2921 9.0768 C 18.305 9.1006 18.3079 9.1281 18.3004 9.1542 C 18.2929 9.1803 18.2748 9.2021 18.2507 9.2138 L 17.3614 9.669 C 17.3178 9.692 17.2643 9.6781 17.2356 9.6385 C 16.9329 9.2135 16.5956 9.0251 16.1423 9.0251 C 15.5512 9.0251 15.122 9.429 15.122 9.9865 C 15.122 10.6738 15.6529 10.8414 16.5339 11.1192 C 16.6491 11.1558 16.7696 11.194 16.8939 11.2343 C 18.2763 11.6865 19.0768 12.2311 19.0768 13.6836 C 19.0769 15.1297 17.8389 16.2204 16.1974 16.2204 Z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/linkedin.js
/**
* WordPress dependencies
*/
const LinkedInIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/mail.js
/**
* WordPress dependencies
*/
const MailIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l7.5 5.6 7.5-5.6V17zm0-9.1L12 13.6 4.5 7.9V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v.9z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/mastodon.js
/**
* WordPress dependencies
*/
const MastodonIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M23.193 7.879c0-5.206-3.411-6.732-3.411-6.732C18.062.357 15.108.025 12.041 0h-.076c-3.068.025-6.02.357-7.74 1.147 0 0-3.411 1.526-3.411 6.732 0 1.192-.023 2.618.015 4.129.124 5.092.934 10.109 5.641 11.355 2.17.574 4.034.695 5.535.612 2.722-.15 4.25-.972 4.25-.972l-.09-1.975s-1.945.613-4.129.539c-2.165-.074-4.449-.233-4.799-2.891a5.499 5.499 0 0 1-.048-.745s2.125.52 4.817.643c1.646.075 3.19-.097 4.758-.283 3.007-.359 5.625-2.212 5.954-3.905.517-2.665.475-6.507.475-6.507zm-4.024 6.709h-2.497V8.469c0-1.29-.543-1.944-1.628-1.944-1.2 0-1.802.776-1.802 2.312v3.349h-2.483v-3.35c0-1.536-.602-2.312-1.802-2.312-1.085 0-1.628.655-1.628 1.944v6.119H4.832V8.284c0-1.289.328-2.313.987-3.07.68-.758 1.569-1.146 2.674-1.146 1.278 0 2.246.491 2.886 1.474L12 6.585l.622-1.043c.64-.983 1.608-1.474 2.886-1.474 1.104 0 1.994.388 2.674 1.146.658.757.986 1.781.986 3.07v6.304z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/meetup.js
/**
* WordPress dependencies
*/
const MeetupIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M19.24775,14.722a3.57032,3.57032,0,0,1-2.94457,3.52073,3.61886,3.61886,0,0,1-.64652.05634c-.07314-.0008-.10187.02846-.12507.09547A2.38881,2.38881,0,0,1,13.49453,20.094a2.33092,2.33092,0,0,1-1.827-.50716.13635.13635,0,0,0-.19878-.00408,3.191,3.191,0,0,1-2.104.60248,3.26309,3.26309,0,0,1-3.00324-2.71993,2.19076,2.19076,0,0,1-.03512-.30865c-.00156-.08579-.03413-.1189-.11608-.13493a2.86421,2.86421,0,0,1-1.23189-.56111,2.945,2.945,0,0,1-1.166-2.05749,2.97484,2.97484,0,0,1,.87524-2.50774.112.112,0,0,0,.02091-.16107,2.7213,2.7213,0,0,1-.36648-1.48A2.81256,2.81256,0,0,1,6.57673,7.58838a.35764.35764,0,0,0,.28869-.22819,4.2208,4.2208,0,0,1,6.02892-1.90111.25161.25161,0,0,0,.22023.0243,3.65608,3.65608,0,0,1,3.76031.90678A3.57244,3.57244,0,0,1,17.95918,8.626a2.97339,2.97339,0,0,1,.01829.57356.10637.10637,0,0,0,.0853.12792,1.97669,1.97669,0,0,1,1.27939,1.33733,2.00266,2.00266,0,0,1-.57112,2.12652c-.05284.05166-.04168.08328-.01173.13489A3.51189,3.51189,0,0,1,19.24775,14.722Zm-6.35959-.27836a1.6984,1.6984,0,0,0,1.14556,1.61113,3.82039,3.82039,0,0,0,1.036.17935,1.46888,1.46888,0,0,0,.73509-.12255.44082.44082,0,0,0,.26057-.44274.45312.45312,0,0,0-.29211-.43375.97191.97191,0,0,0-.20678-.063c-.21326-.03806-.42754-.0701-.63973-.11215a.54787.54787,0,0,1-.50172-.60926,2.75864,2.75864,0,0,1,.1773-.901c.1763-.535.414-1.045.64183-1.55913A12.686,12.686,0,0,0,15.85,10.47863a1.58461,1.58461,0,0,0,.04861-.87208,1.04531,1.04531,0,0,0-.85432-.83981,1.60658,1.60658,0,0,0-1.23654.16594.27593.27593,0,0,1-.36286-.03413c-.085-.0747-.16594-.15379-.24918-.23055a.98682.98682,0,0,0-1.33577-.04933,6.1468,6.1468,0,0,1-.4989.41615.47762.47762,0,0,1-.51535.03566c-.17448-.09307-.35512-.175-.53531-.25665a1.74949,1.74949,0,0,0-.56476-.2016,1.69943,1.69943,0,0,0-1.61654.91787,8.05815,8.05815,0,0,0-.32952.80126c-.45471,1.2557-.82507,2.53825-1.20838,3.81639a1.24151,1.24151,0,0,0,.51532,1.44389,1.42659,1.42659,0,0,0,1.22008.17166,1.09728,1.09728,0,0,0,.66994-.69764c.44145-1.04111.839-2.09989,1.25981-3.14926.11581-.28876.22792-.57874.35078-.86438a.44548.44548,0,0,1,.69189-.19539.50521.50521,0,0,1,.15044.43836,1.75625,1.75625,0,0,1-.14731.50453c-.27379.69219-.55265,1.38236-.82766,2.074a2.0836,2.0836,0,0,0-.14038.42876.50719.50719,0,0,0,.27082.57722.87236.87236,0,0,0,.66145.02739.99137.99137,0,0,0,.53406-.532q.61571-1.20914,1.228-2.42031.28423-.55863.57585-1.1133a.87189.87189,0,0,1,.29055-.35253.34987.34987,0,0,1,.37634-.01265.30291.30291,0,0,1,.12434.31459.56716.56716,0,0,1-.04655.1915c-.05318.12739-.10286.25669-.16183.38156-.34118.71775-.68754,1.43273-1.02568,2.152A2.00213,2.00213,0,0,0,12.88816,14.44366Zm4.78568,5.28972a.88573.88573,0,0,0-1.77139.00465.8857.8857,0,0,0,1.77139-.00465Zm-14.83838-7.296a.84329.84329,0,1,0,.00827-1.68655.8433.8433,0,0,0-.00827,1.68655Zm10.366-9.43673a.83506.83506,0,1,0-.0091,1.67.83505.83505,0,0,0,.0091-1.67Zm6.85014,5.22a.71651.71651,0,0,0-1.433.0093.71656.71656,0,0,0,1.433-.0093ZM5.37528,6.17908A.63823.63823,0,1,0,6.015,5.54483.62292.62292,0,0,0,5.37528,6.17908Zm6.68214,14.80843a.54949.54949,0,1,0-.55052.541A.54556.54556,0,0,0,12.05742,20.98752Zm8.53235-8.49689a.54777.54777,0,0,0-.54027.54023.53327.53327,0,0,0,.532.52293.51548.51548,0,0,0,.53272-.5237A.53187.53187,0,0,0,20.58977,12.49063ZM7.82846,2.4715a.44927.44927,0,1,0,.44484.44766A.43821.43821,0,0,0,7.82846,2.4715Zm13.775,7.60492a.41186.41186,0,0,0-.40065.39623.40178.40178,0,0,0,.40168.40168A.38994.38994,0,0,0,22,10.48172.39946.39946,0,0,0,21.60349,10.07642ZM5.79193,17.96207a.40469.40469,0,0,0-.397-.39646.399.399,0,0,0-.396.405.39234.39234,0,0,0,.39939.389A.39857.39857,0,0,0,5.79193,17.96207Z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/medium.js
/**
* WordPress dependencies
*/
const MediumIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M20.962,7.257l-5.457,8.867l-3.923-6.375l3.126-5.08c0.112-0.182,0.319-0.286,0.527-0.286c0.05,0,0.1,0.008,0.149,0.02 c0.039,0.01,0.078,0.023,0.114,0.041l5.43,2.715l0.006,0.003c0.004,0.002,0.007,0.006,0.011,0.008 C20.971,7.191,20.98,7.227,20.962,7.257z M9.86,8.592v5.783l5.14,2.57L9.86,8.592z M15.772,17.331l4.231,2.115 C20.554,19.721,21,19.529,21,19.016V8.835L15.772,17.331z M8.968,7.178L3.665,4.527C3.569,4.479,3.478,4.456,3.395,4.456 C3.163,4.456,3,4.636,3,4.938v11.45c0,0.306,0.224,0.669,0.498,0.806l4.671,2.335c0.12,0.06,0.234,0.088,0.337,0.088 c0.29,0,0.494-0.225,0.494-0.602V7.231C9,7.208,8.988,7.188,8.968,7.178z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/patreon.js
/**
* WordPress dependencies
*/
const PatreonIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M20 8.40755C19.9969 6.10922 18.2543 4.22555 16.2097 3.54588C13.6708 2.70188 10.3222 2.82421 7.89775 3.99921C4.95932 5.42355 4.03626 8.54355 4.00186 11.6552C3.97363 14.2136 4.2222 20.9517 7.92225 20.9997C10.6715 21.0356 11.0809 17.3967 12.3529 15.6442C13.258 14.3974 14.4233 14.0452 15.8578 13.6806C18.3233 13.0537 20.0036 11.0551 20 8.40755Z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/pinterest.js
/**
* WordPress dependencies
*/
const PinterestIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12.289,2C6.617,2,3.606,5.648,3.606,9.622c0,1.846,1.025,4.146,2.666,4.878c0.25,0.111,0.381,0.063,0.439-0.169 c0.044-0.175,0.267-1.029,0.365-1.428c0.032-0.128,0.017-0.237-0.091-0.362C6.445,11.911,6.01,10.75,6.01,9.668 c0-2.777,2.194-5.464,5.933-5.464c3.23,0,5.49,2.108,5.49,5.122c0,3.407-1.794,5.768-4.13,5.768c-1.291,0-2.257-1.021-1.948-2.277 c0.372-1.495,1.089-3.112,1.089-4.191c0-0.967-0.542-1.775-1.663-1.775c-1.319,0-2.379,1.309-2.379,3.059 c0,1.115,0.394,1.869,0.394,1.869s-1.302,5.279-1.54,6.261c-0.405,1.666,0.053,4.368,0.094,4.604 c0.021,0.126,0.167,0.169,0.25,0.063c0.129-0.165,1.699-2.419,2.142-4.051c0.158-0.59,0.817-2.995,0.817-2.995 c0.43,0.784,1.681,1.446,3.013,1.446c3.963,0,6.822-3.494,6.822-7.833C20.394,5.112,16.849,2,12.289,2"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/pocket.js
/**
* WordPress dependencies
*/
const PocketIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M21.927,4.194C21.667,3.48,20.982,3,20.222,3h-0.01h-1.721H3.839C3.092,3,2.411,3.47,2.145,4.17 C2.066,4.378,2.026,4.594,2.026,4.814v6.035l0.069,1.2c0.29,2.73,1.707,5.115,3.899,6.778c0.039,0.03,0.079,0.059,0.119,0.089 l0.025,0.018c1.175,0.859,2.491,1.441,3.91,1.727c0.655,0.132,1.325,0.2,1.991,0.2c0.615,0,1.232-0.057,1.839-0.17 c0.073-0.014,0.145-0.028,0.219-0.044c0.02-0.004,0.042-0.012,0.064-0.023c1.359-0.297,2.621-0.864,3.753-1.691l0.025-0.018 c0.04-0.029,0.08-0.058,0.119-0.089c2.192-1.664,3.609-4.049,3.898-6.778l0.069-1.2V4.814C22.026,4.605,22,4.398,21.927,4.194z M17.692,10.481l-4.704,4.512c-0.266,0.254-0.608,0.382-0.949,0.382c-0.342,0-0.684-0.128-0.949-0.382l-4.705-4.512 C5.838,9.957,5.82,9.089,6.344,8.542c0.524-0.547,1.392-0.565,1.939-0.04l3.756,3.601l3.755-3.601 c0.547-0.524,1.415-0.506,1.939,0.04C18.256,9.089,18.238,9.956,17.692,10.481z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/reddit.js
/**
* WordPress dependencies
*/
const RedditIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M22 12.068a2.184 2.184 0 0 0-2.186-2.186c-.592 0-1.13.233-1.524.609-1.505-1.075-3.566-1.774-5.86-1.864l1.004-4.695 3.261.699A1.56 1.56 0 1 0 18.255 3c-.61-.001-1.147.357-1.398.877l-3.638-.77a.382.382 0 0 0-.287.053.348.348 0 0 0-.161.251l-1.112 5.233c-2.33.072-4.426.77-5.95 1.864a2.201 2.201 0 0 0-1.523-.61 2.184 2.184 0 0 0-.896 4.176c-.036.215-.053.43-.053.663 0 3.37 3.924 6.111 8.763 6.111s8.763-2.724 8.763-6.11c0-.216-.017-.449-.053-.664A2.207 2.207 0 0 0 22 12.068Zm-15.018 1.56a1.56 1.56 0 0 1 3.118 0c0 .86-.699 1.558-1.559 1.558-.86.018-1.559-.699-1.559-1.559Zm8.728 4.139c-1.076 1.075-3.119 1.147-3.71 1.147-.61 0-2.652-.09-3.71-1.147a.4.4 0 0 1 0-.573.4.4 0 0 1 .574 0c.68.68 2.114.914 3.136.914 1.022 0 2.473-.233 3.136-.914a.4.4 0 0 1 .574 0 .436.436 0 0 1 0 .573Zm-.287-2.563a1.56 1.56 0 0 1 0-3.118c.86 0 1.56.699 1.56 1.56 0 .841-.7 1.558-1.56 1.558Z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/skype.js
/**
* WordPress dependencies
*/
const SkypeIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M10.113,2.699c0.033-0.006,0.067-0.013,0.1-0.02c0.033,0.017,0.066,0.033,0.098,0.051L10.113,2.699z M2.72,10.223 c-0.006,0.034-0.011,0.069-0.017,0.103c0.018,0.032,0.033,0.064,0.051,0.095L2.72,10.223z M21.275,13.771 c0.007-0.035,0.011-0.071,0.018-0.106c-0.018-0.031-0.033-0.064-0.052-0.095L21.275,13.771z M13.563,21.199 c0.032,0.019,0.065,0.035,0.096,0.053c0.036-0.006,0.071-0.011,0.105-0.017L13.563,21.199z M22,16.386 c0,1.494-0.581,2.898-1.637,3.953c-1.056,1.057-2.459,1.637-3.953,1.637c-0.967,0-1.914-0.251-2.75-0.725 c0.036-0.006,0.071-0.011,0.105-0.017l-0.202-0.035c0.032,0.019,0.065,0.035,0.096,0.053c-0.543,0.096-1.099,0.147-1.654,0.147 c-1.275,0-2.512-0.25-3.676-0.743c-1.125-0.474-2.135-1.156-3.002-2.023c-0.867-0.867-1.548-1.877-2.023-3.002 c-0.493-1.164-0.743-2.401-0.743-3.676c0-0.546,0.049-1.093,0.142-1.628c0.018,0.032,0.033,0.064,0.051,0.095L2.72,10.223 c-0.006,0.034-0.011,0.069-0.017,0.103C2.244,9.5,2,8.566,2,7.615c0-1.493,0.582-2.898,1.637-3.953 c1.056-1.056,2.46-1.638,3.953-1.638c0.915,0,1.818,0.228,2.622,0.655c-0.033,0.007-0.067,0.013-0.1,0.02l0.199,0.031 c-0.032-0.018-0.066-0.034-0.098-0.051c0.002,0,0.003-0.001,0.004-0.001c0.586-0.112,1.187-0.169,1.788-0.169 c1.275,0,2.512,0.249,3.676,0.742c1.124,0.476,2.135,1.156,3.002,2.024c0.868,0.867,1.548,1.877,2.024,3.002 c0.493,1.164,0.743,2.401,0.743,3.676c0,0.575-0.054,1.15-0.157,1.712c-0.018-0.031-0.033-0.064-0.052-0.095l0.034,0.201 c0.007-0.035,0.011-0.071,0.018-0.106C21.754,14.494,22,15.432,22,16.386z M16.817,14.138c0-1.331-0.613-2.743-3.033-3.282 l-2.209-0.49c-0.84-0.192-1.807-0.444-1.807-1.237c0-0.794,0.679-1.348,1.903-1.348c2.468,0,2.243,1.696,3.468,1.696 c0.645,0,1.209-0.379,1.209-1.031c0-1.521-2.435-2.663-4.5-2.663c-2.242,0-4.63,0.952-4.63,3.488c0,1.221,0.436,2.521,2.839,3.123 l2.984,0.745c0.903,0.223,1.129,0.731,1.129,1.189c0,0.762-0.758,1.507-2.129,1.507c-2.679,0-2.307-2.062-3.743-2.062 c-0.645,0-1.113,0.444-1.113,1.078c0,1.236,1.501,2.886,4.856,2.886C15.236,17.737,16.817,16.199,16.817,14.138z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/snapchat.js
/**
* WordPress dependencies
*/
const SnapchatIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12.065,2a5.526,5.526,0,0,1,3.132.892A5.854,5.854,0,0,1,17.326,5.4a5.821,5.821,0,0,1,.351,2.33q0,.612-.117,2.487a.809.809,0,0,0,.365.091,1.93,1.93,0,0,0,.664-.176,1.93,1.93,0,0,1,.664-.176,1.3,1.3,0,0,1,.729.234.7.7,0,0,1,.351.6.839.839,0,0,1-.41.7,2.732,2.732,0,0,1-.9.41,3.192,3.192,0,0,0-.9.378.728.728,0,0,0-.41.618,1.575,1.575,0,0,0,.156.56,6.9,6.9,0,0,0,1.334,1.953,5.6,5.6,0,0,0,1.881,1.315,5.875,5.875,0,0,0,1.042.3.42.42,0,0,1,.365.456q0,.911-2.852,1.341a1.379,1.379,0,0,0-.143.507,1.8,1.8,0,0,1-.182.605.451.451,0,0,1-.429.241,5.878,5.878,0,0,1-.807-.085,5.917,5.917,0,0,0-.833-.085,4.217,4.217,0,0,0-.807.065,2.42,2.42,0,0,0-.82.293,6.682,6.682,0,0,0-.755.5q-.351.267-.755.527a3.886,3.886,0,0,1-.989.436A4.471,4.471,0,0,1,11.831,22a4.307,4.307,0,0,1-1.256-.176,3.784,3.784,0,0,1-.976-.436q-.4-.26-.749-.527a6.682,6.682,0,0,0-.755-.5,2.422,2.422,0,0,0-.807-.293,4.432,4.432,0,0,0-.82-.065,5.089,5.089,0,0,0-.853.1,5,5,0,0,1-.762.1.474.474,0,0,1-.456-.241,1.819,1.819,0,0,1-.182-.618,1.411,1.411,0,0,0-.143-.521q-2.852-.429-2.852-1.341a.42.42,0,0,1,.365-.456,5.793,5.793,0,0,0,1.042-.3,5.524,5.524,0,0,0,1.881-1.315,6.789,6.789,0,0,0,1.334-1.953A1.575,1.575,0,0,0,6,12.9a.728.728,0,0,0-.41-.618,3.323,3.323,0,0,0-.9-.384,2.912,2.912,0,0,1-.9-.41.814.814,0,0,1-.41-.684.71.71,0,0,1,.338-.593,1.208,1.208,0,0,1,.716-.241,1.976,1.976,0,0,1,.625.169,2.008,2.008,0,0,0,.69.169.919.919,0,0,0,.416-.091q-.117-1.849-.117-2.474A5.861,5.861,0,0,1,6.385,5.4,5.516,5.516,0,0,1,8.625,2.819,7.075,7.075,0,0,1,12.062,2Z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/soundcloud.js
/**
* WordPress dependencies
*/
const SoundCloudIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M8.9,16.1L9,14L8.9,9.5c0-0.1,0-0.1-0.1-0.1c0,0-0.1-0.1-0.1-0.1c-0.1,0-0.1,0-0.1,0.1c0,0-0.1,0.1-0.1,0.1L8.3,14l0.1,2.1 c0,0.1,0,0.1,0.1,0.1c0,0,0.1,0.1,0.1,0.1C8.8,16.3,8.9,16.3,8.9,16.1z M11.4,15.9l0.1-1.8L11.4,9c0-0.1,0-0.2-0.1-0.2 c0,0-0.1,0-0.1,0s-0.1,0-0.1,0c-0.1,0-0.1,0.1-0.1,0.2l0,0.1l-0.1,5c0,0,0,0.7,0.1,2v0c0,0.1,0,0.1,0.1,0.1c0.1,0.1,0.1,0.1,0.2,0.1 c0.1,0,0.1,0,0.2-0.1c0.1,0,0.1-0.1,0.1-0.2L11.4,15.9z M2.4,12.9L2.5,14l-0.2,1.1c0,0.1,0,0.1-0.1,0.1c0,0-0.1,0-0.1-0.1L2.1,14 l0.1-1.1C2.2,12.9,2.3,12.9,2.4,12.9C2.3,12.9,2.4,12.9,2.4,12.9z M3.1,12.2L3.3,14l-0.2,1.8c0,0.1,0,0.1-0.1,0.1 c-0.1,0-0.1,0-0.1-0.1L2.8,14L3,12.2C3,12.2,3,12.2,3.1,12.2C3.1,12.2,3.1,12.2,3.1,12.2z M3.9,11.9L4.1,14l-0.2,2.1 c0,0.1,0,0.1-0.1,0.1c-0.1,0-0.1,0-0.1-0.1L3.5,14l0.2-2.1c0-0.1,0-0.1,0.1-0.1C3.9,11.8,3.9,11.8,3.9,11.9z M4.7,11.9L4.9,14 l-0.2,2.1c0,0.1-0.1,0.1-0.1,0.1c-0.1,0-0.1,0-0.1-0.1L4.3,14l0.2-2.2c0-0.1,0-0.1,0.1-0.1C4.7,11.7,4.7,11.8,4.7,11.9z M5.6,12 l0.2,2l-0.2,2.1c0,0.1-0.1,0.1-0.1,0.1c0,0-0.1,0-0.1,0c0,0,0-0.1,0-0.1L5.1,14l0.2-2c0,0,0-0.1,0-0.1s0.1,0,0.1,0 C5.5,11.9,5.5,11.9,5.6,12L5.6,12z M6.4,10.7L6.6,14l-0.2,2.1c0,0,0,0.1,0,0.1c0,0-0.1,0-0.1,0c-0.1,0-0.1-0.1-0.2-0.2L5.9,14 l0.2-3.3c0-0.1,0.1-0.2,0.2-0.2c0,0,0.1,0,0.1,0C6.4,10.7,6.4,10.7,6.4,10.7z M7.2,10l0.2,4.1l-0.2,2.1c0,0,0,0.1,0,0.1 c0,0-0.1,0-0.1,0c-0.1,0-0.2-0.1-0.2-0.2l-0.1-2.1L6.8,10c0-0.1,0.1-0.2,0.2-0.2c0,0,0.1,0,0.1,0S7.2,9.9,7.2,10z M8,9.6L8.2,14 L8,16.1c0,0.1-0.1,0.2-0.2,0.2c-0.1,0-0.2-0.1-0.2-0.2L7.5,14l0.1-4.4c0-0.1,0-0.1,0.1-0.1c0,0,0.1-0.1,0.1-0.1c0.1,0,0.1,0,0.1,0.1 C8,9.6,8,9.6,8,9.6z M11.4,16.1L11.4,16.1L11.4,16.1z M9.7,9.6L9.8,14l-0.1,2.1c0,0.1,0,0.1-0.1,0.2s-0.1,0.1-0.2,0.1 c-0.1,0-0.1,0-0.1-0.1s-0.1-0.1-0.1-0.2L9.2,14l0.1-4.4c0-0.1,0-0.1,0.1-0.2s0.1-0.1,0.2-0.1c0.1,0,0.1,0,0.2,0.1S9.7,9.5,9.7,9.6 L9.7,9.6z M10.6,9.8l0.1,4.3l-0.1,2c0,0.1,0,0.1-0.1,0.2c0,0-0.1,0.1-0.2,0.1c-0.1,0-0.1,0-0.2-0.1c0,0-0.1-0.1-0.1-0.2L10,14 l0.1-4.3c0-0.1,0-0.1,0.1-0.2c0,0,0.1-0.1,0.2-0.1c0.1,0,0.1,0,0.2,0.1S10.6,9.7,10.6,9.8z M12.4,14l-0.1,2c0,0.1,0,0.1-0.1,0.2 c-0.1,0.1-0.1,0.1-0.2,0.1c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2l-0.1-1l-0.1-1l0.1-5.5v0c0-0.1,0-0.2,0.1-0.2 c0.1,0,0.1-0.1,0.2-0.1c0,0,0.1,0,0.1,0c0.1,0,0.1,0.1,0.1,0.2L12.4,14z M22.1,13.9c0,0.7-0.2,1.3-0.7,1.7c-0.5,0.5-1.1,0.7-1.7,0.7 h-6.8c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2V8.2c0-0.1,0.1-0.2,0.2-0.3c0.5-0.2,1-0.3,1.6-0.3c1.1,0,2.1,0.4,2.9,1.1 c0.8,0.8,1.3,1.7,1.4,2.8c0.3-0.1,0.6-0.2,1-0.2c0.7,0,1.3,0.2,1.7,0.7C21.8,12.6,22.1,13.2,22.1,13.9L22.1,13.9z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/spotify.js
/**
* WordPress dependencies
*/
const SpotifyIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12,2C6.477,2,2,6.477,2,12c0,5.523,4.477,10,10,10c5.523,0,10-4.477,10-10C22,6.477,17.523,2,12,2 M16.586,16.424 c-0.18,0.295-0.563,0.387-0.857,0.207c-2.348-1.435-5.304-1.76-8.785-0.964c-0.335,0.077-0.67-0.133-0.746-0.469 c-0.077-0.335,0.132-0.67,0.469-0.746c3.809-0.871,7.077-0.496,9.713,1.115C16.673,15.746,16.766,16.13,16.586,16.424 M17.81,13.7 c-0.226,0.367-0.706,0.482-1.072,0.257c-2.687-1.652-6.785-2.131-9.965-1.166C6.36,12.917,5.925,12.684,5.8,12.273 C5.675,11.86,5.908,11.425,6.32,11.3c3.632-1.102,8.147-0.568,11.234,1.328C17.92,12.854,18.035,13.335,17.81,13.7 M17.915,10.865 c-3.223-1.914-8.54-2.09-11.618-1.156C5.804,9.859,5.281,9.58,5.131,9.086C4.982,8.591,5.26,8.069,5.755,7.919 c3.532-1.072,9.404-0.865,13.115,1.338c0.445,0.264,0.59,0.838,0.327,1.282C18.933,10.983,18.359,11.129,17.915,10.865"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/telegram.js
/**
* WordPress dependencies
*/
const TelegramIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 128 128",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M28.9700376,63.3244248 C47.6273373,55.1957357 60.0684594,49.8368063 66.2934036,47.2476366 C84.0668845,39.855031 87.7600616,38.5708563 90.1672227,38.528 C90.6966555,38.5191258 91.8804274,38.6503351 92.6472251,39.2725385 C93.294694,39.7979149 93.4728387,40.5076237 93.5580865,41.0057381 C93.6433345,41.5038525 93.7494885,42.63857 93.6651041,43.5252052 C92.7019529,53.6451182 88.5344133,78.2034783 86.4142057,89.5379542 C85.5170662,94.3339958 83.750571,95.9420841 82.0403991,96.0994568 C78.3237996,96.4414641 75.5015827,93.6432685 71.9018743,91.2836143 C66.2690414,87.5912212 63.0868492,85.2926952 57.6192095,81.6896017 C51.3004058,77.5256038 55.3966232,75.2369981 58.9976911,71.4967761 C59.9401076,70.5179421 76.3155302,55.6232293 76.6324771,54.2720454 C76.6721165,54.1030573 76.7089039,53.4731496 76.3346867,53.1405352 C75.9604695,52.8079208 75.4081573,52.921662 75.0095933,53.0121213 C74.444641,53.1403447 65.4461175,59.0880351 48.0140228,70.8551922 C45.4598218,72.6091037 43.1463059,73.4636682 41.0734751,73.4188859 C38.7883453,73.3695169 34.3926725,72.1268388 31.1249416,71.0646282 C27.1169366,69.7617838 23.931454,69.0729605 24.208838,66.8603276 C24.3533167,65.7078514 25.9403832,64.5292172 28.9700376,63.3244248 Z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/threads.js
/**
* WordPress dependencies
*/
const ThreadsIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M16.3 11.3c-.1 0-.2-.1-.2-.1-.1-2.6-1.5-4-3.9-4-1.4 0-2.6.6-3.3 1.7l1.3.9c.5-.8 1.4-1 2-1 .8 0 1.4.2 1.7.7.3.3.5.8.5 1.3-.7-.1-1.4-.2-2.2-.1-2.2.1-3.7 1.4-3.6 3.2 0 .9.5 1.7 1.3 2.2.7.4 1.5.6 2.4.6 1.2-.1 2.1-.5 2.7-1.3.5-.6.8-1.4.9-2.4.6.3 1 .8 1.2 1.3.4.9.4 2.4-.8 3.6-1.1 1.1-2.3 1.5-4.3 1.5-2.1 0-3.8-.7-4.8-2S5.7 14.3 5.7 12c0-2.3.5-4.1 1.5-5.4 1.1-1.3 2.7-2 4.8-2 2.2 0 3.8.7 4.9 2 .5.7.9 1.5 1.2 2.5l1.5-.4c-.3-1.2-.8-2.2-1.5-3.1-1.3-1.7-3.3-2.6-6-2.6-2.6 0-4.7.9-6 2.6C4.9 7.2 4.3 9.3 4.3 12s.6 4.8 1.9 6.4c1.4 1.7 3.4 2.6 6 2.6 2.3 0 4-.6 5.3-2 1.8-1.8 1.7-4 1.1-5.4-.4-.9-1.2-1.7-2.3-2.3zm-4 3.8c-1 .1-2-.4-2-1.3 0-.7.5-1.5 2.1-1.6h.5c.6 0 1.1.1 1.6.2-.2 2.3-1.3 2.7-2.2 2.7z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/tiktok.js
/**
* WordPress dependencies
*/
const TiktokIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 32 32",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M16.708 0.027c1.745-0.027 3.48-0.011 5.213-0.027 0.105 2.041 0.839 4.12 2.333 5.563 1.491 1.479 3.6 2.156 5.652 2.385v5.369c-1.923-0.063-3.855-0.463-5.6-1.291-0.76-0.344-1.468-0.787-2.161-1.24-0.009 3.896 0.016 7.787-0.025 11.667-0.104 1.864-0.719 3.719-1.803 5.255-1.744 2.557-4.771 4.224-7.88 4.276-1.907 0.109-3.812-0.411-5.437-1.369-2.693-1.588-4.588-4.495-4.864-7.615-0.032-0.667-0.043-1.333-0.016-1.984 0.24-2.537 1.495-4.964 3.443-6.615 2.208-1.923 5.301-2.839 8.197-2.297 0.027 1.975-0.052 3.948-0.052 5.923-1.323-0.428-2.869-0.308-4.025 0.495-0.844 0.547-1.485 1.385-1.819 2.333-0.276 0.676-0.197 1.427-0.181 2.145 0.317 2.188 2.421 4.027 4.667 3.828 1.489-0.016 2.916-0.88 3.692-2.145 0.251-0.443 0.532-0.896 0.547-1.417 0.131-2.385 0.079-4.76 0.095-7.145 0.011-5.375-0.016-10.735 0.025-16.093z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/tumblr.js
/**
* WordPress dependencies
*/
const TumblrIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.04 21.28h-3.28c-2.84 0-4.94-1.37-4.94-5.02v-5.67H6.08V7.5c2.93-.73 4.11-3.3 4.3-5.48h3.01v4.93h3.47v3.65H13.4v4.93c0 1.47.73 2.01 1.92 2.01h1.73v3.75z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/twitch.js
/**
* WordPress dependencies
*/
const TwitchIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M16.499,8.089h-1.636v4.91h1.636V8.089z M12,8.089h-1.637v4.91H12V8.089z M4.228,3.178L3,6.451v13.092h4.499V22h2.456 l2.454-2.456h3.681L21,14.636V3.178H4.228z M19.364,13.816l-2.864,2.865H12l-2.453,2.453V16.68H5.863V4.814h13.501V13.816z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/twitter.js
/**
* WordPress dependencies
*/
const TwitterIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M22.23,5.924c-0.736,0.326-1.527,0.547-2.357,0.646c0.847-0.508,1.498-1.312,1.804-2.27 c-0.793,0.47-1.671,0.812-2.606,0.996C18.324,4.498,17.257,4,16.077,4c-2.266,0-4.103,1.837-4.103,4.103 c0,0.322,0.036,0.635,0.106,0.935C8.67,8.867,5.647,7.234,3.623,4.751C3.27,5.357,3.067,6.062,3.067,6.814 c0,1.424,0.724,2.679,1.825,3.415c-0.673-0.021-1.305-0.206-1.859-0.513c0,0.017,0,0.034,0,0.052c0,1.988,1.414,3.647,3.292,4.023 c-0.344,0.094-0.707,0.144-1.081,0.144c-0.264,0-0.521-0.026-0.772-0.074c0.522,1.63,2.038,2.816,3.833,2.85 c-1.404,1.1-3.174,1.756-5.096,1.756c-0.331,0-0.658-0.019-0.979-0.057c1.816,1.164,3.973,1.843,6.29,1.843 c7.547,0,11.675-6.252,11.675-11.675c0-0.178-0.004-0.355-0.012-0.531C20.985,7.47,21.68,6.747,22.23,5.924z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/vimeo.js
/**
* WordPress dependencies
*/
const VimeoIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M22.396,7.164c-0.093,2.026-1.507,4.799-4.245,8.32C15.322,19.161,12.928,21,10.97,21c-1.214,0-2.24-1.119-3.079-3.359 c-0.56-2.053-1.119-4.106-1.68-6.159C5.588,9.243,4.921,8.122,4.206,8.122c-0.156,0-0.701,0.328-1.634,0.98L1.594,7.841 c1.027-0.902,2.04-1.805,3.037-2.708C6.001,3.95,7.03,3.327,7.715,3.264c1.619-0.156,2.616,0.951,2.99,3.321 c0.404,2.557,0.685,4.147,0.841,4.769c0.467,2.121,0.981,3.181,1.542,3.181c0.435,0,1.09-0.688,1.963-2.065 c0.871-1.376,1.338-2.422,1.401-3.142c0.125-1.187-0.343-1.782-1.401-1.782c-0.498,0-1.012,0.115-1.541,0.341 c1.023-3.35,2.977-4.977,5.862-4.884C21.511,3.066,22.52,4.453,22.396,7.164z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/vk.js
/**
* WordPress dependencies
*/
const VkIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M22,7.1c0.2,0.4-0.4,1.5-1.6,3.1c-0.2,0.2-0.4,0.5-0.7,0.9c-0.5,0.7-0.9,1.1-0.9,1.4c-0.1,0.3-0.1,0.6,0.1,0.8 c0.1,0.1,0.4,0.4,0.8,0.9h0l0,0c1,0.9,1.6,1.7,2,2.3c0,0,0,0.1,0.1,0.1c0,0.1,0,0.1,0.1,0.3c0,0.1,0,0.2,0,0.4 c0,0.1-0.1,0.2-0.3,0.3c-0.1,0.1-0.4,0.1-0.6,0.1l-2.7,0c-0.2,0-0.4,0-0.6-0.1c-0.2-0.1-0.4-0.1-0.5-0.2l-0.2-0.1 c-0.2-0.1-0.5-0.4-0.7-0.7s-0.5-0.6-0.7-0.8c-0.2-0.2-0.4-0.4-0.6-0.6C14.8,15,14.6,15,14.4,15c0,0,0,0-0.1,0c0,0-0.1,0.1-0.2,0.2 c-0.1,0.1-0.2,0.2-0.2,0.3c-0.1,0.1-0.1,0.3-0.2,0.5c-0.1,0.2-0.1,0.5-0.1,0.8c0,0.1,0,0.2,0,0.3c0,0.1-0.1,0.2-0.1,0.2l0,0.1 c-0.1,0.1-0.3,0.2-0.6,0.2h-1.2c-0.5,0-1,0-1.5-0.2c-0.5-0.1-1-0.3-1.4-0.6s-0.7-0.5-1.1-0.7s-0.6-0.4-0.7-0.6l-0.3-0.3 c-0.1-0.1-0.2-0.2-0.3-0.3s-0.4-0.5-0.7-0.9s-0.7-1-1.1-1.6c-0.4-0.6-0.8-1.3-1.3-2.2C2.9,9.4,2.5,8.5,2.1,7.5C2,7.4,2,7.3,2,7.2 c0-0.1,0-0.1,0-0.2l0-0.1c0.1-0.1,0.3-0.2,0.6-0.2l2.9,0c0.1,0,0.2,0,0.2,0.1S5.9,6.9,5.9,7L6,7c0.1,0.1,0.2,0.2,0.3,0.3 C6.4,7.7,6.5,8,6.7,8.4C6.9,8.8,7,9,7.1,9.2l0.2,0.3c0.2,0.4,0.4,0.8,0.6,1.1c0.2,0.3,0.4,0.5,0.5,0.7s0.3,0.3,0.4,0.4 c0.1,0.1,0.3,0.1,0.4,0.1c0.1,0,0.2,0,0.3-0.1c0,0,0,0,0.1-0.1c0,0,0.1-0.1,0.1-0.2c0.1-0.1,0.1-0.3,0.1-0.5c0-0.2,0.1-0.5,0.1-0.8 c0-0.4,0-0.8,0-1.3c0-0.3,0-0.5-0.1-0.8c0-0.2-0.1-0.4-0.1-0.5L9.6,7.6C9.4,7.3,9.1,7.2,8.7,7.1C8.6,7.1,8.6,7,8.7,6.9 C8.9,6.7,9,6.6,9.1,6.5c0.4-0.2,1.2-0.3,2.5-0.3c0.6,0,1,0.1,1.4,0.1c0.1,0,0.3,0.1,0.3,0.1c0.1,0.1,0.2,0.1,0.2,0.3 c0,0.1,0.1,0.2,0.1,0.3s0,0.3,0,0.5c0,0.2,0,0.4,0,0.6c0,0.2,0,0.4,0,0.7c0,0.3,0,0.6,0,0.9c0,0.1,0,0.2,0,0.4c0,0.2,0,0.4,0,0.5 c0,0.1,0,0.3,0,0.4s0.1,0.3,0.1,0.4c0.1,0.1,0.1,0.2,0.2,0.3c0.1,0,0.1,0,0.2,0c0.1,0,0.2,0,0.3-0.1c0.1-0.1,0.2-0.2,0.4-0.4 s0.3-0.4,0.5-0.7c0.2-0.3,0.5-0.7,0.7-1.1c0.4-0.7,0.8-1.5,1.1-2.3c0-0.1,0.1-0.1,0.1-0.2c0-0.1,0.1-0.1,0.1-0.1l0,0l0.1,0 c0,0,0,0,0.1,0s0.2,0,0.2,0l3,0c0.3,0,0.5,0,0.7,0S21.9,7,21.9,7L22,7.1z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/whatsapp.js
/**
* WordPress dependencies
*/
const WhatsAppIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M 12.011719 2 C 6.5057187 2 2.0234844 6.478375 2.0214844 11.984375 C 2.0204844 13.744375 2.4814687 15.462563 3.3554688 16.976562 L 2 22 L 7.2324219 20.763672 C 8.6914219 21.559672 10.333859 21.977516 12.005859 21.978516 L 12.009766 21.978516 C 17.514766 21.978516 21.995047 17.499141 21.998047 11.994141 C 22.000047 9.3251406 20.962172 6.8157344 19.076172 4.9277344 C 17.190172 3.0407344 14.683719 2.001 12.011719 2 z M 12.009766 4 C 14.145766 4.001 16.153109 4.8337969 17.662109 6.3417969 C 19.171109 7.8517969 20.000047 9.8581875 19.998047 11.992188 C 19.996047 16.396187 16.413812 19.978516 12.007812 19.978516 C 10.674812 19.977516 9.3544062 19.642812 8.1914062 19.007812 L 7.5175781 18.640625 L 6.7734375 18.816406 L 4.8046875 19.28125 L 5.2851562 17.496094 L 5.5019531 16.695312 L 5.0878906 15.976562 C 4.3898906 14.768562 4.0204844 13.387375 4.0214844 11.984375 C 4.0234844 7.582375 7.6067656 4 12.009766 4 z M 8.4765625 7.375 C 8.3095625 7.375 8.0395469 7.4375 7.8105469 7.6875 C 7.5815469 7.9365 6.9355469 8.5395781 6.9355469 9.7675781 C 6.9355469 10.995578 7.8300781 12.182609 7.9550781 12.349609 C 8.0790781 12.515609 9.68175 15.115234 12.21875 16.115234 C 14.32675 16.946234 14.754891 16.782234 15.212891 16.740234 C 15.670891 16.699234 16.690438 16.137687 16.898438 15.554688 C 17.106437 14.971687 17.106922 14.470187 17.044922 14.367188 C 16.982922 14.263188 16.816406 14.201172 16.566406 14.076172 C 16.317406 13.951172 15.090328 13.348625 14.861328 13.265625 C 14.632328 13.182625 14.464828 13.140625 14.298828 13.390625 C 14.132828 13.640625 13.655766 14.201187 13.509766 14.367188 C 13.363766 14.534188 13.21875 14.556641 12.96875 14.431641 C 12.71875 14.305641 11.914938 14.041406 10.960938 13.191406 C 10.218937 12.530406 9.7182656 11.714844 9.5722656 11.464844 C 9.4272656 11.215844 9.5585938 11.079078 9.6835938 10.955078 C 9.7955938 10.843078 9.9316406 10.663578 10.056641 10.517578 C 10.180641 10.371578 10.223641 10.267562 10.306641 10.101562 C 10.389641 9.9355625 10.347156 9.7890625 10.285156 9.6640625 C 10.223156 9.5390625 9.737625 8.3065 9.515625 7.8125 C 9.328625 7.3975 9.131125 7.3878594 8.953125 7.3808594 C 8.808125 7.3748594 8.6425625 7.375 8.4765625 7.375 z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/x.js
/**
* WordPress dependencies
*/
const XIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/yelp.js
/**
* WordPress dependencies
*/
const YelpIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12.271,16.718v1.417q-.011,3.257-.067,3.4a.707.707,0,0,1-.569.446,4.637,4.637,0,0,1-2.024-.424A4.609,4.609,0,0,1,7.8,20.565a.844.844,0,0,1-.19-.4.692.692,0,0,1,.044-.29,3.181,3.181,0,0,1,.379-.524q.335-.412,2.019-2.409.011,0,.669-.781a.757.757,0,0,1,.44-.274.965.965,0,0,1,.552.039.945.945,0,0,1,.418.324.732.732,0,0,1,.139.468Zm-1.662-2.8a.783.783,0,0,1-.58.781l-1.339.435q-3.067.981-3.257.981a.711.711,0,0,1-.6-.4,2.636,2.636,0,0,1-.19-.836,9.134,9.134,0,0,1,.011-1.857,3.559,3.559,0,0,1,.335-1.389.659.659,0,0,1,.625-.357,22.629,22.629,0,0,1,2.253.859q.781.324,1.283.524l.937.379a.771.771,0,0,1,.4.34A.982.982,0,0,1,10.609,13.917Zm9.213,3.313a4.467,4.467,0,0,1-1.021,1.8,4.559,4.559,0,0,1-1.512,1.417.671.671,0,0,1-.7-.078q-.156-.112-2.052-3.2l-.524-.859a.761.761,0,0,1-.128-.513.957.957,0,0,1,.217-.513.774.774,0,0,1,.926-.29q.011.011,1.327.446,2.264.736,2.7.887a2.082,2.082,0,0,1,.524.229.673.673,0,0,1,.245.68Zm-7.5-7.049q.056,1.137-.6,1.361-.647.19-1.272-.792L6.237,4.08a.7.7,0,0,1,.212-.691,5.788,5.788,0,0,1,2.314-1,5.928,5.928,0,0,1,2.5-.352.681.681,0,0,1,.547.5q.034.2.245,3.407T12.327,10.181Zm7.384,1.2a.679.679,0,0,1-.29.658q-.167.112-3.67.959-.747.167-1.015.257l.011-.022a.769.769,0,0,1-.513-.044.914.914,0,0,1-.413-.357.786.786,0,0,1,0-.971q.011-.011.836-1.137,1.394-1.908,1.673-2.275a2.423,2.423,0,0,1,.379-.435A.7.7,0,0,1,17.435,8a4.482,4.482,0,0,1,1.372,1.489,4.81,4.81,0,0,1,.9,1.868v.034Z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/icons/youtube.js
/**
* WordPress dependencies
*/
const YouTubeIcon = () => (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "24",
height: "24",
viewBox: "0 0 24 24",
version: "1.1"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/variations.js
/**
* Internal dependencies
*/
const social_link_variations_variations = [{
isDefault: true,
name: 'wordpress',
attributes: {
service: 'wordpress'
},
title: 'WordPress',
icon: WordPressIcon
}, {
name: 'fivehundredpx',
attributes: {
service: 'fivehundredpx'
},
title: '500px',
icon: FivehundredpxIcon
}, {
name: 'amazon',
attributes: {
service: 'amazon'
},
title: 'Amazon',
icon: AmazonIcon
}, {
name: 'bandcamp',
attributes: {
service: 'bandcamp'
},
title: 'Bandcamp',
icon: BandcampIcon
}, {
name: 'behance',
attributes: {
service: 'behance'
},
title: 'Behance',
icon: BehanceIcon
}, {
name: 'chain',
attributes: {
service: 'chain'
},
title: 'Link',
icon: ChainIcon
}, {
name: 'codepen',
attributes: {
service: 'codepen'
},
title: 'CodePen',
icon: CodepenIcon
}, {
name: 'deviantart',
attributes: {
service: 'deviantart'
},
title: 'DeviantArt',
icon: DeviantArtIcon
}, {
name: 'dribbble',
attributes: {
service: 'dribbble'
},
title: 'Dribbble',
icon: DribbbleIcon
}, {
name: 'dropbox',
attributes: {
service: 'dropbox'
},
title: 'Dropbox',
icon: DropboxIcon
}, {
name: 'etsy',
attributes: {
service: 'etsy'
},
title: 'Etsy',
icon: EtsyIcon
}, {
name: 'facebook',
attributes: {
service: 'facebook'
},
title: 'Facebook',
icon: FacebookIcon
}, {
name: 'feed',
attributes: {
service: 'feed'
},
title: 'RSS Feed',
icon: FeedIcon
}, {
name: 'flickr',
attributes: {
service: 'flickr'
},
title: 'Flickr',
icon: FlickrIcon
}, {
name: 'foursquare',
attributes: {
service: 'foursquare'
},
title: 'Foursquare',
icon: FoursquareIcon
}, {
name: 'goodreads',
attributes: {
service: 'goodreads'
},
title: 'Goodreads',
icon: GoodreadsIcon
}, {
name: 'google',
attributes: {
service: 'google'
},
title: 'Google',
icon: GoogleIcon
}, {
name: 'github',
attributes: {
service: 'github'
},
title: 'GitHub',
icon: GitHubIcon
}, {
name: 'gravatar',
attributes: {
service: 'gravatar'
},
title: 'Gravatar',
icon: GravatarIcon
}, {
name: 'instagram',
attributes: {
service: 'instagram'
},
title: 'Instagram',
icon: InstagramIcon
}, {
name: 'lastfm',
attributes: {
service: 'lastfm'
},
title: 'Last.fm',
icon: LastfmIcon
}, {
name: 'linkedin',
attributes: {
service: 'linkedin'
},
title: 'LinkedIn',
icon: LinkedInIcon
}, {
name: 'mail',
attributes: {
service: 'mail'
},
title: 'Mail',
keywords: ['email', 'e-mail'],
icon: MailIcon
}, {
name: 'mastodon',
attributes: {
service: 'mastodon'
},
title: 'Mastodon',
icon: MastodonIcon
}, {
name: 'meetup',
attributes: {
service: 'meetup'
},
title: 'Meetup',
icon: MeetupIcon
}, {
name: 'medium',
attributes: {
service: 'medium'
},
title: 'Medium',
icon: MediumIcon
}, {
name: 'patreon',
attributes: {
service: 'patreon'
},
title: 'Patreon',
icon: PatreonIcon
}, {
name: 'pinterest',
attributes: {
service: 'pinterest'
},
title: 'Pinterest',
icon: PinterestIcon
}, {
name: 'pocket',
attributes: {
service: 'pocket'
},
title: 'Pocket',
icon: PocketIcon
}, {
name: 'reddit',
attributes: {
service: 'reddit'
},
title: 'Reddit',
icon: RedditIcon
}, {
name: 'skype',
attributes: {
service: 'skype'
},
title: 'Skype',
icon: SkypeIcon
}, {
name: 'snapchat',
attributes: {
service: 'snapchat'
},
title: 'Snapchat',
icon: SnapchatIcon
}, {
name: 'soundcloud',
attributes: {
service: 'soundcloud'
},
title: 'SoundCloud',
icon: SoundCloudIcon
}, {
name: 'spotify',
attributes: {
service: 'spotify'
},
title: 'Spotify',
icon: SpotifyIcon
}, {
name: 'telegram',
attributes: {
service: 'telegram'
},
title: 'Telegram',
icon: TelegramIcon
}, {
name: 'threads',
attributes: {
service: 'threads'
},
title: 'Threads',
icon: ThreadsIcon
}, {
name: 'tiktok',
attributes: {
service: 'tiktok'
},
title: 'TikTok',
icon: TiktokIcon
}, {
name: 'tumblr',
attributes: {
service: 'tumblr'
},
title: 'Tumblr',
icon: TumblrIcon
}, {
name: 'twitch',
attributes: {
service: 'twitch'
},
title: 'Twitch',
icon: TwitchIcon
}, {
name: 'twitter',
attributes: {
service: 'twitter'
},
title: 'Twitter',
icon: TwitterIcon
}, {
name: 'vimeo',
attributes: {
service: 'vimeo'
},
title: 'Vimeo',
icon: VimeoIcon
}, {
name: 'vk',
attributes: {
service: 'vk'
},
title: 'VK',
icon: VkIcon
}, {
name: 'whatsapp',
attributes: {
service: 'whatsapp'
},
title: 'WhatsApp',
icon: WhatsAppIcon
}, {
name: 'x',
attributes: {
service: 'x'
},
keywords: ['twitter'],
title: 'X',
icon: XIcon
}, {
name: 'yelp',
attributes: {
service: 'yelp'
},
title: 'Yelp',
icon: YelpIcon
}, {
name: 'youtube',
attributes: {
service: 'youtube'
},
title: 'YouTube',
icon: YouTubeIcon
}];
/**
* Add `isActive` function to all `social link` variations, if not defined.
* `isActive` function is used to find a variation match from a created
* Block by providing its attributes.
*/
social_link_variations_variations.forEach(variation => {
if (variation.isActive) return;
variation.isActive = (blockAttributes, variationAttributes) => blockAttributes.service === variationAttributes.service;
});
/* harmony default export */ const social_link_variations = (social_link_variations_variations);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/social-list.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Retrieves the social service's icon component.
*
* @param {string} name key for a social service (lowercase slug)
*
* @return {Component} Icon component for social service.
*/
const getIconBySite = name => {
const variation = social_link_variations.find(v => v.name === name);
return variation ? variation.icon : ChainIcon;
};
/**
* Retrieves the display name for the social service.
*
* @param {string} name key for a social service (lowercase slug)
*
* @return {string} Display name for social service
*/
const getNameBySite = name => {
const variation = social_link_variations.find(v => v.name === name);
return variation ? variation.title : (0,external_wp_i18n_namespaceObject.__)('Social Icon');
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const SocialLinkURLPopover = ({
url,
setAttributes,
setPopover,
popoverAnchor,
clientId
}) => {
const {
removeBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.URLPopover, {
anchor: popoverAnchor,
onClose: () => setPopover(false)
}, (0,external_React_namespaceObject.createElement)("form", {
className: "block-editor-url-popover__link-editor",
onSubmit: event => {
event.preventDefault();
setPopover(false);
}
}, (0,external_React_namespaceObject.createElement)("div", {
className: "block-editor-url-input"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.URLInput, {
__nextHasNoMarginBottom: true,
value: url,
onChange: nextURL => setAttributes({
url: nextURL
}),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Enter address'),
disableSuggestions: true,
onKeyDown: event => {
if (!!url || event.defaultPrevented || ![external_wp_keycodes_namespaceObject.BACKSPACE, external_wp_keycodes_namespaceObject.DELETE].includes(event.keyCode)) {
return;
}
removeBlock(clientId);
}
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
icon: keyboard_return,
label: (0,external_wp_i18n_namespaceObject.__)('Apply'),
type: "submit"
})));
};
const SocialLinkEdit = ({
attributes,
context,
isSelected,
setAttributes,
clientId
}) => {
const {
url,
service,
label,
rel
} = attributes;
const {
showLabels,
iconColor,
iconColorValue,
iconBackgroundColor,
iconBackgroundColorValue
} = context;
const [showURLPopover, setPopover] = (0,external_wp_element_namespaceObject.useState)(false);
const classes = classnames_default()('wp-social-link', 'wp-social-link-' + service, {
'wp-social-link__is-incomplete': !url,
[`has-${iconColor}-color`]: iconColor,
[`has-${iconBackgroundColor}-background-color`]: iconBackgroundColor
});
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
const IconComponent = getIconBySite(service);
const socialLinkName = getNameBySite(service);
const socialLinkLabel = label !== null && label !== void 0 ? label : socialLinkName;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classes,
style: {
color: iconColorValue,
backgroundColor: iconBackgroundColorValue
}
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: name of the social service. */
(0,external_wp_i18n_namespaceObject.__)('%s label'), socialLinkName),
initialOpen: false
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link label'),
help: (0,external_wp_i18n_namespaceObject.__)('Briefly describe the link to help screen reader users.'),
value: label || '',
onChange: value => setAttributes({
label: value
})
})))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Link rel'),
value: rel || '',
onChange: value => setAttributes({
rel: value
})
})), (0,external_React_namespaceObject.createElement)("li", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
className: "wp-block-social-link-anchor",
ref: setPopoverAnchor,
onClick: () => setPopover(true)
}, (0,external_React_namespaceObject.createElement)(IconComponent, null), (0,external_React_namespaceObject.createElement)("span", {
className: classnames_default()('wp-block-social-link-label', {
'screen-reader-text': !showLabels
})
}, socialLinkLabel), isSelected && showURLPopover && (0,external_React_namespaceObject.createElement)(SocialLinkURLPopover, {
url: url,
setAttributes: setAttributes,
setPopover: setPopover,
popoverAnchor: popoverAnchor,
clientId: clientId
}))));
};
/* harmony default export */ const social_link_edit = (SocialLinkEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-link/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const social_link_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/social-link",
title: "Social Icon",
category: "widgets",
parent: ["core/social-links"],
description: "Display an icon linking to a social media profile or site.",
textdomain: "default",
attributes: {
url: {
type: "string"
},
service: {
type: "string"
},
label: {
type: "string"
},
rel: {
type: "string"
}
},
usesContext: ["openInNewTab", "showLabels", "iconColor", "iconColorValue", "iconBackgroundColor", "iconBackgroundColorValue"],
supports: {
reusable: false,
html: false,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-social-link-editor"
};
const {
name: social_link_name
} = social_link_metadata;
const social_link_settings = {
icon: library_share,
edit: social_link_edit,
variations: social_link_variations
};
const social_link_init = () => initBlock({
name: social_link_name,
metadata: social_link_metadata,
settings: social_link_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-links/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* The specific handling by `className` below is needed because `itemsJustification`
* was introduced in https://github.com/WordPress/gutenberg/pull/28980/files and wasn't
* declared in block.json.
*
* @param {Object} attributes Block's attributes.
*/
const social_links_deprecated_migrateWithLayout = attributes => {
if (!!attributes.layout) {
return attributes;
}
const {
className
} = attributes;
// Matches classes with `items-justified-` prefix.
const prefix = `items-justified-`;
const justifiedItemsRegex = new RegExp(`\\b${prefix}[^ ]*[ ]?\\b`, 'g');
const newAttributes = {
...attributes,
className: className?.replace(justifiedItemsRegex, '').trim()
};
/**
* Add `layout` prop only if `justifyContent` is defined, for backwards
* compatibility. In other cases the block's default layout will be used.
* Also noting that due to the missing attribute, it's possible for a block
* to have more than one of `justified` classes.
*/
const justifyContent = className?.match(justifiedItemsRegex)?.[0]?.trim();
if (justifyContent) {
Object.assign(newAttributes, {
layout: {
type: 'flex',
justifyContent: justifyContent.slice(prefix.length)
}
});
}
return newAttributes;
};
// Social Links block deprecations.
const social_links_deprecated_deprecated = [
// V1. Remove CSS variable use for colors.
{
attributes: {
iconColor: {
type: 'string'
},
customIconColor: {
type: 'string'
},
iconColorValue: {
type: 'string'
},
iconBackgroundColor: {
type: 'string'
},
customIconBackgroundColor: {
type: 'string'
},
iconBackgroundColorValue: {
type: 'string'
},
openInNewTab: {
type: 'boolean',
default: false
},
size: {
type: 'string'
}
},
providesContext: {
openInNewTab: 'openInNewTab'
},
supports: {
align: ['left', 'center', 'right'],
anchor: true
},
migrate: social_links_deprecated_migrateWithLayout,
save: props => {
const {
attributes: {
iconBackgroundColorValue,
iconColorValue,
itemsJustification,
size
}
} = props;
const className = classnames_default()(size, {
'has-icon-color': iconColorValue,
'has-icon-background-color': iconBackgroundColorValue,
[`items-justified-${itemsJustification}`]: itemsJustification
});
const style = {
'--wp--social-links--icon-color': iconColorValue,
'--wp--social-links--icon-background-color': iconBackgroundColorValue
};
return (0,external_React_namespaceObject.createElement)("ul", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className,
style
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
}
}];
/* harmony default export */ const social_links_deprecated = (social_links_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
/**
* WordPress dependencies
*/
const check = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_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 */ const library_check = (check);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-links/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const sizeOptions = [{
name: (0,external_wp_i18n_namespaceObject.__)('Small'),
value: 'has-small-icon-size'
}, {
name: (0,external_wp_i18n_namespaceObject.__)('Normal'),
value: 'has-normal-icon-size'
}, {
name: (0,external_wp_i18n_namespaceObject.__)('Large'),
value: 'has-large-icon-size'
}, {
name: (0,external_wp_i18n_namespaceObject.__)('Huge'),
value: 'has-huge-icon-size'
}];
function SocialLinksEdit(props) {
var _attributes$layout$or;
const {
clientId,
attributes,
iconBackgroundColor,
iconColor,
isSelected,
setAttributes,
setIconBackgroundColor,
setIconColor
} = props;
const {
iconBackgroundColorValue,
customIconBackgroundColor,
iconColorValue,
openInNewTab,
showLabels,
size
} = attributes;
const logosOnly = attributes.className?.includes('is-style-logos-only');
// Remove icon background color when logos only style is selected or
// restore it when any other style is selected.
const backgroundBackup = (0,external_wp_element_namespaceObject.useRef)({});
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (logosOnly) {
backgroundBackup.current = {
iconBackgroundColor,
iconBackgroundColorValue,
customIconBackgroundColor
};
setAttributes({
iconBackgroundColor: undefined,
customIconBackgroundColor: undefined,
iconBackgroundColorValue: undefined
});
} else {
setAttributes({
...backgroundBackup.current
});
}
}, [logosOnly]);
const SocialPlaceholder = (0,external_React_namespaceObject.createElement)("li", {
className: "wp-block-social-links__social-placeholder"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-social-links__social-placeholder-icons"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-social-link wp-social-link-twitter"
}), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-social-link wp-social-link-facebook"
}), (0,external_React_namespaceObject.createElement)("div", {
className: "wp-social-link wp-social-link-instagram"
})));
const SelectedSocialPlaceholder = (0,external_React_namespaceObject.createElement)("li", {
className: "wp-block-social-links__social-prompt"
}, (0,external_wp_i18n_namespaceObject.__)('Click plus to add'));
// Fallback color values are used maintain selections in case switching
// themes and named colors in palette do not match.
const className = classnames_default()(size, {
'has-visible-labels': showLabels,
'has-icon-color': iconColor.color || iconColorValue,
'has-icon-background-color': iconBackgroundColor.color || iconBackgroundColorValue
});
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className
});
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
placeholder: isSelected ? SelectedSocialPlaceholder : SocialPlaceholder,
templateLock: false,
orientation: (_attributes$layout$or = attributes.layout?.orientation) !== null && _attributes$layout$or !== void 0 ? _attributes$layout$or : 'horizontal',
__experimentalAppenderTagName: 'li'
});
const POPOVER_PROPS = {
position: 'bottom right'
};
const colorSettings = [{
// Use custom attribute as fallback to prevent loss of named color selection when
// switching themes to a new theme that does not have a matching named color.
value: iconColor.color || iconColorValue,
onChange: colorValue => {
setIconColor(colorValue);
setAttributes({
iconColorValue: colorValue
});
},
label: (0,external_wp_i18n_namespaceObject.__)('Icon color'),
resetAllFilter: () => {
setIconColor(undefined);
setAttributes({
iconColorValue: undefined
});
}
}];
if (!logosOnly) {
colorSettings.push({
// Use custom attribute as fallback to prevent loss of named color selection when
// switching themes to a new theme that does not have a matching named color.
value: iconBackgroundColor.color || iconBackgroundColorValue,
onChange: colorValue => {
setIconBackgroundColor(colorValue);
setAttributes({
iconBackgroundColorValue: colorValue
});
},
label: (0,external_wp_i18n_namespaceObject.__)('Icon background'),
resetAllFilter: () => {
setIconBackgroundColor(undefined);
setAttributes({
iconBackgroundColorValue: undefined
});
}
});
}
const colorGradientSettings = (0,external_wp_blockEditor_namespaceObject.__experimentalUseMultipleOriginColorsAndGradients)();
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarDropdownMenu, {
label: (0,external_wp_i18n_namespaceObject.__)('Size'),
text: (0,external_wp_i18n_namespaceObject.__)('Size'),
icon: null,
popoverProps: POPOVER_PROPS
}, ({
onClose
}) => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, sizeOptions.map(entry => {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
icon: (size === entry.value || !size && entry.value === 'has-normal-icon-size') && library_check,
isSelected: size === entry.value,
key: entry.value,
onClick: () => {
setAttributes({
size: entry.value
});
},
onClose: onClose,
role: "menuitemradio"
}, entry.name);
})))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Open links in new tab'),
checked: openInNewTab,
onChange: () => setAttributes({
openInNewTab: !openInNewTab
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show labels'),
checked: showLabels,
onChange: () => setAttributes({
showLabels: !showLabels
})
}))), colorGradientSettings.hasColorsOrGradients && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "color"
}, colorSettings.map(({
onChange,
label,
value,
resetAllFilter
}) => (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientSettingsDropdown, {
key: `social-links-color-${label}`,
__experimentalIsRenderedInSidebar: true,
settings: [{
colorValue: value,
label,
onColorChange: onChange,
isShownByDefault: true,
resetAllFilter,
enableAlpha: true
}],
panelId: clientId,
...colorGradientSettings
})), !logosOnly && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ContrastChecker, {
textColor: iconColorValue,
backgroundColor: iconBackgroundColorValue,
isLargeText: false
})), (0,external_React_namespaceObject.createElement)("ul", {
...innerBlocksProps
}));
}
const iconColorAttributes = {
iconColor: 'icon-color',
iconBackgroundColor: 'icon-background-color'
};
/* harmony default export */ const social_links_edit = ((0,external_wp_blockEditor_namespaceObject.withColors)(iconColorAttributes)(SocialLinksEdit));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-links/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function social_links_save_save(props) {
const {
attributes: {
iconBackgroundColorValue,
iconColorValue,
showLabels,
size
}
} = props;
const className = classnames_default()(size, {
'has-visible-labels': showLabels,
'has-icon-color': iconColorValue,
'has-icon-background-color': iconBackgroundColorValue
});
const blockProps = external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
});
const innerBlocksProps = external_wp_blockEditor_namespaceObject.useInnerBlocksProps.save(blockProps);
return (0,external_React_namespaceObject.createElement)("ul", {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/social-links/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const social_links_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/social-links",
title: "Social Icons",
category: "widgets",
allowedBlocks: ["core/social-link"],
description: "Display icons linking to your social media profiles or sites.",
keywords: ["links"],
textdomain: "default",
attributes: {
iconColor: {
type: "string"
},
customIconColor: {
type: "string"
},
iconColorValue: {
type: "string"
},
iconBackgroundColor: {
type: "string"
},
customIconBackgroundColor: {
type: "string"
},
iconBackgroundColorValue: {
type: "string"
},
openInNewTab: {
type: "boolean",
"default": false
},
showLabels: {
type: "boolean",
"default": false
},
size: {
type: "string"
}
},
providesContext: {
openInNewTab: "openInNewTab",
showLabels: "showLabels",
iconColor: "iconColor",
iconColorValue: "iconColorValue",
iconBackgroundColor: "iconBackgroundColor",
iconBackgroundColorValue: "iconBackgroundColorValue"
},
supports: {
align: ["left", "center", "right"],
anchor: true,
__experimentalExposeControlsToChildren: true,
layout: {
allowSwitching: false,
allowInheriting: false,
allowVerticalAlignment: false,
"default": {
type: "flex"
}
},
color: {
enableContrastChecker: false,
background: true,
gradients: true,
text: false,
__experimentalDefaultControls: {
background: false
}
},
spacing: {
blockGap: ["horizontal", "vertical"],
margin: true,
padding: true,
units: ["px", "em", "rem", "vh", "vw"],
__experimentalDefaultControls: {
blockGap: true,
margin: true,
padding: false
}
},
interactivity: {
clientNavigation: true
}
},
styles: [{
name: "default",
label: "Default",
isDefault: true
}, {
name: "logos-only",
label: "Logos Only"
}, {
name: "pill-shape",
label: "Pill Shape"
}],
editorStyle: "wp-block-social-links-editor",
style: "wp-block-social-links"
};
const {
name: social_links_name
} = social_links_metadata;
const social_links_settings = {
example: {
innerBlocks: [{
name: 'core/social-link',
attributes: {
service: 'wordpress',
url: 'https://wordpress.org'
}
}, {
name: 'core/social-link',
attributes: {
service: 'facebook',
url: 'https://www.facebook.com/WordPress/'
}
}, {
name: 'core/social-link',
attributes: {
service: 'twitter',
url: 'https://twitter.com/WordPress'
}
}]
},
icon: library_share,
edit: social_links_edit,
save: social_links_save_save,
deprecated: social_links_deprecated
};
const social_links_init = () => initBlock({
name: social_links_name,
metadata: social_links_metadata,
settings: social_links_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/resize-corner-n-e.js
/**
* WordPress dependencies
*/
const resizeCornerNE = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M7 18h4.5v1.5h-7v-7H6V17L17 6h-4.5V4.5h7v7H18V7L7 18Z"
}));
/* harmony default export */ const resize_corner_n_e = (resizeCornerNE);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/spacer/deprecated.js
/**
* WordPress dependencies
*/
const spacer_deprecated_deprecated = [{
attributes: {
height: {
type: 'number',
default: 100
},
width: {
type: 'number'
}
},
migrate(attributes) {
const {
height,
width
} = attributes;
return {
...attributes,
width: width !== undefined ? `${width}px` : undefined,
height: height !== undefined ? `${height}px` : undefined
};
},
save({
attributes
}) {
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
style: {
height: attributes.height,
width: attributes.width
},
'aria-hidden': true
})
});
}
}];
/* harmony default export */ const spacer_deprecated = (spacer_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/spacer/constants.js
const MIN_SPACER_SIZE = 0;
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/spacer/controls.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function DimensionInput({
label,
onChange,
isResizing,
value = ''
}) {
const inputId = (0,external_wp_compose_namespaceObject.useInstanceId)(external_wp_components_namespaceObject.__experimentalUnitControl, 'block-spacer-height-input');
const [spacingSizes, spacingUnits] = (0,external_wp_blockEditor_namespaceObject.useSettings)('spacing.spacingSizes', 'spacing.units');
// In most contexts the spacer size cannot meaningfully be set to a
// percentage, since this is relative to the parent container. This
// unit is disabled from the UI.
const availableUnits = spacingUnits ? spacingUnits.filter(unit => unit !== '%') : ['px', 'em', 'rem', 'vw', 'vh'];
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits,
defaultValues: {
px: 100,
em: 10,
rem: 10,
vw: 10,
vh: 25
}
});
const handleOnChange = unprocessedValue => {
onChange(unprocessedValue.all);
};
// Force the unit to update to `px` when the Spacer is being resized.
const [parsedQuantity, parsedUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(value);
const computedValue = (0,external_wp_blockEditor_namespaceObject.isValueSpacingPreset)(value) ? value : [parsedQuantity, isResizing ? 'px' : parsedUnit].join('');
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (!spacingSizes || spacingSizes?.length === 0) && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, {
label: label,
id: inputId
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
id: inputId,
isResetValueOnUnitChange: true,
min: MIN_SPACER_SIZE,
onChange: handleOnChange,
style: {
maxWidth: 80
},
value: computedValue,
units: units
})), spacingSizes?.length > 0 && (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.View, {
className: "tools-panel-item-spacing"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalSpacingSizesControl, {
values: {
all: computedValue
},
onChange: handleOnChange,
label: label,
sides: ['all'],
units: units,
allowReset: false,
splitOnAxis: false,
showSideInLabel: false
})));
}
function SpacerControls({
setAttributes,
orientation,
height,
width,
isResizing
}) {
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, orientation === 'horizontal' && (0,external_React_namespaceObject.createElement)(DimensionInput, {
label: (0,external_wp_i18n_namespaceObject.__)('Width'),
value: width,
onChange: nextWidth => setAttributes({
width: nextWidth
}),
isResizing: isResizing
}), orientation !== 'horizontal' && (0,external_React_namespaceObject.createElement)(DimensionInput, {
label: (0,external_wp_i18n_namespaceObject.__)('Height'),
value: height,
onChange: nextHeight => setAttributes({
height: nextHeight
}),
isResizing: isResizing
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/spacer/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ResizableSpacer = ({
orientation,
onResizeStart,
onResize,
onResizeStop,
isSelected,
isResizing,
setIsResizing,
...props
}) => {
const getCurrentSize = elt => {
return orientation === 'horizontal' ? elt.clientWidth : elt.clientHeight;
};
const getNextVal = elt => {
return `${getCurrentSize(elt)}px`;
};
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ResizableBox, {
className: classnames_default()('block-library-spacer__resize-container', {
'resize-horizontal': orientation === 'horizontal',
'is-resizing': isResizing,
'is-selected': isSelected
}),
onResizeStart: (_event, _direction, elt) => {
const nextVal = getNextVal(elt);
onResizeStart(nextVal);
onResize(nextVal);
},
onResize: (_event, _direction, elt) => {
onResize(getNextVal(elt));
if (!isResizing) {
setIsResizing(true);
}
},
onResizeStop: (_event, _direction, elt) => {
const nextVal = getCurrentSize(elt);
onResizeStop(`${nextVal}px`);
setIsResizing(false);
},
__experimentalShowTooltip: true,
__experimentalTooltipProps: {
axis: orientation === 'horizontal' ? 'x' : 'y',
position: 'corner',
isVisible: isResizing
},
showHandle: isSelected,
...props
});
};
const SpacerEdit = ({
attributes,
isSelected,
setAttributes,
toggleSelection,
context,
__unstableParentLayout: parentLayout,
className
}) => {
const disableCustomSpacingSizes = (0,external_wp_data_namespaceObject.useSelect)(select => {
const editorSettings = select(external_wp_blockEditor_namespaceObject.store).getSettings();
return editorSettings?.disableCustomSpacingSizes;
});
const {
orientation
} = context;
const {
orientation: parentOrientation,
type,
default: {
type: defaultType
} = {}
} = parentLayout || {};
// Check if the spacer is inside a flex container.
const isFlexLayout = type === 'flex' || !type && defaultType === 'flex';
// If the spacer is inside a flex container, it should either inherit the orientation
// of the parent or use the flex default orientation.
const inheritedOrientation = !parentOrientation && isFlexLayout ? 'horizontal' : parentOrientation || orientation;
const {
height,
width,
style: blockStyle = {}
} = attributes;
const {
layout = {}
} = blockStyle;
const {
selfStretch,
flexSize
} = layout;
const [spacingSizes] = (0,external_wp_blockEditor_namespaceObject.useSettings)('spacing.spacingSizes');
const [isResizing, setIsResizing] = (0,external_wp_element_namespaceObject.useState)(false);
const [temporaryHeight, setTemporaryHeight] = (0,external_wp_element_namespaceObject.useState)(null);
const [temporaryWidth, setTemporaryWidth] = (0,external_wp_element_namespaceObject.useState)(null);
const onResizeStart = () => toggleSelection(false);
const onResizeStop = () => toggleSelection(true);
const handleOnVerticalResizeStop = newHeight => {
onResizeStop();
if (isFlexLayout) {
setAttributes({
style: {
...blockStyle,
layout: {
...layout,
flexSize: newHeight,
selfStretch: 'fixed'
}
}
});
}
setAttributes({
height: newHeight
});
setTemporaryHeight(null);
};
const handleOnHorizontalResizeStop = newWidth => {
onResizeStop();
if (isFlexLayout) {
setAttributes({
style: {
...blockStyle,
layout: {
...layout,
flexSize: newWidth,
selfStretch: 'fixed'
}
}
});
}
setAttributes({
width: newWidth
});
setTemporaryWidth(null);
};
const getHeightForVerticalBlocks = () => {
if (isFlexLayout) {
return undefined;
}
return temporaryHeight || (0,external_wp_blockEditor_namespaceObject.getSpacingPresetCssVar)(height) || undefined;
};
const getWidthForHorizontalBlocks = () => {
if (isFlexLayout) {
return undefined;
}
return temporaryWidth || (0,external_wp_blockEditor_namespaceObject.getSpacingPresetCssVar)(width) || undefined;
};
const sizeConditionalOnOrientation = inheritedOrientation === 'horizontal' ? temporaryWidth || flexSize : temporaryHeight || flexSize;
const style = {
height: inheritedOrientation === 'horizontal' ? 24 : getHeightForVerticalBlocks(),
width: inheritedOrientation === 'horizontal' ? getWidthForHorizontalBlocks() : undefined,
// In vertical flex containers, the spacer shrinks to nothing without a minimum width.
minWidth: inheritedOrientation === 'vertical' && isFlexLayout ? 48 : undefined,
// Add flex-basis so temporary sizes are respected.
flexBasis: isFlexLayout ? sizeConditionalOnOrientation : undefined,
// Remove flex-grow when resizing.
flexGrow: isFlexLayout && isResizing ? 0 : undefined
};
const resizableBoxWithOrientation = blockOrientation => {
if (blockOrientation === 'horizontal') {
return (0,external_React_namespaceObject.createElement)(ResizableSpacer, {
minWidth: MIN_SPACER_SIZE,
enable: {
top: false,
right: true,
bottom: false,
left: false,
topRight: false,
bottomRight: false,
bottomLeft: false,
topLeft: false
},
orientation: blockOrientation,
onResizeStart: onResizeStart,
onResize: setTemporaryWidth,
onResizeStop: handleOnHorizontalResizeStop,
isSelected: isSelected,
isResizing: isResizing,
setIsResizing: setIsResizing
});
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(ResizableSpacer, {
minHeight: MIN_SPACER_SIZE,
enable: {
top: false,
right: false,
bottom: true,
left: false,
topRight: false,
bottomRight: false,
bottomLeft: false,
topLeft: false
},
orientation: blockOrientation,
onResizeStart: onResizeStart,
onResize: setTemporaryHeight,
onResizeStop: handleOnVerticalResizeStop,
isSelected: isSelected,
isResizing: isResizing,
setIsResizing: setIsResizing
}));
};
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (isFlexLayout && selfStretch !== 'fill' && selfStretch !== 'fit' && !flexSize) {
if (inheritedOrientation === 'horizontal') {
// If spacer is moving from a vertical container to a horizontal container,
// it might not have width but have height instead.
const newSize = (0,external_wp_blockEditor_namespaceObject.getCustomValueFromPreset)(width, spacingSizes) || (0,external_wp_blockEditor_namespaceObject.getCustomValueFromPreset)(height, spacingSizes) || '100px';
setAttributes({
width: '0px',
style: {
...blockStyle,
layout: {
...layout,
flexSize: newSize,
selfStretch: 'fixed'
}
}
});
} else {
const newSize = (0,external_wp_blockEditor_namespaceObject.getCustomValueFromPreset)(height, spacingSizes) || (0,external_wp_blockEditor_namespaceObject.getCustomValueFromPreset)(width, spacingSizes) || '100px';
setAttributes({
height: '0px',
style: {
...blockStyle,
layout: {
...layout,
flexSize: newSize,
selfStretch: 'fixed'
}
}
});
}
} else if (isFlexLayout && (selfStretch === 'fill' || selfStretch === 'fit')) {
if (inheritedOrientation === 'horizontal') {
setAttributes({
width: undefined
});
} else {
setAttributes({
height: undefined
});
}
} else if (!isFlexLayout && (selfStretch || flexSize)) {
if (inheritedOrientation === 'horizontal') {
setAttributes({
width: flexSize
});
} else {
setAttributes({
height: flexSize
});
}
setAttributes({
style: {
...blockStyle,
layout: {
...layout,
flexSize: undefined,
selfStretch: undefined
}
}
});
}
}, [blockStyle, flexSize, height, inheritedOrientation, isFlexLayout, layout, selfStretch, setAttributes, spacingSizes, width]);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.View, {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({
style,
className: classnames_default()(className, {
'custom-sizes-disabled': disableCustomSpacingSizes
})
})
}, resizableBoxWithOrientation(inheritedOrientation)), !isFlexLayout && (0,external_React_namespaceObject.createElement)(SpacerControls, {
setAttributes: setAttributes,
height: temporaryHeight || height,
width: temporaryWidth || width,
orientation: inheritedOrientation,
isResizing: isResizing
}));
};
/* harmony default export */ const spacer_edit = (SpacerEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/spacer/save.js
/**
* WordPress dependencies
*/
function spacer_save_save({
attributes
}) {
const {
height,
width,
style
} = attributes;
const {
layout: {
selfStretch
} = {}
} = style || {};
// If selfStretch is set to 'fill' or 'fit', don't set default height.
const finalHeight = selfStretch === 'fill' || selfStretch === 'fit' ? undefined : height;
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
style: {
height: (0,external_wp_blockEditor_namespaceObject.getSpacingPresetCssVar)(finalHeight),
width: (0,external_wp_blockEditor_namespaceObject.getSpacingPresetCssVar)(width)
},
'aria-hidden': true
})
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/spacer/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const spacer_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/spacer",
title: "Spacer",
category: "design",
description: "Add white space between blocks and customize its height.",
textdomain: "default",
attributes: {
height: {
type: "string",
"default": "100px"
},
width: {
type: "string"
}
},
usesContext: ["orientation"],
supports: {
anchor: true,
spacing: {
margin: ["top", "bottom"],
__experimentalDefaultControls: {
margin: true
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-spacer-editor",
style: "wp-block-spacer"
};
const {
name: spacer_name
} = spacer_metadata;
const spacer_settings = {
icon: resize_corner_n_e,
edit: spacer_edit,
save: spacer_save_save,
deprecated: spacer_deprecated
};
const spacer_init = () => initBlock({
name: spacer_name,
metadata: spacer_metadata,
settings: spacer_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-table.js
/**
* WordPress dependencies
*/
const blockTable = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_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-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z"
}));
/* harmony default export */ const block_table = (blockTable);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/table/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
// As the previous arbitrary colors won't match theme color palettes, the hex
// value will be mapped to the style.color.background attribute as if it was
// a custom color selection.
const oldColors = {
'subtle-light-gray': '#f3f4f5',
'subtle-pale-green': '#e9fbe5',
'subtle-pale-blue': '#e7f5fe',
'subtle-pale-pink': '#fcf0ef'
};
// In #41140 support was added to global styles for caption elements which
// added a `wp-element-caption` classname to the embed figcaption element.
const table_deprecated_v3 = {
attributes: {
hasFixedLayout: {
type: 'boolean',
default: false
},
caption: {
type: 'string',
source: 'html',
selector: 'figcaption',
default: ''
},
head: {
type: 'array',
default: [],
source: 'query',
selector: 'thead tr',
query: {
cells: {
type: 'array',
default: [],
source: 'query',
selector: 'td,th',
query: {
content: {
type: 'string',
source: 'html'
},
tag: {
type: 'string',
default: 'td',
source: 'tag'
},
scope: {
type: 'string',
source: 'attribute',
attribute: 'scope'
},
align: {
type: 'string',
source: 'attribute',
attribute: 'data-align'
}
}
}
}
},
body: {
type: 'array',
default: [],
source: 'query',
selector: 'tbody tr',
query: {
cells: {
type: 'array',
default: [],
source: 'query',
selector: 'td,th',
query: {
content: {
type: 'string',
source: 'html'
},
tag: {
type: 'string',
default: 'td',
source: 'tag'
},
scope: {
type: 'string',
source: 'attribute',
attribute: 'scope'
},
align: {
type: 'string',
source: 'attribute',
attribute: 'data-align'
}
}
}
}
},
foot: {
type: 'array',
default: [],
source: 'query',
selector: 'tfoot tr',
query: {
cells: {
type: 'array',
default: [],
source: 'query',
selector: 'td,th',
query: {
content: {
type: 'string',
source: 'html'
},
tag: {
type: 'string',
default: 'td',
source: 'tag'
},
scope: {
type: 'string',
source: 'attribute',
attribute: 'scope'
},
align: {
type: 'string',
source: 'attribute',
attribute: 'data-align'
}
}
}
}
}
},
supports: {
anchor: true,
align: true,
color: {
__experimentalSkipSerialization: true,
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalDefaultControls: {
fontSize: true
}
},
__experimentalBorder: {
__experimentalSkipSerialization: true,
color: true,
style: true,
width: true,
__experimentalDefaultControls: {
color: true,
style: true,
width: true
}
},
__experimentalSelector: '.wp-block-table > table'
},
save({
attributes
}) {
const {
hasFixedLayout,
head,
body,
foot,
caption
} = attributes;
const isEmpty = !head.length && !body.length && !foot.length;
if (isEmpty) {
return null;
}
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetColorClassesAndStyles)(attributes);
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes);
const classes = classnames_default()(colorProps.className, borderProps.className, {
'has-fixed-layout': hasFixedLayout
});
const hasCaption = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption);
const Section = ({
type,
rows
}) => {
if (!rows.length) {
return null;
}
const Tag = `t${type}`;
return (0,external_React_namespaceObject.createElement)(Tag, null, rows.map(({
cells
}, rowIndex) => (0,external_React_namespaceObject.createElement)("tr", {
key: rowIndex
}, cells.map(({
content,
tag,
scope,
align
}, cellIndex) => {
const cellClasses = classnames_default()({
[`has-text-align-${align}`]: align
});
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
className: cellClasses ? cellClasses : undefined,
"data-align": align,
tagName: tag,
value: content,
key: cellIndex,
scope: tag === 'th' ? scope : undefined
});
}))));
};
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, (0,external_React_namespaceObject.createElement)("table", {
className: classes === '' ? undefined : classes,
style: {
...colorProps.style,
...borderProps.style
}
}, (0,external_React_namespaceObject.createElement)(Section, {
type: "head",
rows: head
}), (0,external_React_namespaceObject.createElement)(Section, {
type: "body",
rows: body
}), (0,external_React_namespaceObject.createElement)(Section, {
type: "foot",
rows: foot
})), hasCaption && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: caption
}));
}
};
// Deprecation migrating table block to use colors block support feature.
const table_deprecated_v2 = {
attributes: {
hasFixedLayout: {
type: 'boolean',
default: false
},
backgroundColor: {
type: 'string'
},
caption: {
type: 'string',
source: 'html',
selector: 'figcaption',
default: ''
},
head: {
type: 'array',
default: [],
source: 'query',
selector: 'thead tr',
query: {
cells: {
type: 'array',
default: [],
source: 'query',
selector: 'td,th',
query: {
content: {
type: 'string',
source: 'html'
},
tag: {
type: 'string',
default: 'td',
source: 'tag'
},
scope: {
type: 'string',
source: 'attribute',
attribute: 'scope'
},
align: {
type: 'string',
source: 'attribute',
attribute: 'data-align'
}
}
}
}
},
body: {
type: 'array',
default: [],
source: 'query',
selector: 'tbody tr',
query: {
cells: {
type: 'array',
default: [],
source: 'query',
selector: 'td,th',
query: {
content: {
type: 'string',
source: 'html'
},
tag: {
type: 'string',
default: 'td',
source: 'tag'
},
scope: {
type: 'string',
source: 'attribute',
attribute: 'scope'
},
align: {
type: 'string',
source: 'attribute',
attribute: 'data-align'
}
}
}
}
},
foot: {
type: 'array',
default: [],
source: 'query',
selector: 'tfoot tr',
query: {
cells: {
type: 'array',
default: [],
source: 'query',
selector: 'td,th',
query: {
content: {
type: 'string',
source: 'html'
},
tag: {
type: 'string',
default: 'td',
source: 'tag'
},
scope: {
type: 'string',
source: 'attribute',
attribute: 'scope'
},
align: {
type: 'string',
source: 'attribute',
attribute: 'data-align'
}
}
}
}
}
},
supports: {
anchor: true,
align: true,
__experimentalSelector: '.wp-block-table > table'
},
save: ({
attributes
}) => {
const {
hasFixedLayout,
head,
body,
foot,
backgroundColor,
caption
} = attributes;
const isEmpty = !head.length && !body.length && !foot.length;
if (isEmpty) {
return null;
}
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const classes = classnames_default()(backgroundClass, {
'has-fixed-layout': hasFixedLayout,
'has-background': !!backgroundClass
});
const hasCaption = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption);
const Section = ({
type,
rows
}) => {
if (!rows.length) {
return null;
}
const Tag = `t${type}`;
return (0,external_React_namespaceObject.createElement)(Tag, null, rows.map(({
cells
}, rowIndex) => (0,external_React_namespaceObject.createElement)("tr", {
key: rowIndex
}, cells.map(({
content,
tag,
scope,
align
}, cellIndex) => {
const cellClasses = classnames_default()({
[`has-text-align-${align}`]: align
});
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
className: cellClasses ? cellClasses : undefined,
"data-align": align,
tagName: tag,
value: content,
key: cellIndex,
scope: tag === 'th' ? scope : undefined
});
}))));
};
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, (0,external_React_namespaceObject.createElement)("table", {
className: classes === '' ? undefined : classes
}, (0,external_React_namespaceObject.createElement)(Section, {
type: "head",
rows: head
}), (0,external_React_namespaceObject.createElement)(Section, {
type: "body",
rows: body
}), (0,external_React_namespaceObject.createElement)(Section, {
type: "foot",
rows: foot
})), hasCaption && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: caption
}));
},
isEligible: attributes => {
return attributes.backgroundColor && attributes.backgroundColor in oldColors && !attributes.style;
},
// This version is the first to introduce the style attribute to the
// table block. As a result, we'll explicitly override that.
migrate: attributes => {
return {
...attributes,
backgroundColor: undefined,
style: {
color: {
background: oldColors[attributes.backgroundColor]
}
}
};
}
};
const table_deprecated_v1 = {
attributes: {
hasFixedLayout: {
type: 'boolean',
default: false
},
backgroundColor: {
type: 'string'
},
head: {
type: 'array',
default: [],
source: 'query',
selector: 'thead tr',
query: {
cells: {
type: 'array',
default: [],
source: 'query',
selector: 'td,th',
query: {
content: {
type: 'string',
source: 'html'
},
tag: {
type: 'string',
default: 'td',
source: 'tag'
},
scope: {
type: 'string',
source: 'attribute',
attribute: 'scope'
}
}
}
}
},
body: {
type: 'array',
default: [],
source: 'query',
selector: 'tbody tr',
query: {
cells: {
type: 'array',
default: [],
source: 'query',
selector: 'td,th',
query: {
content: {
type: 'string',
source: 'html'
},
tag: {
type: 'string',
default: 'td',
source: 'tag'
},
scope: {
type: 'string',
source: 'attribute',
attribute: 'scope'
}
}
}
}
},
foot: {
type: 'array',
default: [],
source: 'query',
selector: 'tfoot tr',
query: {
cells: {
type: 'array',
default: [],
source: 'query',
selector: 'td,th',
query: {
content: {
type: 'string',
source: 'html'
},
tag: {
type: 'string',
default: 'td',
source: 'tag'
},
scope: {
type: 'string',
source: 'attribute',
attribute: 'scope'
}
}
}
}
}
},
supports: {
align: true
},
save({
attributes
}) {
const {
hasFixedLayout,
head,
body,
foot,
backgroundColor
} = attributes;
const isEmpty = !head.length && !body.length && !foot.length;
if (isEmpty) {
return null;
}
const backgroundClass = (0,external_wp_blockEditor_namespaceObject.getColorClassName)('background-color', backgroundColor);
const classes = classnames_default()(backgroundClass, {
'has-fixed-layout': hasFixedLayout,
'has-background': !!backgroundClass
});
const Section = ({
type,
rows
}) => {
if (!rows.length) {
return null;
}
const Tag = `t${type}`;
return (0,external_React_namespaceObject.createElement)(Tag, null, rows.map(({
cells
}, rowIndex) => (0,external_React_namespaceObject.createElement)("tr", {
key: rowIndex
}, cells.map(({
content,
tag,
scope
}, cellIndex) => (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: tag,
value: content,
key: cellIndex,
scope: tag === 'th' ? scope : undefined
})))));
};
return (0,external_React_namespaceObject.createElement)("table", {
className: classes
}, (0,external_React_namespaceObject.createElement)(Section, {
type: "head",
rows: head
}), (0,external_React_namespaceObject.createElement)(Section, {
type: "body",
rows: body
}), (0,external_React_namespaceObject.createElement)(Section, {
type: "foot",
rows: foot
}));
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const table_deprecated = ([table_deprecated_v3, table_deprecated_v2, table_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-left.js
/**
* WordPress dependencies
*/
const alignLeft = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z"
}));
/* harmony default export */ const align_left = (alignLeft);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-center.js
/**
* WordPress dependencies
*/
const alignCenter = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M7.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z"
}));
/* harmony default export */ const align_center = (alignCenter);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/align-right.js
/**
* WordPress dependencies
*/
const alignRight = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z"
}));
/* harmony default export */ const align_right = (alignRight);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/table-row-before.js
/**
* WordPress dependencies
*/
const tableRowBefore = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "-2 -2 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M6.656 6.464h2.88v2.88h1.408v-2.88h2.88V5.12h-2.88V2.24H9.536v2.88h-2.88zM0 17.92V0h20.48v17.92H0zm7.68-2.56h5.12v-3.84H7.68v3.84zm-6.4 0H6.4v-3.84H1.28v3.84zM19.2 1.28H1.28v9.024H19.2V1.28zm0 10.24h-5.12v3.84h5.12v-3.84zM6.656 6.464h2.88v2.88h1.408v-2.88h2.88V5.12h-2.88V2.24H9.536v2.88h-2.88zM0 17.92V0h20.48v17.92H0zm7.68-2.56h5.12v-3.84H7.68v3.84zm-6.4 0H6.4v-3.84H1.28v3.84zM19.2 1.28H1.28v9.024H19.2V1.28zm0 10.24h-5.12v3.84h5.12v-3.84z"
}));
/* harmony default export */ const table_row_before = (tableRowBefore);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/table-row-after.js
/**
* WordPress dependencies
*/
const tableRowAfter = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "-2 -2 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13.824 10.176h-2.88v-2.88H9.536v2.88h-2.88v1.344h2.88v2.88h1.408v-2.88h2.88zM0 17.92V0h20.48v17.92H0zM6.4 1.28H1.28v3.84H6.4V1.28zm6.4 0H7.68v3.84h5.12V1.28zm6.4 0h-5.12v3.84h5.12V1.28zm0 5.056H1.28v9.024H19.2V6.336z"
}));
/* harmony default export */ const table_row_after = (tableRowAfter);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/table-row-delete.js
/**
* WordPress dependencies
*/
const tableRowDelete = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "-2 -2 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.728 11.456L14.592 8.32l3.2-3.2-1.536-1.536-3.2 3.2L9.92 3.648 8.384 5.12l3.2 3.2-3.264 3.264 1.536 1.536 3.264-3.264 3.136 3.136 1.472-1.536zM0 17.92V0h20.48v17.92H0zm19.2-6.4h-.448l-1.28-1.28H19.2V6.4h-1.792l1.28-1.28h.512V1.28H1.28v3.84h6.208l1.28 1.28H1.28v3.84h7.424l-1.28 1.28H1.28v3.84H19.2v-3.84z"
}));
/* harmony default export */ const table_row_delete = (tableRowDelete);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/table-column-before.js
/**
* WordPress dependencies
*/
const tableColumnBefore = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "-2 -2 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M6.4 3.776v3.648H2.752v1.792H6.4v3.648h1.728V9.216h3.712V7.424H8.128V3.776zM0 17.92V0h20.48v17.92H0zM12.8 1.28H1.28v14.08H12.8V1.28zm6.4 0h-5.12v3.84h5.12V1.28zm0 5.12h-5.12v3.84h5.12V6.4zm0 5.12h-5.12v3.84h5.12v-3.84z"
}));
/* harmony default export */ const table_column_before = (tableColumnBefore);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/table-column-after.js
/**
* WordPress dependencies
*/
const tableColumnAfter = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "-2 -2 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M14.08 12.864V9.216h3.648V7.424H14.08V3.776h-1.728v3.648H8.64v1.792h3.712v3.648zM0 17.92V0h20.48v17.92H0zM6.4 1.28H1.28v3.84H6.4V1.28zm0 5.12H1.28v3.84H6.4V6.4zm0 5.12H1.28v3.84H6.4v-3.84zM19.2 1.28H7.68v14.08H19.2V1.28z"
}));
/* harmony default export */ const table_column_after = (tableColumnAfter);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/table-column-delete.js
/**
* WordPress dependencies
*/
const tableColumnDelete = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "-2 -2 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M6.4 9.98L7.68 8.7v-.256L6.4 7.164V9.98zm6.4-1.532l1.28-1.28V9.92L12.8 8.64v-.192zm7.68 9.472V0H0v17.92h20.48zm-1.28-2.56h-5.12v-1.024l-.256.256-1.024-1.024v1.792H7.68v-1.792l-1.024 1.024-.256-.256v1.024H1.28V1.28H6.4v2.368l.704-.704.576.576V1.216h5.12V3.52l.96-.96.32.32V1.216h5.12V15.36zm-5.76-2.112l-3.136-3.136-3.264 3.264-1.536-1.536 3.264-3.264L5.632 5.44l1.536-1.536 3.136 3.136 3.2-3.2 1.536 1.536-3.2 3.2 3.136 3.136-1.536 1.536z"
}));
/* harmony default export */ const table_column_delete = (tableColumnDelete);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/table.js
/**
* WordPress dependencies
*/
const table = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M4 6v11.5h16V6H4zm1.5 1.5h6V11h-6V7.5zm0 8.5v-3.5h6V16h-6zm13 0H13v-3.5h5.5V16zM13 11V7.5h5.5V11H13z"
}));
/* harmony default export */ const library_table = (table);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/table/state.js
const INHERITED_COLUMN_ATTRIBUTES = ['align'];
/**
* Creates a table state.
*
* @param {Object} options
* @param {number} options.rowCount Row count for the table to create.
* @param {number} options.columnCount Column count for the table to create.
*
* @return {Object} New table state.
*/
function createTable({
rowCount,
columnCount
}) {
return {
body: Array.from({
length: rowCount
}).map(() => ({
cells: Array.from({
length: columnCount
}).map(() => ({
content: '',
tag: 'td'
}))
}))
};
}
/**
* Returns the first row in the table.
*
* @param {Object} state Current table state.
*
* @return {Object | undefined} The first table row.
*/
function getFirstRow(state) {
if (!isEmptyTableSection(state.head)) {
return state.head[0];
}
if (!isEmptyTableSection(state.body)) {
return state.body[0];
}
if (!isEmptyTableSection(state.foot)) {
return state.foot[0];
}
}
/**
* Gets an attribute for a cell.
*
* @param {Object} state Current table state.
* @param {Object} cellLocation The location of the cell
* @param {string} attributeName The name of the attribute to get the value of.
*
* @return {*} The attribute value.
*/
function getCellAttribute(state, cellLocation, attributeName) {
const {
sectionName,
rowIndex,
columnIndex
} = cellLocation;
return state[sectionName]?.[rowIndex]?.cells?.[columnIndex]?.[attributeName];
}
/**
* Returns updated cell attributes after applying the `updateCell` function to the selection.
*
* @param {Object} state The block attributes.
* @param {Object} selection The selection of cells to update.
* @param {Function} updateCell A function to update the selected cell attributes.
*
* @return {Object} New table state including the updated cells.
*/
function updateSelectedCell(state, selection, updateCell) {
if (!selection) {
return state;
}
const tableSections = Object.fromEntries(Object.entries(state).filter(([key]) => ['head', 'body', 'foot'].includes(key)));
const {
sectionName: selectionSectionName,
rowIndex: selectionRowIndex
} = selection;
return Object.fromEntries(Object.entries(tableSections).map(([sectionName, section]) => {
if (selectionSectionName && selectionSectionName !== sectionName) {
return [sectionName, section];
}
return [sectionName, section.map((row, rowIndex) => {
if (selectionRowIndex && selectionRowIndex !== rowIndex) {
return row;
}
return {
cells: row.cells.map((cellAttributes, columnIndex) => {
const cellLocation = {
sectionName,
columnIndex,
rowIndex
};
if (!isCellSelected(cellLocation, selection)) {
return cellAttributes;
}
return updateCell(cellAttributes);
})
};
})];
}));
}
/**
* Returns whether the cell at `cellLocation` is included in the selection `selection`.
*
* @param {Object} cellLocation An object containing cell location properties.
* @param {Object} selection An object containing selection properties.
*
* @return {boolean} True if the cell is selected, false otherwise.
*/
function isCellSelected(cellLocation, selection) {
if (!cellLocation || !selection) {
return false;
}
switch (selection.type) {
case 'column':
return selection.type === 'column' && cellLocation.columnIndex === selection.columnIndex;
case 'cell':
return selection.type === 'cell' && cellLocation.sectionName === selection.sectionName && cellLocation.columnIndex === selection.columnIndex && cellLocation.rowIndex === selection.rowIndex;
}
}
/**
* Inserts a row in the table state.
*
* @param {Object} state Current table state.
* @param {Object} options
* @param {string} options.sectionName Section in which to insert the row.
* @param {number} options.rowIndex Row index at which to insert the row.
* @param {number} options.columnCount Column count for the table to create.
*
* @return {Object} New table state.
*/
function insertRow(state, {
sectionName,
rowIndex,
columnCount
}) {
const firstRow = getFirstRow(state);
const cellCount = columnCount === undefined ? firstRow?.cells?.length : columnCount;
// Bail early if the function cannot determine how many cells to add.
if (!cellCount) {
return state;
}
return {
[sectionName]: [...state[sectionName].slice(0, rowIndex), {
cells: Array.from({
length: cellCount
}).map((_, index) => {
var _firstRow$cells$index;
const firstCellInColumn = (_firstRow$cells$index = firstRow?.cells?.[index]) !== null && _firstRow$cells$index !== void 0 ? _firstRow$cells$index : {};
const inheritedAttributes = Object.fromEntries(Object.entries(firstCellInColumn).filter(([key]) => INHERITED_COLUMN_ATTRIBUTES.includes(key)));
return {
...inheritedAttributes,
content: '',
tag: sectionName === 'head' ? 'th' : 'td'
};
})
}, ...state[sectionName].slice(rowIndex)]
};
}
/**
* Deletes a row from the table state.
*
* @param {Object} state Current table state.
* @param {Object} options
* @param {string} options.sectionName Section in which to delete the row.
* @param {number} options.rowIndex Row index to delete.
*
* @return {Object} New table state.
*/
function deleteRow(state, {
sectionName,
rowIndex
}) {
return {
[sectionName]: state[sectionName].filter((row, index) => index !== rowIndex)
};
}
/**
* Inserts a column in the table state.
*
* @param {Object} state Current table state.
* @param {Object} options
* @param {number} options.columnIndex Column index at which to insert the column.
*
* @return {Object} New table state.
*/
function insertColumn(state, {
columnIndex
}) {
const tableSections = Object.fromEntries(Object.entries(state).filter(([key]) => ['head', 'body', 'foot'].includes(key)));
return Object.fromEntries(Object.entries(tableSections).map(([sectionName, section]) => {
// Bail early if the table section is empty.
if (isEmptyTableSection(section)) {
return [sectionName, section];
}
return [sectionName, section.map(row => {
// Bail early if the row is empty or it's an attempt to insert past
// the last possible index of the array.
if (isEmptyRow(row) || row.cells.length < columnIndex) {
return row;
}
return {
cells: [...row.cells.slice(0, columnIndex), {
content: '',
tag: sectionName === 'head' ? 'th' : 'td'
}, ...row.cells.slice(columnIndex)]
};
})];
}));
}
/**
* Deletes a column from the table state.
*
* @param {Object} state Current table state.
* @param {Object} options
* @param {number} options.columnIndex Column index to delete.
*
* @return {Object} New table state.
*/
function deleteColumn(state, {
columnIndex
}) {
const tableSections = Object.fromEntries(Object.entries(state).filter(([key]) => ['head', 'body', 'foot'].includes(key)));
return Object.fromEntries(Object.entries(tableSections).map(([sectionName, section]) => {
// Bail early if the table section is empty.
if (isEmptyTableSection(section)) {
return [sectionName, section];
}
return [sectionName, section.map(row => ({
cells: row.cells.length >= columnIndex ? row.cells.filter((cell, index) => index !== columnIndex) : row.cells
})).filter(row => row.cells.length)];
}));
}
/**
* Toggles the existence of a section.
*
* @param {Object} state Current table state.
* @param {string} sectionName Name of the section to toggle.
*
* @return {Object} New table state.
*/
function toggleSection(state, sectionName) {
var _state$body$0$cells$l;
// Section exists, replace it with an empty row to remove it.
if (!isEmptyTableSection(state[sectionName])) {
return {
[sectionName]: []
};
}
// Get the length of the first row of the body to use when creating the header.
const columnCount = (_state$body$0$cells$l = state.body?.[0]?.cells?.length) !== null && _state$body$0$cells$l !== void 0 ? _state$body$0$cells$l : 1;
// Section doesn't exist, insert an empty row to create the section.
return insertRow(state, {
sectionName,
rowIndex: 0,
columnCount
});
}
/**
* Determines whether a table section is empty.
*
* @param {Object} section Table section state.
*
* @return {boolean} True if the table section is empty, false otherwise.
*/
function isEmptyTableSection(section) {
return !section || !section.length || section.every(isEmptyRow);
}
/**
* Determines whether a table row is empty.
*
* @param {Object} row Table row state.
*
* @return {boolean} True if the table section is empty, false otherwise.
*/
function isEmptyRow(row) {
return !(row.cells && row.cells.length);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/table/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ALIGNMENT_CONTROLS = [{
icon: align_left,
title: (0,external_wp_i18n_namespaceObject.__)('Align column left'),
align: 'left'
}, {
icon: align_center,
title: (0,external_wp_i18n_namespaceObject.__)('Align column center'),
align: 'center'
}, {
icon: align_right,
title: (0,external_wp_i18n_namespaceObject.__)('Align column right'),
align: 'right'
}];
const cellAriaLabel = {
head: (0,external_wp_i18n_namespaceObject.__)('Header cell text'),
body: (0,external_wp_i18n_namespaceObject.__)('Body cell text'),
foot: (0,external_wp_i18n_namespaceObject.__)('Footer cell text')
};
const edit_placeholder = {
head: (0,external_wp_i18n_namespaceObject.__)('Header label'),
foot: (0,external_wp_i18n_namespaceObject.__)('Footer label')
};
function TSection({
name,
...props
}) {
const TagName = `t${name}`;
return (0,external_React_namespaceObject.createElement)(TagName, {
...props
});
}
function TableEdit({
attributes,
setAttributes,
insertBlocksAfter,
isSelected
}) {
const {
hasFixedLayout,
caption,
head,
foot
} = attributes;
const [initialRowCount, setInitialRowCount] = (0,external_wp_element_namespaceObject.useState)(2);
const [initialColumnCount, setInitialColumnCount] = (0,external_wp_element_namespaceObject.useState)(2);
const [selectedCell, setSelectedCell] = (0,external_wp_element_namespaceObject.useState)();
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseColorProps)(attributes);
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalUseBorderProps)(attributes);
const tableRef = (0,external_wp_element_namespaceObject.useRef)();
const [hasTableCreated, setHasTableCreated] = (0,external_wp_element_namespaceObject.useState)(false);
/**
* Updates the initial column count used for table creation.
*
* @param {number} count New initial column count.
*/
function onChangeInitialColumnCount(count) {
setInitialColumnCount(count);
}
/**
* Updates the initial row count used for table creation.
*
* @param {number} count New initial row count.
*/
function onChangeInitialRowCount(count) {
setInitialRowCount(count);
}
/**
* Creates a table based on dimensions in local state.
*
* @param {Object} event Form submit event.
*/
function onCreateTable(event) {
event.preventDefault();
setAttributes(createTable({
rowCount: parseInt(initialRowCount, 10) || 2,
columnCount: parseInt(initialColumnCount, 10) || 2
}));
setHasTableCreated(true);
}
/**
* Toggles whether the table has a fixed layout or not.
*/
function onChangeFixedLayout() {
setAttributes({
hasFixedLayout: !hasFixedLayout
});
}
/**
* Changes the content of the currently selected cell.
*
* @param {Array} content A RichText content value.
*/
function onChange(content) {
if (!selectedCell) {
return;
}
setAttributes(updateSelectedCell(attributes, selectedCell, cellAttributes => ({
...cellAttributes,
content
})));
}
/**
* Align text within the a column.
*
* @param {string} align The new alignment to apply to the column.
*/
function onChangeColumnAlignment(align) {
if (!selectedCell) {
return;
}
// Convert the cell selection to a column selection so that alignment
// is applied to the entire column.
const columnSelection = {
type: 'column',
columnIndex: selectedCell.columnIndex
};
const newAttributes = updateSelectedCell(attributes, columnSelection, cellAttributes => ({
...cellAttributes,
align
}));
setAttributes(newAttributes);
}
/**
* Get the alignment of the currently selected cell.
*
* @return {string | undefined} The new alignment to apply to the column.
*/
function getCellAlignment() {
if (!selectedCell) {
return;
}
return getCellAttribute(attributes, selectedCell, 'align');
}
/**
* Add or remove a `head` table section.
*/
function onToggleHeaderSection() {
setAttributes(toggleSection(attributes, 'head'));
}
/**
* Add or remove a `foot` table section.
*/
function onToggleFooterSection() {
setAttributes(toggleSection(attributes, 'foot'));
}
/**
* Inserts a row at the currently selected row index, plus `delta`.
*
* @param {number} delta Offset for selected row index at which to insert.
*/
function onInsertRow(delta) {
if (!selectedCell) {
return;
}
const {
sectionName,
rowIndex
} = selectedCell;
const newRowIndex = rowIndex + delta;
setAttributes(insertRow(attributes, {
sectionName,
rowIndex: newRowIndex
}));
// Select the first cell of the new row.
setSelectedCell({
sectionName,
rowIndex: newRowIndex,
columnIndex: 0,
type: 'cell'
});
}
/**
* Inserts a row before the currently selected row.
*/
function onInsertRowBefore() {
onInsertRow(0);
}
/**
* Inserts a row after the currently selected row.
*/
function onInsertRowAfter() {
onInsertRow(1);
}
/**
* Deletes the currently selected row.
*/
function onDeleteRow() {
if (!selectedCell) {
return;
}
const {
sectionName,
rowIndex
} = selectedCell;
setSelectedCell();
setAttributes(deleteRow(attributes, {
sectionName,
rowIndex
}));
}
/**
* Inserts a column at the currently selected column index, plus `delta`.
*
* @param {number} delta Offset for selected column index at which to insert.
*/
function onInsertColumn(delta = 0) {
if (!selectedCell) {
return;
}
const {
columnIndex
} = selectedCell;
const newColumnIndex = columnIndex + delta;
setAttributes(insertColumn(attributes, {
columnIndex: newColumnIndex
}));
// Select the first cell of the new column.
setSelectedCell({
rowIndex: 0,
columnIndex: newColumnIndex,
type: 'cell'
});
}
/**
* Inserts a column before the currently selected column.
*/
function onInsertColumnBefore() {
onInsertColumn(0);
}
/**
* Inserts a column after the currently selected column.
*/
function onInsertColumnAfter() {
onInsertColumn(1);
}
/**
* Deletes the currently selected column.
*/
function onDeleteColumn() {
if (!selectedCell) {
return;
}
const {
sectionName,
columnIndex
} = selectedCell;
setSelectedCell();
setAttributes(deleteColumn(attributes, {
sectionName,
columnIndex
}));
}
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isSelected) {
setSelectedCell();
}
}, [isSelected]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (hasTableCreated) {
tableRef?.current?.querySelector('td div[contentEditable="true"]')?.focus();
setHasTableCreated(false);
}
}, [hasTableCreated]);
const sections = ['head', 'body', 'foot'].filter(name => !isEmptyTableSection(attributes[name]));
const tableControls = [{
icon: table_row_before,
title: (0,external_wp_i18n_namespaceObject.__)('Insert row before'),
isDisabled: !selectedCell,
onClick: onInsertRowBefore
}, {
icon: table_row_after,
title: (0,external_wp_i18n_namespaceObject.__)('Insert row after'),
isDisabled: !selectedCell,
onClick: onInsertRowAfter
}, {
icon: table_row_delete,
title: (0,external_wp_i18n_namespaceObject.__)('Delete row'),
isDisabled: !selectedCell,
onClick: onDeleteRow
}, {
icon: table_column_before,
title: (0,external_wp_i18n_namespaceObject.__)('Insert column before'),
isDisabled: !selectedCell,
onClick: onInsertColumnBefore
}, {
icon: table_column_after,
title: (0,external_wp_i18n_namespaceObject.__)('Insert column after'),
isDisabled: !selectedCell,
onClick: onInsertColumnAfter
}, {
icon: table_column_delete,
title: (0,external_wp_i18n_namespaceObject.__)('Delete column'),
isDisabled: !selectedCell,
onClick: onDeleteColumn
}];
const renderedSections = sections.map(name => (0,external_React_namespaceObject.createElement)(TSection, {
name: name,
key: name
}, attributes[name].map(({
cells
}, rowIndex) => (0,external_React_namespaceObject.createElement)("tr", {
key: rowIndex
}, cells.map(({
content,
tag: CellTag,
scope,
align,
colspan,
rowspan
}, columnIndex) => (0,external_React_namespaceObject.createElement)(CellTag, {
key: columnIndex,
scope: CellTag === 'th' ? scope : undefined,
colSpan: colspan,
rowSpan: rowspan,
className: classnames_default()({
[`has-text-align-${align}`]: align
}, 'wp-block-table__cell-content')
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
value: content,
onChange: onChange,
onFocus: () => {
setSelectedCell({
sectionName: name,
rowIndex,
columnIndex,
type: 'cell'
});
},
"aria-label": cellAriaLabel[name],
placeholder: edit_placeholder[name]
})))))));
const isEmpty = !sections.length;
return (0,external_React_namespaceObject.createElement)("figure", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({
ref: tableRef
})
}, !isEmpty && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Change column alignment'),
alignmentControls: ALIGNMENT_CONTROLS,
value: getCellAlignment(),
onChange: nextAlign => onChangeColumnAlignment(nextAlign)
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarDropdownMenu, {
hasArrowIndicator: true,
icon: library_table,
label: (0,external_wp_i18n_namespaceObject.__)('Edit table'),
controls: tableControls
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
className: "blocks-table-settings"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Fixed width table cells'),
checked: !!hasFixedLayout,
onChange: onChangeFixedLayout
}), !isEmpty && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Header section'),
checked: !!(head && head.length),
onChange: onToggleHeaderSection
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Footer section'),
checked: !!(foot && foot.length),
onChange: onToggleFooterSection
})))), !isEmpty && (0,external_React_namespaceObject.createElement)("table", {
className: classnames_default()(colorProps.className, borderProps.className, {
'has-fixed-layout': hasFixedLayout,
// This is required in the editor only to overcome
// the fact the editor rewrites individual border
// widths into a shorthand format.
'has-individual-borders': (0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(attributes?.style?.border)
}),
style: {
...colorProps.style,
...borderProps.style
}
}, renderedSections), !isEmpty && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
identifier: "caption",
tagName: "figcaption",
className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'),
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Table caption text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Add caption'),
value: caption,
onChange: value => setAttributes({
caption: value
})
// Deselect the selected table cell when the caption is focused.
,
onFocus: () => setSelectedCell(),
__unstableOnSplitAtEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()))
}), isEmpty && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
label: (0,external_wp_i18n_namespaceObject.__)('Table'),
icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: block_table,
showColors: true
}),
instructions: (0,external_wp_i18n_namespaceObject.__)('Insert a table for sharing data.')
}, (0,external_React_namespaceObject.createElement)("form", {
className: "blocks-table__placeholder-form",
onSubmit: onCreateTable
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
type: "number",
label: (0,external_wp_i18n_namespaceObject.__)('Column count'),
value: initialColumnCount,
onChange: onChangeInitialColumnCount,
min: "1",
className: "blocks-table__placeholder-input"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
type: "number",
label: (0,external_wp_i18n_namespaceObject.__)('Row count'),
value: initialRowCount,
onChange: onChangeInitialRowCount,
min: "1",
className: "blocks-table__placeholder-input"
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "primary",
type: "submit"
}, (0,external_wp_i18n_namespaceObject.__)('Create Table')))));
}
/* harmony default export */ const table_edit = (TableEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/table/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function table_save_save({
attributes
}) {
const {
hasFixedLayout,
head,
body,
foot,
caption
} = attributes;
const isEmpty = !head.length && !body.length && !foot.length;
if (isEmpty) {
return null;
}
const colorProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetColorClassesAndStyles)(attributes);
const borderProps = (0,external_wp_blockEditor_namespaceObject.__experimentalGetBorderClassesAndStyles)(attributes);
const classes = classnames_default()(colorProps.className, borderProps.className, {
'has-fixed-layout': hasFixedLayout
});
const hasCaption = !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption);
const Section = ({
type,
rows
}) => {
if (!rows.length) {
return null;
}
const Tag = `t${type}`;
return (0,external_React_namespaceObject.createElement)(Tag, null, rows.map(({
cells
}, rowIndex) => (0,external_React_namespaceObject.createElement)("tr", {
key: rowIndex
}, cells.map(({
content,
tag,
scope,
align,
colspan,
rowspan
}, cellIndex) => {
const cellClasses = classnames_default()({
[`has-text-align-${align}`]: align
});
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
className: cellClasses ? cellClasses : undefined,
"data-align": align,
tagName: tag,
value: content,
key: cellIndex,
scope: tag === 'th' ? scope : undefined,
colSpan: colspan,
rowSpan: rowspan
});
}))));
};
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, (0,external_React_namespaceObject.createElement)("table", {
className: classes === '' ? undefined : classes,
style: {
...colorProps.style,
...borderProps.style
}
}, (0,external_React_namespaceObject.createElement)(Section, {
type: "head",
rows: head
}), (0,external_React_namespaceObject.createElement)(Section, {
type: "body",
rows: body
}), (0,external_React_namespaceObject.createElement)(Section, {
type: "foot",
rows: foot
})), hasCaption && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: caption,
className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption')
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/table/utils.js
/**
* Normalize the rowspan/colspan value.
* Returns undefined if the parameter is not a positive number
* or the default value (1) for rowspan/colspan.
*
* @param {number|undefined} rowColSpan rowspan/colspan value.
*
* @return {string|undefined} normalized rowspan/colspan value.
*/
function normalizeRowColSpan(rowColSpan) {
const parsedValue = parseInt(rowColSpan, 10);
if (!Number.isInteger(parsedValue)) {
return undefined;
}
return parsedValue < 0 || parsedValue === 1 ? undefined : parsedValue.toString();
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/table/transforms.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const tableContentPasteSchema = ({
phrasingContentSchema
}) => ({
tr: {
allowEmpty: true,
children: {
th: {
allowEmpty: true,
children: phrasingContentSchema,
attributes: ['scope', 'colspan', 'rowspan']
},
td: {
allowEmpty: true,
children: phrasingContentSchema,
attributes: ['colspan', 'rowspan']
}
}
}
});
const tablePasteSchema = args => ({
table: {
children: {
thead: {
allowEmpty: true,
children: tableContentPasteSchema(args)
},
tfoot: {
allowEmpty: true,
children: tableContentPasteSchema(args)
},
tbody: {
allowEmpty: true,
children: tableContentPasteSchema(args)
}
}
}
});
const table_transforms_transforms = {
from: [{
type: 'raw',
selector: 'table',
schema: tablePasteSchema,
transform: node => {
const attributes = Array.from(node.children).reduce((sectionAcc, section) => {
if (!section.children.length) {
return sectionAcc;
}
const sectionName = section.nodeName.toLowerCase().slice(1);
const sectionAttributes = Array.from(section.children).reduce((rowAcc, row) => {
if (!row.children.length) {
return rowAcc;
}
const rowAttributes = Array.from(row.children).reduce((colAcc, col) => {
const rowspan = normalizeRowColSpan(col.getAttribute('rowspan'));
const colspan = normalizeRowColSpan(col.getAttribute('colspan'));
colAcc.push({
tag: col.nodeName.toLowerCase(),
content: col.innerHTML,
rowspan,
colspan
});
return colAcc;
}, []);
rowAcc.push({
cells: rowAttributes
});
return rowAcc;
}, []);
sectionAcc[sectionName] = sectionAttributes;
return sectionAcc;
}, {});
return (0,external_wp_blocks_namespaceObject.createBlock)('core/table', attributes);
}
}]
};
/* harmony default export */ const table_transforms = (table_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/table/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const table_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/table",
title: "Table",
category: "text",
description: "Create structured content in rows and columns to display information.",
textdomain: "default",
attributes: {
hasFixedLayout: {
type: "boolean",
"default": false
},
caption: {
type: "rich-text",
source: "rich-text",
selector: "figcaption"
},
head: {
type: "array",
"default": [],
source: "query",
selector: "thead tr",
query: {
cells: {
type: "array",
"default": [],
source: "query",
selector: "td,th",
query: {
content: {
type: "rich-text",
source: "rich-text"
},
tag: {
type: "string",
"default": "td",
source: "tag"
},
scope: {
type: "string",
source: "attribute",
attribute: "scope"
},
align: {
type: "string",
source: "attribute",
attribute: "data-align"
},
colspan: {
type: "string",
source: "attribute",
attribute: "colspan"
},
rowspan: {
type: "string",
source: "attribute",
attribute: "rowspan"
}
}
}
}
},
body: {
type: "array",
"default": [],
source: "query",
selector: "tbody tr",
query: {
cells: {
type: "array",
"default": [],
source: "query",
selector: "td,th",
query: {
content: {
type: "rich-text",
source: "rich-text"
},
tag: {
type: "string",
"default": "td",
source: "tag"
},
scope: {
type: "string",
source: "attribute",
attribute: "scope"
},
align: {
type: "string",
source: "attribute",
attribute: "data-align"
},
colspan: {
type: "string",
source: "attribute",
attribute: "colspan"
},
rowspan: {
type: "string",
source: "attribute",
attribute: "rowspan"
}
}
}
}
},
foot: {
type: "array",
"default": [],
source: "query",
selector: "tfoot tr",
query: {
cells: {
type: "array",
"default": [],
source: "query",
selector: "td,th",
query: {
content: {
type: "rich-text",
source: "rich-text"
},
tag: {
type: "string",
"default": "td",
source: "tag"
},
scope: {
type: "string",
source: "attribute",
attribute: "scope"
},
align: {
type: "string",
source: "attribute",
attribute: "data-align"
},
colspan: {
type: "string",
source: "attribute",
attribute: "colspan"
},
rowspan: {
type: "string",
source: "attribute",
attribute: "rowspan"
}
}
}
}
}
},
supports: {
anchor: true,
align: true,
color: {
__experimentalSkipSerialization: true,
gradients: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalDefaultControls: {
fontSize: true
}
},
__experimentalBorder: {
__experimentalSkipSerialization: true,
color: true,
style: true,
width: true,
__experimentalDefaultControls: {
color: true,
style: true,
width: true
}
},
__experimentalSelector: ".wp-block-table > table",
interactivity: {
clientNavigation: true
}
},
styles: [{
name: "regular",
label: "Default",
isDefault: true
}, {
name: "stripes",
label: "Stripes"
}],
editorStyle: "wp-block-table-editor",
style: "wp-block-table"
};
const {
name: table_name
} = table_metadata;
const table_settings = {
icon: block_table,
example: {
attributes: {
head: [{
cells: [{
content: (0,external_wp_i18n_namespaceObject.__)('Version'),
tag: 'th'
}, {
content: (0,external_wp_i18n_namespaceObject.__)('Jazz Musician'),
tag: 'th'
}, {
content: (0,external_wp_i18n_namespaceObject.__)('Release Date'),
tag: 'th'
}]
}],
body: [{
cells: [{
content: '5.2',
tag: 'td'
}, {
content: 'Jaco Pastorius',
tag: 'td'
}, {
content: (0,external_wp_i18n_namespaceObject.__)('May 7, 2019'),
tag: 'td'
}]
}, {
cells: [{
content: '5.1',
tag: 'td'
}, {
content: 'Betty Carter',
tag: 'td'
}, {
content: (0,external_wp_i18n_namespaceObject.__)('February 21, 2019'),
tag: 'td'
}]
}, {
cells: [{
content: '5.0',
tag: 'td'
}, {
content: 'Bebo Valdés',
tag: 'td'
}, {
content: (0,external_wp_i18n_namespaceObject.__)('December 6, 2018'),
tag: 'td'
}]
}]
},
viewportWidth: 450
},
transforms: table_transforms,
edit: table_edit,
save: table_save_save,
deprecated: table_deprecated
};
const table_init = () => initBlock({
name: table_name,
metadata: table_metadata,
settings: table_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/table-of-contents.js
/**
* WordPress dependencies
*/
const tableOfContents = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M20 9.484h-8.889v-1.5H20v1.5Zm0 7h-4.889v-1.5H20v1.5Zm-14 .032a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 1a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"
}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13 15.516a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM8 8.484a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"
}));
/* harmony default export */ const table_of_contents = (tableOfContents);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/table-of-contents/list.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const ENTRY_CLASS_NAME = 'wp-block-table-of-contents__entry';
function TableOfContentsList({
nestedHeadingList,
disableLinkActivation,
onClick
}) {
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, nestedHeadingList.map((node, index) => {
const {
content,
link
} = node.heading;
const entry = link ? (0,external_React_namespaceObject.createElement)("a", {
className: ENTRY_CLASS_NAME,
href: link,
"aria-disabled": disableLinkActivation || undefined,
onClick: disableLinkActivation && 'function' === typeof onClick ? onClick : undefined
}, content) : (0,external_React_namespaceObject.createElement)("span", {
className: ENTRY_CLASS_NAME
}, content);
return (0,external_React_namespaceObject.createElement)("li", {
key: index
}, entry, node.children ? (0,external_React_namespaceObject.createElement)("ol", null, (0,external_React_namespaceObject.createElement)(TableOfContentsList, {
nestedHeadingList: node.children,
disableLinkActivation: disableLinkActivation,
onClick: disableLinkActivation && 'function' === typeof onClick ? onClick : undefined
})) : null);
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/table-of-contents/utils.js
/**
* Takes a flat list of heading parameters and nests them based on each header's
* immediate parent's level.
*
* @param headingList The flat list of headings to nest.
*
* @return The nested list of headings.
*/
function linearToNestedHeadingList(headingList) {
const nestedHeadingList = [];
headingList.forEach((heading, key) => {
if (heading.content === '') {
return;
}
// Make sure we are only working with the same level as the first iteration in our set.
if (heading.level === headingList[0].level) {
// Check that the next iteration will return a value.
// If it does and the next level is greater than the current level,
// the next iteration becomes a child of the current iteration.
if (headingList[key + 1]?.level > heading.level) {
// We must calculate the last index before the next iteration that
// has the same level (siblings). We then use this index to slice
// the array for use in recursion. This prevents duplicate nodes.
let endOfSlice = headingList.length;
for (let i = key + 1; i < headingList.length; i++) {
if (headingList[i].level === heading.level) {
endOfSlice = i;
break;
}
}
// We found a child node: Push a new node onto the return array
// with children.
nestedHeadingList.push({
heading,
children: linearToNestedHeadingList(headingList.slice(key + 1, endOfSlice))
});
} else {
// No child node: Push a new node onto the return array.
nestedHeadingList.push({
heading,
children: null
});
}
}
});
return nestedHeadingList;
}
// EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js
var es6 = __webpack_require__(7734);
var es6_default = /*#__PURE__*/__webpack_require__.n(es6);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/table-of-contents/hooks.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function getLatestHeadings(select, clientId) {
var _select$getPermalink, _getBlockAttributes;
const {
getBlockAttributes,
getBlockName,
getClientIdsWithDescendants,
getBlocksByName
} = select(external_wp_blockEditor_namespaceObject.store);
// FIXME: @wordpress/block-library should not depend on @wordpress/editor.
// Blocks can be loaded into a *non-post* block editor, so to avoid
// declaring @wordpress/editor as a dependency, we must access its
// store by string. When the store is not available, editorSelectors
// will be null, and the block's saved markup will lack permalinks.
// eslint-disable-next-line @wordpress/data-no-store-string-literals
const permalink = (_select$getPermalink = select('core/editor').getPermalink()) !== null && _select$getPermalink !== void 0 ? _select$getPermalink : null;
const isPaginated = getBlocksByName('core/nextpage').length !== 0;
const {
onlyIncludeCurrentPage
} = (_getBlockAttributes = getBlockAttributes(clientId)) !== null && _getBlockAttributes !== void 0 ? _getBlockAttributes : {};
// Get the client ids of all blocks in the editor.
const allBlockClientIds = getClientIdsWithDescendants();
// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.
let tocPage = 1;
if (isPaginated && onlyIncludeCurrentPage) {
// We can't use getBlockIndex because it only returns the index
// relative to sibling blocks.
const tocIndex = allBlockClientIds.indexOf(clientId);
for (const [blockIndex, blockClientId] of allBlockClientIds.entries()) {
// If we've reached blocks after the Table of Contents, we've
// finished calculating which page the block is on.
if (blockIndex >= tocIndex) {
break;
}
if (getBlockName(blockClientId) === 'core/nextpage') {
tocPage++;
}
}
}
const latestHeadings = [];
/** The page (of a paginated post) a heading will be part of. */
let headingPage = 1;
let headingPageLink = null;
// If the core/editor store is available, we can add permalinks to the
// generated table of contents.
if (typeof permalink === 'string') {
headingPageLink = isPaginated ? (0,external_wp_url_namespaceObject.addQueryArgs)(permalink, {
page: headingPage
}) : permalink;
}
for (const blockClientId of allBlockClientIds) {
const blockName = getBlockName(blockClientId);
if (blockName === 'core/nextpage') {
headingPage++;
// If we're only including headings from the current page (of
// a paginated post), then exit the loop if we've reached the
// pages after the one with the Table of Contents block.
if (onlyIncludeCurrentPage && headingPage > tocPage) {
break;
}
if (typeof permalink === 'string') {
headingPageLink = (0,external_wp_url_namespaceObject.addQueryArgs)((0,external_wp_url_namespaceObject.removeQueryArgs)(permalink, ['page']), {
page: headingPage
});
}
}
// If we're including all headings or we've reached headings on
// the same page as the Table of Contents block, add them to the
// list.
else if (!onlyIncludeCurrentPage || headingPage === tocPage) {
if (blockName === 'core/heading') {
const headingAttributes = getBlockAttributes(blockClientId);
const canBeLinked = typeof headingPageLink === 'string' && typeof headingAttributes.anchor === 'string' && headingAttributes.anchor !== '';
latestHeadings.push({
// Convert line breaks to spaces, and get rid of HTML tags in the headings.
content: (0,external_wp_dom_namespaceObject.__unstableStripHTML)(headingAttributes.content.replace(/(<br *\/?>)+/g, ' ')),
level: headingAttributes.level,
link: canBeLinked ? `${headingPageLink}#${headingAttributes.anchor}` : null
});
}
}
}
return latestHeadings;
}
function observeCallback(select, dispatch, clientId) {
const {
getBlockAttributes
} = select(external_wp_blockEditor_namespaceObject.store);
const {
updateBlockAttributes,
__unstableMarkNextChangeAsNotPersistent
} = dispatch(external_wp_blockEditor_namespaceObject.store);
/**
* If the block no longer exists in the store, skip the update.
* The "undo" action recreates the block and provides a new `clientId`.
* The hook still might be observing the changes while the old block unmounts.
*/
const attributes = getBlockAttributes(clientId);
if (attributes === null) {
return;
}
const headings = getLatestHeadings(select, clientId);
if (!es6_default()(headings, attributes.headings)) {
__unstableMarkNextChangeAsNotPersistent();
updateBlockAttributes(clientId, {
headings
});
}
}
function useObserveHeadings(clientId) {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Todo: Limit subscription to block editor store when data no longer depends on `getPermalink`.
// See: https://github.com/WordPress/gutenberg/pull/45513
return registry.subscribe(() => observeCallback(registry.select, registry.dispatch, clientId));
}, [registry, clientId]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/table-of-contents/edit.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('./utils').HeadingData} HeadingData */
/**
* Table of Contents block edit component.
*
* @param {Object} props The props.
* @param {Object} props.attributes The block attributes.
* @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.
* @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).
* @param {string} props.clientId
* @param {(attributes: Object) => void} props.setAttributes
*
* @return {Component} The component.
*/
function TableOfContentsEdit({
attributes: {
headings = [],
onlyIncludeCurrentPage
},
clientId,
setAttributes
}) {
useObserveHeadings(clientId);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(TableOfContentsEdit, 'table-of-contents');
// If a user clicks to a link prevent redirection and show a warning.
const {
createWarningNotice,
removeNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
let noticeId;
const showRedirectionPreventedNotice = event => {
event.preventDefault();
// Remove previous warning if any, to show one at a time per block.
removeNotice(noticeId);
noticeId = `block-library/core/table-of-contents/redirection-prevented/${instanceId}`;
createWarningNotice((0,external_wp_i18n_namespaceObject.__)('Links are disabled in the editor.'), {
id: noticeId,
type: 'snackbar'
});
};
const canInsertList = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getBlockRootClientId,
canInsertBlockType
} = select(external_wp_blockEditor_namespaceObject.store);
const rootClientId = getBlockRootClientId(clientId);
return canInsertBlockType('core/list', rootClientId);
}, [clientId]);
const {
replaceBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
const headingTree = linearToNestedHeadingList(headings);
const toolbarControls = canInsertList && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: () => replaceBlocks(clientId, (0,external_wp_blocks_namespaceObject.createBlock)('core/list', {
ordered: true,
values: (0,external_wp_element_namespaceObject.renderToString)((0,external_React_namespaceObject.createElement)(TableOfContentsList, {
nestedHeadingList: headingTree
}))
}))
}, (0,external_wp_i18n_namespaceObject.__)('Convert to static list'))));
const inspectorControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Only include current page'),
checked: onlyIncludeCurrentPage,
onChange: value => setAttributes({
onlyIncludeCurrentPage: value
}),
help: onlyIncludeCurrentPage ? (0,external_wp_i18n_namespaceObject.__)('Only including headings from the current page (if the post is paginated).') : (0,external_wp_i18n_namespaceObject.__)('Toggle to only include headings from the current page (if the post is paginated).')
})));
// If there are no headings or the only heading is empty.
// Note that the toolbar controls are intentionally omitted since the
// "Convert to static list" option is useless to the placeholder state.
if (headings.length === 0) {
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: table_of_contents
}),
label: (0,external_wp_i18n_namespaceObject.__)('Table of Contents'),
instructions: (0,external_wp_i18n_namespaceObject.__)('Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.')
})), inspectorControls);
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("nav", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("ol", null, (0,external_React_namespaceObject.createElement)(TableOfContentsList, {
nestedHeadingList: headingTree,
disableLinkActivation: true,
onClick: showRedirectionPreventedNotice
}))), toolbarControls, inspectorControls);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/table-of-contents/save.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function table_of_contents_save_save({
attributes: {
headings = []
}
}) {
if (headings.length === 0) {
return null;
}
return (0,external_React_namespaceObject.createElement)("nav", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, (0,external_React_namespaceObject.createElement)("ol", null, (0,external_React_namespaceObject.createElement)(TableOfContentsList, {
nestedHeadingList: linearToNestedHeadingList(headings)
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/table-of-contents/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const table_of_contents_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
__experimental: true,
name: "core/table-of-contents",
title: "Table of Contents",
category: "layout",
description: "Summarize your post with a list of headings. Add HTML anchors to Heading blocks to link them here.",
keywords: ["document outline", "summary"],
textdomain: "default",
attributes: {
headings: {
type: "array",
items: {
type: "object"
},
"default": []
},
onlyIncludeCurrentPage: {
type: "boolean",
"default": false
}
},
supports: {
html: false,
color: {
text: true,
background: true,
gradients: true,
link: true
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
example: {}
};
const {
name: table_of_contents_name
} = table_of_contents_metadata;
const table_of_contents_settings = {
icon: table_of_contents,
edit: TableOfContentsEdit,
save: table_of_contents_save_save
};
const table_of_contents_init = () => initBlock({
name: table_of_contents_name,
metadata: table_of_contents_metadata,
settings: table_of_contents_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/tag-cloud/transforms.js
/**
* WordPress dependencies
*/
const tag_cloud_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/categories'],
transform: () => (0,external_wp_blocks_namespaceObject.createBlock)('core/tag-cloud')
}],
to: [{
type: 'block',
blocks: ['core/categories'],
transform: () => (0,external_wp_blocks_namespaceObject.createBlock)('core/categories')
}]
};
/* harmony default export */ const tag_cloud_transforms = (tag_cloud_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/tag-cloud/edit.js
/**
* WordPress dependencies
*/
/**
* Minimum number of tags a user can show using this block.
*
* @type {number}
*/
const MIN_TAGS = 1;
/**
* Maximum number of tags a user can show using this block.
*
* @type {number}
*/
const MAX_TAGS = 100;
const MIN_FONT_SIZE = 0.1;
const MAX_FONT_SIZE = 100;
function TagCloudEdit({
attributes,
setAttributes
}) {
const {
taxonomy,
showTagCounts,
numberOfTags,
smallestFontSize,
largestFontSize
} = attributes;
const [availableUnits] = (0,external_wp_blockEditor_namespaceObject.useSettings)('spacing.units');
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: availableUnits || ['%', 'px', 'em', 'rem']
});
const taxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTaxonomies({
per_page: -1
}), []);
const getTaxonomyOptions = () => {
const selectOption = {
label: (0,external_wp_i18n_namespaceObject.__)('- Select -'),
value: '',
disabled: true
};
const taxonomyOptions = (taxonomies !== null && taxonomies !== void 0 ? taxonomies : []).filter(tax => !!tax.show_cloud).map(item => {
return {
value: item.slug,
label: item.name
};
});
return [selectOption, ...taxonomyOptions];
};
const onFontSizeChange = (fontSizeLabel, newValue) => {
// eslint-disable-next-line @wordpress/no-unused-vars-before-return
const [quantity, newUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(newValue);
if (!Number.isFinite(quantity)) {
return;
}
const updateObj = {
[fontSizeLabel]: newValue
};
// We need to keep in sync the `unit` changes to both `smallestFontSize`
// and `largestFontSize` attributes.
Object.entries({
smallestFontSize,
largestFontSize
}).forEach(([attribute, currentValue]) => {
const [currentQuantity, currentUnit] = (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(currentValue);
// Only add an update if the other font size attribute has a different unit.
if (attribute !== fontSizeLabel && currentUnit !== newUnit) {
updateObj[attribute] = `${currentQuantity}${newUnit}`;
}
});
setAttributes(updateObj);
};
const inspectorControls = (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Taxonomy'),
options: getTaxonomyOptions(),
value: taxonomy,
onChange: selectedTaxonomy => setAttributes({
taxonomy: selectedTaxonomy
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Show post counts'),
checked: showTagCounts,
onChange: () => setAttributes({
showTagCounts: !showTagCounts
})
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Number of tags'),
value: numberOfTags,
onChange: value => setAttributes({
numberOfTags: value
}),
min: MIN_TAGS,
max: MAX_TAGS,
required: true
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
isBlock: true
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Smallest size'),
value: smallestFontSize,
onChange: value => {
onFontSizeChange('smallestFontSize', value);
},
units: units,
min: MIN_FONT_SIZE,
max: MAX_FONT_SIZE
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
isBlock: true
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Largest size'),
value: largestFontSize,
onChange: value => {
onFontSizeChange('largestFontSize', value);
},
units: units,
min: MIN_FONT_SIZE,
max: MAX_FONT_SIZE
})))));
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, inspectorControls, (0,external_React_namespaceObject.createElement)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)()
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, null, (0,external_React_namespaceObject.createElement)((external_wp_serverSideRender_default()), {
skipBlockSupportAttributes: true,
block: "core/tag-cloud",
attributes: attributes
}))));
}
/* harmony default export */ const tag_cloud_edit = (TagCloudEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/tag-cloud/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const tag_cloud_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/tag-cloud",
title: "Tag Cloud",
category: "widgets",
description: "A cloud of your most used tags.",
textdomain: "default",
attributes: {
numberOfTags: {
type: "number",
"default": 45,
minimum: 1,
maximum: 100
},
taxonomy: {
type: "string",
"default": "post_tag"
},
showTagCounts: {
type: "boolean",
"default": false
},
smallestFontSize: {
type: "string",
"default": "8pt"
},
largestFontSize: {
type: "string",
"default": "22pt"
}
},
styles: [{
name: "default",
label: "Default",
isDefault: true
}, {
name: "outline",
label: "Outline"
}],
supports: {
html: false,
align: true,
spacing: {
margin: true,
padding: true
},
typography: {
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalLetterSpacing: true
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-tag-cloud-editor"
};
const {
name: tag_cloud_name
} = tag_cloud_metadata;
const tag_cloud_settings = {
icon: library_tag,
example: {},
edit: tag_cloud_edit,
transforms: tag_cloud_transforms
};
const tag_cloud_init = () => initBlock({
name: tag_cloud_name,
metadata: tag_cloud_metadata,
settings: tag_cloud_settings
});
;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
/******************************************************************************
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, SuppressedError, Symbol */
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) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
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 __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
};
function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
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 (g && (g = 0, op[0] && (_ = 0)), _) 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;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (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;
}
/** @deprecated */
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
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 __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
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: false } : 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, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
function next() {
while (env.stack.length) {
var rec = env.stack.pop();
try {
var result = rec.dispose && rec.dispose.call(rec.value);
if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
catch (e) {
fail(e);
}
}
if (env.hasError) throw env.error;
}
return next();
}
/* harmony default export */ const tslib_es6 = ({
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__createBinding,
__exportStar,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
});
;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
/**
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
*/
var SUPPORTED_LOCALE = {
tr: {
regexp: /\u0130|\u0049|\u0049\u0307/g,
map: {
İ: "\u0069",
I: "\u0131",
İ: "\u0069",
},
},
az: {
regexp: /\u0130/g,
map: {
İ: "\u0069",
I: "\u0131",
İ: "\u0069",
},
},
lt: {
regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
map: {
I: "\u0069\u0307",
J: "\u006A\u0307",
Į: "\u012F\u0307",
Ì: "\u0069\u0307\u0300",
Í: "\u0069\u0307\u0301",
Ĩ: "\u0069\u0307\u0303",
},
},
};
/**
* Localized lower case.
*/
function localeLowerCase(str, locale) {
var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
if (lang)
return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
return lowerCase(str);
}
/**
* Lower case as a function.
*/
function lowerCase(str) {
return str.toLowerCase();
}
;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
// Remove all non-word characters.
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
/**
* Normalize the string into something other libraries can manipulate easier.
*/
function noCase(input, options) {
if (options === void 0) { options = {}; }
var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
var start = 0;
var end = result.length;
// Trim the delimiter from around the output string.
while (result.charAt(start) === "\0")
start++;
while (result.charAt(end - 1) === "\0")
end--;
// Transform each token independently.
return result.slice(start, end).split("\0").map(transform).join(delimiter);
}
/**
* Replace `re` in the input string with the replacement value.
*/
function replace(input, re, value) {
if (re instanceof RegExp)
return input.replace(re, value);
return re.reduce(function (input, re) { return input.replace(re, value); }, input);
}
;// CONCATENATED MODULE: ./node_modules/upper-case-first/dist.es2015/index.js
/**
* Upper case the first character of an input string.
*/
function upperCaseFirst(input) {
return input.charAt(0).toUpperCase() + input.substr(1);
}
;// CONCATENATED MODULE: ./node_modules/capital-case/dist.es2015/index.js
function capitalCaseTransform(input) {
return upperCaseFirst(input.toLowerCase());
}
function capitalCase(input, options) {
if (options === void 0) { options = {}; }
return noCase(input, __assign({ delimiter: " ", transform: capitalCaseTransform }, options));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js
/**
* WordPress dependencies
*/
const symbolFilled = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_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-17.6 1L10 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 */ const symbol_filled = (symbolFilled);
;// CONCATENATED MODULE: ./node_modules/dot-case/dist.es2015/index.js
function dotCase(input, options) {
if (options === void 0) { options = {}; }
return noCase(input, __assign({ delimiter: "." }, options));
}
;// CONCATENATED MODULE: ./node_modules/param-case/dist.es2015/index.js
function paramCase(input, options) {
if (options === void 0) { options = {}; }
return dotCase(input, __assign({ delimiter: "-" }, options));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/edit/utils/hooks.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Retrieves the available template parts for the given area.
*
* @param {string} area Template part area.
* @param {string} excludedId Template part ID to exclude.
*
* @return {{ templateParts: Array, isResolving: boolean }} array of template parts.
*/
function useAlternativeTemplateParts(area, excludedId) {
const {
templateParts,
isResolving
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEntityRecords,
isResolving: _isResolving
} = select(external_wp_coreData_namespaceObject.store);
const query = {
per_page: -1
};
return {
templateParts: getEntityRecords('postType', 'wp_template_part', query),
isResolving: _isResolving('getEntityRecords', ['postType', 'wp_template_part', query])
};
}, []);
const filteredTemplateParts = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!templateParts) {
return [];
}
return templateParts.filter(templatePart => createTemplatePartId(templatePart.theme, templatePart.slug) !== excludedId && (!area || 'uncategorized' === area || templatePart.area === area)) || [];
}, [templateParts, area, excludedId]);
return {
templateParts: filteredTemplateParts,
isResolving
};
}
/**
* Retrieves the available block patterns for the given area.
*
* @param {string} area Template part area.
* @param {string} clientId Block Client ID. (The container of the block can impact allowed blocks).
*
* @return {Array} array of block patterns.
*/
function useAlternativeBlockPatterns(area, clientId) {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
const blockNameWithArea = area ? `core/template-part/${area}` : 'core/template-part';
const {
getBlockRootClientId,
getPatternsByBlockTypes
} = select(external_wp_blockEditor_namespaceObject.store);
const rootClientId = getBlockRootClientId(clientId);
return getPatternsByBlockTypes(blockNameWithArea, rootClientId);
}, [area, clientId]);
}
function useCreateTemplatePartFromBlocks(area, setAttributes) {
const {
saveEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
return async (blocks = [], title = (0,external_wp_i18n_namespaceObject.__)('Untitled Template Part')) => {
// Currently template parts only allow latin chars.
// Fallback slug will receive suffix by default.
const cleanSlug = paramCase(title).replace(/[^\w-]+/g, '') || 'wp-custom-part';
// If we have `area` set from block attributes, means an exposed
// block variation was inserted. So add this prop to the template
// part entity on creation. Afterwards remove `area` value from
// block attributes.
const record = {
title,
slug: cleanSlug,
content: (0,external_wp_blocks_namespaceObject.serialize)(blocks),
// `area` is filterable on the server and defaults to `UNCATEGORIZED`
// if provided value is not allowed.
area
};
const templatePart = await saveEntityRecord('postType', 'wp_template_part', record);
setAttributes({
slug: templatePart.slug,
theme: templatePart.theme,
area: undefined
});
};
}
/**
* Retrieves the template part area object.
*
* @param {string} area Template part area identifier.
*
* @return {{icon: Object, label: string, tagName: string}} Template Part area.
*/
function useTemplatePartArea(area) {
return (0,external_wp_data_namespaceObject.useSelect)(select => {
var _selectedArea$area_ta;
// FIXME: @wordpress/block-library should not depend on @wordpress/editor.
// Blocks can be loaded into a *non-post* block editor.
/* eslint-disable @wordpress/data-no-store-string-literals */
const definedAreas = select('core/editor').__experimentalGetDefaultTemplatePartAreas();
/* eslint-enable @wordpress/data-no-store-string-literals */
const selectedArea = definedAreas.find(definedArea => definedArea.area === area);
const defaultArea = definedAreas.find(definedArea => definedArea.area === 'uncategorized');
return {
icon: selectedArea?.icon || defaultArea?.icon,
label: selectedArea?.label || (0,external_wp_i18n_namespaceObject.__)('Template Part'),
tagName: (_selectedArea$area_ta = selectedArea?.area_tag) !== null && _selectedArea$area_ta !== void 0 ? _selectedArea$area_ta : 'div'
};
}, [area]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/edit/title-modal.js
/**
* WordPress dependencies
*/
function TitleModal({
areaLabel,
onClose,
onSubmit
}) {
// Restructure onCreate to set the blocks on local state.
// Add modal to confirm title and trigger onCreate.
const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)((0,external_wp_i18n_namespaceObject.__)('Untitled Template Part'));
const submitForCreation = event => {
event.preventDefault();
onSubmit(title);
};
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.sprintf)(
// Translators: %s as template part area title ("Header", "Footer", etc.).
(0,external_wp_i18n_namespaceObject.__)('Name and create your new %s'), areaLabel.toLowerCase()),
overlayClassName: "wp-block-template-part__placeholder-create-new__title-form",
onRequestClose: onClose
}, (0,external_React_namespaceObject.createElement)("form", {
onSubmit: submitForCreation
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: "5"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Name'),
value: title,
onChange: setTitle
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
justify: "right"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
type: "submit",
disabled: !title.length,
"aria-disabled": !title.length
}, (0,external_wp_i18n_namespaceObject.__)('Create'))))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/edit/placeholder.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function TemplatePartPlaceholder({
area,
clientId,
templatePartId,
onOpenSelectionModal,
setAttributes
}) {
const {
templateParts,
isResolving
} = useAlternativeTemplateParts(area, templatePartId);
const blockPatterns = useAlternativeBlockPatterns(area, clientId);
const [showTitleModal, setShowTitleModal] = (0,external_wp_element_namespaceObject.useState)(false);
const areaObject = useTemplatePartArea(area);
const createFromBlocks = useCreateTemplatePartFromBlocks(area, setAttributes);
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
icon: areaObject.icon,
label: areaObject.label,
instructions: (0,external_wp_i18n_namespaceObject.sprintf)(
// Translators: %s as template part area title ("Header", "Footer", etc.).
(0,external_wp_i18n_namespaceObject.__)('Choose an existing %s or create a new one.'), areaObject.label.toLowerCase())
}, isResolving && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), !isResolving && !!(templateParts.length || blockPatterns.length) && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: onOpenSelectionModal
}, (0,external_wp_i18n_namespaceObject.__)('Choose')), !isResolving && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "secondary",
onClick: () => {
setShowTitleModal(true);
}
}, (0,external_wp_i18n_namespaceObject.__)('Start blank')), showTitleModal && (0,external_React_namespaceObject.createElement)(TitleModal, {
areaLabel: areaObject.label,
onClose: () => setShowTitleModal(false),
onSubmit: title => {
createFromBlocks([], title);
}
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/edit/selection-modal.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function TemplatePartSelectionModal({
setAttributes,
onClose,
templatePartId = null,
area,
clientId
}) {
const [searchValue, setSearchValue] = (0,external_wp_element_namespaceObject.useState)('');
const {
templateParts
} = useAlternativeTemplateParts(area, templatePartId);
// We can map template parts to block patters to reuse the BlockPatternsList UI
const filteredTemplateParts = (0,external_wp_element_namespaceObject.useMemo)(() => {
const partsAsPatterns = templateParts.map(templatePart => ({
name: createTemplatePartId(templatePart.theme, templatePart.slug),
title: templatePart.title.rendered,
blocks: (0,external_wp_blocks_namespaceObject.parse)(templatePart.content.raw),
templatePart
}));
return searchPatterns(partsAsPatterns, searchValue);
}, [templateParts, searchValue]);
const shownTemplateParts = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredTemplateParts);
const blockPatterns = useAlternativeBlockPatterns(area, clientId);
const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => {
return searchPatterns(blockPatterns, searchValue);
}, [blockPatterns, searchValue]);
const shownBlockPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredBlockPatterns);
const {
createSuccessNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const onTemplatePartSelect = templatePart => {
setAttributes({
slug: templatePart.slug,
theme: templatePart.theme,
area: undefined
});
createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: template part title. */
(0,external_wp_i18n_namespaceObject.__)('Template Part "%s" inserted.'), templatePart.title?.rendered || templatePart.slug), {
type: 'snackbar'
});
onClose();
};
const createFromBlocks = useCreateTemplatePartFromBlocks(area, setAttributes);
const hasTemplateParts = !!filteredTemplateParts.length;
const hasBlockPatterns = !!filteredBlockPatterns.length;
return (0,external_React_namespaceObject.createElement)("div", {
className: "block-library-template-part__selection-content"
}, (0,external_React_namespaceObject.createElement)("div", {
className: "block-library-template-part__selection-search"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, {
__nextHasNoMarginBottom: true,
onChange: setSearchValue,
value: searchValue,
label: (0,external_wp_i18n_namespaceObject.__)('Search for replacements'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Search')
})), hasTemplateParts && (0,external_React_namespaceObject.createElement)("div", null, (0,external_React_namespaceObject.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Existing template parts')), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
blockPatterns: filteredTemplateParts,
shownPatterns: shownTemplateParts,
onClickPattern: pattern => {
onTemplatePartSelect(pattern.templatePart);
}
})), hasBlockPatterns && (0,external_React_namespaceObject.createElement)("div", null, (0,external_React_namespaceObject.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Patterns')), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
blockPatterns: filteredBlockPatterns,
shownPatterns: shownBlockPatterns,
onClickPattern: (pattern, blocks) => {
createFromBlocks(blocks, pattern.title);
onClose();
}
})), !hasTemplateParts && !hasBlockPatterns && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
alignment: "center"
}, (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No results found.'))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/edit/utils/transformers.js
/**
* WordPress dependencies
*/
/**
* Converts a widget entity record into a block.
*
* @param {Object} widget The widget entity record.
* @return {Object} a block (converted from the entity record).
*/
function transformWidgetToBlock(widget) {
if (widget.id_base !== 'block') {
let attributes;
if (widget._embedded.about[0].is_multi) {
attributes = {
idBase: widget.id_base,
instance: widget.instance
};
} else {
attributes = {
id: widget.id
};
}
return switchLegacyWidgetType((0,external_wp_blocks_namespaceObject.createBlock)('core/legacy-widget', attributes));
}
const parsedBlocks = (0,external_wp_blocks_namespaceObject.parse)(widget.instance.raw.content, {
__unstableSkipAutop: true
});
if (!parsedBlocks.length) {
return undefined;
}
const block = parsedBlocks[0];
if (block.name === 'core/widget-group') {
return (0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getGroupingBlockName)(), undefined, transformInnerBlocks(block.innerBlocks));
}
if (block.innerBlocks.length > 0) {
return (0,external_wp_blocks_namespaceObject.cloneBlock)(block, undefined, transformInnerBlocks(block.innerBlocks));
}
return block;
}
/**
* Switch Legacy Widget to the first matching transformation block.
*
* @param {Object} block Legacy Widget block object
* @return {Object|undefined} a block
*/
function switchLegacyWidgetType(block) {
const transforms = (0,external_wp_blocks_namespaceObject.getPossibleBlockTransformations)([block]).filter(item => {
// The block without any transformations can't be a wildcard.
if (!item.transforms) {
return true;
}
const hasWildCardFrom = item.transforms?.from?.find(from => from.blocks && from.blocks.includes('*'));
const hasWildCardTo = item.transforms?.to?.find(to => to.blocks && to.blocks.includes('*'));
// Skip wildcard transformations.
return !hasWildCardFrom && !hasWildCardTo;
});
if (!transforms.length) {
return undefined;
}
return (0,external_wp_blocks_namespaceObject.switchToBlockType)(block, transforms[0].name);
}
function transformInnerBlocks(innerBlocks = []) {
return innerBlocks.flatMap(block => {
if (block.name === 'core/legacy-widget') {
return switchLegacyWidgetType(block);
}
return (0,external_wp_blocks_namespaceObject.createBlock)(block.name, block.attributes, transformInnerBlocks(block.innerBlocks));
}).filter(block => !!block);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/edit/import-controls.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const SIDEBARS_QUERY = {
per_page: -1,
_fields: 'id,name,description,status,widgets'
};
function TemplatePartImportControls({
area,
setAttributes
}) {
const [selectedSidebar, setSelectedSidebar] = (0,external_wp_element_namespaceObject.useState)('');
const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
sidebars,
hasResolved
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSidebars,
hasFinishedResolution
} = select(external_wp_coreData_namespaceObject.store);
return {
sidebars: getSidebars(SIDEBARS_QUERY),
hasResolved: hasFinishedResolution('getSidebars', [SIDEBARS_QUERY])
};
}, []);
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
const createFromBlocks = useCreateTemplatePartFromBlocks(area, setAttributes);
const options = (0,external_wp_element_namespaceObject.useMemo)(() => {
const sidebarOptions = (sidebars !== null && sidebars !== void 0 ? sidebars : []).filter(widgetArea => widgetArea.id !== 'wp_inactive_widgets' && widgetArea.widgets.length > 0).map(widgetArea => {
return {
value: widgetArea.id,
label: widgetArea.name
};
});
if (!sidebarOptions.length) {
return [];
}
return [{
value: '',
label: (0,external_wp_i18n_namespaceObject.__)('Select widget area')
}, ...sidebarOptions];
}, [sidebars]);
// Render an empty node while data is loading to avoid SlotFill re-positioning bug.
// See: https://github.com/WordPress/gutenberg/issues/15641.
if (!hasResolved) {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
marginBottom: "0"
});
}
if (hasResolved && !options.length) {
return null;
}
async function createFromWidgets(event) {
event.preventDefault();
if (isBusy || !selectedSidebar) {
return;
}
setIsBusy(true);
const sidebar = options.find(({
value
}) => value === selectedSidebar);
const {
getWidgets
} = registry.resolveSelect(external_wp_coreData_namespaceObject.store);
// The widgets API always returns a successful response.
const widgets = await getWidgets({
sidebar: sidebar.value,
_embed: 'about'
});
const skippedWidgets = new Set();
const blocks = widgets.flatMap(widget => {
const block = transformWidgetToBlock(widget);
// Skip the block if we have no matching transformations.
if (!block) {
skippedWidgets.add(widget.id_base);
return [];
}
return block;
});
await createFromBlocks(blocks, /* translators: %s: name of the widget area */
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Widget area: %s'), sidebar.label));
if (skippedWidgets.size) {
createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the list of widgets */
(0,external_wp_i18n_namespaceObject.__)('Unable to import the following widgets: %s.'), Array.from(skippedWidgets).join(', ')), {
type: 'snackbar'
});
}
setIsBusy(false);
}
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
marginBottom: "4"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
as: "form",
onSubmit: createFromWidgets
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Import widget area'),
value: selectedSidebar,
options: options,
onChange: value => setSelectedSidebar(value),
disabled: !options.length,
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
style: {
marginBottom: '8px',
marginTop: 'auto'
}
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
__next40pxDefaultSize: true,
variant: "primary",
type: "submit",
isBusy: isBusy,
"aria-disabled": isBusy || !selectedSidebar
}, (0,external_wp_i18n_namespaceObject._x)('Import', 'button label')))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/edit/advanced-controls.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const htmlElementMessages = {
header: (0,external_wp_i18n_namespaceObject.__)('The <header> element should represent introductory content, typically a group of introductory or navigational aids.'),
main: (0,external_wp_i18n_namespaceObject.__)('The <main> element should be used for the primary content of your document only.'),
section: (0,external_wp_i18n_namespaceObject.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element."),
article: (0,external_wp_i18n_namespaceObject.__)('The <article> element should represent a self-contained, syndicatable portion of the document.'),
aside: (0,external_wp_i18n_namespaceObject.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."),
footer: (0,external_wp_i18n_namespaceObject.__)('The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).')
};
function TemplatePartAdvancedControls({
tagName,
setAttributes,
isEntityAvailable,
templatePartId,
defaultWrapper,
hasInnerBlocks
}) {
const [area, setArea] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', 'wp_template_part', 'area', templatePartId);
const [title, setTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', 'wp_template_part', 'title', templatePartId);
const definedAreas = (0,external_wp_data_namespaceObject.useSelect)(select => {
// FIXME: @wordpress/block-library should not depend on @wordpress/editor.
// Blocks can be loaded into a *non-post* block editor.
/* eslint-disable-next-line @wordpress/data-no-store-string-literals */
return select('core/editor').__experimentalGetDefaultTemplatePartAreas();
}, []);
const areaOptions = definedAreas.map(({
label,
area: _area
}) => ({
label,
value: _area
}));
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, isEntityAvailable && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Title'),
value: title,
onChange: value => {
setTitle(value);
},
onFocus: event => event.target.select()
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Area'),
labelPosition: "top",
options: areaOptions,
value: area,
onChange: setArea
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('HTML element'),
options: [{
label: (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: HTML tag based on area. */
(0,external_wp_i18n_namespaceObject.__)('Default based on area (%s)'), `<${defaultWrapper}>`),
value: ''
}, {
label: '<header>',
value: 'header'
}, {
label: '<main>',
value: 'main'
}, {
label: '<section>',
value: 'section'
}, {
label: '<article>',
value: 'article'
}, {
label: '<aside>',
value: 'aside'
}, {
label: '<footer>',
value: 'footer'
}, {
label: '<div>',
value: 'div'
}],
value: tagName || '',
onChange: value => setAttributes({
tagName: value
}),
help: htmlElementMessages[tagName]
}), !hasInnerBlocks && (0,external_React_namespaceObject.createElement)(TemplatePartImportControls, {
area: area,
setAttributes: setAttributes
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/edit/inner-blocks.js
/**
* WordPress dependencies
*/
function TemplatePartInnerBlocks({
postId: id,
hasInnerBlocks,
layout,
tagName: TagName,
blockProps
}) {
const themeSupportsLayout = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getSettings
} = select(external_wp_blockEditor_namespaceObject.store);
return getSettings()?.supportsLayout;
}, []);
const [defaultLayout] = (0,external_wp_blockEditor_namespaceObject.useSettings)('layout');
const usedLayout = layout?.inherit ? defaultLayout || {} : layout;
const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', 'wp_template_part', {
id
});
const innerBlocksProps = (0,external_wp_blockEditor_namespaceObject.useInnerBlocksProps)(blockProps, {
value: blocks,
onInput,
onChange,
renderAppender: hasInnerBlocks ? undefined : external_wp_blockEditor_namespaceObject.InnerBlocks.ButtonBlockAppender,
layout: themeSupportsLayout ? usedLayout : undefined
});
return (0,external_React_namespaceObject.createElement)(TagName, {
...innerBlocksProps
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/edit/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ReplaceButton({
isEntityAvailable,
area,
clientId,
templatePartId,
isTemplatePartSelectionOpen,
setIsTemplatePartSelectionOpen
}) {
const {
templateParts
} = useAlternativeTemplateParts(area, templatePartId);
const blockPatterns = useAlternativeBlockPatterns(area, clientId);
const hasReplacements = !!templateParts.length || !!blockPatterns.length;
const canReplace = isEntityAvailable && hasReplacements && (area === 'header' || area === 'footer');
if (!canReplace) {
return null;
}
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
onClick: () => {
setIsTemplatePartSelectionOpen(true);
},
"aria-expanded": isTemplatePartSelectionOpen,
"aria-haspopup": "dialog"
}, (0,external_wp_i18n_namespaceObject.__)('Replace'));
}
function TemplatePartEdit({
attributes,
setAttributes,
clientId
}) {
const currentTheme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getCurrentTheme()?.stylesheet, []);
const {
slug,
theme = currentTheme,
tagName,
layout = {}
} = attributes;
const templatePartId = createTemplatePartId(theme, slug);
const hasAlreadyRendered = (0,external_wp_blockEditor_namespaceObject.useHasRecursion)(templatePartId);
const [isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen] = (0,external_wp_element_namespaceObject.useState)(false);
const {
isResolved,
hasInnerBlocks,
isMissing,
area
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditedEntityRecord,
hasFinishedResolution
} = select(external_wp_coreData_namespaceObject.store);
const {
getBlockCount
} = select(external_wp_blockEditor_namespaceObject.store);
const getEntityArgs = ['postType', 'wp_template_part', templatePartId];
const entityRecord = templatePartId ? getEditedEntityRecord(...getEntityArgs) : null;
const _area = entityRecord?.area || attributes.area;
const hasResolvedEntity = templatePartId ? hasFinishedResolution('getEditedEntityRecord', getEntityArgs) : false;
return {
hasInnerBlocks: getBlockCount(clientId) > 0,
isResolved: hasResolvedEntity,
isMissing: hasResolvedEntity && (!entityRecord || Object.keys(entityRecord).length === 0),
area: _area
};
}, [templatePartId, attributes.area, clientId]);
const areaObject = useTemplatePartArea(area);
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
const isPlaceholder = !slug;
const isEntityAvailable = !isPlaceholder && !isMissing && isResolved;
const TagName = tagName || areaObject.tagName;
// We don't want to render a missing state if we have any inner blocks.
// A new template part is automatically created if we have any inner blocks but no entity.
if (!hasInnerBlocks && (slug && !theme || slug && isMissing)) {
return (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Template part slug */
(0,external_wp_i18n_namespaceObject.__)('Template part has been deleted or is unavailable: %s'), slug)));
}
if (isEntityAvailable && hasAlreadyRendered) {
return (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, null, (0,external_wp_i18n_namespaceObject.__)('Block cannot be rendered inside itself.')));
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RecursionProvider, {
uniqueId: templatePartId
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, {
group: "advanced"
}, (0,external_React_namespaceObject.createElement)(TemplatePartAdvancedControls, {
tagName: tagName,
setAttributes: setAttributes,
isEntityAvailable: isEntityAvailable,
templatePartId: templatePartId,
defaultWrapper: areaObject.tagName,
hasInnerBlocks: hasInnerBlocks
})), isPlaceholder && (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(TemplatePartPlaceholder, {
area: attributes.area,
templatePartId: templatePartId,
clientId: clientId,
setAttributes: setAttributes,
onOpenSelectionModal: () => setIsTemplatePartSelectionOpen(true)
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, ({
selectedClientIds
}) => {
// Only enable for single selection that matches the current block.
// Ensures menu item doesn't render multiple times.
if (!(selectedClientIds.length === 1 && clientId === selectedClientIds[0])) {
return null;
}
return (0,external_React_namespaceObject.createElement)(ReplaceButton, {
isEntityAvailable,
area,
clientId,
templatePartId,
isTemplatePartSelectionOpen,
setIsTemplatePartSelectionOpen
});
}), isEntityAvailable && (0,external_React_namespaceObject.createElement)(TemplatePartInnerBlocks, {
tagName: TagName,
blockProps: blockProps,
postId: templatePartId,
hasInnerBlocks: hasInnerBlocks,
layout: layout
}), !isPlaceholder && !isResolved && (0,external_React_namespaceObject.createElement)(TagName, {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null))), isTemplatePartSelectionOpen && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
overlayClassName: "block-editor-template-part__selection-modal",
title: (0,external_wp_i18n_namespaceObject.sprintf)(
// Translators: %s as template part area title ("Header", "Footer", etc.).
(0,external_wp_i18n_namespaceObject.__)('Choose a %s'), areaObject.label.toLowerCase()),
onRequestClose: () => setIsTemplatePartSelectionOpen(false),
isFullScreen: true
}, (0,external_React_namespaceObject.createElement)(TemplatePartSelectionModal, {
templatePartId: templatePartId,
clientId: clientId,
area: area,
setAttributes: setAttributes,
onClose: () => setIsTemplatePartSelectionOpen(false)
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/header.js
/**
* WordPress dependencies
*/
const header = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M18.5 10.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 */ const library_header = (header);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/footer.js
/**
* WordPress dependencies
*/
const footer = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
}));
/* harmony default export */ const library_footer = (footer);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sidebar.js
/**
* WordPress dependencies
*/
const sidebar = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_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.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
}));
/* harmony default export */ const library_sidebar = (sidebar);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/variations.js
/**
* WordPress dependencies
*/
function getTemplatePartIcon(iconName) {
if ('header' === iconName) {
return library_header;
} else if ('footer' === iconName) {
return library_footer;
} else if ('sidebar' === iconName) {
return library_sidebar;
}
return symbol_filled;
}
function enhanceTemplatePartVariations(settings, name) {
if (name !== 'core/template-part') {
return settings;
}
if (settings.variations) {
const isActive = (blockAttributes, variationAttributes) => {
const {
area,
theme,
slug
} = blockAttributes;
// We first check the `area` block attribute which is set during insertion.
// This property is removed on the creation of a template part.
if (area) return area === variationAttributes.area;
// Find a matching variation from the created template part
// by checking the entity's `area` property.
if (!slug) return false;
const {
getCurrentTheme,
getEntityRecord
} = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store);
const entity = getEntityRecord('postType', 'wp_template_part', `${theme || getCurrentTheme()?.stylesheet}//${slug}`);
if (entity?.slug) {
return entity.slug === variationAttributes.slug;
}
return entity?.area === variationAttributes.area;
};
const variations = settings.variations.map(variation => {
return {
...variation,
...(!variation.isActive && {
isActive
}),
...(typeof variation.icon === 'string' && {
icon: getTemplatePartIcon(variation.icon)
})
};
});
return {
...settings,
variations
};
}
return settings;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/template-part/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const template_part_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/template-part",
title: "Template Part",
category: "theme",
description: "Edit the different global regions of your site, like the header, footer, sidebar, or create your own.",
textdomain: "default",
attributes: {
slug: {
type: "string"
},
theme: {
type: "string"
},
tagName: {
type: "string"
},
area: {
type: "string"
}
},
supports: {
align: true,
html: false,
reusable: false,
renaming: false,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-template-part-editor"
};
const {
name: template_part_name
} = template_part_metadata;
const template_part_settings = {
icon: symbol_filled,
__experimentalLabel: ({
slug,
theme
}) => {
// Attempt to find entity title if block is a template part.
// Require slug to request, otherwise entity is uncreated and will throw 404.
if (!slug) {
return;
}
const {
getCurrentTheme,
getEditedEntityRecord
} = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store);
const entity = getEditedEntityRecord('postType', 'wp_template_part', (theme || getCurrentTheme()?.stylesheet) + '//' + slug);
if (!entity) {
return;
}
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entity.title) || capitalCase(entity.slug || '');
},
edit: TemplatePartEdit
};
const template_part_init = () => {
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/template-part', enhanceTemplatePartVariations);
// Prevent adding template parts inside post templates.
const DISALLOWED_PARENTS = ['core/post-template', 'core/post-content'];
(0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'core/block-library/removeTemplatePartsFromPostTemplates', (canInsert, blockType, rootClientId, {
getBlock,
getBlockParentsByBlockName
}) => {
if (blockType.name !== 'core/template-part') {
return canInsert;
}
for (const disallowedParentType of DISALLOWED_PARENTS) {
const hasDisallowedParent = getBlock(rootClientId)?.name === disallowedParentType || getBlockParentsByBlockName(rootClientId, disallowedParentType).length;
if (hasDisallowedParent) {
return false;
}
}
return true;
});
return initBlock({
name: template_part_name,
metadata: template_part_metadata,
settings: template_part_settings
});
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/term-description.js
/**
* WordPress dependencies
*/
const term_description_tag = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M6.08 10.103h2.914L9.657 12h1.417L8.23 4H6.846L4 12h1.417l.663-1.897Zm1.463-4.137.994 2.857h-2l1.006-2.857ZM11 16H4v-1.5h7V16Zm1 0h8v-1.5h-8V16Zm-4 4H4v-1.5h4V20Zm7-1.5V20H9v-1.5h6Z"
}));
/* harmony default export */ const term_description = (term_description_tag);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/term-description/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function TermDescriptionEdit({
attributes,
setAttributes,
mergedStyle
}) {
const {
textAlign
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
}),
style: mergedStyle
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "block"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentControl, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-term-description__placeholder"
}, (0,external_React_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Term Description')))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/term-description/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const term_description_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/term-description",
title: "Term Description",
category: "theme",
description: "Display the description of categories, tags and custom taxonomies when viewing an archive.",
textdomain: "default",
attributes: {
textAlign: {
type: "string"
}
},
supports: {
align: ["wide", "full"],
html: false,
color: {
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
padding: true,
margin: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
}
};
const {
name: term_description_name
} = term_description_metadata;
const term_description_settings = {
icon: term_description,
edit: TermDescriptionEdit
};
const term_description_init = () => initBlock({
name: term_description_name,
metadata: term_description_metadata,
settings: term_description_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/text-columns/edit.js
/**
* WordPress dependencies
*/
function TextColumnsEdit({
attributes,
setAttributes
}) {
const {
width,
content,
columns
} = attributes;
external_wp_deprecated_default()('The Text Columns block', {
since: '5.3',
alternative: 'the Columns block'
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar, {
value: width,
onChange: nextWidth => setAttributes({
width: nextWidth
}),
controls: ['center', 'wide', 'full']
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
label: (0,external_wp_i18n_namespaceObject.__)('Columns'),
value: columns,
onChange: value => setAttributes({
columns: value
}),
min: 2,
max: 4,
required: true
}))), (0,external_React_namespaceObject.createElement)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: `align${width} columns-${columns}`
})
}, Array.from({
length: columns
}).map((_, index) => {
return (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-column",
key: `column-${index}`
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: "p",
value: content?.[index]?.children,
onChange: nextContent => {
setAttributes({
content: [...content.slice(0, index), {
children: nextContent
}, ...content.slice(index + 1)]
});
},
"aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %d: column index (starting with 1)
(0,external_wp_i18n_namespaceObject.__)('Column %d text'), index + 1),
placeholder: (0,external_wp_i18n_namespaceObject.__)('New Column')
}));
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/text-columns/save.js
/**
* WordPress dependencies
*/
function text_columns_save_save({
attributes
}) {
const {
width,
content,
columns
} = attributes;
return (0,external_React_namespaceObject.createElement)("div", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className: `align${width} columns-${columns}`
})
}, Array.from({
length: columns
}).map((_, index) => (0,external_React_namespaceObject.createElement)("div", {
className: "wp-block-column",
key: `column-${index}`
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "p",
value: content?.[index]?.children
}))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/text-columns/transforms.js
/**
* WordPress dependencies
*/
const text_columns_transforms_transforms = {
to: [{
type: 'block',
blocks: ['core/columns'],
transform: ({
className,
columns,
content,
width
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/columns', {
align: 'wide' === width || 'full' === width ? width : undefined,
className,
columns
}, content.map(({
children
}) => (0,external_wp_blocks_namespaceObject.createBlock)('core/column', {}, [(0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', {
content: children
})])))
}]
};
/* harmony default export */ const text_columns_transforms = (text_columns_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/text-columns/index.js
/**
* Internal dependencies
*/
const text_columns_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/text-columns",
title: "Text Columns (deprecated)",
icon: "columns",
category: "design",
description: "This block is deprecated. Please use the Columns block instead.",
textdomain: "default",
attributes: {
content: {
type: "array",
source: "query",
selector: "p",
query: {
children: {
type: "string",
source: "html"
}
},
"default": [{}, {}]
},
columns: {
type: "number",
"default": 2
},
width: {
type: "string"
}
},
supports: {
inserter: false,
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-text-columns-editor",
style: "wp-block-text-columns"
};
const {
name: text_columns_name
} = text_columns_metadata;
const text_columns_settings = {
transforms: text_columns_transforms,
getEditWrapperProps(attributes) {
const {
width
} = attributes;
if ('wide' === width || 'full' === width) {
return {
'data-align': width
};
}
},
edit: TextColumnsEdit,
save: text_columns_save_save
};
const text_columns_init = () => initBlock({
name: text_columns_name,
metadata: text_columns_metadata,
settings: text_columns_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/verse.js
/**
* WordPress dependencies
*/
const verse = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"
}));
/* harmony default export */ const library_verse = (verse);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/verse/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const verse_deprecated_v1 = {
attributes: {
content: {
type: 'string',
source: 'html',
selector: 'pre',
default: ''
},
textAlign: {
type: 'string'
}
},
save({
attributes
}) {
const {
textAlign,
content
} = attributes;
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "pre",
style: {
textAlign
},
value: content
});
}
};
const verse_deprecated_v2 = {
attributes: {
content: {
type: 'string',
source: 'html',
selector: 'pre',
default: '',
__unstablePreserveWhiteSpace: true,
__experimentalRole: 'content'
},
textAlign: {
type: 'string'
}
},
supports: {
anchor: true,
color: {
gradients: true,
link: true
},
typography: {
fontSize: true,
__experimentalFontFamily: true
},
spacing: {
padding: true
}
},
save({
attributes
}) {
const {
textAlign,
content
} = attributes;
const className = classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
});
return (0,external_React_namespaceObject.createElement)("pre", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: content
}));
},
migrate: migrate_font_family,
isEligible({
style
}) {
return style?.typography?.fontFamily;
}
};
/**
* New deprecations need to be placed first
* for them to have higher priority.
*
* Old deprecations may need to be updated as well.
*
* See block-deprecation.md
*/
/* harmony default export */ const verse_deprecated = ([verse_deprecated_v2, verse_deprecated_v1]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/verse/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function VerseEdit({
attributes,
setAttributes,
mergeBlocks,
onRemove,
insertBlocksAfter,
style
}) {
const {
textAlign,
content
} = attributes;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
}),
style
});
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.AlignmentToolbar, {
value: textAlign,
onChange: nextAlign => {
setAttributes({
textAlign: nextAlign
});
}
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
tagName: "pre",
identifier: "content",
preserveWhiteSpace: true,
value: content,
onChange: nextContent => {
setAttributes({
content: nextContent
});
},
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Verse text'),
placeholder: (0,external_wp_i18n_namespaceObject.__)('Write verse…'),
onRemove: onRemove,
onMerge: mergeBlocks,
textAlign: textAlign,
...blockProps,
__unstablePastePlainText: true,
__unstableOnSplitAtDoubleLineEnd: () => insertBlocksAfter((0,external_wp_blocks_namespaceObject.createBlock)((0,external_wp_blocks_namespaceObject.getDefaultBlockName)()))
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/verse/save.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function verse_save_save({
attributes
}) {
const {
textAlign,
content
} = attributes;
const className = classnames_default()({
[`has-text-align-${textAlign}`]: textAlign
});
return (0,external_React_namespaceObject.createElement)("pre", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save({
className
})
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
value: content
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/verse/transforms.js
/**
* WordPress dependencies
*/
const verse_transforms_transforms = {
from: [{
type: 'block',
blocks: ['core/paragraph'],
transform: attributes => (0,external_wp_blocks_namespaceObject.createBlock)('core/verse', attributes)
}],
to: [{
type: 'block',
blocks: ['core/paragraph'],
transform: attributes => (0,external_wp_blocks_namespaceObject.createBlock)('core/paragraph', attributes)
}]
};
/* harmony default export */ const verse_transforms = (verse_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/verse/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const verse_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/verse",
title: "Verse",
category: "text",
description: "Insert poetry. Use special spacing formats. Or quote song lyrics.",
keywords: ["poetry", "poem"],
textdomain: "default",
attributes: {
content: {
type: "rich-text",
source: "rich-text",
selector: "pre",
__unstablePreserveWhiteSpace: true,
__experimentalRole: "content"
},
textAlign: {
type: "string"
}
},
supports: {
anchor: true,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
typography: {
fontSize: true,
__experimentalFontFamily: true,
lineHeight: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalDefaultControls: {
fontSize: true
}
},
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
__experimentalBorder: {
radius: true,
width: true,
color: true,
style: true
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-verse",
editorStyle: "wp-block-verse-editor"
};
const {
name: verse_name
} = verse_metadata;
const verse_settings = {
icon: library_verse,
example: {
attributes: {
/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */
// translators: Sample content for the Verse block. Can be replaced with a more locale-adequate work.
content: (0,external_wp_i18n_namespaceObject.__)('WHAT was he doing, the great god Pan,\n Down in the reeds by the river?\nSpreading ruin and scattering ban,\nSplashing and paddling with hoofs of a goat,\nAnd breaking the golden lilies afloat\n With the dragon-fly on the river.')
/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */
}
},
transforms: verse_transforms,
deprecated: verse_deprecated,
merge(attributes, attributesToMerge) {
return {
content: attributes.content + '\n\n' + attributesToMerge.content
};
},
edit: VerseEdit,
save: verse_save_save
};
const verse_init = () => initBlock({
name: verse_name,
metadata: verse_metadata,
settings: verse_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/video.js
/**
* WordPress dependencies
*/
const video = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_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 */ const library_video = (video);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/video/tracks.js
function Tracks({
tracks = []
}) {
return tracks.map(track => {
return (0,external_React_namespaceObject.createElement)("track", {
key: track.src,
...track
});
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/video/deprecated.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const video_deprecated_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/video",
title: "Video",
category: "media",
description: "Embed a video from your media library or upload a new one.",
keywords: ["movie"],
textdomain: "default",
attributes: {
autoplay: {
type: "boolean",
source: "attribute",
selector: "video",
attribute: "autoplay"
},
caption: {
type: "rich-text",
source: "rich-text",
selector: "figcaption",
__experimentalRole: "content"
},
controls: {
type: "boolean",
source: "attribute",
selector: "video",
attribute: "controls",
"default": true
},
id: {
type: "number",
__experimentalRole: "content"
},
loop: {
type: "boolean",
source: "attribute",
selector: "video",
attribute: "loop"
},
muted: {
type: "boolean",
source: "attribute",
selector: "video",
attribute: "muted"
},
poster: {
type: "string",
source: "attribute",
selector: "video",
attribute: "poster"
},
preload: {
type: "string",
source: "attribute",
selector: "video",
attribute: "preload",
"default": "metadata"
},
src: {
type: "string",
source: "attribute",
selector: "video",
attribute: "src",
__experimentalRole: "content"
},
playsInline: {
type: "boolean",
source: "attribute",
selector: "video",
attribute: "playsinline"
},
tracks: {
__experimentalRole: "content",
type: "array",
items: {
type: "object"
},
"default": []
}
},
supports: {
anchor: true,
align: true,
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-video-editor",
style: "wp-block-video"
};
const {
attributes: video_deprecated_blockAttributes
} = video_deprecated_metadata;
// In #41140 support was added to global styles for caption elements which added a `wp-element-caption` classname
// to the video figcaption element.
const video_deprecated_v1 = {
attributes: video_deprecated_blockAttributes,
save({
attributes
}) {
const {
autoplay,
caption,
controls,
loop,
muted,
poster,
preload,
src,
playsInline,
tracks
} = attributes;
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, src && (0,external_React_namespaceObject.createElement)("video", {
autoPlay: autoplay,
controls: controls,
loop: loop,
muted: muted,
poster: poster,
preload: preload !== 'metadata' ? preload : undefined,
src: src,
playsInline: playsInline
}, (0,external_React_namespaceObject.createElement)(Tracks, {
tracks: tracks
})), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
tagName: "figcaption",
value: caption
}));
}
};
const video_deprecated_deprecated = [video_deprecated_v1];
/* harmony default export */ const video_deprecated = (video_deprecated_deprecated);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/video/edit-common-settings.js
/**
* WordPress dependencies
*/
const options = [{
value: 'auto',
label: (0,external_wp_i18n_namespaceObject.__)('Auto')
}, {
value: 'metadata',
label: (0,external_wp_i18n_namespaceObject.__)('Metadata')
}, {
value: 'none',
label: (0,external_wp_i18n_namespaceObject._x)('None', 'Preload value')
}];
const VideoSettings = ({
setAttributes,
attributes
}) => {
const {
autoplay,
controls,
loop,
muted,
playsInline,
preload
} = attributes;
const autoPlayHelpText = (0,external_wp_i18n_namespaceObject.__)('Autoplay may cause usability issues for some users.');
const getAutoplayHelp = external_wp_element_namespaceObject.Platform.select({
web: (0,external_wp_element_namespaceObject.useCallback)(checked => {
return checked ? autoPlayHelpText : null;
}, []),
native: autoPlayHelpText
});
const toggleFactory = (0,external_wp_element_namespaceObject.useMemo)(() => {
const toggleAttribute = attribute => {
return newValue => {
setAttributes({
[attribute]: newValue
});
};
};
return {
autoplay: toggleAttribute('autoplay'),
loop: toggleAttribute('loop'),
muted: toggleAttribute('muted'),
controls: toggleAttribute('controls'),
playsInline: toggleAttribute('playsInline')
};
}, []);
const onChangePreload = (0,external_wp_element_namespaceObject.useCallback)(value => {
setAttributes({
preload: value
});
}, []);
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Autoplay'),
onChange: toggleFactory.autoplay,
checked: !!autoplay,
help: getAutoplayHelp
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Loop'),
onChange: toggleFactory.loop,
checked: !!loop
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Muted'),
onChange: toggleFactory.muted,
checked: !!muted
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Playback controls'),
onChange: toggleFactory.controls,
checked: !!controls
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Play inline'),
onChange: toggleFactory.playsInline,
checked: !!playsInline
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Preload'),
value: preload,
onChange: onChangePreload,
options: options,
hideCancelButton: true
}));
};
/* harmony default export */ const edit_common_settings = (VideoSettings);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/video/tracks-editor.js
/**
* WordPress dependencies
*/
const ALLOWED_TYPES = ['text/vtt'];
const DEFAULT_KIND = 'subtitles';
const KIND_OPTIONS = [{
label: (0,external_wp_i18n_namespaceObject.__)('Subtitles'),
value: 'subtitles'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Captions'),
value: 'captions'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Descriptions'),
value: 'descriptions'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Chapters'),
value: 'chapters'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Metadata'),
value: 'metadata'
}];
function TrackList({
tracks,
onEditPress
}) {
let content;
if (tracks.length === 0) {
content = (0,external_React_namespaceObject.createElement)("p", {
className: "block-library-video-tracks-editor__tracks-informative-message"
}, (0,external_wp_i18n_namespaceObject.__)('Tracks can be subtitles, captions, chapters, or descriptions. They help make your content more accessible to a wider range of users.'));
} else {
content = tracks.map((track, index) => {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
key: index,
className: "block-library-video-tracks-editor__track-list-track"
}, (0,external_React_namespaceObject.createElement)("span", null, track.label, " "), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "tertiary",
onClick: () => onEditPress(index),
"aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: Label of the video text track e.g: "French subtitles" */
(0,external_wp_i18n_namespaceObject.__)('Edit %s'), track.label)
}, (0,external_wp_i18n_namespaceObject.__)('Edit')));
});
}
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Text tracks'),
className: "block-library-video-tracks-editor__track-list"
}, content);
}
function SingleTrackEditor({
track,
onChange,
onClose,
onRemove
}) {
const {
src = '',
label = '',
srcLang = '',
kind = DEFAULT_KIND
} = track;
const fileName = src.startsWith('blob:') ? '' : (0,external_wp_url_namespaceObject.getFilename)(src) || '';
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.NavigableMenu, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
className: "block-library-video-tracks-editor__single-track-editor",
spacing: "4"
}, (0,external_React_namespaceObject.createElement)("span", {
className: "block-library-video-tracks-editor__single-track-editor-edit-track-label"
}, (0,external_wp_i18n_namespaceObject.__)('Edit track')), (0,external_React_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('File'), ": ", (0,external_React_namespaceObject.createElement)("b", null, fileName)), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalGrid, {
columns: 2,
gap: 4
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true
/* eslint-disable jsx-a11y/no-autofocus */,
autoFocus: true
/* eslint-enable jsx-a11y/no-autofocus */,
onChange: newLabel => onChange({
...track,
label: newLabel
}),
label: (0,external_wp_i18n_namespaceObject.__)('Label'),
value: label,
help: (0,external_wp_i18n_namespaceObject.__)('Title of track')
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
__nextHasNoMarginBottom: true,
onChange: newSrcLang => onChange({
...track,
srcLang: newSrcLang
}),
label: (0,external_wp_i18n_namespaceObject.__)('Source language'),
value: srcLang,
help: (0,external_wp_i18n_namespaceObject.__)('Language tag (en, fr, etc.)')
})), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
spacing: "8"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
className: "block-library-video-tracks-editor__single-track-editor-kind-select",
options: KIND_OPTIONS,
value: kind,
label: (0,external_wp_i18n_namespaceObject.__)('Kind'),
onChange: newKind => {
onChange({
...track,
kind: newKind
});
}
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
className: "block-library-video-tracks-editor__single-track-editor-buttons-container"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "secondary",
onClick: () => {
const changes = {};
let hasChanges = false;
if (label === '') {
changes.label = (0,external_wp_i18n_namespaceObject.__)('English');
hasChanges = true;
}
if (srcLang === '') {
changes.srcLang = 'en';
hasChanges = true;
}
if (track.kind === undefined) {
changes.kind = DEFAULT_KIND;
hasChanges = true;
}
if (hasChanges) {
onChange({
...track,
...changes
});
}
onClose();
}
}, (0,external_wp_i18n_namespaceObject.__)('Close')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
isDestructive: true,
variant: "link",
onClick: onRemove
}, (0,external_wp_i18n_namespaceObject.__)('Remove track'))))));
}
function TracksEditor({
tracks = [],
onChange
}) {
const mediaUpload = (0,external_wp_data_namespaceObject.useSelect)(select => {
return select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload;
}, []);
const [trackBeingEdited, setTrackBeingEdited] = (0,external_wp_element_namespaceObject.useState)(null);
if (!mediaUpload) {
return null;
}
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
contentClassName: "block-library-video-tracks-editor",
renderToggle: ({
isOpen,
onToggle
}) => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
label: (0,external_wp_i18n_namespaceObject.__)('Text tracks'),
showTooltip: true,
"aria-expanded": isOpen,
"aria-haspopup": "true",
onClick: onToggle
}, (0,external_wp_i18n_namespaceObject.__)('Text tracks'))),
renderContent: () => {
if (trackBeingEdited !== null) {
return (0,external_React_namespaceObject.createElement)(SingleTrackEditor, {
track: tracks[trackBeingEdited],
onChange: newTrack => {
const newTracks = [...tracks];
newTracks[trackBeingEdited] = newTrack;
onChange(newTracks);
},
onClose: () => setTrackBeingEdited(null),
onRemove: () => {
onChange(tracks.filter((_track, index) => index !== trackBeingEdited));
setTrackBeingEdited(null);
}
});
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.NavigableMenu, null, (0,external_React_namespaceObject.createElement)(TrackList, {
tracks: tracks,
onEditPress: setTrackBeingEdited
}), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
className: "block-library-video-tracks-editor__add-tracks-container",
label: (0,external_wp_i18n_namespaceObject.__)('Add tracks')
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, {
onSelect: ({
url
}) => {
const trackIndex = tracks.length;
onChange([...tracks, {
src: url
}]);
setTrackBeingEdited(trackIndex);
},
allowedTypes: ALLOWED_TYPES,
render: ({
open
}) => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
icon: library_media,
onClick: open
}, (0,external_wp_i18n_namespaceObject.__)('Open Media Library'))
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FormFileUpload, {
onChange: event => {
const files = event.target.files;
const trackIndex = tracks.length;
mediaUpload({
allowedTypes: ALLOWED_TYPES,
filesList: files,
onFileChange: ([{
url
}]) => {
const newTracks = [...tracks];
if (!newTracks[trackIndex]) {
newTracks[trackIndex] = {};
}
newTracks[trackIndex] = {
...tracks[trackIndex],
src: url
};
onChange(newTracks);
setTrackBeingEdited(trackIndex);
}
});
},
accept: ".vtt,text/vtt",
render: ({
openFileDialog
}) => {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
icon: library_upload,
onClick: () => {
openFileDialog();
}
}, (0,external_wp_i18n_namespaceObject.__)('Upload'));
}
})))));
}
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/video/edit.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// Much of this description is duplicated from MediaPlaceholder.
const video_edit_placeholder = content => {
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
className: "block-editor-media-placeholder",
withIllustration: true,
icon: library_video,
label: (0,external_wp_i18n_namespaceObject.__)('Video'),
instructions: (0,external_wp_i18n_namespaceObject.__)('Upload a video file, pick one from your media library, or add one with a URL.')
}, content);
};
const video_edit_ALLOWED_MEDIA_TYPES = ['video'];
const VIDEO_POSTER_ALLOWED_MEDIA_TYPES = ['image'];
function VideoEdit({
isSelected: isSingleSelected,
attributes,
className,
setAttributes,
insertBlocksAfter,
onReplace
}) {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(VideoEdit);
const videoPlayer = (0,external_wp_element_namespaceObject.useRef)();
const posterImageButton = (0,external_wp_element_namespaceObject.useRef)();
const {
id,
controls,
poster,
src,
tracks
} = attributes;
const isTemporaryVideo = !id && (0,external_wp_blob_namespaceObject.isBlobURL)(src);
const {
getSettings
} = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!id && (0,external_wp_blob_namespaceObject.isBlobURL)(src)) {
const file = (0,external_wp_blob_namespaceObject.getBlobByURL)(src);
if (file) {
getSettings().mediaUpload({
filesList: [file],
onFileChange: ([media]) => onSelectVideo(media),
onError: onUploadError,
allowedTypes: video_edit_ALLOWED_MEDIA_TYPES
});
}
}
}, []);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Placeholder may be rendered.
if (videoPlayer.current) {
videoPlayer.current.load();
}
}, [poster]);
function onSelectVideo(media) {
if (!media || !media.url) {
// In this case there was an error
// previous attributes should be removed
// because they may be temporary blob urls.
setAttributes({
src: undefined,
id: undefined,
poster: undefined,
caption: undefined
});
return;
}
// Sets the block's attribute and updates the edit component from the
// selected media.
setAttributes({
src: media.url,
id: media.id,
poster: media.image?.src !== media.icon ? media.image?.src : undefined,
caption: media.caption
});
}
function onSelectURL(newSrc) {
if (newSrc !== src) {
// Check if there's an embed block that handles this URL.
const embedBlock = createUpgradedEmbedBlock({
attributes: {
url: newSrc
}
});
if (undefined !== embedBlock && onReplace) {
onReplace(embedBlock);
return;
}
setAttributes({
src: newSrc,
id: undefined,
poster: undefined
});
}
}
const {
createErrorNotice
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
function onUploadError(message) {
createErrorNotice(message, {
type: 'snackbar'
});
}
const classes = classnames_default()(className, {
'is-transient': isTemporaryVideo
});
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: classes
});
if (!src) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaPlaceholder, {
icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: library_video
}),
onSelect: onSelectVideo,
onSelectURL: onSelectURL,
accept: "video/*",
allowedTypes: video_edit_ALLOWED_MEDIA_TYPES,
value: attributes,
onError: onUploadError,
placeholder: video_edit_placeholder
}));
}
function onSelectPoster(image) {
setAttributes({
poster: image.url
});
}
function onRemovePoster() {
setAttributes({
poster: undefined
});
// Move focus back to the Media Upload button.
posterImageButton.current.focus();
}
const videoPosterDescription = `video-block__poster-image-description-${instanceId}`;
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, isSingleSelected && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, null, (0,external_React_namespaceObject.createElement)(TracksEditor, {
tracks: tracks,
onChange: newTracks => {
setAttributes({
tracks: newTracks
});
}
})), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
group: "other"
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaReplaceFlow, {
mediaId: id,
mediaURL: src,
allowedTypes: video_edit_ALLOWED_MEDIA_TYPES,
accept: "video/*",
onSelect: onSelectVideo,
onSelectURL: onSelectURL,
onError: onUploadError
}))), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Settings')
}, (0,external_React_namespaceObject.createElement)(edit_common_settings, {
setAttributes: setAttributes,
attributes: attributes
}), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, {
className: "editor-video-poster-control"
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, null, (0,external_wp_i18n_namespaceObject.__)('Poster image')), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, {
title: (0,external_wp_i18n_namespaceObject.__)('Select poster image'),
onSelect: onSelectPoster,
allowedTypes: VIDEO_POSTER_ALLOWED_MEDIA_TYPES,
render: ({
open
}) => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary",
onClick: open,
ref: posterImageButton,
"aria-describedby": videoPosterDescription
}, !poster ? (0,external_wp_i18n_namespaceObject.__)('Select') : (0,external_wp_i18n_namespaceObject.__)('Replace'))
}), (0,external_React_namespaceObject.createElement)("p", {
id: videoPosterDescription,
hidden: true
}, poster ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: poster image URL. */
(0,external_wp_i18n_namespaceObject.__)('The current poster image url is %s'), poster) : (0,external_wp_i18n_namespaceObject.__)('There is no poster image currently selected')), !!poster && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
onClick: onRemovePoster,
variant: "tertiary"
}, (0,external_wp_i18n_namespaceObject.__)('Remove')))))), (0,external_React_namespaceObject.createElement)("figure", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, {
isDisabled: !isSingleSelected
}, (0,external_React_namespaceObject.createElement)("video", {
controls: controls,
poster: poster,
src: src,
ref: videoPlayer
}, (0,external_React_namespaceObject.createElement)(Tracks, {
tracks: tracks
}))), isTemporaryVideo && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_React_namespaceObject.createElement)(Caption, {
attributes: attributes,
setAttributes: setAttributes,
isSelected: isSingleSelected,
insertBlocksAfter: insertBlocksAfter,
label: (0,external_wp_i18n_namespaceObject.__)('Video caption text'),
showToolbarButton: isSingleSelected
})));
}
/* harmony default export */ const video_edit = (VideoEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/video/save.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function video_save_save({
attributes
}) {
const {
autoplay,
caption,
controls,
loop,
muted,
poster,
preload,
src,
playsInline,
tracks
} = attributes;
return (0,external_React_namespaceObject.createElement)("figure", {
...external_wp_blockEditor_namespaceObject.useBlockProps.save()
}, src && (0,external_React_namespaceObject.createElement)("video", {
autoPlay: autoplay,
controls: controls,
loop: loop,
muted: muted,
poster: poster,
preload: preload !== 'metadata' ? preload : undefined,
src: src,
playsInline: playsInline
}, (0,external_React_namespaceObject.createElement)(Tracks, {
tracks: tracks
})), !external_wp_blockEditor_namespaceObject.RichText.isEmpty(caption) && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
className: (0,external_wp_blockEditor_namespaceObject.__experimentalGetElementClassName)('caption'),
tagName: "figcaption",
value: caption
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/video/transforms.js
/**
* WordPress dependencies
*/
const video_transforms_transforms = {
from: [{
type: 'files',
isMatch(files) {
return files.length === 1 && files[0].type.indexOf('video/') === 0;
},
transform(files) {
const file = files[0];
// We don't need to upload the media directly here
// It's already done as part of the `componentDidMount`
// in the video block
const block = (0,external_wp_blocks_namespaceObject.createBlock)('core/video', {
src: (0,external_wp_blob_namespaceObject.createBlobURL)(file)
});
return block;
}
}, {
type: 'shortcode',
tag: 'video',
attributes: {
src: {
type: 'string',
shortcode: ({
named: {
src,
mp4,
m4v,
webm,
ogv,
flv
}
}) => {
return src || mp4 || m4v || webm || ogv || flv;
}
},
poster: {
type: 'string',
shortcode: ({
named: {
poster
}
}) => {
return poster;
}
},
loop: {
type: 'string',
shortcode: ({
named: {
loop
}
}) => {
return loop;
}
},
autoplay: {
type: 'string',
shortcode: ({
named: {
autoplay
}
}) => {
return autoplay;
}
},
preload: {
type: 'string',
shortcode: ({
named: {
preload
}
}) => {
return preload;
}
}
}
}, {
type: 'raw',
isMatch: node => node.nodeName === 'P' && node.children.length === 1 && node.firstChild.nodeName === 'VIDEO',
transform: node => {
const videoElement = node.firstChild;
const attributes = {
autoplay: videoElement.hasAttribute('autoplay') ? true : undefined,
controls: videoElement.hasAttribute('controls') ? undefined : false,
loop: videoElement.hasAttribute('loop') ? true : undefined,
muted: videoElement.hasAttribute('muted') ? true : undefined,
preload: videoElement.getAttribute('preload') || undefined,
playsInline: videoElement.hasAttribute('playsinline') ? true : undefined,
poster: videoElement.getAttribute('poster') || undefined,
src: videoElement.getAttribute('src') || undefined
};
return (0,external_wp_blocks_namespaceObject.createBlock)('core/video', attributes);
}
}]
};
/* harmony default export */ const video_transforms = (video_transforms_transforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/video/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const video_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/video",
title: "Video",
category: "media",
description: "Embed a video from your media library or upload a new one.",
keywords: ["movie"],
textdomain: "default",
attributes: {
autoplay: {
type: "boolean",
source: "attribute",
selector: "video",
attribute: "autoplay"
},
caption: {
type: "rich-text",
source: "rich-text",
selector: "figcaption",
__experimentalRole: "content"
},
controls: {
type: "boolean",
source: "attribute",
selector: "video",
attribute: "controls",
"default": true
},
id: {
type: "number",
__experimentalRole: "content"
},
loop: {
type: "boolean",
source: "attribute",
selector: "video",
attribute: "loop"
},
muted: {
type: "boolean",
source: "attribute",
selector: "video",
attribute: "muted"
},
poster: {
type: "string",
source: "attribute",
selector: "video",
attribute: "poster"
},
preload: {
type: "string",
source: "attribute",
selector: "video",
attribute: "preload",
"default": "metadata"
},
src: {
type: "string",
source: "attribute",
selector: "video",
attribute: "src",
__experimentalRole: "content"
},
playsInline: {
type: "boolean",
source: "attribute",
selector: "video",
attribute: "playsinline"
},
tracks: {
__experimentalRole: "content",
type: "array",
items: {
type: "object"
},
"default": []
}
},
supports: {
anchor: true,
align: true,
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
interactivity: {
clientNavigation: true
}
},
editorStyle: "wp-block-video-editor",
style: "wp-block-video"
};
const {
name: video_name
} = video_metadata;
const video_settings = {
icon: library_video,
example: {
attributes: {
src: 'https://upload.wikimedia.org/wikipedia/commons/c/ca/Wood_thrush_in_Central_Park_switch_sides_%2816510%29.webm',
// translators: Caption accompanying a video of the wood thrush singing, which serves as an example for the Video block.
caption: (0,external_wp_i18n_namespaceObject.__)('Wood thrush singing in Central Park, NYC.')
}
},
transforms: video_transforms,
deprecated: video_deprecated,
edit: video_edit,
save: video_save_save
};
const video_init = () => initBlock({
name: video_name,
metadata: video_metadata,
settings: video_settings
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/footnotes/edit.js
/**
* WordPress dependencies
*/
function FootnotesEdit({
context: {
postType,
postId
}
}) {
const [meta, updateMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'meta', postId);
const footnotesSupported = 'string' === typeof meta?.footnotes;
const footnotes = meta?.footnotes ? JSON.parse(meta.footnotes) : [];
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)();
if (!footnotesSupported) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: format_list_numbered
}),
label: (0,external_wp_i18n_namespaceObject.__)('Footnotes'),
instructions: (0,external_wp_i18n_namespaceObject.__)('Footnotes are not supported here. Add this block to post or page content.')
}));
}
if (!footnotes.length) {
return (0,external_React_namespaceObject.createElement)("div", {
...blockProps
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: format_list_numbered
}),
label: (0,external_wp_i18n_namespaceObject.__)('Footnotes'),
instructions: (0,external_wp_i18n_namespaceObject.__)('Footnotes found in blocks within this document will be displayed here.')
}));
}
return (0,external_React_namespaceObject.createElement)("ol", {
...blockProps
}, footnotes.map(({
id,
content
}) => /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
(0,external_React_namespaceObject.createElement)("li", {
key: id,
onMouseDown: event => {
// When clicking on the list item (not on descendants),
// focus the rich text element since it's only 1px wide when
// empty.
if (event.target === event.currentTarget) {
event.target.firstElementChild.focus();
event.preventDefault();
}
}
}, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
id: id,
tagName: "span",
value: content,
identifier: id
// To do: figure out why the browser is not scrolling
// into view when it receives focus.
,
onFocus: event => {
if (!event.target.textContent.trim()) {
event.target.scrollIntoView();
}
},
onChange: nextFootnote => {
updateMeta({
...meta,
footnotes: JSON.stringify(footnotes.map(footnote => {
return footnote.id === id ? {
content: nextFootnote,
id
} : footnote;
}))
});
}
}), ' ', (0,external_React_namespaceObject.createElement)("a", {
href: `#${id}-link`
}, "\u21A9\uFE0E"))));
}
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/native.js
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
/* harmony default export */ const esm_browser_native = ({
randomUUID
});
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js
// Unique ID creation requires a high quality random # generator. In the browser we therefore
// require the crypto API and do not support built-in fallback to lower quality random number
// generators (like Math.random()).
let getRandomValues;
const rnds8 = new Uint8Array(16);
function rng() {
// lazy load so that environments that need to polyfill have a chance to do so
if (!getRandomValues) {
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
if (!getRandomValues) {
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
}
}
return getRandomValues(rnds8);
}
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js
/**
* Convert array of 16 byte values to UUID string format of the form:
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
*/
const byteToHex = [];
for (let i = 0; i < 256; ++i) {
byteToHex.push((i + 0x100).toString(16).slice(1));
}
function unsafeStringify(arr, offset = 0) {
// Note: Be careful editing this code! It's been tuned for performance
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
}
function stringify(arr, offset = 0) {
const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
// of the following:
// - One or more input array values don't map to a hex octet (leading to
// "undefined" in the uuid)
// - Invalid input values for the RFC `version` or `variant` fields
if (!validate(uuid)) {
throw TypeError('Stringified UUID is invalid');
}
return uuid;
}
/* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify)));
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js
function v4_v4(options, buf, offset) {
if (esm_browser_native.randomUUID && !buf && !options) {
return esm_browser_native.randomUUID();
}
options = options || {};
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
rnds[6] = rnds[6] & 0x0f | 0x40;
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
if (buf) {
offset = offset || 0;
for (let i = 0; i < 16; ++i) {
buf[offset + i] = rnds[i];
}
return buf;
}
return unsafeStringify(rnds);
}
/* harmony default export */ const esm_browser_v4 = (v4_v4);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/footnotes/format.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
usesContextKey
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
const formatName = 'core/footnote';
const POST_CONTENT_BLOCK_NAME = 'core/post-content';
const SYNCED_PATTERN_BLOCK_NAME = 'core/block';
const format = {
title: (0,external_wp_i18n_namespaceObject.__)('Footnote'),
tagName: 'sup',
className: 'fn',
attributes: {
'data-fn': 'data-fn'
},
interactive: true,
contentEditable: false,
[usesContextKey]: ['postType', 'postId'],
edit: function Edit({
value,
onChange,
isObjectActive,
context: {
postType,
postId
}
}) {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const {
getSelectedBlockClientId,
getBlocks,
getBlockRootClientId,
getBlockName,
getBlockParentsByBlockName
} = registry.select(external_wp_blockEditor_namespaceObject.store);
const isFootnotesSupported = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!select(external_wp_blocks_namespaceObject.store).getBlockType('core/footnotes')) {
return false;
}
const allowedBlocks = select(external_wp_blockEditor_namespaceObject.store).getSettings().allowedBlockTypes;
if (allowedBlocks === false || Array.isArray(allowedBlocks) && !allowedBlocks.includes('core/footnotes')) {
return false;
}
const entityRecord = select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', postType, postId);
if ('string' !== typeof entityRecord?.meta?.footnotes) {
return false;
}
// Checks if the selected block lives within a pattern.
const {
getBlockParentsByBlockName: _getBlockParentsByBlockName,
getSelectedBlockClientId: _getSelectedBlockClientId
} = select(external_wp_blockEditor_namespaceObject.store);
const parentCoreBlocks = _getBlockParentsByBlockName(_getSelectedBlockClientId(), SYNCED_PATTERN_BLOCK_NAME);
return !parentCoreBlocks || parentCoreBlocks.length === 0;
}, [postType, postId]);
const {
selectionChange,
insertBlock
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
if (!isFootnotesSupported) {
return null;
}
function onClick() {
registry.batch(() => {
let id;
if (isObjectActive) {
const object = value.replacements[value.start];
id = object?.attributes?.['data-fn'];
} else {
id = esm_browser_v4();
const newValue = (0,external_wp_richText_namespaceObject.insertObject)(value, {
type: formatName,
attributes: {
'data-fn': id
},
innerHTML: `<a href="#${id}" id="${id}-link">*</a>`
}, value.end, value.end);
newValue.start = newValue.end - 1;
onChange(newValue);
}
const selectedClientId = getSelectedBlockClientId();
/*
* Attempts to find a common parent post content block.
* This allows for locating blocks within a page edited in the site editor.
*/
const parentPostContent = getBlockParentsByBlockName(selectedClientId, POST_CONTENT_BLOCK_NAME);
// When called with a post content block, getBlocks will return
// the block with controlled inner blocks included.
const blocks = parentPostContent.length ? getBlocks(parentPostContent[0]) : getBlocks();
// BFS search to find the first footnote block.
let fnBlock = null;
{
const queue = [...blocks];
while (queue.length) {
const block = queue.shift();
if (block.name === 'core/footnotes') {
fnBlock = block;
break;
}
queue.push(...block.innerBlocks);
}
}
// Maybe this should all also be moved to the entity provider.
// When there is no footnotes block in the post, create one and
// insert it at the bottom.
if (!fnBlock) {
let rootClientId = getBlockRootClientId(selectedClientId);
while (rootClientId && getBlockName(rootClientId) !== POST_CONTENT_BLOCK_NAME) {
rootClientId = getBlockRootClientId(rootClientId);
}
fnBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/footnotes');
insertBlock(fnBlock, undefined, rootClientId);
}
selectionChange(fnBlock.clientId, id, 0, 0);
});
}
return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
icon: format_list_numbered,
title: (0,external_wp_i18n_namespaceObject.__)('Footnote'),
onClick: onClick,
isActive: isObjectActive
});
}
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/footnotes/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const footnotes_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/footnotes",
title: "Footnotes",
category: "text",
description: "Display footnotes added to the page.",
keywords: ["references"],
textdomain: "default",
usesContext: ["postId", "postType"],
supports: {
__experimentalBorder: {
radius: true,
color: true,
width: true,
style: true,
__experimentalDefaultControls: {
radius: false,
color: false,
width: false,
style: false
}
},
color: {
background: true,
link: true,
text: true,
__experimentalDefaultControls: {
link: true,
text: true
}
},
html: false,
multiple: false,
reusable: false,
inserter: false,
spacing: {
margin: true,
padding: true,
__experimentalDefaultControls: {
margin: false,
padding: false
}
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalTextDecoration: true,
__experimentalFontStyle: true,
__experimentalFontWeight: true,
__experimentalLetterSpacing: true,
__experimentalTextTransform: true,
__experimentalWritingMode: true,
__experimentalDefaultControls: {
fontSize: true
}
},
interactivity: {
clientNavigation: true
}
},
style: "wp-block-footnotes"
};
const {
name: footnotes_name
} = footnotes_metadata;
const footnotes_settings = {
icon: format_list_numbered,
edit: FootnotesEdit
};
(0,external_wp_richText_namespaceObject.registerFormatType)(formatName, format);
const footnotes_init = () => {
initBlock({
name: footnotes_name,
metadata: footnotes_metadata,
settings: footnotes_settings
});
};
// EXTERNAL MODULE: ./node_modules/@wordpress/block-library/build-module/utils/is-block-metadata-experimental.js
var is_block_metadata_experimental = __webpack_require__(2321);
var is_block_metadata_experimental_default = /*#__PURE__*/__webpack_require__.n(is_block_metadata_experimental);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// When IS_GUTENBERG_PLUGIN is set to false, imports of experimental blocks
// are transformed by packages/block-library/src/index.js as follows:
// import * as experimentalBlock from './experimental-block'
// becomes
// const experimentalBlock = null;
// This enables webpack to eliminate the experimental blocks code from the
// production build to make the final bundle smaller.
//
// See https://github.com/WordPress/gutenberg/pull/40655 for more context.
/**
* Function to get all the block-library blocks in an array
*/
const getAllBlocks = () => {
const blocks = [
// Common blocks are grouped at the top to prioritize their display
// in various contexts — like the inserter and auto-complete components.
build_module_paragraph_namespaceObject, build_module_image_namespaceObject, build_module_heading_namespaceObject, build_module_gallery_namespaceObject, build_module_list_namespaceObject, build_module_list_item_namespaceObject, build_module_quote_namespaceObject,
// Register all remaining core blocks.
archives_namespaceObject, build_module_audio_namespaceObject, build_module_button_namespaceObject, build_module_buttons_namespaceObject, build_module_calendar_namespaceObject, categories_namespaceObject, build_module_code_namespaceObject, build_module_column_namespaceObject, build_module_columns_namespaceObject, build_module_comment_author_avatar_namespaceObject, build_module_cover_namespaceObject, build_module_details_namespaceObject, embed_namespaceObject, build_module_file_namespaceObject, build_module_group_namespaceObject, build_module_html_namespaceObject, latest_comments_namespaceObject, latest_posts_namespaceObject, media_text_namespaceObject, missing_namespaceObject, build_module_more_namespaceObject, nextpage_namespaceObject, page_list_namespaceObject, page_list_item_namespaceObject, pattern_namespaceObject, build_module_preformatted_namespaceObject, build_module_pullquote_namespaceObject, block_namespaceObject, build_module_rss_namespaceObject, build_module_search_namespaceObject, build_module_separator_namespaceObject, build_module_shortcode_namespaceObject, social_link_namespaceObject, social_links_namespaceObject, spacer_namespaceObject, build_module_table_namespaceObject, tag_cloud_namespaceObject, text_columns_namespaceObject, build_module_verse_namespaceObject, build_module_video_namespaceObject, footnotes_namespaceObject,
// theme blocks
build_module_navigation_namespaceObject, navigation_link_namespaceObject, navigation_submenu_namespaceObject, build_module_site_logo_namespaceObject, site_title_namespaceObject, site_tagline_namespaceObject, query_namespaceObject, template_part_namespaceObject, avatar_namespaceObject, post_title_namespaceObject, build_module_post_excerpt_namespaceObject, build_module_post_featured_image_namespaceObject, build_module_post_content_namespaceObject, build_module_post_author_namespaceObject, post_author_name_namespaceObject, post_comment_namespaceObject, build_module_post_comments_count_namespaceObject, post_comments_link_namespaceObject, build_module_post_date_namespaceObject, build_module_post_terms_namespaceObject, post_navigation_link_namespaceObject, post_template_namespaceObject, post_time_to_read_namespaceObject, build_module_query_pagination_namespaceObject, build_module_query_pagination_next_namespaceObject, build_module_query_pagination_numbers_namespaceObject, build_module_query_pagination_previous_namespaceObject, query_no_results_namespaceObject, read_more_namespaceObject, comments_namespaceObject, build_module_comment_author_name_namespaceObject, build_module_comment_content_namespaceObject, comment_date_namespaceObject, build_module_comment_edit_link_namespaceObject, build_module_comment_reply_link_namespaceObject, comment_template_namespaceObject, comments_title_namespaceObject, comments_pagination_namespaceObject, comments_pagination_next_namespaceObject, comments_pagination_numbers_namespaceObject, comments_pagination_previous_namespaceObject, build_module_post_comments_form_namespaceObject, build_module_table_of_contents_namespaceObject, home_link_namespaceObject, loginout_namespaceObject, build_module_term_description_namespaceObject, query_title_namespaceObject, post_author_biography_namespaceObject];
if (window?.__experimentalEnableFormBlocks) {
blocks.push(build_module_form_namespaceObject);
blocks.push(form_input_namespaceObject);
blocks.push(form_submit_button_namespaceObject);
blocks.push(form_submission_notification_namespaceObject);
}
// When in a WordPress context, conditionally
// add the classic block and TinyMCE editor
// under any of the following conditions:
// - the current post contains a classic block
// - the experiment to disable TinyMCE isn't active.
// - a query argument specifies that TinyMCE should be loaded
if (window?.wp?.oldEditor && (window?.wp?.needsClassicBlock || !window?.__experimentalDisableTinymce || !!new URLSearchParams(window?.location?.search).get('requiresTinymce'))) {
blocks.push(freeform_namespaceObject);
}
return blocks.filter(Boolean);
};
/**
* Function to get all the core blocks in an array.
*
* @example
* ```js
* import { __experimentalGetCoreBlocks } from '@wordpress/block-library';
*
* const coreBlocks = __experimentalGetCoreBlocks();
* ```
*/
const __experimentalGetCoreBlocks = () => getAllBlocks().filter(({
metadata
}) => !is_block_metadata_experimental_default()(metadata));
/**
* Function to register core blocks provided by the block editor.
*
* @param {Array} blocks An optional array of the core blocks being registered.
*
* @example
* ```js
* import { registerCoreBlocks } from '@wordpress/block-library';
*
* registerCoreBlocks();
* ```
*/
const registerCoreBlocks = (blocks = __experimentalGetCoreBlocks()) => {
blocks.forEach(({
init
}) => init());
(0,external_wp_blocks_namespaceObject.setDefaultBlockName)(paragraph_name);
if (window.wp && window.wp.oldEditor && blocks.some(({
name
}) => name === freeform_name)) {
(0,external_wp_blocks_namespaceObject.setFreeformContentHandlerName)(freeform_name);
}
(0,external_wp_blocks_namespaceObject.setUnregisteredTypeHandlerName)(missing_name);
(0,external_wp_blocks_namespaceObject.setGroupingBlockName)(group_name);
};
/**
* Function to register experimental core blocks depending on editor settings.
*
* @param {boolean} enableFSEBlocks Whether to enable the full site editing blocks.
* @example
* ```js
* import { __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';
*
* __experimentalRegisterExperimentalCoreBlocks( settings );
* ```
*/
const __experimentalRegisterExperimentalCoreBlocks = false ? 0 : undefined;
})();
(window.wp = window.wp || {}).blockLibrary = __webpack_exports__;
/******/ })()
;/*! This file is auto-generated */
(()=>{var e={2321:e=>{e.exports=function(e){return e&&"__experimental"in e&&!1!==e.__experimental}},1668:(e,t)=>{var n;
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var a=function(){function e(){}function t(e,t){for(var n=t.length,a=0;a<n;++a)o(e,t[a])}e.prototype=Object.create(null);var n={}.hasOwnProperty;var a=/\s+/;function o(e,o){if(o){var r=typeof o;"string"===r?function(e,t){for(var n=t.split(a),o=n.length,r=0;r<o;++r)e[n[r]]=!0}(e,o):Array.isArray(o)?t(e,o):"object"===r?function(e,t){if(t.toString===Object.prototype.toString||t.toString.toString().includes("[native code]"))for(var a in t)n.call(t,a)&&(e[a]=!!t[a]);else e[t.toString()]=!0}(e,o):"number"===r&&function(e,t){e[t]=!0}(e,o)}}return function(){for(var n=arguments.length,a=Array(n),o=0;o<n;o++)a[o]=arguments[o];var r=new e;t(r,a);var l=[];for(var i in r)r[i]&&l.push(i);return l.join(" ")}}();e.exports?(a.default=a,e.exports=a):void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()},5755:(e,t)=>{var n;
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var a={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var r=typeof n;if("string"===r||"number"===r)e.push(n);else if(Array.isArray(n)){if(n.length){var l=o.apply(null,n);l&&e.push(l)}}else if("object"===r){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var i in n)a.call(n,i)&&n[i]&&e.push(i)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},7734:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var a,o,r;if(Array.isArray(t)){if((a=t.length)!=n.length)return!1;for(o=a;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;for(o of t.entries())if(!e(o[1],n.get(o[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((a=t.length)!=n.length)return!1;for(o=a;0!=o--;)if(t[o]!==n[o])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((a=(r=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=a;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,r[o]))return!1;for(o=a;0!=o--;){var l=r[o];if(!e(t[l],n[l]))return!1}return!0}return t!=t&&n!=n}},9681:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},n=Object.keys(t).join("|"),a=new RegExp(n,"g"),o=new RegExp(n,"");function r(e){return t[e]}var l=function(e){return e.replace(a,r)};e.exports=l,e.exports.has=function(e){return!!e.match(o)},e.exports.remove=l}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{"use strict";n.r(a),n.d(a,{__experimentalGetCoreBlocks:()=>iB,__experimentalRegisterExperimentalCoreBlocks:()=>cB,registerCoreBlocks:()=>sB});var e={};n.r(e),n.d(e,{init:()=>st,metadata:()=>rt,name:()=>lt,settings:()=>it});var t={};n.r(t),n.d(t,{init:()=>Bt,metadata:()=>Et,name:()=>Ct,settings:()=>St});var o={};n.r(o),n.d(o,{init:()=>an,metadata:()=>en,name:()=>tn,settings:()=>nn});var r={};n.r(r),n.d(r,{init:()=>Tn,metadata:()=>Sn,name:()=>Bn,settings:()=>Nn});var l={};n.r(l),n.d(l,{init:()=>Gn,metadata:()=>Vn,name:()=>$n,settings:()=>On});var i={};n.r(i),n.d(i,{init:()=>Kn,metadata:()=>Wn,name:()=>Zn,settings:()=>Qn});var s={};n.r(s),n.d(s,{init:()=>aa,metadata:()=>ea,name:()=>ta,settings:()=>na});var c={};n.r(c),n.d(c,{init:()=>ha,metadata:()=>pa,name:()=>da,settings:()=>ga});var m={};n.r(m),n.d(m,{init:()=>Ea,metadata:()=>ka,name:()=>xa,settings:()=>wa});var u={};n.r(u),n.d(u,{init:()=>Ma,metadata:()=>Ta,name:()=>Ia,settings:()=>Pa});var p={};n.r(p),n.d(p,{init:()=>Qa,metadata:()=>ja,name:()=>Wa,settings:()=>Za});var d={};n.r(d),n.d(d,{init:()=>io,metadata:()=>oo,name:()=>ro,settings:()=>lo});var g={};n.r(g),n.d(g,{init:()=>uo,metadata:()=>so,name:()=>co,settings:()=>mo});var h={};n.r(h),n.d(h,{init:()=>vo,metadata:()=>bo,name:()=>_o,settings:()=>yo});var b={};n.r(b),n.d(b,{init:()=>Eo,metadata:()=>ko,name:()=>xo,settings:()=>wo});var _={};n.r(_),n.d(_,{init:()=>Mo,metadata:()=>To,name:()=>Io,settings:()=>Po});var y={};n.r(y),n.d(y,{init:()=>Lo,metadata:()=>Ro,name:()=>Ao,settings:()=>Ho});var v={};n.r(v),n.d(v,{init:()=>Go,metadata:()=>Vo,name:()=>$o,settings:()=>Oo});var f={};n.r(f),n.d(f,{init:()=>tr,metadata:()=>Jo,name:()=>Xo,settings:()=>er});var k={};n.r(k),n.d(k,{init:()=>ir,metadata:()=>or,name:()=>rr,settings:()=>lr});var x={};n.r(x),n.d(x,{init:()=>gr,metadata:()=>ur,name:()=>pr,settings:()=>dr});var w={};n.r(w),n.d(w,{init:()=>fr,metadata:()=>_r,name:()=>yr,settings:()=>vr});var E={};n.r(E),n.d(E,{init:()=>Sr,metadata:()=>wr,name:()=>Er,settings:()=>Cr});var C={};n.r(C),n.d(C,{init:()=>Rr,metadata:()=>Pr,name:()=>Mr,settings:()=>zr});var S={};n.r(S),n.d(S,{init:()=>Ii,metadata:()=>Bi,name:()=>Ni,settings:()=>Ti});var B={};n.r(B),n.d(B,{init:()=>Li,metadata:()=>Ri,name:()=>Ai,settings:()=>Hi});var N={};n.r(N),n.d(N,{init:()=>Ss,metadata:()=>ws,name:()=>Es,settings:()=>Cs});var T={};n.r(T),n.d(T,{init:()=>Gs,metadata:()=>Vs,name:()=>$s,settings:()=>Os});var I={};n.r(I),n.d(I,{init:()=>ec,metadata:()=>Ys,name:()=>Js,settings:()=>Xs});var P={};n.r(P),n.d(P,{init:()=>pc,metadata:()=>cc,name:()=>mc,settings:()=>uc});var M={};n.r(M),n.d(M,{init:()=>vc,metadata:()=>bc,name:()=>_c,settings:()=>yc});var z={};n.r(z),n.d(z,{init:()=>Nc,metadata:()=>Cc,name:()=>Sc,settings:()=>Bc});var R={};n.r(R),n.d(R,{init:()=>Om,metadata:()=>Fm,name:()=>Vm,settings:()=>$m});var A={};n.r(A),n.d(A,{init:()=>ru,metadata:()=>nu,name:()=>au,settings:()=>ou});var H={};n.r(H),n.d(H,{init:()=>Nu,metadata:()=>Cu,name:()=>Su,settings:()=>Bu});var L={};n.r(L),n.d(L,{init:()=>Ru,metadata:()=>Pu,name:()=>Mu,settings:()=>zu});var D={};n.r(D),n.d(D,{init:()=>Gu,metadata:()=>Vu,name:()=>$u,settings:()=>Ou});var F={};n.r(F),n.d(F,{init:()=>fp,metadata:()=>_p,name:()=>yp,settings:()=>vp});var V={};n.r(V),n.d(V,{init:()=>Cp,metadata:()=>xp,name:()=>wp,settings:()=>Ep});var $={};n.r($),n.d($,{init:()=>Ap,metadata:()=>Mp,name:()=>zp,settings:()=>Rp});var O={};n.r(O),n.d(O,{init:()=>id,metadata:()=>od,name:()=>rd,settings:()=>ld});var G={};n.r(G),n.d(G,{init:()=>kd,metadata:()=>yd,name:()=>vd,settings:()=>fd});var U={};n.r(U),n.d(U,{init:()=>Sd,metadata:()=>wd,name:()=>Ed,settings:()=>Cd});var q={};n.r(q),n.d(q,{init:()=>pg,metadata:()=>cg,name:()=>mg,settings:()=>ug});var j={};n.r(j),n.d(j,{init:()=>yg,metadata:()=>hg,name:()=>bg,settings:()=>_g});var W={};n.r(W),n.d(W,{init:()=>Cg,metadata:()=>xg,name:()=>wg,settings:()=>Eg});var Z={};n.r(Z),n.d(Z,{init:()=>tb,metadata:()=>Jh,name:()=>Xh,settings:()=>eb});var Q={};n.r(Q),n.d(Q,{init:()=>gb,metadata:()=>ub,name:()=>pb,settings:()=>db});var K={};n.r(K),n.d(K,{init:()=>Eb,metadata:()=>kb,name:()=>xb,settings:()=>wb});var Y={};n.r(Y),n.d(Y,{init:()=>Ib,metadata:()=>Bb,name:()=>Nb,settings:()=>Tb});var J={};n.r(J),n.d(J,{init:()=>Vb,metadata:()=>Lb,name:()=>Db,settings:()=>Fb});var X={};n.r(X),n.d(X,{init:()=>Jb,metadata:()=>Qb,name:()=>Kb,settings:()=>Yb});var ee={};n.r(ee),n.d(ee,{init:()=>a_,metadata:()=>e_,name:()=>t_,settings:()=>n_});var te={};n.r(te),n.d(te,{init:()=>E_,metadata:()=>k_,name:()=>x_,settings:()=>w_});var ne={};n.r(ne),n.d(ne,{init:()=>P_,metadata:()=>N_,name:()=>T_,settings:()=>I_});var ae={};n.r(ae),n.d(ae,{init:()=>L_,metadata:()=>R_,name:()=>A_,settings:()=>H_});var oe={};n.r(oe),n.d(oe,{init:()=>O_,metadata:()=>F_,name:()=>V_,settings:()=>$_});var re={};n.r(re),n.d(re,{init:()=>Z_,metadata:()=>q_,name:()=>j_,settings:()=>W_});var le={};n.r(le),n.d(le,{init:()=>X_,metadata:()=>K_,name:()=>Y_,settings:()=>J_});var ie={};n.r(ie),n.d(ie,{init:()=>oy,metadata:()=>ty,name:()=>ny,settings:()=>ay});var se={};n.r(se),n.d(se,{init:()=>cy,metadata:()=>ly,name:()=>iy,settings:()=>sy});var ce={};n.r(ce),n.d(ce,{init:()=>fy,metadata:()=>_y,name:()=>yy,settings:()=>vy});var me={};n.r(me),n.d(me,{init:()=>Ty,metadata:()=>Sy,name:()=>By,settings:()=>Ny});var ue={};n.r(ue),n.d(ue,{init:()=>Ay,metadata:()=>My,name:()=>zy,settings:()=>Ry});var pe={};n.r(pe),n.d(pe,{init:()=>Wy,metadata:()=>Uy,name:()=>qy,settings:()=>jy});var de={};n.r(de),n.d(de,{init:()=>tv,metadata:()=>Jy,name:()=>Xy,settings:()=>ev});var ge={};n.r(ge),n.d(ge,{init:()=>sv,metadata:()=>rv,name:()=>lv,settings:()=>iv});var he={};n.r(he),n.d(he,{init:()=>yv,metadata:()=>hv,name:()=>bv,settings:()=>_v});var be={};n.r(be),n.d(be,{init:()=>Cv,metadata:()=>xv,name:()=>wv,settings:()=>Ev});var _e={};n.r(_e),n.d(_e,{init:()=>Pv,metadata:()=>Nv,name:()=>Tv,settings:()=>Iv});var ye={};n.r(ye),n.d(ye,{init:()=>Dv,metadata:()=>Av,name:()=>Hv,settings:()=>Lv});var ve={};n.r(ve),n.d(ve,{init:()=>of,metadata:()=>tf,name:()=>nf,settings:()=>af});var fe={};n.r(fe),n.d(fe,{init:()=>hk,metadata:()=>pk,name:()=>dk,settings:()=>gk});var ke={};n.r(ke),n.d(ke,{init:()=>fk,metadata:()=>_k,name:()=>yk,settings:()=>vk});var xe={};n.r(xe),n.d(xe,{init:()=>Nk,metadata:()=>Ck,name:()=>Sk,settings:()=>Bk});var we={};n.r(we),n.d(we,{init:()=>zk,metadata:()=>Ik,name:()=>Pk,settings:()=>Mk});var Ee={};n.r(Ee),n.d(Ee,{init:()=>Dk,metadata:()=>Ak,name:()=>Hk,settings:()=>Lk});var Ce={};n.r(Ce),n.d(Ce,{init:()=>Gk,metadata:()=>Vk,name:()=>$k,settings:()=>Ok});var Se={};n.r(Se),n.d(Se,{init:()=>Jk,metadata:()=>Qk,name:()=>Kk,settings:()=>Yk});var Be={};n.r(Be),n.d(Be,{init:()=>dx,metadata:()=>mx,name:()=>ux,settings:()=>px});var Ne={};n.r(Ne),n.d(Ne,{init:()=>Ax,metadata:()=>Mx,name:()=>zx,settings:()=>Rx});var Te={};n.r(Te),n.d(Te,{init:()=>Fx,metadata:()=>Hx,name:()=>Lx,settings:()=>Dx});var Ie={};n.r(Ie),n.d(Ie,{init:()=>Ux,metadata:()=>$x,name:()=>Ox,settings:()=>Gx});var Pe={};n.r(Pe),n.d(Pe,{init:()=>aw,metadata:()=>ew,name:()=>tw,settings:()=>nw});var Me={};n.r(Me),n.d(Me,{init:()=>uw,metadata:()=>sw,name:()=>cw,settings:()=>mw});var ze={};n.r(ze),n.d(ze,{init:()=>yw,metadata:()=>hw,name:()=>bw,settings:()=>_w});var Re={};n.r(Re),n.d(Re,{init:()=>Tw,metadata:()=>Sw,name:()=>Bw,settings:()=>Nw});var Ae={};n.r(Ae),n.d(Ae,{init:()=>Hw,metadata:()=>zw,name:()=>Rw,settings:()=>Aw});var He={};n.r(He),n.d(He,{init:()=>qw,metadata:()=>Ow,name:()=>Gw,settings:()=>Uw});var Le={};n.r(Le),n.d(Le,{init:()=>nE,metadata:()=>Xw,name:()=>eE,settings:()=>tE});var De={};n.r(De),n.d(De,{init:()=>uE,metadata:()=>sE,name:()=>cE,settings:()=>mE});var Fe={};n.r(Fe),n.d(Fe,{init:()=>wE,metadata:()=>fE,name:()=>kE,settings:()=>xE});var Ve={};n.r(Ve),n.d(Ve,{init:()=>oC,metadata:()=>tC,name:()=>nC,settings:()=>aC});var $e={};n.r($e),n.d($e,{init:()=>hC,metadata:()=>pC,name:()=>dC,settings:()=>gC});var Oe={};n.r(Oe),n.d(Oe,{init:()=>kC,metadata:()=>yC,name:()=>vC,settings:()=>fC});var Ge={};n.r(Ge),n.d(Ge,{init:()=>XC,metadata:()=>KC,name:()=>YC,settings:()=>JC});var Ue={};n.r(Ue),n.d(Ue,{init:()=>oS,metadata:()=>tS,name:()=>nS,settings:()=>aS});var qe={};n.r(qe),n.d(qe,{init:()=>mS,metadata:()=>iS,name:()=>sS,settings:()=>cS});var je={};n.r(je),n.d(je,{init:()=>fS,metadata:()=>_S,name:()=>yS,settings:()=>vS});var We={};n.r(We),n.d(We,{init:()=>GS,metadata:()=>VS,name:()=>$S,settings:()=>OS});var Ze={};n.r(Ze),n.d(Ze,{init:()=>oB,metadata:()=>tB,name:()=>nB,settings:()=>aB});const Qe=window.wp.blocks,Ke=window.React,Ye=window.wp.primitives,Je=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M11.934 7.406a1 1 0 0 0 .914.594H19a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5h5.764a.5.5 0 0 1 .447.276l.723 1.63Zm1.064-1.216a.5.5 0 0 0 .462.31H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.764a2 2 0 0 1 1.789 1.106l.445 1.084ZM8.5 10.5h7V12h-7v-1.5Zm7 3.5h-7v1.5h7V14Z"}));function Xe(e){if(!e)return;const{metadata:t,settings:n,name:a}=e;return(0,Qe.registerBlockType)({name:a,...t},n)}const et=window.wp.components,tt=window.wp.i18n,nt=window.wp.blockEditor,at=window.wp.serverSideRender;var ot=n.n(at);const rt={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/archives",title:"Archives",category:"widgets",description:"Display a date archive of your posts.",textdomain:"default",attributes:{displayAsDropdown:{type:"boolean",default:!1},showLabel:{type:"boolean",default:!0},showPostCounts:{type:"boolean",default:!1},type:{type:"string",default:"monthly"}},supports:{align:!0,html:!1,spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-archives-editor"},{name:lt}=rt,it={icon:Je,example:{},edit:function({attributes:e,setAttributes:t}){const{showLabel:n,showPostCounts:a,displayAsDropdown:o,type:r}=e;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display as dropdown"),checked:o,onChange:()=>t({displayAsDropdown:!o})}),o&&(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show label"),checked:n,onChange:()=>t({showLabel:!n})}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show post counts"),checked:a,onChange:()=>t({showPostCounts:!a})}),(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Group by:"),options:[{label:(0,tt.__)("Year"),value:"yearly"},{label:(0,tt.__)("Month"),value:"monthly"},{label:(0,tt.__)("Week"),value:"weekly"},{label:(0,tt.__)("Day"),value:"daily"}],value:r,onChange:e=>t({type:e})}))),(0,Ke.createElement)("div",{...(0,nt.useBlockProps)()},(0,Ke.createElement)(et.Disabled,null,(0,Ke.createElement)(ot(),{block:"core/archives",skipBlockSupportAttributes:!0,attributes:e}))))}},st=()=>Xe({name:lt,metadata:rt,settings:it}),ct=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{fillRule:"evenodd",d:"M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",clipRule:"evenodd"}));var mt=n(5755),ut=n.n(mt);const pt=window.wp.url,dt=window.wp.coreData,gt=window.wp.data;function ht(e){const t=e?e[0]:24,n=e?e[e.length-1]:96;return{minSize:t,maxSize:Math.floor(2.5*n)}}function bt(){const{avatarURL:e}=(0,gt.useSelect)((e=>{const{getSettings:t}=e(nt.store),{__experimentalDiscussionSettings:n}=t();return n}));return e}const _t=window.wp.element,yt={who:"authors",per_page:-1,_fields:"id,name",context:"view"};const vt=function({value:e,onChange:t}){const[n,a]=(0,_t.useState)(),o=(0,gt.useSelect)((e=>{const{getUsers:t}=e(dt.store);return t(yt)}),[]);if(!o)return null;const r=o.map((e=>({label:e.name,value:e.id})));return(0,Ke.createElement)(et.ComboboxControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("User"),help:(0,tt.__)("Select the avatar user to display, if it is blank it will use the post/page author."),value:e,onChange:t,options:n||r,onFilterValueChange:e=>a(r.filter((t=>t.label.toLowerCase().startsWith(e.toLowerCase()))))})},ft=({setAttributes:e,avatar:t,attributes:n,selectUser:a})=>(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Image size"),onChange:t=>e({size:t}),min:t.minSize,max:t.maxSize,initialPosition:n?.size,value:n?.size}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link to user profile"),onChange:()=>e({isLink:!n.isLink}),checked:n.isLink}),n.isLink&&(0,Ke.createElement)(et.ToggleControl,{label:(0,tt.__)("Open in new tab"),onChange:t=>e({linkTarget:t?"_blank":"_self"}),checked:"_blank"===n.linkTarget}),a&&(0,Ke.createElement)(vt,{value:n?.userId,onChange:t=>{e({userId:t})}}))),kt=({setAttributes:e,attributes:t,avatar:n,blockProps:a,isSelected:o})=>{const r=(0,nt.__experimentalUseBorderProps)(t),l=(0,pt.addQueryArgs)((0,pt.removeQueryArgs)(n?.src,["s"]),{s:2*t?.size});return(0,Ke.createElement)("div",{...a},(0,Ke.createElement)(et.ResizableBox,{size:{width:t.size,height:t.size},showHandle:o,onResizeStop:(n,a,o,r)=>{e({size:parseInt(t.size+(r.height||r.width),10)})},lockAspectRatio:!0,enable:{top:!1,right:!(0,tt.isRTL)(),bottom:!0,left:(0,tt.isRTL)()},minWidth:n.minSize,maxWidth:n.maxSize},(0,Ke.createElement)("img",{src:l,alt:n.alt,className:ut()("avatar","avatar-"+t.size,"photo","wp-block-avatar__image",r.className),style:r.style})))},xt=({attributes:e,context:t,setAttributes:n,isSelected:a})=>{const{commentId:o}=t,r=(0,nt.useBlockProps)(),l=function({commentId:e}){const[t]=(0,dt.useEntityProp)("root","comment","author_avatar_urls",e),[n]=(0,dt.useEntityProp)("root","comment","author_name",e),a=t?Object.values(t):null,o=t?Object.keys(t):null,{minSize:r,maxSize:l}=ht(o),i=bt();return{src:a?a[a.length-1]:i,minSize:r,maxSize:l,alt:n?(0,tt.sprintf)((0,tt.__)("%s Avatar"),n):(0,tt.__)("Default Avatar")}}({commentId:o});return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(ft,{avatar:l,setAttributes:n,attributes:e,selectUser:!1}),e.isLink?(0,Ke.createElement)("a",{href:"#avatar-pseudo-link",className:"wp-block-avatar__link",onClick:e=>e.preventDefault()},(0,Ke.createElement)(kt,{attributes:e,avatar:l,blockProps:r,isSelected:a,setAttributes:n})):(0,Ke.createElement)(kt,{attributes:e,avatar:l,blockProps:r,isSelected:a,setAttributes:n}))},wt=({attributes:e,context:t,setAttributes:n,isSelected:a})=>{const{postId:o,postType:r}=t,l=function({userId:e,postId:t,postType:n}){const{authorDetails:a}=(0,gt.useSelect)((a=>{const{getEditedEntityRecord:o,getUser:r}=a(dt.store);if(e)return{authorDetails:r(e)};const l=o("postType",n,t)?.author;return{authorDetails:l?r(l):null}}),[n,t,e]),o=a?.avatar_urls?Object.values(a.avatar_urls):null,r=a?.avatar_urls?Object.keys(a.avatar_urls):null,{minSize:l,maxSize:i}=ht(r),s=bt();return{src:o?o[o.length-1]:s,minSize:l,maxSize:i,alt:a?(0,tt.sprintf)((0,tt.__)("%s Avatar"),a?.name):(0,tt.__)("Default Avatar")}}({userId:e?.userId,postId:o,postType:r}),i=(0,nt.useBlockProps)();return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(ft,{selectUser:!0,attributes:e,avatar:l,setAttributes:n}),e.isLink?(0,Ke.createElement)("a",{href:"#avatar-pseudo-link",className:"wp-block-avatar__link",onClick:e=>e.preventDefault()},(0,Ke.createElement)(kt,{attributes:e,avatar:l,blockProps:i,isSelected:a,setAttributes:n})):(0,Ke.createElement)(kt,{attributes:e,avatar:l,blockProps:i,isSelected:a,setAttributes:n}))};const Et={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/avatar",title:"Avatar",category:"theme",description:"Add a user’s avatar.",textdomain:"default",attributes:{userId:{type:"number"},size:{type:"number",default:96},isLink:{type:"boolean",default:!1},linkTarget:{type:"string",default:"_self"}},usesContext:["postType","postId","commentId"],supports:{html:!1,align:!0,alignWide:!1,spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},__experimentalBorder:{__experimentalSkipSerialization:!0,radius:!0,width:!0,color:!0,style:!0,__experimentalDefaultControls:{radius:!0}},color:{text:!1,background:!1,__experimentalDuotone:"img"},interactivity:{clientNavigation:!0}},selectors:{border:".wp-block-avatar img"},editorStyle:"wp-block-avatar-editor",style:"wp-block-avatar"},{name:Ct}=Et,St={icon:ct,edit:function(e){return e?.context?.commentId||null===e?.context?.commentId?(0,Ke.createElement)(xt,{...e}):(0,Ke.createElement)(wt,{...e})}},Bt=()=>Xe({name:Ct,metadata:Et,settings:St}),Nt=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M17.7 4.3c-1.2 0-2.8 0-3.8 1-.6.6-.9 1.5-.9 2.6V14c-.6-.6-1.5-1-2.5-1C8.6 13 7 14.6 7 16.5S8.6 20 10.5 20c1.5 0 2.8-1 3.3-2.3.5-.8.7-1.8.7-2.5V7.9c0-.7.2-1.2.5-1.6.6-.6 1.8-.6 2.8-.6h.3V4.3h-.4z"})),Tt=[{attributes:{src:{type:"string",source:"attribute",selector:"audio",attribute:"src"},caption:{type:"string",source:"html",selector:"figcaption"},id:{type:"number"},autoplay:{type:"boolean",source:"attribute",selector:"audio",attribute:"autoplay"},loop:{type:"boolean",source:"attribute",selector:"audio",attribute:"loop"},preload:{type:"string",source:"attribute",selector:"audio",attribute:"preload"}},supports:{align:!0},save({attributes:e}){const{autoplay:t,caption:n,loop:a,preload:o,src:r}=e;return(0,Ke.createElement)("figure",null,(0,Ke.createElement)("audio",{controls:"controls",src:r,autoPlay:t,loop:a,preload:o}),!nt.RichText.isEmpty(n)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:n}))}}],It=window.wp.blob,Pt=window.wp.notices;var Mt=n(1668),zt=n.n(Mt);function Rt(e,t){var n,a,o=0;function r(){var r,l,i=n,s=arguments.length;e:for(;i;){if(i.args.length===arguments.length){for(l=0;l<s;l++)if(i.args[l]!==arguments[l]){i=i.next;continue e}return i!==n&&(i===a&&(a=i.prev),i.prev.next=i.next,i.next&&(i.next.prev=i.prev),i.next=n,i.prev=null,n.prev=i,n=i),i.val}i=i.next}for(r=new Array(s),l=0;l<s;l++)r[l]=arguments[l];return i={args:r,val:e.apply(null,r)},n?(n.prev=i,i.next=n):a=i,o===t.maxSize?(a=a.prev).next=null:o++,n=i,i.val}return t=t||{},r.clear=function(){n=null,a=null,o=0},r}const At=[{ratio:"2.33",className:"wp-embed-aspect-21-9"},{ratio:"2.00",className:"wp-embed-aspect-18-9"},{ratio:"1.78",className:"wp-embed-aspect-16-9"},{ratio:"1.33",className:"wp-embed-aspect-4-3"},{ratio:"1.00",className:"wp-embed-aspect-1-1"},{ratio:"0.56",className:"wp-embed-aspect-9-16"},{ratio:"0.50",className:"wp-embed-aspect-1-2"}],Ht="wp-embed",Lt=window.wp.privateApis,{lock:Dt,unlock:Ft}=(0,Lt.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/block-library"),{name:Vt}={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/embed",title:"Embed",category:"embed",description:"Add a block that displays content pulled from other sites, like Twitter or YouTube.",textdomain:"default",attributes:{url:{type:"string",__experimentalRole:"content"},caption:{type:"rich-text",source:"rich-text",selector:"figcaption",__experimentalRole:"content"},type:{type:"string",__experimentalRole:"content"},providerNameSlug:{type:"string",__experimentalRole:"content"},allowResponsive:{type:"boolean",default:!0},responsive:{type:"boolean",default:!1,__experimentalRole:"content"},previewable:{type:"boolean",default:!0,__experimentalRole:"content"}},supports:{align:!0,spacing:{margin:!0},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-embed-editor",style:"wp-block-embed"},$t=e=>e&&e.includes('class="wp-embedded-content"'),Ot=(e,t={})=>{const{preview:n,attributes:a={}}=e,{url:o,providerNameSlug:r,type:l,...i}=a;if(!o||!(0,Qe.getBlockType)(Vt))return;const s=(e=>(0,Qe.getBlockVariations)(Vt)?.find((({patterns:t})=>((e,t=[])=>t.some((t=>e.match(t))))(e,t))))(o),c="wordpress"===r||l===Ht;if(!c&&s&&(s.attributes.providerNameSlug!==r||!r))return(0,Qe.createBlock)(Vt,{url:o,...i,...s.attributes});const m=(0,Qe.getBlockVariations)(Vt)?.find((({name:e})=>"wordpress"===e));return m&&n&&$t(n.html)&&!c?(0,Qe.createBlock)(Vt,{url:o,...m.attributes,...t}):void 0},Gt=e=>{if(!e)return e;const t=At.reduce(((e,{className:t})=>(e[t]=!1,e)),{"wp-has-aspect-ratio":!1});return zt()(e,t)};function Ut(e,t,n=!0){if(!n)return Gt(t);const a=document.implementation.createHTMLDocument("");a.body.innerHTML=e;const o=a.body.querySelector("iframe");if(o&&o.height&&o.width){const e=(o.width/o.height).toFixed(2);for(let n=0;n<At.length;n++){const a=At[n];if(e>=a.ratio){return e-a.ratio>.1?Gt(t):zt()(Gt(t),a.className,"wp-has-aspect-ratio")}}}return t}const qt=Rt(((e,t,n,a,o=!0)=>{if(!e)return{};const r={};let{type:l="rich"}=e;const{html:i,provider_name:s}=e,{kebabCase:c}=Ft(et.privateApis),m=c((s||t).toLowerCase());return $t(i)&&(l=Ht),(i||"photo"===l)&&(r.type=l,r.providerNameSlug=m),(u=n)&&At.some((({className:e})=>u.includes(e)))||(r.className=Ut(i,n,a&&o)),r;var u})),jt=window.wp.compose,Wt=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6 5.5h12a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5ZM4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6Zm4 10h2v-1.5H8V16Zm5 0h-2v-1.5h2V16Zm1 0h2v-1.5h-2V16Z"})),{PrivateRichText:Zt}=Ft(nt.privateApis);function Qt({key:e="caption",attributes:t,setAttributes:n,isSelected:a,insertBlocksAfter:o,placeholder:r=(0,tt.__)("Add caption"),label:l=(0,tt.__)("Caption text"),showToolbarButton:i=!0,className:s,disableEditing:c}){const m=t[e],u=(0,jt.usePrevious)(m),p=Zt.isEmpty(m),d=Zt.isEmpty(u),[g,h]=(0,_t.useState)(!p);(0,_t.useEffect)((()=>{!p&&d&&h(!0)}),[p,d]),(0,_t.useEffect)((()=>{!a&&p&&h(!1)}),[a,p]);const b=(0,_t.useCallback)((e=>{e&&p&&e.focus()}),[p]);return(0,Ke.createElement)(Ke.Fragment,null,i&&(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(et.ToolbarButton,{onClick:()=>{h(!g),g&&m&&n({caption:void 0})},icon:Wt,isPressed:g,label:g?(0,tt.__)("Remove caption"):(0,tt.__)("Add caption")})),g&&(!Zt.isEmpty(m)||a)&&(0,Ke.createElement)(Zt,{identifier:e,tagName:"figcaption",className:ut()(s,(0,nt.__experimentalGetElementClassName)("caption")),ref:b,"aria-label":l,placeholder:r,value:m,onChange:e=>n({caption:e}),inlineToolbar:!0,__unstableOnSplitAtEnd:()=>o((0,Qe.createBlock)((0,Qe.getDefaultBlockName)())),disableEditing:c}))}const Kt=["audio"];const Yt=function({attributes:e,className:t,setAttributes:n,onReplace:a,isSelected:o,insertBlocksAfter:r}){const{id:l,autoplay:i,loop:s,preload:c,src:m}=e,u=!l&&(0,It.isBlobURL)(m),{getSettings:p}=(0,gt.useSelect)(nt.store);function d(e){return t=>{n({[e]:t})}}function g(e){if(e!==m){const t=Ot({attributes:{url:e}});if(void 0!==t&&a)return void a(t);n({src:e,id:void 0})}}(0,_t.useEffect)((()=>{if(!l&&(0,It.isBlobURL)(m)){const e=(0,It.getBlobByURL)(m);e&&p().mediaUpload({filesList:[e],onFileChange:([e])=>_(e),onError:e=>b(e),allowedTypes:Kt})}}),[]);const{createErrorNotice:h}=(0,gt.useDispatch)(Pt.store);function b(e){h(e,{type:"snackbar"})}function _(e){e&&e.url?n({src:e.url,id:e.id,caption:e.caption}):n({src:void 0,id:void 0,caption:void 0})}const y=ut()(t,{"is-transient":u}),v=(0,nt.useBlockProps)({className:y});return m?(0,Ke.createElement)(Ke.Fragment,null,o&&(0,Ke.createElement)(nt.BlockControls,{group:"other"},(0,Ke.createElement)(nt.MediaReplaceFlow,{mediaId:l,mediaURL:m,allowedTypes:Kt,accept:"audio/*",onSelect:_,onSelectURL:g,onError:b})),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Autoplay"),onChange:d("autoplay"),checked:i,help:function(e){return e?(0,tt.__)("Autoplay may cause usability issues for some users."):null}}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Loop"),onChange:d("loop"),checked:s}),(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt._x)("Preload","noun; Audio block parameter"),value:c||"",onChange:e=>n({preload:e||void 0}),options:[{value:"",label:(0,tt.__)("Browser default")},{value:"auto",label:(0,tt.__)("Auto")},{value:"metadata",label:(0,tt.__)("Metadata")},{value:"none",label:(0,tt._x)("None","Preload value")}]}))),(0,Ke.createElement)("figure",{...v},(0,Ke.createElement)(et.Disabled,{isDisabled:!o},(0,Ke.createElement)("audio",{controls:"controls",src:m})),u&&(0,Ke.createElement)(et.Spinner,null),(0,Ke.createElement)(Qt,{attributes:e,setAttributes:n,isSelected:o,insertBlocksAfter:r,label:(0,tt.__)("Audio caption text"),showToolbarButton:o}))):(0,Ke.createElement)("div",{...v},(0,Ke.createElement)(nt.MediaPlaceholder,{icon:(0,Ke.createElement)(nt.BlockIcon,{icon:Nt}),onSelect:_,onSelectURL:g,accept:"audio/*",allowedTypes:Kt,value:e,onError:b}))};const Jt={from:[{type:"files",isMatch:e=>1===e.length&&0===e[0].type.indexOf("audio/"),transform(e){const t=e[0];return(0,Qe.createBlock)("core/audio",{src:(0,It.createBlobURL)(t)})}},{type:"shortcode",tag:"audio",attributes:{src:{type:"string",shortcode:({named:{src:e,mp3:t,m4a:n,ogg:a,wav:o,wma:r}})=>e||t||n||a||o||r},loop:{type:"string",shortcode:({named:{loop:e}})=>e},autoplay:{type:"string",shortcode:({named:{autoplay:e}})=>e},preload:{type:"string",shortcode:({named:{preload:e}})=>e}}}]},Xt=Jt,en={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/audio",title:"Audio",category:"media",description:"Embed a simple audio player.",keywords:["music","sound","podcast","recording"],textdomain:"default",attributes:{src:{type:"string",source:"attribute",selector:"audio",attribute:"src",__experimentalRole:"content"},caption:{type:"rich-text",source:"rich-text",selector:"figcaption",__experimentalRole:"content"},id:{type:"number",__experimentalRole:"content"},autoplay:{type:"boolean",source:"attribute",selector:"audio",attribute:"autoplay"},loop:{type:"boolean",source:"attribute",selector:"audio",attribute:"loop"},preload:{type:"string",source:"attribute",selector:"audio",attribute:"preload"}},supports:{anchor:!0,align:!0,spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-audio-editor",style:"wp-block-audio"},{name:tn}=en,nn={icon:Nt,example:{attributes:{src:"https://upload.wikimedia.org/wikipedia/commons/d/dd/Armstrong_Small_Step.ogg"},viewportWidth:350},transforms:Xt,deprecated:Tt,edit:Yt,save:function({attributes:e}){const{autoplay:t,caption:n,loop:a,preload:o,src:r}=e;return r&&(0,Ke.createElement)("figure",{...nt.useBlockProps.save()},(0,Ke.createElement)("audio",{controls:"controls",src:r,autoPlay:t,loop:a,preload:o}),!nt.RichText.isEmpty(n)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:n,className:(0,nt.__experimentalGetElementClassName)("caption")}))}},an=()=>Xe({name:tn,metadata:en,settings:nn}),on=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z"})),{cleanEmptyObject:rn}=Ft(nt.privateApis);function ln(e){if(!e?.style?.typography?.fontFamily)return e;const{fontFamily:t,...n}=e.style.typography;return{...e,style:rn({...e.style,typography:n}),fontFamily:t.split("|").pop()}}const sn=e=>{const{borderRadius:t,...n}=e,a=[t,n.style?.border?.radius].find((e=>"number"==typeof e&&0!==e));return a?{...n,style:{...n.style,border:{...n.style?.border,radius:`${a}px`}}}:n};const cn=e=>{if(!e.customTextColor&&!e.customBackgroundColor&&!e.customGradient)return e;const t={color:{}};e.customTextColor&&(t.color.text=e.customTextColor),e.customBackgroundColor&&(t.color.background=e.customBackgroundColor),e.customGradient&&(t.color.gradient=e.customGradient);const{customTextColor:n,customBackgroundColor:a,customGradient:o,...r}=e;return{...r,style:t}},mn=e=>{const{color:t,textColor:n,...a}={...e,customTextColor:e.textColor&&"#"===e.textColor[0]?e.textColor:void 0,customBackgroundColor:e.color&&"#"===e.color[0]?e.color:void 0};return cn(a)},un={url:{type:"string",source:"attribute",selector:"a",attribute:"href"},title:{type:"string",source:"attribute",selector:"a",attribute:"title"},text:{type:"string",source:"html",selector:"a"}},pn={attributes:{url:{type:"string",source:"attribute",selector:"a",attribute:"href"},title:{type:"string",source:"attribute",selector:"a",attribute:"title"},text:{type:"string",source:"html",selector:"a"},linkTarget:{type:"string",source:"attribute",selector:"a",attribute:"target"},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel"},placeholder:{type:"string"},backgroundColor:{type:"string"},textColor:{type:"string"},gradient:{type:"string"},width:{type:"number"}},supports:{anchor:!0,align:!0,alignWide:!1,color:{__experimentalSkipSerialization:!0,gradients:!0,__experimentalDefaultControls:{background:!0,text:!0}},typography:{fontSize:!0,__experimentalFontFamily:!0,__experimentalDefaultControls:{fontSize:!0}},reusable:!1,spacing:{__experimentalSkipSerialization:!0,padding:["horizontal","vertical"],__experimentalDefaultControls:{padding:!0}},__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0,__experimentalDefaultControls:{radius:!0}},__experimentalSelector:".wp-block-button__link"},save({attributes:e,className:t}){const{fontSize:n,linkTarget:a,rel:o,style:r,text:l,title:i,url:s,width:c}=e;if(!l)return null;const m=(0,nt.__experimentalGetBorderClassesAndStyles)(e),u=(0,nt.__experimentalGetColorClassesAndStyles)(e),p=(0,nt.__experimentalGetSpacingClassesAndStyles)(e),d=ut()("wp-block-button__link",u.className,m.className,{"no-border-radius":0===r?.border?.radius}),g={...m.style,...u.style,...p.style},h=ut()(t,{[`has-custom-width wp-block-button__width-${c}`]:c,"has-custom-font-size":n||r?.typography?.fontSize});return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:h})},(0,Ke.createElement)(nt.RichText.Content,{tagName:"a",className:d,href:s,title:i,style:g,value:l,target:a,rel:o}))}},dn={attributes:{url:{type:"string",source:"attribute",selector:"a",attribute:"href"},title:{type:"string",source:"attribute",selector:"a",attribute:"title"},text:{type:"string",source:"html",selector:"a"},linkTarget:{type:"string",source:"attribute",selector:"a",attribute:"target"},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel"},placeholder:{type:"string"},backgroundColor:{type:"string"},textColor:{type:"string"},gradient:{type:"string"},width:{type:"number"}},supports:{anchor:!0,align:!0,alignWide:!1,color:{__experimentalSkipSerialization:!0,gradients:!0},typography:{fontSize:!0,__experimentalFontFamily:!0},reusable:!1,spacing:{__experimentalSkipSerialization:!0,padding:["horizontal","vertical"],__experimentalDefaultControls:{padding:!0}},__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wp-block-button__link"},save({attributes:e,className:t}){const{fontSize:n,linkTarget:a,rel:o,style:r,text:l,title:i,url:s,width:c}=e;if(!l)return null;const m=(0,nt.__experimentalGetBorderClassesAndStyles)(e),u=(0,nt.__experimentalGetColorClassesAndStyles)(e),p=(0,nt.__experimentalGetSpacingClassesAndStyles)(e),d=ut()("wp-block-button__link",u.className,m.className,{"no-border-radius":0===r?.border?.radius}),g={...m.style,...u.style,...p.style},h=ut()(t,{[`has-custom-width wp-block-button__width-${c}`]:c,"has-custom-font-size":n||r?.typography?.fontSize});return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:h})},(0,Ke.createElement)(nt.RichText.Content,{tagName:"a",className:d,href:s,title:i,style:g,value:l,target:a,rel:o}))},migrate:ln,isEligible:({style:e})=>e?.typography?.fontFamily},gn=[pn,dn,{supports:{anchor:!0,align:!0,alignWide:!1,color:{__experimentalSkipSerialization:!0,gradients:!0},typography:{fontSize:!0,__experimentalFontFamily:!0},reusable:!1,__experimentalSelector:".wp-block-button__link"},attributes:{...un,linkTarget:{type:"string",source:"attribute",selector:"a",attribute:"target"},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel"},placeholder:{type:"string"},backgroundColor:{type:"string"},textColor:{type:"string"},gradient:{type:"string"},width:{type:"number"}},isEligible:({style:e})=>"number"==typeof e?.border?.radius,save({attributes:e,className:t}){const{fontSize:n,linkTarget:a,rel:o,style:r,text:l,title:i,url:s,width:c}=e;if(!l)return null;const m=r?.border?.radius,u=(0,nt.__experimentalGetColorClassesAndStyles)(e),p=ut()("wp-block-button__link",u.className,{"no-border-radius":0===r?.border?.radius}),d={borderRadius:m||void 0,...u.style},g=ut()(t,{[`has-custom-width wp-block-button__width-${c}`]:c,"has-custom-font-size":n||r?.typography?.fontSize});return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:g})},(0,Ke.createElement)(nt.RichText.Content,{tagName:"a",className:p,href:s,title:i,style:d,value:l,target:a,rel:o}))},migrate:(0,jt.compose)(ln,sn)},{supports:{anchor:!0,align:!0,alignWide:!1,color:{__experimentalSkipSerialization:!0},reusable:!1,__experimentalSelector:".wp-block-button__link"},attributes:{...un,linkTarget:{type:"string",source:"attribute",selector:"a",attribute:"target"},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel"},placeholder:{type:"string"},borderRadius:{type:"number"},backgroundColor:{type:"string"},textColor:{type:"string"},gradient:{type:"string"},style:{type:"object"},width:{type:"number"}},save({attributes:e,className:t}){const{borderRadius:n,linkTarget:a,rel:o,text:r,title:l,url:i,width:s}=e,c=(0,nt.__experimentalGetColorClassesAndStyles)(e),m=ut()("wp-block-button__link",c.className,{"no-border-radius":0===n}),u={borderRadius:n?n+"px":void 0,...c.style},p=ut()(t,{[`has-custom-width wp-block-button__width-${s}`]:s});return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:p})},(0,Ke.createElement)(nt.RichText.Content,{tagName:"a",className:m,href:i,title:l,style:u,value:r,target:a,rel:o}))},migrate:(0,jt.compose)(ln,sn)},{supports:{anchor:!0,align:!0,alignWide:!1,color:{__experimentalSkipSerialization:!0},reusable:!1,__experimentalSelector:".wp-block-button__link"},attributes:{...un,linkTarget:{type:"string",source:"attribute",selector:"a",attribute:"target"},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel"},placeholder:{type:"string"},borderRadius:{type:"number"},backgroundColor:{type:"string"},textColor:{type:"string"},gradient:{type:"string"},style:{type:"object"},width:{type:"number"}},save({attributes:e,className:t}){const{borderRadius:n,linkTarget:a,rel:o,text:r,title:l,url:i,width:s}=e,c=(0,nt.__experimentalGetColorClassesAndStyles)(e),m=ut()("wp-block-button__link",c.className,{"no-border-radius":0===n}),u={borderRadius:n?n+"px":void 0,...c.style},p=ut()(t,{[`has-custom-width wp-block-button__width-${s}`]:s});return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:p})},(0,Ke.createElement)(nt.RichText.Content,{tagName:"a",className:m,href:i,title:l,style:u,value:r,target:a,rel:o}))},migrate:(0,jt.compose)(ln,sn)},{supports:{align:!0,alignWide:!1,color:{gradients:!0}},attributes:{...un,linkTarget:{type:"string",source:"attribute",selector:"a",attribute:"target"},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel"},placeholder:{type:"string"},borderRadius:{type:"number"},backgroundColor:{type:"string"},textColor:{type:"string"},gradient:{type:"string"},style:{type:"object"}},save({attributes:e}){const{borderRadius:t,linkTarget:n,rel:a,text:o,title:r,url:l}=e,i=ut()("wp-block-button__link",{"no-border-radius":0===t}),s={borderRadius:t?t+"px":void 0};return(0,Ke.createElement)(nt.RichText.Content,{tagName:"a",className:i,href:l,title:r,style:s,value:o,target:n,rel:a})},migrate:sn},{supports:{align:!0,alignWide:!1},attributes:{...un,linkTarget:{type:"string",source:"attribute",selector:"a",attribute:"target"},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel"},placeholder:{type:"string"},borderRadius:{type:"number"},backgroundColor:{type:"string"},textColor:{type:"string"},customBackgroundColor:{type:"string"},customTextColor:{type:"string"},customGradient:{type:"string"},gradient:{type:"string"}},isEligible:e=>!!(e.customTextColor||e.customBackgroundColor||e.customGradient||e.align),migrate:(0,jt.compose)(sn,cn,(function(e){if(!e.align)return e;const{align:t,...n}=e;return{...n,className:ut()(n.className,`align${e.align}`)}})),save({attributes:e}){const{backgroundColor:t,borderRadius:n,customBackgroundColor:a,customTextColor:o,customGradient:r,linkTarget:l,gradient:i,rel:s,text:c,textColor:m,title:u,url:p}=e,d=(0,nt.getColorClassName)("color",m),g=!r&&(0,nt.getColorClassName)("background-color",t),h=(0,nt.__experimentalGetGradientClass)(i),b=ut()("wp-block-button__link",{"has-text-color":m||o,[d]:d,"has-background":t||a||r||i,[g]:g,"no-border-radius":0===n,[h]:h}),_={background:r||void 0,backgroundColor:g||r||i?void 0:a,color:d?void 0:o,borderRadius:n?n+"px":void 0};return(0,Ke.createElement)("div",null,(0,Ke.createElement)(nt.RichText.Content,{tagName:"a",className:b,href:p,title:u,style:_,value:c,target:l,rel:s}))}},{attributes:{...un,align:{type:"string",default:"none"},backgroundColor:{type:"string"},textColor:{type:"string"},customBackgroundColor:{type:"string"},customTextColor:{type:"string"},linkTarget:{type:"string",source:"attribute",selector:"a",attribute:"target"},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel"},placeholder:{type:"string"}},isEligible:e=>e.className&&e.className.includes("is-style-squared"),migrate(e){let t=e.className;return t&&(t=t.replace(/is-style-squared[\s]?/,"").trim()),sn(cn({...e,className:t||void 0,borderRadius:0}))},save({attributes:e}){const{backgroundColor:t,customBackgroundColor:n,customTextColor:a,linkTarget:o,rel:r,text:l,textColor:i,title:s,url:c}=e,m=(0,nt.getColorClassName)("color",i),u=(0,nt.getColorClassName)("background-color",t),p=ut()("wp-block-button__link",{"has-text-color":i||a,[m]:m,"has-background":t||n,[u]:u}),d={backgroundColor:u?void 0:n,color:m?void 0:a};return(0,Ke.createElement)("div",null,(0,Ke.createElement)(nt.RichText.Content,{tagName:"a",className:p,href:c,title:s,style:d,value:l,target:o,rel:r}))}},{attributes:{...un,align:{type:"string",default:"none"},backgroundColor:{type:"string"},textColor:{type:"string"},customBackgroundColor:{type:"string"},customTextColor:{type:"string"}},migrate:mn,save({attributes:e}){const{url:t,text:n,title:a,backgroundColor:o,textColor:r,customBackgroundColor:l,customTextColor:i}=e,s=(0,nt.getColorClassName)("color",r),c=(0,nt.getColorClassName)("background-color",o),m=ut()("wp-block-button__link",{"has-text-color":r||i,[s]:s,"has-background":o||l,[c]:c}),u={backgroundColor:c?void 0:l,color:s?void 0:i};return(0,Ke.createElement)("div",null,(0,Ke.createElement)(nt.RichText.Content,{tagName:"a",className:m,href:t,title:a,style:u,value:n}))}},{attributes:{...un,color:{type:"string"},textColor:{type:"string"},align:{type:"string",default:"none"}},save({attributes:e}){const{url:t,text:n,title:a,align:o,color:r,textColor:l}=e,i={backgroundColor:r,color:l};return(0,Ke.createElement)("div",{className:`align${o}`},(0,Ke.createElement)(nt.RichText.Content,{tagName:"a",className:"wp-block-button__link",href:t,title:a,style:i,value:n}))},migrate:mn},{attributes:{...un,color:{type:"string"},textColor:{type:"string"},align:{type:"string",default:"none"}},save({attributes:e}){const{url:t,text:n,title:a,align:o,color:r,textColor:l}=e;return(0,Ke.createElement)("div",{className:`align${o}`,style:{backgroundColor:r}},(0,Ke.createElement)(nt.RichText.Content,{tagName:"a",href:t,title:a,style:{color:l},value:n}))},migrate:mn}],hn=gn,bn="noreferrer noopener",_n="_blank",yn="nofollow";function vn(e){return e.toString().replace(/<\/?a[^>]*>/g,"")}const fn=window.wp.keycodes,kn=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})),xn=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"})),wn=[...nt.__experimentalLinkControl.DEFAULT_LINK_SETTINGS,{id:"nofollow",title:(0,tt.__)("Mark as nofollow")}];function En({selectedWidth:e,setAttributes:t}){return(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Width settings")},(0,Ke.createElement)(et.ButtonGroup,{"aria-label":(0,tt.__)("Button width")},[25,50,75,100].map((n=>(0,Ke.createElement)(et.Button,{key:n,size:"small",variant:n===e?"primary":void 0,onClick:()=>{var a;t({width:e===(a=n)?void 0:a})}},n,"%")))))}const Cn=function(e){const{attributes:t,setAttributes:n,className:a,isSelected:o,onReplace:r,mergeBlocks:l,clientId:i}=e,{tagName:s,textAlign:c,linkTarget:m,placeholder:u,rel:p,style:d,text:g,url:h,width:b,metadata:_}=t,y=s||"a",[v,f]=(0,_t.useState)(null),k=(0,nt.__experimentalUseBorderProps)(t),x=(0,nt.__experimentalUseColorProps)(t),w=(0,nt.__experimentalGetSpacingClassesAndStyles)(t),E=(0,nt.__experimentalGetShadowClassesAndStyles)(t),C=(0,_t.useRef)(),S=(0,_t.useRef)(),B=(0,nt.useBlockProps)({ref:(0,jt.useMergeRefs)([f,C]),onKeyDown:function(e){fn.isKeyboardEvent.primary(e,"k")?A(e):fn.isKeyboardEvent.primaryShift(e,"k")&&(H(),S.current?.focus())}}),N=(0,nt.useBlockEditingMode)(),[T,I]=(0,_t.useState)(!1),P=!!h,M=m===_n,z=!!p?.includes(yn),R="a"===y;function A(e){e.preventDefault(),I(!0)}function H(){n({url:void 0,linkTarget:void 0,rel:void 0}),I(!1)}(0,_t.useEffect)((()=>{o||I(!1)}),[o]);const L=(0,_t.useMemo)((()=>({url:h,opensInNewTab:M,nofollow:z})),[h,M,z]),D=function(e){const{replaceBlocks:t,selectionChange:n}=(0,gt.useDispatch)(nt.store),{getBlock:a,getBlockRootClientId:o,getBlockIndex:r}=(0,gt.useSelect)(nt.store),l=(0,_t.useRef)(e);return l.current=e,(0,jt.useRefEffect)((e=>{function i(e){if(e.defaultPrevented||e.keyCode!==fn.ENTER)return;const{content:i,clientId:s}=l.current;if(i.length)return;e.preventDefault();const c=a(o(s)),m=r(s),u=(0,Qe.cloneBlock)({...c,innerBlocks:c.innerBlocks.slice(0,m)}),p=(0,Qe.createBlock)((0,Qe.getDefaultBlockName)()),d=c.innerBlocks.slice(m+1),g=d.length?[(0,Qe.cloneBlock)({...c,innerBlocks:d})]:[];t(c.clientId,[u,p,...g],1),n(p.clientId)}return e.addEventListener("keydown",i),()=>{e.removeEventListener("keydown",i)}}),[])}({content:g,clientId:i}),F=(0,jt.useMergeRefs)([D,S]),{lockUrlControls:V=!1}=(0,gt.useSelect)((e=>{if(!o)return{};const t=Ft(e(Qe.store)).getBlockBindingsSource(_?.bindings?.url?.source);return{lockUrlControls:!!_?.bindings?.url&&(!t||t?.lockAttributesEditing)}}),[o]);return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("div",{...B,className:ut()(B.className,{[`has-custom-width wp-block-button__width-${b}`]:b,"has-custom-font-size":B.style.fontSize})},(0,Ke.createElement)(nt.RichText,{ref:F,"aria-label":(0,tt.__)("Button text"),placeholder:u||(0,tt.__)("Add text…"),value:g,onChange:e=>n({text:vn(e)}),withoutInteractiveFormatting:!0,className:ut()(a,"wp-block-button__link",x.className,k.className,{[`has-text-align-${c}`]:c,"no-border-radius":0===d?.border?.radius},(0,nt.__experimentalGetElementClassName)("button")),style:{...k.style,...x.style,...w.style,...E.style},onSplit:e=>(0,Qe.createBlock)("core/button",{...t,text:e}),onReplace:r,onMerge:l,identifier:"text"})),(0,Ke.createElement)(nt.BlockControls,{group:"block"},"default"===N&&(0,Ke.createElement)(nt.AlignmentControl,{value:c,onChange:e=>{n({textAlign:e})}}),!P&&R&&!V&&(0,Ke.createElement)(et.ToolbarButton,{name:"link",icon:kn,title:(0,tt.__)("Link"),shortcut:fn.displayShortcut.primary("k"),onClick:A}),P&&R&&!V&&(0,Ke.createElement)(et.ToolbarButton,{name:"link",icon:xn,title:(0,tt.__)("Unlink"),shortcut:fn.displayShortcut.primaryShift("k"),onClick:H,isActive:!0})),R&&o&&(T||P)&&!V&&(0,Ke.createElement)(et.Popover,{placement:"bottom",onClose:()=>{I(!1),S.current?.focus()},anchor:v,focusOnMount:!!T&&"firstElement",__unstableSlotName:"__unstable-block-tools-after",shift:!0},(0,Ke.createElement)(nt.__experimentalLinkControl,{value:L,onChange:({url:e,opensInNewTab:t,nofollow:a})=>n(function({rel:e="",url:t="",opensInNewTab:n,nofollow:a}){let o,r=e;if(n)o=_n,r=r?.includes(bn)?r:r+` ${bn}`;else{const e=new RegExp(`\\b${bn}\\s*`,"g");r=r?.replace(e,"").trim()}if(a)r=r?.includes(yn)?r:r+` ${yn}`;else{const e=new RegExp(`\\b${yn}\\s*`,"g");r=r?.replace(e,"").trim()}return{url:(0,pt.prependHTTP)(t),linkTarget:o,rel:r||void 0}}({rel:p,url:e,opensInNewTab:t,nofollow:a})),onRemove:()=>{H(),S.current?.focus()},forceIsEditingLink:T,settings:wn})),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(En,{selectedWidth:b,setAttributes:n})),(0,Ke.createElement)(nt.InspectorControls,{group:"advanced"},R&&(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link rel"),value:p||"",onChange:e=>n({rel:e})})))};const Sn={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/button",title:"Button",category:"design",parent:["core/buttons"],description:"Prompt visitors to take action with a button-style link.",keywords:["link"],textdomain:"default",attributes:{tagName:{type:"string",enum:["a","button"],default:"a"},type:{type:"string",default:"button"},textAlign:{type:"string"},url:{type:"string",source:"attribute",selector:"a",attribute:"href",__experimentalRole:"content"},title:{type:"string",source:"attribute",selector:"a,button",attribute:"title",__experimentalRole:"content"},text:{type:"rich-text",source:"rich-text",selector:"a,button",__experimentalRole:"content"},linkTarget:{type:"string",source:"attribute",selector:"a",attribute:"target",__experimentalRole:"content"},rel:{type:"string",source:"attribute",selector:"a",attribute:"rel",__experimentalRole:"content"},placeholder:{type:"string"},backgroundColor:{type:"string"},textColor:{type:"string"},gradient:{type:"string"},width:{type:"number"}},supports:{anchor:!0,align:!1,alignWide:!1,color:{__experimentalSkipSerialization:!0,gradients:!0,__experimentalDefaultControls:{background:!0,text:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},reusable:!1,shadow:{__experimentalSkipSerialization:!0},spacing:{__experimentalSkipSerialization:!0,padding:["horizontal","vertical"],__experimentalDefaultControls:{padding:!0}},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0,__experimentalSkipSerialization:!0,__experimentalDefaultControls:{color:!0,radius:!0,style:!0,width:!0}},__experimentalSelector:".wp-block-button .wp-block-button__link",interactivity:{clientNavigation:!0}},styles:[{name:"fill",label:"Fill",isDefault:!0},{name:"outline",label:"Outline"}],editorStyle:"wp-block-button-editor",style:"wp-block-button"},{name:Bn}=Sn,Nn={icon:on,example:{attributes:{className:"is-style-fill",text:(0,tt.__)("Call to Action")}},edit:Cn,save:function({attributes:e,className:t}){const{tagName:n,type:a,textAlign:o,fontSize:r,linkTarget:l,rel:i,style:s,text:c,title:m,url:u,width:p}=e;if(nt.RichText.isEmpty(c))return null;const d=n||"a",g="button"===d,h=a||"button",b=(0,nt.__experimentalGetBorderClassesAndStyles)(e),_=(0,nt.__experimentalGetColorClassesAndStyles)(e),y=(0,nt.__experimentalGetSpacingClassesAndStyles)(e),v=(0,nt.__experimentalGetShadowClassesAndStyles)(e),f=ut()("wp-block-button__link",_.className,b.className,{[`has-text-align-${o}`]:o,"no-border-radius":0===s?.border?.radius},(0,nt.__experimentalGetElementClassName)("button")),k={...b.style,..._.style,...y.style,...v.style},x=ut()(t,{[`has-custom-width wp-block-button__width-${p}`]:p,"has-custom-font-size":r||s?.typography?.fontSize});return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:x})},(0,Ke.createElement)(nt.RichText.Content,{tagName:d,type:g?h:null,className:f,href:g?null:u,title:m,style:k,value:c,target:g?null:l,rel:g?null:i}))},deprecated:hn,merge:(e,{text:t=""})=>({...e,text:(e.text||"")+t})},Tn=()=>Xe({name:Bn,metadata:Sn,settings:Nn}),In=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M14.5 17.5H9.5V16H14.5V17.5Z M14.5 8H9.5V6.5H14.5V8Z M7 3.5H17C18.1046 3.5 19 4.39543 19 5.5V9C19 10.1046 18.1046 11 17 11H7C5.89543 11 5 10.1046 5 9V5.5C5 4.39543 5.89543 3.5 7 3.5ZM17 5H7C6.72386 5 6.5 5.22386 6.5 5.5V9C6.5 9.27614 6.72386 9.5 7 9.5H17C17.2761 9.5 17.5 9.27614 17.5 9V5.5C17.5 5.22386 17.2761 5 17 5Z M7 13H17C18.1046 13 19 13.8954 19 15V18.5C19 19.6046 18.1046 20.5 17 20.5H7C5.89543 20.5 5 19.6046 5 18.5V15C5 13.8954 5.89543 13 7 13ZM17 14.5H7C6.72386 14.5 6.5 14.7239 6.5 15V18.5C6.5 18.7761 6.72386 19 7 19H17C17.2761 19 17.5 18.7761 17.5 18.5V15C17.5 14.7239 17.2761 14.5 17 14.5Z"})),Pn=e=>{if(e.layout)return e;const{contentJustification:t,orientation:n,...a}=e;return(t||n)&&Object.assign(a,{layout:{type:"flex",...t&&{justifyContent:t},...n&&{orientation:n}}}),a},Mn=[{attributes:{contentJustification:{type:"string"},orientation:{type:"string",default:"horizontal"}},supports:{anchor:!0,align:["wide","full"],__experimentalExposeControlsToChildren:!0,spacing:{blockGap:!0,margin:["top","bottom"],__experimentalDefaultControls:{blockGap:!0}}},isEligible:({contentJustification:e,orientation:t})=>!!e||!!t,migrate:Pn,save:({attributes:{contentJustification:e,orientation:t}})=>(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:ut()({[`is-content-justification-${e}`]:e,"is-vertical":"vertical"===t})})},(0,Ke.createElement)(nt.InnerBlocks.Content,null))},{supports:{align:["center","left","right"],anchor:!0},save:()=>(0,Ke.createElement)("div",null,(0,Ke.createElement)(nt.InnerBlocks.Content,null)),isEligible:({align:e})=>e&&["center","left","right"].includes(e),migrate:e=>Pn({...e,align:void 0,contentJustification:e.align})}],zn=Mn,Rn=window.wp.richText;function An(e,t,n){if(!e)return;const{supports:a}=(0,Qe.getBlockType)(t),o=[];if(["core/paragraph","core/heading","core/image","core/button"].includes(t)&&n&&o.push("id","bindings"),!1!==a.renaming&&o.push("name"),!o.length)return;const r=Object.entries(e).reduce(((e,[t,a])=>o.includes(t)?(e[t]="bindings"===t?n(a):a,e):e),{});return Object.keys(r).length?r:void 0}const Hn={from:[{type:"block",isMultiBlock:!0,blocks:["core/button"],transform:e=>(0,Qe.createBlock)("core/buttons",{},e.map((e=>(0,Qe.createBlock)("core/button",e))))},{type:"block",isMultiBlock:!0,blocks:["core/paragraph"],transform:e=>(0,Qe.createBlock)("core/buttons",{},e.map((e=>{const{content:t,metadata:n}=e,a=(0,Rn.__unstableCreateElement)(document,t),o=a.innerText||"",r=a.querySelector("a"),l=r?.getAttribute("href");return(0,Qe.createBlock)("core/button",{text:o,url:l,metadata:An(n,"core/button",(({content:e})=>({text:e})))})}))),isMatch:e=>e.every((e=>{const t=(0,Rn.__unstableCreateElement)(document,e.content),n=t.innerText||"",a=t.querySelectorAll("a");return n.length<=30&&a.length<=1}))}]},Ln=Hn,Dn={name:"core/button",attributesToCopy:["backgroundColor","border","className","fontFamily","fontSize","gradient","style","textColor","width"]};const Fn=function({attributes:e,className:t}){var n;const{fontSize:a,layout:o,style:r}=e,l=(0,nt.useBlockProps)({className:ut()(t,{"has-custom-font-size":a||r?.typography?.fontSize})}),{preferredStyle:i,hasButtonVariations:s}=(0,gt.useSelect)((e=>{const t=e(nt.store).getSettings().__experimentalPreferredStyleVariations,n=e(Qe.store).getBlockVariations("core/button","inserter");return{preferredStyle:t?.value?.["core/button"],hasButtonVariations:n.length>0}}),[]),c=(0,nt.useInnerBlocksProps)(l,{defaultBlock:Dn,directInsert:!s,template:[["core/button",{className:i&&`is-style-${i}`}]],templateInsertUpdatesSelection:!0,orientation:null!==(n=o?.orientation)&&void 0!==n?n:"horizontal"});return(0,Ke.createElement)("div",{...c})};const Vn={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/buttons",title:"Buttons",category:"design",allowedBlocks:["core/button"],description:"Prompt visitors to take action with a group of button-style links.",keywords:["link"],textdomain:"default",supports:{anchor:!0,align:["wide","full"],html:!1,__experimentalExposeControlsToChildren:!0,spacing:{blockGap:!0,margin:["top","bottom"],__experimentalDefaultControls:{blockGap:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},layout:{allowSwitching:!1,allowInheriting:!1,default:{type:"flex"}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-buttons-editor",style:"wp-block-buttons"},{name:$n}=Vn,On={icon:In,example:{innerBlocks:[{name:"core/button",attributes:{text:(0,tt.__)("Find out more")}},{name:"core/button",attributes:{text:(0,tt.__)("Contact us")}}]},deprecated:zn,transforms:Ln,edit:Fn,save:function({attributes:e,className:t}){const{fontSize:n,style:a}=e,o=nt.useBlockProps.save({className:ut()(t,{"has-custom-font-size":n||a?.typography?.fontSize})}),r=nt.useInnerBlocksProps.save(o);return(0,Ke.createElement)("div",{...r})}},Gn=()=>Xe({name:$n,metadata:Vn,settings:On}),Un=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.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.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z"})),qn=Rt((e=>{if(!e)return{};const t=new Date(e);return{year:t.getFullYear(),month:t.getMonth()+1}}));const jn={from:[{type:"block",blocks:["core/archives"],transform:()=>(0,Qe.createBlock)("core/calendar")}],to:[{type:"block",blocks:["core/archives"],transform:()=>(0,Qe.createBlock)("core/archives")}]},Wn={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/calendar",title:"Calendar",category:"widgets",description:"A calendar of your site’s posts.",keywords:["posts","archive"],textdomain:"default",attributes:{month:{type:"integer"},year:{type:"integer"}},supports:{align:!0,color:{link:!0,__experimentalSkipSerialization:["text","background"],__experimentalDefaultControls:{background:!0,text:!0},__experimentalSelector:"table, th"},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},style:"wp-block-calendar"},{name:Zn}=Wn,Qn={icon:Un,example:{},edit:function({attributes:e}){const t=(0,nt.useBlockProps)(),{date:n,hasPosts:a,hasPostsResolved:o}=(0,gt.useSelect)((e=>{const{getEntityRecords:t,hasFinishedResolution:n}=e(dt.store),a={status:"publish",per_page:1},o=t("postType","post",a),r=n("getEntityRecords",["postType","post",a]);let l;const i=e("core/editor");if(i){"post"===i.getEditedPostAttribute("type")&&(l=i.getEditedPostAttribute("date"))}return{date:l,hasPostsResolved:r,hasPosts:r&&1===o?.length}}),[]);return a?(0,Ke.createElement)("div",{...t},(0,Ke.createElement)(et.Disabled,null,(0,Ke.createElement)(ot(),{block:"core/calendar",attributes:{...e,...qn(n)}}))):(0,Ke.createElement)("div",{...t},(0,Ke.createElement)(et.Placeholder,{icon:Un,label:(0,tt.__)("Calendar")},o?(0,tt.__)("No published posts found."):(0,Ke.createElement)(et.Spinner,null)))},transforms:jn},Kn=()=>Xe({name:Zn,metadata:Wn,settings:Qn}),Yn=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",fillRule:"evenodd",clipRule:"evenodd"})),Jn=window.wp.htmlEntities,Xn=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z"}));const ea={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/categories",title:"Categories List",category:"widgets",description:"Display a list of all categories.",textdomain:"default",attributes:{displayAsDropdown:{type:"boolean",default:!1},showHierarchy:{type:"boolean",default:!1},showPostCounts:{type:"boolean",default:!1},showOnlyTopLevel:{type:"boolean",default:!1},showEmpty:{type:"boolean",default:!1}},supports:{align:!0,html:!1,spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-categories-editor",style:"wp-block-categories"},{name:ta}=ea,na={icon:Yn,example:{},edit:function e({attributes:{displayAsDropdown:t,showHierarchy:n,showPostCounts:a,showOnlyTopLevel:o,showEmpty:r},setAttributes:l,className:i}){const s=(0,jt.useInstanceId)(e,"blocks-category-select"),c={per_page:-1,hide_empty:!r,context:"view"};o&&(c.parent=0);const{records:m,isResolving:u}=(0,dt.useEntityRecords)("taxonomy","category",c),p=e=>m?.length?null===e?m:m.filter((({parent:t})=>t===e)):[],d=e=>t=>l({[e]:t}),g=e=>e?(0,Jn.decodeEntities)(e).trim():(0,tt.__)("(Untitled)"),h=e=>{const t=p(e.id),{id:o,link:r,count:l,name:i}=e;return(0,Ke.createElement)("li",{key:o,className:`cat-item cat-item-${o}`},(0,Ke.createElement)("a",{href:r,target:"_blank",rel:"noreferrer noopener"},g(i)),a&&` (${l})`,n&&!!t.length&&(0,Ke.createElement)("ul",{className:"children"},t.map((e=>h(e)))))},b=(e,t)=>{const{id:o,count:r,name:l}=e,i=p(o);return[(0,Ke.createElement)("option",{key:o,className:`level-${t}`},Array.from({length:3*t}).map((()=>" ")),g(l),a&&` (${r})`),n&&!!i.length&&i.map((e=>b(e,t+1)))]},_=!m?.length||t||u?"div":"ul",y=ut()(i,{"wp-block-categories-list":!!m?.length&&!t&&!u,"wp-block-categories-dropdown":!!m?.length&&t&&!u}),v=(0,nt.useBlockProps)({className:y});return(0,Ke.createElement)(_,{...v},(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display as dropdown"),checked:t,onChange:d("displayAsDropdown")}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show post counts"),checked:a,onChange:d("showPostCounts")}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show only top level categories"),checked:o,onChange:d("showOnlyTopLevel")}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show empty categories"),checked:r,onChange:d("showEmpty")}),!o&&(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show hierarchy"),checked:n,onChange:d("showHierarchy")}))),u&&(0,Ke.createElement)(et.Placeholder,{icon:Xn,label:(0,tt.__)("Categories")},(0,Ke.createElement)(et.Spinner,null)),!u&&0===m?.length&&(0,Ke.createElement)("p",null,(0,tt.__)("Your site does not have any posts, so there is nothing to display here at the moment.")),!u&&m?.length>0&&(t?(()=>{const e=p(n?0:null);return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.VisuallyHidden,{as:"label",htmlFor:s},(0,tt.__)("Categories")),(0,Ke.createElement)("select",{id:s},(0,Ke.createElement)("option",null,(0,tt.__)("Select Category")),e.map((e=>b(e,0)))))})():p(n?0:null).map((e=>h(e)))))}},aa=()=>Xe({name:ta,metadata:ea,settings:na}),oa=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M20 6H4c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H4c-.3 0-.5-.2-.5-.5V8c0-.3.2-.5.5-.5h16c.3 0 .5.2.5.5v9zM10 10H8v2h2v-2zm-5 2h2v-2H5v2zm8-2h-2v2h2v-2zm-5 6h8v-2H8v2zm6-4h2v-2h-2v2zm3 0h2v-2h-2v2zm0 4h2v-2h-2v2zM5 16h2v-2H5v2z"})),ra=({clientId:e})=>{const{replaceBlocks:t}=(0,gt.useDispatch)(nt.store),n=(0,gt.useSelect)((t=>t(nt.store).getBlock(e)),[e]);return(0,Ke.createElement)(et.ToolbarButton,{onClick:()=>t(n.clientId,(0,Qe.rawHandler)({HTML:(0,Qe.serialize)(n)}))},(0,tt.__)("Convert to blocks"))},la=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z"}));function ia({onClick:e,isModalFullScreen:t}){return(0,jt.useViewportMatch)("small","<")?null:(0,Ke.createElement)(et.Button,{onClick:e,icon:la,isPressed:t,label:t?(0,tt.__)("Exit fullscreen"):(0,tt.__)("Enter fullscreen")})}function sa(e){const t=(0,gt.useSelect)((e=>e(nt.store).getSettings().styles));return(0,_t.useEffect)((()=>{const{baseURL:n,suffix:a,settings:o}=window.wpEditorL10n.tinymce;return window.tinymce.EditorManager.overrideDefaults({base_url:n,suffix:a}),window.wp.oldEditor.initialize(e.id,{tinymce:{...o,setup(e){e.on("init",(()=>{const n=e.getDoc();t.forEach((({css:e})=>{const t=n.createElement("style");t.innerHTML=e,n.head.appendChild(t)}))}))}}}),()=>{window.wp.oldEditor.remove(e.id)}}),[]),(0,Ke.createElement)("textarea",{...e})}function ca(e){const{clientId:t,attributes:{content:n},setAttributes:a,onReplace:o}=e,[r,l]=(0,_t.useState)(!1),[i,s]=(0,_t.useState)(!1),c=`editor-${t}`,m=()=>n?l(!1):o([]);return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,null,(0,Ke.createElement)(et.ToolbarButton,{onClick:()=>l(!0)},(0,tt.__)("Edit")))),n&&(0,Ke.createElement)(_t.RawHTML,null,n),(r||!n)&&(0,Ke.createElement)(et.Modal,{title:(0,tt.__)("Classic Editor"),onRequestClose:m,shouldCloseOnClickOutside:!1,overlayClassName:"block-editor-freeform-modal",isFullScreen:i,className:"block-editor-freeform-modal__content",headerActions:(0,Ke.createElement)(ia,{onClick:()=>s(!i),isModalFullScreen:i})},(0,Ke.createElement)(sa,{id:c,defaultValue:n}),(0,Ke.createElement)(et.Flex,{className:"block-editor-freeform-modal__actions",justify:"flex-end",expanded:!1},(0,Ke.createElement)(et.FlexItem,null,(0,Ke.createElement)(et.Button,{variant:"tertiary",onClick:m},(0,tt.__)("Cancel"))),(0,Ke.createElement)(et.FlexItem,null,(0,Ke.createElement)(et.Button,{variant:"primary",onClick:()=>{a({content:window.wp.oldEditor.getContent(c)}),l(!1)}},(0,tt.__)("Save"))))))}const{wp:ma}=window;function ua({clientId:e,attributes:{content:t},setAttributes:n,onReplace:a}){const{getMultiSelectedBlockClientIds:o}=(0,gt.useSelect)(nt.store),r=(0,_t.useRef)(!1);return(0,_t.useEffect)((()=>{if(!r.current)return;const n=window.tinymce.get(`editor-${e}`),a=n?.getContent();a!==t&&n.setContent(t||"")}),[t]),(0,_t.useEffect)((()=>{const{baseURL:l,suffix:i}=window.wpEditorL10n.tinymce;function s(e){let r;t&&e.on("loadContent",(()=>e.setContent(t))),e.on("blur",(()=>{r=e.selection.getBookmark(2,!0);const t=document.querySelector(".interface-interface-skeleton__content"),a=t.scrollTop;return o()?.length||n({content:e.getContent()}),e.once("focus",(()=>{r&&(e.selection.moveToBookmark(r),t.scrollTop!==a&&(t.scrollTop=a))})),!1})),e.on("mousedown touchstart",(()=>{r=null}));const l=(0,jt.debounce)((()=>{const t=e.getContent();t!==e._lastChange&&(e._lastChange=t,n({content:t}))}),250);e.on("Paste Change input Undo Redo",l),e.on("remove",l.cancel),e.on("keydown",(t=>{fn.isKeyboardEvent.primary(t,"z")&&t.stopPropagation(),t.keyCode!==fn.BACKSPACE&&t.keyCode!==fn.DELETE||!function(e){const t=e.getBody();return!(t.childNodes.length>1)&&(0===t.childNodes.length||!(t.childNodes[0].childNodes.length>1)&&/^\n?$/.test(t.innerText||t.textContent))}(e)||(a([]),t.preventDefault(),t.stopImmediatePropagation());const{altKey:n}=t;n&&t.keyCode===fn.F10&&t.stopPropagation()})),e.on("init",(()=>{const t=e.getBody();t.ownerDocument.activeElement===t&&(t.blur(),e.focus())}))}function c(){const{settings:t}=window.wpEditorL10n.tinymce;ma.oldEditor.initialize(`editor-${e}`,{tinymce:{...t,inline:!0,content_css:!1,fixed_toolbar_container:`#toolbar-${e}`,setup:s}})}function m(){"complete"===document.readyState&&c()}return r.current=!0,window.tinymce.EditorManager.overrideDefaults({base_url:l,suffix:i}),"complete"===document.readyState?c():document.addEventListener("readystatechange",m),()=>{document.removeEventListener("readystatechange",m),ma.oldEditor.remove(`editor-${e}`)}}),[]),(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("div",{key:"toolbar",id:`toolbar-${e}`,className:"block-library-classic__toolbar",onClick:function(){const t=window.tinymce.get(`editor-${e}`);t&&t.focus()},"data-placeholder":(0,tt.__)("Classic"),onKeyDown:function(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()}}),(0,Ke.createElement)("div",{key:"editor",id:`editor-${e}`,className:"wp-block-freeform block-library-rich-text__tinymce"}))}const pa={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/freeform",title:"Classic",category:"text",description:"Use the classic WordPress editor.",textdomain:"default",attributes:{content:{type:"string",source:"raw"}},supports:{className:!1,customClassName:!1,reusable:!1},editorStyle:"wp-block-freeform-editor"},{name:da}=pa,ga={icon:oa,edit:function(e){const{clientId:t}=e,n=(0,gt.useSelect)((e=>e(nt.store).canRemoveBlock(t)),[t]),[a,o]=(0,_t.useState)(!1),r=(0,jt.useRefEffect)((e=>{o(e.ownerDocument!==document)}),[]);return(0,Ke.createElement)(Ke.Fragment,null,n&&(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,null,(0,Ke.createElement)(ra,{clientId:t}))),(0,Ke.createElement)("div",{...(0,nt.useBlockProps)({ref:r})},a?(0,Ke.createElement)(ca,{...e}):(0,Ke.createElement)(ua,{...e})))},save:function({attributes:e}){const{content:t}=e;return(0,Ke.createElement)(_t.RawHTML,null,t)}},ha=()=>Xe({name:da,metadata:pa,settings:ga}),ba=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"}));function _a(e){return e.replace(/\[/g,"[")}function ya(e){return e.replace(/^(\s*https?:)\/\/([^\s<>"]+\s*)$/m,"$1//$2")}const va={from:[{type:"enter",regExp:/^```$/,transform:()=>(0,Qe.createBlock)("core/code")},{type:"block",blocks:["core/paragraph"],transform:({content:e,metadata:t})=>(0,Qe.createBlock)("core/code",{content:e,metadata:An(t,"core/code")})},{type:"block",blocks:["core/html"],transform:({content:e,metadata:t})=>(0,Qe.createBlock)("core/code",{content:(0,Rn.toHTMLString)({value:(0,Rn.create)({text:e})}),metadata:An(t,"core/code")})},{type:"raw",isMatch:e=>"PRE"===e.nodeName&&1===e.children.length&&"CODE"===e.firstChild.nodeName,schema:{pre:{children:{code:{children:{"#text":{}}}}}}}],to:[{type:"block",blocks:["core/paragraph"],transform:({content:e,metadata:t})=>(0,Qe.createBlock)("core/paragraph",{content:e,metadata:An(t,"core/paragraph")})}]},fa=va,ka={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/code",title:"Code",category:"text",description:"Display code snippets that respect your spacing and tabs.",textdomain:"default",attributes:{content:{type:"rich-text",source:"rich-text",selector:"code",__unstablePreserveWhiteSpace:!0}},supports:{align:["wide"],anchor:!0,typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},spacing:{margin:["top","bottom"],padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},__experimentalBorder:{radius:!0,color:!0,width:!0,style:!0,__experimentalDefaultControls:{width:!0,color:!0}},color:{text:!0,background:!0,gradients:!0,__experimentalDefaultControls:{background:!0,text:!0}},interactivity:{clientNavigation:!0}},style:"wp-block-code"},{name:xa}=ka,wa={icon:ba,example:{attributes:{content:(0,tt.__)("// A “block” is the abstract term used\n// to describe units of markup that\n// when composed together, form the\n// content or layout of a page.\nregisterBlockType( name, settings );")}},merge:(e,t)=>({content:e.content+"\n\n"+t.content}),transforms:fa,edit:function({attributes:e,setAttributes:t,onRemove:n,insertBlocksAfter:a,mergeBlocks:o}){const r=(0,nt.useBlockProps)();return(0,Ke.createElement)("pre",{...r},(0,Ke.createElement)(nt.RichText,{tagName:"code",identifier:"content",value:e.content,onChange:e=>t({content:e}),onRemove:n,onMerge:o,placeholder:(0,tt.__)("Write code…"),"aria-label":(0,tt.__)("Code"),preserveWhiteSpace:!0,__unstablePastePlainText:!0,__unstableOnSplitAtDoubleLineEnd:()=>a((0,Qe.createBlock)((0,Qe.getDefaultBlockName)()))}))},save:function({attributes:e}){return(0,Ke.createElement)("pre",{...nt.useBlockProps.save()},(0,Ke.createElement)(nt.RichText.Content,{tagName:"code",value:(t="string"==typeof e.content?e.content:e.content.toHTMLString({preserveWhiteSpace:!0}),(0,jt.pipe)(_a,ya)(t||""))}));var t}},Ea=()=>Xe({name:xa,metadata:ka,settings:wa}),Ca=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M19 6H6c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zM6 17.5c-.3 0-.5-.2-.5-.5V8c0-.3.2-.5.5-.5h3v10H6zm13.5-.5c0 .3-.2.5-.5.5h-3v-10h3c.3 0 .5.2.5.5v9z"})),Sa=[{attributes:{verticalAlignment:{type:"string"},width:{type:"number",min:0,max:100}},isEligible:({width:e})=>isFinite(e),migrate:e=>({...e,width:`${e.width}%`}),save({attributes:e}){const{verticalAlignment:t,width:n}=e,a=ut()({[`is-vertically-aligned-${t}`]:t}),o={flexBasis:n+"%"};return(0,Ke.createElement)("div",{className:a,style:o},(0,Ke.createElement)(nt.InnerBlocks.Content,null))}}],Ba=Sa;const Na=function({attributes:{verticalAlignment:e,width:t,templateLock:n,allowedBlocks:a},setAttributes:o,clientId:r}){const l=ut()("block-core-columns",{[`is-vertically-aligned-${e}`]:e}),[i]=(0,nt.useSettings)("spacing.units"),s=(0,et.__experimentalUseCustomUnits)({availableUnits:i||["%","px","em","rem","vw"]}),{columnsIds:c,hasChildBlocks:m,rootClientId:u}=(0,gt.useSelect)((e=>{const{getBlockOrder:t,getBlockRootClientId:n}=e(nt.store),a=n(r);return{hasChildBlocks:t(r).length>0,rootClientId:a,columnsIds:t(a)}}),[r]),{updateBlockAttributes:p}=(0,gt.useDispatch)(nt.store),d=Number.isFinite(t)?t+"%":t,g=(0,nt.useBlockProps)({className:l,style:d?{flexBasis:d}:void 0}),h=c.length,b=c.indexOf(r)+1,_=(0,tt.sprintf)((0,tt.__)("%1$s (%2$d of %3$d)"),g["aria-label"],b,h),y=(0,nt.useInnerBlocksProps)({...g,"aria-label":_},{templateLock:n,allowedBlocks:a,renderAppender:m?void 0:nt.InnerBlocks.ButtonBlockAppender});return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(nt.BlockVerticalAlignmentToolbar,{onChange:e=>{o({verticalAlignment:e}),p(u,{verticalAlignment:null})},value:e,controls:["top","center","bottom","stretch"]})),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.__experimentalUnitControl,{label:(0,tt.__)("Width"),labelPosition:"edge",__unstableInputWidth:"80px",value:t||"",onChange:e=>{e=0>parseFloat(e)?"0":e,o({width:e})},units:s}))),(0,Ke.createElement)("div",{...y}))};const Ta={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/column",title:"Column",category:"design",parent:["core/columns"],description:"A single column within a columns block.",textdomain:"default",attributes:{verticalAlignment:{type:"string"},width:{type:"string"},allowedBlocks:{type:"array"},templateLock:{type:["string","boolean"],enum:["all","insert","contentOnly",!1]}},supports:{__experimentalOnEnter:!0,anchor:!0,reusable:!1,html:!1,color:{gradients:!0,heading:!0,button:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},shadow:!0,spacing:{blockGap:!0,padding:!0,__experimentalDefaultControls:{padding:!0,blockGap:!0}},__experimentalBorder:{color:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,style:!0,width:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},layout:!0,interactivity:{clientNavigation:!0}}},{name:Ia}=Ta,Pa={icon:Ca,edit:Na,save:function({attributes:e}){const{verticalAlignment:t,width:n}=e,a=ut()({[`is-vertically-aligned-${t}`]:t});let o;if(n&&/\d/.test(n)){let e=Number.isFinite(n)?n+"%":n;if(!Number.isFinite(n)&&n?.endsWith("%")){const t=1e12;e=Math.round(Number.parseFloat(n)*t)/t+"%"}o={flexBasis:e}}const r=nt.useBlockProps.save({className:a,style:o}),l=nt.useInnerBlocksProps.save(r);return(0,Ke.createElement)("div",{...l})},deprecated:Ba},Ma=()=>Xe({name:Ia,metadata:Ta,settings:Pa}),za=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M15 7.5h-5v10h5v-10Zm1.5 0v10H19a.5.5 0 0 0 .5-.5V8a.5.5 0 0 0-.5-.5h-2.5ZM6 7.5h2.5v10H6a.5.5 0 0 1-.5-.5V8a.5.5 0 0 1 .5-.5ZM6 6h13a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2Z"}));function Ra(e){let t,{doc:n}=Ra;n||(n=document.implementation.createHTMLDocument(""),Ra.doc=n),n.body.innerHTML=e;for(const e of n.body.firstChild.classList)if(t=e.match(/^layout-column-(\d+)$/))return Number(t[1])-1}const Aa=[{attributes:{verticalAlignment:{type:"string"},backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},customTextColor:{type:"string"},textColor:{type:"string"}},migrate:e=>{if(!e.customTextColor&&!e.customBackgroundColor)return e;const t={color:{}};e.customTextColor&&(t.color.text=e.customTextColor),e.customBackgroundColor&&(t.color.background=e.customBackgroundColor);const{customTextColor:n,customBackgroundColor:a,...o}=e;return{...o,style:t,isStackedOnMobile:!0}},save({attributes:e}){const{verticalAlignment:t,backgroundColor:n,customBackgroundColor:a,textColor:o,customTextColor:r}=e,l=(0,nt.getColorClassName)("background-color",n),i=(0,nt.getColorClassName)("color",o),s=ut()({"has-background":n||a,"has-text-color":o||r,[l]:l,[i]:i,[`are-vertically-aligned-${t}`]:t}),c={backgroundColor:l?void 0:a,color:i?void 0:r};return(0,Ke.createElement)("div",{className:s||void 0,style:c},(0,Ke.createElement)(nt.InnerBlocks.Content,null))}},{attributes:{columns:{type:"number",default:2}},isEligible:(e,t)=>!!t.some((e=>/layout-column-\d+/.test(e.originalContent)))&&t.some((e=>void 0!==Ra(e.originalContent))),migrate(e,t){const n=t.reduce(((e,t)=>{const{originalContent:n}=t;let a=Ra(n);return void 0===a&&(a=0),e[a]||(e[a]=[]),e[a].push(t),e}),[]).map((e=>(0,Qe.createBlock)("core/column",{},e))),{columns:a,...o}=e;return[{...o,isStackedOnMobile:!0},n]},save({attributes:e}){const{columns:t}=e;return(0,Ke.createElement)("div",{className:`has-${t}-columns`},(0,Ke.createElement)(nt.InnerBlocks.Content,null))}},{attributes:{columns:{type:"number",default:2}},migrate(e,t){const{columns:n,...a}=e;return[e={...a,isStackedOnMobile:!0},t]},save({attributes:e}){const{verticalAlignment:t,columns:n}=e,a=ut()(`has-${n}-columns`,{[`are-vertically-aligned-${t}`]:t});return(0,Ke.createElement)("div",{className:a},(0,Ke.createElement)(nt.InnerBlocks.Content,null))}}],Ha=e=>{const t=parseFloat(e);return Number.isFinite(t)?parseFloat(t.toFixed(2)):void 0};function La(e,t){const{width:n=100/t}=e.attributes;return Ha(n)}function Da(e,t,n=e.length){const a=function(e,t=e.length){return e.reduce(((e,n)=>e+La(n,t)),0)}(e,n);return Object.fromEntries(Object.entries(function(e,t=e.length){return e.reduce(((e,n)=>{const a=La(n,t);return Object.assign(e,{[n.clientId]:a})}),{})}(e,n)).map((([e,n])=>[e,Ha(t*n/a)])))}function Fa(e,t){return e.map((e=>({...e,attributes:{...e.attributes,width:`${t[e.clientId]}%`}})))}function Va({attributes:e,setAttributes:t,clientId:n}){const{isStackedOnMobile:a,verticalAlignment:o,templateLock:r}=e,{count:l,canInsertColumnBlock:i,minCount:s}=(0,gt.useSelect)((e=>{const{canInsertBlockType:t,canRemoveBlock:a,getBlocks:o,getBlockCount:r}=e(nt.store),l=o(n).reduce(((e,t,n)=>(a(t.clientId)||e.push(n),e)),[]);return{count:r(n),canInsertColumnBlock:t("core/column",n),minCount:Math.max(...l)+1}}),[n]),c=(0,gt.useRegistry)(),{getBlocks:m,getBlockOrder:u}=(0,gt.useSelect)(nt.store),{updateBlockAttributes:p,replaceInnerBlocks:d}=(0,gt.useDispatch)(nt.store),g=ut()({[`are-vertically-aligned-${o}`]:o,"is-not-stacked-on-mobile":!a}),h=(0,nt.useBlockProps)({className:g}),b=(0,nt.useInnerBlocksProps)(h,{orientation:"horizontal",renderAppender:!1,templateLock:r});function _(e,t){let a=m(n);const o=a.every((e=>{const t=e.attributes.width;return Number.isFinite(t?.endsWith?.("%")?parseFloat(t):t)}));const r=t>e;if(r&&o){const n=Ha(100/t);a=[...Fa(a,Da(a,100-n)),...Array.from({length:t-e}).map((()=>(0,Qe.createBlock)("core/column",{width:`${n}%`})))]}else if(r)a=[...a,...Array.from({length:t-e}).map((()=>(0,Qe.createBlock)("core/column")))];else if(t<e&&(a=a.slice(0,-(e-t)),o)){a=Fa(a,Da(a,100))}d(n,a)}return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(nt.BlockVerticalAlignmentToolbar,{onChange:function(e){const a=u(n);c.batch((()=>{t({verticalAlignment:e}),p(a,{verticalAlignment:e})}))},value:o})),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},i&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Columns"),value:l,onChange:e=>_(l,Math.max(s,e)),min:Math.max(1,s),max:Math.max(6,l)}),l>6&&(0,Ke.createElement)(et.Notice,{status:"warning",isDismissible:!1},(0,tt.__)("This column count exceeds the recommended amount and may cause visual breakage."))),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Stack on mobile"),checked:a,onChange:()=>t({isStackedOnMobile:!a})}))),(0,Ke.createElement)("div",{...b}))}function $a({clientId:e,name:t,setAttributes:n}){const{blockType:a,defaultVariation:o,variations:r}=(0,gt.useSelect)((e=>{const{getBlockVariations:n,getBlockType:a,getDefaultBlockVariation:o}=e(Qe.store);return{blockType:a(t),defaultVariation:o(t,"block"),variations:n(t,"block")}}),[t]),{replaceInnerBlocks:l}=(0,gt.useDispatch)(nt.store),i=(0,nt.useBlockProps)();return(0,Ke.createElement)("div",{...i},(0,Ke.createElement)(nt.__experimentalBlockVariationPicker,{icon:a?.icon?.src,label:a?.title,variations:r,onSelect:(t=o)=>{t.attributes&&n(t.attributes),t.innerBlocks&&l(e,(0,Qe.createBlocksFromInnerBlocksTemplate)(t.innerBlocks),!0)},allowSkip:!0}))}const Oa=e=>{const{clientId:t}=e,n=(0,gt.useSelect)((e=>e(nt.store).getBlocks(t).length>0),[t])?Va:$a;return(0,Ke.createElement)(n,{...e})};const Ga=[{name:"one-column-full",title:(0,tt.__)("100"),description:(0,tt.__)("One column"),icon:(0,Ke.createElement)(et.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(et.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"m39.0625 14h-30.0625v20.0938h30.0625zm-30.0625-2c-1.10457 0-2 .8954-2 2v20.0938c0 1.1045.89543 2 2 2h30.0625c1.1046 0 2-.8955 2-2v-20.0938c0-1.1046-.8954-2-2-2z"})),innerBlocks:[["core/column"]],scope:["block"]},{name:"two-columns-equal",title:(0,tt.__)("50 / 50"),description:(0,tt.__)("Two columns; equal split"),icon:(0,Ke.createElement)(et.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(et.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H25V34H39ZM23 34H9V14H23V34Z"})),isDefault:!0,innerBlocks:[["core/column"],["core/column"]],scope:["block"]},{name:"two-columns-one-third-two-thirds",title:(0,tt.__)("33 / 66"),description:(0,tt.__)("Two columns; one-third, two-thirds split"),icon:(0,Ke.createElement)(et.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(et.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H20V34H39ZM18 34H9V14H18V34Z"})),innerBlocks:[["core/column",{width:"33.33%"}],["core/column",{width:"66.66%"}]],scope:["block"]},{name:"two-columns-two-thirds-one-third",title:(0,tt.__)("66 / 33"),description:(0,tt.__)("Two columns; two-thirds, one-third split"),icon:(0,Ke.createElement)(et.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(et.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H30V34H39ZM28 34H9V14H28V34Z"})),innerBlocks:[["core/column",{width:"66.66%"}],["core/column",{width:"33.33%"}]],scope:["block"]},{name:"three-columns-equal",title:(0,tt.__)("33 / 33 / 33"),description:(0,tt.__)("Three columns; equal split"),icon:(0,Ke.createElement)(et.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(et.Path,{fillRule:"evenodd",d:"M41 14a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h30a2 2 0 0 0 2-2V14zM28.5 34h-9V14h9v20zm2 0V14H39v20h-8.5zm-13 0H9V14h8.5v20z"})),innerBlocks:[["core/column"],["core/column"],["core/column"]],scope:["block"]},{name:"three-columns-wider-center",title:(0,tt.__)("25 / 50 / 25"),description:(0,tt.__)("Three columns; wide center column"),icon:(0,Ke.createElement)(et.SVG,{width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(et.Path,{fillRule:"evenodd",d:"M41 14a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h30a2 2 0 0 0 2-2V14zM31 34H17V14h14v20zm2 0V14h6v20h-6zm-18 0H9V14h6v20z"})),innerBlocks:[["core/column",{width:"25%"}],["core/column",{width:"50%"}],["core/column",{width:"25%"}]],scope:["block"]}],Ua={from:[{type:"block",isMultiBlock:!0,blocks:["*"],__experimentalConvert:e=>{const t=+(100/e.length).toFixed(2),n=e.map((({name:e,attributes:n,innerBlocks:a})=>["core/column",{width:`${t}%`},[[e,{...n},a]]]));return(0,Qe.createBlock)("core/columns",{},(0,Qe.createBlocksFromInnerBlocksTemplate)(n))},isMatch:({length:e},t)=>(1!==t.length||"core/columns"!==t[0].name)&&(e&&e<=6)},{type:"block",blocks:["core/media-text"],priority:1,transform:(e,t)=>{const{align:n,backgroundColor:a,textColor:o,style:r,mediaAlt:l,mediaId:i,mediaPosition:s,mediaSizeSlug:c,mediaType:m,mediaUrl:u,mediaWidth:p,verticalAlignment:d}=e;let g;if("image"!==m&&m)g=["core/video",{id:i,src:u}];else{g=["core/image",{...{id:i,alt:l,url:u,sizeSlug:c},...{href:e.href,linkClass:e.linkClass,linkDestination:e.linkDestination,linkTarget:e.linkTarget,rel:e.rel}}]}const h=[["core/column",{width:`${p}%`},[g]],["core/column",{width:100-p+"%"},t]];return"right"===s&&h.reverse(),(0,Qe.createBlock)("core/columns",{align:n,backgroundColor:a,textColor:o,style:r,verticalAlignment:d},(0,Qe.createBlocksFromInnerBlocksTemplate)(h))}}],ungroup:(e,t)=>t.flatMap((e=>e.innerBlocks))},qa=Ua,ja={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/columns",title:"Columns",category:"design",allowedBlocks:["core/column"],description:"Display content in multiple columns, with blocks added to each column.",textdomain:"default",attributes:{verticalAlignment:{type:"string"},isStackedOnMobile:{type:"boolean",default:!0},templateLock:{type:["string","boolean"],enum:["all","insert","contentOnly",!1]}},supports:{anchor:!0,align:["wide","full"],html:!1,color:{gradients:!0,link:!0,heading:!0,button:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{blockGap:{__experimentalDefault:"2em",sides:["horizontal","vertical"]},margin:["top","bottom"],padding:!0,__experimentalDefaultControls:{padding:!0,blockGap:!0}},layout:{allowSwitching:!1,allowInheriting:!1,allowEditing:!1,default:{type:"flex",flexWrap:"nowrap"}},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,radius:!0,style:!0,width:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0},shadow:!0},editorStyle:"wp-block-columns-editor",style:"wp-block-columns"},{name:Wa}=ja,Za={icon:za,variations:Ga,example:{viewportWidth:600,innerBlocks:[{name:"core/column",innerBlocks:[{name:"core/paragraph",attributes:{content:(0,tt.__)("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et eros eu felis.")}},{name:"core/image",attributes:{url:"https://s.w.org/images/core/5.3/Windbuchencom.jpg"}},{name:"core/paragraph",attributes:{content:(0,tt.__)("Suspendisse commodo neque lacus, a dictum orci interdum et.")}}]},{name:"core/column",innerBlocks:[{name:"core/paragraph",attributes:{content:(0,tt.__)("Etiam et egestas lorem. Vivamus sagittis sit amet dolor quis lobortis. Integer sed fermentum arcu, id vulputate lacus. Etiam fermentum sem eu quam hendrerit.")}},{name:"core/paragraph",attributes:{content:(0,tt.__)("Nam risus massa, ullamcorper consectetur eros fermentum, porta aliquet ligula. Sed vel mauris nec enim.")}}]}]},deprecated:Aa,edit:Oa,save:function({attributes:e}){const{isStackedOnMobile:t,verticalAlignment:n}=e,a=ut()({[`are-vertically-aligned-${n}`]:n,"is-not-stacked-on-mobile":!t}),o=nt.useBlockProps.save({className:a}),r=nt.useInnerBlocksProps.save(o);return(0,Ke.createElement)("div",{...r})},transforms:qa},Qa=()=>Xe({name:Wa,metadata:ja,settings:Za}),Ka=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M14 10.1V4c0-.6-.4-1-1-1H5c-.6 0-1 .4-1 1v8.3c0 .3.2.7.6.8.1.1.2.1.3.1.2 0 .5-.1.6-.3l1.8-1.8H13c.6 0 1-.4 1-1zm-1.5-.5H6.7l-1.2 1.2V4.5h7v5.1zM19 12h-8c-.6 0-1 .4-1 1v6.1c0 .6.4 1 1 1h5.7l1.8 1.8c.1.2.4.3.6.3.1 0 .2 0 .3-.1.4-.1.6-.5.6-.8V13c0-.6-.4-1-1-1zm-.5 7.8l-1.2-1.2h-5.8v-5.1h7v6.3z"})),Ya=[{attributes:{tagName:{type:"string",default:"div"}},apiVersion:3,supports:{align:["wide","full"],html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}}},save({attributes:{tagName:e}}){const t=nt.useBlockProps.save(),{className:n}=t,a=n?.split(" ")||[],o=a?.filter((e=>"wp-block-comments"!==e)),r={...t,className:o.join(" ")};return(0,Ke.createElement)(e,{...r},(0,Ke.createElement)(nt.InnerBlocks.Content,null))}}];function Ja({attributes:{tagName:e},setAttributes:t}){const n={section:(0,tt.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element."),aside:(0,tt.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.")};return(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(nt.InspectorControls,{group:"advanced"},(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("HTML element"),options:[{label:(0,tt.__)("Default (<div>)"),value:"div"},{label:"<section>",value:"section"},{label:"<aside>",value:"aside"}],value:e,onChange:e=>t({tagName:e}),help:n[e]})))}const Xa=()=>{const e=(0,jt.useInstanceId)(Xa);return(0,Ke.createElement)("div",{className:"comment-respond"},(0,Ke.createElement)("h3",{className:"comment-reply-title"},(0,tt.__)("Leave a Reply")),(0,Ke.createElement)("form",{noValidate:!0,className:"comment-form",onSubmit:e=>e.preventDefault()},(0,Ke.createElement)("p",null,(0,Ke.createElement)("label",{htmlFor:`comment-${e}`},(0,tt.__)("Comment")),(0,Ke.createElement)("textarea",{id:`comment-${e}`,name:"comment",cols:"45",rows:"8",readOnly:!0})),(0,Ke.createElement)("p",{className:"form-submit wp-block-button"},(0,Ke.createElement)("input",{name:"submit",type:"submit",className:ut()("wp-block-button__link",(0,nt.__experimentalGetElementClassName)("button")),label:(0,tt.__)("Post Comment"),value:(0,tt.__)("Post Comment"),"aria-disabled":"true"}))))},eo=({postId:e,postType:t})=>{const[n,a]=(0,dt.useEntityProp)("postType",t,"comment_status",e),o=void 0===t||void 0===e,{defaultCommentStatus:r}=(0,gt.useSelect)((e=>e(nt.store).getSettings().__experimentalDiscussionSettings)),l=(0,gt.useSelect)((e=>!!t&&!!e(dt.store).getPostType(t)?.supports.comments));if(!o&&"open"!==n){if("closed"===n){const e=[(0,Ke.createElement)(et.Button,{key:"enableComments",onClick:()=>a("open"),variant:"primary"},(0,tt._x)("Enable comments","action that affects the current post"))];return(0,Ke.createElement)(nt.Warning,{actions:e},(0,tt.__)("Post Comments Form block: Comments are not enabled for this item."))}if(!l)return(0,Ke.createElement)(nt.Warning,null,(0,tt.sprintf)((0,tt.__)("Post Comments Form block: Comments are not enabled for this post type (%s)."),t));if("open"!==r)return(0,Ke.createElement)(nt.Warning,null,(0,tt.__)("Post Comments Form block: Comments are not enabled."))}return(0,Ke.createElement)(Xa,null)};function to({postType:e,postId:t}){let[n]=(0,dt.useEntityProp)("postType",e,"title",t);n=n||(0,tt.__)("Post Title");const{avatarURL:a}=(0,gt.useSelect)((e=>e(nt.store).getSettings().__experimentalDiscussionSettings));return(0,Ke.createElement)("div",{className:"wp-block-comments__legacy-placeholder",inert:"true"},(0,Ke.createElement)("h3",null,(0,tt.sprintf)((0,tt.__)("One response to %s"),n)),(0,Ke.createElement)("div",{className:"navigation"},(0,Ke.createElement)("div",{className:"alignleft"},(0,Ke.createElement)("a",{href:"#top"},"« ",(0,tt.__)("Older Comments"))),(0,Ke.createElement)("div",{className:"alignright"},(0,Ke.createElement)("a",{href:"#top"},(0,tt.__)("Newer Comments")," »"))),(0,Ke.createElement)("ol",{className:"commentlist"},(0,Ke.createElement)("li",{className:"comment even thread-even depth-1"},(0,Ke.createElement)("article",{className:"comment-body"},(0,Ke.createElement)("footer",{className:"comment-meta"},(0,Ke.createElement)("div",{className:"comment-author vcard"},(0,Ke.createElement)("img",{alt:(0,tt.__)("Commenter Avatar"),src:a,className:"avatar avatar-32 photo",height:"32",width:"32",loading:"lazy"}),(0,Ke.createElement)("b",{className:"fn"},(0,Ke.createElement)("a",{href:"#top",className:"url"},(0,tt.__)("A WordPress Commenter")))," ",(0,Ke.createElement)("span",{className:"says"},(0,tt.__)("says"),":")),(0,Ke.createElement)("div",{className:"comment-metadata"},(0,Ke.createElement)("a",{href:"#top"},(0,Ke.createElement)("time",{dateTime:"2000-01-01T00:00:00+00:00"},(0,tt.__)("January 1, 2000 at 00:00 am")))," ",(0,Ke.createElement)("span",{className:"edit-link"},(0,Ke.createElement)("a",{className:"comment-edit-link",href:"#top"},(0,tt.__)("Edit"))))),(0,Ke.createElement)("div",{className:"comment-content"},(0,Ke.createElement)("p",null,(0,tt.__)("Hi, this is a comment."),(0,Ke.createElement)("br",null),(0,tt.__)("To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard."),(0,Ke.createElement)("br",null),(0,_t.createInterpolateElement)((0,tt.__)("Commenter avatars come from <a>Gravatar</a>."),{a:(0,Ke.createElement)("a",{href:"https://gravatar.com/"})}))),(0,Ke.createElement)("div",{className:"reply"},(0,Ke.createElement)("a",{className:"comment-reply-link",href:"#top","aria-label":(0,tt.__)("Reply to A WordPress Commenter")},(0,tt.__)("Reply")))))),(0,Ke.createElement)("div",{className:"navigation"},(0,Ke.createElement)("div",{className:"alignleft"},(0,Ke.createElement)("a",{href:"#top"},"« ",(0,tt.__)("Older Comments"))),(0,Ke.createElement)("div",{className:"alignright"},(0,Ke.createElement)("a",{href:"#top"},(0,tt.__)("Newer Comments")," »"))),(0,Ke.createElement)(eo,{postId:t,postType:e}))}function no({attributes:e,setAttributes:t,context:{postType:n,postId:a}}){const{textAlign:o}=e,r=[(0,Ke.createElement)(et.Button,{key:"convert",onClick:()=>{t({legacy:!1})},variant:"primary"},(0,tt.__)("Switch to editable mode"))],l=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${o}`]:o})});return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:o,onChange:e=>{t({textAlign:e})}})),(0,Ke.createElement)("div",{...l},(0,Ke.createElement)(nt.Warning,{actions:r},(0,tt.__)("Comments block: You’re currently using the legacy version of the block. The following is just a placeholder - the final styling will likely look different. For a better representation and more customization options, switch the block to its editable mode.")),(0,Ke.createElement)(to,{postId:a,postType:n})))}const ao=[["core/comments-title"],["core/comment-template",{},[["core/columns",{},[["core/column",{width:"40px"},[["core/avatar",{size:40,style:{border:{radius:"20px"}}}]]],["core/column",{},[["core/comment-author-name",{fontSize:"small"}],["core/group",{layout:{type:"flex"},style:{spacing:{margin:{top:"0px",bottom:"0px"}}}},[["core/comment-date",{fontSize:"small"}],["core/comment-edit-link",{fontSize:"small"}]]],["core/comment-content"],["core/comment-reply-link",{fontSize:"small"}]]]]]]],["core/comments-pagination"],["core/post-comments-form"]];const oo={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/comments",title:"Comments",category:"theme",description:"An advanced block that allows displaying post comments using different visual configurations.",textdomain:"default",attributes:{tagName:{type:"string",default:"div"},legacy:{type:"boolean",default:!1}},supports:{align:["wide","full"],html:!1,color:{gradients:!0,heading:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}}},editorStyle:"wp-block-comments-editor",usesContext:["postId","postType"]},{name:ro}=oo,lo={icon:Ka,edit:function(e){const{attributes:t,setAttributes:n}=e,{tagName:a,legacy:o}=t,r=(0,nt.useBlockProps)(),l=(0,nt.useInnerBlocksProps)(r,{template:ao});return o?(0,Ke.createElement)(no,{...e}):(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(Ja,{attributes:t,setAttributes:n}),(0,Ke.createElement)(a,{...l}))},save:function({attributes:{tagName:e,legacy:t}}){const n=nt.useBlockProps.save(),a=nt.useInnerBlocksProps.save(n);return t?null:(0,Ke.createElement)(e,{...a})},deprecated:Ya},io=()=>Xe({name:ro,metadata:oo,settings:lo});const so={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,__experimental:"fse",name:"core/comment-author-avatar",title:"Comment Author Avatar (deprecated)",category:"theme",ancestor:["core/comment-template"],description:"This block is deprecated. Please use the Avatar block instead.",textdomain:"default",attributes:{width:{type:"number",default:96},height:{type:"number",default:96}},usesContext:["commentId"],supports:{html:!1,inserter:!1,__experimentalBorder:{radius:!0,width:!0,color:!0,style:!0},color:{background:!0,text:!1,__experimentalDefaultControls:{background:!0}},spacing:{__experimentalSkipSerialization:!0,margin:!0,padding:!0},interactivity:{clientNavigation:!0}}},{name:co}=so,mo={icon:ct,edit:function({attributes:e,context:{commentId:t},setAttributes:n,isSelected:a}){const{height:o,width:r}=e,[l]=(0,dt.useEntityProp)("root","comment","author_avatar_urls",t),[i]=(0,dt.useEntityProp)("root","comment","author_name",t),s=l?Object.values(l):null,c=l?Object.keys(l):null,m=c?c[0]:24,u=c?c[c.length-1]:96,p=(0,nt.useBlockProps)(),d=(0,nt.__experimentalGetSpacingClassesAndStyles)(e),g=Math.floor(2.5*u),{avatarURL:h}=(0,gt.useSelect)((e=>{const{getSettings:t}=e(nt.store),{__experimentalDiscussionSettings:n}=t();return n})),b=(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Avatar Settings")},(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Image size"),onChange:e=>n({width:e,height:e}),min:m,max:g,initialPosition:r,value:r}))),_=(0,Ke.createElement)(et.ResizableBox,{size:{width:r,height:o},showHandle:a,onResizeStop:(e,t,a,l)=>{n({height:parseInt(o+l.height,10),width:parseInt(r+l.width,10)})},lockAspectRatio:!0,enable:{top:!1,right:!(0,tt.isRTL)(),bottom:!0,left:(0,tt.isRTL)()},minWidth:m,maxWidth:g},(0,Ke.createElement)("img",{src:s?s[s.length-1]:h,alt:`${i} ${(0,tt.__)("Avatar")}`,...p}));return(0,Ke.createElement)(Ke.Fragment,null,b,(0,Ke.createElement)("div",{...d},_))}},uo=()=>Xe({name:co,metadata:so,settings:mo}),po=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z",fillRule:"evenodd",clipRule:"evenodd"}),(0,Ke.createElement)(Ye.Path,{d:"M15 15V15C15 13.8954 14.1046 13 13 13L11 13C9.89543 13 9 13.8954 9 15V15",fillRule:"evenodd",clipRule:"evenodd"}),(0,Ke.createElement)(Ye.Circle,{cx:"12",cy:"9",r:"2",fillRule:"evenodd",clipRule:"evenodd"}));const go={attributes:{isLink:{type:"boolean",default:!1},linkTarget:{type:"string",default:"_self"}},supports:{html:!1,color:{gradients:!0,link:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalLetterSpacing:!0}},save:()=>null,migrate:ln,isEligible:({style:e})=>e?.typography?.fontFamily},ho=[go],bo={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/comment-author-name",title:"Comment Author Name",category:"theme",ancestor:["core/comment-template"],description:"Displays the name of the author of the comment.",textdomain:"default",attributes:{isLink:{type:"boolean",default:!0},linkTarget:{type:"string",default:"_self"},textAlign:{type:"string"}},usesContext:["commentId"],supports:{html:!1,spacing:{margin:!0,padding:!0},color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:_o}=bo,yo={icon:po,edit:function({attributes:{isLink:e,linkTarget:t,textAlign:n},context:{commentId:a},setAttributes:o}){const r=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${n}`]:n})});let l=(0,gt.useSelect)((e=>{const{getEntityRecord:t}=e(dt.store),n=t("root","comment",a),o=n?.author_name;if(n&&!o){var r;const e=t("root","user",n.author);return null!==(r=e?.name)&&void 0!==r?r:(0,tt.__)("Anonymous")}return null!=o?o:""}),[a]);const i=(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:n,onChange:e=>o({textAlign:e})})),s=(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link to authors URL"),onChange:()=>o({isLink:!e}),checked:e}),e&&(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Open in new tab"),onChange:e=>o({linkTarget:e?"_blank":"_self"}),checked:"_blank"===t})));a&&l||(l=(0,tt._x)("Comment Author","block title"));const c=e?(0,Ke.createElement)("a",{href:"#comment-author-pseudo-link",onClick:e=>e.preventDefault()},l):l;return(0,Ke.createElement)(Ke.Fragment,null,s,i,(0,Ke.createElement)("div",{...r},c))},deprecated:ho},vo=()=>Xe({name:_o,metadata:bo,settings:yo}),fo=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6.68822 16.625L5.5 17.8145L5.5 5.5L18.5 5.5L18.5 16.625L6.68822 16.625ZM7.31 18.125L19 18.125C19.5523 18.125 20 17.6773 20 17.125L20 5C20 4.44772 19.5523 4 19 4H5C4.44772 4 4 4.44772 4 5V19.5247C4 19.8173 4.16123 20.086 4.41935 20.2237C4.72711 20.3878 5.10601 20.3313 5.35252 20.0845L7.31 18.125ZM16 9.99997H8V8.49997H16V9.99997ZM8 14H13V12.5H8V14Z"}));const ko={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/comment-content",title:"Comment Content",category:"theme",ancestor:["core/comment-template"],description:"Displays the contents of a comment.",textdomain:"default",usesContext:["commentId"],attributes:{textAlign:{type:"string"}},supports:{color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},spacing:{padding:["horizontal","vertical"],__experimentalDefaultControls:{padding:!0}},html:!1}},{name:xo}=ko,wo={icon:fo,edit:function({setAttributes:e,attributes:{textAlign:t},context:{commentId:n}}){const a=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${t}`]:t})}),[o]=(0,dt.useEntityProp)("root","comment","content",n),r=(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:t,onChange:t=>e({textAlign:t})}));return n&&o?(0,Ke.createElement)(Ke.Fragment,null,r,(0,Ke.createElement)("div",{...a},(0,Ke.createElement)(et.Disabled,null,(0,Ke.createElement)(_t.RawHTML,{key:"html"},o.rendered)))):(0,Ke.createElement)(Ke.Fragment,null,r,(0,Ke.createElement)("div",{...a},(0,Ke.createElement)("p",null,(0,tt._x)("Comment Content","block title"))))}},Eo=()=>Xe({name:xo,metadata:ko,settings:wo}),Co=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M11.696 13.972c.356-.546.599-.958.728-1.235a1.79 1.79 0 00.203-.783c0-.264-.077-.47-.23-.618-.148-.153-.354-.23-.618-.23-.295 0-.569.07-.82.212a3.413 3.413 0 00-.738.571l-.147-1.188c.289-.234.59-.41.903-.526.313-.117.66-.175 1.041-.175.375 0 .695.08.959.24.264.153.46.362.59.626.135.265.203.556.203.876 0 .362-.08.734-.24 1.115-.154.381-.427.87-.82 1.466l-.756 1.152H14v1.106h-4l1.696-2.609z"}),(0,Ke.createElement)(Ye.Path,{d:"M19.5 7h-15v12a.5.5 0 00.5.5h14a.5.5 0 00.5-.5V7zM3 7V5a2 2 0 012-2h14a2 2 0 012 2v14a2 2 0 01-2 2H5a2 2 0 01-2-2V7z"})),So=window.wp.date;const Bo={attributes:{format:{type:"string"},isLink:{type:"boolean",default:!1}},supports:{html:!1,color:{gradients:!0,link:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalLetterSpacing:!0}},save:()=>null,migrate:ln,isEligible:({style:e})=>e?.typography?.fontFamily},No=[Bo],To={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/comment-date",title:"Comment Date",category:"theme",ancestor:["core/comment-template"],description:"Displays the date on which the comment was posted.",textdomain:"default",attributes:{format:{type:"string"},isLink:{type:"boolean",default:!0}},usesContext:["commentId"],supports:{html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:Io}=To,Po={icon:Co,edit:function({attributes:{format:e,isLink:t},context:{commentId:n},setAttributes:a}){const o=(0,nt.useBlockProps)();let[r]=(0,dt.useEntityProp)("root","comment","date",n);const[l=(0,So.getSettings)().formats.date]=(0,dt.useEntityProp)("root","site","date_format"),i=(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(nt.__experimentalDateFormatPicker,{format:e,defaultFormat:l,onChange:e=>a({format:e})}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link to comment"),onChange:()=>a({isLink:!t}),checked:t})));n&&r||(r=(0,tt._x)("Comment Date","block title"));let s=r instanceof Date?(0,Ke.createElement)("time",{dateTime:(0,So.dateI18n)("c",r)},(0,So.dateI18n)(e||l,r)):(0,Ke.createElement)("time",null,r);return t&&(s=(0,Ke.createElement)("a",{href:"#comment-date-pseudo-link",onClick:e=>e.preventDefault()},s)),(0,Ke.createElement)(Ke.Fragment,null,i,(0,Ke.createElement)("div",{...o},s))},deprecated:No},Mo=()=>Xe({name:Io,metadata:To,settings:Po}),zo=(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"m6.249 11.065.44-.44h3.186l-1.5 1.5H7.31l-1.957 1.96A.792.792 0 0 1 4 13.524V5a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v1.5L12.5 8V5.5h-7v6.315l.749-.75ZM20 19.75H7v-1.5h13v1.5Zm0-12.653-8.967 9.064L8 17l.867-2.935L17.833 5 20 7.097Z"}));const Ro={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/comment-edit-link",title:"Comment Edit Link",category:"theme",ancestor:["core/comment-template"],description:"Displays a link to edit the comment in the WordPress Dashboard. This link is only visible to users with the edit comment capability.",textdomain:"default",usesContext:["commentId"],attributes:{linkTarget:{type:"string",default:"_self"},textAlign:{type:"string"}},supports:{html:!1,color:{link:!0,gradients:!0,text:!1,__experimentalDefaultControls:{background:!0,link:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:Ao}=Ro,Ho={icon:zo,edit:function({attributes:{linkTarget:e,textAlign:t},setAttributes:n}){const a=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${t}`]:t})}),o=(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:t,onChange:e=>n({textAlign:e})})),r=(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Open in new tab"),onChange:e=>n({linkTarget:e?"_blank":"_self"}),checked:"_blank"===e})));return(0,Ke.createElement)(Ke.Fragment,null,o,r,(0,Ke.createElement)("div",{...a},(0,Ke.createElement)("a",{href:"#edit-comment-pseudo-link",onClick:e=>e.preventDefault()},(0,tt.__)("Edit"))))}},Lo=()=>Xe({name:Ao,metadata:Ro,settings:Ho}),Do=(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M6.68822 10.625L6.24878 11.0649L5.5 11.8145L5.5 5.5L12.5 5.5V8L14 6.5V5C14 4.44772 13.5523 4 13 4H5C4.44772 4 4 4.44771 4 5V13.5247C4 13.8173 4.16123 14.086 4.41935 14.2237C4.72711 14.3878 5.10601 14.3313 5.35252 14.0845L7.31 12.125H8.375L9.875 10.625H7.31H6.68822ZM14.5605 10.4983L11.6701 13.75H16.9975C17.9963 13.75 18.7796 14.1104 19.3553 14.7048C19.9095 15.2771 20.2299 16.0224 20.4224 16.7443C20.7645 18.0276 20.7543 19.4618 20.7487 20.2544C20.7481 20.345 20.7475 20.4272 20.7475 20.4999L19.2475 20.5001C19.2475 20.4191 19.248 20.3319 19.2484 20.2394V20.2394C19.2526 19.4274 19.259 18.2035 18.973 17.1307C18.8156 16.5401 18.586 16.0666 18.2778 15.7483C17.9909 15.4521 17.5991 15.25 16.9975 15.25H11.8106L14.5303 17.9697L13.4696 19.0303L8.96956 14.5303L13.4394 9.50171L14.5605 10.4983Z"}));const Fo=function({setAttributes:e,attributes:{textAlign:t}}){const n=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${t}`]:t})}),a=(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:t,onChange:t=>e({textAlign:t})}));return(0,Ke.createElement)(Ke.Fragment,null,a,(0,Ke.createElement)("div",{...n},(0,Ke.createElement)("a",{href:"#comment-reply-pseudo-link",onClick:e=>e.preventDefault()},(0,tt.__)("Reply"))))},Vo={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/comment-reply-link",title:"Comment Reply Link",category:"theme",ancestor:["core/comment-template"],description:"Displays a link to reply to a comment.",textdomain:"default",usesContext:["commentId"],attributes:{textAlign:{type:"string"}},supports:{color:{gradients:!0,link:!0,text:!1,__experimentalDefaultControls:{background:!0,link:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},html:!1}},{name:$o}=Vo,Oo={edit:Fo,icon:Do},Go=()=>Xe({name:$o,metadata:Vo,settings:Oo}),Uo=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.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"})),qo=window.wp.apiFetch;var jo=n.n(qo);const Wo=({defaultPage:e,postId:t,perPage:n,queryArgs:a})=>{const[o,r]=(0,_t.useState)({}),l=`${t}_${n}`,i=o[l]||0;return(0,_t.useEffect)((()=>{i||"newest"!==e||jo()({path:(0,pt.addQueryArgs)("/wp/v2/comments",{...a,post:t,per_page:n,_fields:"id"}),method:"HEAD",parse:!1}).then((e=>{const t=parseInt(e.headers.get("X-WP-TotalPages"));r({...o,[l]:t<=1?1:t})}))}),[e,t,n,r]),"newest"===e?i:1},Zo=[["core/avatar"],["core/comment-author-name"],["core/comment-date"],["core/comment-content"],["core/comment-reply-link"],["core/comment-edit-link"]];function Qo({comment:e,activeCommentId:t,setActiveCommentId:n,firstCommentId:a,blocks:o}){const{children:r,...l}=(0,nt.useInnerBlocksProps)({},{template:Zo});return(0,Ke.createElement)("li",{...l},e.commentId===(t||a)?r:null,(0,Ke.createElement)(Ko,{blocks:o,commentId:e.commentId,setActiveCommentId:n,isHidden:e.commentId===(t||a)}),e?.children?.length>0?(0,Ke.createElement)(Yo,{comments:e.children,activeCommentId:t,setActiveCommentId:n,blocks:o,firstCommentId:a}):null)}const Ko=(0,_t.memo)((({blocks:e,commentId:t,setActiveCommentId:n,isHidden:a})=>{const o=(0,nt.__experimentalUseBlockPreview)({blocks:e}),r=()=>{n(t)},l={display:a?"none":void 0};return(0,Ke.createElement)("div",{...o,tabIndex:0,role:"button",style:l,onClick:r,onKeyPress:r})})),Yo=({comments:e,blockProps:t,activeCommentId:n,setActiveCommentId:a,blocks:o,firstCommentId:r})=>(0,Ke.createElement)("ol",{...t},e&&e.map((({commentId:e,...t},l)=>(0,Ke.createElement)(nt.BlockContextProvider,{key:t.commentId||l,value:{commentId:e<0?null:e}},(0,Ke.createElement)(Qo,{comment:{commentId:e,...t},activeCommentId:n,setActiveCommentId:a,blocks:o,firstCommentId:r})))));const Jo={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/comment-template",title:"Comment Template",category:"design",parent:["core/comments"],description:"Contains the block elements used to display a comment, like the title, date, author, avatar and more.",textdomain:"default",usesContext:["postId"],supports:{align:!0,html:!1,reusable:!1,spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},style:"wp-block-comment-template"},{name:Xo}=Jo,er={icon:Uo,edit:function({clientId:e,context:{postId:t}}){const n=(0,nt.useBlockProps)(),[a,o]=(0,_t.useState)(),{commentOrder:r,threadCommentsDepth:l,threadComments:i,commentsPerPage:s,pageComments:c}=(0,gt.useSelect)((e=>{const{getSettings:t}=e(nt.store);return t().__experimentalDiscussionSettings})),m=(({postId:e})=>{const t={status:"approve",order:"asc",context:"embed",parent:0,_embed:"children"},{pageComments:n,commentsPerPage:a,defaultCommentsPage:o}=(0,gt.useSelect)((e=>{const{getSettings:t}=e(nt.store),{__experimentalDiscussionSettings:n}=t();return n})),r=n?Math.min(a,100):100,l=Wo({defaultPage:o,postId:e,perPage:r,queryArgs:t});return(0,_t.useMemo)((()=>l?{...t,post:e,per_page:r,page:l}:null),[e,r,l])})({postId:t}),{topLevelComments:u,blocks:p}=(0,gt.useSelect)((t=>{const{getEntityRecords:n}=t(dt.store),{getBlocks:a}=t(nt.store);return{topLevelComments:m?n("root","comment",m):null,blocks:a(e)}}),[e,m]);let d=(e=>(0,_t.useMemo)((()=>e?.map((({id:e,_embedded:t})=>{const[n]=t?.children||[[]];return{commentId:e,children:n.map((e=>({commentId:e.id})))}}))),[e]))("desc"===r&&u?[...u].reverse():u);return u?(t||(d=(({perPage:e,pageComments:t,threadComments:n,threadCommentsDepth:a})=>{const o=n?Math.min(a,3):1,r=e=>e<o?[{commentId:-(e+3),children:r(e+1)}]:[],l=[{commentId:-1,children:r(1)}];return(!t||e>=2)&&o<3&&l.push({commentId:-2,children:[]}),(!t||e>=3)&&o<2&&l.push({commentId:-3,children:[]}),l})({perPage:s,pageComments:c,threadComments:i,threadCommentsDepth:l})),d.length?(0,Ke.createElement)(Yo,{comments:d,blockProps:n,blocks:p,activeCommentId:a,setActiveCommentId:o,firstCommentId:d[0]?.commentId}):(0,Ke.createElement)("p",{...n},(0,tt.__)("No results found."))):(0,Ke.createElement)("p",{...n},(0,Ke.createElement)(et.Spinner,null))},save:function(){return(0,Ke.createElement)(nt.InnerBlocks.Content,null)}},tr=()=>Xe({name:Xo,metadata:Jo,settings:er}),nr=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M16 10.5v3h3v-3h-3zm-5 3h3v-3h-3v3zM7 9l-3 3 3 3 1-1-2-2 2-2-1-1z"})),ar={none:"",arrow:"←",chevron:"«"};const or={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/comments-pagination-previous",title:"Comments Previous Page",category:"theme",parent:["core/comments-pagination"],description:"Displays the previous comment's page link.",textdomain:"default",attributes:{label:{type:"string"}},usesContext:["postId","comments/paginationArrow"],supports:{reusable:!1,html:!1,color:{gradients:!0,text:!1,__experimentalDefaultControls:{background:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:rr}=or,lr={icon:nr,edit:function({attributes:{label:e},setAttributes:t,context:{"comments/paginationArrow":n}}){const a=ar[n];return(0,Ke.createElement)("a",{href:"#comments-pagination-previous-pseudo-link",onClick:e=>e.preventDefault(),...(0,nt.useBlockProps)()},a&&(0,Ke.createElement)("span",{className:`wp-block-comments-pagination-previous-arrow is-arrow-${n}`},a),(0,Ke.createElement)(nt.PlainText,{__experimentalVersion:2,tagName:"span","aria-label":(0,tt.__)("Older comments page link"),placeholder:(0,tt.__)("Older Comments"),value:e,onChange:e=>t({label:e})}))}},ir=()=>Xe({name:rr,metadata:or,settings:lr}),sr=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M4 13.5h6v-3H4v3zm8 0h3v-3h-3v3zm5-3v3h3v-3h-3z"}));function cr({value:e,onChange:t}){return(0,Ke.createElement)(et.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Arrow"),value:e,onChange:t,help:(0,tt.__)("A decorative arrow appended to the next and previous comments link."),isBlock:!0},(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"none",label:(0,tt._x)("None","Arrow option for Comments Pagination Next/Previous blocks")}),(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"arrow",label:(0,tt._x)("Arrow","Arrow option for Comments Pagination Next/Previous blocks")}),(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"chevron",label:(0,tt._x)("Chevron","Arrow option for Comments Pagination Next/Previous blocks")}))}const mr=[["core/comments-pagination-previous"],["core/comments-pagination-numbers"],["core/comments-pagination-next"]];const ur={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/comments-pagination",title:"Comments Pagination",category:"theme",parent:["core/comments"],allowedBlocks:["core/comments-pagination-previous","core/comments-pagination-numbers","core/comments-pagination-next"],description:"Displays a paginated navigation to next/previous set of comments, when applicable.",textdomain:"default",attributes:{paginationArrow:{type:"string",default:"none"}},providesContext:{"comments/paginationArrow":"paginationArrow"},supports:{align:!0,reusable:!1,html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},layout:{allowSwitching:!1,allowInheriting:!1,default:{type:"flex"}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-comments-pagination-editor",style:"wp-block-comments-pagination"},{name:pr}=ur,dr={icon:sr,edit:function({attributes:{paginationArrow:e},setAttributes:t,clientId:n}){const a=(0,gt.useSelect)((e=>{const{getBlocks:t}=e(nt.store),a=t(n);return a?.find((e=>["core/comments-pagination-previous","core/comments-pagination-next"].includes(e.name)))}),[]),o=(0,nt.useBlockProps)(),r=(0,nt.useInnerBlocksProps)(o,{template:mr});return(0,gt.useSelect)((e=>{const{getSettings:t}=e(nt.store),{__experimentalDiscussionSettings:n}=t();return n?.pageComments}),[])?(0,Ke.createElement)(Ke.Fragment,null,a&&(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(cr,{value:e,onChange:e=>{t({paginationArrow:e})}}))),(0,Ke.createElement)("div",{...r})):(0,Ke.createElement)(nt.Warning,null,(0,tt.__)("Comments Pagination block: paging comments is disabled in the Discussion Settings"))},save:function(){return(0,Ke.createElement)(nt.InnerBlocks.Content,null)}},gr=()=>Xe({name:pr,metadata:ur,settings:dr}),hr=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M5 13.5h3v-3H5v3zm5 0h3v-3h-3v3zM17 9l-1 1 2 2-2 2 1 1 3-3-3-3z"})),br={none:"",arrow:"→",chevron:"»"};const _r={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/comments-pagination-next",title:"Comments Next Page",category:"theme",parent:["core/comments-pagination"],description:"Displays the next comment's page link.",textdomain:"default",attributes:{label:{type:"string"}},usesContext:["postId","comments/paginationArrow"],supports:{reusable:!1,html:!1,color:{gradients:!0,text:!1,__experimentalDefaultControls:{background:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:yr}=_r,vr={icon:hr,edit:function({attributes:{label:e},setAttributes:t,context:{"comments/paginationArrow":n}}){const a=br[n];return(0,Ke.createElement)("a",{href:"#comments-pagination-next-pseudo-link",onClick:e=>e.preventDefault(),...(0,nt.useBlockProps)()},(0,Ke.createElement)(nt.PlainText,{__experimentalVersion:2,tagName:"span","aria-label":(0,tt.__)("Newer comments page link"),placeholder:(0,tt.__)("Newer Comments"),value:e,onChange:e=>t({label:e})}),a&&(0,Ke.createElement)("span",{className:`wp-block-comments-pagination-next-arrow is-arrow-${n}`},a))}},fr=()=>Xe({name:yr,metadata:_r,settings:vr}),kr=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M4 13.5h6v-3H4v3zm8.2-2.5.8-.3V14h1V9.3l-2.2.7.4 1zm7.1-1.2c-.5-.6-1.2-.5-1.7-.4-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5h2.7v-1h-.9c.3-.6.8-1.4.9-2.1 0-.3-.1-.8-.3-1.1z"})),xr=({content:e,tag:t="a",extraClass:n=""})=>"a"===t?(0,Ke.createElement)(t,{className:`page-numbers ${n}`,href:"#comments-pagination-numbers-pseudo-link",onClick:e=>e.preventDefault()},e):(0,Ke.createElement)(t,{className:`page-numbers ${n}`},e);const wr={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/comments-pagination-numbers",title:"Comments Page Numbers",category:"theme",parent:["core/comments-pagination"],description:"Displays a list of page numbers for comments pagination.",textdomain:"default",usesContext:["postId"],supports:{reusable:!1,html:!1,color:{gradients:!0,text:!1,__experimentalDefaultControls:{background:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:Er}=wr,Cr={icon:kr,edit:function(){return(0,Ke.createElement)("div",{...(0,nt.useBlockProps)()},(0,Ke.createElement)(xr,{content:"1"}),(0,Ke.createElement)(xr,{content:"2"}),(0,Ke.createElement)(xr,{content:"3",tag:"span",extraClass:"current"}),(0,Ke.createElement)(xr,{content:"4"}),(0,Ke.createElement)(xr,{content:"5"}),(0,Ke.createElement)(xr,{content:"...",tag:"span",extraClass:"dots"}),(0,Ke.createElement)(xr,{content:"8"}))}},Sr=()=>Xe({name:Er,metadata:wr,settings:Cr}),Br=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"m4 5.5h2v6.5h1.5v-6.5h2v-1.5h-5.5zm16 10.5h-16v-1.5h16zm-7 4h-9v-1.5h9z"}));const{attributes:Nr,supports:Tr}={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/comments-title",title:"Comments Title",category:"theme",ancestor:["core/comments"],description:"Displays a title with the number of comments.",textdomain:"default",usesContext:["postId","postType"],attributes:{textAlign:{type:"string"},showPostTitle:{type:"boolean",default:!0},showCommentsCount:{type:"boolean",default:!0},level:{type:"number",default:2}},supports:{anchor:!1,align:!0,html:!1,__experimentalBorder:{radius:!0,color:!0,width:!0,style:!0},color:{gradients:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0,__experimentalFontFamily:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0}},interactivity:{clientNavigation:!0}}},Ir=[{attributes:{...Nr,singleCommentLabel:{type:"string"},multipleCommentsLabel:{type:"string"}},supports:Tr,migrate:e=>{const{singleCommentLabel:t,multipleCommentsLabel:n,...a}=e;return a},isEligible:({multipleCommentsLabel:e,singleCommentLabel:t})=>e||t,save:()=>null}],Pr={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/comments-title",title:"Comments Title",category:"theme",ancestor:["core/comments"],description:"Displays a title with the number of comments.",textdomain:"default",usesContext:["postId","postType"],attributes:{textAlign:{type:"string"},showPostTitle:{type:"boolean",default:!0},showCommentsCount:{type:"boolean",default:!0},level:{type:"number",default:2}},supports:{anchor:!1,align:!0,html:!1,__experimentalBorder:{radius:!0,color:!0,width:!0,style:!0},color:{gradients:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0,__experimentalFontFamily:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0}},interactivity:{clientNavigation:!0}}},{name:Mr}=Pr,zr={icon:Br,edit:function({attributes:{textAlign:e,showPostTitle:t,showCommentsCount:n,level:a},setAttributes:o,context:{postType:r,postId:l}}){const i="h"+a,[s,c]=(0,_t.useState)(),[m]=(0,dt.useEntityProp)("postType",r,"title",l),u=void 0===l,p=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${e}`]:e})}),{threadCommentsDepth:d,threadComments:g,commentsPerPage:h,pageComments:b}=(0,gt.useSelect)((e=>{const{getSettings:t}=e(nt.store);return t().__experimentalDiscussionSettings}));(0,_t.useEffect)((()=>{if(u){const e=g?Math.min(d,3)-1:0,t=b?h:3,n=parseInt(e)+parseInt(t);return void c(Math.min(n,3))}const e=l;jo()({path:(0,pt.addQueryArgs)("/wp/v2/comments",{post:l,_fields:"id"}),method:"HEAD",parse:!1}).then((t=>{e===l&&c(parseInt(t.headers.get("X-WP-Total")))})).catch((()=>{c(0)}))}),[l]);const _=(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:e,onChange:e=>o({textAlign:e})}),(0,Ke.createElement)(nt.HeadingLevelDropdown,{value:a,onChange:e=>o({level:e})})),y=(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show post title"),checked:t,onChange:e=>o({showPostTitle:e})}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show comments count"),checked:n,onChange:e=>o({showCommentsCount:e})}))),v=u?(0,tt.__)("“Post Title”"):`"${m}"`;let f;return f=n&&void 0!==s?t?1===s?(0,tt.sprintf)((0,tt.__)("One response to %s"),v):(0,tt.sprintf)((0,tt._n)("%1$s response to %2$s","%1$s responses to %2$s",s),s,v):1===s?(0,tt.__)("One response"):(0,tt.sprintf)((0,tt._n)("%s response","%s responses",s),s):t?1===s?(0,tt.sprintf)((0,tt.__)("Response to %s"),v):(0,tt.sprintf)((0,tt.__)("Responses to %s"),v):1===s?(0,tt.__)("Response"):(0,tt.__)("Responses"),(0,Ke.createElement)(Ke.Fragment,null,_,y,(0,Ke.createElement)(i,{...p},f))},deprecated:Ir},Rr=()=>Xe({name:Mr,metadata:Pr,settings:zr}),Ar=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.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-.8h6.2v8.9l2.5-3.1 2.5 3.1V4.5h2.2c.4 0 .8.4.8.8v13.4z"})),Hr={"top left":"is-position-top-left","top center":"is-position-top-center","top right":"is-position-top-right","center left":"is-position-center-left","center center":"is-position-center-center",center:"is-position-center-center","center right":"is-position-center-right","bottom left":"is-position-bottom-left","bottom center":"is-position-bottom-center","bottom right":"is-position-bottom-right"},Lr="image",Dr="video",Fr=50,Vr={x:.5,y:.5},$r=["image","video"];function Or({x:e,y:t}=Vr){return`${Math.round(100*e)}% ${Math.round(100*t)}%`}function Gr(e){return 50===e||void 0===e?null:"has-background-dim-"+10*Math.round(e/10)}function Ur(e){return!e||"center center"===e||"center"===e}function qr(e){return Ur(e)?"":Hr[e]}function jr(e){return e?{backgroundImage:`url(${e})`}:{}}function Wr(e){return 0!==e&&50!==e&&e?"has-background-dim-"+10*Math.round(e/10):null}function Zr(e){return{...e,dimRatio:e.url?e.dimRatio:100}}function Qr(e){return e.tagName||(e={...e,tagName:"div"}),{...e}}const Kr={url:{type:"string"},id:{type:"number"},hasParallax:{type:"boolean",default:!1},dimRatio:{type:"number",default:50},overlayColor:{type:"string"},customOverlayColor:{type:"string"},backgroundType:{type:"string",default:"image"},focalPoint:{type:"object"}},Yr={url:{type:"string"},id:{type:"number"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},hasParallax:{type:"boolean",default:!1},isRepeated:{type:"boolean",default:!1},dimRatio:{type:"number",default:100},overlayColor:{type:"string"},customOverlayColor:{type:"string"},backgroundType:{type:"string",default:"image"},focalPoint:{type:"object"},minHeight:{type:"number"},minHeightUnit:{type:"string"},gradient:{type:"string"},customGradient:{type:"string"},contentPosition:{type:"string"},isDark:{type:"boolean",default:!0},allowedBlocks:{type:"array"},templateLock:{type:["string","boolean"],enum:["all","insert",!1]}},Jr={...Yr,useFeaturedImage:{type:"boolean",default:!1},tagName:{type:"string",default:"div"}},Xr={anchor:!0,align:!0,html:!1,spacing:{padding:!0,__experimentalDefaultControls:{padding:!0}},color:{__experimentalDuotone:"> .wp-block-cover__image-background, > .wp-block-cover__video-background",text:!1,background:!1}},el={...Xr,spacing:{padding:!0,margin:["top","bottom"],blockGap:!0,__experimentalDefaultControls:{padding:!0,blockGap:!0}},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,radius:!0,style:!0,width:!0}},color:{__experimentalDuotone:"> .wp-block-cover__image-background, > .wp-block-cover__video-background",heading:!0,text:!0,background:!1,__experimentalSkipSerialization:["gradients"],enableContrastChecker:!1},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},layout:{allowJustification:!1}},tl={attributes:Jr,supports:el,save({attributes:e}){const{backgroundType:t,gradient:n,contentPosition:a,customGradient:o,customOverlayColor:r,dimRatio:l,focalPoint:i,useFeaturedImage:s,hasParallax:c,isDark:m,isRepeated:u,overlayColor:p,url:d,alt:g,id:h,minHeight:b,minHeightUnit:_,tagName:y}=e,v=(0,nt.getColorClassName)("background-color",p),f=(0,nt.__experimentalGetGradientClass)(n),k=Lr===t,x=Dr===t,w=!(c||u),E={minHeight:(b&&_?`${b}${_}`:b)||void 0},C={backgroundColor:v?void 0:r,background:o||void 0},S=i&&w?Or(i):void 0,B=d?`url(${d})`:void 0,N=Or(i),T=ut()({"is-light":!m,"has-parallax":c,"is-repeated":u,"has-custom-content-position":!Ur(a)},qr(a)),I=ut()("wp-block-cover__image-background",h?`wp-image-${h}`:null,{"has-parallax":c,"is-repeated":u}),P=n||o;return(0,Ke.createElement)(y,{...nt.useBlockProps.save({className:T,style:E})},(0,Ke.createElement)("span",{"aria-hidden":"true",className:ut()("wp-block-cover__background",v,Gr(l),{"has-background-dim":void 0!==l,"wp-block-cover__gradient-background":d&&P&&0!==l,"has-background-gradient":P,[f]:f}),style:C}),!s&&k&&d&&(w?(0,Ke.createElement)("img",{className:I,alt:g,src:d,style:{objectPosition:S},"data-object-fit":"cover","data-object-position":S}):(0,Ke.createElement)("div",{role:"img",className:I,style:{backgroundPosition:N,backgroundImage:B}})),x&&d&&(0,Ke.createElement)("video",{className:ut()("wp-block-cover__video-background","intrinsic-ignore"),autoPlay:!0,muted:!0,loop:!0,playsInline:!0,src:d,style:{objectPosition:S},"data-object-fit":"cover","data-object-position":S}),(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-cover__inner-container"})}))}},nl={attributes:Jr,supports:el,isEligible:e=>void 0!==e.customOverlayColor||void 0!==e.overlayColor,migrate:e=>({...e,isUserOverlayColor:!0}),save({attributes:e}){const{backgroundType:t,gradient:n,contentPosition:a,customGradient:o,customOverlayColor:r,dimRatio:l,focalPoint:i,useFeaturedImage:s,hasParallax:c,isDark:m,isRepeated:u,overlayColor:p,url:d,alt:g,id:h,minHeight:b,minHeightUnit:_,tagName:y}=e,v=(0,nt.getColorClassName)("background-color",p),f=(0,nt.__experimentalGetGradientClass)(n),k=Lr===t,x=Dr===t,w=!(c||u),E={minHeight:(b&&_?`${b}${_}`:b)||void 0},C={backgroundColor:v?void 0:r,background:o||void 0},S=i&&w?Or(i):void 0,B=d?`url(${d})`:void 0,N=Or(i),T=ut()({"is-light":!m,"has-parallax":c,"is-repeated":u,"has-custom-content-position":!Ur(a)},qr(a)),I=ut()("wp-block-cover__image-background",h?`wp-image-${h}`:null,{"has-parallax":c,"is-repeated":u}),P=n||o;return(0,Ke.createElement)(y,{...nt.useBlockProps.save({className:T,style:E})},(0,Ke.createElement)("span",{"aria-hidden":"true",className:ut()("wp-block-cover__background",v,Gr(l),{"has-background-dim":void 0!==l,"wp-block-cover__gradient-background":d&&P&&0!==l,"has-background-gradient":P,[f]:f}),style:C}),!s&&k&&d&&(w?(0,Ke.createElement)("img",{className:I,alt:g,src:d,style:{objectPosition:S},"data-object-fit":"cover","data-object-position":S}):(0,Ke.createElement)("div",{role:"img",className:I,style:{backgroundPosition:N,backgroundImage:B}})),x&&d&&(0,Ke.createElement)("video",{className:ut()("wp-block-cover__video-background","intrinsic-ignore"),autoPlay:!0,muted:!0,loop:!0,playsInline:!0,src:d,style:{objectPosition:S},"data-object-fit":"cover","data-object-position":S}),(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-cover__inner-container"})}))}},al={attributes:Yr,supports:Xr,save({attributes:e}){const{backgroundType:t,gradient:n,contentPosition:a,customGradient:o,customOverlayColor:r,dimRatio:l,focalPoint:i,useFeaturedImage:s,hasParallax:c,isDark:m,isRepeated:u,overlayColor:p,url:d,alt:g,id:h,minHeight:b,minHeightUnit:_}=e,y=(0,nt.getColorClassName)("background-color",p),v=(0,nt.__experimentalGetGradientClass)(n),f=Lr===t,k=Dr===t,x=!(c||u),w={minHeight:(b&&_?`${b}${_}`:b)||void 0},E={backgroundColor:y?void 0:r,background:o||void 0},C=i&&x?Or(i):void 0,S=d?`url(${d})`:void 0,B=Or(i),N=ut()({"is-light":!m,"has-parallax":c,"is-repeated":u,"has-custom-content-position":!Ur(a)},qr(a)),T=ut()("wp-block-cover__image-background",h?`wp-image-${h}`:null,{"has-parallax":c,"is-repeated":u}),I=n||o;return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:N,style:w})},(0,Ke.createElement)("span",{"aria-hidden":"true",className:ut()("wp-block-cover__background",y,Gr(l),{"has-background-dim":void 0!==l,"wp-block-cover__gradient-background":d&&I&&0!==l,"has-background-gradient":I,[v]:v}),style:E}),!s&&f&&d&&(x?(0,Ke.createElement)("img",{className:T,alt:g,src:d,style:{objectPosition:C},"data-object-fit":"cover","data-object-position":C}):(0,Ke.createElement)("div",{role:"img",className:T,style:{backgroundPosition:B,backgroundImage:S}})),k&&d&&(0,Ke.createElement)("video",{className:ut()("wp-block-cover__video-background","intrinsic-ignore"),autoPlay:!0,muted:!0,loop:!0,playsInline:!0,src:d,style:{objectPosition:C},"data-object-fit":"cover","data-object-position":C}),(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-cover__inner-container"})}))},migrate:Qr},ol={attributes:Yr,supports:Xr,save({attributes:e}){const{backgroundType:t,gradient:n,contentPosition:a,customGradient:o,customOverlayColor:r,dimRatio:l,focalPoint:i,useFeaturedImage:s,hasParallax:c,isDark:m,isRepeated:u,overlayColor:p,url:d,alt:g,id:h,minHeight:b,minHeightUnit:_}=e,y=(0,nt.getColorClassName)("background-color",p),v=(0,nt.__experimentalGetGradientClass)(n),f=b&&_?`${b}${_}`:b,k=Lr===t,x=Dr===t,w=!(c||u),E={...!k||w||s?{}:jr(d),minHeight:f||void 0},C={backgroundColor:y?void 0:r,background:o||void 0},S=i&&w?`${Math.round(100*i.x)}% ${Math.round(100*i.y)}%`:void 0,B=ut()({"is-light":!m,"has-parallax":c,"is-repeated":u,"has-custom-content-position":!Ur(a)},qr(a)),N=n||o;return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:B,style:E})},(0,Ke.createElement)("span",{"aria-hidden":"true",className:ut()("wp-block-cover__background",y,Gr(l),{"has-background-dim":void 0!==l,"wp-block-cover__gradient-background":d&&N&&0!==l,"has-background-gradient":N,[v]:v}),style:C}),!s&&k&&w&&d&&(0,Ke.createElement)("img",{className:ut()("wp-block-cover__image-background",h?`wp-image-${h}`:null),alt:g,src:d,style:{objectPosition:S},"data-object-fit":"cover","data-object-position":S}),x&&d&&(0,Ke.createElement)("video",{className:ut()("wp-block-cover__video-background","intrinsic-ignore"),autoPlay:!0,muted:!0,loop:!0,playsInline:!0,src:d,style:{objectPosition:S},"data-object-fit":"cover","data-object-position":S}),(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-cover__inner-container"})}))},migrate:Qr},rl={attributes:Yr,supports:Xr,save({attributes:e}){const{backgroundType:t,gradient:n,contentPosition:a,customGradient:o,customOverlayColor:r,dimRatio:l,focalPoint:i,hasParallax:s,isDark:c,isRepeated:m,overlayColor:u,url:p,alt:d,id:g,minHeight:h,minHeightUnit:b}=e,_=(0,nt.getColorClassName)("background-color",u),y=(0,nt.__experimentalGetGradientClass)(n),v=b?`${h}${b}`:h,f=Lr===t,k=Dr===t,x=!(s||m),w={...f&&!x?jr(p):{},minHeight:v||void 0},E={backgroundColor:_?void 0:r,background:o||void 0},C=i&&x?`${Math.round(100*i.x)}% ${Math.round(100*i.y)}%`:void 0,S=ut()({"is-light":!c,"has-parallax":s,"is-repeated":m,"has-custom-content-position":!Ur(a)},qr(a)),B=n||o;return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:S,style:w})},(0,Ke.createElement)("span",{"aria-hidden":"true",className:ut()("wp-block-cover__background",_,Gr(l),{"has-background-dim":void 0!==l,"wp-block-cover__gradient-background":p&&B&&0!==l,"has-background-gradient":B,[y]:y}),style:E}),f&&x&&p&&(0,Ke.createElement)("img",{className:ut()("wp-block-cover__image-background",g?`wp-image-${g}`:null),alt:d,src:p,style:{objectPosition:C},"data-object-fit":"cover","data-object-position":C}),k&&p&&(0,Ke.createElement)("video",{className:ut()("wp-block-cover__video-background","intrinsic-ignore"),autoPlay:!0,muted:!0,loop:!0,playsInline:!0,src:p,style:{objectPosition:C},"data-object-fit":"cover","data-object-position":C}),(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-cover__inner-container"})}))},migrate:Qr},ll={attributes:Yr,supports:Xr,save({attributes:e}){const{backgroundType:t,gradient:n,contentPosition:a,customGradient:o,customOverlayColor:r,dimRatio:l,focalPoint:i,hasParallax:s,isDark:c,isRepeated:m,overlayColor:u,url:p,alt:d,id:g,minHeight:h,minHeightUnit:b}=e,_=(0,nt.getColorClassName)("background-color",u),y=(0,nt.__experimentalGetGradientClass)(n),v=b?`${h}${b}`:h,f=Lr===t,k=Dr===t,x=!(s||m),w={...f&&!x?jr(p):{},minHeight:v||void 0},E={backgroundColor:_?void 0:r,background:o||void 0},C=i&&x?`${Math.round(100*i.x)}% ${Math.round(100*i.y)}%`:void 0,S=ut()({"is-light":!c,"has-parallax":s,"is-repeated":m,"has-custom-content-position":!Ur(a)},qr(a));return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:S,style:w})},(0,Ke.createElement)("span",{"aria-hidden":"true",className:ut()(_,Gr(l),"wp-block-cover__gradient-background",y,{"has-background-dim":void 0!==l,"has-background-gradient":n||o,[y]:!p&&y}),style:E}),f&&x&&p&&(0,Ke.createElement)("img",{className:ut()("wp-block-cover__image-background",g?`wp-image-${g}`:null),alt:d,src:p,style:{objectPosition:C},"data-object-fit":"cover","data-object-position":C}),k&&p&&(0,Ke.createElement)("video",{className:ut()("wp-block-cover__video-background","intrinsic-ignore"),autoPlay:!0,muted:!0,loop:!0,playsInline:!0,src:p,style:{objectPosition:C},"data-object-fit":"cover","data-object-position":C}),(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-cover__inner-container"})}))},migrate:Qr},il={attributes:{...Kr,isRepeated:{type:"boolean",default:!1},minHeight:{type:"number"},minHeightUnit:{type:"string"},gradient:{type:"string"},customGradient:{type:"string"},contentPosition:{type:"string"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""}},supports:Xr,save({attributes:e}){const{backgroundType:t,gradient:n,contentPosition:a,customGradient:o,customOverlayColor:r,dimRatio:l,focalPoint:i,hasParallax:s,isRepeated:c,overlayColor:m,url:u,alt:p,id:d,minHeight:g,minHeightUnit:h}=e,b=(0,nt.getColorClassName)("background-color",m),_=(0,nt.__experimentalGetGradientClass)(n),y=h?`${g}${h}`:g,v=Lr===t,f=Dr===t,k=!(s||c),x={...v&&!k?jr(u):{},backgroundColor:b?void 0:r,background:o&&!u?o:void 0,minHeight:y||void 0},w=i&&k?`${Math.round(100*i.x)}% ${Math.round(100*i.y)}%`:void 0,E=ut()(Wr(l),b,{"has-background-dim":0!==l,"has-parallax":s,"is-repeated":c,"has-background-gradient":n||o,[_]:!u&&_,"has-custom-content-position":!Ur(a)},qr(a));return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:E,style:x})},u&&(n||o)&&0!==l&&(0,Ke.createElement)("span",{"aria-hidden":"true",className:ut()("wp-block-cover__gradient-background",_),style:o?{background:o}:void 0}),v&&k&&u&&(0,Ke.createElement)("img",{className:ut()("wp-block-cover__image-background",d?`wp-image-${d}`:null),alt:p,src:u,style:{objectPosition:w},"data-object-fit":"cover","data-object-position":w}),f&&u&&(0,Ke.createElement)("video",{className:ut()("wp-block-cover__video-background","intrinsic-ignore"),autoPlay:!0,muted:!0,loop:!0,playsInline:!0,src:u,style:{objectPosition:w},"data-object-fit":"cover","data-object-position":w}),(0,Ke.createElement)("div",{className:"wp-block-cover__inner-container"},(0,Ke.createElement)(nt.InnerBlocks.Content,null)))},migrate:(0,jt.compose)(Zr,Qr)},sl={attributes:{...Kr,isRepeated:{type:"boolean",default:!1},minHeight:{type:"number"},minHeightUnit:{type:"string"},gradient:{type:"string"},customGradient:{type:"string"},contentPosition:{type:"string"}},supports:{align:!0},save({attributes:e}){const{backgroundType:t,gradient:n,contentPosition:a,customGradient:o,customOverlayColor:r,dimRatio:l,focalPoint:i,hasParallax:s,isRepeated:c,overlayColor:m,url:u,minHeight:p,minHeightUnit:d}=e,g=(0,nt.getColorClassName)("background-color",m),h=(0,nt.__experimentalGetGradientClass)(n),b=d?`${p}${d}`:p,_=Lr===t,y=Dr===t,v=_?jr(u):{},f={};let k;g||(v.backgroundColor=r),o&&!u&&(v.background=o),v.minHeight=b||void 0,i&&(k=`${Math.round(100*i.x)}% ${Math.round(100*i.y)}%`,_&&!s&&(v.backgroundPosition=k),y&&(f.objectPosition=k));const x=ut()(Wr(l),g,{"has-background-dim":0!==l,"has-parallax":s,"is-repeated":c,"has-background-gradient":n||o,[h]:!u&&h,"has-custom-content-position":!Ur(a)},qr(a));return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:x,style:v})},u&&(n||o)&&0!==l&&(0,Ke.createElement)("span",{"aria-hidden":"true",className:ut()("wp-block-cover__gradient-background",h),style:o?{background:o}:void 0}),y&&u&&(0,Ke.createElement)("video",{className:"wp-block-cover__video-background",autoPlay:!0,muted:!0,loop:!0,playsInline:!0,src:u,style:f}),(0,Ke.createElement)("div",{className:"wp-block-cover__inner-container"},(0,Ke.createElement)(nt.InnerBlocks.Content,null)))},migrate:(0,jt.compose)(Zr,Qr)},cl={attributes:{...Kr,minHeight:{type:"number"},gradient:{type:"string"},customGradient:{type:"string"}},supports:{align:!0},save({attributes:e}){const{backgroundType:t,gradient:n,customGradient:a,customOverlayColor:o,dimRatio:r,focalPoint:l,hasParallax:i,overlayColor:s,url:c,minHeight:m}=e,u=(0,nt.getColorClassName)("background-color",s),p=(0,nt.__experimentalGetGradientClass)(n),d=t===Lr?jr(c):{};u||(d.backgroundColor=o),l&&!i&&(d.backgroundPosition=`${Math.round(100*l.x)}% ${Math.round(100*l.y)}%`),a&&!c&&(d.background=a),d.minHeight=m||void 0;const g=ut()(Wr(r),u,{"has-background-dim":0!==r,"has-parallax":i,"has-background-gradient":a,[p]:!c&&p});return(0,Ke.createElement)("div",{className:g,style:d},c&&(n||a)&&0!==r&&(0,Ke.createElement)("span",{"aria-hidden":"true",className:ut()("wp-block-cover__gradient-background",p),style:a?{background:a}:void 0}),Dr===t&&c&&(0,Ke.createElement)("video",{className:"wp-block-cover__video-background",autoPlay:!0,muted:!0,loop:!0,src:c}),(0,Ke.createElement)("div",{className:"wp-block-cover__inner-container"},(0,Ke.createElement)(nt.InnerBlocks.Content,null)))},migrate:(0,jt.compose)(Zr,Qr)},ml={attributes:{...Kr,minHeight:{type:"number"},gradient:{type:"string"},customGradient:{type:"string"}},supports:{align:!0},save({attributes:e}){const{backgroundType:t,gradient:n,customGradient:a,customOverlayColor:o,dimRatio:r,focalPoint:l,hasParallax:i,overlayColor:s,url:c,minHeight:m}=e,u=(0,nt.getColorClassName)("background-color",s),p=(0,nt.__experimentalGetGradientClass)(n),d=t===Lr?jr(c):{};u||(d.backgroundColor=o),l&&!i&&(d.backgroundPosition=`${100*l.x}% ${100*l.y}%`),a&&!c&&(d.background=a),d.minHeight=m||void 0;const g=ut()(Wr(r),u,{"has-background-dim":0!==r,"has-parallax":i,"has-background-gradient":a,[p]:!c&&p});return(0,Ke.createElement)("div",{className:g,style:d},c&&(n||a)&&0!==r&&(0,Ke.createElement)("span",{"aria-hidden":"true",className:ut()("wp-block-cover__gradient-background",p),style:a?{background:a}:void 0}),Dr===t&&c&&(0,Ke.createElement)("video",{className:"wp-block-cover__video-background",autoPlay:!0,muted:!0,loop:!0,src:c}),(0,Ke.createElement)("div",{className:"wp-block-cover__inner-container"},(0,Ke.createElement)(nt.InnerBlocks.Content,null)))},migrate:(0,jt.compose)(Zr,Qr)},ul={attributes:{...Kr,title:{type:"string",source:"html",selector:"p"},contentAlign:{type:"string",default:"center"}},supports:{align:!0},save({attributes:e}){const{backgroundType:t,contentAlign:n,customOverlayColor:a,dimRatio:o,focalPoint:r,hasParallax:l,overlayColor:i,title:s,url:c}=e,m=(0,nt.getColorClassName)("background-color",i),u=t===Lr?jr(c):{};m||(u.backgroundColor=a),r&&!l&&(u.backgroundPosition=`${100*r.x}% ${100*r.y}%`);const p=ut()(Wr(o),m,{"has-background-dim":0!==o,"has-parallax":l,[`has-${n}-content`]:"center"!==n});return(0,Ke.createElement)("div",{className:p,style:u},Dr===t&&c&&(0,Ke.createElement)("video",{className:"wp-block-cover__video-background",autoPlay:!0,muted:!0,loop:!0,src:c}),!nt.RichText.isEmpty(s)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"p",className:"wp-block-cover-text",value:s}))},migrate(e){const t={...e,dimRatio:e.url?e.dimRatio:100,tagName:e.tagName?e.tagName:"div"},{title:n,contentAlign:a,...o}=t;return[o,[(0,Qe.createBlock)("core/paragraph",{content:e.title,align:e.contentAlign,fontSize:"large",placeholder:(0,tt.__)("Write title…")})]]}},pl={attributes:{...Kr,title:{type:"string",source:"html",selector:"p"},contentAlign:{type:"string",default:"center"},align:{type:"string"}},supports:{className:!1},save({attributes:e}){const{url:t,title:n,hasParallax:a,dimRatio:o,align:r,contentAlign:l,overlayColor:i,customOverlayColor:s}=e,c=(0,nt.getColorClassName)("background-color",i),m=jr(t);c||(m.backgroundColor=s);const u=ut()("wp-block-cover-image",Wr(o),c,{"has-background-dim":0!==o,"has-parallax":a,[`has-${l}-content`]:"center"!==l},r?`align${r}`:null);return(0,Ke.createElement)("div",{className:u,style:m},!nt.RichText.isEmpty(n)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"p",className:"wp-block-cover-image-text",value:n}))},migrate(e){const t={...e,dimRatio:e.url?e.dimRatio:100,tagName:e.tagName?e.tagName:"div"},{title:n,contentAlign:a,align:o,...r}=t;return[r,[(0,Qe.createBlock)("core/paragraph",{content:e.title,align:e.contentAlign,fontSize:"large",placeholder:(0,tt.__)("Write title…")})]]}},dl={attributes:{...Kr,title:{type:"string",source:"html",selector:"h2"},align:{type:"string"},contentAlign:{type:"string",default:"center"}},supports:{className:!1},save({attributes:e}){const{url:t,title:n,hasParallax:a,dimRatio:o,align:r}=e,l=jr(t),i=ut()("wp-block-cover-image",Wr(o),{"has-background-dim":0!==o,"has-parallax":a},r?`align${r}`:null);return(0,Ke.createElement)("section",{className:i,style:l},(0,Ke.createElement)(nt.RichText.Content,{tagName:"h2",value:n}))},migrate(e){const t={...e,dimRatio:e.url?e.dimRatio:100,tagName:e.tagName?e.tagName:"div"},{title:n,contentAlign:a,align:o,...r}=t;return[r,[(0,Qe.createBlock)("core/paragraph",{content:e.title,align:e.contentAlign,fontSize:"large",placeholder:(0,tt.__)("Write title…")})]]}},gl=[tl,nl,al,ol,rl,ll,il,sl,cl,ml,ul,pl,dl],{cleanEmptyObject:hl}=Ft(nt.privateApis);function bl({onChange:e,onUnitChange:t,unit:n="px",value:a=""}){const o=`block-cover-height-input-${(0,jt.useInstanceId)(et.__experimentalUnitControl)}`,r="px"===n,[l]=(0,nt.useSettings)("spacing.units"),i=(0,et.__experimentalUseCustomUnits)({availableUnits:l||["px","em","rem","vw","vh"],defaultValues:{px:430,"%":20,em:20,rem:20,vw:20,vh:50}}),s=(0,_t.useMemo)((()=>{const[e]=(0,et.__experimentalParseQuantityAndUnitFromRawValue)(a);return[e,n].join("")}),[n,a]),c=r?Fr:0;return(0,Ke.createElement)(et.__experimentalUnitControl,{label:(0,tt.__)("Minimum height of cover"),id:o,isResetValueOnUnitChange:!0,min:c,onChange:t=>{const n=""!==t?parseFloat(t):void 0;isNaN(n)&&void 0!==n||e(n)},onUnitChange:t,__unstableInputWidth:"80px",units:i,value:s})}function _l({attributes:e,setAttributes:t,clientId:n,setOverlayColor:a,coverRef:o,currentSettings:r,updateDimRatio:l,onClearMedia:i}){const{useFeaturedImage:s,dimRatio:c,focalPoint:m,hasParallax:u,isRepeated:p,minHeight:d,minHeightUnit:g,alt:h,tagName:b}=e,{isVideoBackground:_,isImageBackground:y,mediaElement:v,url:f,overlayColor:k}=r,{gradientValue:x,setGradient:w}=(0,nt.__experimentalUseGradient)(),E=_||y&&(!u||p),C=e=>{const[t,n]=v.current?[v.current.style,"objectPosition"]:[o.current.style,"backgroundPosition"];t[n]=Or(e)},S=(0,nt.__experimentalUseMultipleOriginColorsAndGradients)(),B={header:(0,tt.__)("The <header> element should represent introductory content, typically a group of introductory or navigational aids."),main:(0,tt.__)("The <main> element should be used for the primary content of your document only."),section:(0,tt.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element."),article:(0,tt.__)("The <article> element should represent a self-contained, syndicatable portion of the document."),aside:(0,tt.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."),footer:(0,tt.__)("The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).")};return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,!!f&&(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},y&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Fixed background"),checked:u,onChange:()=>{t({hasParallax:!u,...u?{}:{focalPoint:void 0}})}}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Repeated background"),checked:p,onChange:()=>{t({isRepeated:!p})}})),E&&(0,Ke.createElement)(et.FocalPointPicker,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Focal point"),url:f,value:m,onDragStart:C,onDrag:C,onChange:e=>t({focalPoint:e})}),!s&&f&&!_&&(0,Ke.createElement)(et.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Alternative text"),value:h,onChange:e=>t({alt:e}),help:(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ExternalLink,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree"},(0,tt.__)("Describe the purpose of the image.")),(0,Ke.createElement)("br",null),(0,tt.__)("Leave empty if decorative."))}),(0,Ke.createElement)(et.PanelRow,null,(0,Ke.createElement)(et.Button,{variant:"secondary",size:"small",className:"block-library-cover__reset-button",onClick:i},(0,tt.__)("Clear Media"))))),S.hasColorsOrGradients&&(0,Ke.createElement)(nt.InspectorControls,{group:"color"},(0,Ke.createElement)(nt.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:k.color,gradientValue:x,label:(0,tt.__)("Overlay"),onColorChange:a,onGradientChange:w,isShownByDefault:!0,resetAllFilter:()=>({overlayColor:void 0,customOverlayColor:void 0,gradient:void 0,customGradient:void 0})}],panelId:n,...S}),(0,Ke.createElement)(et.__experimentalToolsPanelItem,{hasValue:()=>void 0!==c&&c!==(f?50:100),label:(0,tt.__)("Overlay opacity"),onDeselect:()=>l(f?50:100),resetAllFilter:()=>({dimRatio:f?50:100}),isShownByDefault:!0,panelId:n},(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Overlay opacity"),value:c,onChange:e=>l(e),min:0,max:100,step:10,required:!0,__next40pxDefaultSize:!0}))),(0,Ke.createElement)(nt.InspectorControls,{group:"dimensions"},(0,Ke.createElement)(et.__experimentalToolsPanelItem,{hasValue:()=>!!d,label:(0,tt.__)("Minimum height"),onDeselect:()=>t({minHeight:void 0,minHeightUnit:void 0}),resetAllFilter:()=>({minHeight:void 0,minHeightUnit:void 0}),isShownByDefault:!0,panelId:n},(0,Ke.createElement)(bl,{value:e?.style?.dimensions?.aspectRatio?"":d,unit:g,onChange:n=>t({minHeight:n,style:hl({...e?.style,dimensions:{...e?.style?.dimensions,aspectRatio:void 0}})}),onUnitChange:e=>t({minHeightUnit:e})}))),(0,Ke.createElement)(nt.InspectorControls,{group:"advanced"},(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("HTML element"),options:[{label:(0,tt.__)("Default (<div>)"),value:"div"},{label:"<header>",value:"header"},{label:"<main>",value:"main"},{label:"<section>",value:"section"},{label:"<article>",value:"article"},{label:"<aside>",value:"aside"},{label:"<footer>",value:"footer"}],value:b,onChange:e=>t({tagName:e}),help:B[b]})))}const{cleanEmptyObject:yl}=Ft(nt.privateApis);function vl({attributes:e,setAttributes:t,onSelectMedia:n,currentSettings:a,toggleUseFeaturedImage:o}){const{contentPosition:r,id:l,useFeaturedImage:i,minHeight:s,minHeightUnit:c}=e,{hasInnerBlocks:m,url:u}=a,[p,d]=(0,_t.useState)(s),[g,h]=(0,_t.useState)(c),b="vh"===c&&100===s&&!e?.style?.dimensions?.aspectRatio;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.__experimentalBlockAlignmentMatrixControl,{label:(0,tt.__)("Change content position"),value:r,onChange:e=>t({contentPosition:e}),isDisabled:!m}),(0,Ke.createElement)(nt.__experimentalBlockFullHeightAligmentControl,{isActive:b,onToggle:()=>b?t("vh"===g&&100===p?{minHeight:void 0,minHeightUnit:void 0}:{minHeight:p,minHeightUnit:g}):(d(s),h(c),t({minHeight:100,minHeightUnit:"vh",style:yl({...e?.style,dimensions:{...e?.style?.dimensions,aspectRatio:void 0}})})),isDisabled:!m})),(0,Ke.createElement)(nt.BlockControls,{group:"other"},(0,Ke.createElement)(nt.MediaReplaceFlow,{mediaId:l,mediaURL:u,allowedTypes:$r,accept:"image/*,video/*",onSelect:n,onToggleFeaturedImage:o,useFeaturedImage:i,name:u?(0,tt.__)("Replace"):(0,tt.__)("Add Media")})))}function fl({disableMediaButtons:e=!1,children:t,onSelectMedia:n,onError:a,style:o,toggleUseFeaturedImage:r}){return(0,Ke.createElement)(nt.MediaPlaceholder,{icon:(0,Ke.createElement)(nt.BlockIcon,{icon:Ar}),labels:{title:(0,tt.__)("Cover"),instructions:(0,tt.__)("Drag and drop onto this block, upload, or select existing media from your library.")},onSelect:n,accept:"image/*,video/*",allowedTypes:$r,disableMediaButtons:e,onToggleFeaturedImage:r,onError:a,style:o},t)}const kl={top:!1,right:!1,bottom:!0,left:!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},{ResizableBoxPopover:xl}=Ft(nt.privateApis);function wl({className:e,height:t,minHeight:n,onResize:a,onResizeStart:o,onResizeStop:r,showHandle:l,size:i,width:s,...c}){const[m,u]=(0,_t.useState)(!1),p=(0,_t.useMemo)((()=>({height:t,minHeight:n,width:s})),[n,t,s]),d={className:ut()(e,{"is-resizing":m}),enable:kl,onResizeStart:(e,t,n)=>{o(n.clientHeight),a(n.clientHeight)},onResize:(e,t,n)=>{a(n.clientHeight),m||u(!0)},onResizeStop:(e,t,n)=>{r(n.clientHeight),u(!1)},showHandle:l,size:i,__experimentalShowTooltip:!0,__experimentalTooltipProps:{axis:"y",position:"bottom",isVisible:m}};return(0,Ke.createElement)(xl,{className:"block-library-cover__resizable-box-popover",__unstableRefreshSize:p,resizableBoxProps:d,...c})}var El={grad:.9,turn:360,rad:360/(2*Math.PI)},Cl=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},Sl=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},Bl=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},Nl=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Tl=function(e){return{r:Bl(e.r,0,255),g:Bl(e.g,0,255),b:Bl(e.b,0,255),a:Bl(e.a)}},Il=function(e){return{r:Sl(e.r),g:Sl(e.g),b:Sl(e.b),a:Sl(e.a,3)}},Pl=/^#([0-9a-f]{3,8})$/i,Ml=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},zl=function(e){var t=e.r,n=e.g,a=e.b,o=e.a,r=Math.max(t,n,a),l=r-Math.min(t,n,a),i=l?r===t?(n-a)/l:r===n?2+(a-t)/l:4+(t-n)/l:0;return{h:60*(i<0?i+6:i),s:r?l/r*100:0,v:r/255*100,a:o}},Rl=function(e){var t=e.h,n=e.s,a=e.v,o=e.a;t=t/360*6,n/=100,a/=100;var r=Math.floor(t),l=a*(1-n),i=a*(1-(t-r)*n),s=a*(1-(1-t+r)*n),c=r%6;return{r:255*[a,i,l,l,s,a][c],g:255*[s,a,a,i,l,l][c],b:255*[l,l,s,a,a,i][c],a:o}},Al=function(e){return{h:Nl(e.h),s:Bl(e.s,0,100),l:Bl(e.l,0,100),a:Bl(e.a)}},Hl=function(e){return{h:Sl(e.h),s:Sl(e.s),l:Sl(e.l),a:Sl(e.a,3)}},Ll=function(e){return Rl((n=(t=e).s,{h:t.h,s:(n*=((a=t.l)<50?a:100-a)/100)>0?2*n/(a+n)*100:0,v:a+n,a:t.a}));var t,n,a},Dl=function(e){return{h:(t=zl(e)).h,s:(o=(200-(n=t.s))*(a=t.v)/100)>0&&o<200?n*a/100/(o<=100?o:200-o)*100:0,l:o/2,a:t.a};var t,n,a,o},Fl=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Vl=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$l=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ol=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Gl={string:[[function(e){var t=Pl.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?Sl(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?Sl(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=$l.exec(e)||Ol.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Tl({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(e){var t=Fl.exec(e)||Vl.exec(e);if(!t)return null;var n,a,o=Al({h:(n=t[1],a=t[2],void 0===a&&(a="deg"),Number(n)*(El[a]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return Ll(o)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,a=e.b,o=e.a,r=void 0===o?1:o;return Cl(t)&&Cl(n)&&Cl(a)?Tl({r:Number(t),g:Number(n),b:Number(a),a:Number(r)}):null},"rgb"],[function(e){var t=e.h,n=e.s,a=e.l,o=e.a,r=void 0===o?1:o;if(!Cl(t)||!Cl(n)||!Cl(a))return null;var l=Al({h:Number(t),s:Number(n),l:Number(a),a:Number(r)});return Ll(l)},"hsl"],[function(e){var t=e.h,n=e.s,a=e.v,o=e.a,r=void 0===o?1:o;if(!Cl(t)||!Cl(n)||!Cl(a))return null;var l=function(e){return{h:Nl(e.h),s:Bl(e.s,0,100),v:Bl(e.v,0,100),a:Bl(e.a)}}({h:Number(t),s:Number(n),v:Number(a),a:Number(r)});return Rl(l)},"hsv"]]},Ul=function(e,t){for(var n=0;n<t.length;n++){var a=t[n][0](e);if(a)return[a,t[n][1]]}return[null,void 0]},ql=function(e){return"string"==typeof e?Ul(e.trim(),Gl.string):"object"==typeof e&&null!==e?Ul(e,Gl.object):[null,void 0]},jl=function(e,t){var n=Dl(e);return{h:n.h,s:Bl(n.s+100*t,0,100),l:n.l,a:n.a}},Wl=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Zl=function(e,t){var n=Dl(e);return{h:n.h,s:n.s,l:Bl(n.l+100*t,0,100),a:n.a}},Ql=function(){function e(e){this.parsed=ql(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return null!==this.parsed},e.prototype.brightness=function(){return Sl(Wl(this.rgba),2)},e.prototype.isDark=function(){return Wl(this.rgba)<.5},e.prototype.isLight=function(){return Wl(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=Il(this.rgba)).r,n=e.g,a=e.b,r=(o=e.a)<1?Ml(Sl(255*o)):"","#"+Ml(t)+Ml(n)+Ml(a)+r;var e,t,n,a,o,r},e.prototype.toRgb=function(){return Il(this.rgba)},e.prototype.toRgbString=function(){return t=(e=Il(this.rgba)).r,n=e.g,a=e.b,(o=e.a)<1?"rgba("+t+", "+n+", "+a+", "+o+")":"rgb("+t+", "+n+", "+a+")";var e,t,n,a,o},e.prototype.toHsl=function(){return Hl(Dl(this.rgba))},e.prototype.toHslString=function(){return t=(e=Hl(Dl(this.rgba))).h,n=e.s,a=e.l,(o=e.a)<1?"hsla("+t+", "+n+"%, "+a+"%, "+o+")":"hsl("+t+", "+n+"%, "+a+"%)";var e,t,n,a,o},e.prototype.toHsv=function(){return e=zl(this.rgba),{h:Sl(e.h),s:Sl(e.s),v:Sl(e.v),a:Sl(e.a,3)};var e},e.prototype.invert=function(){return Kl({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),Kl(jl(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Kl(jl(this.rgba,-e))},e.prototype.grayscale=function(){return Kl(jl(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Kl(Zl(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Kl(Zl(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?Kl({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Sl(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=Dl(this.rgba);return"number"==typeof e?Kl({h:e,s:t.s,l:t.l,a:t.a}):Sl(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Kl(e).toHex()},e}(),Kl=function(e){return e instanceof Ql?e:new Ql(e)},Yl=[];
/*! Fast Average Color | © 2022 Denis Seleznev | MIT License | https://github.com/fast-average-color/fast-average-color */
function Jl(e){var t=e.toString(16);return 1===t.length?"0"+t:t}function Xl(e){return"#"+e.map(Jl).join("")}function ei(e){return e?(t=e,Array.isArray(t[0])?e:[e]):[];var t}function ti(e,t,n){for(var a=0;a<n.length;a++)if(ni(e,t,n[a]))return!0;return!1}function ni(e,t,n){switch(n.length){case 3:if(function(e,t,n){if(255!==e[t+3])return!0;if(e[t]===n[0]&&e[t+1]===n[1]&&e[t+2]===n[2])return!0;return!1}(e,t,n))return!0;break;case 4:if(function(e,t,n){if(e[t+3]&&n[3])return e[t]===n[0]&&e[t+1]===n[1]&&e[t+2]===n[2]&&e[t+3]===n[3];return e[t+3]===n[3]}(e,t,n))return!0;break;case 5:if(function(e,t,n){var a=n[0],o=n[1],r=n[2],l=n[3],i=n[4],s=e[t+3],c=ai(s,l,i);if(!l)return c;if(!s&&c)return!0;if(ai(e[t],a,i)&&ai(e[t+1],o,i)&&ai(e[t+2],r,i)&&c)return!0;return!1}(e,t,n))return!0;break;default:return!1}}function ai(e,t,n){return e>=t-n&&e<=t+n}function oi(e,t,n){for(var a={},o=n.ignoredColor,r=n.step,l=[0,0,0,0,0],i=0;i<t;i+=r){var s=e[i],c=e[i+1],m=e[i+2],u=e[i+3];if(!o||!ti(e,i,o)){var p=Math.round(s/24)+","+Math.round(c/24)+","+Math.round(m/24);a[p]?a[p]=[a[p][0]+s*u,a[p][1]+c*u,a[p][2]+m*u,a[p][3]+u,a[p][4]+1]:a[p]=[s*u,c*u,m*u,u,1],l[4]<a[p][4]&&(l=a[p])}}var d=l[0],g=l[1],h=l[2],b=l[3],_=l[4];return b?[Math.round(d/b),Math.round(g/b),Math.round(h/b),Math.round(b/_)]:n.defaultColor}function ri(e,t,n){for(var a=0,o=0,r=0,l=0,i=0,s=n.ignoredColor,c=n.step,m=0;m<t;m+=c){var u=e[m+3],p=e[m]*u,d=e[m+1]*u,g=e[m+2]*u;s&&ti(e,m,s)||(a+=p,o+=d,r+=g,l+=u,i++)}return l?[Math.round(a/l),Math.round(o/l),Math.round(r/l),Math.round(l/i)]:n.defaultColor}function li(e,t,n){for(var a=0,o=0,r=0,l=0,i=0,s=n.ignoredColor,c=n.step,m=0;m<t;m+=c){var u=e[m],p=e[m+1],d=e[m+2],g=e[m+3];s&&ti(e,m,s)||(a+=u*u*g,o+=p*p*g,r+=d*d*g,l+=g,i++)}return l?[Math.round(Math.sqrt(a/l)),Math.round(Math.sqrt(o/l)),Math.round(Math.sqrt(r/l)),Math.round(l/i)]:n.defaultColor}function ii(e){return si(e,"defaultColor",[0,0,0,0])}function si(e,t,n){return void 0===e[t]?n:e[t]}function ci(e){if(ui(e)){var t=e.naturalWidth,n=e.naturalHeight;return e.naturalWidth||-1===e.src.search(/\.svg(\?|$)/i)||(t=n=100),{width:t,height:n}}return function(e){return"undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement}(e)?{width:e.videoWidth,height:e.videoHeight}:{width:e.width,height:e.height}}function mi(e){return function(e){return"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement}(e)?"canvas":function(e){return pi&&e instanceof OffscreenCanvas}(e)?"offscreencanvas":function(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap}(e)?"imagebitmap":e.src}function ui(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement}var pi="undefined"!=typeof OffscreenCanvas;var di="undefined"==typeof window;function gi(e){return Error("FastAverageColor: "+e)}function hi(e,t){t||console.error(e)}var bi=function(){function e(){this.canvas=null,this.ctx=null}return e.prototype.getColorAsync=function(e,t){if(!e)return Promise.reject(gi("call .getColorAsync() without resource."));if("string"==typeof e){if("undefined"==typeof Image)return Promise.reject(gi("resource as string is not supported in this environment"));var n=new Image;return n.crossOrigin=t&&t.crossOrigin||"",n.src=e,this.bindImageEvents(n,t)}if(ui(e)&&!e.complete)return this.bindImageEvents(e,t);var a=this.getColor(e,t);return a.error?Promise.reject(a.error):Promise.resolve(a)},e.prototype.getColor=function(e,t){var n=ii(t=t||{});if(!e)return hi(r=gi("call .getColor(null) without resource"),t.silent),this.prepareResult(n,r);var a=function(e,t){var n,a=si(t,"left",0),o=si(t,"top",0),r=si(t,"width",e.width),l=si(t,"height",e.height),i=r,s=l;return"precision"===t.mode||(r>l?(n=r/l,i=100,s=Math.round(i/n)):(n=l/r,s=100,i=Math.round(s/n)),(i>r||s>l||i<10||s<10)&&(i=r,s=l)),{srcLeft:a,srcTop:o,srcWidth:r,srcHeight:l,destWidth:i,destHeight:s}}(ci(e),t);if(!(a.srcWidth&&a.srcHeight&&a.destWidth&&a.destHeight))return hi(r=gi('incorrect sizes for resource "'.concat(mi(e),'"')),t.silent),this.prepareResult(n,r);if(!this.canvas&&(this.canvas=di?pi?new OffscreenCanvas(1,1):null:document.createElement("canvas"),!this.canvas))return hi(r=gi("OffscreenCanvas is not supported in this browser"),t.silent),this.prepareResult(n,r);if(!this.ctx){if(this.ctx=this.canvas.getContext("2d",{willReadFrequently:!0}),!this.ctx)return hi(r=gi("Canvas Context 2D is not supported in this browser"),t.silent),this.prepareResult(n);this.ctx.imageSmoothingEnabled=!1}this.canvas.width=a.destWidth,this.canvas.height=a.destHeight;try{this.ctx.clearRect(0,0,a.destWidth,a.destHeight),this.ctx.drawImage(e,a.srcLeft,a.srcTop,a.srcWidth,a.srcHeight,0,0,a.destWidth,a.destHeight);var o=this.ctx.getImageData(0,0,a.destWidth,a.destHeight).data;return this.prepareResult(this.getColorFromArray4(o,t))}catch(a){var r;return hi(r=gi("security error (CORS) for resource ".concat(mi(e),".\nDetails: https://developer.mozilla.org/en/docs/Web/HTML/CORS_enabled_image")),t.silent),!t.silent&&console.error(a),this.prepareResult(n,r)}},e.prototype.getColorFromArray4=function(e,t){t=t||{};var n=e.length,a=ii(t);if(n<4)return a;var o,r=n-n%4,l=4*(t.step||1);switch(t.algorithm||"sqrt"){case"simple":o=ri;break;case"sqrt":o=li;break;case"dominant":o=oi;break;default:throw gi("".concat(t.algorithm," is unknown algorithm"))}return o(e,r,{defaultColor:a,ignoredColor:ei(t.ignoredColor),step:l})},e.prototype.prepareResult=function(e,t){var n,a=e.slice(0,3),o=[e[0],e[1],e[2],e[3]/255],r=(299*(n=e)[0]+587*n[1]+114*n[2])/1e3<128;return{value:[e[0],e[1],e[2],e[3]],rgb:"rgb("+a.join(",")+")",rgba:"rgba("+o.join(",")+")",hex:Xl(a),hexa:Xl(e),isDark:r,isLight:!r,error:t}},e.prototype.destroy=function(){this.canvas&&(this.canvas.width=1,this.canvas.height=1,this.canvas=null),this.ctx=null},e.prototype.bindImageEvents=function(e,t){var n=this;return new Promise((function(a,o){var r=function(){s();var r=n.getColor(e,t);r.error?o(r.error):a(r)},l=function(){s(),o(gi('Error loading image "'.concat(e.src,'".')))},i=function(){s(),o(gi('Image "'.concat(e.src,'" loading aborted')))},s=function(){e.removeEventListener("load",r),e.removeEventListener("error",l),e.removeEventListener("abort",i)};e.addEventListener("load",r),e.addEventListener("error",l),e.addEventListener("abort",i)}))},e}();const _i=window.wp.hooks;!function(e){e.forEach((function(e){Yl.indexOf(e)<0&&(e(Ql,Gl),Yl.push(e))}))}([function(e,t){var n={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"},a={};for(var o in n)a[n[o]]=o;var r={};e.prototype.toName=function(t){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,l,i=a[this.toHex()];if(i)return i;if(null==t?void 0:t.closest){var s=this.toRgb(),c=1/0,m="black";if(!r.length)for(var u in n)r[u]=new e(n[u]).toRgb();for(var p in n){var d=(o=s,l=r[p],Math.pow(o.r-l.r,2)+Math.pow(o.g-l.g,2)+Math.pow(o.b-l.b,2));d<c&&(c=d,m=p)}return m}},t.string.push([function(t){var a=t.toLowerCase(),o="transparent"===a?"#0000":n[a];return o?new e(o).toRgb():null},"name"])}]);const yi="#FFF";function vi(){return vi.fastAverageColor||(vi.fastAverageColor=new bi),vi.fastAverageColor}const fi=Rt((async e=>{if(!e)return yi;const{r:t,g:n,b:a,a:o}=Kl(yi).toRgb();try{const r=(0,_i.applyFilters)("media.crossOrigin",void 0,e);return(await vi().getColorAsync(e,{defaultColor:[t,n,a,255*o],silent:!0,crossOrigin:r})).hex}catch(e){return yi}}));function ki(e,t,n){if(t===n||100===e)return Kl(t).isDark();const a=Kl(t).alpha(e/100).toRgb(),o=Kl(n).toRgb(),r=(i=o,{r:(l=a).r*l.a+i.r*i.a*(1-l.a),g:l.g*l.a+i.g*i.a*(1-l.a),b:l.b*l.a+i.b*i.a*(1-l.a),a:l.a+i.a*(1-l.a)});var l,i;return Kl(r).isDark()}const xi=(0,jt.compose)([(0,nt.withColors)({overlayColor:"background-color"})])((function({attributes:e,clientId:t,isSelected:n,overlayColor:a,setAttributes:o,setOverlayColor:r,toggleSelection:l,context:{postId:i,postType:s}}){const{contentPosition:c,id:m,url:u,backgroundType:p,useFeaturedImage:d,dimRatio:g,focalPoint:h,hasParallax:b,isDark:_,isRepeated:y,minHeight:v,minHeightUnit:f,alt:k,allowedBlocks:x,templateLock:w,tagName:E="div",isUserOverlayColor:C}=e,[S]=(0,dt.useEntityProp)("postType",s,"featured_media",i),{__unstableMarkNextChangeAsNotPersistent:B}=(0,gt.useDispatch)(nt.store),N=(0,gt.useSelect)((e=>S&&e(dt.store).getMedia(S,{context:"view"})),[S]),T=N?.source_url;(0,_t.useEffect)((()=>{(async()=>{if(!d)return;const e=await fi(T);let t=a.color;C||(t=e,B(),r(t));const n=ki(g,t,e);B(),o({isDark:n})})()}),[T]);const I=d?T:u?.replaceAll("&","&"),P=d?Lr:p,{createErrorNotice:M}=(0,gt.useDispatch)(Pt.store),{gradientClass:z,gradientValue:R}=(0,nt.__experimentalUseGradient)(),A=async e=>{const t=function(e){if(!e||!e.url)return{url:void 0,id:void 0};let t;if((0,It.isBlobURL)(e.url)&&(e.type=(0,It.getBlobTypeByURL)(e.url)),e.media_type)t=e.media_type===Lr?Lr:Dr;else{if(e.type!==Lr&&e.type!==Dr)return;t=e.type}return{url:e.url,id:e.id,alt:e?.alt,backgroundType:t,...t===Dr?{hasParallax:void 0}:{}}}(e),n=[e?.type,e?.media_type].includes(Lr),l=await fi(n?e?.url:void 0);let i=a.color;C||(i=l,r(i),B());const s=void 0===u&&100===g?50:g,c=ki(s,i,l);o({...t,focalPoint:void 0,useFeaturedImage:void 0,dimRatio:s,isDark:c})},H=async e=>{const t=await fi(I),n=ki(g,e,t);r(e),B(),o({isUserOverlayColor:!0,isDark:n})},L=e=>{M(e,{type:"snackbar"})},D=((e,t)=>!e&&(0,It.isBlobURL)(t))(m,I),F=Lr===P,V=Dr===P,[$,{height:O,width:G}]=(0,jt.useResizeObserver)(),U=(0,_t.useMemo)((()=>({height:"px"===f?v:"auto",width:"auto"})),[v,f]),q=v&&f?`${v}${f}`:v,j=!(b||y),W={minHeight:q||void 0},Z=I?`url(${I})`:void 0,Q=Or(h),K={backgroundColor:a.color},Y={objectPosition:h&&j?Or(h):void 0},J=!!(I||a.color||R),X=(0,gt.useSelect)((e=>e(nt.store).getBlock(t).innerBlocks.length>0),[t]),ee=(0,_t.useRef)(),te=(0,nt.useBlockProps)({ref:ee}),[ne]=(0,nt.useSettings)("typography.fontSizes"),ae=function(e){return[["core/paragraph",{align:"center",placeholder:(0,tt.__)("Write title…"),...e}]]}({fontSize:ne?.length>0?"large":void 0}),oe=(0,nt.useInnerBlocksProps)({className:"wp-block-cover__inner-container"},{template:X?void 0:ae,templateInsertUpdatesSelection:!0,allowedBlocks:x,templateLock:w,dropZoneElement:ee.current}),re=(0,_t.useRef)(),le={isVideoBackground:V,isImageBackground:F,mediaElement:re,hasInnerBlocks:X,url:I,isImgElement:j,overlayColor:a},ie=async()=>{const e=!d,t=e?await fi(T):yi,n=C?a.color:t;C||(r(e?n:void 0),B());const l=100===g?50:g,i=ki(l,n,t);o({id:void 0,url:void 0,useFeaturedImage:e,dimRatio:l,backgroundType:d?Lr:void 0,isDark:i})},se=(0,Ke.createElement)(vl,{attributes:e,setAttributes:o,onSelectMedia:A,currentSettings:le,toggleUseFeaturedImage:ie}),ce=(0,Ke.createElement)(_l,{attributes:e,setAttributes:o,clientId:t,setOverlayColor:H,coverRef:ee,currentSettings:le,toggleUseFeaturedImage:ie,updateDimRatio:async e=>{const t=await fi(I),n=ki(e,a.color,t);o({dimRatio:e,isDark:n})},onClearMedia:()=>{let e=a.color;C||(e="#000",r(void 0),B());const t=ki(g,e,yi);o({url:void 0,id:void 0,backgroundType:void 0,focalPoint:void 0,hasParallax:void 0,isRepeated:void 0,useFeaturedImage:void 0,isDark:t})}}),me={className:"block-library-cover__resize-container",clientId:t,height:O,minHeight:q,onResizeStart:()=>{o({minHeightUnit:"px"}),l(!1)},onResize:e=>{o({minHeight:e})},onResizeStop:e=>{l(!0),o({minHeight:e})},showHandle:!e.style?.dimensions?.aspectRatio,size:U,width:G};if(!d&&!X&&!J)return(0,Ke.createElement)(Ke.Fragment,null,se,ce,n&&(0,Ke.createElement)(wl,{...me}),(0,Ke.createElement)(E,{...te,className:ut()("is-placeholder",te.className),style:{...te.style,minHeight:q||void 0}},$,(0,Ke.createElement)(fl,{onSelectMedia:A,onError:L,toggleUseFeaturedImage:ie},(0,Ke.createElement)("div",{className:"wp-block-cover__placeholder-background-options"},(0,Ke.createElement)(nt.ColorPalette,{disableCustomColors:!0,value:a.color,onChange:H,clearable:!1})))));const ue=ut()({"is-dark-theme":_,"is-light":!_,"is-transient":D,"has-parallax":b,"is-repeated":y,"has-custom-content-position":!Ur(c)},qr(c));return(0,Ke.createElement)(Ke.Fragment,null,se,ce,(0,Ke.createElement)(E,{...te,className:ut()(ue,te.className),style:{...W,...te.style},"data-url":I},$,(!d||I)&&(0,Ke.createElement)("span",{"aria-hidden":"true",className:ut()("wp-block-cover__background",Gr(g),{[a.class]:a.class,"has-background-dim":void 0!==g,"wp-block-cover__gradient-background":I&&R&&0!==g,"has-background-gradient":R,[z]:z}),style:{backgroundImage:R,...K}}),!I&&d&&(0,Ke.createElement)(et.Placeholder,{className:"wp-block-cover__image--placeholder-image",withIllustration:!0}),I&&F&&(j?(0,Ke.createElement)("img",{ref:re,className:"wp-block-cover__image-background",alt:k,src:I,style:Y}):(0,Ke.createElement)("div",{ref:re,role:k?"img":void 0,"aria-label":k||void 0,className:ut()(ue,"wp-block-cover__image-background"),style:{backgroundImage:Z,backgroundPosition:Q}})),I&&V&&(0,Ke.createElement)("video",{ref:re,className:"wp-block-cover__video-background",autoPlay:!0,muted:!0,loop:!0,src:I,style:Y}),D&&(0,Ke.createElement)(et.Spinner,null),(0,Ke.createElement)(fl,{disableMediaButtons:!0,onSelectMedia:A,onError:L,toggleUseFeaturedImage:ie}),(0,Ke.createElement)("div",{...oe})),n&&(0,Ke.createElement)(wl,{...me}))}));const{cleanEmptyObject:wi}=Ft(nt.privateApis),Ei={from:[{type:"block",blocks:["core/image"],transform:({caption:e,url:t,alt:n,align:a,id:o,anchor:r,style:l})=>(0,Qe.createBlock)("core/cover",{dimRatio:50,url:t,alt:n,align:a,id:o,anchor:r,style:{color:{duotone:l?.color?.duotone}}},[(0,Qe.createBlock)("core/paragraph",{content:e,fontSize:"large",align:"center"})])},{type:"block",blocks:["core/video"],transform:({caption:e,src:t,align:n,id:a,anchor:o})=>(0,Qe.createBlock)("core/cover",{dimRatio:50,url:t,align:n,id:a,backgroundType:Dr,anchor:o},[(0,Qe.createBlock)("core/paragraph",{content:e,fontSize:"large",align:"center"})])},{type:"block",blocks:["core/group"],transform:(e,t)=>{const{align:n,anchor:a,backgroundColor:o,gradient:r,style:l}=e;if(1===t?.length&&"core/cover"===t[0]?.name)return(0,Qe.createBlock)("core/cover",t[0].attributes,t[0].innerBlocks);const i={align:n,anchor:a,dimRatio:o||r||l?.color?.background||l?.color?.gradient?void 0:50,overlayColor:o,customOverlayColor:l?.color?.background,gradient:r,customGradient:l?.color?.gradient},s={...e,backgroundColor:void 0,gradient:void 0,style:wi({...e?.style,color:l?.color?{...l?.color,background:void 0,gradient:void 0}:void 0})};return(0,Qe.createBlock)("core/cover",i,[(0,Qe.createBlock)("core/group",s,t)])}}],to:[{type:"block",blocks:["core/image"],isMatch:({backgroundType:e,url:t,overlayColor:n,customOverlayColor:a,gradient:o,customGradient:r})=>t?e===Lr:!(n||a||o||r),transform:({title:e,url:t,alt:n,align:a,id:o,anchor:r,style:l})=>(0,Qe.createBlock)("core/image",{caption:e,url:t,alt:n,align:a,id:o,anchor:r,style:{color:{duotone:l?.color?.duotone}}})},{type:"block",blocks:["core/video"],isMatch:({backgroundType:e,url:t,overlayColor:n,customOverlayColor:a,gradient:o,customGradient:r})=>t?e===Dr:!(n||a||o||r),transform:({title:e,url:t,align:n,id:a,anchor:o})=>(0,Qe.createBlock)("core/video",{caption:e,src:t,id:a,align:n,anchor:o})},{type:"block",blocks:["core/group"],isMatch:({url:e,useFeaturedImage:t})=>!e&&!t,transform:(e,t)=>{const n={backgroundColor:e?.overlayColor,gradient:e?.gradient,style:wi({...e?.style,color:e?.customOverlayColor||e?.customGradient||e?.style?.color?{background:e?.customOverlayColor,gradient:e?.customGradient,...e?.style?.color}:void 0})};if(1===t?.length&&"core/group"===t[0]?.name){const e=wi(t[0].attributes||{});return e?.backgroundColor||e?.gradient||e?.style?.color?.background||e?.style?.color?.gradient?(0,Qe.createBlock)("core/group",e,t[0]?.innerBlocks):(0,Qe.createBlock)("core/group",{...n,...e,style:wi({...e?.style,color:n?.style?.color||e?.style?.color?{...n?.style?.color,...e?.style?.color}:void 0})},t[0]?.innerBlocks)}return(0,Qe.createBlock)("core/group",{...e,...n},t)}}]},Ci=Ei,Si=[{name:"cover",title:(0,tt.__)("Cover"),description:(0,tt.__)("Add an image or video with a text overlay."),attributes:{layout:{type:"constrained"}},isDefault:!0,icon:Ar}],Bi={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/cover",title:"Cover",category:"media",description:"Add an image or video with a text overlay.",textdomain:"default",attributes:{url:{type:"string"},useFeaturedImage:{type:"boolean",default:!1},id:{type:"number"},alt:{type:"string",default:""},hasParallax:{type:"boolean",default:!1},isRepeated:{type:"boolean",default:!1},dimRatio:{type:"number",default:100},overlayColor:{type:"string"},customOverlayColor:{type:"string"},isUserOverlayColor:{type:"boolean"},backgroundType:{type:"string",default:"image"},focalPoint:{type:"object"},minHeight:{type:"number"},minHeightUnit:{type:"string"},gradient:{type:"string"},customGradient:{type:"string"},contentPosition:{type:"string"},isDark:{type:"boolean",default:!0},allowedBlocks:{type:"array"},templateLock:{type:["string","boolean"],enum:["all","insert","contentOnly",!1]},tagName:{type:"string",default:"div"}},usesContext:["postId","postType"],supports:{anchor:!0,align:!0,html:!1,spacing:{padding:!0,margin:["top","bottom"],blockGap:!0,__experimentalDefaultControls:{padding:!0,blockGap:!0}},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,radius:!0,style:!0,width:!0}},color:{__experimentalDuotone:"> .wp-block-cover__image-background, > .wp-block-cover__video-background",heading:!0,text:!0,background:!1,__experimentalSkipSerialization:["gradients"],enableContrastChecker:!1},dimensions:{aspectRatio:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},layout:{allowJustification:!1},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-cover-editor",style:"wp-block-cover"},{name:Ni}=Bi,Ti={icon:Ar,example:{attributes:{customOverlayColor:"#065174",dimRatio:40,url:"https://s.w.org/images/core/5.3/Windbuchencom.jpg"},innerBlocks:[{name:"core/paragraph",attributes:{content:(0,tt.__)("<strong>Snow Patrol</strong>"),align:"center",style:{typography:{fontSize:48},color:{text:"white"}}}}]},transforms:Ci,save:function({attributes:e}){const{backgroundType:t,gradient:n,contentPosition:a,customGradient:o,customOverlayColor:r,dimRatio:l,focalPoint:i,useFeaturedImage:s,hasParallax:c,isDark:m,isRepeated:u,overlayColor:p,url:d,alt:g,id:h,minHeight:b,minHeightUnit:_,tagName:y}=e,v=(0,nt.getColorClassName)("background-color",p),f=(0,nt.__experimentalGetGradientClass)(n),k=Lr===t,x=Dr===t,w=!(c||u),E={minHeight:(b&&_?`${b}${_}`:b)||void 0},C={backgroundColor:v?void 0:r,background:o||void 0},S=i&&w?Or(i):void 0,B=d?`url(${d})`:void 0,N=Or(i),T=ut()({"is-light":!m,"has-parallax":c,"is-repeated":u,"has-custom-content-position":!Ur(a)},qr(a)),I=ut()("wp-block-cover__image-background",h?`wp-image-${h}`:null,{"has-parallax":c,"is-repeated":u}),P=n||o;return(0,Ke.createElement)(y,{...nt.useBlockProps.save({className:T,style:E})},(0,Ke.createElement)("span",{"aria-hidden":"true",className:ut()("wp-block-cover__background",v,Gr(l),{"has-background-dim":void 0!==l,"wp-block-cover__gradient-background":d&&P&&0!==l,"has-background-gradient":P,[f]:f}),style:C}),!s&&k&&d&&(w?(0,Ke.createElement)("img",{className:I,alt:g,src:d,style:{objectPosition:S},"data-object-fit":"cover","data-object-position":S}):(0,Ke.createElement)("div",{role:g?"img":void 0,"aria-label":g||void 0,className:I,style:{backgroundPosition:N,backgroundImage:B}})),x&&d&&(0,Ke.createElement)("video",{className:ut()("wp-block-cover__video-background","intrinsic-ignore"),autoPlay:!0,muted:!0,loop:!0,playsInline:!0,src:d,style:{objectPosition:S},"data-object-fit":"cover","data-object-position":S}),(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-cover__inner-container"})}))},edit:xi,deprecated:gl,variations:Si},Ii=()=>Xe({name:Ni,metadata:Bi,settings:Ti}),Pi=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M4 16h10v1.5H4V16Zm0-4.5h16V13H4v-1.5ZM10 7h10v1.5H10V7Z",fillRule:"evenodd",clipRule:"evenodd"}),(0,Ke.createElement)(Ye.Path,{d:"m4 5.25 4 2.5-4 2.5v-5Z"})),Mi=[["core/paragraph",{placeholder:(0,tt.__)("Type / to add a hidden block")}]];const zi=function({attributes:e,setAttributes:t,clientId:n}){const{showContent:a,summary:o}=e,r=(0,nt.useBlockProps)(),l=(0,nt.useInnerBlocksProps)(r,{template:Mi,__experimentalCaptureToolbars:!0}),i=(0,gt.useSelect)((e=>{const{isBlockSelected:t,hasSelectedInnerBlock:a}=e(nt.store);return a(n,!0)||t(n)}),[n]);return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{label:(0,tt.__)("Open by default"),checked:a,onChange:()=>t({showContent:!a})}))),(0,Ke.createElement)("details",{...l,open:i||a},(0,Ke.createElement)("summary",{onClick:e=>e.preventDefault()},(0,Ke.createElement)(nt.RichText,{"aria-label":(0,tt.__)("Write summary"),placeholder:(0,tt.__)("Write summary…"),allowedFormats:[],withoutInteractiveFormatting:!0,value:o,onChange:e=>t({summary:e})})),l.children))};const Ri={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/details",title:"Details",category:"text",description:"Hide and show additional content.",keywords:["accordion","summary","toggle","disclosure"],textdomain:"default",attributes:{showContent:{type:"boolean",default:!1},summary:{type:"rich-text",source:"rich-text",selector:"summary"}},supports:{align:["wide","full"],color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},__experimentalBorder:{color:!0,width:!0,style:!0},html:!1,spacing:{margin:!0,padding:!0,blockGap:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},layout:{allowEditing:!1},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-details-editor",style:"wp-block-details"},{name:Ai}=Ri,Hi={icon:Pi,example:{attributes:{summary:"La Mancha",showContent:!0},innerBlocks:[{name:"core/paragraph",attributes:{content:(0,tt.__)("In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.")}}]},save:function({attributes:e}){const{showContent:t}=e,n=e.summary?e.summary:"Details",a=nt.useBlockProps.save();return(0,Ke.createElement)("details",{...a,open:t},(0,Ke.createElement)("summary",null,(0,Ke.createElement)(nt.RichText.Content,{value:n})),(0,Ke.createElement)(nt.InnerBlocks.Content,null))},edit:zi},Li=()=>Xe({name:Ai,metadata:Ri,settings:Hi}),Di=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"}));function Fi(e){return e?(0,tt.__)("This embed will preserve its aspect ratio when the browser is resized."):(0,tt.__)("This embed may not preserve its aspect ratio when the browser is resized.")}const Vi=({blockSupportsResponsive:e,showEditButton:t,themeSupportsResponsive:n,allowResponsive:a,toggleResponsive:o,switchBackToURLInput:r})=>(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,null,t&&(0,Ke.createElement)(et.ToolbarButton,{className:"components-toolbar__control",label:(0,tt.__)("Edit URL"),icon:Di,onClick:r}))),n&&e&&(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Media settings"),className:"blocks-responsive"},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Resize for smaller devices"),checked:a,help:Fi,onChange:o})))),$i=(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(et.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.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zm-6-9.5L16 12l-2.5 2.8 1.1 1L18 12l-3.5-3.5-1 1zm-3 0l-1-1L6 12l3.5 3.8 1.1-1L8 12l2.5-2.5z"})),Oi=(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(et.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.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zM13.2 7.7c-.4.4-.7 1.1-.7 1.9v3.7c-.4-.3-.8-.4-1.3-.4-1.2 0-2.2 1-2.2 2.2 0 1.2 1 2.2 2.2 2.2.5 0 1-.2 1.4-.5.9-.6 1.4-1.6 1.4-2.6V9.6c0-.4.1-.6.2-.8.3-.3 1-.3 1.6-.3h.2V7h-.2c-.7 0-1.8 0-2.6.7z"})),Gi=(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(et.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-2zM9.2 4.5H19c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V9.8l4.6-5.3zm9.8 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),Ui=(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(et.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.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zM10 15l5-3-5-3v6z"})),qi={foreground:"#1da1f2",src:(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(et.G,null,(0,Ke.createElement)(et.Path,{d:"M22.23 5.924c-.736.326-1.527.547-2.357.646.847-.508 1.498-1.312 1.804-2.27-.793.47-1.67.812-2.606.996C18.325 4.498 17.258 4 16.078 4c-2.266 0-4.103 1.837-4.103 4.103 0 .322.036.635.106.935-3.41-.17-6.433-1.804-8.457-4.287-.353.607-.556 1.312-.556 2.064 0 1.424.724 2.68 1.825 3.415-.673-.022-1.305-.207-1.86-.514v.052c0 1.988 1.415 3.647 3.293 4.023-.344.095-.707.145-1.08.145-.265 0-.522-.026-.773-.074.522 1.63 2.038 2.817 3.833 2.85-1.404 1.1-3.174 1.757-5.096 1.757-.332 0-.66-.02-.98-.057 1.816 1.164 3.973 1.843 6.29 1.843 7.547 0 11.675-6.252 11.675-11.675 0-.178-.004-.355-.012-.53.802-.578 1.497-1.3 2.047-2.124z"})))},ji={foreground:"#ff0000",src:(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Path,{d:"M21.8 8s-.195-1.377-.795-1.984c-.76-.797-1.613-.8-2.004-.847-2.798-.203-6.996-.203-6.996-.203h-.01s-4.197 0-6.996.202c-.39.046-1.242.05-2.003.846C2.395 6.623 2.2 8 2.2 8S2 9.62 2 11.24v1.517c0 1.618.2 3.237.2 3.237s.195 1.378.795 1.985c.76.797 1.76.77 2.205.855 1.6.153 6.8.2 6.8.2s4.203-.005 7-.208c.392-.047 1.244-.05 2.005-.847.6-.607.795-1.985.795-1.985s.2-1.618.2-3.237v-1.517C22 9.62 21.8 8 21.8 8zM9.935 14.595v-5.62l5.403 2.82-5.403 2.8z"}))},Wi={foreground:"#3b5998",src:(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Path,{d:"M20 3H4c-.6 0-1 .4-1 1v16c0 .5.4 1 1 1h8.6v-7h-2.3v-2.7h2.3v-2c0-2.3 1.4-3.6 3.5-3.6 1 0 1.8.1 2.1.1v2.4h-1.4c-1.1 0-1.3.5-1.3 1.3v1.7h2.7l-.4 2.8h-2.3v7H20c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1z"}))},Zi=(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24"},(0,Ke.createElement)(et.G,null,(0,Ke.createElement)(et.Path,{d:"M12 4.622c2.403 0 2.688.01 3.637.052.877.04 1.354.187 1.67.31.42.163.72.358 1.036.673.315.315.51.615.673 1.035.123.317.27.794.31 1.67.043.95.052 1.235.052 3.638s-.01 2.688-.052 3.637c-.04.877-.187 1.354-.31 1.67-.163.42-.358.72-.673 1.036-.315.315-.615.51-1.035.673-.317.123-.794.27-1.67.31-.95.043-1.234.052-3.638.052s-2.688-.01-3.637-.052c-.877-.04-1.354-.187-1.67-.31-.42-.163-.72-.358-1.036-.673-.315-.315-.51-.615-.673-1.035-.123-.317-.27-.794-.31-1.67-.043-.95-.052-1.235-.052-3.638s.01-2.688.052-3.637c.04-.877.187-1.354.31-1.67.163-.42.358-.72.673-1.036.315-.315.615-.51 1.035-.673.317-.123.794-.27 1.67-.31.95-.043 1.235-.052 3.638-.052M12 3c-2.444 0-2.75.01-3.71.054s-1.613.196-2.185.418c-.592.23-1.094.538-1.594 1.04-.5.5-.807 1-1.037 1.593-.223.572-.375 1.226-.42 2.184C3.01 9.25 3 9.555 3 12s.01 2.75.054 3.71.196 1.613.418 2.186c.23.592.538 1.094 1.038 1.594s1.002.808 1.594 1.038c.572.222 1.227.375 2.185.418.96.044 1.266.054 3.71.054s2.75-.01 3.71-.054 1.613-.196 2.186-.418c.592-.23 1.094-.538 1.594-1.038s.808-1.002 1.038-1.594c.222-.572.375-1.227.418-2.185.044-.96.054-1.266.054-3.71s-.01-2.75-.054-3.71-.196-1.613-.418-2.186c-.23-.592-.538-1.094-1.038-1.594s-1.002-.808-1.594-1.038c-.572-.222-1.227-.375-2.185-.418C14.75 3.01 14.445 3 12 3zm0 4.378c-2.552 0-4.622 2.07-4.622 4.622s2.07 4.622 4.622 4.622 4.622-2.07 4.622-4.622S14.552 7.378 12 7.378zM12 15c-1.657 0-3-1.343-3-3s1.343-3 3-3 3 1.343 3 3-1.343 3-3 3zm4.804-8.884c-.596 0-1.08.484-1.08 1.08s.484 1.08 1.08 1.08c.596 0 1.08-.484 1.08-1.08s-.483-1.08-1.08-1.08z"}))),Qi={foreground:"#0073AA",src:(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24"},(0,Ke.createElement)(et.G,null,(0,Ke.createElement)(et.Path,{d:"M12.158 12.786l-2.698 7.84c.806.236 1.657.365 2.54.365 1.047 0 2.05-.18 2.986-.51-.024-.037-.046-.078-.065-.123l-2.762-7.57zM3.008 12c0 3.56 2.07 6.634 5.068 8.092L3.788 8.342c-.5 1.117-.78 2.354-.78 3.658zm15.06-.454c0-1.112-.398-1.88-.74-2.48-.456-.74-.883-1.368-.883-2.11 0-.825.627-1.595 1.51-1.595.04 0 .078.006.116.008-1.598-1.464-3.73-2.36-6.07-2.36-3.14 0-5.904 1.613-7.512 4.053.21.008.41.012.58.012.94 0 2.395-.114 2.395-.114.484-.028.54.684.057.74 0 0-.487.058-1.03.086l3.275 9.74 1.968-5.902-1.4-3.838c-.485-.028-.944-.085-.944-.085-.486-.03-.43-.77.056-.742 0 0 1.484.114 2.368.114.94 0 2.397-.114 2.397-.114.486-.028.543.684.058.74 0 0-.488.058-1.03.086l3.25 9.665.897-2.997c.456-1.17.684-2.137.684-2.907zm1.82-3.86c.04.286.06.593.06.924 0 .912-.17 1.938-.683 3.22l-2.746 7.94c2.672-1.558 4.47-4.454 4.47-7.77 0-1.564-.4-3.033-1.1-4.314zM12 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10z"})))},Ki={foreground:"#1db954",src:(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Path,{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2m4.586 14.424c-.18.295-.563.387-.857.207-2.35-1.434-5.305-1.76-8.786-.963-.335.077-.67-.133-.746-.47-.077-.334.132-.67.47-.745 3.808-.87 7.076-.496 9.712 1.115.293.18.386.563.206.857M17.81 13.7c-.226.367-.706.482-1.072.257-2.687-1.652-6.785-2.13-9.965-1.166-.413.127-.848-.106-.973-.517-.125-.413.108-.848.52-.973 3.632-1.102 8.147-.568 11.234 1.328.366.226.48.707.256 1.072m.105-2.835C14.692 8.95 9.375 8.775 6.297 9.71c-.493.15-1.016-.13-1.166-.624-.148-.495.13-1.017.625-1.167 3.532-1.073 9.404-.866 13.115 1.337.445.264.59.838.327 1.282-.264.443-.838.59-1.282.325"}))},Yi=(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Path,{d:"m6.5 7c-2.75 0-5 2.25-5 5s2.25 5 5 5 5-2.25 5-5-2.25-5-5-5zm11 0c-2.75 0-5 2.25-5 5s2.25 5 5 5 5-2.25 5-5-2.25-5-5-5z"})),Ji={foreground:"#1ab7ea",src:(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(et.G,null,(0,Ke.createElement)(et.Path,{d:"M22.396 7.164c-.093 2.026-1.507 4.8-4.245 8.32C15.323 19.16 12.93 21 10.97 21c-1.214 0-2.24-1.12-3.08-3.36-.56-2.052-1.118-4.105-1.68-6.158-.622-2.24-1.29-3.36-2.004-3.36-.156 0-.7.328-1.634.98l-.978-1.26c1.027-.903 2.04-1.806 3.037-2.71C6 3.95 7.03 3.328 7.716 3.265c1.62-.156 2.616.95 2.99 3.32.404 2.558.685 4.148.84 4.77.468 2.12.982 3.18 1.543 3.18.435 0 1.09-.687 1.963-2.064.872-1.376 1.34-2.422 1.402-3.142.125-1.187-.343-1.782-1.4-1.782-.5 0-1.013.115-1.542.34 1.023-3.35 2.977-4.976 5.862-4.883 2.14.063 3.148 1.45 3.024 4.16z"})))},Xi=(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Path,{d:"M22 12.068a2.184 2.184 0 0 0-2.186-2.186c-.592 0-1.13.233-1.524.609-1.505-1.075-3.566-1.774-5.86-1.864l1.004-4.695 3.261.699A1.56 1.56 0 1 0 18.255 3c-.61-.001-1.147.357-1.398.877l-3.638-.77a.382.382 0 0 0-.287.053.348.348 0 0 0-.161.251l-1.112 5.233c-2.33.072-4.426.77-5.95 1.864a2.201 2.201 0 0 0-1.523-.61 2.184 2.184 0 0 0-.896 4.176c-.036.215-.053.43-.053.663 0 3.37 3.924 6.111 8.763 6.111s8.763-2.724 8.763-6.11c0-.216-.017-.449-.053-.664A2.207 2.207 0 0 0 22 12.068Zm-15.018 1.56a1.56 1.56 0 0 1 3.118 0c0 .86-.699 1.558-1.559 1.558-.86.018-1.559-.699-1.559-1.559Zm8.728 4.139c-1.076 1.075-3.119 1.147-3.71 1.147-.61 0-2.652-.09-3.71-1.147a.4.4 0 0 1 0-.573.4.4 0 0 1 .574 0c.68.68 2.114.914 3.136.914 1.022 0 2.473-.233 3.136-.914a.4.4 0 0 1 .574 0 .436.436 0 0 1 0 .573Zm-.287-2.563a1.56 1.56 0 0 1 0-3.118c.86 0 1.56.699 1.56 1.56 0 .841-.7 1.558-1.56 1.558Z"})),es={foreground:"#35465c",src:(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Path,{d:"M19 3H5a2 2 0 00-2 2v14c0 1.1.9 2 2 2h14a2 2 0 002-2V5a2 2 0 00-2-2zm-5.69 14.66c-2.72 0-3.1-1.9-3.1-3.16v-3.56H8.49V8.99c1.7-.62 2.54-1.99 2.64-2.87 0-.06.06-.41.06-.58h1.9v3.1h2.17v2.3h-2.18v3.1c0 .47.13 1.3 1.2 1.26h1.1v2.36c-1.01.02-2.07 0-2.07 0z"}))},ts=(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Path,{d:"M18.42 14.58c-.51-.66-1.05-1.23-1.05-2.5V7.87c0-1.8.15-3.45-1.2-4.68-1.05-1.02-2.79-1.35-4.14-1.35-2.6 0-5.52.96-6.12 4.14-.06.36.18.54.4.57l2.66.3c.24-.03.42-.27.48-.5.24-1.12 1.17-1.63 2.2-1.63.56 0 1.22.21 1.55.7.4.56.33 1.31.33 1.97v.36c-1.59.18-3.66.27-5.16.93a4.63 4.63 0 0 0-2.93 4.44c0 2.82 1.8 4.23 4.1 4.23 1.95 0 3.03-.45 4.53-1.98.51.72.66 1.08 1.59 1.83.18.09.45.09.63-.1v.04l2.1-1.8c.24-.21.2-.48.03-.75zm-5.4-1.2c-.45.75-1.14 1.23-1.92 1.23-1.05 0-1.65-.81-1.65-1.98 0-2.31 2.1-2.73 4.08-2.73v.6c0 1.05.03 1.92-.5 2.88z"}),(0,Ke.createElement)(et.Path,{d:"M21.69 19.2a17.62 17.62 0 0 1-21.6-1.57c-.23-.2 0-.5.28-.33a23.88 23.88 0 0 0 20.93 1.3c.45-.19.84.3.39.6z"}),(0,Ke.createElement)(et.Path,{d:"M22.8 17.96c-.36-.45-2.22-.2-3.1-.12-.23.03-.3-.18-.05-.36 1.5-1.05 3.96-.75 4.26-.39.3.36-.1 2.82-1.5 4.02-.21.18-.42.1-.3-.15.3-.8 1.02-2.58.69-3z"})),ns=(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Path,{d:"m.0206909 21 19.8160091-13.07806 3.5831 6.20826z",fill:"#4bc7ee"}),(0,Ke.createElement)(et.Path,{d:"m23.7254 19.0205-10.1074-17.18468c-.6421-1.114428-1.7087-1.114428-2.3249 0l-11.2931 19.16418h22.5655c1.279 0 1.8019-.8905 1.1599-1.9795z",fill:"#d4cdcb"}),(0,Ke.createElement)(et.Path,{d:"m.0206909 21 15.2439091-16.38571 4.3029 7.32271z",fill:"#c3d82e"}),(0,Ke.createElement)(et.Path,{d:"m13.618 1.83582c-.6421-1.114428-1.7087-1.114428-2.3249 0l-11.2931 19.16418 15.2646-16.38573z",fill:"#e4ecb0"}),(0,Ke.createElement)(et.Path,{d:"m.0206909 21 19.5468091-9.063 1.6621 2.8344z",fill:"#209dbd"}),(0,Ke.createElement)(et.Path,{d:"m.0206909 21 17.9209091-11.82623 1.6259 2.76323z",fill:"#7cb3c9"})),as=(0,Ke.createElement)(et.SVG,{viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Path,{d:"M11.903 16.568c-1.82 0-3.124-1.281-3.124-2.967a2.987 2.987 0 0 1 2.989-2.989c1.663 0 2.944 1.304 2.944 3.034 0 1.663-1.281 2.922-2.81 2.922ZM17.997 3l-3.308.73v5.107c-.809-1.034-2.045-1.37-3.505-1.37-1.529 0-2.9.561-4.023 1.662-1.259 1.214-1.933 2.764-1.933 4.495 0 1.888.72 3.506 2.113 4.742 1.056.944 2.314 1.415 3.775 1.415 1.438 0 2.517-.382 3.573-1.415v1.415h3.308V3Z",fill:"#333436"})),os=(0,Ke.createElement)(et.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(et.Path,{d:"M12.289,2C6.617,2,3.606,5.648,3.606,9.622c0,1.846,1.025,4.146,2.666,4.878c0.25,0.111,0.381,0.063,0.439-0.169 c0.044-0.175,0.267-1.029,0.365-1.428c0.032-0.128,0.017-0.237-0.091-0.362C6.445,11.911,6.01,10.75,6.01,9.668 c0-2.777,2.194-5.464,5.933-5.464c3.23,0,5.49,2.108,5.49,5.122c0,3.407-1.794,5.768-4.13,5.768c-1.291,0-2.257-1.021-1.948-2.277 c0.372-1.495,1.089-3.112,1.089-4.191c0-0.967-0.542-1.775-1.663-1.775c-1.319,0-2.379,1.309-2.379,3.059 c0,1.115,0.394,1.869,0.394,1.869s-1.302,5.279-1.54,6.261c-0.405,1.666,0.053,4.368,0.094,4.604 c0.021,0.126,0.167,0.169,0.25,0.063c0.129-0.165,1.699-2.419,2.142-4.051c0.158-0.59,0.817-2.995,0.817-2.995 c0.43,0.784,1.681,1.446,3.013,1.446c3.963,0,6.822-3.494,6.822-7.833C20.394,5.112,16.849,2,12.289,2"})),rs=(0,Ke.createElement)(et.SVG,{viewBox:"0 0 44 44"},(0,Ke.createElement)(et.Path,{d:"M32.59521,22.001l4.31885-4.84473-6.34131-1.38379.646-6.459-5.94336,2.61035L22,6.31934l-3.27344,5.60351L12.78418,9.3125l.645,6.458L7.08643,17.15234,11.40479,21.999,7.08594,26.84375l6.34131,1.38379-.64551,6.458,5.94287-2.60938L22,37.68066l3.27344-5.60351,5.94287,2.61035-.64551-6.458,6.34277-1.38183Zm.44385,2.75244L30.772,23.97827l-1.59558-2.07391,1.97888.735Zm-8.82147,6.1579L22.75,33.424V30.88977l1.52228-2.22168ZM18.56226,13.48816,19.819,15.09534l-2.49219-.88642L15.94037,12.337Zm6.87719.00116,2.62043-1.15027-1.38654,1.86981L24.183,15.0946Zm3.59357,2.6029-1.22546,1.7381.07525-2.73486,1.44507-1.94867ZM22,29.33008l-2.16406-3.15686L22,23.23688l2.16406,2.93634Zm-4.25458-9.582-.10528-3.836,3.60986,1.284v3.73242Zm5.00458-2.552,3.60986-1.284-.10528,3.836L22.75,20.92853Zm-7.78174-1.10559-.29352-2.94263,1.44245,1.94739.07519,2.73321Zm2.30982,5.08319,3.50817,1.18164-2.16247,2.9342-3.678-1.08447Zm2.4486,7.49285L21.25,30.88977v2.53485L19.78052,30.91Zm3.48707-6.31121,3.50817-1.18164,2.33228,3.03137-3.678,1.08447Zm10.87219-4.28113-2.714,3.04529L28.16418,19.928l1.92176-2.72565ZM24.06036,12.81769l-2.06012,2.6322-2.059-2.63318L22,9.292ZM9.91455,18.07227l4.00079-.87195,1.921,2.72735-3.20794,1.19019Zm2.93024,4.565,1.9801-.73462L13.228,23.97827l-2.26838.77429Zm-1.55591,3.58819L13.701,25.4021l2.64935.78058-2.14447.67853Zm3.64868,1.977L18.19,27.17334l.08313,3.46332L14.52979,32.2793Zm10.7876,2.43549.08447-3.464,3.25165,1.03052.407,4.07684Zm4.06824-3.77478-2.14545-.68,2.65063-.781,2.41266.825Z"})),ls={foreground:"#f43e37",src:(0,Ke.createElement)(et.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(et.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M24,12A12,12,0,1,1,12,0,12,12,0,0,1,24,12Z"}),(0,Ke.createElement)(et.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M2.67,12a9.33,9.33,0,0,1,18.66,0H19a7,7,0,1,0-7,7v2.33A9.33,9.33,0,0,1,2.67,12ZM12,17.6A5.6,5.6,0,1,1,17.6,12h-2A3.56,3.56,0,1,0,12,15.56Z",fill:"#fff"}))},is=()=>(0,Ke.createElement)("div",{className:"wp-block-embed is-loading"},(0,Ke.createElement)(et.Spinner,null)),ss=({icon:e,label:t,value:n,onSubmit:a,onChange:o,cannotEmbed:r,fallback:l,tryAgain:i})=>(0,Ke.createElement)(et.Placeholder,{icon:(0,Ke.createElement)(nt.BlockIcon,{icon:e,showColors:!0}),label:t,className:"wp-block-embed",instructions:(0,tt.__)("Paste a link to the content you want to display on your site.")},(0,Ke.createElement)("form",{onSubmit:a},(0,Ke.createElement)("input",{type:"url",value:n||"",className:"components-placeholder__input","aria-label":t,placeholder:(0,tt.__)("Enter URL to embed here…"),onChange:o}),(0,Ke.createElement)(et.Button,{variant:"primary",type:"submit"},(0,tt._x)("Embed","button label"))),(0,Ke.createElement)("div",{className:"wp-block-embed__learn-more"},(0,Ke.createElement)(et.ExternalLink,{href:(0,tt.__)("https://wordpress.org/documentation/article/embeds/")},(0,tt.__)("Learn more about embeds"))),r&&(0,Ke.createElement)("div",{className:"components-placeholder__error"},(0,Ke.createElement)("div",{className:"components-placeholder__instructions"},(0,tt.__)("Sorry, this content could not be embedded.")),(0,Ke.createElement)(et.Button,{variant:"secondary",onClick:i},(0,tt._x)("Try again","button label"))," ",(0,Ke.createElement)(et.Button,{variant:"secondary",onClick:l},(0,tt._x)("Convert to link","button label")))),cs={class:"className",frameborder:"frameBorder",marginheight:"marginHeight",marginwidth:"marginWidth"};function ms({html:e}){const t=(0,_t.useRef)(),n=(0,_t.useMemo)((()=>{const t=(new window.DOMParser).parseFromString(e,"text/html").querySelector("iframe"),n={};return t?(Array.from(t.attributes).forEach((({name:e,value:t})=>{"style"!==e&&(n[cs[e]||e]=t)})),n):n}),[e]);return(0,_t.useEffect)((()=>{const{ownerDocument:e}=t.current,{defaultView:a}=e;function o({data:{secret:e,message:a,value:o}={}}){"height"===a&&e===n["data-secret"]&&(t.current.height=o)}return a.addEventListener("message",o),()=>{a.removeEventListener("message",o)}}),[]),(0,Ke.createElement)("div",{className:"wp-block-embed__wrapper"},(0,Ke.createElement)("iframe",{ref:(0,jt.useMergeRefs)([t,(0,jt.useFocusableIframe)()]),title:n.title,...n}))}class us extends _t.Component{constructor(){super(...arguments),this.hideOverlay=this.hideOverlay.bind(this),this.state={interactive:!1}}static getDerivedStateFromProps(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}hideOverlay(){this.setState({interactive:!0})}render(){const{preview:e,previewable:t,url:n,type:a,caption:o,onCaptionChange:r,isSelected:l,className:i,icon:s,label:c,insertBlocksAfter:m}=this.props,{scripts:u}=e,{interactive:p}=this.state,d="photo"===a?(e=>{const t=e.url||e.thumbnail_url,n=(0,Ke.createElement)("p",null,(0,Ke.createElement)("img",{src:t,alt:e.title,width:"100%"}));return(0,_t.renderToString)(n)})(e):e.html,g=new URL(n).host.split("."),h=g.splice(g.length-2,g.length-1).join("."),b=(0,tt.sprintf)((0,tt.__)("Embedded content from %s"),h),_=zt()(a,i,"wp-block-embed__wrapper"),y="wp-embed"===a?(0,Ke.createElement)(ms,{html:d}):(0,Ke.createElement)("div",{className:"wp-block-embed__wrapper"},(0,Ke.createElement)(et.SandBox,{html:d,scripts:u,title:b,type:_,onFocus:this.hideOverlay}),!p&&(0,Ke.createElement)("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}));return(0,Ke.createElement)("figure",{className:zt()(i,"wp-block-embed",{"is-type-video":"video"===a})},t?y:(0,Ke.createElement)(et.Placeholder,{icon:(0,Ke.createElement)(nt.BlockIcon,{icon:s,showColors:!0}),label:c},(0,Ke.createElement)("p",{className:"components-placeholder__error"},(0,Ke.createElement)("a",{href:n},n)),(0,Ke.createElement)("p",{className:"components-placeholder__error"},(0,tt.sprintf)((0,tt.__)("Embedded content from %s can't be previewed in the editor."),h))),(!nt.RichText.isEmpty(o)||l)&&(0,Ke.createElement)(nt.RichText,{identifier:"caption",tagName:"figcaption",className:(0,nt.__experimentalGetElementClassName)("caption"),placeholder:(0,tt.__)("Add caption"),value:o,onChange:r,inlineToolbar:!0,__unstableOnSplitAtEnd:()=>m((0,Qe.createBlock)((0,Qe.getDefaultBlockName)()))}))}}const ps=us,ds=e=>{const{attributes:{providerNameSlug:t,previewable:n,responsive:a,url:o},attributes:r,isSelected:l,onReplace:i,setAttributes:s,insertBlocksAfter:c,onFocus:m}=e,u={title:(0,tt._x)("Embed","block title"),icon:$i},{icon:p,title:d}=(g=t,(0,Qe.getBlockVariations)(Vt)?.find((({name:e})=>e===g))||u);var g;const[h,b]=(0,_t.useState)(o),[_,y]=(0,_t.useState)(!1),{invalidateResolution:v}=(0,gt.useDispatch)(dt.store),{preview:f,fetching:k,themeSupportsResponsive:x,cannotEmbed:w}=(0,gt.useSelect)((e=>{const{getEmbedPreview:t,isPreviewEmbedFallback:n,isRequestingEmbedPreview:a,getThemeSupports:r}=e(dt.store);if(!o)return{fetching:!1,cannotEmbed:!1};const l=t(o),i=n(o),s=!!l&&!(!1===l?.html&&void 0===l?.type)&&!(404===l?.data?.status);return{preview:s?l:void 0,fetching:a(o),themeSupportsResponsive:r()["responsive-embeds"],cannotEmbed:!s||i}}),[o]),E=()=>((e,t,n,a)=>{const{allowResponsive:o,className:r}=e;return{...e,...qt(t,n,r,a,o)}})(r,f,d,a);(0,_t.useEffect)((()=>{if(f?.html||!w||k)return;const e=o.replace(/\/$/,"");b(e),y(!1),s({url:e})}),[f?.html,o,w,k,s]),(0,_t.useEffect)((()=>{if(w&&!k&&h&&"x.com"===(0,pt.getAuthority)(h)){const e=new URL(h);e.host="twitter.com",s({url:e.toString()})}}),[h,w,k,s]),(0,_t.useEffect)((()=>{if(f&&!_){const t=E();if(s(t),i){const n=Ot(e,t);n&&i(n)}}}),[f,_]);const C=(0,nt.useBlockProps)();if(k)return(0,Ke.createElement)(Ye.View,{...C},(0,Ke.createElement)(is,null));const S=(0,tt.sprintf)((0,tt.__)("%s URL"),d);if(!f||w||_)return(0,Ke.createElement)(Ye.View,{...C},(0,Ke.createElement)(ss,{icon:p,label:S,onFocus:m,onSubmit:e=>{e&&e.preventDefault();const t=Gt(r.className);y(!1),s({url:h,className:t})},value:h,cannotEmbed:w,onChange:e=>b(e.target.value),fallback:()=>function(e,t){const n=(0,Ke.createElement)("a",{href:e},e);t((0,Qe.createBlock)("core/paragraph",{content:(0,_t.renderToString)(n)}))}(h,i),tryAgain:()=>{v("getEmbedPreview",[h])}}));const{caption:B,type:N,allowResponsive:T,className:I}=E(),P=ut()(I,e.className);return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(Vi,{showEditButton:f&&!w,themeSupportsResponsive:x,blockSupportsResponsive:a,allowResponsive:T,toggleResponsive:()=>{const{allowResponsive:e,className:t}=r,{html:n}=f,o=!e;s({allowResponsive:o,className:Ut(n,t,a&&o)})},switchBackToURLInput:()=>y(!0)}),(0,Ke.createElement)(Ye.View,{...C},(0,Ke.createElement)(ps,{preview:f,previewable:n,className:P,url:h,type:N,caption:B,onCaptionChange:e=>s({caption:e}),isSelected:l,icon:p,label:S,insertBlocksAfter:c})))};const{name:gs}={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/embed",title:"Embed",category:"embed",description:"Add a block that displays content pulled from other sites, like Twitter or YouTube.",textdomain:"default",attributes:{url:{type:"string",__experimentalRole:"content"},caption:{type:"rich-text",source:"rich-text",selector:"figcaption",__experimentalRole:"content"},type:{type:"string",__experimentalRole:"content"},providerNameSlug:{type:"string",__experimentalRole:"content"},allowResponsive:{type:"boolean",default:!0},responsive:{type:"boolean",default:!1,__experimentalRole:"content"},previewable:{type:"boolean",default:!0,__experimentalRole:"content"}},supports:{align:!0,spacing:{margin:!0},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-embed-editor",style:"wp-block-embed"},hs={from:[{type:"raw",isMatch:e=>"P"===e.nodeName&&/^\s*(https?:\/\/\S+)\s*$/i.test(e.textContent)&&1===e.textContent?.match(/https/gi)?.length,transform:e=>(0,Qe.createBlock)(gs,{url:e.textContent.trim()})}],to:[{type:"block",blocks:["core/paragraph"],isMatch:({url:e})=>!!e,transform:({url:e,caption:t})=>{let n=`<a href="${e}">${e}</a>`;return t?.trim()&&(n+=`<br />${t}`),(0,Qe.createBlock)("core/paragraph",{content:n})}}]},bs=hs,_s=[{name:"twitter",title:"Twitter",icon:qi,keywords:["tweet",(0,tt.__)("social")],description:(0,tt.__)("Embed a tweet."),patterns:[/^https?:\/\/(www\.)?twitter\.com\/.+/i],attributes:{providerNameSlug:"twitter",responsive:!0}},{name:"youtube",title:"YouTube",icon:ji,keywords:[(0,tt.__)("music"),(0,tt.__)("video")],description:(0,tt.__)("Embed a YouTube video."),patterns:[/^https?:\/\/((m|www)\.)?youtube\.com\/.+/i,/^https?:\/\/youtu\.be\/.+/i],attributes:{providerNameSlug:"youtube",responsive:!0}},{name:"facebook",title:"Facebook",icon:Wi,keywords:[(0,tt.__)("social")],description:(0,tt.__)("Embed a Facebook post."),scope:["block"],patterns:[],attributes:{providerNameSlug:"facebook",previewable:!1,responsive:!0}},{name:"instagram",title:"Instagram",icon:Zi,keywords:[(0,tt.__)("image"),(0,tt.__)("social")],description:(0,tt.__)("Embed an Instagram post."),scope:["block"],patterns:[],attributes:{providerNameSlug:"instagram",responsive:!0}},{name:"wordpress",title:"WordPress",icon:Qi,keywords:[(0,tt.__)("post"),(0,tt.__)("blog")],description:(0,tt.__)("Embed a WordPress post."),attributes:{providerNameSlug:"wordpress"}},{name:"soundcloud",title:"SoundCloud",icon:Oi,keywords:[(0,tt.__)("music"),(0,tt.__)("audio")],description:(0,tt.__)("Embed SoundCloud content."),patterns:[/^https?:\/\/(www\.)?soundcloud\.com\/.+/i],attributes:{providerNameSlug:"soundcloud",responsive:!0}},{name:"spotify",title:"Spotify",icon:Ki,keywords:[(0,tt.__)("music"),(0,tt.__)("audio")],description:(0,tt.__)("Embed Spotify content."),patterns:[/^https?:\/\/(open|play)\.spotify\.com\/.+/i],attributes:{providerNameSlug:"spotify",responsive:!0}},{name:"flickr",title:"Flickr",icon:Yi,keywords:[(0,tt.__)("image")],description:(0,tt.__)("Embed Flickr content."),patterns:[/^https?:\/\/(www\.)?flickr\.com\/.+/i,/^https?:\/\/flic\.kr\/.+/i],attributes:{providerNameSlug:"flickr",responsive:!0}},{name:"vimeo",title:"Vimeo",icon:Ji,keywords:[(0,tt.__)("video")],description:(0,tt.__)("Embed a Vimeo video."),patterns:[/^https?:\/\/(www\.)?vimeo\.com\/.+/i],attributes:{providerNameSlug:"vimeo",responsive:!0}},{name:"animoto",title:"Animoto",icon:ns,description:(0,tt.__)("Embed an Animoto video."),patterns:[/^https?:\/\/(www\.)?(animoto|video214)\.com\/.+/i],attributes:{providerNameSlug:"animoto",responsive:!0}},{name:"cloudup",title:"Cloudup",icon:$i,description:(0,tt.__)("Embed Cloudup content."),patterns:[/^https?:\/\/cloudup\.com\/.+/i],attributes:{providerNameSlug:"cloudup",responsive:!0}},{name:"collegehumor",title:"CollegeHumor",icon:Ui,description:(0,tt.__)("Embed CollegeHumor content."),scope:["block"],patterns:[],attributes:{providerNameSlug:"collegehumor",responsive:!0}},{name:"crowdsignal",title:"Crowdsignal",icon:$i,keywords:["polldaddy",(0,tt.__)("survey")],description:(0,tt.__)("Embed Crowdsignal (formerly Polldaddy) content."),patterns:[/^https?:\/\/((.+\.)?polldaddy\.com|poll\.fm|.+\.crowdsignal\.net|.+\.survey\.fm)\/.+/i],attributes:{providerNameSlug:"crowdsignal",responsive:!0}},{name:"dailymotion",title:"Dailymotion",icon:as,keywords:[(0,tt.__)("video")],description:(0,tt.__)("Embed a Dailymotion video."),patterns:[/^https?:\/\/(www\.)?dailymotion\.com\/.+/i],attributes:{providerNameSlug:"dailymotion",responsive:!0}},{name:"imgur",title:"Imgur",icon:Gi,description:(0,tt.__)("Embed Imgur content."),patterns:[/^https?:\/\/(.+\.)?imgur\.com\/.+/i],attributes:{providerNameSlug:"imgur",responsive:!0}},{name:"issuu",title:"Issuu",icon:$i,description:(0,tt.__)("Embed Issuu content."),patterns:[/^https?:\/\/(www\.)?issuu\.com\/.+/i],attributes:{providerNameSlug:"issuu",responsive:!0}},{name:"kickstarter",title:"Kickstarter",icon:$i,description:(0,tt.__)("Embed Kickstarter content."),patterns:[/^https?:\/\/(www\.)?kickstarter\.com\/.+/i,/^https?:\/\/kck\.st\/.+/i],attributes:{providerNameSlug:"kickstarter",responsive:!0}},{name:"mixcloud",title:"Mixcloud",icon:Oi,keywords:[(0,tt.__)("music"),(0,tt.__)("audio")],description:(0,tt.__)("Embed Mixcloud content."),patterns:[/^https?:\/\/(www\.)?mixcloud\.com\/.+/i],attributes:{providerNameSlug:"mixcloud",responsive:!0}},{name:"pocket-casts",title:"Pocket Casts",icon:ls,keywords:[(0,tt.__)("podcast"),(0,tt.__)("audio")],description:(0,tt.__)("Embed a podcast player from Pocket Casts."),patterns:[/^https:\/\/pca.st\/\w+/i],attributes:{providerNameSlug:"pocket-casts",responsive:!0}},{name:"reddit",title:"Reddit",icon:Xi,description:(0,tt.__)("Embed a Reddit thread."),patterns:[/^https?:\/\/(www\.)?reddit\.com\/.+/i],attributes:{providerNameSlug:"reddit",responsive:!0}},{name:"reverbnation",title:"ReverbNation",icon:Oi,description:(0,tt.__)("Embed ReverbNation content."),patterns:[/^https?:\/\/(www\.)?reverbnation\.com\/.+/i],attributes:{providerNameSlug:"reverbnation",responsive:!0}},{name:"screencast",title:"Screencast",icon:Ui,description:(0,tt.__)("Embed Screencast content."),patterns:[/^https?:\/\/(www\.)?screencast\.com\/.+/i],attributes:{providerNameSlug:"screencast",responsive:!0}},{name:"scribd",title:"Scribd",icon:$i,description:(0,tt.__)("Embed Scribd content."),patterns:[/^https?:\/\/(www\.)?scribd\.com\/.+/i],attributes:{providerNameSlug:"scribd",responsive:!0}},{name:"slideshare",title:"Slideshare",icon:$i,description:(0,tt.__)("Embed Slideshare content."),patterns:[/^https?:\/\/(.+?\.)?slideshare\.net\/.+/i],attributes:{providerNameSlug:"slideshare",responsive:!0}},{name:"smugmug",title:"SmugMug",icon:Gi,description:(0,tt.__)("Embed SmugMug content."),patterns:[/^https?:\/\/(.+\.)?smugmug\.com\/.*/i],attributes:{providerNameSlug:"smugmug",previewable:!1,responsive:!0}},{name:"speaker-deck",title:"Speaker Deck",icon:$i,description:(0,tt.__)("Embed Speaker Deck content."),patterns:[/^https?:\/\/(www\.)?speakerdeck\.com\/.+/i],attributes:{providerNameSlug:"speaker-deck",responsive:!0}},{name:"tiktok",title:"TikTok",icon:Ui,keywords:[(0,tt.__)("video")],description:(0,tt.__)("Embed a TikTok video."),patterns:[/^https?:\/\/(www\.)?tiktok\.com\/.+/i],attributes:{providerNameSlug:"tiktok",responsive:!0}},{name:"ted",title:"TED",icon:Ui,description:(0,tt.__)("Embed a TED video."),patterns:[/^https?:\/\/(www\.|embed\.)?ted\.com\/.+/i],attributes:{providerNameSlug:"ted",responsive:!0}},{name:"tumblr",title:"Tumblr",icon:es,keywords:[(0,tt.__)("social")],description:(0,tt.__)("Embed a Tumblr post."),patterns:[/^https?:\/\/(.+)\.tumblr\.com\/.+/i],attributes:{providerNameSlug:"tumblr",responsive:!0}},{name:"videopress",title:"VideoPress",icon:Ui,keywords:[(0,tt.__)("video")],description:(0,tt.__)("Embed a VideoPress video."),patterns:[/^https?:\/\/videopress\.com\/.+/i],attributes:{providerNameSlug:"videopress",responsive:!0}},{name:"wordpress-tv",title:"WordPress.tv",icon:Ui,description:(0,tt.__)("Embed a WordPress.tv video."),patterns:[/^https?:\/\/wordpress\.tv\/.+/i],attributes:{providerNameSlug:"wordpress-tv",responsive:!0}},{name:"amazon-kindle",title:"Amazon Kindle",icon:ts,keywords:[(0,tt.__)("ebook")],description:(0,tt.__)("Embed Amazon Kindle content."),patterns:[/^https?:\/\/([a-z0-9-]+\.)?(amazon|amzn)(\.[a-z]{2,4})+\/.+/i,/^https?:\/\/(www\.)?(a\.co|z\.cn)\/.+/i],attributes:{providerNameSlug:"amazon-kindle"}},{name:"pinterest",title:"Pinterest",icon:os,keywords:[(0,tt.__)("social"),(0,tt.__)("bookmark")],description:(0,tt.__)("Embed Pinterest pins, boards, and profiles."),patterns:[/^https?:\/\/([a-z]{2}|www)\.pinterest\.com(\.(au|mx))?\/.*/i],attributes:{providerNameSlug:"pinterest"}},{name:"wolfram-cloud",title:"Wolfram",icon:rs,description:(0,tt.__)("Embed Wolfram notebook content."),patterns:[/^https?:\/\/(www\.)?wolframcloud\.com\/obj\/.+/i],attributes:{providerNameSlug:"wolfram-cloud",responsive:!0}}];_s.forEach((e=>{e.isActive||(e.isActive=(e,t)=>e.providerNameSlug===t.providerNameSlug)}));const ys=_s,{attributes:vs}={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/embed",title:"Embed",category:"embed",description:"Add a block that displays content pulled from other sites, like Twitter or YouTube.",textdomain:"default",attributes:{url:{type:"string",__experimentalRole:"content"},caption:{type:"rich-text",source:"rich-text",selector:"figcaption",__experimentalRole:"content"},type:{type:"string",__experimentalRole:"content"},providerNameSlug:{type:"string",__experimentalRole:"content"},allowResponsive:{type:"boolean",default:!0},responsive:{type:"boolean",default:!1,__experimentalRole:"content"},previewable:{type:"boolean",default:!0,__experimentalRole:"content"}},supports:{align:!0,spacing:{margin:!0},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-embed-editor",style:"wp-block-embed"},fs={attributes:vs,save({attributes:e}){const{url:t,caption:n,type:a,providerNameSlug:o}=e;if(!t)return null;const r=ut()("wp-block-embed",{[`is-type-${a}`]:a,[`is-provider-${o}`]:o,[`wp-block-embed-${o}`]:o});return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:r})},(0,Ke.createElement)("div",{className:"wp-block-embed__wrapper"},`\n${t}\n`),!nt.RichText.isEmpty(n)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:n}))}},ks={attributes:vs,save({attributes:{url:e,caption:t,type:n,providerNameSlug:a}}){if(!e)return null;const o=ut()("wp-block-embed",{[`is-type-${n}`]:n,[`is-provider-${a}`]:a});return(0,Ke.createElement)("figure",{className:o},`\n${e}\n`,!nt.RichText.isEmpty(t)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:t}))}},xs=[fs,ks],ws={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/embed",title:"Embed",category:"embed",description:"Add a block that displays content pulled from other sites, like Twitter or YouTube.",textdomain:"default",attributes:{url:{type:"string",__experimentalRole:"content"},caption:{type:"rich-text",source:"rich-text",selector:"figcaption",__experimentalRole:"content"},type:{type:"string",__experimentalRole:"content"},providerNameSlug:{type:"string",__experimentalRole:"content"},allowResponsive:{type:"boolean",default:!0},responsive:{type:"boolean",default:!1,__experimentalRole:"content"},previewable:{type:"boolean",default:!0,__experimentalRole:"content"}},supports:{align:!0,spacing:{margin:!0},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-embed-editor",style:"wp-block-embed"},{name:Es}=ws,Cs={icon:$i,edit:ds,save:function({attributes:e}){const{url:t,caption:n,type:a,providerNameSlug:o}=e;if(!t)return null;const r=zt()("wp-block-embed",{[`is-type-${a}`]:a,[`is-provider-${o}`]:o,[`wp-block-embed-${o}`]:o});return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:r})},(0,Ke.createElement)("div",{className:"wp-block-embed__wrapper"},`\n${t}\n`),!nt.RichText.isEmpty(n)&&(0,Ke.createElement)(nt.RichText.Content,{className:(0,nt.__experimentalGetElementClassName)("caption"),tagName:"figcaption",value:n}))},transforms:bs,variations:ys,deprecated:xs},Ss=()=>Xe({name:Es,metadata:ws,settings:Cs}),Bs=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"})),Ns={attributes:{id:{type:"number"},href:{type:"string"},fileId:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"id"},fileName:{type:"string",source:"html",selector:"a:not([download])"},textLinkHref:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"href"},textLinkTarget:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"target"},showDownloadButton:{type:"boolean",default:!0},downloadButtonText:{type:"string",source:"html",selector:"a[download]"},displayPreview:{type:"boolean"},previewHeight:{type:"number",default:600}},supports:{anchor:!0,align:!0},save({attributes:e}){const{href:t,fileId:n,fileName:a,textLinkHref:o,textLinkTarget:r,showDownloadButton:l,downloadButtonText:i,displayPreview:s,previewHeight:c}=e,m=nt.RichText.isEmpty(a)?(0,tt.__)("PDF embed"):(0,tt.sprintf)((0,tt.__)("Embed of %s."),a),u=!nt.RichText.isEmpty(a),p=u?n:void 0;return t&&(0,Ke.createElement)("div",{...nt.useBlockProps.save()},s&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("object",{className:"wp-block-file__embed",data:t,type:"application/pdf",style:{width:"100%",height:`${c}px`},"aria-label":m})),u&&(0,Ke.createElement)("a",{id:p,href:o,target:r,rel:r?"noreferrer noopener":void 0},(0,Ke.createElement)(nt.RichText.Content,{value:a})),l&&(0,Ke.createElement)("a",{href:t,className:ut()("wp-block-file__button",(0,nt.__experimentalGetElementClassName)("button")),download:!0,"aria-describedby":p},(0,Ke.createElement)(nt.RichText.Content,{value:i})))}},Ts={attributes:{id:{type:"number"},href:{type:"string"},fileId:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"id"},fileName:{type:"string",source:"html",selector:"a:not([download])"},textLinkHref:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"href"},textLinkTarget:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"target"},showDownloadButton:{type:"boolean",default:!0},downloadButtonText:{type:"string",source:"html",selector:"a[download]"},displayPreview:{type:"boolean"},previewHeight:{type:"number",default:600}},supports:{anchor:!0,align:!0},save({attributes:e}){const{href:t,fileId:n,fileName:a,textLinkHref:o,textLinkTarget:r,showDownloadButton:l,downloadButtonText:i,displayPreview:s,previewHeight:c}=e,m=nt.RichText.isEmpty(a)?(0,tt.__)("PDF embed"):(0,tt.sprintf)((0,tt.__)("Embed of %s."),a),u=!nt.RichText.isEmpty(a),p=u?n:void 0;return t&&(0,Ke.createElement)("div",{...nt.useBlockProps.save()},s&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("object",{className:"wp-block-file__embed",data:t,type:"application/pdf",style:{width:"100%",height:`${c}px`},"aria-label":m})),u&&(0,Ke.createElement)("a",{id:p,href:o,target:r,rel:r?"noreferrer noopener":void 0},(0,Ke.createElement)(nt.RichText.Content,{value:a})),l&&(0,Ke.createElement)("a",{href:t,className:"wp-block-file__button",download:!0,"aria-describedby":p},(0,Ke.createElement)(nt.RichText.Content,{value:i})))}},Is={attributes:{id:{type:"number"},href:{type:"string"},fileName:{type:"string",source:"html",selector:"a:not([download])"},textLinkHref:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"href"},textLinkTarget:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"target"},showDownloadButton:{type:"boolean",default:!0},downloadButtonText:{type:"string",source:"html",selector:"a[download]"},displayPreview:{type:"boolean"},previewHeight:{type:"number",default:600}},supports:{anchor:!0,align:!0},save({attributes:e}){const{href:t,fileName:n,textLinkHref:a,textLinkTarget:o,showDownloadButton:r,downloadButtonText:l,displayPreview:i,previewHeight:s}=e,c=nt.RichText.isEmpty(n)?(0,tt.__)("PDF embed"):(0,tt.sprintf)((0,tt.__)("Embed of %s."),n);return t&&(0,Ke.createElement)("div",{...nt.useBlockProps.save()},i&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("object",{className:"wp-block-file__embed",data:t,type:"application/pdf",style:{width:"100%",height:`${s}px`},"aria-label":c})),!nt.RichText.isEmpty(n)&&(0,Ke.createElement)("a",{href:a,target:o,rel:o?"noreferrer noopener":void 0},(0,Ke.createElement)(nt.RichText.Content,{value:n})),r&&(0,Ke.createElement)("a",{href:t,className:"wp-block-file__button",download:!0},(0,Ke.createElement)(nt.RichText.Content,{value:l})))}},Ps=[Ns,Ts,Is];function Ms({hrefs:e,openInNewWindow:t,showDownloadButton:n,changeLinkDestinationOption:a,changeOpenInNewWindow:o,changeShowDownloadButton:r,displayPreview:l,changeDisplayPreview:i,previewHeight:s,changePreviewHeight:c}){const{href:m,textLinkHref:u,attachmentPage:p}=e;let d=[{value:m,label:(0,tt.__)("URL")}];return p&&(d=[{value:m,label:(0,tt.__)("Media file")},{value:p,label:(0,tt.__)("Attachment page")}]),(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,m.endsWith(".pdf")&&(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("PDF settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show inline embed"),help:l?(0,tt.__)("Note: Most phone and tablet browsers won't display embedded PDFs."):null,checked:!!l,onChange:i}),l&&(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Height in pixels"),min:Rs,max:Math.max(As,s),value:s,onChange:c})),(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link to"),value:u,options:d,onChange:a}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Open in new tab"),checked:t,onChange:o}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show download button"),checked:n,onChange:r}))))}const zs=e=>{let t;try{t=new window.ActiveXObject(e)}catch(e){t=void 0}return t},Rs=200,As=2e3;function Hs({text:e,disabled:t}){const{createNotice:n}=(0,gt.useDispatch)(Pt.store),a=(0,jt.useCopyToClipboard)(e,(()=>{n("info",(0,tt.__)("Copied URL to clipboard."),{isDismissible:!0,type:"snackbar"})}));return(0,Ke.createElement)(et.ToolbarButton,{className:"components-clipboard-toolbar-button",ref:a,disabled:t},(0,tt.__)("Copy URL"))}const Ls=function({attributes:e,isSelected:t,setAttributes:n,clientId:a}){const{id:o,fileName:r,href:l,textLinkHref:i,textLinkTarget:s,showDownloadButton:c,downloadButtonText:m,displayPreview:u,previewHeight:p}=e,{getSettings:d}=(0,gt.useSelect)(nt.store),{media:g}=(0,gt.useSelect)((e=>({media:void 0===o?void 0:e(dt.store).getMedia(o)})),[o]),{createErrorNotice:h}=(0,gt.useDispatch)(Pt.store),{toggleSelection:b}=(0,gt.useDispatch)(nt.store);function _(e){if(!e||!e.url)return;const t=e.url.endsWith(".pdf");n({href:e.url,fileName:e.title,textLinkHref:e.url,id:e.id,displayPreview:!!t||void 0,previewHeight:t?600:void 0,fileId:`wp-block-file--media-${a}`})}function y(e){n({href:void 0}),h(e,{type:"snackbar"})}(0,_t.useEffect)((()=>{if((0,It.isBlobURL)(l)){const e=(0,It.getBlobByURL)(l);d().mediaUpload({filesList:[e],onFileChange:([e])=>_(e),onError:y}),(0,It.revokeBlobURL)(l)}nt.RichText.isEmpty(m)&&n({downloadButtonText:(0,tt._x)("Download","button label")})}),[]);const v=g&&g.link,f=(0,nt.useBlockProps)({className:ut()((0,It.isBlobURL)(l)&&(0,et.__unstableGetAnimateClassName)({type:"loading"}),{"is-transient":(0,It.isBlobURL)(l)})}),k=!(window.navigator.userAgent.indexOf("Mobi")>-1||window.navigator.userAgent.indexOf("Android")>-1||window.navigator.userAgent.indexOf("Macintosh")>-1&&window.navigator.maxTouchPoints&&window.navigator.maxTouchPoints>2||(window.ActiveXObject||"ActiveXObject"in window)&&!zs("AcroPDF.PDF")&&!zs("PDF.PdfCtrl"))&&u;return l?(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(Ms,{hrefs:{href:l,textLinkHref:i,attachmentPage:v},openInNewWindow:!!s,showDownloadButton:c,changeLinkDestinationOption:function(e){n({textLinkHref:e})},changeOpenInNewWindow:function(e){n({textLinkTarget:!!e&&"_blank"})},changeShowDownloadButton:function(e){n({showDownloadButton:e})},displayPreview:u,changeDisplayPreview:function(e){n({displayPreview:e})},previewHeight:p,changePreviewHeight:function(e){const t=Math.max(parseInt(e,10),Rs);n({previewHeight:t})}}),(0,Ke.createElement)(nt.BlockControls,{group:"other"},(0,Ke.createElement)(nt.MediaReplaceFlow,{mediaId:o,mediaURL:l,accept:"*",onSelect:_,onError:y}),(0,Ke.createElement)(Hs,{text:l,disabled:(0,It.isBlobURL)(l)})),(0,Ke.createElement)("div",{...f},k&&(0,Ke.createElement)(et.ResizableBox,{size:{height:p},minHeight:Rs,maxHeight:As,minWidth:"100%",grid:[10,10],enable:{top:!1,right:!1,bottom:!0,left:!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},onResizeStart:()=>b(!1),onResizeStop:function(e,t,a,o){b(!0);const r=parseInt(p+o.height,10);n({previewHeight:r})},showHandle:t},(0,Ke.createElement)("object",{className:"wp-block-file__preview",data:l,type:"application/pdf","aria-label":(0,tt.__)("Embed of the selected PDF file.")}),!t&&(0,Ke.createElement)("div",{className:"wp-block-file__preview-overlay"})),(0,Ke.createElement)("div",{className:"wp-block-file__content-wrapper"},(0,Ke.createElement)(nt.RichText,{tagName:"a",value:r,placeholder:(0,tt.__)("Write file name…"),withoutInteractiveFormatting:!0,onChange:e=>n({fileName:vn(e)}),href:i}),c&&(0,Ke.createElement)("div",{className:"wp-block-file__button-richtext-wrapper"},(0,Ke.createElement)(nt.RichText,{tagName:"div","aria-label":(0,tt.__)("Download button text"),className:ut()("wp-block-file__button",(0,nt.__experimentalGetElementClassName)("button")),value:m,withoutInteractiveFormatting:!0,placeholder:(0,tt.__)("Add text…"),onChange:e=>n({downloadButtonText:vn(e)})}))))):(0,Ke.createElement)("div",{...f},(0,Ke.createElement)(nt.MediaPlaceholder,{icon:(0,Ke.createElement)(nt.BlockIcon,{icon:Bs}),labels:{title:(0,tt.__)("File"),instructions:(0,tt.__)("Upload a file or pick one from your media library.")},onSelect:_,onError:y,accept:"*"}))};const Ds={from:[{type:"files",isMatch:e=>e.length>0,priority:15,transform:e=>{const t=[];return e.forEach((e=>{const n=(0,It.createBlobURL)(e);t.push((0,Qe.createBlock)("core/file",{href:n,fileName:e.name,textLinkHref:n}))})),t}},{type:"block",blocks:["core/audio"],transform:e=>(0,Qe.createBlock)("core/file",{href:e.src,fileName:e.caption,textLinkHref:e.src,id:e.id,anchor:e.anchor})},{type:"block",blocks:["core/video"],transform:e=>(0,Qe.createBlock)("core/file",{href:e.src,fileName:e.caption,textLinkHref:e.src,id:e.id,anchor:e.anchor})},{type:"block",blocks:["core/image"],transform:e=>(0,Qe.createBlock)("core/file",{href:e.url,fileName:e.caption||(0,pt.getFilename)(e.url),textLinkHref:e.url,id:e.id,anchor:e.anchor})}],to:[{type:"block",blocks:["core/audio"],isMatch:({id:e})=>{if(!e)return!1;const{getMedia:t}=(0,gt.select)(dt.store),n=t(e);return!!n&&n.mime_type.includes("audio")},transform:e=>(0,Qe.createBlock)("core/audio",{src:e.href,caption:e.fileName,id:e.id,anchor:e.anchor})},{type:"block",blocks:["core/video"],isMatch:({id:e})=>{if(!e)return!1;const{getMedia:t}=(0,gt.select)(dt.store),n=t(e);return!!n&&n.mime_type.includes("video")},transform:e=>(0,Qe.createBlock)("core/video",{src:e.href,caption:e.fileName,id:e.id,anchor:e.anchor})},{type:"block",blocks:["core/image"],isMatch:({id:e})=>{if(!e)return!1;const{getMedia:t}=(0,gt.select)(dt.store),n=t(e);return!!n&&n.mime_type.includes("image")},transform:e=>(0,Qe.createBlock)("core/image",{url:e.href,caption:e.fileName,id:e.id,anchor:e.anchor})}]},Fs=Ds,Vs={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/file",title:"File",category:"media",description:"Add a link to a downloadable file.",keywords:["document","pdf","download"],textdomain:"default",attributes:{id:{type:"number"},href:{type:"string"},fileId:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"id"},fileName:{type:"rich-text",source:"rich-text",selector:"a:not([download])"},textLinkHref:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"href"},textLinkTarget:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"target"},showDownloadButton:{type:"boolean",default:!0},downloadButtonText:{type:"rich-text",source:"rich-text",selector:"a[download]"},displayPreview:{type:"boolean"},previewHeight:{type:"number",default:600}},supports:{anchor:!0,align:!0,spacing:{margin:!0,padding:!0},color:{gradients:!0,link:!0,text:!1,__experimentalDefaultControls:{background:!0,link:!0}},interactivity:!0},editorStyle:"wp-block-file-editor",style:"wp-block-file"},{name:$s}=Vs,Os={icon:Bs,example:{attributes:{href:"https://upload.wikimedia.org/wikipedia/commons/d/dd/Armstrong_Small_Step.ogg",fileName:(0,tt._x)("Armstrong_Small_Step","Name of the file")}},transforms:Fs,deprecated:Ps,edit:Ls,save:function({attributes:e}){const{href:t,fileId:n,fileName:a,textLinkHref:o,textLinkTarget:r,showDownloadButton:l,downloadButtonText:i,displayPreview:s,previewHeight:c}=e,m=nt.RichText.isEmpty(a)?"PDF embed":a.toString(),u=!nt.RichText.isEmpty(a),p=u?n:void 0;return t&&(0,Ke.createElement)("div",{...nt.useBlockProps.save()},s&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("object",{className:"wp-block-file__embed",data:t,type:"application/pdf",style:{width:"100%",height:`${c}px`},"aria-label":m})),u&&(0,Ke.createElement)("a",{id:p,href:o,target:r,rel:r?"noreferrer noopener":void 0},(0,Ke.createElement)(nt.RichText.Content,{value:a})),l&&(0,Ke.createElement)("a",{href:t,className:ut()("wp-block-file__button",(0,nt.__experimentalGetElementClassName)("button")),download:!0,"aria-describedby":p},(0,Ke.createElement)(nt.RichText.Content,{value:i})))}},Gs=()=>Xe({name:$s,metadata:Vs,settings:Os}),Us=["core/form-submission-notification",{type:"success"},[["core/paragraph",{content:'<mark style="background-color:rgba(0, 0, 0, 0);color:#345C00" class="has-inline-color">'+(0,tt.__)("Your form has been submitted successfully")+"</mark>"}]]],qs=["core/form-submission-notification",{type:"error"},[["core/paragraph",{content:'<mark style="background-color:rgba(0, 0, 0, 0);color:#CF2E2E" class="has-inline-color">'+(0,tt.__)("There was an error submitting your form.")+"</mark>"}]]],js=[Us,qs,["core/form-input",{type:"text",label:(0,tt.__)("Name"),required:!0}],["core/form-input",{type:"email",label:(0,tt.__)("Email"),required:!0}],["core/form-input",{type:"textarea",label:(0,tt.__)("Comment"),required:!0}],["core/form-submit-button",{}]],Ws=({attributes:e,setAttributes:t,clientId:n})=>{const{action:a,method:o,email:r,submissionMethod:l}=e,i=(0,nt.useBlockProps)(),{hasInnerBlocks:s}=(0,gt.useSelect)((e=>{const{getBlock:t}=e(nt.store),a=t(n);return{hasInnerBlocks:!(!a||!a.innerBlocks.length)}}),[n]),c=(0,nt.useInnerBlocksProps)(i,{template:js,renderAppender:s?void 0:nt.InnerBlocks.ButtonBlockAppender});return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.SelectControl,{label:(0,tt.__)("Submissions method"),options:[{label:(0,tt.__)("Send email"),value:"email"},{label:(0,tt.__)("- Custom -"),value:"custom"}],value:l,onChange:e=>t({submissionMethod:e}),help:"custom"===l?(0,tt.__)('Select the method to use for form submissions. Additional options for the "custom" mode can be found in the "Advanced" section.'):(0,tt.__)("Select the method to use for form submissions.")}),"email"===l&&(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,autoComplete:"off",label:(0,tt.__)("Email for form submissions"),value:r,required:!0,onChange:e=>{t({email:e}),t({action:`mailto:${e}`}),t({method:"post"})},help:(0,tt.__)("The email address where form submissions will be sent. Separate multiple email addresses with a comma.")}))),"email"!==l&&(0,Ke.createElement)(nt.InspectorControls,{group:"advanced"},(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Method"),options:[{label:"Get",value:"get"},{label:"Post",value:"post"}],value:o,onChange:e=>t({method:e}),help:(0,tt.__)("Select the method to use for form submissions.")}),(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,autoComplete:"off",label:(0,tt.__)("Form action"),value:a,onChange:e=>{t({action:e})},help:(0,tt.__)("The URL where the form should be submitted.")})),(0,Ke.createElement)("form",{...c,className:"wp-block-form",encType:"email"===l?"text/plain":null}))},Zs=({attributes:e})=>{const t=nt.useBlockProps.save(),{submissionMethod:n}=e;return(0,Ke.createElement)("form",{...t,className:"wp-block-form",encType:"email"===n?"text/plain":null},(0,Ke.createElement)(nt.InnerBlocks.Content,null))},Qs=[{name:"comment-form",title:(0,tt.__)("Experimental Comment form"),description:(0,tt.__)("A comment form for posts and pages."),attributes:{submissionMethod:"custom",action:"{SITE_URL}/wp-comments-post.php",method:"post",anchor:"comment-form"},isDefault:!1,innerBlocks:[["core/form-input",{type:"text",name:"author",label:(0,tt.__)("Name"),required:!0,visibilityPermissions:"logged-out"}],["core/form-input",{type:"email",name:"email",label:(0,tt.__)("Email"),required:!0,visibilityPermissions:"logged-out"}],["core/form-input",{type:"textarea",name:"comment",label:(0,tt.__)("Comment"),required:!0,visibilityPermissions:"all"}],["core/form-submit-button",{}]],scope:["inserter","transform"],isActive:e=>!e?.type||"text"===e?.type},{name:"wp-privacy-form",title:(0,tt.__)("Experimental privacy request form"),keywords:["GDPR"],description:(0,tt.__)("A form to request data exports and/or deletion."),attributes:{submissionMethod:"custom",action:"",method:"post",anchor:"gdpr-form"},isDefault:!1,innerBlocks:[Us,qs,["core/paragraph",{content:(0,tt.__)("To request an export or deletion of your personal data on this site, please fill-in the form below. You can define the type of request you wish to perform, and your email address. Once the form is submitted, you will receive a confirmation email with instructions on the next steps.")}],["core/form-input",{type:"email",name:"email",label:(0,tt.__)("Enter your email address."),required:!0,visibilityPermissions:"all"}],["core/form-input",{type:"checkbox",name:"export_personal_data",label:(0,tt.__)("Request data export"),required:!1,visibilityPermissions:"all"}],["core/form-input",{type:"checkbox",name:"remove_personal_data",label:(0,tt.__)("Request data deletion"),required:!1,visibilityPermissions:"all"}],["core/form-submit-button",{}],["core/form-input",{type:"hidden",name:"wp-action",value:"wp_privacy_send_request"}],["core/form-input",{type:"hidden",name:"wp-privacy-request",value:"1"}]],scope:["inserter","transform"],isActive:e=>!e?.type||"text"===e?.type}],Ks=Qs,Ys={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,__experimental:!0,name:"core/form",title:"Form",category:"common",allowedBlocks:["core/paragraph","core/heading","core/form-input","core/form-submit-button","core/form-submission-notification","core/group","core/columns"],description:"A form.",keywords:["container","wrapper","row","section"],textdomain:"default",icon:"feedback",attributes:{submissionMethod:{type:"string",default:"email"},method:{type:"string",default:"post"},action:{type:"string"},email:{type:"string"}},supports:{anchor:!0,className:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalTextDecoration:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalDefaultControls:{fontSize:!0}},__experimentalSelector:"form"},viewScript:"file:./view.min.js"},{name:Js}=Ys,Xs={edit:Ws,save:Zs,variations:Ks},ec=()=>{const e=["core/form"];return(0,_i.addFilter)("blockEditor.__unstableCanInsertBlockType","core/block-library/preventInsertingFormIntoAnotherForm",((t,n,a,{getBlock:o,getBlockParentsByBlockName:r})=>{if("core/form"!==n.name)return t;for(const t of e){if(o(a)?.name===t||r(a,t).length)return!1}return!0})),Xe({name:Js,metadata:Ys,settings:Xs})};var tc=n(9681),nc=n.n(tc);const ac=window.wp.dom,oc={attributes:{type:{type:"string",default:"text"},name:{type:"string"},label:{type:"string",default:"Label",selector:".wp-block-form-input__label-content",source:"html",__experimentalRole:"content"},inlineLabel:{type:"boolean",default:!1},required:{type:"boolean",default:!1,selector:".wp-block-form-input__input",source:"attribute",attribute:"required"},placeholder:{type:"string",selector:".wp-block-form-input__input",source:"attribute",attribute:"placeholder",__experimentalRole:"content"},value:{type:"string",default:"",selector:"input",source:"attribute",attribute:"value"},visibilityPermissions:{type:"string",default:"all"}},supports:{className:!1,anchor:!0,reusable:!1,spacing:{margin:["top","bottom"]},__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0,__experimentalDefaultControls:{radius:!0}}},save({attributes:e}){const{type:t,name:n,label:a,inlineLabel:o,required:r,placeholder:l,value:i}=e,s=(0,nt.__experimentalGetBorderClassesAndStyles)(e),c=(0,nt.__experimentalGetColorClassesAndStyles)(e),m={...s.style,...c.style},u=ut()("wp-block-form-input__input",c.className,s.className),p="textarea"===t?"textarea":"input";return"hidden"===t?(0,Ke.createElement)("input",{type:t,name:n,value:i}):(0,Ke.createElement)("label",{className:ut()("wp-block-form-input__label",{"is-label-inline":o})},(0,Ke.createElement)("span",{className:"wp-block-form-input__label-content"},(0,Ke.createElement)(nt.RichText.Content,{value:a})),(0,Ke.createElement)(p,{className:u,type:"textarea"===t?void 0:t,name:n||(d=a,nc()((0,ac.__unstableStripHTML)(d)).replace(/[^\p{L}\p{N}]+/gu,"-").toLowerCase().replace(/(^-+)|(-+$)/g,"")),required:r,"aria-required":r,placeholder:l||void 0,style:m}));var d}},rc=[oc];const lc=function({attributes:e,setAttributes:t,className:n}){const{type:a,name:o,label:r,inlineLabel:l,required:i,placeholder:s,value:c}=e,m=(0,nt.useBlockProps)(),u=(0,_t.useRef)(),p="textarea"===a?"textarea":"input",d=(0,nt.__experimentalUseBorderProps)(e),g=(0,nt.__experimentalUseColorProps)(e);u.current&&u.current.focus();const h=(0,Ke.createElement)(Ke.Fragment,null,"hidden"!==a&&(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Input settings")},"checkbox"!==a&&(0,Ke.createElement)(et.CheckboxControl,{label:(0,tt.__)("Inline label"),checked:l,onChange:e=>{t({inlineLabel:e})}}),(0,Ke.createElement)(et.CheckboxControl,{label:(0,tt.__)("Required"),checked:i,onChange:e=>{t({required:e})}}))),(0,Ke.createElement)(nt.InspectorControls,{group:"advanced"},(0,Ke.createElement)(et.TextControl,{autoComplete:"off",label:(0,tt.__)("Name"),value:o,onChange:e=>{t({name:e})},help:(0,tt.__)('Affects the "name" atribute of the input element, and is used as a name for the form submission results.')})));return"hidden"===a?(0,Ke.createElement)(Ke.Fragment,null,h,(0,Ke.createElement)("input",{type:"hidden",className:ut()(n,"wp-block-form-input__input",g.className,d.className),"aria-label":(0,tt.__)("Value"),value:c,onChange:e=>t({value:e.target.value})})):(0,Ke.createElement)("div",{...m},h,(0,Ke.createElement)("span",{className:ut()("wp-block-form-input__label",{"is-label-inline":l||"checkbox"===a})},(0,Ke.createElement)(nt.RichText,{tagName:"span",className:"wp-block-form-input__label-content",value:r,onChange:e=>t({label:e}),"aria-label":r?(0,tt.__)("Label"):(0,tt.__)("Empty label"),"data-empty":!r,placeholder:(0,tt.__)("Type the label for this input")}),(0,Ke.createElement)(p,{type:"textarea"===a?void 0:a,className:ut()(n,"wp-block-form-input__input",g.className,d.className),"aria-label":(0,tt.__)("Optional placeholder text"),placeholder:s?void 0:(0,tt.__)("Optional placeholder…"),value:s,onChange:e=>t({placeholder:e.target.value}),"aria-required":i,style:{...d.style,...g.style}})))};const ic=[{name:"text",title:(0,tt.__)("Text Input"),icon:"edit-page",description:(0,tt.__)("A generic text input."),attributes:{type:"text"},isDefault:!0,scope:["inserter","transform"],isActive:e=>!e?.type||"text"===e?.type},{name:"textarea",title:(0,tt.__)("Textarea Input"),icon:"testimonial",description:(0,tt.__)("A textarea input to allow entering multiple lines of text."),attributes:{type:"textarea"},isDefault:!0,scope:["inserter","transform"],isActive:e=>"textarea"===e?.type},{name:"checkbox",title:(0,tt.__)("Checkbox Input"),description:(0,tt.__)("A simple checkbox input."),icon:"forms",attributes:{type:"checkbox",inlineLabel:!0},isDefault:!0,scope:["inserter","transform"],isActive:e=>"checkbox"===e?.type},{name:"email",title:(0,tt.__)("Email Input"),icon:"email",description:(0,tt.__)("Used for email addresses."),attributes:{type:"email"},isDefault:!0,scope:["inserter","transform"],isActive:e=>"email"===e?.type},{name:"url",title:(0,tt.__)("URL Input"),icon:"admin-site",description:(0,tt.__)("Used for URLs."),attributes:{type:"url"},isDefault:!0,scope:["inserter","transform"],isActive:e=>"url"===e?.type},{name:"tel",title:(0,tt.__)("Telephone Input"),icon:"phone",description:(0,tt.__)("Used for phone numbers."),attributes:{type:"tel"},isDefault:!0,scope:["inserter","transform"],isActive:e=>"tel"===e?.type},{name:"number",title:(0,tt.__)("Number Input"),icon:"edit-page",description:(0,tt.__)("A numeric input."),attributes:{type:"number"},isDefault:!0,scope:["inserter","transform"],isActive:e=>"number"===e?.type}],sc=ic,cc={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,__experimental:!0,name:"core/form-input",title:"Input Field",category:"common",ancestor:["core/form"],description:"The basic building block for forms.",keywords:["input","form"],textdomain:"default",icon:"forms",attributes:{type:{type:"string",default:"text"},name:{type:"string"},label:{type:"rich-text",default:"Label",selector:".wp-block-form-input__label-content",source:"rich-text",__experimentalRole:"content"},inlineLabel:{type:"boolean",default:!1},required:{type:"boolean",default:!1,selector:".wp-block-form-input__input",source:"attribute",attribute:"required"},placeholder:{type:"string",selector:".wp-block-form-input__input",source:"attribute",attribute:"placeholder",__experimentalRole:"content"},value:{type:"string",default:"",selector:"input",source:"attribute",attribute:"value"},visibilityPermissions:{type:"string",default:"all"}},supports:{anchor:!0,reusable:!1,spacing:{margin:["top","bottom"]},__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0,__experimentalDefaultControls:{radius:!0}}},style:["wp-block-form-input"]},{name:mc}=cc,uc={deprecated:rc,edit:lc,save:function({attributes:e}){const{type:t,name:n,label:a,inlineLabel:o,required:r,placeholder:l,value:i}=e,s=(0,nt.__experimentalGetBorderClassesAndStyles)(e),c=(0,nt.__experimentalGetColorClassesAndStyles)(e),m={...s.style,...c.style},u=ut()("wp-block-form-input__input",c.className,s.className),p="textarea"===t?"textarea":"input",d=nt.useBlockProps.save();return"hidden"===t?(0,Ke.createElement)("input",{type:t,name:n,value:i}):(0,Ke.createElement)("div",{...d},(0,Ke.createElement)("label",{className:ut()("wp-block-form-input__label",{"is-label-inline":o})},(0,Ke.createElement)("span",{className:"wp-block-form-input__label-content"},(0,Ke.createElement)(nt.RichText.Content,{value:a})),(0,Ke.createElement)(p,{className:u,type:"textarea"===t?void 0:t,name:n||(g=a,nc()((0,ac.__unstableStripHTML)(g)).replace(/[^\p{L}\p{N}]+/gu,"-").toLowerCase().replace(/(^-+)|(-+$)/g,"")),required:r,"aria-required":r,placeholder:l||void 0,style:m})));var g},variations:sc},pc=()=>Xe({name:mc,metadata:cc,settings:uc}),dc=[["core/buttons",{},[["core/button",{text:(0,tt.__)("Submit"),tagName:"button",type:"submit"}]]]],gc=()=>{const e=(0,nt.useBlockProps)(),t=(0,nt.useInnerBlocksProps)(e,{template:dc,templateLock:"all"});return(0,Ke.createElement)("div",{className:"wp-block-form-submit-wrapper",...t})},hc=()=>{const e=nt.useBlockProps.save();return(0,Ke.createElement)("div",{className:"wp-block-form-submit-wrapper",...e},(0,Ke.createElement)(nt.InnerBlocks.Content,null))},bc={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,__experimental:!0,name:"core/form-submit-button",title:"Form Submit Button",category:"common",icon:"button",ancestor:["core/form"],allowedBlocks:["core/buttons","core/button"],description:"A submission button for forms.",keywords:["submit","button","form"],textdomain:"default",style:["wp-block-form-submit-button"]},{name:_c}=bc,yc={edit:gc,save:hc},vc=()=>Xe({name:_c,metadata:bc,settings:yc}),fc=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.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"})),kc=[["core/paragraph",{content:(0,tt.__)("Enter the message you wish displayed for form submission error/success, and select the type of the message (success/error) from the block's options.")}]],xc=({attributes:e,clientId:t})=>{const{type:n}=e,a=(0,nt.useBlockProps)({className:ut()("wp-block-form-submission-notification",{[`form-notification-type-${n}`]:n})}),{hasInnerBlocks:o}=(0,gt.useSelect)((e=>{const{getBlock:n}=e(nt.store),a=n(t);return{hasInnerBlocks:!(!a||!a.innerBlocks.length)}}),[t]),r=(0,nt.useInnerBlocksProps)(a,{template:kc,renderAppender:o?void 0:nt.InnerBlocks.ButtonBlockAppender});return(0,Ke.createElement)("div",{...r,"data-message-success":(0,tt.__)("Submission success notification"),"data-message-error":(0,tt.__)("Submission error notification")})};const wc=[{name:"form-submission-success",title:(0,tt.__)("Form Submission Success"),description:(0,tt.__)("Success message for form submissions."),attributes:{type:"success"},isDefault:!0,innerBlocks:[["core/paragraph",{content:(0,tt.__)("Your form has been submitted successfully."),backgroundColor:"#00D084",textColor:"#000000",style:{elements:{link:{color:{text:"#000000"}}}}}]],scope:["inserter","transform"],isActive:e=>!e?.type||"success"===e?.type},{name:"form-submission-error",title:(0,tt.__)("Form Submission Error"),description:(0,tt.__)("Error/failure message for form submissions."),attributes:{type:"error"},isDefault:!1,innerBlocks:[["core/paragraph",{content:(0,tt.__)("There was an error submitting your form."),backgroundColor:"#CF2E2E",textColor:"#FFFFFF",style:{elements:{link:{color:{text:"#FFFFFF"}}}}}]],scope:["inserter","transform"],isActive:e=>!e?.type||"error"===e?.type}],Ec=wc,Cc={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,__experimental:!0,name:"core/form-submission-notification",title:"Form Submission Notification",category:"common",ancestor:["core/form"],description:"Provide a notification message after the form has been submitted.",keywords:["form","feedback","notification","message"],textdomain:"default",icon:"feedback",attributes:{type:{type:"string",default:"success"}}},{name:Sc}=Cc,Bc={icon:fc,edit:xc,save:function({attributes:e}){const{type:t}=e;return(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save(nt.useBlockProps.save({className:ut()("wp-block-form-submission-notification",{[`form-notification-type-${t}`]:t})}))})},variations:Ec},Nc=()=>Xe({name:Sc,metadata:Cc,settings:Bc}),Tc=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M16.375 4.5H4.625a.125.125 0 0 0-.125.125v8.254l2.859-1.54a.75.75 0 0 1 .68-.016l2.384 1.142 2.89-2.074a.75.75 0 0 1 .874 0l2.313 1.66V4.625a.125.125 0 0 0-.125-.125Zm.125 9.398-2.75-1.975-2.813 2.02a.75.75 0 0 1-.76.067l-2.444-1.17L4.5 14.583v1.792c0 .069.056.125.125.125h11.75a.125.125 0 0 0 .125-.125v-2.477ZM4.625 3C3.728 3 3 3.728 3 4.625v11.75C3 17.273 3.728 18 4.625 18h11.75c.898 0 1.625-.727 1.625-1.625V4.625C18 3.728 17.273 3 16.375 3H4.625ZM20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z",fillRule:"evenodd",clipRule:"evenodd"})),Ic="none",Pc="media",Mc="attachment",zc="file",Rc="post";const Ac=(e,t="large")=>{const n=Object.fromEntries(Object.entries(null!=e?e:{}).filter((([e])=>["alt","id","link"].includes(e))));n.url=e?.sizes?.[t]?.url||e?.media_details?.sizes?.[t]?.source_url||e?.url||e?.source_url;const a=e?.sizes?.full?.url||e?.media_details?.sizes?.full?.source_url;return a&&(n.fullUrl=a),n};function Hc(){return!_t.Platform.isNative||function(){if(!window.wp||"boolean"!=typeof window.wp.galleryBlockV2Enabled)throw"window.wp.galleryBlockV2Enabled is not defined";return window.wp.galleryBlockV2Enabled}()}const Lc="file",Dc="post";function Fc(e){return Math.min(3,e?.images?.length)}function Vc(e,t){switch(t){case Lc:return{href:e?.source_url||e?.url,linkDestination:Pc};case Dc:return{href:e?.link,linkDestination:Mc};case Pc:return{href:e?.source_url||e?.url,linkDestination:Pc};case Mc:return{href:e?.link,linkDestination:Mc};case Ic:return{href:void 0,linkDestination:Ic}}return{}}function $c(e){let t=e.linkTo?e.linkTo:"none";"post"===t?t="attachment":"file"===t&&(t="media");const n=e.images.map((n=>function(e,t,n){return(0,Qe.createBlock)("core/image",{...e.id&&{id:parseInt(e.id)},url:e.url,alt:e.alt,caption:e.caption,sizeSlug:t,...Vc(e,n)})}(n,e.sizeSlug,t))),{images:a,ids:o,...r}=e;return[{...r,linkTo:t,allowResize:!1},n]}const Oc={attributes:{images:{type:"array",default:[],source:"query",selector:".blocks-gallery-item",query:{url:{type:"string",source:"attribute",selector:"img",attribute:"src"},fullUrl:{type:"string",source:"attribute",selector:"img",attribute:"data-full-url"},link:{type:"string",source:"attribute",selector:"img",attribute:"data-link"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},id:{type:"string",source:"attribute",selector:"img",attribute:"data-id"},caption:{type:"string",source:"html",selector:".blocks-gallery-item__caption"}}},ids:{type:"array",items:{type:"number"},default:[]},shortCodeTransforms:{type:"array",default:[],items:{type:"object"}},columns:{type:"number",minimum:1,maximum:8},caption:{type:"string",source:"html",selector:".blocks-gallery-caption"},imageCrop:{type:"boolean",default:!0},fixedHeight:{type:"boolean",default:!0},linkTarget:{type:"string"},linkTo:{type:"string"},sizeSlug:{type:"string",default:"large"},allowResize:{type:"boolean",default:!1}},save({attributes:e}){const{caption:t,columns:n,imageCrop:a}=e,o=ut()("has-nested-images",{[`columns-${n}`]:void 0!==n,"columns-default":void 0===n,"is-cropped":a}),r=nt.useBlockProps.save({className:o}),l=nt.useInnerBlocksProps.save(r);return(0,Ke.createElement)("figure",{...l},l.children,!nt.RichText.isEmpty(t)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",className:"blocks-gallery-caption",value:t}))}},Gc={attributes:{images:{type:"array",default:[],source:"query",selector:".blocks-gallery-item",query:{url:{type:"string",source:"attribute",selector:"img",attribute:"src"},fullUrl:{type:"string",source:"attribute",selector:"img",attribute:"data-full-url"},link:{type:"string",source:"attribute",selector:"img",attribute:"data-link"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},id:{type:"string",source:"attribute",selector:"img",attribute:"data-id"},caption:{type:"string",source:"html",selector:".blocks-gallery-item__caption"}}},ids:{type:"array",items:{type:"number"},default:[]},columns:{type:"number",minimum:1,maximum:8},caption:{type:"string",source:"html",selector:".blocks-gallery-caption"},imageCrop:{type:"boolean",default:!0},fixedHeight:{type:"boolean",default:!0},linkTo:{type:"string"},sizeSlug:{type:"string",default:"large"}},supports:{anchor:!0,align:!0},save({attributes:e}){const{images:t,columns:n=Fc(e),imageCrop:a,caption:o,linkTo:r}=e,l=`columns-${n} ${a?"is-cropped":""}`;return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:l})},(0,Ke.createElement)("ul",{className:"blocks-gallery-grid"},t.map((e=>{let t;switch(r){case Lc:t=e.fullUrl||e.url;break;case Dc:t=e.link}const n=(0,Ke.createElement)("img",{src:e.url,alt:e.alt,"data-id":e.id,"data-full-url":e.fullUrl,"data-link":e.link,className:e.id?`wp-image-${e.id}`:null});return(0,Ke.createElement)("li",{key:e.id||e.url,className:"blocks-gallery-item"},(0,Ke.createElement)("figure",null,t?(0,Ke.createElement)("a",{href:t},n):n,!nt.RichText.isEmpty(e.caption)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",className:"blocks-gallery-item__caption",value:e.caption})))}))),!nt.RichText.isEmpty(o)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",className:"blocks-gallery-caption",value:o}))},migrate:e=>Hc()?$c(e):e},Uc={attributes:{images:{type:"array",default:[],source:"query",selector:".blocks-gallery-item",query:{url:{type:"string",source:"attribute",selector:"img",attribute:"src"},fullUrl:{type:"string",source:"attribute",selector:"img",attribute:"data-full-url"},link:{type:"string",source:"attribute",selector:"img",attribute:"data-link"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},id:{type:"string",source:"attribute",selector:"img",attribute:"data-id"},caption:{type:"string",source:"html",selector:".blocks-gallery-item__caption"}}},ids:{type:"array",items:{type:"number"},default:[]},columns:{type:"number",minimum:1,maximum:8},caption:{type:"string",source:"html",selector:".blocks-gallery-caption"},imageCrop:{type:"boolean",default:!0},linkTo:{type:"string",default:"none"},sizeSlug:{type:"string",default:"large"}},supports:{align:!0},isEligible:({linkTo:e})=>!e||"attachment"===e||"media"===e,migrate(e){if(Hc())return $c(e);let t=e.linkTo;return e.linkTo?"attachment"===e.linkTo?t="post":"media"===e.linkTo&&(t="file"):t="none",{...e,linkTo:t}},save({attributes:e}){const{images:t,columns:n=Fc(e),imageCrop:a,caption:o,linkTo:r}=e;return(0,Ke.createElement)("figure",{className:`columns-${n} ${a?"is-cropped":""}`},(0,Ke.createElement)("ul",{className:"blocks-gallery-grid"},t.map((e=>{let t;switch(r){case"media":t=e.fullUrl||e.url;break;case"attachment":t=e.link}const n=(0,Ke.createElement)("img",{src:e.url,alt:e.alt,"data-id":e.id,"data-full-url":e.fullUrl,"data-link":e.link,className:e.id?`wp-image-${e.id}`:null});return(0,Ke.createElement)("li",{key:e.id||e.url,className:"blocks-gallery-item"},(0,Ke.createElement)("figure",null,t?(0,Ke.createElement)("a",{href:t},n):n,!nt.RichText.isEmpty(e.caption)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",className:"blocks-gallery-item__caption",value:e.caption})))}))),!nt.RichText.isEmpty(o)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",className:"blocks-gallery-caption",value:o}))}},qc={attributes:{images:{type:"array",default:[],source:"query",selector:".blocks-gallery-item",query:{url:{source:"attribute",selector:"img",attribute:"src"},fullUrl:{source:"attribute",selector:"img",attribute:"data-full-url"},link:{source:"attribute",selector:"img",attribute:"data-link"},alt:{source:"attribute",selector:"img",attribute:"alt",default:""},id:{source:"attribute",selector:"img",attribute:"data-id"},caption:{type:"string",source:"html",selector:".blocks-gallery-item__caption"}}},ids:{type:"array",default:[]},columns:{type:"number"},caption:{type:"string",source:"html",selector:".blocks-gallery-caption"},imageCrop:{type:"boolean",default:!0},linkTo:{type:"string",default:"none"}},supports:{align:!0},isEligible:({ids:e})=>e&&e.some((e=>"string"==typeof e)),migrate(e){var t;return Hc()?$c(e):{...e,ids:(null!==(t=e.ids)&&void 0!==t?t:[]).map((e=>{const t=parseInt(e,10);return Number.isInteger(t)?t:null}))}},save({attributes:e}){const{images:t,columns:n=Fc(e),imageCrop:a,caption:o,linkTo:r}=e;return(0,Ke.createElement)("figure",{className:`columns-${n} ${a?"is-cropped":""}`},(0,Ke.createElement)("ul",{className:"blocks-gallery-grid"},t.map((e=>{let t;switch(r){case"media":t=e.fullUrl||e.url;break;case"attachment":t=e.link}const n=(0,Ke.createElement)("img",{src:e.url,alt:e.alt,"data-id":e.id,"data-full-url":e.fullUrl,"data-link":e.link,className:e.id?`wp-image-${e.id}`:null});return(0,Ke.createElement)("li",{key:e.id||e.url,className:"blocks-gallery-item"},(0,Ke.createElement)("figure",null,t?(0,Ke.createElement)("a",{href:t},n):n,!nt.RichText.isEmpty(e.caption)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",className:"blocks-gallery-item__caption",value:e.caption})))}))),!nt.RichText.isEmpty(o)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",className:"blocks-gallery-caption",value:o}))}},jc={attributes:{images:{type:"array",default:[],source:"query",selector:"ul.wp-block-gallery .blocks-gallery-item",query:{url:{source:"attribute",selector:"img",attribute:"src"},fullUrl:{source:"attribute",selector:"img",attribute:"data-full-url"},alt:{source:"attribute",selector:"img",attribute:"alt",default:""},id:{source:"attribute",selector:"img",attribute:"data-id"},link:{source:"attribute",selector:"img",attribute:"data-link"},caption:{type:"string",source:"html",selector:"figcaption"}}},ids:{type:"array",default:[]},columns:{type:"number"},imageCrop:{type:"boolean",default:!0},linkTo:{type:"string",default:"none"}},supports:{align:!0},save({attributes:e}){const{images:t,columns:n=Fc(e),imageCrop:a,linkTo:o}=e;return(0,Ke.createElement)("ul",{className:`columns-${n} ${a?"is-cropped":""}`},t.map((e=>{let t;switch(o){case"media":t=e.fullUrl||e.url;break;case"attachment":t=e.link}const n=(0,Ke.createElement)("img",{src:e.url,alt:e.alt,"data-id":e.id,"data-full-url":e.fullUrl,"data-link":e.link,className:e.id?`wp-image-${e.id}`:null});return(0,Ke.createElement)("li",{key:e.id||e.url,className:"blocks-gallery-item"},(0,Ke.createElement)("figure",null,t?(0,Ke.createElement)("a",{href:t},n):n,e.caption&&e.caption.length>0&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:e.caption})))})))},migrate:e=>Hc()?$c(e):e},Wc={attributes:{images:{type:"array",default:[],source:"query",selector:"ul.wp-block-gallery .blocks-gallery-item",query:{url:{source:"attribute",selector:"img",attribute:"src"},alt:{source:"attribute",selector:"img",attribute:"alt",default:""},id:{source:"attribute",selector:"img",attribute:"data-id"},link:{source:"attribute",selector:"img",attribute:"data-link"},caption:{type:"string",source:"html",selector:"figcaption"}}},columns:{type:"number"},imageCrop:{type:"boolean",default:!0},linkTo:{type:"string",default:"none"}},isEligible:({images:e,ids:t})=>e&&e.length>0&&(!t&&e||t&&e&&t.length!==e.length||e.some(((e,n)=>!e&&null!==t[n]||parseInt(e,10)!==t[n]))),migrate(e){var t;return Hc()?$c(e):{...e,ids:(null!==(t=e.images)&&void 0!==t?t:[]).map((({id:e})=>e?parseInt(e,10):null))}},supports:{align:!0},save({attributes:e}){const{images:t,columns:n=Fc(e),imageCrop:a,linkTo:o}=e;return(0,Ke.createElement)("ul",{className:`columns-${n} ${a?"is-cropped":""}`},t.map((e=>{let t;switch(o){case"media":t=e.url;break;case"attachment":t=e.link}const n=(0,Ke.createElement)("img",{src:e.url,alt:e.alt,"data-id":e.id,"data-link":e.link,className:e.id?`wp-image-${e.id}`:null});return(0,Ke.createElement)("li",{key:e.id||e.url,className:"blocks-gallery-item"},(0,Ke.createElement)("figure",null,t?(0,Ke.createElement)("a",{href:t},n):n,e.caption&&e.caption.length>0&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:e.caption})))})))}},Zc={attributes:{images:{type:"array",default:[],source:"query",selector:"div.wp-block-gallery figure.blocks-gallery-image img",query:{url:{source:"attribute",attribute:"src"},alt:{source:"attribute",attribute:"alt",default:""},id:{source:"attribute",attribute:"data-id"}}},columns:{type:"number"},imageCrop:{type:"boolean",default:!0},linkTo:{type:"string",default:"none"},align:{type:"string",default:"none"}},supports:{align:!0},save({attributes:e}){const{images:t,columns:n=Fc(e),align:a,imageCrop:o,linkTo:r}=e,l=ut()(`columns-${n}`,{alignnone:"none"===a,"is-cropped":o});return(0,Ke.createElement)("div",{className:l},t.map((e=>{let t;switch(r){case"media":t=e.url;break;case"attachment":t=e.link}const n=(0,Ke.createElement)("img",{src:e.url,alt:e.alt,"data-id":e.id});return(0,Ke.createElement)("figure",{key:e.id||e.url,className:"blocks-gallery-image"},t?(0,Ke.createElement)("a",{href:t},n):n)})))},migrate:e=>Hc()?$c(e):e},Qc=[Oc,Gc,Uc,qc,jc,Wc,Zc],Kc=window.wp.viewport,Yc=(0,Ke.createElement)(nt.BlockIcon,{icon:Tc}),Jc=20,Xc="none",em="media",tm="attachment",nm="custom",am=["noreferrer","noopener"],om=["image"];function rm(e,t,n){switch(n||t){case zc:case Pc:return{href:e?.source_url||e?.url,linkDestination:em};case Rc:case Mc:return{href:e?.link,linkDestination:tm};case Ic:return{href:void 0,linkDestination:Xc}}return{}}function lm(e,{rel:t}){const n=e?"_blank":void 0;let a;return a=n||t?function(e){let t=e;return void 0!==e&&t&&(am.forEach((e=>{const n=new RegExp("\\b"+e+"\\b","gi");t=t.replace(n,"")})),t!==e&&(t=t.trim()),t||(t=void 0)),t}(t):void 0,{linkTarget:n,rel:a}}function im(e){const{attributes:t,isSelected:n,setAttributes:a,mediaPlaceholder:o,insertBlocksAfter:r,blockProps:l,__unstableLayoutClassNames:i,isContentLocked:s,multiGallerySelection:c}=e,{align:m,columns:u,imageCrop:p}=t;return(0,Ke.createElement)("figure",{...l,className:ut()(l.className,i,"blocks-gallery-grid",{[`align${m}`]:m,[`columns-${u}`]:void 0!==u,"columns-default":void 0===u,"is-cropped":p})},l.children,n&&!l.children&&(0,Ke.createElement)(Ye.View,{className:"blocks-gallery-media-placeholder-wrapper"},o),(0,Ke.createElement)(Qt,{attributes:t,setAttributes:a,isSelected:n,insertBlocksAfter:r,showToolbarButton:!c&&!s,className:"blocks-gallery-caption",label:(0,tt.__)("Gallery caption text"),placeholder:(0,tt.__)("Add gallery caption")}))}function sm(e,t,n){return(0,_t.useMemo)((()=>function(){if(!e||0===e.length)return;const{imageSizes:a}=n();let o={};t&&(o=e.reduce(((e,t)=>{if(!t.id)return e;const n=a.reduce(((e,n)=>{const a=t.sizes?.[n.slug]?.url,o=t.media_details?.sizes?.[n.slug]?.source_url;return{...e,[n.slug]:a||o}}),{});return{...e,[parseInt(t.id,10)]:n}}),{}));const r=Object.values(o);return a.filter((({slug:e})=>r.some((t=>t[e])))).map((({name:e,slug:t})=>({value:t,label:e})))}()),[e,t])}function cm(e,t){const[n,a]=(0,_t.useState)([]);return(0,_t.useMemo)((()=>function(){let o=!1;const r=n.filter((t=>e.find((e=>t.clientId===e.clientId))));r.length<n.length&&(o=!0);e.forEach((e=>{e.fromSavedContent&&!r.find((t=>t.id===e.id))&&(o=!0,r.push(e))}));const l=e.filter((e=>!r.find((t=>e.clientId&&t.clientId===e.clientId))&&t?.find((t=>t.id===e.id))&&!e.fromSavedConent));(o||l?.length>0)&&a([...r,...l]);return l.length>0?l:null}()),[e,t])}const mm=[];const{useStyleOverride:um}=Ft(nt.privateApis);function pm({blockGap:e,clientId:t}){const n="var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )";let a,o=n,r=n;e&&(a="string"==typeof e?(0,nt.__experimentalGetGapCSSValue)(e):(0,nt.__experimentalGetGapCSSValue)(e?.top)||n,r="string"==typeof e?(0,nt.__experimentalGetGapCSSValue)(e):(0,nt.__experimentalGetGapCSSValue)(e?.left)||n,o=a===r?a:`${a} ${r}`);return um({css:`#block-${t} {\n\t\t--wp--style--unstable-gallery-gap: ${"0"===r?"0px":r};\n\t\tgap: ${o}\n\t}`}),null}const dm=[{value:Mc,label:(0,tt.__)("Attachment Page")},{value:Pc,label:(0,tt.__)("Media File")},{value:Ic,label:(0,tt._x)("None","Media item link option")}],gm=["image"],hm=_t.Platform.isNative?(0,tt.__)("Add media"):(0,tt.__)("Drag images, upload new ones or select files from your library."),bm=_t.Platform.isNative?{type:"stepper"}:{},_m=[];const ym=(0,jt.compose)([(0,Kc.withViewportMatch)({isNarrow:"< small"})])((function(e){const{setAttributes:t,attributes:n,className:a,clientId:o,isSelected:r,insertBlocksAfter:l,isContentLocked:i,onFocus:s}=e,{columns:c,imageCrop:m,randomOrder:u,linkTarget:p,linkTo:d,sizeSlug:g}=n,{__unstableMarkNextChangeAsNotPersistent:h,replaceInnerBlocks:b,updateBlockAttributes:_,selectBlock:y}=(0,gt.useDispatch)(nt.store),{createSuccessNotice:v,createErrorNotice:f}=(0,gt.useDispatch)(Pt.store),{getBlock:k,getSettings:x,preferredStyle:w,innerBlockImages:E,blockWasJustInserted:C,multiGallerySelection:S}=(0,gt.useSelect)((e=>{var t;const{getBlockName:n,getMultiSelectedBlockClientIds:a,getSettings:r,getBlock:l,wasBlockJustInserted:i}=e(nt.store),s=r().__experimentalPreferredStyleVariations,c=a();return{getBlock:l,getSettings:r,preferredStyle:s?.value?.["core/image"],innerBlockImages:null!==(t=l(o)?.innerBlocks)&&void 0!==t?t:_m,blockWasJustInserted:i(o,"inserter_menu"),multiGallerySelection:c.length&&c.every((e=>"core/gallery"===n(e)))}}),[o]),B=(0,_t.useMemo)((()=>E?.map((e=>({clientId:e.clientId,id:e.attributes.id,url:e.attributes.url,attributes:e.attributes,fromSavedContent:Boolean(e.originalContent)})))),[E]),N=function(e){return(0,gt.useSelect)((t=>{var n;const a=e.map((e=>e.attributes.id)).filter((e=>void 0!==e));return 0===a.length?mm:null!==(n=t(dt.store).getMediaItems({include:a.join(","),per_page:-1,orderby:"include"}))&&void 0!==n?n:mm}),[e])}(E),T=cm(B,N);(0,_t.useEffect)((()=>{T?.forEach((e=>{h(),_(e.clientId,{...P(e.attributes),id:e.id,align:void 0})}))}),[T]);const I=sm(N,r,x);function P(e){const t=e.id?N.find((({id:t})=>t===e.id)):null;let a,o;return a=e.className&&""!==e.className?e.className:w?`is-style-${w}`:void 0,o=e.linkTarget||e.rel?{linkTarget:e.linkTarget,rel:e.rel}:lm(p,n),{...Ac(t,g),...rm(t,d,e?.linkDestination),...o,className:a,sizeSlug:g,caption:e.caption||t.caption?.raw,alt:e.alt||t.alt_text}}function M(e){const t=_t.Platform.isNative&&e.id?N.find((({id:t})=>t===e.id)):null,n=t?t?.media_type:e.type;return gm.some((e=>0===n?.indexOf(e)))||0===e.url?.indexOf("blob:")}function z(e){const t="[object FileList]"===Object.prototype.toString.call(e),n=t?Array.from(e).map((e=>e.url?e:Ac({url:(0,It.createBlobURL)(e)}))):e;n.every(M)||f((0,tt.__)("If uploading to a gallery all files need to be image formats"),{id:"gallery-upload-invalid-file",type:"snackbar"});const a=n.filter((e=>e.url||M(e))).map((e=>e.url?e:Ac({url:(0,It.createBlobURL)(e)}))),r=a.reduce(((e,t,n)=>(e[t.id]=n,e)),{}),l=t?E:E.filter((e=>a.find((t=>t.id===e.attributes.id)))),i=a.filter((e=>!l.find((t=>e.id===t.attributes.id)))).map((e=>(0,Qe.createBlock)("core/image",{id:e.id,url:e.url,caption:e.caption,alt:e.alt})));b(o,l.concat(i).sort(((e,t)=>r[e.attributes.id]-r[t.attributes.id]))),i?.length>0&&y(i[0].clientId)}(0,_t.useEffect)((()=>{d||(h(),t({linkTo:window?.wp?.media?.view?.settings?.defaultProps?.link||Ic}))}),[d]);const R=!!B.length,A=R&&B.some((e=>!!e.id)),H=B.some((e=>_t.Platform.isNative?0===e.url?.indexOf("file:"):!e.id&&0===e.url?.indexOf("blob:"))),L=_t.Platform.select({web:{addToGallery:!1,disableMediaButtons:H,value:{}},native:{addToGallery:A,isAppender:R,disableMediaButtons:R&&!r||H,value:A?B:{},autoOpenMediaUpload:!R&&r&&C,onFocus:s}}),D=(0,Ke.createElement)(nt.MediaPlaceholder,{handleUpload:!1,icon:Yc,labels:{title:(0,tt.__)("Gallery"),instructions:hm},onSelect:z,accept:"image/*",allowedTypes:gm,multiple:!0,onError:function(e){f(e,{type:"snackbar"})},...L}),F=(0,nt.useBlockProps)({className:ut()(a,"has-nested-images")}),V=_t.Platform.isNative&&{marginHorizontal:0,marginVertical:0},$=(0,nt.useInnerBlocksProps)(F,{orientation:"horizontal",renderAppender:!1,...V});if(!R)return(0,Ke.createElement)(Ye.View,{...$},$.children,D);const O=d&&"none"!==d;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},B.length>1&&(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Columns"),value:c||(G=B.length,G?Math.min(3,G):3),onChange:function(e){t({columns:e})},min:1,max:Math.min(8,B.length),...bm,required:!0,__next40pxDefaultSize:!0}),I?.length>0&&(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Resolution"),help:(0,tt.__)("Select the size of the source images."),value:g,options:I,onChange:function(e){t({sizeSlug:e});const n={},a=[];k(o).innerBlocks.forEach((t=>{a.push(t.clientId);const o=t.attributes.id?N.find((({id:e})=>e===t.attributes.id)):null;n[t.clientId]=function(e,t){const n=e?.media_details?.sizes?.[t]?.source_url;return n?{url:n,width:void 0,height:void 0,sizeSlug:t}:{}}(o,e)})),_(a,n,!0);const r=I.find((t=>t.value===e));v((0,tt.sprintf)((0,tt.__)("All gallery image sizes updated to: %s"),r.label),{id:"gallery-attributes-sizeSlug",type:"snackbar"})},hideCancelButton:!0,size:"__unstable-large"}),(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link to"),value:d,onChange:function(e){t({linkTo:e});const n={},a=[];k(o).innerBlocks.forEach((t=>{a.push(t.clientId);const o=t.attributes.id?N.find((({id:e})=>e===t.attributes.id)):null;n[t.clientId]=rm(o,e)})),_(a,n,!0);const r=[...dm].find((t=>t.value===e));v((0,tt.sprintf)((0,tt.__)("All gallery image links updated to: %s"),r.label),{id:"gallery-attributes-linkTo",type:"snackbar"})},options:dm,hideCancelButton:!0,size:"__unstable-large"}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Crop images to fit"),checked:!!m,onChange:function(){t({imageCrop:!m})}}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Randomize order"),checked:!!u,onChange:function(){t({randomOrder:!u})}}),O&&(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Open images in new tab"),checked:"_blank"===p,onChange:function(e){const n=e?"_blank":void 0;t({linkTarget:n});const a={},r=[];k(o).innerBlocks.forEach((e=>{r.push(e.clientId),a[e.clientId]=lm(n,e.attributes)})),_(r,a,!0);const l=e?(0,tt.__)("All gallery images updated to open in new tab"):(0,tt.__)("All gallery images updated to not open in new tab");v(l,{id:"gallery-attributes-openInNewTab",type:"snackbar"})}}),_t.Platform.isWeb&&!I&&A&&(0,Ke.createElement)(et.BaseControl,{className:"gallery-image-sizes"},(0,Ke.createElement)(et.BaseControl.VisualLabel,null,(0,tt.__)("Resolution")),(0,Ke.createElement)(Ye.View,{className:"gallery-image-sizes__loading"},(0,Ke.createElement)(et.Spinner,null),(0,tt.__)("Loading options…"))))),_t.Platform.isWeb&&(0,Ke.createElement)(Ke.Fragment,null,!S&&(0,Ke.createElement)(nt.BlockControls,{group:"other"},(0,Ke.createElement)(nt.MediaReplaceFlow,{allowedTypes:gm,accept:"image/*",handleUpload:!1,onSelect:z,name:(0,tt.__)("Add"),multiple:!0,mediaIds:B.filter((e=>e.id)).map((e=>e.id)),addToGallery:A})),(0,Ke.createElement)(pm,{blockGap:n.style?.spacing?.blockGap,clientId:o})),(0,Ke.createElement)(im,{...e,isContentLocked:i,images:B,mediaPlaceholder:!R||_t.Platform.isNative?D:void 0,blockProps:$,insertBlocksAfter:l,multiGallerySelection:S}));var G})),vm=(e,t="large")=>{const n=Object.fromEntries(Object.entries(null!=e?e:{}).filter((([e])=>["alt","id","link","caption"].includes(e))));n.url=e?.sizes?.[t]?.url||e?.media_details?.sizes?.[t]?.source_url||e?.url;const a=e?.sizes?.full?.url||e?.media_details?.sizes?.full?.source_url;return a&&(n.fullUrl=a),n},fm=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.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-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),km=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})),xm=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})),wm=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.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"})),Em="none",Cm="file",Sm="post";class Bm extends _t.Component{constructor(){super(...arguments),this.onSelectImage=this.onSelectImage.bind(this),this.onRemoveImage=this.onRemoveImage.bind(this),this.bindContainer=this.bindContainer.bind(this),this.onEdit=this.onEdit.bind(this),this.onSelectImageFromLibrary=this.onSelectImageFromLibrary.bind(this),this.onSelectCustomURL=this.onSelectCustomURL.bind(this),this.state={isEditing:!1}}bindContainer(e){this.container=e}onSelectImage(){this.props.isSelected||this.props.onSelect()}onRemoveImage(e){this.container===this.container.ownerDocument.activeElement&&this.props.isSelected&&-1!==[fn.BACKSPACE,fn.DELETE].indexOf(e.keyCode)&&(e.preventDefault(),this.props.onRemove())}onEdit(){this.setState({isEditing:!0})}componentDidUpdate(){const{image:e,url:t,__unstableMarkNextChangeAsNotPersistent:n}=this.props;e&&!t&&(n(),this.props.setAttributes({url:e.source_url,alt:e.alt_text}))}deselectOnBlur(){this.props.onDeselect()}onSelectImageFromLibrary(e){const{setAttributes:t,id:n,url:a,alt:o,caption:r,sizeSlug:l}=this.props;if(!e||!e.url)return;let i=vm(e,l);if(((e,t)=>!e&&(0,It.isBlobURL)(t))(n,a)&&o){const{alt:e,...t}=i;i=t}if(r&&!i.caption){const{caption:e,...t}=i;i=t}t(i),this.setState({isEditing:!1})}onSelectCustomURL(e){const{setAttributes:t,url:n}=this.props;e!==n&&(t({url:e,id:void 0}),this.setState({isEditing:!1}))}render(){const{url:e,alt:t,id:n,linkTo:a,link:o,isFirstItem:r,isLastItem:l,isSelected:i,caption:s,onRemove:c,onMoveForward:m,onMoveBackward:u,setAttributes:p,"aria-label":d}=this.props,{isEditing:g}=this.state;let h;switch(a){case Cm:h=e;break;case Sm:h=o}const b=(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("img",{src:e,alt:t,"data-id":n,onKeyDown:this.onRemoveImage,tabIndex:"0","aria-label":d,ref:this.bindContainer}),(0,It.isBlobURL)(e)&&(0,Ke.createElement)(et.Spinner,null)),_=ut()({"is-selected":i,"is-transient":(0,It.isBlobURL)(e)});return(0,Ke.createElement)("figure",{className:_,onClick:this.onSelectImage,onFocus:this.onSelectImage},!g&&(h?(0,Ke.createElement)("a",{href:h},b):b),g&&(0,Ke.createElement)(nt.MediaPlaceholder,{labels:{title:(0,tt.__)("Edit gallery image")},icon:fm,onSelect:this.onSelectImageFromLibrary,onSelectURL:this.onSelectCustomURL,accept:"image/*",allowedTypes:["image"],value:{id:n,src:e}}),(0,Ke.createElement)(et.ButtonGroup,{className:"block-library-gallery-item__inline-menu is-left"},(0,Ke.createElement)(et.Button,{icon:km,onClick:r?void 0:u,label:(0,tt.__)("Move image backward"),"aria-disabled":r,disabled:!i}),(0,Ke.createElement)(et.Button,{icon:xm,onClick:l?void 0:m,label:(0,tt.__)("Move image forward"),"aria-disabled":l,disabled:!i})),(0,Ke.createElement)(et.ButtonGroup,{className:"block-library-gallery-item__inline-menu is-right"},(0,Ke.createElement)(et.Button,{icon:Di,onClick:this.onEdit,label:(0,tt.__)("Replace image"),disabled:!i}),(0,Ke.createElement)(et.Button,{icon:wm,onClick:c,label:(0,tt.__)("Remove image"),disabled:!i})),!g&&(i||s)&&(0,Ke.createElement)(nt.RichText,{tagName:"figcaption",className:(0,nt.__experimentalGetElementClassName)("caption"),"aria-label":(0,tt.__)("Image caption text"),placeholder:i?(0,tt.__)("Add caption"):null,value:s,onChange:e=>p({caption:e}),inlineToolbar:!0}))}}const Nm=(0,jt.compose)([(0,gt.withSelect)(((e,t)=>{const{getMedia:n}=e(dt.store),{id:a}=t;return{image:a?n(parseInt(a,10)):null}})),(0,gt.withDispatch)((e=>{const{__unstableMarkNextChangeAsNotPersistent:t}=e(nt.store);return{__unstableMarkNextChangeAsNotPersistent:t}}))])(Bm);function Tm({isHidden:e,...t}){return e?(0,Ke.createElement)(et.VisuallyHidden,{as:nt.RichText,...t}):(0,Ke.createElement)(nt.RichText,{...t})}const Im=e=>{const{attributes:t,isSelected:n,setAttributes:a,selectedImage:o,mediaPlaceholder:r,onMoveBackward:l,onMoveForward:i,onRemoveImage:s,onSelectImage:c,onDeselectImage:m,onSetImageAttributes:u,insertBlocksAfter:p,blockProps:d}=e,{align:g,columns:h=Fc(t),caption:b,imageCrop:_,images:y}=t;return(0,Ke.createElement)("figure",{...d,className:ut()(d.className,{[`align${g}`]:g,[`columns-${h}`]:h,"is-cropped":_})},(0,Ke.createElement)("ul",{className:"blocks-gallery-grid"},y.map(((e,a)=>{const r=(0,tt.sprintf)((0,tt.__)("image %1$d of %2$d in gallery"),a+1,y.length);return(0,Ke.createElement)("li",{className:"blocks-gallery-item",key:e.id?`${e.id}-${a}`:e.url},(0,Ke.createElement)(Nm,{url:e.url,alt:e.alt,id:e.id,isFirstItem:0===a,isLastItem:a+1===y.length,isSelected:n&&o===a,onMoveBackward:l(a),onMoveForward:i(a),onRemove:s(a),onSelect:c(a),onDeselect:m(a),setAttributes:e=>u(a,e),caption:e.caption,"aria-label":r,sizeSlug:t.sizeSlug}))}))),r,(0,Ke.createElement)(Tm,{isHidden:!n&&nt.RichText.isEmpty(b),tagName:"figcaption",className:ut()("blocks-gallery-caption",(0,nt.__experimentalGetElementClassName)("caption")),"aria-label":(0,tt.__)("Gallery caption text"),placeholder:(0,tt.__)("Write gallery caption…"),value:b,onChange:e=>a({caption:e}),inlineToolbar:!0,__unstableOnSplitAtEnd:()=>p((0,Qe.createBlock)((0,Qe.getDefaultBlockName)()))}))},Pm=[{value:Sm,label:(0,tt.__)("Attachment Page")},{value:Cm,label:(0,tt.__)("Media File")},{value:Em,label:(0,tt.__)("None")}],Mm=["image"],zm=_t.Platform.select({web:(0,tt.__)("Drag images, upload new ones or select files from your library."),native:(0,tt.__)("ADD MEDIA")}),Rm=_t.Platform.select({web:{},native:{type:"stepper"}});const Am=(0,jt.compose)([et.withNotices,(0,Kc.withViewportMatch)({isNarrow:"< small"})])((function(e){const{attributes:t,clientId:n,isSelected:a,noticeUI:o,noticeOperations:r,onFocus:l}=e,{columns:i=Fc(t),imageCrop:s,images:c,linkTo:m,sizeSlug:u}=t,[p,d]=(0,_t.useState)(),[g,h]=(0,_t.useState)(),{__unstableMarkNextChangeAsNotPersistent:b}=(0,gt.useDispatch)(nt.store),{imageSizes:_,mediaUpload:y,getMedia:v,wasBlockJustInserted:f}=(0,gt.useSelect)((e=>{const t=e(nt.store).getSettings();return{imageSizes:t.imageSizes,mediaUpload:t.mediaUpload,getMedia:e(dt.store).getMedia,wasBlockJustInserted:e(nt.store).wasBlockJustInserted(n,"inserter_menu")}})),k=(0,_t.useMemo)((()=>{var e;return a?(null!==(e=t.ids)&&void 0!==e?e:[]).reduce(((e,t)=>{if(!t)return e;const n=v(t),a=_.reduce(((e,t)=>{const a=n?.sizes?.[t.slug]?.url,o=n?.media_details?.sizes?.[t.slug]?.source_url;return{...e,[t.slug]:a||o}}),{});return{...e,[parseInt(t,10)]:a}}),{}):{}}),[a,t.ids,_]);function x(t){if(t.ids)throw new Error('The "ids" attribute should not be changed directly. It is managed automatically when "images" attribute changes');t.images&&(t={...t,ids:t.images.map((({id:e})=>parseInt(e,10)))}),e.setAttributes(t)}function w(e,t){const n=[...c];n.splice(t,1,c[e]),n.splice(e,1,c[t]),d(t),x({images:n})}function E(e){const t=e.id.toString(),n=c.find((({id:e})=>e===t)),a=n?n.caption:e.caption;if(!g)return a;const o=g.find((({id:e})=>e===t));return o&&o.caption!==e.caption?e.caption:a}function C(e){h(e.map((e=>({id:e.id.toString(),caption:e.caption})))),x({images:e.map((e=>({...vm(e,u),caption:E(e),id:e.id.toString()}))),columns:t.columns?Math.min(e.length,t.columns):t.columns})}(0,_t.useEffect)((()=>{if("web"===_t.Platform.OS&&c&&c.length>0&&c.every((({url:e})=>(0,It.isBlobURL)(e)))){const e=c.map((({url:e})=>(0,It.getBlobByURL)(e)));c.forEach((({url:e})=>(0,It.revokeBlobURL)(e))),y({filesList:e,onFileChange:C,allowedTypes:["image"]})}}),[]),(0,_t.useEffect)((()=>{a||d()}),[a]),(0,_t.useEffect)((()=>{m||(b(),x({linkTo:window?.wp?.media?.view?.settings?.defaultProps?.link||Em}))}),[m]);const S=!!c.length,B=S&&c.some((e=>!!e.id)),N=(0,Ke.createElement)(nt.MediaPlaceholder,{addToGallery:B,isAppender:S,disableMediaButtons:S&&!a,icon:!S&&Yc,labels:{title:!S&&(0,tt.__)("Gallery"),instructions:!S&&zm},onSelect:C,accept:"image/*",allowedTypes:Mm,multiple:!0,value:B?c:{},onError:function(e){r.removeAllNotices(),r.createErrorNotice(e)},notices:S?void 0:o,onFocus:l,autoOpenMediaUpload:!S&&a&&f}),T=(0,nt.useBlockProps)();if(!S)return(0,Ke.createElement)(Ye.View,{...T},N);const I=function(){const e=Object.values(k);return _.filter((({slug:t})=>e.some((e=>e[t])))).map((({name:e,slug:t})=>({value:t,label:e})))}(),P=S&&I.length>0;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},c.length>1&&(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Columns"),value:i,onChange:function(e){x({columns:e})},min:1,max:Math.min(8,c.length),...Rm,required:!0}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Crop images"),checked:!!s,onChange:function(){x({imageCrop:!s})},help:function(e){return e?(0,tt.__)("Thumbnails are cropped to align."):(0,tt.__)("Thumbnails are not cropped.")}}),(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link to"),value:m,onChange:function(e){x({linkTo:e})},options:Pm,hideCancelButton:!0}),P&&(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Image size"),value:u,options:I,onChange:function(e){x({images:(null!=c?c:[]).map((t=>{if(!t.id)return t;const n=k[parseInt(t.id,10)]?.[e];return{...t,...n&&{url:n}}})),sizeSlug:e})},hideCancelButton:!0}))),o,(0,Ke.createElement)(Im,{...e,selectedImage:p,mediaPlaceholder:N,onMoveBackward:function(e){return()=>{0!==e&&w(e,e-1)}},onMoveForward:function(e){return()=>{e!==c.length-1&&w(e,e+1)}},onRemoveImage:function(e){return()=>{const n=c.filter(((t,n)=>e!==n));d(),x({images:n,columns:t.columns?Math.min(n.length,t.columns):t.columns})}},onSelectImage:function(e){return()=>{d(e)}},onDeselectImage:function(){return()=>{d()}},onSetImageAttributes:function(e,t){c[e]&&x({images:[...c.slice(0,e),{...c[e],...t},...c.slice(e+1)]})},blockProps:T,onFocusGalleryCaption:function(){d()}}))}));const Hm=(0,jt.compose)([et.withNotices])((function(e){return Hc()?(0,Ke.createElement)(ym,{...e}):(0,Ke.createElement)(Am,{...e})}));(0,_i.addFilter)("blocks.switchToBlockType.transformedBlock","core/gallery/update-third-party-transform-to",(function(e){if(Hc()&&"core/gallery"===e.name&&e.attributes?.images.length>0){const t=e.attributes.images.map((({url:t,id:n,alt:a})=>(0,Qe.createBlock)("core/image",{url:t,id:n?parseInt(n,10):null,alt:a,sizeSlug:e.attributes.sizeSlug,linkDestination:e.attributes.linkDestination})));delete e.attributes.ids,delete e.attributes.images,e.innerBlocks=t}return e})),(0,_i.addFilter)("blocks.switchToBlockType.transformedBlock","core/gallery/update-third-party-transform-from",(function(e,t){const n=(Array.isArray(t)?t:[t]).find((t=>"core/gallery"===t.name&&t.innerBlocks.length>0&&!t.attributes.images?.length>0&&!e.name.includes("core/")));if(n){const e=n.innerBlocks.map((({attributes:{url:e,id:t,alt:n}})=>({url:e,id:t?parseInt(t,10):null,alt:n}))),t=e.map((({id:e})=>e));n.attributes.images=e,n.attributes.ids=t}return e}));const Lm={from:[{type:"block",isMultiBlock:!0,blocks:["core/image"],transform:e=>{let{align:t,sizeSlug:n}=e[0];t=e.every((e=>e.align===t))?t:void 0,n=e.every((e=>e.sizeSlug===n))?n:void 0;const a=e.filter((({url:e})=>e));if(Hc()){const e=a.map((e=>(e.width=void 0,e.height=void 0,(0,Qe.createBlock)("core/image",e))));return(0,Qe.createBlock)("core/gallery",{align:t,sizeSlug:n},e)}return(0,Qe.createBlock)("core/gallery",{images:a.map((({id:e,url:t,alt:n,caption:a})=>({id:e.toString(),url:t,alt:n,caption:a}))),ids:a.map((({id:e})=>parseInt(e,10))),align:t,sizeSlug:n})}},{type:"shortcode",tag:"gallery",transform({named:{ids:e,columns:t=3,link:n,orderby:a}}){const o=(e=>e?e.split(",").map((e=>parseInt(e,10))):[])(e).map((e=>parseInt(e,10)));let r=Ic;"post"===n?r=Mc:"file"===n&&(r=Pc);return(0,Qe.createBlock)("core/gallery",{columns:parseInt(t,10),linkTo:r,randomOrder:"rand"===a},o.map((e=>(0,Qe.createBlock)("core/image",{id:e}))))},isMatch:({named:e})=>void 0!==e.ids},{type:"files",priority:1,isMatch:e=>1!==e.length&&e.every((e=>0===e.type.indexOf("image/"))),transform(e){if(Hc()){const t=e.map((e=>(0,Qe.createBlock)("core/image",{url:(0,It.createBlobURL)(e)})));return(0,Qe.createBlock)("core/gallery",{},t)}const t=(0,Qe.createBlock)("core/gallery",{images:e.map((e=>Ac({url:(0,It.createBlobURL)(e)})))});return t}}],to:[{type:"block",blocks:["core/image"],transform:({align:e,images:t,ids:n,sizeSlug:a},o)=>Hc()?o.length>0?o.map((({attributes:{url:t,alt:n,caption:a,title:o,href:r,rel:l,linkClass:i,id:s,sizeSlug:c,linkDestination:m,linkTarget:u,anchor:p,className:d}})=>(0,Qe.createBlock)("core/image",{align:e,url:t,alt:n,caption:a,title:o,href:r,rel:l,linkClass:i,id:s,sizeSlug:c,linkDestination:m,linkTarget:u,anchor:p,className:d}))):(0,Qe.createBlock)("core/image",{align:e}):t.length>0?t.map((({url:t,alt:o,caption:r},l)=>(0,Qe.createBlock)("core/image",{id:n[l],url:t,alt:o,caption:r,align:e,sizeSlug:a}))):(0,Qe.createBlock)("core/image",{align:e})}]},Dm=Lm,Fm={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/gallery",title:"Gallery",category:"media",allowedBlocks:["core/image"],description:"Display multiple images in a rich gallery.",keywords:["images","photos"],textdomain:"default",attributes:{images:{type:"array",default:[],source:"query",selector:".blocks-gallery-item",query:{url:{type:"string",source:"attribute",selector:"img",attribute:"src"},fullUrl:{type:"string",source:"attribute",selector:"img",attribute:"data-full-url"},link:{type:"string",source:"attribute",selector:"img",attribute:"data-link"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},id:{type:"string",source:"attribute",selector:"img",attribute:"data-id"},caption:{type:"rich-text",source:"rich-text",selector:".blocks-gallery-item__caption"}}},ids:{type:"array",items:{type:"number"},default:[]},shortCodeTransforms:{type:"array",items:{type:"object"},default:[]},columns:{type:"number",minimum:1,maximum:8},caption:{type:"rich-text",source:"rich-text",selector:".blocks-gallery-caption"},imageCrop:{type:"boolean",default:!0},randomOrder:{type:"boolean",default:!1},fixedHeight:{type:"boolean",default:!0},linkTarget:{type:"string"},linkTo:{type:"string"},sizeSlug:{type:"string",default:"large"},allowResize:{type:"boolean",default:!1}},providesContext:{allowResize:"allowResize",imageCrop:"imageCrop",fixedHeight:"fixedHeight"},supports:{anchor:!0,align:!0,html:!1,units:["px","em","rem","vh","vw"],spacing:{margin:!0,padding:!0,blockGap:["horizontal","vertical"],__experimentalSkipSerialization:["blockGap"],__experimentalDefaultControls:{blockGap:!0,margin:!1,padding:!1}},color:{text:!1,background:!0,gradients:!0},layout:{allowSwitching:!1,allowInheriting:!1,allowEditing:!1,default:{type:"flex"}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-gallery-editor",style:"wp-block-gallery"},{name:Vm}=Fm,$m={icon:Tc,example:{attributes:{columns:2},innerBlocks:[{name:"core/image",attributes:{url:"https://s.w.org/images/core/5.3/Glacial_lakes%2C_Bhutan.jpg"}},{name:"core/image",attributes:{url:"https://s.w.org/images/core/5.3/Sediment_off_the_Yucatan_Peninsula.jpg"}}]},transforms:Dm,edit:Hm,save:function({attributes:e}){if(!Hc())return function({attributes:e}){const{images:t,columns:n=Fc(e),imageCrop:a,caption:o,linkTo:r}=e,l=`columns-${n} ${a?"is-cropped":""}`;return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:l})},(0,Ke.createElement)("ul",{className:"blocks-gallery-grid"},t.map((e=>{let t;switch(r){case Cm:t=e.fullUrl||e.url;break;case Sm:t=e.link}const n=(0,Ke.createElement)("img",{src:e.url,alt:e.alt,"data-id":e.id,"data-full-url":e.fullUrl,"data-link":e.link,className:e.id?`wp-image-${e.id}`:null});return(0,Ke.createElement)("li",{key:e.id||e.url,className:"blocks-gallery-item"},(0,Ke.createElement)("figure",null,t?(0,Ke.createElement)("a",{href:t},n):n,!nt.RichText.isEmpty(e.caption)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",className:ut()("blocks-gallery-item__caption",(0,nt.__experimentalGetElementClassName)("caption")),value:e.caption})))}))),!nt.RichText.isEmpty(o)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",className:ut()("blocks-gallery-caption",(0,nt.__experimentalGetElementClassName)("caption")),value:o}))}({attributes:e});const{caption:t,columns:n,imageCrop:a}=e,o=ut()("has-nested-images",{[`columns-${n}`]:void 0!==n,"columns-default":void 0===n,"is-cropped":a}),r=nt.useBlockProps.save({className:o}),l=nt.useInnerBlocksProps.save(r);return(0,Ke.createElement)("figure",{...l},l.children,!nt.RichText.isEmpty(t)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",className:ut()("blocks-gallery-caption",(0,nt.__experimentalGetElementClassName)("caption")),value:t}))},deprecated:Qc},Om=()=>Xe({name:Vm,metadata:Fm,settings:$m}),Gm=e=>{if(e.tagName||(e={...e,tagName:"div"}),!e.customTextColor&&!e.customBackgroundColor)return e;const t={color:{}};e.customTextColor&&(t.color.text=e.customTextColor),e.customBackgroundColor&&(t.color.background=e.customBackgroundColor);const{customTextColor:n,customBackgroundColor:a,...o}=e;return{...o,style:t}},Um=[{attributes:{tagName:{type:"string",default:"div"},templateLock:{type:["string","boolean"],enum:["all","insert",!1]}},supports:{__experimentalOnEnter:!0,__experimentalSettings:!0,align:["wide","full"],anchor:!0,ariaLabel:!0,html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:["top","bottom"],padding:!0,blockGap:!0,__experimentalDefaultControls:{padding:!0,blockGap:!0}},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,radius:!0,style:!0,width:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalDefaultControls:{fontSize:!0}},layout:!0},save:({attributes:{tagName:e}})=>(0,Ke.createElement)(e,{...nt.useInnerBlocksProps.save(nt.useBlockProps.save())}),isEligible:({layout:e})=>!e||e.inherit||e.contentSize&&"constrained"!==e.type,migrate:e=>{const{layout:t=null}=e;return t?t.inherit||t.contentSize?{...e,layout:{...t,type:"constrained"}}:void 0:e}},{attributes:{tagName:{type:"string",default:"div"},templateLock:{type:["string","boolean"],enum:["all","insert",!1]}},supports:{align:["wide","full"],anchor:!0,color:{gradients:!0,link:!0},spacing:{padding:!0},__experimentalBorder:{radius:!0}},save({attributes:e}){const{tagName:t}=e;return(0,Ke.createElement)(t,{...nt.useBlockProps.save()},(0,Ke.createElement)("div",{className:"wp-block-group__inner-container"},(0,Ke.createElement)(nt.InnerBlocks.Content,null)))}},{attributes:{backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},textColor:{type:"string"},customTextColor:{type:"string"}},supports:{align:["wide","full"],anchor:!0,html:!1},migrate:Gm,save({attributes:e}){const{backgroundColor:t,customBackgroundColor:n,textColor:a,customTextColor:o}=e,r=(0,nt.getColorClassName)("background-color",t),l=(0,nt.getColorClassName)("color",a),i=ut()(r,l,{"has-text-color":a||o,"has-background":t||n}),s={backgroundColor:r?void 0:n,color:l?void 0:o};return(0,Ke.createElement)("div",{className:i,style:s},(0,Ke.createElement)("div",{className:"wp-block-group__inner-container"},(0,Ke.createElement)(nt.InnerBlocks.Content,null)))}},{attributes:{backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},textColor:{type:"string"},customTextColor:{type:"string"}},migrate:Gm,supports:{align:["wide","full"],anchor:!0,html:!1},save({attributes:e}){const{backgroundColor:t,customBackgroundColor:n,textColor:a,customTextColor:o}=e,r=(0,nt.getColorClassName)("background-color",t),l=(0,nt.getColorClassName)("color",a),i=ut()(r,{"has-text-color":a||o,"has-background":t||n}),s={backgroundColor:r?void 0:n,color:l?void 0:o};return(0,Ke.createElement)("div",{className:i,style:s},(0,Ke.createElement)("div",{className:"wp-block-group__inner-container"},(0,Ke.createElement)(nt.InnerBlocks.Content,null)))}},{attributes:{backgroundColor:{type:"string"},customBackgroundColor:{type:"string"}},supports:{align:["wide","full"],anchor:!0,html:!1},migrate:Gm,save({attributes:e}){const{backgroundColor:t,customBackgroundColor:n}=e,a=(0,nt.getColorClassName)("background-color",t),o=ut()(a,{"has-background":t||n}),r={backgroundColor:a?void 0:n};return(0,Ke.createElement)("div",{className:o,style:r},(0,Ke.createElement)(nt.InnerBlocks.Content,null))}}],qm=Um,jm=(e="group")=>{const t={group:(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"44",height:"32",viewBox:"0 0 44 32"},(0,Ke.createElement)(et.Path,{d:"M42 0H2C.9 0 0 .9 0 2v28c0 1.1.9 2 2 2h40c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2z"})),"group-row":(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"44",height:"32",viewBox:"0 0 44 32"},(0,Ke.createElement)(et.Path,{d:"M42 0H23.5c-.6 0-1 .4-1 1v30c0 .6.4 1 1 1H42c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zM20.5 0H2C.9 0 0 .9 0 2v28c0 1.1.9 2 2 2h18.5c.6 0 1-.4 1-1V1c0-.6-.4-1-1-1z"})),"group-stack":(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"44",height:"32",viewBox:"0 0 44 32"},(0,Ke.createElement)(et.Path,{d:"M42 0H2C.9 0 0 .9 0 2v12.5c0 .6.4 1 1 1h42c.6 0 1-.4 1-1V2c0-1.1-.9-2-2-2zm1 16.5H1c-.6 0-1 .4-1 1V30c0 1.1.9 2 2 2h40c1.1 0 2-.9 2-2V17.5c0-.6-.4-1-1-1z"})),"group-grid":(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"44",height:"32",viewBox:"0 0 44 32"},(0,Ke.createElement)(et.Path,{d:"m20.30137,-0.00025l-18.9728,0c-0.86524,0.07234 -1.41711,0.79149 -1.41711,1.89149l0,12.64468c0,0.6 0.73401,0.96383 1.0304,0.96383l19.67469,0.03617c0.29639,0 1.0304,-0.4 1.0304,-1l-0.03576,-12.7532c0,-1.1 -0.76644,-1.78297 -1.30983,-1.78297zm0.52975,16.60851l-19.99654,-0.03617c-0.29639,0 -0.92312,0.36383 -0.92312,0.96383l-0.03576,12.68085c0,1.1 0.8022,1.81915 1.34559,1.81915l19.00857,0c0.54339,0 1.45287,-0.71915 1.45287,-1.81915l0,-12.53617c0,-0.6 -0.5552,-1.07234 -0.8516,-1.07234z"}),(0,Ke.createElement)(et.Path,{d:"m42.73056,-0.03617l-18.59217,0c-0.84788,0.07234 -1.38868,0.79149 -1.38868,1.89149l0,12.64468c0,0.6 0.71928,0.96383 1.00973,0.96383l19.27997,0.03617c0.29045,0 1.00973,-0.4 1.00973,-1l-0.03504,-12.7532c0,-1.1 -0.75106,-1.78297 -1.28355,-1.78297zm0.51912,16.60851l-19.59537,-0.03617c-0.29045,0 -0.9046,0.36383 -0.9046,0.96383l-0.03504,12.68085c0,1.1 0.78611,1.81915 1.31859,1.81915l18.62721,0c0.53249,0 1.42372,-0.71915 1.42372,-1.81915l0,-12.53617c0,-0.6 -0.54407,-1.07234 -0.83451,-1.07234z"}))};return t?.[e]};const Wm=function({name:e,onSelect:t}){const n=(0,gt.useSelect)((t=>t(Qe.store).getBlockVariations(e,"block")),[e]),a=(0,nt.useBlockProps)({className:"wp-block-group__placeholder"});return(0,Ke.createElement)("div",{...a},(0,Ke.createElement)(et.Placeholder,{instructions:(0,tt.__)("Group blocks together. Select a layout:")},(0,Ke.createElement)("ul",{role:"list",className:"wp-block-group-placeholder__variations","aria-label":(0,tt.__)("Block variations")},n.map((e=>(0,Ke.createElement)("li",{key:e.name},(0,Ke.createElement)(et.Button,{variant:"tertiary",icon:jm(e.name),iconSize:44,onClick:()=>t(e),className:"wp-block-group-placeholder__variation-button",label:`${e.title}: ${e.description}`})))))))};function Zm({tagName:e,onSelectTagName:t}){const n={header:(0,tt.__)("The <header> element should represent introductory content, typically a group of introductory or navigational aids."),main:(0,tt.__)("The <main> element should be used for the primary content of your document only. "),section:(0,tt.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element."),article:(0,tt.__)("The <article> element should represent a self-contained, syndicatable portion of the document."),aside:(0,tt.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."),footer:(0,tt.__)("The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).")};return(0,Ke.createElement)(nt.InspectorControls,{group:"advanced"},(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("HTML element"),options:[{label:(0,tt.__)("Default (<div>)"),value:"div"},{label:"<header>",value:"header"},{label:"<main>",value:"main"},{label:"<section>",value:"section"},{label:"<article>",value:"article"},{label:"<aside>",value:"aside"},{label:"<footer>",value:"footer"}],value:e,onChange:t,help:n[e]}))}const Qm=function({attributes:e,name:t,setAttributes:n,clientId:a}){const{hasInnerBlocks:o,themeSupportsLayout:r}=(0,gt.useSelect)((e=>{const{getBlock:t,getSettings:n}=e(nt.store),o=t(a);return{hasInnerBlocks:!(!o||!o.innerBlocks.length),themeSupportsLayout:n()?.supportsLayout}}),[a]),{tagName:l="div",templateLock:i,allowedBlocks:s,layout:c={}}=e,{type:m="default"}=c,u=r||"flex"===m||"grid"===m,p=(0,_t.useRef)(),d=(0,nt.useBlockProps)({ref:p}),[g,h]=function({attributes:e={style:void 0,backgroundColor:void 0,textColor:void 0,fontSize:void 0},usedLayoutType:t="",hasInnerBlocks:n=!1}){const{style:a,backgroundColor:o,textColor:r,fontSize:l}=e,[i,s]=(0,_t.useState)(!(n||o||l||r||a||"flex"===t||"grid"===t));return(0,_t.useEffect)((()=>{(n||o||l||r||a||"flex"===t)&&s(!1)}),[o,l,r,a,t,n]),[i,s]}({attributes:e,usedLayoutType:m,hasInnerBlocks:o});let b;g?b=!1:o||(b=nt.InnerBlocks.ButtonBlockAppender);const _=(0,nt.useInnerBlocksProps)(u?d:{className:"wp-block-group__inner-container"},{dropZoneElement:p.current,templateLock:i,allowedBlocks:s,renderAppender:b}),{selectBlock:y}=(0,gt.useDispatch)(nt.store);return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(Zm,{tagName:l,onSelectTagName:e=>n({tagName:e})}),g&&(0,Ke.createElement)(Ye.View,null,_.children,(0,Ke.createElement)(Wm,{name:t,onSelect:e=>{n(e.attributes),y(a,-1),h(!1)}})),u&&!g&&(0,Ke.createElement)(l,{..._}),!u&&!g&&(0,Ke.createElement)(l,{...d},(0,Ke.createElement)("div",{..._})))};const Km={from:[{type:"block",isMultiBlock:!0,blocks:["*"],__experimentalConvert(e){const t=["wide","full"],n=e.reduce(((e,n)=>{const{align:a}=n.attributes;return t.indexOf(a)>t.indexOf(e)?a:e}),void 0),a=e.map((e=>(0,Qe.createBlock)(e.name,e.attributes,e.innerBlocks)));return(0,Qe.createBlock)("core/group",{align:n,layout:{type:"constrained"}},a)}}]},Ym=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M4 6.5h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4V16h5a.5.5 0 0 0 .5-.5v-7A.5.5 0 0 0 9 8H4V6.5Zm16 0h-5a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h5V16h-5a.5.5 0 0 1-.5-.5v-7A.5.5 0 0 1 15 8h5V6.5Z"})),Jm=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M17.5 4v5a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V4H8v5a.5.5 0 0 0 .5.5h7A.5.5 0 0 0 16 9V4h1.5Zm0 16v-5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v5H8v-5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v5h1.5Z"})),Xm=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z",fillRule:"evenodd",clipRule:"evenodd"})),eu=[{name:"group",title:(0,tt.__)("Group"),description:(0,tt.__)("Gather blocks in a container."),attributes:{layout:{type:"constrained"}},isDefault:!0,scope:["block","inserter","transform"],isActive:e=>!e.layout||!e.layout?.type||"default"===e.layout?.type||"constrained"===e.layout?.type,icon:fc},{name:"group-row",title:(0,tt._x)("Row","single horizontal line"),description:(0,tt.__)("Arrange blocks horizontally."),attributes:{layout:{type:"flex",flexWrap:"nowrap"}},scope:["block","inserter","transform"],isActive:e=>"flex"===e.layout?.type&&(!e.layout?.orientation||"horizontal"===e.layout?.orientation),icon:Ym},{name:"group-stack",title:(0,tt.__)("Stack"),description:(0,tt.__)("Arrange blocks vertically."),attributes:{layout:{type:"flex",orientation:"vertical"}},scope:["block","inserter","transform"],isActive:e=>"flex"===e.layout?.type&&"vertical"===e.layout?.orientation,icon:Jm}];window?.__experimentalEnableGroupGridVariation&&eu.push({name:"group-grid",title:(0,tt.__)("Grid"),description:(0,tt.__)("Arrange blocks in a grid."),attributes:{layout:{type:"grid"}},scope:["block","inserter","transform"],isActive:e=>"grid"===e.layout?.type,icon:Xm});const tu=eu,nu={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/group",title:"Group",category:"design",description:"Gather blocks in a layout container.",keywords:["container","wrapper","row","section"],textdomain:"default",attributes:{tagName:{type:"string",default:"div"},templateLock:{type:["string","boolean"],enum:["all","insert","contentOnly",!1]},allowedBlocks:{type:"array"}},supports:{__experimentalOnEnter:!0,__experimentalOnMerge:!0,__experimentalSettings:!0,align:["wide","full"],anchor:!0,ariaLabel:!0,html:!1,background:{backgroundImage:!0,backgroundSize:!0,__experimentalDefaultControls:{backgroundImage:!0}},color:{gradients:!0,heading:!0,button:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:["top","bottom"],padding:!0,blockGap:!0,__experimentalDefaultControls:{padding:!0,blockGap:!0}},dimensions:{minHeight:!0},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,radius:!0,style:!0,width:!0}},position:{sticky:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},layout:{allowSizingOnChildren:!0},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-group-editor",style:"wp-block-group"},{name:au}=nu,ou={icon:fc,example:{attributes:{style:{color:{text:"#000000",background:"#ffffff"}}},innerBlocks:[{name:"core/paragraph",attributes:{customTextColor:"#cf2e2e",fontSize:"large",content:(0,tt.__)("One.")}},{name:"core/paragraph",attributes:{customTextColor:"#ff6900",fontSize:"large",content:(0,tt.__)("Two.")}},{name:"core/paragraph",attributes:{customTextColor:"#fcb900",fontSize:"large",content:(0,tt.__)("Three.")}},{name:"core/paragraph",attributes:{customTextColor:"#00d084",fontSize:"large",content:(0,tt.__)("Four.")}},{name:"core/paragraph",attributes:{customTextColor:"#0693e3",fontSize:"large",content:(0,tt.__)("Five.")}},{name:"core/paragraph",attributes:{customTextColor:"#9b51e0",fontSize:"large",content:(0,tt.__)("Six.")}}]},transforms:Km,edit:Qm,save:function({attributes:{tagName:e}}){return(0,Ke.createElement)(e,{...nt.useInnerBlocksProps.save(nt.useBlockProps.save())})},deprecated:qm,variations:tu},ru=()=>Xe({name:au,metadata:nu,settings:ou}),lu=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M6 5V18.5911L12 13.8473L18 18.5911V5H6Z"})),iu={className:!1,anchor:!0},su={align:{type:"string"},content:{type:"string",source:"html",selector:"h1,h2,h3,h4,h5,h6",default:""},level:{type:"number",default:2},placeholder:{type:"string"}},cu=e=>{if(!e.customTextColor)return e;const t={color:{text:e.customTextColor}},{customTextColor:n,...a}=e;return{...a,style:t}},mu=["left","right","center"],uu=e=>{const{align:t,...n}=e;return mu.includes(t)?{...n,textAlign:t}:e},pu={supports:iu,attributes:{...su,customTextColor:{type:"string"},textColor:{type:"string"}},migrate:e=>cu(uu(e)),save({attributes:e}){const{align:t,level:n,content:a,textColor:o,customTextColor:r}=e,l="h"+n,i=(0,nt.getColorClassName)("color",o),s=ut()({[i]:i});return(0,Ke.createElement)(nt.RichText.Content,{className:s||void 0,tagName:l,style:{textAlign:t,color:i?void 0:r},value:a})}},du={attributes:{...su,customTextColor:{type:"string"},textColor:{type:"string"}},migrate:e=>cu(uu(e)),save({attributes:e}){const{align:t,content:n,customTextColor:a,level:o,textColor:r}=e,l="h"+o,i=(0,nt.getColorClassName)("color",r),s=ut()({[i]:i,[`has-text-align-${t}`]:t});return(0,Ke.createElement)(nt.RichText.Content,{className:s||void 0,tagName:l,style:{color:i?void 0:a},value:n})},supports:iu},gu={supports:iu,attributes:{...su,customTextColor:{type:"string"},textColor:{type:"string"}},migrate:e=>cu(uu(e)),save({attributes:e}){const{align:t,content:n,customTextColor:a,level:o,textColor:r}=e,l="h"+o,i=(0,nt.getColorClassName)("color",r),s=ut()({[i]:i,"has-text-color":r||a,[`has-text-align-${t}`]:t});return(0,Ke.createElement)(nt.RichText.Content,{className:s||void 0,tagName:l,style:{color:i?void 0:a},value:n})}},hu={supports:{align:["wide","full"],anchor:!0,className:!1,color:{link:!0},fontSize:!0,lineHeight:!0,__experimentalSelector:{"core/heading/h1":"h1","core/heading/h2":"h2","core/heading/h3":"h3","core/heading/h4":"h4","core/heading/h5":"h5","core/heading/h6":"h6"},__unstablePasteTextInline:!0},attributes:su,isEligible:({align:e})=>mu.includes(e),migrate:uu,save({attributes:e}){const{align:t,content:n,level:a}=e,o="h"+a,r=ut()({[`has-text-align-${t}`]:t});return(0,Ke.createElement)(o,{...nt.useBlockProps.save({className:r})},(0,Ke.createElement)(nt.RichText.Content,{value:n}))}},bu={supports:{align:["wide","full"],anchor:!0,className:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalDefaultControls:{fontSize:!0,fontAppearance:!0,textTransform:!0}},__experimentalSelector:"h1,h2,h3,h4,h5,h6",__unstablePasteTextInline:!0,__experimentalSlashInserter:!0},attributes:{textAlign:{type:"string"},content:{type:"string",source:"html",selector:"h1,h2,h3,h4,h5,h6",default:"",__experimentalRole:"content"},level:{type:"number",default:2},placeholder:{type:"string"}},save({attributes:e}){const{textAlign:t,content:n,level:a}=e,o="h"+a,r=ut()({[`has-text-align-${t}`]:t});return(0,Ke.createElement)(o,{...nt.useBlockProps.save({className:r})},(0,Ke.createElement)(nt.RichText.Content,{value:n}))}},_u=[bu,hu,gu,du,pu],yu={},vu=e=>nc()((e=>{const t=document.createElement("div");return t.innerHTML=e,t.innerText})(e)).replace(/[^\p{L}\p{N}]+/gu,"-").toLowerCase().replace(/(^-+)|(-+$)/g,""),fu=(e,t)=>{const n=vu(t);if(""===n)return null;delete yu[e];let a=n,o=0;for(;Object.values(yu).includes(a);)o+=1,a=n+"-"+o;return a},ku=(e,t)=>{yu[e]=t};const xu=function({attributes:e,setAttributes:t,mergeBlocks:n,onReplace:a,style:o,clientId:r}){const{textAlign:l,content:i,level:s,placeholder:c,anchor:m}=e,u="h"+s,p=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${l}`]:l}),style:o}),d=(0,nt.useBlockEditingMode)(),{canGenerateAnchors:g}=(0,gt.useSelect)((e=>{const{getGlobalBlockCount:t,getSettings:n}=e(nt.store);return{canGenerateAnchors:!!n().generateAnchors||t("core/table-of-contents")>0}}),[]),{__unstableMarkNextChangeAsNotPersistent:h}=(0,gt.useDispatch)(nt.store);return(0,_t.useEffect)((()=>{if(g)return!m&&i&&(h(),t({anchor:fu(r,i)})),ku(r,m),()=>ku(r,null)}),[m,i,r,g]),(0,Ke.createElement)(Ke.Fragment,null,"default"===d&&(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.HeadingLevelDropdown,{value:s,onChange:e=>t({level:e})}),(0,Ke.createElement)(nt.AlignmentControl,{value:l,onChange:e=>{t({textAlign:e})}})),(0,Ke.createElement)(nt.RichText,{identifier:"content",tagName:u,value:i,onChange:e=>{const n={content:e};!g||m&&e&&fu(r,i)!==m||(n.anchor=fu(r,e)),t(n)},onMerge:n,onSplit:(t,n)=>{let a;var o;n||t?a=(0,Qe.createBlock)("core/heading",{...e,content:t}):a=(0,Qe.createBlock)(null!==(o=(0,Qe.getDefaultBlockName)())&&void 0!==o?o:"core/heading");return n&&(a.clientId=r),a},onReplace:a,onRemove:()=>a([]),placeholder:c||(0,tt.__)("Heading"),textAlign:l,..._t.Platform.isNative&&{deleteEnter:!0},...p}))};const wu={from:[{type:"block",isMultiBlock:!0,blocks:["core/paragraph"],transform:e=>e.map((({content:e,anchor:t,align:n,metadata:a})=>(0,Qe.createBlock)("core/heading",{content:e,anchor:t,textAlign:n,metadata:An(a,"core/heading",(({content:e})=>({content:e})))})))},{type:"raw",selector:"h1,h2,h3,h4,h5,h6",schema:({phrasingContentSchema:e,isPaste:t})=>{const n={children:e,attributes:t?[]:["style","id"]};return{h1:n,h2:n,h3:n,h4:n,h5:n,h6:n}},transform(e){const t=(0,Qe.getBlockAttributes)("core/heading",e.outerHTML),{textAlign:n}=e.style||{};var a;return t.level=(a=e.nodeName,Number(a.substr(1))),"left"!==n&&"center"!==n&&"right"!==n||(t.align=n),(0,Qe.createBlock)("core/heading",t)}},...[1,2,3,4,5,6].map((e=>({type:"prefix",prefix:Array(e+1).join("#"),transform:t=>(0,Qe.createBlock)("core/heading",{level:e,content:t})}))),...[1,2,3,4,5,6].map((e=>({type:"enter",regExp:new RegExp(`^/(h|H)${e}$`),transform:()=>(0,Qe.createBlock)("core/heading",{level:e})})))],to:[{type:"block",isMultiBlock:!0,blocks:["core/paragraph"],transform:e=>e.map((({content:e,textAlign:t,metadata:n})=>(0,Qe.createBlock)("core/paragraph",{content:e,align:t,metadata:An(n,"core/paragraph",(({content:e})=>({content:e})))})))}]},Eu=wu,Cu={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/heading",title:"Heading",category:"text",description:"Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.",keywords:["title","subtitle"],textdomain:"default",attributes:{textAlign:{type:"string"},content:{type:"rich-text",source:"rich-text",selector:"h1,h2,h3,h4,h5,h6",__experimentalRole:"content"},level:{type:"number",default:2},placeholder:{type:"string"}},supports:{align:["wide","full"],anchor:!0,className:!0,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalWritingMode:!0,__experimentalDefaultControls:{fontSize:!0}},__unstablePasteTextInline:!0,__experimentalSlashInserter:!0,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-heading-editor",style:"wp-block-heading"},{name:Su}=Cu,Bu={icon:lu,example:{attributes:{content:(0,tt.__)("Code is Poetry"),level:2}},__experimentalLabel(e,{context:t}){const{content:n,level:a}=e,o=e?.metadata?.name,r=n?.length>0;return"list-view"===t&&(o||r)?o||n:"accessibility"===t?r?(0,tt.sprintf)((0,tt.__)("Level %1$s. %2$s"),a,n):(0,tt.sprintf)((0,tt.__)("Level %s. Empty."),a):void 0},transforms:Eu,deprecated:_u,merge:(e,t)=>({content:(e.content||"")+(t.content||"")}),edit:xu,save:function({attributes:e}){const{textAlign:t,content:n,level:a}=e,o="h"+a,r=ut()({[`has-text-align-${t}`]:t});return(0,Ke.createElement)(o,{...nt.useBlockProps.save({className:r})},(0,Ke.createElement)(nt.RichText.Content,{value:n}))}},Nu=()=>Xe({name:Su,metadata:Cu,settings:Bu}),Tu=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"})),Iu=e=>e.preventDefault();const Pu={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/home-link",category:"design",parent:["core/navigation"],title:"Home Link",description:"Create a link that always points to the homepage of the site. Usually not necessary if there is already a site title link present in the header.",textdomain:"default",attributes:{label:{type:"string"}},usesContext:["textColor","customTextColor","backgroundColor","customBackgroundColor","fontSize","customFontSize","style"],supports:{reusable:!1,html:!1,typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-home-link-editor",style:"wp-block-home-link"},{name:Mu}=Pu,zu={icon:Tu,edit:function({attributes:e,setAttributes:t,context:n}){const{homeUrl:a}=(0,gt.useSelect)((e=>{const{getUnstableBase:t}=e(dt.store);return{homeUrl:t()?.home}}),[]),{__unstableMarkNextChangeAsNotPersistent:o}=(0,gt.useDispatch)(nt.store),{textColor:r,backgroundColor:l,style:i}=n,s=(0,nt.useBlockProps)({className:ut()("wp-block-navigation-item",{"has-text-color":!!r||!!i?.color?.text,[`has-${r}-color`]:!!r,"has-background":!!l||!!i?.color?.background,[`has-${l}-background-color`]:!!l}),style:{color:i?.color?.text,backgroundColor:i?.color?.background}}),{label:c}=e;return(0,_t.useEffect)((()=>{void 0===c&&(o(),t({label:(0,tt.__)("Home")}))}),[c]),(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("div",{...s},(0,Ke.createElement)("a",{className:"wp-block-home-link__content wp-block-navigation-item__content",href:a,onClick:Iu},(0,Ke.createElement)(nt.RichText,{identifier:"label",className:"wp-block-home-link__label",value:c,onChange:e=>{t({label:e})},"aria-label":(0,tt.__)("Home link text"),placeholder:(0,tt.__)("Add home link"),withoutInteractiveFormatting:!0,allowedFormats:["core/bold","core/italic","core/image","core/strikethrough"]}))))},save:function(){return(0,Ke.createElement)(nt.InnerBlocks.Content,null)},example:{attributes:{label:(0,tt._x)("Home Link","block example")}}},Ru=()=>Xe({name:Mu,metadata:Pu,settings:zu}),Au=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M4.8 11.4H2.1V9H1v6h1.1v-2.6h2.7V15h1.1V9H4.8v2.4zm1.9-1.3h1.7V15h1.1v-4.9h1.7V9H6.7v1.1zM16.2 9l-1.5 2.7L13.3 9h-.9l-.8 6h1.1l.5-4 1.5 2.8 1.5-2.8.5 4h1.1L17 9h-.8zm3.8 5V9h-1.1v6h3.6v-1H20z"})),Hu="\n\thtml,body,:root {\n\t\tmargin: 0 !important;\n\t\tpadding: 0 !important;\n\t\toverflow: visible !important;\n\t\tmin-height: auto !important;\n\t}\n";function Lu({content:e,isSelected:t}){const n=(0,gt.useSelect)((e=>e(nt.store).getSettings().styles)),a=(0,_t.useMemo)((()=>[Hu,...(0,nt.transformStyles)(n.filter((e=>e.css)))]),[n]);return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.SandBox,{html:e,styles:a,title:(0,tt.__)("Custom HTML Preview"),tabIndex:-1}),!t&&(0,Ke.createElement)("div",{className:"block-library-html__preview-overlay"}))}const Du={from:[{type:"block",blocks:["core/code"],transform:({content:e})=>(0,Qe.createBlock)("core/html",{content:(0,Rn.create)({html:e}).text})}]},Fu=Du,Vu={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/html",title:"Custom HTML",category:"widgets",description:"Add custom HTML code and preview it as you edit.",keywords:["embed"],textdomain:"default",attributes:{content:{type:"string",source:"raw"}},supports:{customClassName:!1,className:!1,html:!1,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-html-editor"},{name:$u}=Vu,Ou={icon:Au,example:{attributes:{content:"<marquee>"+(0,tt.__)("Welcome to the wonderful world of blocks…")+"</marquee>"}},edit:function e({attributes:t,setAttributes:n,isSelected:a}){const[o,r]=(0,_t.useState)(),l=(0,_t.useContext)(et.Disabled.Context),i=(0,jt.useInstanceId)(e,"html-edit-desc"),s=(0,nt.useBlockProps)({className:"block-library-html__edit","aria-describedby":o?i:void 0});return(0,Ke.createElement)("div",{...s},(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,null,(0,Ke.createElement)(et.ToolbarButton,{className:"components-tab-button",isPressed:!o,onClick:function(){r(!1)}},"HTML"),(0,Ke.createElement)(et.ToolbarButton,{className:"components-tab-button",isPressed:o,onClick:function(){r(!0)}},(0,tt.__)("Preview")))),o||l?(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(Lu,{content:t.content,isSelected:a}),(0,Ke.createElement)(et.VisuallyHidden,{id:i},(0,tt.__)("HTML preview is not yet fully accessible. Please switch screen reader to virtualized mode to navigate the below iFrame."))):(0,Ke.createElement)(nt.PlainText,{value:t.content,onChange:e=>n({content:e}),placeholder:(0,tt.__)("Write HTML…"),"aria-label":(0,tt.__)("HTML")}))},save:function({attributes:e}){return(0,Ke.createElement)(_t.RawHTML,null,e.content)},transforms:Fu},Gu=()=>Xe({name:$u,metadata:Vu,settings:Ou}),Uu={attributes:{url:{type:"string",source:"attribute",selector:"img",attribute:"src"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},caption:{type:"array",source:"children",selector:"figcaption"},href:{type:"string",source:"attribute",selector:"a",attribute:"href"},id:{type:"number"},align:{type:"string"},width:{type:"number"},height:{type:"number"}},save({attributes:e}){const{url:t,alt:n,caption:a,align:o,href:r,width:l,height:i}=e,s=l||i?{width:l,height:i}:{},c=(0,Ke.createElement)("img",{src:t,alt:n,...s});let m={};return l?m={width:l}:"left"!==o&&"right"!==o||(m={maxWidth:"50%"}),(0,Ke.createElement)("figure",{className:o?`align${o}`:null,style:m},r?(0,Ke.createElement)("a",{href:r},c):c,!nt.RichText.isEmpty(a)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:a}))}},qu={attributes:{url:{type:"string",source:"attribute",selector:"img",attribute:"src"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},caption:{type:"array",source:"children",selector:"figcaption"},href:{type:"string",source:"attribute",selector:"a",attribute:"href"},id:{type:"number"},align:{type:"string"},width:{type:"number"},height:{type:"number"}},save({attributes:e}){const{url:t,alt:n,caption:a,align:o,href:r,width:l,height:i,id:s}=e,c=(0,Ke.createElement)("img",{src:t,alt:n,className:s?`wp-image-${s}`:null,width:l,height:i});return(0,Ke.createElement)("figure",{className:o?`align${o}`:null},r?(0,Ke.createElement)("a",{href:r},c):c,!nt.RichText.isEmpty(a)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:a}))}},ju={attributes:{url:{type:"string",source:"attribute",selector:"img",attribute:"src"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},caption:{type:"array",source:"children",selector:"figcaption"},href:{type:"string",source:"attribute",selector:"figure > a",attribute:"href"},id:{type:"number"},align:{type:"string"},width:{type:"number"},height:{type:"number"},linkDestination:{type:"string",default:"none"}},save({attributes:e}){const{url:t,alt:n,caption:a,align:o,href:r,width:l,height:i,id:s}=e,c=ut()({[`align${o}`]:o,"is-resized":l||i}),m=(0,Ke.createElement)("img",{src:t,alt:n,className:s?`wp-image-${s}`:null,width:l,height:i});return(0,Ke.createElement)("figure",{className:c},r?(0,Ke.createElement)("a",{href:r},m):m,!nt.RichText.isEmpty(a)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:a}))}},Wu={attributes:{align:{type:"string"},url:{type:"string",source:"attribute",selector:"img",attribute:"src"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},caption:{type:"string",source:"html",selector:"figcaption"},title:{type:"string",source:"attribute",selector:"img",attribute:"title"},href:{type:"string",source:"attribute",selector:"figure > a",attribute:"href"},rel:{type:"string",source:"attribute",selector:"figure > a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"figure > a",attribute:"class"},id:{type:"number"},width:{type:"number"},height:{type:"number"},sizeSlug:{type:"string"},linkDestination:{type:"string"},linkTarget:{type:"string",source:"attribute",selector:"figure > a",attribute:"target"}},supports:{anchor:!0},save({attributes:e}){const{url:t,alt:n,caption:a,align:o,href:r,rel:l,linkClass:i,width:s,height:c,id:m,linkTarget:u,sizeSlug:p,title:d}=e,g=l||void 0,h=ut()({[`align${o}`]:o,[`size-${p}`]:p,"is-resized":s||c}),b=(0,Ke.createElement)("img",{src:t,alt:n,className:m?`wp-image-${m}`:null,width:s,height:c,title:d}),_=(0,Ke.createElement)(Ke.Fragment,null,r?(0,Ke.createElement)("a",{className:i,href:r,target:u,rel:g},b):b,!nt.RichText.isEmpty(a)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:a}));return"left"===o||"right"===o||"center"===o?(0,Ke.createElement)("div",{...nt.useBlockProps.save()},(0,Ke.createElement)("figure",{className:h},_)):(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:h})},_)}},Zu={attributes:{align:{type:"string"},url:{type:"string",source:"attribute",selector:"img",attribute:"src"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:""},caption:{type:"string",source:"html",selector:"figcaption"},title:{type:"string",source:"attribute",selector:"img",attribute:"title"},href:{type:"string",source:"attribute",selector:"figure > a",attribute:"href"},rel:{type:"string",source:"attribute",selector:"figure > a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"figure > a",attribute:"class"},id:{type:"number"},width:{type:"number"},height:{type:"number"},sizeSlug:{type:"string"},linkDestination:{type:"string"},linkTarget:{type:"string",source:"attribute",selector:"figure > a",attribute:"target"}},supports:{anchor:!0,color:{__experimentalDuotone:"img",text:!1,background:!1},__experimentalBorder:{radius:!0,__experimentalDefaultControls:{radius:!0}},__experimentalStyle:{spacing:{margin:"0 0 1em 0"}}},save({attributes:e}){const{url:t,alt:n,caption:a,align:o,href:r,rel:l,linkClass:i,width:s,height:c,id:m,linkTarget:u,sizeSlug:p,title:d}=e,g=l||void 0,h=ut()({[`align${o}`]:o,[`size-${p}`]:p,"is-resized":s||c}),b=(0,Ke.createElement)("img",{src:t,alt:n,className:m?`wp-image-${m}`:null,width:s,height:c,title:d}),_=(0,Ke.createElement)(Ke.Fragment,null,r?(0,Ke.createElement)("a",{className:i,href:r,target:u,rel:g},b):b,!nt.RichText.isEmpty(a)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:a}));return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:h})},_)}},Qu={attributes:{align:{type:"string"},url:{type:"string",source:"attribute",selector:"img",attribute:"src",__experimentalRole:"content"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:"",__experimentalRole:"content"},caption:{type:"string",source:"html",selector:"figcaption",__experimentalRole:"content"},title:{type:"string",source:"attribute",selector:"img",attribute:"title",__experimentalRole:"content"},href:{type:"string",source:"attribute",selector:"figure > a",attribute:"href",__experimentalRole:"content"},rel:{type:"string",source:"attribute",selector:"figure > a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"figure > a",attribute:"class"},id:{type:"number",__experimentalRole:"content"},width:{type:"number"},height:{type:"number"},aspectRatio:{type:"string"},scale:{type:"string"},sizeSlug:{type:"string"},linkDestination:{type:"string"},linkTarget:{type:"string",source:"attribute",selector:"figure > a",attribute:"target"}},supports:{anchor:!0,color:{text:!1,background:!1},filter:{duotone:!0},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSkipSerialization:!0,__experimentalDefaultControls:{color:!0,radius:!0,width:!0}}},migrate(e){const{height:t,width:n}=e;return{...e,width:"number"==typeof n?`${n}px`:n,height:"number"==typeof t?`${t}px`:t}},save({attributes:e}){const{url:t,alt:n,caption:a,align:o,href:r,rel:l,linkClass:i,width:s,height:c,aspectRatio:m,scale:u,id:p,linkTarget:d,sizeSlug:g,title:h}=e,b=l||void 0,_=(0,nt.__experimentalGetBorderClassesAndStyles)(e),y=ut()({[`align${o}`]:o,[`size-${g}`]:g,"is-resized":s||c,"has-custom-border":!!_.className||_.style&&Object.keys(_.style).length>0}),v=ut()(_.className,{[`wp-image-${p}`]:!!p}),f=(0,Ke.createElement)("img",{src:t,alt:n,className:v||void 0,style:{..._.style,aspectRatio:m,objectFit:u},width:s,height:c,title:h}),k=(0,Ke.createElement)(Ke.Fragment,null,r?(0,Ke.createElement)("a",{className:i,href:r,target:d,rel:b},f):f,!nt.RichText.isEmpty(a)&&(0,Ke.createElement)(nt.RichText.Content,{className:(0,nt.__experimentalGetElementClassName)("caption"),tagName:"figcaption",value:a}));return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:y})},k)}},Ku={attributes:{align:{type:"string"},url:{type:"string",source:"attribute",selector:"img",attribute:"src",__experimentalRole:"content"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:"",__experimentalRole:"content"},caption:{type:"string",source:"html",selector:"figcaption",__experimentalRole:"content"},title:{type:"string",source:"attribute",selector:"img",attribute:"title",__experimentalRole:"content"},href:{type:"string",source:"attribute",selector:"figure > a",attribute:"href",__experimentalRole:"content"},rel:{type:"string",source:"attribute",selector:"figure > a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"figure > a",attribute:"class"},id:{type:"number",__experimentalRole:"content"},width:{type:"number"},height:{type:"number"},aspectRatio:{type:"string"},scale:{type:"string"},sizeSlug:{type:"string"},linkDestination:{type:"string"},linkTarget:{type:"string",source:"attribute",selector:"figure > a",attribute:"target"}},supports:{anchor:!0,color:{text:!1,background:!1},filter:{duotone:!0},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSkipSerialization:!0,__experimentalDefaultControls:{color:!0,radius:!0,width:!0}}},migrate:({width:e,height:t,...n})=>({...n,width:`${e}px`,height:`${t}px`}),save({attributes:e}){const{url:t,alt:n,caption:a,align:o,href:r,rel:l,linkClass:i,width:s,height:c,aspectRatio:m,scale:u,id:p,linkTarget:d,sizeSlug:g,title:h}=e,b=l||void 0,_=(0,nt.__experimentalGetBorderClassesAndStyles)(e),y=ut()({[`align${o}`]:o,[`size-${g}`]:g,"is-resized":s||c,"has-custom-border":!!_.className||_.style&&Object.keys(_.style).length>0}),v=ut()(_.className,{[`wp-image-${p}`]:!!p}),f=(0,Ke.createElement)("img",{src:t,alt:n,className:v||void 0,style:{..._.style,aspectRatio:m,objectFit:u,width:s,height:c},width:s,height:c,title:h}),k=(0,Ke.createElement)(Ke.Fragment,null,r?(0,Ke.createElement)("a",{className:i,href:r,target:d,rel:b},f):f,!nt.RichText.isEmpty(a)&&(0,Ke.createElement)(nt.RichText.Content,{className:(0,nt.__experimentalGetElementClassName)("caption"),tagName:"figcaption",value:a}));return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:y})},k)}},Yu={attributes:{align:{type:"string"},behaviors:{type:"object"},url:{type:"string",source:"attribute",selector:"img",attribute:"src",__experimentalRole:"content"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:"",__experimentalRole:"content"},caption:{type:"string",source:"html",selector:"figcaption",__experimentalRole:"content"},title:{type:"string",source:"attribute",selector:"img",attribute:"title",__experimentalRole:"content"},href:{type:"string",source:"attribute",selector:"figure > a",attribute:"href",__experimentalRole:"content"},rel:{type:"string",source:"attribute",selector:"figure > a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"figure > a",attribute:"class"},id:{type:"number",__experimentalRole:"content"},width:{type:"string"},height:{type:"string"},aspectRatio:{type:"string"},scale:{type:"string"},sizeSlug:{type:"string"},linkDestination:{type:"string"},linkTarget:{type:"string",source:"attribute",selector:"figure > a",attribute:"target"}},supports:{anchor:!0,color:{text:!1,background:!1},filter:{duotone:!0},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSkipSerialization:!0,__experimentalDefaultControls:{color:!0,radius:!0,width:!0}}},migrate({width:e,height:t,...n}){if(!n.behaviors?.lightbox)return n;const{behaviors:{lightbox:{enabled:a}}}=n,o={...n,lightbox:{enabled:a}};return delete o.behaviors,o},isEligible:e=>!!e.behaviors,save({attributes:e}){const{url:t,alt:n,caption:a,align:o,href:r,rel:l,linkClass:i,width:s,height:c,aspectRatio:m,scale:u,id:p,linkTarget:d,sizeSlug:g,title:h}=e,b=l||void 0,_=(0,nt.__experimentalGetBorderClassesAndStyles)(e),y=ut()({[`align${o}`]:o,[`size-${g}`]:g,"is-resized":s||c,"has-custom-border":!!_.className||_.style&&Object.keys(_.style).length>0}),v=ut()(_.className,{[`wp-image-${p}`]:!!p}),f=(0,Ke.createElement)("img",{src:t,alt:n,className:v||void 0,style:{..._.style,aspectRatio:m,objectFit:u,width:s,height:c},title:h}),k=(0,Ke.createElement)(Ke.Fragment,null,r?(0,Ke.createElement)("a",{className:i,href:r,target:d,rel:b},f):f,!nt.RichText.isEmpty(a)&&(0,Ke.createElement)(nt.RichText.Content,{className:(0,nt.__experimentalGetElementClassName)("caption"),tagName:"figcaption",value:a}));return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:y})},k)}},Ju=[Yu,Ku,Qu,Zu,Wu,ju,qu,Uu],Xu=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z"})),ep=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M18 20v-2h2v-1.5H7.75a.25.25 0 0 1-.25-.25V4H6v2H4v1.5h2v8.75c0 .966.784 1.75 1.75 1.75h8.75v2H18ZM9.273 7.5h6.977a.25.25 0 0 1 .25.25v6.977H18V7.75A1.75 1.75 0 0 0 16.25 6H9.273v1.5Z"})),tp=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12-9.8c.4 0 .8-.3.9-.7l1.1-3h3.6l.5 1.7h1.9L13 9h-2.2l-3.4 9.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v12H20V6c0-1.1-.9-2-2-2zm-6 7l1.4 3.9h-2.7L12 11z"})),np=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.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"}));function ap(e,t){const[n,a]=(0,_t.useState)();function o(){a(e.current?.clientWidth)}return(0,_t.useEffect)(o,t),(0,_t.useEffect)((()=>{const{defaultView:t}=e.current.ownerDocument;return t.addEventListener("resize",o),()=>{t.removeEventListener("resize",o)}}),[]),n}const op={popoverProps:{placement:"left-start",offset:259}},{DimensionsTool:rp,ResolutionTool:lp}=Ft(nt.privateApis),ip=[{value:"cover",label:(0,tt._x)("Cover","Scale option for dimensions control"),help:(0,tt.__)("Image covers the space evenly.")},{value:"contain",label:(0,tt._x)("Contain","Scale option for dimensions control"),help:(0,tt.__)("Image is contained without distortion.")}],sp=({href:e,children:t})=>e?(0,Ke.createElement)("a",{href:e,onClick:e=>e.preventDefault(),"aria-disabled":!0,style:{pointerEvents:"none",cursor:"default",display:"inline"}},t):t;function cp({temporaryURL:e,attributes:t,setAttributes:n,isSingleSelected:a,insertBlocksAfter:o,onReplace:r,onSelectImage:l,onSelectURL:i,onUploadError:s,containerRef:c,context:m,clientId:u,blockEditingMode:p}){const{url:d="",alt:g,align:h,id:b,href:_,rel:y,linkClass:v,linkDestination:f,title:k,width:x,height:w,aspectRatio:E,scale:C,linkTarget:S,sizeSlug:B,lightbox:N,metadata:T}=t,I=x?parseInt(x,10):void 0,P=w?parseInt(w,10):void 0,M=(0,_t.useRef)(),{allowResize:z=!0}=m,{getBlock:R,getSettings:A}=(0,gt.useSelect)(nt.store),H=(0,gt.useSelect)((e=>b&&a?e(dt.store).getMedia(b,{context:"view"}):null),[b,a]),{canInsertCover:L,imageEditing:D,imageSizes:F,maxWidth:V}=(0,gt.useSelect)((e=>{const{getBlockRootClientId:t,canInsertBlockType:n}=e(nt.store),a=t(u),o=A();return{imageEditing:o.imageEditing,imageSizes:o.imageSizes,maxWidth:o.maxWidth,canInsertCover:n("core/cover",a)}}),[u]),{replaceBlocks:$,toggleSelection:O}=(0,gt.useDispatch)(nt.store),{createErrorNotice:G,createSuccessNotice:U}=(0,gt.useDispatch)(Pt.store),q=(0,jt.useViewportMatch)("medium"),j=["wide","full"].includes(h),[{loadedNaturalWidth:W,loadedNaturalHeight:Z},Q]=(0,_t.useState)({}),[K,Y]=(0,_t.useState)(!1),[J,X]=(0,_t.useState)(),ee=ap(c,[h]),te="default"===p,ne="contentOnly"===p,ae=z&&te&&!j&&q,oe=F.filter((({slug:e})=>H?.media_details?.sizes?.[e]?.source_url)).map((({name:e,slug:t})=>({value:t,label:e})));(0,_t.useEffect)((()=>{mp(b,d)&&a&&A().mediaUpload?J||window.fetch(d.includes("?")?d:d+"?").then((e=>e.blob())).then((e=>X(e))).catch((()=>{})):X()}),[b,d,a,J]);const{naturalWidth:re,naturalHeight:le}=(0,_t.useMemo)((()=>({naturalWidth:M.current?.naturalWidth||W||void 0,naturalHeight:M.current?.naturalHeight||Z||void 0})),[W,Z,M.current?.complete]);function ie(e){n({title:e})}function se(e){n({alt:e})}(0,_t.useEffect)((()=>{a||Y(!1)}),[a]);const ce=b&&re&&le&&D,me=a&&ce&&!K;const ue=(0,et.__experimentalUseCustomUnits)({availableUnits:["px"]}),[pe]=(0,nt.useSettings)("lightbox"),de=!!N&&N?.enabled!==pe?.enabled||pe?.allowEditing,ge=!!N?.enabled||!N&&!!pe?.enabled,he=(0,Ke.createElement)(rp,{value:{width:x,height:w,scale:C,aspectRatio:E},onChange:({width:e,height:t,scale:a,aspectRatio:o})=>{n({width:!e&&t?"auto":e,height:t,scale:a,aspectRatio:o})},defaultScale:"cover",defaultAspectRatio:"auto",scaleOptions:ip,unitsOptions:ue}),be=()=>{n({alt:void 0,width:void 0,height:void 0,scale:void 0,aspectRatio:void 0,lightbox:void 0})},_e=(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.__experimentalToolsPanel,{label:(0,tt.__)("Settings"),resetAll:be,dropdownMenuProps:op},ae&&he)),{lockUrlControls:ye=!1,lockHrefControls:ve=!1,lockAltControls:fe=!1,lockAltControlsMessage:ke,lockTitleControls:xe=!1,lockTitleControlsMessage:we,lockCaption:Ee=!1}=(0,gt.useSelect)((e=>{if(!a)return{};const{getBlockBindingsSource:t}=Ft(e(Qe.store)),{getBlockParentsByBlockName:n}=Ft(e(nt.store)),{url:o,alt:r,title:l}=T?.bindings||{},i=n(u,"core/block").length>0,s=t(o?.source),c=t(r?.source),m=t(l?.source);return{lockUrlControls:!!o&&(!s||s?.lockAttributesEditing),lockHrefControls:i,lockCaption:i,lockAltControls:!!r&&(!c||c?.lockAttributesEditing),lockAltControlsMessage:c?.label?(0,tt.sprintf)((0,tt.__)("Connected to %s"),c.label):(0,tt.__)("Connected to dynamic data"),lockTitleControls:!!l&&(!m||m?.lockAttributesEditing),lockTitleControlsMessage:m?.label?(0,tt.sprintf)((0,tt.__)("Connected to %s"),m.label):(0,tt.__)("Connected to dynamic data")}}),[u,a,T?.bindings]),Ce=(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},a&&!K&&!ve&&!ye&&(0,Ke.createElement)(nt.__experimentalImageURLInputUI,{url:_||"",onChangeUrl:function(e){n(e)},linkDestination:f,mediaUrl:H&&H.source_url||d,mediaLink:H&&H.link,linkTarget:S,linkClass:v,rel:y,showLightboxSetting:de,lightboxEnabled:ge,onSetLightbox:function(e){n(e&&!pe?.enabled?{lightbox:{enabled:!0}}:!e&&pe?.enabled?{lightbox:{enabled:!1}}:{lightbox:void 0})},resetLightbox:function(){n(pe?.enabled&&pe?.allowEditing?{lightbox:{enabled:!1}}:{lightbox:void 0})}}),me&&(0,Ke.createElement)(et.ToolbarButton,{onClick:()=>Y(!0),icon:ep,label:(0,tt.__)("Crop")}),a&&L&&(0,Ke.createElement)(et.ToolbarButton,{icon:tp,label:(0,tt.__)("Add text over image"),onClick:function(){$(u,(0,Qe.switchToBlockType)(R(u),"core/cover"))}})),a&&!K&&!ye&&(0,Ke.createElement)(nt.BlockControls,{group:"other"},(0,Ke.createElement)(nt.MediaReplaceFlow,{mediaId:b,mediaURL:d,allowedTypes:om,accept:"image/*",onSelect:l,onSelectURL:i,onError:s})),a&&J&&(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,null,(0,Ke.createElement)(et.ToolbarButton,{onClick:function(){const{mediaUpload:e}=A();e&&e({filesList:[J],onFileChange([e]){l(e),(0,It.isBlobURL)(e.url)||(X(),U((0,tt.__)("Image uploaded."),{type:"snackbar"}))},allowedTypes:om,onError(e){G(e,{type:"snackbar"})}})},icon:np,label:(0,tt.__)("Upload to Media Library")}))),ne&&(0,Ke.createElement)(nt.BlockControls,{group:"other"},(0,Ke.createElement)(et.Dropdown,{popoverProps:{position:"bottom right"},renderToggle:({isOpen:e,onToggle:t})=>(0,Ke.createElement)(et.ToolbarButton,{onClick:t,"aria-haspopup":"true","aria-expanded":e,onKeyDown:n=>{e||n.keyCode!==fn.DOWN||(n.preventDefault(),t())}},(0,tt._x)("Alt","Alternative text for an image. Block toolbar label, a low character count is preferred.")),renderContent:()=>(0,Ke.createElement)(et.TextareaControl,{className:"wp-block-image__toolbar_content_textarea",label:(0,tt.__)("Alternative text"),value:g||"",onChange:se,disabled:fe,help:fe?(0,Ke.createElement)(Ke.Fragment,null,ke):(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ExternalLink,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree"},(0,tt.__)("Describe the purpose of the image.")),(0,Ke.createElement)("br",null),(0,tt.__)("Leave empty if decorative.")),__nextHasNoMarginBottom:!0})}),(0,Ke.createElement)(et.Dropdown,{popoverProps:{position:"bottom right"},renderToggle:({isOpen:e,onToggle:t})=>(0,Ke.createElement)(et.ToolbarButton,{onClick:t,"aria-haspopup":"true","aria-expanded":e,onKeyDown:n=>{e||n.keyCode!==fn.DOWN||(n.preventDefault(),t())}},(0,tt.__)("Title")),renderContent:()=>(0,Ke.createElement)(et.TextControl,{className:"wp-block-image__toolbar_content_textarea",__nextHasNoMarginBottom:!0,label:(0,tt.__)("Title attribute"),value:k||"",onChange:ie,disabled:xe,help:xe?(0,Ke.createElement)(Ke.Fragment,null,we):(0,Ke.createElement)(Ke.Fragment,null,(0,tt.__)("Describe the role of this image on the page."),(0,Ke.createElement)(et.ExternalLink,{href:"https://www.w3.org/TR/html52/dom.html#the-title-attribute"},(0,tt.__)("(Note: many devices and browsers do not display this text.)")))})})),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.__experimentalToolsPanel,{label:(0,tt.__)("Settings"),resetAll:be,dropdownMenuProps:op},a&&(0,Ke.createElement)(et.__experimentalToolsPanelItem,{label:(0,tt.__)("Alternative text"),isShownByDefault:!0,hasValue:()=>!!g,onDeselect:()=>n({alt:void 0})},(0,Ke.createElement)(et.TextareaControl,{label:(0,tt.__)("Alternative text"),value:g||"",onChange:se,readOnly:fe,help:fe?(0,Ke.createElement)(Ke.Fragment,null,ke):(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ExternalLink,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree"},(0,tt.__)("Describe the purpose of the image.")),(0,Ke.createElement)("br",null),(0,tt.__)("Leave empty if decorative.")),__nextHasNoMarginBottom:!0})),ae&&he,!!oe.length&&(0,Ke.createElement)(lp,{value:B,onChange:function(e){const t=H?.media_details?.sizes?.[e]?.source_url;if(!t)return null;n({url:t,sizeSlug:e})},options:oe}))),(0,Ke.createElement)(nt.InspectorControls,{group:"advanced"},(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Title attribute"),value:k||"",onChange:ie,readOnly:xe,help:xe?(0,Ke.createElement)(Ke.Fragment,null,we):(0,Ke.createElement)(Ke.Fragment,null,(0,tt.__)("Describe the role of this image on the page."),(0,Ke.createElement)(et.ExternalLink,{href:"https://www.w3.org/TR/html52/dom.html#the-title-attribute"},(0,tt.__)("(Note: many devices and browsers do not display this text.)")))}))),Se=(0,pt.getFilename)(d);let Be;Be=g||(Se?(0,tt.sprintf)((0,tt.__)("This image has an empty alt attribute; its file name is %s"),Se):(0,tt.__)("This image has an empty alt attribute"));const Ne=(0,nt.__experimentalUseBorderProps)(t),Te=(0,nt.__experimentalGetShadowClassesAndStyles)(t),Ie=t.className?.includes("is-style-rounded");let Pe=(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("img",{src:e||d,alt:Be,onError:()=>function(){const e=Ot({attributes:{url:d}});void 0!==e&&r(e)}(),onLoad:e=>{Q({loadedNaturalWidth:e.target?.naturalWidth,loadedNaturalHeight:e.target?.naturalHeight})},ref:M,className:Ne.className,style:{width:x&&w||E?"100%":void 0,height:x&&w||E?"100%":void 0,objectFit:C,...Ne.style,...Te.style}}),e&&(0,Ke.createElement)(et.Spinner,null));const Me=M.current?.width||ee;if(ce&&K)Pe=(0,Ke.createElement)(sp,{href:_},(0,Ke.createElement)(nt.__experimentalImageEditor,{id:b,url:d,width:I,height:P,clientWidth:Me,naturalHeight:le,naturalWidth:re,onSaveImage:e=>n(e),onFinishEditing:()=>{Y(!1)},borderProps:Ie?void 0:Ne}));else if(ae){const e=E&&function(e){const[t,n=1]=e.split("/").map(Number),a=t/n;return a===1/0||0===a?NaN:a}(E),t=re/le,o=e||I/P||t||1,r=!I&&P?P*o:I,l=!P&&I?I/o:P,i=re<le?Jc:Jc*o,s=le<re?Jc:Jc/o,c=2.5*V;let m=!1,u=!1;"center"===h?(m=!0,u=!0):(0,tt.isRTL)()?"left"===h?m=!0:u=!0:"right"===h?u=!0:m=!0,Pe=(0,Ke.createElement)(et.ResizableBox,{style:{display:"block",objectFit:C,aspectRatio:x||w||!E?void 0:E},size:{width:null!=r?r:"auto",height:null!=l?l:"auto"},showHandle:a,minWidth:i,maxWidth:c,minHeight:s,maxHeight:c/o,lockAspectRatio:o,enable:{top:!1,right:m,bottom:!0,left:u},onResizeStart:function(){O(!1)},onResizeStop:(e,a,r)=>{O(!0),n({width:`${r.offsetWidth}px`,height:"auto",aspectRatio:o===t?void 0:String(o)})},resizeRatio:"center"===h?2:1},(0,Ke.createElement)(sp,{href:_},Pe))}else Pe=(0,Ke.createElement)("div",{style:{width:x,height:w,aspectRatio:E}},(0,Ke.createElement)(sp,{href:_},Pe));return d||e?(0,Ke.createElement)(Ke.Fragment,null,!e&&Ce,Pe,(0,Ke.createElement)(Qt,{attributes:t,setAttributes:n,isSelected:a,insertBlocksAfter:o,label:(0,tt.__)("Image caption text"),showToolbarButton:a&&te,disableEditing:Ee})):T?.bindings?Ce:_e}const mp=(e,t)=>t&&!e&&!(0,It.isBlobURL)(t);function up(e,t){var n,a;return"url"in(null!==(n=e?.sizes?.[t])&&void 0!==n?n:{})||"source_url"in(null!==(a=e?.media_details?.sizes?.[t])&&void 0!==a?a:{})}const pp=function({attributes:e,setAttributes:t,isSelected:n,className:a,insertBlocksAfter:o,onReplace:r,context:l,clientId:i}){const{url:s="",alt:c,caption:m,id:u,width:p,height:d,sizeSlug:g,aspectRatio:h,scale:b,align:_,metadata:y}=e,[v,f]=(0,_t.useState)(),k=(0,_t.useRef)();(0,_t.useEffect)((()=>{k.current=c}),[c]);const x=(0,_t.useRef)();(0,_t.useEffect)((()=>{x.current=m}),[m]);const{__unstableMarkNextChangeAsNotPersistent:w}=(0,gt.useDispatch)(nt.store);(0,_t.useEffect)((()=>{["wide","full"].includes(_)&&(w(),t({width:void 0,height:void 0,aspectRatio:void 0,scale:void 0}))}),[_]);const E=(0,_t.useRef)(),{getSettings:C}=(0,gt.useSelect)(nt.store),S=(0,nt.useBlockEditingMode)(),{createErrorNotice:B}=(0,gt.useDispatch)(Pt.store);function N(e){B(e,{type:"snackbar"}),t({src:void 0,id:void 0,url:void 0}),f(void 0)}function T(n){if(!n||!n.url)return void t({url:void 0,alt:void 0,id:void 0,title:void 0,caption:void 0});if((0,It.isBlobURL)(n.url))return void f(n.url);f();const{imageDefaultSize:a}=C();let o="full";g&&up(n,g)?o=g:up(n,a)&&(o=a);let r,l=((e,t)=>{const n=Object.fromEntries(Object.entries(null!=e?e:{}).filter((([e])=>["alt","id","link","caption"].includes(e))));return n.url=e?.sizes?.[t]?.url||e?.media_details?.sizes?.[t]?.source_url||e.url,n})(n,o);if(x.current&&!l.caption){const{caption:e,...t}=l;l=t}r=n.id&&n.id===u?{url:s}:{sizeSlug:o};let i,c=e.linkDestination;if(!c)switch(window?.wp?.media?.view?.settings?.defaultProps?.link||Xc){case"file":case em:c=em;break;case"post":case tm:c=tm;break;case nm:c=nm;break;case Xc:c=Xc}switch(c){case em:i=n.url;break;case tm:i=n.link}l.href=i,t({...l,...r,linkDestination:c})}function I(e){e!==s&&t({url:e,id:void 0,sizeSlug:C().imageDefaultSize})}let P=((e,t)=>!e&&(0,It.isBlobURL)(t))(u,s);(0,_t.useEffect)((()=>{if(!P)return;const e=(0,It.getBlobByURL)(s);if(e){const{mediaUpload:t}=C();if(!t)return;t({filesList:[e],onFileChange:([e])=>{T(e)},allowedTypes:om,onError:e=>{P=!1,N(e)}})}}),[]),(0,_t.useEffect)((()=>{P?f(s):(0,It.revokeBlobURL)(v)}),[P,s]);const M=mp(u,s)?s:void 0,z=!!s&&(0,Ke.createElement)("img",{alt:(0,tt.__)("Edit image"),title:(0,tt.__)("Edit image"),className:"edit-image-preview",src:s}),R=(0,nt.__experimentalUseBorderProps)(e),A=(0,nt.__experimentalGetShadowClassesAndStyles)(e),H=ut()(a,{"is-transient":v,"is-resized":!!p||!!d,[`size-${g}`]:g,"has-custom-border":!!R.className||R.style&&Object.keys(R.style).length>0}),L=(0,nt.useBlockProps)({ref:E,className:H}),{lockUrlControls:D=!1,lockUrlControlsMessage:F}=(0,gt.useSelect)((e=>{if(!n)return{};const t=Ft(e(Qe.store)).getBlockBindingsSource(y?.bindings?.url?.source);return{lockUrlControls:!!y?.bindings?.url&&(!t||t?.lockAttributesEditing),lockUrlControlsMessage:t?.label?(0,tt.sprintf)((0,tt.__)("Connected to %s"),t.label):(0,tt.__)("Connected to dynamic data")}}),[n]);return(0,Ke.createElement)("figure",{...L},(0,Ke.createElement)(cp,{temporaryURL:v,attributes:e,setAttributes:t,isSingleSelected:n,insertBlocksAfter:o,onReplace:r,onSelectImage:T,onSelectURL:I,onUploadError:N,containerRef:E,context:l,clientId:i,blockEditingMode:S}),(0,Ke.createElement)(nt.MediaPlaceholder,{icon:(0,Ke.createElement)(nt.BlockIcon,{icon:fm}),onSelect:T,onSelectURL:I,onError:N,placeholder:e=>(0,Ke.createElement)(et.Placeholder,{className:ut()("block-editor-media-placeholder",{[R.className]:!!R.className&&!n}),withIllustration:!0,icon:D?Xu:fm,label:(0,tt.__)("Image"),instructions:!D&&(0,tt.__)("Upload an image file, pick one from your media library, or add one with a URL."),style:{aspectRatio:p&&d||!h?void 0:h,width:d&&h?"100%":p,height:p&&h?"100%":d,objectFit:b,...R.style,...A.style}},D?(0,Ke.createElement)("span",{className:"block-bindings-media-placeholder-message"},F):e),accept:"image/*",allowedTypes:om,value:{id:u,src:M},mediaPreview:z,disableMediaButtons:v||s}))};function dp(e,t){const{body:n}=document.implementation.createHTMLDocument("");n.innerHTML=e;const{firstElementChild:a}=n;if(a&&"A"===a.nodeName)return a.getAttribute(t)||void 0}const gp={img:{attributes:["src","alt","title"],classes:["alignleft","aligncenter","alignright","alignnone",/^wp-image-\d+$/]}},hp={from:[{type:"raw",isMatch:e=>"FIGURE"===e.nodeName&&!!e.querySelector("img"),schema:({phrasingContentSchema:e})=>({figure:{require:["img"],children:{...gp,a:{attributes:["href","rel","target"],children:gp},figcaption:{children:e}}}}),transform:e=>{const t=e.className+" "+e.querySelector("img").className,n=/(?:^|\s)align(left|center|right)(?:$|\s)/.exec(t),a=""===e.id?void 0:e.id,o=n?n[1]:void 0,r=/(?:^|\s)wp-image-(\d+)(?:$|\s)/.exec(t),l=r?Number(r[1]):void 0,i=e.querySelector("a"),s=i&&i.href?"custom":void 0,c=i&&i.href?i.href:void 0,m=i&&i.rel?i.rel:void 0,u=i&&i.className?i.className:void 0,p=(0,Qe.getBlockAttributes)("core/image",e.outerHTML,{align:o,id:l,linkDestination:s,href:c,rel:m,linkClass:u,anchor:a});return(0,Qe.createBlock)("core/image",p)}},{type:"files",isMatch(e){if(e.some((e=>0===e.type.indexOf("image/")))&&e.some((e=>0!==e.type.indexOf("image/")))){const{createErrorNotice:e}=(0,gt.dispatch)(Pt.store);e((0,tt.__)("If uploading to a gallery all files need to be image formats"),{id:"gallery-transform-invalid-file",type:"snackbar"})}return e.every((e=>0===e.type.indexOf("image/")))},transform(e){const t=e.map((e=>(0,Qe.createBlock)("core/image",{url:(0,It.createBlobURL)(e)})));return t}},{type:"shortcode",tag:"caption",attributes:{url:{type:"string",source:"attribute",attribute:"src",selector:"img"},alt:{type:"string",source:"attribute",attribute:"alt",selector:"img"},caption:{shortcode:function(e,{shortcode:t}){const{body:n}=document.implementation.createHTMLDocument("");n.innerHTML=t.content;let a=n.querySelector("img");for(;a&&a.parentNode&&a.parentNode!==n;)a=a.parentNode;return a&&a.parentNode.removeChild(a),n.innerHTML.trim()}},href:{shortcode:(e,{shortcode:t})=>dp(t.content,"href")},rel:{shortcode:(e,{shortcode:t})=>dp(t.content,"rel")},linkClass:{shortcode:(e,{shortcode:t})=>dp(t.content,"class")},id:{type:"number",shortcode:({named:{id:e}})=>{if(e)return parseInt(e.replace("attachment_",""),10)}},align:{type:"string",shortcode:({named:{align:e="alignnone"}})=>e.replace("align","")}}}]},bp=hp,_p={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/image",title:"Image",category:"media",usesContext:["allowResize","imageCrop","fixedHeight"],description:"Insert an image to make a visual statement.",keywords:["img","photo","picture"],textdomain:"default",attributes:{url:{type:"string",source:"attribute",selector:"img",attribute:"src",__experimentalRole:"content"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:"",__experimentalRole:"content"},caption:{type:"rich-text",source:"rich-text",selector:"figcaption",__experimentalRole:"content"},lightbox:{type:"object",enabled:{type:"boolean"}},title:{type:"string",source:"attribute",selector:"img",attribute:"title",__experimentalRole:"content"},href:{type:"string",source:"attribute",selector:"figure > a",attribute:"href",__experimentalRole:"content"},rel:{type:"string",source:"attribute",selector:"figure > a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"figure > a",attribute:"class"},id:{type:"number",__experimentalRole:"content"},width:{type:"string"},height:{type:"string"},aspectRatio:{type:"string"},scale:{type:"string"},sizeSlug:{type:"string"},linkDestination:{type:"string"},linkTarget:{type:"string",source:"attribute",selector:"figure > a",attribute:"target"}},supports:{interactivity:!0,align:["left","center","right","wide","full"],anchor:!0,color:{text:!1,background:!1},filter:{duotone:!0},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSkipSerialization:!0,__experimentalDefaultControls:{color:!0,radius:!0,width:!0}},shadow:{__experimentalSkipSerialization:!0}},selectors:{border:".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",shadow:".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",filter:{duotone:".wp-block-image img, .wp-block-image .components-placeholder"}},styles:[{name:"default",label:"Default",isDefault:!0},{name:"rounded",label:"Rounded"}],editorStyle:"wp-block-image-editor",style:"wp-block-image"},{name:yp}=_p,vp={icon:fm,example:{attributes:{sizeSlug:"large",url:"https://s.w.org/images/core/5.3/MtBlanc1.jpg",caption:(0,tt.__)("Mont Blanc appears—still, snowy, and serene.")}},__experimentalLabel(e,{context:t}){const n=e?.metadata?.name;if("list-view"===t&&n)return n;if("accessibility"===t){const{caption:t,alt:n,url:a}=e;return a?n?n+(t?". "+t:""):t||"":(0,tt.__)("Empty")}},getEditWrapperProps:e=>({"data-align":e.align}),transforms:bp,edit:pp,save:function({attributes:e}){const{url:t,alt:n,caption:a,align:o,href:r,rel:l,linkClass:i,width:s,height:c,aspectRatio:m,scale:u,id:p,linkTarget:d,sizeSlug:g,title:h}=e,b=l||void 0,_=(0,nt.__experimentalGetBorderClassesAndStyles)(e),y=(0,nt.__experimentalGetShadowClassesAndStyles)(e),v=ut()({alignnone:"none"===o,[`size-${g}`]:g,"is-resized":s||c,"has-custom-border":!!_.className||_.style&&Object.keys(_.style).length>0}),f=ut()(_.className,{[`wp-image-${p}`]:!!p}),k=(0,Ke.createElement)("img",{src:t,alt:n,className:f||void 0,style:{..._.style,...y.style,aspectRatio:m,objectFit:u,width:s,height:c},title:h}),x=(0,Ke.createElement)(Ke.Fragment,null,r?(0,Ke.createElement)("a",{className:i,href:r,target:d,rel:b},k):k,!nt.RichText.isEmpty(a)&&(0,Ke.createElement)(nt.RichText.Content,{className:(0,nt.__experimentalGetElementClassName)("caption"),tagName:"figcaption",value:a}));return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:v})},x)},deprecated:Ju},fp=()=>Xe({name:yp,metadata:_p,settings:vp}),kp=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z"}));const xp={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/latest-comments",title:"Latest Comments",category:"widgets",description:"Display a list of your most recent comments.",keywords:["recent comments"],textdomain:"default",attributes:{commentsToShow:{type:"number",default:5,minimum:1,maximum:100},displayAvatar:{type:"boolean",default:!0},displayDate:{type:"boolean",default:!0},displayExcerpt:{type:"boolean",default:!0}},supports:{align:!0,html:!1,spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-latest-comments-editor",style:"wp-block-latest-comments"},{name:wp}=xp,Ep={icon:kp,example:{},edit:function({attributes:e,setAttributes:t}){const{commentsToShow:n,displayAvatar:a,displayDate:o,displayExcerpt:r}=e,l={...e,style:{...e?.style,spacing:void 0}};return(0,Ke.createElement)("div",{...(0,nt.useBlockProps)()},(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display avatar"),checked:a,onChange:()=>t({displayAvatar:!a})}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display date"),checked:o,onChange:()=>t({displayDate:!o})}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display excerpt"),checked:r,onChange:()=>t({displayExcerpt:!r})}),(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Number of comments"),value:n,onChange:e=>t({commentsToShow:e}),min:1,max:100,required:!0}))),(0,Ke.createElement)(et.Disabled,null,(0,Ke.createElement)(ot(),{block:"core/latest-comments",attributes:l,urlQueryArgs:{_locale:"site"}})))}},Cp=()=>Xe({name:wp,metadata:xp,settings:Ep}),Sp=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M18 5.5H6a.5.5 0 0 0-.5.5v12a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5V6a.5.5 0 0 0-.5-.5ZM6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm1 5h1.5v1.5H7V9Zm1.5 4.5H7V15h1.5v-1.5ZM10 9h7v1.5h-7V9Zm7 4.5h-7V15h7v-1.5Z"})),{attributes:Bp}={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/latest-posts",title:"Latest Posts",category:"widgets",description:"Display a list of your most recent posts.",keywords:["recent posts"],textdomain:"default",attributes:{categories:{type:"array",items:{type:"object"}},selectedAuthor:{type:"number"},postsToShow:{type:"number",default:5},displayPostContent:{type:"boolean",default:!1},displayPostContentRadio:{type:"string",default:"excerpt"},excerptLength:{type:"number",default:55},displayAuthor:{type:"boolean",default:!1},displayPostDate:{type:"boolean",default:!1},postLayout:{type:"string",default:"list"},columns:{type:"number",default:3},order:{type:"string",default:"desc"},orderBy:{type:"string",default:"date"},displayFeaturedImage:{type:"boolean",default:!1},featuredImageAlign:{type:"string",enum:["left","center","right"]},featuredImageSizeSlug:{type:"string",default:"thumbnail"},featuredImageSizeWidth:{type:"number",default:null},featuredImageSizeHeight:{type:"number",default:null},addLinkToFeaturedImage:{type:"boolean",default:!1}},supports:{align:!0,html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-latest-posts-editor",style:"wp-block-latest-posts"},Np=[{attributes:{...Bp,categories:{type:"string"}},supports:{align:!0,html:!1},migrate:e=>({...e,categories:[{id:Number(e.categories)}]}),isEligible:({categories:e})=>e&&"string"==typeof e,save:()=>null}],Tp=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"})),Ip={per_page:-1,context:"view"},Pp={per_page:-1,has_published_posts:["post"],context:"view"};const Mp={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/latest-posts",title:"Latest Posts",category:"widgets",description:"Display a list of your most recent posts.",keywords:["recent posts"],textdomain:"default",attributes:{categories:{type:"array",items:{type:"object"}},selectedAuthor:{type:"number"},postsToShow:{type:"number",default:5},displayPostContent:{type:"boolean",default:!1},displayPostContentRadio:{type:"string",default:"excerpt"},excerptLength:{type:"number",default:55},displayAuthor:{type:"boolean",default:!1},displayPostDate:{type:"boolean",default:!1},postLayout:{type:"string",default:"list"},columns:{type:"number",default:3},order:{type:"string",default:"desc"},orderBy:{type:"string",default:"date"},displayFeaturedImage:{type:"boolean",default:!1},featuredImageAlign:{type:"string",enum:["left","center","right"]},featuredImageSizeSlug:{type:"string",default:"thumbnail"},featuredImageSizeWidth:{type:"number",default:null},featuredImageSizeHeight:{type:"number",default:null},addLinkToFeaturedImage:{type:"boolean",default:!1}},supports:{align:!0,html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-latest-posts-editor",style:"wp-block-latest-posts"},{name:zp}=Mp,Rp={icon:Sp,example:{},edit:function e({attributes:t,setAttributes:n}){var a;const o=(0,jt.useInstanceId)(e),{postsToShow:r,order:l,orderBy:i,categories:s,selectedAuthor:c,displayFeaturedImage:m,displayPostContentRadio:u,displayPostContent:p,displayPostDate:d,displayAuthor:g,postLayout:h,columns:b,excerptLength:_,featuredImageAlign:y,featuredImageSizeSlug:v,featuredImageSizeWidth:f,featuredImageSizeHeight:k,addLinkToFeaturedImage:x}=t,{imageSizes:w,latestPosts:E,defaultImageWidth:C,defaultImageHeight:S,categoriesList:B,authorList:N}=(0,gt.useSelect)((e=>{var t,n;const{getEntityRecords:a,getUsers:o}=e(dt.store),m=e(nt.store).getSettings(),u=s&&s.length>0?s.map((e=>e.id)):[],p=Object.fromEntries(Object.entries({categories:u,author:c,order:l,orderby:i,per_page:r,_embed:"wp:featuredmedia"}).filter((([,e])=>void 0!==e)));return{defaultImageWidth:null!==(t=m.imageDimensions?.[v]?.width)&&void 0!==t?t:0,defaultImageHeight:null!==(n=m.imageDimensions?.[v]?.height)&&void 0!==n?n:0,imageSizes:m.imageSizes,latestPosts:a("postType","post",p),categoriesList:a("taxonomy","category",Ip),authorList:o(Pp)}}),[v,r,l,i,s,c]),{createWarningNotice:T,removeNotice:I}=(0,gt.useDispatch)(Pt.store);let P;const M=e=>{e.preventDefault(),I(P),P=`block-library/core/latest-posts/redirection-prevented/${o}`,T((0,tt.__)("Links are disabled in the editor."),{id:P,type:"snackbar"})},z=w.filter((({slug:e})=>"full"!==e)).map((({name:e,slug:t})=>({value:t,label:e}))),R=null!==(a=B?.reduce(((e,t)=>({...e,[t.name]:t})),{}))&&void 0!==a?a:{},A=!!E?.length,H=(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Post content")},(0,Ke.createElement)(et.ToggleControl,{label:(0,tt.__)("Post content"),checked:p,onChange:e=>n({displayPostContent:e})}),p&&(0,Ke.createElement)(et.RadioControl,{label:(0,tt.__)("Show:"),selected:u,options:[{label:(0,tt.__)("Excerpt"),value:"excerpt"},{label:(0,tt.__)("Full post"),value:"full_post"}],onChange:e=>n({displayPostContentRadio:e})}),p&&"excerpt"===u&&(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Max number of words"),value:_,onChange:e=>n({excerptLength:e}),min:10,max:100})),(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Post meta")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display author name"),checked:g,onChange:e=>n({displayAuthor:e})}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display post date"),checked:d,onChange:e=>n({displayPostDate:e})})),(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Featured image")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display featured image"),checked:m,onChange:e=>n({displayFeaturedImage:e})}),m&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.__experimentalImageSizeControl,{onChange:e=>{const t={};e.hasOwnProperty("width")&&(t.featuredImageSizeWidth=e.width),e.hasOwnProperty("height")&&(t.featuredImageSizeHeight=e.height),n(t)},slug:v,width:f,height:k,imageWidth:C,imageHeight:S,imageSizeOptions:z,imageSizeHelp:(0,tt.__)("Select the size of the source image."),onChangeImage:e=>n({featuredImageSizeSlug:e,featuredImageSizeWidth:void 0,featuredImageSizeHeight:void 0})}),(0,Ke.createElement)(et.BaseControl,{className:"editor-latest-posts-image-alignment-control"},(0,Ke.createElement)(et.BaseControl.VisualLabel,null,(0,tt.__)("Image alignment")),(0,Ke.createElement)(nt.BlockAlignmentToolbar,{value:y,onChange:e=>n({featuredImageAlign:e}),controls:["left","center","right"],isCollapsed:!1})),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Add link to featured image"),checked:x,onChange:e=>n({addLinkToFeaturedImage:e})}))),(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Sorting and filtering")},(0,Ke.createElement)(et.QueryControls,{order:l,orderBy:i,numberOfItems:r,onOrderChange:e=>n({order:e}),onOrderByChange:e=>n({orderBy:e}),onNumberOfItemsChange:e=>n({postsToShow:e}),categorySuggestions:R,onCategoryChange:e=>{if(e.some((e=>"string"==typeof e&&!R[e])))return;const t=e.map((e=>"string"==typeof e?R[e]:e));if(t.includes(null))return!1;n({categories:t})},selectedCategories:s,onAuthorChange:e=>n({selectedAuthor:""!==e?Number(e):void 0}),authorList:null!=N?N:[],selectedAuthorId:c}),"grid"===h&&(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Columns"),value:b,onChange:e=>n({columns:e}),min:2,max:A?Math.min(6,E.length):6,required:!0}))),L=(0,nt.useBlockProps)({className:ut()({"wp-block-latest-posts__list":!0,"is-grid":"grid"===h,"has-dates":d,"has-author":g,[`columns-${b}`]:"grid"===h})});if(!A)return(0,Ke.createElement)("div",{...L},H,(0,Ke.createElement)(et.Placeholder,{icon:Xn,label:(0,tt.__)("Latest Posts")},Array.isArray(E)?(0,tt.__)("No posts found."):(0,Ke.createElement)(et.Spinner,null)));const D=E.length>r?E.slice(0,r):E,F=[{icon:Tp,title:(0,tt.__)("List view"),onClick:()=>n({postLayout:"list"}),isActive:"list"===h},{icon:Xm,title:(0,tt.__)("Grid view"),onClick:()=>n({postLayout:"grid"}),isActive:"grid"===h}],V=(0,So.getSettings)().formats.date;return(0,Ke.createElement)("div",null,H,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,{controls:F})),(0,Ke.createElement)("ul",{...L},D.map((e=>{const t=e.title.rendered.trim();let n=e.excerpt.rendered;const a=N?.find((t=>t.id===e.author)),o=document.createElement("div");o.innerHTML=n,n=o.textContent||o.innerText||"";const{url:r,alt:l}=function(e,t){var n;const a=e._embedded?.["wp:featuredmedia"]?.[0];return{url:null!==(n=a?.media_details?.sizes?.[t]?.source_url)&&void 0!==n?n:a?.source_url,alt:a?.alt_text}}(e,v),i=ut()({"wp-block-latest-posts__featured-image":!0,[`align${y}`]:!!y}),s=m&&r,c=s&&(0,Ke.createElement)("img",{src:r,alt:l,style:{maxWidth:f,maxHeight:k}}),h=_<n.trim().split(" ").length&&""===e.excerpt.raw?(0,Ke.createElement)(Ke.Fragment,null,n.trim().split(" ",_).join(" "),(0,_t.createInterpolateElement)((0,tt.sprintf)((0,tt.__)("… <a>Read more<span>: %1$s</span></a>"),t||(0,tt.__)("(no title)")),{a:(0,Ke.createElement)("a",{className:"wp-block-latest-posts__read-more",href:e.link,rel:"noopener noreferrer",onClick:M}),span:(0,Ke.createElement)("span",{className:"screen-reader-text"})})):n;return(0,Ke.createElement)("li",{key:e.id},s&&(0,Ke.createElement)("div",{className:i},x?(0,Ke.createElement)("a",{className:"wp-block-latest-posts__post-title",href:e.link,rel:"noreferrer noopener",onClick:M},c):c),(0,Ke.createElement)("a",{href:e.link,rel:"noreferrer noopener",dangerouslySetInnerHTML:t?{__html:t}:void 0,onClick:M},t?null:(0,tt.__)("(no title)")),g&&a&&(0,Ke.createElement)("div",{className:"wp-block-latest-posts__post-author"},(0,tt.sprintf)((0,tt.__)("by %s"),a.name)),d&&e.date_gmt&&(0,Ke.createElement)("time",{dateTime:(0,So.format)("c",e.date_gmt),className:"wp-block-latest-posts__post-date"},(0,So.dateI18n)(V,e.date_gmt)),p&&"excerpt"===u&&(0,Ke.createElement)("div",{className:"wp-block-latest-posts__post-excerpt"},h),p&&"full_post"===u&&(0,Ke.createElement)("div",{className:"wp-block-latest-posts__post-full-content",dangerouslySetInnerHTML:{__html:e.content.raw.trim()}}))}))))},deprecated:Np},Ap=()=>Xe({name:zp,metadata:Mp,settings:Rp}),Hp={A:"upper-alpha",a:"lower-alpha",I:"upper-roman",i:"lower-roman"};function Lp(e){const{values:t,start:n,reversed:a,ordered:o,type:r,...l}=e,i=document.createElement(o?"ol":"ul");i.innerHTML=t,n&&i.setAttribute("start",n),a&&i.setAttribute("reversed",!0),r&&i.setAttribute("type",r);const[s]=(0,Qe.rawHandler)({HTML:i.outerHTML});return[{...l,...s.attributes},s.innerBlocks]}const Dp={attributes:{ordered:{type:"boolean",default:!1,__experimentalRole:"content"},values:{type:"string",source:"html",selector:"ol,ul",multiline:"li",__unstableMultilineWrapperTags:["ol","ul"],default:"",__experimentalRole:"content"},type:{type:"string"},start:{type:"number"},reversed:{type:"boolean"},placeholder:{type:"string"}},supports:{anchor:!0,className:!1,typography:{fontSize:!0,__experimentalFontFamily:!0},color:{gradients:!0,link:!0},__unstablePasteTextInline:!0,__experimentalSelector:"ol,ul",__experimentalSlashInserter:!0},save({attributes:e}){const{ordered:t,values:n,type:a,reversed:o,start:r}=e,l=t?"ol":"ul";return(0,Ke.createElement)(l,{...nt.useBlockProps.save({type:a,reversed:o,start:r})},(0,Ke.createElement)(nt.RichText.Content,{value:n,multiline:"li"}))},migrate:ln,isEligible:({style:e})=>e?.typography?.fontFamily},Fp={attributes:{ordered:{type:"boolean",default:!1,__experimentalRole:"content"},values:{type:"string",source:"html",selector:"ol,ul",multiline:"li",__unstableMultilineWrapperTags:["ol","ul"],default:"",__experimentalRole:"content"},type:{type:"string"},start:{type:"number"},reversed:{type:"boolean"},placeholder:{type:"string"}},supports:{anchor:!0,className:!1,typography:{fontSize:!0,__experimentalFontFamily:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalDefaultControls:{fontSize:!0}},color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},__unstablePasteTextInline:!0,__experimentalSelector:"ol,ul",__experimentalSlashInserter:!0},save({attributes:e}){const{ordered:t,values:n,type:a,reversed:o,start:r}=e,l=t?"ol":"ul";return(0,Ke.createElement)(l,{...nt.useBlockProps.save({type:a,reversed:o,start:r})},(0,Ke.createElement)(nt.RichText.Content,{value:n,multiline:"li"}))},migrate:Lp},Vp={attributes:{ordered:{type:"boolean",default:!1,__experimentalRole:"content"},values:{type:"string",source:"html",selector:"ol,ul",multiline:"li",__unstableMultilineWrapperTags:["ol","ul"],default:"",__experimentalRole:"content"},type:{type:"string"},start:{type:"number"},reversed:{type:"boolean"},placeholder:{type:"string"}},supports:{anchor:!0,className:!1,typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},__unstablePasteTextInline:!0,__experimentalSelector:"ol,ul",__experimentalSlashInserter:!0},isEligible:({type:e})=>!!e,save({attributes:e}){const{ordered:t,type:n,reversed:a,start:o}=e,r=t?"ol":"ul";return(0,Ke.createElement)(r,{...nt.useBlockProps.save({type:n,reversed:a,start:o})},(0,Ke.createElement)(nt.InnerBlocks.Content,null))},migrate:function(e){const{type:t}=e;return t&&Hp[t]?{...e,type:Hp[t]}:e}},$p=[Vp,Fp,Dp],Op=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M20 5.5H4V4H20V5.5ZM12 12.5H4V11H12V12.5ZM20 20V18.5H4V20H20ZM15.4697 14.9697L18.4393 12L15.4697 9.03033L16.5303 7.96967L20.0303 11.4697L20.5607 12L20.0303 12.5303L16.5303 16.0303L15.4697 14.9697Z"})),Gp=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-4-4.6l-4 4 4 4 1-1-3-3 3-3-1-1z"})),Up=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"})),qp=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),jp=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M3.8 15.8h8.9v-1.5H3.8v1.5zm0-7h8.9V7.2H3.8v1.6zm14.7-2.1V10h1V5.3l-2.2.7.3 1 .9-.3zm1.2 6.1c-.5-.6-1.2-.5-1.7-.4-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5H20v-1h-.9c.3-.6.8-1.4.9-2.1 0-.3 0-.8-.3-1.1z"})),Wp=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM5 6.7V10h1V5.3L3.8 6l.4 1 .8-.3zm-.4 5.7c-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5h2.7v-1h-1c.3-.6.8-1.4.9-2.1.1-.3 0-.8-.2-1.1-.5-.6-1.3-.5-1.7-.4z"})),Zp=window.wp.deprecated;var Qp=n.n(Zp);const Kp=({setAttributes:e,reversed:t,start:n,type:a})=>(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Ordered list settings")},(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Start value"),type:"number",onChange:t=>{const n=parseInt(t,10);e({start:isNaN(n)?void 0:n})},value:Number.isInteger(n)?n.toString(10):"",step:"1"}),(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Numbering style"),options:[{label:(0,tt.__)("Numbers"),value:"decimal"},{label:(0,tt.__)("Uppercase letters"),value:"upper-alpha"},{label:(0,tt.__)("Lowercase letters"),value:"lower-alpha"},{label:(0,tt.__)("Uppercase Roman numerals"),value:"upper-roman"},{label:(0,tt.__)("Lowercase Roman numerals"),value:"lower-roman"}],value:a,onChange:t=>e({type:t})}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Reverse list numbering"),checked:t||!1,onChange:t=>{e({reversed:t||void 0})}})));const Yp=(0,_t.forwardRef)((function(e,t){const{ordered:n,...a}=e,o=n?"ol":"ul";return(0,Ke.createElement)(o,{ref:t,...a})})),Jp=[["core/list-item"]];function Xp({clientId:e}){const t=function(e){const{replaceBlocks:t,selectionChange:n}=(0,gt.useDispatch)(nt.store),{getBlockRootClientId:a,getBlockAttributes:o,getBlock:r}=(0,gt.useSelect)(nt.store);return(0,_t.useCallback)((()=>{const l=a(e),i=o(l),s=(0,Qe.createBlock)("core/list-item",i),{innerBlocks:c}=r(e);t([l],[s,...c]),n(c[c.length-1].clientId)}),[e])}(e),n=(0,gt.useSelect)((t=>{const{getBlockRootClientId:n,getBlockName:a}=t(nt.store);return"core/list-item"===a(n(e))}),[e]);return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ToolbarButton,{icon:(0,tt.isRTL)()?Op:Gp,title:(0,tt.__)("Outdent"),describedBy:(0,tt.__)("Outdent list item"),disabled:!n,onClick:t}))}function ed({phrasingContentSchema:e}){const t={...e,ul:{},ol:{attributes:["type","start","reversed"]}};return["ul","ol"].forEach((e=>{t[e].children={li:{children:t}}})),t}function td(e){return e.flatMap((({name:e,attributes:t,innerBlocks:n=[]})=>"core/list-item"===e?[t.content,...td(n)]:td(n)))}const nd={from:[{type:"block",isMultiBlock:!0,blocks:["core/paragraph","core/heading"],transform:e=>{let t=[];if(e.length>1)t=e.map((({content:e})=>(0,Qe.createBlock)("core/list-item",{content:e})));else if(1===e.length){const n=(0,Rn.create)({html:e[0].content});t=(0,Rn.split)(n,"\n").map((e=>(0,Qe.createBlock)("core/list-item",{content:(0,Rn.toHTMLString)({value:e})})))}return(0,Qe.createBlock)("core/list",{anchor:e.anchor},t)}},{type:"raw",selector:"ol,ul",schema:e=>({ol:ed(e).ol,ul:ed(e).ul}),transform:function e(t){const n=t.getAttribute("type"),a={ordered:"OL"===t.tagName,anchor:""===t.id?void 0:t.id,start:t.getAttribute("start")?parseInt(t.getAttribute("start"),10):void 0,reversed:!!t.hasAttribute("reversed")||void 0,type:n&&Hp[n]?Hp[n]:void 0},o=Array.from(t.children).map((t=>{const n=Array.from(t.childNodes).filter((e=>e.nodeType!==e.TEXT_NODE||0!==e.textContent.trim().length));n.reverse();const[a,...o]=n;if(!("UL"===a?.tagName||"OL"===a?.tagName))return(0,Qe.createBlock)("core/list-item",{content:t.innerHTML});const r=o.map((e=>e.nodeType===e.TEXT_NODE?e.textContent:e.outerHTML));r.reverse();const l={content:r.join("").trim()},i=[e(a)];return(0,Qe.createBlock)("core/list-item",l,i)}));return(0,Qe.createBlock)("core/list",a,o)}},...["*","-"].map((e=>({type:"prefix",prefix:e,transform:e=>(0,Qe.createBlock)("core/list",{},[(0,Qe.createBlock)("core/list-item",{content:e})])}))),...["1.","1)"].map((e=>({type:"prefix",prefix:e,transform:e=>(0,Qe.createBlock)("core/list",{ordered:!0},[(0,Qe.createBlock)("core/list-item",{content:e})])})))],to:[...["core/paragraph","core/heading"].map((e=>({type:"block",blocks:[e],transform:(t,n)=>td(n).map((t=>(0,Qe.createBlock)(e,{content:t})))})))]},ad=nd,od={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/list",title:"List",category:"text",allowedBlocks:["core/list-item"],description:"Create a bulleted or numbered list.",keywords:["bullet list","ordered list","numbered list"],textdomain:"default",attributes:{ordered:{type:"boolean",default:!1,__experimentalRole:"content"},values:{type:"string",source:"html",selector:"ol,ul",multiline:"li",__unstableMultilineWrapperTags:["ol","ul"],default:"",__experimentalRole:"content"},type:{type:"string"},start:{type:"number"},reversed:{type:"boolean"},placeholder:{type:"string"}},supports:{anchor:!0,className:!1,typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},__unstablePasteTextInline:!0,__experimentalSelector:"ol,ul",__experimentalOnMerge:!0,__experimentalSlashInserter:!0,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-list-editor",style:"wp-block-list"},{name:rd}=od,ld={icon:Tp,example:{innerBlocks:[{name:"core/list-item",attributes:{content:(0,tt.__)("Alice.")}},{name:"core/list-item",attributes:{content:(0,tt.__)("The White Rabbit.")}},{name:"core/list-item",attributes:{content:(0,tt.__)("The Cheshire Cat.")}},{name:"core/list-item",attributes:{content:(0,tt.__)("The Mad Hatter.")}},{name:"core/list-item",attributes:{content:(0,tt.__)("The Queen of Hearts.")}}]},transforms:ad,edit:function({attributes:e,setAttributes:t,clientId:n,style:a}){const{ordered:o,type:r,reversed:l,start:i}=e,s=(0,nt.useBlockProps)({style:{..._t.Platform.isNative&&a,listStyleType:o&&"decimal"!==r?r:void 0}}),c=(0,nt.useInnerBlocksProps)(s,{template:Jp,templateLock:!1,templateInsertUpdatesSelection:!0,..._t.Platform.isNative&&{marginVertical:8,marginHorizontal:8,renderAppender:!1},__experimentalCaptureToolbars:!0});!function(e,t){const n=(0,gt.useRegistry)(),{updateBlockAttributes:a,replaceInnerBlocks:o}=(0,gt.useDispatch)(nt.store);(0,_t.useEffect)((()=>{if(!e.values)return;const[r,l]=Lp(e);Qp()("Value attribute on the list block",{since:"6.0",version:"6.5",alternative:"inner blocks"}),n.batch((()=>{a(t,r),o(t,l)}))}),[e.values])}(e,n);const m=(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(et.ToolbarButton,{icon:(0,tt.isRTL)()?Up:qp,title:(0,tt.__)("Unordered"),describedBy:(0,tt.__)("Convert to unordered list"),isActive:!1===o,onClick:()=>{t({ordered:!1})}}),(0,Ke.createElement)(et.ToolbarButton,{icon:(0,tt.isRTL)()?jp:Wp,title:(0,tt.__)("Ordered"),describedBy:(0,tt.__)("Convert to ordered list"),isActive:!0===o,onClick:()=>{t({ordered:!0})}}),(0,Ke.createElement)(Xp,{clientId:n}));return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(Yp,{ordered:o,reversed:l,start:i,...c}),m,o&&(0,Ke.createElement)(Kp,{setAttributes:t,reversed:l,start:i,type:r}))},save:function({attributes:e}){const{ordered:t,type:n,reversed:a,start:o}=e,r=t?"ol":"ul";return(0,Ke.createElement)(r,{...nt.useBlockProps.save({reversed:a,start:o,style:{listStyleType:t&&"decimal"!==n?n:void 0}})},(0,Ke.createElement)(nt.InnerBlocks.Content,null))},deprecated:$p},id=()=>Xe({name:rd,metadata:od,settings:ld}),sd=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M12 11v1.5h8V11h-8zm-6-1c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),cd=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M20 5.5H4V4H20V5.5ZM12 12.5H4V11H12V12.5ZM20 20V18.5H4V20H20ZM20.0303 9.03033L17.0607 12L20.0303 14.9697L18.9697 16.0303L15.4697 12.5303L14.9393 12L15.4697 11.4697L18.9697 7.96967L20.0303 9.03033Z"})),md=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-8-3.5l3 3-3 3 1 1 4-4-4-4-1 1z"}));function ud(e){const{replaceBlocks:t,selectionChange:n,multiSelect:a}=(0,gt.useDispatch)(nt.store),{getBlock:o,getPreviousBlockClientId:r,getSelectionStart:l,getSelectionEnd:i,hasMultiSelection:s,getMultiSelectedBlockClientIds:c}=(0,gt.useSelect)(nt.store);return(0,_t.useCallback)((()=>{const m=s(),u=m?c():[e],p=u.map((e=>(0,Qe.cloneBlock)(o(e)))),d=r(e),g=(0,Qe.cloneBlock)(o(d));g.innerBlocks?.length||(g.innerBlocks=[(0,Qe.createBlock)("core/list")]),g.innerBlocks[g.innerBlocks.length-1].innerBlocks.push(...p);const h=l(),b=i();t([d,...u],[g]),m?a(p[0].clientId,p[p.length-1].clientId):n(p[0].clientId,b.attributeKey,b.clientId===h.clientId?h.offset:b.offset,b.offset)}),[e])}function pd(){const e=(0,gt.useRegistry)(),{moveBlocksToPosition:t,removeBlock:n,insertBlock:a,updateBlockListSettings:o}=(0,gt.useDispatch)(nt.store),{getBlockRootClientId:r,getBlockName:l,getBlockOrder:i,getBlockIndex:s,getSelectedBlockClientIds:c,getBlock:m,getBlockListSettings:u}=(0,gt.useSelect)(nt.store);return(0,_t.useCallback)(((p=c())=>{if(Array.isArray(p)||(p=[p]),!p.length)return;const d=p[0];if("core/list-item"!==l(d))return;const g=function(e){const t=r(e),n=r(t);if(n&&"core/list-item"===l(n))return n}(d);if(!g)return;const h=r(d),b=p[p.length-1],_=i(h).slice(s(b)+1);e.batch((()=>{if(_.length){let e=i(d)[0];if(!e){const t=(0,Qe.cloneBlock)(m(h),{},[]);e=t.clientId,a(t,0,d,!1),o(e,u(h))}t(_,h,e)}if(t(p,h,r(g),s(g)+1),!i(h).length){n(h,!1)}}))}),[])}function dd(e,t){const n=(0,gt.useRegistry)(),{getPreviousBlockClientId:a,getNextBlockClientId:o,getBlockOrder:r,getBlockRootClientId:l,getBlockName:i}=(0,gt.useSelect)(nt.store),{mergeBlocks:s,moveBlocksToPosition:c}=(0,gt.useDispatch)(nt.store),m=pd();function u(e){const t=r(e);return t.length?u(t[t.length-1]):e}function p(e){const t=l(e),n=l(t);if(n&&"core/list-item"===i(n))return n}function d(e){const t=o(e);if(t)return t;const n=p(e);return n?d(n):void 0}function g(e){const t=r(e);return t.length?r(t[0])[0]:d(e)}return o=>{function i(e,t){n.batch((()=>{const[n]=r(t);n&&c(r(n),n,l(e)),s(e,t)}))}if(o){const n=g(e);if(!n)return void t(o);p(n)?m(n):i(e,n)}else{const n=a(e);if(p(e))m(e);else if(n){i(u(n),e)}else t(o)}}}function gd(e){const t=(0,Qe.switchToBlockType)(e,"core/list");if(t)return t;const n=(0,Qe.switchToBlockType)(e,"core/paragraph");return n?(0,Qe.switchToBlockType)(n,"core/list"):null}function hd({clientId:e}){const t=ud(e),n=pd(),{canIndent:a,canOutdent:o}=(0,gt.useSelect)((t=>{const{getBlockIndex:n,getBlockRootClientId:a,getBlockName:o}=t(nt.store);return{canIndent:n(e)>0,canOutdent:"core/list-item"===o(a(a(e)))}}),[e]);return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ToolbarButton,{icon:(0,tt.isRTL)()?Op:Gp,title:(0,tt.__)("Outdent"),describedBy:(0,tt.__)("Outdent list item"),disabled:!o,onClick:()=>n()}),(0,Ke.createElement)(et.ToolbarButton,{icon:(0,tt.isRTL)()?cd:md,title:(0,tt.__)("Indent"),describedBy:(0,tt.__)("Indent list item"),isDisabled:!a,onClick:()=>t()}))}const bd={to:[{type:"block",blocks:["core/paragraph"],transform:(e,t=[])=>[(0,Qe.createBlock)("core/paragraph",e),...t.map((e=>(0,Qe.cloneBlock)(e)))]}]},_d=bd,yd={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/list-item",title:"List item",category:"text",parent:["core/list"],allowedBlocks:["core/list"],description:"Create a list item.",textdomain:"default",attributes:{placeholder:{type:"string"},content:{type:"rich-text",source:"rich-text",selector:"li",__experimentalRole:"content"}},supports:{className:!1,__experimentalSelector:"li",spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:vd}=yd,fd={icon:sd,edit:function({attributes:e,setAttributes:t,onReplace:n,clientId:a,mergeBlocks:o}){const{placeholder:r,content:l}=e,i=(0,nt.useBlockProps)(),s=(0,nt.useInnerBlocksProps)(i,{renderAppender:!1,__unstableDisableDropZone:!0}),c=function(e){const{replaceBlocks:t,selectionChange:n}=(0,gt.useDispatch)(nt.store),{getBlock:a,getBlockRootClientId:o,getBlockIndex:r,getBlockName:l}=(0,gt.useSelect)(nt.store),i=(0,_t.useRef)(e);i.current=e;const s=pd();return(0,jt.useRefEffect)((e=>{function c(e){if(e.defaultPrevented||e.keyCode!==fn.ENTER)return;const{content:c,clientId:m}=i.current;if(c.length)return;if(e.preventDefault(),"core/list-item"===l(o(o(i.current.clientId))))return void s();const u=a(o(m)),p=r(m),d=(0,Qe.cloneBlock)({...u,innerBlocks:u.innerBlocks.slice(0,p)}),g=(0,Qe.createBlock)((0,Qe.getDefaultBlockName)()),h=[...u.innerBlocks[p].innerBlocks[0]?.innerBlocks||[],...u.innerBlocks.slice(p+1)],b=h.length?[(0,Qe.cloneBlock)({...u,innerBlocks:h})]:[];t(u.clientId,[d,g,...b],1),n(g.clientId)}return e.addEventListener("keydown",c),()=>{e.removeEventListener("keydown",c)}}),[])}({content:l,clientId:a}),m=function(e){const{getSelectionStart:t,getSelectionEnd:n,getBlockIndex:a}=(0,gt.useSelect)(nt.store),o=ud(e);return(0,jt.useRefEffect)((r=>{function l(r){const{keyCode:l,shiftKey:i,altKey:s,metaKey:c,ctrlKey:m}=r;if(r.defaultPrevented||l!==fn.SPACE||i||s||c||m)return;if(0===a(e))return;const u=t(),p=n();0===u.offset&&0===p.offset&&(r.preventDefault(),o())}return r.addEventListener("keydown",l),()=>{r.removeEventListener("keydown",l)}}),[e,o])}(a),u=function(e){const t=(0,_t.useRef)(!1),{getBlock:n}=(0,gt.useSelect)(nt.store);return(0,_t.useCallback)((a=>{const o=n(e);return t.current?(0,Qe.cloneBlock)(o,{content:a}):(t.current=!0,(0,Qe.createBlock)(o.name,{...o.attributes,content:a}))}),[e,n])}(a),p=dd(a,o);return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("li",{...s},(0,Ke.createElement)(nt.RichText,{ref:(0,jt.useMergeRefs)([c,m]),identifier:"content",tagName:"div",onChange:e=>t({content:e}),value:l,"aria-label":(0,tt.__)("List text"),placeholder:r||(0,tt.__)("List"),onSplit:u,onMerge:p,onReplace:n?(e,...t)=>{n(function(e){const t=[];for(let n of e)if("core/list-item"===n.name)t.push(n);else if("core/list"===n.name)t.push(...n.innerBlocks);else if(n=gd(n))for(const{innerBlocks:e}of n)t.push(...e);return t}(e),...t)}:void 0}),s.children),(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(hd,{clientId:a})))},save:function({attributes:e}){return(0,Ke.createElement)("li",{...nt.useBlockProps.save()},(0,Ke.createElement)(nt.RichText.Content,{value:e.content}),(0,Ke.createElement)(nt.InnerBlocks.Content,null))},merge:(e,t)=>({...e,content:e.content+t.content}),transforms:_d,[Ft(nt.privateApis).requiresWrapperOnCopy]:!0},kd=()=>Xe({name:vd,metadata:yd,settings:fd}),xd=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M11 14.5l1.1 1.1 3-3 .5-.5-.6-.6-3-3-1 1 1.7 1.7H5v1.5h7.7L11 14.5zM16.8 5h-7c-1.1 0-2 .9-2 2v1.5h1.5V7c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v10c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5v-1.5H7.8V17c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2z"}));const wd={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/loginout",title:"Login/out",category:"theme",description:"Show login & logout links.",keywords:["login","logout","form"],textdomain:"default",attributes:{displayLoginAsForm:{type:"boolean",default:!1},redirectToCurrent:{type:"boolean",default:!0}},supports:{className:!0,spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:Ed}=wd,Cd={icon:xd,edit:function({attributes:e,setAttributes:t}){const{displayLoginAsForm:n,redirectToCurrent:a}=e;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display login as form"),checked:n,onChange:()=>t({displayLoginAsForm:!n})}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Redirect to current URL"),checked:a,onChange:()=>t({redirectToCurrent:!a})}))),(0,Ke.createElement)("div",{...(0,nt.useBlockProps)({className:"logged-in"})},(0,Ke.createElement)("a",{href:"#login-pseudo-link"},(0,tt.__)("Log out"))))}},Sd=()=>Xe({name:Ed,metadata:wd,settings:Cd}),Bd=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M3 6v11.5h8V6H3Zm11 3h7V7.5h-7V9Zm7 3.5h-7V11h7v1.5ZM14 16h7v-1.5h-7V16Z"})),Nd="full",Td="media",Id="attachment",Pd=[["core/paragraph",{placeholder:(0,tt._x)("Content…","content placeholder")}]],Md=(e,t)=>e?{backgroundImage:`url(${e})`,backgroundPosition:t?`${100*t.x}% ${100*t.y}%`:"50% 50%"}:{},zd=50,Rd=()=>{},Ad=e=>{if(!e.customBackgroundColor)return e;const t={color:{background:e.customBackgroundColor}},{customBackgroundColor:n,...a}=e;return{...a,style:t}},Hd=e=>e.align?e:{...e,align:"wide"},Ld={align:{type:"string",default:"wide"},mediaAlt:{type:"string",source:"attribute",selector:"figure img",attribute:"alt",default:""},mediaPosition:{type:"string",default:"left"},mediaId:{type:"number"},mediaType:{type:"string"},mediaWidth:{type:"number",default:50},isStackedOnMobile:{type:"boolean",default:!1}},Dd={...Ld,isStackedOnMobile:{type:"boolean",default:!0},mediaUrl:{type:"string",source:"attribute",selector:"figure video,figure img",attribute:"src"},mediaLink:{type:"string"},linkDestination:{type:"string"},linkTarget:{type:"string",source:"attribute",selector:"figure a",attribute:"target"},href:{type:"string",source:"attribute",selector:"figure a",attribute:"href"},rel:{type:"string",source:"attribute",selector:"figure a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"figure a",attribute:"class"},mediaSizeSlug:{type:"string"},verticalAlignment:{type:"string"},imageFill:{type:"boolean"},focalPoint:{type:"object"}},Fd={anchor:!0,align:["wide","full"],html:!1,color:{gradients:!0,link:!0}},Vd={attributes:{...Dd,mediaAlt:{type:"string",source:"attribute",selector:"figure img",attribute:"alt",default:"",__experimentalRole:"content"},mediaId:{type:"number",__experimentalRole:"content"},mediaUrl:{type:"string",source:"attribute",selector:"figure video,figure img",attribute:"src",__experimentalRole:"content"},href:{type:"string",source:"attribute",selector:"figure a",attribute:"href",__experimentalRole:"content"},mediaType:{type:"string",__experimentalRole:"content"}},supports:{...Fd,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}}},save({attributes:e}){const{isStackedOnMobile:t,mediaAlt:n,mediaPosition:a,mediaType:o,mediaUrl:r,mediaWidth:l,mediaId:i,verticalAlignment:s,imageFill:c,focalPoint:m,linkClass:u,href:p,linkTarget:d,rel:g}=e,h=e.mediaSizeSlug||Nd,b=g||void 0,_=ut()({[`wp-image-${i}`]:i&&"image"===o,[`size-${h}`]:i&&"image"===o});let y=(0,Ke.createElement)("img",{src:r,alt:n,className:_||null});p&&(y=(0,Ke.createElement)("a",{className:u,href:p,target:d,rel:b},y));const v={image:()=>y,video:()=>(0,Ke.createElement)("video",{controls:!0,src:r})},f=ut()({"has-media-on-the-right":"right"===a,"is-stacked-on-mobile":t,[`is-vertically-aligned-${s}`]:s,"is-image-fill":c}),k=c?((e,t)=>e?{backgroundImage:`url(${e})`,backgroundPosition:t?`${Math.round(100*t.x)}% ${Math.round(100*t.y)}%`:"50% 50%"}:{})(r,m):{};let x;l!==zd&&(x="right"===a?`auto ${l}%`:`${l}% auto`);const w={gridTemplateColumns:x};return"right"===a?(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:f,style:w})},(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-media-text__content"})}),(0,Ke.createElement)("figure",{className:"wp-block-media-text__media",style:k},(v[o]||Rd)())):(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:f,style:w})},(0,Ke.createElement)("figure",{className:"wp-block-media-text__media",style:k},(v[o]||Rd)()),(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-media-text__content"})}))},migrate:Hd,isEligible(e,t,{block:n}){const{attributes:a}=n;return void 0===e.align&&!!a.className?.includes("alignwide")}},$d={attributes:Dd,supports:Fd,save({attributes:e}){const{isStackedOnMobile:t,mediaAlt:n,mediaPosition:a,mediaType:o,mediaUrl:r,mediaWidth:l,mediaId:i,verticalAlignment:s,imageFill:c,focalPoint:m,linkClass:u,href:p,linkTarget:d,rel:g}=e,h=e.mediaSizeSlug||Nd,b=g||void 0,_=ut()({[`wp-image-${i}`]:i&&"image"===o,[`size-${h}`]:i&&"image"===o});let y=(0,Ke.createElement)("img",{src:r,alt:n,className:_||null});p&&(y=(0,Ke.createElement)("a",{className:u,href:p,target:d,rel:b},y));const v={image:()=>y,video:()=>(0,Ke.createElement)("video",{controls:!0,src:r})},f=ut()({"has-media-on-the-right":"right"===a,"is-stacked-on-mobile":t,[`is-vertically-aligned-${s}`]:s,"is-image-fill":c}),k=c?Md(r,m):{};let x;l!==zd&&(x="right"===a?`auto ${l}%`:`${l}% auto`);const w={gridTemplateColumns:x};return"right"===a?(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:f,style:w})},(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-media-text__content"})}),(0,Ke.createElement)("figure",{className:"wp-block-media-text__media",style:k},(v[o]||Rd)())):(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:f,style:w})},(0,Ke.createElement)("figure",{className:"wp-block-media-text__media",style:k},(v[o]||Rd)()),(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-media-text__content"})}))},migrate:Hd},Od={attributes:Dd,supports:Fd,save({attributes:e}){const{isStackedOnMobile:t,mediaAlt:n,mediaPosition:a,mediaType:o,mediaUrl:r,mediaWidth:l,mediaId:i,verticalAlignment:s,imageFill:c,focalPoint:m,linkClass:u,href:p,linkTarget:d,rel:g}=e,h=e.mediaSizeSlug||Nd,b=g||void 0,_=ut()({[`wp-image-${i}`]:i&&"image"===o,[`size-${h}`]:i&&"image"===o});let y=(0,Ke.createElement)("img",{src:r,alt:n,className:_||null});p&&(y=(0,Ke.createElement)("a",{className:u,href:p,target:d,rel:b},y));const v={image:()=>y,video:()=>(0,Ke.createElement)("video",{controls:!0,src:r})},f=ut()({"has-media-on-the-right":"right"===a,"is-stacked-on-mobile":t,[`is-vertically-aligned-${s}`]:s,"is-image-fill":c}),k=c?Md(r,m):{};let x;l!==zd&&(x="right"===a?`auto ${l}%`:`${l}% auto`);const w={gridTemplateColumns:x};return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:f,style:w})},(0,Ke.createElement)("figure",{className:"wp-block-media-text__media",style:k},(v[o]||Rd)()),(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-media-text__content"})}))},migrate:Hd},Gd={attributes:{...Ld,isStackedOnMobile:{type:"boolean",default:!0},backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},mediaLink:{type:"string"},linkDestination:{type:"string"},linkTarget:{type:"string",source:"attribute",selector:"figure a",attribute:"target"},href:{type:"string",source:"attribute",selector:"figure a",attribute:"href"},rel:{type:"string",source:"attribute",selector:"figure a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"figure a",attribute:"class"},verticalAlignment:{type:"string"},imageFill:{type:"boolean"},focalPoint:{type:"object"}},migrate:(0,jt.compose)(Ad,Hd),save({attributes:e}){const{backgroundColor:t,customBackgroundColor:n,isStackedOnMobile:a,mediaAlt:o,mediaPosition:r,mediaType:l,mediaUrl:i,mediaWidth:s,mediaId:c,verticalAlignment:m,imageFill:u,focalPoint:p,linkClass:d,href:g,linkTarget:h,rel:b}=e,_=b||void 0;let y=(0,Ke.createElement)("img",{src:i,alt:o,className:c&&"image"===l?`wp-image-${c}`:null});g&&(y=(0,Ke.createElement)("a",{className:d,href:g,target:h,rel:_},y));const v={image:()=>y,video:()=>(0,Ke.createElement)("video",{controls:!0,src:i})},f=(0,nt.getColorClassName)("background-color",t),k=ut()({"has-media-on-the-right":"right"===r,"has-background":f||n,[f]:f,"is-stacked-on-mobile":a,[`is-vertically-aligned-${m}`]:m,"is-image-fill":u}),x=u?Md(i,p):{};let w;s!==zd&&(w="right"===r?`auto ${s}%`:`${s}% auto`);const E={backgroundColor:f?void 0:n,gridTemplateColumns:w};return(0,Ke.createElement)("div",{className:k,style:E},(0,Ke.createElement)("figure",{className:"wp-block-media-text__media",style:x},(v[l]||Rd)()),(0,Ke.createElement)("div",{className:"wp-block-media-text__content"},(0,Ke.createElement)(nt.InnerBlocks.Content,null)))}},Ud={attributes:{...Ld,backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},mediaUrl:{type:"string",source:"attribute",selector:"figure video,figure img",attribute:"src"},verticalAlignment:{type:"string"},imageFill:{type:"boolean"},focalPoint:{type:"object"}},migrate:(0,jt.compose)(Ad,Hd),save({attributes:e}){const{backgroundColor:t,customBackgroundColor:n,isStackedOnMobile:a,mediaAlt:o,mediaPosition:r,mediaType:l,mediaUrl:i,mediaWidth:s,mediaId:c,verticalAlignment:m,imageFill:u,focalPoint:p}=e,d={image:()=>(0,Ke.createElement)("img",{src:i,alt:o,className:c&&"image"===l?`wp-image-${c}`:null}),video:()=>(0,Ke.createElement)("video",{controls:!0,src:i})},g=(0,nt.getColorClassName)("background-color",t),h=ut()({"has-media-on-the-right":"right"===r,[g]:g,"is-stacked-on-mobile":a,[`is-vertically-aligned-${m}`]:m,"is-image-fill":u}),b=u?Md(i,p):{};let _;s!==zd&&(_="right"===r?`auto ${s}%`:`${s}% auto`);const y={backgroundColor:g?void 0:n,gridTemplateColumns:_};return(0,Ke.createElement)("div",{className:h,style:y},(0,Ke.createElement)("figure",{className:"wp-block-media-text__media",style:b},(d[l]||Rd)()),(0,Ke.createElement)("div",{className:"wp-block-media-text__content"},(0,Ke.createElement)(nt.InnerBlocks.Content,null)))}},qd={attributes:{...Ld,backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},mediaUrl:{type:"string",source:"attribute",selector:"figure video,figure img",attribute:"src"}},migrate:Hd,save({attributes:e}){const{backgroundColor:t,customBackgroundColor:n,isStackedOnMobile:a,mediaAlt:o,mediaPosition:r,mediaType:l,mediaUrl:i,mediaWidth:s}=e,c={image:()=>(0,Ke.createElement)("img",{src:i,alt:o}),video:()=>(0,Ke.createElement)("video",{controls:!0,src:i})},m=(0,nt.getColorClassName)("background-color",t),u=ut()({"has-media-on-the-right":"right"===r,[m]:m,"is-stacked-on-mobile":a});let p;s!==zd&&(p="right"===r?`auto ${s}%`:`${s}% auto`);const d={backgroundColor:m?void 0:n,gridTemplateColumns:p};return(0,Ke.createElement)("div",{className:u,style:d},(0,Ke.createElement)("figure",{className:"wp-block-media-text__media"},(c[l]||Rd)()),(0,Ke.createElement)("div",{className:"wp-block-media-text__content"},(0,Ke.createElement)(nt.InnerBlocks.Content,null)))}},jd=[Vd,$d,Od,Gd,Ud,qd],Wd=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M4 18h6V6H4v12zm9-9.5V10h7V8.5h-7zm0 7h7V14h-7v1.5z"})),Zd=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M14 6v12h6V6h-6zM4 10h7V8.5H4V10zm0 5.5h7V14H4v1.5z"})),Qd=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"m7 6.5 4 2.5-4 2.5z"}),(0,Ke.createElement)(Ye.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z"})),Kd=["image","video"],Yd=()=>{};function Jd(e,t){return e?{backgroundImage:`url(${e})`,backgroundPosition:t?`${Math.round(100*t.x)}% ${Math.round(100*t.y)}%`:"50% 50%"}:{}}const Xd=(0,_t.forwardRef)((({isSelected:e,isStackedOnMobile:t,...n},a)=>{const o=(0,jt.useViewportMatch)("small","<");return(0,Ke.createElement)(et.ResizableBox,{ref:a,showHandle:e&&(!o||!t),...n})}));function eg({mediaId:e,mediaUrl:t,onSelectMedia:n}){return(0,Ke.createElement)(nt.BlockControls,{group:"other"},(0,Ke.createElement)(nt.MediaReplaceFlow,{mediaId:e,mediaURL:t,allowedTypes:Kd,accept:"image/*,video/*",onSelect:n}))}function tg({className:e,mediaUrl:t,onSelectMedia:n}){const{createErrorNotice:a}=(0,gt.useDispatch)(Pt.store);return(0,Ke.createElement)(nt.MediaPlaceholder,{icon:(0,Ke.createElement)(nt.BlockIcon,{icon:Qd}),labels:{title:(0,tt.__)("Media area")},className:e,onSelect:n,accept:"image/*,video/*",allowedTypes:Kd,onError:e=>{a(e,{type:"snackbar"})},disableMediaButtons:t})}const ng=(0,_t.forwardRef)((function(e,t){const{className:n,commitWidthChange:a,focalPoint:o,imageFill:r,isSelected:l,isStackedOnMobile:i,mediaAlt:s,mediaId:c,mediaPosition:m,mediaType:u,mediaUrl:p,mediaWidth:d,onSelectMedia:g,onWidthChange:h,enableResize:b}=e,_=!c&&(0,It.isBlobURL)(p),{toggleSelection:y}=(0,gt.useDispatch)(nt.store);if(p){const v=()=>{y(!1)},f=(e,t,n)=>{h(parseInt(n.style.width))},k=(e,t,n)=>{y(!0),a(parseInt(n.style.width))},x={right:b&&"left"===m,left:b&&"right"===m},w="image"===u&&r?Jd(p,o):{},E={image:()=>(0,Ke.createElement)("img",{src:p,alt:s}),video:()=>(0,Ke.createElement)("video",{controls:!0,src:p})};return(0,Ke.createElement)(Xd,{as:"figure",className:ut()(n,"editor-media-container__resizer",{"is-transient":_}),style:w,size:{width:d+"%"},minWidth:"10%",maxWidth:"100%",enable:x,onResizeStart:v,onResize:f,onResizeStop:k,axis:"x",isSelected:l,isStackedOnMobile:i,ref:t},(0,Ke.createElement)(eg,{onSelectMedia:g,mediaUrl:p,mediaId:c}),(E[u]||Yd)(),_&&(0,Ke.createElement)(et.Spinner,null),(0,Ke.createElement)(tg,{...e}))}return(0,Ke.createElement)(tg,{...e})})),ag=e=>Math.max(15,Math.min(e,85));function og(e,t){return e?.media_details?.sizes?.[t]?.source_url}const rg=function({attributes:e,isSelected:t,setAttributes:n}){const{focalPoint:a,href:o,imageFill:r,isStackedOnMobile:l,linkClass:i,linkDestination:s,linkTarget:c,mediaAlt:m,mediaId:u,mediaPosition:p,mediaType:d,mediaUrl:g,mediaWidth:h,rel:b,verticalAlignment:_,allowedBlocks:y}=e,v=e.mediaSizeSlug||Nd,{imageSizes:f,image:k}=(0,gt.useSelect)((e=>{const{getSettings:n}=e(nt.store);return{image:u&&t?e(dt.store).getMedia(u,{context:"view"}):null,imageSizes:n()?.imageSizes}}),[t,u]),x=(0,_t.useRef)(),w=e=>{const{style:t}=x.current.resizable,{x:n,y:a}=e;t.backgroundPosition=`${100*n}% ${100*a}%`},[E,C]=(0,_t.useState)(null),S=function({attributes:{linkDestination:e,href:t},setAttributes:n}){return a=>{if(!a||!a.url)return void n({mediaAlt:void 0,mediaId:void 0,mediaType:void 0,mediaUrl:void 0,mediaLink:void 0,href:void 0,focalPoint:void 0});let o,r;(0,It.isBlobURL)(a.url)&&(a.type=(0,It.getBlobTypeByURL)(a.url)),o=a.media_type?"image"===a.media_type?"image":"video":a.type,"image"===o&&(r=a.sizes?.large?.url||a.media_details?.sizes?.large?.source_url);let l=t;e===Td&&(l=a.url),e===Id&&(l=a.link),n({mediaAlt:a.alt,mediaId:a.id,mediaType:o,mediaUrl:r||a.url,mediaLink:a.link||void 0,href:l,focalPoint:void 0})}}({attributes:e,setAttributes:n}),B=e=>{n({mediaWidth:ag(e)}),C(null)},N=ut()({"has-media-on-the-right":"right"===p,"is-selected":t,"is-stacked-on-mobile":l,[`is-vertically-aligned-${_}`]:_,"is-image-fill":r}),T=`${E||h}%`,I="right"===p?`1fr ${T}`:`${T} 1fr`,P={gridTemplateColumns:I,msGridColumns:I},M=f.filter((({slug:e})=>og(k,e))).map((({name:e,slug:t})=>({value:t,label:e}))),z=(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Media width"),value:E||h,onChange:B,min:15,max:85}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Stack on mobile"),checked:l,onChange:()=>n({isStackedOnMobile:!l})}),"image"===d&&(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Crop image to fill"),checked:!!r,onChange:()=>n({imageFill:!r})}),r&&g&&"image"===d&&(0,Ke.createElement)(et.FocalPointPicker,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Focal point"),url:g,value:a,onChange:e=>n({focalPoint:e}),onDragStart:w,onDrag:w}),"image"===d&&(0,Ke.createElement)(et.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Alternative text"),value:m,onChange:e=>{n({mediaAlt:e})},help:(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ExternalLink,{href:"https://www.w3.org/WAI/tutorials/images/decision-tree"},(0,tt.__)("Describe the purpose of the image.")),(0,Ke.createElement)("br",null),(0,tt.__)("Leave empty if decorative."))}),"image"===d&&(0,Ke.createElement)(nt.__experimentalImageSizeControl,{onChangeImage:e=>{const t=og(k,e);if(!t)return null;n({mediaUrl:t,mediaSizeSlug:e})},slug:v,imageSizeOptions:M,isResizable:!1,imageSizeHelp:(0,tt.__)("Select the size of the source image.")})),R=(0,nt.useBlockProps)({className:N,style:P}),A=(0,nt.useInnerBlocksProps)({className:"wp-block-media-text__content"},{template:Pd,allowedBlocks:y}),H=(0,nt.useBlockEditingMode)();return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,z),(0,Ke.createElement)(nt.BlockControls,{group:"block"},"default"===H&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockVerticalAlignmentControl,{onChange:e=>{n({verticalAlignment:e})},value:_}),(0,Ke.createElement)(et.ToolbarButton,{icon:Wd,title:(0,tt.__)("Show media on left"),isActive:"left"===p,onClick:()=>n({mediaPosition:"left"})}),(0,Ke.createElement)(et.ToolbarButton,{icon:Zd,title:(0,tt.__)("Show media on right"),isActive:"right"===p,onClick:()=>n({mediaPosition:"right"})})),"image"===d&&(0,Ke.createElement)(nt.__experimentalImageURLInputUI,{url:o||"",onChangeUrl:e=>{n(e)},linkDestination:s,mediaType:d,mediaUrl:k&&k.source_url,mediaLink:k&&k.link,linkTarget:c,linkClass:i,rel:b})),(0,Ke.createElement)("div",{...R},"right"===p&&(0,Ke.createElement)("div",{...A}),(0,Ke.createElement)(ng,{className:"wp-block-media-text__media",onSelectMedia:S,onWidthChange:e=>{C(ag(e))},commitWidthChange:B,ref:x,enableResize:"default"===H,focalPoint:a,imageFill:r,isSelected:t,isStackedOnMobile:l,mediaAlt:m,mediaId:u,mediaPosition:p,mediaType:d,mediaUrl:g,mediaWidth:h}),"right"!==p&&(0,Ke.createElement)("div",{...A})))},lg=()=>{};const ig={from:[{type:"block",blocks:["core/image"],transform:({alt:e,url:t,id:n,anchor:a})=>(0,Qe.createBlock)("core/media-text",{mediaAlt:e,mediaId:n,mediaUrl:t,mediaType:"image",anchor:a})},{type:"block",blocks:["core/video"],transform:({src:e,id:t,anchor:n})=>(0,Qe.createBlock)("core/media-text",{mediaId:t,mediaUrl:e,mediaType:"video",anchor:n})},{type:"block",blocks:["core/cover"],transform:({align:e,alt:t,anchor:n,backgroundType:a,customGradient:o,customOverlayColor:r,gradient:l,id:i,overlayColor:s,style:c,textColor:m,url:u},p)=>{let d={};return o?d={style:{color:{gradient:o}}}:r&&(d={style:{color:{background:r}}}),c?.color?.text&&(d.style={color:{...d.style?.color,text:c.color.text}}),(0,Qe.createBlock)("core/media-text",{align:e,anchor:n,backgroundColor:s,gradient:l,mediaAlt:t,mediaId:i,mediaType:a,mediaUrl:u,textColor:m,...d},p)}}],to:[{type:"block",blocks:["core/image"],isMatch:({mediaType:e,mediaUrl:t})=>!t||"image"===e,transform:({mediaAlt:e,mediaId:t,mediaUrl:n,anchor:a})=>(0,Qe.createBlock)("core/image",{alt:e,id:t,url:n,anchor:a})},{type:"block",blocks:["core/video"],isMatch:({mediaType:e,mediaUrl:t})=>!t||"video"===e,transform:({mediaId:e,mediaUrl:t,anchor:n})=>(0,Qe.createBlock)("core/video",{id:e,src:t,anchor:n})},{type:"block",blocks:["core/cover"],transform:({align:e,anchor:t,backgroundColor:n,focalPoint:a,gradient:o,mediaAlt:r,mediaId:l,mediaType:i,mediaUrl:s,style:c,textColor:m},u)=>{const p={};c?.color?.gradient?p.customGradient=c.color.gradient:c?.color?.background&&(p.customOverlayColor=c.color.background),c?.color?.text&&(p.style={color:{text:c.color.text}});const d={align:e,alt:r,anchor:t,backgroundType:i,dimRatio:s?50:100,focalPoint:a,gradient:o,id:l,overlayColor:n,textColor:m,url:s,...p};return(0,Qe.createBlock)("core/cover",d,u)}}]},sg=ig,cg={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/media-text",title:"Media & Text",category:"media",description:"Set media and words side-by-side for a richer layout.",keywords:["image","video"],textdomain:"default",attributes:{align:{type:"string",default:"none"},mediaAlt:{type:"string",source:"attribute",selector:"figure img",attribute:"alt",default:"",__experimentalRole:"content"},mediaPosition:{type:"string",default:"left"},mediaId:{type:"number",__experimentalRole:"content"},mediaUrl:{type:"string",source:"attribute",selector:"figure video,figure img",attribute:"src",__experimentalRole:"content"},mediaLink:{type:"string"},linkDestination:{type:"string"},linkTarget:{type:"string",source:"attribute",selector:"figure a",attribute:"target"},href:{type:"string",source:"attribute",selector:"figure a",attribute:"href",__experimentalRole:"content"},rel:{type:"string",source:"attribute",selector:"figure a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"figure a",attribute:"class"},mediaType:{type:"string",__experimentalRole:"content"},mediaWidth:{type:"number",default:50},mediaSizeSlug:{type:"string"},isStackedOnMobile:{type:"boolean",default:!0},verticalAlignment:{type:"string"},imageFill:{type:"boolean"},focalPoint:{type:"object"},allowedBlocks:{type:"array"}},supports:{anchor:!0,align:["wide","full"],html:!1,color:{gradients:!0,heading:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-media-text-editor",style:"wp-block-media-text"},{name:mg}=cg,ug={icon:Bd,example:{viewportWidth:601,attributes:{mediaType:"image",mediaUrl:"https://s.w.org/images/core/5.3/Biologia_Centrali-Americana_-_Cantorchilus_semibadius_1902.jpg"},innerBlocks:[{name:"core/paragraph",attributes:{content:(0,tt.__)("The wren<br>Earns his living<br>Noiselessly.")}},{name:"core/paragraph",attributes:{content:(0,tt.__)("— Kobayashi Issa (一茶)")}}]},transforms:sg,edit:rg,save:function({attributes:e}){const{isStackedOnMobile:t,mediaAlt:n,mediaPosition:a,mediaType:o,mediaUrl:r,mediaWidth:l,mediaId:i,verticalAlignment:s,imageFill:c,focalPoint:m,linkClass:u,href:p,linkTarget:d,rel:g}=e,h=e.mediaSizeSlug||Nd,b=g||void 0,_=ut()({[`wp-image-${i}`]:i&&"image"===o,[`size-${h}`]:i&&"image"===o});let y=(0,Ke.createElement)("img",{src:r,alt:n,className:_||null});p&&(y=(0,Ke.createElement)("a",{className:u,href:p,target:d,rel:b},y));const v={image:()=>y,video:()=>(0,Ke.createElement)("video",{controls:!0,src:r})},f=ut()({"has-media-on-the-right":"right"===a,"is-stacked-on-mobile":t,[`is-vertically-aligned-${s}`]:s,"is-image-fill":c}),k=c?Jd(r,m):{};let x;50!==l&&(x="right"===a?`auto ${l}%`:`${l}% auto`);const w={gridTemplateColumns:x};return"right"===a?(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:f,style:w})},(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-media-text__content"})}),(0,Ke.createElement)("figure",{className:"wp-block-media-text__media",style:k},(v[o]||lg)())):(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:f,style:w})},(0,Ke.createElement)("figure",{className:"wp-block-media-text__media",style:k},(v[o]||lg)()),(0,Ke.createElement)("div",{...nt.useInnerBlocksProps.save({className:"wp-block-media-text__content"})}))},deprecated:jd},pg=()=>Xe({name:mg,metadata:cg,settings:ug});const dg=(0,gt.withDispatch)(((e,{clientId:t,attributes:n})=>{const{replaceBlock:a}=e(nt.store);return{convertToHTML(){a(t,(0,Qe.createBlock)("core/html",{content:n.originalUndelimitedContent}))}}}))((function({attributes:e,convertToHTML:t,clientId:n}){const{originalName:a,originalUndelimitedContent:o}=e,r=!!o,{hasFreeformBlock:l,hasHTMLBlock:i}=(0,gt.useSelect)((e=>{const{canInsertBlockType:t,getBlockRootClientId:a}=e(nt.store);return{hasFreeformBlock:t("core/freeform",a(n)),hasHTMLBlock:t("core/html",a(n))}}),[n]),s=[];let c;const m=(0,Ke.createElement)(et.Button,{key:"convert",onClick:t,variant:"primary"},(0,tt.__)("Keep as HTML"));return!r||l||a?r&&i?(c=(0,tt.sprintf)((0,tt.__)('Your site doesn’t include support for the "%s" block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely.'),a),s.push(m)):c=(0,tt.sprintf)((0,tt.__)('Your site doesn’t include support for the "%s" block. You can leave this block intact or remove it entirely.'),a):i?(c=(0,tt.__)("It appears you are trying to use the deprecated Classic block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely. Alternatively, you can refresh the page to use the Classic block."),s.push(m)):c=(0,tt.__)("It appears you are trying to use the deprecated Classic block. You can leave this block intact, or remove it entirely. Alternatively, you can refresh the page to use the Classic block."),(0,Ke.createElement)("div",{...(0,nt.useBlockProps)({className:"has-warning"})},(0,Ke.createElement)(nt.Warning,{actions:s},c),(0,Ke.createElement)(_t.RawHTML,null,(0,ac.safeHTML)(o)))})),gg=dg;const hg={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/missing",title:"Unsupported",category:"text",description:"Your site doesn’t include support for this block.",textdomain:"default",attributes:{originalName:{type:"string"},originalUndelimitedContent:{type:"string"},originalContent:{type:"string",source:"raw"}},supports:{className:!1,customClassName:!1,inserter:!1,html:!1,reusable:!1,interactivity:{clientNavigation:!0}}},{name:bg}=hg,_g={name:bg,__experimentalLabel(e,{context:t}){if("accessibility"===t){const{originalName:t}=e,n=t?(0,Qe.getBlockType)(t):void 0;return n?n.settings.title||t:""}},edit:gg,save:function({attributes:e}){return(0,Ke.createElement)(_t.RawHTML,null,e.originalContent)}},yg=()=>Xe({name:bg,metadata:hg,settings:_g}),vg=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M4 9v1.5h16V9H4zm12 5.5h4V13h-4v1.5zm-6 0h4V13h-4v1.5zm-6 0h4V13H4v1.5z"})),fg=(0,tt.__)("Read more");const kg={from:[{type:"raw",schema:{"wp-block":{attributes:["data-block"]}},isMatch:e=>e.dataset&&"core/more"===e.dataset.block,transform(e){const{customText:t,noTeaser:n}=e.dataset,a={};return t&&(a.customText=t),""===n&&(a.noTeaser=!0),(0,Qe.createBlock)("core/more",a)}}]},xg={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/more",title:"More",category:"design",description:"Content before this block will be shown in the excerpt on your archives page.",keywords:["read more"],textdomain:"default",attributes:{customText:{type:"string"},noTeaser:{type:"boolean",default:!1}},supports:{customClassName:!1,className:!1,html:!1,multiple:!1,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-more-editor"},{name:wg}=xg,Eg={icon:vg,example:{},__experimentalLabel(e,{context:t}){const n=e?.metadata?.name;return"list-view"===t&&n?n:"accessibility"===t?e.customText:void 0},transforms:kg,edit:function({attributes:{customText:e,noTeaser:t},insertBlocksAfter:n,setAttributes:a}){const o={width:`${(e||fg).length+1.2}em`};return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,null,(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Hide the excerpt on the full content page"),checked:!!t,onChange:()=>a({noTeaser:!t}),help:e=>e?(0,tt.__)("The excerpt is hidden."):(0,tt.__)("The excerpt is visible.")}))),(0,Ke.createElement)("div",{...(0,nt.useBlockProps)()},(0,Ke.createElement)("input",{"aria-label":(0,tt.__)("“Read more” link text"),type:"text",value:e,placeholder:fg,onChange:e=>{a({customText:""!==e.target.value?e.target.value:void 0})},onKeyDown:({keyCode:e})=>{e===fn.ENTER&&n([(0,Qe.createBlock)((0,Qe.getDefaultBlockName)())])},style:o})))},save:function({attributes:{customText:e,noTeaser:t}}){const n=e?`\x3c!--more ${e}--\x3e`:"\x3c!--more--\x3e",a=t?"\x3c!--noteaser--\x3e":"";return(0,Ke.createElement)(_t.RawHTML,null,[n,a].filter(Boolean).join("\n"))}},Cg=()=>Xe({name:wg,metadata:xg,settings:Eg}),Sg=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z"})),Bg=window.wp.a11y;const Ng=(0,_t.forwardRef)((function({icon:e,size:t=24,...n},a){return(0,_t.cloneElement)(e,{width:t,height:t,...n,ref:a})})),Tg=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.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"})),Ig={name:"core/navigation-link"},Pg=["core/navigation-link/page","core/navigation-link"],Mg={per_page:100,status:["publish","draft"],order:"desc",orderby:"date"},zg=["postType","wp_navigation",Mg];function Rg(e){const t=(0,dt.useResourcePermissions)("navigation",e),{navigationMenu:n,isNavigationMenuResolved:a,isNavigationMenuMissing:o}=(0,gt.useSelect)((t=>function(e,t){if(!t)return{isNavigationMenuResolved:!1,isNavigationMenuMissing:!0};const{getEntityRecord:n,getEditedEntityRecord:a,hasFinishedResolution:o}=e(dt.store),r=["postType","wp_navigation",t],l=n(...r),i=a(...r),s=o("getEditedEntityRecord",r),c="publish"===i.status||"draft"===i.status;return{isNavigationMenuResolved:s,isNavigationMenuMissing:s&&(!l||!c),navigationMenu:c?i:null}}(t,e)),[e]),{canCreate:r,canUpdate:l,canDelete:i,isResolving:s,hasResolved:c}=t,{records:m,isResolving:u,hasResolved:p}=(0,dt.useEntityRecords)("postType","wp_navigation",Mg);return{navigationMenu:n,isNavigationMenuResolved:a,isNavigationMenuMissing:o,navigationMenus:m,isResolvingNavigationMenus:u,hasResolvedNavigationMenus:p,canSwitchNavigationMenu:e?m?.length>1:m?.length>0,canUserCreateNavigationMenu:r,isResolvingCanUserCreateNavigationMenu:s,hasResolvedCanUserCreateNavigationMenu:c,canUserUpdateNavigationMenu:l,hasResolvedCanUserUpdateNavigationMenu:e?c:void 0,canUserDeleteNavigationMenu:i,hasResolvedCanUserDeleteNavigationMenu:e?c:void 0}}function Ag(e){const{records:t,isResolving:n,hasResolved:a}=(0,dt.useEntityRecords)("root","menu",{per_page:-1,context:"view"}),{records:o,isResolving:r,hasResolved:l}=(0,dt.useEntityRecords)("postType","page",{parent:0,order:"asc",orderby:"id",per_page:-1,context:"view"}),{records:i,hasResolved:s}=(0,dt.useEntityRecords)("root","menuItem",{menus:e,per_page:-1,context:"view"},{enabled:!!e});return{pages:o,isResolvingPages:r,hasResolvedPages:l,hasPages:!(!l||!o?.length),menus:t,isResolvingMenus:n,hasResolvedMenus:a,hasMenus:!(!a||!t?.length),menuItems:i,hasResolvedMenuItems:s}}const Hg=({isVisible:e=!0})=>(0,Ke.createElement)("div",{"aria-hidden":!e||void 0,className:"wp-block-navigation-placeholder__preview"},(0,Ke.createElement)("div",{className:"wp-block-navigation-placeholder__actions__indicator"},(0,Ke.createElement)(Ng,{icon:Sg}),(0,tt.__)("Navigation"))),Lg=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));const Dg=function({currentMenuId:e,onSelectNavigationMenu:t,onSelectClassicMenu:n,onCreateNew:a,actionLabel:o,createNavigationMenuIsSuccess:r,createNavigationMenuIsError:l}){const i=(0,tt.__)("Create from '%s'"),[s,c]=(0,_t.useState)(!1);o=o||i;const{menus:m}=Ag(),{navigationMenus:u,isResolvingNavigationMenus:p,hasResolvedNavigationMenus:d,canUserCreateNavigationMenu:g,canSwitchNavigationMenu:h}=Rg(),[b]=(0,dt.useEntityProp)("postType","wp_navigation","title"),_=(0,_t.useMemo)((()=>u?.map((({id:e,title:t,status:n},a)=>{const r=function(e,t,n){return e?"publish"===n?(0,Jn.decodeEntities)(e):(0,tt.sprintf)((0,tt.__)("%1$s (%2$s)"),(0,Jn.decodeEntities)(e),n):(0,tt.sprintf)((0,tt.__)("(no title %s)"),t)}(t?.rendered,a+1,n);return{value:e,label:r,ariaLabel:(0,tt.sprintf)(o,r),disabled:s||p||!d}}))||[]),[u,o,p,d,s]),y=!!u?.length,v=!!m?.length,f=!!h,k=!!g,x=y&&!e,w=!y&&d,E=d&&null===e;let C="";C=p?(0,tt.__)("Loading…"):x||w||E?(0,tt.__)("Choose or create a Navigation menu"):b,(0,_t.useEffect)((()=>{s&&(r||l)&&c(!1)}),[d,r,g,l,s,E,w,x]);const S=(0,Ke.createElement)(et.DropdownMenu,{label:C,icon:Lg,toggleProps:{isSmall:!0}},(({onClose:o})=>(0,Ke.createElement)(Ke.Fragment,null,f&&y&&(0,Ke.createElement)(et.MenuGroup,{label:(0,tt.__)("Menus")},(0,Ke.createElement)(et.MenuItemsChoice,{value:e,onSelect:e=>{t(e),o()},choices:_})),k&&v&&(0,Ke.createElement)(et.MenuGroup,{label:(0,tt.__)("Import Classic Menus")},m?.map((e=>{const t=(0,Jn.decodeEntities)(e.name);return(0,Ke.createElement)(et.MenuItem,{onClick:async()=>{c(!0),await n(e),c(!1),o()},key:e.id,"aria-label":(0,tt.sprintf)(i,t),disabled:s||p||!d},t)}))),g&&(0,Ke.createElement)(et.MenuGroup,{label:(0,tt.__)("Tools")},(0,Ke.createElement)(et.MenuItem,{onClick:async()=>{c(!0),await a(),c(!1),o()},disabled:s||p||!d},(0,tt.__)("Create new menu"))))));return S};function Fg({isSelected:e,currentMenuId:t,clientId:n,canUserCreateNavigationMenu:a=!1,isResolvingCanUserCreateNavigationMenu:o,onSelectNavigationMenu:r,onSelectClassicMenu:l,onCreateEmpty:i}){const{isResolvingMenus:s,hasResolvedMenus:c}=Ag();(0,_t.useEffect)((()=>{e&&(s&&(0,Bg.speak)((0,tt.__)("Loading navigation block setup options…")),c&&(0,Bg.speak)((0,tt.__)("Navigation block setup options ready.")))}),[c,s,e]);const m=s&&o;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.Placeholder,{className:"wp-block-navigation-placeholder"},(0,Ke.createElement)(Hg,{isVisible:!e}),(0,Ke.createElement)("div",{"aria-hidden":!e||void 0,className:"wp-block-navigation-placeholder__controls"},(0,Ke.createElement)("div",{className:"wp-block-navigation-placeholder__actions"},(0,Ke.createElement)("div",{className:"wp-block-navigation-placeholder__actions__indicator"},(0,Ke.createElement)(Ng,{icon:Sg})," ",(0,tt.__)("Navigation")),(0,Ke.createElement)("hr",null),m&&(0,Ke.createElement)(et.Spinner,null),(0,Ke.createElement)(Dg,{currentMenuId:t,clientId:n,onSelectNavigationMenu:r,onSelectClassicMenu:l}),(0,Ke.createElement)("hr",null),a&&(0,Ke.createElement)(et.Button,{variant:"tertiary",onClick:i},(0,tt.__)("Start empty"))))))}const Vg=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M5 5v1.5h14V5H5zm0 7.8h14v-1.5H5v1.5zM5 19h14v-1.5H5V19z"}));function $g({icon:e}){return"menu"===e?(0,Ke.createElement)(Ng,{icon:Vg}):(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false"},(0,Ke.createElement)(Ye.Rect,{x:"4",y:"7.5",width:"16",height:"1.5"}),(0,Ke.createElement)(Ye.Rect,{x:"4",y:"15",width:"16",height:"1.5"}))}function Og({children:e,id:t,isOpen:n,isResponsive:a,onToggle:o,isHiddenByDefault:r,overlayBackgroundColor:l,overlayTextColor:i,hasIcon:s,icon:c}){if(!a)return e;const m=ut()("wp-block-navigation__responsive-container",{"has-text-color":!!i.color||!!i?.class,[(0,nt.getColorClassName)("color",i?.slug)]:!!i?.slug,"has-background":!!l.color||l?.class,[(0,nt.getColorClassName)("background-color",l?.slug)]:!!l?.slug,"is-menu-open":n,"hidden-by-default":r}),u={color:!i?.slug&&i?.color,backgroundColor:!l?.slug&&l?.color&&l.color},p=ut()("wp-block-navigation__responsive-container-open",{"always-shown":r}),d=`${t}-modal`,g={className:"wp-block-navigation__responsive-dialog",...n&&{role:"dialog","aria-modal":!0,"aria-label":(0,tt.__)("Menu")}};return(0,Ke.createElement)(Ke.Fragment,null,!n&&(0,Ke.createElement)(et.Button,{"aria-haspopup":"true","aria-label":s&&(0,tt.__)("Open menu"),className:p,onClick:()=>o(!0)},s&&(0,Ke.createElement)($g,{icon:c}),!s&&(0,tt.__)("Menu")),(0,Ke.createElement)("div",{className:m,style:u,id:d},(0,Ke.createElement)("div",{className:"wp-block-navigation__responsive-close",tabIndex:"-1"},(0,Ke.createElement)("div",{...g},(0,Ke.createElement)(et.Button,{className:"wp-block-navigation__responsive-container-close","aria-label":s&&(0,tt.__)("Close menu"),onClick:()=>o(!1)},s&&(0,Ke.createElement)(Ng,{icon:Tg}),!s&&(0,tt.__)("Close")),(0,Ke.createElement)("div",{className:"wp-block-navigation__responsive-container-content",id:`${d}-content`},e)))))}function Gg({clientId:e,hasCustomPlaceholder:t,orientation:n,templateLock:a}){const{isImmediateParentOfSelectedBlock:o,selectedBlockHasChildren:r,isSelected:l}=(0,gt.useSelect)((t=>{const{getBlockCount:n,hasSelectedInnerBlock:a,getSelectedBlockClientId:o}=t(nt.store),r=o();return{isImmediateParentOfSelectedBlock:a(e,!1),selectedBlockHasChildren:!!n(r),isSelected:r===e}}),[e]),[i,s,c]=(0,dt.useEntityBlockEditor)("postType","wp_navigation"),m=l||o&&!r,u=(0,_t.useMemo)((()=>(0,Ke.createElement)(Hg,null)),[]),p=!t&&!!!i?.length&&!l,d=(0,nt.useInnerBlocksProps)({className:"wp-block-navigation__container"},{value:i,onInput:s,onChange:c,prioritizedInserterBlocks:Pg,defaultBlock:Ig,directInsert:!0,orientation:n,templateLock:a,renderAppender:!!(l||o&&!r||m)&&nt.InnerBlocks.ButtonBlockAppender,placeholder:p?u:void 0,__experimentalCaptureToolbars:!0,__unstableDisableLayoutClassNames:!0});return(0,Ke.createElement)("div",{...d})}function Ug(){const[e,t]=(0,dt.useEntityProp)("postType","wp_navigation","title");return(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Menu name"),value:e,onChange:t})}const qg=(e,t,n)=>{if(e===t)return!0;if("object"==typeof e&&null!=e&&"object"==typeof t&&null!=t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e){if(!t.hasOwnProperty(a))return!1;if(n&&n(a,e))return!0;if(!qg(e[a],t[a],n))return!1}return!0}return!1},jg={};function Wg({blocks:e,createNavigationMenu:t,hasSelection:n}){const a=(0,_t.useRef)();(0,_t.useEffect)((()=>{a?.current||(a.current=e)}),[e]);const o=function(e,t){return!qg(e,t,((e,t)=>{if("core/page-list"===t?.name&&"innerBlocks"===e)return!0}))}(a?.current,e),r=(0,_t.useContext)(et.Disabled.Context),l=(0,nt.useInnerBlocksProps)({className:"wp-block-navigation__container"},{renderAppender:!!n&&void 0,defaultBlock:Ig,directInsert:!0}),{isSaving:i,hasResolvedAllNavigationMenus:s}=(0,gt.useSelect)((e=>{if(r)return jg;const{hasFinishedResolution:t,isSavingEntityRecord:n}=e(dt.store);return{isSaving:n("postType","wp_navigation"),hasResolvedAllNavigationMenus:t("getEntityRecords",zg)}}),[r]);(0,_t.useEffect)((()=>{!r&&!i&&s&&n&&o&&t(null,e)}),[e,t,r,i,s,o,n]);const c=i?et.Disabled:"div";return(0,Ke.createElement)(c,{...l})}function Zg({onDelete:e}){const[t,n]=(0,_t.useState)(!1),a=(0,dt.useEntityId)("postType","wp_navigation"),[o]=(0,dt.useEntityProp)("postType","wp_navigation","title"),{deleteEntityRecord:r}=(0,gt.useDispatch)(dt.store);return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.Button,{className:"wp-block-navigation-delete-menu-button",variant:"secondary",isDestructive:!0,onClick:()=>{n(!0)}},(0,tt.__)("Delete menu")),t&&(0,Ke.createElement)(et.Modal,{title:(0,tt.sprintf)((0,tt.__)("Delete %s"),o),onRequestClose:()=>n(!1)},(0,Ke.createElement)("p",null,(0,tt.__)("Are you sure you want to delete this navigation menu?")),(0,Ke.createElement)(et.__experimentalHStack,{justify:"right"},(0,Ke.createElement)(et.Button,{variant:"tertiary",onClick:()=>{n(!1)}},(0,tt.__)("Cancel")),(0,Ke.createElement)(et.Button,{variant:"primary",onClick:()=>{r("postType","wp_navigation",a,{force:!0}),e(o)}},(0,tt.__)("Confirm")))))}const Qg=function({name:e,message:t=""}={}){const n=(0,_t.useRef)(),{createWarningNotice:a,removeNotice:o}=(0,gt.useDispatch)(Pt.store);return[(0,_t.useCallback)((o=>{n.current||(n.current=e,a(o||t,{id:n.current,type:"snackbar"}))}),[n,a,t,e]),(0,_t.useCallback)((()=>{n.current&&(o(n.current),n.current=null)}),[n,o])]};function Kg({setAttributes:e,hasIcon:t,icon:n}){return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show icon button"),help:(0,tt.__)("Configure the visual appearance of the button that toggles the overlay menu."),onChange:t=>e({hasIcon:t}),checked:t}),(0,Ke.createElement)(et.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Icon"),value:n,onChange:t=>e({icon:t}),isBlock:!0},(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"handle","aria-label":(0,tt.__)("handle"),label:(0,Ke.createElement)($g,{icon:"handle"})}),(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"menu","aria-label":(0,tt.__)("menu"),label:(0,Ke.createElement)($g,{icon:"menu"})})))}function Yg(e){if(!e)return null;const t=Jg(function(e,t="id",n="parent"){const a=Object.create(null),o=[];for(const r of e)a[r[t]]={...r,children:[]},r[n]?(a[r[n]]=a[r[n]]||{},a[r[n]].children=a[r[n]].children||[],a[r[n]].children.push(a[r[t]])):o.push(a[r[t]]);return o}(e));return(0,_i.applyFilters)("blocks.navigation.__unstableMenuItemsToBlocks",t,e)}function Jg(e,t=0){let n={};const a=[...e].sort(((e,t)=>e.menu_order-t.menu_order)),o=a.map((e=>{if("block"===e.type){const[t]=(0,Qe.parse)(e.content.raw);return t||(0,Qe.createBlock)("core/freeform",{content:e.content})}const a=e.children?.length?"core/navigation-submenu":"core/navigation-link",o=function({title:e,xfn:t,classes:n,attr_title:a,object:o,object_id:r,description:l,url:i,type:s,target:c},m,u){o&&"post_tag"===o&&(o="tag");return{label:e?.rendered||"",...o?.length&&{type:o},kind:s?.replace("_","-")||"custom",url:i||"",...t?.length&&t.join(" ").trim()&&{rel:t.join(" ").trim()},...n?.length&&n.join(" ").trim()&&{className:n.join(" ").trim()},...a?.length&&{title:a},...r&&"custom"!==o&&{id:r},...l?.length&&{description:l},..."_blank"===c&&{opensInNewTab:!0},..."core/navigation-submenu"===m&&{isTopLevelItem:0===u},..."core/navigation-link"===m&&{isTopLevelLink:0===u}}}(e,a,t),{innerBlocks:r=[],mapping:l={}}=e.children?.length?Jg(e.children,t+1):{};n={...n,...l};const i=(0,Qe.createBlock)(a,o,r);return n[e.id]=i.clientId,i}));return{innerBlocks:o,mapping:n}}const Xg="success",eh="error",th="pending";let nh=null;const ah=function(e,{throwOnError:t=!1}={}){const n=(0,gt.useRegistry)(),{editEntityRecord:a}=(0,gt.useDispatch)(dt.store),[o,r]=(0,_t.useState)("idle"),[l,i]=(0,_t.useState)(null),s=(0,_t.useCallback)((async(t,o,r="publish")=>{let l,i;try{i=await n.resolveSelect(dt.store).getMenuItems({menus:t,per_page:-1,context:"view"})}catch(e){throw new Error((0,tt.sprintf)((0,tt.__)('Unable to fetch classic menu "%s" from API.'),o),{cause:e})}if(null===i)throw new Error((0,tt.sprintf)((0,tt.__)('Unable to fetch classic menu "%s" from API.'),o));const{innerBlocks:s}=Yg(i);try{l=await e(o,s,r),await a("postType","wp_navigation",l.id,{status:"publish"},{throwOnError:!0})}catch(e){throw new Error((0,tt.sprintf)((0,tt.__)('Unable to create Navigation Menu "%s".'),o),{cause:e})}return l}),[e,a,n]);return{convert:(0,_t.useCallback)((async(e,n,a)=>{if(nh!==e)return nh=e,e&&n?(r(th),i(null),await s(e,n,a).then((e=>(r(Xg),nh=null,e))).catch((e=>{if(i(e?.message),r(eh),nh=null,t)throw new Error((0,tt.sprintf)((0,tt.__)('Unable to create Navigation Menu "%s".'),n),{cause:e})}))):(i("Unable to convert menu. Missing menu details."),void r(eh))}),[s,t]),status:o,error:l}};function oh(e,t){return e&&t?e+"//"+t:null}const rh=["postType","wp_navigation",{status:"draft",per_page:-1}],lh=["postType","wp_navigation",{per_page:-1,status:"publish"}];function ih(e){const t=(0,_t.useContext)(et.Disabled.Context),n=function(e){return(0,gt.useSelect)((t=>{if(!e)return;const{getBlock:n,getBlockParentsByBlockName:a}=t(nt.store),o=a(e,"core/template-part",!0);if(!o?.length)return;const r=t("core/editor").__experimentalGetDefaultTemplatePartAreas(),{getCurrentTheme:l,getEditedEntityRecord:i}=t(dt.store);for(const e of o){const t=n(e),{theme:a=l()?.stylesheet,slug:o}=t.attributes,s=i("postType","wp_template_part",oh(a,o));if(s?.area)return r.find((e=>"uncategorized"!==e.area&&e.area===s.area))?.label}}),[e])}(t?void 0:e),a=(0,gt.useRegistry)();return(0,_t.useCallback)((async()=>{if(t)return"";const{getEntityRecords:e}=a.resolveSelect(dt.store),[o,r]=await Promise.all([e(...rh),e(...lh)]),l=n?(0,tt.sprintf)((0,tt.__)("%s navigation"),n):(0,tt.__)("Navigation"),i=[...o,...r].reduce(((e,t)=>t?.title?.raw?.startsWith(l)?e+1:e),0);return(i>0?`${l} ${i+1}`:l)||""}),[t,n,a])}const sh="success",ch="error",mh="pending",uh="idle";const ph=[];function dh(e){return e.ownerDocument.defaultView.getComputedStyle(e)}function gh(e,t,n){if(!e)return;t(dh(e).color);let a=e,o=dh(a).backgroundColor;for(;"rgba(0, 0, 0, 0)"===o&&a.parentNode&&a.parentNode.nodeType===a.parentNode.ELEMENT_NODE;)a=a.parentNode,o=dh(a).backgroundColor;n(o)}function hh(e,t){const{textColor:n,customTextColor:a,backgroundColor:o,customBackgroundColor:r,overlayTextColor:l,customOverlayTextColor:i,overlayBackgroundColor:s,customOverlayBackgroundColor:c,style:m}=e,u={};return t&&i?u.customTextColor=i:t&&l?u.textColor=l:a?u.customTextColor=a:n?u.textColor=n:m?.color?.text&&(u.customTextColor=m.color.text),t&&c?u.customBackgroundColor=c:t&&s?u.backgroundColor=s:r?u.customBackgroundColor=r:o?u.backgroundColor=o:m?.color?.background&&(u.customTextColor=m.color.background),u}function bh(e){return{className:ut()("wp-block-navigation__submenu-container",{"has-text-color":!(!e.textColor&&!e.customTextColor),[`has-${e.textColor}-color`]:!!e.textColor,"has-background":!(!e.backgroundColor&&!e.customBackgroundColor),[`has-${e.backgroundColor}-background-color`]:!!e.backgroundColor}),style:{color:e.customTextColor,backgroundColor:e.customBackgroundColor}}}const _h=({className:e="",disabled:t,isMenuItem:n=!1})=>{let a=et.Button;return n&&(a=et.MenuItem),(0,Ke.createElement)(a,{variant:"link",disabled:t,className:e,href:(0,pt.addQueryArgs)("edit.php",{post_type:"wp_navigation"})},(0,tt.__)("Manage menus"))};const yh=function({onCreateNew:e}){return(0,Ke.createElement)(nt.Warning,null,(0,_t.createInterpolateElement)((0,tt.__)("Navigation menu has been deleted or is unavailable. <button>Create a new menu?</button>"),{button:(0,Ke.createElement)(et.Button,{onClick:e,variant:"link"})}))},vh=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M2 12c0 3.6 2.4 5.5 6 5.5h.5V19l3-2.5-3-2.5v2H8c-2.5 0-4.5-1.5-4.5-4s2-4.5 4.5-4.5h3.5V6H8c-3.6 0-6 2.4-6 6zm19.5-1h-8v1.5h8V11zm0 5h-8v1.5h8V16zm0-10h-8v1.5h8V6z"})),fh=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),kh=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),xh={className:"block-editor-block-settings-menu__popover",placement:"bottom-start"},wh=["core/navigation-link","core/navigation-submenu"];function Eh({block:e,onClose:t,expandedState:n,expand:a,setInsertedBlock:o}){const{insertBlock:r,replaceBlock:l,replaceInnerBlocks:i}=(0,gt.useDispatch)(nt.store),s=e.clientId,c=!wh.includes(e.name);return(0,Ke.createElement)(et.MenuItem,{icon:vh,disabled:c,onClick:()=>{const c=(0,Qe.createBlock)("core/navigation-link");if("core/navigation-submenu"===e.name)r(c,e.innerBlocks.length,s,false);else{const t=(0,Qe.createBlock)("core/navigation-submenu",e.attributes,e.innerBlocks);l(s,t),i(t.clientId,[c],false)}o(c),n[e.clientId]||a(e.clientId),t()}},(0,tt.__)("Add submenu link"))}function Ch(e){const{block:t}=e,{clientId:n}=t,{moveBlocksDown:a,moveBlocksUp:o,removeBlocks:r}=(0,gt.useDispatch)(nt.store),l=(0,tt.sprintf)((0,tt.__)("Remove %s"),(0,nt.BlockTitle)({clientId:n,maximumLength:25})),i=(0,gt.useSelect)((e=>{const{getBlockRootClientId:t}=e(nt.store);return t(n)}),[n]);return(0,Ke.createElement)(et.DropdownMenu,{icon:Lg,label:(0,tt.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:xh,noIcons:!0,...e},(({onClose:s})=>(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.MenuGroup,null,(0,Ke.createElement)(et.MenuItem,{icon:fh,onClick:()=>{o([n],i),s()}},(0,tt.__)("Move up")),(0,Ke.createElement)(et.MenuItem,{icon:kh,onClick:()=>{a([n],i),s()}},(0,tt.__)("Move down")),(0,Ke.createElement)(Eh,{block:t,onClose:s,expanded:!0,expandedState:e.expandedState,expand:e.expand,setInsertedBlock:e.setInsertedBlock})),(0,Ke.createElement)(et.MenuGroup,null,(0,Ke.createElement)(et.MenuItem,{onClick:()=>{r([n],!1),s()}},l)))))}const Sh=window.wp.escapeHtml,Bh=(e={},t,n={})=>{const{label:a="",kind:o="",type:r=""}=n,{title:l="",url:i="",opensInNewTab:s,id:c,kind:m=o,type:u=r}=e,p=l.replace(/http(s?):\/\//gi,""),d=i.replace(/http(s?):\/\//gi,""),g=l&&l!==a&&p!==d?(0,Sh.escapeHTML)(l):a||(0,Sh.escapeHTML)(d),h="post_tag"===u?"tag":u.replace("-","_"),b=["post","page","tag","category"].indexOf(h)>-1,_=!m&&!b||"custom"===m?"custom":m;t({...i&&{url:encodeURI((0,pt.safeDecodeURI)(i))},...g&&{label:g},...void 0!==s&&{opensInNewTab:s},...c&&Number.isInteger(c)&&{id:c},..._&&{kind:_},...h&&"URL"!==h&&{type:h}})},Nh=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"})),Th=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})),{PrivateQuickInserter:Ih}=Ft(nt.privateApis);function Ph(e,t){switch(e){case"post":case"page":return{type:"post",subtype:e};case"category":return{type:"term",subtype:"category"};case"tag":return{type:"term",subtype:"post_tag"};case"post_format":return{type:"post-format"};default:return"taxonomy"===t?{type:"term",subtype:e}:"post-type"===t?{type:"post",subtype:e}:{initialSuggestionsSearchOptions:{type:"post",subtype:"page",perPage:20}}}}function Mh({clientId:e,onBack:t,onSelectBlock:n}){const{rootBlockClientId:a}=(0,gt.useSelect)((t=>{const{getBlockRootClientId:n}=t(nt.store);return{rootBlockClientId:n(e)}}),[e]),o=(0,jt.useFocusOnMount)("firstElement"),r=(0,jt.useInstanceId)(nt.__experimentalLinkControl,"link-ui-block-inserter__title"),l=(0,jt.useInstanceId)(nt.__experimentalLinkControl,"link-ui-block-inserter__description");return e?(0,Ke.createElement)("div",{className:"link-ui-block-inserter",role:"dialog","aria-labelledby":r,"aria-describedby":l,ref:o},(0,Ke.createElement)(et.VisuallyHidden,null,(0,Ke.createElement)("h2",{id:r},(0,tt.__)("Add block")),(0,Ke.createElement)("p",{id:l},(0,tt.__)("Choose a block to add to your Navigation."))),(0,Ke.createElement)(et.Button,{className:"link-ui-block-inserter__back",icon:Nh,onClick:e=>{e.preventDefault(),t()},size:"small"},(0,tt.__)("Back")),(0,Ke.createElement)(Ih,{rootClientId:a,clientId:e,isAppender:!1,prioritizePatterns:!1,selectBlockOnInsert:!0,hasSearch:!1,onSelect:n})):null}function zh(e){const[t,n]=(0,_t.useState)(!1),[a,o]=(0,_t.useState)(!1),[r,l]=(0,_t.useState)(!0),{saveEntityRecord:i}=(0,gt.useDispatch)(dt.store),s=(0,dt.useResourcePermissions)("pages"),c=(0,dt.useResourcePermissions)("posts");const{label:m,url:u,opensInNewTab:p,type:d,kind:g}=e.link;let h=!1;d&&"page"!==d?"post"===d&&(h=c.canCreate):h=s.canCreate;const b=(0,_t.useMemo)((()=>({url:u,opensInNewTab:p,title:m&&(0,ac.__unstableStripHTML)(m)})),[m,p,u]),_=(0,jt.useInstanceId)(zh,"link-ui-link-control__title"),y=(0,jt.useInstanceId)(zh,"link-ui-link-control__description"),{onClose:v}=e;return(0,Ke.createElement)(Ke.Fragment,null,r&&(0,Ke.createElement)("div",{className:"components-popover-pointer-events-trap","aria-hidden":"true",onClick:()=>l(!1)}),(0,Ke.createElement)(et.Popover,{placement:"bottom",onClose:e.onClose,anchor:e.anchor,shift:!0},!t&&(0,Ke.createElement)("div",{role:"dialog","aria-labelledby":_,"aria-describedby":y},(0,Ke.createElement)(et.VisuallyHidden,null,(0,Ke.createElement)("h2",{id:_},(0,tt.__)("Add link")),(0,Ke.createElement)("p",{id:y},(0,tt.__)("Search for and add a link to your Navigation."))),(0,Ke.createElement)(nt.__experimentalLinkControl,{hasTextControl:!0,hasRichPreviews:!0,value:b,showInitialSuggestions:!0,withCreateSuggestion:h,createSuggestion:async function(t){const n=e.link.type||"page",a=await i("postType",n,{title:t,status:"draft"});return{id:a.id,type:n,title:(0,Jn.decodeEntities)(a.title.rendered),url:a.link,kind:"post-type"}},createSuggestionButtonText:e=>{let t;return t="post"===d?(0,tt.__)("Create draft post: <mark>%s</mark>"):(0,tt.__)("Create draft page: <mark>%s</mark>"),(0,_t.createInterpolateElement)((0,tt.sprintf)(t,e),{mark:(0,Ke.createElement)("mark",null)})},noDirectEntry:!!d,noURLSuggestion:!!d,suggestionsQuery:Ph(d,g),onChange:e.onChange,onRemove:e.onRemove,onCancel:e.onCancel,renderControlBottom:()=>!b?.url?.length&&(0,Ke.createElement)(Rh,{focusAddBlockButton:a,setAddingBlock:()=>{n(!0),o(!1)}})})),t&&(0,Ke.createElement)(Mh,{clientId:e.clientId,onBack:()=>{n(!1),o(!0)},onSelectBlock:v})))}const Rh=({setAddingBlock:e,focusAddBlockButton:t})=>{const n=(0,_t.useRef)();return(0,_t.useEffect)((()=>{t&&n.current?.focus()}),[t]),(0,Ke.createElement)(et.__experimentalVStack,{className:"link-ui-tools"},(0,Ke.createElement)(et.Button,{ref:n,icon:Th,onClick:t=>{t.preventDefault(),e(!0)},"aria-haspopup":"listbox"},(0,tt.__)("Add block")))},Ah=(0,tt.__)("Switch to '%s'"),Hh=["core/navigation-link","core/navigation-submenu"],{PrivateListView:Lh}=Ft(nt.privateApis);function Dh({block:e,insertedBlock:t,setInsertedBlock:n}){const{updateBlockAttributes:a}=(0,gt.useDispatch)(nt.store),o=Hh?.includes(t?.name),r=t?.clientId===e.clientId;if(!(o&&r))return null;return(0,Ke.createElement)(zh,{clientId:t?.clientId,link:t?.attributes,onClose:()=>{n(null)},onChange:e=>{var o;Bh(e,(o=t?.clientId,e=>{o&&a(o,e)}),t?.attributes),n(null)},onCancel:()=>{n(null)}})}const Fh=({clientId:e,currentMenuId:t,isLoading:n,isNavigationMenuMissing:a,onCreateNew:o})=>{const r=(0,gt.useSelect)((t=>!!t(nt.store).getBlockCount(e)),[e]),{navigationMenu:l}=Rg(t);if(t&&a)return(0,Ke.createElement)(yh,{onCreateNew:o});if(n)return(0,Ke.createElement)(et.Spinner,null);const i=l?(0,tt.sprintf)((0,tt.__)("Structure for navigation menu: %s"),l?.title||(0,tt.__)("Untitled menu")):(0,tt.__)("You have not yet created any menus. Displaying a list of your Pages");return(0,Ke.createElement)("div",{className:"wp-block-navigation__menu-inspector-controls"},!r&&(0,Ke.createElement)("p",{className:"wp-block-navigation__menu-inspector-controls__empty-message"},(0,tt.__)("This navigation menu is empty.")),(0,Ke.createElement)(Lh,{rootClientId:e,isExpanded:!0,description:i,showAppender:!0,blockSettingsMenu:Ch,additionalBlockContent:Dh}))},Vh=e=>{const{createNavigationMenuIsSuccess:t,createNavigationMenuIsError:n,currentMenuId:a=null,onCreateNew:o,onSelectClassicMenu:r,onSelectNavigationMenu:l,isManageMenusButtonDisabled:i,blockEditingMode:s}=e;return(0,Ke.createElement)(nt.InspectorControls,{group:"list"},(0,Ke.createElement)(et.PanelBody,{title:null},(0,Ke.createElement)(et.__experimentalHStack,{className:"wp-block-navigation-off-canvas-editor__header"},(0,Ke.createElement)(et.__experimentalHeading,{className:"wp-block-navigation-off-canvas-editor__title",level:2},(0,tt.__)("Menu")),"default"===s&&(0,Ke.createElement)(Dg,{currentMenuId:a,onSelectClassicMenu:r,onSelectNavigationMenu:l,onCreateNew:o,createNavigationMenuIsSuccess:t,createNavigationMenuIsError:n,actionLabel:Ah,isManageMenusButtonDisabled:i})),(0,Ke.createElement)(Fh,{...e})))};function $h({id:e,children:t}){return(0,Ke.createElement)(et.VisuallyHidden,null,(0,Ke.createElement)("div",{id:e,className:"wp-block-navigation__description"},t))}function Oh({id:e}){const[t]=(0,dt.useEntityProp)("postType","wp_navigation","title"),n=(0,tt.sprintf)((0,tt.__)('Navigation menu: "%s"'),t);return(0,Ke.createElement)($h,{id:e},n)}const Gh=(0,nt.withColors)({textColor:"color"},{backgroundColor:"color"},{overlayBackgroundColor:"color"},{overlayTextColor:"color"})((function({attributes:e,setAttributes:t,clientId:n,isSelected:a,className:o,backgroundColor:r,setBackgroundColor:l,textColor:i,setTextColor:s,overlayBackgroundColor:c,setOverlayBackgroundColor:m,overlayTextColor:u,setOverlayTextColor:p,hasSubmenuIndicatorSetting:d=!0,customPlaceholder:g=null,__unstableLayoutClassNames:h}){const{openSubmenusOnClick:b,overlayMenu:_,showSubmenuIcon:y,templateLock:v,layout:{justifyContent:f,orientation:k="horizontal",flexWrap:x="wrap"}={},hasIcon:w,icon:E="handle"}=e,C=e.ref,S=(0,_t.useCallback)((e=>{t({ref:e})}),[t]),B=`navigationMenu/${C}`,N=(0,nt.useHasRecursion)(B),T=(0,nt.useBlockEditingMode)(),{menus:I}=Ag(),[P,M]=Qg({name:"block-library/core/navigation/status"}),[z,R]=Qg({name:"block-library/core/navigation/classic-menu-conversion"}),[A,H]=Qg({name:"block-library/core/navigation/permissions/update"}),{create:L,status:D,error:F,value:V,isPending:$,isSuccess:O,isError:G}=function(e){const[t,n]=(0,_t.useState)(uh),[a,o]=(0,_t.useState)(null),[r,l]=(0,_t.useState)(null),{saveEntityRecord:i,editEntityRecord:s}=(0,gt.useDispatch)(dt.store),c=ih(e),m=(0,_t.useCallback)((async(e=null,t=[],a)=>{if(e&&"string"!=typeof e)throw l("Invalid title supplied when creating Navigation Menu."),n(ch),new Error("Value of supplied title argument was not a string.");n(mh),o(null),l(null),e||(e=await c().catch((e=>{throw l(e?.message),n(ch),new Error("Failed to create title when saving new Navigation Menu.",{cause:e})})));const r={title:e,content:(0,Qe.serialize)(t),status:a};return i("postType","wp_navigation",r).then((e=>(o(e),n(sh),"publish"!==a&&s("postType","wp_navigation",e.id,{status:"publish"}),e))).catch((e=>{throw l(e?.message),n(ch),new Error("Unable to save new Navigation Menu",{cause:e})}))}),[i,s,c]);return{create:m,status:t,value:a,error:r,isIdle:t===uh,isPending:t===mh,isSuccess:t===sh,isError:t===ch}}(n),U=async()=>{await L("")},{hasUncontrolledInnerBlocks:q,uncontrolledInnerBlocks:j,isInnerBlockSelected:W,innerBlocks:Z}=function(e){return(0,gt.useSelect)((t=>{const{getBlock:n,getBlocks:a,hasSelectedInnerBlock:o}=t(nt.store),r=n(e).innerBlocks,l=!!r?.length,i=l?ph:a(e);return{innerBlocks:l?r:i,hasUncontrolledInnerBlocks:l,uncontrolledInnerBlocks:r,controlledInnerBlocks:i,isInnerBlockSelected:o(e,!0)}}),[e])}(n),Q=!!Z.find((e=>"core/navigation-submenu"===e.name)),{replaceInnerBlocks:K,selectBlock:Y,__unstableMarkNextChangeAsNotPersistent:J}=(0,gt.useDispatch)(nt.store),[X,ee]=(0,_t.useState)(!1),[te,ne]=(0,_t.useState)(!1),{hasResolvedNavigationMenus:ae,isNavigationMenuResolved:oe,isNavigationMenuMissing:re,canUserUpdateNavigationMenu:le,hasResolvedCanUserUpdateNavigationMenu:ie,canUserDeleteNavigationMenu:se,hasResolvedCanUserDeleteNavigationMenu:ce,canUserCreateNavigationMenu:me,isResolvingCanUserCreateNavigationMenu:ue,hasResolvedCanUserCreateNavigationMenu:pe}=Rg(C),de=ae&&re,{convert:ge,status:he,error:be}=ah(L),_e=he===th,ye=(0,_t.useCallback)(((e,t={focusNavigationBlock:!1})=>{const{focusNavigationBlock:a}=t;S(e),a&&Y(n)}),[Y,n,S]),ve=!re&&oe,fe=q&&!ve,{getNavigationFallbackId:ke}=Ft((0,gt.useSelect)(dt.store)),xe=C||fe?null:ke();(0,_t.useEffect)((()=>{C||fe||!xe||(J(),S(xe))}),[C,S,fe,xe,J]);const we=(0,_t.useRef)(),Ee="nav",Ce=!C&&!$&&!_e&&ae&&0===I?.length&&!q,Se=!ae||$||_e||!(!C||ve||_e),Be=e.style?.typography?.textDecoration,Ne=(0,gt.useSelect)((e=>e(nt.store).__unstableHasActiveBlockOverlayActive(n)),[n]),Te="never"!==_,Ie=(0,nt.useBlockProps)({ref:we,className:ut()(o,{"items-justified-right":"right"===f,"items-justified-space-between":"space-between"===f,"items-justified-left":"left"===f,"items-justified-center":"center"===f,"is-vertical":"vertical"===k,"no-wrap":"nowrap"===x,"is-responsive":Te,"has-text-color":!!i.color||!!i?.class,[(0,nt.getColorClassName)("color",i?.slug)]:!!i?.slug,"has-background":!!r.color||r.class,[(0,nt.getColorClassName)("background-color",r?.slug)]:!!r?.slug,[`has-text-decoration-${Be}`]:Be,"block-editor-block-content-overlay":Ne},h),style:{color:!i?.slug&&i?.color,backgroundColor:!r?.slug&&r?.color}}),Pe="web"===_t.Platform.OS,[Me,ze]=(0,_t.useState)(),[Re,Ae]=(0,_t.useState)(),[He,Le]=(0,_t.useState)(),[De,Fe]=(0,_t.useState)(),Ve=async e=>ge(e.id,e.name,"draft"),$e=e=>{ye(e)};(0,_t.useEffect)((()=>{M(),$&&(0,Bg.speak)((0,tt.__)("Creating Navigation Menu.")),O&&(ye(V?.id,{focusNavigationBlock:!0}),P((0,tt.__)("Navigation Menu successfully created."))),G&&P((0,tt.__)("Failed to create Navigation Menu."))}),[D,F,V?.id,G,O,$,ye,M,P]),(0,_t.useEffect)((()=>{R(),he===th&&(0,Bg.speak)((0,tt.__)("Classic menu importing.")),he===Xg&&(z((0,tt.__)("Classic menu imported successfully.")),ye(V?.id,{focusNavigationBlock:!0})),he===eh&&z((0,tt.__)("Classic menu import failed."))}),[he,be,R,z,V?.id,ye]),(0,_t.useEffect)((()=>{if(!Pe)return;gh(we.current,Ae,ze);const e=we.current?.querySelector('[data-type="core/navigation-submenu"] [data-type="core/navigation-link"]');e&&(u.color||c.color)&&gh(e,Fe,Le)}),[Pe,u.color,c.color]),(0,_t.useEffect)((()=>{a||W||H(),(a||W)&&(C&&!de&&ie&&!le&&A((0,tt.__)("You do not have permission to edit this Menu. Any changes made will not be saved.")),C||!pe||me||A((0,tt.__)("You do not have permission to create Navigation Menus.")))}),[a,W,le,ie,me,pe,C,H,A,de]);const Oe=me||le,Ge=ut()("wp-block-navigation__overlay-menu-preview",{open:te}),Ue=y||b?"":(0,tt.__)('The current menu options offer reduced accessibility for users and are not recommended. Enabling either "Open on Click" or "Show arrow" offers enhanced accessibility by allowing keyboard users to browse submenus selectively.'),qe=(0,_t.useRef)(!0);(0,_t.useEffect)((()=>{!qe.current&&Ue&&(0,Bg.speak)(Ue),qe.current=!1}),[Ue]);const je=(0,jt.useInstanceId)(Kg,"overlay-menu-preview"),We=(0,nt.__experimentalUseMultipleOriginColorsAndGradients)(),Ze=(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,d&&(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Display")},Te&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.Button,{className:Ge,onClick:()=>{ne(!te)},"aria-label":(0,tt.__)("Overlay menu controls"),"aria-controls":je,"aria-expanded":te},w&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)($g,{icon:E}),(0,Ke.createElement)(Ng,{icon:Tg})),!w&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("span",null,(0,tt.__)("Menu")),(0,Ke.createElement)("span",null,(0,tt.__)("Close")))),(0,Ke.createElement)("div",{id:je},te&&(0,Ke.createElement)(Kg,{setAttributes:t,hasIcon:w,icon:E,hidden:!te}))),(0,Ke.createElement)("h3",null,(0,tt.__)("Overlay Menu")),(0,Ke.createElement)(et.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Configure overlay menu"),value:_,help:(0,tt.__)("Collapses the navigation options in a menu icon opening an overlay."),onChange:e=>t({overlayMenu:e}),isBlock:!0,hideLabelFromVision:!0},(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"never",label:(0,tt.__)("Off")}),(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"mobile",label:(0,tt.__)("Mobile")}),(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"always",label:(0,tt.__)("Always")})),Q&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("h3",null,(0,tt.__)("Submenus")),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,checked:b,onChange:e=>{t({openSubmenusOnClick:e,...e&&{showSubmenuIcon:!0}})},label:(0,tt.__)("Open on click")}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,checked:y,onChange:e=>{t({showSubmenuIcon:e})},disabled:e.openSubmenusOnClick,label:(0,tt.__)("Show arrow")}),Ue&&(0,Ke.createElement)("div",null,(0,Ke.createElement)(et.Notice,{spokenMessage:null,status:"warning",isDismissible:!1},Ue))))),We.hasColorsOrGradients&&(0,Ke.createElement)(nt.InspectorControls,{group:"color"},(0,Ke.createElement)(nt.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:i.color,label:(0,tt.__)("Text"),onColorChange:s,resetAllFilter:()=>s()},{colorValue:r.color,label:(0,tt.__)("Background"),onColorChange:l,resetAllFilter:()=>l()},{colorValue:u.color,label:(0,tt.__)("Submenu & overlay text"),onColorChange:p,resetAllFilter:()=>p()},{colorValue:c.color,label:(0,tt.__)("Submenu & overlay background"),onColorChange:m,resetAllFilter:()=>m()}],panelId:n,...We,gradients:[],disableCustomGradients:!0}),Pe&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.ContrastChecker,{backgroundColor:Me,textColor:Re}),(0,Ke.createElement)(nt.ContrastChecker,{backgroundColor:He,textColor:De})))),Ye=`${n}-desc`,Je=!Oe||!ae;if(fe&&!$)return(0,Ke.createElement)(Ee,{...Ie,"aria-describedby":Ce?void 0:Ye},(0,Ke.createElement)($h,{id:Ye},(0,tt.__)("Unsaved Navigation Menu.")),(0,Ke.createElement)(Vh,{clientId:n,createNavigationMenuIsSuccess:O,createNavigationMenuIsError:G,currentMenuId:C,isNavigationMenuMissing:re,isManageMenusButtonDisabled:Je,onCreateNew:U,onSelectClassicMenu:Ve,onSelectNavigationMenu:$e,isLoading:Se,blockEditingMode:T}),"default"===T&&Ze,(0,Ke.createElement)(Og,{id:n,onToggle:ee,isOpen:X,hasIcon:w,icon:E,isResponsive:Te,isHiddenByDefault:"always"===_,overlayBackgroundColor:c,overlayTextColor:u},(0,Ke.createElement)(Wg,{createNavigationMenu:L,blocks:j,hasSelection:a||W})));if(C&&re)return(0,Ke.createElement)(Ee,{...Ie},(0,Ke.createElement)(Vh,{clientId:n,createNavigationMenuIsSuccess:O,createNavigationMenuIsError:G,currentMenuId:C,isNavigationMenuMissing:re,isManageMenusButtonDisabled:Je,onCreateNew:U,onSelectClassicMenu:Ve,onSelectNavigationMenu:$e,isLoading:Se,blockEditingMode:T}),(0,Ke.createElement)(yh,{onCreateNew:U}));if(ve&&N)return(0,Ke.createElement)("div",{...Ie},(0,Ke.createElement)(nt.Warning,null,(0,tt.__)("Block cannot be rendered inside itself.")));const Xe=g||Fg;return Ce&&g?(0,Ke.createElement)(Ee,{...Ie},(0,Ke.createElement)(Xe,{isSelected:a,currentMenuId:C,clientId:n,canUserCreateNavigationMenu:me,isResolvingCanUserCreateNavigationMenu:ue,onSelectNavigationMenu:$e,onSelectClassicMenu:Ve,onCreateEmpty:U})):(0,Ke.createElement)(dt.EntityProvider,{kind:"postType",type:"wp_navigation",id:C},(0,Ke.createElement)(nt.RecursionProvider,{uniqueId:B},(0,Ke.createElement)(Vh,{clientId:n,createNavigationMenuIsSuccess:O,createNavigationMenuIsError:G,currentMenuId:C,isNavigationMenuMissing:re,isManageMenusButtonDisabled:Je,onCreateNew:U,onSelectClassicMenu:Ve,onSelectNavigationMenu:$e,isLoading:Se,blockEditingMode:T}),"default"===T&&Ze,"default"===T&&ve&&(0,Ke.createElement)(nt.InspectorControls,{group:"advanced"},ie&&le&&(0,Ke.createElement)(Ug,null),ce&&se&&(0,Ke.createElement)(Zg,{onDelete:(e="")=>{K(n,[]),P((0,tt.sprintf)((0,tt.__)("Navigation menu %s successfully deleted."),e))}}),(0,Ke.createElement)(_h,{disabled:Je,className:"wp-block-navigation-manage-menus-button"})),(0,Ke.createElement)(Ee,{...Ie,"aria-describedby":Ce||Se?void 0:Ye},Se&&(0,Ke.createElement)("div",{className:"wp-block-navigation__loading-indicator-container"},(0,Ke.createElement)(et.Spinner,{className:"wp-block-navigation__loading-indicator"})),!Se&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(Oh,{id:Ye}),(0,Ke.createElement)(Og,{id:n,onToggle:ee,hasIcon:w,icon:E,isOpen:X,isResponsive:Te,isHiddenByDefault:"always"===_,overlayBackgroundColor:c,overlayTextColor:u},ve&&(0,Ke.createElement)(Gg,{clientId:n,hasCustomPlaceholder:!!g,templateLock:v,orientation:k}))))))}));const Uh={fontStyle:"var:preset|font-style|",fontWeight:"var:preset|font-weight|",textDecoration:"var:preset|text-decoration|",textTransform:"var:preset|text-transform|"},qh=({navigationMenuId:e,...t})=>({...t,ref:e}),jh=e=>{if(e.layout)return e;const{itemsJustification:t,orientation:n,...a}=e;return(t||n)&&Object.assign(a,{layout:{type:"flex",...t&&{justifyContent:t},...n&&{orientation:n}}}),a},Wh={attributes:{navigationMenuId:{type:"number"},textColor:{type:"string"},customTextColor:{type:"string"},rgbTextColor:{type:"string"},backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},rgbBackgroundColor:{type:"string"},showSubmenuIcon:{type:"boolean",default:!0},openSubmenusOnClick:{type:"boolean",default:!1},overlayMenu:{type:"string",default:"mobile"},__unstableLocation:{type:"string"},overlayBackgroundColor:{type:"string"},customOverlayBackgroundColor:{type:"string"},overlayTextColor:{type:"string"},customOverlayTextColor:{type:"string"}},supports:{align:["wide","full"],anchor:!0,html:!1,inserter:!0,typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0,__experimentalTextDecoration:!0,__experimentalDefaultControls:{fontSize:!0}},spacing:{blockGap:!0,units:["px","em","rem","vh","vw"],__experimentalDefaultControls:{blockGap:!0}},layout:{allowSwitching:!1,allowInheriting:!1,default:{type:"flex"}}},save:()=>(0,Ke.createElement)(nt.InnerBlocks.Content,null),isEligible:({navigationMenuId:e})=>!!e,migrate:qh},Zh={attributes:{navigationMenuId:{type:"number"},orientation:{type:"string",default:"horizontal"},textColor:{type:"string"},customTextColor:{type:"string"},rgbTextColor:{type:"string"},backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},rgbBackgroundColor:{type:"string"},itemsJustification:{type:"string"},showSubmenuIcon:{type:"boolean",default:!0},openSubmenusOnClick:{type:"boolean",default:!1},overlayMenu:{type:"string",default:"never"},__unstableLocation:{type:"string"},overlayBackgroundColor:{type:"string"},customOverlayBackgroundColor:{type:"string"},overlayTextColor:{type:"string"},customOverlayTextColor:{type:"string"}},supports:{align:["wide","full"],anchor:!0,html:!1,inserter:!0,typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0,__experimentalTextDecoration:!0,__experimentalDefaultControls:{fontSize:!0}},spacing:{blockGap:!0,units:["px","em","rem","vh","vw"],__experimentalDefaultControls:{blockGap:!0}}},save:()=>(0,Ke.createElement)(nt.InnerBlocks.Content,null),isEligible:({itemsJustification:e,orientation:t})=>!!e||!!t,migrate:(0,jt.compose)(qh,jh)},Qh={attributes:{orientation:{type:"string",default:"horizontal"},textColor:{type:"string"},customTextColor:{type:"string"},rgbTextColor:{type:"string"},backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},rgbBackgroundColor:{type:"string"},itemsJustification:{type:"string"},showSubmenuIcon:{type:"boolean",default:!0},openSubmenusOnClick:{type:"boolean",default:!1},overlayMenu:{type:"string",default:"never"},__unstableLocation:{type:"string"},overlayBackgroundColor:{type:"string"},customOverlayBackgroundColor:{type:"string"},overlayTextColor:{type:"string"},customOverlayTextColor:{type:"string"}},supports:{align:["wide","full"],anchor:!0,html:!1,inserter:!0,typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0,__experimentalTextDecoration:!0},spacing:{blockGap:!0,units:["px","em","rem","vh","vw"],__experimentalDefaultControls:{blockGap:!0}}},save:()=>(0,Ke.createElement)(nt.InnerBlocks.Content,null),migrate:(0,jt.compose)(qh,jh,ln),isEligible:({style:e})=>e?.typography?.fontFamily},Kh=[Wh,Zh,Qh,{attributes:{orientation:{type:"string",default:"horizontal"},textColor:{type:"string"},customTextColor:{type:"string"},rgbTextColor:{type:"string"},backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},rgbBackgroundColor:{type:"string"},itemsJustification:{type:"string"},showSubmenuIcon:{type:"boolean",default:!0},openSubmenusOnClick:{type:"boolean",default:!1},isResponsive:{type:"boolean",default:"false"},__unstableLocation:{type:"string"},overlayBackgroundColor:{type:"string"},customOverlayBackgroundColor:{type:"string"},overlayTextColor:{type:"string"},customOverlayTextColor:{type:"string"}},supports:{align:["wide","full"],anchor:!0,html:!1,inserter:!0,typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0,__experimentalTextDecoration:!0}},isEligible:e=>e.isResponsive,migrate:(0,jt.compose)(qh,jh,ln,(function(e){return delete e.isResponsive,{...e,overlayMenu:"mobile"}})),save:()=>(0,Ke.createElement)(nt.InnerBlocks.Content,null)},{attributes:{orientation:{type:"string"},textColor:{type:"string"},customTextColor:{type:"string"},rgbTextColor:{type:"string"},backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},rgbBackgroundColor:{type:"string"},itemsJustification:{type:"string"},showSubmenuIcon:{type:"boolean",default:!0}},supports:{align:["wide","full"],anchor:!0,html:!1,inserter:!0,fontSize:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,color:!0,__experimentalFontFamily:!0,__experimentalTextDecoration:!0},save:()=>(0,Ke.createElement)(nt.InnerBlocks.Content,null),isEligible(e){if(!e.style||!e.style.typography)return!1;for(const t in Uh){const n=e.style.typography[t];if(n&&n.startsWith(Uh[t]))return!0}return!1},migrate:(0,jt.compose)(qh,jh,ln,(function(e){var t;return{...e,style:{...e.style,typography:Object.fromEntries(Object.entries(null!==(t=e.style.typography)&&void 0!==t?t:{}).map((([e,t])=>{const n=Uh[e];if(n&&t.startsWith(n)){const a=t.slice(n.length);return"textDecoration"===e&&"strikethrough"===a?[e,"line-through"]:[e,a]}return[e,t]})))}}}))},{attributes:{className:{type:"string"},textColor:{type:"string"},rgbTextColor:{type:"string"},backgroundColor:{type:"string"},rgbBackgroundColor:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"},itemsJustification:{type:"string"},showSubmenuIcon:{type:"boolean"}},isEligible:e=>e.rgbTextColor||e.rgbBackgroundColor,supports:{align:["wide","full"],anchor:!0,html:!1,inserter:!0},migrate:(0,jt.compose)(qh,(e=>{const{rgbTextColor:t,rgbBackgroundColor:n,...a}=e;return{...a,customTextColor:e.textColor?void 0:e.rgbTextColor,customBackgroundColor:e.backgroundColor?void 0:e.rgbBackgroundColor}})),save:()=>(0,Ke.createElement)(nt.InnerBlocks.Content,null)}],Yh=Kh,Jh={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/navigation",title:"Navigation",category:"theme",allowedBlocks:["core/navigation-link","core/search","core/social-links","core/page-list","core/spacer","core/home-link","core/site-title","core/site-logo","core/navigation-submenu","core/loginout","core/buttons"],description:"A collection of blocks that allow visitors to get around your site.",keywords:["menu","navigation","links"],textdomain:"default",attributes:{ref:{type:"number"},textColor:{type:"string"},customTextColor:{type:"string"},rgbTextColor:{type:"string"},backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},rgbBackgroundColor:{type:"string"},showSubmenuIcon:{type:"boolean",default:!0},openSubmenusOnClick:{type:"boolean",default:!1},overlayMenu:{type:"string",default:"mobile"},icon:{type:"string",default:"handle"},hasIcon:{type:"boolean",default:!0},__unstableLocation:{type:"string"},overlayBackgroundColor:{type:"string"},customOverlayBackgroundColor:{type:"string"},overlayTextColor:{type:"string"},customOverlayTextColor:{type:"string"},maxNestingLevel:{type:"number",default:5},templateLock:{type:["string","boolean"],enum:["all","insert","contentOnly",!1]}},providesContext:{textColor:"textColor",customTextColor:"customTextColor",backgroundColor:"backgroundColor",customBackgroundColor:"customBackgroundColor",overlayTextColor:"overlayTextColor",customOverlayTextColor:"customOverlayTextColor",overlayBackgroundColor:"overlayBackgroundColor",customOverlayBackgroundColor:"customOverlayBackgroundColor",fontSize:"fontSize",customFontSize:"customFontSize",showSubmenuIcon:"showSubmenuIcon",openSubmenusOnClick:"openSubmenusOnClick",style:"style",maxNestingLevel:"maxNestingLevel"},supports:{align:["wide","full"],ariaLabel:!0,html:!1,inserter:!0,typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0,__experimentalLetterSpacing:!0,__experimentalTextDecoration:!0,__experimentalSkipSerialization:["textDecoration"],__experimentalDefaultControls:{fontSize:!0}},spacing:{blockGap:!0,units:["px","em","rem","vh","vw"],__experimentalDefaultControls:{blockGap:!0}},layout:{allowSwitching:!1,allowInheriting:!1,allowVerticalAlignment:!1,allowSizingOnChildren:!0,default:{type:"flex"}},__experimentalStyle:{elements:{link:{color:{text:"inherit"}}}},interactivity:!0,renaming:!1},editorStyle:"wp-block-navigation-editor",style:"wp-block-navigation"},{name:Xh}=Jh,eb={icon:Sg,example:{attributes:{overlayMenu:"never"},innerBlocks:[{name:"core/navigation-link",attributes:{label:(0,tt.__)("Home"),url:"https://make.wordpress.org/"}},{name:"core/navigation-link",attributes:{label:(0,tt.__)("About"),url:"https://make.wordpress.org/"}},{name:"core/navigation-link",attributes:{label:(0,tt.__)("Contact"),url:"https://make.wordpress.org/"}}]},edit:Gh,save:function({attributes:e}){if(!e.ref)return(0,Ke.createElement)(nt.InnerBlocks.Content,null)},deprecated:Yh},tb=()=>Xe({name:Xh,metadata:Jh,settings:eb}),nb=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M12.5 14.5h-1V16h1c2.2 0 4-1.8 4-4s-1.8-4-4-4h-1v1.5h1c1.4 0 2.5 1.1 2.5 2.5s-1.1 2.5-2.5 2.5zm-4 1.5v-1.5h-1C6.1 14.5 5 13.4 5 12s1.1-2.5 2.5-2.5h1V8h-1c-2.2 0-4 1.8-4 4s1.8 4 4 4h1zm-1-3.2h5v-1.5h-5v1.5zM18 4H9c-1.1 0-2 .9-2 2v.5h1.5V6c0-.3.2-.5.5-.5h9c.3 0 .5.2.5.5v12c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5v-.5H7v.5c0 1.1.9 2 2 2h9c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2z"})),ab={name:"core/navigation-link"};const ob=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,Ke.createElement)(Ye.Path,{d:"M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"})),rb=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})),lb=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4zm.8-4l.7.7 2-2V12h1V9.2l2 2 .7-.7-2-2H12v-1H9.2l2-2-.7-.7-2 2V4h-1v2.8l-2-2-.7.7 2 2H4v1h2.8l-2 2z"}));function ib(e){switch(e){case"post":return Sp;case"page":return ob;case"tag":return rb;case"category":return Yn;default:return lb}}function sb(e,t){if("core/navigation-link"!==t)return e;if(e.variations){const t=(e,t)=>e.type===t.type,n=e.variations.map((e=>({...e,...!e.icon&&{icon:ib(e.name)},...!e.isActive&&{isActive:t}})));return{...e,variations:n}}return e}const cb={from:[{type:"block",blocks:["core/site-logo"],transform:()=>(0,Qe.createBlock)("core/navigation-link")},{type:"block",blocks:["core/spacer"],transform:()=>(0,Qe.createBlock)("core/navigation-link")},{type:"block",blocks:["core/home-link"],transform:()=>(0,Qe.createBlock)("core/navigation-link")},{type:"block",blocks:["core/social-links"],transform:()=>(0,Qe.createBlock)("core/navigation-link")},{type:"block",blocks:["core/search"],transform:()=>(0,Qe.createBlock)("core/navigation-link")},{type:"block",blocks:["core/page-list"],transform:()=>(0,Qe.createBlock)("core/navigation-link")},{type:"block",blocks:["core/buttons"],transform:()=>(0,Qe.createBlock)("core/navigation-link")}],to:[{type:"block",blocks:["core/navigation-submenu"],transform:(e,t)=>(0,Qe.createBlock)("core/navigation-submenu",e,t)},{type:"block",blocks:["core/spacer"],transform:()=>(0,Qe.createBlock)("core/spacer")},{type:"block",blocks:["core/site-logo"],transform:()=>(0,Qe.createBlock)("core/site-logo")},{type:"block",blocks:["core/home-link"],transform:()=>(0,Qe.createBlock)("core/home-link")},{type:"block",blocks:["core/social-links"],transform:()=>(0,Qe.createBlock)("core/social-links")},{type:"block",blocks:["core/search"],transform:()=>(0,Qe.createBlock)("core/search",{showLabel:!1,buttonUseIcon:!0,buttonPosition:"button-inside"})},{type:"block",blocks:["core/page-list"],transform:()=>(0,Qe.createBlock)("core/page-list")},{type:"block",blocks:["core/buttons"],transform:({label:e,url:t,rel:n,title:a,opensInNewTab:o})=>(0,Qe.createBlock)("core/buttons",{},[(0,Qe.createBlock)("core/button",{text:e,url:t,rel:n,title:a,linkTarget:o?"_blank":void 0})])}]},mb=cb,ub={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/navigation-link",title:"Custom Link",category:"design",parent:["core/navigation"],allowedBlocks:["core/navigation-link","core/navigation-submenu","core/page-list"],description:"Add a page, link, or another item to your navigation.",textdomain:"default",attributes:{label:{type:"string"},type:{type:"string"},description:{type:"string"},rel:{type:"string"},id:{type:"number"},opensInNewTab:{type:"boolean",default:!1},url:{type:"string"},title:{type:"string"},kind:{type:"string"},isTopLevelLink:{type:"boolean"}},usesContext:["textColor","customTextColor","backgroundColor","customBackgroundColor","overlayTextColor","customOverlayTextColor","overlayBackgroundColor","customOverlayBackgroundColor","fontSize","customFontSize","showSubmenuIcon","maxNestingLevel","style"],supports:{reusable:!1,html:!1,__experimentalSlashInserter:!0,typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},renaming:!1,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-navigation-link-editor",style:"wp-block-navigation-link"},{name:pb}=ub,db={icon:nb,__experimentalLabel:({label:e})=>e,merge:(e,{label:t=""})=>({...e,label:e.label+t}),edit:function({attributes:e,isSelected:t,setAttributes:n,insertBlocksAfter:a,mergeBlocks:o,onReplace:r,context:l,clientId:i}){const{id:s,label:c,type:m,url:u,description:p,rel:d,title:g,kind:h}=e,[b,_]=((e,t,n)=>{const a="post-type"===e||"post"===t||"page"===t,o=Number.isInteger(n),r=(0,gt.useSelect)((e=>{if(!a)return null;const{getEntityRecord:o}=e(dt.store);return o("postType",t,n)?.status}),[a,t,n]);return[a&&o&&r&&"trash"===r,"draft"===r]})(h,m,s),{maxNestingLevel:y}=l,{replaceBlock:v,__unstableMarkNextChangeAsNotPersistent:f}=(0,gt.useDispatch)(nt.store),[k,x]=(0,_t.useState)(!1),[w,E]=(0,_t.useState)(null),C=(0,_t.useRef)(null),S=(e=>{const[t,n]=(0,_t.useState)(!1);return(0,_t.useEffect)((()=>{const{ownerDocument:t}=e.current;function a(e){r(e)}function o(){n(!1)}function r(t){e.current.contains(t.target)?n(!0):n(!1)}return t.addEventListener("dragstart",a),t.addEventListener("dragend",o),t.addEventListener("dragenter",r),()=>{t.removeEventListener("dragstart",a),t.removeEventListener("dragend",o),t.removeEventListener("dragenter",r)}}),[]),t})(C),B=(0,tt.__)("Add label…"),N=(0,_t.useRef)(),[T,I]=(0,_t.useState)(!1),{innerBlocks:P,isAtMaxNesting:M,isTopLevelLink:z,isParentOfSelectedBlock:R,hasChildren:A}=(0,gt.useSelect)((e=>{const{getBlocks:t,getBlockCount:n,getBlockName:a,getBlockRootClientId:o,hasSelectedInnerBlock:r,getBlockParentsByBlockName:l}=e(nt.store);return{innerBlocks:t(i),isAtMaxNesting:l(i,["core/navigation-link","core/navigation-submenu"]).length>=y,isTopLevelLink:"core/navigation"===a(o(i)),isParentOfSelectedBlock:r(i,!0),hasChildren:!!n(i)}}),[i]);function H(){const t=(0,Qe.createBlock)("core/navigation-submenu",e,P.length>0?P:[(0,Qe.createBlock)("core/navigation-link")]);v(i,t)}(0,_t.useEffect)((()=>{u||x(!0)}),[u]),(0,_t.useEffect)((()=>{A&&(f(),H())}),[A]),(0,_t.useEffect)((()=>{t||x(!1)}),[t]),(0,_t.useEffect)((()=>{k&&u&&((0,pt.isURL)((0,pt.prependHTTP)(c))&&/^.+\.[a-z]+/.test(c)?function(){N.current.focus();const{ownerDocument:e}=N.current,{defaultView:t}=e,n=t.getSelection(),a=e.createRange();a.selectNodeContents(N.current),n.removeAllRanges(),n.addRange(a)}():(0,ac.placeCaretAtHorizontalEdge)(N.current,!0))}),[u]);const{textColor:L,customTextColor:D,backgroundColor:F,customBackgroundColor:V}=hh(l,!z),$=(0,nt.useBlockProps)({ref:(0,jt.useMergeRefs)([E,C]),className:ut()("wp-block-navigation-item",{"is-editing":t||R,"is-dragging-within":S,"has-link":!!u,"has-child":A,"has-text-color":!!L||!!D,[(0,nt.getColorClassName)("color",L)]:!!L,"has-background":!!F||V,[(0,nt.getColorClassName)("background-color",F)]:!!F}),style:{color:!L&&D,backgroundColor:!F&&V},onKeyDown:function(e){(fn.isKeyboardEvent.primary(e,"k")||(!u||_||b)&&e.keyCode===fn.ENTER)&&(e.preventDefault(),x(!0))}}),O=(0,nt.useInnerBlocksProps)({...$,className:"remove-outline"},{defaultBlock:ab,directInsert:!0,renderAppender:!1});(!u||b||_)&&($.onClick=()=>x(!0));const G=ut()("wp-block-navigation-item__content",{"wp-block-navigation-link__placeholder":!u||b||_}),U=function(e){let t="";switch(e){case"post":t=(0,tt.__)("Select post");break;case"page":t=(0,tt.__)("Select page");break;case"category":t=(0,tt.__)("Select category");break;case"tag":t=(0,tt.__)("Select tag");break;default:t=(0,tt.__)("Add link")}return t}(m),q=`(${b?(0,tt.__)("Invalid"):(0,tt.__)("Draft")})`,j=b||_?(0,tt.__)("This item has been deleted, or is a draft"):(0,tt.__)("This item is missing a link");return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,null,(0,Ke.createElement)(et.ToolbarButton,{name:"link",icon:kn,title:(0,tt.__)("Link"),shortcut:fn.displayShortcut.primary("k"),onClick:()=>x(!0)}),!M&&(0,Ke.createElement)(et.ToolbarButton,{name:"submenu",icon:vh,title:(0,tt.__)("Add submenu"),onClick:H}))),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,value:c?(0,ac.__unstableStripHTML)(c):"",onChange:e=>{n({label:e})},label:(0,tt.__)("Label"),autoComplete:"off",onFocus:()=>I(!0),onBlur:()=>I(!1)}),(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,value:u?(0,pt.safeDecodeURI)(u):"",onChange:t=>{Bh({url:t},n,e)},label:(0,tt.__)("URL"),autoComplete:"off"}),(0,Ke.createElement)(et.TextareaControl,{__nextHasNoMarginBottom:!0,value:p||"",onChange:e=>{n({description:e})},label:(0,tt.__)("Description"),help:(0,tt.__)("The description will be displayed in the menu if the current theme supports it.")}),(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,value:g||"",onChange:e=>{n({title:e})},label:(0,tt.__)("Title attribute"),autoComplete:"off",help:(0,tt.__)("Additional information to help clarify the purpose of the link.")}),(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,value:d||"",onChange:e=>{n({rel:e})},label:(0,tt.__)("Rel attribute"),autoComplete:"off",help:(0,tt.__)("The relationship of the linked URL as space-separated link types.")}))),(0,Ke.createElement)("div",{...$},(0,Ke.createElement)("a",{className:G},u?(0,Ke.createElement)(Ke.Fragment,null,!b&&!_&&!T&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.RichText,{ref:N,identifier:"label",className:"wp-block-navigation-item__label",value:c,onChange:e=>n({label:e}),onMerge:o,onReplace:r,__unstableOnSplitAtEnd:()=>a((0,Qe.createBlock)("core/navigation-link")),"aria-label":(0,tt.__)("Navigation link text"),placeholder:B,withoutInteractiveFormatting:!0,allowedFormats:["core/bold","core/italic","core/image","core/strikethrough"],onClick:()=>{u||x(!0)}}),p&&(0,Ke.createElement)("span",{className:"wp-block-navigation-item__description"},p)),(b||_||T)&&(0,Ke.createElement)("div",{className:"wp-block-navigation-link__placeholder-text wp-block-navigation-link__label"},(0,Ke.createElement)(et.Tooltip,{text:j},(0,Ke.createElement)("span",{"aria-label":(0,tt.__)("Navigation link text")},`${(0,Jn.decodeEntities)(c)} ${b||_?q:""}`.trim())))):(0,Ke.createElement)("div",{className:"wp-block-navigation-link__placeholder-text"},(0,Ke.createElement)(et.Tooltip,{text:j},(0,Ke.createElement)("span",null,U))),k&&(0,Ke.createElement)(zh,{clientId:i,link:e,onClose:()=>{u||r([])},anchor:w,onRemove:function(){n({url:void 0,label:void 0,id:void 0,kind:void 0,type:void 0,opensInNewTab:!1}),x(!1)},onChange:t=>{Bh(t,n,e)}})),(0,Ke.createElement)("div",{...O})))},save:function(){return(0,Ke.createElement)(nt.InnerBlocks.Content,null)},example:{attributes:{label:(0,tt._x)("Example Link","navigation link preview example"),url:"https://example.com"}},deprecated:[{isEligible:e=>e.nofollow,attributes:{label:{type:"string"},type:{type:"string"},nofollow:{type:"boolean"},description:{type:"string"},id:{type:"number"},opensInNewTab:{type:"boolean",default:!1},url:{type:"string"}},migrate:({nofollow:e,...t})=>({rel:e?"nofollow":"",...t}),save:()=>(0,Ke.createElement)(nt.InnerBlocks.Content,null)}],transforms:mb},gb=()=>((0,_i.addFilter)("blocks.registerBlockType","core/navigation-link",sb),Xe({name:pb,metadata:ub,settings:db})),hb=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"m13.955 20.748 8-17.5-.91-.416L19.597 6H13.5v1.5h5.411l-1.6 3.5H13.5v1.5h3.126l-1.6 3.5H13.5l.028 1.5h.812l-1.295 2.832.91.416ZM17.675 16l-.686 1.5h4.539L21.5 16h-3.825Zm2.286-5-.686 1.5H21.5V11h-1.54ZM2 12c0 3.58 2.42 5.5 6 5.5h.5V19l3-2.5-3-2.5v2H8c-2.48 0-4.5-1.52-4.5-4S5.52 7.5 8 7.5h3.5V6H8c-3.58 0-6 2.42-6 6Z"})),bb=()=>(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},(0,Ke.createElement)(et.Path,{d:"M1.50002 4L6.00002 8L10.5 4",strokeWidth:"1.5"})),_b=["core/navigation-link","core/navigation-submenu","core/page-list"],yb={name:"core/navigation-link"};const vb={to:[{type:"block",blocks:["core/navigation-link"],isMatch:(e,t)=>0===t?.innerBlocks?.length,transform:e=>(0,Qe.createBlock)("core/navigation-link",e)},{type:"block",blocks:["core/spacer"],isMatch:(e,t)=>0===t?.innerBlocks?.length,transform:()=>(0,Qe.createBlock)("core/spacer")},{type:"block",blocks:["core/site-logo"],isMatch:(e,t)=>0===t?.innerBlocks?.length,transform:()=>(0,Qe.createBlock)("core/site-logo")},{type:"block",blocks:["core/home-link"],isMatch:(e,t)=>0===t?.innerBlocks?.length,transform:()=>(0,Qe.createBlock)("core/home-link")},{type:"block",blocks:["core/social-links"],isMatch:(e,t)=>0===t?.innerBlocks?.length,transform:()=>(0,Qe.createBlock)("core/social-links")},{type:"block",blocks:["core/search"],isMatch:(e,t)=>0===t?.innerBlocks?.length,transform:()=>(0,Qe.createBlock)("core/search")}]},fb=vb,kb={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/navigation-submenu",title:"Submenu",category:"design",parent:["core/navigation"],description:"Add a submenu to your navigation.",textdomain:"default",attributes:{label:{type:"string"},type:{type:"string"},description:{type:"string"},rel:{type:"string"},id:{type:"number"},opensInNewTab:{type:"boolean",default:!1},url:{type:"string"},title:{type:"string"},kind:{type:"string"},isTopLevelItem:{type:"boolean"}},usesContext:["textColor","customTextColor","backgroundColor","customBackgroundColor","overlayTextColor","customOverlayTextColor","overlayBackgroundColor","customOverlayBackgroundColor","fontSize","customFontSize","showSubmenuIcon","maxNestingLevel","openSubmenusOnClick","style"],supports:{reusable:!1,html:!1,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-navigation-submenu-editor",style:"wp-block-navigation-submenu"},{name:xb}=kb,wb={icon:({context:e})=>"list-view"===e?ob:vh,__experimentalLabel(e,{context:t}){const{label:n}=e,a=e?.metadata?.name;return"list-view"===t&&(a||n)&&e?.metadata?.name||n},edit:function({attributes:e,isSelected:t,setAttributes:n,mergeBlocks:a,onReplace:o,context:r,clientId:l}){const{label:i,type:s,url:c,description:m,rel:u,title:p}=e,{showSubmenuIcon:d,maxNestingLevel:g,openSubmenusOnClick:h}=r,{__unstableMarkNextChangeAsNotPersistent:b,replaceBlock:_}=(0,gt.useDispatch)(nt.store),[y,v]=(0,_t.useState)(!1),[f,k]=(0,_t.useState)(null),x=(0,_t.useRef)(null),w=(e=>{const[t,n]=(0,_t.useState)(!1);return(0,_t.useEffect)((()=>{const{ownerDocument:t}=e.current;function a(e){r(e)}function o(){n(!1)}function r(t){e.current.contains(t.target)?n(!0):n(!1)}return t.addEventListener("dragstart",a),t.addEventListener("dragend",o),t.addEventListener("dragenter",r),()=>{t.removeEventListener("dragstart",a),t.removeEventListener("dragend",o),t.removeEventListener("dragenter",r)}}),[]),t})(x),E=(0,tt.__)("Add text…"),C=(0,_t.useRef)(),S=(0,dt.useResourcePermissions)("pages"),B=(0,dt.useResourcePermissions)("posts"),{parentCount:N,isParentOfSelectedBlock:T,isImmediateParentOfSelectedBlock:I,hasChildren:P,selectedBlockHasChildren:M,onlyDescendantIsEmptyLink:z}=(0,gt.useSelect)((e=>{const{hasSelectedInnerBlock:t,getSelectedBlockClientId:n,getBlockParentsByBlockName:a,getBlock:o,getBlockCount:r,getBlockOrder:i}=e(nt.store);let s;const c=i(n());if(1===c?.length){const e=o(c[0]);s="core/navigation-link"===e?.name&&!e?.attributes?.label}return{parentCount:a(l,"core/navigation-submenu").length,isParentOfSelectedBlock:t(l,!0),isImmediateParentOfSelectedBlock:t(l,!1),hasChildren:!!r(l),selectedBlockHasChildren:!!c?.length,onlyDescendantIsEmptyLink:s}}),[l]),R=(0,jt.usePrevious)(P);(0,_t.useEffect)((()=>{h||c||v(!0)}),[]),(0,_t.useEffect)((()=>{t||v(!1)}),[t]),(0,_t.useEffect)((()=>{y&&c&&((0,pt.isURL)((0,pt.prependHTTP)(i))&&/^.+\.[a-z]+/.test(i)?function(){C.current.focus();const{ownerDocument:e}=C.current,{defaultView:t}=e,n=t.getSelection(),a=e.createRange();a.selectNodeContents(C.current),n.removeAllRanges(),n.addRange(a)}():(0,ac.placeCaretAtHorizontalEdge)(C.current,!0))}),[c]);let A=!1;s&&"page"!==s?"post"===s&&(A=B.canCreate):A=S.canCreate;const{textColor:H,customTextColor:L,backgroundColor:D,customBackgroundColor:F}=hh(r,N>0),V=(0,nt.useBlockProps)({ref:(0,jt.useMergeRefs)([k,x]),className:ut()("wp-block-navigation-item",{"is-editing":t||T,"is-dragging-within":w,"has-link":!!c,"has-child":P,"has-text-color":!!H||!!L,[(0,nt.getColorClassName)("color",H)]:!!H,"has-background":!!D||F,[(0,nt.getColorClassName)("background-color",D)]:!!D,"open-on-click":h}),style:{color:!H&&L,backgroundColor:!D&&F},onKeyDown:function(e){fn.isKeyboardEvent.primary(e,"k")&&(e.preventDefault(),v(!0))}}),$=hh(r,!0),O=N>=g?_b.filter((e=>"core/navigation-submenu"!==e)):_b,G=bh($),U=(0,nt.useInnerBlocksProps)(G,{allowedBlocks:O,defaultBlock:yb,directInsert:!0,__experimentalCaptureToolbars:!0,renderAppender:!!(t||I&&!M||P)&&nt.InnerBlocks.ButtonBlockAppender}),q=h?"button":"a";function j(){const t=(0,Qe.createBlock)("core/navigation-link",e);_(l,t)}(0,_t.useEffect)((()=>{!P&&R&&(b(),j())}),[P,R]);const W=!M||z;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,null,!h&&(0,Ke.createElement)(et.ToolbarButton,{name:"link",icon:kn,title:(0,tt.__)("Link"),shortcut:fn.displayShortcut.primary("k"),onClick:()=>v(!0)}),(0,Ke.createElement)(et.ToolbarButton,{name:"revert",icon:hb,title:(0,tt.__)("Convert to Link"),onClick:j,className:"wp-block-navigation__submenu__revert",isDisabled:!W}))),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,value:i||"",onChange:e=>{n({label:e})},label:(0,tt.__)("Label"),autoComplete:"off"}),(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,value:c||"",onChange:e=>{n({url:e})},label:(0,tt.__)("URL"),autoComplete:"off"}),(0,Ke.createElement)(et.TextareaControl,{__nextHasNoMarginBottom:!0,value:m||"",onChange:e=>{n({description:e})},label:(0,tt.__)("Description"),help:(0,tt.__)("The description will be displayed in the menu if the current theme supports it.")}),(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,value:p||"",onChange:e=>{n({title:e})},label:(0,tt.__)("Title attribute"),autoComplete:"off",help:(0,tt.__)("Additional information to help clarify the purpose of the link.")}),(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,value:u||"",onChange:e=>{n({rel:e})},label:(0,tt.__)("Rel attribute"),autoComplete:"off",help:(0,tt.__)("The relationship of the linked URL as space-separated link types.")}))),(0,Ke.createElement)("div",{...V},(0,Ke.createElement)(q,{className:"wp-block-navigation-item__content"},(0,Ke.createElement)(nt.RichText,{ref:C,identifier:"label",className:"wp-block-navigation-item__label",value:i,onChange:e=>n({label:e}),onMerge:a,onReplace:o,"aria-label":(0,tt.__)("Navigation link text"),placeholder:E,withoutInteractiveFormatting:!0,allowedFormats:["core/bold","core/italic","core/image","core/strikethrough"],onClick:()=>{h||c||v(!0)}}),!h&&y&&(0,Ke.createElement)(zh,{clientId:l,link:e,onClose:()=>v(!1),anchor:f,hasCreateSuggestion:A,onRemove:()=>{n({url:""}),(0,Bg.speak)((0,tt.__)("Link removed."),"assertive")},onChange:t=>{Bh(t,n,e)}})),(d||h)&&(0,Ke.createElement)("span",{className:"wp-block-navigation__submenu-icon"},(0,Ke.createElement)(bb,null)),(0,Ke.createElement)("div",{...U})))},save:function(){return(0,Ke.createElement)(nt.InnerBlocks.Content,null)},transforms:fb},Eb=()=>Xe({name:xb,metadata:kb,settings:wb}),Cb=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M17.5 9V6a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v3H8V6a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v3h1.5Zm0 6.5V18a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2v-2.5H8V18a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-2.5h1.5ZM4 13h16v-1.5H4V13Z"}));const Sb={from:[{type:"raw",schema:{"wp-block":{attributes:["data-block"]}},isMatch:e=>e.dataset&&"core/nextpage"===e.dataset.block,transform:()=>(0,Qe.createBlock)("core/nextpage",{})}]},Bb={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/nextpage",title:"Page Break",category:"design",description:"Separate your content into a multi-page experience.",keywords:["next page","pagination"],parent:["core/post-content"],textdomain:"default",supports:{customClassName:!1,className:!1,html:!1,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-nextpage-editor"},{name:Nb}=Bb,Tb={icon:Cb,example:{},transforms:Sb,edit:function(){return(0,Ke.createElement)("div",{...(0,nt.useBlockProps)()},(0,Ke.createElement)("span",null,(0,tt.__)("Page break")))},save:function(){return(0,Ke.createElement)(_t.RawHTML,null,"\x3c!--nextpage--\x3e")}},Ib=()=>Xe({name:Nb,metadata:Bb,settings:Tb}),Pb=new WeakMap;function Mb(){const e=(0,gt.useRegistry)();if(!Pb.has(e)){const t=new Map;Pb.set(e,zb.bind(null,t))}return Pb.get(e)}function zb(e,{name:t,blocks:n}){const a=[...n];for(;a.length;){const n=a.shift();for(const e of null!==(o=n.innerBlocks)&&void 0!==o?o:[]){var o;a.unshift(e)}"core/pattern"===n.name&&Rb(e,t,n.attributes.slug)}}function Rb(e,t,n){if(e.has(t)||e.set(t,new Set),e.get(t).add(n),Ab(e,t))throw new TypeError(`Pattern ${t} has a circular dependency and cannot be rendered.`)}function Ab(e,t,n=new Set,a=new Set){var o;n.add(t),a.add(t);const r=null!==(o=e.get(t))&&void 0!==o?o:new Set;for(const t of r)if(n.has(t)){if(a.has(t))return!0}else if(Ab(e,t,n,a))return!0;return a.delete(t),!1}const Hb=({attributes:e,clientId:t})=>{const n=(0,gt.useSelect)((t=>t(nt.store).__experimentalGetParsedPattern(e.slug)),[e.slug]),a=(0,gt.useSelect)((e=>e(dt.store).getCurrentTheme()?.stylesheet),[]),{replaceBlocks:o,setBlockEditingMode:r,__unstableMarkNextChangeAsNotPersistent:l}=(0,gt.useDispatch)(nt.store),{getBlockRootClientId:i,getBlockEditingMode:s}=(0,gt.useSelect)(nt.store),[c,m]=(0,_t.useState)(!1),u=Mb();(0,_t.useEffect)((()=>{if(!c&&n?.blocks){try{u(n)}catch(e){return void m(!0)}window.queueMicrotask((()=>{const e=i(t),c=n.blocks.map((e=>(0,Qe.cloneBlock)(function(e){return e.innerBlocks.find((e=>"core/template-part"===e.name))&&(e.innerBlocks=e.innerBlocks.map((e=>("core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=a),e)))),"core/template-part"===e.name&&void 0===e.attributes.theme&&(e.attributes.theme=a),e}(e)))),m=s(e);l(),r(e,"default"),l(),o(t,c),l(),r(e,m)}))}}),[t,c,n,l,o,s,r,i]);const p=(0,nt.useBlockProps)();return c?(0,Ke.createElement)("div",{...p},(0,Ke.createElement)(nt.Warning,null,(0,tt.sprintf)((0,tt.__)('Pattern "%s" cannot be rendered inside itself.'),n?.name))):(0,Ke.createElement)("div",{...p})},Lb={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/pattern",title:"Pattern placeholder",category:"theme",description:"Show a block pattern.",supports:{html:!1,inserter:!1,renaming:!1,interactivity:{clientNavigation:!0}},textdomain:"default",attributes:{slug:{type:"string"}}},{name:Db}=Lb,Fb={edit:Hb},Vb=()=>Xe({name:Db,metadata:Lb,settings:Fb}),$b=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z"}),(0,Ke.createElement)(Ye.Path,{d:"M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z"}),(0,Ke.createElement)(Ye.Path,{d:"M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z"}));function Ob(e,t){for(const n of e){if(n.attributes.id===t)return n;if(n.innerBlocks&&n.innerBlocks.length){const e=Ob(n.innerBlocks,t);if(e)return e}}return null}function Gb(e=[],t=null){let n=function(e=[]){const t={},n=[];return e.forEach((({id:e,title:a,link:o,type:r,parent:l})=>{var i;const s=null!==(i=t[e]?.innerBlocks)&&void 0!==i?i:[];t[e]=(0,Qe.createBlock)("core/navigation-link",{id:e,label:a.rendered,url:o,type:r,kind:"post-type"},s),l?(t[l]||(t[l]={innerBlocks:[]}),t[l].innerBlocks.push(t[e])):n.push(t[e])})),n}(e);if(t){const e=Ob(n,t);e&&e.innerBlocks&&(n=e.innerBlocks)}const a=e=>{e.forEach(((e,t,n)=>{const{attributes:o,innerBlocks:r}=e;if(0!==r.length){a(r);const e=(0,Qe.createBlock)("core/navigation-submenu",o,r);n[t]=e}}))};return a(n),n}function Ub({clientId:e,pages:t,parentClientId:n,parentPageID:a}){const{replaceBlock:o,selectBlock:r}=(0,gt.useDispatch)(nt.store);return()=>{const l=Gb(t,a);o(e,l),r(n)}}const qb=(0,tt.__)("This navigation menu displays your website's pages. Editing it will enable you to add, delete, or reorder pages. However, new pages will no longer be added automatically.");function jb({onClick:e,onClose:t,disabled:n}){return(0,Ke.createElement)(et.Modal,{onRequestClose:t,title:(0,tt.__)("Edit Page List"),className:"wp-block-page-list-modal",aria:{describedby:"wp-block-page-list-modal__description"}},(0,Ke.createElement)("p",{id:"wp-block-page-list-modal__description"},qb),(0,Ke.createElement)("div",{className:"wp-block-page-list-modal-buttons"},(0,Ke.createElement)(et.Button,{variant:"tertiary",onClick:t},(0,tt.__)("Cancel")),(0,Ke.createElement)(et.Button,{variant:"primary",disabled:n,onClick:e},(0,tt.__)("Edit"))))}const Wb=()=>{};function Zb({blockProps:e,innerBlocksProps:t,hasResolvedPages:n,blockList:a,pages:o,parentPageID:r}){if(!n)return(0,Ke.createElement)("div",{...e},(0,Ke.createElement)("div",{className:"wp-block-page-list__loading-indicator-container"},(0,Ke.createElement)(et.Spinner,{className:"wp-block-page-list__loading-indicator"})));if(null===o)return(0,Ke.createElement)("div",{...e},(0,Ke.createElement)(et.Notice,{status:"warning",isDismissible:!1},(0,tt.__)("Page List: Cannot retrieve Pages.")));if(0===o.length)return(0,Ke.createElement)("div",{...e},(0,Ke.createElement)(et.Notice,{status:"info",isDismissible:!1},(0,tt.__)("Page List: Cannot retrieve Pages.")));if(0===a.length){const t=o.find((e=>e.id===r));return t?.title?.rendered?(0,Ke.createElement)("div",{...e},(0,Ke.createElement)(nt.Warning,null,(0,tt.sprintf)((0,tt.__)('Page List: "%s" page has no children.'),t.title.rendered))):(0,Ke.createElement)("div",{...e},(0,Ke.createElement)(et.Notice,{status:"warning",isDismissible:!1},(0,tt.__)("Page List: Cannot retrieve Pages.")))}return o.length>0?(0,Ke.createElement)("ul",{...t}):void 0}const Qb={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/page-list",title:"Page List",category:"widgets",allowedBlocks:["core/page-list-item"],description:"Display a list of all pages.",keywords:["menu","navigation"],textdomain:"default",attributes:{parentPageID:{type:"integer",default:0},isNested:{type:"boolean",default:!1}},usesContext:["textColor","customTextColor","backgroundColor","customBackgroundColor","overlayTextColor","customOverlayTextColor","overlayBackgroundColor","customOverlayBackgroundColor","fontSize","customFontSize","showSubmenuIcon","style","openSubmenusOnClick"],supports:{reusable:!1,html:!1,typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-page-list-editor",style:"wp-block-page-list"},{name:Kb}=Qb,Yb={icon:$b,example:{},edit:function({context:e,clientId:t,attributes:n,setAttributes:a}){const{parentPageID:o}=n,[r,l]=(0,_t.useState)(!1),i=(0,_t.useCallback)((()=>l(!0)),[]),{records:s,hasResolved:c}=(0,dt.useEntityRecords)("postType","page",{per_page:100,_fields:["id","link","menu_order","parent","title","type"],orderby:"menu_order",order:"asc"}),m="showSubmenuIcon"in e&&s?.length>0&&s?.length<=100,u=(0,_t.useMemo)((()=>{if(null===s)return new Map;const e=s.sort(((e,t)=>e.menu_order===t.menu_order?e.title.rendered.localeCompare(t.title.rendered):e.menu_order-t.menu_order));return e.reduce(((e,t)=>{const{parent:n}=t;return e.has(n)?e.get(n).push(t):e.set(n,[t]),e}),new Map)}),[s]),p=(0,nt.useBlockProps)({className:ut()("wp-block-page-list",{"has-text-color":!!e.textColor,[(0,nt.getColorClassName)("color",e.textColor)]:!!e.textColor,"has-background":!!e.backgroundColor,[(0,nt.getColorClassName)("background-color",e.backgroundColor)]:!!e.backgroundColor}),style:{...e.style?.color}}),d=(0,_t.useMemo)((function e(t=0,n=0){const a=u.get(t);return a?.length?a.reduce(((t,a)=>{const o=u.has(a.id),r={value:a.id,label:"— ".repeat(n)+a.title.rendered,rawName:a.title.rendered};return t.push(r),o&&t.push(...e(a.id,n+1)),t}),[]):[]}),[u]),g=(0,_t.useMemo)((function e(t=o){const n=u.get(t);return n?.length?n.reduce(((t,n)=>{const a=u.has(n.id),o={id:n.id,label:""!==n.title?.rendered?.trim()?n.title?.rendered:(0,tt.__)("(no title)"),title:n.title?.rendered,link:n.url,hasChildren:a};let r=null;const l=e(n.id);return r=(0,Qe.createBlock)("core/page-list-item",o,l),t.push(r),t}),[]):[]}),[u,o]),{isNested:h,hasSelectedChild:b,parentClientId:_,hasDraggedChild:y,isChildOfNavigation:v}=(0,gt.useSelect)((e=>{const{getBlockParentsByBlockName:n,hasSelectedInnerBlock:a,hasDraggedInnerBlock:o}=e(nt.store),r=n(t,"core/navigation-submenu",!0),l=n(t,"core/navigation",!0);return{isNested:r.length>0,isChildOfNavigation:l.length>0,hasSelectedChild:a(t,!0),hasDraggedChild:o(t,!0),parentClientId:l[0]}}),[t]),f=Ub({clientId:t,pages:s,parentClientId:_,parentPageID:o}),k=(0,nt.useInnerBlocksProps)(p,{renderAppender:!1,__unstableDisableDropZone:!0,templateLock:!v&&"all",onInput:Wb,onChange:Wb,value:g}),{selectBlock:x}=(0,gt.useDispatch)(nt.store);return(0,_t.useEffect)((()=>{(b||y)&&(i(),x(_))}),[b,y,_,x,i]),(0,_t.useEffect)((()=>{a({isNested:h})}),[h,a]),(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,d.length>0&&(0,Ke.createElement)(et.PanelBody,null,(0,Ke.createElement)(et.ComboboxControl,{__next40pxDefaultSize:!0,className:"editor-page-attributes__parent",label:(0,tt.__)("Parent"),value:o,options:d,onChange:e=>a({parentPageID:null!=e?e:0}),help:(0,tt.__)("Choose a page to show only its subpages.")})),m&&(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Edit this menu")},(0,Ke.createElement)("p",null,qb),(0,Ke.createElement)(et.Button,{variant:"primary",disabled:!c,onClick:f},(0,tt.__)("Edit")))),m&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"other"},(0,Ke.createElement)(et.ToolbarButton,{title:(0,tt.__)("Edit"),onClick:i},(0,tt.__)("Edit"))),r&&(0,Ke.createElement)(jb,{onClick:f,onClose:()=>l(!1),disabled:!c})),(0,Ke.createElement)(Zb,{blockProps:p,innerBlocksProps:k,hasResolvedPages:c,blockList:g,pages:s,parentPageID:o}))}},Jb=()=>Xe({name:Kb,metadata:Qb,settings:Yb}),Xb=()=>(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},(0,Ke.createElement)(et.Path,{d:"M1.50002 4L6.00002 8L10.5 4",strokeWidth:"1.5"}));const e_={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/page-list-item",title:"Page List Item",category:"widgets",parent:["core/page-list"],description:"Displays a page inside a list of all pages.",keywords:["page","menu","navigation"],textdomain:"default",attributes:{id:{type:"number"},label:{type:"string"},title:{type:"string"},link:{type:"string"},hasChildren:{type:"boolean"}},usesContext:["textColor","customTextColor","backgroundColor","customBackgroundColor","overlayTextColor","customOverlayTextColor","overlayBackgroundColor","customOverlayBackgroundColor","fontSize","customFontSize","showSubmenuIcon","style","openSubmenusOnClick"],supports:{reusable:!1,html:!1,lock:!1,inserter:!1,__experimentalToolbar:!1,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-page-list-editor",style:"wp-block-page-list"},{name:t_}=e_,n_={__experimentalLabel:({label:e})=>e,icon:ob,example:{},edit:function({context:e,attributes:t}){const{id:n,label:a,link:o,hasChildren:r,title:l}=t,i="showSubmenuIcon"in e,s=(0,gt.useSelect)((e=>{if(!e(dt.store).canUser("read","settings"))return;const t=e(dt.store).getEntityRecord("root","site");return"page"===t?.show_on_front&&t?.page_on_front}),[]),c=bh(hh(e,!0)),m=(0,nt.useBlockProps)(c,{className:"wp-block-pages-list__item"}),u=(0,nt.useInnerBlocksProps)(m);return(0,Ke.createElement)("li",{key:n,className:ut()("wp-block-pages-list__item",{"has-child":r,"wp-block-navigation-item":i,"open-on-click":e.openSubmenusOnClick,"open-on-hover-click":!e.openSubmenusOnClick&&e.showSubmenuIcon,"menu-item-home":n===s})},r&&e.openSubmenusOnClick?(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("button",{type:"button",className:"wp-block-navigation-item__content wp-block-navigation-submenu__toggle","aria-expanded":"false"},(0,Jn.decodeEntities)(a)),(0,Ke.createElement)("span",{className:"wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"},(0,Ke.createElement)(Xb,null))):(0,Ke.createElement)("a",{className:ut()("wp-block-pages-list__item__link",{"wp-block-navigation-item__content":i}),href:o},(0,Jn.decodeEntities)(l)),r&&(0,Ke.createElement)(Ke.Fragment,null,!e.openSubmenusOnClick&&e.showSubmenuIcon&&(0,Ke.createElement)("button",{className:"wp-block-navigation-item__content wp-block-navigation-submenu__toggle wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon","aria-expanded":"false",type:"button"},(0,Ke.createElement)(Xb,null)),(0,Ke.createElement)("ul",{...u})))}},a_=()=>Xe({name:t_,metadata:e_,settings:n_}),o_=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z"})),r_={className:!1},l_={align:{type:"string"},content:{type:"string",source:"html",selector:"p",default:""},dropCap:{type:"boolean",default:!1},placeholder:{type:"string"},textColor:{type:"string"},backgroundColor:{type:"string"},fontSize:{type:"string"},direction:{type:"string",enum:["ltr","rtl"]},style:{type:"object"}},i_=e=>{if(!e.customTextColor&&!e.customBackgroundColor&&!e.customFontSize)return e;const t={};(e.customTextColor||e.customBackgroundColor)&&(t.color={}),e.customTextColor&&(t.color.text=e.customTextColor),e.customBackgroundColor&&(t.color.background=e.customBackgroundColor),e.customFontSize&&(t.typography={fontSize:e.customFontSize});const{customTextColor:n,customBackgroundColor:a,customFontSize:o,...r}=e;return{...r,style:t}},{style:s_,...c_}=l_,m_=[{supports:r_,attributes:{...c_,customTextColor:{type:"string"},customBackgroundColor:{type:"string"},customFontSize:{type:"number"}},save({attributes:e}){const{align:t,content:n,dropCap:a,direction:o}=e,r=ut()({"has-drop-cap":t!==((0,tt.isRTL)()?"left":"right")&&"center"!==t&&a,[`has-text-align-${t}`]:t});return(0,Ke.createElement)("p",{...nt.useBlockProps.save({className:r,dir:o})},(0,Ke.createElement)(nt.RichText.Content,{value:n}))}},{supports:r_,attributes:{...c_,customTextColor:{type:"string"},customBackgroundColor:{type:"string"},customFontSize:{type:"number"}},migrate:i_,save({attributes:e}){const{align:t,content:n,dropCap:a,backgroundColor:o,textColor:r,customBackgroundColor:l,customTextColor:i,fontSize:s,customFontSize:c,direction:m}=e,u=(0,nt.getColorClassName)("color",r),p=(0,nt.getColorClassName)("background-color",o),d=(0,nt.getFontSizeClass)(s),g=ut()({"has-text-color":r||i,"has-background":o||l,"has-drop-cap":a,[`has-text-align-${t}`]:t,[d]:d,[u]:u,[p]:p}),h={backgroundColor:p?void 0:l,color:u?void 0:i,fontSize:d?void 0:c};return(0,Ke.createElement)(nt.RichText.Content,{tagName:"p",style:h,className:g||void 0,value:n,dir:m})}},{supports:r_,attributes:{...c_,customTextColor:{type:"string"},customBackgroundColor:{type:"string"},customFontSize:{type:"number"}},migrate:i_,save({attributes:e}){const{align:t,content:n,dropCap:a,backgroundColor:o,textColor:r,customBackgroundColor:l,customTextColor:i,fontSize:s,customFontSize:c,direction:m}=e,u=(0,nt.getColorClassName)("color",r),p=(0,nt.getColorClassName)("background-color",o),d=(0,nt.getFontSizeClass)(s),g=ut()({"has-text-color":r||i,"has-background":o||l,"has-drop-cap":a,[d]:d,[u]:u,[p]:p}),h={backgroundColor:p?void 0:l,color:u?void 0:i,fontSize:d?void 0:c,textAlign:t};return(0,Ke.createElement)(nt.RichText.Content,{tagName:"p",style:h,className:g||void 0,value:n,dir:m})}},{supports:r_,attributes:{...c_,customTextColor:{type:"string"},customBackgroundColor:{type:"string"},customFontSize:{type:"number"},width:{type:"string"}},migrate:i_,save({attributes:e}){const{width:t,align:n,content:a,dropCap:o,backgroundColor:r,textColor:l,customBackgroundColor:i,customTextColor:s,fontSize:c,customFontSize:m}=e,u=(0,nt.getColorClassName)("color",l),p=(0,nt.getColorClassName)("background-color",r),d=c&&`is-${c}-text`,g=ut()({[`align${t}`]:t,"has-background":r||i,"has-drop-cap":o,[d]:d,[u]:u,[p]:p}),h={backgroundColor:p?void 0:i,color:u?void 0:s,fontSize:d?void 0:m,textAlign:n};return(0,Ke.createElement)(nt.RichText.Content,{tagName:"p",style:h,className:g||void 0,value:a})}},{supports:r_,attributes:{...c_,fontSize:{type:"number"}},save({attributes:e}){const{width:t,align:n,content:a,dropCap:o,backgroundColor:r,textColor:l,fontSize:i}=e,s=ut()({[`align${t}`]:t,"has-background":r,"has-drop-cap":o}),c={backgroundColor:r,color:l,fontSize:i,textAlign:n};return(0,Ke.createElement)("p",{style:c,className:s||void 0},a)},migrate:e=>i_({...e,customFontSize:Number.isFinite(e.fontSize)?e.fontSize:void 0,customTextColor:e.textColor&&"#"===e.textColor[0]?e.textColor:void 0,customBackgroundColor:e.backgroundColor&&"#"===e.backgroundColor[0]?e.backgroundColor:void 0})},{supports:r_,attributes:{...l_,content:{type:"string",source:"html",default:""}},save:({attributes:e})=>(0,Ke.createElement)(_t.RawHTML,null,e.content),migrate:e=>e}],u_=m_,p_=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M5.52 2h7.43c.55 0 1 .45 1 1s-.45 1-1 1h-1v13c0 .55-.45 1-1 1s-1-.45-1-1V5c0-.55-.45-1-1-1s-1 .45-1 1v12c0 .55-.45 1-1 1s-1-.45-1-1v-5.96h-.43C3.02 11.04 1 9.02 1 6.52S3.02 2 5.52 2zM14 14l5-4-5-4v8z"}));function d_(e){const{batch:t}=(0,gt.useRegistry)(),{moveBlocksToPosition:n,replaceInnerBlocks:a,duplicateBlocks:o,insertBlock:r}=(0,gt.useDispatch)(nt.store),{getBlockRootClientId:l,getBlockIndex:i,getBlockOrder:s,getBlockName:c,getBlock:m,getNextBlockClientId:u,canInsertBlockType:p}=(0,gt.useSelect)(nt.store),d=(0,_t.useRef)(e);return d.current=e,(0,jt.useRefEffect)((e=>{function g(e){if(e.defaultPrevented)return;if(e.keyCode!==fn.ENTER)return;const{content:g,clientId:h}=d.current;if(g.length)return;const b=l(h);if(!(0,Qe.hasBlockSupport)(c(b),"__experimentalOnEnter",!1))return;const _=s(b),y=_.indexOf(h);if(y===_.length-1){let t=b;for(;!p(c(h),l(t));)t=l(t);return void("string"==typeof t&&(e.preventDefault(),n([h],b,l(t),i(t)+1)))}const v=(0,Qe.getDefaultBlockName)();if(!p(v,l(b)))return;e.preventDefault();const f=m(b);t((()=>{o([b]);const e=i(b);a(b,f.innerBlocks.slice(0,y)),a(u(b),f.innerBlocks.slice(y+1)),r((0,Qe.createBlock)(v),e+1,l(b),!0)}))}return e.addEventListener("keydown",g),()=>{e.removeEventListener("keydown",g)}}),[])}function g_({direction:e,setDirection:t}){return(0,tt.isRTL)()&&(0,Ke.createElement)(et.ToolbarButton,{icon:p_,title:(0,tt._x)("Left to right","editor button"),isActive:"ltr"===e,onClick:()=>{t("ltr"===e?void 0:"ltr")}})}function h_(e){return e===((0,tt.isRTL)()?"left":"right")||"center"===e}function b_({clientId:e,attributes:t,setAttributes:n}){const[a]=(0,nt.useSettings)("typography.dropCap");if(!a)return null;const{align:o,dropCap:r}=t;let l;return l=h_(o)?(0,tt.__)("Not available for aligned text."):r?(0,tt.__)("Showing large initial letter."):(0,tt.__)("Toggle to show a large initial letter."),(0,Ke.createElement)(et.__experimentalToolsPanelItem,{hasValue:()=>!!r,label:(0,tt.__)("Drop cap"),onDeselect:()=>n({dropCap:void 0}),resetAllFilter:()=>({dropCap:void 0}),panelId:e},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Drop cap"),checked:!!r,onChange:()=>n({dropCap:!r}),help:l,disabled:!!h_(o)}))}const __=function({attributes:e,mergeBlocks:t,onReplace:n,onRemove:a,setAttributes:o,clientId:r}){const{align:l,content:i,direction:s,dropCap:c,placeholder:m}=e,u=(0,nt.useBlockProps)({ref:d_({clientId:r,content:i}),className:ut()({"has-drop-cap":!h_(l)&&c,[`has-text-align-${l}`]:l}),style:{direction:s}}),p=(0,nt.useBlockEditingMode)();return(0,Ke.createElement)(Ke.Fragment,null,"default"===p&&(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:l,onChange:e=>o({align:e,dropCap:!h_(e)&&c})}),(0,Ke.createElement)(g_,{direction:s,setDirection:e=>o({direction:e})})),(0,Ke.createElement)(nt.InspectorControls,{group:"typography"},(0,Ke.createElement)(b_,{clientId:r,attributes:e,setAttributes:o})),(0,Ke.createElement)(nt.RichText,{identifier:"content",tagName:"p",...u,value:i,onChange:e=>o({content:e}),onSplit:(t,n)=>{let a;(n||t)&&(a={...e,content:t});const o=(0,Qe.createBlock)("core/paragraph",a);return n&&(o.clientId=r),o},onMerge:t,onReplace:n,onRemove:a,"aria-label":nt.RichText.isEmpty(i)?(0,tt.__)("Empty block; start writing or type forward slash to choose a block"):(0,tt.__)("Block: Paragraph"),"data-empty":nt.RichText.isEmpty(i),placeholder:m||(0,tt.__)("Type / to choose a block"),"data-custom-placeholder":!!m||void 0,__unstableEmbedURLOnPaste:!0,__unstableAllowPrefixTransformations:!0}))};const{name:y_}={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/paragraph",title:"Paragraph",category:"text",description:"Start with the basic building block of all narrative.",keywords:["text"],textdomain:"default",usesContext:["postId"],attributes:{align:{type:"string"},content:{type:"rich-text",source:"rich-text",selector:"p",__experimentalRole:"content"},dropCap:{type:"boolean",default:!1},placeholder:{type:"string"},direction:{type:"string",enum:["ltr","rtl"]}},supports:{anchor:!0,className:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalTextDecoration:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalWritingMode:!0,__experimentalDefaultControls:{fontSize:!0}},__experimentalSelector:"p",__unstablePasteTextInline:!0,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-paragraph-editor",style:"wp-block-paragraph"},v_={from:[{type:"raw",priority:20,selector:"p",schema:({phrasingContentSchema:e,isPaste:t})=>({p:{children:e,attributes:t?[]:["style","id"]}}),transform(e){const t=(0,Qe.getBlockAttributes)(y_,e.outerHTML),{textAlign:n}=e.style||{};return"left"!==n&&"center"!==n&&"right"!==n||(t.align=n),(0,Qe.createBlock)(y_,t)}}]},f_=v_,k_={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/paragraph",title:"Paragraph",category:"text",description:"Start with the basic building block of all narrative.",keywords:["text"],textdomain:"default",usesContext:["postId"],attributes:{align:{type:"string"},content:{type:"rich-text",source:"rich-text",selector:"p",__experimentalRole:"content"},dropCap:{type:"boolean",default:!1},placeholder:{type:"string"},direction:{type:"string",enum:["ltr","rtl"]}},supports:{anchor:!0,className:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalTextDecoration:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalWritingMode:!0,__experimentalDefaultControls:{fontSize:!0}},__experimentalSelector:"p",__unstablePasteTextInline:!0,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-paragraph-editor",style:"wp-block-paragraph"},{name:x_}=k_,w_={icon:o_,example:{attributes:{content:(0,tt.__)("In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.")}},__experimentalLabel(e,{context:t}){const n=e?.metadata?.name;if("list-view"===t&&n)return n;if("accessibility"===t){if(n)return n;const{content:t}=e;return t&&0!==t.length?t:(0,tt.__)("Empty")}},transforms:f_,deprecated:u_,merge:(e,t)=>({content:(e.content||"")+(t.content||"")}),edit:__,save:function({attributes:e}){const{align:t,content:n,dropCap:a,direction:o}=e,r=ut()({"has-drop-cap":t!==((0,tt.isRTL)()?"left":"right")&&"center"!==t&&a,[`has-text-align-${t}`]:t});return(0,Ke.createElement)("p",{...nt.useBlockProps.save({className:r,dir:o})},(0,Ke.createElement)(nt.RichText.Content,{value:n}))}},E_=()=>Xe({name:x_,metadata:k_,settings:w_}),C_=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M10 4.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm2.25 7.5v-1A2.75 2.75 0 0011 8.25H7A2.75 2.75 0 004.25 11v1h1.5v-1c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v1h1.5zM4 20h9v-1.5H4V20zm16-4H4v-1.5h16V16z",fillRule:"evenodd",clipRule:"evenodd"})),S_={who:"authors",per_page:100};const B_=function({isSelected:e,context:{postType:t,postId:n,queryId:a},attributes:o,setAttributes:r}){const l=Number.isFinite(a),{authorId:i,authorDetails:s,authors:c}=(0,gt.useSelect)((e=>{const{getEditedEntityRecord:a,getUser:o,getUsers:r}=e(dt.store),l=a("postType",t,n)?.author;return{authorId:l,authorDetails:l?o(l):null,authors:r(S_)}}),[t,n]),{editEntityRecord:m}=(0,gt.useDispatch)(dt.store),{textAlign:u,showAvatar:p,showBio:d,byline:g,isLink:h,linkTarget:b}=o,_=[],y=s?.name||(0,tt.__)("Post Author");s?.avatar_urls&&Object.keys(s.avatar_urls).forEach((e=>{_.push({value:e,label:`${e} x ${e}`})}));const v=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${u}`]:u})}),f=c?.length?c.map((({id:e,name:t})=>({value:e,label:t}))):[],k=e=>{m("postType",t,n,{author:e})},x=f.length>=25,w=!!n&&!l&&f.length>0;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},w&&(x&&(0,Ke.createElement)(et.ComboboxControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Author"),options:f,value:i,onChange:k,allowReset:!1})||(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Author"),value:i,options:f,onChange:k})),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show avatar"),checked:p,onChange:()=>r({showAvatar:!p})}),p&&(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Avatar size"),value:o.avatarSize,options:_,onChange:e=>{r({avatarSize:Number(e)})}}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show bio"),checked:d,onChange:()=>r({showBio:!d})}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link author name to author page"),checked:h,onChange:()=>r({isLink:!h})}),h&&(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Open in new tab"),onChange:e=>r({linkTarget:e?"_blank":"_self"}),checked:"_blank"===b}))),(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:u,onChange:e=>{r({textAlign:e})}})),(0,Ke.createElement)("div",{...v},p&&s?.avatar_urls&&(0,Ke.createElement)("div",{className:"wp-block-post-author__avatar"},(0,Ke.createElement)("img",{width:o.avatarSize,src:s.avatar_urls[o.avatarSize],alt:s.name})),(0,Ke.createElement)("div",{className:"wp-block-post-author__content"},(!nt.RichText.isEmpty(g)||e)&&(0,Ke.createElement)(nt.RichText,{className:"wp-block-post-author__byline","aria-label":(0,tt.__)("Post author byline text"),placeholder:(0,tt.__)("Write byline…"),value:g,onChange:e=>r({byline:e})}),(0,Ke.createElement)("p",{className:"wp-block-post-author__name"},h?(0,Ke.createElement)("a",{href:"#post-author-pseudo-link",onClick:e=>e.preventDefault()},y):y),d&&(0,Ke.createElement)("p",{className:"wp-block-post-author__bio",dangerouslySetInnerHTML:{__html:s?.description}}))))},N_={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/post-author",title:"Author",category:"theme",description:"Display post author details such as name, avatar, and bio.",textdomain:"default",attributes:{textAlign:{type:"string"},avatarSize:{type:"number",default:48},showAvatar:{type:"boolean",default:!0},showBio:{type:"boolean"},byline:{type:"string"},isLink:{type:"boolean",default:!1},linkTarget:{type:"string",default:"_self"}},usesContext:["postType","postId","queryId"],supports:{html:!1,spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},color:{gradients:!0,link:!0,__experimentalDuotone:".wp-block-post-author__avatar img",__experimentalDefaultControls:{background:!0,text:!0}},interactivity:{clientNavigation:!0}},style:"wp-block-post-author"},{name:T_}=N_,I_={icon:C_,edit:B_},P_=()=>Xe({name:T_,metadata:N_,settings:I_});const M_=function({context:{postType:e,postId:t},attributes:{textAlign:n,isLink:a,linkTarget:o},setAttributes:r}){const{authorName:l}=(0,gt.useSelect)((n=>{const{getEditedEntityRecord:a,getUser:o}=n(dt.store),r=a("postType",e,t)?.author;return{authorName:r?o(r):null}}),[e,t]),i=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${n}`]:n})}),s=l?.name||(0,tt.__)("Author Name"),c=a?(0,Ke.createElement)("a",{href:"#author-pseudo-link",onClick:e=>e.preventDefault(),className:"wp-block-post-author-name__link"},s):s;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:n,onChange:e=>{r({textAlign:e})}})),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link to author archive"),onChange:()=>r({isLink:!a}),checked:a}),a&&(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Open in new tab"),onChange:e=>r({linkTarget:e?"_blank":"_self"}),checked:"_blank"===o}))),(0,Ke.createElement)("div",{...i}," ",c," "))},z_={from:[{type:"block",blocks:["core/post-author"],transform:({textAlign:e})=>(0,Qe.createBlock)("core/post-author-name",{textAlign:e})}],to:[{type:"block",blocks:["core/post-author"],transform:({textAlign:e})=>(0,Qe.createBlock)("core/post-author",{textAlign:e})}]},R_={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/post-author-name",title:"Author Name",category:"theme",description:"The author name.",textdomain:"default",attributes:{textAlign:{type:"string"},isLink:{type:"boolean",default:!1},linkTarget:{type:"string",default:"_self"}},usesContext:["postType","postId"],supports:{html:!1,spacing:{margin:!0,padding:!0},color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:A_}=R_,H_={icon:C_,transforms:z_,edit:M_},L_=()=>Xe({name:A_,metadata:R_,settings:H_});const D_=function({context:{postType:e,postId:t},attributes:{textAlign:n},setAttributes:a}){const{authorDetails:o}=(0,gt.useSelect)((n=>{const{getEditedEntityRecord:a,getUser:o}=n(dt.store),r=a("postType",e,t)?.author;return{authorDetails:r?o(r):null}}),[e,t]),r=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${n}`]:n})}),l=o?.description||(0,tt.__)("Author Biography");return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:n,onChange:e=>{a({textAlign:e})}})),(0,Ke.createElement)("div",{...r,dangerouslySetInnerHTML:{__html:l}}))},F_={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/post-author-biography",title:"Author Biography",category:"theme",description:"The author biography.",textdomain:"default",attributes:{textAlign:{type:"string"}},usesContext:["postType","postId"],supports:{spacing:{margin:!0,padding:!0},color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:V_}=F_,$_={icon:C_,edit:D_},O_=()=>Xe({name:V_,metadata:F_,settings:$_}),G_=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.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"})),U_=[["core/avatar"],["core/comment-author-name"],["core/comment-date"],["core/comment-content"],["core/comment-reply-link"],["core/comment-edit-link"]];const q_={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,__experimental:"fse",name:"core/post-comment",title:"Comment (deprecated)",category:"theme",allowedBlocks:["core/avatar","core/comment-author-name","core/comment-content","core/comment-date","core/comment-edit-link","core/comment-reply-link"],description:"This block is deprecated. Please use the Comments block instead.",textdomain:"default",attributes:{commentId:{type:"number"}},providesContext:{commentId:"commentId"},supports:{html:!1,inserter:!1,interactivity:{clientNavigation:!0}}},{name:j_}=q_,W_={icon:kp,edit:function({attributes:{commentId:e},setAttributes:t}){const[n,a]=(0,_t.useState)(e),o=(0,nt.useBlockProps)(),r=(0,nt.useInnerBlocksProps)(o,{template:U_});return e?(0,Ke.createElement)("div",{...r}):(0,Ke.createElement)("div",{...o},(0,Ke.createElement)(et.Placeholder,{icon:G_,label:(0,tt._x)("Post Comment","block title"),instructions:(0,tt.__)("To show a comment, input the comment ID.")},(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,value:e,onChange:e=>a(parseInt(e))}),(0,Ke.createElement)(et.Button,{variant:"primary",onClick:()=>{t({commentId:n})}},(0,tt.__)("Save"))))},save:function(){const e=nt.useBlockProps.save(),t=nt.useInnerBlocksProps.save(e);return(0,Ke.createElement)("div",{...t})}},Z_=()=>Xe({name:j_,metadata:q_,settings:W_}),Q_=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M13 8H4v1.5h9V8zM4 4v1.5h16V4H4zm9 8H5c-.6 0-1 .4-1 1v8.3c0 .3.2.7.6.8.1.1.2.1.3.1.2 0 .5-.1.6-.3l1.8-1.8H13c.6 0 1-.4 1-1V13c0-.6-.4-1-1-1zm-2.2 6.6H7l1.6-2.2c.3-.4.5-.7.6-.9.1-.2.2-.4.2-.5 0-.2-.1-.3-.1-.4-.1-.1-.2-.1-.4-.1s-.4 0-.6.1c-.3.1-.5.3-.7.4l-.2.2-.2-1.2.1-.1c.3-.2.5-.3.8-.4.3-.1.6-.1.9-.1.3 0 .6.1.9.2.2.1.4.3.6.5.1.2.2.5.2.7 0 .3-.1.6-.2.9-.1.3-.4.7-.7 1.1l-.5.6h1.6v1.2z"}));const K_={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,__experimental:"fse",name:"core/post-comments-count",title:"Comments Count",category:"theme",description:"Display a post's comments count.",textdomain:"default",attributes:{textAlign:{type:"string"}},usesContext:["postId"],supports:{html:!1,color:{gradients:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:Y_}=K_,J_={icon:Q_,edit:function({attributes:e,context:t,setAttributes:n}){const{textAlign:a}=e,{postId:o}=t,[r,l]=(0,_t.useState)(),i=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${a}`]:a})});(0,_t.useEffect)((()=>{if(!o)return;const e=o;jo()({path:(0,pt.addQueryArgs)("/wp/v2/comments",{post:o}),parse:!1}).then((t=>{e===o&&l(t.headers.get("X-WP-Total"))}))}),[o]);const s=o&&void 0!==r,c={...i.style,textDecoration:s?i.style?.textDecoration:void 0};return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:a,onChange:e=>{n({textAlign:e})}})),(0,Ke.createElement)("div",{...i,style:c},s?r:(0,Ke.createElement)(nt.Warning,null,(0,tt.__)("Post Comments Count block: post not found."))))}},X_=()=>Xe({name:Y_,metadata:K_,settings:J_}),ey=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M13 8H4v1.5h9V8zM4 4v1.5h16V4H4zm9 8H5c-.6 0-1 .4-1 1v8.3c0 .3.2.7.6.8.1.1.2.1.3.1.2 0 .5-.1.6-.3l1.8-1.8H13c.6 0 1-.4 1-1V13c0-.6-.4-1-1-1zm-.5 6.6H6.7l-1.2 1.2v-6.3h7v5.1z"}));const ty={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/post-comments-form",title:"Comments Form",category:"theme",description:"Display a post's comments form.",textdomain:"default",attributes:{textAlign:{type:"string"}},usesContext:["postId","postType"],supports:{html:!1,color:{gradients:!0,heading:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalDefaultControls:{fontSize:!0}}},editorStyle:"wp-block-post-comments-form-editor",style:["wp-block-post-comments-form","wp-block-buttons","wp-block-button"]},{name:ny}=ty,ay={icon:ey,edit:function e({attributes:t,context:n,setAttributes:a}){const{textAlign:o}=t,{postId:r,postType:l}=n,i=(0,jt.useInstanceId)(e),s=(0,tt.sprintf)("comments-form-edit-%d-desc",i),c=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${o}`]:o}),"aria-describedby":s});return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:o,onChange:e=>{a({textAlign:e})}})),(0,Ke.createElement)("div",{...c},(0,Ke.createElement)(eo,{postId:r,postType:l}),(0,Ke.createElement)(et.VisuallyHidden,{id:s},(0,tt.__)("Comments form disabled in editor."))))}},oy=()=>Xe({name:ny,metadata:ty,settings:ay});const ry=function({context:e,attributes:t,setAttributes:n}){const{textAlign:a}=t,{postType:o,postId:r}=e,[l,i]=(0,_t.useState)(),s=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${a}`]:a})});(0,_t.useEffect)((()=>{if(!r)return;const e=r;jo()({path:(0,pt.addQueryArgs)("/wp/v2/comments",{post:r}),parse:!1}).then((t=>{e===r&&i(t.headers.get("X-WP-Total"))}))}),[r]);const c=(0,gt.useSelect)((e=>e(dt.store).getEditedEntityRecord("postType",o,r)),[o,r]);if(!c)return null;const{link:m}=c;let u;if(void 0!==l){const e=parseInt(l);u=0===e?(0,tt.__)("No comments"):(0,tt.sprintf)((0,tt._n)("%s comment","%s comments",e),e.toLocaleString())}return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:a,onChange:e=>{n({textAlign:e})}})),(0,Ke.createElement)("div",{...s},m&&void 0!==u?(0,Ke.createElement)("a",{href:m+"#comments",onClick:e=>e.preventDefault()},u):(0,Ke.createElement)(nt.Warning,null,(0,tt.__)("Post Comments Link block: post not found."))))},ly={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,__experimental:"fse",name:"core/post-comments-link",title:"Comments Link",category:"theme",description:"Displays the link to the current post comments.",textdomain:"default",usesContext:["postType","postId"],attributes:{textAlign:{type:"string"}},supports:{html:!1,color:{link:!0,text:!1,__experimentalDefaultControls:{background:!0,link:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:iy}=ly,sy={edit:ry,icon:Q_},cy=()=>Xe({name:iy,metadata:ly,settings:sy}),my=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M4 6h12V4.5H4V6Zm16 4.5H4V9h16v1.5ZM4 15h16v-1.5H4V15Zm0 4.5h16V18H4v1.5Z"}));function uy(e,t,n){return(0,gt.useSelect)((a=>a(dt.store).canUserEditEntityRecord(e,t,n)),[e,t,n])}function py({layoutClassNames:e,userCanEdit:t,postType:n,postId:a}){const[,,o]=(0,dt.useEntityProp)("postType",n,"content",a),r=(0,nt.useBlockProps)({className:e});return o?.protected&&!t?(0,Ke.createElement)("div",{...r},(0,Ke.createElement)(nt.Warning,null,(0,tt.__)("This content is password protected."))):(0,Ke.createElement)("div",{...r,dangerouslySetInnerHTML:{__html:o?.rendered}})}function dy({context:e={}}){const{postType:t,postId:n}=e,[a,o,r]=(0,dt.useEntityBlockEditor)("postType",t,{id:n}),l=(0,gt.useSelect)((e=>e(dt.store).getEntityRecord("postType",t,n)),[t,n]),i=!!l?.content?.raw||a?.length,s=(0,nt.useInnerBlocksProps)((0,nt.useBlockProps)({className:"entry-content"}),{value:a,onInput:o,onChange:r,template:i?void 0:[["core/paragraph"]]});return(0,Ke.createElement)("div",{...s})}function gy(e){const{context:{queryId:t,postType:n,postId:a}={},layoutClassNames:o}=e,r=uy("postType",n,a);if(void 0===r)return null;const l=Number.isFinite(t);return r&&!l?(0,Ke.createElement)(dy,{...e}):(0,Ke.createElement)(py,{layoutClassNames:o,userCanEdit:r,postType:n,postId:a})}function hy({layoutClassNames:e}){const t=(0,nt.useBlockProps)({className:e});return(0,Ke.createElement)("div",{...t},(0,Ke.createElement)("p",null,(0,tt.__)("This is the Content block, it will display all the blocks in any single post or page.")),(0,Ke.createElement)("p",null,(0,tt.__)("That might be a simple arrangement like consecutive paragraphs in a blog post, or a more elaborate composition that includes image galleries, videos, tables, columns, and any other block types.")),(0,Ke.createElement)("p",null,(0,tt.__)("If there are any Custom Post Types registered at your site, the Content block can display the contents of those entries as well.")))}function by(){const e=(0,nt.useBlockProps)();return(0,Ke.createElement)("div",{...e},(0,Ke.createElement)(nt.Warning,null,(0,tt.__)("Block cannot be rendered inside itself.")))}const _y={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/post-content",title:"Content",category:"theme",description:"Displays the contents of a post or page.",textdomain:"default",usesContext:["postId","postType","queryId"],supports:{align:["wide","full"],html:!1,layout:!0,dimensions:{minHeight:!0},spacing:{blockGap:!0},color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!1,text:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}}},editorStyle:"wp-block-post-content-editor"},{name:yy}=_y,vy={icon:my,edit:function({context:e,__unstableLayoutClassNames:t}){const{postId:n,postType:a}=e,o=(0,nt.useHasRecursion)(n);return n&&a&&o?(0,Ke.createElement)(by,null):(0,Ke.createElement)(nt.RecursionProvider,{uniqueId:n},n&&a?(0,Ke.createElement)(gy,{context:e,layoutClassNames:t}):(0,Ke.createElement)(hy,{layoutClassNames:t}))}},fy=()=>Xe({name:yy,metadata:_y,settings:vy});function ky(e){return/(?:^|[^\\])[aAgh]/.test(e)}const xy={attributes:{textAlign:{type:"string"},format:{type:"string"},isLink:{type:"boolean",default:!1}},supports:{html:!1,color:{gradients:!0,link:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalLetterSpacing:!0}},save:()=>null,migrate:ln,isEligible:({style:e})=>e?.typography?.fontFamily},wy=[xy],Ey=[{name:"post-date-modified",title:(0,tt.__)("Modified Date"),description:(0,tt.__)("Display a post's last updated date."),attributes:{displayType:"modified"},scope:["block","inserter"],isActive:e=>"modified"===e.displayType,icon:Co}],Cy=Ey,Sy={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/post-date",title:"Date",category:"theme",description:"Display the publish date for an entry such as a post or page.",textdomain:"default",attributes:{textAlign:{type:"string"},format:{type:"string"},isLink:{type:"boolean",default:!1},displayType:{type:"string",default:"date"}},usesContext:["postId","postType","queryId"],supports:{html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:By}=Sy,Ny={icon:Co,edit:function({attributes:{textAlign:e,format:t,isLink:n,displayType:a},context:{postId:o,postType:r,queryId:l},setAttributes:i}){const s=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${e}`]:e,"wp-block-post-date__modified-date":"modified"===a})}),[c,m]=(0,_t.useState)(null),u=(0,_t.useMemo)((()=>({anchor:c})),[c]),p=Number.isFinite(l),d=(0,So.getSettings)(),[g=d.formats.date]=(0,dt.useEntityProp)("root","site","date_format"),[h=d.formats.time]=(0,dt.useEntityProp)("root","site","time_format"),[b,_]=(0,dt.useEntityProp)("postType",r,a,o),y=(0,gt.useSelect)((e=>r?e(dt.store).getPostType(r):null),[r]),v="date"===a?(0,tt.__)("Post Date"):(0,tt.__)("Post Modified Date");let f=b?(0,Ke.createElement)("time",{dateTime:(0,So.dateI18n)("c",b),ref:m},(0,So.dateI18n)(t||g,b)):v;return n&&b&&(f=(0,Ke.createElement)("a",{href:"#post-date-pseudo-link",onClick:e=>e.preventDefault()},f)),(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:e,onChange:e=>{i({textAlign:e})}}),b&&"date"===a&&!p&&(0,Ke.createElement)(et.ToolbarGroup,null,(0,Ke.createElement)(et.Dropdown,{popoverProps:u,renderContent:({onClose:e})=>(0,Ke.createElement)(nt.__experimentalPublishDateTimePicker,{currentDate:b,onChange:_,is12Hour:ky(h),onClose:e}),renderToggle:({isOpen:e,onToggle:t})=>(0,Ke.createElement)(et.ToolbarButton,{"aria-expanded":e,icon:Di,title:(0,tt.__)("Change Date"),onClick:t,onKeyDown:n=>{e||n.keyCode!==fn.DOWN||(n.preventDefault(),t())}})}))),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(nt.__experimentalDateFormatPicker,{format:t,defaultFormat:g,onChange:e=>i({format:e})}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:y?.labels.singular_name?(0,tt.sprintf)((0,tt.__)("Link to %s"),y.labels.singular_name.toLowerCase()):(0,tt.__)("Link to post"),onChange:()=>i({isLink:!n}),checked:n}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display last modified date"),onChange:e=>i({displayType:e?"modified":"date"}),checked:"modified"===a,help:(0,tt.__)("Only shows if the post has been modified")}))),(0,Ke.createElement)("div",{...s},f))},deprecated:wy,variations:Cy},Ty=()=>Xe({name:By,metadata:Sy,settings:Ny}),Iy=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M8.001 3.984V9.47c0 1.518-.98 2.5-2.499 2.5h-.5v-1.5h.5c.69 0 1-.31 1-1V6.984H4v-3h4.001ZM4 20h9v-1.5H4V20Zm16-4H4v-1.5h16V16ZM13.001 3.984V9.47c0 1.518-.98 2.5-2.499 2.5h-.5v-1.5h.5c.69 0 1-.31 1-1V6.984H9v-3h4.001Z"}));const Py={from:[{type:"block",blocks:["core/post-content"],transform:()=>(0,Qe.createBlock)("core/post-excerpt")}],to:[{type:"block",blocks:["core/post-content"],transform:()=>(0,Qe.createBlock)("core/post-content")}]},My={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/post-excerpt",title:"Excerpt",category:"theme",description:"Display the excerpt.",textdomain:"default",attributes:{textAlign:{type:"string"},moreText:{type:"string"},showMoreOnNewLine:{type:"boolean",default:!0},excerptLength:{type:"number",default:55}},usesContext:["postId","postType","queryId"],supports:{html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-post-excerpt-editor",style:"wp-block-post-excerpt"},{name:zy}=My,Ry={icon:Iy,transforms:Py,edit:function({attributes:{textAlign:e,moreText:t,showMoreOnNewLine:n,excerptLength:a},setAttributes:o,isSelected:r,context:{postId:l,postType:i,queryId:s}}){const c=Number.isFinite(s),m=uy("postType",i,l),[u,p,{rendered:d,protected:g}={}]=(0,dt.useEntityProp)("postType",i,"excerpt",l),h=(0,gt.useSelect)((e=>"page"===i||!!e(dt.store).getPostType(i)?.supports?.excerpt),[i]),b=m&&!c&&h,_=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${e}`]:e})}),y=(0,tt._x)("words","Word count type. Do not translate!"),v=(0,_t.useMemo)((()=>{if(!d)return"";const e=(new window.DOMParser).parseFromString(d,"text/html");return e.body.textContent||e.body.innerText||""}),[d]);if(!i||!l)return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(nt.AlignmentToolbar,{value:e,onChange:e=>o({textAlign:e})})),(0,Ke.createElement)("div",{..._},(0,Ke.createElement)("p",null,(0,tt.__)("This block will display the excerpt."))));if(g&&!m)return(0,Ke.createElement)("div",{..._},(0,Ke.createElement)(nt.Warning,null,(0,tt.__)("The content is currently protected and does not have the available excerpt.")));const f=(0,Ke.createElement)(nt.RichText,{className:"wp-block-post-excerpt__more-link",tagName:"a","aria-label":(0,tt.__)("“Read more” link text"),placeholder:(0,tt.__)('Add "read more" link text'),value:t,onChange:e=>o({moreText:e}),withoutInteractiveFormatting:!0}),k=ut()("wp-block-post-excerpt__excerpt",{"is-inline":!n}),x=(u||v).trim();let w="";if("words"===y)w=x.split(" ",a).join(" ");else if("characters_excluding_spaces"===y){const e=x.split("",a).join(""),t=e.length-e.replaceAll(" ","").length;w=x.split("",a+t).join("")}else"characters_including_spaces"===y&&(w=x.split("",a).join(""));const E=w!==x,C=b?(0,Ke.createElement)(nt.RichText,{className:k,"aria-label":(0,tt.__)("Excerpt text"),value:r?x:(E?w+"…":x)||(0,tt.__)("No excerpt found"),onChange:p,tagName:"p"}):(0,Ke.createElement)("p",{className:k},E?w+"…":x||(0,tt.__)("No excerpt found"));return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(nt.AlignmentToolbar,{value:e,onChange:e=>o({textAlign:e})})),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show link on new line"),checked:n,onChange:e=>o({showMoreOnNewLine:e})}),(0,Ke.createElement)(et.RangeControl,{label:(0,tt.__)("Max number of words"),value:a,onChange:e=>{o({excerptLength:e})},min:"10",max:"100"}))),(0,Ke.createElement)("div",{..._},C,!n&&" ",n?(0,Ke.createElement)("p",{className:"wp-block-post-excerpt__more-text"},f):f))}},Ay=()=>Xe({name:zy,metadata:My,settings:Ry}),Hy=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M19 3H5c-.6 0-1 .4-1 1v7c0 .5.4 1 1 1h14c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1zM5.5 10.5v-.4l1.8-1.3 1.3.8c.3.2.7.2.9-.1L11 8.1l2.4 2.4H5.5zm13 0h-2.9l-4-4c-.3-.3-.8-.3-1.1 0L8.9 8l-1.2-.8c-.3-.2-.6-.2-.9 0l-1.3 1V4.5h13v6zM4 20h9v-1.5H4V20zm0-4h16v-1.5H4V16z"})),Ly=(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"cover",label:(0,tt._x)("Cover","Scale option for Image dimension control")}),(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"contain",label:(0,tt._x)("Contain","Scale option for Image dimension control")}),(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"fill",label:(0,tt._x)("Fill","Scale option for Image dimension control")})),Dy="cover",Fy={cover:(0,tt.__)("Image is scaled and cropped to fill the entire space without being distorted."),contain:(0,tt.__)("Image is scaled to fill the space without clipping nor distorting."),fill:(0,tt.__)("Image will be stretched and distorted to completely fill the space.")},Vy=({clientId:e,attributes:{aspectRatio:t,width:n,height:a,scale:o,sizeSlug:r},setAttributes:l,imageSizeOptions:i=[]})=>{const[s]=(0,nt.useSettings)("spacing.units"),c=(0,et.__experimentalUseCustomUnits)({availableUnits:s||["px","%","vw","em","rem"]}),m=(e,t)=>{const n=parseFloat(t);isNaN(n)&&t||l({[e]:n<0?"0":t})},u=(0,tt._x)("Scale","Image scaling options"),p=a||t&&"auto"!==t;return(0,Ke.createElement)(nt.InspectorControls,{group:"dimensions"},(0,Ke.createElement)(et.__experimentalToolsPanelItem,{hasValue:()=>!!t,label:(0,tt.__)("Aspect ratio"),onDeselect:()=>l({aspectRatio:void 0}),resetAllFilter:()=>({aspectRatio:void 0}),isShownByDefault:!0,panelId:e},(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Aspect ratio"),value:t,options:[{label:(0,tt.__)("Original"),value:"auto"},{label:(0,tt.__)("Square"),value:"1"},{label:(0,tt.__)("16:9"),value:"16/9"},{label:(0,tt.__)("4:3"),value:"4/3"},{label:(0,tt.__)("3:2"),value:"3/2"},{label:(0,tt.__)("9:16"),value:"9/16"},{label:(0,tt.__)("3:4"),value:"3/4"},{label:(0,tt.__)("2:3"),value:"2/3"}],onChange:e=>l({aspectRatio:e})})),(0,Ke.createElement)(et.__experimentalToolsPanelItem,{className:"single-column",hasValue:()=>!!a,label:(0,tt.__)("Height"),onDeselect:()=>l({height:void 0}),resetAllFilter:()=>({height:void 0}),isShownByDefault:!0,panelId:e},(0,Ke.createElement)(et.__experimentalUnitControl,{label:(0,tt.__)("Height"),labelPosition:"top",value:a||"",min:0,onChange:e=>m("height",e),units:c})),(0,Ke.createElement)(et.__experimentalToolsPanelItem,{className:"single-column",hasValue:()=>!!n,label:(0,tt.__)("Width"),onDeselect:()=>l({width:void 0}),resetAllFilter:()=>({width:void 0}),isShownByDefault:!0,panelId:e},(0,Ke.createElement)(et.__experimentalUnitControl,{label:(0,tt.__)("Width"),labelPosition:"top",value:n||"",min:0,onChange:e=>m("width",e),units:c})),p&&(0,Ke.createElement)(et.__experimentalToolsPanelItem,{hasValue:()=>!!o&&o!==Dy,label:u,onDeselect:()=>l({scale:Dy}),resetAllFilter:()=>({scale:Dy}),isShownByDefault:!0,panelId:e},(0,Ke.createElement)(et.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:u,value:o,help:Fy[o],onChange:e=>l({scale:e}),isBlock:!0},Ly)),!!i.length&&(0,Ke.createElement)(et.__experimentalToolsPanelItem,{hasValue:()=>!!r,label:(0,tt.__)("Resolution"),onDeselect:()=>l({sizeSlug:void 0}),resetAllFilter:()=>({sizeSlug:void 0}),isShownByDefault:!1,panelId:e},(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Resolution"),value:r||"full",options:i,onChange:e=>l({sizeSlug:e}),help:(0,tt.__)("Select the size of the source image.")})))};const $y=(0,jt.compose)([(0,nt.withColors)({overlayColor:"background-color"})])((({clientId:e,attributes:t,setAttributes:n,overlayColor:a,setOverlayColor:o})=>{const{dimRatio:r}=t,{gradientClass:l,gradientValue:i,setGradient:s}=(0,nt.__experimentalUseGradient)(),c=(0,nt.__experimentalUseMultipleOriginColorsAndGradients)(),m=(0,nt.__experimentalUseBorderProps)(t),u={backgroundColor:a.color,backgroundImage:i,...m.style};return c.hasColorsOrGradients?(0,Ke.createElement)(Ke.Fragment,null,!!r&&(0,Ke.createElement)("span",{"aria-hidden":"true",className:ut()("wp-block-post-featured-image__overlay",(p=r,void 0===p?null:"has-background-dim-"+10*Math.round(p/10)),{[a.class]:a.class,"has-background-dim":void 0!==r,"has-background-gradient":i,[l]:l},m.className),style:u}),(0,Ke.createElement)(nt.InspectorControls,{group:"color"},(0,Ke.createElement)(nt.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:a.color,gradientValue:i,label:(0,tt.__)("Overlay"),onColorChange:o,onGradientChange:s,isShownByDefault:!0,resetAllFilter:()=>({overlayColor:void 0,customOverlayColor:void 0,gradient:void 0,customGradient:void 0})}],panelId:e,...c}),(0,Ke.createElement)(et.__experimentalToolsPanelItem,{hasValue:()=>void 0!==r,label:(0,tt.__)("Overlay opacity"),onDeselect:()=>n({dimRatio:0}),resetAllFilter:()=>({dimRatio:0}),isShownByDefault:!0,panelId:e},(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Overlay opacity"),value:r,onChange:e=>n({dimRatio:e}),min:0,max:100,step:10,required:!0,__next40pxDefaultSize:!0})))):null;var p})),Oy=["image"];const Gy={onClick:e=>e.preventDefault(),"aria-disabled":!0};const Uy={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/post-featured-image",title:"Featured Image",category:"theme",description:"Display a post's featured image.",textdomain:"default",attributes:{isLink:{type:"boolean",default:!1},aspectRatio:{type:"string"},width:{type:"string"},height:{type:"string"},scale:{type:"string",default:"cover"},sizeSlug:{type:"string"},rel:{type:"string",attribute:"rel",default:""},linkTarget:{type:"string",default:"_self"},overlayColor:{type:"string"},customOverlayColor:{type:"string"},dimRatio:{type:"number",default:0},gradient:{type:"string"},customGradient:{type:"string"},useFirstImageFromPost:{type:"boolean",default:!1}},usesContext:["postId","postType","queryId"],supports:{align:["left","right","center","wide","full"],color:{__experimentalDuotone:"img, .wp-block-post-featured-image__placeholder, .components-placeholder__illustration, .components-placeholder::before",text:!1,background:!1},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSelector:"img, .block-editor-media-placeholder, .wp-block-post-featured-image__overlay",__experimentalSkipSerialization:!0,__experimentalDefaultControls:{color:!0,radius:!0,width:!0}},html:!1,spacing:{margin:!0,padding:!0},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-post-featured-image-editor",style:"wp-block-post-featured-image"},{name:qy}=Uy,jy={icon:Hy,edit:function({clientId:e,attributes:t,setAttributes:n,context:{postId:a,postType:o,queryId:r}}){const l=Number.isFinite(r),{isLink:i,aspectRatio:s,height:c,width:m,scale:u,sizeSlug:p,rel:d,linkTarget:g,useFirstImageFromPost:h}=t,[b,_]=(0,dt.useEntityProp)("postType",o,"featured_media",a),[y]=(0,dt.useEntityProp)("postType",o,"content",a),v=(0,_t.useMemo)((()=>{if(b)return b;if(!h)return;const e=/<!--\s+wp:(?:core\/)?image\s+(?<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\s+\/?-->).)*)?}\s+)?-->/.exec(y);return e?.groups?.attrs&&JSON.parse(e.groups.attrs)?.id}),[b,h,y]),{media:f,postType:k,postPermalink:x}=(0,gt.useSelect)((e=>{const{getMedia:t,getPostType:n,getEditedEntityRecord:r}=e(dt.store);return{media:v&&t(v,{context:"view"}),postType:o&&n(o),postPermalink:r("postType",o,a)?.link}}),[v,o,a]),w=function(e,t){return e?.media_details?.sizes?.[t]?.source_url||e?.source_url}(f,p),E=(0,gt.useSelect)((e=>e(nt.store).getSettings().imageSizes),[]).filter((({slug:e})=>f?.media_details?.sizes?.[e]?.source_url)).map((({name:e,slug:t})=>({value:t,label:e}))),C=(0,nt.useBlockProps)({style:{width:m,height:c,aspectRatio:s}}),S=(0,nt.__experimentalUseBorderProps)(t),B=(0,nt.useBlockEditingMode)(),N=e=>(0,Ke.createElement)(et.Placeholder,{className:ut()("block-editor-media-placeholder",S.className),withIllustration:!0,style:{height:!!s&&"100%",width:!!s&&"100%",...S.style}},e),T=e=>{e?.id&&_(e.id)},{createErrorNotice:I}=(0,gt.useDispatch)(Pt.store),P=e=>{I(e,{type:"snackbar"})},M="default"===B&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)($y,{attributes:t,setAttributes:n,clientId:e}),(0,Ke.createElement)(Vy,{clientId:e,attributes:t,setAttributes:n,imageSizeOptions:E}),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:k?.labels.singular_name?(0,tt.sprintf)((0,tt.__)("Link to %s"),k.labels.singular_name):(0,tt.__)("Link to post"),onChange:()=>n({isLink:!i}),checked:i}),i&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Open in new tab"),onChange:e=>n({linkTarget:e?"_blank":"_self"}),checked:"_blank"===g}),(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link rel"),value:d,onChange:e=>n({rel:e})})))));let z;if(!v&&(l||!a))return(0,Ke.createElement)(Ke.Fragment,null,M,(0,Ke.createElement)("div",{...C},i?(0,Ke.createElement)("a",{href:x,target:g,...Gy},N()):N()));const R=(0,tt.__)("Add a featured image"),A={...S.style,height:s?"100%":c,width:!!s&&"100%",objectFit:!(!c&&!s)&&u};return z=v?f?(0,Ke.createElement)("img",{className:S.className,src:w,alt:f.alt_text?(0,tt.sprintf)((0,tt.__)("Featured image: %s"),f.alt_text):(0,tt.__)("Featured image"),style:A}):N():(0,Ke.createElement)(nt.MediaPlaceholder,{onSelect:T,accept:"image/*",allowedTypes:Oy,onError:P,placeholder:N,mediaLibraryButton:({open:e})=>(0,Ke.createElement)(et.Button,{icon:np,variant:"primary",label:R,showTooltip:!0,tooltipPosition:"top center",onClick:()=>{e()}})}),(0,Ke.createElement)(Ke.Fragment,null,M,!!f&&!l&&(0,Ke.createElement)(nt.BlockControls,{group:"other"},(0,Ke.createElement)(nt.MediaReplaceFlow,{mediaId:v,mediaURL:w,allowedTypes:Oy,accept:"image/*",onSelect:T,onError:P},(0,Ke.createElement)(et.MenuItem,{onClick:()=>_(0)},(0,tt.__)("Reset")))),(0,Ke.createElement)("figure",{...C},i?(0,Ke.createElement)("a",{href:x,target:g,...Gy},z):z))}},Wy=()=>Xe({name:qy,metadata:Uy,settings:jy});const Zy=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z"})),Qy=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z"})),Ky=[{isDefault:!0,name:"post-next",title:(0,tt.__)("Next post"),description:(0,tt.__)("Displays the post link that follows the current post."),icon:Zy,attributes:{type:"next"},scope:["inserter","transform"]},{name:"post-previous",title:(0,tt.__)("Previous post"),description:(0,tt.__)("Displays the post link that precedes the current post."),icon:Qy,attributes:{type:"previous"},scope:["inserter","transform"]}];Ky.forEach((e=>{e.isActive||(e.isActive=(e,t)=>e.type===t.type)}));const Yy=Ky,Jy={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/post-navigation-link",title:"Post Navigation Link",category:"theme",description:"Displays the next or previous post link that is adjacent to the current post.",textdomain:"default",attributes:{textAlign:{type:"string"},type:{type:"string",default:"next"},label:{type:"string"},showTitle:{type:"boolean",default:!1},linkLabel:{type:"boolean",default:!1},arrow:{type:"string",default:"none"},taxonomy:{type:"string",default:""}},usesContext:["postType"],supports:{reusable:!1,html:!1,color:{link:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalWritingMode:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},style:"wp-block-post-navigation-link"},{name:Xy}=Jy,ev={edit:function({context:{postType:e},attributes:{type:t,label:n,showTitle:a,textAlign:o,linkLabel:r,arrow:l,taxonomy:i},setAttributes:s}){const c="next"===t;let m=c?(0,tt.__)("Next"):(0,tt.__)("Previous");const u={none:"",arrow:c?"→":"←",chevron:c?"»":"«"}[l];a&&(m=c?(0,tt.__)("Next: "):(0,tt.__)("Previous: "));const p=c?(0,tt.__)("Next post"):(0,tt.__)("Previous post"),d=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${o}`]:o})}),g=(0,gt.useSelect)((t=>{const{getTaxonomies:n}=t(dt.store);return n({type:e,per_page:-1})}),[e]);return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,null,(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display the title as a link"),help:(0,tt.__)("If you have entered a custom label, it will be prepended before the title."),checked:!!a,onChange:()=>s({showTitle:!a})}),a&&(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Include the label as part of the link"),checked:!!r,onChange:()=>s({linkLabel:!r})}),(0,Ke.createElement)(et.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Arrow"),value:l,onChange:e=>{s({arrow:e})},help:(0,tt.__)("A decorative arrow for the next and previous link."),isBlock:!0},(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"none",label:(0,tt._x)("None","Arrow option for Next/Previous link")}),(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"arrow",label:(0,tt._x)("Arrow","Arrow option for Next/Previous link")}),(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"chevron",label:(0,tt._x)("Chevron","Arrow option for Next/Previous link")})))),(0,Ke.createElement)(nt.InspectorControls,{group:"advanced"},(0,Ke.createElement)(et.SelectControl,{label:(0,tt.__)("Filter by taxonomy"),value:i,options:[{label:(0,tt.__)("Unfiltered"),value:""},...(null!=g?g:[]).filter((({visibility:e})=>!!e?.publicly_queryable)).map((e=>({value:e.slug,label:e.name})))],onChange:e=>s({taxonomy:e}),help:(0,tt.__)("Only link to posts that have the same taxonomy terms as the current post. For example the same tags or categories.")})),(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(nt.AlignmentToolbar,{value:o,onChange:e=>{s({textAlign:e})}})),(0,Ke.createElement)("div",{...d},!c&&u&&(0,Ke.createElement)("span",{className:`wp-block-post-navigation-link__arrow-previous is-arrow-${l}`},u),(0,Ke.createElement)(nt.RichText,{tagName:"a","aria-label":p,placeholder:m,value:n,allowedFormats:["core/bold","core/italic"],onChange:e=>s({label:e})}),a&&(0,Ke.createElement)("a",{href:"#post-navigation-pseudo-link",onClick:e=>e.preventDefault()},(0,tt.__)("An example title")),c&&u&&(0,Ke.createElement)("span",{className:`wp-block-post-navigation-link__arrow-next is-arrow-${l}`,"aria-hidden":!0},u)))},variations:Yy},tv=()=>Xe({name:Xy,metadata:Jy,settings:ev}),nv=[["core/post-title"],["core/post-date"],["core/post-excerpt"]];function av(){const e=(0,nt.useInnerBlocksProps)({className:"wp-block-post"},{template:nv,__unstableDisableLayoutClassNames:!0});return(0,Ke.createElement)("li",{...e})}const ov=(0,_t.memo)((function({blocks:e,blockContextId:t,isHidden:n,setActiveBlockContextId:a}){const o=(0,nt.__experimentalUseBlockPreview)({blocks:e,props:{className:"wp-block-post"}}),r=()=>{a(t)},l={display:n?"none":void 0};return(0,Ke.createElement)("li",{...o,tabIndex:0,role:"button",onClick:r,onKeyPress:r,style:l})}));const rv={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/post-template",title:"Post Template",category:"theme",parent:["core/query"],description:"Contains the block elements used to render a post, like the title, date, featured image, content or excerpt, and more.",textdomain:"default",usesContext:["queryId","query","displayLayout","templateSlug","previewPostType","enhancedPagination"],supports:{reusable:!1,html:!1,align:["wide","full"],layout:!0,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},spacing:{blockGap:{__experimentalDefault:"1.25em"},__experimentalDefaultControls:{blockGap:!0}},interactivity:{clientNavigation:!0}},style:"wp-block-post-template",editorStyle:"wp-block-post-template-editor"},{name:lv}=rv,iv={icon:Uo,edit:function({setAttributes:e,clientId:t,context:{query:{perPage:n,offset:a=0,postType:o,order:r,orderBy:l,author:i,search:s,exclude:c,sticky:m,inherit:u,taxQuery:p,parents:d,pages:g,...h}={},templateSlug:b,previewPostType:_},attributes:{layout:y},__unstableLayoutClassNames:v}){const{type:f,columnCount:k=3}=y||{},[x,w]=(0,_t.useState)(),{posts:E,blocks:C}=(0,gt.useSelect)((e=>{const{getEntityRecords:g,getTaxonomies:y}=e(dt.store),{getBlocks:v}=e(nt.store),f=u&&b?.startsWith("category-")&&g("taxonomy","category",{context:"view",per_page:1,_fields:["id"],slug:b.replace("category-","")}),k={offset:a||0,order:r,orderby:l};if(p&&!u){const e=y({type:o,per_page:-1,context:"view"}),t=Object.entries(p).reduce(((t,[n,a])=>{const o=e?.find((({slug:e})=>e===n));return o?.rest_base&&(t[o?.rest_base]=a),t}),{});Object.keys(t).length&&Object.assign(k,t)}n&&(k.per_page=n),i&&(k.author=i),s&&(k.search=s),c?.length&&(k.exclude=c),d?.length&&(k.parent=d),m&&(k.sticky="only"===m),u&&(b?.startsWith("archive-")?(k.postType=b.replace("archive-",""),o=k.postType):f&&(k.categories=f[0]?.id));return{posts:g("postType",_||o,{...k,...h}),blocks:v(t)}}),[n,a,r,l,t,i,s,o,c,m,u,b,p,d,h,_]),S=(0,_t.useMemo)((()=>E?.map((e=>({postType:e.type,postId:e.id})))),[E]),B=(0,nt.useBlockProps)({className:ut()(v,{[`columns-${k}`]:"grid"===f&&k})});if(!E)return(0,Ke.createElement)("p",{...B},(0,Ke.createElement)(et.Spinner,null));if(!E.length)return(0,Ke.createElement)("p",{...B}," ",(0,tt.__)("No results found."));const N=t=>e({layout:{...y,...t}}),T=[{icon:Tp,title:(0,tt.__)("List view"),onClick:()=>N({type:"default"}),isActive:"default"===f||"constrained"===f},{icon:Xm,title:(0,tt.__)("Grid view"),onClick:()=>N({type:"grid",columnCount:k}),isActive:"grid"===f}];return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,{controls:T})),(0,Ke.createElement)("ul",{...B},S&&S.map((e=>(0,Ke.createElement)(nt.BlockContextProvider,{key:e.postId,value:e},e.postId===(x||S[0]?.postId)?(0,Ke.createElement)(av,null):null,(0,Ke.createElement)(ov,{blocks:C,blockContextId:e.postId,setActiveBlockContextId:w,isHidden:e.postId===(x||S[0]?.postId)}))))))},save:function(){return(0,Ke.createElement)(nt.InnerBlocks.Content,null)}},sv=()=>Xe({name:lv,metadata:rv,settings:iv}),cv=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M20 4H4v1.5h16V4zm-2 9h-3c-1.1 0-2 .9-2 2v3c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2zm.5 5c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5v-3c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3zM4 9.5h9V8H4v1.5zM9 13H6c-1.1 0-2 .9-2 2v3c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2zm.5 5c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-3c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3z",fillRule:"evenodd",clipRule:"evenodd"})),mv=[];const uv=["core/bold","core/image","core/italic","core/link","core/strikethrough","core/text-color"];const pv=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M8.1 12.3c.1.1.3.3.5.3.2.1.4.1.6.1.2 0 .4 0 .6-.1.2-.1.4-.2.5-.3l3-3c.3-.3.5-.7.5-1.1 0-.4-.2-.8-.5-1.1L9.7 3.5c-.1-.2-.3-.3-.5-.3H5c-.4 0-.8.4-.8.8v4.2c0 .2.1.4.2.5l3.7 3.6zM5.8 4.8h3.1l3.4 3.4v.1l-3 3 .5.5-.7-.5-3.3-3.4V4.8zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z"})),dv={category:cv,post_tag:pv};function gv(e,t){if("core/post-terms"!==t)return e;const n=e.variations.map((e=>{var t;return{...e,icon:null!==(t=dv[e.name])&&void 0!==t?t:cv}}));return{...e,variations:n}}const hv={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/post-terms",title:"Post Terms",category:"theme",description:"Post terms.",textdomain:"default",attributes:{term:{type:"string"},textAlign:{type:"string"},separator:{type:"string",default:", "},prefix:{type:"string",default:""},suffix:{type:"string",default:""}},usesContext:["postId","postType"],supports:{html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},style:"wp-block-post-terms"},{name:bv}=hv,_v={icon:cv,edit:function({attributes:e,clientId:t,context:n,isSelected:a,setAttributes:o,insertBlocksAfter:r}){const{term:l,textAlign:i,separator:s,prefix:c,suffix:m}=e,{postId:u,postType:p}=n,d=(0,gt.useSelect)((e=>{if(!l)return{};const{getTaxonomy:t}=e(dt.store),n=t(l);return n?.visibility?.publicly_queryable?n:{}}),[l]),{postTerms:g,hasPostTerms:h,isLoading:b}=function({postId:e,term:t}){const{slug:n}=t;return(0,gt.useSelect)((a=>{const o=t?.visibility?.publicly_queryable;if(!o)return{postTerms:mv,isLoading:!1,hasPostTerms:!1};const{getEntityRecords:r,isResolving:l}=a(dt.store),i=["taxonomy",n,{post:e,per_page:-1,context:"view"}],s=r(...i);return{postTerms:s,isLoading:l("getEntityRecords",i),hasPostTerms:!!s?.length}}),[e,t?.visibility?.publicly_queryable,n])}({postId:u,term:d}),_=u&&p,y=(0,nt.useBlockDisplayInformation)(t),v=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${i}`]:i,[`taxonomy-${l}`]:l})});return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(nt.AlignmentToolbar,{value:i,onChange:e=>{o({textAlign:e})}})),(0,Ke.createElement)(nt.InspectorControls,{group:"advanced"},(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,autoComplete:"off",label:(0,tt.__)("Separator"),value:s||"",onChange:e=>{o({separator:e})},help:(0,tt.__)("Enter character(s) used to separate terms.")})),(0,Ke.createElement)("div",{...v},b&&_&&(0,Ke.createElement)(et.Spinner,null),!b&&(a||c)&&(0,Ke.createElement)(nt.RichText,{allowedFormats:uv,className:"wp-block-post-terms__prefix","aria-label":(0,tt.__)("Prefix"),placeholder:(0,tt.__)("Prefix")+" ",value:c,onChange:e=>o({prefix:e}),tagName:"span"}),(!_||!l)&&(0,Ke.createElement)("span",null,y.title),_&&!b&&h&&g.map((e=>(0,Ke.createElement)("a",{key:e.id,href:e.link,onClick:e=>e.preventDefault()},(0,Jn.decodeEntities)(e.name)))).reduce(((e,t)=>(0,Ke.createElement)(Ke.Fragment,null,e,(0,Ke.createElement)("span",{className:"wp-block-post-terms__separator"},s||" "),t))),_&&!b&&!h&&(d?.labels?.no_terms||(0,tt.__)("Term items not found.")),!b&&(a||m)&&(0,Ke.createElement)(nt.RichText,{allowedFormats:uv,className:"wp-block-post-terms__suffix","aria-label":(0,tt.__)("Suffix"),placeholder:" "+(0,tt.__)("Suffix"),value:m,onChange:e=>o({suffix:e}),tagName:"span",__unstableOnSplitAtEnd:()=>r((0,Qe.createBlock)((0,Qe.getDefaultBlockName)()))})))}},yv=()=>((0,_i.addFilter)("blocks.registerBlockType","core/template-part",gv),Xe({name:bv,metadata:hv,settings:_v})),vv=window.wp.wordcount;const fv=function({attributes:e,setAttributes:t,context:n}){const{textAlign:a}=e,{postId:o,postType:r}=n,[l]=(0,dt.useEntityProp)("postType",r,"content",o),[i]=(0,dt.useEntityBlockEditor)("postType",r,{id:o}),s=(0,_t.useMemo)((()=>{let e;e=l instanceof Function?l({blocks:i}):i?(0,Qe.__unstableSerializeAndClean)(i):l;const t=(0,tt._x)("words","Word count type. Do not translate!"),n=Math.max(1,Math.round((0,vv.count)(e,t)/189));return(0,tt.sprintf)((0,tt._n)("%d minute","%d minutes",n),n)}),[l,i]),c=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${a}`]:a})});return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:a,onChange:e=>{t({textAlign:e})}})),(0,Ke.createElement)("div",{...c},s))},kv=(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Path,{d:"M12 3c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16.5c-4.1 0-7.5-3.4-7.5-7.5S7.9 4.5 12 4.5s7.5 3.4 7.5 7.5-3.4 7.5-7.5 7.5zM12 7l-1 5c0 .3.2.6.4.8l4.2 2.8-2.7-4.1L12 7z"})),xv={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,__experimental:!0,name:"core/post-time-to-read",title:"Time To Read",category:"theme",description:"Show minutes required to finish reading the post.",textdomain:"default",usesContext:["postId","postType"],attributes:{textAlign:{type:"string"}},supports:{color:{gradients:!0,__experimentalDefaultControls:{background:!0,text:!0}},html:!1,spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:wv}=xv,Ev={icon:kv,edit:fv},Cv=()=>Xe({name:wv,metadata:xv,settings:Ev});const Sv={attributes:{textAlign:{type:"string"},level:{type:"number",default:2},isLink:{type:"boolean",default:!1},rel:{type:"string",attribute:"rel",default:""},linkTarget:{type:"string",default:"_self"}},supports:{align:["wide","full"],html:!1,color:{gradients:!0,link:!0},spacing:{margin:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0}},save:()=>null,migrate:ln,isEligible:({style:e})=>e?.typography?.fontFamily},Bv=[Sv],Nv={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/post-title",title:"Title",category:"theme",description:"Displays the title of a post, page, or any other content-type.",textdomain:"default",usesContext:["postId","postType","queryId"],attributes:{textAlign:{type:"string"},level:{type:"number",default:2},isLink:{type:"boolean",default:!1},rel:{type:"string",attribute:"rel",default:""},linkTarget:{type:"string",default:"_self"}},supports:{align:["wide","full"],html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},style:"wp-block-post-title"},{name:Tv}=Nv,Iv={icon:Br,edit:function({attributes:{level:e,textAlign:t,isLink:n,rel:a,linkTarget:o},setAttributes:r,context:{postType:l,postId:i,queryId:s},insertBlocksAfter:c}){const m="h"+e,u=uy("postType",!Number.isFinite(s)&&l,i),[p="",d,g]=(0,dt.useEntityProp)("postType",l,"title",i),[h]=(0,dt.useEntityProp)("postType",l,"link",i),b=()=>{c((0,Qe.createBlock)((0,Qe.getDefaultBlockName)()))},_=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${t}`]:t})}),y=(0,nt.useBlockEditingMode)();let v=(0,Ke.createElement)(m,{..._},(0,tt.__)("Title"));return l&&i&&(v=u?(0,Ke.createElement)(nt.PlainText,{tagName:m,placeholder:(0,tt.__)("No Title"),value:p,onChange:d,__experimentalVersion:2,__unstableOnSplitAtEnd:b,..._}):(0,Ke.createElement)(m,{..._,dangerouslySetInnerHTML:{__html:g?.rendered}})),n&&l&&i&&(v=u?(0,Ke.createElement)(m,{..._},(0,Ke.createElement)(nt.PlainText,{tagName:"a",href:h,target:o,rel:a,placeholder:p.length?null:(0,tt.__)("No Title"),value:p,onChange:d,__experimentalVersion:2,__unstableOnSplitAtEnd:b})):(0,Ke.createElement)(m,{..._},(0,Ke.createElement)("a",{href:h,target:o,rel:a,onClick:e=>e.preventDefault(),dangerouslySetInnerHTML:{__html:g?.rendered}}))),(0,Ke.createElement)(Ke.Fragment,null,"default"===y&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.HeadingLevelDropdown,{value:e,onChange:e=>r({level:e})}),(0,Ke.createElement)(nt.AlignmentControl,{value:t,onChange:e=>{r({textAlign:e})}})),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Make title a link"),onChange:()=>r({isLink:!n}),checked:n}),n&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Open in new tab"),onChange:e=>r({linkTarget:e?"_blank":"_self"}),checked:"_blank"===o}),(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link rel"),value:a,onChange:e=>r({rel:e})}))))),v)},deprecated:Bv},Pv=()=>Xe({name:Tv,metadata:Nv,settings:Iv}),Mv=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v12zM7 16.5h6V15H7v1.5zm4-4h6V11h-6v1.5zM9 11H7v1.5h2V11zm6 5.5h2V15h-2v1.5z"}));const zv={from:[{type:"block",blocks:["core/code","core/paragraph"],transform:({content:e,anchor:t})=>(0,Qe.createBlock)("core/preformatted",{content:e,anchor:t})},{type:"raw",isMatch:e=>"PRE"===e.nodeName&&!(1===e.children.length&&"CODE"===e.firstChild.nodeName),schema:({phrasingContentSchema:e})=>({pre:{children:e}})}],to:[{type:"block",blocks:["core/paragraph"],transform:e=>(0,Qe.createBlock)("core/paragraph",e)},{type:"block",blocks:["core/code"],transform:e=>(0,Qe.createBlock)("core/code",e)}]},Rv=zv,Av={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/preformatted",title:"Preformatted",category:"text",description:"Add text that respects your spacing and tabs, and also allows styling.",textdomain:"default",attributes:{content:{type:"rich-text",source:"rich-text",selector:"pre",__unstablePreserveWhiteSpace:!0,__experimentalRole:"content"}},supports:{anchor:!0,color:{gradients:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{padding:!0,margin:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},style:"wp-block-preformatted"},{name:Hv}=Av,Lv={icon:Mv,example:{attributes:{content:(0,tt.__)("EXT. XANADU - FAINT DAWN - 1940 (MINIATURE)\nWindow, very small in the distance, illuminated.\nAll around this is an almost totally black screen. Now, as the camera moves slowly towards the window which is almost a postage stamp in the frame, other forms appear;")}},transforms:Rv,edit:function({attributes:e,mergeBlocks:t,setAttributes:n,onRemove:a,insertBlocksAfter:o,style:r}){const{content:l}=e,i=(0,nt.useBlockProps)({style:r});return(0,Ke.createElement)(nt.RichText,{tagName:"pre",identifier:"content",preserveWhiteSpace:!0,value:l,onChange:e=>{n({content:e})},onRemove:a,"aria-label":(0,tt.__)("Preformatted text"),placeholder:(0,tt.__)("Write preformatted text…"),onMerge:t,...i,__unstablePastePlainText:!0,__unstableOnSplitAtDoubleLineEnd:()=>o((0,Qe.createBlock)((0,Qe.getDefaultBlockName)()))})},save:function({attributes:e}){const{content:t}=e;return(0,Ke.createElement)("pre",{...nt.useBlockProps.save()},(0,Ke.createElement)(nt.RichText.Content,{value:t}))},merge:(e,t)=>({content:e.content+"\n\n"+t.content})},Dv=()=>Xe({name:Hv,metadata:Av,settings:Lv}),Fv=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M18 8H6c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2zm.5 6c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-4c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v4zM4 4v1.5h16V4H4zm0 16h16v-1.5H4V20z"})),Vv="is-style-solid-color",$v={value:{type:"string",source:"html",selector:"blockquote",multiline:"p"},citation:{type:"string",source:"html",selector:"cite",default:""},mainColor:{type:"string"},customMainColor:{type:"string"},textColor:{type:"string"},customTextColor:{type:"string"}};function Ov(e){if(!e)return;const t=e.match(/border-color:([^;]+)[;]?/);return t&&t[1]?t[1]:void 0}function Gv(e){const t=`</p>${e=e||"<p></p>"}<p>`.split("</p><p>");return t.shift(),t.pop(),t.join("<br>")}const Uv={attributes:{value:{type:"string",source:"html",selector:"blockquote",multiline:"p",__experimentalRole:"content"},citation:{type:"string",source:"html",selector:"cite",default:"",__experimentalRole:"content"},textAlign:{type:"string"}},save({attributes:e}){const{textAlign:t,citation:n,value:a}=e,o=!nt.RichText.isEmpty(n);return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:ut()({[`has-text-align-${t}`]:t})})},(0,Ke.createElement)("blockquote",null,(0,Ke.createElement)(nt.RichText.Content,{value:a,multiline:!0}),o&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:n})))},migrate:({value:e,...t})=>({value:Gv(e),...t})},qv={attributes:{...$v},save({attributes:e}){const{mainColor:t,customMainColor:n,customTextColor:a,textColor:o,value:r,citation:l,className:i}=e,s=i?.includes(Vv);let c,m;if(s){const e=(0,nt.getColorClassName)("background-color",t);c=ut()({"has-background":e||n,[e]:e}),m={backgroundColor:e?void 0:n}}else n&&(m={borderColor:n});const u=(0,nt.getColorClassName)("color",o),p=ut()({"has-text-color":o||a,[u]:u}),d=u?void 0:{color:a};return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:c,style:m})},(0,Ke.createElement)("blockquote",{className:p,style:d},(0,Ke.createElement)(nt.RichText.Content,{value:r,multiline:!0}),!nt.RichText.isEmpty(l)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:l})))},migrate({value:e,className:t,mainColor:n,customMainColor:a,customTextColor:o,...r}){const l=t?.includes(Vv);let i;return a&&(i=l?{color:{background:a}}:{border:{color:a}}),o&&i&&(i.color={...i.color,text:o}),{value:Gv(e),className:t,backgroundColor:l?n:void 0,borderColor:l?void 0:n,textAlign:l?"left":void 0,style:i,...r}}},jv={attributes:{...$v,figureStyle:{source:"attribute",selector:"figure",attribute:"style"}},save({attributes:e}){const{mainColor:t,customMainColor:n,textColor:a,customTextColor:o,value:r,citation:l,className:i,figureStyle:s}=e,c=i?.includes(Vv);let m,u;if(c){const e=(0,nt.getColorClassName)("background-color",t);m=ut()({"has-background":e||n,[e]:e}),u={backgroundColor:e?void 0:n}}else if(n)u={borderColor:n};else if(t){u={borderColor:Ov(s)}}const p=(0,nt.getColorClassName)("color",a),d=(a||o)&&ut()("has-text-color",{[p]:p}),g=p?void 0:{color:o};return(0,Ke.createElement)("figure",{className:m,style:u},(0,Ke.createElement)("blockquote",{className:d,style:g},(0,Ke.createElement)(nt.RichText.Content,{value:r,multiline:!0}),!nt.RichText.isEmpty(l)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:l})))},migrate({value:e,className:t,figureStyle:n,mainColor:a,customMainColor:o,customTextColor:r,...l}){const i=t?.includes(Vv);let s;if(o&&(s=i?{color:{background:o}}:{border:{color:o}}),r&&s&&(s.color={...s.color,text:r}),!i&&a&&n){const a=Ov(n);if(a)return{value:Gv(e),...l,className:t,style:{border:{color:a}}}}return{value:Gv(e),className:t,backgroundColor:i?a:void 0,borderColor:i?void 0:a,textAlign:i?"left":void 0,style:s,...l}}},Wv={attributes:$v,save({attributes:e}){const{mainColor:t,customMainColor:n,textColor:a,customTextColor:o,value:r,citation:l,className:i}=e,s=i?.includes(Vv);let c,m;if(s)c=(0,nt.getColorClassName)("background-color",t),c||(m={backgroundColor:n});else if(n)m={borderColor:n};else if(t){var u;const e=null!==(u=(0,gt.select)(nt.store).getSettings().colors)&&void 0!==u?u:[];m={borderColor:(0,nt.getColorObjectByAttributeValues)(e,t).color}}const p=(0,nt.getColorClassName)("color",a),d=a||o?ut()("has-text-color",{[p]:p}):void 0,g=p?void 0:{color:o};return(0,Ke.createElement)("figure",{className:c,style:m},(0,Ke.createElement)("blockquote",{className:d,style:g},(0,Ke.createElement)(nt.RichText.Content,{value:r,multiline:!0}),!nt.RichText.isEmpty(l)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:l})))},migrate({value:e,className:t,mainColor:n,customMainColor:a,customTextColor:o,...r}){const l=t?.includes(Vv);let i={};return a&&(i=l?{color:{background:a}}:{border:{color:a}}),o&&i&&(i.color={...i.color,text:o}),{value:Gv(e),className:t,backgroundColor:l?n:void 0,borderColor:l?void 0:n,textAlign:l?"left":void 0,style:i,...r}}},Zv={attributes:{...$v},save({attributes:e}){const{value:t,citation:n}=e;return(0,Ke.createElement)("blockquote",null,(0,Ke.createElement)(nt.RichText.Content,{value:t,multiline:!0}),!nt.RichText.isEmpty(n)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:n}))},migrate:({value:e,...t})=>({value:Gv(e),...t})},Qv={attributes:{...$v,citation:{type:"string",source:"html",selector:"footer"},align:{type:"string",default:"none"}},save({attributes:e}){const{value:t,citation:n,align:a}=e;return(0,Ke.createElement)("blockquote",{className:`align${a}`},(0,Ke.createElement)(nt.RichText.Content,{value:t,multiline:!0}),!nt.RichText.isEmpty(n)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"footer",value:n}))},migrate:({value:e,...t})=>({value:Gv(e),...t})},Kv=[Uv,qv,jv,Wv,Zv,Qv],Yv="web"===_t.Platform.OS;const Jv=function({attributes:e,setAttributes:t,isSelected:n,insertBlocksAfter:a}){const{textAlign:o,citation:r,value:l}=e,i=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${o}`]:o})}),s=!nt.RichText.isEmpty(r)||n;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:o,onChange:e=>{t({textAlign:e})}})),(0,Ke.createElement)("figure",{...i},(0,Ke.createElement)("blockquote",null,(0,Ke.createElement)(nt.RichText,{identifier:"value",tagName:"p",value:l,onChange:e=>t({value:e}),"aria-label":(0,tt.__)("Pullquote text"),placeholder:(0,tt.__)("Add quote"),textAlign:"center"}),s&&(0,Ke.createElement)(nt.RichText,{identifier:"citation",tagName:Yv?"cite":void 0,style:{display:"block"},value:r,"aria-label":(0,tt.__)("Pullquote citation text"),placeholder:(0,tt.__)("Add citation"),onChange:e=>t({citation:e}),className:"wp-block-pullquote__citation",__unstableMobileNoFocusOnMount:!0,textAlign:"center",__unstableOnSplitAtEnd:()=>a((0,Qe.createBlock)((0,Qe.getDefaultBlockName)()))}))))};const Xv={from:[{type:"block",isMultiBlock:!0,blocks:["core/paragraph"],transform:e=>(0,Qe.createBlock)("core/pullquote",{value:(0,Rn.toHTMLString)({value:(0,Rn.join)(e.map((({content:e})=>(0,Rn.create)({html:e}))),"\n")}),anchor:e.anchor})},{type:"block",blocks:["core/heading"],transform:({content:e,anchor:t})=>(0,Qe.createBlock)("core/pullquote",{value:e,anchor:t})}],to:[{type:"block",blocks:["core/paragraph"],transform:({value:e,citation:t})=>{const n=[];return e&&n.push((0,Qe.createBlock)("core/paragraph",{content:e})),t&&n.push((0,Qe.createBlock)("core/paragraph",{content:t})),0===n.length?(0,Qe.createBlock)("core/paragraph",{content:""}):n}},{type:"block",blocks:["core/heading"],transform:({value:e,citation:t})=>{if(!e)return(0,Qe.createBlock)("core/heading",{content:t});const n=(0,Qe.createBlock)("core/heading",{content:e});return t?[n,(0,Qe.createBlock)("core/heading",{content:t})]:n}}]},ef=Xv,tf={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/pullquote",title:"Pullquote",category:"text",description:"Give special visual emphasis to a quote from your text.",textdomain:"default",attributes:{value:{type:"rich-text",source:"rich-text",selector:"p",__experimentalRole:"content"},citation:{type:"rich-text",source:"rich-text",selector:"cite",__experimentalRole:"content"},textAlign:{type:"string"}},supports:{anchor:!0,align:["left","right","wide","full"],color:{gradients:!0,background:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,radius:!0,style:!0,width:!0}},__experimentalStyle:{typography:{fontSize:"1.5em",lineHeight:"1.6"}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-pullquote-editor",style:"wp-block-pullquote"},{name:nf}=tf,af={icon:Fv,example:{attributes:{value:(0,tt.__)("One of the hardest things to do in technology is disrupt yourself."),citation:(0,tt.__)("Matt Mullenweg")}},transforms:ef,edit:Jv,save:function({attributes:e}){const{textAlign:t,citation:n,value:a}=e,o=!nt.RichText.isEmpty(n);return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:ut()({[`has-text-align-${t}`]:t})})},(0,Ke.createElement)("blockquote",null,(0,Ke.createElement)(nt.RichText.Content,{tagName:"p",value:a}),o&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:n})))},deprecated:Kv},of=()=>Xe({name:nf,metadata:tf,settings:af}),rf=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M18.1823 11.6392C18.1823 13.0804 17.0139 14.2487 15.5727 14.2487C14.3579 14.2487 13.335 13.4179 13.0453 12.2922L13.0377 12.2625L13.0278 12.2335L12.3985 10.377L12.3942 10.3785C11.8571 8.64997 10.246 7.39405 8.33961 7.39405C5.99509 7.39405 4.09448 9.29465 4.09448 11.6392C4.09448 13.9837 5.99509 15.8843 8.33961 15.8843C8.88499 15.8843 9.40822 15.781 9.88943 15.5923L9.29212 14.0697C8.99812 14.185 8.67729 14.2487 8.33961 14.2487C6.89838 14.2487 5.73003 13.0804 5.73003 11.6392C5.73003 10.1979 6.89838 9.02959 8.33961 9.02959C9.55444 9.02959 10.5773 9.86046 10.867 10.9862L10.8772 10.9836L11.4695 12.7311C11.9515 14.546 13.6048 15.8843 15.5727 15.8843C17.9172 15.8843 19.8178 13.9837 19.8178 11.6392C19.8178 9.29465 17.9172 7.39404 15.5727 7.39404C15.0287 7.39404 14.5066 7.4968 14.0264 7.6847L14.6223 9.20781C14.9158 9.093 15.2358 9.02959 15.5727 9.02959C17.0139 9.02959 18.1823 10.1979 18.1823 11.6392Z"})),lf=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"}),(0,Ke.createElement)(Ye.Path,{d:"m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"})),sf=e=>{const t=e?.reduce(((e,t)=>{const{mapById:n,mapByName:a,names:o}=e;return n[t.id]=t,a[t.name]=t,o.push(t.name),e}),{mapById:{},mapByName:{},names:[]});return{entities:e,...t}},cf=(e,t)=>{const n=t.split(".");let a=e;return n.forEach((e=>{a=a?.[e]})),a},mf=(e,t)=>(e||[]).map((e=>({...e,name:(0,Jn.decodeEntities)(cf(e,t))}))),uf=()=>{const e=(0,gt.useSelect)((e=>{const{getPostTypes:t}=e(dt.store),n=["attachment"],a=t({per_page:-1})?.filter((({viewable:e,slug:t})=>e&&!n.includes(t)));return a}),[]);return{postTypesTaxonomiesMap:(0,_t.useMemo)((()=>{if(e?.length)return e.reduce(((e,t)=>(e[t.slug]=t.taxonomies,e)),{})}),[e]),postTypesSelectOptions:(0,_t.useMemo)((()=>(e||[]).map((({labels:e,slug:t})=>({label:e.singular_name,value:t})))),[e])}},pf=e=>(0,gt.useSelect)((t=>{const{getTaxonomies:n}=t(dt.store);return n({type:e,per_page:-1,context:"view"})}),[e]);function df(e,t){return!e||e.includes(t)}function gf(e,t){const n=(0,gt.useSelect)((e=>e(Qe.store).getActiveBlockVariation("core/query",t)?.name),[t]),a=`core/query/${n}`;return(0,gt.useSelect)((t=>{if(!n)return!1;const{getBlockRootClientId:o,getPatternsByBlockTypes:r}=t(nt.store),l=o(e);return r(a,l).length>0}),[e,n,a])?a:"core/query"}const hf=(e,t)=>(0,gt.useSelect)((n=>{const{getBlockRootClientId:a,getPatternsByBlockTypes:o}=n(nt.store),r=a(e);return o(t,r)}),[t,e]),bf=e=>(0,gt.useSelect)((t=>{const{getClientIdsOfDescendants:n,getBlockName:a}=t(nt.store),o={};return n(e).forEach((e=>{const t=a(e),n=Object.is((0,Qe.getBlockSupport)(t,"interactivity"),!0),r=(0,Qe.getBlockSupport)(t,"interactivity.clientNavigation");n||r?"core/post-content"===t&&(o.hasPostContentBlock=!0):o.hasBlocksFromPlugins=!0})),o.hasUnsupportedBlocks=o.hasBlocksFromPlugins||o.hasPostContentBlock,o}),[e]);function _f({attributes:{query:e},setQuery:t,openPatternSelectionModal:n,name:a,clientId:o}){const r=!!hf(o,a).length,l=(0,jt.useInstanceId)(_f,"blocks-query-pagination-max-page-input");return(0,Ke.createElement)(Ke.Fragment,null,!e.inherit&&(0,Ke.createElement)(et.ToolbarGroup,null,(0,Ke.createElement)(et.Dropdown,{contentClassName:"block-library-query-toolbar__popover",renderToggle:({onToggle:e})=>(0,Ke.createElement)(et.ToolbarButton,{icon:lf,label:(0,tt.__)("Display settings"),onClick:e}),renderContent:()=>(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.BaseControl,null,(0,Ke.createElement)(et.__experimentalNumberControl,{__unstableInputWidth:"60px",label:(0,tt.__)("Items per Page"),labelPosition:"edge",min:1,max:100,onChange:e=>{isNaN(e)||e<1||e>100||t({perPage:e})},step:"1",value:e.perPage,isDragEnabled:!1})),(0,Ke.createElement)(et.BaseControl,null,(0,Ke.createElement)(et.__experimentalNumberControl,{__unstableInputWidth:"60px",label:(0,tt.__)("Offset"),labelPosition:"edge",min:0,max:100,onChange:e=>{isNaN(e)||e<0||e>100||t({offset:e})},step:"1",value:e.offset,isDragEnabled:!1})),(0,Ke.createElement)(et.BaseControl,{id:l,help:(0,tt.__)("Limit the pages you want to show, even if the query has more results. To show all pages use 0 (zero).")},(0,Ke.createElement)(et.__experimentalNumberControl,{id:l,__unstableInputWidth:"60px",label:(0,tt.__)("Max page to show"),labelPosition:"edge",min:0,onChange:e=>{isNaN(e)||e<0||t({pages:e})},step:"1",value:e.pages,isDragEnabled:!1})))})),r&&(0,Ke.createElement)(et.ToolbarGroup,{className:"wp-block-template-part__block-control-group"},(0,Ke.createElement)(et.ToolbarButton,{onClick:n},(0,tt.__)("Replace"))))}const yf=[{label:(0,tt.__)("Newest to oldest"),value:"date/desc"},{label:(0,tt.__)("Oldest to newest"),value:"date/asc"},{label:(0,tt.__)("A → Z"),value:"title/asc"},{label:(0,tt.__)("Z → A"),value:"title/desc"}];const vf=function({order:e,orderBy:t,onChange:n}){return(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Order by"),value:`${t}/${e}`,options:yf,onChange:e=>{const[t,a]=e.split("/");n({order:a,orderBy:t})}})},ff={who:"authors",per_page:-1,_fields:"id,name",context:"view"};const kf=function({value:e,onChange:t}){const n=(0,gt.useSelect)((e=>{const{getUsers:t}=e(dt.store);return t(ff)}),[]);if(!n)return null;const a=sf(n),o=(e?e.toString().split(","):[]).reduce(((e,t)=>{const n=a.mapById[t];return n&&e.push({id:t,value:n.name}),e}),[]);return(0,Ke.createElement)(et.FormTokenField,{label:(0,tt.__)("Authors"),value:o,suggestions:a.names,onChange:e=>{const n=Array.from(e.reduce(((e,t)=>{const n=((e,t)=>{const n=t?.id||e[t]?.id;if(n)return n})(a.mapByName,t);return n&&e.add(n),e}),new Set));t({author:n.join(",")})},__experimentalShowHowTo:!1})},xf=[],wf={order:"asc",_fields:"id,title",context:"view"};const Ef=function({parents:e,postType:t,onChange:n}){const[a,o]=(0,_t.useState)(""),[r,l]=(0,_t.useState)(xf),[i,s]=(0,_t.useState)(xf),c=(0,jt.useDebounce)(o,250),{searchResults:m,searchHasResolved:u}=(0,gt.useSelect)((n=>{if(!a)return{searchResults:xf,searchHasResolved:!0};const{getEntityRecords:o,hasFinishedResolution:r}=n(dt.store),l=["postType",t,{...wf,search:a,orderby:"relevance",exclude:e,per_page:20}];return{searchResults:o(...l),searchHasResolved:r("getEntityRecords",l)}}),[a,e]),p=(0,gt.useSelect)((n=>{if(!e?.length)return xf;const{getEntityRecords:a}=n(dt.store);return a("postType",t,{...wf,include:e,per_page:e.length})}),[e]);(0,_t.useEffect)((()=>{if(e?.length||l(xf),!p?.length)return;const t=sf(mf(p,"title.rendered")),n=e.reduce(((e,n)=>{const a=t.mapById[n];return a&&e.push({id:n,value:a.name}),e}),[]);l(n)}),[e,p]);const d=(0,_t.useMemo)((()=>m?.length?sf(mf(m,"title.rendered")):xf),[m]);return(0,_t.useEffect)((()=>{u&&s(d.names)}),[d.names,u]),(0,Ke.createElement)(et.FormTokenField,{label:(0,tt.__)("Parents"),value:r,onInputChange:c,suggestions:i,onChange:e=>{const t=Array.from(e.reduce(((e,t)=>{const n=((e,t)=>{const n=t?.id||e?.[t]?.id;if(n)return n})(d.mapByName,t);return n&&e.add(n),e}),new Set));s(xf),n({parents:t})},__experimentalShowHowTo:!1})},Cf=[],Sf={order:"asc",_fields:"id,name",context:"view"},Bf=(e,t)=>{const n=t?.id||e?.find((e=>e.name===t))?.id;if(n)return n;const a=t.toLocaleLowerCase();return e?.find((e=>e.name.toLocaleLowerCase()===a))?.id};function Nf({onChange:e,query:t}){const{postType:n,taxQuery:a}=t,o=pf(n);return o&&0!==o.length?(0,Ke.createElement)(Ke.Fragment,null,o.map((t=>{const n=a?.[t.slug]||[];return(0,Ke.createElement)(Tf,{key:t.slug,taxonomy:t,termIds:n,onChange:n=>e({taxQuery:{...a,[t.slug]:n}})})}))):null}function Tf({taxonomy:e,termIds:t,onChange:n}){const[a,o]=(0,_t.useState)(""),[r,l]=(0,_t.useState)(Cf),[i,s]=(0,_t.useState)(Cf),c=(0,jt.useDebounce)(o,250),{searchResults:m,searchHasResolved:u}=(0,gt.useSelect)((n=>{if(!a)return{searchResults:Cf,searchHasResolved:!0};const{getEntityRecords:o,hasFinishedResolution:r}=n(dt.store),l=["taxonomy",e.slug,{...Sf,search:a,orderby:"name",exclude:t,per_page:20}];return{searchResults:o(...l),searchHasResolved:r("getEntityRecords",l)}}),[a,t]),p=(0,gt.useSelect)((n=>{if(!t?.length)return Cf;const{getEntityRecords:a}=n(dt.store);return a("taxonomy",e.slug,{...Sf,include:t,per_page:t.length})}),[t]);(0,_t.useEffect)((()=>{if(t?.length||l(Cf),!p?.length)return;const e=t.reduce(((e,t)=>{const n=p.find((e=>e.id===t));return n&&e.push({id:t,value:n.name}),e}),[]);l(e)}),[t,p]),(0,_t.useEffect)((()=>{u&&s(m.map((e=>e.name)))}),[m,u]);return(0,Ke.createElement)("div",{className:"block-library-query-inspector__taxonomy-control"},(0,Ke.createElement)(et.FormTokenField,{label:e.name,value:r,onInputChange:c,suggestions:i,displayTransform:Jn.decodeEntities,onChange:e=>{const t=new Set;for(const n of e){const e=Bf(m,n);e&&t.add(e)}s(Cf),n(Array.from(t))},__experimentalShowHowTo:!1}))}const If=[{label:(0,tt.__)("Include"),value:""},{label:(0,tt.__)("Exclude"),value:"exclude"},{label:(0,tt.__)("Only"),value:"only"}];function Pf({value:e,onChange:t}){return(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Sticky posts"),options:If,value:e,onChange:t,help:(0,tt.__)("Blog posts can be “stickied”, a feature that places them at the top of the front page of posts, keeping it there until new sticky posts are published.")})}function Mf({enhancedPagination:e,setAttributes:t,clientId:n}){const{hasUnsupportedBlocks:a}=bf(n);let o=(0,tt.__)("Browsing between pages requires a full page reload.");return e?o=(0,tt.__)("Browsing between pages won't require a full page reload, unless non-compatible blocks are detected."):a&&(o=(0,tt.__)("Force page reload can't be disabled because there are non-compatible blocks inside the Query block.")),(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ToggleControl,{label:(0,tt.__)("Force page reload"),help:o,checked:!e,disabled:a,onChange:e=>{t({enhancedPagination:!e})}}))}const zf=({attributes:{query:{postType:e}={}}={}})=>{if(!e)return null;const t=(0,pt.addQueryArgs)("post-new.php",{post_type:e});return(0,Ke.createElement)("div",{className:"wp-block-query__create-new-link"},(0,_t.createInterpolateElement)((0,tt.__)("<a>Add new post</a>"),{a:(0,Ke.createElement)("a",{href:t})}))},{BlockInfo:Rf}=Ft(nt.privateApis);function Af(e){const{attributes:t,setQuery:n,setDisplayLayout:a,setAttributes:o,clientId:r}=e,{query:l,displayLayout:i,enhancedPagination:s}=t,{order:c,orderBy:m,author:u,postType:p,sticky:d,inherit:g,taxQuery:h,parents:b}=l,_=function(e){return(0,gt.useSelect)((t=>t(Qe.store).getActiveBlockVariation("core/query",e)?.allowedControls),[e])}(t),[y,v]=(0,_t.useState)("post"===p),{postTypesTaxonomiesMap:f,postTypesSelectOptions:k}=uf(),x=pf(p),w=function(e){return(0,gt.useSelect)((t=>{const n=t(dt.store).getPostType(e);return n?.viewable&&n?.hierarchical}),[e])}(p);(0,_t.useEffect)((()=>{v("post"===p)}),[p]);const[E,C]=(0,_t.useState)(l.search),S=(0,_t.useCallback)((0,jt.debounce)((()=>{l.search!==E&&n({search:E})}),250),[E,l.search]);(0,_t.useEffect)((()=>(S(),S.cancel)),[E,S]);const B=df(_,"inherit"),N=!g&&df(_,"postType"),T=!g&&df(_,"order"),I=!g&&y&&df(_,"sticky"),P=B||N||T||I,M=!!x?.length&&df(_,"taxQuery"),z=df(_,"author"),R=df(_,"search"),A=df(_,"parents")&&w,H=M||z||R||A;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(Rf,null,(0,Ke.createElement)(zf,{...e})),P&&(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},B&&(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Inherit query from template"),help:(0,tt.__)("Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently."),checked:!!g,onChange:e=>n({inherit:!!e})}),N&&(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,options:k,value:p,label:(0,tt.__)("Post type"),onChange:e=>{const t={postType:e},a=f[e],o=Object.entries(h||{}).reduce(((e,[t,n])=>(a.includes(t)&&(e[t]=n),e)),{});t.taxQuery=Object.keys(o).length?o:void 0,"post"!==e&&(t.sticky=""),t.parents=[],n(t)},help:(0,tt.__)("WordPress contains different types of content and they are divided into collections called “Post types”. By default there are a few different ones such as blog posts and pages, but plugins could add more.")}),false,T&&(0,Ke.createElement)(vf,{order:c,orderBy:m,onChange:n}),I&&(0,Ke.createElement)(Pf,{value:d,onChange:e=>n({sticky:e})}),(0,Ke.createElement)(Mf,{enhancedPagination:s,setAttributes:o,clientId:r})),!g&&H&&(0,Ke.createElement)(et.__experimentalToolsPanel,{className:"block-library-query-toolspanel__filters",label:(0,tt.__)("Filters"),resetAll:()=>{n({author:"",parents:[],search:"",taxQuery:null}),C("")},dropdownMenuProps:op},M&&(0,Ke.createElement)(et.__experimentalToolsPanelItem,{label:(0,tt.__)("Taxonomies"),hasValue:()=>Object.values(h||{}).some((e=>!!e.length)),onDeselect:()=>n({taxQuery:null})},(0,Ke.createElement)(Nf,{onChange:n,query:l})),z&&(0,Ke.createElement)(et.__experimentalToolsPanelItem,{hasValue:()=>!!u,label:(0,tt.__)("Authors"),onDeselect:()=>n({author:""})},(0,Ke.createElement)(kf,{value:u,onChange:n})),R&&(0,Ke.createElement)(et.__experimentalToolsPanelItem,{hasValue:()=>!!E,label:(0,tt.__)("Keyword"),onDeselect:()=>C("")},(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Keyword"),value:E,onChange:C})),A&&(0,Ke.createElement)(et.__experimentalToolsPanelItem,{hasValue:()=>!!b?.length,label:(0,tt.__)("Parents"),onDeselect:()=>n({parents:[]})},(0,Ke.createElement)(Ef,{parents:b,postType:p,onChange:n}))))}const Hf="wp-block-query-enhanced-pagination-modal__description";function Lf({clientId:e,attributes:{enhancedPagination:t},setAttributes:n}){const[a,o]=(0,_t.useState)(!1),{hasBlocksFromPlugins:r,hasPostContentBlock:l,hasUnsupportedBlocks:i}=bf(e);(0,_t.useEffect)((()=>{t&&i&&(n({enhancedPagination:!1}),o(!0))}),[t,i,n]);const s=()=>{o(!1)};let c=(0,tt.__)('If you still want to prevent full page reloads, remove that block, then disable "Force page reload" again in the Query Block settings.');return r?c=(0,tt.__)("Currently, avoiding full page reloads is not possible when non-interactive or non-clientNavigation compatible blocks from plugins are present inside the Query block.")+" "+c:l&&(c=(0,tt.__)("Currently, avoiding full page reloads is not possible when a Content block is present inside the Query block.")+" "+c),a&&(0,Ke.createElement)(et.Modal,{title:(0,tt.__)("Query block: Force page reload enabled"),className:"wp-block-query__enhanced-pagination-modal",aria:{describedby:Hf},role:"alertdialog",focusOnMount:"firstElement",isDismissible:!1,onRequestClose:s},(0,Ke.createElement)(et.__experimentalVStack,{alignment:"right",spacing:5},(0,Ke.createElement)("span",{id:Hf},c),(0,Ke.createElement)(et.Button,{variant:"primary",onClick:s},(0,tt.__)("OK"))))}const Df=[["core/post-template"]];function Ff({attributes:e,setAttributes:t,openPatternSelectionModal:n,name:a,clientId:o}){const{queryId:r,query:l,displayLayout:i,tagName:s="div",query:{inherit:c}={}}=e,{__unstableMarkNextChangeAsNotPersistent:m}=(0,gt.useDispatch)(nt.store),u=(0,jt.useInstanceId)(Ff),p=(0,nt.useBlockProps)(),d=(0,nt.useInnerBlocksProps)(p,{template:Df}),{postsPerPage:g}=(0,gt.useSelect)((e=>{const{getSettings:t}=e(nt.store),{getEntityRecord:n,canUser:a}=e(dt.store);return{postsPerPage:(a("read","settings")?+n("root","site")?.posts_per_page:+t().postsPerPage)||3}}),[]);(0,_t.useEffect)((()=>{const e={};(c&&l.perPage!==g||!l.perPage&&g)&&(e.perPage=g),Object.keys(e).length&&(m(),h(e))}),[l.perPage,g,c]),(0,_t.useEffect)((()=>{Number.isFinite(r)||(m(),t({queryId:u}))}),[r,u]);const h=e=>t({query:{...l,...e}}),b={main:(0,tt.__)("The <main> element should be used for the primary content of your document only. "),section:(0,tt.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element."),aside:(0,tt.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.")};return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(Lf,{attributes:e,setAttributes:t,clientId:o}),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(Af,{attributes:e,setQuery:h,setDisplayLayout:e=>t({displayLayout:{...i,...e}}),setAttributes:t,clientId:o})),(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(_f,{name:a,clientId:o,attributes:e,setQuery:h,openPatternSelectionModal:n})),(0,Ke.createElement)(nt.InspectorControls,{group:"advanced"},(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("HTML element"),options:[{label:(0,tt.__)("Default (<div>)"),value:"div"},{label:"<main>",value:"main"},{label:"<section>",value:"section"},{label:"<aside>",value:"aside"}],value:s,onChange:e=>t({tagName:e}),help:b[s]})),(0,Ke.createElement)(s,{...d}))}function Vf({attributes:e,clientId:t,name:n,openPatternSelectionModal:a,setAttributes:o}){const[r,l]=(0,_t.useState)(!1),i=(0,nt.useBlockProps)(),s=gf(t,e),{blockType:c,activeBlockVariation:m,hasPatterns:u}=(0,gt.useSelect)((a=>{const{getActiveBlockVariation:o,getBlockType:r}=a(Qe.store),{getBlockRootClientId:l,getPatternsByBlockTypes:i}=a(nt.store),c=l(t);return{blockType:r(n),activeBlockVariation:o(n,e),hasPatterns:!!i(s,c).length}}),[n,s,t,e]),p=m?.icon?.src||m?.icon||c?.icon?.src,d=m?.title||c?.title;return r?(0,Ke.createElement)($f,{clientId:t,attributes:e,setAttributes:o,icon:p,label:d}):(0,Ke.createElement)("div",{...i},(0,Ke.createElement)(et.Placeholder,{icon:p,label:d,instructions:(0,tt.__)("Choose a pattern for the query loop or start blank.")},!!u&&(0,Ke.createElement)(et.Button,{variant:"primary",onClick:a},(0,tt.__)("Choose")),(0,Ke.createElement)(et.Button,{variant:"secondary",onClick:()=>{l(!0)}},(0,tt.__)("Start blank"))))}function $f({clientId:e,attributes:t,setAttributes:n,icon:a,label:o}){const r=function(e){const{activeVariationName:t,blockVariations:n}=(0,gt.useSelect)((t=>{const{getActiveBlockVariation:n,getBlockVariations:a}=t(Qe.store);return{activeVariationName:n("core/query",e)?.name,blockVariations:a("core/query","block")}}),[e]);return(0,_t.useMemo)((()=>{const e=e=>!e.attributes?.namespace;if(!t)return n.filter(e);const a=n.filter((e=>e.attributes?.namespace?.includes(t)));return a.length?a:n.filter(e)}),[t,n])}(t),{replaceInnerBlocks:l}=(0,gt.useDispatch)(nt.store),i=(0,nt.useBlockProps)();return(0,Ke.createElement)("div",{...i},(0,Ke.createElement)(nt.__experimentalBlockVariationPicker,{icon:a,label:o,variations:r,onSelect:a=>{a.attributes&&n({...a.attributes,query:{...a.attributes.query,postType:t.query.postType||a.attributes.query.postType},namespace:t.namespace}),a.innerBlocks&&l(e,(0,Qe.createBlocksFromInnerBlocksTemplate)(a.innerBlocks),!1)}}))}function Of(e=""){return e=(e=nc()(e)).trim().toLowerCase()}function Gf(e,t){const n=Of(t),a=Of(e.title);let o=0;if(n===a)o+=30;else if(a.startsWith(n))o+=20;else{n.split(" ").every((e=>a.includes(e)))&&(o+=10)}return o}function Uf(e=[],t=""){if(!t)return e;const n=e.map((e=>[e,Gf(e,t)])).filter((([,e])=>e>0));return n.sort((([,e],[,t])=>t-e)),n.map((([e])=>e))}function qf({clientId:e,attributes:t,setIsPatternSelectionModalOpen:n}){const[a,o]=(0,_t.useState)(""),{replaceBlock:r,selectBlock:l}=(0,gt.useDispatch)(nt.store),i=(0,_t.useMemo)((()=>({previewPostType:t.query.postType})),[t.query.postType]),s=gf(e,t),c=hf(e,s),m=(0,_t.useMemo)((()=>Uf(c,a)),[c,a]),u=(0,jt.useAsyncList)(m);return(0,Ke.createElement)(et.Modal,{overlayClassName:"block-library-query-pattern__selection-modal",title:(0,tt.__)("Choose a pattern"),onRequestClose:()=>n(!1),isFullScreen:!0},(0,Ke.createElement)("div",{className:"block-library-query-pattern__selection-content"},(0,Ke.createElement)("div",{className:"block-library-query-pattern__selection-search"},(0,Ke.createElement)(et.SearchControl,{__nextHasNoMarginBottom:!0,onChange:o,value:a,label:(0,tt.__)("Search for patterns"),placeholder:(0,tt.__)("Search")})),(0,Ke.createElement)(nt.BlockContextProvider,{value:i},(0,Ke.createElement)(nt.__experimentalBlockPatternsList,{blockPatterns:m,shownPatterns:u,onClickPattern:(n,a)=>{const{newBlocks:o,queryClientIds:i}=((e,t)=>{const{query:{postType:n,inherit:a}}=t,o=e.map((e=>(0,Qe.cloneBlock)(e))),r=[],l=[...o];for(;l.length>0;){const e=l.shift();"core/query"===e.name&&(e.attributes.query={...e.attributes.query,postType:n,inherit:a},r.push(e.clientId)),e.innerBlocks?.forEach((e=>{l.push(e)}))}return{newBlocks:o,queryClientIds:r}})(a,t);r(e,o),i[0]&&l(i[0])}}))))}const jf=e=>{const{clientId:t,attributes:n}=e,[a,o]=(0,_t.useState)(!1),r=(0,gt.useSelect)((e=>!!e(nt.store).getBlocks(t).length),[t])?Ff:Vf;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(r,{...e,openPatternSelectionModal:()=>o(!0)}),a&&(0,Ke.createElement)(qf,{clientId:t,attributes:n,setIsPatternSelectionModalOpen:o}))};const Wf=(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48"},(0,Ke.createElement)(et.Path,{d:"M41 9H7v3h34V9zm-22 5H7v1h12v-1zM7 26h12v1H7v-1zm34-5H7v3h34v-3zM7 38h12v1H7v-1zm34-5H7v3h34v-3z"})),Zf=(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48"},(0,Ke.createElement)(et.Path,{d:"M41 9H7v3h34V9zm-4 5H7v1h30v-1zm4 3H7v1h34v-1zM7 20h30v1H7v-1zm0 12h30v1H7v-1zm34 3H7v1h34v-1zM7 38h30v1H7v-1zm34-11H7v3h34v-3z"})),Qf=(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48"},(0,Ke.createElement)(et.Path,{d:"M41 9H7v3h34V9zm-22 5H7v1h12v-1zm22 3H7v1h34v-1zM7 20h34v1H7v-1zm0 12h12v1H7v-1zm34 3H7v1h34v-1zM7 38h34v1H7v-1zm34-11H7v3h34v-3z"})),Kf=(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48"},(0,Ke.createElement)(et.Path,{d:"M7 9h34v6H7V9zm12 8H7v1h12v-1zm18 3H7v1h30v-1zm0 18H7v1h30v-1zM7 35h12v1H7v-1zm34-8H7v6h34v-6z"})),Yf={query:{perPage:3,pages:0,offset:0,postType:"post",order:"desc",orderBy:"date",author:"",search:"",exclude:[],sticky:"",inherit:!1}},Jf=[{name:"posts-list",title:(0,tt.__)("Posts List"),description:(0,tt.__)("Display a list of your most recent posts, excluding sticky posts."),icon:Sp,attributes:{namespace:"core/posts-list",query:{perPage:4,pages:1,offset:0,postType:"post",order:"desc",orderBy:"date",author:"",search:"",sticky:"exclude",inherit:!1}},scope:["inserter"],isActive:({namespace:e,query:t})=>"core/posts-list"===e&&"post"===t.postType},{name:"title-date",title:(0,tt.__)("Title & Date"),icon:Wf,attributes:{...Yf},innerBlocks:[["core/post-template",{},[["core/post-title"],["core/post-date"]]],["core/query-pagination"],["core/query-no-results"]],scope:["block"]},{name:"title-excerpt",title:(0,tt.__)("Title & Excerpt"),icon:Zf,attributes:{...Yf},innerBlocks:[["core/post-template",{},[["core/post-title"],["core/post-excerpt"]]],["core/query-pagination"],["core/query-no-results"]],scope:["block"]},{name:"title-date-excerpt",title:(0,tt.__)("Title, Date, & Excerpt"),icon:Qf,attributes:{...Yf},innerBlocks:[["core/post-template",{},[["core/post-title"],["core/post-date"],["core/post-excerpt"]]],["core/query-pagination"],["core/query-no-results"]],scope:["block"]},{name:"image-date-title",title:(0,tt.__)("Image, Date, & Title"),icon:Kf,attributes:{...Yf},innerBlocks:[["core/post-template",{},[["core/post-featured-image"],["core/post-date"],["core/post-title"]]],["core/query-pagination"],["core/query-no-results"]],scope:["block"]}],{cleanEmptyObject:Xf}=Ft(nt.privateApis),ek=e=>{const{query:t}=e,{categoryIds:n,tagIds:a,...o}=t;return(t.categoryIds?.length||t.tagIds?.length)&&(o.taxQuery={category:t.categoryIds?.length?t.categoryIds:void 0,post_tag:t.tagIds?.length?t.tagIds:void 0}),{...e,query:o}},tk=(e,t)=>{const{style:n,backgroundColor:a,gradient:o,textColor:r,...l}=e;if(!(a||o||r||n?.color||n?.elements?.link))return[e,t];if(n&&(l.style=Xf({...n,color:void 0,elements:{...n.elements,link:void 0}})),nk(t)){const e=t[0],i=n?.color||n?.elements?.link||e.attributes.style?Xf({...e.attributes.style,color:n?.color,elements:n?.elements?.link?{link:n?.elements?.link}:void 0}):void 0;return[l,[(0,Qe.createBlock)("core/group",{...e.attributes,backgroundColor:a,gradient:o,textColor:r,style:i},e.innerBlocks)]]}return[l,[(0,Qe.createBlock)("core/group",{backgroundColor:a,gradient:o,textColor:r,style:Xf({color:n?.color,elements:n?.elements?.link?{link:n?.elements?.link}:void 0})},t)]]},nk=(e=[])=>1===e.length&&"core/group"===e[0].name,ak=e=>{const{layout:t=null}=e;if(!t)return e;const{inherit:n=null,contentSize:a=null,...o}=t;return n||a?{...e,layout:{...o,contentSize:a,type:"constrained"}}:e},ok=(e=[])=>{let t=null;for(const n of e){if("core/post-template"===n.name){t=n;break}n.innerBlocks.length&&(t=ok(n.innerBlocks))}return t},rk=(e=[],t)=>(e.forEach(((n,a)=>{"core/post-template"===n.name?e.splice(a,1,t):n.innerBlocks.length&&(n.innerBlocks=rk(n.innerBlocks,t))})),e),lk=(e,t)=>{const{displayLayout:n=null,...a}=e;if(!n)return[e,t];const o=ok(t);if(!o)return[e,t];const{type:r,columns:l}=n,i="flex"===r?"grid":"default",s=(0,Qe.createBlock)("core/post-template",{...o.attributes,layout:{type:i,...l&&{columnCount:l}}},o.innerBlocks);return[a,rk(t,s)]},ik={attributes:{queryId:{type:"number"},query:{type:"object",default:{perPage:null,pages:0,offset:0,postType:"post",categoryIds:[],tagIds:[],order:"desc",orderBy:"date",author:"",search:"",exclude:[],sticky:"",inherit:!0}},layout:{type:"object",default:{type:"list"}}},supports:{html:!1},migrate(e,t){const n=ek(e),{layout:a,...o}=n,r={...o,displayLayout:n.layout};return lk(r,t)},save:()=>(0,Ke.createElement)(nt.InnerBlocks.Content,null)},sk={attributes:{queryId:{type:"number"},query:{type:"object",default:{perPage:null,pages:0,offset:0,postType:"post",categoryIds:[],tagIds:[],order:"desc",orderBy:"date",author:"",search:"",exclude:[],sticky:"",inherit:!0}},tagName:{type:"string",default:"div"},displayLayout:{type:"object",default:{type:"list"}}},supports:{align:["wide","full"],html:!1,color:{gradients:!0,link:!0},layout:!0},isEligible:({query:{categoryIds:e,tagIds:t}={}})=>e||t,migrate(e,t){const n=ek(e),[a,o]=tk(n,t),r=ak(a);return lk(r,o)},save({attributes:{tagName:e="div"}}){const t=nt.useBlockProps.save(),n=nt.useInnerBlocksProps.save(t);return(0,Ke.createElement)(e,{...n})}},ck={attributes:{queryId:{type:"number"},query:{type:"object",default:{perPage:null,pages:0,offset:0,postType:"post",order:"desc",orderBy:"date",author:"",search:"",exclude:[],sticky:"",inherit:!0,taxQuery:null,parents:[]}},tagName:{type:"string",default:"div"},displayLayout:{type:"object",default:{type:"list"}},namespace:{type:"string"}},supports:{align:["wide","full"],html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},layout:!0},isEligible(e){const{style:t,backgroundColor:n,gradient:a,textColor:o}=e;return n||a||o||t?.color||t?.elements?.link},migrate(e,t){const[n,a]=tk(e,t),o=ak(n);return lk(o,a)},save({attributes:{tagName:e="div"}}){const t=nt.useBlockProps.save(),n=nt.useInnerBlocksProps.save(t);return(0,Ke.createElement)(e,{...n})}},mk={attributes:{queryId:{type:"number"},query:{type:"object",default:{perPage:null,pages:0,offset:0,postType:"post",order:"desc",orderBy:"date",author:"",search:"",exclude:[],sticky:"",inherit:!0,taxQuery:null,parents:[]}},tagName:{type:"string",default:"div"},displayLayout:{type:"object",default:{type:"list"}},namespace:{type:"string"}},supports:{align:["wide","full"],html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},layout:!0},save({attributes:{tagName:e="div"}}){const t=nt.useBlockProps.save(),n=nt.useInnerBlocksProps.save(t);return(0,Ke.createElement)(e,{...n})},isEligible:({layout:e})=>e?.inherit||e?.contentSize&&"constrained"!==e?.type,migrate(e,t){const n=ak(e);return lk(n,t)}},uk=[{attributes:{queryId:{type:"number"},query:{type:"object",default:{perPage:null,pages:0,offset:0,postType:"post",order:"desc",orderBy:"date",author:"",search:"",exclude:[],sticky:"",inherit:!0,taxQuery:null,parents:[]}},tagName:{type:"string",default:"div"},displayLayout:{type:"object",default:{type:"list"}},namespace:{type:"string"}},supports:{align:["wide","full"],anchor:!0,html:!1,layout:!0},save({attributes:{tagName:e="div"}}){const t=nt.useBlockProps.save(),n=nt.useInnerBlocksProps.save(t);return(0,Ke.createElement)(e,{...n})},isEligible:({displayLayout:e})=>!!e,migrate:lk},mk,ck,sk,ik],pk={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/query",title:"Query Loop",category:"theme",description:"An advanced block that allows displaying post types based on different query parameters and visual configurations.",textdomain:"default",attributes:{queryId:{type:"number"},query:{type:"object",default:{perPage:null,pages:0,offset:0,postType:"post",order:"desc",orderBy:"date",author:"",search:"",exclude:[],sticky:"",inherit:!0,taxQuery:null,parents:[]}},tagName:{type:"string",default:"div"},namespace:{type:"string"},enhancedPagination:{type:"boolean",default:!1}},providesContext:{queryId:"queryId",query:"query",displayLayout:"displayLayout",enhancedPagination:"enhancedPagination"},supports:{align:["wide","full"],html:!1,layout:!0,interactivity:!0},editorStyle:"wp-block-query-editor"},{name:dk}=pk,gk={icon:rf,edit:jf,save:function({attributes:{tagName:e="div"}}){const t=nt.useBlockProps.save(),n=nt.useInnerBlocksProps.save(t);return(0,Ke.createElement)(e,{...n})},variations:Jf,deprecated:uk},hk=()=>Xe({name:dk,metadata:pk,settings:gk}),bk=[["core/paragraph",{placeholder:(0,tt.__)("Add text or blocks that will display when a query returns no results.")}]];const _k={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/query-no-results",title:"No results",category:"theme",description:"Contains the block elements used to render content when no query results are found.",parent:["core/query"],textdomain:"default",usesContext:["queryId","query"],supports:{align:!0,reusable:!1,html:!1,color:{gradients:!0,link:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:yk}=_k,vk={icon:rf,edit:function(){const e=(0,nt.useBlockProps)(),t=(0,nt.useInnerBlocksProps)(e,{template:bk});return(0,Ke.createElement)("div",{...t})},save:function(){return(0,Ke.createElement)(nt.InnerBlocks.Content,null)}},fk=()=>Xe({name:yk,metadata:_k,settings:vk});function kk({value:e,onChange:t}){return(0,Ke.createElement)(et.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Arrow"),value:e,onChange:t,help:(0,tt.__)("A decorative arrow appended to the next and previous page link."),isBlock:!0},(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"none",label:(0,tt._x)("None","Arrow option for Query Pagination Next/Previous blocks")}),(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"arrow",label:(0,tt._x)("Arrow","Arrow option for Query Pagination Next/Previous blocks")}),(0,Ke.createElement)(et.__experimentalToggleGroupControlOption,{value:"chevron",label:(0,tt._x)("Chevron","Arrow option for Query Pagination Next/Previous blocks")}))}function xk({value:e,onChange:t}){return(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show label text"),help:(0,tt.__)('Toggle off to hide the label text, e.g. "Next Page".'),onChange:t,checked:!0===e})}const wk=[["core/query-pagination-previous"],["core/query-pagination-numbers"],["core/query-pagination-next"]];const Ek=[{save:()=>(0,Ke.createElement)("div",{...nt.useBlockProps.save()},(0,Ke.createElement)(nt.InnerBlocks.Content,null))}],Ck={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/query-pagination",title:"Pagination",category:"theme",ancestor:["core/query"],allowedBlocks:["core/query-pagination-previous","core/query-pagination-numbers","core/query-pagination-next"],description:"Displays a paginated navigation to next/previous set of posts, when applicable.",textdomain:"default",attributes:{paginationArrow:{type:"string",default:"none"},showLabel:{type:"boolean",default:!0}},usesContext:["queryId","query"],providesContext:{paginationArrow:"paginationArrow",showLabel:"showLabel"},supports:{align:!0,reusable:!1,html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},layout:{allowSwitching:!1,allowInheriting:!1,default:{type:"flex"}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-query-pagination-editor",style:"wp-block-query-pagination"},{name:Sk}=Ck,Bk={icon:sr,edit:function({attributes:{paginationArrow:e,showLabel:t},setAttributes:n,clientId:a}){const o=(0,gt.useSelect)((e=>{const{getBlocks:t}=e(nt.store),n=t(a);return n?.find((e=>["core/query-pagination-next","core/query-pagination-previous"].includes(e.name)))}),[a]),r=(0,nt.useBlockProps)(),l=(0,nt.useInnerBlocksProps)(r,{template:wk});return(0,_t.useEffect)((()=>{"none"!==e||t||n({showLabel:!0})}),[e,n,t]),(0,Ke.createElement)(Ke.Fragment,null,o&&(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(kk,{value:e,onChange:e=>{n({paginationArrow:e})}}),"none"!==e&&(0,Ke.createElement)(xk,{value:t,onChange:e=>{n({showLabel:e})}}))),(0,Ke.createElement)("nav",{...l}))},save:function(){return(0,Ke.createElement)(nt.InnerBlocks.Content,null)},deprecated:Ek},Nk=()=>Xe({name:Sk,metadata:Ck,settings:Bk}),Tk={none:"",arrow:"→",chevron:"»"};const Ik={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/query-pagination-next",title:"Next Page",category:"theme",parent:["core/query-pagination"],description:"Displays the next posts page link.",textdomain:"default",attributes:{label:{type:"string"}},usesContext:["queryId","query","paginationArrow","showLabel","enhancedPagination"],supports:{reusable:!1,html:!1,color:{gradients:!0,text:!1,__experimentalDefaultControls:{background:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:Pk}=Ik,Mk={icon:hr,edit:function({attributes:{label:e},setAttributes:t,context:{paginationArrow:n,showLabel:a}}){const o=Tk[n];return(0,Ke.createElement)("a",{href:"#pagination-next-pseudo-link",onClick:e=>e.preventDefault(),...(0,nt.useBlockProps)()},a&&(0,Ke.createElement)(nt.PlainText,{__experimentalVersion:2,tagName:"span","aria-label":(0,tt.__)("Next page link"),placeholder:(0,tt.__)("Next Page"),value:e,onChange:e=>t({label:e})}),o&&(0,Ke.createElement)("span",{className:`wp-block-query-pagination-next-arrow is-arrow-${n}`,"aria-hidden":!0},o))}},zk=()=>Xe({name:Pk,metadata:Ik,settings:Mk}),Rk=(e,t="a",n="")=>(0,Ke.createElement)(t,{key:e,className:`page-numbers ${n}`},e);const Ak={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/query-pagination-numbers",title:"Page Numbers",category:"theme",parent:["core/query-pagination"],description:"Displays a list of page numbers for pagination.",textdomain:"default",attributes:{midSize:{type:"number",default:2}},usesContext:["queryId","query","enhancedPagination"],supports:{reusable:!1,html:!1,color:{gradients:!0,text:!1,__experimentalDefaultControls:{background:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-query-pagination-numbers-editor"},{name:Hk}=Ak,Lk={icon:kr,edit:function({attributes:e,setAttributes:t}){const{midSize:n}=e,a=(e=>{const t=[];for(let n=1;n<=e;n++)t.push(Rk(n));t.push(Rk(e+1,"span","current"));for(let n=1;n<=e;n++)t.push(Rk(e+1+n));return t.push(Rk("...","span","dots")),t.push(Rk(2*e+3)),(0,Ke.createElement)(Ke.Fragment,null,t)})(parseInt(n,10));return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.RangeControl,{label:(0,tt.__)("Number of links"),help:(0,tt.__)("Specify how many links can appear before and after the current page number. Links to the first, current and last page are always visible."),value:n,onChange:e=>{t({midSize:parseInt(e,10)})},min:0,max:5,withInputField:!1}))),(0,Ke.createElement)("div",{...(0,nt.useBlockProps)()},a))}},Dk=()=>Xe({name:Hk,metadata:Ak,settings:Lk}),Fk={none:"",arrow:"←",chevron:"«"};const Vk={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/query-pagination-previous",title:"Previous Page",category:"theme",parent:["core/query-pagination"],description:"Displays the previous posts page link.",textdomain:"default",attributes:{label:{type:"string"}},usesContext:["queryId","query","paginationArrow","showLabel","enhancedPagination"],supports:{reusable:!1,html:!1,color:{gradients:!0,text:!1,__experimentalDefaultControls:{background:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:$k}=Vk,Ok={icon:nr,edit:function({attributes:{label:e},setAttributes:t,context:{paginationArrow:n,showLabel:a}}){const o=Fk[n];return(0,Ke.createElement)("a",{href:"#pagination-previous-pseudo-link",onClick:e=>e.preventDefault(),...(0,nt.useBlockProps)()},o&&(0,Ke.createElement)("span",{className:`wp-block-query-pagination-previous-arrow is-arrow-${n}`,"aria-hidden":!0},o),a&&(0,Ke.createElement)(nt.PlainText,{__experimentalVersion:2,tagName:"span","aria-label":(0,tt.__)("Previous page link"),placeholder:(0,tt.__)("Previous Page"),value:e,onChange:e=>t({label:e})}))}},Gk=()=>Xe({name:$k,metadata:Vk,settings:Ok}),Uk=["archive","search"];const qk=[{isDefault:!0,name:"archive-title",title:(0,tt.__)("Archive Title"),description:(0,tt.__)("Display the archive title based on the queried object."),icon:Br,attributes:{type:"archive"},scope:["inserter"]},{isDefault:!1,name:"search-title",title:(0,tt.__)("Search Results Title"),description:(0,tt.__)("Display the search results title based on the queried object."),icon:Br,attributes:{type:"search"},scope:["inserter"]}];qk.forEach((e=>{e.isActive||(e.isActive=(e,t)=>e.type===t.type)}));const jk=qk,Wk={attributes:{type:{type:"string"},textAlign:{type:"string"},level:{type:"number",default:1}},supports:{align:["wide","full"],html:!1,color:{gradients:!0},spacing:{margin:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0}},save:()=>null,migrate:ln,isEligible:({style:e})=>e?.typography?.fontFamily},Zk=[Wk],Qk={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/query-title",title:"Query Title",category:"theme",description:"Display the query title.",textdomain:"default",attributes:{type:{type:"string"},textAlign:{type:"string"},level:{type:"number",default:1},showPrefix:{type:"boolean",default:!0},showSearchTerm:{type:"boolean",default:!0}},supports:{align:["wide","full"],html:!1,color:{gradients:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},style:"wp-block-query-title"},{name:Kk}=Qk,Yk={icon:Br,edit:function({attributes:{type:e,level:t,textAlign:n,showPrefix:a,showSearchTerm:o},setAttributes:r}){const{archiveTypeTitle:l,archiveNameLabel:i}=(0,gt.useSelect)((e=>{const{getSettings:t}=e(nt.store),{__experimentalArchiveTitleNameLabel:n,__experimentalArchiveTitleTypeLabel:a}=t();return{archiveTypeTitle:a,archiveNameLabel:n}})),s=`h${t}`,c=(0,nt.useBlockProps)({className:ut()("wp-block-query-title__placeholder",{[`has-text-align-${n}`]:n})});if(!Uk.includes(e))return(0,Ke.createElement)("div",{...c},(0,Ke.createElement)(nt.Warning,null,(0,tt.__)("Provided type is not supported.")));let m;if("archive"===e){let e;e=l?a?i?(0,tt.sprintf)((0,tt.__)("%1$s: %2$s"),l,i):(0,tt.sprintf)((0,tt.__)("%s: Name"),l):i||(0,tt.sprintf)((0,tt.__)("%s name"),l):a?(0,tt.__)("Archive type: Name"):(0,tt.__)("Archive title"),m=(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show archive type in title"),onChange:()=>r({showPrefix:!a}),checked:a}))),(0,Ke.createElement)(s,{...c},e))}return"search"===e&&(m=(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show search term in title"),onChange:()=>r({showSearchTerm:!o}),checked:o}))),(0,Ke.createElement)(s,{...c},o?(0,tt.__)("Search results for: “search term”"):(0,tt.__)("Search results")))),(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.HeadingLevelDropdown,{value:t,onChange:e=>r({level:e})}),(0,Ke.createElement)(nt.AlignmentControl,{value:n,onChange:e=>{r({textAlign:e})}})),m)},variations:jk,deprecated:Zk},Jk=()=>Xe({name:Kk,metadata:Qk,settings:Yk}),Xk=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M13 6v6h5.2v4c0 .8-.2 1.4-.5 1.7-.6.6-1.6.6-2.5.5h-.3v1.5h.5c1 0 2.3-.1 3.3-1 .6-.6 1-1.6 1-2.8V6H13zm-9 6h5.2v4c0 .8-.2 1.4-.5 1.7-.6.6-1.6.6-2.5.5h-.3v1.5h.5c1 0 2.3-.1 3.3-1 .6-.6 1-1.6 1-2.8V6H4v6z"})),ex=e=>{const{value:t,...n}=e;return[{...n},t?(0,Qe.parseWithAttributeSchema)(t,{type:"array",source:"query",selector:"p",query:{content:{type:"string",source:"html"}}}).map((({content:e})=>(0,Qe.createBlock)("core/paragraph",{content:e}))):(0,Qe.createBlock)("core/paragraph")]},tx={attributes:{value:{type:"string",source:"html",selector:"blockquote",multiline:"p",default:"",__experimentalRole:"content"},citation:{type:"string",source:"html",selector:"cite",default:"",__experimentalRole:"content"},align:{type:"string"}},supports:{anchor:!0,__experimentalSlashInserter:!0,typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalDefaultControls:{fontSize:!0,fontAppearance:!0}}},save({attributes:e}){const{align:t,value:n,citation:a}=e,o=ut()({[`has-text-align-${t}`]:t});return(0,Ke.createElement)("blockquote",{...nt.useBlockProps.save({className:o})},(0,Ke.createElement)(nt.RichText.Content,{multiline:!0,value:n}),!nt.RichText.isEmpty(a)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:a}))},migrate:ex},nx={attributes:{value:{type:"string",source:"html",selector:"blockquote",multiline:"p",default:""},citation:{type:"string",source:"html",selector:"cite",default:""},align:{type:"string"}},migrate:ex,save({attributes:e}){const{align:t,value:n,citation:a}=e;return(0,Ke.createElement)("blockquote",{style:{textAlign:t||null}},(0,Ke.createElement)(nt.RichText.Content,{multiline:!0,value:n}),!nt.RichText.isEmpty(a)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:a}))}},ax={attributes:{value:{type:"string",source:"html",selector:"blockquote",multiline:"p",default:""},citation:{type:"string",source:"html",selector:"cite",default:""},align:{type:"string"},style:{type:"number",default:1}},migrate(e){if(2===e.style){const{style:t,...n}=e;return ex({...n,className:e.className?e.className+" is-style-large":"is-style-large"})}return ex(e)},save({attributes:e}){const{align:t,value:n,citation:a,style:o}=e;return(0,Ke.createElement)("blockquote",{className:2===o?"is-large":"",style:{textAlign:t||null}},(0,Ke.createElement)(nt.RichText.Content,{multiline:!0,value:n}),!nt.RichText.isEmpty(a)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:a}))}},ox={attributes:{value:{type:"string",source:"html",selector:"blockquote",multiline:"p",default:""},citation:{type:"string",source:"html",selector:"footer",default:""},align:{type:"string"},style:{type:"number",default:1}},migrate(e){if(!isNaN(parseInt(e.style))){const{style:t,...n}=e;return ex({...n})}return ex(e)},save({attributes:e}){const{align:t,value:n,citation:a,style:o}=e;return(0,Ke.createElement)("blockquote",{className:`blocks-quote-style-${o}`,style:{textAlign:t||null}},(0,Ke.createElement)(nt.RichText.Content,{multiline:!0,value:n}),!nt.RichText.isEmpty(a)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"footer",value:a}))}},rx=[tx,nx,ax,ox],lx="web"===_t.Platform.OS,ix=[["core/paragraph",{}]];const sx={from:[{type:"block",blocks:["core/pullquote"],transform:({value:e,citation:t,anchor:n,fontSize:a,style:o})=>(0,Qe.createBlock)("core/quote",{citation:t,anchor:n,fontSize:a,style:o},[(0,Qe.createBlock)("core/paragraph",{content:e})])},{type:"prefix",prefix:">",transform:e=>(0,Qe.createBlock)("core/quote",{},[(0,Qe.createBlock)("core/paragraph",{content:e})])},{type:"raw",schema:()=>({blockquote:{children:"*"}}),selector:"blockquote",transform:(e,t)=>(0,Qe.createBlock)("core/quote",{},t({HTML:e.innerHTML,mode:"BLOCKS"}))},{type:"block",isMultiBlock:!0,blocks:["*"],isMatch:({},e)=>1===e.length?["core/paragraph","core/heading","core/list","core/pullquote"].includes(e[0].name):!e.some((({name:e})=>"core/quote"===e)),__experimentalConvert:e=>(0,Qe.createBlock)("core/quote",{},e.map((e=>(0,Qe.createBlock)(e.name,e.attributes,e.innerBlocks))))}],to:[{type:"block",blocks:["core/pullquote"],isMatch:({},e)=>e.innerBlocks.every((({name:e})=>"core/paragraph"===e)),transform:({citation:e,anchor:t,fontSize:n,style:a},o)=>{const r=o.map((({attributes:e})=>`${e.content}`)).join("<br>");return(0,Qe.createBlock)("core/pullquote",{value:r,citation:e,anchor:t,fontSize:n,style:a})}},{type:"block",blocks:["core/paragraph"],transform:({citation:e},t)=>nt.RichText.isEmpty(e)?t:[...t,(0,Qe.createBlock)("core/paragraph",{content:e})]},{type:"block",blocks:["core/group"],transform:({citation:e,anchor:t},n)=>(0,Qe.createBlock)("core/group",{anchor:t},nt.RichText.isEmpty(e)?n:[...n,(0,Qe.createBlock)("core/paragraph",{content:e})])}],ungroup:({citation:e},t)=>nt.RichText.isEmpty(e)?t:[...t,(0,Qe.createBlock)("core/paragraph",{content:e})]},cx=sx,mx={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/quote",title:"Quote",category:"text",description:'Give quoted text visual emphasis. "In quoting others, we cite ourselves." — Julio Cortázar',keywords:["blockquote","cite"],textdomain:"default",attributes:{value:{type:"string",source:"html",selector:"blockquote",multiline:"p",default:"",__experimentalRole:"content"},citation:{type:"rich-text",source:"rich-text",selector:"cite",__experimentalRole:"content"},align:{type:"string"}},supports:{anchor:!0,html:!1,__experimentalOnEnter:!0,__experimentalOnMerge:!0,typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},color:{gradients:!0,heading:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},layout:{allowEditing:!1},spacing:{blockGap:!0},interactivity:{clientNavigation:!0}},styles:[{name:"default",label:"Default",isDefault:!0},{name:"plain",label:"Plain"}],editorStyle:"wp-block-quote-editor",style:"wp-block-quote"},{name:ux}=mx,px={icon:Xk,example:{attributes:{citation:"Julio Cortázar"},innerBlocks:[{name:"core/paragraph",attributes:{content:(0,tt.__)("In quoting others, we cite ourselves.")}}]},transforms:cx,edit:function({attributes:e,setAttributes:t,insertBlocksAfter:n,clientId:a,className:o,style:r}){const{align:l,citation:i}=e;((e,t)=>{const n=(0,gt.useRegistry)(),{updateBlockAttributes:a,replaceInnerBlocks:o}=(0,gt.useDispatch)(nt.store);(0,_t.useEffect)((()=>{if(!e.value)return;const[r,l]=ex(e);Qp()("Value attribute on the quote block",{since:"6.0",version:"6.5",alternative:"inner blocks"}),n.batch((()=>{a(t,r),o(t,l)}))}),[e.value])})(e,a);const s=(0,gt.useSelect)((e=>{const{isBlockSelected:t,hasSelectedInnerBlock:n}=e(nt.store);return n(a)||t(a)}),[]),c=(0,nt.useBlockProps)({className:ut()(o,{[`has-text-align-${l}`]:l}),...!lx&&{style:r}}),m=(0,nt.useInnerBlocksProps)(c,{template:ix,templateInsertUpdatesSelection:!0,__experimentalCaptureToolbars:!0});return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:l,onChange:e=>{t({align:e})}})),(0,Ke.createElement)(et.BlockQuotation,{...m},m.children,(!nt.RichText.isEmpty(i)||s)&&(0,Ke.createElement)(nt.RichText,{identifier:"citation",tagName:lx?"cite":void 0,style:{display:"block"},value:i,onChange:e=>{t({citation:e})},__unstableMobileNoFocusOnMount:!0,"aria-label":(0,tt.__)("Quote citation"),placeholder:(0,tt.__)("Add citation"),className:"wp-block-quote__citation",__unstableOnSplitAtEnd:()=>n((0,Qe.createBlock)((0,Qe.getDefaultBlockName)())),...lx?{}:{textAlign:l}})))},save:function({attributes:e}){const{align:t,citation:n}=e,a=ut()({[`has-text-align-${t}`]:t});return(0,Ke.createElement)("blockquote",{...nt.useBlockProps.save({className:a})},(0,Ke.createElement)(nt.InnerBlocks.Content,null),!nt.RichText.isEmpty(n)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:n}))},deprecated:rx},dx=()=>Xe({name:ux,metadata:mx,settings:px}),gx=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.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"})),hx=window.wp.patterns,{useLayoutClasses:bx}=Ft(nt.privateApis),{PARTIAL_SYNCING_SUPPORTED_BLOCKS:_x}=Ft(hx.privateApis),yx=["full","wide","left","right"];function vx(e,t,n={}){let a={};for(const o of e){o?.innerBlocks?.length&&(a={...a,...vx(o.innerBlocks,t,n)});const e=o.attributes.metadata?.id,r=o.clientId;e&&t?.[e]&&(a[r]=e)}return a}const fx=(e,t)=>{const n=(0,_t.useRef)();return(0,_t.useMemo)((()=>{if(!e?.length)return{};let a=n.current;if(void 0===a){const o="constrained"===t?.type,r=e.some((e=>yx.includes(e.attributes.align)));a=o&&r?"full":null,n.current=a}return{alignment:a,layout:a?t:void 0}}),[e,t])};function kx(e){return Object.keys(_x).includes(e.name)&&!!e.attributes.metadata?.bindings&&Object.values(e.attributes.metadata.bindings).some((e=>"core/pattern-overrides"===e.source))}function xx(e){return e.some((e=>!!kx(e)||xx(e.innerBlocks)))}function wx(e){return Object.entries(e.attributes.metadata.bindings).filter((([,e])=>"core/pattern-overrides"===e.source)).map((([e])=>e))}function Ex(e,t={},n,a){return e.map((e=>{var o;const r=Ex(e.innerBlocks,t,n,a),l=null!==(o=a?.[e.clientId])&&void 0!==o?o:e.attributes.metadata?.name;if(!l||!kx(e))return{...e,innerBlocks:r};const i=wx(e),s={...e.attributes};for(const a of i){var c;null!==(c=n[l])&&void 0!==c||(n[l]={}),n[l][a]=e.attributes[a];const o=t[l];void 0!==o?.[a]&&(s[a]=o[a])}return{...e,attributes:s,innerBlocks:r}}))}function Cx(e,t,n){const a={};for(const s of e){var o;if(s.name===zx)continue;s.innerBlocks.length&&Object.assign(a,Cx(s.innerBlocks,t,n));const e=null!==(o=n?.[s.clientId])&&void 0!==o?o:s.attributes.metadata?.name;if(!e||!kx(s))continue;const c=wx(s);for(const n of c){var r;if(l=s.attributes[n],i=t?.[e]?.[n],!(l instanceof Rn.RichTextData&&i instanceof Rn.RichTextData?l.toString()===i.toString():l===i))null!==(r=a[e])&&void 0!==r||(a[e]={}),a[e][n]=void 0===s.attributes[n]?"":s.attributes[n]}}var l,i;return Object.keys(a).length>0?a:void 0}function Sx(e,t,n){t.forEach((t=>{const a=n||(kx(t)?"contentOnly":"disabled");e(t.clientId,a),Sx(e,t.innerBlocks,t.name===zx?"disabled":n)}))}function Bx(){const e=(0,nt.useBlockProps)();return(0,Ke.createElement)("div",{...e},(0,Ke.createElement)(nt.Warning,null,(0,tt.__)("Block cannot be rendered inside itself.")))}function Nx({name:e,attributes:{ref:t,content:n},__unstableParentLayout:a,clientId:o,setAttributes:r}){const l=(0,gt.useRegistry)(),{record:i,editedRecord:s,hasResolved:c}=(0,dt.useEntityRecord)("postType","wp_block",t),m=c&&!i,u=(0,_t.useRef)(n),p=(0,_t.useRef)({}),{replaceInnerBlocks:d,__unstableMarkNextChangeAsNotPersistent:g,setBlockEditingMode:h}=(0,gt.useDispatch)(nt.store),{syncDerivedUpdates:b}=Ft((0,gt.useDispatch)(nt.store)),{innerBlocks:_,userCanEdit:y,getBlockEditingMode:v,onNavigateToEntityRecord:f,editingMode:k,hasPatternOverridesSource:x}=(0,gt.useSelect)((e=>{const{canUser:n}=e(dt.store),{getBlocks:a,getSettings:r,getBlockEditingMode:l}=e(nt.store),{getBlockBindingsSource:i}=Ft(e(Qe.store));return{innerBlocks:a(o),userCanEdit:n("update","blocks",t),getBlockEditingMode:l,onNavigateToEntityRecord:r().onNavigateToEntityRecord,editingMode:l(o),hasPatternOverridesSource:!!i("core/pattern-overrides")}}),[o,t]);(0,_t.useEffect)((()=>{Sx(h,_,"disabled"!==k&&x?void 0:"disabled")}),[k,_,h,x]);const w=(0,_t.useMemo)((()=>x&&xx(_)),[x,_]),E=(0,_t.useMemo)((()=>{var e;return null!==(e=s.blocks?.map((e=>(0,Qe.cloneBlock)(e))))&&void 0!==e?e:s.content&&"function"!=typeof s.content?(0,Qe.parse)(s.content):[]}),[s.blocks,s.content]),C=(0,_t.useRef)({});(0,_t.useEffect)((()=>{C.current=vx(E,u.current),p.current={};const e=v(o);l.batch((()=>{h(o,"default"),b((()=>{const e=x?Ex(E,u.current,p.current,C.current):E;d(o,e)})),h(o,e)}))}),[x,g,o,E,d,l,v,h,b]);const{alignment:S,layout:B}=fx(_,a),N=bx({layout:B},e),T=(0,nt.useBlockProps)({className:ut()("block-library-block__reusable-block-container",B&&N,{[`align${S}`]:S})}),I=(0,nt.useInnerBlocksProps)(T,{templateLock:"all",layout:B,renderAppender:_?.length?void 0:nt.InnerBlocks.ButtonBlockAppender});(0,_t.useEffect)((()=>{if(!x)return;const{getBlocks:e}=l.select(nt.store);let t=e(o);return l.subscribe((()=>{const n=e(o);n!==t&&(t=n,b((()=>{r({content:Cx(n,p.current,C.current)})})))}),nt.store)}),[x,b,o,l,r]);let P=null;return m&&(P=(0,Ke.createElement)(nt.Warning,null,(0,tt.__)("Block has been deleted or is unavailable."))),c||(P=(0,Ke.createElement)(et.Placeholder,null,(0,Ke.createElement)(et.Spinner,null))),(0,Ke.createElement)(Ke.Fragment,null,y&&f&&(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,null,(0,Ke.createElement)(et.ToolbarButton,{onClick:()=>{f({postId:t,postType:"wp_block"})}},(0,tt.__)("Edit original")))),w&&(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,null,(0,Ke.createElement)(et.ToolbarButton,{onClick:()=>{n&&d(o,E)},disabled:!n,__experimentalIsFocusable:!0},(0,tt.__)("Reset")))),null===P?(0,Ke.createElement)("div",{...I}):(0,Ke.createElement)("div",{...T},P))}const Tx={attributes:{ref:{type:"number"},content:{type:"object"}},supports:{customClassName:!1,html:!1,inserter:!1,renaming:!1},isEligible:({content:e})=>!!e&&Object.keys(e).every((t=>{return e[t].values&&("object"==typeof(n=e[t].values)&&!Array.isArray(n)&&null!==n);var n})),migrate(e){const{content:t,...n}=e;if(t&&Object.keys(t).length){const e={...t};for(const n in t)e[n]=t[n].values;return{...n,content:e}}return e}},Ix={attributes:{ref:{type:"number"},overrides:{type:"object"}},supports:{customClassName:!1,html:!1,inserter:!1,renaming:!1},isEligible:({overrides:e})=>!!e,migrate(e){const{overrides:t,...n}=e,a={};return Object.keys(t).forEach((e=>{a[e]=t[e]})),{...n,content:a}}},Px=[Tx,Ix],Mx={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/block",title:"Pattern",category:"reusable",description:"Reuse this design across your site.",keywords:["reusable"],textdomain:"default",attributes:{ref:{type:"number"},content:{type:"object"}},supports:{customClassName:!1,html:!1,inserter:!1,renaming:!1,interactivity:{clientNavigation:!0}}},{name:zx}=Mx,Rx={deprecated:Px,edit:function(e){const{ref:t}=e.attributes;return(0,nt.useHasRecursion)(t)?(0,Ke.createElement)(Bx,null):(0,Ke.createElement)(nt.RecursionProvider,{uniqueId:t},(0,Ke.createElement)(Nx,{...e}))},icon:gx,__experimentalLabel:({ref:e})=>{if(!e)return;const t=(0,gt.select)(dt.store).getEditedEntityRecord("postType","wp_block",e);return t?.title?(0,Jn.decodeEntities)(t.title):void 0}},Ax=()=>Xe({name:zx,metadata:Mx,settings:Rx});const Hx={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/read-more",title:"Read More",category:"theme",description:"Displays the link of a post, page, or any other content-type.",textdomain:"default",attributes:{content:{type:"string"},linkTarget:{type:"string",default:"_self"}},usesContext:["postId"],supports:{html:!1,color:{gradients:!0,text:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalLetterSpacing:!0,__experimentalTextDecoration:!0,__experimentalDefaultControls:{fontSize:!0,textDecoration:!0}},spacing:{margin:["top","bottom"],padding:!0,__experimentalDefaultControls:{padding:!0}},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalDefaultControls:{width:!0}},interactivity:{clientNavigation:!0}},style:"wp-block-read-more"},{name:Lx}=Hx,Dx={icon:kn,edit:function({attributes:{content:e,linkTarget:t},setAttributes:n,insertBlocksAfter:a}){const o=(0,nt.useBlockProps)();return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Open in new tab"),onChange:e=>n({linkTarget:e?"_blank":"_self"}),checked:"_blank"===t}))),(0,Ke.createElement)(nt.RichText,{tagName:"a","aria-label":(0,tt.__)("“Read more” link text"),placeholder:(0,tt.__)("Read more"),value:e,onChange:e=>n({content:e}),__unstableOnSplitAtEnd:()=>a((0,Qe.createBlock)((0,Qe.getDefaultBlockName)())),withoutInteractiveFormatting:!0,...o}))}},Fx=()=>Xe({name:Lx,metadata:Hx,settings:Dx}),Vx=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M5 10.2h-.8v1.5H5c1.9 0 3.8.8 5.1 2.1 1.4 1.4 2.1 3.2 2.1 5.1v.8h1.5V19c0-2.3-.9-4.5-2.6-6.2-1.6-1.6-3.8-2.6-6.1-2.6zm10.4-1.6C12.6 5.8 8.9 4.2 5 4.2h-.8v1.5H5c3.5 0 6.9 1.4 9.4 3.9s3.9 5.8 3.9 9.4v.8h1.5V19c0-3.9-1.6-7.6-4.4-10.4zM4 20h3v-3H4v3z"}));const $x={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/rss",title:"RSS",category:"widgets",description:"Display entries from any RSS or Atom feed.",keywords:["atom","feed"],textdomain:"default",attributes:{columns:{type:"number",default:2},blockLayout:{type:"string",default:"list"},feedURL:{type:"string",default:""},itemsToShow:{type:"number",default:5},displayExcerpt:{type:"boolean",default:!1},displayAuthor:{type:"boolean",default:!1},displayDate:{type:"boolean",default:!1},excerptLength:{type:"number",default:55}},supports:{align:!0,html:!1,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-rss-editor",style:"wp-block-rss"},{name:Ox}=$x,Gx={icon:Vx,example:{attributes:{feedURL:"https://wordpress.org"}},edit:function({attributes:e,setAttributes:t}){const[n,a]=(0,_t.useState)(!e.feedURL),{blockLayout:o,columns:r,displayAuthor:l,displayDate:i,displayExcerpt:s,excerptLength:c,feedURL:m,itemsToShow:u}=e;function p(n){return()=>{const a=e[n];t({[n]:!a})}}const d=(0,nt.useBlockProps)();if(n)return(0,Ke.createElement)("div",{...d},(0,Ke.createElement)(et.Placeholder,{icon:Vx,label:"RSS"},(0,Ke.createElement)("form",{onSubmit:function(e){e.preventDefault(),m&&(t({feedURL:(0,pt.prependHTTP)(m)}),a(!1))},className:"wp-block-rss__placeholder-form"},(0,Ke.createElement)(et.__experimentalHStack,{wrap:!0},(0,Ke.createElement)(et.__experimentalInputControl,{__next40pxDefaultSize:!0,placeholder:(0,tt.__)("Enter URL here…"),value:m,onChange:e=>t({feedURL:e}),className:"wp-block-rss__placeholder-input"}),(0,Ke.createElement)(et.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit"},(0,tt.__)("Use URL"))))));const g=[{icon:Di,title:(0,tt.__)("Edit RSS URL"),onClick:()=>a(!0)},{icon:Tp,title:(0,tt.__)("List view"),onClick:()=>t({blockLayout:"list"}),isActive:"list"===o},{icon:Xm,title:(0,tt.__)("Grid view"),onClick:()=>t({blockLayout:"grid"}),isActive:"grid"===o}];return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,{controls:g})),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Number of items"),value:u,onChange:e=>t({itemsToShow:e}),min:1,max:20,required:!0}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display author"),checked:l,onChange:p("displayAuthor")}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display date"),checked:i,onChange:p("displayDate")}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Display excerpt"),checked:s,onChange:p("displayExcerpt")}),s&&(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Max number of words in excerpt"),value:c,onChange:e=>t({excerptLength:e}),min:10,max:100,required:!0}),"grid"===o&&(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Columns"),value:r,onChange:e=>t({columns:e}),min:2,max:6,required:!0}))),(0,Ke.createElement)("div",{...d},(0,Ke.createElement)(et.Disabled,null,(0,Ke.createElement)(ot(),{block:"core/rss",attributes:e}))))}},Ux=()=>Xe({name:Ox,metadata:$x,settings:Gx}),qx=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"})),jx=(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Rect,{x:"7",y:"10",width:"10",height:"4",rx:"1",fill:"currentColor"})),Wx=(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Rect,{x:"4.75",y:"15.25",width:"6.5",height:"9.5",transform:"rotate(-90 4.75 15.25)",stroke:"currentColor",strokeWidth:"1.5",fill:"none"}),(0,Ke.createElement)(et.Rect,{x:"16",y:"10",width:"4",height:"4",rx:"1",fill:"currentColor"})),Zx=(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Rect,{x:"4.75",y:"15.25",width:"6.5",height:"14.5",transform:"rotate(-90 4.75 15.25)",stroke:"currentColor",strokeWidth:"1.5",fill:"none"}),(0,Ke.createElement)(et.Rect,{x:"14",y:"10",width:"4",height:"4",rx:"1",fill:"currentColor"})),Qx=(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Rect,{x:"4.75",y:"15.25",width:"6.5",height:"14.5",transform:"rotate(-90 4.75 15.25)",stroke:"currentColor",fill:"none",strokeWidth:"1.5"})),Kx=(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Rect,{x:"4.75",y:"7.75",width:"14.5",height:"8.5",rx:"1.25",stroke:"currentColor",fill:"none",strokeWidth:"1.5"}),(0,Ke.createElement)(et.Rect,{x:"8",y:"11",width:"8",height:"2",fill:"currentColor"})),Yx=(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(et.Rect,{x:"4.75",y:"17.25",width:"5.5",height:"14.5",transform:"rotate(-90 4.75 17.25)",stroke:"currentColor",fill:"none",strokeWidth:"1.5"}),(0,Ke.createElement)(et.Rect,{x:"4",y:"7",width:"10",height:"2",fill:"currentColor"}));function Jx(e){return"%"===e}const Xx=[{name:"default",isDefault:!0,attributes:{buttonText:(0,tt.__)("Search"),label:(0,tt.__)("Search")}}],ew={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/search",title:"Search",category:"widgets",description:"Help visitors find your content.",keywords:["find"],textdomain:"default",attributes:{label:{type:"string",__experimentalRole:"content"},showLabel:{type:"boolean",default:!0},placeholder:{type:"string",default:"",__experimentalRole:"content"},width:{type:"number"},widthUnit:{type:"string"},buttonText:{type:"string",__experimentalRole:"content"},buttonPosition:{type:"string",default:"button-outside"},buttonUseIcon:{type:"boolean",default:!1},query:{type:"object",default:{}},isSearchFieldHidden:{type:"boolean",default:!1}},supports:{align:["left","center","right"],color:{gradients:!0,__experimentalSkipSerialization:!0,__experimentalDefaultControls:{background:!0,text:!0}},interactivity:!0,typography:{__experimentalSkipSerialization:!0,__experimentalSelector:".wp-block-search__label, .wp-block-search__input, .wp-block-search__button",fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSkipSerialization:!0,__experimentalDefaultControls:{color:!0,radius:!0,width:!0}},html:!1},editorStyle:"wp-block-search-editor",style:"wp-block-search"},{name:tw}=ew,nw={icon:qx,example:{attributes:{buttonText:(0,tt.__)("Search"),label:(0,tt.__)("Search")},viewportWidth:400},variations:Xx,edit:function({className:e,attributes:t,setAttributes:n,toggleSelection:a,isSelected:o,clientId:r}){const{label:l,showLabel:i,placeholder:s,width:c,widthUnit:m,align:u,buttonText:p,buttonPosition:d,buttonUseIcon:g,isSearchFieldHidden:h,style:b}=t,_=(0,gt.useSelect)((e=>{const{getBlockParentsByBlockName:t,wasBlockJustInserted:n}=e(nt.store);return!!t(r,"core/navigation")?.length&&n(r)}),[r]),{__unstableMarkNextChangeAsNotPersistent:y}=(0,gt.useDispatch)(nt.store);(0,_t.useEffect)((()=>{_&&(y(),n({showLabel:!1,buttonUseIcon:!0,buttonPosition:"button-inside"}))}),[y,_,n]);const v=b?.border?.radius,f=(0,nt.__experimentalUseBorderProps)(t);"number"==typeof v&&(f.style.borderRadius=`${v}px`);const k=(0,nt.__experimentalUseColorProps)(t),[x,w]=(0,nt.useSettings)("typography.fluid","layout"),E=(0,nt.getTypographyClassesAndStyles)(t,{typography:{fluid:x},layout:{wideSize:w?.wideSize}}),C=`wp-block-search__width-${(0,jt.useInstanceId)(et.__experimentalUnitControl)}`,S="button-inside"===d,B="button-outside"===d,N="no-button"===d,T="button-only"===d,I=(0,_t.useRef)(),P=(0,_t.useRef)(),M=(0,et.__experimentalUseCustomUnits)({availableUnits:["%","px"],defaultValues:{"%":50,px:350}});(0,_t.useEffect)((()=>{T&&!o&&n({isSearchFieldHidden:!0})}),[T,o,n]),(0,_t.useEffect)((()=>{T&&o&&n({isSearchFieldHidden:!1})}),[T,o,n,c]);const z=[{role:"menuitemradio",title:(0,tt.__)("Button outside"),isActive:"button-outside"===d,icon:Wx,onClick:()=>{n({buttonPosition:"button-outside",isSearchFieldHidden:!1})}},{role:"menuitemradio",title:(0,tt.__)("Button inside"),isActive:"button-inside"===d,icon:Zx,onClick:()=>{n({buttonPosition:"button-inside",isSearchFieldHidden:!1})}},{role:"menuitemradio",title:(0,tt.__)("No button"),isActive:"no-button"===d,icon:Qx,onClick:()=>{n({buttonPosition:"no-button",isSearchFieldHidden:!1})}},{role:"menuitemradio",title:(0,tt.__)("Button only"),isActive:"button-only"===d,icon:jx,onClick:()=>{n({buttonPosition:"button-only",isSearchFieldHidden:!0})}}],R=()=>{const e=ut()("wp-block-search__input",S?void 0:f.className,E.className),t={...S?{borderRadius:v}:f.style,...E.style,textDecoration:void 0};return(0,Ke.createElement)("input",{type:"search",className:e,style:t,"aria-label":(0,tt.__)("Optional placeholder text"),placeholder:s?void 0:(0,tt.__)("Optional placeholder…"),value:s,onChange:e=>n({placeholder:e.target.value}),ref:I})},A=(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,null,(0,Ke.createElement)(et.ToolbarButton,{title:(0,tt.__)("Toggle search label"),icon:Yx,onClick:()=>{n({showLabel:!i})},className:i?"is-pressed":void 0}),(0,Ke.createElement)(et.ToolbarDropdownMenu,{icon:(()=>{switch(d){case"button-inside":return Zx;case"button-outside":return Wx;case"no-button":return Qx;case"button-only":return jx}})(),label:(0,tt.__)("Change button position"),controls:z}),!N&&(0,Ke.createElement)(et.ToolbarButton,{title:(0,tt.__)("Use button with icon"),icon:Kx,onClick:()=>{n({buttonUseIcon:!g})},className:g?"is-pressed":void 0}))),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Display Settings")},(0,Ke.createElement)(et.BaseControl,{label:(0,tt.__)("Width"),id:C},(0,Ke.createElement)(et.__experimentalUnitControl,{id:C,min:Jx(m)?0:220,max:Jx(m)?100:void 0,step:1,onChange:e=>{const t="%"===m&&parseInt(e,10)>100?100:e;n({width:parseInt(t,10)})},onUnitChange:e=>{n({width:"%"===e?50:350,widthUnit:e})},__unstableInputWidth:"80px",value:`${c}${m}`,units:M}),(0,Ke.createElement)(et.ButtonGroup,{className:"wp-block-search__components-button-group","aria-label":(0,tt.__)("Percentage Width")},[25,50,75,100].map((e=>(0,Ke.createElement)(et.Button,{key:e,size:"small",variant:e===c&&"%"===m?"primary":void 0,onClick:()=>n({width:e,widthUnit:"%"})},e,"%")))))))),H=e=>e?`calc(${e} + 4px)`:void 0,L=(0,nt.useBlockProps)({className:ut()(e,S?"wp-block-search__button-inside":void 0,B?"wp-block-search__button-outside":void 0,N?"wp-block-search__no-button":void 0,T?"wp-block-search__button-only":void 0,g||N?void 0:"wp-block-search__text-button",g&&!N?"wp-block-search__icon-button":void 0,T&&h?"wp-block-search__searchfield-hidden":void 0),style:{...E.style,textDecoration:void 0}}),D=ut()("wp-block-search__label",E.className);return(0,Ke.createElement)("div",{...L},A,i&&(0,Ke.createElement)(nt.RichText,{className:D,"aria-label":(0,tt.__)("Label text"),placeholder:(0,tt.__)("Add label…"),withoutInteractiveFormatting:!0,value:l,onChange:e=>n({label:e}),style:E.style}),(0,Ke.createElement)(et.ResizableBox,{size:{width:`${c}${m}`},className:ut()("wp-block-search__inside-wrapper",S?f.className:void 0),style:(()=>{const e=S?f.style:{borderRadius:f.style?.borderRadius,borderTopLeftRadius:f.style?.borderTopLeftRadius,borderTopRightRadius:f.style?.borderTopRightRadius,borderBottomLeftRadius:f.style?.borderBottomLeftRadius,borderBottomRightRadius:f.style?.borderBottomRightRadius},t=void 0!==v&&0!==parseInt(v,10);if(S&&t){if("object"==typeof v){const{topLeft:t,topRight:n,bottomLeft:a,bottomRight:o}=v;return{...e,borderTopLeftRadius:H(t),borderTopRightRadius:H(n),borderBottomLeftRadius:H(a),borderBottomRightRadius:H(o)}}const t=Number.isInteger(v)?`${v}px`:v;e.borderRadius=`calc(${t} + 4px)`}return e})(),minWidth:220,enable:T?{}:{right:"right"!==u,left:"right"===u},onResizeStart:(e,t,o)=>{n({width:parseInt(o.offsetWidth,10),widthUnit:"px"}),a(!1)},onResizeStop:(e,t,o,r)=>{n({width:parseInt(c+r.width,10)}),a(!0)},showHandle:o},(S||B||T)&&(0,Ke.createElement)(Ke.Fragment,null,R(),(()=>{const e=ut()("wp-block-search__button",k.className,E.className,S?void 0:f.className,g?"has-icon":void 0,(0,nt.__experimentalGetElementClassName)("button")),t={...k.style,...E.style,...S?{borderRadius:v}:f.style},a=()=>{T&&n({isSearchFieldHidden:!h})};return(0,Ke.createElement)(Ke.Fragment,null,g&&(0,Ke.createElement)("button",{type:"button",className:e,style:t,"aria-label":p?(0,ac.__unstableStripHTML)(p):(0,tt.__)("Search"),onClick:a,ref:P},(0,Ke.createElement)(Ng,{icon:qx})),!g&&(0,Ke.createElement)(nt.RichText,{className:e,style:t,"aria-label":(0,tt.__)("Button text"),placeholder:(0,tt.__)("Add button text…"),withoutInteractiveFormatting:!0,value:p,onChange:e=>n({buttonText:e}),onClick:a}))})()),N&&R()))}},aw=()=>Xe({name:tw,metadata:ew,settings:nw}),ow=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M4.5 12.5v4H3V7h1.5v3.987h15V7H21v9.5h-1.5v-4h-15Z"}));const rw={from:[{type:"enter",regExp:/^-{3,}$/,transform:()=>(0,Qe.createBlock)("core/separator")},{type:"raw",selector:"hr",schema:{hr:{}}}]},lw={attributes:{color:{type:"string"},customColor:{type:"string"}},save({attributes:e}){const{color:t,customColor:n}=e,a=(0,nt.getColorClassName)("background-color",t),o=(0,nt.getColorClassName)("color",t),r=ut()({"has-text-color has-background":t||n,[a]:a,[o]:o}),l={backgroundColor:a?void 0:n,color:o?void 0:n};return(0,Ke.createElement)("hr",{...nt.useBlockProps.save({className:r,style:l})})},migrate(e){const{color:t,customColor:n,...a}=e;return{...a,backgroundColor:t||void 0,opacity:"css",style:n?{color:{background:n}}:void 0}}},iw=[lw],sw={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/separator",title:"Separator",category:"design",description:"Create a break between ideas or sections with a horizontal separator.",keywords:["horizontal-line","hr","divider"],textdomain:"default",attributes:{opacity:{type:"string",default:"alpha-channel"}},supports:{anchor:!0,align:["center","wide","full"],color:{enableContrastChecker:!1,__experimentalSkipSerialization:!0,gradients:!0,background:!0,text:!1,__experimentalDefaultControls:{background:!0}},spacing:{margin:["top","bottom"]},interactivity:{clientNavigation:!0}},styles:[{name:"default",label:"Default",isDefault:!0},{name:"wide",label:"Wide Line"},{name:"dots",label:"Dots"}],editorStyle:"wp-block-separator-editor",style:"wp-block-separator"},{name:cw}=sw,mw={icon:ow,example:{attributes:{customColor:"#065174",className:"is-style-wide"}},transforms:rw,edit:function({attributes:e,setAttributes:t}){const{backgroundColor:n,opacity:a,style:o}=e,r=(0,nt.__experimentalUseColorProps)(e),l=r?.style?.backgroundColor,i=!!o?.color?.background;!function(e,t,n){const[a,o]=(0,_t.useState)(!1),r=(0,jt.usePrevious)(t);(0,_t.useEffect)((()=>{"css"!==e||t||r||o(!0)}),[t,r,e]),(0,_t.useEffect)((()=>{"css"===e&&(a&&t||r&&t!==r)&&(n({opacity:"alpha-channel"}),o(!1))}),[a,t,r])}(a,l,t);const s=(0,nt.getColorClassName)("color",n),c=ut()({"has-text-color":n||l,[s]:s,"has-css-opacity":"css"===a,"has-alpha-channel-opacity":"alpha-channel"===a},r.className),m={color:l,backgroundColor:l};return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.HorizontalRule,{...(0,nt.useBlockProps)({className:c,style:i?m:void 0})}))},save:function({attributes:e}){const{backgroundColor:t,style:n,opacity:a}=e,o=n?.color?.background,r=(0,nt.__experimentalGetColorClassesAndStyles)(e),l=(0,nt.getColorClassName)("color",t),i=ut()({"has-text-color":t||o,[l]:l,"has-css-opacity":"css"===a,"has-alpha-channel-opacity":"alpha-channel"===a},r.className),s={backgroundColor:r?.style?.backgroundColor,color:l?void 0:o};return(0,Ke.createElement)("hr",{...nt.useBlockProps.save({className:i,style:s})})},deprecated:iw},uw=()=>Xe({name:cw,metadata:sw,settings:mw}),pw=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M16 4.2v1.5h2.5v12.5H16v1.5h4V4.2h-4zM4.2 19.8h4v-1.5H5.8V5.8h2.5V4.2h-4l-.1 15.6zm5.1-3.1l1.4.6 4-10-1.4-.6-4 10z"}));const dw=window.wp.autop,gw={from:[{type:"shortcode",tag:"[a-z][a-z0-9_-]*",attributes:{text:{type:"string",shortcode:(e,{content:t})=>(0,dw.removep)((0,dw.autop)(t))}},priority:20}]},hw={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/shortcode",title:"Shortcode",category:"widgets",description:"Insert additional custom elements with a WordPress shortcode.",textdomain:"default",attributes:{text:{type:"string",source:"raw"}},supports:{className:!1,customClassName:!1,html:!1},editorStyle:"wp-block-shortcode-editor"},{name:bw}=hw,_w={icon:pw,transforms:gw,edit:function e({attributes:t,setAttributes:n}){const a=`blocks-shortcode-input-${(0,jt.useInstanceId)(e)}`;return(0,Ke.createElement)("div",{...(0,nt.useBlockProps)({className:"components-placeholder"})},(0,Ke.createElement)("label",{htmlFor:a,className:"components-placeholder__label"},(0,Ke.createElement)(Ng,{icon:pw}),(0,tt.__)("Shortcode")),(0,Ke.createElement)(nt.PlainText,{className:"blocks-shortcode__textarea",id:a,value:t.text,"aria-label":(0,tt.__)("Shortcode text"),placeholder:(0,tt.__)("Write shortcode here…"),onChange:e=>n({text:e})}))},save:function({attributes:e}){return(0,Ke.createElement)(_t.RawHTML,null,e.text)}},yw=()=>Xe({name:bw,metadata:hw,settings:_w}),vw=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M12 3c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 1.5c4.1 0 7.5 3.4 7.5 7.5v.1c-1.4-.8-3.3-1.7-3.4-1.8-.2-.1-.5-.1-.8.1l-2.9 2.1L9 11.3c-.2-.1-.4 0-.6.1l-3.7 2.2c-.1-.5-.2-1-.2-1.5 0-4.2 3.4-7.6 7.5-7.6zm0 15c-3.1 0-5.7-1.9-6.9-4.5l3.7-2.2 3.5 1.2c.2.1.5 0 .7-.1l2.9-2.1c.8.4 2.5 1.2 3.5 1.9-.9 3.3-3.9 5.8-7.4 5.8z"})),fw=["image"],kw="image/*",xw=({alt:e,attributes:{align:t,width:n,height:a,isLink:o,linkTarget:r,shouldSyncIcon:l},containerRef:i,isSelected:s,setAttributes:c,setLogo:m,logoUrl:u,siteUrl:p,logoId:d,iconId:g,setIcon:h,canUserEdit:b})=>{const _=ap(i,[t]),y=(0,jt.useViewportMatch)("medium"),v=!["wide","full"].includes(t)&&y,[{naturalWidth:f,naturalHeight:k},x]=(0,_t.useState)({}),[w,E]=(0,_t.useState)(!1),{toggleSelection:C}=(0,gt.useDispatch)(nt.store),S=ut()("custom-logo-link",{"is-transient":(0,It.isBlobURL)(u)}),{imageEditing:B,maxWidth:N,title:T}=(0,gt.useSelect)((e=>{const t=e(nt.store).getSettings(),n=e(dt.store).getEntityRecord("root","__unstableBase");return{title:n?.name,imageEditing:t.imageEditing,maxWidth:t.maxWidth}}),[]);(0,_t.useEffect)((()=>{l&&d!==g&&c({shouldSyncIcon:!1})}),[]),(0,_t.useEffect)((()=>{s||E(!1)}),[s]);const I=(0,Ke.createElement)("img",{className:"custom-logo",src:u,alt:e,onLoad:e=>{x({naturalWidth:e.target.naturalWidth,naturalHeight:e.target.naturalHeight})}});let P,M=I;if(o&&(M=(0,Ke.createElement)("a",{href:p,className:S,rel:"home",title:T,onClick:e=>e.preventDefault()},I)),_&&f&&k){P=f>_?_:f}if(!v||!P)return(0,Ke.createElement)("div",{style:{width:n,height:a}},M);const z=n||120,R=f/k,A=z/R,H=f<k?Jc:Math.ceil(Jc*R),L=k<f?Jc:Math.ceil(Jc/R),D=2.5*N;let F=!1,V=!1;"center"===t?(F=!0,V=!0):(0,tt.isRTL)()?"left"===t?F=!0:V=!0:"right"===t?V=!0:F=!0;const $=d&&f&&k&&B,O=$&&w?(0,Ke.createElement)(nt.__experimentalImageEditor,{id:d,url:u,width:z,height:A,clientWidth:_,naturalHeight:k,naturalWidth:f,onSaveImage:e=>{m(e.id)},onFinishEditing:()=>{E(!1)}}):(0,Ke.createElement)(et.ResizableBox,{size:{width:z,height:A},showHandle:s,minWidth:H,maxWidth:D,minHeight:L,maxHeight:D/R,lockAspectRatio:!0,enable:{top:!1,right:F,bottom:!0,left:V},onResizeStart:function(){C(!1)},onResizeStop:(e,t,n,a)=>{C(!0),c({width:parseInt(z+a.width,10),height:parseInt(A+a.height,10)})}},M),G=!window?.__experimentalUseCustomizerSiteLogoUrl?p+"/wp-admin/options-general.php":p+"/wp-admin/customize.php?autofocus[section]=title_tagline",U=(0,_t.createInterpolateElement)((0,tt.__)("Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. To use a custom icon that is different from your site logo, use the <a>Site Icon settings</a>."),{a:(0,Ke.createElement)("a",{href:G,target:"_blank",rel:"noopener noreferrer"})});return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Image width"),onChange:e=>c({width:e}),min:H,max:D,initialPosition:Math.min(120,D),value:n||"",disabled:!v}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link image to home"),onChange:()=>c({isLink:!o}),checked:o}),o&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Open in new tab"),onChange:e=>c({linkTarget:e?"_blank":"_self"}),checked:"_blank"===r})),b&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Use as Site Icon"),onChange:e=>{c({shouldSyncIcon:e}),h(e?d:void 0)},checked:!!l,help:U})))),(0,Ke.createElement)(nt.BlockControls,{group:"block"},$&&!w&&(0,Ke.createElement)(et.ToolbarButton,{onClick:()=>E(!0),icon:ep,label:(0,tt.__)("Crop")})),O)};function ww({onRemoveLogo:e,...t}){return(0,Ke.createElement)(nt.MediaReplaceFlow,{...t,allowedTypes:fw,accept:kw},(0,Ke.createElement)(et.MenuItem,{onClick:e},(0,tt.__)("Reset")))}const Ew=({mediaItemData:e={},itemGroupProps:t})=>{const{alt_text:n,source_url:a,slug:o,media_details:r}=e,l=r?.sizes?.full?.file||o;return(0,Ke.createElement)(et.__experimentalItemGroup,{...t,as:"span"},(0,Ke.createElement)(et.__experimentalHStack,{justify:"flex-start",as:"span"},(0,Ke.createElement)("img",{src:a,alt:n}),(0,Ke.createElement)(et.FlexItem,{as:"span"},(0,Ke.createElement)(et.__experimentalTruncate,{numberOfLines:1,className:"block-library-site-logo__inspector-media-replace-title"},l))))};const Cw={to:[{type:"block",blocks:["core/site-title"],transform:({isLink:e,linkTarget:t})=>(0,Qe.createBlock)("core/site-title",{isLink:e,linkTarget:t})}]},Sw={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/site-logo",title:"Site Logo",category:"theme",description:"Display an image to represent this site. Update this block and the changes apply everywhere.",textdomain:"default",attributes:{width:{type:"number"},isLink:{type:"boolean",default:!0},linkTarget:{type:"string",default:"_self"},shouldSyncIcon:{type:"boolean"}},example:{viewportWidth:500,attributes:{width:350,className:"block-editor-block-types-list__site-logo-example"}},supports:{html:!1,align:!0,alignWide:!1,color:{__experimentalDuotone:"img, .components-placeholder__illustration, .components-placeholder::before",text:!1,background:!1},spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},interactivity:{clientNavigation:!0}},styles:[{name:"default",label:"Default",isDefault:!0},{name:"rounded",label:"Rounded"}],editorStyle:"wp-block-site-logo-editor",style:"wp-block-site-logo"},{name:Bw}=Sw,Nw={icon:vw,example:{},edit:function({attributes:e,className:t,setAttributes:n,isSelected:a}){const{width:o,shouldSyncIcon:r}=e,l=(0,_t.useRef)(),{siteLogoId:i,canUserEdit:s,url:c,siteIconId:m,mediaItemData:u,isRequestingMediaItem:p}=(0,gt.useSelect)((e=>{const{canUser:t,getEntityRecord:n,getEditedEntityRecord:a}=e(dt.store),o=t("update","settings"),r=o?a("root","site"):void 0,l=n("root","__unstableBase"),i=o?r?.site_logo:l?.site_logo,s=r?.site_icon,c=i&&e(dt.store).getMedia(i,{context:"view"}),m=i&&!e(dt.store).hasFinishedResolution("getMedia",[i,{context:"view"}]);return{siteLogoId:i,canUserEdit:o,url:l?.home,mediaItemData:c,isRequestingMediaItem:m,siteIconId:s}}),[]),{getSettings:d}=(0,gt.useSelect)(nt.store),{editEntityRecord:g}=(0,gt.useDispatch)(dt.store),h=(e,t=!1)=>{(r||t)&&b(e),g("root","site",void 0,{site_logo:e})},b=e=>g("root","site",void 0,{site_icon:null!=e?e:null}),{alt_text:_,source_url:y}=null!=u?u:{},v=e=>{if(void 0===r){const t=!m;return n({shouldSyncIcon:t}),void f(e,t)}f(e)},f=(e,t=!1)=>{e&&(e.id||!e.url?h(e.id,t):h(void 0))},{createErrorNotice:k}=(0,gt.useDispatch)(Pt.store),x=e=>{k(e,{type:"snackbar"})},w=e=>{d().mediaUpload({allowedTypes:fw,filesList:e,onFileChange([e]){(0,It.isBlobURL)(e?.url)||v(e)},onError:x})},E={mediaURL:y,onSelect:f,onError:x,onRemoveLogo:()=>{h(null),n({width:void 0})}},C=s&&y&&(0,Ke.createElement)(nt.BlockControls,{group:"other"},(0,Ke.createElement)(ww,{...E}));let S;const B=void 0===i||p;B&&(S=(0,Ke.createElement)(et.Spinner,null)),y&&(S=(0,Ke.createElement)(xw,{alt:_,attributes:e,className:t,containerRef:l,isSelected:a,setAttributes:n,logoUrl:y,setLogo:h,logoId:u?.id||i,siteUrl:c,setIcon:b,iconId:m,canUserEdit:s}));const N=ut()(t,{"is-default-size":!o}),T=(0,nt.useBlockProps)({ref:l,className:N}),I=(0,tt.__)("Add a site logo"),P=(s||y)&&(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Media")},(0,Ke.createElement)("div",{className:"block-library-site-logo__inspector-media-replace-container"},!s&&!!y&&(0,Ke.createElement)(Ew,{mediaItemData:u,itemGroupProps:{isBordered:!0,className:"block-library-site-logo__inspector-readonly-logo-preview"}}),s&&!!y&&(0,Ke.createElement)(ww,{...E,name:(0,Ke.createElement)(Ew,{mediaItemData:u}),popoverProps:{}}),s&&!y&&(0,Ke.createElement)(nt.MediaUploadCheck,null,(0,Ke.createElement)(nt.MediaUpload,{onSelect:v,allowedTypes:fw,render:({open:e})=>(0,Ke.createElement)("div",{className:"block-library-site-logo__inspector-upload-container"},(0,Ke.createElement)(et.Button,{onClick:e,variant:"secondary"},B?(0,Ke.createElement)(et.Spinner,null):(0,tt.__)("Add media")),(0,Ke.createElement)(et.DropZone,{onFilesDrop:w}))})))));return(0,Ke.createElement)("div",{...T},C,P,!!y&&S,!y&&!s&&(0,Ke.createElement)(et.Placeholder,{className:"site-logo_placeholder"},!!B&&(0,Ke.createElement)("span",{className:"components-placeholder__preview"},(0,Ke.createElement)(et.Spinner,null))),!y&&s&&(0,Ke.createElement)(nt.MediaPlaceholder,{onSelect:v,accept:kw,allowedTypes:fw,onError:x,placeholder:e=>{const n=ut()("block-editor-media-placeholder",t);return(0,Ke.createElement)(et.Placeholder,{className:n,preview:S,withIllustration:!0,style:{width:o}},e)},mediaLibraryButton:({open:e})=>(0,Ke.createElement)(et.Button,{icon:np,variant:"primary",label:I,showTooltip:!0,tooltipPosition:"top center",onClick:()=>{e()}})}))},transforms:Cw},Tw=()=>Xe({name:Bw,metadata:Sw,settings:Nw});const Iw=(0,Ke.createElement)(et.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24"},(0,Ke.createElement)(et.Path,{d:"M4 10.5h16V9H4v1.5ZM4 15h9v-1.5H4V15Z"})),Pw={attributes:{textAlign:{type:"string"}},supports:{align:["wide","full"],html:!1,color:{gradients:!0},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalTextTransform:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0}},save:()=>null,migrate:ln,isEligible:({style:e})=>e?.typography?.fontFamily},Mw=[Pw],zw={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/site-tagline",title:"Site Tagline",category:"theme",description:"Describe in a few words what the site is about. The tagline can be used in search results or when sharing on social networks even if it’s not displayed in the theme design.",keywords:["description"],textdomain:"default",attributes:{textAlign:{type:"string"}},example:{},supports:{align:["wide","full"],html:!1,color:{gradients:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-site-tagline-editor"},{name:Rw}=zw,Aw={icon:Iw,edit:function({attributes:e,setAttributes:t,insertBlocksAfter:n}){const{textAlign:a}=e,{canUserEdit:o,tagline:r}=(0,gt.useSelect)((e=>{const{canUser:t,getEntityRecord:n,getEditedEntityRecord:a}=e(dt.store),o=t("update","settings"),r=o?a("root","site"):{},l=n("root","__unstableBase");return{canUserEdit:t("update","settings"),tagline:o?r?.description:l?.description}}),[]),{editEntityRecord:l}=(0,gt.useDispatch)(dt.store),i=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${a}`]:a,"wp-block-site-tagline__placeholder":!o&&!r})}),s=o?(0,Ke.createElement)(nt.RichText,{allowedFormats:[],onChange:function(e){l("root","site",void 0,{description:e})},"aria-label":(0,tt.__)("Site tagline text"),placeholder:(0,tt.__)("Write site tagline…"),tagName:"p",value:r,disableLineBreaks:!0,__unstableOnSplitAtEnd:()=>n((0,Qe.createBlock)((0,Qe.getDefaultBlockName)())),...i}):(0,Ke.createElement)("p",{...i},r||(0,tt.__)("Site Tagline placeholder"));return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{onChange:e=>t({textAlign:e}),value:a})),s)},deprecated:Mw},Hw=()=>Xe({name:Rw,metadata:zw,settings:Aw}),Lw=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M12 9c-.8 0-1.5.7-1.5 1.5S11.2 12 12 12s1.5-.7 1.5-1.5S12.8 9 12 9zm0-5c-3.6 0-6.5 2.8-6.5 6.2 0 .8.3 1.8.9 3.1.5 1.1 1.2 2.3 2 3.6.7 1 3 3.8 3.2 3.9l.4.5.4-.5c.2-.2 2.6-2.9 3.2-3.9.8-1.2 1.5-2.5 2-3.6.6-1.3.9-2.3.9-3.1C18.5 6.8 15.6 4 12 4zm4.3 8.7c-.5 1-1.1 2.2-1.9 3.4-.5.7-1.7 2.2-2.4 3-.7-.8-1.9-2.3-2.4-3-.8-1.2-1.4-2.3-1.9-3.3-.6-1.4-.7-2.2-.7-2.5 0-2.6 2.2-4.7 5-4.7s5 2.1 5 4.7c0 .2-.1 1-.7 2.4z"})),Dw=[0,1,2,3,4,5,6];const Fw={attributes:{level:{type:"number",default:1},textAlign:{type:"string"},isLink:{type:"boolean",default:!0},linkTarget:{type:"string",default:"_self"}},supports:{align:["wide","full"],html:!1,color:{gradients:!0,link:!0},spacing:{padding:!0,margin:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalTextTransform:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0}},save:()=>null,migrate:ln,isEligible:({style:e})=>e?.typography?.fontFamily},Vw=[Fw],$w={to:[{type:"block",blocks:["core/site-logo"],transform:({isLink:e,linkTarget:t})=>(0,Qe.createBlock)("core/site-logo",{isLink:e,linkTarget:t})}]},Ow={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/site-title",title:"Site Title",category:"theme",description:"Displays the name of this site. Update the block, and the changes apply everywhere it’s used. This will also appear in the browser title bar and in search results.",textdomain:"default",attributes:{level:{type:"number",default:1},textAlign:{type:"string"},isLink:{type:"boolean",default:!0},linkTarget:{type:"string",default:"_self"}},example:{viewportWidth:500},supports:{align:["wide","full"],html:!1,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0,link:!0}},spacing:{padding:!0,margin:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-site-title-editor",style:"wp-block-site-title"},{name:Gw}=Ow,Uw={icon:Lw,example:{},edit:function({attributes:e,setAttributes:t,insertBlocksAfter:n}){const{level:a,textAlign:o,isLink:r,linkTarget:l}=e,{canUserEdit:i,title:s}=(0,gt.useSelect)((e=>{const{canUser:t,getEntityRecord:n,getEditedEntityRecord:a}=e(dt.store),o=t("update","settings"),r=o?a("root","site"):{},l=n("root","__unstableBase");return{canUserEdit:o,title:o?r?.title:l?.name}}),[]),{editEntityRecord:c}=(0,gt.useDispatch)(dt.store),m=0===a?"p":`h${a}`,u=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${o}`]:o,"wp-block-site-title__placeholder":!i&&!s})}),p=i?(0,Ke.createElement)(m,{...u},(0,Ke.createElement)(nt.RichText,{tagName:r?"a":"span",href:r?"#site-title-pseudo-link":void 0,"aria-label":(0,tt.__)("Site title text"),placeholder:(0,tt.__)("Write site title…"),value:s,onChange:function(e){c("root","site",void 0,{title:e})},allowedFormats:[],disableLineBreaks:!0,__unstableOnSplitAtEnd:()=>n((0,Qe.createBlock)((0,Qe.getDefaultBlockName)()))})):(0,Ke.createElement)(m,{...u},r?(0,Ke.createElement)("a",{href:"#site-title-pseudo-link",onClick:e=>e.preventDefault()},(0,Jn.decodeEntities)(s)||(0,tt.__)("Site Title placeholder")):(0,Ke.createElement)("span",null,(0,Jn.decodeEntities)(s)||(0,tt.__)("Site Title placeholder")));return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.HeadingLevelDropdown,{options:Dw,value:a,onChange:e=>t({level:e})}),(0,Ke.createElement)(nt.AlignmentControl,{value:o,onChange:e=>{t({textAlign:e})}})),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Make title link to home"),onChange:()=>t({isLink:!r}),checked:r}),r&&(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Open in new tab"),onChange:e=>t({linkTarget:e?"_blank":"_self"}),checked:"_blank"===l}))),p)},transforms:$w,deprecated:Vw},qw=()=>Xe({name:Gw,metadata:Ow,settings:Uw}),jw=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M9 11.8l6.1-4.5c.1.4.4.7.9.7h2c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-2c-.6 0-1 .4-1 1v.4l-6.4 4.8c-.2-.1-.4-.2-.6-.2H6c-.6 0-1 .4-1 1v2c0 .6.4 1 1 1h2c.2 0 .4-.1.6-.2l6.4 4.8v.4c0 .6.4 1 1 1h2c.6 0 1-.4 1-1v-2c0-.6-.4-1-1-1h-2c-.5 0-.8.3-.9.7L9 12.2v-.4z"})),Ww=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,Ke.createElement)(Ye.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"})),Zw=()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.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"})),Qw=[{isDefault:!0,name:"wordpress",attributes:{service:"wordpress"},title:"WordPress",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M12.158,12.786L9.46,20.625c0.806,0.237,1.657,0.366,2.54,0.366c1.047,0,2.051-0.181,2.986-0.51 c-0.024-0.038-0.046-0.079-0.065-0.124L12.158,12.786z M3.009,12c0,3.559,2.068,6.634,5.067,8.092L3.788,8.341 C3.289,9.459,3.009,10.696,3.009,12z M18.069,11.546c0-1.112-0.399-1.881-0.741-2.48c-0.456-0.741-0.883-1.368-0.883-2.109 c0-0.826,0.627-1.596,1.51-1.596c0.04,0,0.078,0.005,0.116,0.007C16.472,3.904,14.34,3.009,12,3.009 c-3.141,0-5.904,1.612-7.512,4.052c0.211,0.007,0.41,0.011,0.579,0.011c0.94,0,2.396-0.114,2.396-0.114 C7.947,6.93,8.004,7.642,7.52,7.699c0,0-0.487,0.057-1.029,0.085l3.274,9.739l1.968-5.901l-1.401-3.838 C9.848,7.756,9.389,7.699,9.389,7.699C8.904,7.67,8.961,6.93,9.446,6.958c0,0,1.484,0.114,2.368,0.114 c0.94,0,2.397-0.114,2.397-0.114c0.485-0.028,0.542,0.684,0.057,0.741c0,0-0.488,0.057-1.029,0.085l3.249,9.665l0.897-2.996 C17.841,13.284,18.069,12.316,18.069,11.546z M19.889,7.686c0.039,0.286,0.06,0.593,0.06,0.924c0,0.912-0.171,1.938-0.684,3.22 l-2.746,7.94c2.673-1.558,4.47-4.454,4.47-7.771C20.991,10.436,20.591,8.967,19.889,7.686z M12,22C6.486,22,2,17.514,2,12 C2,6.486,6.486,2,12,2c5.514,0,10,4.486,10,10C22,17.514,17.514,22,12,22z"}))},{name:"fivehundredpx",attributes:{service:"fivehundredpx"},title:"500px",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M6.94026,15.1412c.00437.01213.108.29862.168.44064a6.55008,6.55008,0,1,0,6.03191-9.09557,6.68654,6.68654,0,0,0-2.58357.51467A8.53914,8.53914,0,0,0,8.21268,8.61344L8.209,8.61725V3.22948l9.0504-.00008c.32934-.0036.32934-.46353.32934-.61466s0-.61091-.33035-.61467L7.47248,2a.43.43,0,0,0-.43131.42692v7.58355c0,.24466.30476.42131.58793.4819.553.11812.68074-.05864.81617-.2457l.018-.02481A10.52673,10.52673,0,0,1,9.32258,9.258a5.35268,5.35268,0,1,1,7.58985,7.54976,5.417,5.417,0,0,1-3.80867,1.56365,5.17483,5.17483,0,0,1-2.69822-.74478l.00342-4.61111a2.79372,2.79372,0,0,1,.71372-1.78792,2.61611,2.61611,0,0,1,1.98282-.89477,2.75683,2.75683,0,0,1,1.95525.79477,2.66867,2.66867,0,0,1,.79656,1.909,2.724,2.724,0,0,1-2.75849,2.748,4.94651,4.94651,0,0,1-.86254-.13719c-.31234-.093-.44519.34058-.48892.48349-.16811.54966.08453.65862.13687.67489a3.75751,3.75751,0,0,0,1.25234.18375,3.94634,3.94634,0,1,0-2.82444-6.742,3.67478,3.67478,0,0,0-1.13028,2.584l-.00041.02323c-.0035.11667-.00579,2.881-.00644,3.78811l-.00407-.00451a6.18521,6.18521,0,0,1-1.0851-1.86092c-.10544-.27856-.34358-.22925-.66857-.12917-.14192.04372-.57386.17677-.47833.489Zm4.65165-1.08338a.51346.51346,0,0,0,.19513.31818l.02276.022a.52945.52945,0,0,0,.3517.18416.24242.24242,0,0,0,.16577-.0611c.05473-.05082.67382-.67812.73287-.738l.69041.68819a.28978.28978,0,0,0,.21437.11032.53239.53239,0,0,0,.35708-.19486c.29792-.30419.14885-.46821.07676-.54751l-.69954-.69975.72952-.73469c.16-.17311.01874-.35708-.12218-.498-.20461-.20461-.402-.25742-.52855-.14083l-.7254.72665-.73354-.73375a.20128.20128,0,0,0-.14179-.05695.54135.54135,0,0,0-.34379.19648c-.22561.22555-.274.38149-.15656.5059l.73374.7315-.72942.73072A.26589.26589,0,0,0,11.59191,14.05782Zm1.59866-9.915A8.86081,8.86081,0,0,0,9.854,4.776a.26169.26169,0,0,0-.16938.22759.92978.92978,0,0,0,.08619.42094c.05682.14524.20779.531.50006.41955a8.40969,8.40969,0,0,1,2.91968-.55484,7.87875,7.87875,0,0,1,3.086.62286,8.61817,8.61817,0,0,1,2.30562,1.49315.2781.2781,0,0,0,.18318.07586c.15529,0,.30425-.15253.43167-.29551.21268-.23861.35873-.4369.1492-.63538a8.50425,8.50425,0,0,0-2.62312-1.694A9.0177,9.0177,0,0,0,13.19058,4.14283ZM19.50945,18.6236h0a.93171.93171,0,0,0-.36642-.25406.26589.26589,0,0,0-.27613.06613l-.06943.06929A7.90606,7.90606,0,0,1,7.60639,18.505a7.57284,7.57284,0,0,1-1.696-2.51537,8.58715,8.58715,0,0,1-.5147-1.77754l-.00871-.04864c-.04939-.25873-.28755-.27684-.62981-.22448-.14234.02178-.5755.088-.53426.39969l.001.00712a9.08807,9.08807,0,0,0,15.406,4.99094c.00193-.00192.04753-.04718.0725-.07436C19.79425,19.16234,19.87422,18.98728,19.50945,18.6236Z"}))},{name:"amazon",attributes:{service:"amazon"},title:"Amazon",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M13.582,8.182C11.934,8.367,9.78,8.49,8.238,9.166c-1.781,0.769-3.03,2.337-3.03,4.644 c0,2.953,1.86,4.429,4.253,4.429c2.02,0,3.125-0.477,4.685-2.065c0.516,0.747,0.685,1.109,1.629,1.894 c0.212,0.114,0.483,0.103,0.672-0.066l0.006,0.006c0.567-0.505,1.599-1.401,2.18-1.888c0.231-0.188,0.19-0.496,0.009-0.754 c-0.52-0.718-1.072-1.303-1.072-2.634V8.305c0-1.876,0.133-3.599-1.249-4.891C15.23,2.369,13.422,2,12.04,2 C9.336,2,6.318,3.01,5.686,6.351C5.618,6.706,5.877,6.893,6.109,6.945l2.754,0.298C9.121,7.23,9.308,6.977,9.357,6.72 c0.236-1.151,1.2-1.706,2.284-1.706c0.584,0,1.249,0.215,1.595,0.738c0.398,0.584,0.346,1.384,0.346,2.061V8.182z M13.049,14.088 c-0.451,0.8-1.169,1.291-1.967,1.291c-1.09,0-1.728-0.83-1.728-2.061c0-2.42,2.171-2.86,4.227-2.86v0.615 C13.582,12.181,13.608,13.104,13.049,14.088z M20.683,19.339C18.329,21.076,14.917,22,11.979,22c-4.118,0-7.826-1.522-10.632-4.057 c-0.22-0.199-0.024-0.471,0.241-0.317c3.027,1.762,6.771,2.823,10.639,2.823c2.608,0,5.476-0.541,8.115-1.66 C20.739,18.62,21.072,19.051,20.683,19.339z M21.336,21.043c-0.194,0.163-0.379,0.076-0.293-0.139 c0.284-0.71,0.92-2.298,0.619-2.684c-0.301-0.386-1.99-0.183-2.749-0.092c-0.23,0.027-0.266-0.173-0.059-0.319 c1.348-0.946,3.555-0.673,3.811-0.356C22.925,17.773,22.599,19.986,21.336,21.043z"}))},{name:"bandcamp",attributes:{service:"bandcamp"},title:"Bandcamp",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M15.27 17.289 3 17.289 8.73 6.711 21 6.711 15.27 17.289"}))},{name:"behance",attributes:{service:"behance"},title:"Behance",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M7.799,5.698c0.589,0,1.12,0.051,1.606,0.156c0.482,0.102,0.894,0.273,1.241,0.507c0.344,0.235,0.612,0.546,0.804,0.938 c0.188,0.387,0.281,0.871,0.281,1.443c0,0.619-0.141,1.137-0.421,1.551c-0.284,0.413-0.7,0.751-1.255,1.014 c0.756,0.218,1.317,0.601,1.689,1.146c0.374,0.549,0.557,1.205,0.557,1.975c0,0.623-0.12,1.161-0.359,1.612 c-0.241,0.457-0.569,0.828-0.973,1.114c-0.408,0.288-0.876,0.5-1.399,0.637C9.052,17.931,8.514,18,7.963,18H2V5.698H7.799 M7.449,10.668c0.481,0,0.878-0.114,1.192-0.345c0.311-0.228,0.463-0.603,0.463-1.119c0-0.286-0.051-0.523-0.152-0.707 C8.848,8.315,8.711,8.171,8.536,8.07C8.362,7.966,8.166,7.894,7.94,7.854c-0.224-0.044-0.457-0.06-0.697-0.06H4.709v2.874H7.449z M7.6,15.905c0.267,0,0.521-0.024,0.759-0.077c0.243-0.053,0.457-0.137,0.637-0.261c0.182-0.12,0.332-0.283,0.441-0.491 C9.547,14.87,9.6,14.602,9.6,14.278c0-0.633-0.18-1.084-0.533-1.357c-0.356-0.27-0.83-0.404-1.413-0.404H4.709v3.388L7.6,15.905z M16.162,15.864c0.367,0.358,0.897,0.538,1.583,0.538c0.493,0,0.92-0.125,1.277-0.374c0.354-0.248,0.571-0.514,0.654-0.79h2.155 c-0.347,1.072-0.872,1.838-1.589,2.299C19.534,18,18.67,18.23,17.662,18.23c-0.701,0-1.332-0.113-1.899-0.337 c-0.567-0.227-1.041-0.544-1.439-0.958c-0.389-0.415-0.689-0.907-0.904-1.484c-0.213-0.574-0.32-1.21-0.32-1.899 c0-0.666,0.11-1.288,0.329-1.863c0.222-0.577,0.529-1.075,0.933-1.492c0.406-0.42,0.885-0.751,1.444-0.994 c0.558-0.241,1.175-0.363,1.857-0.363c0.754,0,1.414,0.145,1.98,0.44c0.563,0.291,1.026,0.686,1.389,1.181 c0.363,0.493,0.622,1.057,0.783,1.69c0.16,0.632,0.217,1.292,0.171,1.983h-6.428C15.557,14.84,15.795,15.506,16.162,15.864 M18.973,11.184c-0.291-0.321-0.783-0.496-1.384-0.496c-0.39,0-0.714,0.066-0.973,0.2c-0.254,0.132-0.461,0.297-0.621,0.491 c-0.157,0.197-0.265,0.405-0.328,0.628c-0.063,0.217-0.101,0.413-0.111,0.587h3.98C19.478,11.969,19.265,11.509,18.973,11.184z M15.057,7.738h4.985V6.524h-4.985L15.057,7.738z"}))},{name:"chain",attributes:{service:"chain"},title:"Link",icon:Zw},{name:"codepen",attributes:{service:"codepen"},title:"CodePen",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M22.016,8.84c-0.002-0.013-0.005-0.025-0.007-0.037c-0.005-0.025-0.008-0.048-0.015-0.072 c-0.003-0.015-0.01-0.028-0.013-0.042c-0.008-0.02-0.015-0.04-0.023-0.062c-0.007-0.015-0.013-0.028-0.02-0.042 c-0.008-0.02-0.018-0.037-0.03-0.057c-0.007-0.013-0.017-0.027-0.025-0.038c-0.012-0.018-0.023-0.035-0.035-0.052 c-0.01-0.013-0.02-0.025-0.03-0.037c-0.015-0.017-0.028-0.032-0.043-0.045c-0.01-0.012-0.022-0.023-0.035-0.035 c-0.015-0.015-0.032-0.028-0.048-0.04c-0.012-0.01-0.025-0.02-0.037-0.03c-0.005-0.003-0.01-0.008-0.015-0.012l-9.161-6.096 c-0.289-0.192-0.666-0.192-0.955,0L2.359,8.237C2.354,8.24,2.349,8.245,2.344,8.249L2.306,8.277 c-0.017,0.013-0.033,0.027-0.048,0.04C2.246,8.331,2.234,8.342,2.222,8.352c-0.015,0.015-0.028,0.03-0.042,0.047 c-0.012,0.013-0.022,0.023-0.03,0.037C2.139,8.453,2.125,8.471,2.115,8.488C2.107,8.501,2.099,8.514,2.09,8.526 C2.079,8.548,2.069,8.565,2.06,8.585C2.054,8.6,2.047,8.613,2.04,8.626C2.032,8.648,2.025,8.67,2.019,8.69 c-0.005,0.013-0.01,0.027-0.013,0.042C1.999,8.755,1.995,8.778,1.99,8.803C1.989,8.817,1.985,8.828,1.984,8.84 C1.978,8.879,1.975,8.915,1.975,8.954v6.093c0,0.037,0.003,0.075,0.008,0.112c0.002,0.012,0.005,0.025,0.007,0.038 c0.005,0.023,0.008,0.047,0.015,0.072c0.003,0.015,0.008,0.028,0.013,0.04c0.007,0.022,0.013,0.042,0.022,0.063 c0.007,0.015,0.013,0.028,0.02,0.04c0.008,0.02,0.018,0.038,0.03,0.058c0.007,0.013,0.015,0.027,0.025,0.038 c0.012,0.018,0.023,0.035,0.035,0.052c0.01,0.013,0.02,0.025,0.03,0.037c0.013,0.015,0.028,0.032,0.042,0.045 c0.012,0.012,0.023,0.023,0.035,0.035c0.015,0.013,0.032,0.028,0.048,0.04l0.038,0.03c0.005,0.003,0.01,0.007,0.013,0.01 l9.163,6.095C11.668,21.953,11.833,22,12,22c0.167,0,0.332-0.047,0.478-0.144l9.163-6.095l0.015-0.01 c0.013-0.01,0.027-0.02,0.037-0.03c0.018-0.013,0.035-0.028,0.048-0.04c0.013-0.012,0.025-0.023,0.035-0.035 c0.017-0.015,0.03-0.032,0.043-0.045c0.01-0.013,0.02-0.025,0.03-0.037c0.013-0.018,0.025-0.035,0.035-0.052 c0.008-0.013,0.018-0.027,0.025-0.038c0.012-0.02,0.022-0.038,0.03-0.058c0.007-0.013,0.013-0.027,0.02-0.04 c0.008-0.022,0.015-0.042,0.023-0.063c0.003-0.013,0.01-0.027,0.013-0.04c0.007-0.025,0.01-0.048,0.015-0.072 c0.002-0.013,0.005-0.027,0.007-0.037c0.003-0.042,0.007-0.079,0.007-0.117V8.954C22.025,8.915,22.022,8.879,22.016,8.84z M12.862,4.464l6.751,4.49l-3.016,2.013l-3.735-2.492V4.464z M11.138,4.464v4.009l-3.735,2.494L4.389,8.954L11.138,4.464z M3.699,10.562L5.853,12l-2.155,1.438V10.562z M11.138,19.536l-6.749-4.491l3.015-2.011l3.735,2.492V19.536z M12,14.035L8.953,12 L12,9.966L15.047,12L12,14.035z M12.862,19.536v-4.009l3.735-2.492l3.016,2.011L12.862,19.536z M20.303,13.438L18.147,12 l2.156-1.438L20.303,13.438z"}))},{name:"deviantart",attributes:{service:"deviantart"},title:"DeviantArt",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M 18.19 5.636 18.19 2 18.188 2 14.553 2 14.19 2.366 12.474 5.636 11.935 6 5.81 6 5.81 10.994 9.177 10.994 9.477 11.357 5.81 18.363 5.81 22 5.811 22 9.447 22 9.81 21.634 11.526 18.364 12.065 18 18.19 18 18.19 13.006 14.823 13.006 14.523 12.641 18.19 5.636z"}))},{name:"dribbble",attributes:{service:"dribbble"},title:"Dribbble",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M12,22C6.486,22,2,17.514,2,12S6.486,2,12,2c5.514,0,10,4.486,10,10S17.514,22,12,22z M20.434,13.369 c-0.292-0.092-2.644-0.794-5.32-0.365c1.117,3.07,1.572,5.57,1.659,6.09C18.689,17.798,20.053,15.745,20.434,13.369z M15.336,19.876c-0.127-0.749-0.623-3.361-1.822-6.477c-0.019,0.006-0.038,0.013-0.056,0.019c-4.818,1.679-6.547,5.02-6.701,5.334 c1.448,1.129,3.268,1.803,5.243,1.803C13.183,20.555,14.311,20.313,15.336,19.876z M5.654,17.724 c0.193-0.331,2.538-4.213,6.943-5.637c0.111-0.036,0.224-0.07,0.337-0.102c-0.214-0.485-0.448-0.971-0.692-1.45 c-4.266,1.277-8.405,1.223-8.778,1.216c-0.003,0.087-0.004,0.174-0.004,0.261C3.458,14.207,4.29,16.21,5.654,17.724z M3.639,10.264 c0.382,0.005,3.901,0.02,7.897-1.041c-1.415-2.516-2.942-4.631-3.167-4.94C5.979,5.41,4.193,7.613,3.639,10.264z M9.998,3.709 c0.236,0.316,1.787,2.429,3.187,5c3.037-1.138,4.323-2.867,4.477-3.085C16.154,4.286,14.17,3.471,12,3.471 C11.311,3.471,10.641,3.554,9.998,3.709z M18.612,6.612C18.432,6.855,17,8.69,13.842,9.979c0.199,0.407,0.389,0.821,0.567,1.237 c0.063,0.148,0.124,0.295,0.184,0.441c2.842-0.357,5.666,0.215,5.948,0.275C20.522,9.916,19.801,8.065,18.612,6.612z"}))},{name:"dropbox",attributes:{service:"dropbox"},title:"Dropbox",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M12,6.134L6.069,9.797L2,6.54l5.883-3.843L12,6.134z M2,13.054l5.883,3.843L12,13.459L6.069,9.797L2,13.054z M12,13.459 l4.116,3.439L22,13.054l-4.069-3.257L12,13.459z M22,6.54l-5.884-3.843L12,6.134l5.931,3.663L22,6.54z M12.011,14.2l-4.129,3.426 l-1.767-1.153v1.291l5.896,3.539l5.897-3.539v-1.291l-1.769,1.153L12.011,14.2z"}))},{name:"etsy",attributes:{service:"etsy"},title:"Etsy",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M9.16033,4.038c0-.27174.02717-.43478.48913-.43478h6.22283c1.087,0,1.68478.92391,2.11957,2.663l.35326,1.38587h1.05978C19.59511,3.712,19.75815,2,19.75815,2s-2.663.29891-4.23913.29891h-7.962L3.29076,2.163v1.1413L4.731,3.57609c1.00543.19022,1.25.40761,1.33152,1.33152,0,0,.08152,2.71739.08152,7.20109s-.08152,7.17391-.08152,7.17391c0,.81522-.32609,1.11413-1.33152,1.30435l-1.44022.27174V22l4.2663-.13587h7.11957c1.60326,0,5.32609.13587,5.32609.13587.08152-.97826.625-5.40761.70652-5.89674H19.7038L18.644,18.52174c-.84239,1.90217-2.06522,2.038-3.42391,2.038H11.1712c-1.3587,0-2.01087-.54348-2.01087-1.712V12.65217s3.0163,0,3.99457.08152c.76087.05435,1.22283.27174,1.46739,1.33152l.32609,1.413h1.16848l-.08152-3.55978.163-3.587H15.02989l-.38043,1.57609c-.24457,1.03261-.40761,1.22283-1.46739,1.33152-1.38587.13587-4.02174.1087-4.02174.1087Z"}))},{name:"facebook",attributes:{service:"facebook"},title:"Facebook",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M12 2C6.5 2 2 6.5 2 12c0 5 3.7 9.1 8.4 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.3c-1.2 0-1.6.8-1.6 1.6V12h2.8l-.4 2.9h-2.3v7C18.3 21.1 22 17 22 12c0-5.5-4.5-10-10-10z"}))},{name:"feed",attributes:{service:"feed"},title:"RSS Feed",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M2,8.667V12c5.515,0,10,4.485,10,10h3.333C15.333,14.637,9.363,8.667,2,8.667z M2,2v3.333 c9.19,0,16.667,7.477,16.667,16.667H22C22,10.955,13.045,2,2,2z M4.5,17C3.118,17,2,18.12,2,19.5S3.118,22,4.5,22S7,20.88,7,19.5 S5.882,17,4.5,17z"}))},{name:"flickr",attributes:{service:"flickr"},title:"Flickr",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M6.5,7c-2.75,0-5,2.25-5,5s2.25,5,5,5s5-2.25,5-5S9.25,7,6.5,7z M17.5,7c-2.75,0-5,2.25-5,5s2.25,5,5,5s5-2.25,5-5 S20.25,7,17.5,7z"}))},{name:"foursquare",attributes:{service:"foursquare"},title:"Foursquare",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M17.573,2c0,0-9.197,0-10.668,0S5,3.107,5,3.805s0,16.948,0,16.948c0,0.785,0.422,1.077,0.66,1.172 c0.238,0.097,0.892,0.177,1.285-0.275c0,0,5.035-5.843,5.122-5.93c0.132-0.132,0.132-0.132,0.262-0.132h3.26 c1.368,0,1.588-0.977,1.732-1.552c0.078-0.318,0.692-3.428,1.225-6.122l0.675-3.368C19.56,2.893,19.14,2,17.573,2z M16.495,7.22 c-0.053,0.252-0.372,0.518-0.665,0.518c-0.293,0-4.157,0-4.157,0c-0.467,0-0.802,0.318-0.802,0.787v0.508 c0,0.467,0.337,0.798,0.805,0.798c0,0,3.197,0,3.528,0s0.655,0.362,0.583,0.715c-0.072,0.353-0.407,2.102-0.448,2.295 c-0.04,0.193-0.262,0.523-0.655,0.523c-0.33,0-2.88,0-2.88,0c-0.523,0-0.683,0.068-1.033,0.503 c-0.35,0.437-3.505,4.223-3.505,4.223c-0.032,0.035-0.063,0.027-0.063-0.015V4.852c0-0.298,0.26-0.648,0.648-0.648 c0,0,8.228,0,8.562,0c0.315,0,0.61,0.297,0.528,0.683L16.495,7.22z"}))},{name:"goodreads",attributes:{service:"goodreads"},title:"Goodreads",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M17.3,17.5c-0.2,0.8-0.5,1.4-1,1.9c-0.4,0.5-1,0.9-1.7,1.2C13.9,20.9,13.1,21,12,21c-0.6,0-1.3-0.1-1.9-0.2 c-0.6-0.1-1.1-0.4-1.6-0.7c-0.5-0.3-0.9-0.7-1.2-1.2c-0.3-0.5-0.5-1.1-0.5-1.7h1.5c0.1,0.5,0.2,0.9,0.5,1.2 c0.2,0.3,0.5,0.6,0.9,0.8c0.3,0.2,0.7,0.3,1.1,0.4c0.4,0.1,0.8,0.1,1.2,0.1c1.4,0,2.5-0.4,3.1-1.2c0.6-0.8,1-2,1-3.5v-1.7h0 c-0.4,0.8-0.9,1.4-1.6,1.9c-0.7,0.5-1.5,0.7-2.4,0.7c-1,0-1.9-0.2-2.6-0.5C8.7,15,8.1,14.5,7.7,14c-0.5-0.6-0.8-1.3-1-2.1 c-0.2-0.8-0.3-1.6-0.3-2.5c0-0.9,0.1-1.7,0.4-2.5c0.3-0.8,0.6-1.5,1.1-2c0.5-0.6,1.1-1,1.8-1.4C10.3,3.2,11.1,3,12,3 c0.5,0,0.9,0.1,1.3,0.2c0.4,0.1,0.8,0.3,1.1,0.5c0.3,0.2,0.6,0.5,0.9,0.8c0.3,0.3,0.5,0.6,0.6,1h0V3.4h1.5V15 C17.6,15.9,17.5,16.7,17.3,17.5z M13.8,14.1c0.5-0.3,0.9-0.7,1.3-1.1c0.3-0.5,0.6-1,0.8-1.6c0.2-0.6,0.3-1.2,0.3-1.9 c0-0.6-0.1-1.2-0.2-1.9c-0.1-0.6-0.4-1.2-0.7-1.7c-0.3-0.5-0.7-0.9-1.3-1.2c-0.5-0.3-1.1-0.5-1.9-0.5s-1.4,0.2-1.9,0.5 c-0.5,0.3-1,0.7-1.3,1.2C8.5,6.4,8.3,7,8.1,7.6C8,8.2,7.9,8.9,7.9,9.5c0,0.6,0.1,1.3,0.2,1.9C8.3,12,8.6,12.5,8.9,13 c0.3,0.5,0.8,0.8,1.3,1.1c0.5,0.3,1.1,0.4,1.9,0.4C12.7,14.5,13.3,14.4,13.8,14.1z"}))},{name:"google",attributes:{service:"google"},title:"Google",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M12.02,10.18v3.72v0.01h5.51c-0.26,1.57-1.67,4.22-5.5,4.22c-3.31,0-6.01-2.75-6.01-6.12s2.7-6.12,6.01-6.12 c1.87,0,3.13,0.8,3.85,1.48l2.84-2.76C16.99,2.99,14.73,2,12.03,2c-5.52,0-10,4.48-10,10s4.48,10,10,10c5.77,0,9.6-4.06,9.6-9.77 c0-0.83-0.11-1.42-0.25-2.05H12.02z"}))},{name:"github",attributes:{service:"github"},title:"GitHub",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"}))},{name:"gravatar",attributes:{service:"gravatar"},title:"Gravatar",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M10.8001 4.69937V10.6494C10.8001 11.1001 10.9791 11.5323 11.2978 11.851C11.6165 12.1697 12.0487 12.3487 12.4994 12.3487C12.9501 12.3487 13.3824 12.1697 13.7011 11.851C14.0198 11.5323 14.1988 11.1001 14.1988 10.6494V6.69089C15.2418 7.05861 16.1371 7.75537 16.7496 8.67617C17.3622 9.59698 17.6589 10.6919 17.595 11.796C17.5311 12.9001 17.1101 13.9535 16.3954 14.7975C15.6807 15.6415 14.711 16.2303 13.6325 16.4753C12.5541 16.7202 11.4252 16.608 10.4161 16.1555C9.40691 15.703 8.57217 14.9348 8.03763 13.9667C7.50308 12.9985 7.29769 11.8828 7.45242 10.7877C7.60714 9.69266 8.11359 8.67755 8.89545 7.89537C9.20904 7.57521 9.38364 7.14426 9.38132 6.69611C9.37899 6.24797 9.19994 5.81884 8.88305 5.50195C8.56616 5.18506 8.13704 5.00601 7.68889 5.00369C7.24075 5.00137 6.80979 5.17597 6.48964 5.48956C5.09907 6.8801 4.23369 8.7098 4.04094 10.6669C3.84819 12.624 4.34 14.5873 5.43257 16.2224C6.52515 17.8575 8.15088 19.0632 10.0328 19.634C11.9146 20.2049 13.9362 20.1055 15.753 19.3529C17.5699 18.6003 19.0695 17.241 19.9965 15.5066C20.9234 13.7722 21.2203 11.7701 20.8366 9.84133C20.4528 7.91259 19.4122 6.17658 17.892 4.92911C16.3717 3.68163 14.466 2.99987 12.4994 3C12.0487 3 11.6165 3.17904 11.2978 3.49773C10.9791 3.81643 10.8001 4.24867 10.8001 4.69937Z"}))},{name:"instagram",attributes:{service:"instagram"},title:"Instagram",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M12,4.622c2.403,0,2.688,0.009,3.637,0.052c0.877,0.04,1.354,0.187,1.671,0.31c0.42,0.163,0.72,0.358,1.035,0.673 c0.315,0.315,0.51,0.615,0.673,1.035c0.123,0.317,0.27,0.794,0.31,1.671c0.043,0.949,0.052,1.234,0.052,3.637 s-0.009,2.688-0.052,3.637c-0.04,0.877-0.187,1.354-0.31,1.671c-0.163,0.42-0.358,0.72-0.673,1.035 c-0.315,0.315-0.615,0.51-1.035,0.673c-0.317,0.123-0.794,0.27-1.671,0.31c-0.949,0.043-1.233,0.052-3.637,0.052 s-2.688-0.009-3.637-0.052c-0.877-0.04-1.354-0.187-1.671-0.31c-0.42-0.163-0.72-0.358-1.035-0.673 c-0.315-0.315-0.51-0.615-0.673-1.035c-0.123-0.317-0.27-0.794-0.31-1.671C4.631,14.688,4.622,14.403,4.622,12 s0.009-2.688,0.052-3.637c0.04-0.877,0.187-1.354,0.31-1.671c0.163-0.42,0.358-0.72,0.673-1.035 c0.315-0.315,0.615-0.51,1.035-0.673c0.317-0.123,0.794-0.27,1.671-0.31C9.312,4.631,9.597,4.622,12,4.622 M12,3 C9.556,3,9.249,3.01,8.289,3.054C7.331,3.098,6.677,3.25,6.105,3.472C5.513,3.702,5.011,4.01,4.511,4.511 c-0.5,0.5-0.808,1.002-1.038,1.594C3.25,6.677,3.098,7.331,3.054,8.289C3.01,9.249,3,9.556,3,12c0,2.444,0.01,2.751,0.054,3.711 c0.044,0.958,0.196,1.612,0.418,2.185c0.23,0.592,0.538,1.094,1.038,1.594c0.5,0.5,1.002,0.808,1.594,1.038 c0.572,0.222,1.227,0.375,2.185,0.418C9.249,20.99,9.556,21,12,21s2.751-0.01,3.711-0.054c0.958-0.044,1.612-0.196,2.185-0.418 c0.592-0.23,1.094-0.538,1.594-1.038c0.5-0.5,0.808-1.002,1.038-1.594c0.222-0.572,0.375-1.227,0.418-2.185 C20.99,14.751,21,14.444,21,12s-0.01-2.751-0.054-3.711c-0.044-0.958-0.196-1.612-0.418-2.185c-0.23-0.592-0.538-1.094-1.038-1.594 c-0.5-0.5-1.002-0.808-1.594-1.038c-0.572-0.222-1.227-0.375-2.185-0.418C14.751,3.01,14.444,3,12,3L12,3z M12,7.378 c-2.552,0-4.622,2.069-4.622,4.622S9.448,16.622,12,16.622s4.622-2.069,4.622-4.622S14.552,7.378,12,7.378z M12,15 c-1.657,0-3-1.343-3-3s1.343-3,3-3s3,1.343,3,3S13.657,15,12,15z M16.804,6.116c-0.596,0-1.08,0.484-1.08,1.08 s0.484,1.08,1.08,1.08c0.596,0,1.08-0.484,1.08-1.08S17.401,6.116,16.804,6.116z"}))},{name:"lastfm",attributes:{service:"lastfm"},title:"Last.fm",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M 12.0002 1.5 C 6.2006 1.5 1.5 6.2011 1.5 11.9998 C 1.5 17.799 6.2006 22.5 12.0002 22.5 C 17.799 22.5 22.5 17.799 22.5 11.9998 C 22.5 6.2011 17.799 1.5 12.0002 1.5 Z M 16.1974 16.2204 C 14.8164 16.2152 13.9346 15.587 13.3345 14.1859 L 13.1816 13.8451 L 11.8541 10.8101 C 11.4271 9.7688 10.3526 9.0712 9.1801 9.0712 C 7.5695 9.0712 6.2593 10.3851 6.2593 12.001 C 6.2593 13.6165 7.5695 14.9303 9.1801 14.9303 C 10.272 14.9303 11.2651 14.3275 11.772 13.3567 C 11.7893 13.3235 11.8239 13.302 11.863 13.3038 C 11.9007 13.3054 11.9353 13.3288 11.9504 13.3632 L 12.4865 14.6046 C 12.5016 14.639 12.4956 14.6778 12.4723 14.7069 C 11.6605 15.6995 10.4602 16.2683 9.1801 16.2683 C 6.8331 16.2683 4.9234 14.3536 4.9234 12.001 C 4.9234 9.6468 6.833 7.732 9.1801 7.732 C 10.9572 7.732 12.3909 8.6907 13.1138 10.3636 C 13.1206 10.3802 13.8412 12.0708 14.4744 13.5191 C 14.8486 14.374 15.1462 14.896 16.1288 14.9292 C 17.0663 14.9613 17.7538 14.4122 17.7538 13.6485 C 17.7538 12.9691 17.3321 12.8004 16.3803 12.4822 C 14.7365 11.9398 13.845 11.3861 13.845 10.0182 C 13.845 8.6809 14.7667 7.8162 16.192 7.8162 C 17.1288 7.8162 17.8155 8.2287 18.2921 9.0768 C 18.305 9.1006 18.3079 9.1281 18.3004 9.1542 C 18.2929 9.1803 18.2748 9.2021 18.2507 9.2138 L 17.3614 9.669 C 17.3178 9.692 17.2643 9.6781 17.2356 9.6385 C 16.9329 9.2135 16.5956 9.0251 16.1423 9.0251 C 15.5512 9.0251 15.122 9.429 15.122 9.9865 C 15.122 10.6738 15.6529 10.8414 16.5339 11.1192 C 16.6491 11.1558 16.7696 11.194 16.8939 11.2343 C 18.2763 11.6865 19.0768 12.2311 19.0768 13.6836 C 19.0769 15.1297 17.8389 16.2204 16.1974 16.2204 Z"}))},{name:"linkedin",attributes:{service:"linkedin"},title:"LinkedIn",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"}))},{name:"mail",attributes:{service:"mail"},title:"Mail",keywords:["email","e-mail"],icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l7.5 5.6 7.5-5.6V17zm0-9.1L12 13.6 4.5 7.9V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v.9z"}))},{name:"mastodon",attributes:{service:"mastodon"},title:"Mastodon",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M23.193 7.879c0-5.206-3.411-6.732-3.411-6.732C18.062.357 15.108.025 12.041 0h-.076c-3.068.025-6.02.357-7.74 1.147 0 0-3.411 1.526-3.411 6.732 0 1.192-.023 2.618.015 4.129.124 5.092.934 10.109 5.641 11.355 2.17.574 4.034.695 5.535.612 2.722-.15 4.25-.972 4.25-.972l-.09-1.975s-1.945.613-4.129.539c-2.165-.074-4.449-.233-4.799-2.891a5.499 5.499 0 0 1-.048-.745s2.125.52 4.817.643c1.646.075 3.19-.097 4.758-.283 3.007-.359 5.625-2.212 5.954-3.905.517-2.665.475-6.507.475-6.507zm-4.024 6.709h-2.497V8.469c0-1.29-.543-1.944-1.628-1.944-1.2 0-1.802.776-1.802 2.312v3.349h-2.483v-3.35c0-1.536-.602-2.312-1.802-2.312-1.085 0-1.628.655-1.628 1.944v6.119H4.832V8.284c0-1.289.328-2.313.987-3.07.68-.758 1.569-1.146 2.674-1.146 1.278 0 2.246.491 2.886 1.474L12 6.585l.622-1.043c.64-.983 1.608-1.474 2.886-1.474 1.104 0 1.994.388 2.674 1.146.658.757.986 1.781.986 3.07v6.304z"}))},{name:"meetup",attributes:{service:"meetup"},title:"Meetup",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M19.24775,14.722a3.57032,3.57032,0,0,1-2.94457,3.52073,3.61886,3.61886,0,0,1-.64652.05634c-.07314-.0008-.10187.02846-.12507.09547A2.38881,2.38881,0,0,1,13.49453,20.094a2.33092,2.33092,0,0,1-1.827-.50716.13635.13635,0,0,0-.19878-.00408,3.191,3.191,0,0,1-2.104.60248,3.26309,3.26309,0,0,1-3.00324-2.71993,2.19076,2.19076,0,0,1-.03512-.30865c-.00156-.08579-.03413-.1189-.11608-.13493a2.86421,2.86421,0,0,1-1.23189-.56111,2.945,2.945,0,0,1-1.166-2.05749,2.97484,2.97484,0,0,1,.87524-2.50774.112.112,0,0,0,.02091-.16107,2.7213,2.7213,0,0,1-.36648-1.48A2.81256,2.81256,0,0,1,6.57673,7.58838a.35764.35764,0,0,0,.28869-.22819,4.2208,4.2208,0,0,1,6.02892-1.90111.25161.25161,0,0,0,.22023.0243,3.65608,3.65608,0,0,1,3.76031.90678A3.57244,3.57244,0,0,1,17.95918,8.626a2.97339,2.97339,0,0,1,.01829.57356.10637.10637,0,0,0,.0853.12792,1.97669,1.97669,0,0,1,1.27939,1.33733,2.00266,2.00266,0,0,1-.57112,2.12652c-.05284.05166-.04168.08328-.01173.13489A3.51189,3.51189,0,0,1,19.24775,14.722Zm-6.35959-.27836a1.6984,1.6984,0,0,0,1.14556,1.61113,3.82039,3.82039,0,0,0,1.036.17935,1.46888,1.46888,0,0,0,.73509-.12255.44082.44082,0,0,0,.26057-.44274.45312.45312,0,0,0-.29211-.43375.97191.97191,0,0,0-.20678-.063c-.21326-.03806-.42754-.0701-.63973-.11215a.54787.54787,0,0,1-.50172-.60926,2.75864,2.75864,0,0,1,.1773-.901c.1763-.535.414-1.045.64183-1.55913A12.686,12.686,0,0,0,15.85,10.47863a1.58461,1.58461,0,0,0,.04861-.87208,1.04531,1.04531,0,0,0-.85432-.83981,1.60658,1.60658,0,0,0-1.23654.16594.27593.27593,0,0,1-.36286-.03413c-.085-.0747-.16594-.15379-.24918-.23055a.98682.98682,0,0,0-1.33577-.04933,6.1468,6.1468,0,0,1-.4989.41615.47762.47762,0,0,1-.51535.03566c-.17448-.09307-.35512-.175-.53531-.25665a1.74949,1.74949,0,0,0-.56476-.2016,1.69943,1.69943,0,0,0-1.61654.91787,8.05815,8.05815,0,0,0-.32952.80126c-.45471,1.2557-.82507,2.53825-1.20838,3.81639a1.24151,1.24151,0,0,0,.51532,1.44389,1.42659,1.42659,0,0,0,1.22008.17166,1.09728,1.09728,0,0,0,.66994-.69764c.44145-1.04111.839-2.09989,1.25981-3.14926.11581-.28876.22792-.57874.35078-.86438a.44548.44548,0,0,1,.69189-.19539.50521.50521,0,0,1,.15044.43836,1.75625,1.75625,0,0,1-.14731.50453c-.27379.69219-.55265,1.38236-.82766,2.074a2.0836,2.0836,0,0,0-.14038.42876.50719.50719,0,0,0,.27082.57722.87236.87236,0,0,0,.66145.02739.99137.99137,0,0,0,.53406-.532q.61571-1.20914,1.228-2.42031.28423-.55863.57585-1.1133a.87189.87189,0,0,1,.29055-.35253.34987.34987,0,0,1,.37634-.01265.30291.30291,0,0,1,.12434.31459.56716.56716,0,0,1-.04655.1915c-.05318.12739-.10286.25669-.16183.38156-.34118.71775-.68754,1.43273-1.02568,2.152A2.00213,2.00213,0,0,0,12.88816,14.44366Zm4.78568,5.28972a.88573.88573,0,0,0-1.77139.00465.8857.8857,0,0,0,1.77139-.00465Zm-14.83838-7.296a.84329.84329,0,1,0,.00827-1.68655.8433.8433,0,0,0-.00827,1.68655Zm10.366-9.43673a.83506.83506,0,1,0-.0091,1.67.83505.83505,0,0,0,.0091-1.67Zm6.85014,5.22a.71651.71651,0,0,0-1.433.0093.71656.71656,0,0,0,1.433-.0093ZM5.37528,6.17908A.63823.63823,0,1,0,6.015,5.54483.62292.62292,0,0,0,5.37528,6.17908Zm6.68214,14.80843a.54949.54949,0,1,0-.55052.541A.54556.54556,0,0,0,12.05742,20.98752Zm8.53235-8.49689a.54777.54777,0,0,0-.54027.54023.53327.53327,0,0,0,.532.52293.51548.51548,0,0,0,.53272-.5237A.53187.53187,0,0,0,20.58977,12.49063ZM7.82846,2.4715a.44927.44927,0,1,0,.44484.44766A.43821.43821,0,0,0,7.82846,2.4715Zm13.775,7.60492a.41186.41186,0,0,0-.40065.39623.40178.40178,0,0,0,.40168.40168A.38994.38994,0,0,0,22,10.48172.39946.39946,0,0,0,21.60349,10.07642ZM5.79193,17.96207a.40469.40469,0,0,0-.397-.39646.399.399,0,0,0-.396.405.39234.39234,0,0,0,.39939.389A.39857.39857,0,0,0,5.79193,17.96207Z"}))},{name:"medium",attributes:{service:"medium"},title:"Medium",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M20.962,7.257l-5.457,8.867l-3.923-6.375l3.126-5.08c0.112-0.182,0.319-0.286,0.527-0.286c0.05,0,0.1,0.008,0.149,0.02 c0.039,0.01,0.078,0.023,0.114,0.041l5.43,2.715l0.006,0.003c0.004,0.002,0.007,0.006,0.011,0.008 C20.971,7.191,20.98,7.227,20.962,7.257z M9.86,8.592v5.783l5.14,2.57L9.86,8.592z M15.772,17.331l4.231,2.115 C20.554,19.721,21,19.529,21,19.016V8.835L15.772,17.331z M8.968,7.178L3.665,4.527C3.569,4.479,3.478,4.456,3.395,4.456 C3.163,4.456,3,4.636,3,4.938v11.45c0,0.306,0.224,0.669,0.498,0.806l4.671,2.335c0.12,0.06,0.234,0.088,0.337,0.088 c0.29,0,0.494-0.225,0.494-0.602V7.231C9,7.208,8.988,7.188,8.968,7.178z"}))},{name:"patreon",attributes:{service:"patreon"},title:"Patreon",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M20 8.40755C19.9969 6.10922 18.2543 4.22555 16.2097 3.54588C13.6708 2.70188 10.3222 2.82421 7.89775 3.99921C4.95932 5.42355 4.03626 8.54355 4.00186 11.6552C3.97363 14.2136 4.2222 20.9517 7.92225 20.9997C10.6715 21.0356 11.0809 17.3967 12.3529 15.6442C13.258 14.3974 14.4233 14.0452 15.8578 13.6806C18.3233 13.0537 20.0036 11.0551 20 8.40755Z"}))},{name:"pinterest",attributes:{service:"pinterest"},title:"Pinterest",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M12.289,2C6.617,2,3.606,5.648,3.606,9.622c0,1.846,1.025,4.146,2.666,4.878c0.25,0.111,0.381,0.063,0.439-0.169 c0.044-0.175,0.267-1.029,0.365-1.428c0.032-0.128,0.017-0.237-0.091-0.362C6.445,11.911,6.01,10.75,6.01,9.668 c0-2.777,2.194-5.464,5.933-5.464c3.23,0,5.49,2.108,5.49,5.122c0,3.407-1.794,5.768-4.13,5.768c-1.291,0-2.257-1.021-1.948-2.277 c0.372-1.495,1.089-3.112,1.089-4.191c0-0.967-0.542-1.775-1.663-1.775c-1.319,0-2.379,1.309-2.379,3.059 c0,1.115,0.394,1.869,0.394,1.869s-1.302,5.279-1.54,6.261c-0.405,1.666,0.053,4.368,0.094,4.604 c0.021,0.126,0.167,0.169,0.25,0.063c0.129-0.165,1.699-2.419,2.142-4.051c0.158-0.59,0.817-2.995,0.817-2.995 c0.43,0.784,1.681,1.446,3.013,1.446c3.963,0,6.822-3.494,6.822-7.833C20.394,5.112,16.849,2,12.289,2"}))},{name:"pocket",attributes:{service:"pocket"},title:"Pocket",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M21.927,4.194C21.667,3.48,20.982,3,20.222,3h-0.01h-1.721H3.839C3.092,3,2.411,3.47,2.145,4.17 C2.066,4.378,2.026,4.594,2.026,4.814v6.035l0.069,1.2c0.29,2.73,1.707,5.115,3.899,6.778c0.039,0.03,0.079,0.059,0.119,0.089 l0.025,0.018c1.175,0.859,2.491,1.441,3.91,1.727c0.655,0.132,1.325,0.2,1.991,0.2c0.615,0,1.232-0.057,1.839-0.17 c0.073-0.014,0.145-0.028,0.219-0.044c0.02-0.004,0.042-0.012,0.064-0.023c1.359-0.297,2.621-0.864,3.753-1.691l0.025-0.018 c0.04-0.029,0.08-0.058,0.119-0.089c2.192-1.664,3.609-4.049,3.898-6.778l0.069-1.2V4.814C22.026,4.605,22,4.398,21.927,4.194z M17.692,10.481l-4.704,4.512c-0.266,0.254-0.608,0.382-0.949,0.382c-0.342,0-0.684-0.128-0.949-0.382l-4.705-4.512 C5.838,9.957,5.82,9.089,6.344,8.542c0.524-0.547,1.392-0.565,1.939-0.04l3.756,3.601l3.755-3.601 c0.547-0.524,1.415-0.506,1.939,0.04C18.256,9.089,18.238,9.956,17.692,10.481z"}))},{name:"reddit",attributes:{service:"reddit"},title:"Reddit",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M22 12.068a2.184 2.184 0 0 0-2.186-2.186c-.592 0-1.13.233-1.524.609-1.505-1.075-3.566-1.774-5.86-1.864l1.004-4.695 3.261.699A1.56 1.56 0 1 0 18.255 3c-.61-.001-1.147.357-1.398.877l-3.638-.77a.382.382 0 0 0-.287.053.348.348 0 0 0-.161.251l-1.112 5.233c-2.33.072-4.426.77-5.95 1.864a2.201 2.201 0 0 0-1.523-.61 2.184 2.184 0 0 0-.896 4.176c-.036.215-.053.43-.053.663 0 3.37 3.924 6.111 8.763 6.111s8.763-2.724 8.763-6.11c0-.216-.017-.449-.053-.664A2.207 2.207 0 0 0 22 12.068Zm-15.018 1.56a1.56 1.56 0 0 1 3.118 0c0 .86-.699 1.558-1.559 1.558-.86.018-1.559-.699-1.559-1.559Zm8.728 4.139c-1.076 1.075-3.119 1.147-3.71 1.147-.61 0-2.652-.09-3.71-1.147a.4.4 0 0 1 0-.573.4.4 0 0 1 .574 0c.68.68 2.114.914 3.136.914 1.022 0 2.473-.233 3.136-.914a.4.4 0 0 1 .574 0 .436.436 0 0 1 0 .573Zm-.287-2.563a1.56 1.56 0 0 1 0-3.118c.86 0 1.56.699 1.56 1.56 0 .841-.7 1.558-1.56 1.558Z"}))},{name:"skype",attributes:{service:"skype"},title:"Skype",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M10.113,2.699c0.033-0.006,0.067-0.013,0.1-0.02c0.033,0.017,0.066,0.033,0.098,0.051L10.113,2.699z M2.72,10.223 c-0.006,0.034-0.011,0.069-0.017,0.103c0.018,0.032,0.033,0.064,0.051,0.095L2.72,10.223z M21.275,13.771 c0.007-0.035,0.011-0.071,0.018-0.106c-0.018-0.031-0.033-0.064-0.052-0.095L21.275,13.771z M13.563,21.199 c0.032,0.019,0.065,0.035,0.096,0.053c0.036-0.006,0.071-0.011,0.105-0.017L13.563,21.199z M22,16.386 c0,1.494-0.581,2.898-1.637,3.953c-1.056,1.057-2.459,1.637-3.953,1.637c-0.967,0-1.914-0.251-2.75-0.725 c0.036-0.006,0.071-0.011,0.105-0.017l-0.202-0.035c0.032,0.019,0.065,0.035,0.096,0.053c-0.543,0.096-1.099,0.147-1.654,0.147 c-1.275,0-2.512-0.25-3.676-0.743c-1.125-0.474-2.135-1.156-3.002-2.023c-0.867-0.867-1.548-1.877-2.023-3.002 c-0.493-1.164-0.743-2.401-0.743-3.676c0-0.546,0.049-1.093,0.142-1.628c0.018,0.032,0.033,0.064,0.051,0.095L2.72,10.223 c-0.006,0.034-0.011,0.069-0.017,0.103C2.244,9.5,2,8.566,2,7.615c0-1.493,0.582-2.898,1.637-3.953 c1.056-1.056,2.46-1.638,3.953-1.638c0.915,0,1.818,0.228,2.622,0.655c-0.033,0.007-0.067,0.013-0.1,0.02l0.199,0.031 c-0.032-0.018-0.066-0.034-0.098-0.051c0.002,0,0.003-0.001,0.004-0.001c0.586-0.112,1.187-0.169,1.788-0.169 c1.275,0,2.512,0.249,3.676,0.742c1.124,0.476,2.135,1.156,3.002,2.024c0.868,0.867,1.548,1.877,2.024,3.002 c0.493,1.164,0.743,2.401,0.743,3.676c0,0.575-0.054,1.15-0.157,1.712c-0.018-0.031-0.033-0.064-0.052-0.095l0.034,0.201 c0.007-0.035,0.011-0.071,0.018-0.106C21.754,14.494,22,15.432,22,16.386z M16.817,14.138c0-1.331-0.613-2.743-3.033-3.282 l-2.209-0.49c-0.84-0.192-1.807-0.444-1.807-1.237c0-0.794,0.679-1.348,1.903-1.348c2.468,0,2.243,1.696,3.468,1.696 c0.645,0,1.209-0.379,1.209-1.031c0-1.521-2.435-2.663-4.5-2.663c-2.242,0-4.63,0.952-4.63,3.488c0,1.221,0.436,2.521,2.839,3.123 l2.984,0.745c0.903,0.223,1.129,0.731,1.129,1.189c0,0.762-0.758,1.507-2.129,1.507c-2.679,0-2.307-2.062-3.743-2.062 c-0.645,0-1.113,0.444-1.113,1.078c0,1.236,1.501,2.886,4.856,2.886C15.236,17.737,16.817,16.199,16.817,14.138z"}))},{name:"snapchat",attributes:{service:"snapchat"},title:"Snapchat",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M12.065,2a5.526,5.526,0,0,1,3.132.892A5.854,5.854,0,0,1,17.326,5.4a5.821,5.821,0,0,1,.351,2.33q0,.612-.117,2.487a.809.809,0,0,0,.365.091,1.93,1.93,0,0,0,.664-.176,1.93,1.93,0,0,1,.664-.176,1.3,1.3,0,0,1,.729.234.7.7,0,0,1,.351.6.839.839,0,0,1-.41.7,2.732,2.732,0,0,1-.9.41,3.192,3.192,0,0,0-.9.378.728.728,0,0,0-.41.618,1.575,1.575,0,0,0,.156.56,6.9,6.9,0,0,0,1.334,1.953,5.6,5.6,0,0,0,1.881,1.315,5.875,5.875,0,0,0,1.042.3.42.42,0,0,1,.365.456q0,.911-2.852,1.341a1.379,1.379,0,0,0-.143.507,1.8,1.8,0,0,1-.182.605.451.451,0,0,1-.429.241,5.878,5.878,0,0,1-.807-.085,5.917,5.917,0,0,0-.833-.085,4.217,4.217,0,0,0-.807.065,2.42,2.42,0,0,0-.82.293,6.682,6.682,0,0,0-.755.5q-.351.267-.755.527a3.886,3.886,0,0,1-.989.436A4.471,4.471,0,0,1,11.831,22a4.307,4.307,0,0,1-1.256-.176,3.784,3.784,0,0,1-.976-.436q-.4-.26-.749-.527a6.682,6.682,0,0,0-.755-.5,2.422,2.422,0,0,0-.807-.293,4.432,4.432,0,0,0-.82-.065,5.089,5.089,0,0,0-.853.1,5,5,0,0,1-.762.1.474.474,0,0,1-.456-.241,1.819,1.819,0,0,1-.182-.618,1.411,1.411,0,0,0-.143-.521q-2.852-.429-2.852-1.341a.42.42,0,0,1,.365-.456,5.793,5.793,0,0,0,1.042-.3,5.524,5.524,0,0,0,1.881-1.315,6.789,6.789,0,0,0,1.334-1.953A1.575,1.575,0,0,0,6,12.9a.728.728,0,0,0-.41-.618,3.323,3.323,0,0,0-.9-.384,2.912,2.912,0,0,1-.9-.41.814.814,0,0,1-.41-.684.71.71,0,0,1,.338-.593,1.208,1.208,0,0,1,.716-.241,1.976,1.976,0,0,1,.625.169,2.008,2.008,0,0,0,.69.169.919.919,0,0,0,.416-.091q-.117-1.849-.117-2.474A5.861,5.861,0,0,1,6.385,5.4,5.516,5.516,0,0,1,8.625,2.819,7.075,7.075,0,0,1,12.062,2Z"}))},{name:"soundcloud",attributes:{service:"soundcloud"},title:"SoundCloud",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M8.9,16.1L9,14L8.9,9.5c0-0.1,0-0.1-0.1-0.1c0,0-0.1-0.1-0.1-0.1c-0.1,0-0.1,0-0.1,0.1c0,0-0.1,0.1-0.1,0.1L8.3,14l0.1,2.1 c0,0.1,0,0.1,0.1,0.1c0,0,0.1,0.1,0.1,0.1C8.8,16.3,8.9,16.3,8.9,16.1z M11.4,15.9l0.1-1.8L11.4,9c0-0.1,0-0.2-0.1-0.2 c0,0-0.1,0-0.1,0s-0.1,0-0.1,0c-0.1,0-0.1,0.1-0.1,0.2l0,0.1l-0.1,5c0,0,0,0.7,0.1,2v0c0,0.1,0,0.1,0.1,0.1c0.1,0.1,0.1,0.1,0.2,0.1 c0.1,0,0.1,0,0.2-0.1c0.1,0,0.1-0.1,0.1-0.2L11.4,15.9z M2.4,12.9L2.5,14l-0.2,1.1c0,0.1,0,0.1-0.1,0.1c0,0-0.1,0-0.1-0.1L2.1,14 l0.1-1.1C2.2,12.9,2.3,12.9,2.4,12.9C2.3,12.9,2.4,12.9,2.4,12.9z M3.1,12.2L3.3,14l-0.2,1.8c0,0.1,0,0.1-0.1,0.1 c-0.1,0-0.1,0-0.1-0.1L2.8,14L3,12.2C3,12.2,3,12.2,3.1,12.2C3.1,12.2,3.1,12.2,3.1,12.2z M3.9,11.9L4.1,14l-0.2,2.1 c0,0.1,0,0.1-0.1,0.1c-0.1,0-0.1,0-0.1-0.1L3.5,14l0.2-2.1c0-0.1,0-0.1,0.1-0.1C3.9,11.8,3.9,11.8,3.9,11.9z M4.7,11.9L4.9,14 l-0.2,2.1c0,0.1-0.1,0.1-0.1,0.1c-0.1,0-0.1,0-0.1-0.1L4.3,14l0.2-2.2c0-0.1,0-0.1,0.1-0.1C4.7,11.7,4.7,11.8,4.7,11.9z M5.6,12 l0.2,2l-0.2,2.1c0,0.1-0.1,0.1-0.1,0.1c0,0-0.1,0-0.1,0c0,0,0-0.1,0-0.1L5.1,14l0.2-2c0,0,0-0.1,0-0.1s0.1,0,0.1,0 C5.5,11.9,5.5,11.9,5.6,12L5.6,12z M6.4,10.7L6.6,14l-0.2,2.1c0,0,0,0.1,0,0.1c0,0-0.1,0-0.1,0c-0.1,0-0.1-0.1-0.2-0.2L5.9,14 l0.2-3.3c0-0.1,0.1-0.2,0.2-0.2c0,0,0.1,0,0.1,0C6.4,10.7,6.4,10.7,6.4,10.7z M7.2,10l0.2,4.1l-0.2,2.1c0,0,0,0.1,0,0.1 c0,0-0.1,0-0.1,0c-0.1,0-0.2-0.1-0.2-0.2l-0.1-2.1L6.8,10c0-0.1,0.1-0.2,0.2-0.2c0,0,0.1,0,0.1,0S7.2,9.9,7.2,10z M8,9.6L8.2,14 L8,16.1c0,0.1-0.1,0.2-0.2,0.2c-0.1,0-0.2-0.1-0.2-0.2L7.5,14l0.1-4.4c0-0.1,0-0.1,0.1-0.1c0,0,0.1-0.1,0.1-0.1c0.1,0,0.1,0,0.1,0.1 C8,9.6,8,9.6,8,9.6z M11.4,16.1L11.4,16.1L11.4,16.1z M9.7,9.6L9.8,14l-0.1,2.1c0,0.1,0,0.1-0.1,0.2s-0.1,0.1-0.2,0.1 c-0.1,0-0.1,0-0.1-0.1s-0.1-0.1-0.1-0.2L9.2,14l0.1-4.4c0-0.1,0-0.1,0.1-0.2s0.1-0.1,0.2-0.1c0.1,0,0.1,0,0.2,0.1S9.7,9.5,9.7,9.6 L9.7,9.6z M10.6,9.8l0.1,4.3l-0.1,2c0,0.1,0,0.1-0.1,0.2c0,0-0.1,0.1-0.2,0.1c-0.1,0-0.1,0-0.2-0.1c0,0-0.1-0.1-0.1-0.2L10,14 l0.1-4.3c0-0.1,0-0.1,0.1-0.2c0,0,0.1-0.1,0.2-0.1c0.1,0,0.1,0,0.2,0.1S10.6,9.7,10.6,9.8z M12.4,14l-0.1,2c0,0.1,0,0.1-0.1,0.2 c-0.1,0.1-0.1,0.1-0.2,0.1c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2l-0.1-1l-0.1-1l0.1-5.5v0c0-0.1,0-0.2,0.1-0.2 c0.1,0,0.1-0.1,0.2-0.1c0,0,0.1,0,0.1,0c0.1,0,0.1,0.1,0.1,0.2L12.4,14z M22.1,13.9c0,0.7-0.2,1.3-0.7,1.7c-0.5,0.5-1.1,0.7-1.7,0.7 h-6.8c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2V8.2c0-0.1,0.1-0.2,0.2-0.3c0.5-0.2,1-0.3,1.6-0.3c1.1,0,2.1,0.4,2.9,1.1 c0.8,0.8,1.3,1.7,1.4,2.8c0.3-0.1,0.6-0.2,1-0.2c0.7,0,1.3,0.2,1.7,0.7C21.8,12.6,22.1,13.2,22.1,13.9L22.1,13.9z"}))},{name:"spotify",attributes:{service:"spotify"},title:"Spotify",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M12,2C6.477,2,2,6.477,2,12c0,5.523,4.477,10,10,10c5.523,0,10-4.477,10-10C22,6.477,17.523,2,12,2 M16.586,16.424 c-0.18,0.295-0.563,0.387-0.857,0.207c-2.348-1.435-5.304-1.76-8.785-0.964c-0.335,0.077-0.67-0.133-0.746-0.469 c-0.077-0.335,0.132-0.67,0.469-0.746c3.809-0.871,7.077-0.496,9.713,1.115C16.673,15.746,16.766,16.13,16.586,16.424 M17.81,13.7 c-0.226,0.367-0.706,0.482-1.072,0.257c-2.687-1.652-6.785-2.131-9.965-1.166C6.36,12.917,5.925,12.684,5.8,12.273 C5.675,11.86,5.908,11.425,6.32,11.3c3.632-1.102,8.147-0.568,11.234,1.328C17.92,12.854,18.035,13.335,17.81,13.7 M17.915,10.865 c-3.223-1.914-8.54-2.09-11.618-1.156C5.804,9.859,5.281,9.58,5.131,9.086C4.982,8.591,5.26,8.069,5.755,7.919 c3.532-1.072,9.404-0.865,13.115,1.338c0.445,0.264,0.59,0.838,0.327,1.282C18.933,10.983,18.359,11.129,17.915,10.865"}))},{name:"telegram",attributes:{service:"telegram"},title:"Telegram",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 128 128",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M28.9700376,63.3244248 C47.6273373,55.1957357 60.0684594,49.8368063 66.2934036,47.2476366 C84.0668845,39.855031 87.7600616,38.5708563 90.1672227,38.528 C90.6966555,38.5191258 91.8804274,38.6503351 92.6472251,39.2725385 C93.294694,39.7979149 93.4728387,40.5076237 93.5580865,41.0057381 C93.6433345,41.5038525 93.7494885,42.63857 93.6651041,43.5252052 C92.7019529,53.6451182 88.5344133,78.2034783 86.4142057,89.5379542 C85.5170662,94.3339958 83.750571,95.9420841 82.0403991,96.0994568 C78.3237996,96.4414641 75.5015827,93.6432685 71.9018743,91.2836143 C66.2690414,87.5912212 63.0868492,85.2926952 57.6192095,81.6896017 C51.3004058,77.5256038 55.3966232,75.2369981 58.9976911,71.4967761 C59.9401076,70.5179421 76.3155302,55.6232293 76.6324771,54.2720454 C76.6721165,54.1030573 76.7089039,53.4731496 76.3346867,53.1405352 C75.9604695,52.8079208 75.4081573,52.921662 75.0095933,53.0121213 C74.444641,53.1403447 65.4461175,59.0880351 48.0140228,70.8551922 C45.4598218,72.6091037 43.1463059,73.4636682 41.0734751,73.4188859 C38.7883453,73.3695169 34.3926725,72.1268388 31.1249416,71.0646282 C27.1169366,69.7617838 23.931454,69.0729605 24.208838,66.8603276 C24.3533167,65.7078514 25.9403832,64.5292172 28.9700376,63.3244248 Z"}))},{name:"threads",attributes:{service:"threads"},title:"Threads",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M16.3 11.3c-.1 0-.2-.1-.2-.1-.1-2.6-1.5-4-3.9-4-1.4 0-2.6.6-3.3 1.7l1.3.9c.5-.8 1.4-1 2-1 .8 0 1.4.2 1.7.7.3.3.5.8.5 1.3-.7-.1-1.4-.2-2.2-.1-2.2.1-3.7 1.4-3.6 3.2 0 .9.5 1.7 1.3 2.2.7.4 1.5.6 2.4.6 1.2-.1 2.1-.5 2.7-1.3.5-.6.8-1.4.9-2.4.6.3 1 .8 1.2 1.3.4.9.4 2.4-.8 3.6-1.1 1.1-2.3 1.5-4.3 1.5-2.1 0-3.8-.7-4.8-2S5.7 14.3 5.7 12c0-2.3.5-4.1 1.5-5.4 1.1-1.3 2.7-2 4.8-2 2.2 0 3.8.7 4.9 2 .5.7.9 1.5 1.2 2.5l1.5-.4c-.3-1.2-.8-2.2-1.5-3.1-1.3-1.7-3.3-2.6-6-2.6-2.6 0-4.7.9-6 2.6C4.9 7.2 4.3 9.3 4.3 12s.6 4.8 1.9 6.4c1.4 1.7 3.4 2.6 6 2.6 2.3 0 4-.6 5.3-2 1.8-1.8 1.7-4 1.1-5.4-.4-.9-1.2-1.7-2.3-2.3zm-4 3.8c-1 .1-2-.4-2-1.3 0-.7.5-1.5 2.1-1.6h.5c.6 0 1.1.1 1.6.2-.2 2.3-1.3 2.7-2.2 2.7z"}))},{name:"tiktok",attributes:{service:"tiktok"},title:"TikTok",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 32 32",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M16.708 0.027c1.745-0.027 3.48-0.011 5.213-0.027 0.105 2.041 0.839 4.12 2.333 5.563 1.491 1.479 3.6 2.156 5.652 2.385v5.369c-1.923-0.063-3.855-0.463-5.6-1.291-0.76-0.344-1.468-0.787-2.161-1.24-0.009 3.896 0.016 7.787-0.025 11.667-0.104 1.864-0.719 3.719-1.803 5.255-1.744 2.557-4.771 4.224-7.88 4.276-1.907 0.109-3.812-0.411-5.437-1.369-2.693-1.588-4.588-4.495-4.864-7.615-0.032-0.667-0.043-1.333-0.016-1.984 0.24-2.537 1.495-4.964 3.443-6.615 2.208-1.923 5.301-2.839 8.197-2.297 0.027 1.975-0.052 3.948-0.052 5.923-1.323-0.428-2.869-0.308-4.025 0.495-0.844 0.547-1.485 1.385-1.819 2.333-0.276 0.676-0.197 1.427-0.181 2.145 0.317 2.188 2.421 4.027 4.667 3.828 1.489-0.016 2.916-0.88 3.692-2.145 0.251-0.443 0.532-0.896 0.547-1.417 0.131-2.385 0.079-4.76 0.095-7.145 0.011-5.375-0.016-10.735 0.025-16.093z"}))},{name:"tumblr",attributes:{service:"tumblr"},title:"Tumblr",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M17.04 21.28h-3.28c-2.84 0-4.94-1.37-4.94-5.02v-5.67H6.08V7.5c2.93-.73 4.11-3.3 4.3-5.48h3.01v4.93h3.47v3.65H13.4v4.93c0 1.47.73 2.01 1.92 2.01h1.73v3.75z"}))},{name:"twitch",attributes:{service:"twitch"},title:"Twitch",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M16.499,8.089h-1.636v4.91h1.636V8.089z M12,8.089h-1.637v4.91H12V8.089z M4.228,3.178L3,6.451v13.092h4.499V22h2.456 l2.454-2.456h3.681L21,14.636V3.178H4.228z M19.364,13.816l-2.864,2.865H12l-2.453,2.453V16.68H5.863V4.814h13.501V13.816z"}))},{name:"twitter",attributes:{service:"twitter"},title:"Twitter",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M22.23,5.924c-0.736,0.326-1.527,0.547-2.357,0.646c0.847-0.508,1.498-1.312,1.804-2.27 c-0.793,0.47-1.671,0.812-2.606,0.996C18.324,4.498,17.257,4,16.077,4c-2.266,0-4.103,1.837-4.103,4.103 c0,0.322,0.036,0.635,0.106,0.935C8.67,8.867,5.647,7.234,3.623,4.751C3.27,5.357,3.067,6.062,3.067,6.814 c0,1.424,0.724,2.679,1.825,3.415c-0.673-0.021-1.305-0.206-1.859-0.513c0,0.017,0,0.034,0,0.052c0,1.988,1.414,3.647,3.292,4.023 c-0.344,0.094-0.707,0.144-1.081,0.144c-0.264,0-0.521-0.026-0.772-0.074c0.522,1.63,2.038,2.816,3.833,2.85 c-1.404,1.1-3.174,1.756-5.096,1.756c-0.331,0-0.658-0.019-0.979-0.057c1.816,1.164,3.973,1.843,6.29,1.843 c7.547,0,11.675-6.252,11.675-11.675c0-0.178-0.004-0.355-0.012-0.531C20.985,7.47,21.68,6.747,22.23,5.924z"}))},{name:"vimeo",attributes:{service:"vimeo"},title:"Vimeo",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M22.396,7.164c-0.093,2.026-1.507,4.799-4.245,8.32C15.322,19.161,12.928,21,10.97,21c-1.214,0-2.24-1.119-3.079-3.359 c-0.56-2.053-1.119-4.106-1.68-6.159C5.588,9.243,4.921,8.122,4.206,8.122c-0.156,0-0.701,0.328-1.634,0.98L1.594,7.841 c1.027-0.902,2.04-1.805,3.037-2.708C6.001,3.95,7.03,3.327,7.715,3.264c1.619-0.156,2.616,0.951,2.99,3.321 c0.404,2.557,0.685,4.147,0.841,4.769c0.467,2.121,0.981,3.181,1.542,3.181c0.435,0,1.09-0.688,1.963-2.065 c0.871-1.376,1.338-2.422,1.401-3.142c0.125-1.187-0.343-1.782-1.401-1.782c-0.498,0-1.012,0.115-1.541,0.341 c1.023-3.35,2.977-4.977,5.862-4.884C21.511,3.066,22.52,4.453,22.396,7.164z"}))},{name:"vk",attributes:{service:"vk"},title:"VK",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M22,7.1c0.2,0.4-0.4,1.5-1.6,3.1c-0.2,0.2-0.4,0.5-0.7,0.9c-0.5,0.7-0.9,1.1-0.9,1.4c-0.1,0.3-0.1,0.6,0.1,0.8 c0.1,0.1,0.4,0.4,0.8,0.9h0l0,0c1,0.9,1.6,1.7,2,2.3c0,0,0,0.1,0.1,0.1c0,0.1,0,0.1,0.1,0.3c0,0.1,0,0.2,0,0.4 c0,0.1-0.1,0.2-0.3,0.3c-0.1,0.1-0.4,0.1-0.6,0.1l-2.7,0c-0.2,0-0.4,0-0.6-0.1c-0.2-0.1-0.4-0.1-0.5-0.2l-0.2-0.1 c-0.2-0.1-0.5-0.4-0.7-0.7s-0.5-0.6-0.7-0.8c-0.2-0.2-0.4-0.4-0.6-0.6C14.8,15,14.6,15,14.4,15c0,0,0,0-0.1,0c0,0-0.1,0.1-0.2,0.2 c-0.1,0.1-0.2,0.2-0.2,0.3c-0.1,0.1-0.1,0.3-0.2,0.5c-0.1,0.2-0.1,0.5-0.1,0.8c0,0.1,0,0.2,0,0.3c0,0.1-0.1,0.2-0.1,0.2l0,0.1 c-0.1,0.1-0.3,0.2-0.6,0.2h-1.2c-0.5,0-1,0-1.5-0.2c-0.5-0.1-1-0.3-1.4-0.6s-0.7-0.5-1.1-0.7s-0.6-0.4-0.7-0.6l-0.3-0.3 c-0.1-0.1-0.2-0.2-0.3-0.3s-0.4-0.5-0.7-0.9s-0.7-1-1.1-1.6c-0.4-0.6-0.8-1.3-1.3-2.2C2.9,9.4,2.5,8.5,2.1,7.5C2,7.4,2,7.3,2,7.2 c0-0.1,0-0.1,0-0.2l0-0.1c0.1-0.1,0.3-0.2,0.6-0.2l2.9,0c0.1,0,0.2,0,0.2,0.1S5.9,6.9,5.9,7L6,7c0.1,0.1,0.2,0.2,0.3,0.3 C6.4,7.7,6.5,8,6.7,8.4C6.9,8.8,7,9,7.1,9.2l0.2,0.3c0.2,0.4,0.4,0.8,0.6,1.1c0.2,0.3,0.4,0.5,0.5,0.7s0.3,0.3,0.4,0.4 c0.1,0.1,0.3,0.1,0.4,0.1c0.1,0,0.2,0,0.3-0.1c0,0,0,0,0.1-0.1c0,0,0.1-0.1,0.1-0.2c0.1-0.1,0.1-0.3,0.1-0.5c0-0.2,0.1-0.5,0.1-0.8 c0-0.4,0-0.8,0-1.3c0-0.3,0-0.5-0.1-0.8c0-0.2-0.1-0.4-0.1-0.5L9.6,7.6C9.4,7.3,9.1,7.2,8.7,7.1C8.6,7.1,8.6,7,8.7,6.9 C8.9,6.7,9,6.6,9.1,6.5c0.4-0.2,1.2-0.3,2.5-0.3c0.6,0,1,0.1,1.4,0.1c0.1,0,0.3,0.1,0.3,0.1c0.1,0.1,0.2,0.1,0.2,0.3 c0,0.1,0.1,0.2,0.1,0.3s0,0.3,0,0.5c0,0.2,0,0.4,0,0.6c0,0.2,0,0.4,0,0.7c0,0.3,0,0.6,0,0.9c0,0.1,0,0.2,0,0.4c0,0.2,0,0.4,0,0.5 c0,0.1,0,0.3,0,0.4s0.1,0.3,0.1,0.4c0.1,0.1,0.1,0.2,0.2,0.3c0.1,0,0.1,0,0.2,0c0.1,0,0.2,0,0.3-0.1c0.1-0.1,0.2-0.2,0.4-0.4 s0.3-0.4,0.5-0.7c0.2-0.3,0.5-0.7,0.7-1.1c0.4-0.7,0.8-1.5,1.1-2.3c0-0.1,0.1-0.1,0.1-0.2c0-0.1,0.1-0.1,0.1-0.1l0,0l0.1,0 c0,0,0,0,0.1,0s0.2,0,0.2,0l3,0c0.3,0,0.5,0,0.7,0S21.9,7,21.9,7L22,7.1z"}))},{name:"whatsapp",attributes:{service:"whatsapp"},title:"WhatsApp",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M 12.011719 2 C 6.5057187 2 2.0234844 6.478375 2.0214844 11.984375 C 2.0204844 13.744375 2.4814687 15.462563 3.3554688 16.976562 L 2 22 L 7.2324219 20.763672 C 8.6914219 21.559672 10.333859 21.977516 12.005859 21.978516 L 12.009766 21.978516 C 17.514766 21.978516 21.995047 17.499141 21.998047 11.994141 C 22.000047 9.3251406 20.962172 6.8157344 19.076172 4.9277344 C 17.190172 3.0407344 14.683719 2.001 12.011719 2 z M 12.009766 4 C 14.145766 4.001 16.153109 4.8337969 17.662109 6.3417969 C 19.171109 7.8517969 20.000047 9.8581875 19.998047 11.992188 C 19.996047 16.396187 16.413812 19.978516 12.007812 19.978516 C 10.674812 19.977516 9.3544062 19.642812 8.1914062 19.007812 L 7.5175781 18.640625 L 6.7734375 18.816406 L 4.8046875 19.28125 L 5.2851562 17.496094 L 5.5019531 16.695312 L 5.0878906 15.976562 C 4.3898906 14.768562 4.0204844 13.387375 4.0214844 11.984375 C 4.0234844 7.582375 7.6067656 4 12.009766 4 z M 8.4765625 7.375 C 8.3095625 7.375 8.0395469 7.4375 7.8105469 7.6875 C 7.5815469 7.9365 6.9355469 8.5395781 6.9355469 9.7675781 C 6.9355469 10.995578 7.8300781 12.182609 7.9550781 12.349609 C 8.0790781 12.515609 9.68175 15.115234 12.21875 16.115234 C 14.32675 16.946234 14.754891 16.782234 15.212891 16.740234 C 15.670891 16.699234 16.690438 16.137687 16.898438 15.554688 C 17.106437 14.971687 17.106922 14.470187 17.044922 14.367188 C 16.982922 14.263188 16.816406 14.201172 16.566406 14.076172 C 16.317406 13.951172 15.090328 13.348625 14.861328 13.265625 C 14.632328 13.182625 14.464828 13.140625 14.298828 13.390625 C 14.132828 13.640625 13.655766 14.201187 13.509766 14.367188 C 13.363766 14.534188 13.21875 14.556641 12.96875 14.431641 C 12.71875 14.305641 11.914938 14.041406 10.960938 13.191406 C 10.218937 12.530406 9.7182656 11.714844 9.5722656 11.464844 C 9.4272656 11.215844 9.5585938 11.079078 9.6835938 10.955078 C 9.7955938 10.843078 9.9316406 10.663578 10.056641 10.517578 C 10.180641 10.371578 10.223641 10.267562 10.306641 10.101562 C 10.389641 9.9355625 10.347156 9.7890625 10.285156 9.6640625 C 10.223156 9.5390625 9.737625 8.3065 9.515625 7.8125 C 9.328625 7.3975 9.131125 7.3878594 8.953125 7.3808594 C 8.808125 7.3748594 8.6425625 7.375 8.4765625 7.375 z"}))},{name:"x",attributes:{service:"x"},keywords:["twitter"],title:"X",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M13.982 10.622 20.54 3h-1.554l-5.693 6.618L8.745 3H3.5l6.876 10.007L3.5 21h1.554l6.012-6.989L15.868 21h5.245l-7.131-10.378Zm-2.128 2.474-.697-.997-5.543-7.93H8l4.474 6.4.697.996 5.815 8.318h-2.387l-4.745-6.787Z"}))},{name:"yelp",attributes:{service:"yelp"},title:"Yelp",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M12.271,16.718v1.417q-.011,3.257-.067,3.4a.707.707,0,0,1-.569.446,4.637,4.637,0,0,1-2.024-.424A4.609,4.609,0,0,1,7.8,20.565a.844.844,0,0,1-.19-.4.692.692,0,0,1,.044-.29,3.181,3.181,0,0,1,.379-.524q.335-.412,2.019-2.409.011,0,.669-.781a.757.757,0,0,1,.44-.274.965.965,0,0,1,.552.039.945.945,0,0,1,.418.324.732.732,0,0,1,.139.468Zm-1.662-2.8a.783.783,0,0,1-.58.781l-1.339.435q-3.067.981-3.257.981a.711.711,0,0,1-.6-.4,2.636,2.636,0,0,1-.19-.836,9.134,9.134,0,0,1,.011-1.857,3.559,3.559,0,0,1,.335-1.389.659.659,0,0,1,.625-.357,22.629,22.629,0,0,1,2.253.859q.781.324,1.283.524l.937.379a.771.771,0,0,1,.4.34A.982.982,0,0,1,10.609,13.917Zm9.213,3.313a4.467,4.467,0,0,1-1.021,1.8,4.559,4.559,0,0,1-1.512,1.417.671.671,0,0,1-.7-.078q-.156-.112-2.052-3.2l-.524-.859a.761.761,0,0,1-.128-.513.957.957,0,0,1,.217-.513.774.774,0,0,1,.926-.29q.011.011,1.327.446,2.264.736,2.7.887a2.082,2.082,0,0,1,.524.229.673.673,0,0,1,.245.68Zm-7.5-7.049q.056,1.137-.6,1.361-.647.19-1.272-.792L6.237,4.08a.7.7,0,0,1,.212-.691,5.788,5.788,0,0,1,2.314-1,5.928,5.928,0,0,1,2.5-.352.681.681,0,0,1,.547.5q.034.2.245,3.407T12.327,10.181Zm7.384,1.2a.679.679,0,0,1-.29.658q-.167.112-3.67.959-.747.167-1.015.257l.011-.022a.769.769,0,0,1-.513-.044.914.914,0,0,1-.413-.357.786.786,0,0,1,0-.971q.011-.011.836-1.137,1.394-1.908,1.673-2.275a2.423,2.423,0,0,1,.379-.435A.7.7,0,0,1,17.435,8a4.482,4.482,0,0,1,1.372,1.489,4.81,4.81,0,0,1,.9,1.868v.034Z"}))},{name:"youtube",attributes:{service:"youtube"},title:"YouTube",icon:()=>(0,Ke.createElement)(Ye.SVG,{width:"24",height:"24",viewBox:"0 0 24 24",version:"1.1"},(0,Ke.createElement)(Ye.Path,{d:"M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"}))}];Qw.forEach((e=>{e.isActive||(e.isActive=(e,t)=>e.service===t.service)}));const Kw=Qw,Yw=({url:e,setAttributes:t,setPopover:n,popoverAnchor:a,clientId:o})=>{const{removeBlock:r}=(0,gt.useDispatch)(nt.store);return(0,Ke.createElement)(nt.URLPopover,{anchor:a,onClose:()=>n(!1)},(0,Ke.createElement)("form",{className:"block-editor-url-popover__link-editor",onSubmit:e=>{e.preventDefault(),n(!1)}},(0,Ke.createElement)("div",{className:"block-editor-url-input"},(0,Ke.createElement)(nt.URLInput,{__nextHasNoMarginBottom:!0,value:e,onChange:e=>t({url:e}),placeholder:(0,tt.__)("Enter address"),disableSuggestions:!0,onKeyDown:t=>{e||t.defaultPrevented||![fn.BACKSPACE,fn.DELETE].includes(t.keyCode)||r(o)}})),(0,Ke.createElement)(et.Button,{icon:Ww,label:(0,tt.__)("Apply"),type:"submit"})))},Jw=({attributes:e,context:t,isSelected:n,setAttributes:a,clientId:o})=>{const{url:r,service:l,label:i,rel:s}=e,{showLabels:c,iconColor:m,iconColorValue:u,iconBackgroundColor:p,iconBackgroundColorValue:d}=t,[g,h]=(0,_t.useState)(!1),b=ut()("wp-social-link","wp-social-link-"+l,{"wp-social-link__is-incomplete":!r,[`has-${m}-color`]:m,[`has-${p}-background-color`]:p}),[_,y]=(0,_t.useState)(null),v=(e=>{const t=Kw.find((t=>t.name===e));return t?t.icon:Zw})(l),f=(e=>{const t=Kw.find((t=>t.name===e));return t?t.title:(0,tt.__)("Social Icon")})(l),k=null!=i?i:f,x=(0,nt.useBlockProps)({className:b,style:{color:u,backgroundColor:d}});return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.sprintf)((0,tt.__)("%s label"),f),initialOpen:!1},(0,Ke.createElement)(et.PanelRow,null,(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link label"),help:(0,tt.__)("Briefly describe the link to help screen reader users."),value:i||"",onChange:e=>a({label:e})})))),(0,Ke.createElement)(nt.InspectorControls,{group:"advanced"},(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Link rel"),value:s||"",onChange:e=>a({rel:e})})),(0,Ke.createElement)("li",{...x},(0,Ke.createElement)(et.Button,{className:"wp-block-social-link-anchor",ref:y,onClick:()=>h(!0)},(0,Ke.createElement)(v,null),(0,Ke.createElement)("span",{className:ut()("wp-block-social-link-label",{"screen-reader-text":!c})},k),n&&g&&(0,Ke.createElement)(Yw,{url:r,setAttributes:a,setPopover:h,popoverAnchor:_,clientId:o}))))},Xw={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/social-link",title:"Social Icon",category:"widgets",parent:["core/social-links"],description:"Display an icon linking to a social media profile or site.",textdomain:"default",attributes:{url:{type:"string"},service:{type:"string"},label:{type:"string"},rel:{type:"string"}},usesContext:["openInNewTab","showLabels","iconColor","iconColorValue","iconBackgroundColor","iconBackgroundColorValue"],supports:{reusable:!1,html:!1,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-social-link-editor"},{name:eE}=Xw,tE={icon:jw,edit:Jw,variations:Kw},nE=()=>Xe({name:eE,metadata:Xw,settings:tE}),aE=[{attributes:{iconColor:{type:"string"},customIconColor:{type:"string"},iconColorValue:{type:"string"},iconBackgroundColor:{type:"string"},customIconBackgroundColor:{type:"string"},iconBackgroundColorValue:{type:"string"},openInNewTab:{type:"boolean",default:!1},size:{type:"string"}},providesContext:{openInNewTab:"openInNewTab"},supports:{align:["left","center","right"],anchor:!0},migrate:e=>{if(e.layout)return e;const{className:t}=e,n="items-justified-",a=new RegExp(`\\b${n}[^ ]*[ ]?\\b`,"g"),o={...e,className:t?.replace(a,"").trim()},r=t?.match(a)?.[0]?.trim();return r&&Object.assign(o,{layout:{type:"flex",justifyContent:r.slice(16)}}),o},save:e=>{const{attributes:{iconBackgroundColorValue:t,iconColorValue:n,itemsJustification:a,size:o}}=e,r=ut()(o,{"has-icon-color":n,"has-icon-background-color":t,[`items-justified-${a}`]:a}),l={"--wp--social-links--icon-color":n,"--wp--social-links--icon-background-color":t};return(0,Ke.createElement)("ul",{...nt.useBlockProps.save({className:r,style:l})},(0,Ke.createElement)(nt.InnerBlocks.Content,null))}}],oE=aE,rE=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),lE=[{name:(0,tt.__)("Small"),value:"has-small-icon-size"},{name:(0,tt.__)("Normal"),value:"has-normal-icon-size"},{name:(0,tt.__)("Large"),value:"has-large-icon-size"},{name:(0,tt.__)("Huge"),value:"has-huge-icon-size"}];const iE=(0,nt.withColors)({iconColor:"icon-color",iconBackgroundColor:"icon-background-color"})((function(e){var t;const{clientId:n,attributes:a,iconBackgroundColor:o,iconColor:r,isSelected:l,setAttributes:i,setIconBackgroundColor:s,setIconColor:c}=e,{iconBackgroundColorValue:m,customIconBackgroundColor:u,iconColorValue:p,openInNewTab:d,showLabels:g,size:h}=a,b=a.className?.includes("is-style-logos-only"),_=(0,_t.useRef)({});(0,_t.useEffect)((()=>{b?(_.current={iconBackgroundColor:o,iconBackgroundColorValue:m,customIconBackgroundColor:u},i({iconBackgroundColor:void 0,customIconBackgroundColor:void 0,iconBackgroundColorValue:void 0})):i({..._.current})}),[b]);const y=(0,Ke.createElement)("li",{className:"wp-block-social-links__social-placeholder"},(0,Ke.createElement)("div",{className:"wp-block-social-links__social-placeholder-icons"},(0,Ke.createElement)("div",{className:"wp-social-link wp-social-link-twitter"}),(0,Ke.createElement)("div",{className:"wp-social-link wp-social-link-facebook"}),(0,Ke.createElement)("div",{className:"wp-social-link wp-social-link-instagram"}))),v=(0,Ke.createElement)("li",{className:"wp-block-social-links__social-prompt"},(0,tt.__)("Click plus to add")),f=ut()(h,{"has-visible-labels":g,"has-icon-color":r.color||p,"has-icon-background-color":o.color||m}),k=(0,nt.useBlockProps)({className:f}),x=(0,nt.useInnerBlocksProps)(k,{placeholder:l?v:y,templateLock:!1,orientation:null!==(t=a.layout?.orientation)&&void 0!==t?t:"horizontal",__experimentalAppenderTagName:"li"}),w=[{value:r.color||p,onChange:e=>{c(e),i({iconColorValue:e})},label:(0,tt.__)("Icon color"),resetAllFilter:()=>{c(void 0),i({iconColorValue:void 0})}}];b||w.push({value:o.color||m,onChange:e=>{s(e),i({iconBackgroundColorValue:e})},label:(0,tt.__)("Icon background"),resetAllFilter:()=>{s(void 0),i({iconBackgroundColorValue:void 0})}});const E=(0,nt.__experimentalUseMultipleOriginColorsAndGradients)();return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"other"},(0,Ke.createElement)(et.ToolbarDropdownMenu,{label:(0,tt.__)("Size"),text:(0,tt.__)("Size"),icon:null,popoverProps:{position:"bottom right"}},(({onClose:e})=>(0,Ke.createElement)(et.MenuGroup,null,lE.map((t=>(0,Ke.createElement)(et.MenuItem,{icon:(h===t.value||!h&&"has-normal-icon-size"===t.value)&&rE,isSelected:h===t.value,key:t.value,onClick:()=>{i({size:t.value})},onClose:e,role:"menuitemradio"},t.name))))))),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Open links in new tab"),checked:d,onChange:()=>i({openInNewTab:!d})}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show labels"),checked:g,onChange:()=>i({showLabels:!g})}))),E.hasColorsOrGradients&&(0,Ke.createElement)(nt.InspectorControls,{group:"color"},w.map((({onChange:e,label:t,value:a,resetAllFilter:o})=>(0,Ke.createElement)(nt.__experimentalColorGradientSettingsDropdown,{key:`social-links-color-${t}`,__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:a,label:t,onColorChange:e,isShownByDefault:!0,resetAllFilter:o,enableAlpha:!0}],panelId:n,...E}))),!b&&(0,Ke.createElement)(nt.ContrastChecker,{textColor:p,backgroundColor:m,isLargeText:!1})),(0,Ke.createElement)("ul",{...x}))}));const sE={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/social-links",title:"Social Icons",category:"widgets",allowedBlocks:["core/social-link"],description:"Display icons linking to your social media profiles or sites.",keywords:["links"],textdomain:"default",attributes:{iconColor:{type:"string"},customIconColor:{type:"string"},iconColorValue:{type:"string"},iconBackgroundColor:{type:"string"},customIconBackgroundColor:{type:"string"},iconBackgroundColorValue:{type:"string"},openInNewTab:{type:"boolean",default:!1},showLabels:{type:"boolean",default:!1},size:{type:"string"}},providesContext:{openInNewTab:"openInNewTab",showLabels:"showLabels",iconColor:"iconColor",iconColorValue:"iconColorValue",iconBackgroundColor:"iconBackgroundColor",iconBackgroundColorValue:"iconBackgroundColorValue"},supports:{align:["left","center","right"],anchor:!0,__experimentalExposeControlsToChildren:!0,layout:{allowSwitching:!1,allowInheriting:!1,allowVerticalAlignment:!1,default:{type:"flex"}},color:{enableContrastChecker:!1,background:!0,gradients:!0,text:!1,__experimentalDefaultControls:{background:!1}},spacing:{blockGap:["horizontal","vertical"],margin:!0,padding:!0,units:["px","em","rem","vh","vw"],__experimentalDefaultControls:{blockGap:!0,margin:!0,padding:!1}},interactivity:{clientNavigation:!0}},styles:[{name:"default",label:"Default",isDefault:!0},{name:"logos-only",label:"Logos Only"},{name:"pill-shape",label:"Pill Shape"}],editorStyle:"wp-block-social-links-editor",style:"wp-block-social-links"},{name:cE}=sE,mE={example:{innerBlocks:[{name:"core/social-link",attributes:{service:"wordpress",url:"https://wordpress.org"}},{name:"core/social-link",attributes:{service:"facebook",url:"https://www.facebook.com/WordPress/"}},{name:"core/social-link",attributes:{service:"twitter",url:"https://twitter.com/WordPress"}}]},icon:jw,edit:iE,save:function(e){const{attributes:{iconBackgroundColorValue:t,iconColorValue:n,showLabels:a,size:o}}=e,r=ut()(o,{"has-visible-labels":a,"has-icon-color":n,"has-icon-background-color":t}),l=nt.useBlockProps.save({className:r}),i=nt.useInnerBlocksProps.save(l);return(0,Ke.createElement)("ul",{...i})},deprecated:oE},uE=()=>Xe({name:cE,metadata:sE,settings:mE}),pE=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M7 18h4.5v1.5h-7v-7H6V17L17 6h-4.5V4.5h7v7H18V7L7 18Z"})),dE=[{attributes:{height:{type:"number",default:100},width:{type:"number"}},migrate(e){const{height:t,width:n}=e;return{...e,width:void 0!==n?`${n}px`:void 0,height:void 0!==t?`${t}px`:void 0}},save:({attributes:e})=>(0,Ke.createElement)("div",{...nt.useBlockProps.save({style:{height:e.height,width:e.width},"aria-hidden":!0})})}],gE=dE,hE=0;function bE({label:e,onChange:t,isResizing:n,value:a=""}){const o=(0,jt.useInstanceId)(et.__experimentalUnitControl,"block-spacer-height-input"),[r,l]=(0,nt.useSettings)("spacing.spacingSizes","spacing.units"),i=l?l.filter((e=>"%"!==e)):["px","em","rem","vw","vh"],s=(0,et.__experimentalUseCustomUnits)({availableUnits:i,defaultValues:{px:100,em:10,rem:10,vw:10,vh:25}}),c=e=>{t(e.all)},[m,u]=(0,et.__experimentalParseQuantityAndUnitFromRawValue)(a),p=(0,nt.isValueSpacingPreset)(a)?a:[m,n?"px":u].join("");return(0,Ke.createElement)(Ke.Fragment,null,(!r||0===r?.length)&&(0,Ke.createElement)(et.BaseControl,{label:e,id:o},(0,Ke.createElement)(et.__experimentalUnitControl,{id:o,isResetValueOnUnitChange:!0,min:hE,onChange:c,style:{maxWidth:80},value:p,units:s})),r?.length>0&&(0,Ke.createElement)(Ye.View,{className:"tools-panel-item-spacing"},(0,Ke.createElement)(nt.__experimentalSpacingSizesControl,{values:{all:p},onChange:c,label:e,sides:["all"],units:s,allowReset:!1,splitOnAxis:!1,showSideInLabel:!1})))}function _E({setAttributes:e,orientation:t,height:n,width:a,isResizing:o}){return(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},"horizontal"===t&&(0,Ke.createElement)(bE,{label:(0,tt.__)("Width"),value:a,onChange:t=>e({width:t}),isResizing:o}),"horizontal"!==t&&(0,Ke.createElement)(bE,{label:(0,tt.__)("Height"),value:n,onChange:t=>e({height:t}),isResizing:o})))}const yE=({orientation:e,onResizeStart:t,onResize:n,onResizeStop:a,isSelected:o,isResizing:r,setIsResizing:l,...i})=>{const s=t=>"horizontal"===e?t.clientWidth:t.clientHeight,c=e=>`${s(e)}px`;return(0,Ke.createElement)(et.ResizableBox,{className:ut()("block-library-spacer__resize-container",{"resize-horizontal":"horizontal"===e,"is-resizing":r,"is-selected":o}),onResizeStart:(e,a,o)=>{const r=c(o);t(r),n(r)},onResize:(e,t,a)=>{n(c(a)),r||l(!0)},onResizeStop:(e,t,n)=>{const o=s(n);a(`${o}px`),l(!1)},__experimentalShowTooltip:!0,__experimentalTooltipProps:{axis:"horizontal"===e?"x":"y",position:"corner",isVisible:r},showHandle:o,...i})},vE=({attributes:e,isSelected:t,setAttributes:n,toggleSelection:a,context:o,__unstableParentLayout:r,className:l})=>{const i=(0,gt.useSelect)((e=>{const t=e(nt.store).getSettings();return t?.disableCustomSpacingSizes})),{orientation:s}=o,{orientation:c,type:m,default:{type:u}={}}=r||{},p="flex"===m||!m&&"flex"===u,d=!c&&p?"horizontal":c||s,{height:g,width:h,style:b={}}=e,{layout:_={}}=b,{selfStretch:y,flexSize:v}=_,[f]=(0,nt.useSettings)("spacing.spacingSizes"),[k,x]=(0,_t.useState)(!1),[w,E]=(0,_t.useState)(null),[C,S]=(0,_t.useState)(null),B=()=>a(!1),N=()=>a(!0),T=e=>{N(),p&&n({style:{...b,layout:{..._,flexSize:e,selfStretch:"fixed"}}}),n({height:e}),E(null)},I=e=>{N(),p&&n({style:{...b,layout:{..._,flexSize:e,selfStretch:"fixed"}}}),n({width:e}),S(null)},P="horizontal"===d?C||v:w||v,M={height:"horizontal"===d?24:(()=>{if(!p)return w||(0,nt.getSpacingPresetCssVar)(g)||void 0})(),width:"horizontal"===d?(()=>{if(!p)return C||(0,nt.getSpacingPresetCssVar)(h)||void 0})():void 0,minWidth:"vertical"===d&&p?48:void 0,flexBasis:p?P:void 0,flexGrow:p&&k?0:void 0};return(0,_t.useEffect)((()=>{if(p&&"fill"!==y&&"fit"!==y&&!v)if("horizontal"===d){const e=(0,nt.getCustomValueFromPreset)(h,f)||(0,nt.getCustomValueFromPreset)(g,f)||"100px";n({width:"0px",style:{...b,layout:{..._,flexSize:e,selfStretch:"fixed"}}})}else{const e=(0,nt.getCustomValueFromPreset)(g,f)||(0,nt.getCustomValueFromPreset)(h,f)||"100px";n({height:"0px",style:{...b,layout:{..._,flexSize:e,selfStretch:"fixed"}}})}else!p||"fill"!==y&&"fit"!==y?p||!y&&!v||(n("horizontal"===d?{width:v}:{height:v}),n({style:{...b,layout:{..._,flexSize:void 0,selfStretch:void 0}}})):n("horizontal"===d?{width:void 0}:{height:void 0})}),[b,v,g,d,p,_,y,n,f,h]),(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(Ye.View,{...(0,nt.useBlockProps)({style:M,className:ut()(l,{"custom-sizes-disabled":i})})},"horizontal"===(z=d)?(0,Ke.createElement)(yE,{minWidth:hE,enable:{top:!1,right:!0,bottom:!1,left:!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},orientation:z,onResizeStart:B,onResize:S,onResizeStop:I,isSelected:t,isResizing:k,setIsResizing:x}):(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(yE,{minHeight:hE,enable:{top:!1,right:!1,bottom:!0,left:!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},orientation:z,onResizeStart:B,onResize:E,onResizeStop:T,isSelected:t,isResizing:k,setIsResizing:x}))),!p&&(0,Ke.createElement)(_E,{setAttributes:n,height:w||g,width:C||h,orientation:d,isResizing:k}));var z};const fE={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/spacer",title:"Spacer",category:"design",description:"Add white space between blocks and customize its height.",textdomain:"default",attributes:{height:{type:"string",default:"100px"},width:{type:"string"}},usesContext:["orientation"],supports:{anchor:!0,spacing:{margin:["top","bottom"],__experimentalDefaultControls:{margin:!0}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-spacer-editor",style:"wp-block-spacer"},{name:kE}=fE,xE={icon:pE,edit:vE,save:function({attributes:e}){const{height:t,width:n,style:a}=e,{layout:{selfStretch:o}={}}=a||{},r="fill"===o||"fit"===o?void 0:t;return(0,Ke.createElement)("div",{...nt.useBlockProps.save({style:{height:(0,nt.getSpacingPresetCssVar)(r),width:(0,nt.getSpacingPresetCssVar)(n)},"aria-hidden":!0})})},deprecated:gE},wE=()=>Xe({name:kE,metadata:fE,settings:xE}),EE=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.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-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z"})),CE={"subtle-light-gray":"#f3f4f5","subtle-pale-green":"#e9fbe5","subtle-pale-blue":"#e7f5fe","subtle-pale-pink":"#fcf0ef"},SE={attributes:{hasFixedLayout:{type:"boolean",default:!1},caption:{type:"string",source:"html",selector:"figcaption",default:""},head:{type:"array",default:[],source:"query",selector:"thead tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"string",source:"html"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"}}}}},body:{type:"array",default:[],source:"query",selector:"tbody tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"string",source:"html"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"}}}}},foot:{type:"array",default:[],source:"query",selector:"tfoot tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"string",source:"html"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"}}}}}},supports:{anchor:!0,align:!0,color:{__experimentalSkipSerialization:!0,gradients:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalDefaultControls:{fontSize:!0}},__experimentalBorder:{__experimentalSkipSerialization:!0,color:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,style:!0,width:!0}},__experimentalSelector:".wp-block-table > table"},save({attributes:e}){const{hasFixedLayout:t,head:n,body:a,foot:o,caption:r}=e;if(!n.length&&!a.length&&!o.length)return null;const l=(0,nt.__experimentalGetColorClassesAndStyles)(e),i=(0,nt.__experimentalGetBorderClassesAndStyles)(e),s=ut()(l.className,i.className,{"has-fixed-layout":t}),c=!nt.RichText.isEmpty(r),m=({type:e,rows:t})=>{if(!t.length)return null;const n=`t${e}`;return(0,Ke.createElement)(n,null,t.map((({cells:e},t)=>(0,Ke.createElement)("tr",{key:t},e.map((({content:e,tag:t,scope:n,align:a},o)=>{const r=ut()({[`has-text-align-${a}`]:a});return(0,Ke.createElement)(nt.RichText.Content,{className:r||void 0,"data-align":a,tagName:t,value:e,key:o,scope:"th"===t?n:void 0})}))))))};return(0,Ke.createElement)("figure",{...nt.useBlockProps.save()},(0,Ke.createElement)("table",{className:""===s?void 0:s,style:{...l.style,...i.style}},(0,Ke.createElement)(m,{type:"head",rows:n}),(0,Ke.createElement)(m,{type:"body",rows:a}),(0,Ke.createElement)(m,{type:"foot",rows:o})),c&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:r}))}},BE={attributes:{hasFixedLayout:{type:"boolean",default:!1},backgroundColor:{type:"string"},caption:{type:"string",source:"html",selector:"figcaption",default:""},head:{type:"array",default:[],source:"query",selector:"thead tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"string",source:"html"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"}}}}},body:{type:"array",default:[],source:"query",selector:"tbody tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"string",source:"html"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"}}}}},foot:{type:"array",default:[],source:"query",selector:"tfoot tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"string",source:"html"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"}}}}}},supports:{anchor:!0,align:!0,__experimentalSelector:".wp-block-table > table"},save:({attributes:e})=>{const{hasFixedLayout:t,head:n,body:a,foot:o,backgroundColor:r,caption:l}=e;if(!n.length&&!a.length&&!o.length)return null;const i=(0,nt.getColorClassName)("background-color",r),s=ut()(i,{"has-fixed-layout":t,"has-background":!!i}),c=!nt.RichText.isEmpty(l),m=({type:e,rows:t})=>{if(!t.length)return null;const n=`t${e}`;return(0,Ke.createElement)(n,null,t.map((({cells:e},t)=>(0,Ke.createElement)("tr",{key:t},e.map((({content:e,tag:t,scope:n,align:a},o)=>{const r=ut()({[`has-text-align-${a}`]:a});return(0,Ke.createElement)(nt.RichText.Content,{className:r||void 0,"data-align":a,tagName:t,value:e,key:o,scope:"th"===t?n:void 0})}))))))};return(0,Ke.createElement)("figure",{...nt.useBlockProps.save()},(0,Ke.createElement)("table",{className:""===s?void 0:s},(0,Ke.createElement)(m,{type:"head",rows:n}),(0,Ke.createElement)(m,{type:"body",rows:a}),(0,Ke.createElement)(m,{type:"foot",rows:o})),c&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:l}))},isEligible:e=>e.backgroundColor&&e.backgroundColor in CE&&!e.style,migrate:e=>({...e,backgroundColor:void 0,style:{color:{background:CE[e.backgroundColor]}}})},NE={attributes:{hasFixedLayout:{type:"boolean",default:!1},backgroundColor:{type:"string"},head:{type:"array",default:[],source:"query",selector:"thead tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"string",source:"html"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"}}}}},body:{type:"array",default:[],source:"query",selector:"tbody tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"string",source:"html"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"}}}}},foot:{type:"array",default:[],source:"query",selector:"tfoot tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"string",source:"html"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"}}}}}},supports:{align:!0},save({attributes:e}){const{hasFixedLayout:t,head:n,body:a,foot:o,backgroundColor:r}=e;if(!n.length&&!a.length&&!o.length)return null;const l=(0,nt.getColorClassName)("background-color",r),i=ut()(l,{"has-fixed-layout":t,"has-background":!!l}),s=({type:e,rows:t})=>{if(!t.length)return null;const n=`t${e}`;return(0,Ke.createElement)(n,null,t.map((({cells:e},t)=>(0,Ke.createElement)("tr",{key:t},e.map((({content:e,tag:t,scope:n},a)=>(0,Ke.createElement)(nt.RichText.Content,{tagName:t,value:e,key:a,scope:"th"===t?n:void 0})))))))};return(0,Ke.createElement)("table",{className:i},(0,Ke.createElement)(s,{type:"head",rows:n}),(0,Ke.createElement)(s,{type:"body",rows:a}),(0,Ke.createElement)(s,{type:"foot",rows:o}))}},TE=[SE,BE,NE],IE=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M13 5.5H4V4h9v1.5Zm7 7H4V11h16v1.5Zm-7 7H4V18h9v1.5Z"})),PE=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M7.5 5.5h9V4h-9v1.5Zm-3.5 7h16V11H4v1.5Zm3.5 7h9V18h-9v1.5Z"})),ME=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M11.111 5.5H20V4h-8.889v1.5ZM4 12.5h16V11H4v1.5Zm7.111 7H20V18h-8.889v1.5Z"})),zE=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M6.656 6.464h2.88v2.88h1.408v-2.88h2.88V5.12h-2.88V2.24H9.536v2.88h-2.88zM0 17.92V0h20.48v17.92H0zm7.68-2.56h5.12v-3.84H7.68v3.84zm-6.4 0H6.4v-3.84H1.28v3.84zM19.2 1.28H1.28v9.024H19.2V1.28zm0 10.24h-5.12v3.84h5.12v-3.84zM6.656 6.464h2.88v2.88h1.408v-2.88h2.88V5.12h-2.88V2.24H9.536v2.88h-2.88zM0 17.92V0h20.48v17.92H0zm7.68-2.56h5.12v-3.84H7.68v3.84zm-6.4 0H6.4v-3.84H1.28v3.84zM19.2 1.28H1.28v9.024H19.2V1.28zm0 10.24h-5.12v3.84h5.12v-3.84z"})),RE=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M13.824 10.176h-2.88v-2.88H9.536v2.88h-2.88v1.344h2.88v2.88h1.408v-2.88h2.88zM0 17.92V0h20.48v17.92H0zM6.4 1.28H1.28v3.84H6.4V1.28zm6.4 0H7.68v3.84h5.12V1.28zm6.4 0h-5.12v3.84h5.12V1.28zm0 5.056H1.28v9.024H19.2V6.336z"})),AE=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M17.728 11.456L14.592 8.32l3.2-3.2-1.536-1.536-3.2 3.2L9.92 3.648 8.384 5.12l3.2 3.2-3.264 3.264 1.536 1.536 3.264-3.264 3.136 3.136 1.472-1.536zM0 17.92V0h20.48v17.92H0zm19.2-6.4h-.448l-1.28-1.28H19.2V6.4h-1.792l1.28-1.28h.512V1.28H1.28v3.84h6.208l1.28 1.28H1.28v3.84h7.424l-1.28 1.28H1.28v3.84H19.2v-3.84z"})),HE=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M6.4 3.776v3.648H2.752v1.792H6.4v3.648h1.728V9.216h3.712V7.424H8.128V3.776zM0 17.92V0h20.48v17.92H0zM12.8 1.28H1.28v14.08H12.8V1.28zm6.4 0h-5.12v3.84h5.12V1.28zm0 5.12h-5.12v3.84h5.12V6.4zm0 5.12h-5.12v3.84h5.12v-3.84z"})),LE=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M14.08 12.864V9.216h3.648V7.424H14.08V3.776h-1.728v3.648H8.64v1.792h3.712v3.648zM0 17.92V0h20.48v17.92H0zM6.4 1.28H1.28v3.84H6.4V1.28zm0 5.12H1.28v3.84H6.4V6.4zm0 5.12H1.28v3.84H6.4v-3.84zM19.2 1.28H7.68v14.08H19.2V1.28z"})),DE=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M6.4 9.98L7.68 8.7v-.256L6.4 7.164V9.98zm6.4-1.532l1.28-1.28V9.92L12.8 8.64v-.192zm7.68 9.472V0H0v17.92h20.48zm-1.28-2.56h-5.12v-1.024l-.256.256-1.024-1.024v1.792H7.68v-1.792l-1.024 1.024-.256-.256v1.024H1.28V1.28H6.4v2.368l.704-.704.576.576V1.216h5.12V3.52l.96-.96.32.32V1.216h5.12V15.36zm-5.76-2.112l-3.136-3.136-3.264 3.264-1.536-1.536 3.264-3.264L5.632 5.44l1.536-1.536 3.136 3.136 3.2-3.2 1.536 1.536-3.2 3.2 3.136 3.136-1.536 1.536z"})),FE=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M4 6v11.5h16V6H4zm1.5 1.5h6V11h-6V7.5zm0 8.5v-3.5h6V16h-6zm13 0H13v-3.5h5.5V16zM13 11V7.5h5.5V11H13z"})),VE=["align"];function $E(e,t,n){if(!t)return e;const a=Object.fromEntries(Object.entries(e).filter((([e])=>["head","body","foot"].includes(e)))),{sectionName:o,rowIndex:r}=t;return Object.fromEntries(Object.entries(a).map((([e,a])=>o&&o!==e?[e,a]:[e,a.map(((a,o)=>r&&r!==o?a:{cells:a.cells.map(((a,r)=>function(e,t){if(!e||!t)return!1;switch(t.type){case"column":return"column"===t.type&&e.columnIndex===t.columnIndex;case"cell":return"cell"===t.type&&e.sectionName===t.sectionName&&e.columnIndex===t.columnIndex&&e.rowIndex===t.rowIndex}}({sectionName:e,columnIndex:r,rowIndex:o},t)?n(a):a))}))])))}function OE(e,{sectionName:t,rowIndex:n,columnCount:a}){const o=function(e){return UE(e.head)?UE(e.body)?UE(e.foot)?void 0:e.foot[0]:e.body[0]:e.head[0]}(e),r=void 0===a?o?.cells?.length:a;return r?{[t]:[...e[t].slice(0,n),{cells:Array.from({length:r}).map(((e,n)=>{var a;const r=null!==(a=o?.cells?.[n])&&void 0!==a?a:{};return{...Object.fromEntries(Object.entries(r).filter((([e])=>VE.includes(e)))),content:"",tag:"head"===t?"th":"td"}}))},...e[t].slice(n)]}:e}function GE(e,t){var n;if(!UE(e[t]))return{[t]:[]};return OE(e,{sectionName:t,rowIndex:0,columnCount:null!==(n=e.body?.[0]?.cells?.length)&&void 0!==n?n:1})}function UE(e){return!e||!e.length||e.every(qE)}function qE(e){return!(e.cells&&e.cells.length)}const jE=[{icon:IE,title:(0,tt.__)("Align column left"),align:"left"},{icon:PE,title:(0,tt.__)("Align column center"),align:"center"},{icon:ME,title:(0,tt.__)("Align column right"),align:"right"}],WE={head:(0,tt.__)("Header cell text"),body:(0,tt.__)("Body cell text"),foot:(0,tt.__)("Footer cell text")},ZE={head:(0,tt.__)("Header label"),foot:(0,tt.__)("Footer label")};function QE({name:e,...t}){const n=`t${e}`;return(0,Ke.createElement)(n,{...t})}const KE=function({attributes:e,setAttributes:t,insertBlocksAfter:n,isSelected:a}){const{hasFixedLayout:o,caption:r,head:l,foot:i}=e,[s,c]=(0,_t.useState)(2),[m,u]=(0,_t.useState)(2),[p,d]=(0,_t.useState)(),g=(0,nt.__experimentalUseColorProps)(e),h=(0,nt.__experimentalUseBorderProps)(e),b=(0,_t.useRef)(),[_,y]=(0,_t.useState)(!1);function v(n){p&&t($E(e,p,(e=>({...e,content:n}))))}function f(n){if(!p)return;const{sectionName:a,rowIndex:o}=p,r=o+n;t(OE(e,{sectionName:a,rowIndex:r})),d({sectionName:a,rowIndex:r,columnIndex:0,type:"cell"})}function k(n=0){if(!p)return;const{columnIndex:a}=p,o=a+n;t(function(e,{columnIndex:t}){const n=Object.fromEntries(Object.entries(e).filter((([e])=>["head","body","foot"].includes(e))));return Object.fromEntries(Object.entries(n).map((([e,n])=>UE(n)?[e,n]:[e,n.map((n=>qE(n)||n.cells.length<t?n:{cells:[...n.cells.slice(0,t),{content:"",tag:"head"===e?"th":"td"},...n.cells.slice(t)]}))])))}(e,{columnIndex:o})),d({rowIndex:0,columnIndex:o,type:"cell"})}(0,_t.useEffect)((()=>{a||d()}),[a]),(0,_t.useEffect)((()=>{_&&(b?.current?.querySelector('td div[contentEditable="true"]')?.focus(),y(!1))}),[_]);const x=["head","body","foot"].filter((t=>!UE(e[t]))),w=[{icon:zE,title:(0,tt.__)("Insert row before"),isDisabled:!p,onClick:function(){f(0)}},{icon:RE,title:(0,tt.__)("Insert row after"),isDisabled:!p,onClick:function(){f(1)}},{icon:AE,title:(0,tt.__)("Delete row"),isDisabled:!p,onClick:function(){if(!p)return;const{sectionName:n,rowIndex:a}=p;d(),t(function(e,{sectionName:t,rowIndex:n}){return{[t]:e[t].filter(((e,t)=>t!==n))}}(e,{sectionName:n,rowIndex:a}))}},{icon:HE,title:(0,tt.__)("Insert column before"),isDisabled:!p,onClick:function(){k(0)}},{icon:LE,title:(0,tt.__)("Insert column after"),isDisabled:!p,onClick:function(){k(1)}},{icon:DE,title:(0,tt.__)("Delete column"),isDisabled:!p,onClick:function(){if(!p)return;const{sectionName:n,columnIndex:a}=p;d(),t(function(e,{columnIndex:t}){const n=Object.fromEntries(Object.entries(e).filter((([e])=>["head","body","foot"].includes(e))));return Object.fromEntries(Object.entries(n).map((([e,n])=>UE(n)?[e,n]:[e,n.map((e=>({cells:e.cells.length>=t?e.cells.filter(((e,n)=>n!==t)):e.cells}))).filter((e=>e.cells.length))])))}(e,{sectionName:n,columnIndex:a}))}}],E=x.map((t=>(0,Ke.createElement)(QE,{name:t,key:t},e[t].map((({cells:e},n)=>(0,Ke.createElement)("tr",{key:n},e.map((({content:e,tag:a,scope:o,align:r,colspan:l,rowspan:i},s)=>(0,Ke.createElement)(a,{key:s,scope:"th"===a?o:void 0,colSpan:l,rowSpan:i,className:ut()({[`has-text-align-${r}`]:r},"wp-block-table__cell-content")},(0,Ke.createElement)(nt.RichText,{value:e,onChange:v,onFocus:()=>{d({sectionName:t,rowIndex:n,columnIndex:s,type:"cell"})},"aria-label":WE[t],placeholder:ZE[t]})))))))))),C=!x.length;return(0,Ke.createElement)("figure",{...(0,nt.useBlockProps)({ref:b})},!C&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{label:(0,tt.__)("Change column alignment"),alignmentControls:jE,value:function(){if(p)return function(e,t,n){const{sectionName:a,rowIndex:o,columnIndex:r}=t;return e[a]?.[o]?.cells?.[r]?.[n]}(e,p,"align")}(),onChange:n=>function(n){if(!p)return;const a={type:"column",columnIndex:p.columnIndex},o=$E(e,a,(e=>({...e,align:n})));t(o)}(n)})),(0,Ke.createElement)(nt.BlockControls,{group:"other"},(0,Ke.createElement)(et.ToolbarDropdownMenu,{hasArrowIndicator:!0,icon:FE,label:(0,tt.__)("Edit table"),controls:w}))),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings"),className:"blocks-table-settings"},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Fixed width table cells"),checked:!!o,onChange:function(){t({hasFixedLayout:!o})}}),!C&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Header section"),checked:!(!l||!l.length),onChange:function(){t(GE(e,"head"))}}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Footer section"),checked:!(!i||!i.length),onChange:function(){t(GE(e,"foot"))}})))),!C&&(0,Ke.createElement)("table",{className:ut()(g.className,h.className,{"has-fixed-layout":o,"has-individual-borders":(0,et.__experimentalHasSplitBorders)(e?.style?.border)}),style:{...g.style,...h.style}},E),!C&&(0,Ke.createElement)(nt.RichText,{identifier:"caption",tagName:"figcaption",className:(0,nt.__experimentalGetElementClassName)("caption"),"aria-label":(0,tt.__)("Table caption text"),placeholder:(0,tt.__)("Add caption"),value:r,onChange:e=>t({caption:e}),onFocus:()=>d(),__unstableOnSplitAtEnd:()=>n((0,Qe.createBlock)((0,Qe.getDefaultBlockName)()))}),C&&(0,Ke.createElement)(et.Placeholder,{label:(0,tt.__)("Table"),icon:(0,Ke.createElement)(nt.BlockIcon,{icon:EE,showColors:!0}),instructions:(0,tt.__)("Insert a table for sharing data.")},(0,Ke.createElement)("form",{className:"blocks-table__placeholder-form",onSubmit:function(e){e.preventDefault(),t(function({rowCount:e,columnCount:t}){return{body:Array.from({length:e}).map((()=>({cells:Array.from({length:t}).map((()=>({content:"",tag:"td"})))})))}}({rowCount:parseInt(s,10)||2,columnCount:parseInt(m,10)||2})),y(!0)}},(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,type:"number",label:(0,tt.__)("Column count"),value:m,onChange:function(e){u(e)},min:"1",className:"blocks-table__placeholder-input"}),(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,type:"number",label:(0,tt.__)("Row count"),value:s,onChange:function(e){c(e)},min:"1",className:"blocks-table__placeholder-input"}),(0,Ke.createElement)(et.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit"},(0,tt.__)("Create Table")))))};function YE(e){const t=parseInt(e,10);if(Number.isInteger(t))return t<0||1===t?void 0:t.toString()}const JE=({phrasingContentSchema:e})=>({tr:{allowEmpty:!0,children:{th:{allowEmpty:!0,children:e,attributes:["scope","colspan","rowspan"]},td:{allowEmpty:!0,children:e,attributes:["colspan","rowspan"]}}}}),XE={from:[{type:"raw",selector:"table",schema:e=>({table:{children:{thead:{allowEmpty:!0,children:JE(e)},tfoot:{allowEmpty:!0,children:JE(e)},tbody:{allowEmpty:!0,children:JE(e)}}}}),transform:e=>{const t=Array.from(e.children).reduce(((e,t)=>{if(!t.children.length)return e;const n=t.nodeName.toLowerCase().slice(1),a=Array.from(t.children).reduce(((e,t)=>{if(!t.children.length)return e;const n=Array.from(t.children).reduce(((e,t)=>{const n=YE(t.getAttribute("rowspan")),a=YE(t.getAttribute("colspan"));return e.push({tag:t.nodeName.toLowerCase(),content:t.innerHTML,rowspan:n,colspan:a}),e}),[]);return e.push({cells:n}),e}),[]);return e[n]=a,e}),{});return(0,Qe.createBlock)("core/table",t)}}]},eC=XE,tC={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/table",title:"Table",category:"text",description:"Create structured content in rows and columns to display information.",textdomain:"default",attributes:{hasFixedLayout:{type:"boolean",default:!1},caption:{type:"rich-text",source:"rich-text",selector:"figcaption"},head:{type:"array",default:[],source:"query",selector:"thead tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"rich-text",source:"rich-text"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"},colspan:{type:"string",source:"attribute",attribute:"colspan"},rowspan:{type:"string",source:"attribute",attribute:"rowspan"}}}}},body:{type:"array",default:[],source:"query",selector:"tbody tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"rich-text",source:"rich-text"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"},colspan:{type:"string",source:"attribute",attribute:"colspan"},rowspan:{type:"string",source:"attribute",attribute:"rowspan"}}}}},foot:{type:"array",default:[],source:"query",selector:"tfoot tr",query:{cells:{type:"array",default:[],source:"query",selector:"td,th",query:{content:{type:"rich-text",source:"rich-text"},tag:{type:"string",default:"td",source:"tag"},scope:{type:"string",source:"attribute",attribute:"scope"},align:{type:"string",source:"attribute",attribute:"data-align"},colspan:{type:"string",source:"attribute",attribute:"colspan"},rowspan:{type:"string",source:"attribute",attribute:"rowspan"}}}}}},supports:{anchor:!0,align:!0,color:{__experimentalSkipSerialization:!0,gradients:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalDefaultControls:{fontSize:!0}},__experimentalBorder:{__experimentalSkipSerialization:!0,color:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,style:!0,width:!0}},__experimentalSelector:".wp-block-table > table",interactivity:{clientNavigation:!0}},styles:[{name:"regular",label:"Default",isDefault:!0},{name:"stripes",label:"Stripes"}],editorStyle:"wp-block-table-editor",style:"wp-block-table"},{name:nC}=tC,aC={icon:EE,example:{attributes:{head:[{cells:[{content:(0,tt.__)("Version"),tag:"th"},{content:(0,tt.__)("Jazz Musician"),tag:"th"},{content:(0,tt.__)("Release Date"),tag:"th"}]}],body:[{cells:[{content:"5.2",tag:"td"},{content:"Jaco Pastorius",tag:"td"},{content:(0,tt.__)("May 7, 2019"),tag:"td"}]},{cells:[{content:"5.1",tag:"td"},{content:"Betty Carter",tag:"td"},{content:(0,tt.__)("February 21, 2019"),tag:"td"}]},{cells:[{content:"5.0",tag:"td"},{content:"Bebo Valdés",tag:"td"},{content:(0,tt.__)("December 6, 2018"),tag:"td"}]}]},viewportWidth:450},transforms:eC,edit:KE,save:function({attributes:e}){const{hasFixedLayout:t,head:n,body:a,foot:o,caption:r}=e;if(!n.length&&!a.length&&!o.length)return null;const l=(0,nt.__experimentalGetColorClassesAndStyles)(e),i=(0,nt.__experimentalGetBorderClassesAndStyles)(e),s=ut()(l.className,i.className,{"has-fixed-layout":t}),c=!nt.RichText.isEmpty(r),m=({type:e,rows:t})=>{if(!t.length)return null;const n=`t${e}`;return(0,Ke.createElement)(n,null,t.map((({cells:e},t)=>(0,Ke.createElement)("tr",{key:t},e.map((({content:e,tag:t,scope:n,align:a,colspan:o,rowspan:r},l)=>{const i=ut()({[`has-text-align-${a}`]:a});return(0,Ke.createElement)(nt.RichText.Content,{className:i||void 0,"data-align":a,tagName:t,value:e,key:l,scope:"th"===t?n:void 0,colSpan:o,rowSpan:r})}))))))};return(0,Ke.createElement)("figure",{...nt.useBlockProps.save()},(0,Ke.createElement)("table",{className:""===s?void 0:s,style:{...l.style,...i.style}},(0,Ke.createElement)(m,{type:"head",rows:n}),(0,Ke.createElement)(m,{type:"body",rows:a}),(0,Ke.createElement)(m,{type:"foot",rows:o})),c&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:r,className:(0,nt.__experimentalGetElementClassName)("caption")}))},deprecated:TE},oC=()=>Xe({name:nC,metadata:tC,settings:aC}),rC=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M20 9.484h-8.889v-1.5H20v1.5Zm0 7h-4.889v-1.5H20v1.5Zm-14 .032a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 1a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"}),(0,Ke.createElement)(Ye.Path,{d:"M13 15.516a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM8 8.484a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"})),lC="wp-block-table-of-contents__entry";function iC({nestedHeadingList:e,disableLinkActivation:t,onClick:n}){return(0,Ke.createElement)(Ke.Fragment,null,e.map(((e,a)=>{const{content:o,link:r}=e.heading,l=r?(0,Ke.createElement)("a",{className:lC,href:r,"aria-disabled":t||void 0,onClick:t&&"function"==typeof n?n:void 0},o):(0,Ke.createElement)("span",{className:lC},o);return(0,Ke.createElement)("li",{key:a},l,e.children?(0,Ke.createElement)("ol",null,(0,Ke.createElement)(iC,{nestedHeadingList:e.children,disableLinkActivation:t,onClick:t&&"function"==typeof n?n:void 0})):null)})))}function sC(e){const t=[];return e.forEach(((n,a)=>{if(""!==n.content&&n.level===e[0].level)if(e[a+1]?.level>n.level){let o=e.length;for(let t=a+1;t<e.length;t++)if(e[t].level===n.level){o=t;break}t.push({heading:n,children:sC(e.slice(a+1,o))})}else t.push({heading:n,children:null})})),t}var cC=n(7734),mC=n.n(cC);function uC(e,t,n){const{getBlockAttributes:a}=e(nt.store),{updateBlockAttributes:o,__unstableMarkNextChangeAsNotPersistent:r}=t(nt.store),l=a(n);if(null===l)return;const i=function(e,t){var n,a;const{getBlockAttributes:o,getBlockName:r,getClientIdsWithDescendants:l,getBlocksByName:i}=e(nt.store),s=null!==(n=e("core/editor").getPermalink())&&void 0!==n?n:null,c=0!==i("core/nextpage").length,{onlyIncludeCurrentPage:m}=null!==(a=o(t))&&void 0!==a?a:{},u=l();let p=1;if(c&&m){const e=u.indexOf(t);for(const[t,n]of u.entries()){if(t>=e)break;"core/nextpage"===r(n)&&p++}}const d=[];let g=1,h=null;"string"==typeof s&&(h=c?(0,pt.addQueryArgs)(s,{page:g}):s);for(const e of u){const t=r(e);if("core/nextpage"===t){if(g++,m&&g>p)break;"string"==typeof s&&(h=(0,pt.addQueryArgs)((0,pt.removeQueryArgs)(s,["page"]),{page:g}))}else if((!m||g===p)&&"core/heading"===t){const t=o(e),n="string"==typeof h&&"string"==typeof t.anchor&&""!==t.anchor;d.push({content:(0,ac.__unstableStripHTML)(t.content.replace(/(<br *\/?>)+/g," ")),level:t.level,link:n?`${h}#${t.anchor}`:null})}}return d}(e,n);mC()(i,l.headings)||(r(),o(n,{headings:i}))}const pC={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,__experimental:!0,name:"core/table-of-contents",title:"Table of Contents",category:"layout",description:"Summarize your post with a list of headings. Add HTML anchors to Heading blocks to link them here.",keywords:["document outline","summary"],textdomain:"default",attributes:{headings:{type:"array",items:{type:"object"},default:[]},onlyIncludeCurrentPage:{type:"boolean",default:!1}},supports:{html:!1,color:{text:!0,background:!0,gradients:!0,link:!0},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},example:{}},{name:dC}=pC,gC={icon:rC,edit:function e({attributes:{headings:t=[],onlyIncludeCurrentPage:n},clientId:a,setAttributes:o}){!function(e){const t=(0,gt.useRegistry)();(0,_t.useEffect)((()=>t.subscribe((()=>uC(t.select,t.dispatch,e)))),[t,e])}(a);const r=(0,nt.useBlockProps)(),l=(0,jt.useInstanceId)(e,"table-of-contents"),{createWarningNotice:i,removeNotice:s}=(0,gt.useDispatch)(Pt.store);let c;const m=(0,gt.useSelect)((e=>{const{getBlockRootClientId:t,canInsertBlockType:n}=e(nt.store);return n("core/list",t(a))}),[a]),{replaceBlocks:u}=(0,gt.useDispatch)(nt.store),p=sC(t),d=m&&(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(et.ToolbarGroup,null,(0,Ke.createElement)(et.ToolbarButton,{onClick:()=>u(a,(0,Qe.createBlock)("core/list",{ordered:!0,values:(0,_t.renderToString)((0,Ke.createElement)(iC,{nestedHeadingList:p}))}))},(0,tt.__)("Convert to static list")))),g=(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Only include current page"),checked:n,onChange:e=>o({onlyIncludeCurrentPage:e}),help:n?(0,tt.__)("Only including headings from the current page (if the post is paginated)."):(0,tt.__)("Toggle to only include headings from the current page (if the post is paginated).")})));return 0===t.length?(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("div",{...r},(0,Ke.createElement)(et.Placeholder,{icon:(0,Ke.createElement)(nt.BlockIcon,{icon:rC}),label:(0,tt.__)("Table of Contents"),instructions:(0,tt.__)("Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.")})),g):(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)("nav",{...r},(0,Ke.createElement)("ol",null,(0,Ke.createElement)(iC,{nestedHeadingList:p,disableLinkActivation:!0,onClick:e=>{e.preventDefault(),s(c),c=`block-library/core/table-of-contents/redirection-prevented/${l}`,i((0,tt.__)("Links are disabled in the editor."),{id:c,type:"snackbar"})}}))),d,g)},save:function({attributes:{headings:e=[]}}){return 0===e.length?null:(0,Ke.createElement)("nav",{...nt.useBlockProps.save()},(0,Ke.createElement)("ol",null,(0,Ke.createElement)(iC,{nestedHeadingList:sC(e)})))}},hC=()=>Xe({name:dC,metadata:pC,settings:gC}),bC={from:[{type:"block",blocks:["core/categories"],transform:()=>(0,Qe.createBlock)("core/tag-cloud")}],to:[{type:"block",blocks:["core/categories"],transform:()=>(0,Qe.createBlock)("core/categories")}]};const _C=function({attributes:e,setAttributes:t}){const{taxonomy:n,showTagCounts:a,numberOfTags:o,smallestFontSize:r,largestFontSize:l}=e,[i]=(0,nt.useSettings)("spacing.units"),s=(0,et.__experimentalUseCustomUnits)({availableUnits:i||["%","px","em","rem"]}),c=(0,gt.useSelect)((e=>e(dt.store).getTaxonomies({per_page:-1})),[]),m=(e,n)=>{const[a,o]=(0,et.__experimentalParseQuantityAndUnitFromRawValue)(n);if(!Number.isFinite(a))return;const i={[e]:n};Object.entries({smallestFontSize:r,largestFontSize:l}).forEach((([t,n])=>{const[a,r]=(0,et.__experimentalParseQuantityAndUnitFromRawValue)(n);t!==e&&r!==o&&(i[t]=`${a}${o}`)})),t(i)},u=(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Taxonomy"),options:[{label:(0,tt.__)("- Select -"),value:"",disabled:!0},...(null!=c?c:[]).filter((e=>!!e.show_cloud)).map((e=>({value:e.slug,label:e.name})))],value:n,onChange:e=>t({taxonomy:e})}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Show post counts"),checked:a,onChange:()=>t({showTagCounts:!a})}),(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Number of tags"),value:o,onChange:e=>t({numberOfTags:e}),min:1,max:100,required:!0}),(0,Ke.createElement)(et.Flex,null,(0,Ke.createElement)(et.FlexItem,{isBlock:!0},(0,Ke.createElement)(et.__experimentalUnitControl,{label:(0,tt.__)("Smallest size"),value:r,onChange:e=>{m("smallestFontSize",e)},units:s,min:.1,max:100})),(0,Ke.createElement)(et.FlexItem,{isBlock:!0},(0,Ke.createElement)(et.__experimentalUnitControl,{label:(0,tt.__)("Largest size"),value:l,onChange:e=>{m("largestFontSize",e)},units:s,min:.1,max:100})))));return(0,Ke.createElement)(Ke.Fragment,null,u,(0,Ke.createElement)("div",{...(0,nt.useBlockProps)()},(0,Ke.createElement)(et.Disabled,null,(0,Ke.createElement)(ot(),{skipBlockSupportAttributes:!0,block:"core/tag-cloud",attributes:e}))))},yC={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/tag-cloud",title:"Tag Cloud",category:"widgets",description:"A cloud of your most used tags.",textdomain:"default",attributes:{numberOfTags:{type:"number",default:45,minimum:1,maximum:100},taxonomy:{type:"string",default:"post_tag"},showTagCounts:{type:"boolean",default:!1},smallestFontSize:{type:"string",default:"8pt"},largestFontSize:{type:"string",default:"22pt"}},styles:[{name:"default",label:"Default",isDefault:!0},{name:"outline",label:"Outline"}],supports:{html:!1,align:!0,spacing:{margin:!0,padding:!0},typography:{lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalLetterSpacing:!0},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-tag-cloud-editor"},{name:vC}=yC,fC={icon:rb,example:{},edit:_C,transforms:bC},kC=()=>Xe({name:vC,metadata:yC,settings:fC});var xC=function(){return xC=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},xC.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function wC(e){return e.toLowerCase()}var EC=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],CC=/[^A-Z0-9]+/gi;function SC(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,a=void 0===n?EC:n,o=t.stripRegexp,r=void 0===o?CC:o,l=t.transform,i=void 0===l?wC:l,s=t.delimiter,c=void 0===s?" ":s,m=BC(BC(e,a,"$1\0$2"),r,"\0"),u=0,p=m.length;"\0"===m.charAt(u);)u++;for(;"\0"===m.charAt(p-1);)p--;return m.slice(u,p).split("\0").map(i).join(c)}function BC(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}function NC(e){return function(e){return e.charAt(0).toUpperCase()+e.substr(1)}(e.toLowerCase())}const TC=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.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-17.6 1L10 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"}));function IC(e,t){return void 0===t&&(t={}),function(e,t){return void 0===t&&(t={}),SC(e,xC({delimiter:"."},t))}(e,xC({delimiter:"-"},t))}function PC(e,t){const{templateParts:n,isResolving:a}=(0,gt.useSelect)((e=>{const{getEntityRecords:t,isResolving:n}=e(dt.store),a={per_page:-1};return{templateParts:t("postType","wp_template_part",a),isResolving:n("getEntityRecords",["postType","wp_template_part",a])}}),[]);return{templateParts:(0,_t.useMemo)((()=>n&&n.filter((n=>oh(n.theme,n.slug)!==t&&(!e||"uncategorized"===e||n.area===e)))||[]),[n,e,t]),isResolving:a}}function MC(e,t){return(0,gt.useSelect)((n=>{const a=e?`core/template-part/${e}`:"core/template-part",{getBlockRootClientId:o,getPatternsByBlockTypes:r}=n(nt.store);return r(a,o(t))}),[e,t])}function zC(e,t){const{saveEntityRecord:n}=(0,gt.useDispatch)(dt.store);return async(a=[],o=(0,tt.__)("Untitled Template Part"))=>{const r={title:o,slug:IC(o).replace(/[^\w-]+/g,"")||"wp-custom-part",content:(0,Qe.serialize)(a),area:e},l=await n("postType","wp_template_part",r);t({slug:l.slug,theme:l.theme,area:void 0})}}function RC(e){return(0,gt.useSelect)((t=>{var n;const a=t("core/editor").__experimentalGetDefaultTemplatePartAreas(),o=a.find((t=>t.area===e)),r=a.find((e=>"uncategorized"===e.area));return{icon:o?.icon||r?.icon,label:o?.label||(0,tt.__)("Template Part"),tagName:null!==(n=o?.area_tag)&&void 0!==n?n:"div"}}),[e])}function AC({areaLabel:e,onClose:t,onSubmit:n}){const[a,o]=(0,_t.useState)((0,tt.__)("Untitled Template Part"));return(0,Ke.createElement)(et.Modal,{title:(0,tt.sprintf)((0,tt.__)("Name and create your new %s"),e.toLowerCase()),overlayClassName:"wp-block-template-part__placeholder-create-new__title-form",onRequestClose:t},(0,Ke.createElement)("form",{onSubmit:e=>{e.preventDefault(),n(a)}},(0,Ke.createElement)(et.__experimentalVStack,{spacing:"5"},(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Name"),value:a,onChange:o}),(0,Ke.createElement)(et.__experimentalHStack,{justify:"right"},(0,Ke.createElement)(et.Button,{variant:"primary",type:"submit",disabled:!a.length,"aria-disabled":!a.length},(0,tt.__)("Create"))))))}function HC({area:e,clientId:t,templatePartId:n,onOpenSelectionModal:a,setAttributes:o}){const{templateParts:r,isResolving:l}=PC(e,n),i=MC(e,t),[s,c]=(0,_t.useState)(!1),m=RC(e),u=zC(e,o);return(0,Ke.createElement)(et.Placeholder,{icon:m.icon,label:m.label,instructions:(0,tt.sprintf)((0,tt.__)("Choose an existing %s or create a new one."),m.label.toLowerCase())},l&&(0,Ke.createElement)(et.Spinner,null),!l&&!(!r.length&&!i.length)&&(0,Ke.createElement)(et.Button,{variant:"primary",onClick:a},(0,tt.__)("Choose")),!l&&(0,Ke.createElement)(et.Button,{variant:"secondary",onClick:()=>{c(!0)}},(0,tt.__)("Start blank")),s&&(0,Ke.createElement)(AC,{areaLabel:m.label,onClose:()=>c(!1),onSubmit:e=>{u([],e)}}))}function LC({setAttributes:e,onClose:t,templatePartId:n=null,area:a,clientId:o}){const[r,l]=(0,_t.useState)(""),{templateParts:i}=PC(a,n),s=(0,_t.useMemo)((()=>Uf(i.map((e=>({name:oh(e.theme,e.slug),title:e.title.rendered,blocks:(0,Qe.parse)(e.content.raw),templatePart:e}))),r)),[i,r]),c=(0,jt.useAsyncList)(s),m=MC(a,o),u=(0,_t.useMemo)((()=>Uf(m,r)),[m,r]),p=(0,jt.useAsyncList)(u),{createSuccessNotice:d}=(0,gt.useDispatch)(Pt.store),g=zC(a,e),h=!!s.length,b=!!u.length;return(0,Ke.createElement)("div",{className:"block-library-template-part__selection-content"},(0,Ke.createElement)("div",{className:"block-library-template-part__selection-search"},(0,Ke.createElement)(et.SearchControl,{__nextHasNoMarginBottom:!0,onChange:l,value:r,label:(0,tt.__)("Search for replacements"),placeholder:(0,tt.__)("Search")})),h&&(0,Ke.createElement)("div",null,(0,Ke.createElement)("h2",null,(0,tt.__)("Existing template parts")),(0,Ke.createElement)(nt.__experimentalBlockPatternsList,{blockPatterns:s,shownPatterns:c,onClickPattern:n=>{var a;a=n.templatePart,e({slug:a.slug,theme:a.theme,area:void 0}),d((0,tt.sprintf)((0,tt.__)('Template Part "%s" inserted.'),a.title?.rendered||a.slug),{type:"snackbar"}),t()}})),b&&(0,Ke.createElement)("div",null,(0,Ke.createElement)("h2",null,(0,tt.__)("Patterns")),(0,Ke.createElement)(nt.__experimentalBlockPatternsList,{blockPatterns:u,shownPatterns:p,onClickPattern:(e,n)=>{g(n,e.title),t()}})),!h&&!b&&(0,Ke.createElement)(et.__experimentalHStack,{alignment:"center"},(0,Ke.createElement)("p",null,(0,tt.__)("No results found."))))}function DC(e){const t=(0,Qe.getPossibleBlockTransformations)([e]).filter((e=>{if(!e.transforms)return!0;const t=e.transforms?.from?.find((e=>e.blocks&&e.blocks.includes("*"))),n=e.transforms?.to?.find((e=>e.blocks&&e.blocks.includes("*")));return!t&&!n}));if(t.length)return(0,Qe.switchToBlockType)(e,t[0].name)}function FC(e=[]){return e.flatMap((e=>"core/legacy-widget"===e.name?DC(e):(0,Qe.createBlock)(e.name,e.attributes,FC(e.innerBlocks)))).filter((e=>!!e))}const VC={per_page:-1,_fields:"id,name,description,status,widgets"};function $C({area:e,setAttributes:t}){const[n,a]=(0,_t.useState)(""),[o,r]=(0,_t.useState)(!1),l=(0,gt.useRegistry)(),{sidebars:i,hasResolved:s}=(0,gt.useSelect)((e=>{const{getSidebars:t,hasFinishedResolution:n}=e(dt.store);return{sidebars:t(VC),hasResolved:n("getSidebars",[VC])}}),[]),{createErrorNotice:c}=(0,gt.useDispatch)(Pt.store),m=zC(e,t),u=(0,_t.useMemo)((()=>{const e=(null!=i?i:[]).filter((e=>"wp_inactive_widgets"!==e.id&&e.widgets.length>0)).map((e=>({value:e.id,label:e.name})));return e.length?[{value:"",label:(0,tt.__)("Select widget area")},...e]:[]}),[i]);if(!s)return(0,Ke.createElement)(et.__experimentalSpacer,{marginBottom:"0"});if(s&&!u.length)return null;return(0,Ke.createElement)(et.__experimentalSpacer,{marginBottom:"4"},(0,Ke.createElement)(et.__experimentalHStack,{as:"form",onSubmit:async function(e){if(e.preventDefault(),o||!n)return;r(!0);const t=u.find((({value:e})=>e===n)),{getWidgets:a}=l.resolveSelect(dt.store),i=await a({sidebar:t.value,_embed:"about"}),s=new Set,p=i.flatMap((e=>{const t=function(e){if("block"!==e.id_base){let t;return t=e._embedded.about[0].is_multi?{idBase:e.id_base,instance:e.instance}:{id:e.id},DC((0,Qe.createBlock)("core/legacy-widget",t))}const t=(0,Qe.parse)(e.instance.raw.content,{__unstableSkipAutop:!0});if(!t.length)return;const n=t[0];return"core/widget-group"===n.name?(0,Qe.createBlock)((0,Qe.getGroupingBlockName)(),void 0,FC(n.innerBlocks)):n.innerBlocks.length>0?(0,Qe.cloneBlock)(n,void 0,FC(n.innerBlocks)):n}(e);return t||(s.add(e.id_base),[])}));await m(p,(0,tt.sprintf)((0,tt.__)("Widget area: %s"),t.label)),s.size&&c((0,tt.sprintf)((0,tt.__)("Unable to import the following widgets: %s."),Array.from(s).join(", ")),{type:"snackbar"}),r(!1)}},(0,Ke.createElement)(et.FlexBlock,null,(0,Ke.createElement)(et.SelectControl,{label:(0,tt.__)("Import widget area"),value:n,options:u,onChange:e=>a(e),disabled:!u.length,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})),(0,Ke.createElement)(et.FlexItem,{style:{marginBottom:"8px",marginTop:"auto"}},(0,Ke.createElement)(et.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:o,"aria-disabled":o||!n},(0,tt._x)("Import","button label")))))}const OC={header:(0,tt.__)("The <header> element should represent introductory content, typically a group of introductory or navigational aids."),main:(0,tt.__)("The <main> element should be used for the primary content of your document only."),section:(0,tt.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element."),article:(0,tt.__)("The <article> element should represent a self-contained, syndicatable portion of the document."),aside:(0,tt.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."),footer:(0,tt.__)("The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).")};function GC({tagName:e,setAttributes:t,isEntityAvailable:n,templatePartId:a,defaultWrapper:o,hasInnerBlocks:r}){const[l,i]=(0,dt.useEntityProp)("postType","wp_template_part","area",a),[s,c]=(0,dt.useEntityProp)("postType","wp_template_part","title",a),m=(0,gt.useSelect)((e=>e("core/editor").__experimentalGetDefaultTemplatePartAreas()),[]).map((({label:e,area:t})=>({label:e,value:t})));return(0,Ke.createElement)(Ke.Fragment,null,n&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Title"),value:s,onChange:e=>{c(e)},onFocus:e=>e.target.select()}),(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Area"),labelPosition:"top",options:m,value:l,onChange:i})),(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("HTML element"),options:[{label:(0,tt.sprintf)((0,tt.__)("Default based on area (%s)"),`<${o}>`),value:""},{label:"<header>",value:"header"},{label:"<main>",value:"main"},{label:"<section>",value:"section"},{label:"<article>",value:"article"},{label:"<aside>",value:"aside"},{label:"<footer>",value:"footer"},{label:"<div>",value:"div"}],value:e||"",onChange:e=>t({tagName:e}),help:OC[e]}),!r&&(0,Ke.createElement)($C,{area:l,setAttributes:t}))}function UC({postId:e,hasInnerBlocks:t,layout:n,tagName:a,blockProps:o}){const r=(0,gt.useSelect)((e=>{const{getSettings:t}=e(nt.store);return t()?.supportsLayout}),[]),[l]=(0,nt.useSettings)("layout"),i=n?.inherit?l||{}:n,[s,c,m]=(0,dt.useEntityBlockEditor)("postType","wp_template_part",{id:e}),u=(0,nt.useInnerBlocksProps)(o,{value:s,onInput:c,onChange:m,renderAppender:t?void 0:nt.InnerBlocks.ButtonBlockAppender,layout:r?i:void 0});return(0,Ke.createElement)(a,{...u})}function qC({isEntityAvailable:e,area:t,clientId:n,templatePartId:a,isTemplatePartSelectionOpen:o,setIsTemplatePartSelectionOpen:r}){const{templateParts:l}=PC(t,a),i=MC(t,n),s=!!l.length||!!i.length;return e&&s&&("header"===t||"footer"===t)?(0,Ke.createElement)(et.MenuItem,{onClick:()=>{r(!0)},"aria-expanded":o,"aria-haspopup":"dialog"},(0,tt.__)("Replace")):null}const jC=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M18.5 10.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"})),WC=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{fillRule:"evenodd",d:"M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})),ZC=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.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.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"}));function QC(e,t){if("core/template-part"!==t)return e;if(e.variations){const t=(e,t)=>{const{area:n,theme:a,slug:o}=e;if(n)return n===t.area;if(!o)return!1;const{getCurrentTheme:r,getEntityRecord:l}=(0,gt.select)(dt.store),i=l("postType","wp_template_part",`${a||r()?.stylesheet}//${o}`);return i?.slug?i.slug===t.slug:i?.area===t.area},n=e.variations.map((e=>{return{...e,...!e.isActive&&{isActive:t},..."string"==typeof e.icon&&{icon:(n=e.icon,"header"===n?jC:"footer"===n?WC:"sidebar"===n?ZC:TC)}};var n}));return{...e,variations:n}}return e}const KC={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/template-part",title:"Template Part",category:"theme",description:"Edit the different global regions of your site, like the header, footer, sidebar, or create your own.",textdomain:"default",attributes:{slug:{type:"string"},theme:{type:"string"},tagName:{type:"string"},area:{type:"string"}},supports:{align:!0,html:!1,reusable:!1,renaming:!1,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-template-part-editor"},{name:YC}=KC,JC={icon:TC,__experimentalLabel:({slug:e,theme:t})=>{if(!e)return;const{getCurrentTheme:n,getEditedEntityRecord:a}=(0,gt.select)(dt.store),o=a("postType","wp_template_part",(t||n()?.stylesheet)+"//"+e);return o?(0,Jn.decodeEntities)(o.title)||function(e,t){return void 0===t&&(t={}),SC(e,xC({delimiter:" ",transform:NC},t))}(o.slug||""):void 0},edit:function({attributes:e,setAttributes:t,clientId:n}){const a=(0,gt.useSelect)((e=>e(dt.store).getCurrentTheme()?.stylesheet),[]),{slug:o,theme:r=a,tagName:l,layout:i={}}=e,s=oh(r,o),c=(0,nt.useHasRecursion)(s),[m,u]=(0,_t.useState)(!1),{isResolved:p,hasInnerBlocks:d,isMissing:g,area:h}=(0,gt.useSelect)((t=>{const{getEditedEntityRecord:a,hasFinishedResolution:o}=t(dt.store),{getBlockCount:r}=t(nt.store),l=["postType","wp_template_part",s],i=s?a(...l):null,c=i?.area||e.area,m=!!s&&o("getEditedEntityRecord",l);return{hasInnerBlocks:r(n)>0,isResolved:m,isMissing:m&&(!i||0===Object.keys(i).length),area:c}}),[s,e.area,n]),b=RC(h),_=(0,nt.useBlockProps)(),y=!o,v=!y&&!g&&p,f=l||b.tagName;return!d&&(o&&!r||o&&g)?(0,Ke.createElement)(f,{..._},(0,Ke.createElement)(nt.Warning,null,(0,tt.sprintf)((0,tt.__)("Template part has been deleted or is unavailable: %s"),o))):v&&c?(0,Ke.createElement)(f,{..._},(0,Ke.createElement)(nt.Warning,null,(0,tt.__)("Block cannot be rendered inside itself."))):(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.RecursionProvider,{uniqueId:s},(0,Ke.createElement)(nt.InspectorControls,{group:"advanced"},(0,Ke.createElement)(GC,{tagName:l,setAttributes:t,isEntityAvailable:v,templatePartId:s,defaultWrapper:b.tagName,hasInnerBlocks:d})),y&&(0,Ke.createElement)(f,{..._},(0,Ke.createElement)(HC,{area:e.area,templatePartId:s,clientId:n,setAttributes:t,onOpenSelectionModal:()=>u(!0)})),(0,Ke.createElement)(nt.BlockSettingsMenuControls,null,(({selectedClientIds:e})=>1!==e.length||n!==e[0]?null:(0,Ke.createElement)(qC,{isEntityAvailable:v,area:h,clientId:n,templatePartId:s,isTemplatePartSelectionOpen:m,setIsTemplatePartSelectionOpen:u}))),v&&(0,Ke.createElement)(UC,{tagName:f,blockProps:_,postId:s,hasInnerBlocks:d,layout:i}),!y&&!p&&(0,Ke.createElement)(f,{..._},(0,Ke.createElement)(et.Spinner,null))),m&&(0,Ke.createElement)(et.Modal,{overlayClassName:"block-editor-template-part__selection-modal",title:(0,tt.sprintf)((0,tt.__)("Choose a %s"),b.label.toLowerCase()),onRequestClose:()=>u(!1),isFullScreen:!0},(0,Ke.createElement)(LC,{templatePartId:s,clientId:n,area:h,setAttributes:t,onClose:()=>u(!1)})))}},XC=()=>{(0,_i.addFilter)("blocks.registerBlockType","core/template-part",QC);const e=["core/post-template","core/post-content"];return(0,_i.addFilter)("blockEditor.__unstableCanInsertBlockType","core/block-library/removeTemplatePartsFromPostTemplates",((t,n,a,{getBlock:o,getBlockParentsByBlockName:r})=>{if("core/template-part"!==n.name)return t;for(const t of e){if(o(a)?.name===t||r(a,t).length)return!1}return!0})),Xe({name:YC,metadata:KC,settings:JC})},eS=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"M6.08 10.103h2.914L9.657 12h1.417L8.23 4H6.846L4 12h1.417l.663-1.897Zm1.463-4.137.994 2.857h-2l1.006-2.857ZM11 16H4v-1.5h7V16Zm1 0h8v-1.5h-8V16Zm-4 4H4v-1.5h4V20Zm7-1.5V20H9v-1.5h6Z"}));const tS={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/term-description",title:"Term Description",category:"theme",description:"Display the description of categories, tags and custom taxonomies when viewing an archive.",textdomain:"default",attributes:{textAlign:{type:"string"}},supports:{align:["wide","full"],html:!1,color:{link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{padding:!0,margin:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}}},{name:nS}=tS,aS={icon:eS,edit:function({attributes:e,setAttributes:t,mergedStyle:n}){const{textAlign:a}=e,o=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${a}`]:a}),style:n});return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:a,onChange:e=>{t({textAlign:e})}})),(0,Ke.createElement)("div",{...o},(0,Ke.createElement)("div",{className:"wp-block-term-description__placeholder"},(0,Ke.createElement)("span",null,(0,tt.__)("Term Description")))))}},oS=()=>Xe({name:nS,metadata:tS,settings:aS});const rS={to:[{type:"block",blocks:["core/columns"],transform:({className:e,columns:t,content:n,width:a})=>(0,Qe.createBlock)("core/columns",{align:"wide"===a||"full"===a?a:void 0,className:e,columns:t},n.map((({children:e})=>(0,Qe.createBlock)("core/column",{},[(0,Qe.createBlock)("core/paragraph",{content:e})]))))}]},lS=rS,iS={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/text-columns",title:"Text Columns (deprecated)",icon:"columns",category:"design",description:"This block is deprecated. Please use the Columns block instead.",textdomain:"default",attributes:{content:{type:"array",source:"query",selector:"p",query:{children:{type:"string",source:"html"}},default:[{},{}]},columns:{type:"number",default:2},width:{type:"string"}},supports:{inserter:!1,interactivity:{clientNavigation:!0}},editorStyle:"wp-block-text-columns-editor",style:"wp-block-text-columns"},{name:sS}=iS,cS={transforms:lS,getEditWrapperProps(e){const{width:t}=e;if("wide"===t||"full"===t)return{"data-align":t}},edit:function({attributes:e,setAttributes:t}){const{width:n,content:a,columns:o}=e;return Qp()("The Text Columns block",{since:"5.3",alternative:"the Columns block"}),(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(nt.BlockAlignmentToolbar,{value:n,onChange:e=>t({width:e}),controls:["center","wide","full"]})),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,null,(0,Ke.createElement)(et.RangeControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,tt.__)("Columns"),value:o,onChange:e=>t({columns:e}),min:2,max:4,required:!0}))),(0,Ke.createElement)("div",{...(0,nt.useBlockProps)({className:`align${n} columns-${o}`})},Array.from({length:o}).map(((e,n)=>(0,Ke.createElement)("div",{className:"wp-block-column",key:`column-${n}`},(0,Ke.createElement)(nt.RichText,{tagName:"p",value:a?.[n]?.children,onChange:e=>{t({content:[...a.slice(0,n),{children:e},...a.slice(n+1)]})},"aria-label":(0,tt.sprintf)((0,tt.__)("Column %d text"),n+1),placeholder:(0,tt.__)("New Column")}))))))},save:function({attributes:e}){const{width:t,content:n,columns:a}=e;return(0,Ke.createElement)("div",{...nt.useBlockProps.save({className:`align${t} columns-${a}`})},Array.from({length:a}).map(((e,t)=>(0,Ke.createElement)("div",{className:"wp-block-column",key:`column-${t}`},(0,Ke.createElement)(nt.RichText.Content,{tagName:"p",value:n?.[t]?.children})))))}},mS=()=>Xe({name:sS,metadata:iS,settings:cS}),uS=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"})),pS={attributes:{content:{type:"string",source:"html",selector:"pre",default:""},textAlign:{type:"string"}},save({attributes:e}){const{textAlign:t,content:n}=e;return(0,Ke.createElement)(nt.RichText.Content,{tagName:"pre",style:{textAlign:t},value:n})}},dS={attributes:{content:{type:"string",source:"html",selector:"pre",default:"",__unstablePreserveWhiteSpace:!0,__experimentalRole:"content"},textAlign:{type:"string"}},supports:{anchor:!0,color:{gradients:!0,link:!0},typography:{fontSize:!0,__experimentalFontFamily:!0},spacing:{padding:!0}},save({attributes:e}){const{textAlign:t,content:n}=e,a=ut()({[`has-text-align-${t}`]:t});return(0,Ke.createElement)("pre",{...nt.useBlockProps.save({className:a})},(0,Ke.createElement)(nt.RichText.Content,{value:n}))},migrate:ln,isEligible:({style:e})=>e?.typography?.fontFamily},gS=[dS,pS];const hS={from:[{type:"block",blocks:["core/paragraph"],transform:e=>(0,Qe.createBlock)("core/verse",e)}],to:[{type:"block",blocks:["core/paragraph"],transform:e=>(0,Qe.createBlock)("core/paragraph",e)}]},bS=hS,_S={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/verse",title:"Verse",category:"text",description:"Insert poetry. Use special spacing formats. Or quote song lyrics.",keywords:["poetry","poem"],textdomain:"default",attributes:{content:{type:"rich-text",source:"rich-text",selector:"pre",__unstablePreserveWhiteSpace:!0,__experimentalRole:"content"},textAlign:{type:"string"}},supports:{anchor:!0,color:{gradients:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},typography:{fontSize:!0,__experimentalFontFamily:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalDefaultControls:{fontSize:!0}},spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},__experimentalBorder:{radius:!0,width:!0,color:!0,style:!0},interactivity:{clientNavigation:!0}},style:"wp-block-verse",editorStyle:"wp-block-verse-editor"},{name:yS}=_S,vS={icon:uS,example:{attributes:{content:(0,tt.__)("WHAT was he doing, the great god Pan,\n\tDown in the reeds by the river?\nSpreading ruin and scattering ban,\nSplashing and paddling with hoofs of a goat,\nAnd breaking the golden lilies afloat\n With the dragon-fly on the river.")}},transforms:bS,deprecated:gS,merge:(e,t)=>({content:e.content+"\n\n"+t.content}),edit:function({attributes:e,setAttributes:t,mergeBlocks:n,onRemove:a,insertBlocksAfter:o,style:r}){const{textAlign:l,content:i}=e,s=(0,nt.useBlockProps)({className:ut()({[`has-text-align-${l}`]:l}),style:r});return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(nt.AlignmentToolbar,{value:l,onChange:e=>{t({textAlign:e})}})),(0,Ke.createElement)(nt.RichText,{tagName:"pre",identifier:"content",preserveWhiteSpace:!0,value:i,onChange:e=>{t({content:e})},"aria-label":(0,tt.__)("Verse text"),placeholder:(0,tt.__)("Write verse…"),onRemove:a,onMerge:n,textAlign:l,...s,__unstablePastePlainText:!0,__unstableOnSplitAtDoubleLineEnd:()=>o((0,Qe.createBlock)((0,Qe.getDefaultBlockName)()))}))},save:function({attributes:e}){const{textAlign:t,content:n}=e,a=ut()({[`has-text-align-${t}`]:t});return(0,Ke.createElement)("pre",{...nt.useBlockProps.save({className:a})},(0,Ke.createElement)(nt.RichText.Content,{value:n}))}},fS=()=>Xe({name:yS,metadata:_S,settings:vS}),kS=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.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"}));function xS({tracks:e=[]}){return e.map((e=>(0,Ke.createElement)("track",{key:e.src,...e})))}const{attributes:wS}={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/video",title:"Video",category:"media",description:"Embed a video from your media library or upload a new one.",keywords:["movie"],textdomain:"default",attributes:{autoplay:{type:"boolean",source:"attribute",selector:"video",attribute:"autoplay"},caption:{type:"rich-text",source:"rich-text",selector:"figcaption",__experimentalRole:"content"},controls:{type:"boolean",source:"attribute",selector:"video",attribute:"controls",default:!0},id:{type:"number",__experimentalRole:"content"},loop:{type:"boolean",source:"attribute",selector:"video",attribute:"loop"},muted:{type:"boolean",source:"attribute",selector:"video",attribute:"muted"},poster:{type:"string",source:"attribute",selector:"video",attribute:"poster"},preload:{type:"string",source:"attribute",selector:"video",attribute:"preload",default:"metadata"},src:{type:"string",source:"attribute",selector:"video",attribute:"src",__experimentalRole:"content"},playsInline:{type:"boolean",source:"attribute",selector:"video",attribute:"playsinline"},tracks:{__experimentalRole:"content",type:"array",items:{type:"object"},default:[]}},supports:{anchor:!0,align:!0,spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-video-editor",style:"wp-block-video"},ES={attributes:wS,save({attributes:e}){const{autoplay:t,caption:n,controls:a,loop:o,muted:r,poster:l,preload:i,src:s,playsInline:c,tracks:m}=e;return(0,Ke.createElement)("figure",{...nt.useBlockProps.save()},s&&(0,Ke.createElement)("video",{autoPlay:t,controls:a,loop:o,muted:r,poster:l,preload:"metadata"!==i?i:void 0,src:s,playsInline:c},(0,Ke.createElement)(xS,{tracks:m})),!nt.RichText.isEmpty(n)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"figcaption",value:n}))}},CS=[ES],SS=[{value:"auto",label:(0,tt.__)("Auto")},{value:"metadata",label:(0,tt.__)("Metadata")},{value:"none",label:(0,tt._x)("None","Preload value")}],BS=({setAttributes:e,attributes:t})=>{const{autoplay:n,controls:a,loop:o,muted:r,playsInline:l,preload:i}=t,s=(0,tt.__)("Autoplay may cause usability issues for some users."),c=_t.Platform.select({web:(0,_t.useCallback)((e=>e?s:null),[]),native:s}),m=(0,_t.useMemo)((()=>{const t=t=>n=>{e({[t]:n})};return{autoplay:t("autoplay"),loop:t("loop"),muted:t("muted"),controls:t("controls"),playsInline:t("playsInline")}}),[]),u=(0,_t.useCallback)((t=>{e({preload:t})}),[]);return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Autoplay"),onChange:m.autoplay,checked:!!n,help:c}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Loop"),onChange:m.loop,checked:!!o}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Muted"),onChange:m.muted,checked:!!r}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Playback controls"),onChange:m.controls,checked:!!a}),(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Play inline"),onChange:m.playsInline,checked:!!l}),(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Preload"),value:i,onChange:u,options:SS,hideCancelButton:!0}))},NS=["text/vtt"],TS="subtitles",IS=[{label:(0,tt.__)("Subtitles"),value:"subtitles"},{label:(0,tt.__)("Captions"),value:"captions"},{label:(0,tt.__)("Descriptions"),value:"descriptions"},{label:(0,tt.__)("Chapters"),value:"chapters"},{label:(0,tt.__)("Metadata"),value:"metadata"}];function PS({tracks:e,onEditPress:t}){let n;return n=0===e.length?(0,Ke.createElement)("p",{className:"block-library-video-tracks-editor__tracks-informative-message"},(0,tt.__)("Tracks can be subtitles, captions, chapters, or descriptions. They help make your content more accessible to a wider range of users.")):e.map(((e,n)=>(0,Ke.createElement)(et.__experimentalHStack,{key:n,className:"block-library-video-tracks-editor__track-list-track"},(0,Ke.createElement)("span",null,e.label," "),(0,Ke.createElement)(et.Button,{variant:"tertiary",onClick:()=>t(n),"aria-label":(0,tt.sprintf)((0,tt.__)("Edit %s"),e.label)},(0,tt.__)("Edit"))))),(0,Ke.createElement)(et.MenuGroup,{label:(0,tt.__)("Text tracks"),className:"block-library-video-tracks-editor__track-list"},n)}function MS({track:e,onChange:t,onClose:n,onRemove:a}){const{src:o="",label:r="",srcLang:l="",kind:i=TS}=e,s=o.startsWith("blob:")?"":(0,pt.getFilename)(o)||"";return(0,Ke.createElement)(et.NavigableMenu,null,(0,Ke.createElement)(et.__experimentalVStack,{className:"block-library-video-tracks-editor__single-track-editor",spacing:"4"},(0,Ke.createElement)("span",{className:"block-library-video-tracks-editor__single-track-editor-edit-track-label"},(0,tt.__)("Edit track")),(0,Ke.createElement)("span",null,(0,tt.__)("File"),": ",(0,Ke.createElement)("b",null,s)),(0,Ke.createElement)(et.__experimentalGrid,{columns:2,gap:4},(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,autoFocus:!0,onChange:n=>t({...e,label:n}),label:(0,tt.__)("Label"),value:r,help:(0,tt.__)("Title of track")}),(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,onChange:n=>t({...e,srcLang:n}),label:(0,tt.__)("Source language"),value:l,help:(0,tt.__)("Language tag (en, fr, etc.)")})),(0,Ke.createElement)(et.__experimentalVStack,{spacing:"8"},(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,className:"block-library-video-tracks-editor__single-track-editor-kind-select",options:IS,value:i,label:(0,tt.__)("Kind"),onChange:n=>{t({...e,kind:n})}}),(0,Ke.createElement)(et.__experimentalHStack,{className:"block-library-video-tracks-editor__single-track-editor-buttons-container"},(0,Ke.createElement)(et.Button,{variant:"secondary",onClick:()=>{const a={};let o=!1;""===r&&(a.label=(0,tt.__)("English"),o=!0),""===l&&(a.srcLang="en",o=!0),void 0===e.kind&&(a.kind=TS,o=!0),o&&t({...e,...a}),n()}},(0,tt.__)("Close")),(0,Ke.createElement)(et.Button,{isDestructive:!0,variant:"link",onClick:a},(0,tt.__)("Remove track"))))))}function zS({tracks:e=[],onChange:t}){const n=(0,gt.useSelect)((e=>e(nt.store).getSettings().mediaUpload),[]),[a,o]=(0,_t.useState)(null);return n?(0,Ke.createElement)(et.Dropdown,{contentClassName:"block-library-video-tracks-editor",renderToggle:({isOpen:e,onToggle:t})=>(0,Ke.createElement)(et.ToolbarGroup,null,(0,Ke.createElement)(et.ToolbarButton,{label:(0,tt.__)("Text tracks"),showTooltip:!0,"aria-expanded":e,"aria-haspopup":"true",onClick:t},(0,tt.__)("Text tracks"))),renderContent:()=>null!==a?(0,Ke.createElement)(MS,{track:e[a],onChange:n=>{const o=[...e];o[a]=n,t(o)},onClose:()=>o(null),onRemove:()=>{t(e.filter(((e,t)=>t!==a))),o(null)}}):(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.NavigableMenu,null,(0,Ke.createElement)(PS,{tracks:e,onEditPress:o}),(0,Ke.createElement)(et.MenuGroup,{className:"block-library-video-tracks-editor__add-tracks-container",label:(0,tt.__)("Add tracks")},(0,Ke.createElement)(nt.MediaUpload,{onSelect:({url:n})=>{const a=e.length;t([...e,{src:n}]),o(a)},allowedTypes:NS,render:({open:e})=>(0,Ke.createElement)(et.MenuItem,{icon:Qd,onClick:e},(0,tt.__)("Open Media Library"))}),(0,Ke.createElement)(nt.MediaUploadCheck,null,(0,Ke.createElement)(et.FormFileUpload,{onChange:a=>{const r=a.target.files,l=e.length;n({allowedTypes:NS,filesList:r,onFileChange:([{url:n}])=>{const a=[...e];a[l]||(a[l]={}),a[l]={...e[l],src:n},t(a),o(l)}})},accept:".vtt,text/vtt",render:({openFileDialog:e})=>(0,Ke.createElement)(et.MenuItem,{icon:np,onClick:()=>{e()}},(0,tt.__)("Upload"))})))))}):null}const RS=e=>(0,Ke.createElement)(et.Placeholder,{className:"block-editor-media-placeholder",withIllustration:!0,icon:kS,label:(0,tt.__)("Video"),instructions:(0,tt.__)("Upload a video file, pick one from your media library, or add one with a URL.")},e),AS=["video"],HS=["image"];const LS=function e({isSelected:t,attributes:n,className:a,setAttributes:o,insertBlocksAfter:r,onReplace:l}){const i=(0,jt.useInstanceId)(e),s=(0,_t.useRef)(),c=(0,_t.useRef)(),{id:m,controls:u,poster:p,src:d,tracks:g}=n,h=!m&&(0,It.isBlobURL)(d),{getSettings:b}=(0,gt.useSelect)(nt.store);function _(e){e&&e.url?o({src:e.url,id:e.id,poster:e.image?.src!==e.icon?e.image?.src:void 0,caption:e.caption}):o({src:void 0,id:void 0,poster:void 0,caption:void 0})}function y(e){if(e!==d){const t=Ot({attributes:{url:e}});if(void 0!==t&&l)return void l(t);o({src:e,id:void 0,poster:void 0})}}(0,_t.useEffect)((()=>{if(!m&&(0,It.isBlobURL)(d)){const e=(0,It.getBlobByURL)(d);e&&b().mediaUpload({filesList:[e],onFileChange:([e])=>_(e),onError:f,allowedTypes:AS})}}),[]),(0,_t.useEffect)((()=>{s.current&&s.current.load()}),[p]);const{createErrorNotice:v}=(0,gt.useDispatch)(Pt.store);function f(e){v(e,{type:"snackbar"})}const k=ut()(a,{"is-transient":h}),x=(0,nt.useBlockProps)({className:k});if(!d)return(0,Ke.createElement)("div",{...x},(0,Ke.createElement)(nt.MediaPlaceholder,{icon:(0,Ke.createElement)(nt.BlockIcon,{icon:kS}),onSelect:_,onSelectURL:y,accept:"video/*",allowedTypes:AS,value:n,onError:f,placeholder:RS}));const w=`video-block__poster-image-description-${i}`;return(0,Ke.createElement)(Ke.Fragment,null,t&&(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,null,(0,Ke.createElement)(zS,{tracks:g,onChange:e=>{o({tracks:e})}})),(0,Ke.createElement)(nt.BlockControls,{group:"other"},(0,Ke.createElement)(nt.MediaReplaceFlow,{mediaId:m,mediaURL:d,allowedTypes:AS,accept:"video/*",onSelect:_,onSelectURL:y,onError:f}))),(0,Ke.createElement)(nt.InspectorControls,null,(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},(0,Ke.createElement)(BS,{setAttributes:o,attributes:n}),(0,Ke.createElement)(nt.MediaUploadCheck,null,(0,Ke.createElement)(et.BaseControl,{className:"editor-video-poster-control"},(0,Ke.createElement)(et.BaseControl.VisualLabel,null,(0,tt.__)("Poster image")),(0,Ke.createElement)(nt.MediaUpload,{title:(0,tt.__)("Select poster image"),onSelect:function(e){o({poster:e.url})},allowedTypes:HS,render:({open:e})=>(0,Ke.createElement)(et.Button,{variant:"primary",onClick:e,ref:c,"aria-describedby":w},p?(0,tt.__)("Replace"):(0,tt.__)("Select"))}),(0,Ke.createElement)("p",{id:w,hidden:!0},p?(0,tt.sprintf)((0,tt.__)("The current poster image url is %s"),p):(0,tt.__)("There is no poster image currently selected")),!!p&&(0,Ke.createElement)(et.Button,{onClick:function(){o({poster:void 0}),c.current.focus()},variant:"tertiary"},(0,tt.__)("Remove")))))),(0,Ke.createElement)("figure",{...x},(0,Ke.createElement)(et.Disabled,{isDisabled:!t},(0,Ke.createElement)("video",{controls:u,poster:p,src:d,ref:s},(0,Ke.createElement)(xS,{tracks:g}))),h&&(0,Ke.createElement)(et.Spinner,null),(0,Ke.createElement)(Qt,{attributes:n,setAttributes:o,isSelected:t,insertBlocksAfter:r,label:(0,tt.__)("Video caption text"),showToolbarButton:t})))};const DS={from:[{type:"files",isMatch:e=>1===e.length&&0===e[0].type.indexOf("video/"),transform(e){const t=e[0];return(0,Qe.createBlock)("core/video",{src:(0,It.createBlobURL)(t)})}},{type:"shortcode",tag:"video",attributes:{src:{type:"string",shortcode:({named:{src:e,mp4:t,m4v:n,webm:a,ogv:o,flv:r}})=>e||t||n||a||o||r},poster:{type:"string",shortcode:({named:{poster:e}})=>e},loop:{type:"string",shortcode:({named:{loop:e}})=>e},autoplay:{type:"string",shortcode:({named:{autoplay:e}})=>e},preload:{type:"string",shortcode:({named:{preload:e}})=>e}}},{type:"raw",isMatch:e=>"P"===e.nodeName&&1===e.children.length&&"VIDEO"===e.firstChild.nodeName,transform:e=>{const t=e.firstChild,n={autoplay:!!t.hasAttribute("autoplay")||void 0,controls:!!t.hasAttribute("controls")&&void 0,loop:!!t.hasAttribute("loop")||void 0,muted:!!t.hasAttribute("muted")||void 0,preload:t.getAttribute("preload")||void 0,playsInline:!!t.hasAttribute("playsinline")||void 0,poster:t.getAttribute("poster")||void 0,src:t.getAttribute("src")||void 0};return(0,Qe.createBlock)("core/video",n)}}]},FS=DS,VS={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/video",title:"Video",category:"media",description:"Embed a video from your media library or upload a new one.",keywords:["movie"],textdomain:"default",attributes:{autoplay:{type:"boolean",source:"attribute",selector:"video",attribute:"autoplay"},caption:{type:"rich-text",source:"rich-text",selector:"figcaption",__experimentalRole:"content"},controls:{type:"boolean",source:"attribute",selector:"video",attribute:"controls",default:!0},id:{type:"number",__experimentalRole:"content"},loop:{type:"boolean",source:"attribute",selector:"video",attribute:"loop"},muted:{type:"boolean",source:"attribute",selector:"video",attribute:"muted"},poster:{type:"string",source:"attribute",selector:"video",attribute:"poster"},preload:{type:"string",source:"attribute",selector:"video",attribute:"preload",default:"metadata"},src:{type:"string",source:"attribute",selector:"video",attribute:"src",__experimentalRole:"content"},playsInline:{type:"boolean",source:"attribute",selector:"video",attribute:"playsinline"},tracks:{__experimentalRole:"content",type:"array",items:{type:"object"},default:[]}},supports:{anchor:!0,align:!0,spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-video-editor",style:"wp-block-video"},{name:$S}=VS,OS={icon:kS,example:{attributes:{src:"https://upload.wikimedia.org/wikipedia/commons/c/ca/Wood_thrush_in_Central_Park_switch_sides_%2816510%29.webm",caption:(0,tt.__)("Wood thrush singing in Central Park, NYC.")}},transforms:FS,deprecated:CS,edit:LS,save:function({attributes:e}){const{autoplay:t,caption:n,controls:a,loop:o,muted:r,poster:l,preload:i,src:s,playsInline:c,tracks:m}=e;return(0,Ke.createElement)("figure",{...nt.useBlockProps.save()},s&&(0,Ke.createElement)("video",{autoPlay:t,controls:a,loop:o,muted:r,poster:l,preload:"metadata"!==i?i:void 0,src:s,playsInline:c},(0,Ke.createElement)(xS,{tracks:m})),!nt.RichText.isEmpty(n)&&(0,Ke.createElement)(nt.RichText.Content,{className:(0,nt.__experimentalGetElementClassName)("caption"),tagName:"figcaption",value:n}))}},GS=()=>Xe({name:$S,metadata:VS,settings:OS});const US={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let qS;const jS=new Uint8Array(16);function WS(){if(!qS&&(qS="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!qS))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return qS(jS)}const ZS=[];for(let e=0;e<256;++e)ZS.push((e+256).toString(16).slice(1));function QS(e,t=0){return ZS[e[t+0]]+ZS[e[t+1]]+ZS[e[t+2]]+ZS[e[t+3]]+"-"+ZS[e[t+4]]+ZS[e[t+5]]+"-"+ZS[e[t+6]]+ZS[e[t+7]]+"-"+ZS[e[t+8]]+ZS[e[t+9]]+"-"+ZS[e[t+10]]+ZS[e[t+11]]+ZS[e[t+12]]+ZS[e[t+13]]+ZS[e[t+14]]+ZS[e[t+15]]}const KS=function(e,t,n){if(US.randomUUID&&!t&&!e)return US.randomUUID();const a=(e=e||{}).random||(e.rng||WS)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=a[e];return t}return QS(a)},{usesContextKey:YS}=Ft(nt.privateApis),JS="core/footnote",XS="core/post-content",eB={title:(0,tt.__)("Footnote"),tagName:"sup",className:"fn",attributes:{"data-fn":"data-fn"},interactive:!0,contentEditable:!1,[YS]:["postType","postId"],edit:function({value:e,onChange:t,isObjectActive:n,context:{postType:a,postId:o}}){const r=(0,gt.useRegistry)(),{getSelectedBlockClientId:l,getBlocks:i,getBlockRootClientId:s,getBlockName:c,getBlockParentsByBlockName:m}=r.select(nt.store),u=(0,gt.useSelect)((e=>{if(!e(Qe.store).getBlockType("core/footnotes"))return!1;const t=e(nt.store).getSettings().allowedBlockTypes;if(!1===t||Array.isArray(t)&&!t.includes("core/footnotes"))return!1;const n=e(dt.store).getEntityRecord("postType",a,o);if("string"!=typeof n?.meta?.footnotes)return!1;const{getBlockParentsByBlockName:r,getSelectedBlockClientId:l}=e(nt.store),i=r(l(),"core/block");return!i||0===i.length}),[a,o]),{selectionChange:p,insertBlock:d}=(0,gt.useDispatch)(nt.store);if(!u)return null;return(0,Ke.createElement)(nt.RichTextToolbarButton,{icon:Wp,title:(0,tt.__)("Footnote"),onClick:function(){r.batch((()=>{let a;if(n){const t=e.replacements[e.start];a=t?.attributes?.["data-fn"]}else{a=KS();const n=(0,Rn.insertObject)(e,{type:JS,attributes:{"data-fn":a},innerHTML:`<a href="#${a}" id="${a}-link">*</a>`},e.end,e.end);n.start=n.end-1,t(n)}const o=l(),r=m(o,XS);let u=null;{const e=[...r.length?i(r[0]):i()];for(;e.length;){const t=e.shift();if("core/footnotes"===t.name){u=t;break}e.push(...t.innerBlocks)}}if(!u){let e=s(o);for(;e&&c(e)!==XS;)e=s(e);u=(0,Qe.createBlock)("core/footnotes"),d(u,void 0,e)}p(u.clientId,a,0,0)}))},isActive:n})}},tB={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/footnotes",title:"Footnotes",category:"text",description:"Display footnotes added to the page.",keywords:["references"],textdomain:"default",usesContext:["postId","postType"],supports:{__experimentalBorder:{radius:!0,color:!0,width:!0,style:!0,__experimentalDefaultControls:{radius:!1,color:!1,width:!1,style:!1}},color:{background:!0,link:!0,text:!0,__experimentalDefaultControls:{link:!0,text:!0}},html:!1,multiple:!1,reusable:!1,inserter:!1,spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalTextDecoration:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalLetterSpacing:!0,__experimentalTextTransform:!0,__experimentalWritingMode:!0,__experimentalDefaultControls:{fontSize:!0}},interactivity:{clientNavigation:!0}},style:"wp-block-footnotes"},{name:nB}=tB,aB={icon:Wp,edit:function({context:{postType:e,postId:t}}){const[n,a]=(0,dt.useEntityProp)("postType",e,"meta",t),o="string"==typeof n?.footnotes,r=n?.footnotes?JSON.parse(n.footnotes):[],l=(0,nt.useBlockProps)();return o?r.length?(0,Ke.createElement)("ol",{...l},r.map((({id:e,content:t})=>(0,Ke.createElement)("li",{key:e,onMouseDown:e=>{e.target===e.currentTarget&&(e.target.firstElementChild.focus(),e.preventDefault())}},(0,Ke.createElement)(nt.RichText,{id:e,tagName:"span",value:t,identifier:e,onFocus:e=>{e.target.textContent.trim()||e.target.scrollIntoView()},onChange:t=>{a({...n,footnotes:JSON.stringify(r.map((n=>n.id===e?{content:t,id:e}:n)))})}})," ",(0,Ke.createElement)("a",{href:`#${e}-link`},"↩︎"))))):(0,Ke.createElement)("div",{...l},(0,Ke.createElement)(et.Placeholder,{icon:(0,Ke.createElement)(nt.BlockIcon,{icon:Wp}),label:(0,tt.__)("Footnotes"),instructions:(0,tt.__)("Footnotes found in blocks within this document will be displayed here.")})):(0,Ke.createElement)("div",{...l},(0,Ke.createElement)(et.Placeholder,{icon:(0,Ke.createElement)(nt.BlockIcon,{icon:Wp}),label:(0,tt.__)("Footnotes"),instructions:(0,tt.__)("Footnotes are not supported here. Add this block to post or page content.")}))}};(0,Rn.registerFormatType)(JS,eB);const oB=()=>{Xe({name:nB,metadata:tB,settings:aB})};var rB=n(2321),lB=n.n(rB);const iB=()=>(()=>{const n=[te,F,H,R,O,G,Be,e,o,r,l,i,s,m,u,p,g,S,B,N,T,A,D,V,$,q,j,W,Y,X,ee,J,ye,ve,Ne,Ie,Pe,Me,ze,Le,De,Fe,Ve,Oe,qe,je,We,Ze,Z,Q,K,Re,He,Ae,fe,Ge,t,_e,ue,pe,ce,ne,ae,re,le,se,me,he,de,ge,be,xe,we,Ee,Ce,ke,Te,d,h,b,_,y,v,f,C,x,w,E,k,ie,$e,L,U,Ue,Se,oe];return window?.__experimentalEnableFormBlocks&&(n.push(I),n.push(P),n.push(M),n.push(z)),window?.wp?.oldEditor&&(window?.wp?.needsClassicBlock||!window?.__experimentalDisableTinymce||new URLSearchParams(window?.location?.search).get("requiresTinymce"))&&n.push(c),n.filter(Boolean)})().filter((({metadata:e})=>!lB()(e))),sB=(e=iB())=>{e.forEach((({init:e})=>e())),(0,Qe.setDefaultBlockName)(x_),window.wp&&window.wp.oldEditor&&e.some((({name:e})=>e===da))&&(0,Qe.setFreeformContentHandlerName)(da),(0,Qe.setUnregisteredTypeHandlerName)(bg),(0,Qe.setGroupingBlockName)(au)},cB=void 0})(),(window.wp=window.wp||{}).blockLibrary=a})();/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (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 */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ parse: () => (/* binding */ parse)
/* harmony export */ });
/**
* @type {string}
*/
let document;
/**
* @type {number}
*/
let offset;
/**
* @type {ParsedBlock[]}
*/
let output;
/**
* @type {ParsedFrame[]}
*/
let stack;
/**
* @typedef {Object|null} Attributes
*/
/**
* @typedef {Object} ParsedBlock
* @property {string|null} blockName Block name.
* @property {Attributes} attrs Block attributes.
* @property {ParsedBlock[]} innerBlocks Inner blocks.
* @property {string} innerHTML Inner HTML.
* @property {Array<string|null>} innerContent Inner content.
*/
/**
* @typedef {Object} ParsedFrame
* @property {ParsedBlock} block Block.
* @property {number} tokenStart Token start.
* @property {number} tokenLength Token length.
* @property {number} prevOffset Previous offset.
* @property {number|null} leadingHtmlStart Leading HTML start.
*/
/**
* @typedef {'no-more-tokens'|'void-block'|'block-opener'|'block-closer'} TokenType
*/
/**
* @typedef {[TokenType, string, Attributes, number, number]} Token
*/
/**
* Matches block comment delimiters
*
* While most of this pattern is straightforward the attribute parsing
* incorporates a tricks to make sure we don't choke on specific input
*
* - since JavaScript has no possessive quantifier or atomic grouping
* we are emulating it with a trick
*
* we want a possessive quantifier or atomic group to prevent backtracking
* on the `}`s should we fail to match the remainder of the pattern
*
* we can emulate this with a positive lookahead and back reference
* (a++)*c === ((?=(a+))\1)*c
*
* let's examine an example:
* - /(a+)*c/.test('aaaaaaaaaaaaad') fails after over 49,000 steps
* - /(a++)*c/.test('aaaaaaaaaaaaad') fails after 85 steps
* - /(?>a+)*c/.test('aaaaaaaaaaaaad') fails after 126 steps
*
* this is because the possessive `++` and the atomic group `(?>)`
* tell the engine that all those `a`s belong together as a single group
* and so it won't split it up when stepping backwards to try and match
*
* if we use /((?=(a+))\1)*c/ then we get the same behavior as the atomic group
* or possessive and prevent the backtracking because the `a+` is matched but
* not captured. thus, we find the long string of `a`s and remember it, then
* reference it as a whole unit inside our pattern
*
* @see http://instanceof.me/post/52245507631/regex-emulate-atomic-grouping-with-lookahead
* @see http://blog.stevenlevithan.com/archives/mimic-atomic-groups
* @see https://javascript.info/regexp-infinite-backtracking-problem
*
* once browsers reliably support atomic grouping or possessive
* quantifiers natively we should remove this trick and simplify
*
* @type {RegExp}
*
* @since 3.8.0
* @since 4.6.1 added optimization to prevent backtracking on attribute parsing
*/
const tokenizer = /<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:(?=([^}]+|}+(?=})|(?!}\s+\/?-->)[^])*)\5|[^]*?)}\s+)?(\/)?-->/g;
/**
* Constructs a block object.
*
* @param {string|null} blockName
* @param {Attributes} attrs
* @param {ParsedBlock[]} innerBlocks
* @param {string} innerHTML
* @param {string[]} innerContent
* @return {ParsedBlock} The block object.
*/
function Block(blockName, attrs, innerBlocks, innerHTML, innerContent) {
return {
blockName,
attrs,
innerBlocks,
innerHTML,
innerContent
};
}
/**
* Constructs a freeform block object.
*
* @param {string} innerHTML
* @return {ParsedBlock} The freeform block object.
*/
function Freeform(innerHTML) {
return Block(null, {}, [], innerHTML, [innerHTML]);
}
/**
* Constructs a frame object.
*
* @param {ParsedBlock} block
* @param {number} tokenStart
* @param {number} tokenLength
* @param {number} prevOffset
* @param {number|null} leadingHtmlStart
* @return {ParsedFrame} The frame object.
*/
function Frame(block, tokenStart, tokenLength, prevOffset, leadingHtmlStart) {
return {
block,
tokenStart,
tokenLength,
prevOffset: prevOffset || tokenStart + tokenLength,
leadingHtmlStart
};
}
/**
* Parser function, that converts input HTML into a block based structure.
*
* @param {string} doc The HTML document to parse.
*
* @example
* Input post:
* ```html
* <!-- wp:columns {"columns":3} -->
* <div class="wp-block-columns has-3-columns"><!-- wp:column -->
* <div class="wp-block-column"><!-- wp:paragraph -->
* <p>Left</p>
* <!-- /wp:paragraph --></div>
* <!-- /wp:column -->
*
* <!-- wp:column -->
* <div class="wp-block-column"><!-- wp:paragraph -->
* <p><strong>Middle</strong></p>
* <!-- /wp:paragraph --></div>
* <!-- /wp:column -->
*
* <!-- wp:column -->
* <div class="wp-block-column"></div>
* <!-- /wp:column --></div>
* <!-- /wp:columns -->
* ```
*
* Parsing code:
* ```js
* import { parse } from '@wordpress/block-serialization-default-parser';
*
* parse( post ) === [
* {
* blockName: "core/columns",
* attrs: {
* columns: 3
* },
* innerBlocks: [
* {
* blockName: "core/column",
* attrs: null,
* innerBlocks: [
* {
* blockName: "core/paragraph",
* attrs: null,
* innerBlocks: [],
* innerHTML: "\n<p>Left</p>\n"
* }
* ],
* innerHTML: '\n<div class="wp-block-column"></div>\n'
* },
* {
* blockName: "core/column",
* attrs: null,
* innerBlocks: [
* {
* blockName: "core/paragraph",
* attrs: null,
* innerBlocks: [],
* innerHTML: "\n<p><strong>Middle</strong></p>\n"
* }
* ],
* innerHTML: '\n<div class="wp-block-column"></div>\n'
* },
* {
* blockName: "core/column",
* attrs: null,
* innerBlocks: [],
* innerHTML: '\n<div class="wp-block-column"></div>\n'
* }
* ],
* innerHTML: '\n<div class="wp-block-columns has-3-columns">\n\n\n\n</div>\n'
* }
* ];
* ```
* @return {ParsedBlock[]} A block-based representation of the input HTML.
*/
const parse = doc => {
document = doc;
offset = 0;
output = [];
stack = [];
tokenizer.lastIndex = 0;
do {
// twiddle our thumbs
} while (proceed());
return output;
};
/**
* Parses the next token in the input document.
*
* @return {boolean} Returns true when there is more tokens to parse.
*/
function proceed() {
const stackDepth = stack.length;
const next = nextToken();
const [tokenType, blockName, attrs, startOffset, tokenLength] = next;
// We may have some HTML soup before the next block.
const leadingHtmlStart = startOffset > offset ? offset : null;
switch (tokenType) {
case 'no-more-tokens':
// If not in a block then flush output.
if (0 === stackDepth) {
addFreeform();
return false;
}
// Otherwise we have a problem
// This is an error
// we have options
// - treat it all as freeform text
// - assume an implicit closer (easiest when not nesting)
// For the easy case we'll assume an implicit closer.
if (1 === stackDepth) {
addBlockFromStack();
return false;
}
// For the nested case where it's more difficult we'll
// have to assume that multiple closers are missing
// and so we'll collapse the whole stack piecewise.
while (0 < stack.length) {
addBlockFromStack();
}
return false;
case 'void-block':
// easy case is if we stumbled upon a void block
// in the top-level of the document.
if (0 === stackDepth) {
if (null !== leadingHtmlStart) {
output.push(Freeform(document.substr(leadingHtmlStart, startOffset - leadingHtmlStart)));
}
output.push(Block(blockName, attrs, [], '', []));
offset = startOffset + tokenLength;
return true;
}
// Otherwise we found an inner block.
addInnerBlock(Block(blockName, attrs, [], '', []), startOffset, tokenLength);
offset = startOffset + tokenLength;
return true;
case 'block-opener':
// Track all newly-opened blocks on the stack.
stack.push(Frame(Block(blockName, attrs, [], '', []), startOffset, tokenLength, startOffset + tokenLength, leadingHtmlStart));
offset = startOffset + tokenLength;
return true;
case 'block-closer':
// If we're missing an opener we're in trouble
// This is an error.
if (0 === stackDepth) {
// We have options
// - assume an implicit opener
// - assume _this_ is the opener
// - give up and close out the document.
addFreeform();
return false;
}
// If we're not nesting then this is easy - close the block.
if (1 === stackDepth) {
addBlockFromStack(startOffset);
offset = startOffset + tokenLength;
return true;
}
// Otherwise we're nested and we have to close out the current
// block and add it as a innerBlock to the parent.
const stackTop = /** @type {ParsedFrame} */stack.pop();
const html = document.substr(stackTop.prevOffset, startOffset - stackTop.prevOffset);
stackTop.block.innerHTML += html;
stackTop.block.innerContent.push(html);
stackTop.prevOffset = startOffset + tokenLength;
addInnerBlock(stackTop.block, stackTop.tokenStart, stackTop.tokenLength, startOffset + tokenLength);
offset = startOffset + tokenLength;
return true;
default:
// This is an error.
addFreeform();
return false;
}
}
/**
* Parse JSON if valid, otherwise return null
*
* Note that JSON coming from the block comment
* delimiters is constrained to be an object
* and cannot be things like `true` or `null`
*
* @param {string} input JSON input string to parse
* @return {Object|null} parsed JSON if valid
*/
function parseJSON(input) {
try {
return JSON.parse(input);
} catch (e) {
return null;
}
}
/**
* Finds the next token in the document.
*
* @return {Token} The next matched token.
*/
function nextToken() {
// Aye the magic
// we're using a single RegExp to tokenize the block comment delimiters
// we're also using a trick here because the only difference between a
// block opener and a block closer is the leading `/` before `wp:` (and
// a closer has no attributes). we can trap them both and process the
// match back in JavaScript to see which one it was.
const matches = tokenizer.exec(document);
// We have no more tokens.
if (null === matches) {
return ['no-more-tokens', '', null, 0, 0];
}
const startedAt = matches.index;
const [match, closerMatch, namespaceMatch, nameMatch, attrsMatch /* Internal/unused. */,, voidMatch] = matches;
const length = match.length;
const isCloser = !!closerMatch;
const isVoid = !!voidMatch;
const namespace = namespaceMatch || 'core/';
const name = namespace + nameMatch;
const hasAttrs = !!attrsMatch;
const attrs = hasAttrs ? parseJSON(attrsMatch) : {};
// This state isn't allowed
// This is an error.
if (isCloser && (isVoid || hasAttrs)) {
// We can ignore them since they don't hurt anything
// we may warn against this at some point or reject it.
}
if (isVoid) {
return ['void-block', name, attrs, startedAt, length];
}
if (isCloser) {
return ['block-closer', name, null, startedAt, length];
}
return ['block-opener', name, attrs, startedAt, length];
}
/**
* Adds a freeform block to the output.
*
* @param {number} [rawLength]
*/
function addFreeform(rawLength) {
const length = rawLength ? rawLength : document.length - offset;
if (0 === length) {
return;
}
output.push(Freeform(document.substr(offset, length)));
}
/**
* Adds inner block to the parent block.
*
* @param {ParsedBlock} block
* @param {number} tokenStart
* @param {number} tokenLength
* @param {number} [lastOffset]
*/
function addInnerBlock(block, tokenStart, tokenLength, lastOffset) {
const parent = stack[stack.length - 1];
parent.block.innerBlocks.push(block);
const html = document.substr(parent.prevOffset, tokenStart - parent.prevOffset);
if (html) {
parent.block.innerHTML += html;
parent.block.innerContent.push(html);
}
parent.block.innerContent.push(null);
parent.prevOffset = lastOffset ? lastOffset : tokenStart + tokenLength;
}
/**
* Adds block from the stack to the output.
*
* @param {number} [endOffset]
*/
function addBlockFromStack(endOffset) {
const {
block,
leadingHtmlStart,
prevOffset,
tokenStart
} = /** @type {ParsedFrame} */stack.pop();
const html = endOffset ? document.substr(prevOffset, endOffset - prevOffset) : document.substr(prevOffset);
if (html) {
block.innerHTML += html;
block.innerContent.push(html);
}
if (null !== leadingHtmlStart) {
output.push(Freeform(document.substr(leadingHtmlStart, tokenStart - leadingHtmlStart)));
}
output.push(block);
}
(window.wp = window.wp || {}).blockSerializationDefaultParser = __webpack_exports__;
/******/ })()
;/*! This file is auto-generated */
(()=>{"use strict";var n={d:(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o:(n,e)=>Object.prototype.hasOwnProperty.call(n,e),r:n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})}},e={};let t,r,o,s;n.r(e),n.d(e,{parse:()=>i});const l=/<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:(?=([^}]+|}+(?=})|(?!}\s+\/?-->)[^])*)\5|[^]*?)}\s+)?(\/)?-->/g;function u(n,e,t,r,o){return{blockName:n,attrs:e,innerBlocks:t,innerHTML:r,innerContent:o}}function c(n){return u(null,{},[],n,[n])}const i=n=>{t=n,r=0,o=[],s=[],l.lastIndex=0;do{}while(f());return o};function f(){const n=s.length,e=function(){const n=l.exec(t);if(null===n)return["no-more-tokens","",null,0,0];const e=n.index,[r,o,s,u,c,,i]=n,f=r.length,p=!!o,a=!!i,b=(s||"core/")+u,k=!!c,h=k?function(n){try{return JSON.parse(n)}catch(n){return null}}(c):{};if(a)return["void-block",b,h,e,f];if(p)return["block-closer",b,null,e,f];return["block-opener",b,h,e,f]}(),[i,f,k,h,d]=e,g=h>r?r:null;switch(i){case"no-more-tokens":if(0===n)return p(),!1;if(1===n)return b(),!1;for(;0<s.length;)b();return!1;case"void-block":return 0===n?(null!==g&&o.push(c(t.substr(g,h-g))),o.push(u(f,k,[],"",[])),r=h+d,!0):(a(u(f,k,[],"",[]),h,d),r=h+d,!0);case"block-opener":return s.push(function(n,e,t,r,o){return{block:n,tokenStart:e,tokenLength:t,prevOffset:r||e+t,leadingHtmlStart:o}}(u(f,k,[],"",[]),h,d,h+d,g)),r=h+d,!0;case"block-closer":if(0===n)return p(),!1;if(1===n)return b(h),r=h+d,!0;const e=s.pop(),l=t.substr(e.prevOffset,h-e.prevOffset);return e.block.innerHTML+=l,e.block.innerContent.push(l),e.prevOffset=h+d,a(e.block,e.tokenStart,e.tokenLength,h+d),r=h+d,!0;default:return p(),!1}}function p(n){const e=n||t.length-r;0!==e&&o.push(c(t.substr(r,e)))}function a(n,e,r,o){const l=s[s.length-1];l.block.innerBlocks.push(n);const u=t.substr(l.prevOffset,e-l.prevOffset);u&&(l.block.innerHTML+=u,l.block.innerContent.push(u)),l.block.innerContent.push(null),l.prevOffset=o||e+r}function b(n){const{block:e,leadingHtmlStart:r,prevOffset:l,tokenStart:u}=s.pop(),i=n?t.substr(l,n-l):t.substr(l);i&&(e.innerHTML+=i,e.innerContent.push(i)),null!==r&&o.push(c(t.substr(r,u-r))),o.push(e)}(window.wp=window.wp||{}).blockSerializationDefaultParser=e})();/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 7734:
/***/ ((module) => {
"use strict";
// do not edit .js files directly - edit src/index.jst
var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
module.exports = function equal(a, b) {
if (a === b) return true;
if (a && b && typeof a == 'object' && typeof b == 'object') {
if (a.constructor !== b.constructor) return false;
var length, i, keys;
if (Array.isArray(a)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (!equal(a[i], b[i])) return false;
return true;
}
if ((a instanceof Map) && (b instanceof Map)) {
if (a.size !== b.size) return false;
for (i of a.entries())
if (!b.has(i[0])) return false;
for (i of a.entries())
if (!equal(i[1], b.get(i[0]))) return false;
return true;
}
if ((a instanceof Set) && (b instanceof Set)) {
if (a.size !== b.size) return false;
for (i of a.entries())
if (!b.has(i[0])) return false;
return true;
}
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (a[i] !== b[i]) return false;
return true;
}
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) return false;
for (i = length; i-- !== 0;)
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
for (i = length; i-- !== 0;) {
var key = keys[i];
if (!equal(a[key], b[key])) return false;
}
return true;
}
// true if both NaN, false otherwise
return a!==a && b!==b;
};
/***/ }),
/***/ 5373:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
var __webpack_unused_export__;
/**
* @license React
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}__webpack_unused_export__=h;__webpack_unused_export__=g;__webpack_unused_export__=b;__webpack_unused_export__=l;__webpack_unused_export__=d;__webpack_unused_export__=q;__webpack_unused_export__=p;__webpack_unused_export__=c;__webpack_unused_export__=f;__webpack_unused_export__=e;__webpack_unused_export__=m;
__webpack_unused_export__=n;__webpack_unused_export__=function(){return!1};__webpack_unused_export__=function(){return!1};__webpack_unused_export__=function(a){return v(a)===h};__webpack_unused_export__=function(a){return v(a)===g};__webpack_unused_export__=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};__webpack_unused_export__=function(a){return v(a)===l};__webpack_unused_export__=function(a){return v(a)===d};__webpack_unused_export__=function(a){return v(a)===q};__webpack_unused_export__=function(a){return v(a)===p};
__webpack_unused_export__=function(a){return v(a)===c};__webpack_unused_export__=function(a){return v(a)===f};__webpack_unused_export__=function(a){return v(a)===e};__webpack_unused_export__=function(a){return v(a)===m};__webpack_unused_export__=function(a){return v(a)===n};
exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};__webpack_unused_export__=v;
/***/ }),
/***/ 8529:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
if (true) {
module.exports = __webpack_require__(5373);
} else {}
/***/ }),
/***/ 9681:
/***/ ((module) => {
var characterMap = {
"À": "A",
"Á": "A",
"Â": "A",
"Ã": "A",
"Ä": "A",
"Å": "A",
"Ấ": "A",
"Ắ": "A",
"Ẳ": "A",
"Ẵ": "A",
"Ặ": "A",
"Æ": "AE",
"Ầ": "A",
"Ằ": "A",
"Ȃ": "A",
"Ả": "A",
"Ạ": "A",
"Ẩ": "A",
"Ẫ": "A",
"Ậ": "A",
"Ç": "C",
"Ḉ": "C",
"È": "E",
"É": "E",
"Ê": "E",
"Ë": "E",
"Ế": "E",
"Ḗ": "E",
"Ề": "E",
"Ḕ": "E",
"Ḝ": "E",
"Ȇ": "E",
"Ẻ": "E",
"Ẽ": "E",
"Ẹ": "E",
"Ể": "E",
"Ễ": "E",
"Ệ": "E",
"Ì": "I",
"Í": "I",
"Î": "I",
"Ï": "I",
"Ḯ": "I",
"Ȋ": "I",
"Ỉ": "I",
"Ị": "I",
"Ð": "D",
"Ñ": "N",
"Ò": "O",
"Ó": "O",
"Ô": "O",
"Õ": "O",
"Ö": "O",
"Ø": "O",
"Ố": "O",
"Ṍ": "O",
"Ṓ": "O",
"Ȏ": "O",
"Ỏ": "O",
"Ọ": "O",
"Ổ": "O",
"Ỗ": "O",
"Ộ": "O",
"Ờ": "O",
"Ở": "O",
"Ỡ": "O",
"Ớ": "O",
"Ợ": "O",
"Ù": "U",
"Ú": "U",
"Û": "U",
"Ü": "U",
"Ủ": "U",
"Ụ": "U",
"Ử": "U",
"Ữ": "U",
"Ự": "U",
"Ý": "Y",
"à": "a",
"á": "a",
"â": "a",
"ã": "a",
"ä": "a",
"å": "a",
"ấ": "a",
"ắ": "a",
"ẳ": "a",
"ẵ": "a",
"ặ": "a",
"æ": "ae",
"ầ": "a",
"ằ": "a",
"ȃ": "a",
"ả": "a",
"ạ": "a",
"ẩ": "a",
"ẫ": "a",
"ậ": "a",
"ç": "c",
"ḉ": "c",
"è": "e",
"é": "e",
"ê": "e",
"ë": "e",
"ế": "e",
"ḗ": "e",
"ề": "e",
"ḕ": "e",
"ḝ": "e",
"ȇ": "e",
"ẻ": "e",
"ẽ": "e",
"ẹ": "e",
"ể": "e",
"ễ": "e",
"ệ": "e",
"ì": "i",
"í": "i",
"î": "i",
"ï": "i",
"ḯ": "i",
"ȋ": "i",
"ỉ": "i",
"ị": "i",
"ð": "d",
"ñ": "n",
"ò": "o",
"ó": "o",
"ô": "o",
"õ": "o",
"ö": "o",
"ø": "o",
"ố": "o",
"ṍ": "o",
"ṓ": "o",
"ȏ": "o",
"ỏ": "o",
"ọ": "o",
"ổ": "o",
"ỗ": "o",
"ộ": "o",
"ờ": "o",
"ở": "o",
"ỡ": "o",
"ớ": "o",
"ợ": "o",
"ù": "u",
"ú": "u",
"û": "u",
"ü": "u",
"ủ": "u",
"ụ": "u",
"ử": "u",
"ữ": "u",
"ự": "u",
"ý": "y",
"ÿ": "y",
"Ā": "A",
"ā": "a",
"Ă": "A",
"ă": "a",
"Ą": "A",
"ą": "a",
"Ć": "C",
"ć": "c",
"Ĉ": "C",
"ĉ": "c",
"Ċ": "C",
"ċ": "c",
"Č": "C",
"č": "c",
"C̆": "C",
"c̆": "c",
"Ď": "D",
"ď": "d",
"Đ": "D",
"đ": "d",
"Ē": "E",
"ē": "e",
"Ĕ": "E",
"ĕ": "e",
"Ė": "E",
"ė": "e",
"Ę": "E",
"ę": "e",
"Ě": "E",
"ě": "e",
"Ĝ": "G",
"Ǵ": "G",
"ĝ": "g",
"ǵ": "g",
"Ğ": "G",
"ğ": "g",
"Ġ": "G",
"ġ": "g",
"Ģ": "G",
"ģ": "g",
"Ĥ": "H",
"ĥ": "h",
"Ħ": "H",
"ħ": "h",
"Ḫ": "H",
"ḫ": "h",
"Ĩ": "I",
"ĩ": "i",
"Ī": "I",
"ī": "i",
"Ĭ": "I",
"ĭ": "i",
"Į": "I",
"į": "i",
"İ": "I",
"ı": "i",
"IJ": "IJ",
"ij": "ij",
"Ĵ": "J",
"ĵ": "j",
"Ķ": "K",
"ķ": "k",
"Ḱ": "K",
"ḱ": "k",
"K̆": "K",
"k̆": "k",
"Ĺ": "L",
"ĺ": "l",
"Ļ": "L",
"ļ": "l",
"Ľ": "L",
"ľ": "l",
"Ŀ": "L",
"ŀ": "l",
"Ł": "l",
"ł": "l",
"Ḿ": "M",
"ḿ": "m",
"M̆": "M",
"m̆": "m",
"Ń": "N",
"ń": "n",
"Ņ": "N",
"ņ": "n",
"Ň": "N",
"ň": "n",
"ʼn": "n",
"N̆": "N",
"n̆": "n",
"Ō": "O",
"ō": "o",
"Ŏ": "O",
"ŏ": "o",
"Ő": "O",
"ő": "o",
"Œ": "OE",
"œ": "oe",
"P̆": "P",
"p̆": "p",
"Ŕ": "R",
"ŕ": "r",
"Ŗ": "R",
"ŗ": "r",
"Ř": "R",
"ř": "r",
"R̆": "R",
"r̆": "r",
"Ȓ": "R",
"ȓ": "r",
"Ś": "S",
"ś": "s",
"Ŝ": "S",
"ŝ": "s",
"Ş": "S",
"Ș": "S",
"ș": "s",
"ş": "s",
"Š": "S",
"š": "s",
"Ţ": "T",
"ţ": "t",
"ț": "t",
"Ț": "T",
"Ť": "T",
"ť": "t",
"Ŧ": "T",
"ŧ": "t",
"T̆": "T",
"t̆": "t",
"Ũ": "U",
"ũ": "u",
"Ū": "U",
"ū": "u",
"Ŭ": "U",
"ŭ": "u",
"Ů": "U",
"ů": "u",
"Ű": "U",
"ű": "u",
"Ų": "U",
"ų": "u",
"Ȗ": "U",
"ȗ": "u",
"V̆": "V",
"v̆": "v",
"Ŵ": "W",
"ŵ": "w",
"Ẃ": "W",
"ẃ": "w",
"X̆": "X",
"x̆": "x",
"Ŷ": "Y",
"ŷ": "y",
"Ÿ": "Y",
"Y̆": "Y",
"y̆": "y",
"Ź": "Z",
"ź": "z",
"Ż": "Z",
"ż": "z",
"Ž": "Z",
"ž": "z",
"ſ": "s",
"ƒ": "f",
"Ơ": "O",
"ơ": "o",
"Ư": "U",
"ư": "u",
"Ǎ": "A",
"ǎ": "a",
"Ǐ": "I",
"ǐ": "i",
"Ǒ": "O",
"ǒ": "o",
"Ǔ": "U",
"ǔ": "u",
"Ǖ": "U",
"ǖ": "u",
"Ǘ": "U",
"ǘ": "u",
"Ǚ": "U",
"ǚ": "u",
"Ǜ": "U",
"ǜ": "u",
"Ứ": "U",
"ứ": "u",
"Ṹ": "U",
"ṹ": "u",
"Ǻ": "A",
"ǻ": "a",
"Ǽ": "AE",
"ǽ": "ae",
"Ǿ": "O",
"ǿ": "o",
"Þ": "TH",
"þ": "th",
"Ṕ": "P",
"ṕ": "p",
"Ṥ": "S",
"ṥ": "s",
"X́": "X",
"x́": "x",
"Ѓ": "Г",
"ѓ": "г",
"Ќ": "К",
"ќ": "к",
"A̋": "A",
"a̋": "a",
"E̋": "E",
"e̋": "e",
"I̋": "I",
"i̋": "i",
"Ǹ": "N",
"ǹ": "n",
"Ồ": "O",
"ồ": "o",
"Ṑ": "O",
"ṑ": "o",
"Ừ": "U",
"ừ": "u",
"Ẁ": "W",
"ẁ": "w",
"Ỳ": "Y",
"ỳ": "y",
"Ȁ": "A",
"ȁ": "a",
"Ȅ": "E",
"ȅ": "e",
"Ȉ": "I",
"ȉ": "i",
"Ȍ": "O",
"ȍ": "o",
"Ȑ": "R",
"ȑ": "r",
"Ȕ": "U",
"ȕ": "u",
"B̌": "B",
"b̌": "b",
"Č̣": "C",
"č̣": "c",
"Ê̌": "E",
"ê̌": "e",
"F̌": "F",
"f̌": "f",
"Ǧ": "G",
"ǧ": "g",
"Ȟ": "H",
"ȟ": "h",
"J̌": "J",
"ǰ": "j",
"Ǩ": "K",
"ǩ": "k",
"M̌": "M",
"m̌": "m",
"P̌": "P",
"p̌": "p",
"Q̌": "Q",
"q̌": "q",
"Ř̩": "R",
"ř̩": "r",
"Ṧ": "S",
"ṧ": "s",
"V̌": "V",
"v̌": "v",
"W̌": "W",
"w̌": "w",
"X̌": "X",
"x̌": "x",
"Y̌": "Y",
"y̌": "y",
"A̧": "A",
"a̧": "a",
"B̧": "B",
"b̧": "b",
"Ḑ": "D",
"ḑ": "d",
"Ȩ": "E",
"ȩ": "e",
"Ɛ̧": "E",
"ɛ̧": "e",
"Ḩ": "H",
"ḩ": "h",
"I̧": "I",
"i̧": "i",
"Ɨ̧": "I",
"ɨ̧": "i",
"M̧": "M",
"m̧": "m",
"O̧": "O",
"o̧": "o",
"Q̧": "Q",
"q̧": "q",
"U̧": "U",
"u̧": "u",
"X̧": "X",
"x̧": "x",
"Z̧": "Z",
"z̧": "z",
"й":"и",
"Й":"И",
"ё":"е",
"Ё":"Е",
};
var chars = Object.keys(characterMap).join('|');
var allAccents = new RegExp(chars, 'g');
var firstAccent = new RegExp(chars, '');
function matcher(match) {
return characterMap[match];
}
var removeAccents = function(string) {
return string.replace(allAccents, matcher);
};
var hasAccents = function(string) {
return !!string.match(firstAccent);
};
module.exports = removeAccents;
module.exports.has = hasAccents;
module.exports.remove = removeAccents;
/***/ }),
/***/ 1030:
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;;/*! showdown v 1.9.1 - 02-11-2019 */
(function(){
/**
* Created by Tivie on 13-07-2015.
*/
function getDefaultOpts (simple) {
'use strict';
var defaultOptions = {
omitExtraWLInCodeBlocks: {
defaultValue: false,
describe: 'Omit the default extra whiteline added to code blocks',
type: 'boolean'
},
noHeaderId: {
defaultValue: false,
describe: 'Turn on/off generated header id',
type: 'boolean'
},
prefixHeaderId: {
defaultValue: false,
describe: 'Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic \'section-\' prefix',
type: 'string'
},
rawPrefixHeaderId: {
defaultValue: false,
describe: 'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',
type: 'boolean'
},
ghCompatibleHeaderId: {
defaultValue: false,
describe: 'Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)',
type: 'boolean'
},
rawHeaderId: {
defaultValue: false,
describe: 'Remove only spaces, \' and " from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids',
type: 'boolean'
},
headerLevelStart: {
defaultValue: false,
describe: 'The header blocks level start',
type: 'integer'
},
parseImgDimensions: {
defaultValue: false,
describe: 'Turn on/off image dimension parsing',
type: 'boolean'
},
simplifiedAutoLink: {
defaultValue: false,
describe: 'Turn on/off GFM autolink style',
type: 'boolean'
},
excludeTrailingPunctuationFromURLs: {
defaultValue: false,
describe: 'Excludes trailing punctuation from links generated with autoLinking',
type: 'boolean'
},
literalMidWordUnderscores: {
defaultValue: false,
describe: 'Parse midword underscores as literal underscores',
type: 'boolean'
},
literalMidWordAsterisks: {
defaultValue: false,
describe: 'Parse midword asterisks as literal asterisks',
type: 'boolean'
},
strikethrough: {
defaultValue: false,
describe: 'Turn on/off strikethrough support',
type: 'boolean'
},
tables: {
defaultValue: false,
describe: 'Turn on/off tables support',
type: 'boolean'
},
tablesHeaderId: {
defaultValue: false,
describe: 'Add an id to table headers',
type: 'boolean'
},
ghCodeBlocks: {
defaultValue: true,
describe: 'Turn on/off GFM fenced code blocks support',
type: 'boolean'
},
tasklists: {
defaultValue: false,
describe: 'Turn on/off GFM tasklist support',
type: 'boolean'
},
smoothLivePreview: {
defaultValue: false,
describe: 'Prevents weird effects in live previews due to incomplete input',
type: 'boolean'
},
smartIndentationFix: {
defaultValue: false,
description: 'Tries to smartly fix indentation in es6 strings',
type: 'boolean'
},
disableForced4SpacesIndentedSublists: {
defaultValue: false,
description: 'Disables the requirement of indenting nested sublists by 4 spaces',
type: 'boolean'
},
simpleLineBreaks: {
defaultValue: false,
description: 'Parses simple line breaks as <br> (GFM Style)',
type: 'boolean'
},
requireSpaceBeforeHeadingText: {
defaultValue: false,
description: 'Makes adding a space between `#` and the header text mandatory (GFM Style)',
type: 'boolean'
},
ghMentions: {
defaultValue: false,
description: 'Enables github @mentions',
type: 'boolean'
},
ghMentionsLink: {
defaultValue: 'https://github.com/{u}',
description: 'Changes the link generated by @mentions. Only applies if ghMentions option is enabled.',
type: 'string'
},
encodeEmails: {
defaultValue: true,
description: 'Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities',
type: 'boolean'
},
openLinksInNewWindow: {
defaultValue: false,
description: 'Open all links in new windows',
type: 'boolean'
},
backslashEscapesHTMLTags: {
defaultValue: false,
description: 'Support for HTML Tag escaping. ex: \<div>foo\</div>',
type: 'boolean'
},
emoji: {
defaultValue: false,
description: 'Enable emoji support. Ex: `this is a :smile: emoji`',
type: 'boolean'
},
underline: {
defaultValue: false,
description: 'Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`',
type: 'boolean'
},
completeHTMLDocument: {
defaultValue: false,
description: 'Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags',
type: 'boolean'
},
metadata: {
defaultValue: false,
description: 'Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).',
type: 'boolean'
},
splitAdjacentBlockquotes: {
defaultValue: false,
description: 'Split adjacent blockquote blocks',
type: 'boolean'
}
};
if (simple === false) {
return JSON.parse(JSON.stringify(defaultOptions));
}
var ret = {};
for (var opt in defaultOptions) {
if (defaultOptions.hasOwnProperty(opt)) {
ret[opt] = defaultOptions[opt].defaultValue;
}
}
return ret;
}
function allOptionsOn () {
'use strict';
var options = getDefaultOpts(true),
ret = {};
for (var opt in options) {
if (options.hasOwnProperty(opt)) {
ret[opt] = true;
}
}
return ret;
}
/**
* Created by Tivie on 06-01-2015.
*/
// Private properties
var showdown = {},
parsers = {},
extensions = {},
globalOptions = getDefaultOpts(true),
setFlavor = 'vanilla',
flavor = {
github: {
omitExtraWLInCodeBlocks: true,
simplifiedAutoLink: true,
excludeTrailingPunctuationFromURLs: true,
literalMidWordUnderscores: true,
strikethrough: true,
tables: true,
tablesHeaderId: true,
ghCodeBlocks: true,
tasklists: true,
disableForced4SpacesIndentedSublists: true,
simpleLineBreaks: true,
requireSpaceBeforeHeadingText: true,
ghCompatibleHeaderId: true,
ghMentions: true,
backslashEscapesHTMLTags: true,
emoji: true,
splitAdjacentBlockquotes: true
},
original: {
noHeaderId: true,
ghCodeBlocks: false
},
ghost: {
omitExtraWLInCodeBlocks: true,
parseImgDimensions: true,
simplifiedAutoLink: true,
excludeTrailingPunctuationFromURLs: true,
literalMidWordUnderscores: true,
strikethrough: true,
tables: true,
tablesHeaderId: true,
ghCodeBlocks: true,
tasklists: true,
smoothLivePreview: true,
simpleLineBreaks: true,
requireSpaceBeforeHeadingText: true,
ghMentions: false,
encodeEmails: true
},
vanilla: getDefaultOpts(true),
allOn: allOptionsOn()
};
/**
* helper namespace
* @type {{}}
*/
showdown.helper = {};
/**
* TODO LEGACY SUPPORT CODE
* @type {{}}
*/
showdown.extensions = {};
/**
* Set a global option
* @static
* @param {string} key
* @param {*} value
* @returns {showdown}
*/
showdown.setOption = function (key, value) {
'use strict';
globalOptions[key] = value;
return this;
};
/**
* Get a global option
* @static
* @param {string} key
* @returns {*}
*/
showdown.getOption = function (key) {
'use strict';
return globalOptions[key];
};
/**
* Get the global options
* @static
* @returns {{}}
*/
showdown.getOptions = function () {
'use strict';
return globalOptions;
};
/**
* Reset global options to the default values
* @static
*/
showdown.resetOptions = function () {
'use strict';
globalOptions = getDefaultOpts(true);
};
/**
* Set the flavor showdown should use as default
* @param {string} name
*/
showdown.setFlavor = function (name) {
'use strict';
if (!flavor.hasOwnProperty(name)) {
throw Error(name + ' flavor was not found');
}
showdown.resetOptions();
var preset = flavor[name];
setFlavor = name;
for (var option in preset) {
if (preset.hasOwnProperty(option)) {
globalOptions[option] = preset[option];
}
}
};
/**
* Get the currently set flavor
* @returns {string}
*/
showdown.getFlavor = function () {
'use strict';
return setFlavor;
};
/**
* Get the options of a specified flavor. Returns undefined if the flavor was not found
* @param {string} name Name of the flavor
* @returns {{}|undefined}
*/
showdown.getFlavorOptions = function (name) {
'use strict';
if (flavor.hasOwnProperty(name)) {
return flavor[name];
}
};
/**
* Get the default options
* @static
* @param {boolean} [simple=true]
* @returns {{}}
*/
showdown.getDefaultOptions = function (simple) {
'use strict';
return getDefaultOpts(simple);
};
/**
* Get or set a subParser
*
* subParser(name) - Get a registered subParser
* subParser(name, func) - Register a subParser
* @static
* @param {string} name
* @param {function} [func]
* @returns {*}
*/
showdown.subParser = function (name, func) {
'use strict';
if (showdown.helper.isString(name)) {
if (typeof func !== 'undefined') {
parsers[name] = func;
} else {
if (parsers.hasOwnProperty(name)) {
return parsers[name];
} else {
throw Error('SubParser named ' + name + ' not registered!');
}
}
}
};
/**
* Gets or registers an extension
* @static
* @param {string} name
* @param {object|function=} ext
* @returns {*}
*/
showdown.extension = function (name, ext) {
'use strict';
if (!showdown.helper.isString(name)) {
throw Error('Extension \'name\' must be a string');
}
name = showdown.helper.stdExtName(name);
// Getter
if (showdown.helper.isUndefined(ext)) {
if (!extensions.hasOwnProperty(name)) {
throw Error('Extension named ' + name + ' is not registered!');
}
return extensions[name];
// Setter
} else {
// Expand extension if it's wrapped in a function
if (typeof ext === 'function') {
ext = ext();
}
// Ensure extension is an array
if (!showdown.helper.isArray(ext)) {
ext = [ext];
}
var validExtension = validate(ext, name);
if (validExtension.valid) {
extensions[name] = ext;
} else {
throw Error(validExtension.error);
}
}
};
/**
* Gets all extensions registered
* @returns {{}}
*/
showdown.getAllExtensions = function () {
'use strict';
return extensions;
};
/**
* Remove an extension
* @param {string} name
*/
showdown.removeExtension = function (name) {
'use strict';
delete extensions[name];
};
/**
* Removes all extensions
*/
showdown.resetExtensions = function () {
'use strict';
extensions = {};
};
/**
* Validate extension
* @param {array} extension
* @param {string} name
* @returns {{valid: boolean, error: string}}
*/
function validate (extension, name) {
'use strict';
var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
ret = {
valid: true,
error: ''
};
if (!showdown.helper.isArray(extension)) {
extension = [extension];
}
for (var i = 0; i < extension.length; ++i) {
var baseMsg = errMsg + ' sub-extension ' + i + ': ',
ext = extension[i];
if (typeof ext !== 'object') {
ret.valid = false;
ret.error = baseMsg + 'must be an object, but ' + typeof ext + ' given';
return ret;
}
if (!showdown.helper.isString(ext.type)) {
ret.valid = false;
ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + ' given';
return ret;
}
var type = ext.type = ext.type.toLowerCase();
// normalize extension type
if (type === 'language') {
type = ext.type = 'lang';
}
if (type === 'html') {
type = ext.type = 'output';
}
if (type !== 'lang' && type !== 'output' && type !== 'listener') {
ret.valid = false;
ret.error = baseMsg + 'type ' + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"';
return ret;
}
if (type === 'listener') {
if (showdown.helper.isUndefined(ext.listeners)) {
ret.valid = false;
ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"';
return ret;
}
} else {
if (showdown.helper.isUndefined(ext.filter) && showdown.helper.isUndefined(ext.regex)) {
ret.valid = false;
ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method';
return ret;
}
}
if (ext.listeners) {
if (typeof ext.listeners !== 'object') {
ret.valid = false;
ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + ' given';
return ret;
}
for (var ln in ext.listeners) {
if (ext.listeners.hasOwnProperty(ln)) {
if (typeof ext.listeners[ln] !== 'function') {
ret.valid = false;
ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln +
' must be a function but ' + typeof ext.listeners[ln] + ' given';
return ret;
}
}
}
}
if (ext.filter) {
if (typeof ext.filter !== 'function') {
ret.valid = false;
ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + ' given';
return ret;
}
} else if (ext.regex) {
if (showdown.helper.isString(ext.regex)) {
ext.regex = new RegExp(ext.regex, 'g');
}
if (!(ext.regex instanceof RegExp)) {
ret.valid = false;
ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
return ret;
}
if (showdown.helper.isUndefined(ext.replace)) {
ret.valid = false;
ret.error = baseMsg + '"regex" extensions must implement a replace string or function';
return ret;
}
}
}
return ret;
}
/**
* Validate extension
* @param {object} ext
* @returns {boolean}
*/
showdown.validateExtension = function (ext) {
'use strict';
var validateExtension = validate(ext, null);
if (!validateExtension.valid) {
console.warn(validateExtension.error);
return false;
}
return true;
};
/**
* showdownjs helper functions
*/
if (!showdown.hasOwnProperty('helper')) {
showdown.helper = {};
}
/**
* Check if var is string
* @static
* @param {string} a
* @returns {boolean}
*/
showdown.helper.isString = function (a) {
'use strict';
return (typeof a === 'string' || a instanceof String);
};
/**
* Check if var is a function
* @static
* @param {*} a
* @returns {boolean}
*/
showdown.helper.isFunction = function (a) {
'use strict';
var getType = {};
return a && getType.toString.call(a) === '[object Function]';
};
/**
* isArray helper function
* @static
* @param {*} a
* @returns {boolean}
*/
showdown.helper.isArray = function (a) {
'use strict';
return Array.isArray(a);
};
/**
* Check if value is undefined
* @static
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
*/
showdown.helper.isUndefined = function (value) {
'use strict';
return typeof value === 'undefined';
};
/**
* ForEach helper function
* Iterates over Arrays and Objects (own properties only)
* @static
* @param {*} obj
* @param {function} callback Accepts 3 params: 1. value, 2. key, 3. the original array/object
*/
showdown.helper.forEach = function (obj, callback) {
'use strict';
// check if obj is defined
if (showdown.helper.isUndefined(obj)) {
throw new Error('obj param is required');
}
if (showdown.helper.isUndefined(callback)) {
throw new Error('callback param is required');
}
if (!showdown.helper.isFunction(callback)) {
throw new Error('callback param must be a function/closure');
}
if (typeof obj.forEach === 'function') {
obj.forEach(callback);
} else if (showdown.helper.isArray(obj)) {
for (var i = 0; i < obj.length; i++) {
callback(obj[i], i, obj);
}
} else if (typeof (obj) === 'object') {
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
callback(obj[prop], prop, obj);
}
}
} else {
throw new Error('obj does not seem to be an array or an iterable object');
}
};
/**
* Standardidize extension name
* @static
* @param {string} s extension name
* @returns {string}
*/
showdown.helper.stdExtName = function (s) {
'use strict';
return s.replace(/[_?*+\/\\.^-]/g, '').replace(/\s/g, '').toLowerCase();
};
function escapeCharactersCallback (wholeMatch, m1) {
'use strict';
var charCodeToEscape = m1.charCodeAt(0);
return '¨E' + charCodeToEscape + 'E';
}
/**
* Callback used to escape characters when passing through String.replace
* @static
* @param {string} wholeMatch
* @param {string} m1
* @returns {string}
*/
showdown.helper.escapeCharactersCallback = escapeCharactersCallback;
/**
* Escape characters in a string
* @static
* @param {string} text
* @param {string} charsToEscape
* @param {boolean} afterBackslash
* @returns {XML|string|void|*}
*/
showdown.helper.escapeCharacters = function (text, charsToEscape, afterBackslash) {
'use strict';
// First we have to escape the escape characters so that
// we can build a character class out of them
var regexString = '([' + charsToEscape.replace(/([\[\]\\])/g, '\\$1') + '])';
if (afterBackslash) {
regexString = '\\\\' + regexString;
}
var regex = new RegExp(regexString, 'g');
text = text.replace(regex, escapeCharactersCallback);
return text;
};
/**
* Unescape HTML entities
* @param txt
* @returns {string}
*/
showdown.helper.unescapeHTMLEntities = function (txt) {
'use strict';
return txt
.replace(/"/g, '"')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/&/g, '&');
};
var rgxFindMatchPos = function (str, left, right, flags) {
'use strict';
var f = flags || '',
g = f.indexOf('g') > -1,
x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')),
l = new RegExp(left, f.replace(/g/g, '')),
pos = [],
t, s, m, start, end;
do {
t = 0;
while ((m = x.exec(str))) {
if (l.test(m[0])) {
if (!(t++)) {
s = x.lastIndex;
start = s - m[0].length;
}
} else if (t) {
if (!--t) {
end = m.index + m[0].length;
var obj = {
left: {start: start, end: s},
match: {start: s, end: m.index},
right: {start: m.index, end: end},
wholeMatch: {start: start, end: end}
};
pos.push(obj);
if (!g) {
return pos;
}
}
}
}
} while (t && (x.lastIndex = s));
return pos;
};
/**
* matchRecursiveRegExp
*
* (c) 2007 Steven Levithan <stevenlevithan.com>
* MIT License
*
* Accepts a string to search, a left and right format delimiter
* as regex patterns, and optional regex flags. Returns an array
* of matches, allowing nested instances of left/right delimiters.
* Use the "g" flag to return all matches, otherwise only the
* first is returned. Be careful to ensure that the left and
* right format delimiters produce mutually exclusive matches.
* Backreferences are not supported within the right delimiter
* due to how it is internally combined with the left delimiter.
* When matching strings whose format delimiters are unbalanced
* to the left or right, the output is intentionally as a
* conventional regex library with recursion support would
* produce, e.g. "<<x>" and "<x>>" both produce ["x"] when using
* "<" and ">" as the delimiters (both strings contain a single,
* balanced instance of "<x>").
*
* examples:
* matchRecursiveRegExp("test", "\\(", "\\)")
* returns: []
* matchRecursiveRegExp("<t<<e>><s>>t<>", "<", ">", "g")
* returns: ["t<<e>><s>", ""]
* matchRecursiveRegExp("<div id=\"x\">test</div>", "<div\\b[^>]*>", "</div>", "gi")
* returns: ["test"]
*/
showdown.helper.matchRecursiveRegExp = function (str, left, right, flags) {
'use strict';
var matchPos = rgxFindMatchPos (str, left, right, flags),
results = [];
for (var i = 0; i < matchPos.length; ++i) {
results.push([
str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
str.slice(matchPos[i].match.start, matchPos[i].match.end),
str.slice(matchPos[i].left.start, matchPos[i].left.end),
str.slice(matchPos[i].right.start, matchPos[i].right.end)
]);
}
return results;
};
/**
*
* @param {string} str
* @param {string|function} replacement
* @param {string} left
* @param {string} right
* @param {string} flags
* @returns {string}
*/
showdown.helper.replaceRecursiveRegExp = function (str, replacement, left, right, flags) {
'use strict';
if (!showdown.helper.isFunction(replacement)) {
var repStr = replacement;
replacement = function () {
return repStr;
};
}
var matchPos = rgxFindMatchPos(str, left, right, flags),
finalStr = str,
lng = matchPos.length;
if (lng > 0) {
var bits = [];
if (matchPos[0].wholeMatch.start !== 0) {
bits.push(str.slice(0, matchPos[0].wholeMatch.start));
}
for (var i = 0; i < lng; ++i) {
bits.push(
replacement(
str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
str.slice(matchPos[i].match.start, matchPos[i].match.end),
str.slice(matchPos[i].left.start, matchPos[i].left.end),
str.slice(matchPos[i].right.start, matchPos[i].right.end)
)
);
if (i < lng - 1) {
bits.push(str.slice(matchPos[i].wholeMatch.end, matchPos[i + 1].wholeMatch.start));
}
}
if (matchPos[lng - 1].wholeMatch.end < str.length) {
bits.push(str.slice(matchPos[lng - 1].wholeMatch.end));
}
finalStr = bits.join('');
}
return finalStr;
};
/**
* Returns the index within the passed String object of the first occurrence of the specified regex,
* starting the search at fromIndex. Returns -1 if the value is not found.
*
* @param {string} str string to search
* @param {RegExp} regex Regular expression to search
* @param {int} [fromIndex = 0] Index to start the search
* @returns {Number}
* @throws InvalidArgumentError
*/
showdown.helper.regexIndexOf = function (str, regex, fromIndex) {
'use strict';
if (!showdown.helper.isString(str)) {
throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
}
if (regex instanceof RegExp === false) {
throw 'InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp';
}
var indexOf = str.substring(fromIndex || 0).search(regex);
return (indexOf >= 0) ? (indexOf + (fromIndex || 0)) : indexOf;
};
/**
* Splits the passed string object at the defined index, and returns an array composed of the two substrings
* @param {string} str string to split
* @param {int} index index to split string at
* @returns {[string,string]}
* @throws InvalidArgumentError
*/
showdown.helper.splitAtIndex = function (str, index) {
'use strict';
if (!showdown.helper.isString(str)) {
throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
}
return [str.substring(0, index), str.substring(index)];
};
/**
* Obfuscate an e-mail address through the use of Character Entities,
* transforming ASCII characters into their equivalent decimal or hex entities.
*
* Since it has a random component, subsequent calls to this function produce different results
*
* @param {string} mail
* @returns {string}
*/
showdown.helper.encodeEmailAddress = function (mail) {
'use strict';
var encode = [
function (ch) {
return '&#' + ch.charCodeAt(0) + ';';
},
function (ch) {
return '&#x' + ch.charCodeAt(0).toString(16) + ';';
},
function (ch) {
return ch;
}
];
mail = mail.replace(/./g, function (ch) {
if (ch === '@') {
// this *must* be encoded. I insist.
ch = encode[Math.floor(Math.random() * 2)](ch);
} else {
var r = Math.random();
// roughly 10% raw, 45% hex, 45% dec
ch = (
r > 0.9 ? encode[2](ch) : r > 0.45 ? encode[1](ch) : encode[0](ch)
);
}
return ch;
});
return mail;
};
/**
*
* @param str
* @param targetLength
* @param padString
* @returns {string}
*/
showdown.helper.padEnd = function padEnd (str, targetLength, padString) {
'use strict';
/*jshint bitwise: false*/
// eslint-disable-next-line space-infix-ops
targetLength = targetLength>>0; //floor if number or convert non-number to 0;
/*jshint bitwise: true*/
padString = String(padString || ' ');
if (str.length > targetLength) {
return String(str);
} else {
targetLength = targetLength - str.length;
if (targetLength > padString.length) {
padString += padString.repeat(targetLength / padString.length); //append to original to ensure we are longer than needed
}
return String(str) + padString.slice(0,targetLength);
}
};
/**
* POLYFILLS
*/
// use this instead of builtin is undefined for IE8 compatibility
if (typeof console === 'undefined') {
console = {
warn: function (msg) {
'use strict';
alert(msg);
},
log: function (msg) {
'use strict';
alert(msg);
},
error: function (msg) {
'use strict';
throw msg;
}
};
}
/**
* Common regexes.
* We declare some common regexes to improve performance
*/
showdown.helper.regexes = {
asteriskDashAndColon: /([*_:~])/g
};
/**
* EMOJIS LIST
*/
showdown.helper.emojis = {
'+1':'\ud83d\udc4d',
'-1':'\ud83d\udc4e',
'100':'\ud83d\udcaf',
'1234':'\ud83d\udd22',
'1st_place_medal':'\ud83e\udd47',
'2nd_place_medal':'\ud83e\udd48',
'3rd_place_medal':'\ud83e\udd49',
'8ball':'\ud83c\udfb1',
'a':'\ud83c\udd70\ufe0f',
'ab':'\ud83c\udd8e',
'abc':'\ud83d\udd24',
'abcd':'\ud83d\udd21',
'accept':'\ud83c\ude51',
'aerial_tramway':'\ud83d\udea1',
'airplane':'\u2708\ufe0f',
'alarm_clock':'\u23f0',
'alembic':'\u2697\ufe0f',
'alien':'\ud83d\udc7d',
'ambulance':'\ud83d\ude91',
'amphora':'\ud83c\udffa',
'anchor':'\u2693\ufe0f',
'angel':'\ud83d\udc7c',
'anger':'\ud83d\udca2',
'angry':'\ud83d\ude20',
'anguished':'\ud83d\ude27',
'ant':'\ud83d\udc1c',
'apple':'\ud83c\udf4e',
'aquarius':'\u2652\ufe0f',
'aries':'\u2648\ufe0f',
'arrow_backward':'\u25c0\ufe0f',
'arrow_double_down':'\u23ec',
'arrow_double_up':'\u23eb',
'arrow_down':'\u2b07\ufe0f',
'arrow_down_small':'\ud83d\udd3d',
'arrow_forward':'\u25b6\ufe0f',
'arrow_heading_down':'\u2935\ufe0f',
'arrow_heading_up':'\u2934\ufe0f',
'arrow_left':'\u2b05\ufe0f',
'arrow_lower_left':'\u2199\ufe0f',
'arrow_lower_right':'\u2198\ufe0f',
'arrow_right':'\u27a1\ufe0f',
'arrow_right_hook':'\u21aa\ufe0f',
'arrow_up':'\u2b06\ufe0f',
'arrow_up_down':'\u2195\ufe0f',
'arrow_up_small':'\ud83d\udd3c',
'arrow_upper_left':'\u2196\ufe0f',
'arrow_upper_right':'\u2197\ufe0f',
'arrows_clockwise':'\ud83d\udd03',
'arrows_counterclockwise':'\ud83d\udd04',
'art':'\ud83c\udfa8',
'articulated_lorry':'\ud83d\ude9b',
'artificial_satellite':'\ud83d\udef0',
'astonished':'\ud83d\ude32',
'athletic_shoe':'\ud83d\udc5f',
'atm':'\ud83c\udfe7',
'atom_symbol':'\u269b\ufe0f',
'avocado':'\ud83e\udd51',
'b':'\ud83c\udd71\ufe0f',
'baby':'\ud83d\udc76',
'baby_bottle':'\ud83c\udf7c',
'baby_chick':'\ud83d\udc24',
'baby_symbol':'\ud83d\udebc',
'back':'\ud83d\udd19',
'bacon':'\ud83e\udd53',
'badminton':'\ud83c\udff8',
'baggage_claim':'\ud83d\udec4',
'baguette_bread':'\ud83e\udd56',
'balance_scale':'\u2696\ufe0f',
'balloon':'\ud83c\udf88',
'ballot_box':'\ud83d\uddf3',
'ballot_box_with_check':'\u2611\ufe0f',
'bamboo':'\ud83c\udf8d',
'banana':'\ud83c\udf4c',
'bangbang':'\u203c\ufe0f',
'bank':'\ud83c\udfe6',
'bar_chart':'\ud83d\udcca',
'barber':'\ud83d\udc88',
'baseball':'\u26be\ufe0f',
'basketball':'\ud83c\udfc0',
'basketball_man':'\u26f9\ufe0f',
'basketball_woman':'\u26f9\ufe0f‍\u2640\ufe0f',
'bat':'\ud83e\udd87',
'bath':'\ud83d\udec0',
'bathtub':'\ud83d\udec1',
'battery':'\ud83d\udd0b',
'beach_umbrella':'\ud83c\udfd6',
'bear':'\ud83d\udc3b',
'bed':'\ud83d\udecf',
'bee':'\ud83d\udc1d',
'beer':'\ud83c\udf7a',
'beers':'\ud83c\udf7b',
'beetle':'\ud83d\udc1e',
'beginner':'\ud83d\udd30',
'bell':'\ud83d\udd14',
'bellhop_bell':'\ud83d\udece',
'bento':'\ud83c\udf71',
'biking_man':'\ud83d\udeb4',
'bike':'\ud83d\udeb2',
'biking_woman':'\ud83d\udeb4‍\u2640\ufe0f',
'bikini':'\ud83d\udc59',
'biohazard':'\u2623\ufe0f',
'bird':'\ud83d\udc26',
'birthday':'\ud83c\udf82',
'black_circle':'\u26ab\ufe0f',
'black_flag':'\ud83c\udff4',
'black_heart':'\ud83d\udda4',
'black_joker':'\ud83c\udccf',
'black_large_square':'\u2b1b\ufe0f',
'black_medium_small_square':'\u25fe\ufe0f',
'black_medium_square':'\u25fc\ufe0f',
'black_nib':'\u2712\ufe0f',
'black_small_square':'\u25aa\ufe0f',
'black_square_button':'\ud83d\udd32',
'blonde_man':'\ud83d\udc71',
'blonde_woman':'\ud83d\udc71‍\u2640\ufe0f',
'blossom':'\ud83c\udf3c',
'blowfish':'\ud83d\udc21',
'blue_book':'\ud83d\udcd8',
'blue_car':'\ud83d\ude99',
'blue_heart':'\ud83d\udc99',
'blush':'\ud83d\ude0a',
'boar':'\ud83d\udc17',
'boat':'\u26f5\ufe0f',
'bomb':'\ud83d\udca3',
'book':'\ud83d\udcd6',
'bookmark':'\ud83d\udd16',
'bookmark_tabs':'\ud83d\udcd1',
'books':'\ud83d\udcda',
'boom':'\ud83d\udca5',
'boot':'\ud83d\udc62',
'bouquet':'\ud83d\udc90',
'bowing_man':'\ud83d\ude47',
'bow_and_arrow':'\ud83c\udff9',
'bowing_woman':'\ud83d\ude47‍\u2640\ufe0f',
'bowling':'\ud83c\udfb3',
'boxing_glove':'\ud83e\udd4a',
'boy':'\ud83d\udc66',
'bread':'\ud83c\udf5e',
'bride_with_veil':'\ud83d\udc70',
'bridge_at_night':'\ud83c\udf09',
'briefcase':'\ud83d\udcbc',
'broken_heart':'\ud83d\udc94',
'bug':'\ud83d\udc1b',
'building_construction':'\ud83c\udfd7',
'bulb':'\ud83d\udca1',
'bullettrain_front':'\ud83d\ude85',
'bullettrain_side':'\ud83d\ude84',
'burrito':'\ud83c\udf2f',
'bus':'\ud83d\ude8c',
'business_suit_levitating':'\ud83d\udd74',
'busstop':'\ud83d\ude8f',
'bust_in_silhouette':'\ud83d\udc64',
'busts_in_silhouette':'\ud83d\udc65',
'butterfly':'\ud83e\udd8b',
'cactus':'\ud83c\udf35',
'cake':'\ud83c\udf70',
'calendar':'\ud83d\udcc6',
'call_me_hand':'\ud83e\udd19',
'calling':'\ud83d\udcf2',
'camel':'\ud83d\udc2b',
'camera':'\ud83d\udcf7',
'camera_flash':'\ud83d\udcf8',
'camping':'\ud83c\udfd5',
'cancer':'\u264b\ufe0f',
'candle':'\ud83d\udd6f',
'candy':'\ud83c\udf6c',
'canoe':'\ud83d\udef6',
'capital_abcd':'\ud83d\udd20',
'capricorn':'\u2651\ufe0f',
'car':'\ud83d\ude97',
'card_file_box':'\ud83d\uddc3',
'card_index':'\ud83d\udcc7',
'card_index_dividers':'\ud83d\uddc2',
'carousel_horse':'\ud83c\udfa0',
'carrot':'\ud83e\udd55',
'cat':'\ud83d\udc31',
'cat2':'\ud83d\udc08',
'cd':'\ud83d\udcbf',
'chains':'\u26d3',
'champagne':'\ud83c\udf7e',
'chart':'\ud83d\udcb9',
'chart_with_downwards_trend':'\ud83d\udcc9',
'chart_with_upwards_trend':'\ud83d\udcc8',
'checkered_flag':'\ud83c\udfc1',
'cheese':'\ud83e\uddc0',
'cherries':'\ud83c\udf52',
'cherry_blossom':'\ud83c\udf38',
'chestnut':'\ud83c\udf30',
'chicken':'\ud83d\udc14',
'children_crossing':'\ud83d\udeb8',
'chipmunk':'\ud83d\udc3f',
'chocolate_bar':'\ud83c\udf6b',
'christmas_tree':'\ud83c\udf84',
'church':'\u26ea\ufe0f',
'cinema':'\ud83c\udfa6',
'circus_tent':'\ud83c\udfaa',
'city_sunrise':'\ud83c\udf07',
'city_sunset':'\ud83c\udf06',
'cityscape':'\ud83c\udfd9',
'cl':'\ud83c\udd91',
'clamp':'\ud83d\udddc',
'clap':'\ud83d\udc4f',
'clapper':'\ud83c\udfac',
'classical_building':'\ud83c\udfdb',
'clinking_glasses':'\ud83e\udd42',
'clipboard':'\ud83d\udccb',
'clock1':'\ud83d\udd50',
'clock10':'\ud83d\udd59',
'clock1030':'\ud83d\udd65',
'clock11':'\ud83d\udd5a',
'clock1130':'\ud83d\udd66',
'clock12':'\ud83d\udd5b',
'clock1230':'\ud83d\udd67',
'clock130':'\ud83d\udd5c',
'clock2':'\ud83d\udd51',
'clock230':'\ud83d\udd5d',
'clock3':'\ud83d\udd52',
'clock330':'\ud83d\udd5e',
'clock4':'\ud83d\udd53',
'clock430':'\ud83d\udd5f',
'clock5':'\ud83d\udd54',
'clock530':'\ud83d\udd60',
'clock6':'\ud83d\udd55',
'clock630':'\ud83d\udd61',
'clock7':'\ud83d\udd56',
'clock730':'\ud83d\udd62',
'clock8':'\ud83d\udd57',
'clock830':'\ud83d\udd63',
'clock9':'\ud83d\udd58',
'clock930':'\ud83d\udd64',
'closed_book':'\ud83d\udcd5',
'closed_lock_with_key':'\ud83d\udd10',
'closed_umbrella':'\ud83c\udf02',
'cloud':'\u2601\ufe0f',
'cloud_with_lightning':'\ud83c\udf29',
'cloud_with_lightning_and_rain':'\u26c8',
'cloud_with_rain':'\ud83c\udf27',
'cloud_with_snow':'\ud83c\udf28',
'clown_face':'\ud83e\udd21',
'clubs':'\u2663\ufe0f',
'cocktail':'\ud83c\udf78',
'coffee':'\u2615\ufe0f',
'coffin':'\u26b0\ufe0f',
'cold_sweat':'\ud83d\ude30',
'comet':'\u2604\ufe0f',
'computer':'\ud83d\udcbb',
'computer_mouse':'\ud83d\uddb1',
'confetti_ball':'\ud83c\udf8a',
'confounded':'\ud83d\ude16',
'confused':'\ud83d\ude15',
'congratulations':'\u3297\ufe0f',
'construction':'\ud83d\udea7',
'construction_worker_man':'\ud83d\udc77',
'construction_worker_woman':'\ud83d\udc77‍\u2640\ufe0f',
'control_knobs':'\ud83c\udf9b',
'convenience_store':'\ud83c\udfea',
'cookie':'\ud83c\udf6a',
'cool':'\ud83c\udd92',
'policeman':'\ud83d\udc6e',
'copyright':'\u00a9\ufe0f',
'corn':'\ud83c\udf3d',
'couch_and_lamp':'\ud83d\udecb',
'couple':'\ud83d\udc6b',
'couple_with_heart_woman_man':'\ud83d\udc91',
'couple_with_heart_man_man':'\ud83d\udc68‍\u2764\ufe0f‍\ud83d\udc68',
'couple_with_heart_woman_woman':'\ud83d\udc69‍\u2764\ufe0f‍\ud83d\udc69',
'couplekiss_man_man':'\ud83d\udc68‍\u2764\ufe0f‍\ud83d\udc8b‍\ud83d\udc68',
'couplekiss_man_woman':'\ud83d\udc8f',
'couplekiss_woman_woman':'\ud83d\udc69‍\u2764\ufe0f‍\ud83d\udc8b‍\ud83d\udc69',
'cow':'\ud83d\udc2e',
'cow2':'\ud83d\udc04',
'cowboy_hat_face':'\ud83e\udd20',
'crab':'\ud83e\udd80',
'crayon':'\ud83d\udd8d',
'credit_card':'\ud83d\udcb3',
'crescent_moon':'\ud83c\udf19',
'cricket':'\ud83c\udfcf',
'crocodile':'\ud83d\udc0a',
'croissant':'\ud83e\udd50',
'crossed_fingers':'\ud83e\udd1e',
'crossed_flags':'\ud83c\udf8c',
'crossed_swords':'\u2694\ufe0f',
'crown':'\ud83d\udc51',
'cry':'\ud83d\ude22',
'crying_cat_face':'\ud83d\ude3f',
'crystal_ball':'\ud83d\udd2e',
'cucumber':'\ud83e\udd52',
'cupid':'\ud83d\udc98',
'curly_loop':'\u27b0',
'currency_exchange':'\ud83d\udcb1',
'curry':'\ud83c\udf5b',
'custard':'\ud83c\udf6e',
'customs':'\ud83d\udec3',
'cyclone':'\ud83c\udf00',
'dagger':'\ud83d\udde1',
'dancer':'\ud83d\udc83',
'dancing_women':'\ud83d\udc6f',
'dancing_men':'\ud83d\udc6f‍\u2642\ufe0f',
'dango':'\ud83c\udf61',
'dark_sunglasses':'\ud83d\udd76',
'dart':'\ud83c\udfaf',
'dash':'\ud83d\udca8',
'date':'\ud83d\udcc5',
'deciduous_tree':'\ud83c\udf33',
'deer':'\ud83e\udd8c',
'department_store':'\ud83c\udfec',
'derelict_house':'\ud83c\udfda',
'desert':'\ud83c\udfdc',
'desert_island':'\ud83c\udfdd',
'desktop_computer':'\ud83d\udda5',
'male_detective':'\ud83d\udd75\ufe0f',
'diamond_shape_with_a_dot_inside':'\ud83d\udca0',
'diamonds':'\u2666\ufe0f',
'disappointed':'\ud83d\ude1e',
'disappointed_relieved':'\ud83d\ude25',
'dizzy':'\ud83d\udcab',
'dizzy_face':'\ud83d\ude35',
'do_not_litter':'\ud83d\udeaf',
'dog':'\ud83d\udc36',
'dog2':'\ud83d\udc15',
'dollar':'\ud83d\udcb5',
'dolls':'\ud83c\udf8e',
'dolphin':'\ud83d\udc2c',
'door':'\ud83d\udeaa',
'doughnut':'\ud83c\udf69',
'dove':'\ud83d\udd4a',
'dragon':'\ud83d\udc09',
'dragon_face':'\ud83d\udc32',
'dress':'\ud83d\udc57',
'dromedary_camel':'\ud83d\udc2a',
'drooling_face':'\ud83e\udd24',
'droplet':'\ud83d\udca7',
'drum':'\ud83e\udd41',
'duck':'\ud83e\udd86',
'dvd':'\ud83d\udcc0',
'e-mail':'\ud83d\udce7',
'eagle':'\ud83e\udd85',
'ear':'\ud83d\udc42',
'ear_of_rice':'\ud83c\udf3e',
'earth_africa':'\ud83c\udf0d',
'earth_americas':'\ud83c\udf0e',
'earth_asia':'\ud83c\udf0f',
'egg':'\ud83e\udd5a',
'eggplant':'\ud83c\udf46',
'eight_pointed_black_star':'\u2734\ufe0f',
'eight_spoked_asterisk':'\u2733\ufe0f',
'electric_plug':'\ud83d\udd0c',
'elephant':'\ud83d\udc18',
'email':'\u2709\ufe0f',
'end':'\ud83d\udd1a',
'envelope_with_arrow':'\ud83d\udce9',
'euro':'\ud83d\udcb6',
'european_castle':'\ud83c\udff0',
'european_post_office':'\ud83c\udfe4',
'evergreen_tree':'\ud83c\udf32',
'exclamation':'\u2757\ufe0f',
'expressionless':'\ud83d\ude11',
'eye':'\ud83d\udc41',
'eye_speech_bubble':'\ud83d\udc41‍\ud83d\udde8',
'eyeglasses':'\ud83d\udc53',
'eyes':'\ud83d\udc40',
'face_with_head_bandage':'\ud83e\udd15',
'face_with_thermometer':'\ud83e\udd12',
'fist_oncoming':'\ud83d\udc4a',
'factory':'\ud83c\udfed',
'fallen_leaf':'\ud83c\udf42',
'family_man_woman_boy':'\ud83d\udc6a',
'family_man_boy':'\ud83d\udc68‍\ud83d\udc66',
'family_man_boy_boy':'\ud83d\udc68‍\ud83d\udc66‍\ud83d\udc66',
'family_man_girl':'\ud83d\udc68‍\ud83d\udc67',
'family_man_girl_boy':'\ud83d\udc68‍\ud83d\udc67‍\ud83d\udc66',
'family_man_girl_girl':'\ud83d\udc68‍\ud83d\udc67‍\ud83d\udc67',
'family_man_man_boy':'\ud83d\udc68‍\ud83d\udc68‍\ud83d\udc66',
'family_man_man_boy_boy':'\ud83d\udc68‍\ud83d\udc68‍\ud83d\udc66‍\ud83d\udc66',
'family_man_man_girl':'\ud83d\udc68‍\ud83d\udc68‍\ud83d\udc67',
'family_man_man_girl_boy':'\ud83d\udc68‍\ud83d\udc68‍\ud83d\udc67‍\ud83d\udc66',
'family_man_man_girl_girl':'\ud83d\udc68‍\ud83d\udc68‍\ud83d\udc67‍\ud83d\udc67',
'family_man_woman_boy_boy':'\ud83d\udc68‍\ud83d\udc69‍\ud83d\udc66‍\ud83d\udc66',
'family_man_woman_girl':'\ud83d\udc68‍\ud83d\udc69‍\ud83d\udc67',
'family_man_woman_girl_boy':'\ud83d\udc68‍\ud83d\udc69‍\ud83d\udc67‍\ud83d\udc66',
'family_man_woman_girl_girl':'\ud83d\udc68‍\ud83d\udc69‍\ud83d\udc67‍\ud83d\udc67',
'family_woman_boy':'\ud83d\udc69‍\ud83d\udc66',
'family_woman_boy_boy':'\ud83d\udc69‍\ud83d\udc66‍\ud83d\udc66',
'family_woman_girl':'\ud83d\udc69‍\ud83d\udc67',
'family_woman_girl_boy':'\ud83d\udc69‍\ud83d\udc67‍\ud83d\udc66',
'family_woman_girl_girl':'\ud83d\udc69‍\ud83d\udc67‍\ud83d\udc67',
'family_woman_woman_boy':'\ud83d\udc69‍\ud83d\udc69‍\ud83d\udc66',
'family_woman_woman_boy_boy':'\ud83d\udc69‍\ud83d\udc69‍\ud83d\udc66‍\ud83d\udc66',
'family_woman_woman_girl':'\ud83d\udc69‍\ud83d\udc69‍\ud83d\udc67',
'family_woman_woman_girl_boy':'\ud83d\udc69‍\ud83d\udc69‍\ud83d\udc67‍\ud83d\udc66',
'family_woman_woman_girl_girl':'\ud83d\udc69‍\ud83d\udc69‍\ud83d\udc67‍\ud83d\udc67',
'fast_forward':'\u23e9',
'fax':'\ud83d\udce0',
'fearful':'\ud83d\ude28',
'feet':'\ud83d\udc3e',
'female_detective':'\ud83d\udd75\ufe0f‍\u2640\ufe0f',
'ferris_wheel':'\ud83c\udfa1',
'ferry':'\u26f4',
'field_hockey':'\ud83c\udfd1',
'file_cabinet':'\ud83d\uddc4',
'file_folder':'\ud83d\udcc1',
'film_projector':'\ud83d\udcfd',
'film_strip':'\ud83c\udf9e',
'fire':'\ud83d\udd25',
'fire_engine':'\ud83d\ude92',
'fireworks':'\ud83c\udf86',
'first_quarter_moon':'\ud83c\udf13',
'first_quarter_moon_with_face':'\ud83c\udf1b',
'fish':'\ud83d\udc1f',
'fish_cake':'\ud83c\udf65',
'fishing_pole_and_fish':'\ud83c\udfa3',
'fist_raised':'\u270a',
'fist_left':'\ud83e\udd1b',
'fist_right':'\ud83e\udd1c',
'flags':'\ud83c\udf8f',
'flashlight':'\ud83d\udd26',
'fleur_de_lis':'\u269c\ufe0f',
'flight_arrival':'\ud83d\udeec',
'flight_departure':'\ud83d\udeeb',
'floppy_disk':'\ud83d\udcbe',
'flower_playing_cards':'\ud83c\udfb4',
'flushed':'\ud83d\ude33',
'fog':'\ud83c\udf2b',
'foggy':'\ud83c\udf01',
'football':'\ud83c\udfc8',
'footprints':'\ud83d\udc63',
'fork_and_knife':'\ud83c\udf74',
'fountain':'\u26f2\ufe0f',
'fountain_pen':'\ud83d\udd8b',
'four_leaf_clover':'\ud83c\udf40',
'fox_face':'\ud83e\udd8a',
'framed_picture':'\ud83d\uddbc',
'free':'\ud83c\udd93',
'fried_egg':'\ud83c\udf73',
'fried_shrimp':'\ud83c\udf64',
'fries':'\ud83c\udf5f',
'frog':'\ud83d\udc38',
'frowning':'\ud83d\ude26',
'frowning_face':'\u2639\ufe0f',
'frowning_man':'\ud83d\ude4d‍\u2642\ufe0f',
'frowning_woman':'\ud83d\ude4d',
'middle_finger':'\ud83d\udd95',
'fuelpump':'\u26fd\ufe0f',
'full_moon':'\ud83c\udf15',
'full_moon_with_face':'\ud83c\udf1d',
'funeral_urn':'\u26b1\ufe0f',
'game_die':'\ud83c\udfb2',
'gear':'\u2699\ufe0f',
'gem':'\ud83d\udc8e',
'gemini':'\u264a\ufe0f',
'ghost':'\ud83d\udc7b',
'gift':'\ud83c\udf81',
'gift_heart':'\ud83d\udc9d',
'girl':'\ud83d\udc67',
'globe_with_meridians':'\ud83c\udf10',
'goal_net':'\ud83e\udd45',
'goat':'\ud83d\udc10',
'golf':'\u26f3\ufe0f',
'golfing_man':'\ud83c\udfcc\ufe0f',
'golfing_woman':'\ud83c\udfcc\ufe0f‍\u2640\ufe0f',
'gorilla':'\ud83e\udd8d',
'grapes':'\ud83c\udf47',
'green_apple':'\ud83c\udf4f',
'green_book':'\ud83d\udcd7',
'green_heart':'\ud83d\udc9a',
'green_salad':'\ud83e\udd57',
'grey_exclamation':'\u2755',
'grey_question':'\u2754',
'grimacing':'\ud83d\ude2c',
'grin':'\ud83d\ude01',
'grinning':'\ud83d\ude00',
'guardsman':'\ud83d\udc82',
'guardswoman':'\ud83d\udc82‍\u2640\ufe0f',
'guitar':'\ud83c\udfb8',
'gun':'\ud83d\udd2b',
'haircut_woman':'\ud83d\udc87',
'haircut_man':'\ud83d\udc87‍\u2642\ufe0f',
'hamburger':'\ud83c\udf54',
'hammer':'\ud83d\udd28',
'hammer_and_pick':'\u2692',
'hammer_and_wrench':'\ud83d\udee0',
'hamster':'\ud83d\udc39',
'hand':'\u270b',
'handbag':'\ud83d\udc5c',
'handshake':'\ud83e\udd1d',
'hankey':'\ud83d\udca9',
'hatched_chick':'\ud83d\udc25',
'hatching_chick':'\ud83d\udc23',
'headphones':'\ud83c\udfa7',
'hear_no_evil':'\ud83d\ude49',
'heart':'\u2764\ufe0f',
'heart_decoration':'\ud83d\udc9f',
'heart_eyes':'\ud83d\ude0d',
'heart_eyes_cat':'\ud83d\ude3b',
'heartbeat':'\ud83d\udc93',
'heartpulse':'\ud83d\udc97',
'hearts':'\u2665\ufe0f',
'heavy_check_mark':'\u2714\ufe0f',
'heavy_division_sign':'\u2797',
'heavy_dollar_sign':'\ud83d\udcb2',
'heavy_heart_exclamation':'\u2763\ufe0f',
'heavy_minus_sign':'\u2796',
'heavy_multiplication_x':'\u2716\ufe0f',
'heavy_plus_sign':'\u2795',
'helicopter':'\ud83d\ude81',
'herb':'\ud83c\udf3f',
'hibiscus':'\ud83c\udf3a',
'high_brightness':'\ud83d\udd06',
'high_heel':'\ud83d\udc60',
'hocho':'\ud83d\udd2a',
'hole':'\ud83d\udd73',
'honey_pot':'\ud83c\udf6f',
'horse':'\ud83d\udc34',
'horse_racing':'\ud83c\udfc7',
'hospital':'\ud83c\udfe5',
'hot_pepper':'\ud83c\udf36',
'hotdog':'\ud83c\udf2d',
'hotel':'\ud83c\udfe8',
'hotsprings':'\u2668\ufe0f',
'hourglass':'\u231b\ufe0f',
'hourglass_flowing_sand':'\u23f3',
'house':'\ud83c\udfe0',
'house_with_garden':'\ud83c\udfe1',
'houses':'\ud83c\udfd8',
'hugs':'\ud83e\udd17',
'hushed':'\ud83d\ude2f',
'ice_cream':'\ud83c\udf68',
'ice_hockey':'\ud83c\udfd2',
'ice_skate':'\u26f8',
'icecream':'\ud83c\udf66',
'id':'\ud83c\udd94',
'ideograph_advantage':'\ud83c\ude50',
'imp':'\ud83d\udc7f',
'inbox_tray':'\ud83d\udce5',
'incoming_envelope':'\ud83d\udce8',
'tipping_hand_woman':'\ud83d\udc81',
'information_source':'\u2139\ufe0f',
'innocent':'\ud83d\ude07',
'interrobang':'\u2049\ufe0f',
'iphone':'\ud83d\udcf1',
'izakaya_lantern':'\ud83c\udfee',
'jack_o_lantern':'\ud83c\udf83',
'japan':'\ud83d\uddfe',
'japanese_castle':'\ud83c\udfef',
'japanese_goblin':'\ud83d\udc7a',
'japanese_ogre':'\ud83d\udc79',
'jeans':'\ud83d\udc56',
'joy':'\ud83d\ude02',
'joy_cat':'\ud83d\ude39',
'joystick':'\ud83d\udd79',
'kaaba':'\ud83d\udd4b',
'key':'\ud83d\udd11',
'keyboard':'\u2328\ufe0f',
'keycap_ten':'\ud83d\udd1f',
'kick_scooter':'\ud83d\udef4',
'kimono':'\ud83d\udc58',
'kiss':'\ud83d\udc8b',
'kissing':'\ud83d\ude17',
'kissing_cat':'\ud83d\ude3d',
'kissing_closed_eyes':'\ud83d\ude1a',
'kissing_heart':'\ud83d\ude18',
'kissing_smiling_eyes':'\ud83d\ude19',
'kiwi_fruit':'\ud83e\udd5d',
'koala':'\ud83d\udc28',
'koko':'\ud83c\ude01',
'label':'\ud83c\udff7',
'large_blue_circle':'\ud83d\udd35',
'large_blue_diamond':'\ud83d\udd37',
'large_orange_diamond':'\ud83d\udd36',
'last_quarter_moon':'\ud83c\udf17',
'last_quarter_moon_with_face':'\ud83c\udf1c',
'latin_cross':'\u271d\ufe0f',
'laughing':'\ud83d\ude06',
'leaves':'\ud83c\udf43',
'ledger':'\ud83d\udcd2',
'left_luggage':'\ud83d\udec5',
'left_right_arrow':'\u2194\ufe0f',
'leftwards_arrow_with_hook':'\u21a9\ufe0f',
'lemon':'\ud83c\udf4b',
'leo':'\u264c\ufe0f',
'leopard':'\ud83d\udc06',
'level_slider':'\ud83c\udf9a',
'libra':'\u264e\ufe0f',
'light_rail':'\ud83d\ude88',
'link':'\ud83d\udd17',
'lion':'\ud83e\udd81',
'lips':'\ud83d\udc44',
'lipstick':'\ud83d\udc84',
'lizard':'\ud83e\udd8e',
'lock':'\ud83d\udd12',
'lock_with_ink_pen':'\ud83d\udd0f',
'lollipop':'\ud83c\udf6d',
'loop':'\u27bf',
'loud_sound':'\ud83d\udd0a',
'loudspeaker':'\ud83d\udce2',
'love_hotel':'\ud83c\udfe9',
'love_letter':'\ud83d\udc8c',
'low_brightness':'\ud83d\udd05',
'lying_face':'\ud83e\udd25',
'm':'\u24c2\ufe0f',
'mag':'\ud83d\udd0d',
'mag_right':'\ud83d\udd0e',
'mahjong':'\ud83c\udc04\ufe0f',
'mailbox':'\ud83d\udceb',
'mailbox_closed':'\ud83d\udcea',
'mailbox_with_mail':'\ud83d\udcec',
'mailbox_with_no_mail':'\ud83d\udced',
'man':'\ud83d\udc68',
'man_artist':'\ud83d\udc68‍\ud83c\udfa8',
'man_astronaut':'\ud83d\udc68‍\ud83d\ude80',
'man_cartwheeling':'\ud83e\udd38‍\u2642\ufe0f',
'man_cook':'\ud83d\udc68‍\ud83c\udf73',
'man_dancing':'\ud83d\udd7a',
'man_facepalming':'\ud83e\udd26‍\u2642\ufe0f',
'man_factory_worker':'\ud83d\udc68‍\ud83c\udfed',
'man_farmer':'\ud83d\udc68‍\ud83c\udf3e',
'man_firefighter':'\ud83d\udc68‍\ud83d\ude92',
'man_health_worker':'\ud83d\udc68‍\u2695\ufe0f',
'man_in_tuxedo':'\ud83e\udd35',
'man_judge':'\ud83d\udc68‍\u2696\ufe0f',
'man_juggling':'\ud83e\udd39‍\u2642\ufe0f',
'man_mechanic':'\ud83d\udc68‍\ud83d\udd27',
'man_office_worker':'\ud83d\udc68‍\ud83d\udcbc',
'man_pilot':'\ud83d\udc68‍\u2708\ufe0f',
'man_playing_handball':'\ud83e\udd3e‍\u2642\ufe0f',
'man_playing_water_polo':'\ud83e\udd3d‍\u2642\ufe0f',
'man_scientist':'\ud83d\udc68‍\ud83d\udd2c',
'man_shrugging':'\ud83e\udd37‍\u2642\ufe0f',
'man_singer':'\ud83d\udc68‍\ud83c\udfa4',
'man_student':'\ud83d\udc68‍\ud83c\udf93',
'man_teacher':'\ud83d\udc68‍\ud83c\udfeb',
'man_technologist':'\ud83d\udc68‍\ud83d\udcbb',
'man_with_gua_pi_mao':'\ud83d\udc72',
'man_with_turban':'\ud83d\udc73',
'tangerine':'\ud83c\udf4a',
'mans_shoe':'\ud83d\udc5e',
'mantelpiece_clock':'\ud83d\udd70',
'maple_leaf':'\ud83c\udf41',
'martial_arts_uniform':'\ud83e\udd4b',
'mask':'\ud83d\ude37',
'massage_woman':'\ud83d\udc86',
'massage_man':'\ud83d\udc86‍\u2642\ufe0f',
'meat_on_bone':'\ud83c\udf56',
'medal_military':'\ud83c\udf96',
'medal_sports':'\ud83c\udfc5',
'mega':'\ud83d\udce3',
'melon':'\ud83c\udf48',
'memo':'\ud83d\udcdd',
'men_wrestling':'\ud83e\udd3c‍\u2642\ufe0f',
'menorah':'\ud83d\udd4e',
'mens':'\ud83d\udeb9',
'metal':'\ud83e\udd18',
'metro':'\ud83d\ude87',
'microphone':'\ud83c\udfa4',
'microscope':'\ud83d\udd2c',
'milk_glass':'\ud83e\udd5b',
'milky_way':'\ud83c\udf0c',
'minibus':'\ud83d\ude90',
'minidisc':'\ud83d\udcbd',
'mobile_phone_off':'\ud83d\udcf4',
'money_mouth_face':'\ud83e\udd11',
'money_with_wings':'\ud83d\udcb8',
'moneybag':'\ud83d\udcb0',
'monkey':'\ud83d\udc12',
'monkey_face':'\ud83d\udc35',
'monorail':'\ud83d\ude9d',
'moon':'\ud83c\udf14',
'mortar_board':'\ud83c\udf93',
'mosque':'\ud83d\udd4c',
'motor_boat':'\ud83d\udee5',
'motor_scooter':'\ud83d\udef5',
'motorcycle':'\ud83c\udfcd',
'motorway':'\ud83d\udee3',
'mount_fuji':'\ud83d\uddfb',
'mountain':'\u26f0',
'mountain_biking_man':'\ud83d\udeb5',
'mountain_biking_woman':'\ud83d\udeb5‍\u2640\ufe0f',
'mountain_cableway':'\ud83d\udea0',
'mountain_railway':'\ud83d\ude9e',
'mountain_snow':'\ud83c\udfd4',
'mouse':'\ud83d\udc2d',
'mouse2':'\ud83d\udc01',
'movie_camera':'\ud83c\udfa5',
'moyai':'\ud83d\uddff',
'mrs_claus':'\ud83e\udd36',
'muscle':'\ud83d\udcaa',
'mushroom':'\ud83c\udf44',
'musical_keyboard':'\ud83c\udfb9',
'musical_note':'\ud83c\udfb5',
'musical_score':'\ud83c\udfbc',
'mute':'\ud83d\udd07',
'nail_care':'\ud83d\udc85',
'name_badge':'\ud83d\udcdb',
'national_park':'\ud83c\udfde',
'nauseated_face':'\ud83e\udd22',
'necktie':'\ud83d\udc54',
'negative_squared_cross_mark':'\u274e',
'nerd_face':'\ud83e\udd13',
'neutral_face':'\ud83d\ude10',
'new':'\ud83c\udd95',
'new_moon':'\ud83c\udf11',
'new_moon_with_face':'\ud83c\udf1a',
'newspaper':'\ud83d\udcf0',
'newspaper_roll':'\ud83d\uddde',
'next_track_button':'\u23ed',
'ng':'\ud83c\udd96',
'no_good_man':'\ud83d\ude45‍\u2642\ufe0f',
'no_good_woman':'\ud83d\ude45',
'night_with_stars':'\ud83c\udf03',
'no_bell':'\ud83d\udd15',
'no_bicycles':'\ud83d\udeb3',
'no_entry':'\u26d4\ufe0f',
'no_entry_sign':'\ud83d\udeab',
'no_mobile_phones':'\ud83d\udcf5',
'no_mouth':'\ud83d\ude36',
'no_pedestrians':'\ud83d\udeb7',
'no_smoking':'\ud83d\udead',
'non-potable_water':'\ud83d\udeb1',
'nose':'\ud83d\udc43',
'notebook':'\ud83d\udcd3',
'notebook_with_decorative_cover':'\ud83d\udcd4',
'notes':'\ud83c\udfb6',
'nut_and_bolt':'\ud83d\udd29',
'o':'\u2b55\ufe0f',
'o2':'\ud83c\udd7e\ufe0f',
'ocean':'\ud83c\udf0a',
'octopus':'\ud83d\udc19',
'oden':'\ud83c\udf62',
'office':'\ud83c\udfe2',
'oil_drum':'\ud83d\udee2',
'ok':'\ud83c\udd97',
'ok_hand':'\ud83d\udc4c',
'ok_man':'\ud83d\ude46‍\u2642\ufe0f',
'ok_woman':'\ud83d\ude46',
'old_key':'\ud83d\udddd',
'older_man':'\ud83d\udc74',
'older_woman':'\ud83d\udc75',
'om':'\ud83d\udd49',
'on':'\ud83d\udd1b',
'oncoming_automobile':'\ud83d\ude98',
'oncoming_bus':'\ud83d\ude8d',
'oncoming_police_car':'\ud83d\ude94',
'oncoming_taxi':'\ud83d\ude96',
'open_file_folder':'\ud83d\udcc2',
'open_hands':'\ud83d\udc50',
'open_mouth':'\ud83d\ude2e',
'open_umbrella':'\u2602\ufe0f',
'ophiuchus':'\u26ce',
'orange_book':'\ud83d\udcd9',
'orthodox_cross':'\u2626\ufe0f',
'outbox_tray':'\ud83d\udce4',
'owl':'\ud83e\udd89',
'ox':'\ud83d\udc02',
'package':'\ud83d\udce6',
'page_facing_up':'\ud83d\udcc4',
'page_with_curl':'\ud83d\udcc3',
'pager':'\ud83d\udcdf',
'paintbrush':'\ud83d\udd8c',
'palm_tree':'\ud83c\udf34',
'pancakes':'\ud83e\udd5e',
'panda_face':'\ud83d\udc3c',
'paperclip':'\ud83d\udcce',
'paperclips':'\ud83d\udd87',
'parasol_on_ground':'\u26f1',
'parking':'\ud83c\udd7f\ufe0f',
'part_alternation_mark':'\u303d\ufe0f',
'partly_sunny':'\u26c5\ufe0f',
'passenger_ship':'\ud83d\udef3',
'passport_control':'\ud83d\udec2',
'pause_button':'\u23f8',
'peace_symbol':'\u262e\ufe0f',
'peach':'\ud83c\udf51',
'peanuts':'\ud83e\udd5c',
'pear':'\ud83c\udf50',
'pen':'\ud83d\udd8a',
'pencil2':'\u270f\ufe0f',
'penguin':'\ud83d\udc27',
'pensive':'\ud83d\ude14',
'performing_arts':'\ud83c\udfad',
'persevere':'\ud83d\ude23',
'person_fencing':'\ud83e\udd3a',
'pouting_woman':'\ud83d\ude4e',
'phone':'\u260e\ufe0f',
'pick':'\u26cf',
'pig':'\ud83d\udc37',
'pig2':'\ud83d\udc16',
'pig_nose':'\ud83d\udc3d',
'pill':'\ud83d\udc8a',
'pineapple':'\ud83c\udf4d',
'ping_pong':'\ud83c\udfd3',
'pisces':'\u2653\ufe0f',
'pizza':'\ud83c\udf55',
'place_of_worship':'\ud83d\uded0',
'plate_with_cutlery':'\ud83c\udf7d',
'play_or_pause_button':'\u23ef',
'point_down':'\ud83d\udc47',
'point_left':'\ud83d\udc48',
'point_right':'\ud83d\udc49',
'point_up':'\u261d\ufe0f',
'point_up_2':'\ud83d\udc46',
'police_car':'\ud83d\ude93',
'policewoman':'\ud83d\udc6e‍\u2640\ufe0f',
'poodle':'\ud83d\udc29',
'popcorn':'\ud83c\udf7f',
'post_office':'\ud83c\udfe3',
'postal_horn':'\ud83d\udcef',
'postbox':'\ud83d\udcee',
'potable_water':'\ud83d\udeb0',
'potato':'\ud83e\udd54',
'pouch':'\ud83d\udc5d',
'poultry_leg':'\ud83c\udf57',
'pound':'\ud83d\udcb7',
'rage':'\ud83d\ude21',
'pouting_cat':'\ud83d\ude3e',
'pouting_man':'\ud83d\ude4e‍\u2642\ufe0f',
'pray':'\ud83d\ude4f',
'prayer_beads':'\ud83d\udcff',
'pregnant_woman':'\ud83e\udd30',
'previous_track_button':'\u23ee',
'prince':'\ud83e\udd34',
'princess':'\ud83d\udc78',
'printer':'\ud83d\udda8',
'purple_heart':'\ud83d\udc9c',
'purse':'\ud83d\udc5b',
'pushpin':'\ud83d\udccc',
'put_litter_in_its_place':'\ud83d\udeae',
'question':'\u2753',
'rabbit':'\ud83d\udc30',
'rabbit2':'\ud83d\udc07',
'racehorse':'\ud83d\udc0e',
'racing_car':'\ud83c\udfce',
'radio':'\ud83d\udcfb',
'radio_button':'\ud83d\udd18',
'radioactive':'\u2622\ufe0f',
'railway_car':'\ud83d\ude83',
'railway_track':'\ud83d\udee4',
'rainbow':'\ud83c\udf08',
'rainbow_flag':'\ud83c\udff3\ufe0f‍\ud83c\udf08',
'raised_back_of_hand':'\ud83e\udd1a',
'raised_hand_with_fingers_splayed':'\ud83d\udd90',
'raised_hands':'\ud83d\ude4c',
'raising_hand_woman':'\ud83d\ude4b',
'raising_hand_man':'\ud83d\ude4b‍\u2642\ufe0f',
'ram':'\ud83d\udc0f',
'ramen':'\ud83c\udf5c',
'rat':'\ud83d\udc00',
'record_button':'\u23fa',
'recycle':'\u267b\ufe0f',
'red_circle':'\ud83d\udd34',
'registered':'\u00ae\ufe0f',
'relaxed':'\u263a\ufe0f',
'relieved':'\ud83d\ude0c',
'reminder_ribbon':'\ud83c\udf97',
'repeat':'\ud83d\udd01',
'repeat_one':'\ud83d\udd02',
'rescue_worker_helmet':'\u26d1',
'restroom':'\ud83d\udebb',
'revolving_hearts':'\ud83d\udc9e',
'rewind':'\u23ea',
'rhinoceros':'\ud83e\udd8f',
'ribbon':'\ud83c\udf80',
'rice':'\ud83c\udf5a',
'rice_ball':'\ud83c\udf59',
'rice_cracker':'\ud83c\udf58',
'rice_scene':'\ud83c\udf91',
'right_anger_bubble':'\ud83d\uddef',
'ring':'\ud83d\udc8d',
'robot':'\ud83e\udd16',
'rocket':'\ud83d\ude80',
'rofl':'\ud83e\udd23',
'roll_eyes':'\ud83d\ude44',
'roller_coaster':'\ud83c\udfa2',
'rooster':'\ud83d\udc13',
'rose':'\ud83c\udf39',
'rosette':'\ud83c\udff5',
'rotating_light':'\ud83d\udea8',
'round_pushpin':'\ud83d\udccd',
'rowing_man':'\ud83d\udea3',
'rowing_woman':'\ud83d\udea3‍\u2640\ufe0f',
'rugby_football':'\ud83c\udfc9',
'running_man':'\ud83c\udfc3',
'running_shirt_with_sash':'\ud83c\udfbd',
'running_woman':'\ud83c\udfc3‍\u2640\ufe0f',
'sa':'\ud83c\ude02\ufe0f',
'sagittarius':'\u2650\ufe0f',
'sake':'\ud83c\udf76',
'sandal':'\ud83d\udc61',
'santa':'\ud83c\udf85',
'satellite':'\ud83d\udce1',
'saxophone':'\ud83c\udfb7',
'school':'\ud83c\udfeb',
'school_satchel':'\ud83c\udf92',
'scissors':'\u2702\ufe0f',
'scorpion':'\ud83e\udd82',
'scorpius':'\u264f\ufe0f',
'scream':'\ud83d\ude31',
'scream_cat':'\ud83d\ude40',
'scroll':'\ud83d\udcdc',
'seat':'\ud83d\udcba',
'secret':'\u3299\ufe0f',
'see_no_evil':'\ud83d\ude48',
'seedling':'\ud83c\udf31',
'selfie':'\ud83e\udd33',
'shallow_pan_of_food':'\ud83e\udd58',
'shamrock':'\u2618\ufe0f',
'shark':'\ud83e\udd88',
'shaved_ice':'\ud83c\udf67',
'sheep':'\ud83d\udc11',
'shell':'\ud83d\udc1a',
'shield':'\ud83d\udee1',
'shinto_shrine':'\u26e9',
'ship':'\ud83d\udea2',
'shirt':'\ud83d\udc55',
'shopping':'\ud83d\udecd',
'shopping_cart':'\ud83d\uded2',
'shower':'\ud83d\udebf',
'shrimp':'\ud83e\udd90',
'signal_strength':'\ud83d\udcf6',
'six_pointed_star':'\ud83d\udd2f',
'ski':'\ud83c\udfbf',
'skier':'\u26f7',
'skull':'\ud83d\udc80',
'skull_and_crossbones':'\u2620\ufe0f',
'sleeping':'\ud83d\ude34',
'sleeping_bed':'\ud83d\udecc',
'sleepy':'\ud83d\ude2a',
'slightly_frowning_face':'\ud83d\ude41',
'slightly_smiling_face':'\ud83d\ude42',
'slot_machine':'\ud83c\udfb0',
'small_airplane':'\ud83d\udee9',
'small_blue_diamond':'\ud83d\udd39',
'small_orange_diamond':'\ud83d\udd38',
'small_red_triangle':'\ud83d\udd3a',
'small_red_triangle_down':'\ud83d\udd3b',
'smile':'\ud83d\ude04',
'smile_cat':'\ud83d\ude38',
'smiley':'\ud83d\ude03',
'smiley_cat':'\ud83d\ude3a',
'smiling_imp':'\ud83d\ude08',
'smirk':'\ud83d\ude0f',
'smirk_cat':'\ud83d\ude3c',
'smoking':'\ud83d\udeac',
'snail':'\ud83d\udc0c',
'snake':'\ud83d\udc0d',
'sneezing_face':'\ud83e\udd27',
'snowboarder':'\ud83c\udfc2',
'snowflake':'\u2744\ufe0f',
'snowman':'\u26c4\ufe0f',
'snowman_with_snow':'\u2603\ufe0f',
'sob':'\ud83d\ude2d',
'soccer':'\u26bd\ufe0f',
'soon':'\ud83d\udd1c',
'sos':'\ud83c\udd98',
'sound':'\ud83d\udd09',
'space_invader':'\ud83d\udc7e',
'spades':'\u2660\ufe0f',
'spaghetti':'\ud83c\udf5d',
'sparkle':'\u2747\ufe0f',
'sparkler':'\ud83c\udf87',
'sparkles':'\u2728',
'sparkling_heart':'\ud83d\udc96',
'speak_no_evil':'\ud83d\ude4a',
'speaker':'\ud83d\udd08',
'speaking_head':'\ud83d\udde3',
'speech_balloon':'\ud83d\udcac',
'speedboat':'\ud83d\udea4',
'spider':'\ud83d\udd77',
'spider_web':'\ud83d\udd78',
'spiral_calendar':'\ud83d\uddd3',
'spiral_notepad':'\ud83d\uddd2',
'spoon':'\ud83e\udd44',
'squid':'\ud83e\udd91',
'stadium':'\ud83c\udfdf',
'star':'\u2b50\ufe0f',
'star2':'\ud83c\udf1f',
'star_and_crescent':'\u262a\ufe0f',
'star_of_david':'\u2721\ufe0f',
'stars':'\ud83c\udf20',
'station':'\ud83d\ude89',
'statue_of_liberty':'\ud83d\uddfd',
'steam_locomotive':'\ud83d\ude82',
'stew':'\ud83c\udf72',
'stop_button':'\u23f9',
'stop_sign':'\ud83d\uded1',
'stopwatch':'\u23f1',
'straight_ruler':'\ud83d\udccf',
'strawberry':'\ud83c\udf53',
'stuck_out_tongue':'\ud83d\ude1b',
'stuck_out_tongue_closed_eyes':'\ud83d\ude1d',
'stuck_out_tongue_winking_eye':'\ud83d\ude1c',
'studio_microphone':'\ud83c\udf99',
'stuffed_flatbread':'\ud83e\udd59',
'sun_behind_large_cloud':'\ud83c\udf25',
'sun_behind_rain_cloud':'\ud83c\udf26',
'sun_behind_small_cloud':'\ud83c\udf24',
'sun_with_face':'\ud83c\udf1e',
'sunflower':'\ud83c\udf3b',
'sunglasses':'\ud83d\ude0e',
'sunny':'\u2600\ufe0f',
'sunrise':'\ud83c\udf05',
'sunrise_over_mountains':'\ud83c\udf04',
'surfing_man':'\ud83c\udfc4',
'surfing_woman':'\ud83c\udfc4‍\u2640\ufe0f',
'sushi':'\ud83c\udf63',
'suspension_railway':'\ud83d\ude9f',
'sweat':'\ud83d\ude13',
'sweat_drops':'\ud83d\udca6',
'sweat_smile':'\ud83d\ude05',
'sweet_potato':'\ud83c\udf60',
'swimming_man':'\ud83c\udfca',
'swimming_woman':'\ud83c\udfca‍\u2640\ufe0f',
'symbols':'\ud83d\udd23',
'synagogue':'\ud83d\udd4d',
'syringe':'\ud83d\udc89',
'taco':'\ud83c\udf2e',
'tada':'\ud83c\udf89',
'tanabata_tree':'\ud83c\udf8b',
'taurus':'\u2649\ufe0f',
'taxi':'\ud83d\ude95',
'tea':'\ud83c\udf75',
'telephone_receiver':'\ud83d\udcde',
'telescope':'\ud83d\udd2d',
'tennis':'\ud83c\udfbe',
'tent':'\u26fa\ufe0f',
'thermometer':'\ud83c\udf21',
'thinking':'\ud83e\udd14',
'thought_balloon':'\ud83d\udcad',
'ticket':'\ud83c\udfab',
'tickets':'\ud83c\udf9f',
'tiger':'\ud83d\udc2f',
'tiger2':'\ud83d\udc05',
'timer_clock':'\u23f2',
'tipping_hand_man':'\ud83d\udc81‍\u2642\ufe0f',
'tired_face':'\ud83d\ude2b',
'tm':'\u2122\ufe0f',
'toilet':'\ud83d\udebd',
'tokyo_tower':'\ud83d\uddfc',
'tomato':'\ud83c\udf45',
'tongue':'\ud83d\udc45',
'top':'\ud83d\udd1d',
'tophat':'\ud83c\udfa9',
'tornado':'\ud83c\udf2a',
'trackball':'\ud83d\uddb2',
'tractor':'\ud83d\ude9c',
'traffic_light':'\ud83d\udea5',
'train':'\ud83d\ude8b',
'train2':'\ud83d\ude86',
'tram':'\ud83d\ude8a',
'triangular_flag_on_post':'\ud83d\udea9',
'triangular_ruler':'\ud83d\udcd0',
'trident':'\ud83d\udd31',
'triumph':'\ud83d\ude24',
'trolleybus':'\ud83d\ude8e',
'trophy':'\ud83c\udfc6',
'tropical_drink':'\ud83c\udf79',
'tropical_fish':'\ud83d\udc20',
'truck':'\ud83d\ude9a',
'trumpet':'\ud83c\udfba',
'tulip':'\ud83c\udf37',
'tumbler_glass':'\ud83e\udd43',
'turkey':'\ud83e\udd83',
'turtle':'\ud83d\udc22',
'tv':'\ud83d\udcfa',
'twisted_rightwards_arrows':'\ud83d\udd00',
'two_hearts':'\ud83d\udc95',
'two_men_holding_hands':'\ud83d\udc6c',
'two_women_holding_hands':'\ud83d\udc6d',
'u5272':'\ud83c\ude39',
'u5408':'\ud83c\ude34',
'u55b6':'\ud83c\ude3a',
'u6307':'\ud83c\ude2f\ufe0f',
'u6708':'\ud83c\ude37\ufe0f',
'u6709':'\ud83c\ude36',
'u6e80':'\ud83c\ude35',
'u7121':'\ud83c\ude1a\ufe0f',
'u7533':'\ud83c\ude38',
'u7981':'\ud83c\ude32',
'u7a7a':'\ud83c\ude33',
'umbrella':'\u2614\ufe0f',
'unamused':'\ud83d\ude12',
'underage':'\ud83d\udd1e',
'unicorn':'\ud83e\udd84',
'unlock':'\ud83d\udd13',
'up':'\ud83c\udd99',
'upside_down_face':'\ud83d\ude43',
'v':'\u270c\ufe0f',
'vertical_traffic_light':'\ud83d\udea6',
'vhs':'\ud83d\udcfc',
'vibration_mode':'\ud83d\udcf3',
'video_camera':'\ud83d\udcf9',
'video_game':'\ud83c\udfae',
'violin':'\ud83c\udfbb',
'virgo':'\u264d\ufe0f',
'volcano':'\ud83c\udf0b',
'volleyball':'\ud83c\udfd0',
'vs':'\ud83c\udd9a',
'vulcan_salute':'\ud83d\udd96',
'walking_man':'\ud83d\udeb6',
'walking_woman':'\ud83d\udeb6‍\u2640\ufe0f',
'waning_crescent_moon':'\ud83c\udf18',
'waning_gibbous_moon':'\ud83c\udf16',
'warning':'\u26a0\ufe0f',
'wastebasket':'\ud83d\uddd1',
'watch':'\u231a\ufe0f',
'water_buffalo':'\ud83d\udc03',
'watermelon':'\ud83c\udf49',
'wave':'\ud83d\udc4b',
'wavy_dash':'\u3030\ufe0f',
'waxing_crescent_moon':'\ud83c\udf12',
'wc':'\ud83d\udebe',
'weary':'\ud83d\ude29',
'wedding':'\ud83d\udc92',
'weight_lifting_man':'\ud83c\udfcb\ufe0f',
'weight_lifting_woman':'\ud83c\udfcb\ufe0f‍\u2640\ufe0f',
'whale':'\ud83d\udc33',
'whale2':'\ud83d\udc0b',
'wheel_of_dharma':'\u2638\ufe0f',
'wheelchair':'\u267f\ufe0f',
'white_check_mark':'\u2705',
'white_circle':'\u26aa\ufe0f',
'white_flag':'\ud83c\udff3\ufe0f',
'white_flower':'\ud83d\udcae',
'white_large_square':'\u2b1c\ufe0f',
'white_medium_small_square':'\u25fd\ufe0f',
'white_medium_square':'\u25fb\ufe0f',
'white_small_square':'\u25ab\ufe0f',
'white_square_button':'\ud83d\udd33',
'wilted_flower':'\ud83e\udd40',
'wind_chime':'\ud83c\udf90',
'wind_face':'\ud83c\udf2c',
'wine_glass':'\ud83c\udf77',
'wink':'\ud83d\ude09',
'wolf':'\ud83d\udc3a',
'woman':'\ud83d\udc69',
'woman_artist':'\ud83d\udc69‍\ud83c\udfa8',
'woman_astronaut':'\ud83d\udc69‍\ud83d\ude80',
'woman_cartwheeling':'\ud83e\udd38‍\u2640\ufe0f',
'woman_cook':'\ud83d\udc69‍\ud83c\udf73',
'woman_facepalming':'\ud83e\udd26‍\u2640\ufe0f',
'woman_factory_worker':'\ud83d\udc69‍\ud83c\udfed',
'woman_farmer':'\ud83d\udc69‍\ud83c\udf3e',
'woman_firefighter':'\ud83d\udc69‍\ud83d\ude92',
'woman_health_worker':'\ud83d\udc69‍\u2695\ufe0f',
'woman_judge':'\ud83d\udc69‍\u2696\ufe0f',
'woman_juggling':'\ud83e\udd39‍\u2640\ufe0f',
'woman_mechanic':'\ud83d\udc69‍\ud83d\udd27',
'woman_office_worker':'\ud83d\udc69‍\ud83d\udcbc',
'woman_pilot':'\ud83d\udc69‍\u2708\ufe0f',
'woman_playing_handball':'\ud83e\udd3e‍\u2640\ufe0f',
'woman_playing_water_polo':'\ud83e\udd3d‍\u2640\ufe0f',
'woman_scientist':'\ud83d\udc69‍\ud83d\udd2c',
'woman_shrugging':'\ud83e\udd37‍\u2640\ufe0f',
'woman_singer':'\ud83d\udc69‍\ud83c\udfa4',
'woman_student':'\ud83d\udc69‍\ud83c\udf93',
'woman_teacher':'\ud83d\udc69‍\ud83c\udfeb',
'woman_technologist':'\ud83d\udc69‍\ud83d\udcbb',
'woman_with_turban':'\ud83d\udc73‍\u2640\ufe0f',
'womans_clothes':'\ud83d\udc5a',
'womans_hat':'\ud83d\udc52',
'women_wrestling':'\ud83e\udd3c‍\u2640\ufe0f',
'womens':'\ud83d\udeba',
'world_map':'\ud83d\uddfa',
'worried':'\ud83d\ude1f',
'wrench':'\ud83d\udd27',
'writing_hand':'\u270d\ufe0f',
'x':'\u274c',
'yellow_heart':'\ud83d\udc9b',
'yen':'\ud83d\udcb4',
'yin_yang':'\u262f\ufe0f',
'yum':'\ud83d\ude0b',
'zap':'\u26a1\ufe0f',
'zipper_mouth_face':'\ud83e\udd10',
'zzz':'\ud83d\udca4',
/* special emojis :P */
'octocat': '<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">',
'showdown': '<span style="font-family: \'Anonymous Pro\', monospace; text-decoration: underline; text-decoration-style: dashed; text-decoration-color: #3e8b8a;text-underline-position: under;">S</span>'
};
/**
* Created by Estevao on 31-05-2015.
*/
/**
* Showdown Converter class
* @class
* @param {object} [converterOptions]
* @returns {Converter}
*/
showdown.Converter = function (converterOptions) {
'use strict';
var
/**
* Options used by this converter
* @private
* @type {{}}
*/
options = {},
/**
* Language extensions used by this converter
* @private
* @type {Array}
*/
langExtensions = [],
/**
* Output modifiers extensions used by this converter
* @private
* @type {Array}
*/
outputModifiers = [],
/**
* Event listeners
* @private
* @type {{}}
*/
listeners = {},
/**
* The flavor set in this converter
*/
setConvFlavor = setFlavor,
/**
* Metadata of the document
* @type {{parsed: {}, raw: string, format: string}}
*/
metadata = {
parsed: {},
raw: '',
format: ''
};
_constructor();
/**
* Converter constructor
* @private
*/
function _constructor () {
converterOptions = converterOptions || {};
for (var gOpt in globalOptions) {
if (globalOptions.hasOwnProperty(gOpt)) {
options[gOpt] = globalOptions[gOpt];
}
}
// Merge options
if (typeof converterOptions === 'object') {
for (var opt in converterOptions) {
if (converterOptions.hasOwnProperty(opt)) {
options[opt] = converterOptions[opt];
}
}
} else {
throw Error('Converter expects the passed parameter to be an object, but ' + typeof converterOptions +
' was passed instead.');
}
if (options.extensions) {
showdown.helper.forEach(options.extensions, _parseExtension);
}
}
/**
* Parse extension
* @param {*} ext
* @param {string} [name='']
* @private
*/
function _parseExtension (ext, name) {
name = name || null;
// If it's a string, the extension was previously loaded
if (showdown.helper.isString(ext)) {
ext = showdown.helper.stdExtName(ext);
name = ext;
// LEGACY_SUPPORT CODE
if (showdown.extensions[ext]) {
console.warn('DEPRECATION WARNING: ' + ext + ' is an old extension that uses a deprecated loading method.' +
'Please inform the developer that the extension should be updated!');
legacyExtensionLoading(showdown.extensions[ext], ext);
return;
// END LEGACY SUPPORT CODE
} else if (!showdown.helper.isUndefined(extensions[ext])) {
ext = extensions[ext];
} else {
throw Error('Extension "' + ext + '" could not be loaded. It was either not found or is not a valid extension.');
}
}
if (typeof ext === 'function') {
ext = ext();
}
if (!showdown.helper.isArray(ext)) {
ext = [ext];
}
var validExt = validate(ext, name);
if (!validExt.valid) {
throw Error(validExt.error);
}
for (var i = 0; i < ext.length; ++i) {
switch (ext[i].type) {
case 'lang':
langExtensions.push(ext[i]);
break;
case 'output':
outputModifiers.push(ext[i]);
break;
}
if (ext[i].hasOwnProperty('listeners')) {
for (var ln in ext[i].listeners) {
if (ext[i].listeners.hasOwnProperty(ln)) {
listen(ln, ext[i].listeners[ln]);
}
}
}
}
}
/**
* LEGACY_SUPPORT
* @param {*} ext
* @param {string} name
*/
function legacyExtensionLoading (ext, name) {
if (typeof ext === 'function') {
ext = ext(new showdown.Converter());
}
if (!showdown.helper.isArray(ext)) {
ext = [ext];
}
var valid = validate(ext, name);
if (!valid.valid) {
throw Error(valid.error);
}
for (var i = 0; i < ext.length; ++i) {
switch (ext[i].type) {
case 'lang':
langExtensions.push(ext[i]);
break;
case 'output':
outputModifiers.push(ext[i]);
break;
default:// should never reach here
throw Error('Extension loader error: Type unrecognized!!!');
}
}
}
/**
* Listen to an event
* @param {string} name
* @param {function} callback
*/
function listen (name, callback) {
if (!showdown.helper.isString(name)) {
throw Error('Invalid argument in converter.listen() method: name must be a string, but ' + typeof name + ' given');
}
if (typeof callback !== 'function') {
throw Error('Invalid argument in converter.listen() method: callback must be a function, but ' + typeof callback + ' given');
}
if (!listeners.hasOwnProperty(name)) {
listeners[name] = [];
}
listeners[name].push(callback);
}
function rTrimInputText (text) {
var rsp = text.match(/^\s*/)[0].length,
rgx = new RegExp('^\\s{0,' + rsp + '}', 'gm');
return text.replace(rgx, '');
}
/**
* Dispatch an event
* @private
* @param {string} evtName Event name
* @param {string} text Text
* @param {{}} options Converter Options
* @param {{}} globals
* @returns {string}
*/
this._dispatch = function dispatch (evtName, text, options, globals) {
if (listeners.hasOwnProperty(evtName)) {
for (var ei = 0; ei < listeners[evtName].length; ++ei) {
var nText = listeners[evtName][ei](evtName, text, this, options, globals);
if (nText && typeof nText !== 'undefined') {
text = nText;
}
}
}
return text;
};
/**
* Listen to an event
* @param {string} name
* @param {function} callback
* @returns {showdown.Converter}
*/
this.listen = function (name, callback) {
listen(name, callback);
return this;
};
/**
* Converts a markdown string into HTML
* @param {string} text
* @returns {*}
*/
this.makeHtml = function (text) {
//check if text is not falsy
if (!text) {
return text;
}
var globals = {
gHtmlBlocks: [],
gHtmlMdBlocks: [],
gHtmlSpans: [],
gUrls: {},
gTitles: {},
gDimensions: {},
gListLevel: 0,
hashLinkCounts: {},
langExtensions: langExtensions,
outputModifiers: outputModifiers,
converter: this,
ghCodeBlocks: [],
metadata: {
parsed: {},
raw: '',
format: ''
}
};
// This lets us use ¨ trema as an escape char to avoid md5 hashes
// The choice of character is arbitrary; anything that isn't
// magic in Markdown will work.
text = text.replace(/¨/g, '¨T');
// Replace $ with ¨D
// RegExp interprets $ as a special character
// when it's in a replacement string
text = text.replace(/\$/g, '¨D');
// Standardize line endings
text = text.replace(/\r\n/g, '\n'); // DOS to Unix
text = text.replace(/\r/g, '\n'); // Mac to Unix
// Stardardize line spaces
text = text.replace(/\u00A0/g, ' ');
if (options.smartIndentationFix) {
text = rTrimInputText(text);
}
// Make sure text begins and ends with a couple of newlines:
text = '\n\n' + text + '\n\n';
// detab
text = showdown.subParser('detab')(text, options, globals);
/**
* Strip any lines consisting only of spaces and tabs.
* This makes subsequent regexs easier to write, because we can
* match consecutive blank lines with /\n+/ instead of something
* contorted like /[ \t]*\n+/
*/
text = text.replace(/^[ \t]+$/mg, '');
//run languageExtensions
showdown.helper.forEach(langExtensions, function (ext) {
text = showdown.subParser('runExtension')(ext, text, options, globals);
});
// run the sub parsers
text = showdown.subParser('metadata')(text, options, globals);
text = showdown.subParser('hashPreCodeTags')(text, options, globals);
text = showdown.subParser('githubCodeBlocks')(text, options, globals);
text = showdown.subParser('hashHTMLBlocks')(text, options, globals);
text = showdown.subParser('hashCodeTags')(text, options, globals);
text = showdown.subParser('stripLinkDefinitions')(text, options, globals);
text = showdown.subParser('blockGamut')(text, options, globals);
text = showdown.subParser('unhashHTMLSpans')(text, options, globals);
text = showdown.subParser('unescapeSpecialChars')(text, options, globals);
// attacklab: Restore dollar signs
text = text.replace(/¨D/g, '$$');
// attacklab: Restore tremas
text = text.replace(/¨T/g, '¨');
// render a complete html document instead of a partial if the option is enabled
text = showdown.subParser('completeHTMLDocument')(text, options, globals);
// Run output modifiers
showdown.helper.forEach(outputModifiers, function (ext) {
text = showdown.subParser('runExtension')(ext, text, options, globals);
});
// update metadata
metadata = globals.metadata;
return text;
};
/**
* Converts an HTML string into a markdown string
* @param src
* @param [HTMLParser] A WHATWG DOM and HTML parser, such as JSDOM. If none is supplied, window.document will be used.
* @returns {string}
*/
this.makeMarkdown = this.makeMd = function (src, HTMLParser) {
// replace \r\n with \n
src = src.replace(/\r\n/g, '\n');
src = src.replace(/\r/g, '\n'); // old macs
// due to an edge case, we need to find this: > <
// to prevent removing of non silent white spaces
// ex: <em>this is</em> <strong>sparta</strong>
src = src.replace(/>[ \t]+</, '>¨NBSP;<');
if (!HTMLParser) {
if (window && window.document) {
HTMLParser = window.document;
} else {
throw new Error('HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM');
}
}
var doc = HTMLParser.createElement('div');
doc.innerHTML = src;
var globals = {
preList: substitutePreCodeTags(doc)
};
// remove all newlines and collapse spaces
clean(doc);
// some stuff, like accidental reference links must now be escaped
// TODO
// doc.innerHTML = doc.innerHTML.replace(/\[[\S\t ]]/);
var nodes = doc.childNodes,
mdDoc = '';
for (var i = 0; i < nodes.length; i++) {
mdDoc += showdown.subParser('makeMarkdown.node')(nodes[i], globals);
}
function clean (node) {
for (var n = 0; n < node.childNodes.length; ++n) {
var child = node.childNodes[n];
if (child.nodeType === 3) {
if (!/\S/.test(child.nodeValue)) {
node.removeChild(child);
--n;
} else {
child.nodeValue = child.nodeValue.split('\n').join(' ');
child.nodeValue = child.nodeValue.replace(/(\s)+/g, '$1');
}
} else if (child.nodeType === 1) {
clean(child);
}
}
}
// find all pre tags and replace contents with placeholder
// we need this so that we can remove all indentation from html
// to ease up parsing
function substitutePreCodeTags (doc) {
var pres = doc.querySelectorAll('pre'),
presPH = [];
for (var i = 0; i < pres.length; ++i) {
if (pres[i].childElementCount === 1 && pres[i].firstChild.tagName.toLowerCase() === 'code') {
var content = pres[i].firstChild.innerHTML.trim(),
language = pres[i].firstChild.getAttribute('data-language') || '';
// if data-language attribute is not defined, then we look for class language-*
if (language === '') {
var classes = pres[i].firstChild.className.split(' ');
for (var c = 0; c < classes.length; ++c) {
var matches = classes[c].match(/^language-(.+)$/);
if (matches !== null) {
language = matches[1];
break;
}
}
}
// unescape html entities in content
content = showdown.helper.unescapeHTMLEntities(content);
presPH.push(content);
pres[i].outerHTML = '<precode language="' + language + '" precodenum="' + i.toString() + '"></precode>';
} else {
presPH.push(pres[i].innerHTML);
pres[i].innerHTML = '';
pres[i].setAttribute('prenum', i.toString());
}
}
return presPH;
}
return mdDoc;
};
/**
* Set an option of this Converter instance
* @param {string} key
* @param {*} value
*/
this.setOption = function (key, value) {
options[key] = value;
};
/**
* Get the option of this Converter instance
* @param {string} key
* @returns {*}
*/
this.getOption = function (key) {
return options[key];
};
/**
* Get the options of this Converter instance
* @returns {{}}
*/
this.getOptions = function () {
return options;
};
/**
* Add extension to THIS converter
* @param {{}} extension
* @param {string} [name=null]
*/
this.addExtension = function (extension, name) {
name = name || null;
_parseExtension(extension, name);
};
/**
* Use a global registered extension with THIS converter
* @param {string} extensionName Name of the previously registered extension
*/
this.useExtension = function (extensionName) {
_parseExtension(extensionName);
};
/**
* Set the flavor THIS converter should use
* @param {string} name
*/
this.setFlavor = function (name) {
if (!flavor.hasOwnProperty(name)) {
throw Error(name + ' flavor was not found');
}
var preset = flavor[name];
setConvFlavor = name;
for (var option in preset) {
if (preset.hasOwnProperty(option)) {
options[option] = preset[option];
}
}
};
/**
* Get the currently set flavor of this converter
* @returns {string}
*/
this.getFlavor = function () {
return setConvFlavor;
};
/**
* Remove an extension from THIS converter.
* Note: This is a costly operation. It's better to initialize a new converter
* and specify the extensions you wish to use
* @param {Array} extension
*/
this.removeExtension = function (extension) {
if (!showdown.helper.isArray(extension)) {
extension = [extension];
}
for (var a = 0; a < extension.length; ++a) {
var ext = extension[a];
for (var i = 0; i < langExtensions.length; ++i) {
if (langExtensions[i] === ext) {
langExtensions[i].splice(i, 1);
}
}
for (var ii = 0; ii < outputModifiers.length; ++i) {
if (outputModifiers[ii] === ext) {
outputModifiers[ii].splice(i, 1);
}
}
}
};
/**
* Get all extension of THIS converter
* @returns {{language: Array, output: Array}}
*/
this.getAllExtensions = function () {
return {
language: langExtensions,
output: outputModifiers
};
};
/**
* Get the metadata of the previously parsed document
* @param raw
* @returns {string|{}}
*/
this.getMetadata = function (raw) {
if (raw) {
return metadata.raw;
} else {
return metadata.parsed;
}
};
/**
* Get the metadata format of the previously parsed document
* @returns {string}
*/
this.getMetadataFormat = function () {
return metadata.format;
};
/**
* Private: set a single key, value metadata pair
* @param {string} key
* @param {string} value
*/
this._setMetadataPair = function (key, value) {
metadata.parsed[key] = value;
};
/**
* Private: set metadata format
* @param {string} format
*/
this._setMetadataFormat = function (format) {
metadata.format = format;
};
/**
* Private: set metadata raw text
* @param {string} raw
*/
this._setMetadataRaw = function (raw) {
metadata.raw = raw;
};
};
/**
* Turn Markdown link shortcuts into XHTML <a> tags.
*/
showdown.subParser('anchors', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('anchors.before', text, options, globals);
var writeAnchorTag = function (wholeMatch, linkText, linkId, url, m5, m6, title) {
if (showdown.helper.isUndefined(title)) {
title = '';
}
linkId = linkId.toLowerCase();
// Special case for explicit empty url
if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
url = '';
} else if (!url) {
if (!linkId) {
// lower-case and turn embedded newlines into spaces
linkId = linkText.toLowerCase().replace(/ ?\n/g, ' ');
}
url = '#' + linkId;
if (!showdown.helper.isUndefined(globals.gUrls[linkId])) {
url = globals.gUrls[linkId];
if (!showdown.helper.isUndefined(globals.gTitles[linkId])) {
title = globals.gTitles[linkId];
}
} else {
return wholeMatch;
}
}
//url = showdown.helper.escapeCharacters(url, '*_', false); // replaced line to improve performance
url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
var result = '<a href="' + url + '"';
if (title !== '' && title !== null) {
title = title.replace(/"/g, '"');
//title = showdown.helper.escapeCharacters(title, '*_', false); // replaced line to improve performance
title = title.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
result += ' title="' + title + '"';
}
// optionLinksInNewWindow only applies
// to external links. Hash links (#) open in same page
if (options.openLinksInNewWindow && !/^#/.test(url)) {
// escaped _
result += ' rel="noopener noreferrer" target="¨E95Eblank"';
}
result += '>' + linkText + '</a>';
return result;
};
// First, handle reference-style links: [link text] [id]
text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g, writeAnchorTag);
// Next, inline-style links: [link text](url "optional title")
// cases with crazy urls like ./image/cat1).png
text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
writeAnchorTag);
// normal cases
text = text.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,
writeAnchorTag);
// handle reference-style shortcuts: [link text]
// These must come last in case you've also got [link test][1]
// or [link test](/foo)
text = text.replace(/\[([^\[\]]+)]()()()()()/g, writeAnchorTag);
// Lastly handle GithubMentions if option is enabled
if (options.ghMentions) {
text = text.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi, function (wm, st, escape, mentions, username) {
if (escape === '\\') {
return st + mentions;
}
//check if options.ghMentionsLink is a string
if (!showdown.helper.isString(options.ghMentionsLink)) {
throw new Error('ghMentionsLink option must be a string');
}
var lnk = options.ghMentionsLink.replace(/\{u}/g, username),
target = '';
if (options.openLinksInNewWindow) {
target = ' rel="noopener noreferrer" target="¨E95Eblank"';
}
return st + '<a href="' + lnk + '"' + target + '>' + mentions + '</a>';
});
}
text = globals.converter._dispatch('anchors.after', text, options, globals);
return text;
});
// url allowed chars [a-z\d_.~:/?#[]@!$&'()*+,;=-]
var simpleURLRegex = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,
simpleURLRegex2 = /([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,
delimUrlRegex = /()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,
simpleMailRegex = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi,
delimMailRegex = /<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,
replaceLink = function (options) {
'use strict';
return function (wm, leadingMagicChars, link, m2, m3, trailingPunctuation, trailingMagicChars) {
link = link.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
var lnkTxt = link,
append = '',
target = '',
lmc = leadingMagicChars || '',
tmc = trailingMagicChars || '';
if (/^www\./i.test(link)) {
link = link.replace(/^www\./i, 'http://www.');
}
if (options.excludeTrailingPunctuationFromURLs && trailingPunctuation) {
append = trailingPunctuation;
}
if (options.openLinksInNewWindow) {
target = ' rel="noopener noreferrer" target="¨E95Eblank"';
}
return lmc + '<a href="' + link + '"' + target + '>' + lnkTxt + '</a>' + append + tmc;
};
},
replaceMail = function (options, globals) {
'use strict';
return function (wholeMatch, b, mail) {
var href = 'mailto:';
b = b || '';
mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals);
if (options.encodeEmails) {
href = showdown.helper.encodeEmailAddress(href + mail);
mail = showdown.helper.encodeEmailAddress(mail);
} else {
href = href + mail;
}
return b + '<a href="' + href + '">' + mail + '</a>';
};
};
showdown.subParser('autoLinks', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('autoLinks.before', text, options, globals);
text = text.replace(delimUrlRegex, replaceLink(options));
text = text.replace(delimMailRegex, replaceMail(options, globals));
text = globals.converter._dispatch('autoLinks.after', text, options, globals);
return text;
});
showdown.subParser('simplifiedAutoLinks', function (text, options, globals) {
'use strict';
if (!options.simplifiedAutoLink) {
return text;
}
text = globals.converter._dispatch('simplifiedAutoLinks.before', text, options, globals);
if (options.excludeTrailingPunctuationFromURLs) {
text = text.replace(simpleURLRegex2, replaceLink(options));
} else {
text = text.replace(simpleURLRegex, replaceLink(options));
}
text = text.replace(simpleMailRegex, replaceMail(options, globals));
text = globals.converter._dispatch('simplifiedAutoLinks.after', text, options, globals);
return text;
});
/**
* These are all the transformations that form block-level
* tags like paragraphs, headers, and list items.
*/
showdown.subParser('blockGamut', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('blockGamut.before', text, options, globals);
// we parse blockquotes first so that we can have headings and hrs
// inside blockquotes
text = showdown.subParser('blockQuotes')(text, options, globals);
text = showdown.subParser('headers')(text, options, globals);
// Do Horizontal Rules:
text = showdown.subParser('horizontalRule')(text, options, globals);
text = showdown.subParser('lists')(text, options, globals);
text = showdown.subParser('codeBlocks')(text, options, globals);
text = showdown.subParser('tables')(text, options, globals);
// We already ran _HashHTMLBlocks() before, in Markdown(), but that
// was to escape raw HTML in the original Markdown source. This time,
// we're escaping the markup we've just created, so that we don't wrap
// <p> tags around block-level tags.
text = showdown.subParser('hashHTMLBlocks')(text, options, globals);
text = showdown.subParser('paragraphs')(text, options, globals);
text = globals.converter._dispatch('blockGamut.after', text, options, globals);
return text;
});
showdown.subParser('blockQuotes', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('blockQuotes.before', text, options, globals);
// add a couple extra lines after the text and endtext mark
text = text + '\n\n';
var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;
if (options.splitAdjacentBlockquotes) {
rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm;
}
text = text.replace(rgx, function (bq) {
// attacklab: hack around Konqueror 3.5.4 bug:
// "----------bug".replace(/^-/g,"") == "bug"
bq = bq.replace(/^[ \t]*>[ \t]?/gm, ''); // trim one level of quoting
// attacklab: clean up hack
bq = bq.replace(/¨0/g, '');
bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines
bq = showdown.subParser('githubCodeBlocks')(bq, options, globals);
bq = showdown.subParser('blockGamut')(bq, options, globals); // recurse
bq = bq.replace(/(^|\n)/g, '$1 ');
// These leading spaces screw with <pre> content, so we need to fix that:
bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function (wholeMatch, m1) {
var pre = m1;
// attacklab: hack around Konqueror 3.5.4 bug:
pre = pre.replace(/^ /mg, '¨0');
pre = pre.replace(/¨0/g, '');
return pre;
});
return showdown.subParser('hashBlock')('<blockquote>\n' + bq + '\n</blockquote>', options, globals);
});
text = globals.converter._dispatch('blockQuotes.after', text, options, globals);
return text;
});
/**
* Process Markdown `<pre><code>` blocks.
*/
showdown.subParser('codeBlocks', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('codeBlocks.before', text, options, globals);
// sentinel workarounds for lack of \A and \Z, safari\khtml bug
text += '¨0';
var pattern = /(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;
text = text.replace(pattern, function (wholeMatch, m1, m2) {
var codeblock = m1,
nextChar = m2,
end = '\n';
codeblock = showdown.subParser('outdent')(codeblock, options, globals);
codeblock = showdown.subParser('encodeCode')(codeblock, options, globals);
codeblock = showdown.subParser('detab')(codeblock, options, globals);
codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing newlines
if (options.omitExtraWLInCodeBlocks) {
end = '';
}
codeblock = '<pre><code>' + codeblock + end + '</code></pre>';
return showdown.subParser('hashBlock')(codeblock, options, globals) + nextChar;
});
// strip sentinel
text = text.replace(/¨0/, '');
text = globals.converter._dispatch('codeBlocks.after', text, options, globals);
return text;
});
/**
*
* * Backtick quotes are used for <code></code> spans.
*
* * You can use multiple backticks as the delimiters if you want to
* include literal backticks in the code span. So, this input:
*
* Just type ``foo `bar` baz`` at the prompt.
*
* Will translate to:
*
* <p>Just type <code>foo `bar` baz</code> at the prompt.</p>
*
* There's no arbitrary limit to the number of backticks you
* can use as delimters. If you need three consecutive backticks
* in your code, use four for delimiters, etc.
*
* * You can use spaces to get literal backticks at the edges:
*
* ... type `` `bar` `` ...
*
* Turns to:
*
* ... type <code>`bar`</code> ...
*/
showdown.subParser('codeSpans', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('codeSpans.before', text, options, globals);
if (typeof text === 'undefined') {
text = '';
}
text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
function (wholeMatch, m1, m2, m3) {
var c = m3;
c = c.replace(/^([ \t]*)/g, ''); // leading whitespace
c = c.replace(/[ \t]*$/g, ''); // trailing whitespace
c = showdown.subParser('encodeCode')(c, options, globals);
c = m1 + '<code>' + c + '</code>';
c = showdown.subParser('hashHTMLSpans')(c, options, globals);
return c;
}
);
text = globals.converter._dispatch('codeSpans.after', text, options, globals);
return text;
});
/**
* Create a full HTML document from the processed markdown
*/
showdown.subParser('completeHTMLDocument', function (text, options, globals) {
'use strict';
if (!options.completeHTMLDocument) {
return text;
}
text = globals.converter._dispatch('completeHTMLDocument.before', text, options, globals);
var doctype = 'html',
doctypeParsed = '<!DOCTYPE HTML>\n',
title = '',
charset = '<meta charset="utf-8">\n',
lang = '',
metadata = '';
if (typeof globals.metadata.parsed.doctype !== 'undefined') {
doctypeParsed = '<!DOCTYPE ' + globals.metadata.parsed.doctype + '>\n';
doctype = globals.metadata.parsed.doctype.toString().toLowerCase();
if (doctype === 'html' || doctype === 'html5') {
charset = '<meta charset="utf-8">';
}
}
for (var meta in globals.metadata.parsed) {
if (globals.metadata.parsed.hasOwnProperty(meta)) {
switch (meta.toLowerCase()) {
case 'doctype':
break;
case 'title':
title = '<title>' + globals.metadata.parsed.title + '</title>\n';
break;
case 'charset':
if (doctype === 'html' || doctype === 'html5') {
charset = '<meta charset="' + globals.metadata.parsed.charset + '">\n';
} else {
charset = '<meta name="charset" content="' + globals.metadata.parsed.charset + '">\n';
}
break;
case 'language':
case 'lang':
lang = ' lang="' + globals.metadata.parsed[meta] + '"';
metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
break;
default:
metadata += '<meta name="' + meta + '" content="' + globals.metadata.parsed[meta] + '">\n';
}
}
}
text = doctypeParsed + '<html' + lang + '>\n<head>\n' + title + charset + metadata + '</head>\n<body>\n' + text.trim() + '\n</body>\n</html>';
text = globals.converter._dispatch('completeHTMLDocument.after', text, options, globals);
return text;
});
/**
* Convert all tabs to spaces
*/
showdown.subParser('detab', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('detab.before', text, options, globals);
// expand first n-1 tabs
text = text.replace(/\t(?=\t)/g, ' '); // g_tab_width
// replace the nth with two sentinels
text = text.replace(/\t/g, '¨A¨B');
// use the sentinel to anchor our regex so it doesn't explode
text = text.replace(/¨B(.+?)¨A/g, function (wholeMatch, m1) {
var leadingText = m1,
numSpaces = 4 - leadingText.length % 4; // g_tab_width
// there *must* be a better way to do this:
for (var i = 0; i < numSpaces; i++) {
leadingText += ' ';
}
return leadingText;
});
// clean up sentinels
text = text.replace(/¨A/g, ' '); // g_tab_width
text = text.replace(/¨B/g, '');
text = globals.converter._dispatch('detab.after', text, options, globals);
return text;
});
showdown.subParser('ellipsis', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('ellipsis.before', text, options, globals);
text = text.replace(/\.\.\./g, '…');
text = globals.converter._dispatch('ellipsis.after', text, options, globals);
return text;
});
/**
* Turn emoji codes into emojis
*
* List of supported emojis: https://github.com/showdownjs/showdown/wiki/Emojis
*/
showdown.subParser('emoji', function (text, options, globals) {
'use strict';
if (!options.emoji) {
return text;
}
text = globals.converter._dispatch('emoji.before', text, options, globals);
var emojiRgx = /:([\S]+?):/g;
text = text.replace(emojiRgx, function (wm, emojiCode) {
if (showdown.helper.emojis.hasOwnProperty(emojiCode)) {
return showdown.helper.emojis[emojiCode];
}
return wm;
});
text = globals.converter._dispatch('emoji.after', text, options, globals);
return text;
});
/**
* Smart processing for ampersands and angle brackets that need to be encoded.
*/
showdown.subParser('encodeAmpsAndAngles', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('encodeAmpsAndAngles.before', text, options, globals);
// Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin:
// http://bumppo.net/projects/amputator/
text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, '&');
// Encode naked <'s
text = text.replace(/<(?![a-z\/?$!])/gi, '<');
// Encode <
text = text.replace(/</g, '<');
// Encode >
text = text.replace(/>/g, '>');
text = globals.converter._dispatch('encodeAmpsAndAngles.after', text, options, globals);
return text;
});
/**
* Returns the string, with after processing the following backslash escape sequences.
*
* attacklab: The polite way to do this is with the new escapeCharacters() function:
*
* text = escapeCharacters(text,"\\",true);
* text = escapeCharacters(text,"`*_{}[]()>#+-.!",true);
*
* ...but we're sidestepping its use of the (slow) RegExp constructor
* as an optimization for Firefox. This function gets called a LOT.
*/
showdown.subParser('encodeBackslashEscapes', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('encodeBackslashEscapes.before', text, options, globals);
text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
text = text.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown.helper.escapeCharactersCallback);
text = globals.converter._dispatch('encodeBackslashEscapes.after', text, options, globals);
return text;
});
/**
* Encode/escape certain characters inside Markdown code runs.
* The point is that in code, these characters are literals,
* and lose their special Markdown meanings.
*/
showdown.subParser('encodeCode', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('encodeCode.before', text, options, globals);
// Encode all ampersands; HTML entities are not
// entities within a Markdown code span.
text = text
.replace(/&/g, '&')
// Do the angle bracket song and dance:
.replace(/</g, '<')
.replace(/>/g, '>')
// Now, escape characters that are magic in Markdown:
.replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback);
text = globals.converter._dispatch('encodeCode.after', text, options, globals);
return text;
});
/**
* Within tags -- meaning between < and > -- encode [\ ` * _ ~ =] so they
* don't conflict with their use in Markdown for code, italics and strong.
*/
showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.before', text, options, globals);
// Build a regex to find HTML tags.
var tags = /<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,
comments = /<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;
text = text.replace(tags, function (wholeMatch) {
return wholeMatch
.replace(/(.)<\/?code>(?=.)/g, '$1`')
.replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
});
text = text.replace(comments, function (wholeMatch) {
return wholeMatch
.replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
});
text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.after', text, options, globals);
return text;
});
/**
* Handle github codeblocks prior to running HashHTML so that
* HTML contained within the codeblock gets escaped properly
* Example:
* ```ruby
* def hello_world(x)
* puts "Hello, #{x}"
* end
* ```
*/
showdown.subParser('githubCodeBlocks', function (text, options, globals) {
'use strict';
// early exit if option is not enabled
if (!options.ghCodeBlocks) {
return text;
}
text = globals.converter._dispatch('githubCodeBlocks.before', text, options, globals);
text += '¨0';
text = text.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g, function (wholeMatch, delim, language, codeblock) {
var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';
// First parse the github code block
codeblock = showdown.subParser('encodeCode')(codeblock, options, globals);
codeblock = showdown.subParser('detab')(codeblock, options, globals);
codeblock = codeblock.replace(/^\n+/g, ''); // trim leading newlines
codeblock = codeblock.replace(/\n+$/g, ''); // trim trailing whitespace
codeblock = '<pre><code' + (language ? ' class="' + language + ' language-' + language + '"' : '') + '>' + codeblock + end + '</code></pre>';
codeblock = showdown.subParser('hashBlock')(codeblock, options, globals);
// Since GHCodeblocks can be false positives, we need to
// store the primitive text and the parsed text in a global var,
// and then return a token
return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
});
// attacklab: strip sentinel
text = text.replace(/¨0/, '');
return globals.converter._dispatch('githubCodeBlocks.after', text, options, globals);
});
showdown.subParser('hashBlock', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('hashBlock.before', text, options, globals);
text = text.replace(/(^\n+|\n+$)/g, '');
text = '\n\n¨K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n';
text = globals.converter._dispatch('hashBlock.after', text, options, globals);
return text;
});
/**
* Hash and escape <code> elements that should not be parsed as markdown
*/
showdown.subParser('hashCodeTags', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('hashCodeTags.before', text, options, globals);
var repFunc = function (wholeMatch, match, left, right) {
var codeblock = left + showdown.subParser('encodeCode')(match, options, globals) + right;
return '¨C' + (globals.gHtmlSpans.push(codeblock) - 1) + 'C';
};
// Hash naked <code>
text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '<code\\b[^>]*>', '</code>', 'gim');
text = globals.converter._dispatch('hashCodeTags.after', text, options, globals);
return text;
});
showdown.subParser('hashElement', function (text, options, globals) {
'use strict';
return function (wholeMatch, m1) {
var blockText = m1;
// Undo double lines
blockText = blockText.replace(/\n\n/g, '\n');
blockText = blockText.replace(/^\n/, '');
// strip trailing blank lines
blockText = blockText.replace(/\n+$/g, '');
// Replace the element text with a marker ("¨KxK" where x is its key)
blockText = '\n\n¨K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n';
return blockText;
};
});
showdown.subParser('hashHTMLBlocks', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('hashHTMLBlocks.before', text, options, globals);
var blockTags = [
'pre',
'div',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'blockquote',
'table',
'dl',
'ol',
'ul',
'script',
'noscript',
'form',
'fieldset',
'iframe',
'math',
'style',
'section',
'header',
'footer',
'nav',
'article',
'aside',
'address',
'audio',
'canvas',
'figure',
'hgroup',
'output',
'video',
'p'
],
repFunc = function (wholeMatch, match, left, right) {
var txt = wholeMatch;
// check if this html element is marked as markdown
// if so, it's contents should be parsed as markdown
if (left.search(/\bmarkdown\b/) !== -1) {
txt = left + globals.converter.makeHtml(match) + right;
}
return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
};
if (options.backslashEscapesHTMLTags) {
// encode backslash escaped HTML tags
text = text.replace(/\\<(\/?[^>]+?)>/g, function (wm, inside) {
return '<' + inside + '>';
});
}
// hash HTML Blocks
for (var i = 0; i < blockTags.length; ++i) {
var opTagPos,
rgx1 = new RegExp('^ {0,3}(<' + blockTags[i] + '\\b[^>]*>)', 'im'),
patLeft = '<' + blockTags[i] + '\\b[^>]*>',
patRight = '</' + blockTags[i] + '>';
// 1. Look for the first position of the first opening HTML tag in the text
while ((opTagPos = showdown.helper.regexIndexOf(text, rgx1)) !== -1) {
// if the HTML tag is \ escaped, we need to escape it and break
//2. Split the text in that position
var subTexts = showdown.helper.splitAtIndex(text, opTagPos),
//3. Match recursively
newSubText1 = showdown.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, 'im');
// prevent an infinite loop
if (newSubText1 === subTexts[1]) {
break;
}
text = subTexts[0].concat(newSubText1);
}
}
// HR SPECIAL CASE
text = text.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,
showdown.subParser('hashElement')(text, options, globals));
// Special case for standalone HTML comments
text = showdown.helper.replaceRecursiveRegExp(text, function (txt) {
return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
}, '^ {0,3}<!--', '-->', 'gm');
// PHP and ASP-style processor instructions (<?...?> and <%...%>)
text = text.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,
showdown.subParser('hashElement')(text, options, globals));
text = globals.converter._dispatch('hashHTMLBlocks.after', text, options, globals);
return text;
});
/**
* Hash span elements that should not be parsed as markdown
*/
showdown.subParser('hashHTMLSpans', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('hashHTMLSpans.before', text, options, globals);
function hashHTMLSpan (html) {
return '¨C' + (globals.gHtmlSpans.push(html) - 1) + 'C';
}
// Hash Self Closing tags
text = text.replace(/<[^>]+?\/>/gi, function (wm) {
return hashHTMLSpan(wm);
});
// Hash tags without properties
text = text.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function (wm) {
return hashHTMLSpan(wm);
});
// Hash tags with properties
text = text.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function (wm) {
return hashHTMLSpan(wm);
});
// Hash self closing tags without />
text = text.replace(/<[^>]+?>/gi, function (wm) {
return hashHTMLSpan(wm);
});
/*showdown.helper.matchRecursiveRegExp(text, '<code\\b[^>]*>', '</code>', 'gi');*/
text = globals.converter._dispatch('hashHTMLSpans.after', text, options, globals);
return text;
});
/**
* Unhash HTML spans
*/
showdown.subParser('unhashHTMLSpans', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('unhashHTMLSpans.before', text, options, globals);
for (var i = 0; i < globals.gHtmlSpans.length; ++i) {
var repText = globals.gHtmlSpans[i],
// limiter to prevent infinite loop (assume 10 as limit for recurse)
limit = 0;
while (/¨C(\d+)C/.test(repText)) {
var num = RegExp.$1;
repText = repText.replace('¨C' + num + 'C', globals.gHtmlSpans[num]);
if (limit === 10) {
console.error('maximum nesting of 10 spans reached!!!');
break;
}
++limit;
}
text = text.replace('¨C' + i + 'C', repText);
}
text = globals.converter._dispatch('unhashHTMLSpans.after', text, options, globals);
return text;
});
/**
* Hash and escape <pre><code> elements that should not be parsed as markdown
*/
showdown.subParser('hashPreCodeTags', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('hashPreCodeTags.before', text, options, globals);
var repFunc = function (wholeMatch, match, left, right) {
// encode html entities
var codeblock = left + showdown.subParser('encodeCode')(match, options, globals) + right;
return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
};
// Hash <pre><code>
text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>', '^ {0,3}</code>\\s*</pre>', 'gim');
text = globals.converter._dispatch('hashPreCodeTags.after', text, options, globals);
return text;
});
showdown.subParser('headers', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('headers.before', text, options, globals);
var headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart),
// Set text-style headers:
// Header 1
// ========
//
// Header 2
// --------
//
setextRegexH1 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm,
setextRegexH2 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm;
text = text.replace(setextRegexH1, function (wholeMatch, m1) {
var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
hLevel = headerLevelStart,
hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
return showdown.subParser('hashBlock')(hashBlock, options, globals);
});
text = text.replace(setextRegexH2, function (matchFound, m1) {
var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
hLevel = headerLevelStart + 1,
hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
return showdown.subParser('hashBlock')(hashBlock, options, globals);
});
// atx-style headers:
// # Header 1
// ## Header 2
// ## Header 2 with closing hashes ##
// ...
// ###### Header 6
//
var atxStyle = (options.requireSpaceBeforeHeadingText) ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;
text = text.replace(atxStyle, function (wholeMatch, m1, m2) {
var hText = m2;
if (options.customizedHeaderId) {
hText = m2.replace(/\s?\{([^{]+?)}\s*$/, '');
}
var span = showdown.subParser('spanGamut')(hText, options, globals),
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"',
hLevel = headerLevelStart - 1 + m1.length,
header = '<h' + hLevel + hID + '>' + span + '</h' + hLevel + '>';
return showdown.subParser('hashBlock')(header, options, globals);
});
function headerId (m) {
var title,
prefix;
// It is separate from other options to allow combining prefix and customized
if (options.customizedHeaderId) {
var match = m.match(/\{([^{]+?)}\s*$/);
if (match && match[1]) {
m = match[1];
}
}
title = m;
// Prefix id to prevent causing inadvertent pre-existing style matches.
if (showdown.helper.isString(options.prefixHeaderId)) {
prefix = options.prefixHeaderId;
} else if (options.prefixHeaderId === true) {
prefix = 'section-';
} else {
prefix = '';
}
if (!options.rawPrefixHeaderId) {
title = prefix + title;
}
if (options.ghCompatibleHeaderId) {
title = title
.replace(/ /g, '-')
// replace previously escaped chars (&, ¨ and $)
.replace(/&/g, '')
.replace(/¨T/g, '')
.replace(/¨D/g, '')
// replace rest of the chars (&~$ are repeated as they might have been escaped)
// borrowed from github's redcarpet (some they should produce similar results)
.replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, '')
.toLowerCase();
} else if (options.rawHeaderId) {
title = title
.replace(/ /g, '-')
// replace previously escaped chars (&, ¨ and $)
.replace(/&/g, '&')
.replace(/¨T/g, '¨')
.replace(/¨D/g, '$')
// replace " and '
.replace(/["']/g, '-')
.toLowerCase();
} else {
title = title
.replace(/[^\w]/g, '')
.toLowerCase();
}
if (options.rawPrefixHeaderId) {
title = prefix + title;
}
if (globals.hashLinkCounts[title]) {
title = title + '-' + (globals.hashLinkCounts[title]++);
} else {
globals.hashLinkCounts[title] = 1;
}
return title;
}
text = globals.converter._dispatch('headers.after', text, options, globals);
return text;
});
/**
* Turn Markdown link shortcuts into XHTML <a> tags.
*/
showdown.subParser('horizontalRule', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('horizontalRule.before', text, options, globals);
var key = showdown.subParser('hashBlock')('<hr />', options, globals);
text = text.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key);
text = text.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key);
text = text.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key);
text = globals.converter._dispatch('horizontalRule.after', text, options, globals);
return text;
});
/**
* Turn Markdown image shortcuts into <img> tags.
*/
showdown.subParser('images', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('images.before', text, options, globals);
var inlineRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
crazyRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,
base64RegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
referenceRegExp = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,
refShortcutRegExp = /!\[([^\[\]]+)]()()()()()/g;
function writeImageTagBase64 (wholeMatch, altText, linkId, url, width, height, m5, title) {
url = url.replace(/\s/g, '');
return writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title);
}
function writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title) {
var gUrls = globals.gUrls,
gTitles = globals.gTitles,
gDims = globals.gDimensions;
linkId = linkId.toLowerCase();
if (!title) {
title = '';
}
// Special case for explicit empty url
if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
url = '';
} else if (url === '' || url === null) {
if (linkId === '' || linkId === null) {
// lower-case and turn embedded newlines into spaces
linkId = altText.toLowerCase().replace(/ ?\n/g, ' ');
}
url = '#' + linkId;
if (!showdown.helper.isUndefined(gUrls[linkId])) {
url = gUrls[linkId];
if (!showdown.helper.isUndefined(gTitles[linkId])) {
title = gTitles[linkId];
}
if (!showdown.helper.isUndefined(gDims[linkId])) {
width = gDims[linkId].width;
height = gDims[linkId].height;
}
} else {
return wholeMatch;
}
}
altText = altText
.replace(/"/g, '"')
//altText = showdown.helper.escapeCharacters(altText, '*_', false);
.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
//url = showdown.helper.escapeCharacters(url, '*_', false);
url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
var result = '<img src="' + url + '" alt="' + altText + '"';
if (title && showdown.helper.isString(title)) {
title = title
.replace(/"/g, '"')
//title = showdown.helper.escapeCharacters(title, '*_', false);
.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
result += ' title="' + title + '"';
}
if (width && height) {
width = (width === '*') ? 'auto' : width;
height = (height === '*') ? 'auto' : height;
result += ' width="' + width + '"';
result += ' height="' + height + '"';
}
result += ' />';
return result;
}
// First, handle reference-style labeled images: ![alt text][id]
text = text.replace(referenceRegExp, writeImageTag);
// Next, handle inline images: 
// base64 encoded images
text = text.replace(base64RegExp, writeImageTagBase64);
// cases with crazy urls like ./image/cat1).png
text = text.replace(crazyRegExp, writeImageTag);
// normal cases
text = text.replace(inlineRegExp, writeImageTag);
// handle reference-style shortcuts: ![img text]
text = text.replace(refShortcutRegExp, writeImageTag);
text = globals.converter._dispatch('images.after', text, options, globals);
return text;
});
showdown.subParser('italicsAndBold', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('italicsAndBold.before', text, options, globals);
// it's faster to have 3 separate regexes for each case than have just one
// because of backtracing, in some cases, it could lead to an exponential effect
// called "catastrophic backtrace". Ominous!
function parseInside (txt, left, right) {
/*
if (options.simplifiedAutoLink) {
txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
}
*/
return left + txt + right;
}
// Parse underscores
if (options.literalMidWordUnderscores) {
text = text.replace(/\b___(\S[\s\S]*?)___\b/g, function (wm, txt) {
return parseInside (txt, '<strong><em>', '</em></strong>');
});
text = text.replace(/\b__(\S[\s\S]*?)__\b/g, function (wm, txt) {
return parseInside (txt, '<strong>', '</strong>');
});
text = text.replace(/\b_(\S[\s\S]*?)_\b/g, function (wm, txt) {
return parseInside (txt, '<em>', '</em>');
});
} else {
text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) {
return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
});
text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) {
return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
});
text = text.replace(/_([^\s_][\s\S]*?)_/g, function (wm, m) {
// !/^_[^_]/.test(m) - test if it doesn't start with __ (since it seems redundant, we removed it)
return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
});
}
// Now parse asterisks
if (options.literalMidWordAsterisks) {
text = text.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g, function (wm, lead, txt) {
return parseInside (txt, lead + '<strong><em>', '</em></strong>');
});
text = text.replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g, function (wm, lead, txt) {
return parseInside (txt, lead + '<strong>', '</strong>');
});
text = text.replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g, function (wm, lead, txt) {
return parseInside (txt, lead + '<em>', '</em>');
});
} else {
text = text.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g, function (wm, m) {
return (/\S$/.test(m)) ? parseInside (m, '<strong><em>', '</em></strong>') : wm;
});
text = text.replace(/\*\*(\S[\s\S]*?)\*\*/g, function (wm, m) {
return (/\S$/.test(m)) ? parseInside (m, '<strong>', '</strong>') : wm;
});
text = text.replace(/\*([^\s*][\s\S]*?)\*/g, function (wm, m) {
// !/^\*[^*]/.test(m) - test if it doesn't start with ** (since it seems redundant, we removed it)
return (/\S$/.test(m)) ? parseInside (m, '<em>', '</em>') : wm;
});
}
text = globals.converter._dispatch('italicsAndBold.after', text, options, globals);
return text;
});
/**
* Form HTML ordered (numbered) and unordered (bulleted) lists.
*/
showdown.subParser('lists', function (text, options, globals) {
'use strict';
/**
* Process the contents of a single ordered or unordered list, splitting it
* into individual list items.
* @param {string} listStr
* @param {boolean} trimTrailing
* @returns {string}
*/
function processListItems (listStr, trimTrailing) {
// The $g_list_level global keeps track of when we're inside a list.
// Each time we enter a list, we increment it; when we leave a list,
// we decrement. If it's zero, we're not in a list anymore.
//
// We do this because when we're not inside a list, we want to treat
// something like this:
//
// I recommend upgrading to version
// 8. Oops, now this line is treated
// as a sub-list.
//
// As a single paragraph, despite the fact that the second line starts
// with a digit-period-space sequence.
//
// Whereas when we're inside a list (or sub-list), that line will be
// treated as the start of a sub-list. What a kludge, huh? This is
// an aspect of Markdown's syntax that's hard to parse perfectly
// without resorting to mind-reading. Perhaps the solution is to
// change the syntax rules such that sub-lists must start with a
// starting cardinal number; e.g. "1." or "a.".
globals.gListLevel++;
// trim trailing blank lines:
listStr = listStr.replace(/\n{2,}$/, '\n');
// attacklab: add sentinel to emulate \z
listStr += '¨0';
var rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,
isParagraphed = (/\n[ \t]*\n(?!¨0)/.test(listStr));
// Since version 1.5, nesting sublists requires 4 spaces (or 1 tab) indentation,
// which is a syntax breaking change
// activating this option reverts to old behavior
if (options.disableForced4SpacesIndentedSublists) {
rgx = /(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm;
}
listStr = listStr.replace(rgx, function (wholeMatch, m1, m2, m3, m4, taskbtn, checked) {
checked = (checked && checked.trim() !== '');
var item = showdown.subParser('outdent')(m4, options, globals),
bulletStyle = '';
// Support for github tasklists
if (taskbtn && options.tasklists) {
bulletStyle = ' class="task-list-item" style="list-style-type: none;"';
item = item.replace(/^[ \t]*\[(x|X| )?]/m, function () {
var otp = '<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';
if (checked) {
otp += ' checked';
}
otp += '>';
return otp;
});
}
// ISSUE #312
// This input: - - - a
// causes trouble to the parser, since it interprets it as:
// <ul><li><li><li>a</li></li></li></ul>
// instead of:
// <ul><li>- - a</li></ul>
// So, to prevent it, we will put a marker (¨A)in the beginning of the line
// Kind of hackish/monkey patching, but seems more effective than overcomplicating the list parser
item = item.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g, function (wm2) {
return '¨A' + wm2;
});
// m1 - Leading line or
// Has a double return (multi paragraph) or
// Has sublist
if (m1 || (item.search(/\n{2,}/) > -1)) {
item = showdown.subParser('githubCodeBlocks')(item, options, globals);
item = showdown.subParser('blockGamut')(item, options, globals);
} else {
// Recursion for sub-lists:
item = showdown.subParser('lists')(item, options, globals);
item = item.replace(/\n$/, ''); // chomp(item)
item = showdown.subParser('hashHTMLBlocks')(item, options, globals);
// Colapse double linebreaks
item = item.replace(/\n\n+/g, '\n\n');
if (isParagraphed) {
item = showdown.subParser('paragraphs')(item, options, globals);
} else {
item = showdown.subParser('spanGamut')(item, options, globals);
}
}
// now we need to remove the marker (¨A)
item = item.replace('¨A', '');
// we can finally wrap the line in list item tags
item = '<li' + bulletStyle + '>' + item + '</li>\n';
return item;
});
// attacklab: strip sentinel
listStr = listStr.replace(/¨0/g, '');
globals.gListLevel--;
if (trimTrailing) {
listStr = listStr.replace(/\s+$/, '');
}
return listStr;
}
function styleStartNumber (list, listType) {
// check if ol and starts by a number different than 1
if (listType === 'ol') {
var res = list.match(/^ *(\d+)\./);
if (res && res[1] !== '1') {
return ' start="' + res[1] + '"';
}
}
return '';
}
/**
* Check and parse consecutive lists (better fix for issue #142)
* @param {string} list
* @param {string} listType
* @param {boolean} trimTrailing
* @returns {string}
*/
function parseConsecutiveLists (list, listType, trimTrailing) {
// check if we caught 2 or more consecutive lists by mistake
// we use the counterRgx, meaning if listType is UL we look for OL and vice versa
var olRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm,
ulRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?[*+-][ \t]/gm : /^ {0,3}[*+-][ \t]/gm,
counterRxg = (listType === 'ul') ? olRgx : ulRgx,
result = '';
if (list.search(counterRxg) !== -1) {
(function parseCL (txt) {
var pos = txt.search(counterRxg),
style = styleStartNumber(list, listType);
if (pos !== -1) {
// slice
result += '\n\n<' + listType + style + '>\n' + processListItems(txt.slice(0, pos), !!trimTrailing) + '</' + listType + '>\n';
// invert counterType and listType
listType = (listType === 'ul') ? 'ol' : 'ul';
counterRxg = (listType === 'ul') ? olRgx : ulRgx;
//recurse
parseCL(txt.slice(pos));
} else {
result += '\n\n<' + listType + style + '>\n' + processListItems(txt, !!trimTrailing) + '</' + listType + '>\n';
}
})(list);
} else {
var style = styleStartNumber(list, listType);
result = '\n\n<' + listType + style + '>\n' + processListItems(list, !!trimTrailing) + '</' + listType + '>\n';
}
return result;
}
/** Start of list parsing **/
text = globals.converter._dispatch('lists.before', text, options, globals);
// add sentinel to hack around khtml/safari bug:
// http://bugs.webkit.org/show_bug.cgi?id=11231
text += '¨0';
if (globals.gListLevel) {
text = text.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
function (wholeMatch, list, m2) {
var listType = (m2.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
return parseConsecutiveLists(list, listType, true);
}
);
} else {
text = text.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,
function (wholeMatch, m1, list, m3) {
var listType = (m3.search(/[*+-]/g) > -1) ? 'ul' : 'ol';
return parseConsecutiveLists(list, listType, false);
}
);
}
// strip sentinel
text = text.replace(/¨0/, '');
text = globals.converter._dispatch('lists.after', text, options, globals);
return text;
});
/**
* Parse metadata at the top of the document
*/
showdown.subParser('metadata', function (text, options, globals) {
'use strict';
if (!options.metadata) {
return text;
}
text = globals.converter._dispatch('metadata.before', text, options, globals);
function parseMetadataContents (content) {
// raw is raw so it's not changed in any way
globals.metadata.raw = content;
// escape chars forbidden in html attributes
// double quotes
content = content
// ampersand first
.replace(/&/g, '&')
// double quotes
.replace(/"/g, '"');
content = content.replace(/\n {4}/g, ' ');
content.replace(/^([\S ]+): +([\s\S]+?)$/gm, function (wm, key, value) {
globals.metadata.parsed[key] = value;
return '';
});
}
text = text.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/, function (wholematch, format, content) {
parseMetadataContents(content);
return '¨M';
});
text = text.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/, function (wholematch, format, content) {
if (format) {
globals.metadata.format = format;
}
parseMetadataContents(content);
return '¨M';
});
text = text.replace(/¨M/g, '');
text = globals.converter._dispatch('metadata.after', text, options, globals);
return text;
});
/**
* Remove one level of line-leading tabs or spaces
*/
showdown.subParser('outdent', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('outdent.before', text, options, globals);
// attacklab: hack around Konqueror 3.5.4 bug:
// "----------bug".replace(/^-/g,"") == "bug"
text = text.replace(/^(\t|[ ]{1,4})/gm, '¨0'); // attacklab: g_tab_width
// attacklab: clean up hack
text = text.replace(/¨0/g, '');
text = globals.converter._dispatch('outdent.after', text, options, globals);
return text;
});
/**
*
*/
showdown.subParser('paragraphs', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('paragraphs.before', text, options, globals);
// Strip leading and trailing lines:
text = text.replace(/^\n+/g, '');
text = text.replace(/\n+$/g, '');
var grafs = text.split(/\n{2,}/g),
grafsOut = [],
end = grafs.length; // Wrap <p> tags
for (var i = 0; i < end; i++) {
var str = grafs[i];
// if this is an HTML marker, copy it
if (str.search(/¨(K|G)(\d+)\1/g) >= 0) {
grafsOut.push(str);
// test for presence of characters to prevent empty lines being parsed
// as paragraphs (resulting in undesired extra empty paragraphs)
} else if (str.search(/\S/) >= 0) {
str = showdown.subParser('spanGamut')(str, options, globals);
str = str.replace(/^([ \t]*)/g, '<p>');
str += '</p>';
grafsOut.push(str);
}
}
/** Unhashify HTML blocks */
end = grafsOut.length;
for (i = 0; i < end; i++) {
var blockText = '',
grafsOutIt = grafsOut[i],
codeFlag = false;
// if this is a marker for an html block...
// use RegExp.test instead of string.search because of QML bug
while (/¨(K|G)(\d+)\1/.test(grafsOutIt)) {
var delim = RegExp.$1,
num = RegExp.$2;
if (delim === 'K') {
blockText = globals.gHtmlBlocks[num];
} else {
// we need to check if ghBlock is a false positive
if (codeFlag) {
// use encoded version of all text
blockText = showdown.subParser('encodeCode')(globals.ghCodeBlocks[num].text, options, globals);
} else {
blockText = globals.ghCodeBlocks[num].codeblock;
}
}
blockText = blockText.replace(/\$/g, '$$$$'); // Escape any dollar signs
grafsOutIt = grafsOutIt.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/, blockText);
// Check if grafsOutIt is a pre->code
if (/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(grafsOutIt)) {
codeFlag = true;
}
}
grafsOut[i] = grafsOutIt;
}
text = grafsOut.join('\n');
// Strip leading and trailing lines:
text = text.replace(/^\n+/g, '');
text = text.replace(/\n+$/g, '');
return globals.converter._dispatch('paragraphs.after', text, options, globals);
});
/**
* Run extension
*/
showdown.subParser('runExtension', function (ext, text, options, globals) {
'use strict';
if (ext.filter) {
text = ext.filter(text, globals.converter, options);
} else if (ext.regex) {
// TODO remove this when old extension loading mechanism is deprecated
var re = ext.regex;
if (!(re instanceof RegExp)) {
re = new RegExp(re, 'g');
}
text = text.replace(re, ext.replace);
}
return text;
});
/**
* These are all the transformations that occur *within* block-level
* tags like paragraphs, headers, and list items.
*/
showdown.subParser('spanGamut', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('spanGamut.before', text, options, globals);
text = showdown.subParser('codeSpans')(text, options, globals);
text = showdown.subParser('escapeSpecialCharsWithinTagAttributes')(text, options, globals);
text = showdown.subParser('encodeBackslashEscapes')(text, options, globals);
// Process anchor and image tags. Images must come first,
// because ![foo][f] looks like an anchor.
text = showdown.subParser('images')(text, options, globals);
text = showdown.subParser('anchors')(text, options, globals);
// Make links out of things like `<http://example.com/>`
// Must come after anchors, because you can use < and >
// delimiters in inline links like [this](<url>).
text = showdown.subParser('autoLinks')(text, options, globals);
text = showdown.subParser('simplifiedAutoLinks')(text, options, globals);
text = showdown.subParser('emoji')(text, options, globals);
text = showdown.subParser('underline')(text, options, globals);
text = showdown.subParser('italicsAndBold')(text, options, globals);
text = showdown.subParser('strikethrough')(text, options, globals);
text = showdown.subParser('ellipsis')(text, options, globals);
// we need to hash HTML tags inside spans
text = showdown.subParser('hashHTMLSpans')(text, options, globals);
// now we encode amps and angles
text = showdown.subParser('encodeAmpsAndAngles')(text, options, globals);
// Do hard breaks
if (options.simpleLineBreaks) {
// GFM style hard breaks
// only add line breaks if the text does not contain a block (special case for lists)
if (!/\n\n¨K/.test(text)) {
text = text.replace(/\n+/g, '<br />\n');
}
} else {
// Vanilla hard breaks
text = text.replace(/ +\n/g, '<br />\n');
}
text = globals.converter._dispatch('spanGamut.after', text, options, globals);
return text;
});
showdown.subParser('strikethrough', function (text, options, globals) {
'use strict';
function parseInside (txt) {
if (options.simplifiedAutoLink) {
txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
}
return '<del>' + txt + '</del>';
}
if (options.strikethrough) {
text = globals.converter._dispatch('strikethrough.before', text, options, globals);
text = text.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function (wm, txt) { return parseInside(txt); });
text = globals.converter._dispatch('strikethrough.after', text, options, globals);
}
return text;
});
/**
* Strips link definitions from text, stores the URLs and titles in
* hash references.
* Link defs are in the form: ^[id]: url "optional title"
*/
showdown.subParser('stripLinkDefinitions', function (text, options, globals) {
'use strict';
var regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,
base64Regex = /^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm;
// attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
text += '¨0';
var replaceFunc = function (wholeMatch, linkId, url, width, height, blankLines, title) {
linkId = linkId.toLowerCase();
if (url.match(/^data:.+?\/.+?;base64,/)) {
// remove newlines
globals.gUrls[linkId] = url.replace(/\s/g, '');
} else {
globals.gUrls[linkId] = showdown.subParser('encodeAmpsAndAngles')(url, options, globals); // Link IDs are case-insensitive
}
if (blankLines) {
// Oops, found blank lines, so it's not a title.
// Put back the parenthetical statement we stole.
return blankLines + title;
} else {
if (title) {
globals.gTitles[linkId] = title.replace(/"|'/g, '"');
}
if (options.parseImgDimensions && width && height) {
globals.gDimensions[linkId] = {
width: width,
height: height
};
}
}
// Completely remove the definition from the text
return '';
};
// first we try to find base64 link references
text = text.replace(base64Regex, replaceFunc);
text = text.replace(regex, replaceFunc);
// attacklab: strip sentinel
text = text.replace(/¨0/, '');
return text;
});
showdown.subParser('tables', function (text, options, globals) {
'use strict';
if (!options.tables) {
return text;
}
var tableRgx = /^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,
//singeColTblRgx = /^ {0,3}\|.+\|\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n(?: {0,3}\|.+\|\n)+(?:\n\n|¨0)/gm;
singeColTblRgx = /^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm;
function parseStyles (sLine) {
if (/^:[ \t]*--*$/.test(sLine)) {
return ' style="text-align:left;"';
} else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) {
return ' style="text-align:right;"';
} else if (/^:[ \t]*--*[ \t]*:$/.test(sLine)) {
return ' style="text-align:center;"';
} else {
return '';
}
}
function parseHeaders (header, style) {
var id = '';
header = header.trim();
// support both tablesHeaderId and tableHeaderId due to error in documentation so we don't break backwards compatibility
if (options.tablesHeaderId || options.tableHeaderId) {
id = ' id="' + header.replace(/ /g, '_').toLowerCase() + '"';
}
header = showdown.subParser('spanGamut')(header, options, globals);
return '<th' + id + style + '>' + header + '</th>\n';
}
function parseCells (cell, style) {
var subText = showdown.subParser('spanGamut')(cell, options, globals);
return '<td' + style + '>' + subText + '</td>\n';
}
function buildTable (headers, cells) {
var tb = '<table>\n<thead>\n<tr>\n',
tblLgn = headers.length;
for (var i = 0; i < tblLgn; ++i) {
tb += headers[i];
}
tb += '</tr>\n</thead>\n<tbody>\n';
for (i = 0; i < cells.length; ++i) {
tb += '<tr>\n';
for (var ii = 0; ii < tblLgn; ++ii) {
tb += cells[i][ii];
}
tb += '</tr>\n';
}
tb += '</tbody>\n</table>\n';
return tb;
}
function parseTable (rawTable) {
var i, tableLines = rawTable.split('\n');
for (i = 0; i < tableLines.length; ++i) {
// strip wrong first and last column if wrapped tables are used
if (/^ {0,3}\|/.test(tableLines[i])) {
tableLines[i] = tableLines[i].replace(/^ {0,3}\|/, '');
}
if (/\|[ \t]*$/.test(tableLines[i])) {
tableLines[i] = tableLines[i].replace(/\|[ \t]*$/, '');
}
// parse code spans first, but we only support one line code spans
tableLines[i] = showdown.subParser('codeSpans')(tableLines[i], options, globals);
}
var rawHeaders = tableLines[0].split('|').map(function (s) { return s.trim();}),
rawStyles = tableLines[1].split('|').map(function (s) { return s.trim();}),
rawCells = [],
headers = [],
styles = [],
cells = [];
tableLines.shift();
tableLines.shift();
for (i = 0; i < tableLines.length; ++i) {
if (tableLines[i].trim() === '') {
continue;
}
rawCells.push(
tableLines[i]
.split('|')
.map(function (s) {
return s.trim();
})
);
}
if (rawHeaders.length < rawStyles.length) {
return rawTable;
}
for (i = 0; i < rawStyles.length; ++i) {
styles.push(parseStyles(rawStyles[i]));
}
for (i = 0; i < rawHeaders.length; ++i) {
if (showdown.helper.isUndefined(styles[i])) {
styles[i] = '';
}
headers.push(parseHeaders(rawHeaders[i], styles[i]));
}
for (i = 0; i < rawCells.length; ++i) {
var row = [];
for (var ii = 0; ii < headers.length; ++ii) {
if (showdown.helper.isUndefined(rawCells[i][ii])) {
}
row.push(parseCells(rawCells[i][ii], styles[ii]));
}
cells.push(row);
}
return buildTable(headers, cells);
}
text = globals.converter._dispatch('tables.before', text, options, globals);
// find escaped pipe characters
text = text.replace(/\\(\|)/g, showdown.helper.escapeCharactersCallback);
// parse multi column tables
text = text.replace(tableRgx, parseTable);
// parse one column tables
text = text.replace(singeColTblRgx, parseTable);
text = globals.converter._dispatch('tables.after', text, options, globals);
return text;
});
showdown.subParser('underline', function (text, options, globals) {
'use strict';
if (!options.underline) {
return text;
}
text = globals.converter._dispatch('underline.before', text, options, globals);
if (options.literalMidWordUnderscores) {
text = text.replace(/\b___(\S[\s\S]*?)___\b/g, function (wm, txt) {
return '<u>' + txt + '</u>';
});
text = text.replace(/\b__(\S[\s\S]*?)__\b/g, function (wm, txt) {
return '<u>' + txt + '</u>';
});
} else {
text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) {
return (/\S$/.test(m)) ? '<u>' + m + '</u>' : wm;
});
text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) {
return (/\S$/.test(m)) ? '<u>' + m + '</u>' : wm;
});
}
// escape remaining underscores to prevent them being parsed by italic and bold
text = text.replace(/(_)/g, showdown.helper.escapeCharactersCallback);
text = globals.converter._dispatch('underline.after', text, options, globals);
return text;
});
/**
* Swap back in all the special characters we've hidden.
*/
showdown.subParser('unescapeSpecialChars', function (text, options, globals) {
'use strict';
text = globals.converter._dispatch('unescapeSpecialChars.before', text, options, globals);
text = text.replace(/¨E(\d+)E/g, function (wholeMatch, m1) {
var charCodeToReplace = parseInt(m1);
return String.fromCharCode(charCodeToReplace);
});
text = globals.converter._dispatch('unescapeSpecialChars.after', text, options, globals);
return text;
});
showdown.subParser('makeMarkdown.blockquote', function (node, globals) {
'use strict';
var txt = '';
if (node.hasChildNodes()) {
var children = node.childNodes,
childrenLength = children.length;
for (var i = 0; i < childrenLength; ++i) {
var innerTxt = showdown.subParser('makeMarkdown.node')(children[i], globals);
if (innerTxt === '') {
continue;
}
txt += innerTxt;
}
}
// cleanup
txt = txt.trim();
txt = '> ' + txt.split('\n').join('\n> ');
return txt;
});
showdown.subParser('makeMarkdown.codeBlock', function (node, globals) {
'use strict';
var lang = node.getAttribute('language'),
num = node.getAttribute('precodenum');
return '```' + lang + '\n' + globals.preList[num] + '\n```';
});
showdown.subParser('makeMarkdown.codeSpan', function (node) {
'use strict';
return '`' + node.innerHTML + '`';
});
showdown.subParser('makeMarkdown.emphasis', function (node, globals) {
'use strict';
var txt = '';
if (node.hasChildNodes()) {
txt += '*';
var children = node.childNodes,
childrenLength = children.length;
for (var i = 0; i < childrenLength; ++i) {
txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
}
txt += '*';
}
return txt;
});
showdown.subParser('makeMarkdown.header', function (node, globals, headerLevel) {
'use strict';
var headerMark = new Array(headerLevel + 1).join('#'),
txt = '';
if (node.hasChildNodes()) {
txt = headerMark + ' ';
var children = node.childNodes,
childrenLength = children.length;
for (var i = 0; i < childrenLength; ++i) {
txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
}
}
return txt;
});
showdown.subParser('makeMarkdown.hr', function () {
'use strict';
return '---';
});
showdown.subParser('makeMarkdown.image', function (node) {
'use strict';
var txt = '';
if (node.hasAttribute('src')) {
txt += ' + '>';
if (node.hasAttribute('width') && node.hasAttribute('height')) {
txt += ' =' + node.getAttribute('width') + 'x' + node.getAttribute('height');
}
if (node.hasAttribute('title')) {
txt += ' "' + node.getAttribute('title') + '"';
}
txt += ')';
}
return txt;
});
showdown.subParser('makeMarkdown.links', function (node, globals) {
'use strict';
var txt = '';
if (node.hasChildNodes() && node.hasAttribute('href')) {
var children = node.childNodes,
childrenLength = children.length;
txt = '[';
for (var i = 0; i < childrenLength; ++i) {
txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
}
txt += '](';
txt += '<' + node.getAttribute('href') + '>';
if (node.hasAttribute('title')) {
txt += ' "' + node.getAttribute('title') + '"';
}
txt += ')';
}
return txt;
});
showdown.subParser('makeMarkdown.list', function (node, globals, type) {
'use strict';
var txt = '';
if (!node.hasChildNodes()) {
return '';
}
var listItems = node.childNodes,
listItemsLenght = listItems.length,
listNum = node.getAttribute('start') || 1;
for (var i = 0; i < listItemsLenght; ++i) {
if (typeof listItems[i].tagName === 'undefined' || listItems[i].tagName.toLowerCase() !== 'li') {
continue;
}
// define the bullet to use in list
var bullet = '';
if (type === 'ol') {
bullet = listNum.toString() + '. ';
} else {
bullet = '- ';
}
// parse list item
txt += bullet + showdown.subParser('makeMarkdown.listItem')(listItems[i], globals);
++listNum;
}
// add comment at the end to prevent consecutive lists to be parsed as one
txt += '\n<!-- -->\n';
return txt.trim();
});
showdown.subParser('makeMarkdown.listItem', function (node, globals) {
'use strict';
var listItemTxt = '';
var children = node.childNodes,
childrenLenght = children.length;
for (var i = 0; i < childrenLenght; ++i) {
listItemTxt += showdown.subParser('makeMarkdown.node')(children[i], globals);
}
// if it's only one liner, we need to add a newline at the end
if (!/\n$/.test(listItemTxt)) {
listItemTxt += '\n';
} else {
// it's multiparagraph, so we need to indent
listItemTxt = listItemTxt
.split('\n')
.join('\n ')
.replace(/^ {4}$/gm, '')
.replace(/\n\n+/g, '\n\n');
}
return listItemTxt;
});
showdown.subParser('makeMarkdown.node', function (node, globals, spansOnly) {
'use strict';
spansOnly = spansOnly || false;
var txt = '';
// edge case of text without wrapper paragraph
if (node.nodeType === 3) {
return showdown.subParser('makeMarkdown.txt')(node, globals);
}
// HTML comment
if (node.nodeType === 8) {
return '<!--' + node.data + '-->\n\n';
}
// process only node elements
if (node.nodeType !== 1) {
return '';
}
var tagName = node.tagName.toLowerCase();
switch (tagName) {
//
// BLOCKS
//
case 'h1':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 1) + '\n\n'; }
break;
case 'h2':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 2) + '\n\n'; }
break;
case 'h3':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 3) + '\n\n'; }
break;
case 'h4':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 4) + '\n\n'; }
break;
case 'h5':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 5) + '\n\n'; }
break;
case 'h6':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.header')(node, globals, 6) + '\n\n'; }
break;
case 'p':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.paragraph')(node, globals) + '\n\n'; }
break;
case 'blockquote':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.blockquote')(node, globals) + '\n\n'; }
break;
case 'hr':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.hr')(node, globals) + '\n\n'; }
break;
case 'ol':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.list')(node, globals, 'ol') + '\n\n'; }
break;
case 'ul':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.list')(node, globals, 'ul') + '\n\n'; }
break;
case 'precode':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.codeBlock')(node, globals) + '\n\n'; }
break;
case 'pre':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.pre')(node, globals) + '\n\n'; }
break;
case 'table':
if (!spansOnly) { txt = showdown.subParser('makeMarkdown.table')(node, globals) + '\n\n'; }
break;
//
// SPANS
//
case 'code':
txt = showdown.subParser('makeMarkdown.codeSpan')(node, globals);
break;
case 'em':
case 'i':
txt = showdown.subParser('makeMarkdown.emphasis')(node, globals);
break;
case 'strong':
case 'b':
txt = showdown.subParser('makeMarkdown.strong')(node, globals);
break;
case 'del':
txt = showdown.subParser('makeMarkdown.strikethrough')(node, globals);
break;
case 'a':
txt = showdown.subParser('makeMarkdown.links')(node, globals);
break;
case 'img':
txt = showdown.subParser('makeMarkdown.image')(node, globals);
break;
default:
txt = node.outerHTML + '\n\n';
}
// common normalization
// TODO eventually
return txt;
});
showdown.subParser('makeMarkdown.paragraph', function (node, globals) {
'use strict';
var txt = '';
if (node.hasChildNodes()) {
var children = node.childNodes,
childrenLength = children.length;
for (var i = 0; i < childrenLength; ++i) {
txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
}
}
// some text normalization
txt = txt.trim();
return txt;
});
showdown.subParser('makeMarkdown.pre', function (node, globals) {
'use strict';
var num = node.getAttribute('prenum');
return '<pre>' + globals.preList[num] + '</pre>';
});
showdown.subParser('makeMarkdown.strikethrough', function (node, globals) {
'use strict';
var txt = '';
if (node.hasChildNodes()) {
txt += '~~';
var children = node.childNodes,
childrenLength = children.length;
for (var i = 0; i < childrenLength; ++i) {
txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
}
txt += '~~';
}
return txt;
});
showdown.subParser('makeMarkdown.strong', function (node, globals) {
'use strict';
var txt = '';
if (node.hasChildNodes()) {
txt += '**';
var children = node.childNodes,
childrenLength = children.length;
for (var i = 0; i < childrenLength; ++i) {
txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
}
txt += '**';
}
return txt;
});
showdown.subParser('makeMarkdown.table', function (node, globals) {
'use strict';
var txt = '',
tableArray = [[], []],
headings = node.querySelectorAll('thead>tr>th'),
rows = node.querySelectorAll('tbody>tr'),
i, ii;
for (i = 0; i < headings.length; ++i) {
var headContent = showdown.subParser('makeMarkdown.tableCell')(headings[i], globals),
allign = '---';
if (headings[i].hasAttribute('style')) {
var style = headings[i].getAttribute('style').toLowerCase().replace(/\s/g, '');
switch (style) {
case 'text-align:left;':
allign = ':---';
break;
case 'text-align:right;':
allign = '---:';
break;
case 'text-align:center;':
allign = ':---:';
break;
}
}
tableArray[0][i] = headContent.trim();
tableArray[1][i] = allign;
}
for (i = 0; i < rows.length; ++i) {
var r = tableArray.push([]) - 1,
cols = rows[i].getElementsByTagName('td');
for (ii = 0; ii < headings.length; ++ii) {
var cellContent = ' ';
if (typeof cols[ii] !== 'undefined') {
cellContent = showdown.subParser('makeMarkdown.tableCell')(cols[ii], globals);
}
tableArray[r].push(cellContent);
}
}
var cellSpacesCount = 3;
for (i = 0; i < tableArray.length; ++i) {
for (ii = 0; ii < tableArray[i].length; ++ii) {
var strLen = tableArray[i][ii].length;
if (strLen > cellSpacesCount) {
cellSpacesCount = strLen;
}
}
}
for (i = 0; i < tableArray.length; ++i) {
for (ii = 0; ii < tableArray[i].length; ++ii) {
if (i === 1) {
if (tableArray[i][ii].slice(-1) === ':') {
tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii].slice(-1), cellSpacesCount - 1, '-') + ':';
} else {
tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii], cellSpacesCount, '-');
}
} else {
tableArray[i][ii] = showdown.helper.padEnd(tableArray[i][ii], cellSpacesCount);
}
}
txt += '| ' + tableArray[i].join(' | ') + ' |\n';
}
return txt.trim();
});
showdown.subParser('makeMarkdown.tableCell', function (node, globals) {
'use strict';
var txt = '';
if (!node.hasChildNodes()) {
return '';
}
var children = node.childNodes,
childrenLength = children.length;
for (var i = 0; i < childrenLength; ++i) {
txt += showdown.subParser('makeMarkdown.node')(children[i], globals, true);
}
return txt.trim();
});
showdown.subParser('makeMarkdown.txt', function (node) {
'use strict';
var txt = node.nodeValue;
// multiple spaces are collapsed
txt = txt.replace(/ +/g, ' ');
// replace the custom ¨NBSP; with a space
txt = txt.replace(/¨NBSP;/g, ' ');
// ", <, > and & should replace escaped html entities
txt = showdown.helper.unescapeHTMLEntities(txt);
// escape markdown magic characters
// emphasis, strong and strikethrough - can appear everywhere
// we also escape pipe (|) because of tables
// and escape ` because of code blocks and spans
txt = txt.replace(/([*_~|`])/g, '\\$1');
// escape > because of blockquotes
txt = txt.replace(/^(\s*)>/g, '\\$1>');
// hash character, only troublesome at the beginning of a line because of headers
txt = txt.replace(/^#/gm, '\\#');
// horizontal rules
txt = txt.replace(/^(\s*)([-=]{3,})(\s*)$/, '$1\\$2$3');
// dot, because of ordered lists, only troublesome at the beginning of a line when preceded by an integer
txt = txt.replace(/^( {0,3}\d+)\./gm, '$1\\.');
// +, * and -, at the beginning of a line becomes a list, so we need to escape them also (asterisk was already escaped)
txt = txt.replace(/^( {0,3})([+-])/gm, '$1\\$2');
// images and links, ] followed by ( is problematic, so we escape it
txt = txt.replace(/]([\s]*)\(/g, '\\]$1\\(');
// reference URIs must also be escaped
txt = txt.replace(/^ {0,3}\[([\S \t]*?)]:/gm, '\\[$1]:');
return txt;
});
var root = this;
// AMD Loader
if (true) {
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
'use strict';
return showdown;
}).call(exports, __webpack_require__, exports, module),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
// CommonJS/nodeJS Loader
} else {}
}).call(this);
/***/ })
/******/ });
/************************************************************************/
/******/ // 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 */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (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 */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (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.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
__EXPERIMENTAL_ELEMENTS: () => (/* reexport */ __EXPERIMENTAL_ELEMENTS),
__EXPERIMENTAL_PATHS_WITH_OVERRIDE: () => (/* reexport */ __EXPERIMENTAL_PATHS_WITH_OVERRIDE),
__EXPERIMENTAL_STYLE_PROPERTY: () => (/* reexport */ __EXPERIMENTAL_STYLE_PROPERTY),
__experimentalCloneSanitizedBlock: () => (/* reexport */ __experimentalCloneSanitizedBlock),
__experimentalGetAccessibleBlockLabel: () => (/* reexport */ getAccessibleBlockLabel),
__experimentalGetBlockAttributesNamesByRole: () => (/* reexport */ __experimentalGetBlockAttributesNamesByRole),
__experimentalGetBlockLabel: () => (/* reexport */ getBlockLabel),
__experimentalSanitizeBlockAttributes: () => (/* reexport */ __experimentalSanitizeBlockAttributes),
__unstableGetBlockProps: () => (/* reexport */ getBlockProps),
__unstableGetInnerBlocksProps: () => (/* reexport */ getInnerBlocksProps),
__unstableSerializeAndClean: () => (/* reexport */ __unstableSerializeAndClean),
children: () => (/* reexport */ children),
cloneBlock: () => (/* reexport */ cloneBlock),
createBlock: () => (/* reexport */ createBlock),
createBlocksFromInnerBlocksTemplate: () => (/* reexport */ createBlocksFromInnerBlocksTemplate),
doBlocksMatchTemplate: () => (/* reexport */ doBlocksMatchTemplate),
findTransform: () => (/* reexport */ findTransform),
getBlockAttributes: () => (/* reexport */ getBlockAttributes),
getBlockContent: () => (/* reexport */ getBlockInnerHTML),
getBlockDefaultClassName: () => (/* reexport */ getBlockDefaultClassName),
getBlockFromExample: () => (/* reexport */ getBlockFromExample),
getBlockMenuDefaultClassName: () => (/* reexport */ getBlockMenuDefaultClassName),
getBlockSupport: () => (/* reexport */ getBlockSupport),
getBlockTransforms: () => (/* reexport */ getBlockTransforms),
getBlockType: () => (/* reexport */ getBlockType),
getBlockTypes: () => (/* reexport */ getBlockTypes),
getBlockVariations: () => (/* reexport */ getBlockVariations),
getCategories: () => (/* reexport */ categories_getCategories),
getChildBlockNames: () => (/* reexport */ getChildBlockNames),
getDefaultBlockName: () => (/* reexport */ getDefaultBlockName),
getFreeformContentHandlerName: () => (/* reexport */ getFreeformContentHandlerName),
getGroupingBlockName: () => (/* reexport */ getGroupingBlockName),
getPhrasingContentSchema: () => (/* reexport */ deprecatedGetPhrasingContentSchema),
getPossibleBlockTransformations: () => (/* reexport */ getPossibleBlockTransformations),
getSaveContent: () => (/* reexport */ getSaveContent),
getSaveElement: () => (/* reexport */ getSaveElement),
getUnregisteredTypeHandlerName: () => (/* reexport */ getUnregisteredTypeHandlerName),
hasBlockSupport: () => (/* reexport */ hasBlockSupport),
hasChildBlocks: () => (/* reexport */ hasChildBlocks),
hasChildBlocksWithInserterSupport: () => (/* reexport */ hasChildBlocksWithInserterSupport),
isReusableBlock: () => (/* reexport */ isReusableBlock),
isTemplatePart: () => (/* reexport */ isTemplatePart),
isUnmodifiedBlock: () => (/* reexport */ isUnmodifiedBlock),
isUnmodifiedDefaultBlock: () => (/* reexport */ isUnmodifiedDefaultBlock),
isValidBlockContent: () => (/* reexport */ isValidBlockContent),
isValidIcon: () => (/* reexport */ isValidIcon),
node: () => (/* reexport */ node),
normalizeIconObject: () => (/* reexport */ normalizeIconObject),
parse: () => (/* reexport */ parser_parse),
parseWithAttributeSchema: () => (/* reexport */ parseWithAttributeSchema),
pasteHandler: () => (/* reexport */ pasteHandler),
rawHandler: () => (/* reexport */ rawHandler),
registerBlockCollection: () => (/* reexport */ registerBlockCollection),
registerBlockStyle: () => (/* reexport */ registerBlockStyle),
registerBlockType: () => (/* reexport */ registerBlockType),
registerBlockVariation: () => (/* reexport */ registerBlockVariation),
serialize: () => (/* reexport */ serialize),
serializeRawBlock: () => (/* reexport */ serializeRawBlock),
setCategories: () => (/* reexport */ categories_setCategories),
setDefaultBlockName: () => (/* reexport */ setDefaultBlockName),
setFreeformContentHandlerName: () => (/* reexport */ setFreeformContentHandlerName),
setGroupingBlockName: () => (/* reexport */ setGroupingBlockName),
setUnregisteredTypeHandlerName: () => (/* reexport */ setUnregisteredTypeHandlerName),
store: () => (/* reexport */ store),
switchToBlockType: () => (/* reexport */ switchToBlockType),
synchronizeBlocksWithTemplate: () => (/* reexport */ synchronizeBlocksWithTemplate),
unregisterBlockStyle: () => (/* reexport */ unregisterBlockStyle),
unregisterBlockType: () => (/* reexport */ unregisterBlockType),
unregisterBlockVariation: () => (/* reexport */ unregisterBlockVariation),
unstable__bootstrapServerSideBlockDefinitions: () => (/* reexport */ unstable__bootstrapServerSideBlockDefinitions),
updateCategory: () => (/* reexport */ categories_updateCategory),
validateBlock: () => (/* reexport */ validateBlock),
withBlockContentContext: () => (/* reexport */ withBlockContentContext)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/selectors.js
var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject);
__webpack_require__.d(selectors_namespaceObject, {
__experimentalHasContentRoleAttribute: () => (__experimentalHasContentRoleAttribute),
getActiveBlockVariation: () => (getActiveBlockVariation),
getBlockStyles: () => (getBlockStyles),
getBlockSupport: () => (selectors_getBlockSupport),
getBlockType: () => (selectors_getBlockType),
getBlockTypes: () => (selectors_getBlockTypes),
getBlockVariations: () => (selectors_getBlockVariations),
getCategories: () => (getCategories),
getChildBlockNames: () => (selectors_getChildBlockNames),
getCollections: () => (getCollections),
getDefaultBlockName: () => (selectors_getDefaultBlockName),
getDefaultBlockVariation: () => (getDefaultBlockVariation),
getFreeformFallbackBlockName: () => (getFreeformFallbackBlockName),
getGroupingBlockName: () => (selectors_getGroupingBlockName),
getUnregisteredFallbackBlockName: () => (getUnregisteredFallbackBlockName),
hasBlockSupport: () => (selectors_hasBlockSupport),
hasChildBlocks: () => (selectors_hasChildBlocks),
hasChildBlocksWithInserterSupport: () => (selectors_hasChildBlocksWithInserterSupport),
isMatchingSearchTerm: () => (isMatchingSearchTerm)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/private-selectors.js
var private_selectors_namespaceObject = {};
__webpack_require__.r(private_selectors_namespaceObject);
__webpack_require__.d(private_selectors_namespaceObject, {
getAllBlockBindingsSources: () => (getAllBlockBindingsSources),
getBlockBindingsSource: () => (getBlockBindingsSource),
getBootstrappedBlockType: () => (getBootstrappedBlockType),
getSupportedStyles: () => (getSupportedStyles),
getUnprocessedBlockTypes: () => (getUnprocessedBlockTypes)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/actions.js
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, {
__experimentalReapplyBlockFilters: () => (__experimentalReapplyBlockFilters),
addBlockCollection: () => (addBlockCollection),
addBlockStyles: () => (addBlockStyles),
addBlockTypes: () => (addBlockTypes),
addBlockVariations: () => (addBlockVariations),
reapplyBlockTypeFilters: () => (reapplyBlockTypeFilters),
removeBlockCollection: () => (removeBlockCollection),
removeBlockStyles: () => (removeBlockStyles),
removeBlockTypes: () => (removeBlockTypes),
removeBlockVariations: () => (removeBlockVariations),
setCategories: () => (setCategories),
setDefaultBlockName: () => (actions_setDefaultBlockName),
setFreeformFallbackBlockName: () => (setFreeformFallbackBlockName),
setGroupingBlockName: () => (actions_setGroupingBlockName),
setUnregisteredFallbackBlockName: () => (setUnregisteredFallbackBlockName),
updateCategory: () => (updateCategory)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/blocks/build-module/store/private-actions.js
var private_actions_namespaceObject = {};
__webpack_require__.r(private_actions_namespaceObject);
__webpack_require__.d(private_actions_namespaceObject, {
addBootstrappedBlockType: () => (addBootstrappedBlockType),
addUnprocessedBlockType: () => (addUnprocessedBlockType),
registerBlockBindingsSource: () => (registerBlockBindingsSource)
});
;// CONCATENATED MODULE: external ["wp","data"]
const external_wp_data_namespaceObject = window["wp"]["data"];
;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
/******************************************************************************
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, SuppressedError, Symbol */
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) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
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 __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
};
function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
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 (g && (g = 0, op[0] && (_ = 0)), _) 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;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (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;
}
/** @deprecated */
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
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 __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
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: false } : 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, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
function next() {
while (env.stack.length) {
var rec = env.stack.pop();
try {
var result = rec.dispose && rec.dispose.call(rec.value);
if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
catch (e) {
fail(e);
}
}
if (env.hasError) throw env.error;
}
return next();
}
/* harmony default export */ const tslib_es6 = ({
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__createBinding,
__exportStar,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
});
;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
/**
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
*/
var SUPPORTED_LOCALE = {
tr: {
regexp: /\u0130|\u0049|\u0049\u0307/g,
map: {
İ: "\u0069",
I: "\u0131",
İ: "\u0069",
},
},
az: {
regexp: /\u0130/g,
map: {
İ: "\u0069",
I: "\u0131",
İ: "\u0069",
},
},
lt: {
regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
map: {
I: "\u0069\u0307",
J: "\u006A\u0307",
Į: "\u012F\u0307",
Ì: "\u0069\u0307\u0300",
Í: "\u0069\u0307\u0301",
Ĩ: "\u0069\u0307\u0303",
},
},
};
/**
* Localized lower case.
*/
function localeLowerCase(str, locale) {
var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
if (lang)
return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
return lowerCase(str);
}
/**
* Lower case as a function.
*/
function lowerCase(str) {
return str.toLowerCase();
}
;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
// Remove all non-word characters.
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
/**
* Normalize the string into something other libraries can manipulate easier.
*/
function noCase(input, options) {
if (options === void 0) { options = {}; }
var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
var start = 0;
var end = result.length;
// Trim the delimiter from around the output string.
while (result.charAt(start) === "\0")
start++;
while (result.charAt(end - 1) === "\0")
end--;
// Transform each token independently.
return result.slice(start, end).split("\0").map(transform).join(delimiter);
}
/**
* Replace `re` in the input string with the replacement value.
*/
function replace(input, re, value) {
if (re instanceof RegExp)
return input.replace(re, value);
return re.reduce(function (input, re) { return input.replace(re, value); }, input);
}
;// CONCATENATED MODULE: ./node_modules/pascal-case/dist.es2015/index.js
function pascalCaseTransform(input, index) {
var firstChar = input.charAt(0);
var lowerChars = input.substr(1).toLowerCase();
if (index > 0 && firstChar >= "0" && firstChar <= "9") {
return "_" + firstChar + lowerChars;
}
return "" + firstChar.toUpperCase() + lowerChars;
}
function dist_es2015_pascalCaseTransformMerge(input) {
return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();
}
function pascalCase(input, options) {
if (options === void 0) { options = {}; }
return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options));
}
;// CONCATENATED MODULE: ./node_modules/camel-case/dist.es2015/index.js
function camelCaseTransform(input, index) {
if (index === 0)
return input.toLowerCase();
return pascalCaseTransform(input, index);
}
function camelCaseTransformMerge(input, index) {
if (index === 0)
return input.toLowerCase();
return pascalCaseTransformMerge(input);
}
function camelCase(input, options) {
if (options === void 0) { options = {}; }
return pascalCase(input, __assign({ transform: camelCaseTransform }, options));
}
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// 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<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.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));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])}
;// CONCATENATED MODULE: ./node_modules/colord/plugins/a11y.mjs
var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(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}}
;// CONCATENATED MODULE: external ["wp","element"]
const external_wp_element_namespaceObject = window["wp"]["element"];
;// CONCATENATED MODULE: external ["wp","dom"]
const external_wp_dom_namespaceObject = window["wp"]["dom"];
;// CONCATENATED MODULE: external ["wp","richText"]
const external_wp_richText_namespaceObject = window["wp"]["richText"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/constants.js
const BLOCK_ICON_DEFAULT = 'block-default';
/**
* Array of valid keys in a block type settings deprecation object.
*
* @type {string[]}
*/
const DEPRECATED_ENTRY_KEYS = ['attributes', 'supports', 'save', 'migrate', 'isEligible', 'apiVersion'];
const __EXPERIMENTAL_STYLE_PROPERTY = {
// Kept for back-compatibility purposes.
'--wp--style--color--link': {
value: ['color', 'link'],
support: ['color', 'link']
},
aspectRatio: {
value: ['dimensions', 'aspectRatio'],
support: ['dimensions', 'aspectRatio'],
useEngine: true
},
background: {
value: ['color', 'gradient'],
support: ['color', 'gradients'],
useEngine: true
},
backgroundColor: {
value: ['color', 'background'],
support: ['color', 'background'],
requiresOptOut: true,
useEngine: true
},
backgroundRepeat: {
value: ['background', 'backgroundRepeat'],
support: ['background', 'backgroundRepeat'],
useEngine: true
},
backgroundSize: {
value: ['background', 'backgroundSize'],
support: ['background', 'backgroundSize'],
useEngine: true
},
borderColor: {
value: ['border', 'color'],
support: ['__experimentalBorder', 'color'],
useEngine: true
},
borderRadius: {
value: ['border', 'radius'],
support: ['__experimentalBorder', 'radius'],
properties: {
borderTopLeftRadius: 'topLeft',
borderTopRightRadius: 'topRight',
borderBottomLeftRadius: 'bottomLeft',
borderBottomRightRadius: 'bottomRight'
},
useEngine: true
},
borderStyle: {
value: ['border', 'style'],
support: ['__experimentalBorder', 'style'],
useEngine: true
},
borderWidth: {
value: ['border', 'width'],
support: ['__experimentalBorder', 'width'],
useEngine: true
},
borderTopColor: {
value: ['border', 'top', 'color'],
support: ['__experimentalBorder', 'color'],
useEngine: true
},
borderTopStyle: {
value: ['border', 'top', 'style'],
support: ['__experimentalBorder', 'style'],
useEngine: true
},
borderTopWidth: {
value: ['border', 'top', 'width'],
support: ['__experimentalBorder', 'width'],
useEngine: true
},
borderRightColor: {
value: ['border', 'right', 'color'],
support: ['__experimentalBorder', 'color'],
useEngine: true
},
borderRightStyle: {
value: ['border', 'right', 'style'],
support: ['__experimentalBorder', 'style'],
useEngine: true
},
borderRightWidth: {
value: ['border', 'right', 'width'],
support: ['__experimentalBorder', 'width'],
useEngine: true
},
borderBottomColor: {
value: ['border', 'bottom', 'color'],
support: ['__experimentalBorder', 'color'],
useEngine: true
},
borderBottomStyle: {
value: ['border', 'bottom', 'style'],
support: ['__experimentalBorder', 'style'],
useEngine: true
},
borderBottomWidth: {
value: ['border', 'bottom', 'width'],
support: ['__experimentalBorder', 'width'],
useEngine: true
},
borderLeftColor: {
value: ['border', 'left', 'color'],
support: ['__experimentalBorder', 'color'],
useEngine: true
},
borderLeftStyle: {
value: ['border', 'left', 'style'],
support: ['__experimentalBorder', 'style'],
useEngine: true
},
borderLeftWidth: {
value: ['border', 'left', 'width'],
support: ['__experimentalBorder', 'width'],
useEngine: true
},
color: {
value: ['color', 'text'],
support: ['color', 'text'],
requiresOptOut: true,
useEngine: true
},
columnCount: {
value: ['typography', 'textColumns'],
support: ['typography', 'textColumns'],
useEngine: true
},
filter: {
value: ['filter', 'duotone'],
support: ['filter', 'duotone']
},
linkColor: {
value: ['elements', 'link', 'color', 'text'],
support: ['color', 'link']
},
captionColor: {
value: ['elements', 'caption', 'color', 'text'],
support: ['color', 'caption']
},
buttonColor: {
value: ['elements', 'button', 'color', 'text'],
support: ['color', 'button']
},
buttonBackgroundColor: {
value: ['elements', 'button', 'color', 'background'],
support: ['color', 'button']
},
headingColor: {
value: ['elements', 'heading', 'color', 'text'],
support: ['color', 'heading']
},
headingBackgroundColor: {
value: ['elements', 'heading', 'color', 'background'],
support: ['color', 'heading']
},
fontFamily: {
value: ['typography', 'fontFamily'],
support: ['typography', '__experimentalFontFamily'],
useEngine: true
},
fontSize: {
value: ['typography', 'fontSize'],
support: ['typography', 'fontSize'],
useEngine: true
},
fontStyle: {
value: ['typography', 'fontStyle'],
support: ['typography', '__experimentalFontStyle'],
useEngine: true
},
fontWeight: {
value: ['typography', 'fontWeight'],
support: ['typography', '__experimentalFontWeight'],
useEngine: true
},
lineHeight: {
value: ['typography', 'lineHeight'],
support: ['typography', 'lineHeight'],
useEngine: true
},
margin: {
value: ['spacing', 'margin'],
support: ['spacing', 'margin'],
properties: {
marginTop: 'top',
marginRight: 'right',
marginBottom: 'bottom',
marginLeft: 'left'
},
useEngine: true
},
minHeight: {
value: ['dimensions', 'minHeight'],
support: ['dimensions', 'minHeight'],
useEngine: true
},
padding: {
value: ['spacing', 'padding'],
support: ['spacing', 'padding'],
properties: {
paddingTop: 'top',
paddingRight: 'right',
paddingBottom: 'bottom',
paddingLeft: 'left'
},
useEngine: true
},
textDecoration: {
value: ['typography', 'textDecoration'],
support: ['typography', '__experimentalTextDecoration'],
useEngine: true
},
textTransform: {
value: ['typography', 'textTransform'],
support: ['typography', '__experimentalTextTransform'],
useEngine: true
},
letterSpacing: {
value: ['typography', 'letterSpacing'],
support: ['typography', '__experimentalLetterSpacing'],
useEngine: true
},
writingMode: {
value: ['typography', 'writingMode'],
support: ['typography', '__experimentalWritingMode'],
useEngine: true
},
'--wp--style--root--padding': {
value: ['spacing', 'padding'],
support: ['spacing', 'padding'],
properties: {
'--wp--style--root--padding-top': 'top',
'--wp--style--root--padding-right': 'right',
'--wp--style--root--padding-bottom': 'bottom',
'--wp--style--root--padding-left': 'left'
},
rootOnly: true
}
};
const __EXPERIMENTAL_ELEMENTS = {
link: 'a',
heading: 'h1, h2, h3, h4, h5, h6',
h1: 'h1',
h2: 'h2',
h3: 'h3',
h4: 'h4',
h5: 'h5',
h6: 'h6',
button: '.wp-element-button, .wp-block-button__link',
caption: '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption',
cite: 'cite'
};
// These paths may have three origins, custom, theme, and default,
// and are expected to override other origins with custom, theme,
// and default priority.
const __EXPERIMENTAL_PATHS_WITH_OVERRIDE = {
'color.duotone': true,
'color.gradients': true,
'color.palette': true,
'typography.fontSizes': true,
'spacing.spacingSizes': true
};
;// CONCATENATED MODULE: external ["wp","privateApis"]
const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/lock-unlock.js
/**
* WordPress dependencies
*/
const {
lock,
unlock
} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/blocks');
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/registration.js
/* eslint no-console: [ 'error', { allow: [ 'error', 'warn' ] } ] */
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const i18nBlockSchema = {
title: "block title",
description: "block description",
keywords: ["block keyword"],
styles: [{
label: "block style label"
}],
variations: [{
title: "block variation title",
description: "block variation description",
keywords: ["block variation keyword"]
}]
};
/**
* An icon type definition. One of a Dashicon slug, an element,
* or a component.
*
* @typedef {(string|Element|Component)} WPIcon
*
* @see https://developer.wordpress.org/resource/dashicons/
*/
/**
* Render behavior of a block type icon; one of a Dashicon slug, an element,
* or a component.
*
* @typedef {WPIcon} WPBlockTypeIconRender
*/
/**
* An object describing a normalized block type icon.
*
* @typedef {Object} WPBlockTypeIconDescriptor
*
* @property {WPBlockTypeIconRender} src Render behavior of the icon,
* one of a Dashicon slug, an
* element, or a component.
* @property {string} background Optimal background hex string
* color when displaying icon.
* @property {string} foreground Optimal foreground hex string
* color when displaying icon.
* @property {string} shadowColor Optimal shadow hex string
* color when displaying icon.
*/
/**
* Value to use to render the icon for a block type in an editor interface,
* either a Dashicon slug, an element, a component, or an object describing
* the icon.
*
* @typedef {(WPBlockTypeIconDescriptor|WPBlockTypeIconRender)} WPBlockTypeIcon
*/
/**
* Named block variation scopes.
*
* @typedef {'block'|'inserter'|'transform'} WPBlockVariationScope
*/
/**
* An object describing a variation defined for the block type.
*
* @typedef {Object} WPBlockVariation
*
* @property {string} name The unique and machine-readable name.
* @property {string} title A human-readable variation title.
* @property {string} [description] A detailed variation description.
* @property {string} [category] Block type category classification,
* used in search interfaces to arrange
* block types by category.
* @property {WPIcon} [icon] An icon helping to visualize the variation.
* @property {boolean} [isDefault] Indicates whether the current variation is
* the default one. Defaults to `false`.
* @property {Object} [attributes] Values which override block attributes.
* @property {Array[]} [innerBlocks] Initial configuration of nested blocks.
* @property {Object} [example] Example provides structured data for
* the block preview. You can set to
* `undefined` to disable the preview shown
* for the block type.
* @property {WPBlockVariationScope[]} [scope] The list of scopes where the variation
* is applicable. When not provided, it
* assumes all available scopes.
* @property {string[]} [keywords] An array of terms (which can be translated)
* that help users discover the variation
* while searching.
* @property {Function|string[]} [isActive] This can be a function or an array of block attributes.
* Function that accepts a block's attributes and the
* variation's attributes and determines if a variation is active.
* This function doesn't try to find a match dynamically based
* on all block's attributes, as in many cases some attributes are irrelevant.
* An example would be for `embed` block where we only care
* about `providerNameSlug` attribute's value.
* We can also use a `string[]` to tell which attributes
* should be compared as a shorthand. Each attributes will
* be matched and the variation will be active if all of them are matching.
*/
/**
* Defined behavior of a block type.
*
* @typedef {Object} WPBlockType
*
* @property {string} name Block type's namespaced name.
* @property {string} title Human-readable block type label.
* @property {string} [description] A detailed block type description.
* @property {string} [category] Block type category classification,
* used in search interfaces to arrange
* block types by category.
* @property {WPBlockTypeIcon} [icon] Block type icon.
* @property {string[]} [keywords] Additional keywords to produce block
* type as result in search interfaces.
* @property {Object} [attributes] Block type attributes.
* @property {Component} [save] Optional component describing
* serialized markup structure of a
* block type.
* @property {Component} edit Component rendering an element to
* manipulate the attributes of a block
* in the context of an editor.
* @property {WPBlockVariation[]} [variations] The list of block variations.
* @property {Object} [example] Example provides structured data for
* the block preview. When not defined
* then no preview is shown.
*/
function isObject(object) {
return object !== null && typeof object === 'object';
}
/**
* Sets the server side block definition of blocks.
*
* @param {Object} definitions Server-side block definitions
*/
// eslint-disable-next-line camelcase
function unstable__bootstrapServerSideBlockDefinitions(definitions) {
const {
addBootstrappedBlockType
} = unlock((0,external_wp_data_namespaceObject.dispatch)(store));
for (const [name, blockType] of Object.entries(definitions)) {
addBootstrappedBlockType(name, blockType);
}
}
/**
* Gets block settings from metadata loaded from `block.json` file.
*
* @param {Object} metadata Block metadata loaded from `block.json`.
* @param {string} metadata.textdomain Textdomain to use with translations.
*
* @return {Object} Block settings.
*/
function getBlockSettingsFromMetadata({
textdomain,
...metadata
}) {
const allowedFields = ['apiVersion', 'title', 'category', 'parent', 'ancestor', 'icon', 'description', 'keywords', 'attributes', 'providesContext', 'usesContext', 'selectors', 'supports', 'styles', 'example', 'variations', 'blockHooks', 'allowedBlocks'];
const settings = Object.fromEntries(Object.entries(metadata).filter(([key]) => allowedFields.includes(key)));
if (textdomain) {
Object.keys(i18nBlockSchema).forEach(key => {
if (!settings[key]) {
return;
}
settings[key] = translateBlockSettingUsingI18nSchema(i18nBlockSchema[key], settings[key], textdomain);
});
}
return settings;
}
/**
* Registers a new block provided a unique name and an object defining its
* behavior. Once registered, the block is made available as an option to any
* editor interface where blocks are implemented.
*
* For more in-depth information on registering a custom block see the
* [Create a block tutorial](https://developer.wordpress.org/block-editor/getting-started/create-block/).
*
* @param {string|Object} blockNameOrMetadata Block type name or its metadata.
* @param {Object} settings Block settings.
*
* @example
* ```js
* import { __ } from '@wordpress/i18n';
* import { registerBlockType } from '@wordpress/blocks'
*
* registerBlockType( 'namespace/block-name', {
* title: __( 'My First Block' ),
* edit: () => <div>{ __( 'Hello from the editor!' ) }</div>,
* save: () => <div>Hello from the saved content!</div>,
* } );
* ```
*
* @return {WPBlockType | undefined} The block, if it has been successfully registered;
* otherwise `undefined`.
*/
function registerBlockType(blockNameOrMetadata, settings) {
const name = isObject(blockNameOrMetadata) ? blockNameOrMetadata.name : blockNameOrMetadata;
if (typeof name !== 'string') {
console.error('Block names must be strings.');
return;
}
if (!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(name)) {
console.error('Block names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-block');
return;
}
if ((0,external_wp_data_namespaceObject.select)(store).getBlockType(name)) {
console.error('Block "' + name + '" is already registered.');
return;
}
const {
addBootstrappedBlockType,
addUnprocessedBlockType
} = unlock((0,external_wp_data_namespaceObject.dispatch)(store));
if (isObject(blockNameOrMetadata)) {
const metadata = getBlockSettingsFromMetadata(blockNameOrMetadata);
addBootstrappedBlockType(name, metadata);
}
addUnprocessedBlockType(name, settings);
return (0,external_wp_data_namespaceObject.select)(store).getBlockType(name);
}
/**
* Translates block settings provided with metadata using the i18n schema.
*
* @param {string|string[]|Object[]} i18nSchema I18n schema for the block setting.
* @param {string|string[]|Object[]} settingValue Value for the block setting.
* @param {string} textdomain Textdomain to use with translations.
*
* @return {string|string[]|Object[]} Translated setting.
*/
function translateBlockSettingUsingI18nSchema(i18nSchema, settingValue, textdomain) {
if (typeof i18nSchema === 'string' && typeof settingValue === 'string') {
// eslint-disable-next-line @wordpress/i18n-no-variables, @wordpress/i18n-text-domain
return (0,external_wp_i18n_namespaceObject._x)(settingValue, i18nSchema, textdomain);
}
if (Array.isArray(i18nSchema) && i18nSchema.length && Array.isArray(settingValue)) {
return settingValue.map(value => translateBlockSettingUsingI18nSchema(i18nSchema[0], value, textdomain));
}
if (isObject(i18nSchema) && Object.entries(i18nSchema).length && isObject(settingValue)) {
return Object.keys(settingValue).reduce((accumulator, key) => {
if (!i18nSchema[key]) {
accumulator[key] = settingValue[key];
return accumulator;
}
accumulator[key] = translateBlockSettingUsingI18nSchema(i18nSchema[key], settingValue[key], textdomain);
return accumulator;
}, {});
}
return settingValue;
}
/**
* Registers a new block collection to group blocks in the same namespace in the inserter.
*
* @param {string} namespace The namespace to group blocks by in the inserter; corresponds to the block namespace.
* @param {Object} settings The block collection settings.
* @param {string} settings.title The title to display in the block inserter.
* @param {Object} [settings.icon] The icon to display in the block inserter.
*
* @example
* ```js
* import { __ } from '@wordpress/i18n';
* import { registerBlockCollection, registerBlockType } from '@wordpress/blocks';
*
* // Register the collection.
* registerBlockCollection( 'my-collection', {
* title: __( 'Custom Collection' ),
* } );
*
* // Register a block in the same namespace to add it to the collection.
* registerBlockType( 'my-collection/block-name', {
* title: __( 'My First Block' ),
* edit: () => <div>{ __( 'Hello from the editor!' ) }</div>,
* save: () => <div>'Hello from the saved content!</div>,
* } );
* ```
*/
function registerBlockCollection(namespace, {
title,
icon
}) {
(0,external_wp_data_namespaceObject.dispatch)(store).addBlockCollection(namespace, title, icon);
}
/**
* Unregisters a block collection
*
* @param {string} namespace The namespace to group blocks by in the inserter; corresponds to the block namespace
*
* @example
* ```js
* import { unregisterBlockCollection } from '@wordpress/blocks';
*
* unregisterBlockCollection( 'my-collection' );
* ```
*/
function unregisterBlockCollection(namespace) {
dispatch(blocksStore).removeBlockCollection(namespace);
}
/**
* Unregisters a block.
*
* @param {string} name Block name.
*
* @example
* ```js
* import { __ } from '@wordpress/i18n';
* import { unregisterBlockType } from '@wordpress/blocks';
*
* const ExampleComponent = () => {
* return (
* <Button
* onClick={ () =>
* unregisterBlockType( 'my-collection/block-name' )
* }
* >
* { __( 'Unregister my custom block.' ) }
* </Button>
* );
* };
* ```
*
* @return {WPBlockType | undefined} The previous block value, if it has been successfully
* unregistered; otherwise `undefined`.
*/
function unregisterBlockType(name) {
const oldBlock = (0,external_wp_data_namespaceObject.select)(store).getBlockType(name);
if (!oldBlock) {
console.error('Block "' + name + '" is not registered.');
return;
}
(0,external_wp_data_namespaceObject.dispatch)(store).removeBlockTypes(name);
return oldBlock;
}
/**
* Assigns name of block for handling non-block content.
*
* @param {string} blockName Block name.
*/
function setFreeformContentHandlerName(blockName) {
(0,external_wp_data_namespaceObject.dispatch)(store).setFreeformFallbackBlockName(blockName);
}
/**
* Retrieves name of block handling non-block content, or undefined if no
* handler has been defined.
*
* @return {?string} Block name.
*/
function getFreeformContentHandlerName() {
return (0,external_wp_data_namespaceObject.select)(store).getFreeformFallbackBlockName();
}
/**
* Retrieves name of block used for handling grouping interactions.
*
* @return {?string} Block name.
*/
function getGroupingBlockName() {
return (0,external_wp_data_namespaceObject.select)(store).getGroupingBlockName();
}
/**
* Assigns name of block handling unregistered block types.
*
* @param {string} blockName Block name.
*/
function setUnregisteredTypeHandlerName(blockName) {
(0,external_wp_data_namespaceObject.dispatch)(store).setUnregisteredFallbackBlockName(blockName);
}
/**
* Retrieves name of block handling unregistered block types, or undefined if no
* handler has been defined.
*
* @return {?string} Block name.
*/
function getUnregisteredTypeHandlerName() {
return (0,external_wp_data_namespaceObject.select)(store).getUnregisteredFallbackBlockName();
}
/**
* Assigns the default block name.
*
* @param {string} name Block name.
*
* @example
* ```js
* import { setDefaultBlockName } from '@wordpress/blocks';
*
* const ExampleComponent = () => {
*
* return (
* <Button onClick={ () => setDefaultBlockName( 'core/heading' ) }>
* { __( 'Set the default block to Heading' ) }
* </Button>
* );
* };
* ```
*/
function setDefaultBlockName(name) {
(0,external_wp_data_namespaceObject.dispatch)(store).setDefaultBlockName(name);
}
/**
* Assigns name of block for handling block grouping interactions.
*
* This function lets you select a different block to group other blocks in instead of the
* default `core/group` block. This function must be used in a component or when the DOM is fully
* loaded. See https://developer.wordpress.org/block-editor/reference-guides/packages/packages-dom-ready/
*
* @param {string} name Block name.
*
* @example
* ```js
* import { setGroupingBlockName } from '@wordpress/blocks';
*
* const ExampleComponent = () => {
*
* return (
* <Button onClick={ () => setGroupingBlockName( 'core/columns' ) }>
* { __( 'Wrap in columns' ) }
* </Button>
* );
* };
* ```
*/
function setGroupingBlockName(name) {
(0,external_wp_data_namespaceObject.dispatch)(store).setGroupingBlockName(name);
}
/**
* Retrieves the default block name.
*
* @return {?string} Block name.
*/
function getDefaultBlockName() {
return (0,external_wp_data_namespaceObject.select)(store).getDefaultBlockName();
}
/**
* Returns a registered block type.
*
* @param {string} name Block name.
*
* @return {?Object} Block type.
*/
function getBlockType(name) {
return (0,external_wp_data_namespaceObject.select)(store)?.getBlockType(name);
}
/**
* Returns all registered blocks.
*
* @return {Array} Block settings.
*/
function getBlockTypes() {
return (0,external_wp_data_namespaceObject.select)(store).getBlockTypes();
}
/**
* Returns the block support value for a feature, if defined.
*
* @param {(string|Object)} nameOrType Block name or type object
* @param {string} feature Feature to retrieve
* @param {*} defaultSupports Default value to return if not
* explicitly defined
*
* @return {?*} Block support value
*/
function getBlockSupport(nameOrType, feature, defaultSupports) {
return (0,external_wp_data_namespaceObject.select)(store).getBlockSupport(nameOrType, feature, defaultSupports);
}
/**
* Returns true if the block defines support for a feature, or false otherwise.
*
* @param {(string|Object)} nameOrType Block name or type object.
* @param {string} feature Feature to test.
* @param {boolean} defaultSupports Whether feature is supported by
* default if not explicitly defined.
*
* @return {boolean} Whether block supports feature.
*/
function hasBlockSupport(nameOrType, feature, defaultSupports) {
return (0,external_wp_data_namespaceObject.select)(store).hasBlockSupport(nameOrType, feature, defaultSupports);
}
/**
* Determines whether or not the given block is a reusable block. This is a
* special block type that is used to point to a global block stored via the
* API.
*
* @param {Object} blockOrType Block or Block Type to test.
*
* @return {boolean} Whether the given block is a reusable block.
*/
function isReusableBlock(blockOrType) {
return blockOrType?.name === 'core/block';
}
/**
* Determines whether or not the given block is a template part. This is a
* special block type that allows composing a page template out of reusable
* design elements.
*
* @param {Object} blockOrType Block or Block Type to test.
*
* @return {boolean} Whether the given block is a template part.
*/
function isTemplatePart(blockOrType) {
return blockOrType?.name === 'core/template-part';
}
/**
* Returns an array with the child blocks of a given block.
*
* @param {string} blockName Name of block (example: “latest-posts”).
*
* @return {Array} Array of child block names.
*/
const getChildBlockNames = blockName => {
return (0,external_wp_data_namespaceObject.select)(store).getChildBlockNames(blockName);
};
/**
* Returns a boolean indicating if a block has child blocks or not.
*
* @param {string} blockName Name of block (example: “latest-posts”).
*
* @return {boolean} True if a block contains child blocks and false otherwise.
*/
const hasChildBlocks = blockName => {
return (0,external_wp_data_namespaceObject.select)(store).hasChildBlocks(blockName);
};
/**
* Returns a boolean indicating if a block has at least one child block with inserter support.
*
* @param {string} blockName Block type name.
*
* @return {boolean} True if a block contains at least one child blocks with inserter support
* and false otherwise.
*/
const hasChildBlocksWithInserterSupport = blockName => {
return (0,external_wp_data_namespaceObject.select)(store).hasChildBlocksWithInserterSupport(blockName);
};
/**
* Registers a new block style for the given block.
*
* For more information on connecting the styles with CSS
* [the official documentation](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles/#styles).
*
* @param {string} blockName Name of block (example: “core/latest-posts”).
* @param {Object} styleVariation Object containing `name` which is the class name applied to the block and `label` which identifies the variation to the user.
*
* @example
* ```js
* import { __ } from '@wordpress/i18n';
* import { registerBlockStyle } from '@wordpress/blocks';
* import { Button } from '@wordpress/components';
*
*
* const ExampleComponent = () => {
* return (
* <Button
* onClick={ () => {
* registerBlockStyle( 'core/quote', {
* name: 'fancy-quote',
* label: __( 'Fancy Quote' ),
* } );
* } }
* >
* { __( 'Add a new block style for core/quote' ) }
* </Button>
* );
* };
* ```
*/
const registerBlockStyle = (blockName, styleVariation) => {
(0,external_wp_data_namespaceObject.dispatch)(store).addBlockStyles(blockName, styleVariation);
};
/**
* Unregisters a block style for the given block.
*
* @param {string} blockName Name of block (example: “core/latest-posts”).
* @param {string} styleVariationName Name of class applied to the block.
*
* @example
* ```js
* import { __ } from '@wordpress/i18n';
* import { unregisterBlockStyle } from '@wordpress/blocks';
* import { Button } from '@wordpress/components';
*
* const ExampleComponent = () => {
* return (
* <Button
* onClick={ () => {
* unregisterBlockStyle( 'core/quote', 'plain' );
* } }
* >
* { __( 'Remove the "Plain" block style for core/quote' ) }
* </Button>
* );
* };
* ```
*/
const unregisterBlockStyle = (blockName, styleVariationName) => {
(0,external_wp_data_namespaceObject.dispatch)(store).removeBlockStyles(blockName, styleVariationName);
};
/**
* Returns an array with the variations of a given block type.
* Ignored from documentation as the recommended usage is via useSelect from @wordpress/data.
*
* @ignore
*
* @param {string} blockName Name of block (example: “core/columns”).
* @param {WPBlockVariationScope} [scope] Block variation scope name.
*
* @return {(WPBlockVariation[]|void)} Block variations.
*/
const getBlockVariations = (blockName, scope) => {
return (0,external_wp_data_namespaceObject.select)(store).getBlockVariations(blockName, scope);
};
/**
* Registers a new block variation for the given block type.
*
* For more information on block variations see
* [the official documentation ](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-variations/).
*
* @param {string} blockName Name of the block (example: “core/columns”).
* @param {WPBlockVariation} variation Object describing a block variation.
*
* @example
* ```js
* import { __ } from '@wordpress/i18n';
* import { registerBlockVariation } from '@wordpress/blocks';
* import { Button } from '@wordpress/components';
*
* const ExampleComponent = () => {
* return (
* <Button
* onClick={ () => {
* registerBlockVariation( 'core/embed', {
* name: 'custom',
* title: __( 'My Custom Embed' ),
* attributes: { providerNameSlug: 'custom' },
* } );
* } }
* >
* __( 'Add a custom variation for core/embed' ) }
* </Button>
* );
* };
* ```
*/
const registerBlockVariation = (blockName, variation) => {
(0,external_wp_data_namespaceObject.dispatch)(store).addBlockVariations(blockName, variation);
};
/**
* Unregisters a block variation defined for the given block type.
*
* @param {string} blockName Name of the block (example: “core/columns”).
* @param {string} variationName Name of the variation defined for the block.
*
* @example
* ```js
* import { __ } from '@wordpress/i18n';
* import { unregisterBlockVariation } from '@wordpress/blocks';
* import { Button } from '@wordpress/components';
*
* const ExampleComponent = () => {
* return (
* <Button
* onClick={ () => {
* unregisterBlockVariation( 'core/embed', 'youtube' );
* } }
* >
* { __( 'Remove the YouTube variation from core/embed' ) }
* </Button>
* );
* };
* ```
*/
const unregisterBlockVariation = (blockName, variationName) => {
(0,external_wp_data_namespaceObject.dispatch)(store).removeBlockVariations(blockName, variationName);
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
k([names, a11y]);
/**
* Array of icon colors containing a color to be used if the icon color
* was not explicitly set but the icon background color was.
*
* @type {Object}
*/
const ICON_COLORS = ['#191e23', '#f8f9f9'];
/**
* Determines whether the block's attributes are equal to the default attributes
* which means the block is unmodified.
*
* @param {WPBlock} block Block Object
*
* @return {boolean} Whether the block is an unmodified block.
*/
function isUnmodifiedBlock(block) {
var _getBlockType$attribu;
return Object.entries((_getBlockType$attribu = getBlockType(block.name)?.attributes) !== null && _getBlockType$attribu !== void 0 ? _getBlockType$attribu : {}).every(([key, definition]) => {
const value = block.attributes[key];
// Every attribute that has a default must match the default.
if (definition.hasOwnProperty('default')) {
return value === definition.default;
}
// The rich text type is a bit different from the rest because it
// has an implicit default value of an empty RichTextData instance,
// so check the length of the value.
if (definition.type === 'rich-text') {
return !value?.length;
}
// Every attribute that doesn't have a default should be undefined.
return value === undefined;
});
}
/**
* Determines whether the block is a default block and its attributes are equal
* to the default attributes which means the block is unmodified.
*
* @param {WPBlock} block Block Object
*
* @return {boolean} Whether the block is an unmodified default block.
*/
function isUnmodifiedDefaultBlock(block) {
return block.name === getDefaultBlockName() && isUnmodifiedBlock(block);
}
/**
* Function that checks if the parameter is a valid icon.
*
* @param {*} icon Parameter to be checked.
*
* @return {boolean} True if the parameter is a valid icon and false otherwise.
*/
function isValidIcon(icon) {
return !!icon && (typeof icon === 'string' || (0,external_wp_element_namespaceObject.isValidElement)(icon) || typeof icon === 'function' || icon instanceof external_wp_element_namespaceObject.Component);
}
/**
* Function that receives an icon as set by the blocks during the registration
* and returns a new icon object that is normalized so we can rely on just on possible icon structure
* in the codebase.
*
* @param {WPBlockTypeIconRender} icon Render behavior of a block type icon;
* one of a Dashicon slug, an element, or a
* component.
*
* @return {WPBlockTypeIconDescriptor} Object describing the icon.
*/
function normalizeIconObject(icon) {
icon = icon || BLOCK_ICON_DEFAULT;
if (isValidIcon(icon)) {
return {
src: icon
};
}
if ('background' in icon) {
const colordBgColor = w(icon.background);
const getColorContrast = iconColor => colordBgColor.contrast(iconColor);
const maxContrast = Math.max(...ICON_COLORS.map(getColorContrast));
return {
...icon,
foreground: icon.foreground ? icon.foreground : ICON_COLORS.find(iconColor => getColorContrast(iconColor) === maxContrast),
shadowColor: colordBgColor.alpha(0.3).toRgbString()
};
}
return icon;
}
/**
* Normalizes block type passed as param. When string is passed then
* it converts it to the matching block type object.
* It passes the original object otherwise.
*
* @param {string|Object} blockTypeOrName Block type or name.
*
* @return {?Object} Block type.
*/
function normalizeBlockType(blockTypeOrName) {
if (typeof blockTypeOrName === 'string') {
return getBlockType(blockTypeOrName);
}
return blockTypeOrName;
}
/**
* Get the label for the block, usually this is either the block title,
* or the value of the block's `label` function when that's specified.
*
* @param {Object} blockType The block type.
* @param {Object} attributes The values of the block's attributes.
* @param {Object} context The intended use for the label.
*
* @return {string} The block label.
*/
function getBlockLabel(blockType, attributes, context = 'visual') {
const {
__experimentalLabel: getLabel,
title
} = blockType;
const label = getLabel && getLabel(attributes, {
context
});
if (!label) {
return title;
}
// Strip any HTML (i.e. RichText formatting) before returning.
return (0,external_wp_dom_namespaceObject.__unstableStripHTML)(label);
}
/**
* Get a label for the block for use by screenreaders, this is more descriptive
* than the visual label and includes the block title and the value of the
* `getLabel` function if it's specified.
*
* @param {?Object} blockType The block type.
* @param {Object} attributes The values of the block's attributes.
* @param {?number} position The position of the block in the block list.
* @param {string} [direction='vertical'] The direction of the block layout.
*
* @return {string} The block label.
*/
function getAccessibleBlockLabel(blockType, attributes, position, direction = 'vertical') {
// `title` is already localized, `label` is a user-supplied value.
const title = blockType?.title;
const label = blockType ? getBlockLabel(blockType, attributes, 'accessibility') : '';
const hasPosition = position !== undefined;
// getBlockLabel returns the block title as a fallback when there's no label,
// if it did return the title, this function needs to avoid adding the
// title twice within the accessible label. Use this `hasLabel` boolean to
// handle that.
const hasLabel = label && label !== title;
if (hasPosition && direction === 'vertical') {
if (hasLabel) {
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: The block title. 2: The block row number. 3: The block label.. */
(0,external_wp_i18n_namespaceObject.__)('%1$s Block. Row %2$d. %3$s'), title, position, label);
}
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: The block title. 2: The block row number. */
(0,external_wp_i18n_namespaceObject.__)('%1$s Block. Row %2$d'), title, position);
} else if (hasPosition && direction === 'horizontal') {
if (hasLabel) {
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: The block title. 2: The block column number. 3: The block label.. */
(0,external_wp_i18n_namespaceObject.__)('%1$s Block. Column %2$d. %3$s'), title, position, label);
}
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: The block title. 2: The block column number. */
(0,external_wp_i18n_namespaceObject.__)('%1$s Block. Column %2$d'), title, position);
}
if (hasLabel) {
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. %1: The block title. %2: The block label. */
(0,external_wp_i18n_namespaceObject.__)('%1$s Block. %2$s'), title, label);
}
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. %s: The block title. */
(0,external_wp_i18n_namespaceObject.__)('%s Block'), title);
}
function getDefault(attributeSchema) {
if (attributeSchema.default !== undefined) {
return attributeSchema.default;
}
if (attributeSchema.type === 'rich-text') {
return new external_wp_richText_namespaceObject.RichTextData();
}
}
/**
* Ensure attributes contains only values defined by block type, and merge
* default values for missing attributes.
*
* @param {string} name The block's name.
* @param {Object} attributes The block's attributes.
* @return {Object} The sanitized attributes.
*/
function __experimentalSanitizeBlockAttributes(name, attributes) {
// Get the type definition associated with a registered block.
const blockType = getBlockType(name);
if (undefined === blockType) {
throw new Error(`Block type '${name}' is not registered.`);
}
return Object.entries(blockType.attributes).reduce((accumulator, [key, schema]) => {
const value = attributes[key];
if (undefined !== value) {
if (schema.type === 'rich-text') {
if (value instanceof external_wp_richText_namespaceObject.RichTextData) {
accumulator[key] = value;
} else if (typeof value === 'string') {
accumulator[key] = external_wp_richText_namespaceObject.RichTextData.fromHTMLString(value);
}
} else if (schema.type === 'string' && value instanceof external_wp_richText_namespaceObject.RichTextData) {
accumulator[key] = value.toHTMLString();
} else {
accumulator[key] = value;
}
} else {
const _default = getDefault(schema);
if (undefined !== _default) {
accumulator[key] = _default;
}
}
if (['node', 'children'].indexOf(schema.source) !== -1) {
// Ensure value passed is always an array, which we're expecting in
// the RichText component to handle the deprecated value.
if (typeof accumulator[key] === 'string') {
accumulator[key] = [accumulator[key]];
} else if (!Array.isArray(accumulator[key])) {
accumulator[key] = [];
}
}
return accumulator;
}, {});
}
/**
* Filter block attributes by `role` and return their names.
*
* @param {string} name Block attribute's name.
* @param {string} role The role of a block attribute.
*
* @return {string[]} The attribute names that have the provided role.
*/
function __experimentalGetBlockAttributesNamesByRole(name, role) {
const attributes = getBlockType(name)?.attributes;
if (!attributes) return [];
const attributesNames = Object.keys(attributes);
if (!role) return attributesNames;
return attributesNames.filter(attributeName => attributes[attributeName]?.__experimentalRole === role);
}
/**
* Return a new object with the specified keys omitted.
*
* @param {Object} object Original object.
* @param {Array} keys Keys to be omitted.
*
* @return {Object} Object with omitted keys.
*/
function omit(object, keys) {
return Object.fromEntries(Object.entries(object).filter(([key]) => !keys.includes(key)));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/reducer.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @typedef {Object} WPBlockCategory
*
* @property {string} slug Unique category slug.
* @property {string} title Category label, for display in user interface.
*/
/**
* Default set of categories.
*
* @type {WPBlockCategory[]}
*/
const DEFAULT_CATEGORIES = [{
slug: 'text',
title: (0,external_wp_i18n_namespaceObject.__)('Text')
}, {
slug: 'media',
title: (0,external_wp_i18n_namespaceObject.__)('Media')
}, {
slug: 'design',
title: (0,external_wp_i18n_namespaceObject.__)('Design')
}, {
slug: 'widgets',
title: (0,external_wp_i18n_namespaceObject.__)('Widgets')
}, {
slug: 'theme',
title: (0,external_wp_i18n_namespaceObject.__)('Theme')
}, {
slug: 'embed',
title: (0,external_wp_i18n_namespaceObject.__)('Embeds')
}, {
slug: 'reusable',
title: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks')
}];
// Key block types by their name.
function keyBlockTypesByName(types) {
return types.reduce((newBlockTypes, block) => ({
...newBlockTypes,
[block.name]: block
}), {});
}
// Filter items to ensure they're unique by their name.
function getUniqueItemsByName(items) {
return items.reduce((acc, currentItem) => {
if (!acc.some(item => item.name === currentItem.name)) {
acc.push(currentItem);
}
return acc;
}, []);
}
function bootstrappedBlockTypes(state = {}, action) {
switch (action.type) {
case 'ADD_BOOTSTRAPPED_BLOCK_TYPE':
const {
name,
blockType
} = action;
const serverDefinition = state[name];
let newDefinition;
// Don't overwrite if already set. It covers the case when metadata
// was initialized from the server.
if (serverDefinition) {
// The `selectors` prop is not yet included in the server provided
// definitions and needs to be polyfilled. This can be removed when the
// minimum supported WordPress is >= 6.3.
if (serverDefinition.selectors === undefined && blockType.selectors) {
newDefinition = {
...serverDefinition,
selectors: blockType.selectors
};
}
// The `blockHooks` prop is not yet included in the server provided
// definitions and needs to be polyfilled. This can be removed when the
// minimum supported WordPress is >= 6.4.
if (serverDefinition.blockHooks === undefined && blockType.blockHooks) {
newDefinition = {
...serverDefinition,
...newDefinition,
blockHooks: blockType.blockHooks
};
}
// The `allowedBlocks` prop is not yet included in the server provided
// definitions and needs to be polyfilled. This can be removed when the
// minimum supported WordPress is >= 6.5.
if (serverDefinition.allowedBlocks === undefined && blockType.allowedBlocks) {
newDefinition = {
...serverDefinition,
...newDefinition,
allowedBlocks: blockType.allowedBlocks
};
}
} else {
newDefinition = Object.fromEntries(Object.entries(blockType).filter(([, value]) => value !== null && value !== undefined).map(([key, value]) => [camelCase(key), value]));
newDefinition.name = name;
}
if (newDefinition) {
return {
...state,
[name]: newDefinition
};
}
return state;
case 'REMOVE_BLOCK_TYPES':
return omit(state, action.names);
}
return state;
}
/**
* Reducer managing the unprocessed block types in a form passed when registering the by block.
* It's for internal use only. It allows recomputing the processed block types on-demand after block type filters
* get added or removed.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function unprocessedBlockTypes(state = {}, action) {
switch (action.type) {
case 'ADD_UNPROCESSED_BLOCK_TYPE':
return {
...state,
[action.name]: action.blockType
};
case 'REMOVE_BLOCK_TYPES':
return omit(state, action.names);
}
return state;
}
/**
* Reducer managing the processed block types with all filters applied.
* The state is derived from the `unprocessedBlockTypes` reducer.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function blockTypes(state = {}, action) {
switch (action.type) {
case 'ADD_BLOCK_TYPES':
return {
...state,
...keyBlockTypesByName(action.blockTypes)
};
case 'REMOVE_BLOCK_TYPES':
return omit(state, action.names);
}
return state;
}
/**
* Reducer managing the block styles.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function blockStyles(state = {}, action) {
var _state$action$blockNa, _state$action$blockNa2;
switch (action.type) {
case 'ADD_BLOCK_TYPES':
return {
...state,
...Object.fromEntries(Object.entries(keyBlockTypesByName(action.blockTypes)).map(([name, blockType]) => {
var _blockType$styles, _state$blockType$name;
return [name, getUniqueItemsByName([...((_blockType$styles = blockType.styles) !== null && _blockType$styles !== void 0 ? _blockType$styles : []).map(style => ({
...style,
source: 'block'
})), ...((_state$blockType$name = state[blockType.name]) !== null && _state$blockType$name !== void 0 ? _state$blockType$name : []).filter(({
source
}) => 'block' !== source)])];
}))
};
case 'ADD_BLOCK_STYLES':
return {
...state,
[action.blockName]: getUniqueItemsByName([...((_state$action$blockNa = state[action.blockName]) !== null && _state$action$blockNa !== void 0 ? _state$action$blockNa : []), ...action.styles])
};
case 'REMOVE_BLOCK_STYLES':
return {
...state,
[action.blockName]: ((_state$action$blockNa2 = state[action.blockName]) !== null && _state$action$blockNa2 !== void 0 ? _state$action$blockNa2 : []).filter(style => action.styleNames.indexOf(style.name) === -1)
};
}
return state;
}
/**
* Reducer managing the block variations.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function blockVariations(state = {}, action) {
var _state$action$blockNa3, _state$action$blockNa4;
switch (action.type) {
case 'ADD_BLOCK_TYPES':
return {
...state,
...Object.fromEntries(Object.entries(keyBlockTypesByName(action.blockTypes)).map(([name, blockType]) => {
var _blockType$variations, _state$blockType$name2;
return [name, getUniqueItemsByName([...((_blockType$variations = blockType.variations) !== null && _blockType$variations !== void 0 ? _blockType$variations : []).map(variation => ({
...variation,
source: 'block'
})), ...((_state$blockType$name2 = state[blockType.name]) !== null && _state$blockType$name2 !== void 0 ? _state$blockType$name2 : []).filter(({
source
}) => 'block' !== source)])];
}))
};
case 'ADD_BLOCK_VARIATIONS':
return {
...state,
[action.blockName]: getUniqueItemsByName([...((_state$action$blockNa3 = state[action.blockName]) !== null && _state$action$blockNa3 !== void 0 ? _state$action$blockNa3 : []), ...action.variations])
};
case 'REMOVE_BLOCK_VARIATIONS':
return {
...state,
[action.blockName]: ((_state$action$blockNa4 = state[action.blockName]) !== null && _state$action$blockNa4 !== void 0 ? _state$action$blockNa4 : []).filter(variation => action.variationNames.indexOf(variation.name) === -1)
};
}
return state;
}
/**
* Higher-order Reducer creating a reducer keeping track of given block name.
*
* @param {string} setActionType Action type.
*
* @return {Function} Reducer.
*/
function createBlockNameSetterReducer(setActionType) {
return (state = null, action) => {
switch (action.type) {
case 'REMOVE_BLOCK_TYPES':
if (action.names.indexOf(state) !== -1) {
return null;
}
return state;
case setActionType:
return action.name || null;
}
return state;
};
}
const defaultBlockName = createBlockNameSetterReducer('SET_DEFAULT_BLOCK_NAME');
const freeformFallbackBlockName = createBlockNameSetterReducer('SET_FREEFORM_FALLBACK_BLOCK_NAME');
const unregisteredFallbackBlockName = createBlockNameSetterReducer('SET_UNREGISTERED_FALLBACK_BLOCK_NAME');
const groupingBlockName = createBlockNameSetterReducer('SET_GROUPING_BLOCK_NAME');
/**
* Reducer managing the categories
*
* @param {WPBlockCategory[]} state Current state.
* @param {Object} action Dispatched action.
*
* @return {WPBlockCategory[]} Updated state.
*/
function categories(state = DEFAULT_CATEGORIES, action) {
switch (action.type) {
case 'SET_CATEGORIES':
return action.categories || [];
case 'UPDATE_CATEGORY':
{
if (!action.category || !Object.keys(action.category).length) {
return state;
}
const categoryToChange = state.find(({
slug
}) => slug === action.slug);
if (categoryToChange) {
return state.map(category => {
if (category.slug === action.slug) {
return {
...category,
...action.category
};
}
return category;
});
}
}
}
return state;
}
function collections(state = {}, action) {
switch (action.type) {
case 'ADD_BLOCK_COLLECTION':
return {
...state,
[action.namespace]: {
title: action.title,
icon: action.icon
}
};
case 'REMOVE_BLOCK_COLLECTION':
return omit(state, action.namespace);
}
return state;
}
function blockBindingsSources(state = {}, action) {
if (action.type === 'REGISTER_BLOCK_BINDINGS_SOURCE') {
var _action$lockAttribute;
return {
...state,
[action.sourceName]: {
label: action.sourceLabel,
useSource: action.useSource,
lockAttributesEditing: (_action$lockAttribute = action.lockAttributesEditing) !== null && _action$lockAttribute !== void 0 ? _action$lockAttribute : true
}
};
}
return state;
}
/* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
bootstrappedBlockTypes,
unprocessedBlockTypes,
blockTypes,
blockStyles,
blockVariations,
defaultBlockName,
freeformFallbackBlockName,
unregisteredFallbackBlockName,
groupingBlockName,
categories,
collections,
blockBindingsSources
}));
;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js
/** @typedef {(...args: any[]) => *[]} GetDependants */
/** @typedef {() => void} Clear */
/**
* @typedef {{
* getDependants: GetDependants,
* clear: Clear
* }} EnhancedSelector
*/
/**
* Internal cache entry.
*
* @typedef CacheNode
*
* @property {?CacheNode|undefined} [prev] Previous node.
* @property {?CacheNode|undefined} [next] Next node.
* @property {*[]} args Function arguments for cache entry.
* @property {*} val Function result.
*/
/**
* @typedef Cache
*
* @property {Clear} clear Function to clear cache.
* @property {boolean} [isUniqueByDependants] Whether dependants are valid in
* considering cache uniqueness. A cache is unique if dependents are all arrays
* or objects.
* @property {CacheNode?} [head] Cache head.
* @property {*[]} [lastDependants] Dependants from previous invocation.
*/
/**
* Arbitrary value used as key for referencing cache object in WeakMap tree.
*
* @type {{}}
*/
var LEAF_KEY = {};
/**
* Returns the first argument as the sole entry in an array.
*
* @template T
*
* @param {T} value Value to return.
*
* @return {[T]} 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 {Cache} Cache object.
*/
function createCache() {
/** @type {Cache} */
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 {*[]} a First array.
* @param {*[]} 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.
*
* @template {(...args: *[]) => *} S
*
* @param {S} selector Selector function.
* @param {GetDependants=} getDependants Dependant getter returning an array of
* references used in cache bust consideration.
*/
/* harmony default export */ function rememo(selector, getDependants) {
/** @type {WeakMap<*,*>} */
var rootCache;
/** @type {GetDependants} */
var normalizedGetDependants = getDependants ? getDependants : arrayOf;
/**
* 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 {*[]} dependants Selector dependants.
*
* @return {Cache} Cache object.
*/
function getCache(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);
}
/**
* Resets root memoization cache.
*/
function clear() {
rootCache = new WeakMap();
}
/* eslint-disable jsdoc/check-param-names */
/**
* The augmented selector call, considering first whether dependants have
* changed before passing it to underlying memoize function.
*
* @param {*} source Source object for derivation.
* @param {...*} extraArgs Additional arguments to pass to selector.
*
* @return {*} Selector result.
*/
/* eslint-enable jsdoc/check-param-names */
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 = normalizedGetDependants.apply(null, args);
cache = getCache(dependants);
// If not guaranteed uniqueness by dependants (primitive type), 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.
/** @type {CacheNode} */ (node.prev).next = node.next;
if (node.next) {
node.next.prev = node.prev;
}
node.next = cache.head;
node.prev = null;
/** @type {CacheNode} */ (cache.head).prev = node;
cache.head = node;
}
// Return immediately
return node.val;
}
// No cached value found. Continue to insertion phase:
node = /** @type {CacheNode} */ ({
// 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 = normalizedGetDependants;
callSelector.clear = clear;
clear();
return /** @type {S & EnhancedSelector} */ (callSelector);
}
// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
var remove_accents = __webpack_require__(9681);
var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
;// CONCATENATED MODULE: external ["wp","compose"]
const external_wp_compose_namespaceObject = window["wp"]["compose"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/utils.js
/**
* Helper util to return a value from a certain path of the object.
* Path is specified as either:
* - a string of properties, separated by dots, for example: "x.y".
* - an array of properties, for example `[ 'x', 'y' ]`.
* You can also specify a default value in case the result is nullish.
*
* @param {Object} object Input object.
* @param {string|Array} path Path to the object property.
* @param {*} defaultValue Default value if the value at the specified path is nullish.
* @return {*} Value of the object property at the specified path.
*/
const getValueFromObjectPath = (object, path, defaultValue) => {
var _value;
const normalizedPath = Array.isArray(path) ? path : path.split('.');
let value = object;
normalizedPath.forEach(fieldName => {
value = value?.[fieldName];
});
return (_value = value) !== null && _value !== void 0 ? _value : defaultValue;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/selectors.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */
/** @typedef {import('../api/registration').WPBlockVariationScope} WPBlockVariationScope */
/** @typedef {import('./reducer').WPBlockCategory} WPBlockCategory */
/**
* Given a block name or block type object, returns the corresponding
* normalized block type object.
*
* @param {Object} state Blocks state.
* @param {(string|Object)} nameOrType Block name or type object
*
* @return {Object} Block type object.
*/
const getNormalizedBlockType = (state, nameOrType) => 'string' === typeof nameOrType ? selectors_getBlockType(state, nameOrType) : nameOrType;
/**
* Returns all the available block types.
*
* @param {Object} state Data state.
*
* @example
* ```js
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const blockTypes = useSelect(
* ( select ) => select( blocksStore ).getBlockTypes(),
* []
* );
*
* return (
* <ul>
* { blockTypes.map( ( block ) => (
* <li key={ block.name }>{ block.title }</li>
* ) ) }
* </ul>
* );
* };
* ```
*
* @return {Array} Block Types.
*/
const selectors_getBlockTypes = rememo(state => Object.values(state.blockTypes), state => [state.blockTypes]);
/**
* Returns a block type by name.
*
* @param {Object} state Data state.
* @param {string} name Block type name.
*
* @example
* ```js
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const paragraphBlock = useSelect( ( select ) =>
* ( select ) => select( blocksStore ).getBlockType( 'core/paragraph' ),
* []
* );
*
* return (
* <ul>
* { paragraphBlock &&
* Object.entries( paragraphBlock.supports ).map(
* ( blockSupportsEntry ) => {
* const [ propertyName, value ] = blockSupportsEntry;
* return (
* <li
* key={ propertyName }
* >{ `${ propertyName } : ${ value }` }</li>
* );
* }
* ) }
* </ul>
* );
* };
* ```
*
* @return {Object?} Block Type.
*/
function selectors_getBlockType(state, name) {
return state.blockTypes[name];
}
/**
* Returns block styles by block name.
*
* @param {Object} state Data state.
* @param {string} name Block type name.
*
* @example
* ```js
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const buttonBlockStyles = useSelect( ( select ) =>
* select( blocksStore ).getBlockStyles( 'core/button' ),
* []
* );
*
* return (
* <ul>
* { buttonBlockStyles &&
* buttonBlockStyles.map( ( style ) => (
* <li key={ style.name }>{ style.label }</li>
* ) ) }
* </ul>
* );
* };
* ```
*
* @return {Array?} Block Styles.
*/
function getBlockStyles(state, name) {
return state.blockStyles[name];
}
/**
* Returns block variations by block name.
*
* @param {Object} state Data state.
* @param {string} blockName Block type name.
* @param {WPBlockVariationScope} [scope] Block variation scope name.
*
* @example
* ```js
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const socialLinkVariations = useSelect( ( select ) =>
* select( blocksStore ).getBlockVariations( 'core/social-link' ),
* []
* );
*
* return (
* <ul>
* { socialLinkVariations &&
* socialLinkVariations.map( ( variation ) => (
* <li key={ variation.name }>{ variation.title }</li>
* ) ) }
* </ul>
* );
* };
* ```
*
* @return {(WPBlockVariation[]|void)} Block variations.
*/
const selectors_getBlockVariations = rememo((state, blockName, scope) => {
const variations = state.blockVariations[blockName];
if (!variations || !scope) {
return variations;
}
return variations.filter(variation => {
// For backward compatibility reasons, variation's scope defaults to
// `block` and `inserter` when not set.
return (variation.scope || ['block', 'inserter']).includes(scope);
});
}, (state, blockName) => [state.blockVariations[blockName]]);
/**
* Returns the active block variation for a given block based on its attributes.
* Variations are determined by their `isActive` property.
* Which is either an array of block attribute keys or a function.
*
* In case of an array of block attribute keys, the `attributes` are compared
* to the variation's attributes using strict equality check.
*
* In case of function type, the function should accept a block's attributes
* and the variation's attributes and determines if a variation is active.
* A function that accepts a block's attributes and the variation's attributes and determines if a variation is active.
*
* @param {Object} state Data state.
* @param {string} blockName Name of block (example: “core/columns”).
* @param {Object} attributes Block attributes used to determine active variation.
* @param {WPBlockVariationScope} [scope] Block variation scope name.
*
* @example
* ```js
* import { __ } from '@wordpress/i18n';
* import { store as blocksStore } from '@wordpress/blocks';
* import { store as blockEditorStore } from '@wordpress/block-editor';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* // This example assumes that a core/embed block is the first block in the Block Editor.
* const activeBlockVariation = useSelect( ( select ) => {
* // Retrieve the list of blocks.
* const [ firstBlock ] = select( blockEditorStore ).getBlocks()
*
* // Return the active block variation for the first block.
* return select( blocksStore ).getActiveBlockVariation(
* firstBlock.name,
* firstBlock.attributes
* );
* }, [] );
*
* return activeBlockVariation && activeBlockVariation.name === 'spotify' ? (
* <p>{ __( 'Spotify variation' ) }</p>
* ) : (
* <p>{ __( 'Other variation' ) }</p>
* );
* };
* ```
*
* @return {(WPBlockVariation|undefined)} Active block variation.
*/
function getActiveBlockVariation(state, blockName, attributes, scope) {
const variations = selectors_getBlockVariations(state, blockName, scope);
const match = variations?.find(variation => {
if (Array.isArray(variation.isActive)) {
const blockType = selectors_getBlockType(state, blockName);
const attributeKeys = Object.keys(blockType?.attributes || {});
const definedAttributes = variation.isActive.filter(attribute => attributeKeys.includes(attribute));
if (definedAttributes.length === 0) {
return false;
}
return definedAttributes.every(attribute => attributes[attribute] === variation.attributes[attribute]);
}
return variation.isActive?.(attributes, variation.attributes);
});
return match;
}
/**
* Returns the default block variation for the given block type.
* When there are multiple variations annotated as the default one,
* the last added item is picked. This simplifies registering overrides.
* When there is no default variation set, it returns the first item.
*
* @param {Object} state Data state.
* @param {string} blockName Block type name.
* @param {WPBlockVariationScope} [scope] Block variation scope name.
*
* @example
* ```js
* import { __, sprintf } from '@wordpress/i18n';
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const defaultEmbedBlockVariation = useSelect( ( select ) =>
* select( blocksStore ).getDefaultBlockVariation( 'core/embed' ),
* []
* );
*
* return (
* defaultEmbedBlockVariation && (
* <p>
* { sprintf(
* __( 'core/embed default variation: %s' ),
* defaultEmbedBlockVariation.title
* ) }
* </p>
* )
* );
* };
* ```
*
* @return {?WPBlockVariation} The default block variation.
*/
function getDefaultBlockVariation(state, blockName, scope) {
const variations = selectors_getBlockVariations(state, blockName, scope);
const defaultVariation = [...variations].reverse().find(({
isDefault
}) => !!isDefault);
return defaultVariation || variations[0];
}
/**
* Returns all the available block categories.
*
* @param {Object} state Data state.
*
* @example
* ```js
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect, } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const blockCategories = useSelect( ( select ) =>
* select( blocksStore ).getCategories(),
* []
* );
*
* return (
* <ul>
* { blockCategories.map( ( category ) => (
* <li key={ category.slug }>{ category.title }</li>
* ) ) }
* </ul>
* );
* };
* ```
*
* @return {WPBlockCategory[]} Categories list.
*/
function getCategories(state) {
return state.categories;
}
/**
* Returns all the available collections.
*
* @param {Object} state Data state.
*
* @example
* ```js
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const blockCollections = useSelect( ( select ) =>
* select( blocksStore ).getCollections(),
* []
* );
*
* return (
* <ul>
* { Object.values( blockCollections ).length > 0 &&
* Object.values( blockCollections ).map( ( collection ) => (
* <li key={ collection.title }>{ collection.title }</li>
* ) ) }
* </ul>
* );
* };
* ```
*
* @return {Object} Collections list.
*/
function getCollections(state) {
return state.collections;
}
/**
* Returns the name of the default block name.
*
* @param {Object} state Data state.
*
* @example
* ```js
* import { __, sprintf } from '@wordpress/i18n';
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const defaultBlockName = useSelect( ( select ) =>
* select( blocksStore ).getDefaultBlockName(),
* []
* );
*
* return (
* defaultBlockName && (
* <p>
* { sprintf( __( 'Default block name: %s' ), defaultBlockName ) }
* </p>
* )
* );
* };
* ```
*
* @return {string?} Default block name.
*/
function selectors_getDefaultBlockName(state) {
return state.defaultBlockName;
}
/**
* Returns the name of the block for handling non-block content.
*
* @param {Object} state Data state.
*
* @example
* ```js
* import { __, sprintf } from '@wordpress/i18n';
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const freeformFallbackBlockName = useSelect( ( select ) =>
* select( blocksStore ).getFreeformFallbackBlockName(),
* []
* );
*
* return (
* freeformFallbackBlockName && (
* <p>
* { sprintf( __(
* 'Freeform fallback block name: %s' ),
* freeformFallbackBlockName
* ) }
* </p>
* )
* );
* };
* ```
*
* @return {string?} Name of the block for handling non-block content.
*/
function getFreeformFallbackBlockName(state) {
return state.freeformFallbackBlockName;
}
/**
* Returns the name of the block for handling unregistered blocks.
*
* @param {Object} state Data state.
*
* @example
* ```js
* import { __, sprintf } from '@wordpress/i18n';
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const unregisteredFallbackBlockName = useSelect( ( select ) =>
* select( blocksStore ).getUnregisteredFallbackBlockName(),
* []
* );
*
* return (
* unregisteredFallbackBlockName && (
* <p>
* { sprintf( __(
* 'Unregistered fallback block name: %s' ),
* unregisteredFallbackBlockName
* ) }
* </p>
* )
* );
* };
* ```
*
* @return {string?} Name of the block for handling unregistered blocks.
*/
function getUnregisteredFallbackBlockName(state) {
return state.unregisteredFallbackBlockName;
}
/**
* Returns the name of the block for handling the grouping of blocks.
*
* @param {Object} state Data state.
*
* @example
* ```js
* import { __, sprintf } from '@wordpress/i18n';
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const groupingBlockName = useSelect( ( select ) =>
* select( blocksStore ).getGroupingBlockName(),
* []
* );
*
* return (
* groupingBlockName && (
* <p>
* { sprintf(
* __( 'Default grouping block name: %s' ),
* groupingBlockName
* ) }
* </p>
* )
* );
* };
* ```
*
* @return {string?} Name of the block for handling the grouping of blocks.
*/
function selectors_getGroupingBlockName(state) {
return state.groupingBlockName;
}
/**
* Returns an array with the child blocks of a given block.
*
* @param {Object} state Data state.
* @param {string} blockName Block type name.
*
* @example
* ```js
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const childBlockNames = useSelect( ( select ) =>
* select( blocksStore ).getChildBlockNames( 'core/navigation' ),
* []
* );
*
* return (
* <ul>
* { childBlockNames &&
* childBlockNames.map( ( child ) => (
* <li key={ child }>{ child }</li>
* ) ) }
* </ul>
* );
* };
* ```
*
* @return {Array} Array of child block names.
*/
const selectors_getChildBlockNames = rememo((state, blockName) => {
return selectors_getBlockTypes(state).filter(blockType => {
return blockType.parent?.includes(blockName);
}).map(({
name
}) => name);
}, state => [state.blockTypes]);
/**
* Returns the block support value for a feature, if defined.
*
* @param {Object} state Data state.
* @param {(string|Object)} nameOrType Block name or type object
* @param {Array|string} feature Feature to retrieve
* @param {*} defaultSupports Default value to return if not
* explicitly defined
*
* @example
* ```js
* import { __, sprintf } from '@wordpress/i18n';
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const paragraphBlockSupportValue = useSelect( ( select ) =>
* select( blocksStore ).getBlockSupport( 'core/paragraph', 'anchor' ),
* []
* );
*
* return (
* <p>
* { sprintf(
* __( 'core/paragraph supports.anchor value: %s' ),
* paragraphBlockSupportValue
* ) }
* </p>
* );
* };
* ```
*
* @return {?*} Block support value
*/
const selectors_getBlockSupport = (state, nameOrType, feature, defaultSupports) => {
const blockType = getNormalizedBlockType(state, nameOrType);
if (!blockType?.supports) {
return defaultSupports;
}
return getValueFromObjectPath(blockType.supports, feature, defaultSupports);
};
/**
* Returns true if the block defines support for a feature, or false otherwise.
*
* @param {Object} state Data state.
* @param {(string|Object)} nameOrType Block name or type object.
* @param {string} feature Feature to test.
* @param {boolean} defaultSupports Whether feature is supported by
* default if not explicitly defined.
*
* @example
* ```js
* import { __, sprintf } from '@wordpress/i18n';
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const paragraphBlockSupportClassName = useSelect( ( select ) =>
* select( blocksStore ).hasBlockSupport( 'core/paragraph', 'className' ),
* []
* );
*
* return (
* <p>
* { sprintf(
* __( 'core/paragraph supports custom class name?: %s' ),
* paragraphBlockSupportClassName
* ) }
* /p>
* );
* };
* ```
*
* @return {boolean} Whether block supports feature.
*/
function selectors_hasBlockSupport(state, nameOrType, feature, defaultSupports) {
return !!selectors_getBlockSupport(state, nameOrType, feature, defaultSupports);
}
/**
* Returns true if the block type by the given name or object value matches a
* search term, or false otherwise.
*
* @param {Object} state Blocks state.
* @param {(string|Object)} nameOrType Block name or type object.
* @param {string} searchTerm Search term by which to filter.
*
* @example
* ```js
* import { __, sprintf } from '@wordpress/i18n';
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const termFound = useSelect(
* ( select ) =>
* select( blocksStore ).isMatchingSearchTerm(
* 'core/navigation',
* 'theme'
* ),
* []
* );
*
* return (
* <p>
* { sprintf(
* __(
* 'Search term was found in the title, keywords, category or description in block.json: %s'
* ),
* termFound
* ) }
* </p>
* );
* };
* ```
*
* @return {Object[]} Whether block type matches search term.
*/
function isMatchingSearchTerm(state, nameOrType, searchTerm) {
const blockType = getNormalizedBlockType(state, nameOrType);
const getNormalizedSearchTerm = (0,external_wp_compose_namespaceObject.pipe)([
// Disregard diacritics.
// Input: "média"
term => remove_accents_default()(term !== null && term !== void 0 ? term : ''),
// Lowercase.
// Input: "MEDIA"
term => term.toLowerCase(),
// Strip leading and trailing whitespace.
// Input: " media "
term => term.trim()]);
const normalizedSearchTerm = getNormalizedSearchTerm(searchTerm);
const isSearchMatch = (0,external_wp_compose_namespaceObject.pipe)([getNormalizedSearchTerm, normalizedCandidate => normalizedCandidate.includes(normalizedSearchTerm)]);
return isSearchMatch(blockType.title) || blockType.keywords?.some(isSearchMatch) || isSearchMatch(blockType.category) || typeof blockType.description === 'string' && isSearchMatch(blockType.description);
}
/**
* Returns a boolean indicating if a block has child blocks or not.
*
* @param {Object} state Data state.
* @param {string} blockName Block type name.
*
* @example
* ```js
* import { __, sprintf } from '@wordpress/i18n';
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const navigationBlockHasChildBlocks = useSelect( ( select ) =>
* select( blocksStore ).hasChildBlocks( 'core/navigation' ),
* []
* );
*
* return (
* <p>
* { sprintf(
* __( 'core/navigation has child blocks: %s' ),
* navigationBlockHasChildBlocks
* ) }
* </p>
* );
* };
* ```
*
* @return {boolean} True if a block contains child blocks and false otherwise.
*/
const selectors_hasChildBlocks = (state, blockName) => {
return selectors_getChildBlockNames(state, blockName).length > 0;
};
/**
* Returns a boolean indicating if a block has at least one child block with inserter support.
*
* @param {Object} state Data state.
* @param {string} blockName Block type name.
*
* @example
* ```js
* import { __, sprintf } from '@wordpress/i18n';
* import { store as blocksStore } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
*
* const ExampleComponent = () => {
* const navigationBlockHasChildBlocksWithInserterSupport = useSelect( ( select ) =>
* select( blocksStore ).hasChildBlocksWithInserterSupport(
* 'core/navigation'
* ),
* []
* );
*
* return (
* <p>
* { sprintf(
* __( 'core/navigation has child blocks with inserter support: %s' ),
* navigationBlockHasChildBlocksWithInserterSupport
* ) }
* </p>
* );
* };
* ```
*
* @return {boolean} True if a block contains at least one child blocks with inserter support
* and false otherwise.
*/
const selectors_hasChildBlocksWithInserterSupport = (state, blockName) => {
return selectors_getChildBlockNames(state, blockName).some(childBlockName => {
return selectors_hasBlockSupport(state, childBlockName, 'inserter', true);
});
};
/**
* DO-NOT-USE in production.
* This selector is created for internal/experimental only usage and may be
* removed anytime without any warning, causing breakage on any plugin or theme invoking it.
*/
const __experimentalHasContentRoleAttribute = rememo((state, blockTypeName) => {
const blockType = selectors_getBlockType(state, blockTypeName);
if (!blockType) {
return false;
}
return Object.entries(blockType.attributes).some(([, {
__experimentalRole
}]) => __experimentalRole === 'content');
}, (state, blockTypeName) => [state.blockTypes[blockTypeName]?.attributes]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/private-selectors.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const ROOT_BLOCK_SUPPORTS = ['background', 'backgroundColor', 'color', 'linkColor', 'captionColor', 'buttonColor', 'headingColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'padding', 'contentSize', 'wideSize', 'blockGap', 'textDecoration', 'textTransform', 'letterSpacing'];
/**
* Filters the list of supported styles for a given element.
*
* @param {string[]} blockSupports list of supported styles.
* @param {string|undefined} name block name.
* @param {string|undefined} element element name.
*
* @return {string[]} filtered list of supported styles.
*/
function filterElementBlockSupports(blockSupports, name, element) {
return blockSupports.filter(support => {
if (support === 'fontSize' && element === 'heading') {
return false;
}
// This is only available for links
if (support === 'textDecoration' && !name && element !== 'link') {
return false;
}
// This is only available for heading, button, caption and text
if (support === 'textTransform' && !name && !(['heading', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(element) || element === 'button' || element === 'caption' || element === 'text')) {
return false;
}
// This is only available for heading, button, caption and text
if (support === 'letterSpacing' && !name && !(['heading', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(element) || element === 'button' || element === 'caption' || element === 'text')) {
return false;
}
// Text columns is only available for blocks.
if (support === 'textColumns' && !name) {
return false;
}
return true;
});
}
/**
* Returns the list of supported styles for a given block name and element.
*/
const getSupportedStyles = rememo((state, name, element) => {
if (!name) {
return filterElementBlockSupports(ROOT_BLOCK_SUPPORTS, name, element);
}
const blockType = selectors_getBlockType(state, name);
if (!blockType) {
return [];
}
const supportKeys = [];
// Check for blockGap support.
// Block spacing support doesn't map directly to a single style property, so needs to be handled separately.
if (blockType?.supports?.spacing?.blockGap) {
supportKeys.push('blockGap');
}
// check for shadow support
if (blockType?.supports?.shadow) {
supportKeys.push('shadow');
}
Object.keys(__EXPERIMENTAL_STYLE_PROPERTY).forEach(styleName => {
if (!__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) {
return;
}
// Opting out means that, for certain support keys like background color,
// blocks have to explicitly set the support value false. If the key is
// unset, we still enable it.
if (__EXPERIMENTAL_STYLE_PROPERTY[styleName].requiresOptOut) {
if (__EXPERIMENTAL_STYLE_PROPERTY[styleName].support[0] in blockType.supports && getValueFromObjectPath(blockType.supports, __EXPERIMENTAL_STYLE_PROPERTY[styleName].support) !== false) {
supportKeys.push(styleName);
return;
}
}
if (getValueFromObjectPath(blockType.supports, __EXPERIMENTAL_STYLE_PROPERTY[styleName].support, false)) {
supportKeys.push(styleName);
}
});
return filterElementBlockSupports(supportKeys, name, element);
}, (state, name) => [state.blockTypes[name]]);
/**
* Returns the bootstrapped block type metadata for a give block name.
*
* @param {Object} state Data state.
* @param {string} name Block name.
*
* @return {Object} Bootstrapped block type metadata for a block.
*/
function getBootstrappedBlockType(state, name) {
return state.bootstrappedBlockTypes[name];
}
/**
* Returns all the unprocessed (before applying the `registerBlockType` filter)
* block type settings as passed during block registration.
*
* @param {Object} state Data state.
*
* @return {Array} Unprocessed block type settings for all blocks.
*/
function getUnprocessedBlockTypes(state) {
return state.unprocessedBlockTypes;
}
/**
* Returns all the block bindings sources registered.
*
* @param {Object} state Data state.
*
* @return {Object} All the registered sources and their properties.
*/
function getAllBlockBindingsSources(state) {
return state.blockBindingsSources;
}
/**
* Returns a specific block bindings source.
*
* @param {Object} state Data state.
* @param {string} sourceName Name of the source to get.
*
* @return {Object} The specific block binding source and its properties.
*/
function getBlockBindingsSource(state, sourceName) {
return state.blockBindingsSources[sourceName];
}
;// CONCATENATED MODULE: external ["wp","deprecated"]
const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/is-plain-object/dist/is-plain-object.mjs
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function is_plain_object_isObject(o) {
return Object.prototype.toString.call(o) === '[object Object]';
}
function isPlainObject(o) {
var ctor,prot;
if (is_plain_object_isObject(o) === false) return false;
// If has modified constructor
ctor = o.constructor;
if (ctor === undefined) return true;
// If has modified prototype
prot = ctor.prototype;
if (is_plain_object_isObject(prot) === false) return false;
// If constructor does not have an Object-specific method
if (prot.hasOwnProperty('isPrototypeOf') === false) {
return false;
}
// Most likely a plain Object
return true;
}
// EXTERNAL MODULE: ./node_modules/react-is/index.js
var react_is = __webpack_require__(8529);
;// CONCATENATED MODULE: external ["wp","hooks"]
const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/process-block-type.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('../api/registration').WPBlockType} WPBlockType */
const error = (...args) => window?.console?.error?.(...args);
const warn = (...args) => window?.console?.warn?.(...args);
/**
* Mapping of legacy category slugs to their latest normal values, used to
* accommodate updates of the default set of block categories.
*
* @type {Record<string,string>}
*/
const LEGACY_CATEGORY_MAPPING = {
common: 'text',
formatting: 'text',
layout: 'design'
};
/**
* Takes the unprocessed block type settings, merges them with block type metadata
* and applies all the existing filters for the registered block type.
* Next, it validates all the settings and performs additional processing to the block type definition.
*
* @param {string} name Block name.
* @param {WPBlockType} blockSettings Unprocessed block type settings.
*
* @return {WPBlockType | undefined} The block, if it has been processed and can be registered; otherwise `undefined`.
*/
const processBlockType = (name, blockSettings) => ({
select
}) => {
const blockType = {
name,
icon: BLOCK_ICON_DEFAULT,
keywords: [],
attributes: {},
providesContext: {},
usesContext: [],
selectors: {},
supports: {},
styles: [],
variations: [],
blockHooks: {},
save: () => null,
...select.getBootstrappedBlockType(name),
...blockSettings
};
const settings = (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.registerBlockType', blockType, name, null);
if (settings.description && typeof settings.description !== 'string') {
external_wp_deprecated_default()('Declaring non-string block descriptions', {
since: '6.2'
});
}
if (settings.deprecated) {
settings.deprecated = settings.deprecated.map(deprecation => Object.fromEntries(Object.entries(
// Only keep valid deprecation keys.
(0,external_wp_hooks_namespaceObject.applyFilters)('blocks.registerBlockType',
// Merge deprecation keys with pre-filter settings
// so that filters that depend on specific keys being
// present don't fail.
{
// Omit deprecation keys here so that deprecations
// can opt out of specific keys like "supports".
...omit(blockType, DEPRECATED_ENTRY_KEYS),
...deprecation
}, blockType.name, deprecation)).filter(([key]) => DEPRECATED_ENTRY_KEYS.includes(key))));
}
if (!isPlainObject(settings)) {
error('Block settings must be a valid object.');
return;
}
if (typeof settings.save !== 'function') {
error('The "save" property must be a valid function.');
return;
}
if ('edit' in settings && !(0,react_is.isValidElementType)(settings.edit)) {
error('The "edit" property must be a valid component.');
return;
}
// Canonicalize legacy categories to equivalent fallback.
if (LEGACY_CATEGORY_MAPPING.hasOwnProperty(settings.category)) {
settings.category = LEGACY_CATEGORY_MAPPING[settings.category];
}
if ('category' in settings && !select.getCategories().some(({
slug
}) => slug === settings.category)) {
warn('The block "' + name + '" is registered with an invalid category "' + settings.category + '".');
delete settings.category;
}
if (!('title' in settings) || settings.title === '') {
error('The block "' + name + '" must have a title.');
return;
}
if (typeof settings.title !== 'string') {
error('Block titles must be strings.');
return;
}
settings.icon = normalizeIconObject(settings.icon);
if (!isValidIcon(settings.icon.src)) {
error('The icon passed is invalid. ' + 'The icon should be a string, an element, a function, or an object following the specifications documented in https://developer.wordpress.org/block-editor/developers/block-api/block-registration/#icon-optional');
return;
}
return settings;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/actions.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('../api/registration').WPBlockVariation} WPBlockVariation */
/** @typedef {import('../api/registration').WPBlockType} WPBlockType */
/** @typedef {import('./reducer').WPBlockCategory} WPBlockCategory */
/**
* Returns an action object used in signalling that block types have been added.
* Ignored from documentation as the recommended usage for this action through registerBlockType from @wordpress/blocks.
*
* @ignore
*
* @param {WPBlockType|WPBlockType[]} blockTypes Object or array of objects representing blocks to added.
*
*
* @return {Object} Action object.
*/
function addBlockTypes(blockTypes) {
return {
type: 'ADD_BLOCK_TYPES',
blockTypes: Array.isArray(blockTypes) ? blockTypes : [blockTypes]
};
}
/**
* Signals that all block types should be computed again.
* It uses stored unprocessed block types and all the most recent list of registered filters.
*
* It addresses the issue where third party block filters get registered after third party blocks. A sample sequence:
* 1. Filter A.
* 2. Block B.
* 3. Block C.
* 4. Filter D.
* 5. Filter E.
* 6. Block F.
* 7. Filter G.
* In this scenario some filters would not get applied for all blocks because they are registered too late.
*/
function reapplyBlockTypeFilters() {
return ({
dispatch,
select
}) => {
const processedBlockTypes = [];
for (const [name, settings] of Object.entries(select.getUnprocessedBlockTypes())) {
const result = dispatch(processBlockType(name, settings));
if (result) {
processedBlockTypes.push(result);
}
}
if (!processedBlockTypes.length) {
return;
}
dispatch.addBlockTypes(processedBlockTypes);
};
}
function __experimentalReapplyBlockFilters() {
external_wp_deprecated_default()('wp.data.dispatch( "core/blocks" ).__experimentalReapplyBlockFilters', {
since: '6.4',
alternative: 'reapplyBlockFilters'
});
return reapplyBlockTypeFilters();
}
/**
* Returns an action object used to remove a registered block type.
* Ignored from documentation as the recommended usage for this action through unregisterBlockType from @wordpress/blocks.
*
* @ignore
*
* @param {string|string[]} names Block name or array of block names to be removed.
*
*
* @return {Object} Action object.
*/
function removeBlockTypes(names) {
return {
type: 'REMOVE_BLOCK_TYPES',
names: Array.isArray(names) ? names : [names]
};
}
/**
* Returns an action object used in signalling that new block styles have been added.
* Ignored from documentation as the recommended usage for this action through registerBlockStyle from @wordpress/blocks.
*
* @param {string} blockName Block name.
* @param {Array|Object} styles Block style object or array of block style objects.
*
* @ignore
*
* @return {Object} Action object.
*/
function addBlockStyles(blockName, styles) {
return {
type: 'ADD_BLOCK_STYLES',
styles: Array.isArray(styles) ? styles : [styles],
blockName
};
}
/**
* Returns an action object used in signalling that block styles have been removed.
* Ignored from documentation as the recommended usage for this action through unregisterBlockStyle from @wordpress/blocks.
*
* @ignore
*
* @param {string} blockName Block name.
* @param {Array|string} styleNames Block style names or array of block style names.
*
* @return {Object} Action object.
*/
function removeBlockStyles(blockName, styleNames) {
return {
type: 'REMOVE_BLOCK_STYLES',
styleNames: Array.isArray(styleNames) ? styleNames : [styleNames],
blockName
};
}
/**
* Returns an action object used in signalling that new block variations have been added.
* Ignored from documentation as the recommended usage for this action through registerBlockVariation from @wordpress/blocks.
*
* @ignore
*
* @param {string} blockName Block name.
* @param {WPBlockVariation|WPBlockVariation[]} variations Block variations.
*
* @return {Object} Action object.
*/
function addBlockVariations(blockName, variations) {
return {
type: 'ADD_BLOCK_VARIATIONS',
variations: Array.isArray(variations) ? variations : [variations],
blockName
};
}
/**
* Returns an action object used in signalling that block variations have been removed.
* Ignored from documentation as the recommended usage for this action through unregisterBlockVariation from @wordpress/blocks.
*
* @ignore
*
* @param {string} blockName Block name.
* @param {string|string[]} variationNames Block variation names.
*
* @return {Object} Action object.
*/
function removeBlockVariations(blockName, variationNames) {
return {
type: 'REMOVE_BLOCK_VARIATIONS',
variationNames: Array.isArray(variationNames) ? variationNames : [variationNames],
blockName
};
}
/**
* Returns an action object used to set the default block name.
* Ignored from documentation as the recommended usage for this action through setDefaultBlockName from @wordpress/blocks.
*
* @ignore
*
* @param {string} name Block name.
*
* @return {Object} Action object.
*/
function actions_setDefaultBlockName(name) {
return {
type: 'SET_DEFAULT_BLOCK_NAME',
name
};
}
/**
* Returns an action object used to set the name of the block used as a fallback
* for non-block content.
* Ignored from documentation as the recommended usage for this action through setFreeformContentHandlerName from @wordpress/blocks.
*
* @ignore
*
* @param {string} name Block name.
*
* @return {Object} Action object.
*/
function setFreeformFallbackBlockName(name) {
return {
type: 'SET_FREEFORM_FALLBACK_BLOCK_NAME',
name
};
}
/**
* Returns an action object used to set the name of the block used as a fallback
* for unregistered blocks.
* Ignored from documentation as the recommended usage for this action through setUnregisteredTypeHandlerName from @wordpress/blocks.
*
* @ignore
*
* @param {string} name Block name.
*
* @return {Object} Action object.
*/
function setUnregisteredFallbackBlockName(name) {
return {
type: 'SET_UNREGISTERED_FALLBACK_BLOCK_NAME',
name
};
}
/**
* Returns an action object used to set the name of the block used
* when grouping other blocks
* eg: in "Group/Ungroup" interactions
* Ignored from documentation as the recommended usage for this action through setGroupingBlockName from @wordpress/blocks.
*
* @ignore
*
* @param {string} name Block name.
*
* @return {Object} Action object.
*/
function actions_setGroupingBlockName(name) {
return {
type: 'SET_GROUPING_BLOCK_NAME',
name
};
}
/**
* Returns an action object used to set block categories.
* Ignored from documentation as the recommended usage for this action through setCategories from @wordpress/blocks.
*
* @ignore
*
* @param {WPBlockCategory[]} categories Block categories.
*
* @return {Object} Action object.
*/
function setCategories(categories) {
return {
type: 'SET_CATEGORIES',
categories
};
}
/**
* Returns an action object used to update a category.
* Ignored from documentation as the recommended usage for this action through updateCategory from @wordpress/blocks.
*
* @ignore
*
* @param {string} slug Block category slug.
* @param {Object} category Object containing the category properties that should be updated.
*
* @return {Object} Action object.
*/
function updateCategory(slug, category) {
return {
type: 'UPDATE_CATEGORY',
slug,
category
};
}
/**
* Returns an action object used to add block collections
* Ignored from documentation as the recommended usage for this action through registerBlockCollection from @wordpress/blocks.
*
* @ignore
*
* @param {string} namespace The namespace of the blocks to put in the collection
* @param {string} title The title to display in the block inserter
* @param {Object} icon (optional) The icon to display in the block inserter
*
* @return {Object} Action object.
*/
function addBlockCollection(namespace, title, icon) {
return {
type: 'ADD_BLOCK_COLLECTION',
namespace,
title,
icon
};
}
/**
* Returns an action object used to remove block collections
* Ignored from documentation as the recommended usage for this action through unregisterBlockCollection from @wordpress/blocks.
*
* @ignore
*
* @param {string} namespace The namespace of the blocks to put in the collection
*
* @return {Object} Action object.
*/
function removeBlockCollection(namespace) {
return {
type: 'REMOVE_BLOCK_COLLECTION',
namespace
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/private-actions.js
/**
* Internal dependencies
*/
/** @typedef {import('../api/registration').WPBlockType} WPBlockType */
/**
* Add bootstrapped block type metadata to the store. These metadata usually come from
* the `block.json` file and are either statically boostrapped from the server, or
* passed as the `metadata` parameter to the `registerBlockType` function.
*
* @param {string} name Block name.
* @param {WPBlockType} blockType Block type metadata.
*/
function addBootstrappedBlockType(name, blockType) {
return {
type: 'ADD_BOOTSTRAPPED_BLOCK_TYPE',
name,
blockType
};
}
/**
* Add unprocessed block type settings to the store. These data are passed as the
* `settings` parameter to the client-side `registerBlockType` function.
*
* @param {string} name Block name.
* @param {WPBlockType} blockType Unprocessed block type settings.
*/
function addUnprocessedBlockType(name, blockType) {
return ({
dispatch
}) => {
dispatch({
type: 'ADD_UNPROCESSED_BLOCK_TYPE',
name,
blockType
});
const processedBlockType = dispatch(processBlockType(name, blockType));
if (!processedBlockType) {
return;
}
dispatch.addBlockTypes(processedBlockType);
};
}
/**
* Register new block bindings source.
*
* @param {string} source Name of the source to register.
*/
function registerBlockBindingsSource(source) {
return {
type: 'REGISTER_BLOCK_BINDINGS_SOURCE',
sourceName: source.name,
sourceLabel: source.label,
useSource: source.useSource,
lockAttributesEditing: source.lockAttributesEditing
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/constants.js
const STORE_NAME = 'core/blocks';
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Store definition for the blocks namespace.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*
* @type {Object}
*/
const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
reducer: reducer,
selectors: selectors_namespaceObject,
actions: actions_namespaceObject
});
(0,external_wp_data_namespaceObject.register)(store);
unlock(store).registerPrivateSelectors(private_selectors_namespaceObject);
unlock(store).registerPrivateActions(private_actions_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/native.js
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
/* harmony default export */ const esm_browser_native = ({
randomUUID
});
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js
// Unique ID creation requires a high quality random # generator. In the browser we therefore
// require the crypto API and do not support built-in fallback to lower quality random number
// generators (like Math.random()).
let getRandomValues;
const rnds8 = new Uint8Array(16);
function rng() {
// lazy load so that environments that need to polyfill have a chance to do so
if (!getRandomValues) {
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
if (!getRandomValues) {
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
}
}
return getRandomValues(rnds8);
}
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js
/**
* Convert array of 16 byte values to UUID string format of the form:
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
*/
const byteToHex = [];
for (let i = 0; i < 256; ++i) {
byteToHex.push((i + 0x100).toString(16).slice(1));
}
function unsafeStringify(arr, offset = 0) {
// Note: Be careful editing this code! It's been tuned for performance
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
}
function stringify(arr, offset = 0) {
const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
// of the following:
// - One or more input array values don't map to a hex octet (leading to
// "undefined" in the uuid)
// - Invalid input values for the RFC `version` or `variant` fields
if (!validate(uuid)) {
throw TypeError('Stringified UUID is invalid');
}
return uuid;
}
/* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify)));
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js
function v4(options, buf, offset) {
if (esm_browser_native.randomUUID && !buf && !options) {
return esm_browser_native.randomUUID();
}
options = options || {};
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
rnds[6] = rnds[6] & 0x0f | 0x40;
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
if (buf) {
offset = offset || 0;
for (let i = 0; i < 16; ++i) {
buf[offset + i] = rnds[i];
}
return buf;
}
return unsafeStringify(rnds);
}
/* harmony default export */ const esm_browser_v4 = (v4);
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/factory.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Returns a block object given its type and attributes.
*
* @param {string} name Block name.
* @param {Object} attributes Block attributes.
* @param {?Array} innerBlocks Nested blocks.
*
* @return {Object} Block object.
*/
function createBlock(name, attributes = {}, innerBlocks = []) {
const sanitizedAttributes = __experimentalSanitizeBlockAttributes(name, attributes);
const clientId = esm_browser_v4();
// Blocks are stored with a unique ID, the assigned type name, the block
// attributes, and their inner blocks.
return {
clientId,
name,
isValid: true,
attributes: sanitizedAttributes,
innerBlocks
};
}
/**
* Given an array of InnerBlocks templates or Block Objects,
* returns an array of created Blocks from them.
* It handles the case of having InnerBlocks as Blocks by
* converting them to the proper format to continue recursively.
*
* @param {Array} innerBlocksOrTemplate Nested blocks or InnerBlocks templates.
*
* @return {Object[]} Array of Block objects.
*/
function createBlocksFromInnerBlocksTemplate(innerBlocksOrTemplate = []) {
return innerBlocksOrTemplate.map(innerBlock => {
const innerBlockTemplate = Array.isArray(innerBlock) ? innerBlock : [innerBlock.name, innerBlock.attributes, innerBlock.innerBlocks];
const [name, attributes, innerBlocks = []] = innerBlockTemplate;
return createBlock(name, attributes, createBlocksFromInnerBlocksTemplate(innerBlocks));
});
}
/**
* Given a block object, returns a copy of the block object while sanitizing its attributes,
* optionally merging new attributes and/or replacing its inner blocks.
*
* @param {Object} block Block instance.
* @param {Object} mergeAttributes Block attributes.
* @param {?Array} newInnerBlocks Nested blocks.
*
* @return {Object} A cloned block.
*/
function __experimentalCloneSanitizedBlock(block, mergeAttributes = {}, newInnerBlocks) {
const clientId = esm_browser_v4();
const sanitizedAttributes = __experimentalSanitizeBlockAttributes(block.name, {
...block.attributes,
...mergeAttributes
});
return {
...block,
clientId,
attributes: sanitizedAttributes,
innerBlocks: newInnerBlocks || block.innerBlocks.map(innerBlock => __experimentalCloneSanitizedBlock(innerBlock))
};
}
/**
* Given a block object, returns a copy of the block object,
* optionally merging new attributes and/or replacing its inner blocks.
*
* @param {Object} block Block instance.
* @param {Object} mergeAttributes Block attributes.
* @param {?Array} newInnerBlocks Nested blocks.
*
* @return {Object} A cloned block.
*/
function cloneBlock(block, mergeAttributes = {}, newInnerBlocks) {
const clientId = esm_browser_v4();
return {
...block,
clientId,
attributes: {
...block.attributes,
...mergeAttributes
},
innerBlocks: newInnerBlocks || block.innerBlocks.map(innerBlock => cloneBlock(innerBlock))
};
}
/**
* Returns a boolean indicating whether a transform is possible based on
* various bits of context.
*
* @param {Object} transform The transform object to validate.
* @param {string} direction Is this a 'from' or 'to' transform.
* @param {Array} blocks The blocks to transform from.
*
* @return {boolean} Is the transform possible?
*/
const isPossibleTransformForSource = (transform, direction, blocks) => {
if (!blocks.length) {
return false;
}
// If multiple blocks are selected, only multi block transforms
// or wildcard transforms are allowed.
const isMultiBlock = blocks.length > 1;
const firstBlockName = blocks[0].name;
const isValidForMultiBlocks = isWildcardBlockTransform(transform) || !isMultiBlock || transform.isMultiBlock;
if (!isValidForMultiBlocks) {
return false;
}
// Check non-wildcard transforms to ensure that transform is valid
// for a block selection of multiple blocks of different types.
if (!isWildcardBlockTransform(transform) && !blocks.every(block => block.name === firstBlockName)) {
return false;
}
// Only consider 'block' type transforms as valid.
const isBlockType = transform.type === 'block';
if (!isBlockType) {
return false;
}
// Check if the transform's block name matches the source block (or is a wildcard)
// only if this is a transform 'from'.
const sourceBlock = blocks[0];
const hasMatchingName = direction !== 'from' || transform.blocks.indexOf(sourceBlock.name) !== -1 || isWildcardBlockTransform(transform);
if (!hasMatchingName) {
return false;
}
// Don't allow single Grouping blocks to be transformed into
// a Grouping block.
if (!isMultiBlock && direction === 'from' && isContainerGroupBlock(sourceBlock.name) && isContainerGroupBlock(transform.blockName)) {
return false;
}
// If the transform has a `isMatch` function specified, check that it returns true.
if (!maybeCheckTransformIsMatch(transform, blocks)) {
return false;
}
return true;
};
/**
* Returns block types that the 'blocks' can be transformed into, based on
* 'from' transforms on other blocks.
*
* @param {Array} blocks The blocks to transform from.
*
* @return {Array} Block types that the blocks can be transformed into.
*/
const getBlockTypesForPossibleFromTransforms = blocks => {
if (!blocks.length) {
return [];
}
const allBlockTypes = getBlockTypes();
// filter all blocks to find those with a 'from' transform.
const blockTypesWithPossibleFromTransforms = allBlockTypes.filter(blockType => {
const fromTransforms = getBlockTransforms('from', blockType.name);
return !!findTransform(fromTransforms, transform => {
return isPossibleTransformForSource(transform, 'from', blocks);
});
});
return blockTypesWithPossibleFromTransforms;
};
/**
* Returns block types that the 'blocks' can be transformed into, based on
* the source block's own 'to' transforms.
*
* @param {Array} blocks The blocks to transform from.
*
* @return {Array} Block types that the source can be transformed into.
*/
const getBlockTypesForPossibleToTransforms = blocks => {
if (!blocks.length) {
return [];
}
const sourceBlock = blocks[0];
const blockType = getBlockType(sourceBlock.name);
const transformsTo = blockType ? getBlockTransforms('to', blockType.name) : [];
// filter all 'to' transforms to find those that are possible.
const possibleTransforms = transformsTo.filter(transform => {
return transform && isPossibleTransformForSource(transform, 'to', blocks);
});
// Build a list of block names using the possible 'to' transforms.
const blockNames = possibleTransforms.map(transformation => transformation.blocks).flat();
// Map block names to block types.
return blockNames.map(getBlockType);
};
/**
* Determines whether transform is a "block" type
* and if so whether it is a "wildcard" transform
* ie: targets "any" block type
*
* @param {Object} t the Block transform object
*
* @return {boolean} whether transform is a wildcard transform
*/
const isWildcardBlockTransform = t => t && t.type === 'block' && Array.isArray(t.blocks) && t.blocks.includes('*');
/**
* Determines whether the given Block is the core Block which
* acts as a container Block for other Blocks as part of the
* Grouping mechanics
*
* @param {string} name the name of the Block to test against
*
* @return {boolean} whether or not the Block is the container Block type
*/
const isContainerGroupBlock = name => name === getGroupingBlockName();
/**
* Returns an array of block types that the set of blocks received as argument
* can be transformed into.
*
* @param {Array} blocks Blocks array.
*
* @return {Array} Block types that the blocks argument can be transformed to.
*/
function getPossibleBlockTransformations(blocks) {
if (!blocks.length) {
return [];
}
const blockTypesForFromTransforms = getBlockTypesForPossibleFromTransforms(blocks);
const blockTypesForToTransforms = getBlockTypesForPossibleToTransforms(blocks);
return [...new Set([...blockTypesForFromTransforms, ...blockTypesForToTransforms])];
}
/**
* Given an array of transforms, returns the highest-priority transform where
* the predicate function returns a truthy value. A higher-priority transform
* is one with a lower priority value (i.e. first in priority order). Returns
* null if the transforms set is empty or the predicate function returns a
* falsey value for all entries.
*
* @param {Object[]} transforms Transforms to search.
* @param {Function} predicate Function returning true on matching transform.
*
* @return {?Object} Highest-priority transform candidate.
*/
function findTransform(transforms, predicate) {
// The hooks library already has built-in mechanisms for managing priority
// queue, so leverage via locally-defined instance.
const hooks = (0,external_wp_hooks_namespaceObject.createHooks)();
for (let i = 0; i < transforms.length; i++) {
const candidate = transforms[i];
if (predicate(candidate)) {
hooks.addFilter('transform', 'transform/' + i.toString(), result => result ? result : candidate, candidate.priority);
}
}
// Filter name is arbitrarily chosen but consistent with above aggregation.
return hooks.applyFilters('transform', null);
}
/**
* Returns normal block transforms for a given transform direction, optionally
* for a specific block by name, or an empty array if there are no transforms.
* If no block name is provided, returns transforms for all blocks. A normal
* transform object includes `blockName` as a property.
*
* @param {string} direction Transform direction ("to", "from").
* @param {string|Object} blockTypeOrName Block type or name.
*
* @return {Array} Block transforms for direction.
*/
function getBlockTransforms(direction, blockTypeOrName) {
// When retrieving transforms for all block types, recurse into self.
if (blockTypeOrName === undefined) {
return getBlockTypes().map(({
name
}) => getBlockTransforms(direction, name)).flat();
}
// Validate that block type exists and has array of direction.
const blockType = normalizeBlockType(blockTypeOrName);
const {
name: blockName,
transforms
} = blockType || {};
if (!transforms || !Array.isArray(transforms[direction])) {
return [];
}
const usingMobileTransformations = transforms.supportedMobileTransforms && Array.isArray(transforms.supportedMobileTransforms);
const filteredTransforms = usingMobileTransformations ? transforms[direction].filter(t => {
if (t.type === 'raw') {
return true;
}
if (!t.blocks || !t.blocks.length) {
return false;
}
if (isWildcardBlockTransform(t)) {
return true;
}
return t.blocks.every(transformBlockName => transforms.supportedMobileTransforms.includes(transformBlockName));
}) : transforms[direction];
// Map transforms to normal form.
return filteredTransforms.map(transform => ({
...transform,
blockName,
usingMobileTransformations
}));
}
/**
* Checks that a given transforms isMatch method passes for given source blocks.
*
* @param {Object} transform A transform object.
* @param {Array} blocks Blocks array.
*
* @return {boolean} True if given blocks are a match for the transform.
*/
function maybeCheckTransformIsMatch(transform, blocks) {
if (typeof transform.isMatch !== 'function') {
return true;
}
const sourceBlock = blocks[0];
const attributes = transform.isMultiBlock ? blocks.map(block => block.attributes) : sourceBlock.attributes;
const block = transform.isMultiBlock ? blocks : sourceBlock;
return transform.isMatch(attributes, block);
}
/**
* Switch one or more blocks into one or more blocks of the new block type.
*
* @param {Array|Object} blocks Blocks array or block object.
* @param {string} name Block name.
*
* @return {?Array} Array of blocks or null.
*/
function switchToBlockType(blocks, name) {
const blocksArray = Array.isArray(blocks) ? blocks : [blocks];
const isMultiBlock = blocksArray.length > 1;
const firstBlock = blocksArray[0];
const sourceName = firstBlock.name;
// Find the right transformation by giving priority to the "to"
// transformation.
const transformationsFrom = getBlockTransforms('from', name);
const transformationsTo = getBlockTransforms('to', sourceName);
const transformation = findTransform(transformationsTo, t => t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(name) !== -1) && (!isMultiBlock || t.isMultiBlock) && maybeCheckTransformIsMatch(t, blocksArray)) || findTransform(transformationsFrom, t => t.type === 'block' && (isWildcardBlockTransform(t) || t.blocks.indexOf(sourceName) !== -1) && (!isMultiBlock || t.isMultiBlock) && maybeCheckTransformIsMatch(t, blocksArray));
// Stop if there is no valid transformation.
if (!transformation) {
return null;
}
let transformationResults;
if (transformation.isMultiBlock) {
if ('__experimentalConvert' in transformation) {
transformationResults = transformation.__experimentalConvert(blocksArray);
} else {
transformationResults = transformation.transform(blocksArray.map(currentBlock => currentBlock.attributes), blocksArray.map(currentBlock => currentBlock.innerBlocks));
}
} else if ('__experimentalConvert' in transformation) {
transformationResults = transformation.__experimentalConvert(firstBlock);
} else {
transformationResults = transformation.transform(firstBlock.attributes, firstBlock.innerBlocks);
}
// Ensure that the transformation function returned an object or an array
// of objects.
if (transformationResults === null || typeof transformationResults !== 'object') {
return null;
}
// If the transformation function returned a single object, we want to work
// with an array instead.
transformationResults = Array.isArray(transformationResults) ? transformationResults : [transformationResults];
// Ensure that every block object returned by the transformation has a
// valid block type.
if (transformationResults.some(result => !getBlockType(result.name))) {
return null;
}
const hasSwitchedBlock = transformationResults.some(result => result.name === name);
// Ensure that at least one block object returned by the transformation has
// the expected "destination" block type.
if (!hasSwitchedBlock) {
return null;
}
const ret = transformationResults.map((result, index, results) => {
/**
* Filters an individual transform result from block transformation.
* All of the original blocks are passed, since transformations are
* many-to-many, not one-to-one.
*
* @param {Object} transformedBlock The transformed block.
* @param {Object[]} blocks Original blocks transformed.
* @param {Object[]} index Index of the transformed block on the array of results.
* @param {Object[]} results An array all the blocks that resulted from the transformation.
*/
return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.switchToBlockType.transformedBlock', result, blocks, index, results);
});
return ret;
}
/**
* Create a block object from the example API.
*
* @param {string} name
* @param {Object} example
*
* @return {Object} block.
*/
const getBlockFromExample = (name, example) => {
try {
var _example$innerBlocks;
return createBlock(name, example.attributes, ((_example$innerBlocks = example.innerBlocks) !== null && _example$innerBlocks !== void 0 ? _example$innerBlocks : []).map(innerBlock => getBlockFromExample(innerBlock.name, innerBlock)));
} catch {
return createBlock('core/missing', {
originalName: name,
originalContent: '',
originalUndelimitedContent: ''
});
}
};
;// CONCATENATED MODULE: external ["wp","blockSerializationDefaultParser"]
const external_wp_blockSerializationDefaultParser_namespaceObject = window["wp"]["blockSerializationDefaultParser"];
;// CONCATENATED MODULE: external ["wp","autop"]
const external_wp_autop_namespaceObject = window["wp"]["autop"];
;// CONCATENATED MODULE: external "React"
const external_React_namespaceObject = window["React"];
;// CONCATENATED MODULE: external ["wp","isShallowEqual"]
const 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/blocks/build-module/api/parser/serialize-raw-block.js
/**
* Internal dependencies
*/
/**
* @typedef {Object} Options Serialization options.
* @property {boolean} [isCommentDelimited=true] Whether to output HTML comments around blocks.
*/
/** @typedef {import("./").WPRawBlock} WPRawBlock */
/**
* Serializes a block node into the native HTML-comment-powered block format.
* CAVEAT: This function is intended for re-serializing blocks as parsed by
* valid parsers and skips any validation steps. This is NOT a generic
* serialization function for in-memory blocks. For most purposes, see the
* following functions available in the `@wordpress/blocks` package:
*
* @see serializeBlock
* @see serialize
*
* For more on the format of block nodes as returned by valid parsers:
*
* @see `@wordpress/block-serialization-default-parser` package
* @see `@wordpress/block-serialization-spec-parser` package
*
* @param {WPRawBlock} rawBlock A block node as returned by a valid parser.
* @param {Options} [options={}] Serialization options.
*
* @return {string} An HTML string representing a block.
*/
function serializeRawBlock(rawBlock, options = {}) {
const {
isCommentDelimited = true
} = options;
const {
blockName,
attrs = {},
innerBlocks = [],
innerContent = []
} = rawBlock;
let childIndex = 0;
const content = innerContent.map(item =>
// `null` denotes a nested block, otherwise we have an HTML fragment.
item !== null ? item : serializeRawBlock(innerBlocks[childIndex++], options)).join('\n').replace(/\n+/g, '\n').trim();
return isCommentDelimited ? getCommentDelimitedContent(blockName, attrs, content) : content;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/serializer.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('./parser').WPBlock} WPBlock */
/**
* @typedef {Object} WPBlockSerializationOptions Serialization Options.
*
* @property {boolean} isInnerBlocks Whether we are serializing inner blocks.
*/
/**
* Returns the block's default classname from its name.
*
* @param {string} blockName The block name.
*
* @return {string} The block's default class.
*/
function getBlockDefaultClassName(blockName) {
// Generated HTML classes for blocks follow the `wp-block-{name}` nomenclature.
// Blocks provided by WordPress drop the prefixes 'core/' or 'core-' (historically used in 'core-embed/').
const className = 'wp-block-' + blockName.replace(/\//, '-').replace(/^core-/, '');
return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getBlockDefaultClassName', className, blockName);
}
/**
* Returns the block's default menu item classname from its name.
*
* @param {string} blockName The block name.
*
* @return {string} The block's default menu item class.
*/
function getBlockMenuDefaultClassName(blockName) {
// Generated HTML classes for blocks follow the `editor-block-list-item-{name}` nomenclature.
// Blocks provided by WordPress drop the prefixes 'core/' or 'core-' (historically used in 'core-embed/').
const className = 'editor-block-list-item-' + blockName.replace(/\//, '-').replace(/^core-/, '');
return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getBlockMenuDefaultClassName', className, blockName);
}
const blockPropsProvider = {};
const innerBlocksPropsProvider = {};
/**
* Call within a save function to get the props for the block wrapper.
*
* @param {Object} props Optional. Props to pass to the element.
*/
function getBlockProps(props = {}) {
const {
blockType,
attributes
} = blockPropsProvider;
return getBlockProps.skipFilters ? props : (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getSaveContent.extraProps', {
...props
}, blockType, attributes);
}
/**
* Call within a save function to get the props for the inner blocks wrapper.
*
* @param {Object} props Optional. Props to pass to the element.
*/
function getInnerBlocksProps(props = {}) {
const {
innerBlocks
} = innerBlocksPropsProvider;
// Allow a different component to be passed to getSaveElement to handle
// inner blocks, bypassing the default serialisation.
if (!Array.isArray(innerBlocks)) {
return {
...props,
children: innerBlocks
};
}
// Value is an array of blocks, so defer to block serializer.
const html = serialize(innerBlocks, {
isInnerBlocks: true
});
// Use special-cased raw HTML tag to avoid default escaping.
const children = (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, html);
return {
...props,
children
};
}
/**
* Given a block type containing a save render implementation and attributes, returns the
* enhanced element to be saved or string when raw HTML expected.
*
* @param {string|Object} blockTypeOrName Block type or name.
* @param {Object} attributes Block attributes.
* @param {?Array} innerBlocks Nested blocks.
*
* @return {Object|string} Save element or raw HTML string.
*/
function getSaveElement(blockTypeOrName, attributes, innerBlocks = []) {
const blockType = normalizeBlockType(blockTypeOrName);
if (!blockType?.save) return null;
let {
save
} = blockType;
// Component classes are unsupported for save since serialization must
// occur synchronously. For improved interoperability with higher-order
// components which often return component class, emulate basic support.
if (save.prototype instanceof external_wp_element_namespaceObject.Component) {
const instance = new save({
attributes
});
save = instance.render.bind(instance);
}
blockPropsProvider.blockType = blockType;
blockPropsProvider.attributes = attributes;
innerBlocksPropsProvider.innerBlocks = innerBlocks;
let element = save({
attributes,
innerBlocks
});
if (element !== null && typeof element === 'object' && (0,external_wp_hooks_namespaceObject.hasFilter)('blocks.getSaveContent.extraProps') && !(blockType.apiVersion > 1)) {
/**
* Filters the props applied to the block save result element.
*
* @param {Object} props Props applied to save element.
* @param {WPBlock} blockType Block type definition.
* @param {Object} attributes Block attributes.
*/
const props = (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getSaveContent.extraProps', {
...element.props
}, blockType, attributes);
if (!external_wp_isShallowEqual_default()(props, element.props)) {
element = (0,external_wp_element_namespaceObject.cloneElement)(element, props);
}
}
/**
* Filters the save result of a block during serialization.
*
* @param {Element} element Block save result.
* @param {WPBlock} blockType Block type definition.
* @param {Object} attributes Block attributes.
*/
return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getSaveElement', element, blockType, attributes);
}
/**
* Given a block type containing a save render implementation and attributes, returns the
* static markup to be saved.
*
* @param {string|Object} blockTypeOrName Block type or name.
* @param {Object} attributes Block attributes.
* @param {?Array} innerBlocks Nested blocks.
*
* @return {string} Save content.
*/
function getSaveContent(blockTypeOrName, attributes, innerBlocks) {
const blockType = normalizeBlockType(blockTypeOrName);
return (0,external_wp_element_namespaceObject.renderToString)(getSaveElement(blockType, attributes, innerBlocks));
}
/**
* Returns attributes which are to be saved and serialized into the block
* comment delimiter.
*
* When a block exists in memory it contains as its attributes both those
* parsed the block comment delimiter _and_ those which matched from the
* contents of the block.
*
* This function returns only those attributes which are needed to persist and
* which cannot be matched from the block content.
*
* @param {Object<string,*>} blockType Block type.
* @param {Object<string,*>} attributes Attributes from in-memory block data.
*
* @return {Object<string,*>} Subset of attributes for comment serialization.
*/
function getCommentAttributes(blockType, attributes) {
var _blockType$attributes;
return Object.entries((_blockType$attributes = blockType.attributes) !== null && _blockType$attributes !== void 0 ? _blockType$attributes : {}).reduce((accumulator, [key, attributeSchema]) => {
const value = attributes[key];
// Ignore undefined values.
if (undefined === value) {
return accumulator;
}
// Ignore all attributes but the ones with an "undefined" source
// "undefined" source refers to attributes saved in the block comment.
if (attributeSchema.source !== undefined) {
return accumulator;
}
// Ignore default value.
if ('default' in attributeSchema && JSON.stringify(attributeSchema.default) === JSON.stringify(value)) {
return accumulator;
}
// Otherwise, include in comment set.
accumulator[key] = value;
return accumulator;
}, {});
}
/**
* Given an attributes object, returns a string in the serialized attributes
* format prepared for post content.
*
* @param {Object} attributes Attributes object.
*
* @return {string} Serialized attributes.
*/
function serializeAttributes(attributes) {
return JSON.stringify(attributes)
// Don't break HTML comments.
.replace(/--/g, '\\u002d\\u002d')
// Don't break non-standard-compliant tools.
.replace(/</g, '\\u003c').replace(/>/g, '\\u003e').replace(/&/g, '\\u0026')
// Bypass server stripslashes behavior which would unescape stringify's
// escaping of quotation mark.
//
// See: https://developer.wordpress.org/reference/functions/wp_kses_stripslashes/
.replace(/\\"/g, '\\u0022');
}
/**
* Given a block object, returns the Block's Inner HTML markup.
*
* @param {Object} block Block instance.
*
* @return {string} HTML.
*/
function getBlockInnerHTML(block) {
// If block was parsed as invalid or encounters an error while generating
// save content, use original content instead to avoid content loss. If a
// block contains nested content, exempt it from this condition because we
// otherwise have no access to its original content and content loss would
// still occur.
let saveContent = block.originalContent;
if (block.isValid || block.innerBlocks.length) {
try {
saveContent = getSaveContent(block.name, block.attributes, block.innerBlocks);
} catch (error) {}
}
return saveContent;
}
/**
* Returns the content of a block, including comment delimiters.
*
* @param {string} rawBlockName Block name.
* @param {Object} attributes Block attributes.
* @param {string} content Block save content.
*
* @return {string} Comment-delimited block content.
*/
function getCommentDelimitedContent(rawBlockName, attributes, content) {
const serializedAttributes = attributes && Object.entries(attributes).length ? serializeAttributes(attributes) + ' ' : '';
// Strip core blocks of their namespace prefix.
const blockName = rawBlockName?.startsWith('core/') ? rawBlockName.slice(5) : rawBlockName;
// @todo make the `wp:` prefix potentially configurable.
if (!content) {
return `<!-- wp:${blockName} ${serializedAttributes}/-->`;
}
return `<!-- wp:${blockName} ${serializedAttributes}-->\n` + content + `\n<!-- /wp:${blockName} -->`;
}
/**
* Returns the content of a block, including comment delimiters, determining
* serialized attributes and content form from the current state of the block.
*
* @param {WPBlock} block Block instance.
* @param {WPBlockSerializationOptions} options Serialization options.
*
* @return {string} Serialized block.
*/
function serializeBlock(block, {
isInnerBlocks = false
} = {}) {
if (!block.isValid && block.__unstableBlockSource) {
return serializeRawBlock(block.__unstableBlockSource);
}
const blockName = block.name;
const saveContent = getBlockInnerHTML(block);
if (blockName === getUnregisteredTypeHandlerName() || !isInnerBlocks && blockName === getFreeformContentHandlerName()) {
return saveContent;
}
const blockType = getBlockType(blockName);
if (!blockType) {
return saveContent;
}
const saveAttributes = getCommentAttributes(blockType, block.attributes);
return getCommentDelimitedContent(blockName, saveAttributes, saveContent);
}
function __unstableSerializeAndClean(blocks) {
// A single unmodified default block is assumed to
// be equivalent to an empty post.
if (blocks.length === 1 && isUnmodifiedDefaultBlock(blocks[0])) {
blocks = [];
}
let content = serialize(blocks);
// For compatibility, treat a post consisting of a
// single freeform block as legacy content and apply
// pre-block-editor removep'd content formatting.
if (blocks.length === 1 && blocks[0].name === getFreeformContentHandlerName() && blocks[0].name === 'core/freeform') {
content = (0,external_wp_autop_namespaceObject.removep)(content);
}
return content;
}
/**
* Takes a block or set of blocks and returns the serialized post content.
*
* @param {Array} blocks Block(s) to serialize.
* @param {WPBlockSerializationOptions} options Serialization options.
*
* @return {string} The post content.
*/
function serialize(blocks, options) {
const blocksArray = Array.isArray(blocks) ? blocks : [blocks];
return blocksArray.map(block => serializeBlock(block, options)).join('\n\n');
}
;// CONCATENATED MODULE: ./node_modules/simple-html-tokenizer/dist/es6/index.js
/**
* generated from https://raw.githubusercontent.com/w3c/html/26b5126f96f736f796b9e29718138919dd513744/entities.json
* do not edit
*/
var namedCharRefs = {
Aacute: "Á", aacute: "á", Abreve: "Ă", abreve: "ă", ac: "∾", acd: "∿", acE: "∾̳", Acirc: "Â", acirc: "â", acute: "´", Acy: "А", acy: "а", AElig: "Æ", aelig: "æ", af: "\u2061", Afr: "𝔄", afr: "𝔞", Agrave: "À", agrave: "à", alefsym: "ℵ", aleph: "ℵ", Alpha: "Α", alpha: "α", Amacr: "Ā", amacr: "ā", amalg: "⨿", amp: "&", AMP: "&", andand: "⩕", And: "⩓", and: "∧", andd: "⩜", andslope: "⩘", andv: "⩚", ang: "∠", ange: "⦤", angle: "∠", angmsdaa: "⦨", angmsdab: "⦩", angmsdac: "⦪", angmsdad: "⦫", angmsdae: "⦬", angmsdaf: "⦭", angmsdag: "⦮", angmsdah: "⦯", angmsd: "∡", angrt: "∟", angrtvb: "⊾", angrtvbd: "⦝", angsph: "∢", angst: "Å", angzarr: "⍼", Aogon: "Ą", aogon: "ą", Aopf: "𝔸", aopf: "𝕒", apacir: "⩯", ap: "≈", apE: "⩰", ape: "≊", apid: "≋", apos: "'", ApplyFunction: "\u2061", approx: "≈", approxeq: "≊", Aring: "Å", aring: "å", Ascr: "𝒜", ascr: "𝒶", Assign: "≔", ast: "*", asymp: "≈", asympeq: "≍", Atilde: "Ã", atilde: "ã", Auml: "Ä", auml: "ä", awconint: "∳", awint: "⨑", backcong: "≌", backepsilon: "϶", backprime: "‵", backsim: "∽", backsimeq: "⋍", Backslash: "∖", Barv: "⫧", barvee: "⊽", barwed: "⌅", Barwed: "⌆", barwedge: "⌅", bbrk: "⎵", bbrktbrk: "⎶", bcong: "≌", Bcy: "Б", bcy: "б", bdquo: "„", becaus: "∵", because: "∵", Because: "∵", bemptyv: "⦰", bepsi: "϶", bernou: "ℬ", Bernoullis: "ℬ", Beta: "Β", beta: "β", beth: "ℶ", between: "≬", Bfr: "𝔅", bfr: "𝔟", bigcap: "⋂", bigcirc: "◯", bigcup: "⋃", bigodot: "⨀", bigoplus: "⨁", bigotimes: "⨂", bigsqcup: "⨆", bigstar: "★", bigtriangledown: "▽", bigtriangleup: "△", biguplus: "⨄", bigvee: "⋁", bigwedge: "⋀", bkarow: "⤍", blacklozenge: "⧫", blacksquare: "▪", blacktriangle: "▴", blacktriangledown: "▾", blacktriangleleft: "◂", blacktriangleright: "▸", blank: "␣", blk12: "▒", blk14: "░", blk34: "▓", block: "█", bne: "=⃥", bnequiv: "≡⃥", bNot: "⫭", bnot: "⌐", Bopf: "𝔹", bopf: "𝕓", bot: "⊥", bottom: "⊥", bowtie: "⋈", boxbox: "⧉", boxdl: "┐", boxdL: "╕", boxDl: "╖", boxDL: "╗", boxdr: "┌", boxdR: "╒", boxDr: "╓", boxDR: "╔", boxh: "─", boxH: "═", boxhd: "┬", boxHd: "╤", boxhD: "╥", boxHD: "╦", boxhu: "┴", boxHu: "╧", boxhU: "╨", boxHU: "╩", boxminus: "⊟", boxplus: "⊞", boxtimes: "⊠", boxul: "┘", boxuL: "╛", boxUl: "╜", boxUL: "╝", boxur: "└", boxuR: "╘", boxUr: "╙", boxUR: "╚", boxv: "│", boxV: "║", boxvh: "┼", boxvH: "╪", boxVh: "╫", boxVH: "╬", boxvl: "┤", boxvL: "╡", boxVl: "╢", boxVL: "╣", boxvr: "├", boxvR: "╞", boxVr: "╟", boxVR: "╠", bprime: "‵", breve: "˘", Breve: "˘", brvbar: "¦", bscr: "𝒷", Bscr: "ℬ", bsemi: "⁏", bsim: "∽", bsime: "⋍", bsolb: "⧅", bsol: "\\", bsolhsub: "⟈", bull: "•", bullet: "•", bump: "≎", bumpE: "⪮", bumpe: "≏", Bumpeq: "≎", bumpeq: "≏", Cacute: "Ć", cacute: "ć", capand: "⩄", capbrcup: "⩉", capcap: "⩋", cap: "∩", Cap: "⋒", capcup: "⩇", capdot: "⩀", CapitalDifferentialD: "ⅅ", caps: "∩︀", caret: "⁁", caron: "ˇ", Cayleys: "ℭ", ccaps: "⩍", Ccaron: "Č", ccaron: "č", Ccedil: "Ç", ccedil: "ç", Ccirc: "Ĉ", ccirc: "ĉ", Cconint: "∰", ccups: "⩌", ccupssm: "⩐", Cdot: "Ċ", cdot: "ċ", cedil: "¸", Cedilla: "¸", cemptyv: "⦲", cent: "¢", centerdot: "·", CenterDot: "·", cfr: "𝔠", Cfr: "ℭ", CHcy: "Ч", chcy: "ч", check: "✓", checkmark: "✓", Chi: "Χ", chi: "χ", circ: "ˆ", circeq: "≗", circlearrowleft: "↺", circlearrowright: "↻", circledast: "⊛", circledcirc: "⊚", circleddash: "⊝", CircleDot: "⊙", circledR: "®", circledS: "Ⓢ", CircleMinus: "⊖", CirclePlus: "⊕", CircleTimes: "⊗", cir: "○", cirE: "⧃", cire: "≗", cirfnint: "⨐", cirmid: "⫯", cirscir: "⧂", ClockwiseContourIntegral: "∲", CloseCurlyDoubleQuote: "”", CloseCurlyQuote: "’", clubs: "♣", clubsuit: "♣", colon: ":", Colon: "∷", Colone: "⩴", colone: "≔", coloneq: "≔", comma: ",", commat: "@", comp: "∁", compfn: "∘", complement: "∁", complexes: "ℂ", cong: "≅", congdot: "⩭", Congruent: "≡", conint: "∮", Conint: "∯", ContourIntegral: "∮", copf: "𝕔", Copf: "ℂ", coprod: "∐", Coproduct: "∐", copy: "©", COPY: "©", copysr: "℗", CounterClockwiseContourIntegral: "∳", crarr: "↵", cross: "✗", Cross: "⨯", Cscr: "𝒞", cscr: "𝒸", csub: "⫏", csube: "⫑", csup: "⫐", csupe: "⫒", ctdot: "⋯", cudarrl: "⤸", cudarrr: "⤵", cuepr: "⋞", cuesc: "⋟", cularr: "↶", cularrp: "⤽", cupbrcap: "⩈", cupcap: "⩆", CupCap: "≍", cup: "∪", Cup: "⋓", cupcup: "⩊", cupdot: "⊍", cupor: "⩅", cups: "∪︀", curarr: "↷", curarrm: "⤼", curlyeqprec: "⋞", curlyeqsucc: "⋟", curlyvee: "⋎", curlywedge: "⋏", curren: "¤", curvearrowleft: "↶", curvearrowright: "↷", cuvee: "⋎", cuwed: "⋏", cwconint: "∲", cwint: "∱", cylcty: "⌭", dagger: "†", Dagger: "‡", daleth: "ℸ", darr: "↓", Darr: "↡", dArr: "⇓", dash: "‐", Dashv: "⫤", dashv: "⊣", dbkarow: "⤏", dblac: "˝", Dcaron: "Ď", dcaron: "ď", Dcy: "Д", dcy: "д", ddagger: "‡", ddarr: "⇊", DD: "ⅅ", dd: "ⅆ", DDotrahd: "⤑", ddotseq: "⩷", deg: "°", Del: "∇", Delta: "Δ", delta: "δ", demptyv: "⦱", dfisht: "⥿", Dfr: "𝔇", dfr: "𝔡", dHar: "⥥", dharl: "⇃", dharr: "⇂", DiacriticalAcute: "´", DiacriticalDot: "˙", DiacriticalDoubleAcute: "˝", DiacriticalGrave: "`", DiacriticalTilde: "˜", diam: "⋄", diamond: "⋄", Diamond: "⋄", diamondsuit: "♦", diams: "♦", die: "¨", DifferentialD: "ⅆ", digamma: "ϝ", disin: "⋲", div: "÷", divide: "÷", divideontimes: "⋇", divonx: "⋇", DJcy: "Ђ", djcy: "ђ", dlcorn: "⌞", dlcrop: "⌍", dollar: "$", Dopf: "𝔻", dopf: "𝕕", Dot: "¨", dot: "˙", DotDot: "⃜", doteq: "≐", doteqdot: "≑", DotEqual: "≐", dotminus: "∸", dotplus: "∔", dotsquare: "⊡", doublebarwedge: "⌆", DoubleContourIntegral: "∯", DoubleDot: "¨", DoubleDownArrow: "⇓", DoubleLeftArrow: "⇐", DoubleLeftRightArrow: "⇔", DoubleLeftTee: "⫤", DoubleLongLeftArrow: "⟸", DoubleLongLeftRightArrow: "⟺", DoubleLongRightArrow: "⟹", DoubleRightArrow: "⇒", DoubleRightTee: "⊨", DoubleUpArrow: "⇑", DoubleUpDownArrow: "⇕", DoubleVerticalBar: "∥", DownArrowBar: "⤓", downarrow: "↓", DownArrow: "↓", Downarrow: "⇓", DownArrowUpArrow: "⇵", DownBreve: "̑", downdownarrows: "⇊", downharpoonleft: "⇃", downharpoonright: "⇂", DownLeftRightVector: "⥐", DownLeftTeeVector: "⥞", DownLeftVectorBar: "⥖", DownLeftVector: "↽", DownRightTeeVector: "⥟", DownRightVectorBar: "⥗", DownRightVector: "⇁", DownTeeArrow: "↧", DownTee: "⊤", drbkarow: "⤐", drcorn: "⌟", drcrop: "⌌", Dscr: "𝒟", dscr: "𝒹", DScy: "Ѕ", dscy: "ѕ", dsol: "⧶", Dstrok: "Đ", dstrok: "đ", dtdot: "⋱", dtri: "▿", dtrif: "▾", duarr: "⇵", duhar: "⥯", dwangle: "⦦", DZcy: "Џ", dzcy: "џ", dzigrarr: "⟿", Eacute: "É", eacute: "é", easter: "⩮", Ecaron: "Ě", ecaron: "ě", Ecirc: "Ê", ecirc: "ê", ecir: "≖", ecolon: "≕", Ecy: "Э", ecy: "э", eDDot: "⩷", Edot: "Ė", edot: "ė", eDot: "≑", ee: "ⅇ", efDot: "≒", Efr: "𝔈", efr: "𝔢", eg: "⪚", Egrave: "È", egrave: "è", egs: "⪖", egsdot: "⪘", el: "⪙", Element: "∈", elinters: "⏧", ell: "ℓ", els: "⪕", elsdot: "⪗", Emacr: "Ē", emacr: "ē", empty: "∅", emptyset: "∅", EmptySmallSquare: "◻", emptyv: "∅", EmptyVerySmallSquare: "▫", emsp13: " ", emsp14: " ", emsp: " ", ENG: "Ŋ", eng: "ŋ", ensp: " ", Eogon: "Ę", eogon: "ę", Eopf: "𝔼", eopf: "𝕖", epar: "⋕", eparsl: "⧣", eplus: "⩱", epsi: "ε", Epsilon: "Ε", epsilon: "ε", epsiv: "ϵ", eqcirc: "≖", eqcolon: "≕", eqsim: "≂", eqslantgtr: "⪖", eqslantless: "⪕", Equal: "⩵", equals: "=", EqualTilde: "≂", equest: "≟", Equilibrium: "⇌", equiv: "≡", equivDD: "⩸", eqvparsl: "⧥", erarr: "⥱", erDot: "≓", escr: "ℯ", Escr: "ℰ", esdot: "≐", Esim: "⩳", esim: "≂", Eta: "Η", eta: "η", ETH: "Ð", eth: "ð", Euml: "Ë", euml: "ë", euro: "€", excl: "!", exist: "∃", Exists: "∃", expectation: "ℰ", exponentiale: "ⅇ", ExponentialE: "ⅇ", fallingdotseq: "≒", Fcy: "Ф", fcy: "ф", female: "♀", ffilig: "ffi", fflig: "ff", ffllig: "ffl", Ffr: "𝔉", ffr: "𝔣", filig: "fi", FilledSmallSquare: "◼", FilledVerySmallSquare: "▪", fjlig: "fj", flat: "♭", fllig: "fl", fltns: "▱", fnof: "ƒ", Fopf: "𝔽", fopf: "𝕗", forall: "∀", ForAll: "∀", fork: "⋔", forkv: "⫙", Fouriertrf: "ℱ", fpartint: "⨍", frac12: "½", frac13: "⅓", frac14: "¼", frac15: "⅕", frac16: "⅙", frac18: "⅛", frac23: "⅔", frac25: "⅖", frac34: "¾", frac35: "⅗", frac38: "⅜", frac45: "⅘", frac56: "⅚", frac58: "⅝", frac78: "⅞", frasl: "⁄", frown: "⌢", fscr: "𝒻", Fscr: "ℱ", gacute: "ǵ", Gamma: "Γ", gamma: "γ", Gammad: "Ϝ", gammad: "ϝ", gap: "⪆", Gbreve: "Ğ", gbreve: "ğ", Gcedil: "Ģ", Gcirc: "Ĝ", gcirc: "ĝ", Gcy: "Г", gcy: "г", Gdot: "Ġ", gdot: "ġ", ge: "≥", gE: "≧", gEl: "⪌", gel: "⋛", geq: "≥", geqq: "≧", geqslant: "⩾", gescc: "⪩", ges: "⩾", gesdot: "⪀", gesdoto: "⪂", gesdotol: "⪄", gesl: "⋛︀", gesles: "⪔", Gfr: "𝔊", gfr: "𝔤", gg: "≫", Gg: "⋙", ggg: "⋙", gimel: "ℷ", GJcy: "Ѓ", gjcy: "ѓ", gla: "⪥", gl: "≷", glE: "⪒", glj: "⪤", gnap: "⪊", gnapprox: "⪊", gne: "⪈", gnE: "≩", gneq: "⪈", gneqq: "≩", gnsim: "⋧", Gopf: "𝔾", gopf: "𝕘", grave: "`", GreaterEqual: "≥", GreaterEqualLess: "⋛", GreaterFullEqual: "≧", GreaterGreater: "⪢", GreaterLess: "≷", GreaterSlantEqual: "⩾", GreaterTilde: "≳", Gscr: "𝒢", gscr: "ℊ", gsim: "≳", gsime: "⪎", gsiml: "⪐", gtcc: "⪧", gtcir: "⩺", gt: ">", GT: ">", Gt: "≫", gtdot: "⋗", gtlPar: "⦕", gtquest: "⩼", gtrapprox: "⪆", gtrarr: "⥸", gtrdot: "⋗", gtreqless: "⋛", gtreqqless: "⪌", gtrless: "≷", gtrsim: "≳", gvertneqq: "≩︀", gvnE: "≩︀", Hacek: "ˇ", hairsp: " ", half: "½", hamilt: "ℋ", HARDcy: "Ъ", hardcy: "ъ", harrcir: "⥈", harr: "↔", hArr: "⇔", harrw: "↭", Hat: "^", hbar: "ℏ", Hcirc: "Ĥ", hcirc: "ĥ", hearts: "♥", heartsuit: "♥", hellip: "…", hercon: "⊹", hfr: "𝔥", Hfr: "ℌ", HilbertSpace: "ℋ", hksearow: "⤥", hkswarow: "⤦", hoarr: "⇿", homtht: "∻", hookleftarrow: "↩", hookrightarrow: "↪", hopf: "𝕙", Hopf: "ℍ", horbar: "―", HorizontalLine: "─", hscr: "𝒽", Hscr: "ℋ", hslash: "ℏ", Hstrok: "Ħ", hstrok: "ħ", HumpDownHump: "≎", HumpEqual: "≏", hybull: "⁃", hyphen: "‐", Iacute: "Í", iacute: "í", ic: "\u2063", Icirc: "Î", icirc: "î", Icy: "И", icy: "и", Idot: "İ", IEcy: "Е", iecy: "е", iexcl: "¡", iff: "⇔", ifr: "𝔦", Ifr: "ℑ", Igrave: "Ì", igrave: "ì", ii: "ⅈ", iiiint: "⨌", iiint: "∭", iinfin: "⧜", iiota: "℩", IJlig: "IJ", ijlig: "ij", Imacr: "Ī", imacr: "ī", image: "ℑ", ImaginaryI: "ⅈ", imagline: "ℐ", imagpart: "ℑ", imath: "ı", Im: "ℑ", imof: "⊷", imped: "Ƶ", Implies: "⇒", incare: "℅", in: "∈", infin: "∞", infintie: "⧝", inodot: "ı", intcal: "⊺", int: "∫", Int: "∬", integers: "ℤ", Integral: "∫", intercal: "⊺", Intersection: "⋂", intlarhk: "⨗", intprod: "⨼", InvisibleComma: "\u2063", InvisibleTimes: "\u2062", IOcy: "Ё", iocy: "ё", Iogon: "Į", iogon: "į", Iopf: "𝕀", iopf: "𝕚", Iota: "Ι", iota: "ι", iprod: "⨼", iquest: "¿", iscr: "𝒾", Iscr: "ℐ", isin: "∈", isindot: "⋵", isinE: "⋹", isins: "⋴", isinsv: "⋳", isinv: "∈", it: "\u2062", Itilde: "Ĩ", itilde: "ĩ", Iukcy: "І", iukcy: "і", Iuml: "Ï", iuml: "ï", Jcirc: "Ĵ", jcirc: "ĵ", Jcy: "Й", jcy: "й", Jfr: "𝔍", jfr: "𝔧", jmath: "ȷ", Jopf: "𝕁", jopf: "𝕛", Jscr: "𝒥", jscr: "𝒿", Jsercy: "Ј", jsercy: "ј", Jukcy: "Є", jukcy: "є", Kappa: "Κ", kappa: "κ", kappav: "ϰ", Kcedil: "Ķ", kcedil: "ķ", Kcy: "К", kcy: "к", Kfr: "𝔎", kfr: "𝔨", kgreen: "ĸ", KHcy: "Х", khcy: "х", KJcy: "Ќ", kjcy: "ќ", Kopf: "𝕂", kopf: "𝕜", Kscr: "𝒦", kscr: "𝓀", lAarr: "⇚", Lacute: "Ĺ", lacute: "ĺ", laemptyv: "⦴", lagran: "ℒ", Lambda: "Λ", lambda: "λ", lang: "⟨", Lang: "⟪", langd: "⦑", langle: "⟨", lap: "⪅", Laplacetrf: "ℒ", laquo: "«", larrb: "⇤", larrbfs: "⤟", larr: "←", Larr: "↞", lArr: "⇐", larrfs: "⤝", larrhk: "↩", larrlp: "↫", larrpl: "⤹", larrsim: "⥳", larrtl: "↢", latail: "⤙", lAtail: "⤛", lat: "⪫", late: "⪭", lates: "⪭︀", lbarr: "⤌", lBarr: "⤎", lbbrk: "❲", lbrace: "{", lbrack: "[", lbrke: "⦋", lbrksld: "⦏", lbrkslu: "⦍", Lcaron: "Ľ", lcaron: "ľ", Lcedil: "Ļ", lcedil: "ļ", lceil: "⌈", lcub: "{", Lcy: "Л", lcy: "л", ldca: "⤶", ldquo: "“", ldquor: "„", ldrdhar: "⥧", ldrushar: "⥋", ldsh: "↲", le: "≤", lE: "≦", LeftAngleBracket: "⟨", LeftArrowBar: "⇤", leftarrow: "←", LeftArrow: "←", Leftarrow: "⇐", LeftArrowRightArrow: "⇆", leftarrowtail: "↢", LeftCeiling: "⌈", LeftDoubleBracket: "⟦", LeftDownTeeVector: "⥡", LeftDownVectorBar: "⥙", LeftDownVector: "⇃", LeftFloor: "⌊", leftharpoondown: "↽", leftharpoonup: "↼", leftleftarrows: "⇇", leftrightarrow: "↔", LeftRightArrow: "↔", Leftrightarrow: "⇔", leftrightarrows: "⇆", leftrightharpoons: "⇋", leftrightsquigarrow: "↭", LeftRightVector: "⥎", LeftTeeArrow: "↤", LeftTee: "⊣", LeftTeeVector: "⥚", leftthreetimes: "⋋", LeftTriangleBar: "⧏", LeftTriangle: "⊲", LeftTriangleEqual: "⊴", LeftUpDownVector: "⥑", LeftUpTeeVector: "⥠", LeftUpVectorBar: "⥘", LeftUpVector: "↿", LeftVectorBar: "⥒", LeftVector: "↼", lEg: "⪋", leg: "⋚", leq: "≤", leqq: "≦", leqslant: "⩽", lescc: "⪨", les: "⩽", lesdot: "⩿", lesdoto: "⪁", lesdotor: "⪃", lesg: "⋚︀", lesges: "⪓", lessapprox: "⪅", lessdot: "⋖", lesseqgtr: "⋚", lesseqqgtr: "⪋", LessEqualGreater: "⋚", LessFullEqual: "≦", LessGreater: "≶", lessgtr: "≶", LessLess: "⪡", lesssim: "≲", LessSlantEqual: "⩽", LessTilde: "≲", lfisht: "⥼", lfloor: "⌊", Lfr: "𝔏", lfr: "𝔩", lg: "≶", lgE: "⪑", lHar: "⥢", lhard: "↽", lharu: "↼", lharul: "⥪", lhblk: "▄", LJcy: "Љ", ljcy: "љ", llarr: "⇇", ll: "≪", Ll: "⋘", llcorner: "⌞", Lleftarrow: "⇚", llhard: "⥫", lltri: "◺", Lmidot: "Ŀ", lmidot: "ŀ", lmoustache: "⎰", lmoust: "⎰", lnap: "⪉", lnapprox: "⪉", lne: "⪇", lnE: "≨", lneq: "⪇", lneqq: "≨", lnsim: "⋦", loang: "⟬", loarr: "⇽", lobrk: "⟦", longleftarrow: "⟵", LongLeftArrow: "⟵", Longleftarrow: "⟸", longleftrightarrow: "⟷", LongLeftRightArrow: "⟷", Longleftrightarrow: "⟺", longmapsto: "⟼", longrightarrow: "⟶", LongRightArrow: "⟶", Longrightarrow: "⟹", looparrowleft: "↫", looparrowright: "↬", lopar: "⦅", Lopf: "𝕃", lopf: "𝕝", loplus: "⨭", lotimes: "⨴", lowast: "∗", lowbar: "_", LowerLeftArrow: "↙", LowerRightArrow: "↘", loz: "◊", lozenge: "◊", lozf: "⧫", lpar: "(", lparlt: "⦓", lrarr: "⇆", lrcorner: "⌟", lrhar: "⇋", lrhard: "⥭", lrm: "\u200e", lrtri: "⊿", lsaquo: "‹", lscr: "𝓁", Lscr: "ℒ", lsh: "↰", Lsh: "↰", lsim: "≲", lsime: "⪍", lsimg: "⪏", lsqb: "[", lsquo: "‘", lsquor: "‚", Lstrok: "Ł", lstrok: "ł", ltcc: "⪦", ltcir: "⩹", lt: "<", LT: "<", Lt: "≪", ltdot: "⋖", lthree: "⋋", ltimes: "⋉", ltlarr: "⥶", ltquest: "⩻", ltri: "◃", ltrie: "⊴", ltrif: "◂", ltrPar: "⦖", lurdshar: "⥊", luruhar: "⥦", lvertneqq: "≨︀", lvnE: "≨︀", macr: "¯", male: "♂", malt: "✠", maltese: "✠", Map: "⤅", map: "↦", mapsto: "↦", mapstodown: "↧", mapstoleft: "↤", mapstoup: "↥", marker: "▮", mcomma: "⨩", Mcy: "М", mcy: "м", mdash: "—", mDDot: "∺", measuredangle: "∡", MediumSpace: " ", Mellintrf: "ℳ", Mfr: "𝔐", mfr: "𝔪", mho: "℧", micro: "µ", midast: "*", midcir: "⫰", mid: "∣", middot: "·", minusb: "⊟", minus: "−", minusd: "∸", minusdu: "⨪", MinusPlus: "∓", mlcp: "⫛", mldr: "…", mnplus: "∓", models: "⊧", Mopf: "𝕄", mopf: "𝕞", mp: "∓", mscr: "𝓂", Mscr: "ℳ", mstpos: "∾", Mu: "Μ", mu: "μ", multimap: "⊸", mumap: "⊸", nabla: "∇", Nacute: "Ń", nacute: "ń", nang: "∠⃒", nap: "≉", napE: "⩰̸", napid: "≋̸", napos: "ʼn", napprox: "≉", natural: "♮", naturals: "ℕ", natur: "♮", nbsp: " ", nbump: "≎̸", nbumpe: "≏̸", ncap: "⩃", Ncaron: "Ň", ncaron: "ň", Ncedil: "Ņ", ncedil: "ņ", ncong: "≇", ncongdot: "⩭̸", ncup: "⩂", Ncy: "Н", ncy: "н", ndash: "–", nearhk: "⤤", nearr: "↗", neArr: "⇗", nearrow: "↗", ne: "≠", nedot: "≐̸", NegativeMediumSpace: "", NegativeThickSpace: "", NegativeThinSpace: "", NegativeVeryThinSpace: "", nequiv: "≢", nesear: "⤨", nesim: "≂̸", NestedGreaterGreater: "≫", NestedLessLess: "≪", NewLine: "\u000a", nexist: "∄", nexists: "∄", Nfr: "𝔑", nfr: "𝔫", ngE: "≧̸", nge: "≱", ngeq: "≱", ngeqq: "≧̸", ngeqslant: "⩾̸", nges: "⩾̸", nGg: "⋙̸", ngsim: "≵", nGt: "≫⃒", ngt: "≯", ngtr: "≯", nGtv: "≫̸", nharr: "↮", nhArr: "⇎", nhpar: "⫲", ni: "∋", nis: "⋼", nisd: "⋺", niv: "∋", NJcy: "Њ", njcy: "њ", nlarr: "↚", nlArr: "⇍", nldr: "‥", nlE: "≦̸", nle: "≰", nleftarrow: "↚", nLeftarrow: "⇍", nleftrightarrow: "↮", nLeftrightarrow: "⇎", nleq: "≰", nleqq: "≦̸", nleqslant: "⩽̸", nles: "⩽̸", nless: "≮", nLl: "⋘̸", nlsim: "≴", nLt: "≪⃒", nlt: "≮", nltri: "⋪", nltrie: "⋬", nLtv: "≪̸", nmid: "∤", NoBreak: "\u2060", NonBreakingSpace: " ", nopf: "𝕟", Nopf: "ℕ", Not: "⫬", not: "¬", NotCongruent: "≢", NotCupCap: "≭", NotDoubleVerticalBar: "∦", NotElement: "∉", NotEqual: "≠", NotEqualTilde: "≂̸", NotExists: "∄", NotGreater: "≯", NotGreaterEqual: "≱", NotGreaterFullEqual: "≧̸", NotGreaterGreater: "≫̸", NotGreaterLess: "≹", NotGreaterSlantEqual: "⩾̸", NotGreaterTilde: "≵", NotHumpDownHump: "≎̸", NotHumpEqual: "≏̸", notin: "∉", notindot: "⋵̸", notinE: "⋹̸", notinva: "∉", notinvb: "⋷", notinvc: "⋶", NotLeftTriangleBar: "⧏̸", NotLeftTriangle: "⋪", NotLeftTriangleEqual: "⋬", NotLess: "≮", NotLessEqual: "≰", NotLessGreater: "≸", NotLessLess: "≪̸", NotLessSlantEqual: "⩽̸", NotLessTilde: "≴", NotNestedGreaterGreater: "⪢̸", NotNestedLessLess: "⪡̸", notni: "∌", notniva: "∌", notnivb: "⋾", notnivc: "⋽", NotPrecedes: "⊀", NotPrecedesEqual: "⪯̸", NotPrecedesSlantEqual: "⋠", NotReverseElement: "∌", NotRightTriangleBar: "⧐̸", NotRightTriangle: "⋫", NotRightTriangleEqual: "⋭", NotSquareSubset: "⊏̸", NotSquareSubsetEqual: "⋢", NotSquareSuperset: "⊐̸", NotSquareSupersetEqual: "⋣", NotSubset: "⊂⃒", NotSubsetEqual: "⊈", NotSucceeds: "⊁", NotSucceedsEqual: "⪰̸", NotSucceedsSlantEqual: "⋡", NotSucceedsTilde: "≿̸", NotSuperset: "⊃⃒", NotSupersetEqual: "⊉", NotTilde: "≁", NotTildeEqual: "≄", NotTildeFullEqual: "≇", NotTildeTilde: "≉", NotVerticalBar: "∤", nparallel: "∦", npar: "∦", nparsl: "⫽⃥", npart: "∂̸", npolint: "⨔", npr: "⊀", nprcue: "⋠", nprec: "⊀", npreceq: "⪯̸", npre: "⪯̸", nrarrc: "⤳̸", nrarr: "↛", nrArr: "⇏", nrarrw: "↝̸", nrightarrow: "↛", nRightarrow: "⇏", nrtri: "⋫", nrtrie: "⋭", nsc: "⊁", nsccue: "⋡", nsce: "⪰̸", Nscr: "𝒩", nscr: "𝓃", nshortmid: "∤", nshortparallel: "∦", nsim: "≁", nsime: "≄", nsimeq: "≄", nsmid: "∤", nspar: "∦", nsqsube: "⋢", nsqsupe: "⋣", nsub: "⊄", nsubE: "⫅̸", nsube: "⊈", nsubset: "⊂⃒", nsubseteq: "⊈", nsubseteqq: "⫅̸", nsucc: "⊁", nsucceq: "⪰̸", nsup: "⊅", nsupE: "⫆̸", nsupe: "⊉", nsupset: "⊃⃒", nsupseteq: "⊉", nsupseteqq: "⫆̸", ntgl: "≹", Ntilde: "Ñ", ntilde: "ñ", ntlg: "≸", ntriangleleft: "⋪", ntrianglelefteq: "⋬", ntriangleright: "⋫", ntrianglerighteq: "⋭", Nu: "Ν", nu: "ν", num: "#", numero: "№", numsp: " ", nvap: "≍⃒", nvdash: "⊬", nvDash: "⊭", nVdash: "⊮", nVDash: "⊯", nvge: "≥⃒", nvgt: ">⃒", nvHarr: "⤄", nvinfin: "⧞", nvlArr: "⤂", nvle: "≤⃒", nvlt: "<⃒", nvltrie: "⊴⃒", nvrArr: "⤃", nvrtrie: "⊵⃒", nvsim: "∼⃒", nwarhk: "⤣", nwarr: "↖", nwArr: "⇖", nwarrow: "↖", nwnear: "⤧", Oacute: "Ó", oacute: "ó", oast: "⊛", Ocirc: "Ô", ocirc: "ô", ocir: "⊚", Ocy: "О", ocy: "о", odash: "⊝", Odblac: "Ő", odblac: "ő", odiv: "⨸", odot: "⊙", odsold: "⦼", OElig: "Œ", oelig: "œ", ofcir: "⦿", Ofr: "𝔒", ofr: "𝔬", ogon: "˛", Ograve: "Ò", ograve: "ò", ogt: "⧁", ohbar: "⦵", ohm: "Ω", oint: "∮", olarr: "↺", olcir: "⦾", olcross: "⦻", oline: "‾", olt: "⧀", Omacr: "Ō", omacr: "ō", Omega: "Ω", omega: "ω", Omicron: "Ο", omicron: "ο", omid: "⦶", ominus: "⊖", Oopf: "𝕆", oopf: "𝕠", opar: "⦷", OpenCurlyDoubleQuote: "“", OpenCurlyQuote: "‘", operp: "⦹", oplus: "⊕", orarr: "↻", Or: "⩔", or: "∨", ord: "⩝", order: "ℴ", orderof: "ℴ", ordf: "ª", ordm: "º", origof: "⊶", oror: "⩖", orslope: "⩗", orv: "⩛", oS: "Ⓢ", Oscr: "𝒪", oscr: "ℴ", Oslash: "Ø", oslash: "ø", osol: "⊘", Otilde: "Õ", otilde: "õ", otimesas: "⨶", Otimes: "⨷", otimes: "⊗", Ouml: "Ö", ouml: "ö", ovbar: "⌽", OverBar: "‾", OverBrace: "⏞", OverBracket: "⎴", OverParenthesis: "⏜", para: "¶", parallel: "∥", par: "∥", parsim: "⫳", parsl: "⫽", part: "∂", PartialD: "∂", Pcy: "П", pcy: "п", percnt: "%", period: ".", permil: "‰", perp: "⊥", pertenk: "‱", Pfr: "𝔓", pfr: "𝔭", Phi: "Φ", phi: "φ", phiv: "ϕ", phmmat: "ℳ", phone: "☎", Pi: "Π", pi: "π", pitchfork: "⋔", piv: "ϖ", planck: "ℏ", planckh: "ℎ", plankv: "ℏ", plusacir: "⨣", plusb: "⊞", pluscir: "⨢", plus: "+", plusdo: "∔", plusdu: "⨥", pluse: "⩲", PlusMinus: "±", plusmn: "±", plussim: "⨦", plustwo: "⨧", pm: "±", Poincareplane: "ℌ", pointint: "⨕", popf: "𝕡", Popf: "ℙ", pound: "£", prap: "⪷", Pr: "⪻", pr: "≺", prcue: "≼", precapprox: "⪷", prec: "≺", preccurlyeq: "≼", Precedes: "≺", PrecedesEqual: "⪯", PrecedesSlantEqual: "≼", PrecedesTilde: "≾", preceq: "⪯", precnapprox: "⪹", precneqq: "⪵", precnsim: "⋨", pre: "⪯", prE: "⪳", precsim: "≾", prime: "′", Prime: "″", primes: "ℙ", prnap: "⪹", prnE: "⪵", prnsim: "⋨", prod: "∏", Product: "∏", profalar: "⌮", profline: "⌒", profsurf: "⌓", prop: "∝", Proportional: "∝", Proportion: "∷", propto: "∝", prsim: "≾", prurel: "⊰", Pscr: "𝒫", pscr: "𝓅", Psi: "Ψ", psi: "ψ", puncsp: " ", Qfr: "𝔔", qfr: "𝔮", qint: "⨌", qopf: "𝕢", Qopf: "ℚ", qprime: "⁗", Qscr: "𝒬", qscr: "𝓆", quaternions: "ℍ", quatint: "⨖", quest: "?", questeq: "≟", quot: "\"", QUOT: "\"", rAarr: "⇛", race: "∽̱", Racute: "Ŕ", racute: "ŕ", radic: "√", raemptyv: "⦳", rang: "⟩", Rang: "⟫", rangd: "⦒", range: "⦥", rangle: "⟩", raquo: "»", rarrap: "⥵", rarrb: "⇥", rarrbfs: "⤠", rarrc: "⤳", rarr: "→", Rarr: "↠", rArr: "⇒", rarrfs: "⤞", rarrhk: "↪", rarrlp: "↬", rarrpl: "⥅", rarrsim: "⥴", Rarrtl: "⤖", rarrtl: "↣", rarrw: "↝", ratail: "⤚", rAtail: "⤜", ratio: "∶", rationals: "ℚ", rbarr: "⤍", rBarr: "⤏", RBarr: "⤐", rbbrk: "❳", rbrace: "}", rbrack: "]", rbrke: "⦌", rbrksld: "⦎", rbrkslu: "⦐", Rcaron: "Ř", rcaron: "ř", Rcedil: "Ŗ", rcedil: "ŗ", rceil: "⌉", rcub: "}", Rcy: "Р", rcy: "р", rdca: "⤷", rdldhar: "⥩", rdquo: "”", rdquor: "”", rdsh: "↳", real: "ℜ", realine: "ℛ", realpart: "ℜ", reals: "ℝ", Re: "ℜ", rect: "▭", reg: "®", REG: "®", ReverseElement: "∋", ReverseEquilibrium: "⇋", ReverseUpEquilibrium: "⥯", rfisht: "⥽", rfloor: "⌋", rfr: "𝔯", Rfr: "ℜ", rHar: "⥤", rhard: "⇁", rharu: "⇀", rharul: "⥬", Rho: "Ρ", rho: "ρ", rhov: "ϱ", RightAngleBracket: "⟩", RightArrowBar: "⇥", rightarrow: "→", RightArrow: "→", Rightarrow: "⇒", RightArrowLeftArrow: "⇄", rightarrowtail: "↣", RightCeiling: "⌉", RightDoubleBracket: "⟧", RightDownTeeVector: "⥝", RightDownVectorBar: "⥕", RightDownVector: "⇂", RightFloor: "⌋", rightharpoondown: "⇁", rightharpoonup: "⇀", rightleftarrows: "⇄", rightleftharpoons: "⇌", rightrightarrows: "⇉", rightsquigarrow: "↝", RightTeeArrow: "↦", RightTee: "⊢", RightTeeVector: "⥛", rightthreetimes: "⋌", RightTriangleBar: "⧐", RightTriangle: "⊳", RightTriangleEqual: "⊵", RightUpDownVector: "⥏", RightUpTeeVector: "⥜", RightUpVectorBar: "⥔", RightUpVector: "↾", RightVectorBar: "⥓", RightVector: "⇀", ring: "˚", risingdotseq: "≓", rlarr: "⇄", rlhar: "⇌", rlm: "\u200f", rmoustache: "⎱", rmoust: "⎱", rnmid: "⫮", roang: "⟭", roarr: "⇾", robrk: "⟧", ropar: "⦆", ropf: "𝕣", Ropf: "ℝ", roplus: "⨮", rotimes: "⨵", RoundImplies: "⥰", rpar: ")", rpargt: "⦔", rppolint: "⨒", rrarr: "⇉", Rrightarrow: "⇛", rsaquo: "›", rscr: "𝓇", Rscr: "ℛ", rsh: "↱", Rsh: "↱", rsqb: "]", rsquo: "’", rsquor: "’", rthree: "⋌", rtimes: "⋊", rtri: "▹", rtrie: "⊵", rtrif: "▸", rtriltri: "⧎", RuleDelayed: "⧴", ruluhar: "⥨", rx: "℞", Sacute: "Ś", sacute: "ś", sbquo: "‚", scap: "⪸", Scaron: "Š", scaron: "š", Sc: "⪼", sc: "≻", sccue: "≽", sce: "⪰", scE: "⪴", Scedil: "Ş", scedil: "ş", Scirc: "Ŝ", scirc: "ŝ", scnap: "⪺", scnE: "⪶", scnsim: "⋩", scpolint: "⨓", scsim: "≿", Scy: "С", scy: "с", sdotb: "⊡", sdot: "⋅", sdote: "⩦", searhk: "⤥", searr: "↘", seArr: "⇘", searrow: "↘", sect: "§", semi: ";", seswar: "⤩", setminus: "∖", setmn: "∖", sext: "✶", Sfr: "𝔖", sfr: "𝔰", sfrown: "⌢", sharp: "♯", SHCHcy: "Щ", shchcy: "щ", SHcy: "Ш", shcy: "ш", ShortDownArrow: "↓", ShortLeftArrow: "←", shortmid: "∣", shortparallel: "∥", ShortRightArrow: "→", ShortUpArrow: "↑", shy: "\u00ad", Sigma: "Σ", sigma: "σ", sigmaf: "ς", sigmav: "ς", sim: "∼", simdot: "⩪", sime: "≃", simeq: "≃", simg: "⪞", simgE: "⪠", siml: "⪝", simlE: "⪟", simne: "≆", simplus: "⨤", simrarr: "⥲", slarr: "←", SmallCircle: "∘", smallsetminus: "∖", smashp: "⨳", smeparsl: "⧤", smid: "∣", smile: "⌣", smt: "⪪", smte: "⪬", smtes: "⪬︀", SOFTcy: "Ь", softcy: "ь", solbar: "⌿", solb: "⧄", sol: "/", Sopf: "𝕊", sopf: "𝕤", spades: "♠", spadesuit: "♠", spar: "∥", sqcap: "⊓", sqcaps: "⊓︀", sqcup: "⊔", sqcups: "⊔︀", Sqrt: "√", sqsub: "⊏", sqsube: "⊑", sqsubset: "⊏", sqsubseteq: "⊑", sqsup: "⊐", sqsupe: "⊒", sqsupset: "⊐", sqsupseteq: "⊒", square: "□", Square: "□", SquareIntersection: "⊓", SquareSubset: "⊏", SquareSubsetEqual: "⊑", SquareSuperset: "⊐", SquareSupersetEqual: "⊒", SquareUnion: "⊔", squarf: "▪", squ: "□", squf: "▪", srarr: "→", Sscr: "𝒮", sscr: "𝓈", ssetmn: "∖", ssmile: "⌣", sstarf: "⋆", Star: "⋆", star: "☆", starf: "★", straightepsilon: "ϵ", straightphi: "ϕ", strns: "¯", sub: "⊂", Sub: "⋐", subdot: "⪽", subE: "⫅", sube: "⊆", subedot: "⫃", submult: "⫁", subnE: "⫋", subne: "⊊", subplus: "⪿", subrarr: "⥹", subset: "⊂", Subset: "⋐", subseteq: "⊆", subseteqq: "⫅", SubsetEqual: "⊆", subsetneq: "⊊", subsetneqq: "⫋", subsim: "⫇", subsub: "⫕", subsup: "⫓", succapprox: "⪸", succ: "≻", succcurlyeq: "≽", Succeeds: "≻", SucceedsEqual: "⪰", SucceedsSlantEqual: "≽", SucceedsTilde: "≿", succeq: "⪰", succnapprox: "⪺", succneqq: "⪶", succnsim: "⋩", succsim: "≿", SuchThat: "∋", sum: "∑", Sum: "∑", sung: "♪", sup1: "¹", sup2: "²", sup3: "³", sup: "⊃", Sup: "⋑", supdot: "⪾", supdsub: "⫘", supE: "⫆", supe: "⊇", supedot: "⫄", Superset: "⊃", SupersetEqual: "⊇", suphsol: "⟉", suphsub: "⫗", suplarr: "⥻", supmult: "⫂", supnE: "⫌", supne: "⊋", supplus: "⫀", supset: "⊃", Supset: "⋑", supseteq: "⊇", supseteqq: "⫆", supsetneq: "⊋", supsetneqq: "⫌", supsim: "⫈", supsub: "⫔", supsup: "⫖", swarhk: "⤦", swarr: "↙", swArr: "⇙", swarrow: "↙", swnwar: "⤪", szlig: "ß", Tab: "\u0009", target: "⌖", Tau: "Τ", tau: "τ", tbrk: "⎴", Tcaron: "Ť", tcaron: "ť", Tcedil: "Ţ", tcedil: "ţ", Tcy: "Т", tcy: "т", tdot: "⃛", telrec: "⌕", Tfr: "𝔗", tfr: "𝔱", there4: "∴", therefore: "∴", Therefore: "∴", Theta: "Θ", theta: "θ", thetasym: "ϑ", thetav: "ϑ", thickapprox: "≈", thicksim: "∼", ThickSpace: " ", ThinSpace: " ", thinsp: " ", thkap: "≈", thksim: "∼", THORN: "Þ", thorn: "þ", tilde: "˜", Tilde: "∼", TildeEqual: "≃", TildeFullEqual: "≅", TildeTilde: "≈", timesbar: "⨱", timesb: "⊠", times: "×", timesd: "⨰", tint: "∭", toea: "⤨", topbot: "⌶", topcir: "⫱", top: "⊤", Topf: "𝕋", topf: "𝕥", topfork: "⫚", tosa: "⤩", tprime: "‴", trade: "™", TRADE: "™", triangle: "▵", triangledown: "▿", triangleleft: "◃", trianglelefteq: "⊴", triangleq: "≜", triangleright: "▹", trianglerighteq: "⊵", tridot: "◬", trie: "≜", triminus: "⨺", TripleDot: "⃛", triplus: "⨹", trisb: "⧍", tritime: "⨻", trpezium: "⏢", Tscr: "𝒯", tscr: "𝓉", TScy: "Ц", tscy: "ц", TSHcy: "Ћ", tshcy: "ћ", Tstrok: "Ŧ", tstrok: "ŧ", twixt: "≬", twoheadleftarrow: "↞", twoheadrightarrow: "↠", Uacute: "Ú", uacute: "ú", uarr: "↑", Uarr: "↟", uArr: "⇑", Uarrocir: "⥉", Ubrcy: "Ў", ubrcy: "ў", Ubreve: "Ŭ", ubreve: "ŭ", Ucirc: "Û", ucirc: "û", Ucy: "У", ucy: "у", udarr: "⇅", Udblac: "Ű", udblac: "ű", udhar: "⥮", ufisht: "⥾", Ufr: "𝔘", ufr: "𝔲", Ugrave: "Ù", ugrave: "ù", uHar: "⥣", uharl: "↿", uharr: "↾", uhblk: "▀", ulcorn: "⌜", ulcorner: "⌜", ulcrop: "⌏", ultri: "◸", Umacr: "Ū", umacr: "ū", uml: "¨", UnderBar: "_", UnderBrace: "⏟", UnderBracket: "⎵", UnderParenthesis: "⏝", Union: "⋃", UnionPlus: "⊎", Uogon: "Ų", uogon: "ų", Uopf: "𝕌", uopf: "𝕦", UpArrowBar: "⤒", uparrow: "↑", UpArrow: "↑", Uparrow: "⇑", UpArrowDownArrow: "⇅", updownarrow: "↕", UpDownArrow: "↕", Updownarrow: "⇕", UpEquilibrium: "⥮", upharpoonleft: "↿", upharpoonright: "↾", uplus: "⊎", UpperLeftArrow: "↖", UpperRightArrow: "↗", upsi: "υ", Upsi: "ϒ", upsih: "ϒ", Upsilon: "Υ", upsilon: "υ", UpTeeArrow: "↥", UpTee: "⊥", upuparrows: "⇈", urcorn: "⌝", urcorner: "⌝", urcrop: "⌎", Uring: "Ů", uring: "ů", urtri: "◹", Uscr: "𝒰", uscr: "𝓊", utdot: "⋰", Utilde: "Ũ", utilde: "ũ", utri: "▵", utrif: "▴", uuarr: "⇈", Uuml: "Ü", uuml: "ü", uwangle: "⦧", vangrt: "⦜", varepsilon: "ϵ", varkappa: "ϰ", varnothing: "∅", varphi: "ϕ", varpi: "ϖ", varpropto: "∝", varr: "↕", vArr: "⇕", varrho: "ϱ", varsigma: "ς", varsubsetneq: "⊊︀", varsubsetneqq: "⫋︀", varsupsetneq: "⊋︀", varsupsetneqq: "⫌︀", vartheta: "ϑ", vartriangleleft: "⊲", vartriangleright: "⊳", vBar: "⫨", Vbar: "⫫", vBarv: "⫩", Vcy: "В", vcy: "в", vdash: "⊢", vDash: "⊨", Vdash: "⊩", VDash: "⊫", Vdashl: "⫦", veebar: "⊻", vee: "∨", Vee: "⋁", veeeq: "≚", vellip: "⋮", verbar: "|", Verbar: "‖", vert: "|", Vert: "‖", VerticalBar: "∣", VerticalLine: "|", VerticalSeparator: "❘", VerticalTilde: "≀", VeryThinSpace: " ", Vfr: "𝔙", vfr: "𝔳", vltri: "⊲", vnsub: "⊂⃒", vnsup: "⊃⃒", Vopf: "𝕍", vopf: "𝕧", vprop: "∝", vrtri: "⊳", Vscr: "𝒱", vscr: "𝓋", vsubnE: "⫋︀", vsubne: "⊊︀", vsupnE: "⫌︀", vsupne: "⊋︀", Vvdash: "⊪", vzigzag: "⦚", Wcirc: "Ŵ", wcirc: "ŵ", wedbar: "⩟", wedge: "∧", Wedge: "⋀", wedgeq: "≙", weierp: "℘", Wfr: "𝔚", wfr: "𝔴", Wopf: "𝕎", wopf: "𝕨", wp: "℘", wr: "≀", wreath: "≀", Wscr: "𝒲", wscr: "𝓌", xcap: "⋂", xcirc: "◯", xcup: "⋃", xdtri: "▽", Xfr: "𝔛", xfr: "𝔵", xharr: "⟷", xhArr: "⟺", Xi: "Ξ", xi: "ξ", xlarr: "⟵", xlArr: "⟸", xmap: "⟼", xnis: "⋻", xodot: "⨀", Xopf: "𝕏", xopf: "𝕩", xoplus: "⨁", xotime: "⨂", xrarr: "⟶", xrArr: "⟹", Xscr: "𝒳", xscr: "𝓍", xsqcup: "⨆", xuplus: "⨄", xutri: "△", xvee: "⋁", xwedge: "⋀", Yacute: "Ý", yacute: "ý", YAcy: "Я", yacy: "я", Ycirc: "Ŷ", ycirc: "ŷ", Ycy: "Ы", ycy: "ы", yen: "¥", Yfr: "𝔜", yfr: "𝔶", YIcy: "Ї", yicy: "ї", Yopf: "𝕐", yopf: "𝕪", Yscr: "𝒴", yscr: "𝓎", YUcy: "Ю", yucy: "ю", yuml: "ÿ", Yuml: "Ÿ", Zacute: "Ź", zacute: "ź", Zcaron: "Ž", zcaron: "ž", Zcy: "З", zcy: "з", Zdot: "Ż", zdot: "ż", zeetrf: "ℨ", ZeroWidthSpace: "", Zeta: "Ζ", zeta: "ζ", zfr: "𝔷", Zfr: "ℨ", ZHcy: "Ж", zhcy: "ж", zigrarr: "⇝", zopf: "𝕫", Zopf: "ℤ", Zscr: "𝒵", zscr: "𝓏", zwj: "\u200d", zwnj: "\u200c"
};
var HEXCHARCODE = /^#[xX]([A-Fa-f0-9]+)$/;
var CHARCODE = /^#([0-9]+)$/;
var NAMED = /^([A-Za-z0-9]+)$/;
var EntityParser = /** @class */ (function () {
function EntityParser(named) {
this.named = named;
}
EntityParser.prototype.parse = function (entity) {
if (!entity) {
return;
}
var matches = entity.match(HEXCHARCODE);
if (matches) {
return String.fromCharCode(parseInt(matches[1], 16));
}
matches = entity.match(CHARCODE);
if (matches) {
return String.fromCharCode(parseInt(matches[1], 10));
}
matches = entity.match(NAMED);
if (matches) {
return this.named[matches[1]];
}
};
return EntityParser;
}());
var WSP = /[\t\n\f ]/;
var ALPHA = /[A-Za-z]/;
var CRLF = /\r\n?/g;
function isSpace(char) {
return WSP.test(char);
}
function isAlpha(char) {
return ALPHA.test(char);
}
function preprocessInput(input) {
return input.replace(CRLF, '\n');
}
var EventedTokenizer = /** @class */ (function () {
function EventedTokenizer(delegate, entityParser, mode) {
if (mode === void 0) { mode = 'precompile'; }
this.delegate = delegate;
this.entityParser = entityParser;
this.mode = mode;
this.state = "beforeData" /* beforeData */;
this.line = -1;
this.column = -1;
this.input = '';
this.index = -1;
this.tagNameBuffer = '';
this.states = {
beforeData: function () {
var char = this.peek();
if (char === '<' && !this.isIgnoredEndTag()) {
this.transitionTo("tagOpen" /* tagOpen */);
this.markTagStart();
this.consume();
}
else {
if (this.mode === 'precompile' && char === '\n') {
var tag = this.tagNameBuffer.toLowerCase();
if (tag === 'pre' || tag === 'textarea') {
this.consume();
}
}
this.transitionTo("data" /* data */);
this.delegate.beginData();
}
},
data: function () {
var char = this.peek();
var tag = this.tagNameBuffer;
if (char === '<' && !this.isIgnoredEndTag()) {
this.delegate.finishData();
this.transitionTo("tagOpen" /* tagOpen */);
this.markTagStart();
this.consume();
}
else if (char === '&' && tag !== 'script' && tag !== 'style') {
this.consume();
this.delegate.appendToData(this.consumeCharRef() || '&');
}
else {
this.consume();
this.delegate.appendToData(char);
}
},
tagOpen: function () {
var char = this.consume();
if (char === '!') {
this.transitionTo("markupDeclarationOpen" /* markupDeclarationOpen */);
}
else if (char === '/') {
this.transitionTo("endTagOpen" /* endTagOpen */);
}
else if (char === '@' || char === ':' || isAlpha(char)) {
this.transitionTo("tagName" /* tagName */);
this.tagNameBuffer = '';
this.delegate.beginStartTag();
this.appendToTagName(char);
}
},
markupDeclarationOpen: function () {
var char = this.consume();
if (char === '-' && this.peek() === '-') {
this.consume();
this.transitionTo("commentStart" /* commentStart */);
this.delegate.beginComment();
}
else {
var maybeDoctype = char.toUpperCase() + this.input.substring(this.index, this.index + 6).toUpperCase();
if (maybeDoctype === 'DOCTYPE') {
this.consume();
this.consume();
this.consume();
this.consume();
this.consume();
this.consume();
this.transitionTo("doctype" /* doctype */);
if (this.delegate.beginDoctype)
this.delegate.beginDoctype();
}
}
},
doctype: function () {
var char = this.consume();
if (isSpace(char)) {
this.transitionTo("beforeDoctypeName" /* beforeDoctypeName */);
}
},
beforeDoctypeName: function () {
var char = this.consume();
if (isSpace(char)) {
return;
}
else {
this.transitionTo("doctypeName" /* doctypeName */);
if (this.delegate.appendToDoctypeName)
this.delegate.appendToDoctypeName(char.toLowerCase());
}
},
doctypeName: function () {
var char = this.consume();
if (isSpace(char)) {
this.transitionTo("afterDoctypeName" /* afterDoctypeName */);
}
else if (char === '>') {
if (this.delegate.endDoctype)
this.delegate.endDoctype();
this.transitionTo("beforeData" /* beforeData */);
}
else {
if (this.delegate.appendToDoctypeName)
this.delegate.appendToDoctypeName(char.toLowerCase());
}
},
afterDoctypeName: function () {
var char = this.consume();
if (isSpace(char)) {
return;
}
else if (char === '>') {
if (this.delegate.endDoctype)
this.delegate.endDoctype();
this.transitionTo("beforeData" /* beforeData */);
}
else {
var nextSixChars = char.toUpperCase() + this.input.substring(this.index, this.index + 5).toUpperCase();
var isPublic = nextSixChars.toUpperCase() === 'PUBLIC';
var isSystem = nextSixChars.toUpperCase() === 'SYSTEM';
if (isPublic || isSystem) {
this.consume();
this.consume();
this.consume();
this.consume();
this.consume();
this.consume();
}
if (isPublic) {
this.transitionTo("afterDoctypePublicKeyword" /* afterDoctypePublicKeyword */);
}
else if (isSystem) {
this.transitionTo("afterDoctypeSystemKeyword" /* afterDoctypeSystemKeyword */);
}
}
},
afterDoctypePublicKeyword: function () {
var char = this.peek();
if (isSpace(char)) {
this.transitionTo("beforeDoctypePublicIdentifier" /* beforeDoctypePublicIdentifier */);
this.consume();
}
else if (char === '"') {
this.transitionTo("doctypePublicIdentifierDoubleQuoted" /* doctypePublicIdentifierDoubleQuoted */);
this.consume();
}
else if (char === "'") {
this.transitionTo("doctypePublicIdentifierSingleQuoted" /* doctypePublicIdentifierSingleQuoted */);
this.consume();
}
else if (char === '>') {
this.consume();
if (this.delegate.endDoctype)
this.delegate.endDoctype();
this.transitionTo("beforeData" /* beforeData */);
}
},
doctypePublicIdentifierDoubleQuoted: function () {
var char = this.consume();
if (char === '"') {
this.transitionTo("afterDoctypePublicIdentifier" /* afterDoctypePublicIdentifier */);
}
else if (char === '>') {
if (this.delegate.endDoctype)
this.delegate.endDoctype();
this.transitionTo("beforeData" /* beforeData */);
}
else {
if (this.delegate.appendToDoctypePublicIdentifier)
this.delegate.appendToDoctypePublicIdentifier(char);
}
},
doctypePublicIdentifierSingleQuoted: function () {
var char = this.consume();
if (char === "'") {
this.transitionTo("afterDoctypePublicIdentifier" /* afterDoctypePublicIdentifier */);
}
else if (char === '>') {
if (this.delegate.endDoctype)
this.delegate.endDoctype();
this.transitionTo("beforeData" /* beforeData */);
}
else {
if (this.delegate.appendToDoctypePublicIdentifier)
this.delegate.appendToDoctypePublicIdentifier(char);
}
},
afterDoctypePublicIdentifier: function () {
var char = this.consume();
if (isSpace(char)) {
this.transitionTo("betweenDoctypePublicAndSystemIdentifiers" /* betweenDoctypePublicAndSystemIdentifiers */);
}
else if (char === '>') {
if (this.delegate.endDoctype)
this.delegate.endDoctype();
this.transitionTo("beforeData" /* beforeData */);
}
else if (char === '"') {
this.transitionTo("doctypeSystemIdentifierDoubleQuoted" /* doctypeSystemIdentifierDoubleQuoted */);
}
else if (char === "'") {
this.transitionTo("doctypeSystemIdentifierSingleQuoted" /* doctypeSystemIdentifierSingleQuoted */);
}
},
betweenDoctypePublicAndSystemIdentifiers: function () {
var char = this.consume();
if (isSpace(char)) {
return;
}
else if (char === '>') {
if (this.delegate.endDoctype)
this.delegate.endDoctype();
this.transitionTo("beforeData" /* beforeData */);
}
else if (char === '"') {
this.transitionTo("doctypeSystemIdentifierDoubleQuoted" /* doctypeSystemIdentifierDoubleQuoted */);
}
else if (char === "'") {
this.transitionTo("doctypeSystemIdentifierSingleQuoted" /* doctypeSystemIdentifierSingleQuoted */);
}
},
doctypeSystemIdentifierDoubleQuoted: function () {
var char = this.consume();
if (char === '"') {
this.transitionTo("afterDoctypeSystemIdentifier" /* afterDoctypeSystemIdentifier */);
}
else if (char === '>') {
if (this.delegate.endDoctype)
this.delegate.endDoctype();
this.transitionTo("beforeData" /* beforeData */);
}
else {
if (this.delegate.appendToDoctypeSystemIdentifier)
this.delegate.appendToDoctypeSystemIdentifier(char);
}
},
doctypeSystemIdentifierSingleQuoted: function () {
var char = this.consume();
if (char === "'") {
this.transitionTo("afterDoctypeSystemIdentifier" /* afterDoctypeSystemIdentifier */);
}
else if (char === '>') {
if (this.delegate.endDoctype)
this.delegate.endDoctype();
this.transitionTo("beforeData" /* beforeData */);
}
else {
if (this.delegate.appendToDoctypeSystemIdentifier)
this.delegate.appendToDoctypeSystemIdentifier(char);
}
},
afterDoctypeSystemIdentifier: function () {
var char = this.consume();
if (isSpace(char)) {
return;
}
else if (char === '>') {
if (this.delegate.endDoctype)
this.delegate.endDoctype();
this.transitionTo("beforeData" /* beforeData */);
}
},
commentStart: function () {
var char = this.consume();
if (char === '-') {
this.transitionTo("commentStartDash" /* commentStartDash */);
}
else if (char === '>') {
this.delegate.finishComment();
this.transitionTo("beforeData" /* beforeData */);
}
else {
this.delegate.appendToCommentData(char);
this.transitionTo("comment" /* comment */);
}
},
commentStartDash: function () {
var char = this.consume();
if (char === '-') {
this.transitionTo("commentEnd" /* commentEnd */);
}
else if (char === '>') {
this.delegate.finishComment();
this.transitionTo("beforeData" /* beforeData */);
}
else {
this.delegate.appendToCommentData('-');
this.transitionTo("comment" /* comment */);
}
},
comment: function () {
var char = this.consume();
if (char === '-') {
this.transitionTo("commentEndDash" /* commentEndDash */);
}
else {
this.delegate.appendToCommentData(char);
}
},
commentEndDash: function () {
var char = this.consume();
if (char === '-') {
this.transitionTo("commentEnd" /* commentEnd */);
}
else {
this.delegate.appendToCommentData('-' + char);
this.transitionTo("comment" /* comment */);
}
},
commentEnd: function () {
var char = this.consume();
if (char === '>') {
this.delegate.finishComment();
this.transitionTo("beforeData" /* beforeData */);
}
else {
this.delegate.appendToCommentData('--' + char);
this.transitionTo("comment" /* comment */);
}
},
tagName: function () {
var char = this.consume();
if (isSpace(char)) {
this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
}
else if (char === '/') {
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
}
else if (char === '>') {
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
}
else {
this.appendToTagName(char);
}
},
endTagName: function () {
var char = this.consume();
if (isSpace(char)) {
this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
this.tagNameBuffer = '';
}
else if (char === '/') {
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
this.tagNameBuffer = '';
}
else if (char === '>') {
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
this.tagNameBuffer = '';
}
else {
this.appendToTagName(char);
}
},
beforeAttributeName: function () {
var char = this.peek();
if (isSpace(char)) {
this.consume();
return;
}
else if (char === '/') {
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
this.consume();
}
else if (char === '>') {
this.consume();
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
}
else if (char === '=') {
this.delegate.reportSyntaxError('attribute name cannot start with equals sign');
this.transitionTo("attributeName" /* attributeName */);
this.delegate.beginAttribute();
this.consume();
this.delegate.appendToAttributeName(char);
}
else {
this.transitionTo("attributeName" /* attributeName */);
this.delegate.beginAttribute();
}
},
attributeName: function () {
var char = this.peek();
if (isSpace(char)) {
this.transitionTo("afterAttributeName" /* afterAttributeName */);
this.consume();
}
else if (char === '/') {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
}
else if (char === '=') {
this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */);
this.consume();
}
else if (char === '>') {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
}
else if (char === '"' || char === "'" || char === '<') {
this.delegate.reportSyntaxError(char + ' is not a valid character within attribute names');
this.consume();
this.delegate.appendToAttributeName(char);
}
else {
this.consume();
this.delegate.appendToAttributeName(char);
}
},
afterAttributeName: function () {
var char = this.peek();
if (isSpace(char)) {
this.consume();
return;
}
else if (char === '/') {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
}
else if (char === '=') {
this.consume();
this.transitionTo("beforeAttributeValue" /* beforeAttributeValue */);
}
else if (char === '>') {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
}
else {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.transitionTo("attributeName" /* attributeName */);
this.delegate.beginAttribute();
this.consume();
this.delegate.appendToAttributeName(char);
}
},
beforeAttributeValue: function () {
var char = this.peek();
if (isSpace(char)) {
this.consume();
}
else if (char === '"') {
this.transitionTo("attributeValueDoubleQuoted" /* attributeValueDoubleQuoted */);
this.delegate.beginAttributeValue(true);
this.consume();
}
else if (char === "'") {
this.transitionTo("attributeValueSingleQuoted" /* attributeValueSingleQuoted */);
this.delegate.beginAttributeValue(true);
this.consume();
}
else if (char === '>') {
this.delegate.beginAttributeValue(false);
this.delegate.finishAttributeValue();
this.consume();
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
}
else {
this.transitionTo("attributeValueUnquoted" /* attributeValueUnquoted */);
this.delegate.beginAttributeValue(false);
this.consume();
this.delegate.appendToAttributeValue(char);
}
},
attributeValueDoubleQuoted: function () {
var char = this.consume();
if (char === '"') {
this.delegate.finishAttributeValue();
this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */);
}
else if (char === '&') {
this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
}
else {
this.delegate.appendToAttributeValue(char);
}
},
attributeValueSingleQuoted: function () {
var char = this.consume();
if (char === "'") {
this.delegate.finishAttributeValue();
this.transitionTo("afterAttributeValueQuoted" /* afterAttributeValueQuoted */);
}
else if (char === '&') {
this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
}
else {
this.delegate.appendToAttributeValue(char);
}
},
attributeValueUnquoted: function () {
var char = this.peek();
if (isSpace(char)) {
this.delegate.finishAttributeValue();
this.consume();
this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
}
else if (char === '/') {
this.delegate.finishAttributeValue();
this.consume();
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
}
else if (char === '&') {
this.consume();
this.delegate.appendToAttributeValue(this.consumeCharRef() || '&');
}
else if (char === '>') {
this.delegate.finishAttributeValue();
this.consume();
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
}
else {
this.consume();
this.delegate.appendToAttributeValue(char);
}
},
afterAttributeValueQuoted: function () {
var char = this.peek();
if (isSpace(char)) {
this.consume();
this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
}
else if (char === '/') {
this.consume();
this.transitionTo("selfClosingStartTag" /* selfClosingStartTag */);
}
else if (char === '>') {
this.consume();
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
}
else {
this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
}
},
selfClosingStartTag: function () {
var char = this.peek();
if (char === '>') {
this.consume();
this.delegate.markTagAsSelfClosing();
this.delegate.finishTag();
this.transitionTo("beforeData" /* beforeData */);
}
else {
this.transitionTo("beforeAttributeName" /* beforeAttributeName */);
}
},
endTagOpen: function () {
var char = this.consume();
if (char === '@' || char === ':' || isAlpha(char)) {
this.transitionTo("endTagName" /* endTagName */);
this.tagNameBuffer = '';
this.delegate.beginEndTag();
this.appendToTagName(char);
}
}
};
this.reset();
}
EventedTokenizer.prototype.reset = function () {
this.transitionTo("beforeData" /* beforeData */);
this.input = '';
this.tagNameBuffer = '';
this.index = 0;
this.line = 1;
this.column = 0;
this.delegate.reset();
};
EventedTokenizer.prototype.transitionTo = function (state) {
this.state = state;
};
EventedTokenizer.prototype.tokenize = function (input) {
this.reset();
this.tokenizePart(input);
this.tokenizeEOF();
};
EventedTokenizer.prototype.tokenizePart = function (input) {
this.input += preprocessInput(input);
while (this.index < this.input.length) {
var handler = this.states[this.state];
if (handler !== undefined) {
handler.call(this);
}
else {
throw new Error("unhandled state " + this.state);
}
}
};
EventedTokenizer.prototype.tokenizeEOF = function () {
this.flushData();
};
EventedTokenizer.prototype.flushData = function () {
if (this.state === 'data') {
this.delegate.finishData();
this.transitionTo("beforeData" /* beforeData */);
}
};
EventedTokenizer.prototype.peek = function () {
return this.input.charAt(this.index);
};
EventedTokenizer.prototype.consume = function () {
var char = this.peek();
this.index++;
if (char === '\n') {
this.line++;
this.column = 0;
}
else {
this.column++;
}
return char;
};
EventedTokenizer.prototype.consumeCharRef = function () {
var endIndex = this.input.indexOf(';', this.index);
if (endIndex === -1) {
return;
}
var entity = this.input.slice(this.index, endIndex);
var chars = this.entityParser.parse(entity);
if (chars) {
var count = entity.length;
// consume the entity chars
while (count) {
this.consume();
count--;
}
// consume the `;`
this.consume();
return chars;
}
};
EventedTokenizer.prototype.markTagStart = function () {
this.delegate.tagOpen();
};
EventedTokenizer.prototype.appendToTagName = function (char) {
this.tagNameBuffer += char;
this.delegate.appendToTagName(char);
};
EventedTokenizer.prototype.isIgnoredEndTag = function () {
var tag = this.tagNameBuffer;
return (tag === 'title' && this.input.substring(this.index, this.index + 8) !== '</title>') ||
(tag === 'style' && this.input.substring(this.index, this.index + 8) !== '</style>') ||
(tag === 'script' && this.input.substring(this.index, this.index + 9) !== '</script>');
};
return EventedTokenizer;
}());
var Tokenizer = /** @class */ (function () {
function Tokenizer(entityParser, options) {
if (options === void 0) { options = {}; }
this.options = options;
this.token = null;
this.startLine = 1;
this.startColumn = 0;
this.tokens = [];
this.tokenizer = new EventedTokenizer(this, entityParser, options.mode);
this._currentAttribute = undefined;
}
Tokenizer.prototype.tokenize = function (input) {
this.tokens = [];
this.tokenizer.tokenize(input);
return this.tokens;
};
Tokenizer.prototype.tokenizePart = function (input) {
this.tokens = [];
this.tokenizer.tokenizePart(input);
return this.tokens;
};
Tokenizer.prototype.tokenizeEOF = function () {
this.tokens = [];
this.tokenizer.tokenizeEOF();
return this.tokens[0];
};
Tokenizer.prototype.reset = function () {
this.token = null;
this.startLine = 1;
this.startColumn = 0;
};
Tokenizer.prototype.current = function () {
var token = this.token;
if (token === null) {
throw new Error('token was unexpectedly null');
}
if (arguments.length === 0) {
return token;
}
for (var i = 0; i < arguments.length; i++) {
if (token.type === arguments[i]) {
return token;
}
}
throw new Error("token type was unexpectedly " + token.type);
};
Tokenizer.prototype.push = function (token) {
this.token = token;
this.tokens.push(token);
};
Tokenizer.prototype.currentAttribute = function () {
return this._currentAttribute;
};
Tokenizer.prototype.addLocInfo = function () {
if (this.options.loc) {
this.current().loc = {
start: {
line: this.startLine,
column: this.startColumn
},
end: {
line: this.tokenizer.line,
column: this.tokenizer.column
}
};
}
this.startLine = this.tokenizer.line;
this.startColumn = this.tokenizer.column;
};
// Data
Tokenizer.prototype.beginDoctype = function () {
this.push({
type: "Doctype" /* Doctype */,
name: '',
});
};
Tokenizer.prototype.appendToDoctypeName = function (char) {
this.current("Doctype" /* Doctype */).name += char;
};
Tokenizer.prototype.appendToDoctypePublicIdentifier = function (char) {
var doctype = this.current("Doctype" /* Doctype */);
if (doctype.publicIdentifier === undefined) {
doctype.publicIdentifier = char;
}
else {
doctype.publicIdentifier += char;
}
};
Tokenizer.prototype.appendToDoctypeSystemIdentifier = function (char) {
var doctype = this.current("Doctype" /* Doctype */);
if (doctype.systemIdentifier === undefined) {
doctype.systemIdentifier = char;
}
else {
doctype.systemIdentifier += char;
}
};
Tokenizer.prototype.endDoctype = function () {
this.addLocInfo();
};
Tokenizer.prototype.beginData = function () {
this.push({
type: "Chars" /* Chars */,
chars: ''
});
};
Tokenizer.prototype.appendToData = function (char) {
this.current("Chars" /* Chars */).chars += char;
};
Tokenizer.prototype.finishData = function () {
this.addLocInfo();
};
// Comment
Tokenizer.prototype.beginComment = function () {
this.push({
type: "Comment" /* Comment */,
chars: ''
});
};
Tokenizer.prototype.appendToCommentData = function (char) {
this.current("Comment" /* Comment */).chars += char;
};
Tokenizer.prototype.finishComment = function () {
this.addLocInfo();
};
// Tags - basic
Tokenizer.prototype.tagOpen = function () { };
Tokenizer.prototype.beginStartTag = function () {
this.push({
type: "StartTag" /* StartTag */,
tagName: '',
attributes: [],
selfClosing: false
});
};
Tokenizer.prototype.beginEndTag = function () {
this.push({
type: "EndTag" /* EndTag */,
tagName: ''
});
};
Tokenizer.prototype.finishTag = function () {
this.addLocInfo();
};
Tokenizer.prototype.markTagAsSelfClosing = function () {
this.current("StartTag" /* StartTag */).selfClosing = true;
};
// Tags - name
Tokenizer.prototype.appendToTagName = function (char) {
this.current("StartTag" /* StartTag */, "EndTag" /* EndTag */).tagName += char;
};
// Tags - attributes
Tokenizer.prototype.beginAttribute = function () {
this._currentAttribute = ['', '', false];
};
Tokenizer.prototype.appendToAttributeName = function (char) {
this.currentAttribute()[0] += char;
};
Tokenizer.prototype.beginAttributeValue = function (isQuoted) {
this.currentAttribute()[2] = isQuoted;
};
Tokenizer.prototype.appendToAttributeValue = function (char) {
this.currentAttribute()[1] += char;
};
Tokenizer.prototype.finishAttributeValue = function () {
this.current("StartTag" /* StartTag */).attributes.push(this._currentAttribute);
};
Tokenizer.prototype.reportSyntaxError = function (message) {
this.current().syntaxError = message;
};
return Tokenizer;
}());
function tokenize(input, options) {
var tokenizer = new Tokenizer(new EntityParser(namedCharRefs), options);
return tokenizer.tokenize(input);
}
// EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js
var es6 = __webpack_require__(7734);
var es6_default = /*#__PURE__*/__webpack_require__.n(es6);
;// CONCATENATED MODULE: external ["wp","htmlEntities"]
const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/validation/logger.js
/**
* @typedef LoggerItem
* @property {Function} log Which logger recorded the message
* @property {Array<any>} args White arguments were supplied to the logger
*/
function createLogger() {
/**
* Creates a log handler with block validation prefix.
*
* @param {Function} logger Original logger function.
*
* @return {Function} Augmented logger function.
*/
function createLogHandler(logger) {
let log = (message, ...args) => logger('Block validation: ' + message, ...args);
// In test environments, pre-process string substitutions to improve
// readability of error messages. We'd prefer to avoid pulling in this
// dependency in runtime environments, and it can be dropped by a combo
// of Webpack env substitution + UglifyJS dead code elimination.
if (false) {}
return log;
}
return {
// eslint-disable-next-line no-console
error: createLogHandler(console.error),
// eslint-disable-next-line no-console
warning: createLogHandler(console.warn),
getItems() {
return [];
}
};
}
function createQueuedLogger() {
/**
* The list of enqueued log actions to print.
*
* @type {Array<LoggerItem>}
*/
const queue = [];
const logger = createLogger();
return {
error(...args) {
queue.push({
log: logger.error,
args
});
},
warning(...args) {
queue.push({
log: logger.warning,
args
});
},
getItems() {
return queue;
}
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/validation/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('../parser').WPBlock} WPBlock */
/** @typedef {import('../registration').WPBlockType} WPBlockType */
/** @typedef {import('./logger').LoggerItem} LoggerItem */
const identity = x => x;
/**
* Globally matches any consecutive whitespace
*
* @type {RegExp}
*/
const REGEXP_WHITESPACE = /[\t\n\r\v\f ]+/g;
/**
* Matches a string containing only whitespace
*
* @type {RegExp}
*/
const REGEXP_ONLY_WHITESPACE = /^[\t\n\r\v\f ]*$/;
/**
* Matches a CSS URL type value
*
* @type {RegExp}
*/
const REGEXP_STYLE_URL_TYPE = /^url\s*\(['"\s]*(.*?)['"\s]*\)$/;
/**
* Boolean attributes are attributes whose presence as being assigned is
* meaningful, even if only empty.
*
* See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes
* Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3
*
* Object.keys( Array.from( document.querySelectorAll( '#attributes-1 > tbody > tr' ) )
* .filter( ( tr ) => tr.lastChild.textContent.indexOf( 'Boolean attribute' ) !== -1 )
* .reduce( ( result, tr ) => Object.assign( result, {
* [ tr.firstChild.textContent.trim() ]: true
* } ), {} ) ).sort();
*
* @type {Array}
*/
const BOOLEAN_ATTRIBUTES = ['allowfullscreen', 'allowpaymentrequest', 'allowusermedia', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'default', 'defer', 'disabled', 'download', 'formnovalidate', 'hidden', 'ismap', 'itemscope', 'loop', 'multiple', 'muted', 'nomodule', 'novalidate', 'open', 'playsinline', 'readonly', 'required', 'reversed', 'selected', 'typemustmatch'];
/**
* Enumerated attributes are attributes which must be of a specific value form.
* Like boolean attributes, these are meaningful if specified, even if not of a
* valid enumerated value.
*
* See: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute
* Extracted from: https://html.spec.whatwg.org/multipage/indices.html#attributes-3
*
* Object.keys( Array.from( document.querySelectorAll( '#attributes-1 > tbody > tr' ) )
* .filter( ( tr ) => /^("(.+?)";?\s*)+/.test( tr.lastChild.textContent.trim() ) )
* .reduce( ( result, tr ) => Object.assign( result, {
* [ tr.firstChild.textContent.trim() ]: true
* } ), {} ) ).sort();
*
* @type {Array}
*/
const ENUMERATED_ATTRIBUTES = ['autocapitalize', 'autocomplete', 'charset', 'contenteditable', 'crossorigin', 'decoding', 'dir', 'draggable', 'enctype', 'formenctype', 'formmethod', 'http-equiv', 'inputmode', 'kind', 'method', 'preload', 'scope', 'shape', 'spellcheck', 'translate', 'type', 'wrap'];
/**
* Meaningful attributes are those who cannot be safely ignored when omitted in
* one HTML markup string and not another.
*
* @type {Array}
*/
const MEANINGFUL_ATTRIBUTES = [...BOOLEAN_ATTRIBUTES, ...ENUMERATED_ATTRIBUTES];
/**
* Array of functions which receive a text string on which to apply normalizing
* behavior for consideration in text token equivalence, carefully ordered from
* least-to-most expensive operations.
*
* @type {Array}
*/
const TEXT_NORMALIZATIONS = [identity, getTextWithCollapsedWhitespace];
/**
* Regular expression matching a named character reference. In lieu of bundling
* a full set of references, the pattern covers the minimal necessary to test
* positively against the full set.
*
* "The ampersand must be followed by one of the names given in the named
* character references section, using the same case."
*
* Tested aginst "12.5 Named character references":
*
* ```
* const references = Array.from( document.querySelectorAll(
* '#named-character-references-table tr[id^=entity-] td:first-child'
* ) ).map( ( code ) => code.textContent )
* references.every( ( reference ) => /^[\da-z]+$/i.test( reference ) )
* ```
*
* @see https://html.spec.whatwg.org/multipage/syntax.html#character-references
* @see https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references
*
* @type {RegExp}
*/
const REGEXP_NAMED_CHARACTER_REFERENCE = /^[\da-z]+$/i;
/**
* Regular expression matching a decimal character reference.
*
* "The ampersand must be followed by a U+0023 NUMBER SIGN character (#),
* followed by one or more ASCII digits, representing a base-ten integer"
*
* @see https://html.spec.whatwg.org/multipage/syntax.html#character-references
*
* @type {RegExp}
*/
const REGEXP_DECIMAL_CHARACTER_REFERENCE = /^#\d+$/;
/**
* Regular expression matching a hexadecimal character reference.
*
* "The ampersand must be followed by a U+0023 NUMBER SIGN character (#), which
* must be followed by either a U+0078 LATIN SMALL LETTER X character (x) or a
* U+0058 LATIN CAPITAL LETTER X character (X), which must then be followed by
* one or more ASCII hex digits, representing a hexadecimal integer"
*
* @see https://html.spec.whatwg.org/multipage/syntax.html#character-references
*
* @type {RegExp}
*/
const REGEXP_HEXADECIMAL_CHARACTER_REFERENCE = /^#x[\da-f]+$/i;
/**
* Returns true if the given string is a valid character reference segment, or
* false otherwise. The text should be stripped of `&` and `;` demarcations.
*
* @param {string} text Text to test.
*
* @return {boolean} Whether text is valid character reference.
*/
function isValidCharacterReference(text) {
return REGEXP_NAMED_CHARACTER_REFERENCE.test(text) || REGEXP_DECIMAL_CHARACTER_REFERENCE.test(text) || REGEXP_HEXADECIMAL_CHARACTER_REFERENCE.test(text);
}
/**
* Subsitute EntityParser class for `simple-html-tokenizer` which uses the
* implementation of `decodeEntities` from `html-entities`, in order to avoid
* bundling a massive named character reference.
*
* @see https://github.com/tildeio/simple-html-tokenizer/tree/HEAD/src/entity-parser.ts
*/
class DecodeEntityParser {
/**
* Returns a substitute string for an entity string sequence between `&`
* and `;`, or undefined if no substitution should occur.
*
* @param {string} entity Entity fragment discovered in HTML.
*
* @return {string | undefined} Entity substitute value.
*/
parse(entity) {
if (isValidCharacterReference(entity)) {
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)('&' + entity + ';');
}
}
}
/**
* Given a specified string, returns an array of strings split by consecutive
* whitespace, ignoring leading or trailing whitespace.
*
* @param {string} text Original text.
*
* @return {string[]} Text pieces split on whitespace.
*/
function getTextPiecesSplitOnWhitespace(text) {
return text.trim().split(REGEXP_WHITESPACE);
}
/**
* Given a specified string, returns a new trimmed string where all consecutive
* whitespace is collapsed to a single space.
*
* @param {string} text Original text.
*
* @return {string} Trimmed text with consecutive whitespace collapsed.
*/
function getTextWithCollapsedWhitespace(text) {
// This is an overly simplified whitespace comparison. The specification is
// more prescriptive of whitespace behavior in inline and block contexts.
//
// See: https://medium.com/@patrickbrosset/when-does-white-space-matter-in-html-b90e8a7cdd33
return getTextPiecesSplitOnWhitespace(text).join(' ');
}
/**
* Returns attribute pairs of the given StartTag token, including only pairs
* where the value is non-empty or the attribute is a boolean attribute, an
* enumerated attribute, or a custom data- attribute.
*
* @see MEANINGFUL_ATTRIBUTES
*
* @param {Object} token StartTag token.
*
* @return {Array[]} Attribute pairs.
*/
function getMeaningfulAttributePairs(token) {
return token.attributes.filter(pair => {
const [key, value] = pair;
return value || key.indexOf('data-') === 0 || MEANINGFUL_ATTRIBUTES.includes(key);
});
}
/**
* Returns true if two text tokens (with `chars` property) are equivalent, or
* false otherwise.
*
* @param {Object} actual Actual token.
* @param {Object} expected Expected token.
* @param {Object} logger Validation logger object.
*
* @return {boolean} Whether two text tokens are equivalent.
*/
function isEquivalentTextTokens(actual, expected, logger = createLogger()) {
// This function is intentionally written as syntactically "ugly" as a hot
// path optimization. Text is progressively normalized in order from least-
// to-most operationally expensive, until the earliest point at which text
// can be confidently inferred as being equal.
let actualChars = actual.chars;
let expectedChars = expected.chars;
for (let i = 0; i < TEXT_NORMALIZATIONS.length; i++) {
const normalize = TEXT_NORMALIZATIONS[i];
actualChars = normalize(actualChars);
expectedChars = normalize(expectedChars);
if (actualChars === expectedChars) {
return true;
}
}
logger.warning('Expected text `%s`, saw `%s`.', expected.chars, actual.chars);
return false;
}
/**
* Given a CSS length value, returns a normalized CSS length value for strict equality
* comparison.
*
* @param {string} value CSS length value.
*
* @return {string} Normalized CSS length value.
*/
function getNormalizedLength(value) {
if (0 === parseFloat(value)) {
return '0';
}
// Normalize strings with floats to always include a leading zero.
if (value.indexOf('.') === 0) {
return '0' + value;
}
return value;
}
/**
* Given a style value, returns a normalized style value for strict equality
* comparison.
*
* @param {string} value Style value.
*
* @return {string} Normalized style value.
*/
function getNormalizedStyleValue(value) {
const textPieces = getTextPiecesSplitOnWhitespace(value);
const normalizedPieces = textPieces.map(getNormalizedLength);
const result = normalizedPieces.join(' ');
return result
// Normalize URL type to omit whitespace or quotes.
.replace(REGEXP_STYLE_URL_TYPE, 'url($1)');
}
/**
* Given a style attribute string, returns an object of style properties.
*
* @param {string} text Style attribute.
*
* @return {Object} Style properties.
*/
function getStyleProperties(text) {
const pairs = text
// Trim ending semicolon (avoid including in split)
.replace(/;?\s*$/, '')
// Split on property assignment.
.split(';')
// For each property assignment...
.map(style => {
// ...split further into key-value pairs.
const [key, ...valueParts] = style.split(':');
const value = valueParts.join(':');
return [key.trim(), getNormalizedStyleValue(value.trim())];
});
return Object.fromEntries(pairs);
}
/**
* Attribute-specific equality handlers
*
* @type {Object}
*/
const isEqualAttributesOfName = {
class: (actual, expected) => {
// Class matches if members are the same, even if out of order or
// superfluous whitespace between.
const [actualPieces, expectedPieces] = [actual, expected].map(getTextPiecesSplitOnWhitespace);
const actualDiff = actualPieces.filter(c => !expectedPieces.includes(c));
const expectedDiff = expectedPieces.filter(c => !actualPieces.includes(c));
return actualDiff.length === 0 && expectedDiff.length === 0;
},
style: (actual, expected) => {
return es6_default()(...[actual, expected].map(getStyleProperties));
},
// For each boolean attribute, mere presence of attribute in both is enough
// to assume equivalence.
...Object.fromEntries(BOOLEAN_ATTRIBUTES.map(attribute => [attribute, () => true]))
};
/**
* Given two sets of attribute tuples, returns true if the attribute sets are
* equivalent.
*
* @param {Array[]} actual Actual attributes tuples.
* @param {Array[]} expected Expected attributes tuples.
* @param {Object} logger Validation logger object.
*
* @return {boolean} Whether attributes are equivalent.
*/
function isEqualTagAttributePairs(actual, expected, logger = createLogger()) {
// Attributes is tokenized as tuples. Their lengths should match. This also
// avoids us needing to check both attributes sets, since if A has any keys
// which do not exist in B, we know the sets to be different.
if (actual.length !== expected.length) {
logger.warning('Expected attributes %o, instead saw %o.', expected, actual);
return false;
}
// Attributes are not guaranteed to occur in the same order. For validating
// actual attributes, first convert the set of expected attribute values to
// an object, for lookup by key.
const expectedAttributes = {};
for (let i = 0; i < expected.length; i++) {
expectedAttributes[expected[i][0].toLowerCase()] = expected[i][1];
}
for (let i = 0; i < actual.length; i++) {
const [name, actualValue] = actual[i];
const nameLower = name.toLowerCase();
// As noted above, if missing member in B, assume different.
if (!expectedAttributes.hasOwnProperty(nameLower)) {
logger.warning('Encountered unexpected attribute `%s`.', name);
return false;
}
const expectedValue = expectedAttributes[nameLower];
const isEqualAttributes = isEqualAttributesOfName[nameLower];
if (isEqualAttributes) {
// Defer custom attribute equality handling.
if (!isEqualAttributes(actualValue, expectedValue)) {
logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue);
return false;
}
} else if (actualValue !== expectedValue) {
// Otherwise strict inequality should bail.
logger.warning('Expected attribute `%s` of value `%s`, saw `%s`.', name, expectedValue, actualValue);
return false;
}
}
return true;
}
/**
* Token-type-specific equality handlers
*
* @type {Object}
*/
const isEqualTokensOfType = {
StartTag: (actual, expected, logger = createLogger()) => {
if (actual.tagName !== expected.tagName &&
// Optimization: Use short-circuit evaluation to defer case-
// insensitive check on the assumption that the majority case will
// have exactly equal tag names.
actual.tagName.toLowerCase() !== expected.tagName.toLowerCase()) {
logger.warning('Expected tag name `%s`, instead saw `%s`.', expected.tagName, actual.tagName);
return false;
}
return isEqualTagAttributePairs(...[actual, expected].map(getMeaningfulAttributePairs), logger);
},
Chars: isEquivalentTextTokens,
Comment: isEquivalentTextTokens
};
/**
* Given an array of tokens, returns the first token which is not purely
* whitespace.
*
* Mutates the tokens array.
*
* @param {Object[]} tokens Set of tokens to search.
*
* @return {Object | undefined} Next non-whitespace token.
*/
function getNextNonWhitespaceToken(tokens) {
let token;
while (token = tokens.shift()) {
if (token.type !== 'Chars') {
return token;
}
if (!REGEXP_ONLY_WHITESPACE.test(token.chars)) {
return token;
}
}
}
/**
* Tokenize an HTML string, gracefully handling any errors thrown during
* underlying tokenization.
*
* @param {string} html HTML string to tokenize.
* @param {Object} logger Validation logger object.
*
* @return {Object[]|null} Array of valid tokenized HTML elements, or null on error
*/
function getHTMLTokens(html, logger = createLogger()) {
try {
return new Tokenizer(new DecodeEntityParser()).tokenize(html);
} catch (e) {
logger.warning('Malformed HTML detected: %s', html);
}
return null;
}
/**
* Returns true if the next HTML token closes the current token.
*
* @param {Object} currentToken Current token to compare with.
* @param {Object|undefined} nextToken Next token to compare against.
*
* @return {boolean} true if `nextToken` closes `currentToken`, false otherwise
*/
function isClosedByToken(currentToken, nextToken) {
// Ensure this is a self closed token.
if (!currentToken.selfClosing) {
return false;
}
// Check token names and determine if nextToken is the closing tag for currentToken.
if (nextToken && nextToken.tagName === currentToken.tagName && nextToken.type === 'EndTag') {
return true;
}
return false;
}
/**
* Returns true if the given HTML strings are effectively equivalent, or
* false otherwise. Invalid HTML is not considered equivalent, even if the
* strings directly match.
*
* @param {string} actual Actual HTML string.
* @param {string} expected Expected HTML string.
* @param {Object} logger Validation logger object.
*
* @return {boolean} Whether HTML strings are equivalent.
*/
function isEquivalentHTML(actual, expected, logger = createLogger()) {
// Short-circuit if markup is identical.
if (actual === expected) {
return true;
}
// Tokenize input content and reserialized save content.
const [actualTokens, expectedTokens] = [actual, expected].map(html => getHTMLTokens(html, logger));
// If either is malformed then stop comparing - the strings are not equivalent.
if (!actualTokens || !expectedTokens) {
return false;
}
let actualToken, expectedToken;
while (actualToken = getNextNonWhitespaceToken(actualTokens)) {
expectedToken = getNextNonWhitespaceToken(expectedTokens);
// Inequal if exhausted all expected tokens.
if (!expectedToken) {
logger.warning('Expected end of content, instead saw %o.', actualToken);
return false;
}
// Inequal if next non-whitespace token of each set are not same type.
if (actualToken.type !== expectedToken.type) {
logger.warning('Expected token of type `%s` (%o), instead saw `%s` (%o).', expectedToken.type, expectedToken, actualToken.type, actualToken);
return false;
}
// Defer custom token type equality handling, otherwise continue and
// assume as equal.
const isEqualTokens = isEqualTokensOfType[actualToken.type];
if (isEqualTokens && !isEqualTokens(actualToken, expectedToken, logger)) {
return false;
}
// Peek at the next tokens (actual and expected) to see if they close
// a self-closing tag.
if (isClosedByToken(actualToken, expectedTokens[0])) {
// Consume the next expected token that closes the current actual
// self-closing token.
getNextNonWhitespaceToken(expectedTokens);
} else if (isClosedByToken(expectedToken, actualTokens[0])) {
// Consume the next actual token that closes the current expected
// self-closing token.
getNextNonWhitespaceToken(actualTokens);
}
}
if (expectedToken = getNextNonWhitespaceToken(expectedTokens)) {
// If any non-whitespace tokens remain in expected token set, this
// indicates inequality.
logger.warning('Expected %o, instead saw end of content.', expectedToken);
return false;
}
return true;
}
/**
* Returns an object with `isValid` property set to `true` if the parsed block
* is valid given the input content. A block is considered valid if, when serialized
* with assumed attributes, the content matches the original value. If block is
* invalid, this function returns all validations issues as well.
*
* @param {string|Object} blockTypeOrName Block type.
* @param {Object} attributes Parsed block attributes.
* @param {string} originalBlockContent Original block content.
* @param {Object} logger Validation logger object.
*
* @return {Object} Whether block is valid and contains validation messages.
*/
/**
* Returns an object with `isValid` property set to `true` if the parsed block
* is valid given the input content. A block is considered valid if, when serialized
* with assumed attributes, the content matches the original value. If block is
* invalid, this function returns all validations issues as well.
*
* @param {WPBlock} block block object.
* @param {WPBlockType|string} [blockTypeOrName = block.name] Block type or name, inferred from block if not given.
*
* @return {[boolean,Array<LoggerItem>]} validation results.
*/
function validateBlock(block, blockTypeOrName = block.name) {
const isFallbackBlock = block.name === getFreeformContentHandlerName() || block.name === getUnregisteredTypeHandlerName();
// Shortcut to avoid costly validation.
if (isFallbackBlock) {
return [true, []];
}
const logger = createQueuedLogger();
const blockType = normalizeBlockType(blockTypeOrName);
let generatedBlockContent;
try {
generatedBlockContent = getSaveContent(blockType, block.attributes);
} catch (error) {
logger.error('Block validation failed because an error occurred while generating block content:\n\n%s', error.toString());
return [false, logger.getItems()];
}
const isValid = isEquivalentHTML(block.originalContent, generatedBlockContent, logger);
if (!isValid) {
logger.error('Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, generatedBlockContent, block.originalContent);
}
return [isValid, logger.getItems()];
}
/**
* Returns true if the parsed block is valid given the input content. A block
* is considered valid if, when serialized with assumed attributes, the content
* matches the original value.
*
* Logs to console in development environments when invalid.
*
* @deprecated Use validateBlock instead to avoid data loss.
*
* @param {string|Object} blockTypeOrName Block type.
* @param {Object} attributes Parsed block attributes.
* @param {string} originalBlockContent Original block content.
*
* @return {boolean} Whether block is valid.
*/
function isValidBlockContent(blockTypeOrName, attributes, originalBlockContent) {
external_wp_deprecated_default()('isValidBlockContent introduces opportunity for data loss', {
since: '12.6',
plugin: 'Gutenberg',
alternative: 'validateBlock'
});
const blockType = normalizeBlockType(blockTypeOrName);
const block = {
name: blockType.name,
attributes,
innerBlocks: [],
originalContent: originalBlockContent
};
const [isValid] = validateBlock(block, blockType);
return isValid;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser/convert-legacy-block.js
/**
* Convert legacy blocks to their canonical form. This function is used
* both in the parser level for previous content and to convert such blocks
* used in Custom Post Types templates.
*
* @param {string} name The block's name
* @param {Object} attributes The block's attributes
*
* @return {[string, Object]} The block's name and attributes, changed accordingly if a match was found
*/
function convertLegacyBlockNameAndAttributes(name, attributes) {
const newAttributes = {
...attributes
};
// Convert 'core/cover-image' block in existing content to 'core/cover'.
if ('core/cover-image' === name) {
name = 'core/cover';
}
// Convert 'core/text' blocks in existing content to 'core/paragraph'.
if ('core/text' === name || 'core/cover-text' === name) {
name = 'core/paragraph';
}
// Convert derivative blocks such as 'core/social-link-wordpress' to the
// canonical form 'core/social-link'.
if (name && name.indexOf('core/social-link-') === 0) {
// Capture `social-link-wordpress` into `{"service":"wordpress"}`
newAttributes.service = name.substring(17);
name = 'core/social-link';
}
// Convert derivative blocks such as 'core-embed/instagram' to the
// canonical form 'core/embed'.
if (name && name.indexOf('core-embed/') === 0) {
// Capture `core-embed/instagram` into `{"providerNameSlug":"instagram"}`
const providerSlug = name.substring(11);
const deprecated = {
speaker: 'speaker-deck',
polldaddy: 'crowdsignal'
};
newAttributes.providerNameSlug = providerSlug in deprecated ? deprecated[providerSlug] : providerSlug;
// This is needed as the `responsive` attribute was passed
// in a different way before the refactoring to block variations.
if (!['amazon-kindle', 'wordpress'].includes(providerSlug)) {
newAttributes.responsive = true;
}
name = 'core/embed';
}
// Convert Post Comment blocks in existing content to Comment blocks.
// TODO: Remove these checks when WordPress 6.0 is released.
if (name === 'core/post-comment-author') {
name = 'core/comment-author-name';
}
if (name === 'core/post-comment-content') {
name = 'core/comment-content';
}
if (name === 'core/post-comment-date') {
name = 'core/comment-date';
}
if (name === 'core/comments-query-loop') {
name = 'core/comments';
const {
className = ''
} = newAttributes;
if (!className.includes('wp-block-comments-query-loop')) {
newAttributes.className = ['wp-block-comments-query-loop', className].join(' ');
}
// Note that we also had to add a deprecation to the block in order
// for the ID change to work.
}
if (name === 'core/post-comments') {
name = 'core/comments';
newAttributes.legacy = true;
}
// The following code is only relevant for the Gutenberg plugin.
// It's a stand-alone if statement for dead-code elimination.
if (false) {}
return [name, newAttributes];
}
;// CONCATENATED MODULE: ./node_modules/hpq/es/get-path.js
/**
* Given object and string of dot-delimited path segments, returns value at
* path or undefined if path cannot be resolved.
*
* @param {Object} object Lookup object
* @param {string} path Path to resolve
* @return {?*} Resolved value
*/
function getPath(object, path) {
var segments = path.split('.');
var segment;
while (segment = segments.shift()) {
if (!(segment in object)) {
return;
}
object = object[segment];
}
return object;
}
;// CONCATENATED MODULE: ./node_modules/hpq/es/index.js
/**
* Internal dependencies
*/
/**
* Function returning a DOM document created by `createHTMLDocument`. The same
* document is returned between invocations.
*
* @return {Document} DOM document.
*/
var getDocument = function () {
var doc;
return function () {
if (!doc) {
doc = document.implementation.createHTMLDocument('');
}
return doc;
};
}();
/**
* Given a markup string or DOM element, creates an object aligning with the
* shape of the matchers object, or the value returned by the matcher.
*
* @param {(string|Element)} source Source content
* @param {(Object|Function)} matchers Matcher function or object of matchers
* @return {(Object|*)} Matched value(s), shaped by object
*/
function parse(source, matchers) {
if (!matchers) {
return;
} // Coerce to element
if ('string' === typeof source) {
var doc = getDocument();
doc.body.innerHTML = source;
source = doc.body;
} // Return singular value
if ('function' === typeof matchers) {
return matchers(source);
} // Bail if we can't handle matchers
if (Object !== matchers.constructor) {
return;
} // Shape result by matcher object
return Object.keys(matchers).reduce(function (memo, key) {
memo[key] = parse(source, matchers[key]);
return memo;
}, {});
}
/**
* Generates a function which matches node of type selector, returning an
* attribute by property if the attribute exists. If no selector is passed,
* returns property of the query element.
*
* @param {?string} selector Optional selector
* @param {string} name Property name
* @return {*} Property value
*/
function prop(selector, name) {
if (1 === arguments.length) {
name = selector;
selector = undefined;
}
return function (node) {
var match = node;
if (selector) {
match = node.querySelector(selector);
}
if (match) {
return getPath(match, name);
}
};
}
/**
* Generates a function which matches node of type selector, returning an
* attribute by name if the attribute exists. If no selector is passed,
* returns attribute of the query element.
*
* @param {?string} selector Optional selector
* @param {string} name Attribute name
* @return {?string} Attribute value
*/
function attr(selector, name) {
if (1 === arguments.length) {
name = selector;
selector = undefined;
}
return function (node) {
var attributes = prop(selector, 'attributes')(node);
if (attributes && attributes.hasOwnProperty(name)) {
return attributes[name].value;
}
};
}
/**
* Convenience for `prop( selector, 'innerHTML' )`.
*
* @see prop()
*
* @param {?string} selector Optional selector
* @return {string} Inner HTML
*/
function html(selector) {
return prop(selector, 'innerHTML');
}
/**
* Convenience for `prop( selector, 'textContent' )`.
*
* @see prop()
*
* @param {?string} selector Optional selector
* @return {string} Text content
*/
function es_text(selector) {
return prop(selector, 'textContent');
}
/**
* Creates a new matching context by first finding elements matching selector
* using querySelectorAll before then running another `parse` on `matchers`
* scoped to the matched elements.
*
* @see parse()
*
* @param {string} selector Selector to match
* @param {(Object|Function)} matchers Matcher function or object of matchers
* @return {Array.<*,Object>} Array of matched value(s)
*/
function query(selector, matchers) {
return function (node) {
var matches = node.querySelectorAll(selector);
return [].map.call(matches, function (match) {
return parse(match, matchers);
});
};
}
;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js
/**
* 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 {(...args: any[]) => any} F
*
* @param {F} fn Function to memoize.
* @param {MemizeOptions} [options] Options object.
*
* @return {((...args: Parameters<F>) => ReturnType<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;
};
// 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;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/matchers.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function matchers_html(selector, multilineTag) {
return domNode => {
let match = domNode;
if (selector) {
match = domNode.querySelector(selector);
}
if (!match) {
return '';
}
if (multilineTag) {
let value = '';
const length = match.children.length;
for (let index = 0; index < length; index++) {
const child = match.children[index];
if (child.nodeName.toLowerCase() !== multilineTag) {
continue;
}
value += child.outerHTML;
}
return value;
}
return match.innerHTML;
};
}
const richText = (selector, preserveWhiteSpace) => el => {
const target = selector ? el.querySelector(selector) : el;
return target ? external_wp_richText_namespaceObject.RichTextData.fromHTMLElement(target, {
preserveWhiteSpace
}) : external_wp_richText_namespaceObject.RichTextData.empty();
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/node.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* A representation of a single node within a block's rich text value. If
* representing a text node, the value is simply a string of the node value.
* As representing an element node, it is an object of:
*
* 1. `type` (string): Tag name.
* 2. `props` (object): Attributes and children array of WPBlockNode.
*
* @typedef {string|Object} WPBlockNode
*/
/**
* Given a single node and a node type (e.g. `'br'`), returns true if the node
* corresponds to that type, false otherwise.
*
* @param {WPBlockNode} node Block node to test
* @param {string} type Node to type to test against.
*
* @return {boolean} Whether node is of intended type.
*/
function isNodeOfType(node, type) {
external_wp_deprecated_default()('wp.blocks.node.isNodeOfType', {
since: '6.1',
version: '6.3',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
return node && node.type === type;
}
/**
* Given an object implementing the NamedNodeMap interface, returns a plain
* object equivalent value of name, value key-value pairs.
*
* @see https://dom.spec.whatwg.org/#interface-namednodemap
*
* @param {NamedNodeMap} nodeMap NamedNodeMap to convert to object.
*
* @return {Object} Object equivalent value of NamedNodeMap.
*/
function getNamedNodeMapAsObject(nodeMap) {
const result = {};
for (let i = 0; i < nodeMap.length; i++) {
const {
name,
value
} = nodeMap[i];
result[name] = value;
}
return result;
}
/**
* Given a DOM Element or Text node, returns an equivalent block node. Throws
* if passed any node type other than element or text.
*
* @throws {TypeError} If non-element/text node is passed.
*
* @param {Node} domNode DOM node to convert.
*
* @return {WPBlockNode} Block node equivalent to DOM node.
*/
function fromDOM(domNode) {
external_wp_deprecated_default()('wp.blocks.node.fromDOM', {
since: '6.1',
version: '6.3',
alternative: 'wp.richText.create',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
if (domNode.nodeType === domNode.TEXT_NODE) {
return domNode.nodeValue;
}
if (domNode.nodeType !== domNode.ELEMENT_NODE) {
throw new TypeError('A block node can only be created from a node of type text or ' + 'element.');
}
return {
type: domNode.nodeName.toLowerCase(),
props: {
...getNamedNodeMapAsObject(domNode.attributes),
children: children_fromDOM(domNode.childNodes)
}
};
}
/**
* Given a block node, returns its HTML string representation.
*
* @param {WPBlockNode} node Block node to convert to string.
*
* @return {string} String HTML representation of block node.
*/
function toHTML(node) {
external_wp_deprecated_default()('wp.blocks.node.toHTML', {
since: '6.1',
version: '6.3',
alternative: 'wp.richText.toHTMLString',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
return children_toHTML([node]);
}
/**
* Given a selector, returns an hpq matcher generating a WPBlockNode value
* matching the selector result.
*
* @param {string} selector DOM selector.
*
* @return {Function} hpq matcher.
*/
function node_matcher(selector) {
external_wp_deprecated_default()('wp.blocks.node.matcher', {
since: '6.1',
version: '6.3',
alternative: 'html source',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
return domNode => {
let match = domNode;
if (selector) {
match = domNode.querySelector(selector);
}
try {
return fromDOM(match);
} catch (error) {
return null;
}
};
}
/**
* Object of utility functions used in managing block attribute values of
* source `node`.
*
* @see https://github.com/WordPress/gutenberg/pull/10439
*
* @deprecated since 4.0. The `node` source should not be used, and can be
* replaced by the `html` source.
*
* @private
*/
/* harmony default export */ const node = ({
isNodeOfType,
fromDOM,
toHTML,
matcher: node_matcher
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/children.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* A representation of a block's rich text value.
*
* @typedef {WPBlockNode[]} WPBlockChildren
*/
/**
* Given block children, returns a serialize-capable WordPress element.
*
* @param {WPBlockChildren} children Block children object to convert.
*
* @return {Element} A serialize-capable element.
*/
function getSerializeCapableElement(children) {
// The fact that block children are compatible with the element serializer is
// merely an implementation detail that currently serves to be true, but
// should not be mistaken as being a guarantee on the external API. The
// public API only offers guarantees to work with strings (toHTML) and DOM
// elements (fromDOM), and should provide utilities to manipulate the value
// rather than expect consumers to inspect or construct its shape (concat).
return children;
}
/**
* Given block children, returns an array of block nodes.
*
* @param {WPBlockChildren} children Block children object to convert.
*
* @return {Array<WPBlockNode>} An array of individual block nodes.
*/
function getChildrenArray(children) {
external_wp_deprecated_default()('wp.blocks.children.getChildrenArray', {
since: '6.1',
version: '6.3',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
// The fact that block children are compatible with the element serializer
// is merely an implementation detail that currently serves to be true, but
// should not be mistaken as being a guarantee on the external API.
return children;
}
/**
* Given two or more block nodes, returns a new block node representing a
* concatenation of its values.
*
* @param {...WPBlockChildren} blockNodes Block nodes to concatenate.
*
* @return {WPBlockChildren} Concatenated block node.
*/
function concat(...blockNodes) {
external_wp_deprecated_default()('wp.blocks.children.concat', {
since: '6.1',
version: '6.3',
alternative: 'wp.richText.concat',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
const result = [];
for (let i = 0; i < blockNodes.length; i++) {
const blockNode = Array.isArray(blockNodes[i]) ? blockNodes[i] : [blockNodes[i]];
for (let j = 0; j < blockNode.length; j++) {
const child = blockNode[j];
const canConcatToPreviousString = typeof child === 'string' && typeof result[result.length - 1] === 'string';
if (canConcatToPreviousString) {
result[result.length - 1] += child;
} else {
result.push(child);
}
}
}
return result;
}
/**
* Given an iterable set of DOM nodes, returns equivalent block children.
* Ignores any non-element/text nodes included in set.
*
* @param {Iterable.<Node>} domNodes Iterable set of DOM nodes to convert.
*
* @return {WPBlockChildren} Block children equivalent to DOM nodes.
*/
function children_fromDOM(domNodes) {
external_wp_deprecated_default()('wp.blocks.children.fromDOM', {
since: '6.1',
version: '6.3',
alternative: 'wp.richText.create',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
const result = [];
for (let i = 0; i < domNodes.length; i++) {
try {
result.push(fromDOM(domNodes[i]));
} catch (error) {
// Simply ignore if DOM node could not be converted.
}
}
return result;
}
/**
* Given a block node, returns its HTML string representation.
*
* @param {WPBlockChildren} children Block node(s) to convert to string.
*
* @return {string} String HTML representation of block node.
*/
function children_toHTML(children) {
external_wp_deprecated_default()('wp.blocks.children.toHTML', {
since: '6.1',
version: '6.3',
alternative: 'wp.richText.toHTMLString',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
const element = getSerializeCapableElement(children);
return (0,external_wp_element_namespaceObject.renderToString)(element);
}
/**
* Given a selector, returns an hpq matcher generating a WPBlockChildren value
* matching the selector result.
*
* @param {string} selector DOM selector.
*
* @return {Function} hpq matcher.
*/
function children_matcher(selector) {
external_wp_deprecated_default()('wp.blocks.children.matcher', {
since: '6.1',
version: '6.3',
alternative: 'html source',
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/'
});
return domNode => {
let match = domNode;
if (selector) {
match = domNode.querySelector(selector);
}
if (match) {
return children_fromDOM(match.childNodes);
}
return [];
};
}
/**
* Object of utility functions used in managing block attribute values of
* source `children`.
*
* @see https://github.com/WordPress/gutenberg/pull/10439
*
* @deprecated since 4.0. The `children` source should not be used, and can be
* replaced by the `html` source.
*
* @private
*/
/* harmony default export */ const children = ({
concat,
getChildrenArray,
fromDOM: children_fromDOM,
toHTML: children_toHTML,
matcher: children_matcher
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser/get-block-attributes.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Higher-order hpq matcher which enhances an attribute matcher to return true
* or false depending on whether the original matcher returns undefined. This
* is useful for boolean attributes (e.g. disabled) whose attribute values may
* be technically falsey (empty string), though their mere presence should be
* enough to infer as true.
*
* @param {Function} matcher Original hpq matcher.
*
* @return {Function} Enhanced hpq matcher.
*/
const toBooleanAttributeMatcher = matcher => (0,external_wp_compose_namespaceObject.pipe)([matcher,
// Expected values from `attr( 'disabled' )`:
//
// <input>
// - Value: `undefined`
// - Transformed: `false`
//
// <input disabled>
// - Value: `''`
// - Transformed: `true`
//
// <input disabled="disabled">
// - Value: `'disabled'`
// - Transformed: `true`
value => value !== undefined]);
/**
* Returns true if value is of the given JSON schema type, or false otherwise.
*
* @see http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.25
*
* @param {*} value Value to test.
* @param {string} type Type to test.
*
* @return {boolean} Whether value is of type.
*/
function isOfType(value, type) {
switch (type) {
case 'rich-text':
return value instanceof external_wp_richText_namespaceObject.RichTextData;
case 'string':
return typeof value === 'string';
case 'boolean':
return typeof value === 'boolean';
case 'object':
return !!value && value.constructor === Object;
case 'null':
return value === null;
case 'array':
return Array.isArray(value);
case 'integer':
case 'number':
return typeof value === 'number';
}
return true;
}
/**
* Returns true if value is of an array of given JSON schema types, or false
* otherwise.
*
* @see http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.25
*
* @param {*} value Value to test.
* @param {string[]} types Types to test.
*
* @return {boolean} Whether value is of types.
*/
function isOfTypes(value, types) {
return types.some(type => isOfType(value, type));
}
/**
* Given an attribute key, an attribute's schema, a block's raw content and the
* commentAttributes returns the attribute value depending on its source
* definition of the given attribute key.
*
* @param {string} attributeKey Attribute key.
* @param {Object} attributeSchema Attribute's schema.
* @param {Node} innerDOM Parsed DOM of block's inner HTML.
* @param {Object} commentAttributes Block's comment attributes.
* @param {string} innerHTML Raw HTML from block node's innerHTML property.
*
* @return {*} Attribute value.
*/
function getBlockAttribute(attributeKey, attributeSchema, innerDOM, commentAttributes, innerHTML) {
let value;
switch (attributeSchema.source) {
// An undefined source means that it's an attribute serialized to the
// block's "comment".
case undefined:
value = commentAttributes ? commentAttributes[attributeKey] : undefined;
break;
// raw source means that it's the original raw block content.
case 'raw':
value = innerHTML;
break;
case 'attribute':
case 'property':
case 'html':
case 'text':
case 'rich-text':
case 'children':
case 'node':
case 'query':
case 'tag':
value = parseWithAttributeSchema(innerDOM, attributeSchema);
break;
}
if (!isValidByType(value, attributeSchema.type) || !isValidByEnum(value, attributeSchema.enum)) {
// Reject the value if it is not valid. Reverting to the undefined
// value ensures the default is respected, if applicable.
value = undefined;
}
if (value === undefined) {
value = getDefault(attributeSchema);
}
return value;
}
/**
* Returns true if value is valid per the given block attribute schema type
* definition, or false otherwise.
*
* @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.1
*
* @param {*} value Value to test.
* @param {?(Array<string>|string)} type Block attribute schema type.
*
* @return {boolean} Whether value is valid.
*/
function isValidByType(value, type) {
return type === undefined || isOfTypes(value, Array.isArray(type) ? type : [type]);
}
/**
* Returns true if value is valid per the given block attribute schema enum
* definition, or false otherwise.
*
* @see https://json-schema.org/latest/json-schema-validation.html#rfc.section.6.1.2
*
* @param {*} value Value to test.
* @param {?Array} enumSet Block attribute schema enum.
*
* @return {boolean} Whether value is valid.
*/
function isValidByEnum(value, enumSet) {
return !Array.isArray(enumSet) || enumSet.includes(value);
}
/**
* Returns an hpq matcher given a source object.
*
* @param {Object} sourceConfig Attribute Source object.
*
* @return {Function} A hpq Matcher.
*/
const matcherFromSource = memize(sourceConfig => {
switch (sourceConfig.source) {
case 'attribute':
let matcher = attr(sourceConfig.selector, sourceConfig.attribute);
if (sourceConfig.type === 'boolean') {
matcher = toBooleanAttributeMatcher(matcher);
}
return matcher;
case 'html':
return matchers_html(sourceConfig.selector, sourceConfig.multiline);
case 'text':
return es_text(sourceConfig.selector);
case 'rich-text':
return richText(sourceConfig.selector, sourceConfig.__unstablePreserveWhiteSpace);
case 'children':
return children_matcher(sourceConfig.selector);
case 'node':
return node_matcher(sourceConfig.selector);
case 'query':
const subMatchers = Object.fromEntries(Object.entries(sourceConfig.query).map(([key, subSourceConfig]) => [key, matcherFromSource(subSourceConfig)]));
return query(sourceConfig.selector, subMatchers);
case 'tag':
return (0,external_wp_compose_namespaceObject.pipe)([prop(sourceConfig.selector, 'nodeName'), nodeName => nodeName ? nodeName.toLowerCase() : undefined]);
default:
// eslint-disable-next-line no-console
console.error(`Unknown source type "${sourceConfig.source}"`);
}
});
/**
* Parse a HTML string into DOM tree.
*
* @param {string|Node} innerHTML HTML string or already parsed DOM node.
*
* @return {Node} Parsed DOM node.
*/
function parseHtml(innerHTML) {
return parse(innerHTML, h => h);
}
/**
* Given a block's raw content and an attribute's schema returns the attribute's
* value depending on its source.
*
* @param {string|Node} innerHTML Block's raw content.
* @param {Object} attributeSchema Attribute's schema.
*
* @return {*} Attribute value.
*/
function parseWithAttributeSchema(innerHTML, attributeSchema) {
return matcherFromSource(attributeSchema)(parseHtml(innerHTML));
}
/**
* Returns the block attributes of a registered block node given its type.
*
* @param {string|Object} blockTypeOrName Block type or name.
* @param {string|Node} innerHTML Raw block content.
* @param {?Object} attributes Known block attributes (from delimiters).
*
* @return {Object} All block attributes.
*/
function getBlockAttributes(blockTypeOrName, innerHTML, attributes = {}) {
var _blockType$attributes;
const doc = parseHtml(innerHTML);
const blockType = normalizeBlockType(blockTypeOrName);
const blockAttributes = Object.fromEntries(Object.entries((_blockType$attributes = blockType.attributes) !== null && _blockType$attributes !== void 0 ? _blockType$attributes : {}).map(([key, schema]) => [key, getBlockAttribute(key, schema, doc, attributes, innerHTML)]));
return (0,external_wp_hooks_namespaceObject.applyFilters)('blocks.getBlockAttributes', blockAttributes, blockType, innerHTML, attributes);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser/fix-custom-classname.js
/**
* Internal dependencies
*/
const CLASS_ATTR_SCHEMA = {
type: 'string',
source: 'attribute',
selector: '[data-custom-class-name] > *',
attribute: 'class'
};
/**
* 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) {
const parsed = parseWithAttributeSchema(`<div data-custom-class-name>${innerHTML}</div>`, CLASS_ATTR_SCHEMA);
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 fixCustomClassname(blockAttributes, blockType, innerHTML) {
if (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 {
className: omittedClassName,
...attributesSansClassName
} = blockAttributes;
const serialized = getSaveContent(blockType, attributesSansClassName);
const defaultClasses = getHTMLRootElementClasses(serialized);
const actualClasses = getHTMLRootElementClasses(innerHTML);
const customClasses = actualClasses.filter(className => !defaultClasses.includes(className));
if (customClasses.length) {
blockAttributes.className = customClasses.join(' ');
} else if (serialized) {
delete blockAttributes.className;
}
}
return blockAttributes;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser/apply-built-in-validation-fixes.js
/**
* Internal dependencies
*/
/**
* Attempts to fix block invalidation by applying build-in validation fixes
* like moving all extra classNames to the className attribute.
*
* @param {WPBlock} block block object.
* @param {import('../registration').WPBlockType} blockType Block type. This is normalize not necessary and
* can be inferred from the block name,
* but it's here for performance reasons.
*
* @return {WPBlock} Fixed block object
*/
function applyBuiltInValidationFixes(block, blockType) {
const updatedBlockAttributes = fixCustomClassname(block.attributes, blockType, block.originalContent);
return {
...block,
attributes: updatedBlockAttributes
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser/apply-block-deprecated-versions.js
/**
* Internal dependencies
*/
/**
* Function that takes no arguments and always returns false.
*
* @return {boolean} Always returns false.
*/
function stubFalse() {
return false;
}
/**
* Given a block object, returns a new copy of the block with any applicable
* deprecated migrations applied, or the original block if it was both valid
* and no eligible migrations exist.
*
* @param {import(".").WPBlock} block Parsed and invalid block object.
* @param {import(".").WPRawBlock} rawBlock Raw block object.
* @param {import('../registration').WPBlockType} blockType Block type. This is normalize not necessary and
* can be inferred from the block name,
* but it's here for performance reasons.
*
* @return {import(".").WPBlock} Migrated block object.
*/
function applyBlockDeprecatedVersions(block, rawBlock, blockType) {
const parsedAttributes = rawBlock.attrs;
const {
deprecated: deprecatedDefinitions
} = blockType;
// Bail early if there are no registered deprecations to be handled.
if (!deprecatedDefinitions || !deprecatedDefinitions.length) {
return block;
}
// By design, blocks lack any sort of version tracking. Instead, to process
// outdated content the system operates a queue out of all the defined
// attribute shapes and tries each definition until the input produces a
// valid result. This mechanism seeks to avoid polluting the user-space with
// machine-specific code. An invalid block is thus a block that could not be
// matched successfully with any of the registered deprecation definitions.
for (let i = 0; i < deprecatedDefinitions.length; i++) {
// A block can opt into a migration even if the block is valid by
// defining `isEligible` on its deprecation. If the block is both valid
// and does not opt to migrate, skip.
const {
isEligible = stubFalse
} = deprecatedDefinitions[i];
if (block.isValid && !isEligible(parsedAttributes, block.innerBlocks, {
blockNode: rawBlock,
block
})) {
continue;
}
// Block type properties which could impact either serialization or
// parsing are not considered in the deprecated block type by default,
// and must be explicitly provided.
const deprecatedBlockType = Object.assign(omit(blockType, DEPRECATED_ENTRY_KEYS), deprecatedDefinitions[i]);
let migratedBlock = {
...block,
attributes: getBlockAttributes(deprecatedBlockType, block.originalContent, parsedAttributes)
};
// Ignore the deprecation if it produces a block which is not valid.
let [isValid] = validateBlock(migratedBlock, deprecatedBlockType);
// If the migrated block is not valid initially, try the built-in fixes.
if (!isValid) {
migratedBlock = applyBuiltInValidationFixes(migratedBlock, deprecatedBlockType);
[isValid] = validateBlock(migratedBlock, deprecatedBlockType);
}
// An invalid block does not imply incorrect HTML but the fact block
// source information could be lost on re-serialization.
if (!isValid) {
continue;
}
let migratedInnerBlocks = migratedBlock.innerBlocks;
let migratedAttributes = migratedBlock.attributes;
// A block may provide custom behavior to assign new attributes and/or
// inner blocks.
const {
migrate
} = deprecatedBlockType;
if (migrate) {
let migrated = migrate(migratedAttributes, block.innerBlocks);
if (!Array.isArray(migrated)) {
migrated = [migrated];
}
[migratedAttributes = parsedAttributes, migratedInnerBlocks = block.innerBlocks] = migrated;
}
block = {
...block,
attributes: migratedAttributes,
innerBlocks: migratedInnerBlocks,
isValid: true,
validationIssues: []
};
}
return block;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/parser/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* The raw structure of a block includes its attributes, inner
* blocks, and inner HTML. It is important to distinguish inner blocks from
* the HTML content of the block as only the latter is relevant for block
* validation and edit operations.
*
* @typedef WPRawBlock
*
* @property {string=} blockName Block name
* @property {Object=} attrs Block raw or comment attributes.
* @property {string} innerHTML HTML content of the block.
* @property {(string|null)[]} innerContent Content without inner blocks.
* @property {WPRawBlock[]} innerBlocks Inner Blocks.
*/
/**
* Fully parsed block object.
*
* @typedef WPBlock
*
* @property {string} name Block name
* @property {Object} attributes Block raw or comment attributes.
* @property {WPBlock[]} innerBlocks Inner Blocks.
* @property {string} originalContent Original content of the block before validation fixes.
* @property {boolean} isValid Whether the block is valid.
* @property {Object[]} validationIssues Validation issues.
* @property {WPRawBlock} [__unstableBlockSource] Un-processed original copy of block if created through parser.
*/
/**
* @typedef {Object} ParseOptions
* @property {boolean?} __unstableSkipMigrationLogs If a block is migrated from a deprecated version, skip logging the migration details.
* @property {boolean?} __unstableSkipAutop Whether to skip autop when processing freeform content.
*/
/**
* Convert legacy blocks to their canonical form. This function is used
* both in the parser level for previous content and to convert such blocks
* used in Custom Post Types templates.
*
* @param {WPRawBlock} rawBlock
*
* @return {WPRawBlock} The block's name and attributes, changed accordingly if a match was found
*/
function convertLegacyBlocks(rawBlock) {
const [correctName, correctedAttributes] = convertLegacyBlockNameAndAttributes(rawBlock.blockName, rawBlock.attrs);
return {
...rawBlock,
blockName: correctName,
attrs: correctedAttributes
};
}
/**
* Normalize the raw block by applying the fallback block name if none given,
* sanitize the parsed HTML...
*
* @param {WPRawBlock} rawBlock The raw block object.
* @param {ParseOptions?} options Extra options for handling block parsing.
*
* @return {WPRawBlock} The normalized block object.
*/
function normalizeRawBlock(rawBlock, options) {
const fallbackBlockName = getFreeformContentHandlerName();
// If the grammar parsing don't produce any block name, use the freeform block.
const rawBlockName = rawBlock.blockName || getFreeformContentHandlerName();
const rawAttributes = rawBlock.attrs || {};
const rawInnerBlocks = rawBlock.innerBlocks || [];
let rawInnerHTML = rawBlock.innerHTML.trim();
// Fallback content may be upgraded from classic content expecting implicit
// automatic paragraphs, so preserve them. Assumes wpautop is idempotent,
// meaning there are no negative consequences to repeated autop calls.
if (rawBlockName === fallbackBlockName && rawBlockName === 'core/freeform' && !options?.__unstableSkipAutop) {
rawInnerHTML = (0,external_wp_autop_namespaceObject.autop)(rawInnerHTML).trim();
}
return {
...rawBlock,
blockName: rawBlockName,
attrs: rawAttributes,
innerHTML: rawInnerHTML,
innerBlocks: rawInnerBlocks
};
}
/**
* Uses the "unregistered blockType" to create a block object.
*
* @param {WPRawBlock} rawBlock block.
*
* @return {WPRawBlock} The unregistered block object.
*/
function createMissingBlockType(rawBlock) {
const unregisteredFallbackBlock = getUnregisteredTypeHandlerName() || getFreeformContentHandlerName();
// Preserve undelimited content for use by the unregistered type
// handler. A block node's `innerHTML` isn't enough, as that field only
// carries the block's own HTML and not its nested blocks.
const originalUndelimitedContent = serializeRawBlock(rawBlock, {
isCommentDelimited: false
});
// Preserve full block content for use by the unregistered type
// handler, block boundaries included.
const originalContent = serializeRawBlock(rawBlock, {
isCommentDelimited: true
});
return {
blockName: unregisteredFallbackBlock,
attrs: {
originalName: rawBlock.blockName,
originalContent,
originalUndelimitedContent
},
innerHTML: rawBlock.blockName ? originalContent : rawBlock.innerHTML,
innerBlocks: rawBlock.innerBlocks,
innerContent: rawBlock.innerContent
};
}
/**
* Validates a block and wraps with validation meta.
*
* The name here is regrettable but `validateBlock` is already taken.
*
* @param {WPBlock} unvalidatedBlock
* @param {import('../registration').WPBlockType} blockType
* @return {WPBlock} validated block, with auto-fixes if initially invalid
*/
function applyBlockValidation(unvalidatedBlock, blockType) {
// Attempt to validate the block.
const [isValid] = validateBlock(unvalidatedBlock, blockType);
if (isValid) {
return {
...unvalidatedBlock,
isValid,
validationIssues: []
};
}
// If the block is invalid, attempt some built-in fixes
// like custom classNames handling.
const fixedBlock = applyBuiltInValidationFixes(unvalidatedBlock, blockType);
// Attempt to validate the block once again after the built-in fixes.
const [isFixedValid, validationIssues] = validateBlock(unvalidatedBlock, blockType);
return {
...fixedBlock,
isValid: isFixedValid,
validationIssues
};
}
/**
* Given a raw block returned by grammar parsing, returns a fully parsed block.
*
* @param {WPRawBlock} rawBlock The raw block object.
* @param {ParseOptions} options Extra options for handling block parsing.
*
* @return {WPBlock | undefined} Fully parsed block.
*/
function parseRawBlock(rawBlock, options) {
let normalizedBlock = normalizeRawBlock(rawBlock, options);
// During the lifecycle of the project, we renamed some old blocks
// and transformed others to new blocks. To avoid breaking existing content,
// we added this function to properly parse the old content.
normalizedBlock = convertLegacyBlocks(normalizedBlock);
// Try finding the type for known block name.
let blockType = getBlockType(normalizedBlock.blockName);
// If not blockType is found for the specified name, fallback to the "unregistedBlockType".
if (!blockType) {
normalizedBlock = createMissingBlockType(normalizedBlock);
blockType = getBlockType(normalizedBlock.blockName);
}
// If it's an empty freeform block or there's no blockType (no missing block handler)
// Then, just ignore the block.
// It might be a good idea to throw a warning here.
// TODO: I'm unsure about the unregisteredFallbackBlock check,
// it might ignore some dynamic unregistered third party blocks wrongly.
const isFallbackBlock = normalizedBlock.blockName === getFreeformContentHandlerName() || normalizedBlock.blockName === getUnregisteredTypeHandlerName();
if (!blockType || !normalizedBlock.innerHTML && isFallbackBlock) {
return;
}
// Parse inner blocks recursively.
const parsedInnerBlocks = normalizedBlock.innerBlocks.map(innerBlock => parseRawBlock(innerBlock, options))
// See https://github.com/WordPress/gutenberg/pull/17164.
.filter(innerBlock => !!innerBlock);
// Get the fully parsed block.
const parsedBlock = createBlock(normalizedBlock.blockName, getBlockAttributes(blockType, normalizedBlock.innerHTML, normalizedBlock.attrs), parsedInnerBlocks);
parsedBlock.originalContent = normalizedBlock.innerHTML;
const validatedBlock = applyBlockValidation(parsedBlock, blockType);
const {
validationIssues
} = validatedBlock;
// Run the block deprecation and migrations.
// This is performed on both invalid and valid blocks because
// migration using the `migrate` functions should run even
// if the output is deemed valid.
const updatedBlock = applyBlockDeprecatedVersions(validatedBlock, normalizedBlock, blockType);
if (!updatedBlock.isValid) {
// Preserve the original unprocessed version of the block
// that we received (no fixes, no deprecations) so that
// we can save it as close to exactly the same way as
// we loaded it. This is important to avoid corruption
// and data loss caused by block implementations trying
// to process data that isn't fully recognized.
updatedBlock.__unstableBlockSource = rawBlock;
}
if (!validatedBlock.isValid && updatedBlock.isValid && !options?.__unstableSkipMigrationLogs) {
/* eslint-disable no-console */
console.groupCollapsed('Updated Block: %s', blockType.name);
console.info('Block successfully updated for `%s` (%o).\n\nNew content generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s', blockType.name, blockType, getSaveContent(blockType, updatedBlock.attributes), updatedBlock.originalContent);
console.groupEnd();
/* eslint-enable no-console */
} else if (!validatedBlock.isValid && !updatedBlock.isValid) {
validationIssues.forEach(({
log,
args
}) => log(...args));
}
return updatedBlock;
}
/**
* Utilizes an optimized token-driven parser based on the Gutenberg grammar spec
* defined through a parsing expression grammar to take advantage of the regular
* cadence provided by block delimiters -- composed syntactically through HTML
* comments -- which, given a general HTML document as an input, returns a block
* list array representation.
*
* This is a recursive-descent parser that scans linearly once through the input
* document. Instead of directly recursing it utilizes a trampoline mechanism to
* prevent stack overflow. This initial pass is mainly interested in separating
* and isolating the blocks serialized in the document and manifestly not in the
* content within the blocks.
*
* @see
* https://developer.wordpress.org/block-editor/packages/packages-block-serialization-default-parser/
*
* @param {string} content The post content.
* @param {ParseOptions} options Extra options for handling block parsing.
*
* @return {Array} Block list.
*/
function parser_parse(content, options) {
return (0,external_wp_blockSerializationDefaultParser_namespaceObject.parse)(content).reduce((accumulator, rawBlock) => {
const block = parseRawBlock(rawBlock, options);
if (block) {
accumulator.push(block);
}
return accumulator;
}, []);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/get-raw-transforms.js
/**
* Internal dependencies
*/
function getRawTransforms() {
return getBlockTransforms('from').filter(({
type
}) => type === 'raw').map(transform => {
return transform.isMatch ? transform : {
...transform,
isMatch: node => transform.selector && node.matches(transform.selector)
};
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/html-to-blocks.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Converts HTML directly to blocks. Looks for a matching transform for each
* top-level tag. The HTML should be filtered to not have any text between
* top-level tags and formatted in a way that blocks can handle the HTML.
*
* @param {string} html HTML to convert.
* @param {Function} handler The handler calling htmlToBlocks: either rawHandler
* or pasteHandler.
*
* @return {Array} An array of blocks.
*/
function htmlToBlocks(html, handler) {
const doc = document.implementation.createHTMLDocument('');
doc.body.innerHTML = html;
return Array.from(doc.body.children).flatMap(node => {
const rawTransform = findTransform(getRawTransforms(), ({
isMatch
}) => isMatch(node));
if (!rawTransform) {
// Until the HTML block is supported in the native version, we'll parse it
// instead of creating the block to generate it as an unsupported block.
if (external_wp_element_namespaceObject.Platform.isNative) {
return parser_parse(`<!-- wp:html -->${node.outerHTML}<!-- /wp:html -->`);
}
return createBlock(
// Should not be hardcoded.
'core/html', getBlockAttributes('core/html', node.outerHTML));
}
const {
transform,
blockName
} = rawTransform;
if (transform) {
return transform(node, handler);
}
return createBlock(blockName, getBlockAttributes(blockName, node.outerHTML));
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/normalise-blocks.js
/**
* WordPress dependencies
*/
function normaliseBlocks(HTML) {
const decuDoc = document.implementation.createHTMLDocument('');
const accuDoc = document.implementation.createHTMLDocument('');
const decu = decuDoc.body;
const accu = accuDoc.body;
decu.innerHTML = HTML;
while (decu.firstChild) {
const node = decu.firstChild;
// Text nodes: wrap in a paragraph, or append to previous.
if (node.nodeType === node.TEXT_NODE) {
if ((0,external_wp_dom_namespaceObject.isEmpty)(node)) {
decu.removeChild(node);
} else {
if (!accu.lastChild || accu.lastChild.nodeName !== 'P') {
accu.appendChild(accuDoc.createElement('P'));
}
accu.lastChild.appendChild(node);
}
// Element nodes.
} else if (node.nodeType === node.ELEMENT_NODE) {
// BR nodes: create a new paragraph on double, or append to previous.
if (node.nodeName === 'BR') {
if (node.nextSibling && node.nextSibling.nodeName === 'BR') {
accu.appendChild(accuDoc.createElement('P'));
decu.removeChild(node.nextSibling);
}
// Don't append to an empty paragraph.
if (accu.lastChild && accu.lastChild.nodeName === 'P' && accu.lastChild.hasChildNodes()) {
accu.lastChild.appendChild(node);
} else {
decu.removeChild(node);
}
} else if (node.nodeName === 'P') {
// Only append non-empty paragraph nodes.
if ((0,external_wp_dom_namespaceObject.isEmpty)(node)) {
decu.removeChild(node);
} else {
accu.appendChild(node);
}
} else if ((0,external_wp_dom_namespaceObject.isPhrasingContent)(node)) {
if (!accu.lastChild || accu.lastChild.nodeName !== 'P') {
accu.appendChild(accuDoc.createElement('P'));
}
accu.lastChild.appendChild(node);
} else {
accu.appendChild(node);
}
} else {
decu.removeChild(node);
}
}
return accu.innerHTML;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/special-comment-converter.js
/**
* WordPress dependencies
*/
/**
* Looks for `<!--nextpage-->` and `<!--more-->` comments and
* replaces them with a custom element representing a future block.
*
* The custom element is a way to bypass the rest of the `raw-handling`
* transforms, which would eliminate other kinds of node with which to carry
* `<!--more-->`'s data: nodes with `data` attributes, empty paragraphs, etc.
*
* The custom element is then expected to be recognized by any registered
* block's `raw` transform.
*
* @param {Node} node The node to be processed.
* @param {Document} doc The document of the node.
* @return {void}
*/
function specialCommentConverter(node, doc) {
if (node.nodeType !== node.COMMENT_NODE) {
return;
}
if (node.nodeValue === 'nextpage') {
(0,external_wp_dom_namespaceObject.replace)(node, createNextpage(doc));
return;
}
if (node.nodeValue.indexOf('more') === 0) {
moreCommentConverter(node, doc);
}
}
/**
* Convert `<!--more-->` as well as the `<!--more Some text-->` variant
* and its `<!--noteaser-->` companion into the custom element
* described in `specialCommentConverter()`.
*
* @param {Node} node The node to be processed.
* @param {Document} doc The document of the node.
* @return {void}
*/
function moreCommentConverter(node, doc) {
// Grab any custom text in the comment.
const customText = node.nodeValue.slice(4).trim();
/*
* When a `<!--more-->` comment is found, we need to look for any
* `<!--noteaser-->` sibling, but it may not be a direct sibling
* (whitespace typically lies in between)
*/
let sibling = node;
let noTeaser = false;
while (sibling = sibling.nextSibling) {
if (sibling.nodeType === sibling.COMMENT_NODE && sibling.nodeValue === 'noteaser') {
noTeaser = true;
(0,external_wp_dom_namespaceObject.remove)(sibling);
break;
}
}
const moreBlock = createMore(customText, noTeaser, doc);
// If our `<!--more-->` comment is in the middle of a paragraph, we should
// split the paragraph in two and insert the more block in between. If not,
// the more block will eventually end up being inserted after the paragraph.
if (!node.parentNode || node.parentNode.nodeName !== 'P' || node.parentNode.childNodes.length === 1) {
(0,external_wp_dom_namespaceObject.replace)(node, moreBlock);
} else {
const childNodes = Array.from(node.parentNode.childNodes);
const nodeIndex = childNodes.indexOf(node);
const wrapperNode = node.parentNode.parentNode || doc.body;
const paragraphBuilder = (acc, child) => {
if (!acc) {
acc = doc.createElement('p');
}
acc.appendChild(child);
return acc;
};
// Split the original parent node and insert our more block
[childNodes.slice(0, nodeIndex).reduce(paragraphBuilder, null), moreBlock, childNodes.slice(nodeIndex + 1).reduce(paragraphBuilder, null)].forEach(element => element && wrapperNode.insertBefore(element, node.parentNode));
// Remove the old parent paragraph
(0,external_wp_dom_namespaceObject.remove)(node.parentNode);
}
}
function createMore(customText, noTeaser, doc) {
const node = doc.createElement('wp-block');
node.dataset.block = 'core/more';
if (customText) {
node.dataset.customText = customText;
}
if (noTeaser) {
// "Boolean" data attribute.
node.dataset.noTeaser = '';
}
return node;
}
function createNextpage(doc) {
const node = doc.createElement('wp-block');
node.dataset.block = 'core/nextpage';
return node;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/list-reducer.js
/**
* WordPress dependencies
*/
function isList(node) {
return node.nodeName === 'OL' || node.nodeName === 'UL';
}
function shallowTextContent(element) {
return Array.from(element.childNodes).map(({
nodeValue = ''
}) => nodeValue).join('');
}
function listReducer(node) {
if (!isList(node)) {
return;
}
const list = node;
const prevElement = node.previousElementSibling;
// Merge with previous list if:
// * There is a previous list of the same type.
// * There is only one list item.
if (prevElement && prevElement.nodeName === node.nodeName && list.children.length === 1) {
// Move all child nodes, including any text nodes, if any.
while (list.firstChild) {
prevElement.appendChild(list.firstChild);
}
list.parentNode.removeChild(list);
}
const parentElement = node.parentNode;
// Nested list with empty parent item.
if (parentElement && parentElement.nodeName === 'LI' && parentElement.children.length === 1 && !/\S/.test(shallowTextContent(parentElement))) {
const parentListItem = parentElement;
const prevListItem = parentListItem.previousElementSibling;
const parentList = parentListItem.parentNode;
if (prevListItem) {
prevListItem.appendChild(list);
parentList.removeChild(parentListItem);
} else {
parentList.parentNode.insertBefore(list, parentList);
parentList.parentNode.removeChild(parentList);
}
}
// Invalid: OL/UL > OL/UL.
if (parentElement && isList(parentElement)) {
const prevListItem = node.previousElementSibling;
if (prevListItem) {
prevListItem.appendChild(node);
} else {
(0,external_wp_dom_namespaceObject.unwrap)(node);
}
}
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/blockquote-normaliser.js
/**
* Internal dependencies
*/
function blockquoteNormaliser(node) {
if (node.nodeName !== 'BLOCKQUOTE') {
return;
}
node.innerHTML = normaliseBlocks(node.innerHTML);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/figure-content-reducer.js
/**
* WordPress dependencies
*/
/**
* Whether or not the given node is figure content.
*
* @param {Node} node The node to check.
* @param {Object} schema The schema to use.
*
* @return {boolean} True if figure content, false if not.
*/
function isFigureContent(node, schema) {
var _schema$figure$childr;
const tag = node.nodeName.toLowerCase();
// We are looking for tags that can be a child of the figure tag, excluding
// `figcaption` and any phrasing content.
if (tag === 'figcaption' || (0,external_wp_dom_namespaceObject.isTextContent)(node)) {
return false;
}
return tag in ((_schema$figure$childr = schema?.figure?.children) !== null && _schema$figure$childr !== void 0 ? _schema$figure$childr : {});
}
/**
* Whether or not the given node can have an anchor.
*
* @param {Node} node The node to check.
* @param {Object} schema The schema to use.
*
* @return {boolean} True if it can, false if not.
*/
function canHaveAnchor(node, schema) {
var _schema$figure$childr2;
const tag = node.nodeName.toLowerCase();
return tag in ((_schema$figure$childr2 = schema?.figure?.children?.a?.children) !== null && _schema$figure$childr2 !== void 0 ? _schema$figure$childr2 : {});
}
/**
* Wraps the given element in a figure element.
*
* @param {Element} element The element to wrap.
* @param {Element} beforeElement The element before which to place the figure.
*/
function wrapFigureContent(element, beforeElement = element) {
const figure = element.ownerDocument.createElement('figure');
beforeElement.parentNode.insertBefore(figure, beforeElement);
figure.appendChild(element);
}
/**
* This filter takes figure content out of paragraphs, wraps it in a figure
* element, and moves any anchors with it if needed.
*
* @param {Node} node The node to filter.
* @param {Document} doc The document of the node.
* @param {Object} schema The schema to use.
*
* @return {void}
*/
function figureContentReducer(node, doc, schema) {
if (!isFigureContent(node, schema)) {
return;
}
let nodeToInsert = node;
const parentNode = node.parentNode;
// If the figure content can have an anchor and its parent is an anchor with
// only the figure content, take the anchor out instead of just the content.
if (canHaveAnchor(node, schema) && parentNode.nodeName === 'A' && parentNode.childNodes.length === 1) {
nodeToInsert = node.parentNode;
}
const wrapper = nodeToInsert.closest('p,div');
// If wrapped in a paragraph or div, only extract if it's aligned or if
// there is no text content.
// Otherwise, if directly at the root, wrap in a figure element.
if (wrapper) {
// In jsdom-jscore, 'node.classList' can be undefined.
// In this case, default to extract as it offers a better UI experience on mobile.
if (!node.classList) {
wrapFigureContent(nodeToInsert, wrapper);
} else if (node.classList.contains('alignright') || node.classList.contains('alignleft') || node.classList.contains('aligncenter') || !wrapper.textContent.trim()) {
wrapFigureContent(nodeToInsert, wrapper);
}
} else if (nodeToInsert.parentNode.nodeName === 'BODY') {
wrapFigureContent(nodeToInsert);
}
}
;// CONCATENATED MODULE: external ["wp","shortcode"]
const external_wp_shortcode_namespaceObject = window["wp"]["shortcode"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/shortcode-converter.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const castArray = maybeArray => Array.isArray(maybeArray) ? maybeArray : [maybeArray];
function segmentHTMLToShortcodeBlock(HTML, lastIndex = 0, excludedBlockNames = []) {
// Get all matches.
const transformsFrom = getBlockTransforms('from');
const transformation = findTransform(transformsFrom, transform => excludedBlockNames.indexOf(transform.blockName) === -1 && transform.type === 'shortcode' && castArray(transform.tag).some(tag => (0,external_wp_shortcode_namespaceObject.regexp)(tag).test(HTML)));
if (!transformation) {
return [HTML];
}
const transformTags = castArray(transformation.tag);
const transformTag = transformTags.find(tag => (0,external_wp_shortcode_namespaceObject.regexp)(tag).test(HTML));
let match;
const previousIndex = lastIndex;
if (match = (0,external_wp_shortcode_namespaceObject.next)(transformTag, HTML, lastIndex)) {
lastIndex = match.index + match.content.length;
const beforeHTML = HTML.substr(0, match.index);
const afterHTML = HTML.substr(lastIndex);
// If the shortcode content does not contain HTML and the shortcode is
// not on a new line (or in paragraph from Markdown converter),
// consider the shortcode as inline text, and thus skip conversion for
// this segment.
if (!match.shortcode.content?.includes('<') && !(/(\n|<p>)\s*$/.test(beforeHTML) && /^\s*(\n|<\/p>)/.test(afterHTML))) {
return segmentHTMLToShortcodeBlock(HTML, lastIndex);
}
// If a transformation's `isMatch` predicate fails for the inbound
// shortcode, try again by excluding the current block type.
//
// This is the only call to `segmentHTMLToShortcodeBlock` that should
// ever carry over `excludedBlockNames`. Other calls in the module
// should skip that argument as a way to reset the exclusion state, so
// that one `isMatch` fail in an HTML fragment doesn't prevent any
// valid matches in subsequent fragments.
if (transformation.isMatch && !transformation.isMatch(match.shortcode.attrs)) {
return segmentHTMLToShortcodeBlock(HTML, previousIndex, [...excludedBlockNames, transformation.blockName]);
}
let blocks = [];
if (typeof transformation.transform === 'function') {
// Passing all of `match` as second argument is intentionally broad
// but shouldn't be too relied upon.
//
// See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926
blocks = [].concat(transformation.transform(match.shortcode.attrs, match));
// Applying the built-in fixes can enhance the attributes with missing content like "className".
blocks = blocks.map(block => {
block.originalContent = match.shortcode.content;
return applyBuiltInValidationFixes(block, getBlockType(block.name));
});
} else {
const attributes = Object.fromEntries(Object.entries(transformation.attributes).filter(([, schema]) => schema.shortcode)
// Passing all of `match` as second argument is intentionally broad
// but shouldn't be too relied upon.
//
// See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926
.map(([key, schema]) => [key, schema.shortcode(match.shortcode.attrs, match)]));
const blockType = getBlockType(transformation.blockName);
if (!blockType) {
return [HTML];
}
const transformationBlockType = {
...blockType,
attributes: transformation.attributes
};
let block = createBlock(transformation.blockName, getBlockAttributes(transformationBlockType, match.shortcode.content, attributes));
// Applying the built-in fixes can enhance the attributes with missing content like "className".
block.originalContent = match.shortcode.content;
block = applyBuiltInValidationFixes(block, transformationBlockType);
blocks = [block];
}
return [...segmentHTMLToShortcodeBlock(beforeHTML), ...blocks, ...segmentHTMLToShortcodeBlock(afterHTML)];
}
return [HTML];
}
/* harmony default export */ const shortcode_converter = (segmentHTMLToShortcodeBlock);
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function getBlockContentSchemaFromTransforms(transforms, context) {
const phrasingContentSchema = (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)(context);
const schemaArgs = {
phrasingContentSchema,
isPaste: context === 'paste'
};
const schemas = transforms.map(({
isMatch,
blockName,
schema
}) => {
const hasAnchorSupport = hasBlockSupport(blockName, 'anchor');
schema = typeof schema === 'function' ? schema(schemaArgs) : schema;
// If the block does not has anchor support and the transform does not
// provides an isMatch we can return the schema right away.
if (!hasAnchorSupport && !isMatch) {
return schema;
}
if (!schema) {
return {};
}
return Object.fromEntries(Object.entries(schema).map(([key, value]) => {
let attributes = value.attributes || [];
// If the block supports the "anchor" functionality, it needs to keep its ID attribute.
if (hasAnchorSupport) {
attributes = [...attributes, 'id'];
}
return [key, {
...value,
attributes,
isMatch: isMatch ? isMatch : undefined
}];
}));
});
function mergeTagNameSchemaProperties(objValue, srcValue, key) {
switch (key) {
case 'children':
{
if (objValue === '*' || srcValue === '*') {
return '*';
}
return {
...objValue,
...srcValue
};
}
case 'attributes':
case 'require':
{
return [...(objValue || []), ...(srcValue || [])];
}
case 'isMatch':
{
// If one of the values being merge is undefined (matches everything),
// the result of the merge will be undefined.
if (!objValue || !srcValue) {
return undefined;
}
// When merging two isMatch functions, the result is a new function
// that returns if one of the source functions returns true.
return (...args) => {
return objValue(...args) || srcValue(...args);
};
}
}
}
// A tagName schema is an object with children, attributes, require, and
// isMatch properties.
function mergeTagNameSchemas(a, b) {
for (const key in b) {
a[key] = a[key] ? mergeTagNameSchemaProperties(a[key], b[key], key) : {
...b[key]
};
}
return a;
}
// A schema is an object with tagName schemas by tag name.
function mergeSchemas(a, b) {
for (const key in b) {
a[key] = a[key] ? mergeTagNameSchemas(a[key], b[key]) : {
...b[key]
};
}
return a;
}
return schemas.reduce(mergeSchemas, {});
}
/**
* Gets the block content schema, which is extracted and merged from all
* registered blocks with raw transfroms.
*
* @param {string} context Set to "paste" when in paste context, where the
* schema is more strict.
*
* @return {Object} A complete block content schema.
*/
function getBlockContentSchema(context) {
return getBlockContentSchemaFromTransforms(getRawTransforms(), context);
}
/**
* Checks whether HTML can be considered plain text. That is, it does not contain
* any elements that are not line breaks.
*
* @param {string} HTML The HTML to check.
*
* @return {boolean} Whether the HTML can be considered plain text.
*/
function isPlain(HTML) {
return !/<(?!br[ />])/i.test(HTML);
}
/**
* Given node filters, deeply filters and mutates a NodeList.
*
* @param {NodeList} nodeList The nodeList to filter.
* @param {Array} filters An array of functions that can mutate with the provided node.
* @param {Document} doc The document of the nodeList.
* @param {Object} schema The schema to use.
*/
function deepFilterNodeList(nodeList, filters, doc, schema) {
Array.from(nodeList).forEach(node => {
deepFilterNodeList(node.childNodes, filters, doc, schema);
filters.forEach(item => {
// Make sure the node is still attached to the document.
if (!doc.contains(node)) {
return;
}
item(node, doc, schema);
});
});
}
/**
* Given node filters, deeply filters HTML tags.
* Filters from the deepest nodes to the top.
*
* @param {string} HTML The HTML to filter.
* @param {Array} filters An array of functions that can mutate with the provided node.
* @param {Object} schema The schema to use.
*
* @return {string} The filtered HTML.
*/
function deepFilterHTML(HTML, filters = [], schema) {
const doc = document.implementation.createHTMLDocument('');
doc.body.innerHTML = HTML;
deepFilterNodeList(doc.body.childNodes, filters, doc, schema);
return doc.body.innerHTML;
}
/**
* Gets a sibling within text-level context.
*
* @param {Element} node The subject node.
* @param {string} which "next" or "previous".
*/
function getSibling(node, which) {
const sibling = node[`${which}Sibling`];
if (sibling && (0,external_wp_dom_namespaceObject.isPhrasingContent)(sibling)) {
return sibling;
}
const {
parentNode
} = node;
if (!parentNode || !(0,external_wp_dom_namespaceObject.isPhrasingContent)(parentNode)) {
return;
}
return getSibling(parentNode, which);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function deprecatedGetPhrasingContentSchema(context) {
external_wp_deprecated_default()('wp.blocks.getPhrasingContentSchema', {
since: '5.6',
alternative: 'wp.dom.getPhrasingContentSchema'
});
return (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)(context);
}
/**
* Converts an HTML string to known blocks.
*
* @param {Object} $1
* @param {string} $1.HTML The HTML to convert.
*
* @return {Array} A list of blocks.
*/
function rawHandler({
HTML = ''
}) {
// If we detect block delimiters, parse entirely as blocks.
if (HTML.indexOf('<!-- wp:') !== -1) {
return parser_parse(HTML);
}
// An array of HTML strings and block objects. The blocks replace matched
// shortcodes.
const pieces = shortcode_converter(HTML);
const blockContentSchema = getBlockContentSchema();
return pieces.map(piece => {
// Already a block from shortcode.
if (typeof piece !== 'string') {
return piece;
}
// These filters are essential for some blocks to be able to transform
// from raw HTML. These filters move around some content or add
// additional tags, they do not remove any content.
const filters = [
// Needed to adjust invalid lists.
listReducer,
// Needed to create more and nextpage blocks.
specialCommentConverter,
// Needed to create media blocks.
figureContentReducer,
// Needed to create the quote block, which cannot handle text
// without wrapper paragraphs.
blockquoteNormaliser];
piece = deepFilterHTML(piece, filters, blockContentSchema);
piece = normaliseBlocks(piece);
return htmlToBlocks(piece, rawHandler);
}).flat().filter(Boolean);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/comment-remover.js
/**
* WordPress dependencies
*/
/**
* Looks for comments, and removes them.
*
* @param {Node} node The node to be processed.
* @return {void}
*/
function commentRemover(node) {
if (node.nodeType === node.COMMENT_NODE) {
(0,external_wp_dom_namespaceObject.remove)(node);
}
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/is-inline-content.js
/**
* WordPress dependencies
*/
/**
* Checks if the given node should be considered inline content, optionally
* depending on a context tag.
*
* @param {Node} node Node name.
* @param {string} contextTag Tag name.
*
* @return {boolean} True if the node is inline content, false if nohe.
*/
function isInline(node, contextTag) {
if ((0,external_wp_dom_namespaceObject.isTextContent)(node)) {
return true;
}
if (!contextTag) {
return false;
}
const tag = node.nodeName.toLowerCase();
const inlineAllowedTagGroups = [['ul', 'li', 'ol'], ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']];
return inlineAllowedTagGroups.some(tagGroup => [tag, contextTag].filter(t => !tagGroup.includes(t)).length === 0);
}
function deepCheck(nodes, contextTag) {
return nodes.every(node => isInline(node, contextTag) && deepCheck(Array.from(node.children), contextTag));
}
function isDoubleBR(node) {
return node.nodeName === 'BR' && node.previousSibling && node.previousSibling.nodeName === 'BR';
}
function isInlineContent(HTML, contextTag) {
const doc = document.implementation.createHTMLDocument('');
doc.body.innerHTML = HTML;
const nodes = Array.from(doc.body.children);
return !nodes.some(isDoubleBR) && deepCheck(nodes, contextTag);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/phrasing-content-reducer.js
/**
* WordPress dependencies
*/
function phrasingContentReducer(node, doc) {
// In jsdom-jscore, 'node.style' can be null.
// TODO: Explore fixing this by patching jsdom-jscore.
if (node.nodeName === 'SPAN' && node.style) {
const {
fontWeight,
fontStyle,
textDecorationLine,
textDecoration,
verticalAlign
} = node.style;
if (fontWeight === 'bold' || fontWeight === '700') {
(0,external_wp_dom_namespaceObject.wrap)(doc.createElement('strong'), node);
}
if (fontStyle === 'italic') {
(0,external_wp_dom_namespaceObject.wrap)(doc.createElement('em'), node);
}
// Some DOM implementations (Safari, JSDom) don't support
// style.textDecorationLine, so we check style.textDecoration as a
// fallback.
if (textDecorationLine === 'line-through' || textDecoration.includes('line-through')) {
(0,external_wp_dom_namespaceObject.wrap)(doc.createElement('s'), node);
}
if (verticalAlign === 'super') {
(0,external_wp_dom_namespaceObject.wrap)(doc.createElement('sup'), node);
} else if (verticalAlign === 'sub') {
(0,external_wp_dom_namespaceObject.wrap)(doc.createElement('sub'), node);
}
} else if (node.nodeName === 'B') {
node = (0,external_wp_dom_namespaceObject.replaceTag)(node, 'strong');
} else if (node.nodeName === 'I') {
node = (0,external_wp_dom_namespaceObject.replaceTag)(node, 'em');
} else if (node.nodeName === 'A') {
// In jsdom-jscore, 'node.target' can be null.
// TODO: Explore fixing this by patching jsdom-jscore.
if (node.target && node.target.toLowerCase() === '_blank') {
node.rel = 'noreferrer noopener';
} else {
node.removeAttribute('target');
node.removeAttribute('rel');
}
// Saves anchor elements name attribute as id
if (node.name && !node.id) {
node.id = node.name;
}
// Keeps id only if there is an internal link pointing to it
if (node.id && !node.ownerDocument.querySelector(`[href="#${node.id}"]`)) {
node.removeAttribute('id');
}
}
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/head-remover.js
function headRemover(node) {
if (node.nodeName !== 'SCRIPT' && node.nodeName !== 'NOSCRIPT' && node.nodeName !== 'TEMPLATE' && node.nodeName !== 'STYLE') {
return;
}
node.parentNode.removeChild(node);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/ms-list-ignore.js
/**
* Looks for comments, and removes them.
*
* @param {Node} node The node to be processed.
* @return {void}
*/
function msListIgnore(node) {
if (node.nodeType !== node.ELEMENT_NODE) {
return;
}
const style = node.getAttribute('style');
if (!style || !style.includes('mso-list')) {
return;
}
const rules = style.split(';').reduce((acc, rule) => {
const [key, value] = rule.split(':');
acc[key.trim().toLowerCase()] = value.trim().toLowerCase();
return acc;
}, {});
if (rules['mso-list'] === 'ignore') {
node.remove();
}
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/ms-list-converter.js
/**
* Internal dependencies
*/
function ms_list_converter_isList(node) {
return node.nodeName === 'OL' || node.nodeName === 'UL';
}
function msListConverter(node, doc) {
if (node.nodeName !== 'P') {
return;
}
const style = node.getAttribute('style');
if (!style || !style.includes('mso-list')) {
return;
}
const prevNode = node.previousElementSibling;
// Add new list if no previous.
if (!prevNode || !ms_list_converter_isList(prevNode)) {
// See https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-type.
const type = node.textContent.trim().slice(0, 1);
const isNumeric = /[1iIaA]/.test(type);
const newListNode = doc.createElement(isNumeric ? 'ol' : 'ul');
if (isNumeric) {
newListNode.setAttribute('type', type);
}
node.parentNode.insertBefore(newListNode, node);
}
const listNode = node.previousElementSibling;
const listType = listNode.nodeName;
const listItem = doc.createElement('li');
let receivingNode = listNode;
// Add content.
listItem.innerHTML = deepFilterHTML(node.innerHTML, [msListIgnore]);
const matches = /mso-list\s*:[^;]+level([0-9]+)/i.exec(style);
let level = matches ? parseInt(matches[1], 10) - 1 || 0 : 0;
// Change pointer depending on indentation level.
while (level--) {
receivingNode = receivingNode.lastChild || receivingNode;
// If it's a list, move pointer to the last item.
if (ms_list_converter_isList(receivingNode)) {
receivingNode = receivingNode.lastChild || receivingNode;
}
}
// Make sure we append to a list.
if (!ms_list_converter_isList(receivingNode)) {
receivingNode = receivingNode.appendChild(doc.createElement(listType));
}
// Append the list item to the list.
receivingNode.appendChild(listItem);
// Remove the wrapper paragraph.
node.parentNode.removeChild(node);
}
;// CONCATENATED MODULE: external ["wp","blob"]
const external_wp_blob_namespaceObject = window["wp"]["blob"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/image-corrector.js
/**
* WordPress dependencies
*/
function imageCorrector(node) {
if (node.nodeName !== 'IMG') {
return;
}
if (node.src.indexOf('file:') === 0) {
node.src = '';
}
// This piece cannot be tested outside a browser env.
if (node.src.indexOf('data:') === 0) {
const [properties, data] = node.src.split(',');
const [type] = properties.slice(5).split(';');
if (!data || !type) {
node.src = '';
return;
}
let decoded;
// Can throw DOMException!
try {
decoded = atob(data);
} catch (e) {
node.src = '';
return;
}
const uint8Array = new Uint8Array(decoded.length);
for (let i = 0; i < uint8Array.length; i++) {
uint8Array[i] = decoded.charCodeAt(i);
}
const name = type.replace('/', '.');
const file = new window.File([uint8Array], name, {
type
});
node.src = (0,external_wp_blob_namespaceObject.createBlobURL)(file);
}
// Remove trackers and hardly visible images.
if (node.height === 1 || node.width === 1) {
node.parentNode.removeChild(node);
}
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/div-normaliser.js
/**
* Internal dependencies
*/
function divNormaliser(node) {
if (node.nodeName !== 'DIV') {
return;
}
node.innerHTML = normaliseBlocks(node.innerHTML);
}
// EXTERNAL MODULE: ./node_modules/showdown/dist/showdown.js
var showdown = __webpack_require__(1030);
var showdown_default = /*#__PURE__*/__webpack_require__.n(showdown);
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/markdown-converter.js
/**
* External dependencies
*/
// Reuse the same showdown converter.
const converter = new (showdown_default()).Converter({
noHeaderId: true,
tables: true,
literalMidWordUnderscores: true,
omitExtraWLInCodeBlocks: true,
simpleLineBreaks: true,
strikethrough: true
});
/**
* Corrects the Slack Markdown variant of the code block.
* If uncorrected, it will be converted to inline code.
*
* @see https://get.slack.help/hc/en-us/articles/202288908-how-can-i-add-formatting-to-my-messages-#code-blocks
*
* @param {string} text The potential Markdown text to correct.
*
* @return {string} The corrected Markdown.
*/
function slackMarkdownVariantCorrector(text) {
return text.replace(/((?:^|\n)```)([^\n`]+)(```(?:$|\n))/, (match, p1, p2, p3) => `${p1}\n${p2}\n${p3}`);
}
function bulletsToAsterisks(text) {
return text.replace(/(^|\n)•( +)/g, '$1*$2');
}
/**
* Converts a piece of text into HTML based on any Markdown present.
* Also decodes any encoded HTML.
*
* @param {string} text The plain text to convert.
*
* @return {string} HTML.
*/
function markdownConverter(text) {
return converter.makeHtml(slackMarkdownVariantCorrector(bulletsToAsterisks(text)));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/iframe-remover.js
/**
* Removes iframes.
*
* @param {Node} node The node to check.
*
* @return {void}
*/
function iframeRemover(node) {
if (node.nodeName === 'IFRAME') {
const text = node.ownerDocument.createTextNode(node.src);
node.parentNode.replaceChild(text, node);
}
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/google-docs-uid-remover.js
/**
* WordPress dependencies
*/
function googleDocsUIdRemover(node) {
if (!node.id || node.id.indexOf('docs-internal-guid-') !== 0) {
return;
}
// Google Docs sometimes wraps the content in a B tag. We don't want to keep
// this.
if (node.tagName === 'B') {
(0,external_wp_dom_namespaceObject.unwrap)(node);
} else {
node.removeAttribute('id');
}
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/html-formatting-remover.js
/**
* Internal dependencies
*/
function isFormattingSpace(character) {
return character === ' ' || character === '\r' || character === '\n' || character === '\t';
}
/**
* Removes spacing that formats HTML.
*
* @see https://www.w3.org/TR/css-text-3/#white-space-processing
*
* @param {Node} node The node to be processed.
* @return {void}
*/
function htmlFormattingRemover(node) {
if (node.nodeType !== node.TEXT_NODE) {
return;
}
// Ignore pre content. Note that this does not use Element#closest due to
// a combination of (a) node may not be Element and (b) node.parentElement
// does not have full support in all browsers (Internet Exporer).
//
// See: https://developer.mozilla.org/en-US/docs/Web/API/Node/parentElement#Browser_compatibility
/** @type {Node?} */
let parent = node;
while (parent = parent.parentNode) {
if (parent.nodeType === parent.ELEMENT_NODE && parent.nodeName === 'PRE') {
return;
}
}
// First, replace any sequence of HTML formatting space with a single space.
let newData = node.data.replace(/[ \r\n\t]+/g, ' ');
// Remove the leading space if the text element is at the start of a block,
// is preceded by a line break element, or has a space in the previous
// node.
if (newData[0] === ' ') {
const previousSibling = getSibling(node, 'previous');
if (!previousSibling || previousSibling.nodeName === 'BR' || previousSibling.textContent.slice(-1) === ' ') {
newData = newData.slice(1);
}
}
// Remove the trailing space if the text element is at the end of a block,
// is succeded by a line break element, or has a space in the next text
// node.
if (newData[newData.length - 1] === ' ') {
const nextSibling = getSibling(node, 'next');
if (!nextSibling || nextSibling.nodeName === 'BR' || nextSibling.nodeType === nextSibling.TEXT_NODE && isFormattingSpace(nextSibling.textContent[0])) {
newData = newData.slice(0, -1);
}
}
// If there's no data left, remove the node, so `previousSibling` stays
// accurate. Otherwise, update the node data.
if (!newData) {
node.parentNode.removeChild(node);
} else {
node.data = newData;
}
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/br-remover.js
/**
* Internal dependencies
*/
/**
* Removes trailing br elements from text-level content.
*
* @param {Element} node Node to check.
*/
function brRemover(node) {
if (node.nodeName !== 'BR') {
return;
}
if (getSibling(node, 'next')) {
return;
}
node.parentNode.removeChild(node);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/empty-paragraph-remover.js
/**
* Removes empty paragraph elements.
*
* @param {Element} node Node to check.
*/
function emptyParagraphRemover(node) {
if (node.nodeName !== 'P') {
return;
}
if (node.hasChildNodes()) {
return;
}
node.parentNode.removeChild(node);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/slack-paragraph-corrector.js
/**
* Replaces Slack paragraph markup with a double line break (later converted to
* a proper paragraph).
*
* @param {Element} node Node to check.
*/
function slackParagraphCorrector(node) {
if (node.nodeName !== 'SPAN') {
return;
}
if (node.getAttribute('data-stringify-type') !== 'paragraph-break') {
return;
}
const {
parentNode
} = node;
parentNode.insertBefore(node.ownerDocument.createElement('br'), node);
parentNode.insertBefore(node.ownerDocument.createElement('br'), node);
parentNode.removeChild(node);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/raw-handling/paste-handler.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const log = (...args) => window?.console?.log?.(...args);
/**
* Filters HTML to only contain phrasing content.
*
* @param {string} HTML The HTML to filter.
*
* @return {string} HTML only containing phrasing content.
*/
function filterInlineHTML(HTML) {
HTML = deepFilterHTML(HTML, [headRemover, googleDocsUIdRemover, msListIgnore, phrasingContentReducer, commentRemover]);
HTML = (0,external_wp_dom_namespaceObject.removeInvalidHTML)(HTML, (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)('paste'), {
inline: true
});
HTML = deepFilterHTML(HTML, [htmlFormattingRemover, brRemover]);
// Allows us to ask for this information when we get a report.
log('Processed inline HTML:\n\n', HTML);
return HTML;
}
/**
* Converts an HTML string to known blocks. Strips everything else.
*
* @param {Object} options
* @param {string} [options.HTML] The HTML to convert.
* @param {string} [options.plainText] Plain text version.
* @param {string} [options.mode] Handle content as blocks or inline content.
* * 'AUTO': Decide based on the content passed.
* * 'INLINE': Always handle as inline content, and return string.
* * 'BLOCKS': Always handle as blocks, and return array of blocks.
* @param {Array} [options.tagName] The tag into which content will be inserted.
*
* @return {Array|string} A list of blocks or a string, depending on `handlerMode`.
*/
function pasteHandler({
HTML = '',
plainText = '',
mode = 'AUTO',
tagName
}) {
// First of all, strip any meta tags.
HTML = HTML.replace(/<meta[^>]+>/g, '');
// Strip Windows markers.
HTML = HTML.replace(/^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i, '');
HTML = HTML.replace(/(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i, '');
// If we detect block delimiters in HTML, parse entirely as blocks.
if (mode !== 'INLINE') {
// Check plain text if there is no HTML.
const content = HTML ? HTML : plainText;
if (content.indexOf('<!-- wp:') !== -1) {
return parser_parse(content);
}
}
// Normalize unicode to use composed characters.
// This is unsupported in IE 11 but it's a nice-to-have feature, not mandatory.
// Not normalizing the content will only affect older browsers and won't
// entirely break the app.
// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
// See: https://core.trac.wordpress.org/ticket/30130
// See: https://github.com/WordPress/gutenberg/pull/6983#pullrequestreview-125151075
if (String.prototype.normalize) {
HTML = HTML.normalize();
}
// Must be run before checking if it's inline content.
HTML = deepFilterHTML(HTML, [slackParagraphCorrector]);
// Consider plain text if:
// * There is a plain text version.
// * There is no HTML version, or it has no formatting.
const isPlainText = plainText && (!HTML || isPlain(HTML));
// Parse Markdown (and encoded HTML) if it's considered plain text.
if (isPlainText) {
HTML = plainText;
// The markdown converter (Showdown) trims whitespace.
if (!/^\s+$/.test(plainText)) {
HTML = markdownConverter(HTML);
}
}
// An array of HTML strings and block objects. The blocks replace matched
// shortcodes.
const pieces = shortcode_converter(HTML);
// The call to shortcodeConverter will always return more than one element
// if shortcodes are matched. The reason is when shortcodes are matched
// empty HTML strings are included.
const hasShortcodes = pieces.length > 1;
if (isPlainText && !hasShortcodes) {
// Switch to inline mode if:
// * The current mode is AUTO.
// * The original plain text had no line breaks.
// * The original plain text was not an HTML paragraph.
// * The converted text is just a paragraph.
if (mode === 'AUTO' && plainText.indexOf('\n') === -1 && plainText.indexOf('<p>') !== 0 && HTML.indexOf('<p>') === 0) {
mode = 'INLINE';
}
}
if (mode === 'INLINE') {
return filterInlineHTML(HTML);
}
if (mode === 'AUTO' && !hasShortcodes && isInlineContent(HTML, tagName)) {
return filterInlineHTML(HTML);
}
const phrasingContentSchema = (0,external_wp_dom_namespaceObject.getPhrasingContentSchema)('paste');
const blockContentSchema = getBlockContentSchema('paste');
const blocks = pieces.map(piece => {
// Already a block from shortcode.
if (typeof piece !== 'string') {
return piece;
}
const filters = [googleDocsUIdRemover, msListConverter, headRemover, listReducer, imageCorrector, phrasingContentReducer, specialCommentConverter, commentRemover, iframeRemover, figureContentReducer, blockquoteNormaliser, divNormaliser];
const schema = {
...blockContentSchema,
// Keep top-level phrasing content, normalised by `normaliseBlocks`.
...phrasingContentSchema
};
piece = deepFilterHTML(piece, filters, blockContentSchema);
piece = (0,external_wp_dom_namespaceObject.removeInvalidHTML)(piece, schema);
piece = normaliseBlocks(piece);
piece = deepFilterHTML(piece, [htmlFormattingRemover, brRemover, emptyParagraphRemover], blockContentSchema);
// Allows us to ask for this information when we get a report.
log('Processed HTML piece:\n\n', piece);
return htmlToBlocks(piece, pasteHandler);
}).flat().filter(Boolean);
// If we're allowed to return inline content, and there is only one
// inlineable block, and the original plain text content does not have any
// line breaks, then treat it as inline paste.
if (mode === 'AUTO' && blocks.length === 1 && hasBlockSupport(blocks[0].name, '__unstablePasteTextInline', false)) {
const trimRegex = /^[\n]+|[\n]+$/g;
// Don't catch line breaks at the start or end.
const trimmedPlainText = plainText.replace(trimRegex, '');
if (trimmedPlainText !== '' && trimmedPlainText.indexOf('\n') === -1) {
return (0,external_wp_dom_namespaceObject.removeInvalidHTML)(getBlockInnerHTML(blocks[0]), phrasingContentSchema).replace(trimRegex, '');
}
}
return blocks;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/categories.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('../store/reducer').WPBlockCategory} WPBlockCategory */
/**
* Returns all the block categories.
* Ignored from documentation as the recommended usage is via useSelect from @wordpress/data.
*
* @ignore
*
* @return {WPBlockCategory[]} Block categories.
*/
function categories_getCategories() {
return (0,external_wp_data_namespaceObject.select)(store).getCategories();
}
/**
* Sets the block categories.
*
* @param {WPBlockCategory[]} categories Block categories.
*
* @example
* ```js
* import { __ } from '@wordpress/i18n';
* import { store as blocksStore, setCategories } from '@wordpress/blocks';
* import { useSelect } from '@wordpress/data';
* import { Button } from '@wordpress/components';
*
* const ExampleComponent = () => {
* // Retrieve the list of current categories.
* const blockCategories = useSelect(
* ( select ) => select( blocksStore ).getCategories(),
* []
* );
*
* return (
* <Button
* onClick={ () => {
* // Add a custom category to the existing list.
* setCategories( [
* ...blockCategories,
* { title: 'Custom Category', slug: 'custom-category' },
* ] );
* } }
* >
* { __( 'Add a new custom block category' ) }
* </Button>
* );
* };
* ```
*/
function categories_setCategories(categories) {
(0,external_wp_data_namespaceObject.dispatch)(store).setCategories(categories);
}
/**
* Updates a category.
*
* @param {string} slug Block category slug.
* @param {WPBlockCategory} category Object containing the category properties
* that should be updated.
*
* @example
* ```js
* import { __ } from '@wordpress/i18n';
* import { updateCategory } from '@wordpress/blocks';
* import { Button } from '@wordpress/components';
*
* const ExampleComponent = () => {
* return (
* <Button
* onClick={ () => {
* updateCategory( 'text', { title: __( 'Written Word' ) } );
* } }
* >
* { __( 'Update Text category title' ) }
* </Button>
* ) ;
* };
* ```
*/
function categories_updateCategory(slug, category) {
(0,external_wp_data_namespaceObject.dispatch)(store).updateCategory(slug, category);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/templates.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Checks whether a list of blocks matches a template by comparing the block names.
*
* @param {Array} blocks Block list.
* @param {Array} template Block template.
*
* @return {boolean} Whether the list of blocks matches a templates.
*/
function doBlocksMatchTemplate(blocks = [], template = []) {
return blocks.length === template.length && template.every(([name,, innerBlocksTemplate], index) => {
const block = blocks[index];
return name === block.name && doBlocksMatchTemplate(block.innerBlocks, innerBlocksTemplate);
});
}
/**
* Synchronize a block list with a block template.
*
* Synchronizing a block list with a block template means that we loop over the blocks
* keep the block as is if it matches the block at the same position in the template
* (If it has the same name) and if doesn't match, we create a new block based on the template.
* Extra blocks not present in the template are removed.
*
* @param {Array} blocks Block list.
* @param {Array} template Block template.
*
* @return {Array} Updated Block list.
*/
function synchronizeBlocksWithTemplate(blocks = [], template) {
// If no template is provided, return blocks unmodified.
if (!template) {
return blocks;
}
return template.map(([name, attributes, innerBlocksTemplate], index) => {
var _blockType$attributes;
const block = blocks[index];
if (block && block.name === name) {
const innerBlocks = synchronizeBlocksWithTemplate(block.innerBlocks, innerBlocksTemplate);
return {
...block,
innerBlocks
};
}
// To support old templates that were using the "children" format
// for the attributes using "html" strings now, we normalize the template attributes
// before creating the blocks.
const blockType = getBlockType(name);
const isHTMLAttribute = attributeDefinition => attributeDefinition?.source === 'html';
const isQueryAttribute = attributeDefinition => attributeDefinition?.source === 'query';
const normalizeAttributes = (schema, values) => {
if (!values) {
return {};
}
return Object.fromEntries(Object.entries(values).map(([key, value]) => [key, normalizeAttribute(schema[key], value)]));
};
const normalizeAttribute = (definition, value) => {
if (isHTMLAttribute(definition) && Array.isArray(value)) {
// Introduce a deprecated call at this point
// When we're confident that "children" format should be removed from the templates.
return (0,external_wp_element_namespaceObject.renderToString)(value);
}
if (isQueryAttribute(definition) && value) {
return value.map(subValues => {
return normalizeAttributes(definition.query, subValues);
});
}
return value;
};
const normalizedAttributes = normalizeAttributes((_blockType$attributes = blockType?.attributes) !== null && _blockType$attributes !== void 0 ? _blockType$attributes : {}, attributes);
let [blockName, blockAttributes] = convertLegacyBlockNameAndAttributes(name, normalizedAttributes);
// If a Block is undefined at this point, use the core/missing block as
// a placeholder for a better user experience.
if (undefined === getBlockType(blockName)) {
blockAttributes = {
originalName: name,
originalContent: '',
originalUndelimitedContent: ''
};
blockName = 'core/missing';
}
return createBlock(blockName, blockAttributes, synchronizeBlocksWithTemplate([], innerBlocksTemplate));
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/api/index.js
// The blocktype is the most important concept within the block API. It defines
// all aspects of the block configuration and its interfaces, including `edit`
// and `save`. The transforms specification allows converting one blocktype to
// another through formulas defined by either the source or the destination.
// Switching a blocktype is to be considered a one-way operation implying a
// transformation in the opposite way has to be handled explicitly.
// The block tree is composed of a collection of block nodes. Blocks contained
// within other blocks are called inner blocks. An important design
// consideration is that inner blocks are -- conceptually -- not part of the
// territory established by the parent block that contains them.
//
// This has multiple practical implications: when parsing, we can safely dispose
// of any block boundary found within a block from the innerHTML property when
// transfering to state. Not doing so would have a compounding effect on memory
// and uncertainty over the source of truth. This can be illustrated in how,
// given a tree of `n` nested blocks, the entry node would have to contain the
// actual content of each block while each subsequent block node in the state
// tree would replicate the entire chain `n-1`, meaning the extreme end node
// would have been replicated `n` times as the tree is traversed and would
// generate uncertainty as to which one is to hold the current value of the
// block. For composition, it also means inner blocks can effectively be child
// components whose mechanisms can be shielded from the `edit` implementation
// and just passed along.
// While block transformations account for a specific surface of the API, there
// are also raw transformations which handle arbitrary sources not made out of
// blocks but producing block basaed on various heursitics. This includes
// pasting rich text or HTML data.
// The process of serialization aims to deflate the internal memory of the block
// editor and its state representation back into an HTML valid string. This
// process restores the document integrity and inserts invisible delimiters
// around each block with HTML comment boundaries which can contain any extra
// attributes needed to operate with the block later on.
// Validation is the process of comparing a block source with its output before
// there is any user input or interaction with a block. When this operation
// fails -- for whatever reason -- the block is to be considered invalid. As
// part of validating a block the system will attempt to run the source against
// any provided deprecation definitions.
//
// Worth emphasizing that validation is not a case of whether the markup is
// merely HTML spec-compliant but about how the editor knows to create such
// markup and that its inability to create an identical result can be a strong
// indicator of potential data loss (the invalidation is then a protective
// measure).
//
// The invalidation process can also be deconstructed in phases: 1) validate the
// block exists; 2) validate the source matches the output; 3) validate the
// source matches deprecated outputs; 4) work through the significance of
// differences. These are stacked in a way that favors performance and optimizes
// for the majority of cases. That is to say, the evaluation logic can become
// more sophisticated the further down it goes in the process as the cost is
// accounted for. The first logic checks have to be extremely efficient since
// they will be run for all valid and invalid blocks alike. However, once a
// block is detected as invalid -- failing the three first steps -- it is
// adequate to spend more time determining validity before throwing a conflict.
// Blocks are inherently indifferent about where the data they operate with ends
// up being saved. For example, all blocks can have a static and dynamic aspect
// to them depending on the needs. The static nature of a block is the `save()`
// definition that is meant to be serialized into HTML and which can be left
// void. Any block can also register a `render_callback` on the server, which
// makes its output dynamic either in part or in its totality.
//
// Child blocks are defined as a relationship that builds on top of the inner
// blocks mechanism. A child block is a block node of a particular type that can
// only exist within the inner block boundaries of a specific parent type. This
// allows block authors to compose specific blocks that are not meant to be used
// outside of a specified parent block context. Thus, child blocks extend the
// concept of inner blocks to support a more direct relationship between sets of
// blocks. The addition of parent–child would be a subset of the inner block
// functionality under the premise that certain blocks only make sense as
// children of another block.
// Templates are, in a general sense, a basic collection of block nodes with any
// given set of predefined attributes that are supplied as the initial state of
// an inner blocks group. These nodes can, in turn, contain any number of nested
// blocks within their definition. Templates allow both to specify a default
// state for an editor session or a default set of blocks for any inner block
// implementation within a specific block.
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/deprecated.js
/**
* WordPress dependencies
*/
/**
* A Higher Order Component used to inject BlockContent using context to the
* wrapped component.
*
* @deprecated
*
* @param {Component} OriginalComponent The component to enhance.
* @return {Component} The same component.
*/
function withBlockContentContext(OriginalComponent) {
external_wp_deprecated_default()('wp.blocks.withBlockContentContext', {
since: '6.1'
});
return OriginalComponent;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/index.js
// A "block" is the abstract term used to describe units of markup that,
// when composed together, form the content or layout of a page.
// The API for blocks is exposed via `wp.blocks`.
//
// Supported blocks are registered by calling `registerBlockType`. Once registered,
// the block is made available as an option to the editor interface.
//
// Blocks are inferred from the HTML source of a post through a parsing mechanism
// and then stored as objects in state, from which it is then rendered for editing.
})();
(window.wp = window.wp || {}).blocks = __webpack_exports__;
/******/ })()
;/*! This file is auto-generated */
(()=>{var e={7734:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,a;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!=o--;)if(!e(t[o],r[o]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(o of t.entries())if(!r.has(o[0]))return!1;for(o of t.entries())if(!e(o[1],r.get(o[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(o of t.entries())if(!r.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((n=t.length)!=r.length)return!1;for(o=n;0!=o--;)if(t[o]!==r[o])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(r,a[o]))return!1;for(o=n;0!=o--;){var i=a[o];if(!e(t[i],r[i]))return!1}return!0}return t!=t&&r!=r}},5373:(e,t)=>{"use strict";var r,n=Symbol.for("react.element"),o=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.server_context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen");
/**
* @license React
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/function b(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case a:case s:case i:case p:case h:return e;default:switch(e=e&&e.$$typeof){case u:case l:case d:case g:case f:case c:return e;default:return t}}case o:return t}}}r=Symbol.for("react.module.reference"),t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===s||e===i||e===p||e===h||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===f||e.$$typeof===c||e.$$typeof===l||e.$$typeof===d||e.$$typeof===r||void 0!==e.getModuleId)}},8529:(e,t,r)=>{"use strict";e.exports=r(5373)},9681:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},r=Object.keys(t).join("|"),n=new RegExp(r,"g"),o=new RegExp(r,"");function a(e){return t[e]}var i=function(e){return e.replace(n,a)};e.exports=i,e.exports.has=function(e){return!!e.match(o)},e.exports.remove=i},1030:function(e,t,r){var n;/*! showdown v 1.9.1 - 02-11-2019 */
(function(){function o(e){"use strict";var t={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as <br> (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,description:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,description:"Support for HTML Tag escaping. ex: <div>foo</div>",type:"boolean"},emoji:{defaultValue:!1,description:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,description:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `<em>` and `<strong>`",type:"boolean"},completeHTMLDocument:{defaultValue:!1,description:"Outputs a complete html document, including `<html>`, `<head>` and `<body>` tags",type:"boolean"},metadata:{defaultValue:!1,description:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,description:"Split adjacent blockquote blocks",type:"boolean"}};if(!1===e)return JSON.parse(JSON.stringify(t));var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n].defaultValue);return r}var a={},i={},s={},c=o(!0),l="vanilla",u={github:{omitExtraWLInCodeBlocks:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,disableForced4SpacesIndentedSublists:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghCompatibleHeaderId:!0,ghMentions:!0,backslashEscapesHTMLTags:!0,emoji:!0,splitAdjacentBlockquotes:!0},original:{noHeaderId:!0,ghCodeBlocks:!1},ghost:{omitExtraWLInCodeBlocks:!0,parseImgDimensions:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,smoothLivePreview:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghMentions:!1,encodeEmails:!0},vanilla:o(!0),allOn:function(){"use strict";var e=o(!0),t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=!0);return t}()};function d(e,t){"use strict";var r=t?"Error in "+t+" extension->":"Error in unnamed extension",n={valid:!0,error:""};a.helper.isArray(e)||(e=[e]);for(var o=0;o<e.length;++o){var i=r+" sub-extension "+o+": ",s=e[o];if("object"!=typeof s)return n.valid=!1,n.error=i+"must be an object, but "+typeof s+" given",n;if(!a.helper.isString(s.type))return n.valid=!1,n.error=i+'property "type" must be a string, but '+typeof s.type+" given",n;var c=s.type=s.type.toLowerCase();if("language"===c&&(c=s.type="lang"),"html"===c&&(c=s.type="output"),"lang"!==c&&"output"!==c&&"listener"!==c)return n.valid=!1,n.error=i+"type "+c+' is not recognized. Valid values: "lang/language", "output/html" or "listener"',n;if("listener"===c){if(a.helper.isUndefined(s.listeners))return n.valid=!1,n.error=i+'. Extensions of type "listener" must have a property called "listeners"',n}else if(a.helper.isUndefined(s.filter)&&a.helper.isUndefined(s.regex))return n.valid=!1,n.error=i+c+' extensions must define either a "regex" property or a "filter" method',n;if(s.listeners){if("object"!=typeof s.listeners)return n.valid=!1,n.error=i+'"listeners" property must be an object but '+typeof s.listeners+" given",n;for(var l in s.listeners)if(s.listeners.hasOwnProperty(l)&&"function"!=typeof s.listeners[l])return n.valid=!1,n.error=i+'"listeners" property must be an hash of [event name]: [callback]. listeners.'+l+" must be a function but "+typeof s.listeners[l]+" given",n}if(s.filter){if("function"!=typeof s.filter)return n.valid=!1,n.error=i+'"filter" must be a function, but '+typeof s.filter+" given",n}else if(s.regex){if(a.helper.isString(s.regex)&&(s.regex=new RegExp(s.regex,"g")),!(s.regex instanceof RegExp))return n.valid=!1,n.error=i+'"regex" property must either be a string or a RegExp object, but '+typeof s.regex+" given",n;if(a.helper.isUndefined(s.replace))return n.valid=!1,n.error=i+'"regex" extensions must implement a replace string or function',n}}return n}function p(e,t){"use strict";return"¨E"+t.charCodeAt(0)+"E"}a.helper={},a.extensions={},a.setOption=function(e,t){"use strict";return c[e]=t,this},a.getOption=function(e){"use strict";return c[e]},a.getOptions=function(){"use strict";return c},a.resetOptions=function(){"use strict";c=o(!0)},a.setFlavor=function(e){"use strict";if(!u.hasOwnProperty(e))throw Error(e+" flavor was not found");a.resetOptions();var t=u[e];for(var r in l=e,t)t.hasOwnProperty(r)&&(c[r]=t[r])},a.getFlavor=function(){"use strict";return l},a.getFlavorOptions=function(e){"use strict";if(u.hasOwnProperty(e))return u[e]},a.getDefaultOptions=function(e){"use strict";return o(e)},a.subParser=function(e,t){"use strict";if(a.helper.isString(e)){if(void 0===t){if(i.hasOwnProperty(e))return i[e];throw Error("SubParser named "+e+" not registered!")}i[e]=t}},a.extension=function(e,t){"use strict";if(!a.helper.isString(e))throw Error("Extension 'name' must be a string");if(e=a.helper.stdExtName(e),a.helper.isUndefined(t)){if(!s.hasOwnProperty(e))throw Error("Extension named "+e+" is not registered!");return s[e]}"function"==typeof t&&(t=t()),a.helper.isArray(t)||(t=[t]);var r=d(t,e);if(!r.valid)throw Error(r.error);s[e]=t},a.getAllExtensions=function(){"use strict";return s},a.removeExtension=function(e){"use strict";delete s[e]},a.resetExtensions=function(){"use strict";s={}},a.validateExtension=function(e){"use strict";var t=d(e,null);return!!t.valid||(console.warn(t.error),!1)},a.hasOwnProperty("helper")||(a.helper={}),a.helper.isString=function(e){"use strict";return"string"==typeof e||e instanceof String},a.helper.isFunction=function(e){"use strict";return e&&"[object Function]"==={}.toString.call(e)},a.helper.isArray=function(e){"use strict";return Array.isArray(e)},a.helper.isUndefined=function(e){"use strict";return void 0===e},a.helper.forEach=function(e,t){"use strict";if(a.helper.isUndefined(e))throw new Error("obj param is required");if(a.helper.isUndefined(t))throw new Error("callback param is required");if(!a.helper.isFunction(t))throw new Error("callback param must be a function/closure");if("function"==typeof e.forEach)e.forEach(t);else if(a.helper.isArray(e))for(var r=0;r<e.length;r++)t(e[r],r,e);else{if("object"!=typeof e)throw new Error("obj does not seem to be an array or an iterable object");for(var n in e)e.hasOwnProperty(n)&&t(e[n],n,e)}},a.helper.stdExtName=function(e){"use strict";return e.replace(/[_?*+\/\\.^-]/g,"").replace(/\s/g,"").toLowerCase()},a.helper.escapeCharactersCallback=p,a.helper.escapeCharacters=function(e,t,r){"use strict";var n="(["+t.replace(/([\[\]\\])/g,"\\$1")+"])";r&&(n="\\\\"+n);var o=new RegExp(n,"g");return e=e.replace(o,p)},a.helper.unescapeHTMLEntities=function(e){"use strict";return e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")};var h=function(e,t,r,n){"use strict";var o,a,i,s,c,l=n||"",u=l.indexOf("g")>-1,d=new RegExp(t+"|"+r,"g"+l.replace(/g/g,"")),p=new RegExp(t,l.replace(/g/g,"")),h=[];do{for(o=0;i=d.exec(e);)if(p.test(i[0]))o++||(s=(a=d.lastIndex)-i[0].length);else if(o&&! --o){c=i.index+i[0].length;var f={left:{start:s,end:a},match:{start:a,end:i.index},right:{start:i.index,end:c},wholeMatch:{start:s,end:c}};if(h.push(f),!u)return h}}while(o&&(d.lastIndex=a));return h};a.helper.matchRecursiveRegExp=function(e,t,r,n){"use strict";for(var o=h(e,t,r,n),a=[],i=0;i<o.length;++i)a.push([e.slice(o[i].wholeMatch.start,o[i].wholeMatch.end),e.slice(o[i].match.start,o[i].match.end),e.slice(o[i].left.start,o[i].left.end),e.slice(o[i].right.start,o[i].right.end)]);return a},a.helper.replaceRecursiveRegExp=function(e,t,r,n,o){"use strict";if(!a.helper.isFunction(t)){var i=t;t=function(){return i}}var s=h(e,r,n,o),c=e,l=s.length;if(l>0){var u=[];0!==s[0].wholeMatch.start&&u.push(e.slice(0,s[0].wholeMatch.start));for(var d=0;d<l;++d)u.push(t(e.slice(s[d].wholeMatch.start,s[d].wholeMatch.end),e.slice(s[d].match.start,s[d].match.end),e.slice(s[d].left.start,s[d].left.end),e.slice(s[d].right.start,s[d].right.end))),d<l-1&&u.push(e.slice(s[d].wholeMatch.end,s[d+1].wholeMatch.start));s[l-1].wholeMatch.end<e.length&&u.push(e.slice(s[l-1].wholeMatch.end)),c=u.join("")}return c},a.helper.regexIndexOf=function(e,t,r){"use strict";if(!a.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";if(t instanceof RegExp==!1)throw"InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp";var n=e.substring(r||0).search(t);return n>=0?n+(r||0):n},a.helper.splitAtIndex=function(e,t){"use strict";if(!a.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[e.substring(0,t),e.substring(t)]},a.helper.encodeEmailAddress=function(e){"use strict";var t=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e=e.replace(/./g,(function(e){if("@"===e)e=t[Math.floor(2*Math.random())](e);else{var r=Math.random();e=r>.9?t[2](e):r>.45?t[1](e):t[0](e)}return e}))},a.helper.padEnd=function(e,t,r){"use strict";return t>>=0,r=String(r||" "),e.length>t?String(e):((t-=e.length)>r.length&&(r+=r.repeat(t/r.length)),String(e)+r.slice(0,t))},"undefined"==typeof console&&(console={warn:function(e){"use strict";alert(e)},log:function(e){"use strict";alert(e)},error:function(e){"use strict";throw e}}),a.helper.regexes={asteriskDashAndColon:/([*_:~])/g},a.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:'<img alt=":octocat:" height="20" width="20" align="absmiddle" src="https://assets-cdn.github.com/images/icons/emoji/octocat.png">',showdown:"<span style=\"font-family: 'Anonymous Pro', monospace; text-decoration: underline; text-decoration-style: dashed; text-decoration-color: #3e8b8a;text-underline-position: under;\">S</span>"},a.Converter=function(e){"use strict";var t={},r=[],n=[],o={},i=l,p={parsed:{},raw:"",format:""};function h(e,t){if(t=t||null,a.helper.isString(e)){if(t=e=a.helper.stdExtName(e),a.extensions[e])return console.warn("DEPRECATION WARNING: "+e+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),void function(e,t){"function"==typeof e&&(e=e(new a.Converter));a.helper.isArray(e)||(e=[e]);var o=d(e,t);if(!o.valid)throw Error(o.error);for(var i=0;i<e.length;++i)switch(e[i].type){case"lang":r.push(e[i]);break;case"output":n.push(e[i]);break;default:throw Error("Extension loader error: Type unrecognized!!!")}}(a.extensions[e],e);if(a.helper.isUndefined(s[e]))throw Error('Extension "'+e+'" could not be loaded. It was either not found or is not a valid extension.');e=s[e]}"function"==typeof e&&(e=e()),a.helper.isArray(e)||(e=[e]);var o=d(e,t);if(!o.valid)throw Error(o.error);for(var i=0;i<e.length;++i){switch(e[i].type){case"lang":r.push(e[i]);break;case"output":n.push(e[i])}if(e[i].hasOwnProperty("listeners"))for(var c in e[i].listeners)e[i].listeners.hasOwnProperty(c)&&f(c,e[i].listeners[c])}}function f(e,t){if(!a.helper.isString(e))throw Error("Invalid argument in converter.listen() method: name must be a string, but "+typeof e+" given");if("function"!=typeof t)throw Error("Invalid argument in converter.listen() method: callback must be a function, but "+typeof t+" given");o.hasOwnProperty(e)||(o[e]=[]),o[e].push(t)}!function(){for(var r in e=e||{},c)c.hasOwnProperty(r)&&(t[r]=c[r]);if("object"!=typeof e)throw Error("Converter expects the passed parameter to be an object, but "+typeof e+" was passed instead.");for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.extensions&&a.helper.forEach(t.extensions,h)}(),this._dispatch=function(e,t,r,n){if(o.hasOwnProperty(e))for(var a=0;a<o[e].length;++a){var i=o[e][a](e,t,this,r,n);i&&void 0!==i&&(t=i)}return t},this.listen=function(e,t){return f(e,t),this},this.makeHtml=function(e){if(!e)return e;var o={gHtmlBlocks:[],gHtmlMdBlocks:[],gHtmlSpans:[],gUrls:{},gTitles:{},gDimensions:{},gListLevel:0,hashLinkCounts:{},langExtensions:r,outputModifiers:n,converter:this,ghCodeBlocks:[],metadata:{parsed:{},raw:"",format:""}};return e=(e=(e=(e=(e=e.replace(/¨/g,"¨T")).replace(/\$/g,"¨D")).replace(/\r\n/g,"\n")).replace(/\r/g,"\n")).replace(/\u00A0/g," "),t.smartIndentationFix&&(e=function(e){var t=e.match(/^\s*/)[0].length,r=new RegExp("^\\s{0,"+t+"}","gm");return e.replace(r,"")}(e)),e="\n\n"+e+"\n\n",e=(e=a.subParser("detab")(e,t,o)).replace(/^[ \t]+$/gm,""),a.helper.forEach(r,(function(r){e=a.subParser("runExtension")(r,e,t,o)})),e=a.subParser("metadata")(e,t,o),e=a.subParser("hashPreCodeTags")(e,t,o),e=a.subParser("githubCodeBlocks")(e,t,o),e=a.subParser("hashHTMLBlocks")(e,t,o),e=a.subParser("hashCodeTags")(e,t,o),e=a.subParser("stripLinkDefinitions")(e,t,o),e=a.subParser("blockGamut")(e,t,o),e=a.subParser("unhashHTMLSpans")(e,t,o),e=(e=(e=a.subParser("unescapeSpecialChars")(e,t,o)).replace(/¨D/g,"$$")).replace(/¨T/g,"¨"),e=a.subParser("completeHTMLDocument")(e,t,o),a.helper.forEach(n,(function(r){e=a.subParser("runExtension")(r,e,t,o)})),p=o.metadata,e},this.makeMarkdown=this.makeMd=function(e,t){if(e=(e=(e=e.replace(/\r\n/g,"\n")).replace(/\r/g,"\n")).replace(/>[ \t]+</,">¨NBSP;<"),!t){if(!window||!window.document)throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");t=window.document}var r=t.createElement("div");r.innerHTML=e;var n={preList:function(e){for(var t=e.querySelectorAll("pre"),r=[],n=0;n<t.length;++n)if(1===t[n].childElementCount&&"code"===t[n].firstChild.tagName.toLowerCase()){var o=t[n].firstChild.innerHTML.trim(),i=t[n].firstChild.getAttribute("data-language")||"";if(""===i)for(var s=t[n].firstChild.className.split(" "),c=0;c<s.length;++c){var l=s[c].match(/^language-(.+)$/);if(null!==l){i=l[1];break}}o=a.helper.unescapeHTMLEntities(o),r.push(o),t[n].outerHTML='<precode language="'+i+'" precodenum="'+n.toString()+'"></precode>'}else r.push(t[n].innerHTML),t[n].innerHTML="",t[n].setAttribute("prenum",n.toString());return r}(r)};!function e(t){for(var r=0;r<t.childNodes.length;++r){var n=t.childNodes[r];3===n.nodeType?/\S/.test(n.nodeValue)?(n.nodeValue=n.nodeValue.split("\n").join(" "),n.nodeValue=n.nodeValue.replace(/(\s)+/g,"$1")):(t.removeChild(n),--r):1===n.nodeType&&e(n)}}(r);for(var o=r.childNodes,i="",s=0;s<o.length;s++)i+=a.subParser("makeMarkdown.node")(o[s],n);return i},this.setOption=function(e,r){t[e]=r},this.getOption=function(e){return t[e]},this.getOptions=function(){return t},this.addExtension=function(e,t){h(e,t=t||null)},this.useExtension=function(e){h(e)},this.setFlavor=function(e){if(!u.hasOwnProperty(e))throw Error(e+" flavor was not found");var r=u[e];for(var n in i=e,r)r.hasOwnProperty(n)&&(t[n]=r[n])},this.getFlavor=function(){return i},this.removeExtension=function(e){a.helper.isArray(e)||(e=[e]);for(var t=0;t<e.length;++t){for(var o=e[t],i=0;i<r.length;++i)r[i]===o&&r[i].splice(i,1);for(;0<n.length;++i)n[0]===o&&n[0].splice(i,1)}},this.getAllExtensions=function(){return{language:r,output:n}},this.getMetadata=function(e){return e?p.raw:p.parsed},this.getMetadataFormat=function(){return p.format},this._setMetadataPair=function(e,t){p.parsed[e]=t},this._setMetadataFormat=function(e){p.format=e},this._setMetadataRaw=function(e){p.raw=e}},a.subParser("anchors",(function(e,t,r){"use strict";var n=function(e,n,o,i,s,c,l){if(a.helper.isUndefined(l)&&(l=""),o=o.toLowerCase(),e.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)i="";else if(!i){if(o||(o=n.toLowerCase().replace(/ ?\n/g," ")),i="#"+o,a.helper.isUndefined(r.gUrls[o]))return e;i=r.gUrls[o],a.helper.isUndefined(r.gTitles[o])||(l=r.gTitles[o])}var u='<a href="'+(i=i.replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback))+'"';return""!==l&&null!==l&&(u+=' title="'+(l=(l=l.replace(/"/g,""")).replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback))+'"'),t.openLinksInNewWindow&&!/^#/.test(i)&&(u+=' rel="noopener noreferrer" target="¨E95Eblank"'),u+=">"+n+"</a>"};return e=(e=(e=(e=(e=r.converter._dispatch("anchors.before",e,t,r)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,n)).replace(/\[([^\[\]]+)]()()()()()/g,n),t.ghMentions&&(e=e.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim,(function(e,r,n,o,i){if("\\"===n)return r+o;if(!a.helper.isString(t.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var s=t.ghMentionsLink.replace(/\{u}/g,i),c="";return t.openLinksInNewWindow&&(c=' rel="noopener noreferrer" target="¨E95Eblank"'),r+'<a href="'+s+'"'+c+">"+o+"</a>"}))),e=r.converter._dispatch("anchors.after",e,t,r)}));var f=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,g=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,m=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,b=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,_=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,k=function(e){"use strict";return function(t,r,n,o,i,s,c){var l=n=n.replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback),u="",d="",p=r||"",h=c||"";return/^www\./i.test(n)&&(n=n.replace(/^www\./i,"http://www.")),e.excludeTrailingPunctuationFromURLs&&s&&(u=s),e.openLinksInNewWindow&&(d=' rel="noopener noreferrer" target="¨E95Eblank"'),p+'<a href="'+n+'"'+d+">"+l+"</a>"+u+h}},y=function(e,t){"use strict";return function(r,n,o){var i="mailto:";return n=n||"",o=a.subParser("unescapeSpecialChars")(o,e,t),e.encodeEmails?(i=a.helper.encodeEmailAddress(i+o),o=a.helper.encodeEmailAddress(o)):i+=o,n+'<a href="'+i+'">'+o+"</a>"}};a.subParser("autoLinks",(function(e,t,r){"use strict";return e=(e=(e=r.converter._dispatch("autoLinks.before",e,t,r)).replace(m,k(t))).replace(_,y(t,r)),e=r.converter._dispatch("autoLinks.after",e,t,r)})),a.subParser("simplifiedAutoLinks",(function(e,t,r){"use strict";return t.simplifiedAutoLink?(e=r.converter._dispatch("simplifiedAutoLinks.before",e,t,r),e=(e=t.excludeTrailingPunctuationFromURLs?e.replace(g,k(t)):e.replace(f,k(t))).replace(b,y(t,r)),e=r.converter._dispatch("simplifiedAutoLinks.after",e,t,r)):e})),a.subParser("blockGamut",(function(e,t,r){"use strict";return e=r.converter._dispatch("blockGamut.before",e,t,r),e=a.subParser("blockQuotes")(e,t,r),e=a.subParser("headers")(e,t,r),e=a.subParser("horizontalRule")(e,t,r),e=a.subParser("lists")(e,t,r),e=a.subParser("codeBlocks")(e,t,r),e=a.subParser("tables")(e,t,r),e=a.subParser("hashHTMLBlocks")(e,t,r),e=a.subParser("paragraphs")(e,t,r),e=r.converter._dispatch("blockGamut.after",e,t,r)})),a.subParser("blockQuotes",(function(e,t,r){"use strict";e=r.converter._dispatch("blockQuotes.before",e,t,r),e+="\n\n";var n=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return t.splitAdjacentBlockquotes&&(n=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),e=e.replace(n,(function(e){return e=(e=(e=e.replace(/^[ \t]*>[ \t]?/gm,"")).replace(/¨0/g,"")).replace(/^[ \t]+$/gm,""),e=a.subParser("githubCodeBlocks")(e,t,r),e=(e=(e=a.subParser("blockGamut")(e,t,r)).replace(/(^|\n)/g,"$1 ")).replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,(function(e,t){var r=t;return r=(r=r.replace(/^ /gm,"¨0")).replace(/¨0/g,"")})),a.subParser("hashBlock")("<blockquote>\n"+e+"\n</blockquote>",t,r)})),e=r.converter._dispatch("blockQuotes.after",e,t,r)})),a.subParser("codeBlocks",(function(e,t,r){"use strict";e=r.converter._dispatch("codeBlocks.before",e,t,r);return e=(e=(e+="¨0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g,(function(e,n,o){var i=n,s=o,c="\n";return i=a.subParser("outdent")(i,t,r),i=a.subParser("encodeCode")(i,t,r),i=(i=(i=a.subParser("detab")(i,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),t.omitExtraWLInCodeBlocks&&(c=""),i="<pre><code>"+i+c+"</code></pre>",a.subParser("hashBlock")(i,t,r)+s}))).replace(/¨0/,""),e=r.converter._dispatch("codeBlocks.after",e,t,r)})),a.subParser("codeSpans",(function(e,t,r){"use strict";return void 0===(e=r.converter._dispatch("codeSpans.before",e,t,r))&&(e=""),e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,(function(e,n,o,i){var s=i;return s=(s=s.replace(/^([ \t]*)/g,"")).replace(/[ \t]*$/g,""),s=n+"<code>"+(s=a.subParser("encodeCode")(s,t,r))+"</code>",s=a.subParser("hashHTMLSpans")(s,t,r)})),e=r.converter._dispatch("codeSpans.after",e,t,r)})),a.subParser("completeHTMLDocument",(function(e,t,r){"use strict";if(!t.completeHTMLDocument)return e;e=r.converter._dispatch("completeHTMLDocument.before",e,t,r);var n="html",o="<!DOCTYPE HTML>\n",a="",i='<meta charset="utf-8">\n',s="",c="";for(var l in void 0!==r.metadata.parsed.doctype&&(o="<!DOCTYPE "+r.metadata.parsed.doctype+">\n","html"!==(n=r.metadata.parsed.doctype.toString().toLowerCase())&&"html5"!==n||(i='<meta charset="utf-8">')),r.metadata.parsed)if(r.metadata.parsed.hasOwnProperty(l))switch(l.toLowerCase()){case"doctype":break;case"title":a="<title>"+r.metadata.parsed.title+"</title>\n";break;case"charset":i="html"===n||"html5"===n?'<meta charset="'+r.metadata.parsed.charset+'">\n':'<meta name="charset" content="'+r.metadata.parsed.charset+'">\n';break;case"language":case"lang":s=' lang="'+r.metadata.parsed[l]+'"',c+='<meta name="'+l+'" content="'+r.metadata.parsed[l]+'">\n';break;default:c+='<meta name="'+l+'" content="'+r.metadata.parsed[l]+'">\n'}return e=o+"<html"+s+">\n<head>\n"+a+i+c+"</head>\n<body>\n"+e.trim()+"\n</body>\n</html>",e=r.converter._dispatch("completeHTMLDocument.after",e,t,r)})),a.subParser("detab",(function(e,t,r){"use strict";return e=(e=(e=(e=(e=(e=r.converter._dispatch("detab.before",e,t,r)).replace(/\t(?=\t)/g," ")).replace(/\t/g,"¨A¨B")).replace(/¨B(.+?)¨A/g,(function(e,t){for(var r=t,n=4-r.length%4,o=0;o<n;o++)r+=" ";return r}))).replace(/¨A/g," ")).replace(/¨B/g,""),e=r.converter._dispatch("detab.after",e,t,r)})),a.subParser("ellipsis",(function(e,t,r){"use strict";return e=(e=r.converter._dispatch("ellipsis.before",e,t,r)).replace(/\.\.\./g,"…"),e=r.converter._dispatch("ellipsis.after",e,t,r)})),a.subParser("emoji",(function(e,t,r){"use strict";if(!t.emoji)return e;return e=(e=r.converter._dispatch("emoji.before",e,t,r)).replace(/:([\S]+?):/g,(function(e,t){return a.helper.emojis.hasOwnProperty(t)?a.helper.emojis[t]:e})),e=r.converter._dispatch("emoji.after",e,t,r)})),a.subParser("encodeAmpsAndAngles",(function(e,t,r){"use strict";return e=(e=(e=(e=(e=r.converter._dispatch("encodeAmpsAndAngles.before",e,t,r)).replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&")).replace(/<(?![a-z\/?$!])/gi,"<")).replace(/</g,"<")).replace(/>/g,">"),e=r.converter._dispatch("encodeAmpsAndAngles.after",e,t,r)})),a.subParser("encodeBackslashEscapes",(function(e,t,r){"use strict";return e=(e=(e=r.converter._dispatch("encodeBackslashEscapes.before",e,t,r)).replace(/\\(\\)/g,a.helper.escapeCharactersCallback)).replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,a.helper.escapeCharactersCallback),e=r.converter._dispatch("encodeBackslashEscapes.after",e,t,r)})),a.subParser("encodeCode",(function(e,t,r){"use strict";return e=(e=r.converter._dispatch("encodeCode.before",e,t,r)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/([*_{}\[\]\\=~-])/g,a.helper.escapeCharactersCallback),e=r.converter._dispatch("encodeCode.after",e,t,r)})),a.subParser("escapeSpecialCharsWithinTagAttributes",(function(e,t,r){"use strict";return e=(e=(e=r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",e,t,r)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,(function(e){return e.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,a.helper.escapeCharactersCallback)}))).replace(/<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi,(function(e){return e.replace(/([\\`*_~=|])/g,a.helper.escapeCharactersCallback)})),e=r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",e,t,r)})),a.subParser("githubCodeBlocks",(function(e,t,r){"use strict";return t.ghCodeBlocks?(e=r.converter._dispatch("githubCodeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,(function(e,n,o,i){var s=t.omitExtraWLInCodeBlocks?"":"\n";return i=a.subParser("encodeCode")(i,t,r),i="<pre><code"+(o?' class="'+o+" language-"+o+'"':"")+">"+(i=(i=(i=a.subParser("detab")(i,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""))+s+"</code></pre>",i=a.subParser("hashBlock")(i,t,r),"\n\n¨G"+(r.ghCodeBlocks.push({text:e,codeblock:i})-1)+"G\n\n"}))).replace(/¨0/,""),r.converter._dispatch("githubCodeBlocks.after",e,t,r)):e})),a.subParser("hashBlock",(function(e,t,r){"use strict";return e=(e=r.converter._dispatch("hashBlock.before",e,t,r)).replace(/(^\n+|\n+$)/g,""),e="\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n",e=r.converter._dispatch("hashBlock.after",e,t,r)})),a.subParser("hashCodeTags",(function(e,t,r){"use strict";e=r.converter._dispatch("hashCodeTags.before",e,t,r);return e=a.helper.replaceRecursiveRegExp(e,(function(e,n,o,i){var s=o+a.subParser("encodeCode")(n,t,r)+i;return"¨C"+(r.gHtmlSpans.push(s)-1)+"C"}),"<code\\b[^>]*>","</code>","gim"),e=r.converter._dispatch("hashCodeTags.after",e,t,r)})),a.subParser("hashElement",(function(e,t,r){"use strict";return function(e,t){var n=t;return n=(n=(n=n.replace(/\n\n/g,"\n")).replace(/^\n/,"")).replace(/\n+$/g,""),n="\n\n¨K"+(r.gHtmlBlocks.push(n)-1)+"K\n\n"}})),a.subParser("hashHTMLBlocks",(function(e,t,r){"use strict";e=r.converter._dispatch("hashHTMLBlocks.before",e,t,r);var n=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],o=function(e,t,n,o){var a=e;return-1!==n.search(/\bmarkdown\b/)&&(a=n+r.converter.makeHtml(t)+o),"\n\n¨K"+(r.gHtmlBlocks.push(a)-1)+"K\n\n"};t.backslashEscapesHTMLTags&&(e=e.replace(/\\<(\/?[^>]+?)>/g,(function(e,t){return"<"+t+">"})));for(var i=0;i<n.length;++i)for(var s,c=new RegExp("^ {0,3}(<"+n[i]+"\\b[^>]*>)","im"),l="<"+n[i]+"\\b[^>]*>",u="</"+n[i]+">";-1!==(s=a.helper.regexIndexOf(e,c));){var d=a.helper.splitAtIndex(e,s),p=a.helper.replaceRecursiveRegExp(d[1],o,l,u,"im");if(p===d[1])break;e=d[0].concat(p)}return e=e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,a.subParser("hashElement")(e,t,r)),e=(e=a.helper.replaceRecursiveRegExp(e,(function(e){return"\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n"}),"^ {0,3}\x3c!--","--\x3e","gm")).replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,a.subParser("hashElement")(e,t,r)),e=r.converter._dispatch("hashHTMLBlocks.after",e,t,r)})),a.subParser("hashHTMLSpans",(function(e,t,r){"use strict";function n(e){return"¨C"+(r.gHtmlSpans.push(e)-1)+"C"}return e=(e=(e=(e=(e=r.converter._dispatch("hashHTMLSpans.before",e,t,r)).replace(/<[^>]+?\/>/gi,(function(e){return n(e)}))).replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,(function(e){return n(e)}))).replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,(function(e){return n(e)}))).replace(/<[^>]+?>/gi,(function(e){return n(e)})),e=r.converter._dispatch("hashHTMLSpans.after",e,t,r)})),a.subParser("unhashHTMLSpans",(function(e,t,r){"use strict";e=r.converter._dispatch("unhashHTMLSpans.before",e,t,r);for(var n=0;n<r.gHtmlSpans.length;++n){for(var o=r.gHtmlSpans[n],a=0;/¨C(\d+)C/.test(o);){var i=RegExp.$1;if(o=o.replace("¨C"+i+"C",r.gHtmlSpans[i]),10===a){console.error("maximum nesting of 10 spans reached!!!");break}++a}e=e.replace("¨C"+n+"C",o)}return e=r.converter._dispatch("unhashHTMLSpans.after",e,t,r)})),a.subParser("hashPreCodeTags",(function(e,t,r){"use strict";e=r.converter._dispatch("hashPreCodeTags.before",e,t,r);return e=a.helper.replaceRecursiveRegExp(e,(function(e,n,o,i){var s=o+a.subParser("encodeCode")(n,t,r)+i;return"\n\n¨G"+(r.ghCodeBlocks.push({text:e,codeblock:s})-1)+"G\n\n"}),"^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>","^ {0,3}</code>\\s*</pre>","gim"),e=r.converter._dispatch("hashPreCodeTags.after",e,t,r)})),a.subParser("headers",(function(e,t,r){"use strict";e=r.converter._dispatch("headers.before",e,t,r);var n=isNaN(parseInt(t.headerLevelStart))?1:parseInt(t.headerLevelStart),o=t.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,i=t.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;e=(e=e.replace(o,(function(e,o){var i=a.subParser("spanGamut")(o,t,r),s=t.noHeaderId?"":' id="'+c(o)+'"',l="<h"+n+s+">"+i+"</h"+n+">";return a.subParser("hashBlock")(l,t,r)}))).replace(i,(function(e,o){var i=a.subParser("spanGamut")(o,t,r),s=t.noHeaderId?"":' id="'+c(o)+'"',l=n+1,u="<h"+l+s+">"+i+"</h"+l+">";return a.subParser("hashBlock")(u,t,r)}));var s=t.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;function c(e){var n,o;if(t.customizedHeaderId){var i=e.match(/\{([^{]+?)}\s*$/);i&&i[1]&&(e=i[1])}return n=e,o=a.helper.isString(t.prefixHeaderId)?t.prefixHeaderId:!0===t.prefixHeaderId?"section-":"",t.rawPrefixHeaderId||(n=o+n),n=t.ghCompatibleHeaderId?n.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():t.rawHeaderId?n.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():n.replace(/[^\w]/g,"").toLowerCase(),t.rawPrefixHeaderId&&(n=o+n),r.hashLinkCounts[n]?n=n+"-"+r.hashLinkCounts[n]++:r.hashLinkCounts[n]=1,n}return e=e.replace(s,(function(e,o,i){var s=i;t.customizedHeaderId&&(s=i.replace(/\s?\{([^{]+?)}\s*$/,""));var l=a.subParser("spanGamut")(s,t,r),u=t.noHeaderId?"":' id="'+c(i)+'"',d=n-1+o.length,p="<h"+d+u+">"+l+"</h"+d+">";return a.subParser("hashBlock")(p,t,r)})),e=r.converter._dispatch("headers.after",e,t,r)})),a.subParser("horizontalRule",(function(e,t,r){"use strict";e=r.converter._dispatch("horizontalRule.before",e,t,r);var n=a.subParser("hashBlock")("<hr />",t,r);return e=(e=(e=e.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,n)).replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,n),e=r.converter._dispatch("horizontalRule.after",e,t,r)})),a.subParser("images",(function(e,t,r){"use strict";function n(e,t,n,o,i,s,c,l){var u=r.gUrls,d=r.gTitles,p=r.gDimensions;if(n=n.toLowerCase(),l||(l=""),e.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)o="";else if(""===o||null===o){if(""!==n&&null!==n||(n=t.toLowerCase().replace(/ ?\n/g," ")),o="#"+n,a.helper.isUndefined(u[n]))return e;o=u[n],a.helper.isUndefined(d[n])||(l=d[n]),a.helper.isUndefined(p[n])||(i=p[n].width,s=p[n].height)}t=t.replace(/"/g,""").replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback);var h='<img src="'+(o=o.replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback))+'" alt="'+t+'"';return l&&a.helper.isString(l)&&(h+=' title="'+(l=l.replace(/"/g,""").replace(a.helper.regexes.asteriskDashAndColon,a.helper.escapeCharactersCallback))+'"'),i&&s&&(h+=' width="'+(i="*"===i?"auto":i)+'"',h+=' height="'+(s="*"===s?"auto":s)+'"'),h+=" />"}return e=(e=(e=(e=(e=(e=r.converter._dispatch("images.before",e,t,r)).replace(/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,n)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,(function(e,t,r,o,a,i,s,c){return n(e,t,r,o=o.replace(/\s/g,""),a,i,s,c)}))).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,n)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,n)).replace(/!\[([^\[\]]+)]()()()()()/g,n),e=r.converter._dispatch("images.after",e,t,r)})),a.subParser("italicsAndBold",(function(e,t,r){"use strict";function n(e,t,r){return t+e+r}return e=r.converter._dispatch("italicsAndBold.before",e,t,r),e=t.literalMidWordUnderscores?(e=(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,(function(e,t){return n(t,"<strong><em>","</em></strong>")}))).replace(/\b__(\S[\s\S]*?)__\b/g,(function(e,t){return n(t,"<strong>","</strong>")}))).replace(/\b_(\S[\s\S]*?)_\b/g,(function(e,t){return n(t,"<em>","</em>")})):(e=(e=e.replace(/___(\S[\s\S]*?)___/g,(function(e,t){return/\S$/.test(t)?n(t,"<strong><em>","</em></strong>"):e}))).replace(/__(\S[\s\S]*?)__/g,(function(e,t){return/\S$/.test(t)?n(t,"<strong>","</strong>"):e}))).replace(/_([^\s_][\s\S]*?)_/g,(function(e,t){return/\S$/.test(t)?n(t,"<em>","</em>"):e})),e=t.literalMidWordAsterisks?(e=(e=e.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,(function(e,t,r){return n(r,t+"<strong><em>","</em></strong>")}))).replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,(function(e,t,r){return n(r,t+"<strong>","</strong>")}))).replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,(function(e,t,r){return n(r,t+"<em>","</em>")})):(e=(e=e.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,(function(e,t){return/\S$/.test(t)?n(t,"<strong><em>","</em></strong>"):e}))).replace(/\*\*(\S[\s\S]*?)\*\*/g,(function(e,t){return/\S$/.test(t)?n(t,"<strong>","</strong>"):e}))).replace(/\*([^\s*][\s\S]*?)\*/g,(function(e,t){return/\S$/.test(t)?n(t,"<em>","</em>"):e})),e=r.converter._dispatch("italicsAndBold.after",e,t,r)})),a.subParser("lists",(function(e,t,r){"use strict";function n(e,n){r.gListLevel++,e=e.replace(/\n{2,}$/,"\n");var o=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,i=/\n[ \t]*\n(?!¨0)/.test(e+="¨0");return t.disableForced4SpacesIndentedSublists&&(o=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),e=(e=e.replace(o,(function(e,n,o,s,c,l,u){u=u&&""!==u.trim();var d=a.subParser("outdent")(c,t,r),p="";return l&&t.tasklists&&(p=' class="task-list-item" style="list-style-type: none;"',d=d.replace(/^[ \t]*\[(x|X| )?]/m,(function(){var e='<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';return u&&(e+=" checked"),e+=">"}))),d=d.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,(function(e){return"¨A"+e})),n||d.search(/\n{2,}/)>-1?(d=a.subParser("githubCodeBlocks")(d,t,r),d=a.subParser("blockGamut")(d,t,r)):(d=(d=a.subParser("lists")(d,t,r)).replace(/\n$/,""),d=(d=a.subParser("hashHTMLBlocks")(d,t,r)).replace(/\n\n+/g,"\n\n"),d=i?a.subParser("paragraphs")(d,t,r):a.subParser("spanGamut")(d,t,r)),d="<li"+p+">"+(d=d.replace("¨A",""))+"</li>\n"}))).replace(/¨0/g,""),r.gListLevel--,n&&(e=e.replace(/\s+$/,"")),e}function o(e,t){if("ol"===t){var r=e.match(/^ *(\d+)\./);if(r&&"1"!==r[1])return' start="'+r[1]+'"'}return""}function i(e,r,a){var i=t.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,s=t.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,c="ul"===r?i:s,l="";if(-1!==e.search(c))!function t(u){var d=u.search(c),p=o(e,r);-1!==d?(l+="\n\n<"+r+p+">\n"+n(u.slice(0,d),!!a)+"</"+r+">\n",c="ul"===(r="ul"===r?"ol":"ul")?i:s,t(u.slice(d))):l+="\n\n<"+r+p+">\n"+n(u,!!a)+"</"+r+">\n"}(e);else{var u=o(e,r);l="\n\n<"+r+u+">\n"+n(e,!!a)+"</"+r+">\n"}return l}return e=r.converter._dispatch("lists.before",e,t,r),e+="¨0",e=(e=r.gListLevel?e.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,(function(e,t,r){return i(t,r.search(/[*+-]/g)>-1?"ul":"ol",!0)})):e.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,(function(e,t,r,n){return i(r,n.search(/[*+-]/g)>-1?"ul":"ol",!1)}))).replace(/¨0/,""),e=r.converter._dispatch("lists.after",e,t,r)})),a.subParser("metadata",(function(e,t,r){"use strict";if(!t.metadata)return e;function n(e){r.metadata.raw=e,(e=(e=e.replace(/&/g,"&").replace(/"/g,""")).replace(/\n {4}/g," ")).replace(/^([\S ]+): +([\s\S]+?)$/gm,(function(e,t,n){return r.metadata.parsed[t]=n,""}))}return e=(e=(e=(e=r.converter._dispatch("metadata.before",e,t,r)).replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,(function(e,t,r){return n(r),"¨M"}))).replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,(function(e,t,o){return t&&(r.metadata.format=t),n(o),"¨M"}))).replace(/¨M/g,""),e=r.converter._dispatch("metadata.after",e,t,r)})),a.subParser("outdent",(function(e,t,r){"use strict";return e=(e=(e=r.converter._dispatch("outdent.before",e,t,r)).replace(/^(\t|[ ]{1,4})/gm,"¨0")).replace(/¨0/g,""),e=r.converter._dispatch("outdent.after",e,t,r)})),a.subParser("paragraphs",(function(e,t,r){"use strict";for(var n=(e=(e=(e=r.converter._dispatch("paragraphs.before",e,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,"")).split(/\n{2,}/g),o=[],i=n.length,s=0;s<i;s++){var c=n[s];c.search(/¨(K|G)(\d+)\1/g)>=0?o.push(c):c.search(/\S/)>=0&&(c=(c=a.subParser("spanGamut")(c,t,r)).replace(/^([ \t]*)/g,"<p>"),c+="</p>",o.push(c))}for(i=o.length,s=0;s<i;s++){for(var l="",u=o[s],d=!1;/¨(K|G)(\d+)\1/.test(u);){var p=RegExp.$1,h=RegExp.$2;l=(l="K"===p?r.gHtmlBlocks[h]:d?a.subParser("encodeCode")(r.ghCodeBlocks[h].text,t,r):r.ghCodeBlocks[h].codeblock).replace(/\$/g,"$$$$"),u=u.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/,l),/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(u)&&(d=!0)}o[s]=u}return e=(e=(e=o.join("\n")).replace(/^\n+/g,"")).replace(/\n+$/g,""),r.converter._dispatch("paragraphs.after",e,t,r)})),a.subParser("runExtension",(function(e,t,r,n){"use strict";if(e.filter)t=e.filter(t,n.converter,r);else if(e.regex){var o=e.regex;o instanceof RegExp||(o=new RegExp(o,"g")),t=t.replace(o,e.replace)}return t})),a.subParser("spanGamut",(function(e,t,r){"use strict";return e=r.converter._dispatch("spanGamut.before",e,t,r),e=a.subParser("codeSpans")(e,t,r),e=a.subParser("escapeSpecialCharsWithinTagAttributes")(e,t,r),e=a.subParser("encodeBackslashEscapes")(e,t,r),e=a.subParser("images")(e,t,r),e=a.subParser("anchors")(e,t,r),e=a.subParser("autoLinks")(e,t,r),e=a.subParser("simplifiedAutoLinks")(e,t,r),e=a.subParser("emoji")(e,t,r),e=a.subParser("underline")(e,t,r),e=a.subParser("italicsAndBold")(e,t,r),e=a.subParser("strikethrough")(e,t,r),e=a.subParser("ellipsis")(e,t,r),e=a.subParser("hashHTMLSpans")(e,t,r),e=a.subParser("encodeAmpsAndAngles")(e,t,r),t.simpleLineBreaks?/\n\n¨K/.test(e)||(e=e.replace(/\n+/g,"<br />\n")):e=e.replace(/ +\n/g,"<br />\n"),e=r.converter._dispatch("spanGamut.after",e,t,r)})),a.subParser("strikethrough",(function(e,t,r){"use strict";return t.strikethrough&&(e=(e=r.converter._dispatch("strikethrough.before",e,t,r)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,(function(e,n){return function(e){return t.simplifiedAutoLink&&(e=a.subParser("simplifiedAutoLinks")(e,t,r)),"<del>"+e+"</del>"}(n)})),e=r.converter._dispatch("strikethrough.after",e,t,r)),e})),a.subParser("stripLinkDefinitions",(function(e,t,r){"use strict";var n=function(e,n,o,i,s,c,l){return n=n.toLowerCase(),o.match(/^data:.+?\/.+?;base64,/)?r.gUrls[n]=o.replace(/\s/g,""):r.gUrls[n]=a.subParser("encodeAmpsAndAngles")(o,t,r),c?c+l:(l&&(r.gTitles[n]=l.replace(/"|'/g,""")),t.parseImgDimensions&&i&&s&&(r.gDimensions[n]={width:i,height:s}),"")};return e=(e=(e=(e+="¨0").replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm,n)).replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*<?([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,n)).replace(/¨0/,"")})),a.subParser("tables",(function(e,t,r){"use strict";if(!t.tables)return e;function n(e,n){return"<td"+n+">"+a.subParser("spanGamut")(e,t,r)+"</td>\n"}function o(e){var o,i=e.split("\n");for(o=0;o<i.length;++o)/^ {0,3}\|/.test(i[o])&&(i[o]=i[o].replace(/^ {0,3}\|/,"")),/\|[ \t]*$/.test(i[o])&&(i[o]=i[o].replace(/\|[ \t]*$/,"")),i[o]=a.subParser("codeSpans")(i[o],t,r);var s,c,l,u,d=i[0].split("|").map((function(e){return e.trim()})),p=i[1].split("|").map((function(e){return e.trim()})),h=[],f=[],g=[],m=[];for(i.shift(),i.shift(),o=0;o<i.length;++o)""!==i[o].trim()&&h.push(i[o].split("|").map((function(e){return e.trim()})));if(d.length<p.length)return e;for(o=0;o<p.length;++o)g.push((s=p[o],/^:[ \t]*--*$/.test(s)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(s)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(s)?' style="text-align:center;"':""));for(o=0;o<d.length;++o)a.helper.isUndefined(g[o])&&(g[o]=""),f.push((c=d[o],l=g[o],u=void 0,u="",c=c.trim(),(t.tablesHeaderId||t.tableHeaderId)&&(u=' id="'+c.replace(/ /g,"_").toLowerCase()+'"'),"<th"+u+l+">"+(c=a.subParser("spanGamut")(c,t,r))+"</th>\n"));for(o=0;o<h.length;++o){for(var b=[],_=0;_<f.length;++_)a.helper.isUndefined(h[o][_]),b.push(n(h[o][_],g[_]));m.push(b)}return function(e,t){for(var r="<table>\n<thead>\n<tr>\n",n=e.length,o=0;o<n;++o)r+=e[o];for(r+="</tr>\n</thead>\n<tbody>\n",o=0;o<t.length;++o){r+="<tr>\n";for(var a=0;a<n;++a)r+=t[o][a];r+="</tr>\n"}return r+"</tbody>\n</table>\n"}(f,m)}return e=(e=(e=(e=r.converter._dispatch("tables.before",e,t,r)).replace(/\\(\|)/g,a.helper.escapeCharactersCallback)).replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,o)).replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm,o),e=r.converter._dispatch("tables.after",e,t,r)})),a.subParser("underline",(function(e,t,r){"use strict";return t.underline?(e=r.converter._dispatch("underline.before",e,t,r),e=(e=t.literalMidWordUnderscores?(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,(function(e,t){return"<u>"+t+"</u>"}))).replace(/\b__(\S[\s\S]*?)__\b/g,(function(e,t){return"<u>"+t+"</u>"})):(e=e.replace(/___(\S[\s\S]*?)___/g,(function(e,t){return/\S$/.test(t)?"<u>"+t+"</u>":e}))).replace(/__(\S[\s\S]*?)__/g,(function(e,t){return/\S$/.test(t)?"<u>"+t+"</u>":e}))).replace(/(_)/g,a.helper.escapeCharactersCallback),e=r.converter._dispatch("underline.after",e,t,r)):e})),a.subParser("unescapeSpecialChars",(function(e,t,r){"use strict";return e=(e=r.converter._dispatch("unescapeSpecialChars.before",e,t,r)).replace(/¨E(\d+)E/g,(function(e,t){var r=parseInt(t);return String.fromCharCode(r)})),e=r.converter._dispatch("unescapeSpecialChars.after",e,t,r)})),a.subParser("makeMarkdown.blockquote",(function(e,t){"use strict";var r="";if(e.hasChildNodes())for(var n=e.childNodes,o=n.length,i=0;i<o;++i){var s=a.subParser("makeMarkdown.node")(n[i],t);""!==s&&(r+=s)}return r="> "+(r=r.trim()).split("\n").join("\n> ")})),a.subParser("makeMarkdown.codeBlock",(function(e,t){"use strict";var r=e.getAttribute("language"),n=e.getAttribute("precodenum");return"```"+r+"\n"+t.preList[n]+"\n```"})),a.subParser("makeMarkdown.codeSpan",(function(e){"use strict";return"`"+e.innerHTML+"`"})),a.subParser("makeMarkdown.emphasis",(function(e,t){"use strict";var r="";if(e.hasChildNodes()){r+="*";for(var n=e.childNodes,o=n.length,i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t);r+="*"}return r})),a.subParser("makeMarkdown.header",(function(e,t,r){"use strict";var n=new Array(r+1).join("#"),o="";if(e.hasChildNodes()){o=n+" ";for(var i=e.childNodes,s=i.length,c=0;c<s;++c)o+=a.subParser("makeMarkdown.node")(i[c],t)}return o})),a.subParser("makeMarkdown.hr",(function(){"use strict";return"---"})),a.subParser("makeMarkdown.image",(function(e){"use strict";var t="";return e.hasAttribute("src")&&(t+="+">",e.hasAttribute("width")&&e.hasAttribute("height")&&(t+=" ="+e.getAttribute("width")+"x"+e.getAttribute("height")),e.hasAttribute("title")&&(t+=' "'+e.getAttribute("title")+'"'),t+=")"),t})),a.subParser("makeMarkdown.links",(function(e,t){"use strict";var r="";if(e.hasChildNodes()&&e.hasAttribute("href")){var n=e.childNodes,o=n.length;r="[";for(var i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t);r+="](",r+="<"+e.getAttribute("href")+">",e.hasAttribute("title")&&(r+=' "'+e.getAttribute("title")+'"'),r+=")"}return r})),a.subParser("makeMarkdown.list",(function(e,t,r){"use strict";var n="";if(!e.hasChildNodes())return"";for(var o=e.childNodes,i=o.length,s=e.getAttribute("start")||1,c=0;c<i;++c)if(void 0!==o[c].tagName&&"li"===o[c].tagName.toLowerCase()){n+=("ol"===r?s.toString()+". ":"- ")+a.subParser("makeMarkdown.listItem")(o[c],t),++s}return(n+="\n\x3c!-- --\x3e\n").trim()})),a.subParser("makeMarkdown.listItem",(function(e,t){"use strict";for(var r="",n=e.childNodes,o=n.length,i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t);return/\n$/.test(r)?r=r.split("\n").join("\n ").replace(/^ {4}$/gm,"").replace(/\n\n+/g,"\n\n"):r+="\n",r})),a.subParser("makeMarkdown.node",(function(e,t,r){"use strict";r=r||!1;var n="";if(3===e.nodeType)return a.subParser("makeMarkdown.txt")(e,t);if(8===e.nodeType)return"\x3c!--"+e.data+"--\x3e\n\n";if(1!==e.nodeType)return"";switch(e.tagName.toLowerCase()){case"h1":r||(n=a.subParser("makeMarkdown.header")(e,t,1)+"\n\n");break;case"h2":r||(n=a.subParser("makeMarkdown.header")(e,t,2)+"\n\n");break;case"h3":r||(n=a.subParser("makeMarkdown.header")(e,t,3)+"\n\n");break;case"h4":r||(n=a.subParser("makeMarkdown.header")(e,t,4)+"\n\n");break;case"h5":r||(n=a.subParser("makeMarkdown.header")(e,t,5)+"\n\n");break;case"h6":r||(n=a.subParser("makeMarkdown.header")(e,t,6)+"\n\n");break;case"p":r||(n=a.subParser("makeMarkdown.paragraph")(e,t)+"\n\n");break;case"blockquote":r||(n=a.subParser("makeMarkdown.blockquote")(e,t)+"\n\n");break;case"hr":r||(n=a.subParser("makeMarkdown.hr")(e,t)+"\n\n");break;case"ol":r||(n=a.subParser("makeMarkdown.list")(e,t,"ol")+"\n\n");break;case"ul":r||(n=a.subParser("makeMarkdown.list")(e,t,"ul")+"\n\n");break;case"precode":r||(n=a.subParser("makeMarkdown.codeBlock")(e,t)+"\n\n");break;case"pre":r||(n=a.subParser("makeMarkdown.pre")(e,t)+"\n\n");break;case"table":r||(n=a.subParser("makeMarkdown.table")(e,t)+"\n\n");break;case"code":n=a.subParser("makeMarkdown.codeSpan")(e,t);break;case"em":case"i":n=a.subParser("makeMarkdown.emphasis")(e,t);break;case"strong":case"b":n=a.subParser("makeMarkdown.strong")(e,t);break;case"del":n=a.subParser("makeMarkdown.strikethrough")(e,t);break;case"a":n=a.subParser("makeMarkdown.links")(e,t);break;case"img":n=a.subParser("makeMarkdown.image")(e,t);break;default:n=e.outerHTML+"\n\n"}return n})),a.subParser("makeMarkdown.paragraph",(function(e,t){"use strict";var r="";if(e.hasChildNodes())for(var n=e.childNodes,o=n.length,i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t);return r=r.trim()})),a.subParser("makeMarkdown.pre",(function(e,t){"use strict";var r=e.getAttribute("prenum");return"<pre>"+t.preList[r]+"</pre>"})),a.subParser("makeMarkdown.strikethrough",(function(e,t){"use strict";var r="";if(e.hasChildNodes()){r+="~~";for(var n=e.childNodes,o=n.length,i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t);r+="~~"}return r})),a.subParser("makeMarkdown.strong",(function(e,t){"use strict";var r="";if(e.hasChildNodes()){r+="**";for(var n=e.childNodes,o=n.length,i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t);r+="**"}return r})),a.subParser("makeMarkdown.table",(function(e,t){"use strict";var r,n,o="",i=[[],[]],s=e.querySelectorAll("thead>tr>th"),c=e.querySelectorAll("tbody>tr");for(r=0;r<s.length;++r){var l=a.subParser("makeMarkdown.tableCell")(s[r],t),u="---";if(s[r].hasAttribute("style"))switch(s[r].getAttribute("style").toLowerCase().replace(/\s/g,"")){case"text-align:left;":u=":---";break;case"text-align:right;":u="---:";break;case"text-align:center;":u=":---:"}i[0][r]=l.trim(),i[1][r]=u}for(r=0;r<c.length;++r){var d=i.push([])-1,p=c[r].getElementsByTagName("td");for(n=0;n<s.length;++n){var h=" ";void 0!==p[n]&&(h=a.subParser("makeMarkdown.tableCell")(p[n],t)),i[d].push(h)}}var f=3;for(r=0;r<i.length;++r)for(n=0;n<i[r].length;++n){var g=i[r][n].length;g>f&&(f=g)}for(r=0;r<i.length;++r){for(n=0;n<i[r].length;++n)1===r?":"===i[r][n].slice(-1)?i[r][n]=a.helper.padEnd(i[r][n].slice(-1),f-1,"-")+":":i[r][n]=a.helper.padEnd(i[r][n],f,"-"):i[r][n]=a.helper.padEnd(i[r][n],f);o+="| "+i[r].join(" | ")+" |\n"}return o.trim()})),a.subParser("makeMarkdown.tableCell",(function(e,t){"use strict";var r="";if(!e.hasChildNodes())return"";for(var n=e.childNodes,o=n.length,i=0;i<o;++i)r+=a.subParser("makeMarkdown.node")(n[i],t,!0);return r.trim()})),a.subParser("makeMarkdown.txt",(function(e){"use strict";var t=e.nodeValue;return t=(t=t.replace(/ +/g," ")).replace(/¨NBSP;/g," "),t=(t=(t=(t=(t=(t=(t=(t=(t=a.helper.unescapeHTMLEntities(t)).replace(/([*_~|`])/g,"\\$1")).replace(/^(\s*)>/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")}));void 0===(n=function(){"use strict";return a}.call(t,r,t,e))||(e.exports=n)}).call(this)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{__EXPERIMENTAL_ELEMENTS:()=>X,__EXPERIMENTAL_PATHS_WITH_OVERRIDE:()=>J,__EXPERIMENTAL_STYLE_PROPERTY:()=>Z,__experimentalCloneSanitizedBlock:()=>_r,__experimentalGetAccessibleBlockLabel:()=>He,__experimentalGetBlockAttributesNamesByRole:()=>Ue,__experimentalGetBlockLabel:()=>Re,__experimentalSanitizeBlockAttributes:()=>$e,__unstableGetBlockProps:()=>Vr,__unstableGetInnerBlocksProps:()=>$r,__unstableSerializeAndClean:()=>Wr,children:()=>Gn,cloneBlock:()=>kr,createBlock:()=>mr,createBlocksFromInnerBlocksTemplate:()=>br,doBlocksMatchTemplate:()=>Yo,findTransform:()=>Er,getBlockAttributes:()=>Xn,getBlockContent:()=>qr,getBlockDefaultClassName:()=>zr,getBlockFromExample:()=>Nr,getBlockMenuDefaultClassName:()=>Ir,getBlockSupport:()=>we,getBlockTransforms:()=>Sr,getBlockType:()=>ke,getBlockTypes:()=>ye,getBlockVariations:()=>Ne,getCategories:()=>Go,getChildBlockNames:()=>xe,getDefaultBlockName:()=>_e,getFreeformContentHandlerName:()=>pe,getGroupingBlockName:()=>he,getPhrasingContentSchema:()=>vo,getPossibleBlockTransformations:()=>xr,getSaveContent:()=>Fr,getSaveElement:()=>Ur,getUnregisteredTypeHandlerName:()=>ge,hasBlockSupport:()=>ve,hasChildBlocks:()=>Ee,hasChildBlocksWithInserterSupport:()=>Se,isReusableBlock:()=>Te,isTemplatePart:()=>Ce,isUnmodifiedBlock:()=>Me,isUnmodifiedDefaultBlock:()=>je,isValidBlockContent:()=>Ln,isValidIcon:()=>De,node:()=>$n,normalizeIconObject:()=>ze,parse:()=>oo,parseWithAttributeSchema:()=>Zn,pasteHandler:()=>qo,rawHandler:()=>To,registerBlockCollection:()=>le,registerBlockStyle:()=>Be,registerBlockType:()=>se,registerBlockVariation:()=>Pe,serialize:()=>Yr,serializeRawBlock:()=>Dr,setCategories:()=>Ko,setDefaultBlockName:()=>me,setFreeformContentHandlerName:()=>de,setGroupingBlockName:()=>be,setUnregisteredTypeHandlerName:()=>fe,store:()=>cr,switchToBlockType:()=>Ar,synchronizeBlocksWithTemplate:()=>Qo,unregisterBlockStyle:()=>Ae,unregisterBlockType:()=>ue,unregisterBlockVariation:()=>Oe,unstable__bootstrapServerSideBlockDefinitions:()=>ae,updateCategory:()=>Wo,validateBlock:()=>On,withBlockContentContext:()=>Zo});var e={};r.r(e),r.d(e,{__experimentalHasContentRoleAttribute:()=>St,getActiveBlockVariation:()=>ht,getBlockStyles:()=>dt,getBlockSupport:()=>vt,getBlockType:()=>ut,getBlockTypes:()=>lt,getBlockVariations:()=>pt,getCategories:()=>gt,getChildBlockNames:()=>wt,getCollections:()=>mt,getDefaultBlockName:()=>bt,getDefaultBlockVariation:()=>ft,getFreeformFallbackBlockName:()=>_t,getGroupingBlockName:()=>yt,getUnregisteredFallbackBlockName:()=>kt,hasBlockSupport:()=>Tt,hasChildBlocks:()=>xt,hasChildBlocksWithInserterSupport:()=>Et,isMatchingSearchTerm:()=>Ct});var t={};r.r(t),r.d(t,{getAllBlockBindingsSources:()=>Lt,getBlockBindingsSource:()=>Mt,getBootstrappedBlockType:()=>Pt,getSupportedStyles:()=>Nt,getUnprocessedBlockTypes:()=>Ot});var o={};r.r(o),r.d(o,{__experimentalReapplyBlockFilters:()=>qt,addBlockCollection:()=>nr,addBlockStyles:()=>Kt,addBlockTypes:()=>Ut,addBlockVariations:()=>Yt,reapplyBlockTypeFilters:()=>Ft,removeBlockCollection:()=>or,removeBlockStyles:()=>Wt,removeBlockTypes:()=>Gt,removeBlockVariations:()=>Qt,setCategories:()=>tr,setDefaultBlockName:()=>Zt,setFreeformFallbackBlockName:()=>Xt,setGroupingBlockName:()=>er,setUnregisteredFallbackBlockName:()=>Jt,updateCategory:()=>rr});var a={};r.r(a),r.d(a,{addBootstrappedBlockType:()=>ar,addUnprocessedBlockType:()=>ir,registerBlockBindingsSource:()=>sr});const i=window.wp.data;var s=function(){return s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function c(e){return e.toLowerCase()}var l=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],u=/[^A-Z0-9]+/gi;function d(e,t,r){return t instanceof RegExp?e.replace(t,r):t.reduce((function(e,t){return e.replace(t,r)}),e)}function p(e,t){var r=e.charAt(0),n=e.substr(1).toLowerCase();return t>0&&r>="0"&&r<="9"?"_"+r+n:""+r.toUpperCase()+n}function h(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var r=t.splitRegexp,n=void 0===r?l:r,o=t.stripRegexp,a=void 0===o?u:o,i=t.transform,s=void 0===i?c:i,p=t.delimiter,h=void 0===p?" ":p,f=d(d(e,n,"$1\0$2"),a,"\0"),g=0,m=f.length;"\0"===f.charAt(g);)g++;for(;"\0"===f.charAt(m-1);)m--;return f.slice(g,m).split("\0").map(s).join(h)}(e,s({delimiter:"",transform:p},t))}function f(e,t){return 0===t?e.toLowerCase():p(e,t)}const g=window.wp.i18n;var m={grad:.9,turn:360,rad:360/(2*Math.PI)},b=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},_=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=Math.pow(10,t)),Math.round(r*e)/r+0},k=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),e>r?r:e>t?e:t},y=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},w=function(e){return{r:k(e.r,0,255),g:k(e.g,0,255),b:k(e.b,0,255),a:k(e.a)}},v=function(e){return{r:_(e.r),g:_(e.g),b:_(e.b),a:_(e.a,3)}},T=/^#([0-9a-f]{3,8})$/i,C=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},x=function(e){var t=e.r,r=e.g,n=e.b,o=e.a,a=Math.max(t,r,n),i=a-Math.min(t,r,n),s=i?a===t?(r-n)/i:a===r?2+(n-t)/i:4+(t-r)/i:0;return{h:60*(s<0?s+6:s),s:a?i/a*100:0,v:a/255*100,a:o}},E=function(e){var t=e.h,r=e.s,n=e.v,o=e.a;t=t/360*6,r/=100,n/=100;var a=Math.floor(t),i=n*(1-r),s=n*(1-(t-a)*r),c=n*(1-(1-t+a)*r),l=a%6;return{r:255*[n,s,i,i,c,n][l],g:255*[c,n,n,s,i,i][l],b:255*[i,i,c,n,n,s][l],a:o}},S=function(e){return{h:y(e.h),s:k(e.s,0,100),l:k(e.l,0,100),a:k(e.a)}},B=function(e){return{h:_(e.h),s:_(e.s),l:_(e.l),a:_(e.a,3)}},A=function(e){return E((r=(t=e).s,{h:t.h,s:(r*=((n=t.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:t.a}));var t,r,n},N=function(e){return{h:(t=x(e)).h,s:(o=(200-(r=t.s))*(n=t.v)/100)>0&&o<200?r*n/100/(o<=100?o:200-o)*100:0,l:o/2,a:t.a};var t,r,n,o},P=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,O=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,L=/^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,j={string:[[function(e){var t=T.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?_(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?_(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=L.exec(e)||M.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:w({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(e){var t=P.exec(e)||O.exec(e);if(!t)return null;var r,n,o=S({h:(r=t[1],n=t[2],void 0===n&&(n="deg"),Number(r)*(m[n]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return A(o)},"hsl"]],object:[[function(e){var t=e.r,r=e.g,n=e.b,o=e.a,a=void 0===o?1:o;return b(t)&&b(r)&&b(n)?w({r:Number(t),g:Number(r),b:Number(n),a:Number(a)}):null},"rgb"],[function(e){var t=e.h,r=e.s,n=e.l,o=e.a,a=void 0===o?1:o;if(!b(t)||!b(r)||!b(n))return null;var i=S({h:Number(t),s:Number(r),l:Number(n),a:Number(a)});return A(i)},"hsl"],[function(e){var t=e.h,r=e.s,n=e.v,o=e.a,a=void 0===o?1:o;if(!b(t)||!b(r)||!b(n))return null;var i=function(e){return{h:y(e.h),s:k(e.s,0,100),v:k(e.v,0,100),a:k(e.a)}}({h:Number(t),s:Number(r),v:Number(n),a:Number(a)});return E(i)},"hsv"]]},D=function(e,t){for(var r=0;r<t.length;r++){var n=t[r][0](e);if(n)return[n,t[r][1]]}return[null,void 0]},z=function(e){return"string"==typeof e?D(e.trim(),j.string):"object"==typeof e&&null!==e?D(e,j.object):[null,void 0]},I=function(e,t){var r=N(e);return{h:r.h,s:k(r.s+100*t,0,100),l:r.l,a:r.a}},R=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},H=function(e,t){var r=N(e);return{h:r.h,s:r.s,l:k(r.l+100*t,0,100),a:r.a}},V=function(){function e(e){this.parsed=z(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return null!==this.parsed},e.prototype.brightness=function(){return _(R(this.rgba),2)},e.prototype.isDark=function(){return R(this.rgba)<.5},e.prototype.isLight=function(){return R(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=v(this.rgba)).r,r=e.g,n=e.b,a=(o=e.a)<1?C(_(255*o)):"","#"+C(t)+C(r)+C(n)+a;var e,t,r,n,o,a},e.prototype.toRgb=function(){return v(this.rgba)},e.prototype.toRgbString=function(){return t=(e=v(this.rgba)).r,r=e.g,n=e.b,(o=e.a)<1?"rgba("+t+", "+r+", "+n+", "+o+")":"rgb("+t+", "+r+", "+n+")";var e,t,r,n,o},e.prototype.toHsl=function(){return B(N(this.rgba))},e.prototype.toHslString=function(){return t=(e=B(N(this.rgba))).h,r=e.s,n=e.l,(o=e.a)<1?"hsla("+t+", "+r+"%, "+n+"%, "+o+")":"hsl("+t+", "+r+"%, "+n+"%)";var e,t,r,n,o},e.prototype.toHsv=function(){return e=x(this.rgba),{h:_(e.h),s:_(e.s),v:_(e.v),a:_(e.a,3)};var e},e.prototype.invert=function(){return $({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),$(I(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),$(I(this.rgba,-e))},e.prototype.grayscale=function(){return $(I(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),$(H(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),$(H(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?$({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):_(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=N(this.rgba);return"number"==typeof e?$({h:e,s:t.s,l:t.l,a:t.a}):_(t.h)},e.prototype.isEqual=function(e){return this.toHex()===$(e).toHex()},e}(),$=function(e){return e instanceof V?e:new V(e)},U=[];var F=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},q=function(e){return.2126*F(e.r)+.7152*F(e.g)+.0722*F(e.b)};const G=window.wp.element,K=window.wp.dom,W=window.wp.richText,Y="block-default",Q=["attributes","supports","save","migrate","isEligible","apiVersion"],Z={"--wp--style--color--link":{value:["color","link"],support:["color","link"]},aspectRatio:{value:["dimensions","aspectRatio"],support:["dimensions","aspectRatio"],useEngine:!0},background:{value:["color","gradient"],support:["color","gradients"],useEngine:!0},backgroundColor:{value:["color","background"],support:["color","background"],requiresOptOut:!0,useEngine:!0},backgroundRepeat:{value:["background","backgroundRepeat"],support:["background","backgroundRepeat"],useEngine:!0},backgroundSize:{value:["background","backgroundSize"],support:["background","backgroundSize"],useEngine:!0},borderColor:{value:["border","color"],support:["__experimentalBorder","color"],useEngine:!0},borderRadius:{value:["border","radius"],support:["__experimentalBorder","radius"],properties:{borderTopLeftRadius:"topLeft",borderTopRightRadius:"topRight",borderBottomLeftRadius:"bottomLeft",borderBottomRightRadius:"bottomRight"},useEngine:!0},borderStyle:{value:["border","style"],support:["__experimentalBorder","style"],useEngine:!0},borderWidth:{value:["border","width"],support:["__experimentalBorder","width"],useEngine:!0},borderTopColor:{value:["border","top","color"],support:["__experimentalBorder","color"],useEngine:!0},borderTopStyle:{value:["border","top","style"],support:["__experimentalBorder","style"],useEngine:!0},borderTopWidth:{value:["border","top","width"],support:["__experimentalBorder","width"],useEngine:!0},borderRightColor:{value:["border","right","color"],support:["__experimentalBorder","color"],useEngine:!0},borderRightStyle:{value:["border","right","style"],support:["__experimentalBorder","style"],useEngine:!0},borderRightWidth:{value:["border","right","width"],support:["__experimentalBorder","width"],useEngine:!0},borderBottomColor:{value:["border","bottom","color"],support:["__experimentalBorder","color"],useEngine:!0},borderBottomStyle:{value:["border","bottom","style"],support:["__experimentalBorder","style"],useEngine:!0},borderBottomWidth:{value:["border","bottom","width"],support:["__experimentalBorder","width"],useEngine:!0},borderLeftColor:{value:["border","left","color"],support:["__experimentalBorder","color"],useEngine:!0},borderLeftStyle:{value:["border","left","style"],support:["__experimentalBorder","style"],useEngine:!0},borderLeftWidth:{value:["border","left","width"],support:["__experimentalBorder","width"],useEngine:!0},color:{value:["color","text"],support:["color","text"],requiresOptOut:!0,useEngine:!0},columnCount:{value:["typography","textColumns"],support:["typography","textColumns"],useEngine:!0},filter:{value:["filter","duotone"],support:["filter","duotone"]},linkColor:{value:["elements","link","color","text"],support:["color","link"]},captionColor:{value:["elements","caption","color","text"],support:["color","caption"]},buttonColor:{value:["elements","button","color","text"],support:["color","button"]},buttonBackgroundColor:{value:["elements","button","color","background"],support:["color","button"]},headingColor:{value:["elements","heading","color","text"],support:["color","heading"]},headingBackgroundColor:{value:["elements","heading","color","background"],support:["color","heading"]},fontFamily:{value:["typography","fontFamily"],support:["typography","__experimentalFontFamily"],useEngine:!0},fontSize:{value:["typography","fontSize"],support:["typography","fontSize"],useEngine:!0},fontStyle:{value:["typography","fontStyle"],support:["typography","__experimentalFontStyle"],useEngine:!0},fontWeight:{value:["typography","fontWeight"],support:["typography","__experimentalFontWeight"],useEngine:!0},lineHeight:{value:["typography","lineHeight"],support:["typography","lineHeight"],useEngine:!0},margin:{value:["spacing","margin"],support:["spacing","margin"],properties:{marginTop:"top",marginRight:"right",marginBottom:"bottom",marginLeft:"left"},useEngine:!0},minHeight:{value:["dimensions","minHeight"],support:["dimensions","minHeight"],useEngine:!0},padding:{value:["spacing","padding"],support:["spacing","padding"],properties:{paddingTop:"top",paddingRight:"right",paddingBottom:"bottom",paddingLeft:"left"},useEngine:!0},textDecoration:{value:["typography","textDecoration"],support:["typography","__experimentalTextDecoration"],useEngine:!0},textTransform:{value:["typography","textTransform"],support:["typography","__experimentalTextTransform"],useEngine:!0},letterSpacing:{value:["typography","letterSpacing"],support:["typography","__experimentalLetterSpacing"],useEngine:!0},writingMode:{value:["typography","writingMode"],support:["typography","__experimentalWritingMode"],useEngine:!0},"--wp--style--root--padding":{value:["spacing","padding"],support:["spacing","padding"],properties:{"--wp--style--root--padding-top":"top","--wp--style--root--padding-right":"right","--wp--style--root--padding-bottom":"bottom","--wp--style--root--padding-left":"left"},rootOnly:!0}},X={link:"a",heading:"h1, h2, h3, h4, h5, h6",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",button:".wp-element-button, .wp-block-button__link",caption:".wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption",cite:"cite"},J={"color.duotone":!0,"color.gradients":!0,"color.palette":!0,"typography.fontSizes":!0,"spacing.spacingSizes":!0},ee=window.wp.privateApis,{lock:te,unlock:re}=(0,ee.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/blocks"),ne={title:"block title",description:"block description",keywords:["block keyword"],styles:[{label:"block style label"}],variations:[{title:"block variation title",description:"block variation description",keywords:["block variation keyword"]}]};function oe(e){return null!==e&&"object"==typeof e}function ae(e){const{addBootstrappedBlockType:t}=re((0,i.dispatch)(cr));for(const[r,n]of Object.entries(e))t(r,n)}function ie({textdomain:e,...t}){const r=["apiVersion","title","category","parent","ancestor","icon","description","keywords","attributes","providesContext","usesContext","selectors","supports","styles","example","variations","blockHooks","allowedBlocks"],n=Object.fromEntries(Object.entries(t).filter((([e])=>r.includes(e))));return e&&Object.keys(ne).forEach((t=>{n[t]&&(n[t]=ce(ne[t],n[t],e))})),n}function se(e,t){const r=oe(e)?e.name:e;if("string"!=typeof r)return void console.error("Block names must be strings.");if(!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(r))return void console.error("Block names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-block");if((0,i.select)(cr).getBlockType(r))return void console.error('Block "'+r+'" is already registered.');const{addBootstrappedBlockType:n,addUnprocessedBlockType:o}=re((0,i.dispatch)(cr));if(oe(e)){n(r,ie(e))}return o(r,t),(0,i.select)(cr).getBlockType(r)}function ce(e,t,r){return"string"==typeof e&&"string"==typeof t?(0,g._x)(t,e,r):Array.isArray(e)&&e.length&&Array.isArray(t)?t.map((t=>ce(e[0],t,r))):oe(e)&&Object.entries(e).length&&oe(t)?Object.keys(t).reduce(((n,o)=>e[o]?(n[o]=ce(e[o],t[o],r),n):(n[o]=t[o],n)),{}):t}function le(e,{title:t,icon:r}){(0,i.dispatch)(cr).addBlockCollection(e,t,r)}function ue(e){const t=(0,i.select)(cr).getBlockType(e);if(t)return(0,i.dispatch)(cr).removeBlockTypes(e),t;console.error('Block "'+e+'" is not registered.')}function de(e){(0,i.dispatch)(cr).setFreeformFallbackBlockName(e)}function pe(){return(0,i.select)(cr).getFreeformFallbackBlockName()}function he(){return(0,i.select)(cr).getGroupingBlockName()}function fe(e){(0,i.dispatch)(cr).setUnregisteredFallbackBlockName(e)}function ge(){return(0,i.select)(cr).getUnregisteredFallbackBlockName()}function me(e){(0,i.dispatch)(cr).setDefaultBlockName(e)}function be(e){(0,i.dispatch)(cr).setGroupingBlockName(e)}function _e(){return(0,i.select)(cr).getDefaultBlockName()}function ke(e){return(0,i.select)(cr)?.getBlockType(e)}function ye(){return(0,i.select)(cr).getBlockTypes()}function we(e,t,r){return(0,i.select)(cr).getBlockSupport(e,t,r)}function ve(e,t,r){return(0,i.select)(cr).hasBlockSupport(e,t,r)}function Te(e){return"core/block"===e?.name}function Ce(e){return"core/template-part"===e?.name}const xe=e=>(0,i.select)(cr).getChildBlockNames(e),Ee=e=>(0,i.select)(cr).hasChildBlocks(e),Se=e=>(0,i.select)(cr).hasChildBlocksWithInserterSupport(e),Be=(e,t)=>{(0,i.dispatch)(cr).addBlockStyles(e,t)},Ae=(e,t)=>{(0,i.dispatch)(cr).removeBlockStyles(e,t)},Ne=(e,t)=>(0,i.select)(cr).getBlockVariations(e,t),Pe=(e,t)=>{(0,i.dispatch)(cr).addBlockVariations(e,t)},Oe=(e,t)=>{(0,i.dispatch)(cr).removeBlockVariations(e,t)};!function(e){e.forEach((function(e){U.indexOf(e)<0&&(e(V,j),U.push(e))}))}([function(e,t){var r={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"},n={};for(var o in r)n[r[o]]=o;var a={};e.prototype.toName=function(t){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,i,s=n[this.toHex()];if(s)return s;if(null==t?void 0:t.closest){var c=this.toRgb(),l=1/0,u="black";if(!a.length)for(var d in r)a[d]=new e(r[d]).toRgb();for(var p in r){var h=(o=c,i=a[p],Math.pow(o.r-i.r,2)+Math.pow(o.g-i.g,2)+Math.pow(o.b-i.b,2));h<l&&(l=h,u=p)}return u}},t.string.push([function(t){var n=t.toLowerCase(),o="transparent"===n?"#0000":r[n];return o?new e(o).toRgb():null},"name"])},function(e){e.prototype.luminance=function(){return e=q(this.rgba),void 0===(t=2)&&(t=0),void 0===r&&(r=Math.pow(10,t)),Math.round(r*e)/r+0;var e,t,r},e.prototype.contrast=function(t){void 0===t&&(t="#FFF");var r,n,o,a,i,s,c,l=t instanceof e?t:new e(t);return a=this.rgba,i=l.toRgb(),r=(s=q(a))>(c=q(i))?(s+.05)/(c+.05):(c+.05)/(s+.05),void 0===(n=2)&&(n=0),void 0===o&&(o=Math.pow(10,n)),Math.floor(o*r)/o+0},e.prototype.isReadable=function(e,t){return void 0===e&&(e="#FFF"),void 0===t&&(t={}),this.contrast(e)>=(i=void 0===(a=(r=t).size)?"normal":a,"AAA"===(o=void 0===(n=r.level)?"AA":n)&&"normal"===i?7:"AA"===o&&"large"===i?3:4.5);var r,n,o,a,i}}]);const Le=["#191e23","#f8f9f9"];function Me(e){var t;return Object.entries(null!==(t=ke(e.name)?.attributes)&&void 0!==t?t:{}).every((([t,r])=>{const n=e.attributes[t];return r.hasOwnProperty("default")?n===r.default:"rich-text"===r.type?!n?.length:void 0===n}))}function je(e){return e.name===_e()&&Me(e)}function De(e){return!!e&&("string"==typeof e||(0,G.isValidElement)(e)||"function"==typeof e||e instanceof G.Component)}function ze(e){if(De(e=e||Y))return{src:e};if("background"in e){const t=$(e.background),r=e=>t.contrast(e),n=Math.max(...Le.map(r));return{...e,foreground:e.foreground?e.foreground:Le.find((e=>r(e)===n)),shadowColor:t.alpha(.3).toRgbString()}}return e}function Ie(e){return"string"==typeof e?ke(e):e}function Re(e,t,r="visual"){const{__experimentalLabel:n,title:o}=e,a=n&&n(t,{context:r});return a?(0,K.__unstableStripHTML)(a):o}function He(e,t,r,n="vertical"){const o=e?.title,a=e?Re(e,t,"accessibility"):"",i=void 0!==r,s=a&&a!==o;return i&&"vertical"===n?s?(0,g.sprintf)((0,g.__)("%1$s Block. Row %2$d. %3$s"),o,r,a):(0,g.sprintf)((0,g.__)("%1$s Block. Row %2$d"),o,r):i&&"horizontal"===n?s?(0,g.sprintf)((0,g.__)("%1$s Block. Column %2$d. %3$s"),o,r,a):(0,g.sprintf)((0,g.__)("%1$s Block. Column %2$d"),o,r):s?(0,g.sprintf)((0,g.__)("%1$s Block. %2$s"),o,a):(0,g.sprintf)((0,g.__)("%s Block"),o)}function Ve(e){return void 0!==e.default?e.default:"rich-text"===e.type?new W.RichTextData:void 0}function $e(e,t){const r=ke(e);if(void 0===r)throw new Error(`Block type '${e}' is not registered.`);return Object.entries(r.attributes).reduce(((e,[r,n])=>{const o=t[r];if(void 0!==o)"rich-text"===n.type?o instanceof W.RichTextData?e[r]=o:"string"==typeof o&&(e[r]=W.RichTextData.fromHTMLString(o)):"string"===n.type&&o instanceof W.RichTextData?e[r]=o.toHTMLString():e[r]=o;else{const t=Ve(n);void 0!==t&&(e[r]=t)}return-1!==["node","children"].indexOf(n.source)&&("string"==typeof e[r]?e[r]=[e[r]]:Array.isArray(e[r])||(e[r]=[])),e}),{})}function Ue(e,t){const r=ke(e)?.attributes;if(!r)return[];const n=Object.keys(r);return t?n.filter((e=>r[e]?.__experimentalRole===t)):n}function Fe(e,t){return Object.fromEntries(Object.entries(e).filter((([e])=>!t.includes(e))))}const qe=[{slug:"text",title:(0,g.__)("Text")},{slug:"media",title:(0,g.__)("Media")},{slug:"design",title:(0,g.__)("Design")},{slug:"widgets",title:(0,g.__)("Widgets")},{slug:"theme",title:(0,g.__)("Theme")},{slug:"embed",title:(0,g.__)("Embeds")},{slug:"reusable",title:(0,g.__)("Reusable blocks")}];function Ge(e){return e.reduce(((e,t)=>({...e,[t.name]:t})),{})}function Ke(e){return e.reduce(((e,t)=>(e.some((e=>e.name===t.name))||e.push(t),e)),[])}function We(e){return(t=null,r)=>{switch(r.type){case"REMOVE_BLOCK_TYPES":return-1!==r.names.indexOf(t)?null:t;case e:return r.name||null}return t}}const Ye=We("SET_DEFAULT_BLOCK_NAME"),Qe=We("SET_FREEFORM_FALLBACK_BLOCK_NAME"),Ze=We("SET_UNREGISTERED_FALLBACK_BLOCK_NAME"),Xe=We("SET_GROUPING_BLOCK_NAME");const Je=(0,i.combineReducers)({bootstrappedBlockTypes:function(e={},t){switch(t.type){case"ADD_BOOTSTRAPPED_BLOCK_TYPE":const{name:r,blockType:n}=t,o=e[r];let a;return o?(void 0===o.selectors&&n.selectors&&(a={...o,selectors:n.selectors}),void 0===o.blockHooks&&n.blockHooks&&(a={...o,...a,blockHooks:n.blockHooks}),void 0===o.allowedBlocks&&n.allowedBlocks&&(a={...o,...a,allowedBlocks:n.allowedBlocks})):(a=Object.fromEntries(Object.entries(n).filter((([,e])=>null!=e)).map((([e,t])=>{return[(r=e,void 0===n&&(n={}),h(r,s({transform:f},n))),t];var r,n}))),a.name=r),a?{...e,[r]:a}:e;case"REMOVE_BLOCK_TYPES":return Fe(e,t.names)}return e},unprocessedBlockTypes:function(e={},t){switch(t.type){case"ADD_UNPROCESSED_BLOCK_TYPE":return{...e,[t.name]:t.blockType};case"REMOVE_BLOCK_TYPES":return Fe(e,t.names)}return e},blockTypes:function(e={},t){switch(t.type){case"ADD_BLOCK_TYPES":return{...e,...Ge(t.blockTypes)};case"REMOVE_BLOCK_TYPES":return Fe(e,t.names)}return e},blockStyles:function(e={},t){var r,n;switch(t.type){case"ADD_BLOCK_TYPES":return{...e,...Object.fromEntries(Object.entries(Ge(t.blockTypes)).map((([t,r])=>{var n,o;return[t,Ke([...(null!==(n=r.styles)&&void 0!==n?n:[]).map((e=>({...e,source:"block"}))),...(null!==(o=e[r.name])&&void 0!==o?o:[]).filter((({source:e})=>"block"!==e))])]})))};case"ADD_BLOCK_STYLES":return{...e,[t.blockName]:Ke([...null!==(r=e[t.blockName])&&void 0!==r?r:[],...t.styles])};case"REMOVE_BLOCK_STYLES":return{...e,[t.blockName]:(null!==(n=e[t.blockName])&&void 0!==n?n:[]).filter((e=>-1===t.styleNames.indexOf(e.name)))}}return e},blockVariations:function(e={},t){var r,n;switch(t.type){case"ADD_BLOCK_TYPES":return{...e,...Object.fromEntries(Object.entries(Ge(t.blockTypes)).map((([t,r])=>{var n,o;return[t,Ke([...(null!==(n=r.variations)&&void 0!==n?n:[]).map((e=>({...e,source:"block"}))),...(null!==(o=e[r.name])&&void 0!==o?o:[]).filter((({source:e})=>"block"!==e))])]})))};case"ADD_BLOCK_VARIATIONS":return{...e,[t.blockName]:Ke([...null!==(r=e[t.blockName])&&void 0!==r?r:[],...t.variations])};case"REMOVE_BLOCK_VARIATIONS":return{...e,[t.blockName]:(null!==(n=e[t.blockName])&&void 0!==n?n:[]).filter((e=>-1===t.variationNames.indexOf(e.name)))}}return e},defaultBlockName:Ye,freeformFallbackBlockName:Qe,unregisteredFallbackBlockName:Ze,groupingBlockName:Xe,categories:function(e=qe,t){switch(t.type){case"SET_CATEGORIES":return t.categories||[];case"UPDATE_CATEGORY":if(!t.category||!Object.keys(t.category).length)return e;if(e.find((({slug:e})=>e===t.slug)))return e.map((e=>e.slug===t.slug?{...e,...t.category}:e))}return e},collections:function(e={},t){switch(t.type){case"ADD_BLOCK_COLLECTION":return{...e,[t.namespace]:{title:t.title,icon:t.icon}};case"REMOVE_BLOCK_COLLECTION":return Fe(e,t.namespace)}return e},blockBindingsSources:function(e={},t){var r;return"REGISTER_BLOCK_BINDINGS_SOURCE"===t.type?{...e,[t.sourceName]:{label:t.sourceLabel,useSource:t.useSource,lockAttributesEditing:null===(r=t.lockAttributesEditing)||void 0===r||r}}:e}});var et={};function tt(e){return[e]}function rt(e,t,r){var n;if(e.length!==t.length)return!1;for(n=r;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function nt(e,t){var r,n=t||tt;function o(){r=new WeakMap}function a(){var t,o,a,i,s,c=arguments.length;for(i=new Array(c),a=0;a<c;a++)i[a]=arguments[a];for(t=function(e){var t,n,o,a,i,s=r,c=!0;for(t=0;t<e.length;t++){if(!(i=n=e[t])||"object"!=typeof i){c=!1;break}s.has(n)?s=s.get(n):(o=new WeakMap,s.set(n,o),s=o)}return s.has(et)||((a=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=c,s.set(et,a)),s.get(et)}(s=n.apply(null,i)),t.isUniqueByDependants||(t.lastDependants&&!rt(s,t.lastDependants,0)&&t.clear(),t.lastDependants=s),o=t.head;o;){if(rt(o.args,i,1))return o!==t.head&&(o.prev.next=o.next,o.next&&(o.next.prev=o.prev),o.next=t.head,o.prev=null,t.head.prev=o,t.head=o),o.val;o=o.next}return o={val:e.apply(null,i)},i[0]=null,o.args=i,t.head&&(t.head.prev=o,o.next=t.head),t.head=o,o.val}return a.getDependants=n,a.clear=o,o(),a}var ot=r(9681),at=r.n(ot);const it=window.wp.compose,st=(e,t,r)=>{var n;const o=Array.isArray(t)?t:t.split(".");let a=e;return o.forEach((e=>{a=a?.[e]})),null!==(n=a)&&void 0!==n?n:r},ct=(e,t)=>"string"==typeof t?ut(e,t):t,lt=nt((e=>Object.values(e.blockTypes)),(e=>[e.blockTypes]));function ut(e,t){return e.blockTypes[t]}function dt(e,t){return e.blockStyles[t]}const pt=nt(((e,t,r)=>{const n=e.blockVariations[t];return n&&r?n.filter((e=>(e.scope||["block","inserter"]).includes(r))):n}),((e,t)=>[e.blockVariations[t]]));function ht(e,t,r,n){const o=pt(e,t,n),a=o?.find((n=>{if(Array.isArray(n.isActive)){const o=ut(e,t),a=Object.keys(o?.attributes||{}),i=n.isActive.filter((e=>a.includes(e)));return 0!==i.length&&i.every((e=>r[e]===n.attributes[e]))}return n.isActive?.(r,n.attributes)}));return a}function ft(e,t,r){const n=pt(e,t,r);return[...n].reverse().find((({isDefault:e})=>!!e))||n[0]}function gt(e){return e.categories}function mt(e){return e.collections}function bt(e){return e.defaultBlockName}function _t(e){return e.freeformFallbackBlockName}function kt(e){return e.unregisteredFallbackBlockName}function yt(e){return e.groupingBlockName}const wt=nt(((e,t)=>lt(e).filter((e=>e.parent?.includes(t))).map((({name:e})=>e))),(e=>[e.blockTypes])),vt=(e,t,r,n)=>{const o=ct(e,t);return o?.supports?st(o.supports,r,n):n};function Tt(e,t,r,n){return!!vt(e,t,r,n)}function Ct(e,t,r){const n=ct(e,t),o=(0,it.pipe)([e=>at()(null!=e?e:""),e=>e.toLowerCase(),e=>e.trim()]),a=o(r),i=(0,it.pipe)([o,e=>e.includes(a)]);return i(n.title)||n.keywords?.some(i)||i(n.category)||"string"==typeof n.description&&i(n.description)}const xt=(e,t)=>wt(e,t).length>0,Et=(e,t)=>wt(e,t).some((t=>Tt(e,t,"inserter",!0))),St=nt(((e,t)=>{const r=ut(e,t);return!!r&&Object.entries(r.attributes).some((([,{__experimentalRole:e}])=>"content"===e))}),((e,t)=>[e.blockTypes[t]?.attributes])),Bt=["background","backgroundColor","color","linkColor","captionColor","buttonColor","headingColor","fontFamily","fontSize","fontStyle","fontWeight","lineHeight","padding","contentSize","wideSize","blockGap","textDecoration","textTransform","letterSpacing"];function At(e,t,r){return e.filter((e=>("fontSize"!==e||"heading"!==r)&&(!("textDecoration"===e&&!t&&"link"!==r)&&(!("textTransform"===e&&!t&&!["heading","h1","h2","h3","h4","h5","h6"].includes(r)&&"button"!==r&&"caption"!==r&&"text"!==r)&&(!("letterSpacing"===e&&!t&&!["heading","h1","h2","h3","h4","h5","h6"].includes(r)&&"button"!==r&&"caption"!==r&&"text"!==r)&&!("textColumns"===e&&!t))))))}const Nt=nt(((e,t,r)=>{if(!t)return At(Bt,t,r);const n=ut(e,t);if(!n)return[];const o=[];return n?.supports?.spacing?.blockGap&&o.push("blockGap"),n?.supports?.shadow&&o.push("shadow"),Object.keys(Z).forEach((e=>{Z[e].support&&(Z[e].requiresOptOut&&Z[e].support[0]in n.supports&&!1!==st(n.supports,Z[e].support)||st(n.supports,Z[e].support,!1))&&o.push(e)})),At(o,t,r)}),((e,t)=>[e.blockTypes[t]]));function Pt(e,t){return e.bootstrappedBlockTypes[t]}function Ot(e){return e.unprocessedBlockTypes}function Lt(e){return e.blockBindingsSources}function Mt(e,t){return e.blockBindingsSources[t]}const jt=window.wp.deprecated;var Dt=r.n(jt);
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function zt(e){return"[object Object]"===Object.prototype.toString.call(e)}var It=r(8529);const Rt=window.wp.hooks,Ht=(...e)=>window?.console?.error?.(...e),Vt={common:"text",formatting:"text",layout:"design"},$t=(e,t)=>({select:r})=>{const n={name:e,icon:Y,keywords:[],attributes:{},providesContext:{},usesContext:[],selectors:{},supports:{},styles:[],variations:[],blockHooks:{},save:()=>null,...r.getBootstrappedBlockType(e),...t},o=(0,Rt.applyFilters)("blocks.registerBlockType",n,e,null);if(o.description&&"string"!=typeof o.description&&Dt()("Declaring non-string block descriptions",{since:"6.2"}),o.deprecated&&(o.deprecated=o.deprecated.map((e=>Object.fromEntries(Object.entries((0,Rt.applyFilters)("blocks.registerBlockType",{...Fe(n,Q),...e},n.name,e)).filter((([e])=>Q.includes(e))))))),function(e){var t,r;return!1!==zt(e)&&(void 0===(t=e.constructor)||!1!==zt(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf"))}(o))if("function"==typeof o.save)if(!("edit"in o)||(0,It.isValidElementType)(o.edit))if(Vt.hasOwnProperty(o.category)&&(o.category=Vt[o.category]),"category"in o&&!r.getCategories().some((({slug:e})=>e===o.category))&&(((...e)=>{window?.console?.warn?.(...e)})('The block "'+e+'" is registered with an invalid category "'+o.category+'".'),delete o.category),"title"in o&&""!==o.title)if("string"==typeof o.title){if(o.icon=ze(o.icon),De(o.icon.src))return o;Ht("The icon passed is invalid. The icon should be a string, an element, a function, or an object following the specifications documented in https://developer.wordpress.org/block-editor/developers/block-api/block-registration/#icon-optional")}else Ht("Block titles must be strings.");else Ht('The block "'+e+'" must have a title.');else Ht('The "edit" property must be a valid component.');else Ht('The "save" property must be a valid function.');else Ht("Block settings must be a valid object.")};function Ut(e){return{type:"ADD_BLOCK_TYPES",blockTypes:Array.isArray(e)?e:[e]}}function Ft(){return({dispatch:e,select:t})=>{const r=[];for(const[n,o]of Object.entries(t.getUnprocessedBlockTypes())){const t=e($t(n,o));t&&r.push(t)}r.length&&e.addBlockTypes(r)}}function qt(){return Dt()('wp.data.dispatch( "core/blocks" ).__experimentalReapplyBlockFilters',{since:"6.4",alternative:"reapplyBlockFilters"}),Ft()}function Gt(e){return{type:"REMOVE_BLOCK_TYPES",names:Array.isArray(e)?e:[e]}}function Kt(e,t){return{type:"ADD_BLOCK_STYLES",styles:Array.isArray(t)?t:[t],blockName:e}}function Wt(e,t){return{type:"REMOVE_BLOCK_STYLES",styleNames:Array.isArray(t)?t:[t],blockName:e}}function Yt(e,t){return{type:"ADD_BLOCK_VARIATIONS",variations:Array.isArray(t)?t:[t],blockName:e}}function Qt(e,t){return{type:"REMOVE_BLOCK_VARIATIONS",variationNames:Array.isArray(t)?t:[t],blockName:e}}function Zt(e){return{type:"SET_DEFAULT_BLOCK_NAME",name:e}}function Xt(e){return{type:"SET_FREEFORM_FALLBACK_BLOCK_NAME",name:e}}function Jt(e){return{type:"SET_UNREGISTERED_FALLBACK_BLOCK_NAME",name:e}}function er(e){return{type:"SET_GROUPING_BLOCK_NAME",name:e}}function tr(e){return{type:"SET_CATEGORIES",categories:e}}function rr(e,t){return{type:"UPDATE_CATEGORY",slug:e,category:t}}function nr(e,t,r){return{type:"ADD_BLOCK_COLLECTION",namespace:e,title:t,icon:r}}function or(e){return{type:"REMOVE_BLOCK_COLLECTION",namespace:e}}function ar(e,t){return{type:"ADD_BOOTSTRAPPED_BLOCK_TYPE",name:e,blockType:t}}function ir(e,t){return({dispatch:r})=>{r({type:"ADD_UNPROCESSED_BLOCK_TYPE",name:e,blockType:t});const n=r($t(e,t));n&&r.addBlockTypes(n)}}function sr(e){return{type:"REGISTER_BLOCK_BINDINGS_SOURCE",sourceName:e.name,sourceLabel:e.label,useSource:e.useSource,lockAttributesEditing:e.lockAttributesEditing}}const cr=(0,i.createReduxStore)("core/blocks",{reducer:Je,selectors:e,actions:o});(0,i.register)(cr),re(cr).registerPrivateSelectors(t),re(cr).registerPrivateActions(a);const lr={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let ur;const dr=new Uint8Array(16);function pr(){if(!ur&&(ur="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ur))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ur(dr)}const hr=[];for(let e=0;e<256;++e)hr.push((e+256).toString(16).slice(1));function fr(e,t=0){return hr[e[t+0]]+hr[e[t+1]]+hr[e[t+2]]+hr[e[t+3]]+"-"+hr[e[t+4]]+hr[e[t+5]]+"-"+hr[e[t+6]]+hr[e[t+7]]+"-"+hr[e[t+8]]+hr[e[t+9]]+"-"+hr[e[t+10]]+hr[e[t+11]]+hr[e[t+12]]+hr[e[t+13]]+hr[e[t+14]]+hr[e[t+15]]}const gr=function(e,t,r){if(lr.randomUUID&&!t&&!e)return lr.randomUUID();const n=(e=e||{}).random||(e.rng||pr)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return fr(n)};function mr(e,t={},r=[]){const n=$e(e,t);return{clientId:gr(),name:e,isValid:!0,attributes:n,innerBlocks:r}}function br(e=[]){return e.map((e=>{const t=Array.isArray(e)?e:[e.name,e.attributes,e.innerBlocks],[r,n,o=[]]=t;return mr(r,n,br(o))}))}function _r(e,t={},r){const n=gr(),o=$e(e.name,{...e.attributes,...t});return{...e,clientId:n,attributes:o,innerBlocks:r||e.innerBlocks.map((e=>_r(e)))}}function kr(e,t={},r){const n=gr();return{...e,clientId:n,attributes:{...e.attributes,...t},innerBlocks:r||e.innerBlocks.map((e=>kr(e)))}}const yr=(e,t,r)=>{if(!r.length)return!1;const n=r.length>1,o=r[0].name;if(!(Tr(e)||!n||e.isMultiBlock))return!1;if(!Tr(e)&&!r.every((e=>e.name===o)))return!1;if(!("block"===e.type))return!1;const a=r[0];return!("from"===t&&-1===e.blocks.indexOf(a.name)&&!Tr(e))&&(!(!n&&"from"===t&&Cr(a.name)&&Cr(e.blockName))&&!!Br(e,r))},wr=e=>{if(!e.length)return[];return ye().filter((t=>!!Er(Sr("from",t.name),(t=>yr(t,"from",e)))))},vr=e=>{if(!e.length)return[];const t=ke(e[0].name);return(t?Sr("to",t.name):[]).filter((t=>t&&yr(t,"to",e))).map((e=>e.blocks)).flat().map(ke)},Tr=e=>e&&"block"===e.type&&Array.isArray(e.blocks)&&e.blocks.includes("*"),Cr=e=>e===he();function xr(e){if(!e.length)return[];const t=wr(e),r=vr(e);return[...new Set([...t,...r])]}function Er(e,t){const r=(0,Rt.createHooks)();for(let n=0;n<e.length;n++){const o=e[n];t(o)&&r.addFilter("transform","transform/"+n.toString(),(e=>e||o),o.priority)}return r.applyFilters("transform",null)}function Sr(e,t){if(void 0===t)return ye().map((({name:t})=>Sr(e,t))).flat();const r=Ie(t),{name:n,transforms:o}=r||{};if(!o||!Array.isArray(o[e]))return[];const a=o.supportedMobileTransforms&&Array.isArray(o.supportedMobileTransforms),i=a?o[e].filter((e=>"raw"===e.type||!(!e.blocks||!e.blocks.length)&&(!!Tr(e)||e.blocks.every((e=>o.supportedMobileTransforms.includes(e)))))):o[e];return i.map((e=>({...e,blockName:n,usingMobileTransformations:a})))}function Br(e,t){if("function"!=typeof e.isMatch)return!0;const r=t[0],n=e.isMultiBlock?t.map((e=>e.attributes)):r.attributes,o=e.isMultiBlock?t:r;return e.isMatch(n,o)}function Ar(e,t){const r=Array.isArray(e)?e:[e],n=r.length>1,o=r[0],a=o.name,i=Sr("from",t),s=Er(Sr("to",a),(e=>"block"===e.type&&(Tr(e)||-1!==e.blocks.indexOf(t))&&(!n||e.isMultiBlock)&&Br(e,r)))||Er(i,(e=>"block"===e.type&&(Tr(e)||-1!==e.blocks.indexOf(a))&&(!n||e.isMultiBlock)&&Br(e,r)));if(!s)return null;let c;if(c=s.isMultiBlock?"__experimentalConvert"in s?s.__experimentalConvert(r):s.transform(r.map((e=>e.attributes)),r.map((e=>e.innerBlocks))):"__experimentalConvert"in s?s.__experimentalConvert(o):s.transform(o.attributes,o.innerBlocks),null===c||"object"!=typeof c)return null;if(c=Array.isArray(c)?c:[c],c.some((e=>!ke(e.name))))return null;if(!c.some((e=>e.name===t)))return null;return c.map(((t,r,n)=>(0,Rt.applyFilters)("blocks.switchToBlockType.transformedBlock",t,e,r,n)))}const Nr=(e,t)=>{try{var r;return mr(e,t.attributes,(null!==(r=t.innerBlocks)&&void 0!==r?r:[]).map((e=>Nr(e.name,e))))}catch{return mr("core/missing",{originalName:e,originalContent:"",originalUndelimitedContent:""})}},Pr=window.wp.blockSerializationDefaultParser,Or=window.wp.autop,Lr=window.React,Mr=window.wp.isShallowEqual;var jr=r.n(Mr);function Dr(e,t={}){const{isCommentDelimited:r=!0}=t,{blockName:n,attrs:o={},innerBlocks:a=[],innerContent:i=[]}=e;let s=0;const c=i.map((e=>null!==e?e:Dr(a[s++],t))).join("\n").replace(/\n+/g,"\n").trim();return r?Gr(n,o,c):c}function zr(e){const t="wp-block-"+e.replace(/\//,"-").replace(/^core-/,"");return(0,Rt.applyFilters)("blocks.getBlockDefaultClassName",t,e)}function Ir(e){const t="editor-block-list-item-"+e.replace(/\//,"-").replace(/^core-/,"");return(0,Rt.applyFilters)("blocks.getBlockMenuDefaultClassName",t,e)}const Rr={},Hr={};function Vr(e={}){const{blockType:t,attributes:r}=Rr;return Vr.skipFilters?e:(0,Rt.applyFilters)("blocks.getSaveContent.extraProps",{...e},t,r)}function $r(e={}){const{innerBlocks:t}=Hr;if(!Array.isArray(t))return{...e,children:t};const r=Yr(t,{isInnerBlocks:!0}),n=(0,Lr.createElement)(G.RawHTML,null,r);return{...e,children:n}}function Ur(e,t,r=[]){const n=Ie(e);if(!n?.save)return null;let{save:o}=n;if(o.prototype instanceof G.Component){const e=new o({attributes:t});o=e.render.bind(e)}Rr.blockType=n,Rr.attributes=t,Hr.innerBlocks=r;let a=o({attributes:t,innerBlocks:r});if(null!==a&&"object"==typeof a&&(0,Rt.hasFilter)("blocks.getSaveContent.extraProps")&&!(n.apiVersion>1)){const e=(0,Rt.applyFilters)("blocks.getSaveContent.extraProps",{...a.props},n,t);jr()(e,a.props)||(a=(0,G.cloneElement)(a,e))}return(0,Rt.applyFilters)("blocks.getSaveElement",a,n,t)}function Fr(e,t,r){const n=Ie(e);return(0,G.renderToString)(Ur(n,t,r))}function qr(e){let t=e.originalContent;if(e.isValid||e.innerBlocks.length)try{t=Fr(e.name,e.attributes,e.innerBlocks)}catch(e){}return t}function Gr(e,t,r){const n=t&&Object.entries(t).length?function(e){return JSON.stringify(e).replace(/--/g,"\\u002d\\u002d").replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\\"/g,"\\u0022")}(t)+" ":"",o=e?.startsWith("core/")?e.slice(5):e;return r?`\x3c!-- wp:${o} ${n}--\x3e\n`+r+`\n\x3c!-- /wp:${o} --\x3e`:`\x3c!-- wp:${o} ${n}/--\x3e`}function Kr(e,{isInnerBlocks:t=!1}={}){if(!e.isValid&&e.__unstableBlockSource)return Dr(e.__unstableBlockSource);const r=e.name,n=qr(e);if(r===ge()||!t&&r===pe())return n;const o=ke(r);if(!o)return n;const a=function(e,t){var r;return Object.entries(null!==(r=e.attributes)&&void 0!==r?r:{}).reduce(((e,[r,n])=>{const o=t[r];return void 0===o||void 0!==n.source||"default"in n&&JSON.stringify(n.default)===JSON.stringify(o)||(e[r]=o),e}),{})}(o,e.attributes);return Gr(r,a,n)}function Wr(e){1===e.length&&je(e[0])&&(e=[]);let t=Yr(e);return 1===e.length&&e[0].name===pe()&&"core/freeform"===e[0].name&&(t=(0,Or.removep)(t)),t}function Yr(e,t){return(Array.isArray(e)?e:[e]).map((e=>Kr(e,t))).join("\n\n")}var Qr=/^#[xX]([A-Fa-f0-9]+)$/,Zr=/^#([0-9]+)$/,Xr=/^([A-Za-z0-9]+)$/,Jr=(function(){function e(e){this.named=e}e.prototype.parse=function(e){if(e){var t=e.match(Qr);return t?String.fromCharCode(parseInt(t[1],16)):(t=e.match(Zr))?String.fromCharCode(parseInt(t[1],10)):(t=e.match(Xr))?this.named[t[1]]:void 0}}}(),/[\t\n\f ]/),en=/[A-Za-z]/,tn=/\r\n?/g;function rn(e){return Jr.test(e)}function nn(e){return en.test(e)}var on=function(){function e(e,t,r){void 0===r&&(r="precompile"),this.delegate=e,this.entityParser=t,this.mode=r,this.state="beforeData",this.line=-1,this.column=-1,this.input="",this.index=-1,this.tagNameBuffer="",this.states={beforeData:function(){var e=this.peek();if("<"!==e||this.isIgnoredEndTag()){if("precompile"===this.mode&&"\n"===e){var t=this.tagNameBuffer.toLowerCase();"pre"!==t&&"textarea"!==t||this.consume()}this.transitionTo("data"),this.delegate.beginData()}else this.transitionTo("tagOpen"),this.markTagStart(),this.consume()},data:function(){var e=this.peek(),t=this.tagNameBuffer;"<"!==e||this.isIgnoredEndTag()?"&"===e&&"script"!==t&&"style"!==t?(this.consume(),this.delegate.appendToData(this.consumeCharRef()||"&")):(this.consume(),this.delegate.appendToData(e)):(this.delegate.finishData(),this.transitionTo("tagOpen"),this.markTagStart(),this.consume())},tagOpen:function(){var e=this.consume();"!"===e?this.transitionTo("markupDeclarationOpen"):"/"===e?this.transitionTo("endTagOpen"):("@"===e||":"===e||nn(e))&&(this.transitionTo("tagName"),this.tagNameBuffer="",this.delegate.beginStartTag(),this.appendToTagName(e))},markupDeclarationOpen:function(){var e=this.consume();"-"===e&&"-"===this.peek()?(this.consume(),this.transitionTo("commentStart"),this.delegate.beginComment()):"DOCTYPE"===e.toUpperCase()+this.input.substring(this.index,this.index+6).toUpperCase()&&(this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.transitionTo("doctype"),this.delegate.beginDoctype&&this.delegate.beginDoctype())},doctype:function(){rn(this.consume())&&this.transitionTo("beforeDoctypeName")},beforeDoctypeName:function(){var e=this.consume();rn(e)||(this.transitionTo("doctypeName"),this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(e.toLowerCase()))},doctypeName:function(){var e=this.consume();rn(e)?this.transitionTo("afterDoctypeName"):">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(e.toLowerCase())},afterDoctypeName:function(){var e=this.consume();if(!rn(e))if(">"===e)this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData");else{var t=e.toUpperCase()+this.input.substring(this.index,this.index+5).toUpperCase(),r="PUBLIC"===t.toUpperCase(),n="SYSTEM"===t.toUpperCase();(r||n)&&(this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.consume()),r?this.transitionTo("afterDoctypePublicKeyword"):n&&this.transitionTo("afterDoctypeSystemKeyword")}},afterDoctypePublicKeyword:function(){var e=this.peek();rn(e)?(this.transitionTo("beforeDoctypePublicIdentifier"),this.consume()):'"'===e?(this.transitionTo("doctypePublicIdentifierDoubleQuoted"),this.consume()):"'"===e?(this.transitionTo("doctypePublicIdentifierSingleQuoted"),this.consume()):">"===e&&(this.consume(),this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData"))},doctypePublicIdentifierDoubleQuoted:function(){var e=this.consume();'"'===e?this.transitionTo("afterDoctypePublicIdentifier"):">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(e)},doctypePublicIdentifierSingleQuoted:function(){var e=this.consume();"'"===e?this.transitionTo("afterDoctypePublicIdentifier"):">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(e)},afterDoctypePublicIdentifier:function(){var e=this.consume();rn(e)?this.transitionTo("betweenDoctypePublicAndSystemIdentifiers"):">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):'"'===e?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):"'"===e&&this.transitionTo("doctypeSystemIdentifierSingleQuoted")},betweenDoctypePublicAndSystemIdentifiers:function(){var e=this.consume();rn(e)||(">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):'"'===e?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):"'"===e&&this.transitionTo("doctypeSystemIdentifierSingleQuoted"))},doctypeSystemIdentifierDoubleQuoted:function(){var e=this.consume();'"'===e?this.transitionTo("afterDoctypeSystemIdentifier"):">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeSystemIdentifier&&this.delegate.appendToDoctypeSystemIdentifier(e)},doctypeSystemIdentifierSingleQuoted:function(){var e=this.consume();"'"===e?this.transitionTo("afterDoctypeSystemIdentifier"):">"===e?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeSystemIdentifier&&this.delegate.appendToDoctypeSystemIdentifier(e)},afterDoctypeSystemIdentifier:function(){var e=this.consume();rn(e)||">"===e&&(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData"))},commentStart:function(){var e=this.consume();"-"===e?this.transitionTo("commentStartDash"):">"===e?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData(e),this.transitionTo("comment"))},commentStartDash:function(){var e=this.consume();"-"===e?this.transitionTo("commentEnd"):">"===e?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData("-"),this.transitionTo("comment"))},comment:function(){var e=this.consume();"-"===e?this.transitionTo("commentEndDash"):this.delegate.appendToCommentData(e)},commentEndDash:function(){var e=this.consume();"-"===e?this.transitionTo("commentEnd"):(this.delegate.appendToCommentData("-"+e),this.transitionTo("comment"))},commentEnd:function(){var e=this.consume();">"===e?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData("--"+e),this.transitionTo("comment"))},tagName:function(){var e=this.consume();rn(e)?this.transitionTo("beforeAttributeName"):"/"===e?this.transitionTo("selfClosingStartTag"):">"===e?(this.delegate.finishTag(),this.transitionTo("beforeData")):this.appendToTagName(e)},endTagName:function(){var e=this.consume();rn(e)?(this.transitionTo("beforeAttributeName"),this.tagNameBuffer=""):"/"===e?(this.transitionTo("selfClosingStartTag"),this.tagNameBuffer=""):">"===e?(this.delegate.finishTag(),this.transitionTo("beforeData"),this.tagNameBuffer=""):this.appendToTagName(e)},beforeAttributeName:function(){var e=this.peek();rn(e)?this.consume():"/"===e?(this.transitionTo("selfClosingStartTag"),this.consume()):">"===e?(this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):"="===e?(this.delegate.reportSyntaxError("attribute name cannot start with equals sign"),this.transitionTo("attributeName"),this.delegate.beginAttribute(),this.consume(),this.delegate.appendToAttributeName(e)):(this.transitionTo("attributeName"),this.delegate.beginAttribute())},attributeName:function(){var e=this.peek();rn(e)?(this.transitionTo("afterAttributeName"),this.consume()):"/"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"="===e?(this.transitionTo("beforeAttributeValue"),this.consume()):">"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):'"'===e||"'"===e||"<"===e?(this.delegate.reportSyntaxError(e+" is not a valid character within attribute names"),this.consume(),this.delegate.appendToAttributeName(e)):(this.consume(),this.delegate.appendToAttributeName(e))},afterAttributeName:function(){var e=this.peek();rn(e)?this.consume():"/"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"="===e?(this.consume(),this.transitionTo("beforeAttributeValue")):">"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.transitionTo("attributeName"),this.delegate.beginAttribute(),this.consume(),this.delegate.appendToAttributeName(e))},beforeAttributeValue:function(){var e=this.peek();rn(e)?this.consume():'"'===e?(this.transitionTo("attributeValueDoubleQuoted"),this.delegate.beginAttributeValue(!0),this.consume()):"'"===e?(this.transitionTo("attributeValueSingleQuoted"),this.delegate.beginAttributeValue(!0),this.consume()):">"===e?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.transitionTo("attributeValueUnquoted"),this.delegate.beginAttributeValue(!1),this.consume(),this.delegate.appendToAttributeValue(e))},attributeValueDoubleQuoted:function(){var e=this.consume();'"'===e?(this.delegate.finishAttributeValue(),this.transitionTo("afterAttributeValueQuoted")):"&"===e?this.delegate.appendToAttributeValue(this.consumeCharRef()||"&"):this.delegate.appendToAttributeValue(e)},attributeValueSingleQuoted:function(){var e=this.consume();"'"===e?(this.delegate.finishAttributeValue(),this.transitionTo("afterAttributeValueQuoted")):"&"===e?this.delegate.appendToAttributeValue(this.consumeCharRef()||"&"):this.delegate.appendToAttributeValue(e)},attributeValueUnquoted:function(){var e=this.peek();rn(e)?(this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("beforeAttributeName")):"/"===e?(this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"&"===e?(this.consume(),this.delegate.appendToAttributeValue(this.consumeCharRef()||"&")):">"===e?(this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.consume(),this.delegate.appendToAttributeValue(e))},afterAttributeValueQuoted:function(){var e=this.peek();rn(e)?(this.consume(),this.transitionTo("beforeAttributeName")):"/"===e?(this.consume(),this.transitionTo("selfClosingStartTag")):">"===e?(this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):this.transitionTo("beforeAttributeName")},selfClosingStartTag:function(){">"===this.peek()?(this.consume(),this.delegate.markTagAsSelfClosing(),this.delegate.finishTag(),this.transitionTo("beforeData")):this.transitionTo("beforeAttributeName")},endTagOpen:function(){var e=this.consume();("@"===e||":"===e||nn(e))&&(this.transitionTo("endTagName"),this.tagNameBuffer="",this.delegate.beginEndTag(),this.appendToTagName(e))}},this.reset()}return e.prototype.reset=function(){this.transitionTo("beforeData"),this.input="",this.tagNameBuffer="",this.index=0,this.line=1,this.column=0,this.delegate.reset()},e.prototype.transitionTo=function(e){this.state=e},e.prototype.tokenize=function(e){this.reset(),this.tokenizePart(e),this.tokenizeEOF()},e.prototype.tokenizePart=function(e){for(this.input+=function(e){return e.replace(tn,"\n")}(e);this.index<this.input.length;){var t=this.states[this.state];if(void 0===t)throw new Error("unhandled state "+this.state);t.call(this)}},e.prototype.tokenizeEOF=function(){this.flushData()},e.prototype.flushData=function(){"data"===this.state&&(this.delegate.finishData(),this.transitionTo("beforeData"))},e.prototype.peek=function(){return this.input.charAt(this.index)},e.prototype.consume=function(){var e=this.peek();return this.index++,"\n"===e?(this.line++,this.column=0):this.column++,e},e.prototype.consumeCharRef=function(){var e=this.input.indexOf(";",this.index);if(-1!==e){var t=this.input.slice(this.index,e),r=this.entityParser.parse(t);if(r){for(var n=t.length;n;)this.consume(),n--;return this.consume(),r}}},e.prototype.markTagStart=function(){this.delegate.tagOpen()},e.prototype.appendToTagName=function(e){this.tagNameBuffer+=e,this.delegate.appendToTagName(e)},e.prototype.isIgnoredEndTag=function(){var e=this.tagNameBuffer;return"title"===e&&"</title>"!==this.input.substring(this.index,this.index+8)||"style"===e&&"</style>"!==this.input.substring(this.index,this.index+8)||"script"===e&&"<\/script>"!==this.input.substring(this.index,this.index+9)},e}(),an=function(){function e(e,t){void 0===t&&(t={}),this.options=t,this.token=null,this.startLine=1,this.startColumn=0,this.tokens=[],this.tokenizer=new on(this,e,t.mode),this._currentAttribute=void 0}return e.prototype.tokenize=function(e){return this.tokens=[],this.tokenizer.tokenize(e),this.tokens},e.prototype.tokenizePart=function(e){return this.tokens=[],this.tokenizer.tokenizePart(e),this.tokens},e.prototype.tokenizeEOF=function(){return this.tokens=[],this.tokenizer.tokenizeEOF(),this.tokens[0]},e.prototype.reset=function(){this.token=null,this.startLine=1,this.startColumn=0},e.prototype.current=function(){var e=this.token;if(null===e)throw new Error("token was unexpectedly null");if(0===arguments.length)return e;for(var t=0;t<arguments.length;t++)if(e.type===arguments[t])return e;throw new Error("token type was unexpectedly "+e.type)},e.prototype.push=function(e){this.token=e,this.tokens.push(e)},e.prototype.currentAttribute=function(){return this._currentAttribute},e.prototype.addLocInfo=function(){this.options.loc&&(this.current().loc={start:{line:this.startLine,column:this.startColumn},end:{line:this.tokenizer.line,column:this.tokenizer.column}}),this.startLine=this.tokenizer.line,this.startColumn=this.tokenizer.column},e.prototype.beginDoctype=function(){this.push({type:"Doctype",name:""})},e.prototype.appendToDoctypeName=function(e){this.current("Doctype").name+=e},e.prototype.appendToDoctypePublicIdentifier=function(e){var t=this.current("Doctype");void 0===t.publicIdentifier?t.publicIdentifier=e:t.publicIdentifier+=e},e.prototype.appendToDoctypeSystemIdentifier=function(e){var t=this.current("Doctype");void 0===t.systemIdentifier?t.systemIdentifier=e:t.systemIdentifier+=e},e.prototype.endDoctype=function(){this.addLocInfo()},e.prototype.beginData=function(){this.push({type:"Chars",chars:""})},e.prototype.appendToData=function(e){this.current("Chars").chars+=e},e.prototype.finishData=function(){this.addLocInfo()},e.prototype.beginComment=function(){this.push({type:"Comment",chars:""})},e.prototype.appendToCommentData=function(e){this.current("Comment").chars+=e},e.prototype.finishComment=function(){this.addLocInfo()},e.prototype.tagOpen=function(){},e.prototype.beginStartTag=function(){this.push({type:"StartTag",tagName:"",attributes:[],selfClosing:!1})},e.prototype.beginEndTag=function(){this.push({type:"EndTag",tagName:""})},e.prototype.finishTag=function(){this.addLocInfo()},e.prototype.markTagAsSelfClosing=function(){this.current("StartTag").selfClosing=!0},e.prototype.appendToTagName=function(e){this.current("StartTag","EndTag").tagName+=e},e.prototype.beginAttribute=function(){this._currentAttribute=["","",!1]},e.prototype.appendToAttributeName=function(e){this.currentAttribute()[0]+=e},e.prototype.beginAttributeValue=function(e){this.currentAttribute()[2]=e},e.prototype.appendToAttributeValue=function(e){this.currentAttribute()[1]+=e},e.prototype.finishAttributeValue=function(){this.current("StartTag").attributes.push(this._currentAttribute)},e.prototype.reportSyntaxError=function(e){this.current().syntaxError=e},e}();var sn=r(7734),cn=r.n(sn);const ln=window.wp.htmlEntities;function un(){function e(e){return(t,...r)=>e("Block validation: "+t,...r)}return{error:e(console.error),warning:e(console.warn),getItems:()=>[]}}const dn=/[\t\n\r\v\f ]+/g,pn=/^[\t\n\r\v\f ]*$/,hn=/^url\s*\(['"\s]*(.*?)['"\s]*\)$/,fn=["allowfullscreen","allowpaymentrequest","allowusermedia","async","autofocus","autoplay","checked","controls","default","defer","disabled","download","formnovalidate","hidden","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","typemustmatch"],gn=[...fn,"autocapitalize","autocomplete","charset","contenteditable","crossorigin","decoding","dir","draggable","enctype","formenctype","formmethod","http-equiv","inputmode","kind","method","preload","scope","shape","spellcheck","translate","type","wrap"],mn=[e=>e,function(e){return wn(e).join(" ")}],bn=/^[\da-z]+$/i,_n=/^#\d+$/,kn=/^#x[\da-f]+$/i;class yn{parse(e){if(t=e,bn.test(t)||_n.test(t)||kn.test(t))return(0,ln.decodeEntities)("&"+e+";");var t}}function wn(e){return e.trim().split(dn)}function vn(e){return e.attributes.filter((e=>{const[t,r]=e;return r||0===t.indexOf("data-")||gn.includes(t)}))}function Tn(e,t,r=un()){let n=e.chars,o=t.chars;for(let e=0;e<mn.length;e++){const t=mn[e];if(n=t(n),o=t(o),n===o)return!0}return r.warning("Expected text `%s`, saw `%s`.",t.chars,e.chars),!1}function Cn(e){return 0===parseFloat(e)?"0":0===e.indexOf(".")?"0"+e:e}function xn(e){return wn(e).map(Cn).join(" ").replace(hn,"url($1)")}function En(e){const t=e.replace(/;?\s*$/,"").split(";").map((e=>{const[t,...r]=e.split(":"),n=r.join(":");return[t.trim(),xn(n.trim())]}));return Object.fromEntries(t)}const Sn={class:(e,t)=>{const[r,n]=[e,t].map(wn),o=r.filter((e=>!n.includes(e))),a=n.filter((e=>!r.includes(e)));return 0===o.length&&0===a.length},style:(e,t)=>cn()(...[e,t].map(En)),...Object.fromEntries(fn.map((e=>[e,()=>!0])))};const Bn={StartTag:(e,t,r=un())=>e.tagName!==t.tagName&&e.tagName.toLowerCase()!==t.tagName.toLowerCase()?(r.warning("Expected tag name `%s`, instead saw `%s`.",t.tagName,e.tagName),!1):function(e,t,r=un()){if(e.length!==t.length)return r.warning("Expected attributes %o, instead saw %o.",t,e),!1;const n={};for(let e=0;e<t.length;e++)n[t[e][0].toLowerCase()]=t[e][1];for(let t=0;t<e.length;t++){const[o,a]=e[t],i=o.toLowerCase();if(!n.hasOwnProperty(i))return r.warning("Encountered unexpected attribute `%s`.",o),!1;const s=n[i],c=Sn[i];if(c){if(!c(a,s))return r.warning("Expected attribute `%s` of value `%s`, saw `%s`.",o,s,a),!1}else if(a!==s)return r.warning("Expected attribute `%s` of value `%s`, saw `%s`.",o,s,a),!1}return!0}(...[e,t].map(vn),r),Chars:Tn,Comment:Tn};function An(e){let t;for(;t=e.shift();){if("Chars"!==t.type)return t;if(!pn.test(t.chars))return t}}function Nn(e,t){return!!e.selfClosing&&!(!t||t.tagName!==e.tagName||"EndTag"!==t.type)}function Pn(e,t,r=un()){if(e===t)return!0;const[n,o]=[e,t].map((e=>function(e,t=un()){try{return new an(new yn).tokenize(e)}catch(r){t.warning("Malformed HTML detected: %s",e)}return null}(e,r)));if(!n||!o)return!1;let a,i;for(;a=An(n);){if(i=An(o),!i)return r.warning("Expected end of content, instead saw %o.",a),!1;if(a.type!==i.type)return r.warning("Expected token of type `%s` (%o), instead saw `%s` (%o).",i.type,i,a.type,a),!1;const e=Bn[a.type];if(e&&!e(a,i,r))return!1;Nn(a,o[0])?An(o):Nn(i,n[0])&&An(n)}return!(i=An(o))||(r.warning("Expected %o, instead saw end of content.",i),!1)}function On(e,t=e.name){if(e.name===pe()||e.name===ge())return[!0,[]];const r=function(){const e=[],t=un();return{error(...r){e.push({log:t.error,args:r})},warning(...r){e.push({log:t.warning,args:r})},getItems:()=>e}}(),n=Ie(t);let o;try{o=Fr(n,e.attributes)}catch(e){return r.error("Block validation failed because an error occurred while generating block content:\n\n%s",e.toString()),[!1,r.getItems()]}const a=Pn(e.originalContent,o,r);return a||r.error("Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s",n.name,n,o,e.originalContent),[a,r.getItems()]}function Ln(e,t,r){Dt()("isValidBlockContent introduces opportunity for data loss",{since:"12.6",plugin:"Gutenberg",alternative:"validateBlock"});const n=Ie(e),o={name:n.name,attributes:t,innerBlocks:[],originalContent:r},[a]=On(o,n);return a}function Mn(e,t){const r={...t};if("core/cover-image"===e&&(e="core/cover"),"core/text"!==e&&"core/cover-text"!==e||(e="core/paragraph"),e&&0===e.indexOf("core/social-link-")&&(r.service=e.substring(17),e="core/social-link"),e&&0===e.indexOf("core-embed/")){const t=e.substring(11),n={speaker:"speaker-deck",polldaddy:"crowdsignal"};r.providerNameSlug=t in n?n[t]:t,["amazon-kindle","wordpress"].includes(t)||(r.responsive=!0),e="core/embed"}if("core/post-comment-author"===e&&(e="core/comment-author-name"),"core/post-comment-content"===e&&(e="core/comment-content"),"core/post-comment-date"===e&&(e="core/comment-date"),"core/comments-query-loop"===e){e="core/comments";const{className:t=""}=r;t.includes("wp-block-comments-query-loop")||(r.className=["wp-block-comments-query-loop",t].join(" "))}return"core/post-comments"===e&&(e="core/comments",r.legacy=!0),[e,r]}var jn,Dn=function(){return jn||(jn=document.implementation.createHTMLDocument("")),jn};function zn(e,t){if(t){if("string"==typeof e){var r=Dn();r.body.innerHTML=e,e=r.body}if("function"==typeof t)return t(e);if(Object===t.constructor)return Object.keys(t).reduce((function(r,n){return r[n]=zn(e,t[n]),r}),{})}}function In(e,t){return 1===arguments.length&&(t=e,e=void 0),function(r){var n=r;if(e&&(n=r.querySelector(e)),n)return function(e,t){for(var r,n=t.split(".");r=n.shift();){if(!(r in e))return;e=e[r]}return e}(n,t)}}function Rn(e){const t={};for(let r=0;r<e.length;r++){const{name:n,value:o}=e[r];t[n]=o}return t}function Hn(e){if(Dt()("wp.blocks.node.fromDOM",{since:"6.1",version:"6.3",alternative:"wp.richText.create",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),e.nodeType===e.TEXT_NODE)return e.nodeValue;if(e.nodeType!==e.ELEMENT_NODE)throw new TypeError("A block node can only be created from a node of type text or element.");return{type:e.nodeName.toLowerCase(),props:{...Rn(e.attributes),children:Un(e.childNodes)}}}function Vn(e){return Dt()("wp.blocks.node.matcher",{since:"6.1",version:"6.3",alternative:"html source",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),t=>{let r=t;e&&(r=t.querySelector(e));try{return Hn(r)}catch(e){return null}}}const $n={isNodeOfType:function(e,t){return Dt()("wp.blocks.node.isNodeOfType",{since:"6.1",version:"6.3",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),e&&e.type===t},fromDOM:Hn,toHTML:function(e){return Dt()("wp.blocks.node.toHTML",{since:"6.1",version:"6.3",alternative:"wp.richText.toHTMLString",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),Fn([e])},matcher:Vn};function Un(e){Dt()("wp.blocks.children.fromDOM",{since:"6.1",version:"6.3",alternative:"wp.richText.create",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"});const t=[];for(let r=0;r<e.length;r++)try{t.push(Hn(e[r]))}catch(e){}return t}function Fn(e){Dt()("wp.blocks.children.toHTML",{since:"6.1",version:"6.3",alternative:"wp.richText.toHTMLString",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"});const t=e;return(0,G.renderToString)(t)}function qn(e){return Dt()("wp.blocks.children.matcher",{since:"6.1",version:"6.3",alternative:"html source",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),t=>{let r=t;return e&&(r=t.querySelector(e)),r?Un(r.childNodes):[]}}const Gn={concat:function(...e){Dt()("wp.blocks.children.concat",{since:"6.1",version:"6.3",alternative:"wp.richText.concat",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"});const t=[];for(let r=0;r<e.length;r++){const n=Array.isArray(e[r])?e[r]:[e[r]];for(let e=0;e<n.length;e++){const r=n[e];"string"==typeof r&&"string"==typeof t[t.length-1]?t[t.length-1]+=r:t.push(r)}}return t},getChildrenArray:function(e){return Dt()("wp.blocks.children.getChildrenArray",{since:"6.1",version:"6.3",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/"}),e},fromDOM:Un,toHTML:Fn,matcher:qn};function Kn(e,t){return t.some((t=>function(e,t){switch(t){case"rich-text":return e instanceof W.RichTextData;case"string":return"string"==typeof e;case"boolean":return"boolean"==typeof e;case"object":return!!e&&e.constructor===Object;case"null":return null===e;case"array":return Array.isArray(e);case"integer":case"number":return"number"==typeof e}return!0}(e,t)))}function Wn(e,t,r,n,o){let a;switch(t.source){case void 0:a=n?n[e]:void 0;break;case"raw":a=o;break;case"attribute":case"property":case"html":case"text":case"rich-text":case"children":case"node":case"query":case"tag":a=Zn(r,t)}return function(e,t){return void 0===t||Kn(e,Array.isArray(t)?t:[t])}(a,t.type)&&function(e,t){return!Array.isArray(t)||t.includes(e)}(a,t.enum)||(a=void 0),void 0===a&&(a=Ve(t)),a}const Yn=function(e,t){var r,n,o=0;function a(){var a,i,s=r,c=arguments.length;e:for(;s;){if(s.args.length===arguments.length){for(i=0;i<c;i++)if(s.args[i]!==arguments[i]){s=s.next;continue e}return s!==r&&(s===n&&(n=s.prev),s.prev.next=s.next,s.next&&(s.next.prev=s.prev),s.next=r,s.prev=null,r.prev=s,r=s),s.val}s=s.next}for(a=new Array(c),i=0;i<c;i++)a[i]=arguments[i];return s={args:a,val:e.apply(null,a)},r?(r.prev=s,s.next=r):n=s,o===t.maxSize?(n=n.prev).next=null:o++,r=s,s.val}return t=t||{},a.clear=function(){r=null,n=null,o=0},a}((e=>{switch(e.source){case"attribute":let n=function(e,t){return 1===arguments.length&&(t=e,e=void 0),function(r){var n=In(e,"attributes")(r);if(n&&n.hasOwnProperty(t))return n[t].value}}(e.selector,e.attribute);return"boolean"===e.type&&(n=(e=>(0,it.pipe)([e,e=>void 0!==e]))(n)),n;case"html":return t=e.selector,r=e.multiline,e=>{let n=e;if(t&&(n=e.querySelector(t)),!n)return"";if(r){let e="";const t=n.children.length;for(let o=0;o<t;o++){const t=n.children[o];t.nodeName.toLowerCase()===r&&(e+=t.outerHTML)}return e}return n.innerHTML};case"text":return function(e){return In(e,"textContent")}(e.selector);case"rich-text":return((e,t)=>r=>{const n=e?r.querySelector(e):r;return n?W.RichTextData.fromHTMLElement(n,{preserveWhiteSpace:t}):W.RichTextData.empty()})(e.selector,e.__unstablePreserveWhiteSpace);case"children":return qn(e.selector);case"node":return Vn(e.selector);case"query":const o=Object.fromEntries(Object.entries(e.query).map((([e,t])=>[e,Yn(t)])));return function(e,t){return function(r){var n=r.querySelectorAll(e);return[].map.call(n,(function(e){return zn(e,t)}))}}(e.selector,o);case"tag":return(0,it.pipe)([In(e.selector,"nodeName"),e=>e?e.toLowerCase():void 0]);default:console.error(`Unknown source type "${e.source}"`)}var t,r}));function Qn(e){return zn(e,(e=>e))}function Zn(e,t){return Yn(t)(Qn(e))}function Xn(e,t,r={}){var n;const o=Qn(t),a=Ie(e),i=Object.fromEntries(Object.entries(null!==(n=a.attributes)&&void 0!==n?n:{}).map((([e,n])=>[e,Wn(e,n,o,r,t)])));return(0,Rt.applyFilters)("blocks.getBlockAttributes",i,a,t,r)}const Jn={type:"string",source:"attribute",selector:"[data-custom-class-name] > *",attribute:"class"};function eo(e){const t=Zn(`<div data-custom-class-name>${e}</div>`,Jn);return t?t.trim().split(/\s+/):[]}function to(e,t){const r=function(e,t,r){if(ve(t,"customClassName",!0)){const{className:n,...o}=e,a=Fr(t,o),i=eo(a),s=eo(r).filter((e=>!i.includes(e)));s.length?e.className=s.join(" "):a&&delete e.className}return e}(e.attributes,t,e.originalContent);return{...e,attributes:r}}function ro(){return!1}function no(e,t){let r=function(e,t){const r=pe(),n=e.blockName||pe(),o=e.attrs||{},a=e.innerBlocks||[];let i=e.innerHTML.trim();return n!==r||"core/freeform"!==n||t?.__unstableSkipAutop||(i=(0,Or.autop)(i).trim()),{...e,blockName:n,attrs:o,innerHTML:i,innerBlocks:a}}(e,t);r=function(e){const[t,r]=Mn(e.blockName,e.attrs);return{...e,blockName:t,attrs:r}}(r);let n=ke(r.blockName);n||(r=function(e){const t=ge()||pe(),r=Dr(e,{isCommentDelimited:!1}),n=Dr(e,{isCommentDelimited:!0});return{blockName:t,attrs:{originalName:e.blockName,originalContent:n,originalUndelimitedContent:r},innerHTML:e.blockName?n:e.innerHTML,innerBlocks:e.innerBlocks,innerContent:e.innerContent}}(r),n=ke(r.blockName));const o=r.blockName===pe()||r.blockName===ge();if(!n||!r.innerHTML&&o)return;const a=r.innerBlocks.map((e=>no(e,t))).filter((e=>!!e)),i=mr(r.blockName,Xn(n,r.innerHTML,r.attrs),a);i.originalContent=r.innerHTML;const s=function(e,t){const[r]=On(e,t);if(r)return{...e,isValid:r,validationIssues:[]};const n=to(e,t),[o,a]=On(e,t);return{...n,isValid:o,validationIssues:a}}(i,n),{validationIssues:c}=s,l=function(e,t,r){const n=t.attrs,{deprecated:o}=r;if(!o||!o.length)return e;for(let a=0;a<o.length;a++){const{isEligible:i=ro}=o[a];if(e.isValid&&!i(n,e.innerBlocks,{blockNode:t,block:e}))continue;const s=Object.assign(Fe(r,Q),o[a]);let c={...e,attributes:Xn(s,e.originalContent,n)},[l]=On(c,s);if(l||(c=to(c,s),[l]=On(c,s)),!l)continue;let u=c.innerBlocks,d=c.attributes;const{migrate:p}=s;if(p){let t=p(d,e.innerBlocks);Array.isArray(t)||(t=[t]),[d=n,u=e.innerBlocks]=t}e={...e,attributes:d,innerBlocks:u,isValid:!0,validationIssues:[]}}return e}(s,r,n);return l.isValid||(l.__unstableBlockSource=e),s.isValid||!l.isValid||t?.__unstableSkipMigrationLogs?s.isValid||l.isValid||c.forEach((({log:e,args:t})=>e(...t))):(console.groupCollapsed("Updated Block: %s",n.name),console.info("Block successfully updated for `%s` (%o).\n\nNew content generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s",n.name,n,Fr(n,l.attributes),l.originalContent),console.groupEnd()),l}function oo(e,t){return(0,Pr.parse)(e).reduce(((e,r)=>{const n=no(r,t);return n&&e.push(n),e}),[])}function ao(){return Sr("from").filter((({type:e})=>"raw"===e)).map((e=>e.isMatch?e:{...e,isMatch:t=>e.selector&&t.matches(e.selector)}))}function io(e,t){const r=document.implementation.createHTMLDocument("");return r.body.innerHTML=e,Array.from(r.body.children).flatMap((e=>{const r=Er(ao(),(({isMatch:t})=>t(e)));if(!r)return G.Platform.isNative?oo(`\x3c!-- wp:html --\x3e${e.outerHTML}\x3c!-- /wp:html --\x3e`):mr("core/html",Xn("core/html",e.outerHTML));const{transform:n,blockName:o}=r;return n?n(e,t):mr(o,Xn(o,e.outerHTML))}))}function so(e){const t=document.implementation.createHTMLDocument(""),r=document.implementation.createHTMLDocument(""),n=t.body,o=r.body;for(n.innerHTML=e;n.firstChild;){const e=n.firstChild;e.nodeType===e.TEXT_NODE?(0,K.isEmpty)(e)?n.removeChild(e):(o.lastChild&&"P"===o.lastChild.nodeName||o.appendChild(r.createElement("P")),o.lastChild.appendChild(e)):e.nodeType===e.ELEMENT_NODE?"BR"===e.nodeName?(e.nextSibling&&"BR"===e.nextSibling.nodeName&&(o.appendChild(r.createElement("P")),n.removeChild(e.nextSibling)),o.lastChild&&"P"===o.lastChild.nodeName&&o.lastChild.hasChildNodes()?o.lastChild.appendChild(e):n.removeChild(e)):"P"===e.nodeName?(0,K.isEmpty)(e)?n.removeChild(e):o.appendChild(e):(0,K.isPhrasingContent)(e)?(o.lastChild&&"P"===o.lastChild.nodeName||o.appendChild(r.createElement("P")),o.lastChild.appendChild(e)):o.appendChild(e):n.removeChild(e)}return o.innerHTML}function co(e,t){e.nodeType===e.COMMENT_NODE&&("nextpage"!==e.nodeValue?0===e.nodeValue.indexOf("more")&&function(e,t){const r=e.nodeValue.slice(4).trim();let n=e,o=!1;for(;n=n.nextSibling;)if(n.nodeType===n.COMMENT_NODE&&"noteaser"===n.nodeValue){o=!0,(0,K.remove)(n);break}const a=function(e,t,r){const n=r.createElement("wp-block");n.dataset.block="core/more",e&&(n.dataset.customText=e);t&&(n.dataset.noTeaser="");return n}(r,o,t);if(e.parentNode&&"P"===e.parentNode.nodeName&&1!==e.parentNode.childNodes.length){const r=Array.from(e.parentNode.childNodes),n=r.indexOf(e),o=e.parentNode.parentNode||t.body,i=(e,r)=>(e||(e=t.createElement("p")),e.appendChild(r),e);[r.slice(0,n).reduce(i,null),a,r.slice(n+1).reduce(i,null)].forEach((t=>t&&o.insertBefore(t,e.parentNode))),(0,K.remove)(e.parentNode)}else(0,K.replace)(e,a)}(e,t):(0,K.replace)(e,function(e){const t=e.createElement("wp-block");return t.dataset.block="core/nextpage",t}(t)))}function lo(e){return"OL"===e.nodeName||"UL"===e.nodeName}function uo(e){if(!lo(e))return;const t=e,r=e.previousElementSibling;if(r&&r.nodeName===e.nodeName&&1===t.children.length){for(;t.firstChild;)r.appendChild(t.firstChild);t.parentNode.removeChild(t)}const n=e.parentNode;if(n&&"LI"===n.nodeName&&1===n.children.length&&!/\S/.test((o=n,Array.from(o.childNodes).map((({nodeValue:e=""})=>e)).join("")))){const e=n,r=e.previousElementSibling,o=e.parentNode;r?(r.appendChild(t),o.removeChild(e)):(o.parentNode.insertBefore(t,o),o.parentNode.removeChild(o))}var o;if(n&&lo(n)){const t=e.previousElementSibling;t?t.appendChild(e):(0,K.unwrap)(e)}}function po(e){"BLOCKQUOTE"===e.nodeName&&(e.innerHTML=so(e.innerHTML))}function ho(e,t=e){const r=e.ownerDocument.createElement("figure");t.parentNode.insertBefore(r,t),r.appendChild(e)}function fo(e,t,r){if(!function(e,t){var r;const n=e.nodeName.toLowerCase();return"figcaption"!==n&&!(0,K.isTextContent)(e)&&n in(null!==(r=t?.figure?.children)&&void 0!==r?r:{})}(e,r))return;let n=e;const o=e.parentNode;(function(e,t){var r;return e.nodeName.toLowerCase()in(null!==(r=t?.figure?.children?.a?.children)&&void 0!==r?r:{})})(e,r)&&"A"===o.nodeName&&1===o.childNodes.length&&(n=e.parentNode);const a=n.closest("p,div");a?e.classList?(e.classList.contains("alignright")||e.classList.contains("alignleft")||e.classList.contains("aligncenter")||!a.textContent.trim())&&ho(n,a):ho(n,a):"BODY"===n.parentNode.nodeName&&ho(n)}const go=window.wp.shortcode,mo=e=>Array.isArray(e)?e:[e];const bo=function e(t,r=0,n=[]){const o=Er(Sr("from"),(e=>-1===n.indexOf(e.blockName)&&"shortcode"===e.type&&mo(e.tag).some((e=>(0,go.regexp)(e).test(t)))));if(!o)return[t];const a=mo(o.tag).find((e=>(0,go.regexp)(e).test(t)));let i;const s=r;if(i=(0,go.next)(a,t,r)){r=i.index+i.content.length;const a=t.substr(0,i.index),c=t.substr(r);if(!(i.shortcode.content?.includes("<")||/(\n|<p>)\s*$/.test(a)&&/^\s*(\n|<\/p>)/.test(c)))return e(t,r);if(o.isMatch&&!o.isMatch(i.shortcode.attrs))return e(t,s,[...n,o.blockName]);let l=[];if("function"==typeof o.transform)l=[].concat(o.transform(i.shortcode.attrs,i)),l=l.map((e=>(e.originalContent=i.shortcode.content,to(e,ke(e.name)))));else{const e=Object.fromEntries(Object.entries(o.attributes).filter((([,e])=>e.shortcode)).map((([e,t])=>[e,t.shortcode(i.shortcode.attrs,i)]))),r=ke(o.blockName);if(!r)return[t];const n={...r,attributes:o.attributes};let a=mr(o.blockName,Xn(n,i.shortcode.content,e));a.originalContent=i.shortcode.content,a=to(a,n),l=[a]}return[...e(a),...l,...e(c)]}return[t]};function _o(e){return function(e,t){const r={phrasingContentSchema:(0,K.getPhrasingContentSchema)(t),isPaste:"paste"===t};function n(e,t,r){switch(r){case"children":return"*"===e||"*"===t?"*":{...e,...t};case"attributes":case"require":return[...e||[],...t||[]];case"isMatch":if(!e||!t)return;return(...r)=>e(...r)||t(...r)}}function o(e,t){for(const r in t)e[r]=e[r]?n(e[r],t[r],r):{...t[r]};return e}return e.map((({isMatch:e,blockName:t,schema:n})=>{const o=ve(t,"anchor");return n="function"==typeof n?n(r):n,o||e?n?Object.fromEntries(Object.entries(n).map((([t,r])=>{let n=r.attributes||[];return o&&(n=[...n,"id"]),[t,{...r,attributes:n,isMatch:e||void 0}]}))):{}:n})).reduce((function(e,t){for(const r in t)e[r]=e[r]?o(e[r],t[r]):{...t[r]};return e}),{})}(ao(),e)}function ko(e,t,r,n){Array.from(e).forEach((e=>{ko(e.childNodes,t,r,n),t.forEach((t=>{r.contains(e)&&t(e,r,n)}))}))}function yo(e,t=[],r){const n=document.implementation.createHTMLDocument("");return n.body.innerHTML=e,ko(n.body.childNodes,t,n,r),n.body.innerHTML}function wo(e,t){const r=e[`${t}Sibling`];if(r&&(0,K.isPhrasingContent)(r))return r;const{parentNode:n}=e;return n&&(0,K.isPhrasingContent)(n)?wo(n,t):void 0}function vo(e){return Dt()("wp.blocks.getPhrasingContentSchema",{since:"5.6",alternative:"wp.dom.getPhrasingContentSchema"}),(0,K.getPhrasingContentSchema)(e)}function To({HTML:e=""}){if(-1!==e.indexOf("\x3c!-- wp:"))return oo(e);const t=bo(e),r=_o();return t.map((e=>{if("string"!=typeof e)return e;return io(e=so(e=yo(e,[uo,co,fo,po],r)),To)})).flat().filter(Boolean)}function Co(e){e.nodeType===e.COMMENT_NODE&&(0,K.remove)(e)}function xo(e,t){return e.every((e=>function(e,t){if((0,K.isTextContent)(e))return!0;if(!t)return!1;const r=e.nodeName.toLowerCase();return[["ul","li","ol"],["h1","h2","h3","h4","h5","h6"]].some((e=>0===[r,t].filter((t=>!e.includes(t))).length))}(e,t)&&xo(Array.from(e.children),t)))}function Eo(e){return"BR"===e.nodeName&&e.previousSibling&&"BR"===e.previousSibling.nodeName}function So(e,t){if("SPAN"===e.nodeName&&e.style){const{fontWeight:r,fontStyle:n,textDecorationLine:o,textDecoration:a,verticalAlign:i}=e.style;"bold"!==r&&"700"!==r||(0,K.wrap)(t.createElement("strong"),e),"italic"===n&&(0,K.wrap)(t.createElement("em"),e),("line-through"===o||a.includes("line-through"))&&(0,K.wrap)(t.createElement("s"),e),"super"===i?(0,K.wrap)(t.createElement("sup"),e):"sub"===i&&(0,K.wrap)(t.createElement("sub"),e)}else"B"===e.nodeName?e=(0,K.replaceTag)(e,"strong"):"I"===e.nodeName?e=(0,K.replaceTag)(e,"em"):"A"===e.nodeName&&(e.target&&"_blank"===e.target.toLowerCase()?e.rel="noreferrer noopener":(e.removeAttribute("target"),e.removeAttribute("rel")),e.name&&!e.id&&(e.id=e.name),e.id&&!e.ownerDocument.querySelector(`[href="#${e.id}"]`)&&e.removeAttribute("id"))}function Bo(e){"SCRIPT"!==e.nodeName&&"NOSCRIPT"!==e.nodeName&&"TEMPLATE"!==e.nodeName&&"STYLE"!==e.nodeName||e.parentNode.removeChild(e)}function Ao(e){if(e.nodeType!==e.ELEMENT_NODE)return;const t=e.getAttribute("style");if(!t||!t.includes("mso-list"))return;"ignore"===t.split(";").reduce(((e,t)=>{const[r,n]=t.split(":");return e[r.trim().toLowerCase()]=n.trim().toLowerCase(),e}),{})["mso-list"]&&e.remove()}function No(e){return"OL"===e.nodeName||"UL"===e.nodeName}function Po(e,t){if("P"!==e.nodeName)return;const r=e.getAttribute("style");if(!r||!r.includes("mso-list"))return;const n=e.previousElementSibling;if(!n||!No(n)){const r=e.textContent.trim().slice(0,1),n=/[1iIaA]/.test(r),o=t.createElement(n?"ol":"ul");n&&o.setAttribute("type",r),e.parentNode.insertBefore(o,e)}const o=e.previousElementSibling,a=o.nodeName,i=t.createElement("li");let s=o;i.innerHTML=yo(e.innerHTML,[Ao]);const c=/mso-list\s*:[^;]+level([0-9]+)/i.exec(r);let l=c&&parseInt(c[1],10)-1||0;for(;l--;)s=s.lastChild||s,No(s)&&(s=s.lastChild||s);No(s)||(s=s.appendChild(t.createElement(a))),s.appendChild(i),e.parentNode.removeChild(e)}const Oo=window.wp.blob;function Lo(e){if("IMG"===e.nodeName){if(0===e.src.indexOf("file:")&&(e.src=""),0===e.src.indexOf("data:")){const[t,r]=e.src.split(","),[n]=t.slice(5).split(";");if(!r||!n)return void(e.src="");let o;try{o=atob(r)}catch(t){return void(e.src="")}const a=new Uint8Array(o.length);for(let e=0;e<a.length;e++)a[e]=o.charCodeAt(e);const i=n.replace("/","."),s=new window.File([a],i,{type:n});e.src=(0,Oo.createBlobURL)(s)}1!==e.height&&1!==e.width||e.parentNode.removeChild(e)}}function Mo(e){"DIV"===e.nodeName&&(e.innerHTML=so(e.innerHTML))}var jo=r(1030);const Do=new(r.n(jo)().Converter)({noHeaderId:!0,tables:!0,literalMidWordUnderscores:!0,omitExtraWLInCodeBlocks:!0,simpleLineBreaks:!0,strikethrough:!0});function zo(e){if("IFRAME"===e.nodeName){const t=e.ownerDocument.createTextNode(e.src);e.parentNode.replaceChild(t,e)}}function Io(e){e.id&&0===e.id.indexOf("docs-internal-guid-")&&("B"===e.tagName?(0,K.unwrap)(e):e.removeAttribute("id"))}function Ro(e){if(e.nodeType!==e.TEXT_NODE)return;let t=e;for(;t=t.parentNode;)if(t.nodeType===t.ELEMENT_NODE&&"PRE"===t.nodeName)return;let r=e.data.replace(/[ \r\n\t]+/g," ");if(" "===r[0]){const t=wo(e,"previous");t&&"BR"!==t.nodeName&&" "!==t.textContent.slice(-1)||(r=r.slice(1))}if(" "===r[r.length-1]){const t=wo(e,"next");(!t||"BR"===t.nodeName||t.nodeType===t.TEXT_NODE&&(" "===(n=t.textContent[0])||"\r"===n||"\n"===n||"\t"===n))&&(r=r.slice(0,-1))}var n;r?e.data=r:e.parentNode.removeChild(e)}function Ho(e){"BR"===e.nodeName&&(wo(e,"next")||e.parentNode.removeChild(e))}function Vo(e){"P"===e.nodeName&&(e.hasChildNodes()||e.parentNode.removeChild(e))}function $o(e){if("SPAN"!==e.nodeName)return;if("paragraph-break"!==e.getAttribute("data-stringify-type"))return;const{parentNode:t}=e;t.insertBefore(e.ownerDocument.createElement("br"),e),t.insertBefore(e.ownerDocument.createElement("br"),e),t.removeChild(e)}const Uo=(...e)=>window?.console?.log?.(...e);function Fo(e){return e=yo(e,[Bo,Io,Ao,So,Co]),e=yo(e=(0,K.removeInvalidHTML)(e,(0,K.getPhrasingContentSchema)("paste"),{inline:!0}),[Ro,Ho]),Uo("Processed inline HTML:\n\n",e),e}function qo({HTML:e="",plainText:t="",mode:r="AUTO",tagName:n}){if(e=(e=(e=e.replace(/<meta[^>]+>/g,"")).replace(/^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i,"")).replace(/(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i,""),"INLINE"!==r){const r=e||t;if(-1!==r.indexOf("\x3c!-- wp:"))return oo(r)}String.prototype.normalize&&(e=e.normalize()),e=yo(e,[$o]);const o=t&&(!e||function(e){return!/<(?!br[ />])/i.test(e)}(e));var a;o&&(e=t,/^\s+$/.test(t)||(a=e,e=Do.makeHtml(function(e){return e.replace(/((?:^|\n)```)([^\n`]+)(```(?:$|\n))/,((e,t,r,n)=>`${t}\n${r}\n${n}`))}(function(e){return e.replace(/(^|\n)•( +)/g,"$1*$2")}(a)))));const i=bo(e),s=i.length>1;if(o&&!s&&"AUTO"===r&&-1===t.indexOf("\n")&&0!==t.indexOf("<p>")&&0===e.indexOf("<p>")&&(r="INLINE"),"INLINE"===r)return Fo(e);if("AUTO"===r&&!s&&function(e,t){const r=document.implementation.createHTMLDocument("");r.body.innerHTML=e;const n=Array.from(r.body.children);return!n.some(Eo)&&xo(n,t)}(e,n))return Fo(e);const c=(0,K.getPhrasingContentSchema)("paste"),l=_o("paste"),u=i.map((e=>{if("string"!=typeof e)return e;const t=[Io,Po,Bo,uo,Lo,So,co,Co,zo,fo,po,Mo],r={...l,...c};return e=yo(e,t,l),e=yo(e=so(e=(0,K.removeInvalidHTML)(e,r)),[Ro,Ho,Vo],l),Uo("Processed HTML piece:\n\n",e),io(e,qo)})).flat().filter(Boolean);if("AUTO"===r&&1===u.length&&ve(u[0].name,"__unstablePasteTextInline",!1)){const e=/^[\n]+|[\n]+$/g,r=t.replace(e,"");if(""!==r&&-1===r.indexOf("\n"))return(0,K.removeInvalidHTML)(qr(u[0]),c).replace(e,"")}return u}function Go(){return(0,i.select)(cr).getCategories()}function Ko(e){(0,i.dispatch)(cr).setCategories(e)}function Wo(e,t){(0,i.dispatch)(cr).updateCategory(e,t)}function Yo(e=[],t=[]){return e.length===t.length&&t.every((([t,,r],n)=>{const o=e[n];return t===o.name&&Yo(o.innerBlocks,r)}))}function Qo(e=[],t){return t?t.map((([t,r,n],o)=>{var a;const i=e[o];if(i&&i.name===t){const e=Qo(i.innerBlocks,n);return{...i,innerBlocks:e}}const s=ke(t),c=(e,t)=>t?Object.fromEntries(Object.entries(t).map((([t,r])=>[t,l(e[t],r)]))):{},l=(e,t)=>{return r=e,"html"===r?.source&&Array.isArray(t)?(0,G.renderToString)(t):(e=>"query"===e?.source)(e)&&t?t.map((t=>c(e.query,t))):t;var r},u=c(null!==(a=s?.attributes)&&void 0!==a?a:{},r);let[d,p]=Mn(t,u);return void 0===ke(d)&&(p={originalName:t,originalContent:"",originalUndelimitedContent:""},d="core/missing"),mr(d,p,Qo([],n))})):e}function Zo(e){return Dt()("wp.blocks.withBlockContentContext",{since:"6.1"}),e}})(),(window.wp=window.wp||{}).blocks=n})();/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 5755:
/***/ ((module, exports) => {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
var nativeCodeString = '[native code]';
function classNames() {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
if (arg.length) {
var inner = classNames.apply(null, arg);
if (inner) {
classes.push(inner);
}
}
} else if (argType === 'object') {
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
classes.push(arg.toString());
continue;
}
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if ( true && module.exports) {
classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}());
/***/ }),
/***/ 6007:
/***/ ((module) => {
// The scores are arranged so that a continuous match of characters will
// result in a total score of 1.
//
// The best case, this character is a match, and either this is the start
// of the string, or the previous character was also a match.
var SCORE_CONTINUE_MATCH = 1,
// A new match at the start of a word scores better than a new match
// elsewhere as it's more likely that the user will type the starts
// of fragments.
// (Our notion of word includes CamelCase and hypen-separated, etc.)
SCORE_WORD_JUMP = 0.9,
// Any other match isn't ideal, but we include it for completeness.
SCORE_CHARACTER_JUMP = 0.3,
// If the user transposed two letters, it should be signficantly penalized.
//
// i.e. "ouch" is more likely than "curtain" when "uc" is typed.
SCORE_TRANSPOSITION = 0.1,
// If the user jumped to half-way through a subsequent word, it should be
// very significantly penalized.
//
// i.e. "loes" is very unlikely to match "loch ness".
// NOTE: this is set to 0 for superhuman right now, but we may want to revisit.
SCORE_LONG_JUMP = 0,
// The goodness of a match should decay slightly with each missing
// character.
//
// i.e. "bad" is more likely than "bard" when "bd" is typed.
//
// This will not change the order of suggestions based on SCORE_* until
// 100 characters are inserted between matches.
PENALTY_SKIPPED = 0.999,
// The goodness of an exact-case match should be higher than a
// case-insensitive match by a small amount.
//
// i.e. "HTML" is more likely than "haml" when "HM" is typed.
//
// This will not change the order of suggestions based on SCORE_* until
// 1000 characters are inserted between matches.
PENALTY_CASE_MISMATCH = 0.9999,
// If the word has more characters than the user typed, it should
// be penalised slightly.
//
// i.e. "html" is more likely than "html5" if I type "html".
//
// However, it may well be the case that there's a sensible secondary
// ordering (like alphabetical) that it makes sense to rely on when
// there are many prefix matches, so we don't make the penalty increase
// with the number of tokens.
PENALTY_NOT_COMPLETE = 0.99;
var IS_GAP_REGEXP = /[\\\/\-_+.# \t"@\[\(\{&]/,
COUNT_GAPS_REGEXP = /[\\\/\-_+.# \t"@\[\(\{&]/g;
function commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, stringIndex, abbreviationIndex) {
if (abbreviationIndex === abbreviation.length) {
if (stringIndex === string.length) {
return SCORE_CONTINUE_MATCH;
}
return PENALTY_NOT_COMPLETE;
}
var abbreviationChar = lowerAbbreviation.charAt(abbreviationIndex);
var index = lowerString.indexOf(abbreviationChar, stringIndex);
var highScore = 0;
var score, transposedScore, wordBreaks;
while (index >= 0) {
score = commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, index + 1, abbreviationIndex + 1);
if (score > highScore) {
if (index === stringIndex) {
score *= SCORE_CONTINUE_MATCH;
} else if (IS_GAP_REGEXP.test(string.charAt(index - 1))) {
score *= SCORE_WORD_JUMP;
wordBreaks = string.slice(stringIndex, index - 1).match(COUNT_GAPS_REGEXP);
if (wordBreaks && stringIndex > 0) {
score *= Math.pow(PENALTY_SKIPPED, wordBreaks.length);
}
} else if (IS_GAP_REGEXP.test(string.slice(stringIndex, index - 1))) {
score *= SCORE_LONG_JUMP;
if (stringIndex > 0) {
score *= Math.pow(PENALTY_SKIPPED, index - stringIndex);
}
} else {
score *= SCORE_CHARACTER_JUMP;
if (stringIndex > 0) {
score *= Math.pow(PENALTY_SKIPPED, index - stringIndex);
}
}
if (string.charAt(index) !== abbreviation.charAt(abbreviationIndex)) {
score *= PENALTY_CASE_MISMATCH;
}
}
if (score < SCORE_TRANSPOSITION &&
lowerString.charAt(index - 1) === lowerAbbreviation.charAt(abbreviationIndex + 1) &&
lowerString.charAt(index - 1) !== lowerAbbreviation.charAt(abbreviationIndex)) {
transposedScore = commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, index + 1, abbreviationIndex + 2);
if (transposedScore * SCORE_TRANSPOSITION > score) {
score = transposedScore * SCORE_TRANSPOSITION;
}
}
if (score > highScore) {
highScore = score;
}
index = lowerString.indexOf(abbreviationChar, index + 1);
}
return highScore;
}
function commandScore(string, abbreviation) {
/* NOTE:
* in the original, we used to do the lower-casing on each recursive call, but this meant that toLowerCase()
* was the dominating cost in the algorithm, passing both is a little ugly, but considerably faster.
*/
return commandScoreInner(string, abbreviation, string.toLowerCase(), abbreviation.toLowerCase(), 0, 0);
}
module.exports = commandScore;
/***/ })
/******/ });
/************************************************************************/
/******/ // 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](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (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 */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/nonce */
/******/ (() => {
/******/ __webpack_require__.nc = undefined;
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
CommandMenu: () => (/* reexport */ CommandMenu),
privateApis: () => (/* reexport */ privateApis),
store: () => (/* reexport */ store),
useCommand: () => (/* reexport */ useCommand),
useCommandLoader: () => (/* reexport */ useCommandLoader)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/commands/build-module/store/actions.js
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, {
close: () => (actions_close),
open: () => (actions_open),
registerCommand: () => (registerCommand),
registerCommandLoader: () => (registerCommandLoader),
unregisterCommand: () => (unregisterCommand),
unregisterCommandLoader: () => (unregisterCommandLoader)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/commands/build-module/store/selectors.js
var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject);
__webpack_require__.d(selectors_namespaceObject, {
getCommandLoaders: () => (getCommandLoaders),
getCommands: () => (getCommands),
getContext: () => (getContext),
isOpen: () => (selectors_isOpen)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/commands/build-module/store/private-actions.js
var private_actions_namespaceObject = {};
__webpack_require__.r(private_actions_namespaceObject);
__webpack_require__.d(private_actions_namespaceObject, {
setContext: () => (setContext)
});
;// CONCATENATED MODULE: external "React"
const external_React_namespaceObject = window["React"];
;// 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: ./node_modules/@radix-ui/primitive/dist/index.module.js
function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented: checkForDefaultPrevented = true } = {}) {
return function handleEvent(event) {
originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
};
}
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-compose-refs/dist/index.module.js
/**
* Set a given ref to a given value
* This utility takes care of different types of refs: callback refs and RefObject(s)
*/ function $6ed0406888f73fc4$var$setRef(ref, value) {
if (typeof ref === 'function') ref(value);
else if (ref !== null && ref !== undefined) ref.current = value;
}
/**
* A utility to compose multiple refs together
* Accepts callback refs and RefObject(s)
*/ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)
)
;
}
/**
* A custom hook that composes multiple refs
* Accepts callback refs and RefObject(s)
*/ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
// eslint-disable-next-line react-hooks/exhaustive-deps
return (0,external_React_namespaceObject.useCallback)($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
}
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-context/dist/index.module.js
function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
const Context = /*#__PURE__*/ (0,external_React_namespaceObject.createContext)(defaultContext);
function Provider(props) {
const { children: children , ...context } = props; // Only re-memoize when prop values change
// eslint-disable-next-line react-hooks/exhaustive-deps
const value = (0,external_React_namespaceObject.useMemo)(()=>context
, Object.values(context));
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(Context.Provider, {
value: value
}, children);
}
function useContext(consumerName) {
const context = (0,external_React_namespaceObject.useContext)(Context);
if (context) return context;
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + 'Provider';
return [
Provider,
useContext
];
}
/* -------------------------------------------------------------------------------------------------
* createContextScope
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
let defaultContexts = [];
/* -----------------------------------------------------------------------------------------------
* createContext
* ---------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
const BaseContext = /*#__PURE__*/ (0,external_React_namespaceObject.createContext)(defaultContext);
const index = defaultContexts.length;
defaultContexts = [
...defaultContexts,
defaultContext
];
function Provider(props) {
const { scope: scope , children: children , ...context } = props;
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; // Only re-memoize when prop values change
// eslint-disable-next-line react-hooks/exhaustive-deps
const value = (0,external_React_namespaceObject.useMemo)(()=>context
, Object.values(context));
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(Context.Provider, {
value: value
}, children);
}
function useContext(consumerName, scope) {
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
const context = (0,external_React_namespaceObject.useContext)(Context);
if (context) return context;
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + 'Provider';
return [
Provider,
useContext
];
}
/* -----------------------------------------------------------------------------------------------
* createScope
* ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{
const scopeContexts = defaultContexts.map((defaultContext)=>{
return /*#__PURE__*/ (0,external_React_namespaceObject.createContext)(defaultContext);
});
return function useScope(scope) {
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
return (0,external_React_namespaceObject.useMemo)(()=>({
[`__scope${scopeName}`]: {
...scope,
[scopeName]: contexts
}
})
, [
scope,
contexts
]);
};
};
createScope.scopeName = scopeName;
return [
$c512c27ab02ef895$export$fd42f52fd3ae1109,
$c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps)
];
}
/* -------------------------------------------------------------------------------------------------
* composeContextScopes
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$var$composeContextScopes(...scopes) {
const baseScope = scopes[0];
if (scopes.length === 1) return baseScope;
const createScope1 = ()=>{
const scopeHooks = scopes.map((createScope)=>({
useScope: createScope(),
scopeName: createScope.scopeName
})
);
return function useComposedScopes(overrideScopes) {
const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope: useScope , scopeName: scopeName })=>{
// We are calling a hook inside a callback which React warns against to avoid inconsistent
// renders, however, scoping doesn't have render side effects so we ignore the rule.
// eslint-disable-next-line react-hooks/rules-of-hooks
const scopeProps = useScope(overrideScopes);
const currentScope = scopeProps[`__scope${scopeName}`];
return {
...nextScopes,
...currentScope
};
}, {});
return (0,external_React_namespaceObject.useMemo)(()=>({
[`__scope${baseScope.scopeName}`]: nextScopes1
})
, [
nextScopes1
]);
};
};
createScope1.scopeName = baseScope.scopeName;
return createScope1;
}
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-use-layout-effect/dist/index.module.js
/**
* On the server, React emits a warning when calling `useLayoutEffect`.
* This is because neither `useLayoutEffect` nor `useEffect` run on the server.
* We use this safe version which suppresses the warning by replacing it with a noop on the server.
*
* See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
*/ const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? external_React_namespaceObject.useLayoutEffect : ()=>{};
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-id/dist/index.module.js
const $1746a345f3d73bb7$var$useReactId = external_React_namespaceObject['useId'.toString()] || (()=>undefined
);
let $1746a345f3d73bb7$var$count = 0;
function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
const [id, setId] = external_React_namespaceObject.useState($1746a345f3d73bb7$var$useReactId()); // React versions older than 18 will have client-side ids only.
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
if (!deterministicId) setId((reactId)=>reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
);
}, [
deterministicId
]);
return deterministicId || (id ? `radix-${id}` : '');
}
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-use-callback-ref/dist/index.module.js
/**
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
* prop or avoid re-executing effects when passed as a dependency
*/ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
const callbackRef = (0,external_React_namespaceObject.useRef)(callback);
(0,external_React_namespaceObject.useEffect)(()=>{
callbackRef.current = callback;
}); // https://github.com/facebook/react/issues/19240
return (0,external_React_namespaceObject.useMemo)(()=>(...args)=>{
var _callbackRef$current;
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
}
, []);
}
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-use-controllable-state/dist/index.module.js
function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: prop , defaultProp: defaultProp , onChange: onChange = ()=>{} }) {
const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({
defaultProp: defaultProp,
onChange: onChange
});
const isControlled = prop !== undefined;
const value1 = isControlled ? prop : uncontrolledProp;
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
const setValue = (0,external_React_namespaceObject.useCallback)((nextValue)=>{
if (isControlled) {
const setter = nextValue;
const value = typeof nextValue === 'function' ? setter(prop) : nextValue;
if (value !== prop) handleChange(value);
} else setUncontrolledProp(nextValue);
}, [
isControlled,
prop,
setUncontrolledProp,
handleChange
]);
return [
value1,
setValue
];
}
function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp , onChange: onChange }) {
const uncontrolledState = (0,external_React_namespaceObject.useState)(defaultProp);
const [value] = uncontrolledState;
const prevValueRef = (0,external_React_namespaceObject.useRef)(value);
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
(0,external_React_namespaceObject.useEffect)(()=>{
if (prevValueRef.current !== value) {
handleChange(value);
prevValueRef.current = value;
}
}, [
value,
prevValueRef,
handleChange
]);
return uncontrolledState;
}
;// CONCATENATED MODULE: external "ReactDOM"
const external_ReactDOM_namespaceObject = window["ReactDOM"];
var external_ReactDOM_default = /*#__PURE__*/__webpack_require__.n(external_ReactDOM_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot/dist/index.module.js
/* -------------------------------------------------------------------------------------------------
* Slot
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const { children: children , ...slotProps } = props;
const childrenArray = external_React_namespaceObject.Children.toArray(children);
const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);
if (slottable) {
// the new element to render is the one passed as a child of `Slottable`
const newElement = slottable.props.children;
const newChildren = childrenArray.map((child)=>{
if (child === slottable) {
// because the new element will be the one rendered, we are only interested
// in grabbing its children (`newElement.props.children`)
if (external_React_namespaceObject.Children.count(newElement) > 1) return external_React_namespaceObject.Children.only(null);
return /*#__PURE__*/ (0,external_React_namespaceObject.isValidElement)(newElement) ? newElement.props.children : null;
} else return child;
});
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
ref: forwardedRef
}), /*#__PURE__*/ (0,external_React_namespaceObject.isValidElement)(newElement) ? /*#__PURE__*/ (0,external_React_namespaceObject.cloneElement)(newElement, undefined, newChildren) : null);
}
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
ref: forwardedRef
}), children);
});
$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = 'Slot';
/* -------------------------------------------------------------------------------------------------
* SlotClone
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$var$SlotClone = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const { children: children , ...slotProps } = props;
if (/*#__PURE__*/ (0,external_React_namespaceObject.isValidElement)(children)) return /*#__PURE__*/ (0,external_React_namespaceObject.cloneElement)(children, {
...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),
ref: $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref)
});
return external_React_namespaceObject.Children.count(children) > 1 ? external_React_namespaceObject.Children.only(null) : null;
});
$5e63c961fc1ce211$var$SlotClone.displayName = 'SlotClone';
/* -------------------------------------------------------------------------------------------------
* Slottable
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children: children })=>{
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, children);
};
/* ---------------------------------------------------------------------------------------------- */ function $5e63c961fc1ce211$var$isSlottable(child) {
return /*#__PURE__*/ (0,external_React_namespaceObject.isValidElement)(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;
}
function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {
// all child props should override
const overrideProps = {
...childProps
};
for(const propName in childProps){
const slotPropValue = slotProps[propName];
const childPropValue = childProps[propName];
const isHandler = /^on[A-Z]/.test(propName); // if it's a handler, modify the override by composing the base handler
if (isHandler) overrideProps[propName] = (...args)=>{
childPropValue === null || childPropValue === void 0 || childPropValue(...args);
slotPropValue === null || slotPropValue === void 0 || slotPropValue(...args);
};
else if (propName === 'style') overrideProps[propName] = {
...slotPropValue,
...childPropValue
};
else if (propName === 'className') overrideProps[propName] = [
slotPropValue,
childPropValue
].filter(Boolean).join(' ');
}
return {
...slotProps,
...overrideProps
};
}
const $5e63c961fc1ce211$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($5e63c961fc1ce211$export$8c6ed5c666ac1360));
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.module.js
const $8927f6f2acc4f386$var$NODES = [
'a',
'button',
'div',
'h2',
'h3',
'img',
'li',
'nav',
'ol',
'p',
'span',
'svg',
'ul'
]; // Temporary while we await merge of this fix:
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
// prettier-ignore
/* -------------------------------------------------------------------------------------------------
* Primitive
* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{
const Node = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const { asChild: asChild , ...primitiveProps } = props;
const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
(0,external_React_namespaceObject.useEffect)(()=>{
window[Symbol.for('radix-ui')] = true;
}, []);
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(Comp, _extends({}, primitiveProps, {
ref: forwardedRef
}));
});
Node.displayName = `Primitive.${node}`;
return {
...primitive,
[node]: Node
};
}, {});
/* -------------------------------------------------------------------------------------------------
* Utils
* -----------------------------------------------------------------------------------------------*/ /**
* Flush custom event dispatch
* https://github.com/radix-ui/primitives/pull/1378
*
* React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.
*
* Internally, React prioritises events in the following order:
* - discrete
* - continuous
* - default
*
* https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350
*
* `discrete` is an important distinction as updates within these events are applied immediately.
* React however, is not able to infer the priority of custom event types due to how they are detected internally.
* Because of this, it's possible for updates from custom events to be unexpectedly batched when
* dispatched by another `discrete` event.
*
* In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.
* This utility should be used when dispatching a custom event from within another `discrete` event, this utility
* is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.
* For example:
*
* dispatching a known click 👎
* target.dispatchEvent(new Event(‘click’))
*
* dispatching a custom type within a non-discrete event 👎
* onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}
*
* dispatching a custom type within a `discrete` event 👍
* onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}
*
* Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use
* this utility with them. This is because it's possible for those handlers to be called implicitly during render
* e.g. when focus is within a component as it is unmounted, or when managing focus on mount.
*/ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {
if (target) (0,external_ReactDOM_namespaceObject.flushSync)(()=>target.dispatchEvent(event)
);
}
/* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($8927f6f2acc4f386$export$250ffa63cdc0d034));
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-escape-keydown/dist/index.module.js
/**
* Listens for when the escape key is down
*/ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp) {
const onEscapeKeyDown = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEscapeKeyDownProp);
(0,external_React_namespaceObject.useEffect)(()=>{
const handleKeyDown = (event)=>{
if (event.key === 'Escape') onEscapeKeyDown(event);
};
document.addEventListener('keydown', handleKeyDown);
return ()=>document.removeEventListener('keydown', handleKeyDown)
;
}, [
onEscapeKeyDown
]);
}
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.module.js
/* -------------------------------------------------------------------------------------------------
* DismissableLayer
* -----------------------------------------------------------------------------------------------*/ const $5cb92bef7577960e$var$DISMISSABLE_LAYER_NAME = 'DismissableLayer';
const $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update';
const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';
const $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';
let $5cb92bef7577960e$var$originalBodyPointerEvents;
const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ (0,external_React_namespaceObject.createContext)({
layers: new Set(),
layersWithOutsidePointerEventsDisabled: new Set(),
branches: new Set()
});
const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props;
const context = (0,external_React_namespaceObject.useContext)($5cb92bef7577960e$var$DismissableLayerContext);
const [node1, setNode] = (0,external_React_namespaceObject.useState)(null);
const [, force] = (0,external_React_namespaceObject.useState)({});
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setNode(node)
);
const layers = Array.from(context.layers);
const [highestLayerWithOutsidePointerEventsDisabled] = [
...context.layersWithOutsidePointerEventsDisabled
].slice(-1); // prettier-ignore
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); // prettier-ignore
const index = node1 ? layers.indexOf(node1) : -1;
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event)=>{
const target = event.target;
const isPointerDownOnBranch = [
...context.branches
].some((branch)=>branch.contains(target)
);
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
});
const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event)=>{
const target = event.target;
const isFocusInBranch = [
...context.branches
].some((branch)=>branch.contains(target)
);
if (isFocusInBranch) return;
onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);
onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
});
$addc16e1bbe58fd0$export$3a72a57244d6e765((event)=>{
const isHighestLayer = index === context.layers.size - 1;
if (!isHighestLayer) return;
onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);
if (!event.defaultPrevented && onDismiss) {
event.preventDefault();
onDismiss();
}
});
(0,external_React_namespaceObject.useEffect)(()=>{
if (!node1) return;
if (disableOutsidePointerEvents) {
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
$5cb92bef7577960e$var$originalBodyPointerEvents = document.body.style.pointerEvents;
document.body.style.pointerEvents = 'none';
}
context.layersWithOutsidePointerEventsDisabled.add(node1);
}
context.layers.add(node1);
$5cb92bef7577960e$var$dispatchUpdate();
return ()=>{
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) document.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents;
};
}, [
node1,
disableOutsidePointerEvents,
context
]);
/**
* We purposefully prevent combining this effect with the `disableOutsidePointerEvents` effect
* because a change to `disableOutsidePointerEvents` would remove this layer from the stack
* and add it to the end again so the layering order wouldn't be _creation order_.
* We only want them to be removed from context stacks when unmounted.
*/ (0,external_React_namespaceObject.useEffect)(()=>{
return ()=>{
if (!node1) return;
context.layers.delete(node1);
context.layersWithOutsidePointerEventsDisabled.delete(node1);
$5cb92bef7577960e$var$dispatchUpdate();
};
}, [
node1,
context
]);
(0,external_React_namespaceObject.useEffect)(()=>{
const handleUpdate = ()=>force({})
;
document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
return ()=>document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate)
;
}, []);
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, layerProps, {
ref: composedRefs,
style: {
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined,
...props.style
},
onFocusCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture),
onBlurCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture),
onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
}));
});
/*#__PURE__*/ Object.assign($5cb92bef7577960e$export$177fb62ff3ec1f22, {
displayName: $5cb92bef7577960e$var$DISMISSABLE_LAYER_NAME
});
/* -------------------------------------------------------------------------------------------------
* DismissableLayerBranch
* -----------------------------------------------------------------------------------------------*/ const $5cb92bef7577960e$var$BRANCH_NAME = 'DismissableLayerBranch';
const $5cb92bef7577960e$export$4d5eb2109db14228 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const context = (0,external_React_namespaceObject.useContext)($5cb92bef7577960e$var$DismissableLayerContext);
const ref = (0,external_React_namespaceObject.useRef)(null);
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
(0,external_React_namespaceObject.useEffect)(()=>{
const node = ref.current;
if (node) {
context.branches.add(node);
return ()=>{
context.branches.delete(node);
};
}
}, [
context.branches
]);
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, props, {
ref: composedRefs
}));
});
/*#__PURE__*/ Object.assign($5cb92bef7577960e$export$4d5eb2109db14228, {
displayName: $5cb92bef7577960e$var$BRANCH_NAME
});
/* -----------------------------------------------------------------------------------------------*/ /**
* Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup`
* to mimic layer dismissing behaviour present in OS.
* Returns props to pass to the node we want to check for outside events.
*/ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside) {
const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside);
const isPointerInsideReactTreeRef = (0,external_React_namespaceObject.useRef)(false);
const handleClickRef = (0,external_React_namespaceObject.useRef)(()=>{});
(0,external_React_namespaceObject.useEffect)(()=>{
const handlePointerDown = (event)=>{
if (event.target && !isPointerInsideReactTreeRef.current) {
const eventDetail = {
originalEvent: event
};
function handleAndDispatchPointerDownOutsideEvent() {
$5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {
discrete: true
});
}
/**
* On touch devices, we need to wait for a click event because browsers implement
* a ~350ms delay between the time the user stops touching the display and when the
* browser executres events. We need to ensure we don't reactivate pointer-events within
* this timeframe otherwise the browser may execute events that should have been prevented.
*
* Additionally, this also lets us deal automatically with cancellations when a click event
* isn't raised because the page was considered scrolled/drag-scrolled, long-pressed, etc.
*
* This is why we also continuously remove the previous listener, because we cannot be
* certain that it was raised, and therefore cleaned-up.
*/ if (event.pointerType === 'touch') {
document.removeEventListener('click', handleClickRef.current);
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;
document.addEventListener('click', handleClickRef.current, {
once: true
});
} else handleAndDispatchPointerDownOutsideEvent();
}
isPointerInsideReactTreeRef.current = false;
};
/**
* if this hook executes in a component that mounts via a `pointerdown` event, the event
* would bubble up to the document and trigger a `pointerDownOutside` event. We avoid
* this by delaying the event listener registration on the document.
* This is not React specific, but rather how the DOM works, ie:
* ```
* button.addEventListener('pointerdown', () => {
* console.log('I will log');
* document.addEventListener('pointerdown', () => {
* console.log('I will also log');
* })
* });
*/ const timerId = window.setTimeout(()=>{
document.addEventListener('pointerdown', handlePointerDown);
}, 0);
return ()=>{
window.clearTimeout(timerId);
document.removeEventListener('pointerdown', handlePointerDown);
document.removeEventListener('click', handleClickRef.current);
};
}, [
handlePointerDownOutside
]);
return {
// ensures we check React component tree (not just DOM tree)
onPointerDownCapture: ()=>isPointerInsideReactTreeRef.current = true
};
}
/**
* Listens for when focus happens outside a react subtree.
* Returns props to pass to the root (node) of the subtree we want to check.
*/ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside) {
const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside);
const isFocusInsideReactTreeRef = (0,external_React_namespaceObject.useRef)(false);
(0,external_React_namespaceObject.useEffect)(()=>{
const handleFocus = (event)=>{
if (event.target && !isFocusInsideReactTreeRef.current) {
const eventDetail = {
originalEvent: event
};
$5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
discrete: false
});
}
};
document.addEventListener('focusin', handleFocus);
return ()=>document.removeEventListener('focusin', handleFocus)
;
}, [
handleFocusOutside
]);
return {
onFocusCapture: ()=>isFocusInsideReactTreeRef.current = true
,
onBlurCapture: ()=>isFocusInsideReactTreeRef.current = false
};
}
function $5cb92bef7577960e$var$dispatchUpdate() {
const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE);
document.dispatchEvent(event);
}
function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detail, { discrete: discrete }) {
const target = detail.originalEvent.target;
const event = new CustomEvent(name, {
bubbles: false,
cancelable: true,
detail: detail
});
if (handler) target.addEventListener(name, handler, {
once: true
});
if (discrete) $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event);
else target.dispatchEvent(event);
}
const $5cb92bef7577960e$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($5cb92bef7577960e$export$177fb62ff3ec1f22));
const $5cb92bef7577960e$export$aecb2ddcb55c95be = (/* unused pure expression or super */ null && ($5cb92bef7577960e$export$4d5eb2109db14228));
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-focus-scope/dist/index.module.js
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';
const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
bubbles: false,
cancelable: true
};
/* -------------------------------------------------------------------------------------------------
* FocusScope
* -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$FOCUS_SCOPE_NAME = 'FocusScope';
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
const [container1, setContainer] = (0,external_React_namespaceObject.useState)(null);
const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
const lastFocusedElementRef = (0,external_React_namespaceObject.useRef)(null);
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node)
);
const focusScope = (0,external_React_namespaceObject.useRef)({
paused: false,
pause () {
this.paused = true;
},
resume () {
this.paused = false;
}
}).current; // Takes care of trapping focus if focus is moved outside programmatically for example
(0,external_React_namespaceObject.useEffect)(()=>{
if (trapped) {
function handleFocusIn(event) {
if (focusScope.paused || !container1) return;
const target = event.target;
if (container1.contains(target)) lastFocusedElementRef.current = target;
else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
select: true
});
}
function handleFocusOut(event) {
if (focusScope.paused || !container1) return;
if (!container1.contains(event.relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
select: true
});
}
document.addEventListener('focusin', handleFocusIn);
document.addEventListener('focusout', handleFocusOut);
return ()=>{
document.removeEventListener('focusin', handleFocusIn);
document.removeEventListener('focusout', handleFocusOut);
};
}
}, [
trapped,
container1,
focusScope.paused
]);
(0,external_React_namespaceObject.useEffect)(()=>{
if (container1) {
$d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
const previouslyFocusedElement = document.activeElement;
const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
if (!hasFocusedCandidate) {
const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
container1.dispatchEvent(mountEvent);
if (!mountEvent.defaultPrevented) {
$d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {
select: true
});
if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);
}
}
return ()=>{
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.
// We need to delay the focus a little to get around it for now.
// See: https://github.com/facebook/react/issues/17894
setTimeout(()=>{
const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
container1.dispatchEvent(unmountEvent);
if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
select: true
});
// we need to remove the listener after we `dispatchEvent`
container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
$d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);
}, 0);
};
}
}, [
container1,
onMountAutoFocus,
onUnmountAutoFocus,
focusScope
]); // Takes care of looping focus (when tabbing whilst at the edges)
const handleKeyDown = (0,external_React_namespaceObject.useCallback)((event)=>{
if (!loop && !trapped) return;
if (focusScope.paused) return;
const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
const focusedElement = document.activeElement;
if (isTabKey && focusedElement) {
const container = event.currentTarget;
const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);
const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges
if (!hasTabbableElementsInside) {
if (focusedElement === container) event.preventDefault();
} else {
if (!event.shiftKey && focusedElement === last) {
event.preventDefault();
if (loop) $d3863c46a17e8a28$var$focus(first, {
select: true
});
} else if (event.shiftKey && focusedElement === first) {
event.preventDefault();
if (loop) $d3863c46a17e8a28$var$focus(last, {
select: true
});
}
}
}
}, [
loop,
trapped,
focusScope.paused
]);
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
tabIndex: -1
}, scopeProps, {
ref: composedRefs,
onKeyDown: handleKeyDown
}));
});
/*#__PURE__*/ Object.assign($d3863c46a17e8a28$export$20e40289641fbbb6, {
displayName: $d3863c46a17e8a28$var$FOCUS_SCOPE_NAME
});
/* -------------------------------------------------------------------------------------------------
* Utils
* -----------------------------------------------------------------------------------------------*/ /**
* Attempts focusing the first element in a list of candidates.
* Stops when focus has actually moved.
*/ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {
const previouslyFocusedElement = document.activeElement;
for (const candidate of candidates){
$d3863c46a17e8a28$var$focus(candidate, {
select: select
});
if (document.activeElement !== previouslyFocusedElement) return;
}
}
/**
* Returns the first and last tabbable elements inside a container.
*/ function $d3863c46a17e8a28$var$getTabbableEdges(container) {
const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);
const first = $d3863c46a17e8a28$var$findVisible(candidates, container);
const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);
return [
first,
last
];
}
/**
* Returns a list of potential tabbable candidates.
*
* NOTE: This is only a close approximation. For example it doesn't take into account cases like when
* elements are not visible. This cannot be worked out easily by just reading a property, but rather
* necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
*
* See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
* Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
*/ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {
const nodes = [];
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
acceptNode: (node)=>{
const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
// runtime's understanding of tabbability, so this automatically accounts
// for any kind of element that could be tabbed to.
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
}
});
while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
// hinders accessibility to have tab order different from visual order.
return nodes;
}
/**
* Returns the first visible element in a list.
* NOTE: Only checks visibility up to the `container`.
*/ function $d3863c46a17e8a28$var$findVisible(elements, container) {
for (const element of elements){
// we stop checking if it's hidden at the `container` level (excluding)
if (!$d3863c46a17e8a28$var$isHidden(element, {
upTo: container
})) return element;
}
}
function $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {
if (getComputedStyle(node).visibility === 'hidden') return true;
while(node){
// we stop at `upTo` (excluding it)
if (upTo !== undefined && node === upTo) return false;
if (getComputedStyle(node).display === 'none') return true;
node = node.parentElement;
}
return false;
}
function $d3863c46a17e8a28$var$isSelectableInput(element) {
return element instanceof HTMLInputElement && 'select' in element;
}
function $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {
// only focus if that element is focusable
if (element && element.focus) {
const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users
element.focus({
preventScroll: true
}); // only select if its not the same element, it supports selection and we need to select
if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();
}
}
/* -------------------------------------------------------------------------------------------------
* FocusScope stack
* -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();
function $d3863c46a17e8a28$var$createFocusScopesStack() {
/** A stack of focus scopes, with the active one at the top */ let stack = [];
return {
add (focusScope) {
// pause the currently active focus scope (at the top of the stack)
const activeFocusScope = stack[0];
if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
// remove in case it already exists (because we'll re-add it at the top of the stack)
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
stack.unshift(focusScope);
},
remove (focusScope) {
var _stack$;
stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
(_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
}
};
}
function $d3863c46a17e8a28$var$arrayRemove(array, item) {
const updatedArray = [
...array
];
const index = updatedArray.indexOf(item);
if (index !== -1) updatedArray.splice(index, 1);
return updatedArray;
}
function $d3863c46a17e8a28$var$removeLinks(items) {
return items.filter((item)=>item.tagName !== 'A'
);
}
const $d3863c46a17e8a28$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($d3863c46a17e8a28$export$20e40289641fbbb6));
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.module.js
/* -------------------------------------------------------------------------------------------------
* Portal
* -----------------------------------------------------------------------------------------------*/ const $f1701beae083dbae$var$PORTAL_NAME = 'Portal';
const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
var _globalThis$document;
const { container: container = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body , ...portalProps } = props;
return container ? /*#__PURE__*/ external_ReactDOM_default().createPortal(/*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, portalProps, {
ref: forwardedRef
})), container) : null;
});
/*#__PURE__*/ Object.assign($f1701beae083dbae$export$602eac185826482c, {
displayName: $f1701beae083dbae$var$PORTAL_NAME
});
/* -----------------------------------------------------------------------------------------------*/ const $f1701beae083dbae$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($f1701beae083dbae$export$602eac185826482c));
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-presence/dist/index.module.js
function $fe963b355347cc68$export$3e6543de14f8614f(initialState, machine) {
return (0,external_React_namespaceObject.useReducer)((state, event)=>{
const nextState = machine[state][event];
return nextState !== null && nextState !== void 0 ? nextState : state;
}, initialState);
}
const $921a889cee6df7e8$export$99c2b779aa4e8b8b = (props)=>{
const { present: present , children: children } = props;
const presence = $921a889cee6df7e8$var$usePresence(present);
const child = typeof children === 'function' ? children({
present: presence.isPresent
}) : external_React_namespaceObject.Children.only(children);
const ref = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(presence.ref, child.ref);
const forceMount = typeof children === 'function';
return forceMount || presence.isPresent ? /*#__PURE__*/ (0,external_React_namespaceObject.cloneElement)(child, {
ref: ref
}) : null;
};
$921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = 'Presence';
/* -------------------------------------------------------------------------------------------------
* usePresence
* -----------------------------------------------------------------------------------------------*/ function $921a889cee6df7e8$var$usePresence(present) {
const [node1, setNode] = (0,external_React_namespaceObject.useState)();
const stylesRef = (0,external_React_namespaceObject.useRef)({});
const prevPresentRef = (0,external_React_namespaceObject.useRef)(present);
const prevAnimationNameRef = (0,external_React_namespaceObject.useRef)('none');
const initialState = present ? 'mounted' : 'unmounted';
const [state, send] = $fe963b355347cc68$export$3e6543de14f8614f(initialState, {
mounted: {
UNMOUNT: 'unmounted',
ANIMATION_OUT: 'unmountSuspended'
},
unmountSuspended: {
MOUNT: 'mounted',
ANIMATION_END: 'unmounted'
},
unmounted: {
MOUNT: 'mounted'
}
});
(0,external_React_namespaceObject.useEffect)(()=>{
const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
prevAnimationNameRef.current = state === 'mounted' ? currentAnimationName : 'none';
}, [
state
]);
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
const styles = stylesRef.current;
const wasPresent = prevPresentRef.current;
const hasPresentChanged = wasPresent !== present;
if (hasPresentChanged) {
const prevAnimationName = prevAnimationNameRef.current;
const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(styles);
if (present) send('MOUNT');
else if (currentAnimationName === 'none' || (styles === null || styles === void 0 ? void 0 : styles.display) === 'none') // If there is no exit animation or the element is hidden, animations won't run
// so we unmount instantly
send('UNMOUNT');
else {
/**
* When `present` changes to `false`, we check changes to animation-name to
* determine whether an animation has started. We chose this approach (reading
* computed styles) because there is no `animationrun` event and `animationstart`
* fires after `animation-delay` has expired which would be too late.
*/ const isAnimating = prevAnimationName !== currentAnimationName;
if (wasPresent && isAnimating) send('ANIMATION_OUT');
else send('UNMOUNT');
}
prevPresentRef.current = present;
}
}, [
present,
send
]);
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
if (node1) {
/**
* Triggering an ANIMATION_OUT during an ANIMATION_IN will fire an `animationcancel`
* event for ANIMATION_IN after we have entered `unmountSuspended` state. So, we
* make sure we only trigger ANIMATION_END for the currently active animation.
*/ const handleAnimationEnd = (event)=>{
const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
if (event.target === node1 && isCurrentAnimation) // With React 18 concurrency this update is applied
// a frame after the animation ends, creating a flash of visible content.
// By manually flushing we ensure they sync within a frame, removing the flash.
(0,external_ReactDOM_namespaceObject.flushSync)(()=>send('ANIMATION_END')
);
};
const handleAnimationStart = (event)=>{
if (event.target === node1) // if animation occurred, store its name as the previous animation.
prevAnimationNameRef.current = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
};
node1.addEventListener('animationstart', handleAnimationStart);
node1.addEventListener('animationcancel', handleAnimationEnd);
node1.addEventListener('animationend', handleAnimationEnd);
return ()=>{
node1.removeEventListener('animationstart', handleAnimationStart);
node1.removeEventListener('animationcancel', handleAnimationEnd);
node1.removeEventListener('animationend', handleAnimationEnd);
};
} else // Transition to the unmounted state if the node is removed prematurely.
// We avoid doing so during cleanup as the node may change but still exist.
send('ANIMATION_END');
}, [
node1,
send
]);
return {
isPresent: [
'mounted',
'unmountSuspended'
].includes(state),
ref: (0,external_React_namespaceObject.useCallback)((node)=>{
if (node) stylesRef.current = getComputedStyle(node);
setNode(node);
}, [])
};
}
/* -----------------------------------------------------------------------------------------------*/ function $921a889cee6df7e8$var$getAnimationName(styles) {
return (styles === null || styles === void 0 ? void 0 : styles.animationName) || 'none';
}
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-focus-guards/dist/index.module.js
/** Number of components which have requested interest to have focus guards */ let $3db38b7d1fb3fe6a$var$count = 0;
function $3db38b7d1fb3fe6a$export$ac5b58043b79449b(props) {
$3db38b7d1fb3fe6a$export$b7ece24a22aeda8c();
return props.children;
}
/**
* Injects a pair of focus guards at the edges of the whole DOM tree
* to ensure `focusin` & `focusout` events can be caught consistently.
*/ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
(0,external_React_namespaceObject.useEffect)(()=>{
var _edgeGuards$, _edgeGuards$2;
const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
document.body.insertAdjacentElement('beforeend', (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard());
$3db38b7d1fb3fe6a$var$count++;
return ()=>{
if ($3db38b7d1fb3fe6a$var$count === 1) document.querySelectorAll('[data-radix-focus-guard]').forEach((node)=>node.remove()
);
$3db38b7d1fb3fe6a$var$count--;
};
}, []);
}
function $3db38b7d1fb3fe6a$var$createFocusGuard() {
const element = document.createElement('span');
element.setAttribute('data-radix-focus-guard', '');
element.tabIndex = 0;
element.style.cssText = 'outline: none; opacity: 0; position: fixed; pointer-events: none';
return element;
}
const $3db38b7d1fb3fe6a$export$be92b6f5f03c0fe9 = (/* unused pure expression or super */ null && ($3db38b7d1fb3fe6a$export$ac5b58043b79449b));
;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
/******************************************************************************
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, SuppressedError, Symbol */
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) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
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 __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
};
function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
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 (g && (g = 0, op[0] && (_ = 0)), _) 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;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (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;
}
/** @deprecated */
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
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 __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
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: false } : 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, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
function next() {
while (env.stack.length) {
var rec = env.stack.pop();
try {
var result = rec.dispose && rec.dispose.call(rec.value);
if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
catch (e) {
fail(e);
}
}
if (env.hasError) throw env.error;
}
return next();
}
/* harmony default export */ const tslib_es6 = ({
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__createBinding,
__exportStar,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
});
;// CONCATENATED MODULE: ./node_modules/react-remove-scroll-bar/dist/es2015/constants.js
var zeroRightClassName = 'right-scroll-bar-position';
var fullWidthClassName = 'width-before-scroll-bar';
var noScrollbarsClassName = 'with-scroll-bars-hidden';
/**
* Name of a CSS variable containing the amount of "hidden" scrollbar
* ! might be undefined ! use will fallback!
*/
var removedBarSizeVariable = '--removed-body-scroll-bar-size';
;// CONCATENATED MODULE: ./node_modules/use-callback-ref/dist/es2015/assignRef.js
/**
* Assigns a value for a given ref, no matter of the ref format
* @param {RefObject} ref - a callback function or ref object
* @param value - a new value
*
* @see https://github.com/theKashey/use-callback-ref#assignref
* @example
* const refObject = useRef();
* const refFn = (ref) => {....}
*
* assignRef(refObject, "refValue");
* assignRef(refFn, "refValue");
*/
function assignRef(ref, value) {
if (typeof ref === 'function') {
ref(value);
}
else if (ref) {
ref.current = value;
}
return ref;
}
;// CONCATENATED MODULE: ./node_modules/use-callback-ref/dist/es2015/useRef.js
/**
* creates a MutableRef with ref change callback
* @param initialValue - initial ref value
* @param {Function} callback - a callback to run when value changes
*
* @example
* const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);
* ref.current = 1;
* // prints 0 -> 1
*
* @see https://reactjs.org/docs/hooks-reference.html#useref
* @see https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref
* @returns {MutableRefObject}
*/
function useCallbackRef(initialValue, callback) {
var ref = (0,external_React_namespaceObject.useState)(function () { return ({
// value
value: initialValue,
// last callback
callback: callback,
// "memoized" public interface
facade: {
get current() {
return ref.value;
},
set current(value) {
var last = ref.value;
if (last !== value) {
ref.value = value;
ref.callback(value, last);
}
},
},
}); })[0];
// update callback
ref.callback = callback;
return ref.facade;
}
;// CONCATENATED MODULE: ./node_modules/use-callback-ref/dist/es2015/useMergeRef.js
/**
* Merges two or more refs together providing a single interface to set their value
* @param {RefObject|Ref} refs
* @returns {MutableRefObject} - a new ref, which translates all changes to {refs}
*
* @see {@link mergeRefs} a version without buit-in memoization
* @see https://github.com/theKashey/use-callback-ref#usemergerefs
* @example
* const Component = React.forwardRef((props, ref) => {
* const ownRef = useRef();
* const domRef = useMergeRefs([ref, ownRef]); // 👈 merge together
* return <div ref={domRef}>...</div>
* }
*/
function useMergeRefs(refs, defaultValue) {
return useCallbackRef(defaultValue || null, function (newValue) { return refs.forEach(function (ref) { return assignRef(ref, newValue); }); });
}
;// CONCATENATED MODULE: ./node_modules/use-sidecar/dist/es2015/medium.js
function ItoI(a) {
return a;
}
function innerCreateMedium(defaults, middleware) {
if (middleware === void 0) { middleware = ItoI; }
var buffer = [];
var assigned = false;
var medium = {
read: function () {
if (assigned) {
throw new Error('Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.');
}
if (buffer.length) {
return buffer[buffer.length - 1];
}
return defaults;
},
useMedium: function (data) {
var item = middleware(data, assigned);
buffer.push(item);
return function () {
buffer = buffer.filter(function (x) { return x !== item; });
};
},
assignSyncMedium: function (cb) {
assigned = true;
while (buffer.length) {
var cbs = buffer;
buffer = [];
cbs.forEach(cb);
}
buffer = {
push: function (x) { return cb(x); },
filter: function () { return buffer; },
};
},
assignMedium: function (cb) {
assigned = true;
var pendingQueue = [];
if (buffer.length) {
var cbs = buffer;
buffer = [];
cbs.forEach(cb);
pendingQueue = buffer;
}
var executeQueue = function () {
var cbs = pendingQueue;
pendingQueue = [];
cbs.forEach(cb);
};
var cycle = function () { return Promise.resolve().then(executeQueue); };
cycle();
buffer = {
push: function (x) {
pendingQueue.push(x);
cycle();
},
filter: function (filter) {
pendingQueue = pendingQueue.filter(filter);
return buffer;
},
};
},
};
return medium;
}
function createMedium(defaults, middleware) {
if (middleware === void 0) { middleware = ItoI; }
return innerCreateMedium(defaults, middleware);
}
// eslint-disable-next-line @typescript-eslint/ban-types
function createSidecarMedium(options) {
if (options === void 0) { options = {}; }
var medium = innerCreateMedium(null);
medium.options = __assign({ async: true, ssr: false }, options);
return medium;
}
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/medium.js
var effectCar = createSidecarMedium();
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/UI.js
var nothing = function () {
return;
};
/**
* Removes scrollbar from the page and contain the scroll within the Lock
*/
var RemoveScroll = external_React_namespaceObject.forwardRef(function (props, parentRef) {
var ref = external_React_namespaceObject.useRef(null);
var _a = external_React_namespaceObject.useState({
onScrollCapture: nothing,
onWheelCapture: nothing,
onTouchMoveCapture: nothing,
}), callbacks = _a[0], setCallbacks = _a[1];
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as"]);
var SideCar = sideCar;
var containerRef = useMergeRefs([ref, parentRef]);
var containerProps = __assign(__assign({}, rest), callbacks);
return (external_React_namespaceObject.createElement(external_React_namespaceObject.Fragment, null,
enabled && (external_React_namespaceObject.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref })),
forwardProps ? (external_React_namespaceObject.cloneElement(external_React_namespaceObject.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef }))) : (external_React_namespaceObject.createElement(Container, __assign({}, containerProps, { className: className, ref: containerRef }), children))));
});
RemoveScroll.defaultProps = {
enabled: true,
removeScrollBar: true,
inert: false,
};
RemoveScroll.classNames = {
fullWidth: fullWidthClassName,
zeroRight: zeroRightClassName,
};
;// CONCATENATED MODULE: ./node_modules/use-sidecar/dist/es2015/exports.js
var SideCar = function (_a) {
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
if (!sideCar) {
throw new Error('Sidecar: please provide `sideCar` property to import the right car');
}
var Target = sideCar.read();
if (!Target) {
throw new Error('Sidecar medium not found');
}
return external_React_namespaceObject.createElement(Target, __assign({}, rest));
};
SideCar.isSideCarExport = true;
function exportSidecar(medium, exported) {
medium.useMedium(exported);
return SideCar;
}
;// CONCATENATED MODULE: ./node_modules/get-nonce/dist/es2015/index.js
var currentNonce;
var setNonce = function (nonce) {
currentNonce = nonce;
};
var getNonce = function () {
if (currentNonce) {
return currentNonce;
}
if (true) {
return __webpack_require__.nc;
}
return undefined;
};
;// CONCATENATED MODULE: ./node_modules/react-style-singleton/dist/es2015/singleton.js
function makeStyleTag() {
if (!document)
return null;
var tag = document.createElement('style');
tag.type = 'text/css';
var nonce = getNonce();
if (nonce) {
tag.setAttribute('nonce', nonce);
}
return tag;
}
function injectStyles(tag, css) {
// @ts-ignore
if (tag.styleSheet) {
// @ts-ignore
tag.styleSheet.cssText = css;
}
else {
tag.appendChild(document.createTextNode(css));
}
}
function insertStyleTag(tag) {
var head = document.head || document.getElementsByTagName('head')[0];
head.appendChild(tag);
}
var stylesheetSingleton = function () {
var counter = 0;
var stylesheet = null;
return {
add: function (style) {
if (counter == 0) {
if ((stylesheet = makeStyleTag())) {
injectStyles(stylesheet, style);
insertStyleTag(stylesheet);
}
}
counter++;
},
remove: function () {
counter--;
if (!counter && stylesheet) {
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
stylesheet = null;
}
},
};
};
;// CONCATENATED MODULE: ./node_modules/react-style-singleton/dist/es2015/hook.js
/**
* creates a hook to control style singleton
* @see {@link styleSingleton} for a safer component version
* @example
* ```tsx
* const useStyle = styleHookSingleton();
* ///
* useStyle('body { overflow: hidden}');
*/
var styleHookSingleton = function () {
var sheet = stylesheetSingleton();
return function (styles, isDynamic) {
external_React_namespaceObject.useEffect(function () {
sheet.add(styles);
return function () {
sheet.remove();
};
}, [styles && isDynamic]);
};
};
;// CONCATENATED MODULE: ./node_modules/react-style-singleton/dist/es2015/component.js
/**
* create a Component to add styles on demand
* - styles are added when first instance is mounted
* - styles are removed when the last instance is unmounted
* - changing styles in runtime does nothing unless dynamic is set. But with multiple components that can lead to the undefined behavior
*/
var styleSingleton = function () {
var useStyle = styleHookSingleton();
var Sheet = function (_a) {
var styles = _a.styles, dynamic = _a.dynamic;
useStyle(styles, dynamic);
return null;
};
return Sheet;
};
;// CONCATENATED MODULE: ./node_modules/react-style-singleton/dist/es2015/index.js
;// CONCATENATED MODULE: ./node_modules/react-remove-scroll-bar/dist/es2015/utils.js
var zeroGap = {
left: 0,
top: 0,
right: 0,
gap: 0,
};
var parse = function (x) { return parseInt(x || '', 10) || 0; };
var getOffset = function (gapMode) {
var cs = window.getComputedStyle(document.body);
var left = cs[gapMode === 'padding' ? 'paddingLeft' : 'marginLeft'];
var top = cs[gapMode === 'padding' ? 'paddingTop' : 'marginTop'];
var right = cs[gapMode === 'padding' ? 'paddingRight' : 'marginRight'];
return [parse(left), parse(top), parse(right)];
};
var getGapWidth = function (gapMode) {
if (gapMode === void 0) { gapMode = 'margin'; }
if (typeof window === 'undefined') {
return zeroGap;
}
var offsets = getOffset(gapMode);
var documentWidth = document.documentElement.clientWidth;
var windowWidth = window.innerWidth;
return {
left: offsets[0],
top: offsets[1],
right: offsets[2],
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0]),
};
};
;// CONCATENATED MODULE: ./node_modules/react-remove-scroll-bar/dist/es2015/component.js
var Style = styleSingleton();
// important tip - once we measure scrollBar width and remove them
// we could not repeat this operation
// thus we are using style-singleton - only the first "yet correct" style will be applied.
var getStyles = function (_a, allowRelative, gapMode, important) {
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
if (gapMode === void 0) { gapMode = 'margin'; }
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
allowRelative && "position: relative ".concat(important, ";"),
gapMode === 'margin' &&
"\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
gapMode === 'padding' && "padding-right: ".concat(gap, "px ").concat(important, ";"),
]
.filter(Boolean)
.join(''), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
};
/**
* Removes page scrollbar and blocks page scroll when mounted
*/
var RemoveScrollBar = function (props) {
var noRelative = props.noRelative, noImportant = props.noImportant, _a = props.gapMode, gapMode = _a === void 0 ? 'margin' : _a;
/*
gap will be measured on every component mount
however it will be used only by the "first" invocation
due to singleton nature of <Style
*/
var gap = external_React_namespaceObject.useMemo(function () { return getGapWidth(gapMode); }, [gapMode]);
return external_React_namespaceObject.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '') });
};
;// CONCATENATED MODULE: ./node_modules/react-remove-scroll-bar/dist/es2015/index.js
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js
var passiveSupported = false;
if (typeof window !== 'undefined') {
try {
var options = Object.defineProperty({}, 'passive', {
get: function () {
passiveSupported = true;
return true;
},
});
// @ts-ignore
window.addEventListener('test', options, options);
// @ts-ignore
window.removeEventListener('test', options, options);
}
catch (err) {
passiveSupported = false;
}
}
var nonPassive = passiveSupported ? { passive: false } : false;
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/handleScroll.js
var elementCouldBeVScrolled = function (node) {
var styles = window.getComputedStyle(node);
return (styles.overflowY !== 'hidden' && // not-not-scrollable
!(styles.overflowY === styles.overflowX && styles.overflowY === 'visible') // scrollable
);
};
var elementCouldBeHScrolled = function (node) {
var styles = window.getComputedStyle(node);
return (styles.overflowX !== 'hidden' && // not-not-scrollable
!(styles.overflowY === styles.overflowX && styles.overflowX === 'visible') // scrollable
);
};
var locationCouldBeScrolled = function (axis, node) {
var current = node;
do {
// Skip over shadow root
if (typeof ShadowRoot !== 'undefined' && current instanceof ShadowRoot) {
current = current.host;
}
var isScrollable = elementCouldBeScrolled(axis, current);
if (isScrollable) {
var _a = getScrollVariables(axis, current), s = _a[1], d = _a[2];
if (s > d) {
return true;
}
}
current = current.parentNode;
} while (current && current !== document.body);
return false;
};
var getVScrollVariables = function (_a) {
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
return [
scrollTop,
scrollHeight,
clientHeight,
];
};
var getHScrollVariables = function (_a) {
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
return [
scrollLeft,
scrollWidth,
clientWidth,
];
};
var elementCouldBeScrolled = function (axis, node) {
return axis === 'v' ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
};
var getScrollVariables = function (axis, node) {
return axis === 'v' ? getVScrollVariables(node) : getHScrollVariables(node);
};
var getDirectionFactor = function (axis, direction) {
/**
* If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,
* and then increasingly negative as you scroll towards the end of the content.
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
*/
return axis === 'h' && direction === 'rtl' ? -1 : 1;
};
var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
var delta = directionFactor * sourceDelta;
// find scrollable target
var target = event.target;
var targetInLock = endTarget.contains(target);
var shouldCancelScroll = false;
var isDeltaPositive = delta > 0;
var availableScroll = 0;
var availableScrollTop = 0;
do {
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
var elementScroll = scroll_1 - capacity - directionFactor * position;
if (position || elementScroll) {
if (elementCouldBeScrolled(axis, target)) {
availableScroll += elementScroll;
availableScrollTop += position;
}
}
target = target.parentNode;
} while (
// portaled content
(!targetInLock && target !== document.body) ||
// self content
(targetInLock && (endTarget.contains(target) || endTarget === target)));
if (isDeltaPositive && ((noOverscroll && availableScroll === 0) || (!noOverscroll && delta > availableScroll))) {
shouldCancelScroll = true;
}
else if (!isDeltaPositive &&
((noOverscroll && availableScrollTop === 0) || (!noOverscroll && -delta > availableScrollTop))) {
shouldCancelScroll = true;
}
return shouldCancelScroll;
};
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/SideEffect.js
var getTouchXY = function (event) {
return 'changedTouches' in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
};
var getDeltaXY = function (event) { return [event.deltaX, event.deltaY]; };
var extractRef = function (ref) {
return ref && 'current' in ref ? ref.current : ref;
};
var deltaCompare = function (x, y) { return x[0] === y[0] && x[1] === y[1]; };
var generateStyle = function (id) { return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n"); };
var idCounter = 0;
var lockStack = [];
function RemoveScrollSideCar(props) {
var shouldPreventQueue = external_React_namespaceObject.useRef([]);
var touchStartRef = external_React_namespaceObject.useRef([0, 0]);
var activeAxis = external_React_namespaceObject.useRef();
var id = external_React_namespaceObject.useState(idCounter++)[0];
var Style = external_React_namespaceObject.useState(function () { return styleSingleton(); })[0];
var lastProps = external_React_namespaceObject.useRef(props);
external_React_namespaceObject.useEffect(function () {
lastProps.current = props;
}, [props]);
external_React_namespaceObject.useEffect(function () {
if (props.inert) {
document.body.classList.add("block-interactivity-".concat(id));
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
allow_1.forEach(function (el) { return el.classList.add("allow-interactivity-".concat(id)); });
return function () {
document.body.classList.remove("block-interactivity-".concat(id));
allow_1.forEach(function (el) { return el.classList.remove("allow-interactivity-".concat(id)); });
};
}
return;
}, [props.inert, props.lockRef.current, props.shards]);
var shouldCancelEvent = external_React_namespaceObject.useCallback(function (event, parent) {
if ('touches' in event && event.touches.length === 2) {
return !lastProps.current.allowPinchZoom;
}
var touch = getTouchXY(event);
var touchStart = touchStartRef.current;
var deltaX = 'deltaX' in event ? event.deltaX : touchStart[0] - touch[0];
var deltaY = 'deltaY' in event ? event.deltaY : touchStart[1] - touch[1];
var currentAxis;
var target = event.target;
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? 'h' : 'v';
// allow horizontal touch move on Range inputs. They will not cause any scroll
if ('touches' in event && moveDirection === 'h' && target.type === 'range') {
return false;
}
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
if (!canBeScrolledInMainDirection) {
return true;
}
if (canBeScrolledInMainDirection) {
currentAxis = moveDirection;
}
else {
currentAxis = moveDirection === 'v' ? 'h' : 'v';
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
// other axis might be not scrollable
}
if (!canBeScrolledInMainDirection) {
return false;
}
if (!activeAxis.current && 'changedTouches' in event && (deltaX || deltaY)) {
activeAxis.current = currentAxis;
}
if (!currentAxis) {
return true;
}
var cancelingAxis = activeAxis.current || currentAxis;
return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);
}, []);
var shouldPrevent = external_React_namespaceObject.useCallback(function (_event) {
var event = _event;
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {
// not the last active
return;
}
var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);
var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && e.target === event.target && deltaCompare(e.delta, delta); })[0];
// self event, and should be canceled
if (sourceEvent && sourceEvent.should) {
event.preventDefault();
return;
}
// outside or shard event
if (!sourceEvent) {
var shardNodes = (lastProps.current.shards || [])
.map(extractRef)
.filter(Boolean)
.filter(function (node) { return node.contains(event.target); });
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
if (shouldStop) {
event.preventDefault();
}
}
}, []);
var shouldCancel = external_React_namespaceObject.useCallback(function (name, delta, target, should) {
var event = { name: name, delta: delta, target: target, should: should };
shouldPreventQueue.current.push(event);
setTimeout(function () {
shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });
}, 1);
}, []);
var scrollTouchStart = external_React_namespaceObject.useCallback(function (event) {
touchStartRef.current = getTouchXY(event);
activeAxis.current = undefined;
}, []);
var scrollWheel = external_React_namespaceObject.useCallback(function (event) {
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
}, []);
var scrollTouchMove = external_React_namespaceObject.useCallback(function (event) {
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
}, []);
external_React_namespaceObject.useEffect(function () {
lockStack.push(Style);
props.setCallbacks({
onScrollCapture: scrollWheel,
onWheelCapture: scrollWheel,
onTouchMoveCapture: scrollTouchMove,
});
document.addEventListener('wheel', shouldPrevent, nonPassive);
document.addEventListener('touchmove', shouldPrevent, nonPassive);
document.addEventListener('touchstart', scrollTouchStart, nonPassive);
return function () {
lockStack = lockStack.filter(function (inst) { return inst !== Style; });
document.removeEventListener('wheel', shouldPrevent, nonPassive);
document.removeEventListener('touchmove', shouldPrevent, nonPassive);
document.removeEventListener('touchstart', scrollTouchStart, nonPassive);
};
}, []);
var removeScrollBar = props.removeScrollBar, inert = props.inert;
return (external_React_namespaceObject.createElement(external_React_namespaceObject.Fragment, null,
inert ? external_React_namespaceObject.createElement(Style, { styles: generateStyle(id) }) : null,
removeScrollBar ? external_React_namespaceObject.createElement(RemoveScrollBar, { gapMode: "margin" }) : null));
}
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/sidecar.js
/* harmony default export */ const sidecar = (exportSidecar(effectCar, RemoveScrollSideCar));
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/node_modules/react-remove-scroll/dist/es2015/Combination.js
var ReactRemoveScroll = external_React_namespaceObject.forwardRef(function (props, ref) { return (external_React_namespaceObject.createElement(RemoveScroll, __assign({}, props, { ref: ref, sideCar: sidecar }))); });
ReactRemoveScroll.classNames = RemoveScroll.classNames;
/* harmony default export */ const Combination = (ReactRemoveScroll);
;// CONCATENATED MODULE: ./node_modules/aria-hidden/dist/es2015/index.js
var getDefaultParent = function (originalTarget) {
if (typeof document === 'undefined') {
return null;
}
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
return sampleTarget.ownerDocument.body;
};
var counterMap = new WeakMap();
var uncontrolledNodes = new WeakMap();
var markerMap = {};
var lockCount = 0;
var unwrapHost = function (node) {
return node && (node.host || unwrapHost(node.parentNode));
};
var correctTargets = function (parent, targets) {
return targets
.map(function (target) {
if (parent.contains(target)) {
return target;
}
var correctedTarget = unwrapHost(target);
if (correctedTarget && parent.contains(correctedTarget)) {
return correctedTarget;
}
console.error('aria-hidden', target, 'in not contained inside', parent, '. Doing nothing');
return null;
})
.filter(function (x) { return Boolean(x); });
};
/**
* Marks everything except given node(or nodes) as aria-hidden
* @param {Element | Element[]} originalTarget - elements to keep on the page
* @param [parentNode] - top element, defaults to document.body
* @param {String} [markerName] - a special attribute to mark every node
* @param {String} [controlAttribute] - html Attribute to control
* @return {Undo} undo command
*/
var applyAttributeToOthers = function (originalTarget, parentNode, markerName, controlAttribute) {
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
if (!markerMap[markerName]) {
markerMap[markerName] = new WeakMap();
}
var markerCounter = markerMap[markerName];
var hiddenNodes = [];
var elementsToKeep = new Set();
var elementsToStop = new Set(targets);
var keep = function (el) {
if (!el || elementsToKeep.has(el)) {
return;
}
elementsToKeep.add(el);
keep(el.parentNode);
};
targets.forEach(keep);
var deep = function (parent) {
if (!parent || elementsToStop.has(parent)) {
return;
}
Array.prototype.forEach.call(parent.children, function (node) {
if (elementsToKeep.has(node)) {
deep(node);
}
else {
var attr = node.getAttribute(controlAttribute);
var alreadyHidden = attr !== null && attr !== 'false';
var counterValue = (counterMap.get(node) || 0) + 1;
var markerValue = (markerCounter.get(node) || 0) + 1;
counterMap.set(node, counterValue);
markerCounter.set(node, markerValue);
hiddenNodes.push(node);
if (counterValue === 1 && alreadyHidden) {
uncontrolledNodes.set(node, true);
}
if (markerValue === 1) {
node.setAttribute(markerName, 'true');
}
if (!alreadyHidden) {
node.setAttribute(controlAttribute, 'true');
}
}
});
};
deep(parentNode);
elementsToKeep.clear();
lockCount++;
return function () {
hiddenNodes.forEach(function (node) {
var counterValue = counterMap.get(node) - 1;
var markerValue = markerCounter.get(node) - 1;
counterMap.set(node, counterValue);
markerCounter.set(node, markerValue);
if (!counterValue) {
if (!uncontrolledNodes.has(node)) {
node.removeAttribute(controlAttribute);
}
uncontrolledNodes.delete(node);
}
if (!markerValue) {
node.removeAttribute(markerName);
}
});
lockCount--;
if (!lockCount) {
// clear
counterMap = new WeakMap();
counterMap = new WeakMap();
uncontrolledNodes = new WeakMap();
markerMap = {};
}
};
};
/**
* Marks everything except given node(or nodes) as aria-hidden
* @param {Element | Element[]} originalTarget - elements to keep on the page
* @param [parentNode] - top element, defaults to document.body
* @param {String} [markerName] - a special attribute to mark every node
* @return {Undo} undo command
*/
var hideOthers = function (originalTarget, parentNode, markerName) {
if (markerName === void 0) { markerName = 'data-aria-hidden'; }
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
var activeParentNode = parentNode || getDefaultParent(originalTarget);
if (!activeParentNode) {
return function () { return null; };
}
// we should not hide ariaLive elements - https://github.com/theKashey/aria-hidden/issues/10
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll('[aria-live]')));
return applyAttributeToOthers(targets, activeParentNode, markerName, 'aria-hidden');
};
/**
* Marks everything except given node(or nodes) as inert
* @param {Element | Element[]} originalTarget - elements to keep on the page
* @param [parentNode] - top element, defaults to document.body
* @param {String} [markerName] - a special attribute to mark every node
* @return {Undo} undo command
*/
var inertOthers = function (originalTarget, parentNode, markerName) {
if (markerName === void 0) { markerName = 'data-inert-ed'; }
var activeParentNode = parentNode || getDefaultParent(originalTarget);
if (!activeParentNode) {
return function () { return null; };
}
return applyAttributeToOthers(originalTarget, activeParentNode, markerName, 'inert');
};
/**
* @returns if current browser supports inert
*/
var supportsInert = function () {
return typeof HTMLElement !== 'undefined' && HTMLElement.prototype.hasOwnProperty('inert');
};
/**
* Automatic function to "suppress" DOM elements - _hide_ or _inert_ in the best possible way
* @param {Element | Element[]} originalTarget - elements to keep on the page
* @param [parentNode] - top element, defaults to document.body
* @param {String} [markerName] - a special attribute to mark every node
* @return {Undo} undo command
*/
var suppressOthers = function (originalTarget, parentNode, markerName) {
if (markerName === void 0) { markerName = 'data-suppressed'; }
return (supportsInert() ? inertOthers : hideOthers)(originalTarget, parentNode, markerName);
};
;// CONCATENATED MODULE: ./node_modules/@radix-ui/react-dialog/dist/index.module.js
/* -------------------------------------------------------------------------------------------------
* Dialog
* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DIALOG_NAME = 'Dialog';
const [$5d3850c4d0b4e6c7$var$createDialogContext, $5d3850c4d0b4e6c7$export$cc702773b8ea3e41] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($5d3850c4d0b4e6c7$var$DIALOG_NAME);
const [$5d3850c4d0b4e6c7$var$DialogProvider, $5d3850c4d0b4e6c7$var$useDialogContext] = $5d3850c4d0b4e6c7$var$createDialogContext($5d3850c4d0b4e6c7$var$DIALOG_NAME);
const $5d3850c4d0b4e6c7$export$3ddf2d174ce01153 = (props)=>{
const { __scopeDialog: __scopeDialog , children: children , open: openProp , defaultOpen: defaultOpen , onOpenChange: onOpenChange , modal: modal = true } = props;
const triggerRef = (0,external_React_namespaceObject.useRef)(null);
const contentRef = (0,external_React_namespaceObject.useRef)(null);
const [open = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({
prop: openProp,
defaultProp: defaultOpen,
onChange: onOpenChange
});
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogProvider, {
scope: __scopeDialog,
triggerRef: triggerRef,
contentRef: contentRef,
contentId: $1746a345f3d73bb7$export$f680877a34711e37(),
titleId: $1746a345f3d73bb7$export$f680877a34711e37(),
descriptionId: $1746a345f3d73bb7$export$f680877a34711e37(),
open: open,
onOpenChange: setOpen,
onOpenToggle: (0,external_React_namespaceObject.useCallback)(()=>setOpen((prevOpen)=>!prevOpen
)
, [
setOpen
]),
modal: modal
}, children);
};
/*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$3ddf2d174ce01153, {
displayName: $5d3850c4d0b4e6c7$var$DIALOG_NAME
});
/* -------------------------------------------------------------------------------------------------
* DialogTrigger
* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$TRIGGER_NAME = 'DialogTrigger';
const $5d3850c4d0b4e6c7$export$2e1e1122cf0cba88 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const { __scopeDialog: __scopeDialog , ...triggerProps } = props;
const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$TRIGGER_NAME, __scopeDialog);
const composedTriggerRef = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.triggerRef);
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
type: "button",
"aria-haspopup": "dialog",
"aria-expanded": context.open,
"aria-controls": context.contentId,
"data-state": $5d3850c4d0b4e6c7$var$getState(context.open)
}, triggerProps, {
ref: composedTriggerRef,
onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, context.onOpenToggle)
}));
});
/*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$2e1e1122cf0cba88, {
displayName: $5d3850c4d0b4e6c7$var$TRIGGER_NAME
});
/* -------------------------------------------------------------------------------------------------
* DialogPortal
* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$PORTAL_NAME = 'DialogPortal';
const [$5d3850c4d0b4e6c7$var$PortalProvider, $5d3850c4d0b4e6c7$var$usePortalContext] = $5d3850c4d0b4e6c7$var$createDialogContext($5d3850c4d0b4e6c7$var$PORTAL_NAME, {
forceMount: undefined
});
const $5d3850c4d0b4e6c7$export$dad7c95542bacce0 = (props)=>{
const { __scopeDialog: __scopeDialog , forceMount: forceMount , children: children , container: container } = props;
const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$PORTAL_NAME, __scopeDialog);
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$PortalProvider, {
scope: __scopeDialog,
forceMount: forceMount
}, external_React_namespaceObject.Children.map(children, (child)=>/*#__PURE__*/ (0,external_React_namespaceObject.createElement)($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
present: forceMount || context.open
}, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($f1701beae083dbae$export$602eac185826482c, {
asChild: true,
container: container
}, child))
));
};
/*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$dad7c95542bacce0, {
displayName: $5d3850c4d0b4e6c7$var$PORTAL_NAME
});
/* -------------------------------------------------------------------------------------------------
* DialogOverlay
* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$OVERLAY_NAME = 'DialogOverlay';
const $5d3850c4d0b4e6c7$export$bd1d06c79be19e17 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const portalContext = $5d3850c4d0b4e6c7$var$usePortalContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, props.__scopeDialog);
const { forceMount: forceMount = portalContext.forceMount , ...overlayProps } = props;
const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, props.__scopeDialog);
return context.modal ? /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
present: forceMount || context.open
}, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogOverlayImpl, _extends({}, overlayProps, {
ref: forwardedRef
}))) : null;
});
/*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$bd1d06c79be19e17, {
displayName: $5d3850c4d0b4e6c7$var$OVERLAY_NAME
});
const $5d3850c4d0b4e6c7$var$DialogOverlayImpl = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const { __scopeDialog: __scopeDialog , ...overlayProps } = props;
const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$OVERLAY_NAME, __scopeDialog);
return(/*#__PURE__*/ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
// ie. when `Overlay` and `Content` are siblings
(0,external_React_namespaceObject.createElement)(Combination, {
as: $5e63c961fc1ce211$export$8c6ed5c666ac1360,
allowPinchZoom: true,
shards: [
context.contentRef
]
}, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
"data-state": $5d3850c4d0b4e6c7$var$getState(context.open)
}, overlayProps, {
ref: forwardedRef // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.
,
style: {
pointerEvents: 'auto',
...overlayProps.style
}
}))));
});
/* -------------------------------------------------------------------------------------------------
* DialogContent
* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$CONTENT_NAME = 'DialogContent';
const $5d3850c4d0b4e6c7$export$b6d9565de1e068cf = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const portalContext = $5d3850c4d0b4e6c7$var$usePortalContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
const { forceMount: forceMount = portalContext.forceMount , ...contentProps } = props;
const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
present: forceMount || context.open
}, context.modal ? /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogContentModal, _extends({}, contentProps, {
ref: forwardedRef
})) : /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogContentNonModal, _extends({}, contentProps, {
ref: forwardedRef
})));
});
/*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$b6d9565de1e068cf, {
displayName: $5d3850c4d0b4e6c7$var$CONTENT_NAME
});
/* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DialogContentModal = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
const contentRef = (0,external_React_namespaceObject.useRef)(null);
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.contentRef, contentRef); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
(0,external_React_namespaceObject.useEffect)(()=>{
const content = contentRef.current;
if (content) return hideOthers(content);
}, []);
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogContentImpl, _extends({}, props, {
ref: composedRefs // we make sure focus isn't trapped once `DialogContent` has been closed
,
trapFocus: context.open,
disableOutsidePointerEvents: true,
onCloseAutoFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onCloseAutoFocus, (event)=>{
var _context$triggerRef$c;
event.preventDefault();
(_context$triggerRef$c = context.triggerRef.current) === null || _context$triggerRef$c === void 0 || _context$triggerRef$c.focus();
}),
onPointerDownOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownOutside, (event)=>{
const originalEvent = event.detail.originalEvent;
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
const isRightClick = originalEvent.button === 2 || ctrlLeftClick; // If the event is a right-click, we shouldn't close because
// it is effectively as if we right-clicked the `Overlay`.
if (isRightClick) event.preventDefault();
}) // When focus is trapped, a `focusout` event may still happen.
,
onFocusOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusOutside, (event)=>event.preventDefault()
)
}));
});
/* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DialogContentNonModal = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
const hasInteractedOutsideRef = (0,external_React_namespaceObject.useRef)(false);
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5d3850c4d0b4e6c7$var$DialogContentImpl, _extends({}, props, {
ref: forwardedRef,
trapFocus: false,
disableOutsidePointerEvents: false,
onCloseAutoFocus: (event)=>{
var _props$onCloseAutoFoc;
(_props$onCloseAutoFoc = props.onCloseAutoFocus) === null || _props$onCloseAutoFoc === void 0 || _props$onCloseAutoFoc.call(props, event);
if (!event.defaultPrevented) {
var _context$triggerRef$c2;
if (!hasInteractedOutsideRef.current) (_context$triggerRef$c2 = context.triggerRef.current) === null || _context$triggerRef$c2 === void 0 || _context$triggerRef$c2.focus(); // Always prevent auto focus because we either focus manually or want user agent focus
event.preventDefault();
}
hasInteractedOutsideRef.current = false;
},
onInteractOutside: (event)=>{
var _props$onInteractOuts, _context$triggerRef$c3;
(_props$onInteractOuts = props.onInteractOutside) === null || _props$onInteractOuts === void 0 || _props$onInteractOuts.call(props, event);
if (!event.defaultPrevented) hasInteractedOutsideRef.current = true; // Prevent dismissing when clicking the trigger.
// As the trigger is already setup to close, without doing so would
// cause it to close and immediately open.
//
// We use `onInteractOutside` as some browsers also
// focus on pointer down, creating the same issue.
const target = event.target;
const targetIsTrigger = (_context$triggerRef$c3 = context.triggerRef.current) === null || _context$triggerRef$c3 === void 0 ? void 0 : _context$triggerRef$c3.contains(target);
if (targetIsTrigger) event.preventDefault();
}
}));
});
/* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DialogContentImpl = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const { __scopeDialog: __scopeDialog , trapFocus: trapFocus , onOpenAutoFocus: onOpenAutoFocus , onCloseAutoFocus: onCloseAutoFocus , ...contentProps } = props;
const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, __scopeDialog);
const contentRef = (0,external_React_namespaceObject.useRef)(null);
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentRef); // Make sure the whole tree has focus guards as our `Dialog` will be
// the last element in the DOM (beacuse of the `Portal`)
$3db38b7d1fb3fe6a$export$b7ece24a22aeda8c();
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($d3863c46a17e8a28$export$20e40289641fbbb6, {
asChild: true,
loop: true,
trapped: trapFocus,
onMountAutoFocus: onOpenAutoFocus,
onUnmountAutoFocus: onCloseAutoFocus
}, /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($5cb92bef7577960e$export$177fb62ff3ec1f22, _extends({
role: "dialog",
id: context.contentId,
"aria-describedby": context.descriptionId,
"aria-labelledby": context.titleId,
"data-state": $5d3850c4d0b4e6c7$var$getState(context.open)
}, contentProps, {
ref: composedRefs,
onDismiss: ()=>context.onOpenChange(false)
}))), false);
});
/* -------------------------------------------------------------------------------------------------
* DialogTitle
* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$TITLE_NAME = 'DialogTitle';
const $5d3850c4d0b4e6c7$export$16f7638e4a34b909 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const { __scopeDialog: __scopeDialog , ...titleProps } = props;
const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$TITLE_NAME, __scopeDialog);
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.h2, _extends({
id: context.titleId
}, titleProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$16f7638e4a34b909, {
displayName: $5d3850c4d0b4e6c7$var$TITLE_NAME
});
/* -------------------------------------------------------------------------------------------------
* DialogDescription
* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$DESCRIPTION_NAME = 'DialogDescription';
const $5d3850c4d0b4e6c7$export$94e94c2ec2c954d5 = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const { __scopeDialog: __scopeDialog , ...descriptionProps } = props;
const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$DESCRIPTION_NAME, __scopeDialog);
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.p, _extends({
id: context.descriptionId
}, descriptionProps, {
ref: forwardedRef
}));
});
/*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$94e94c2ec2c954d5, {
displayName: $5d3850c4d0b4e6c7$var$DESCRIPTION_NAME
});
/* -------------------------------------------------------------------------------------------------
* DialogClose
* -----------------------------------------------------------------------------------------------*/ const $5d3850c4d0b4e6c7$var$CLOSE_NAME = 'DialogClose';
const $5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac = /*#__PURE__*/ (0,external_React_namespaceObject.forwardRef)((props, forwardedRef)=>{
const { __scopeDialog: __scopeDialog , ...closeProps } = props;
const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CLOSE_NAME, __scopeDialog);
return /*#__PURE__*/ (0,external_React_namespaceObject.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
type: "button"
}, closeProps, {
ref: forwardedRef,
onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, ()=>context.onOpenChange(false)
)
}));
});
/*#__PURE__*/ Object.assign($5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac, {
displayName: $5d3850c4d0b4e6c7$var$CLOSE_NAME
});
/* -----------------------------------------------------------------------------------------------*/ function $5d3850c4d0b4e6c7$var$getState(open) {
return open ? 'open' : 'closed';
}
const $5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME = 'DialogTitleWarning';
const [$5d3850c4d0b4e6c7$export$69b62a49393917d6, $5d3850c4d0b4e6c7$var$useWarningContext] = $c512c27ab02ef895$export$fd42f52fd3ae1109($5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME, {
contentName: $5d3850c4d0b4e6c7$var$CONTENT_NAME,
titleName: $5d3850c4d0b4e6c7$var$TITLE_NAME,
docsSlug: 'dialog'
});
const $5d3850c4d0b4e6c7$var$TitleWarning = ({ titleId: titleId })=>{
const titleWarningContext = $5d3850c4d0b4e6c7$var$useWarningContext($5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME);
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
$67UHm$useEffect(()=>{
if (titleId) {
const hasTitle = document.getElementById(titleId);
if (!hasTitle) throw new Error(MESSAGE);
}
}, [
MESSAGE,
titleId
]);
return null;
};
const $5d3850c4d0b4e6c7$var$DESCRIPTION_WARNING_NAME = 'DialogDescriptionWarning';
const $5d3850c4d0b4e6c7$var$DescriptionWarning = ({ contentRef: contentRef , descriptionId: descriptionId })=>{
const descriptionWarningContext = $5d3850c4d0b4e6c7$var$useWarningContext($5d3850c4d0b4e6c7$var$DESCRIPTION_WARNING_NAME);
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
$67UHm$useEffect(()=>{
var _contentRef$current;
const describedById = (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.getAttribute('aria-describedby'); // if we have an id and the user hasn't set aria-describedby={undefined}
if (descriptionId && describedById) {
const hasDescription = document.getElementById(descriptionId);
if (!hasDescription) console.warn(MESSAGE);
}
}, [
MESSAGE,
contentRef,
descriptionId
]);
return null;
};
const $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9 = $5d3850c4d0b4e6c7$export$3ddf2d174ce01153;
const $5d3850c4d0b4e6c7$export$41fb9f06171c75f4 = (/* unused pure expression or super */ null && ($5d3850c4d0b4e6c7$export$2e1e1122cf0cba88));
const $5d3850c4d0b4e6c7$export$602eac185826482c = $5d3850c4d0b4e6c7$export$dad7c95542bacce0;
const $5d3850c4d0b4e6c7$export$c6fdb837b070b4ff = $5d3850c4d0b4e6c7$export$bd1d06c79be19e17;
const $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2 = $5d3850c4d0b4e6c7$export$b6d9565de1e068cf;
const $5d3850c4d0b4e6c7$export$f99233281efd08a0 = (/* unused pure expression or super */ null && ($5d3850c4d0b4e6c7$export$16f7638e4a34b909));
const $5d3850c4d0b4e6c7$export$393edc798c47379d = (/* unused pure expression or super */ null && ($5d3850c4d0b4e6c7$export$94e94c2ec2c954d5));
const $5d3850c4d0b4e6c7$export$f39c2d165cd861fe = (/* unused pure expression or super */ null && ($5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac));
// EXTERNAL MODULE: ./node_modules/command-score/index.js
var command_score = __webpack_require__(6007);
;// CONCATENATED MODULE: ./node_modules/cmdk/dist/index.mjs
var ue='[cmdk-list-sizer=""]',M='[cmdk-group=""]',N='[cmdk-group-items=""]',de='[cmdk-group-heading=""]',ee='[cmdk-item=""]',Z=`${ee}:not([aria-disabled="true"])`,z="cmdk-item-select",S="data-value",fe=(n,a)=>command_score(n,a),te=external_React_namespaceObject.createContext(void 0),k=()=>external_React_namespaceObject.useContext(te),re=external_React_namespaceObject.createContext(void 0),U=()=>external_React_namespaceObject.useContext(re),ne=external_React_namespaceObject.createContext(void 0),oe=external_React_namespaceObject.forwardRef((n,a)=>{let r=external_React_namespaceObject.useRef(null),o=x(()=>({search:"",value:"",filtered:{count:0,items:new Map,groups:new Set}})),u=x(()=>new Set),l=x(()=>new Map),p=x(()=>new Map),f=x(()=>new Set),d=ae(n),{label:v,children:E,value:R,onValueChange:w,filter:O,shouldFilter:ie,...D}=n,F=external_React_namespaceObject.useId(),g=external_React_namespaceObject.useId(),A=external_React_namespaceObject.useId(),y=ye();L(()=>{if(R!==void 0){let e=R.trim().toLowerCase();o.current.value=e,y(6,W),h.emit()}},[R]);let h=external_React_namespaceObject.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>o.current,setState:(e,c,i)=>{var s,m,b;if(!Object.is(o.current[e],c)){if(o.current[e]=c,e==="search")j(),G(),y(1,V);else if(e==="value")if(((s=d.current)==null?void 0:s.value)!==void 0){(b=(m=d.current).onValueChange)==null||b.call(m,c);return}else i||y(5,W);h.emit()}},emit:()=>{f.current.forEach(e=>e())}}),[]),K=external_React_namespaceObject.useMemo(()=>({value:(e,c)=>{c!==p.current.get(e)&&(p.current.set(e,c),o.current.filtered.items.set(e,B(c)),y(2,()=>{G(),h.emit()}))},item:(e,c)=>(u.current.add(e),c&&(l.current.has(c)?l.current.get(c).add(e):l.current.set(c,new Set([e]))),y(3,()=>{j(),G(),o.current.value||V(),h.emit()}),()=>{p.current.delete(e),u.current.delete(e),o.current.filtered.items.delete(e),y(4,()=>{j(),V(),h.emit()})}),group:e=>(l.current.has(e)||l.current.set(e,new Set),()=>{p.current.delete(e),l.current.delete(e)}),filter:()=>d.current.shouldFilter,label:v||n["aria-label"],listId:F,inputId:A,labelId:g}),[]);function B(e){var i;let c=((i=d.current)==null?void 0:i.filter)??fe;return e?c(e,o.current.search):0}function G(){if(!r.current||!o.current.search||d.current.shouldFilter===!1)return;let e=o.current.filtered.items,c=[];o.current.filtered.groups.forEach(s=>{let m=l.current.get(s),b=0;m.forEach(P=>{let ce=e.get(P);b=Math.max(ce,b)}),c.push([s,b])});let i=r.current.querySelector(ue);I().sort((s,m)=>{let b=s.getAttribute(S),P=m.getAttribute(S);return(e.get(P)??0)-(e.get(b)??0)}).forEach(s=>{let m=s.closest(N);m?m.appendChild(s.parentElement===m?s:s.closest(`${N} > *`)):i.appendChild(s.parentElement===i?s:s.closest(`${N} > *`))}),c.sort((s,m)=>m[1]-s[1]).forEach(s=>{let m=r.current.querySelector(`${M}[${S}="${s[0]}"]`);m==null||m.parentElement.appendChild(m)})}function V(){let e=I().find(i=>!i.ariaDisabled),c=e==null?void 0:e.getAttribute(S);h.setState("value",c||void 0)}function j(){if(!o.current.search||d.current.shouldFilter===!1){o.current.filtered.count=u.current.size;return}o.current.filtered.groups=new Set;let e=0;for(let c of u.current){let i=p.current.get(c),s=B(i);o.current.filtered.items.set(c,s),s>0&&e++}for(let[c,i]of l.current)for(let s of i)if(o.current.filtered.items.get(s)>0){o.current.filtered.groups.add(c);break}o.current.filtered.count=e}function W(){var c,i,s;let e=_();e&&(((c=e.parentElement)==null?void 0:c.firstChild)===e&&((s=(i=e.closest(M))==null?void 0:i.querySelector(de))==null||s.scrollIntoView({block:"nearest"})),e.scrollIntoView({block:"nearest"}))}function _(){return r.current.querySelector(`${ee}[aria-selected="true"]`)}function I(){return Array.from(r.current.querySelectorAll(Z))}function q(e){let i=I()[e];i&&h.setState("value",i.getAttribute(S))}function $(e){var b;let c=_(),i=I(),s=i.findIndex(P=>P===c),m=i[s+e];(b=d.current)!=null&&b.loop&&(m=s+e<0?i[i.length-1]:s+e===i.length?i[0]:i[s+e]),m&&h.setState("value",m.getAttribute(S))}function J(e){let c=_(),i=c==null?void 0:c.closest(M),s;for(;i&&!s;)i=e>0?Se(i,M):Ce(i,M),s=i==null?void 0:i.querySelector(Z);s?h.setState("value",s.getAttribute(S)):$(e)}let Q=()=>q(I().length-1),X=e=>{e.preventDefault(),e.metaKey?Q():e.altKey?J(1):$(1)},Y=e=>{e.preventDefault(),e.metaKey?q(0):e.altKey?J(-1):$(-1)};return external_React_namespaceObject.createElement("div",{ref:H([r,a]),...D,"cmdk-root":"",onKeyDown:e=>{var c;if((c=D.onKeyDown)==null||c.call(D,e),!e.defaultPrevented)switch(e.key){case"n":case"j":{e.ctrlKey&&X(e);break}case"ArrowDown":{X(e);break}case"p":case"k":{e.ctrlKey&&Y(e);break}case"ArrowUp":{Y(e);break}case"Home":{e.preventDefault(),q(0);break}case"End":{e.preventDefault(),Q();break}case"Enter":{e.preventDefault();let i=_();if(i){let s=new Event(z);i.dispatchEvent(s)}}}}},external_React_namespaceObject.createElement("label",{"cmdk-label":"",htmlFor:K.inputId,id:K.labelId,style:xe},v),external_React_namespaceObject.createElement(re.Provider,{value:h},external_React_namespaceObject.createElement(te.Provider,{value:K},E)))}),me=external_React_namespaceObject.forwardRef((n,a)=>{let r=external_React_namespaceObject.useId(),o=external_React_namespaceObject.useRef(null),u=external_React_namespaceObject.useContext(ne),l=k(),p=ae(n);L(()=>l.item(r,u),[]);let f=se(r,o,[n.value,n.children,o]),d=U(),v=T(g=>g.value&&g.value===f.current),E=T(g=>l.filter()===!1?!0:g.search?g.filtered.items.get(r)>0:!0);external_React_namespaceObject.useEffect(()=>{let g=o.current;if(!(!g||n.disabled))return g.addEventListener(z,R),()=>g.removeEventListener(z,R)},[E,n.onSelect,n.disabled]);function R(){var g,A;(A=(g=p.current).onSelect)==null||A.call(g,f.current)}function w(){d.setState("value",f.current,!0)}if(!E)return null;let{disabled:O,value:ie,onSelect:D,...F}=n;return external_React_namespaceObject.createElement("div",{ref:H([o,a]),...F,"cmdk-item":"",role:"option","aria-disabled":O||void 0,"aria-selected":v||void 0,"data-selected":v||void 0,onPointerMove:O?void 0:w,onClick:O?void 0:R},n.children)}),pe=external_React_namespaceObject.forwardRef((n,a)=>{let{heading:r,children:o,...u}=n,l=external_React_namespaceObject.useId(),p=external_React_namespaceObject.useRef(null),f=external_React_namespaceObject.useRef(null),d=external_React_namespaceObject.useId(),v=k(),E=T(w=>v.filter()===!1?!0:w.search?w.filtered.groups.has(l):!0);L(()=>v.group(l),[]),se(l,p,[n.value,n.heading,f]);let R=external_React_namespaceObject.createElement(ne.Provider,{value:l},o);return external_React_namespaceObject.createElement("div",{ref:H([p,a]),...u,"cmdk-group":"",role:"presentation",hidden:E?void 0:!0},r&&external_React_namespaceObject.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),external_React_namespaceObject.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},R))}),ge=external_React_namespaceObject.forwardRef((n,a)=>{let{alwaysRender:r,...o}=n,u=external_React_namespaceObject.useRef(null),l=T(p=>!p.search);return!r&&!l?null:external_React_namespaceObject.createElement("div",{ref:H([u,a]),...o,"cmdk-separator":"",role:"separator"})}),ve=external_React_namespaceObject.forwardRef((n,a)=>{let{onValueChange:r,...o}=n,u=n.value!=null,l=U(),p=T(d=>d.search),f=k();return external_React_namespaceObject.useEffect(()=>{n.value!=null&&l.setState("search",n.value)},[n.value]),external_React_namespaceObject.createElement("input",{ref:a,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":f.listId,"aria-labelledby":f.labelId,id:f.inputId,type:"text",value:u?n.value:p,onChange:d=>{u||l.setState("search",d.target.value),r==null||r(d.target.value)}})}),Re=external_React_namespaceObject.forwardRef((n,a)=>{let{children:r,...o}=n,u=external_React_namespaceObject.useRef(null),l=external_React_namespaceObject.useRef(null),p=k();return external_React_namespaceObject.useEffect(()=>{if(l.current&&u.current){let f=l.current,d=u.current,v,E=new ResizeObserver(()=>{v=requestAnimationFrame(()=>{let R=f.getBoundingClientRect().height;d.style.setProperty("--cmdk-list-height",R.toFixed(1)+"px")})});return E.observe(f),()=>{cancelAnimationFrame(v),E.unobserve(f)}}},[]),external_React_namespaceObject.createElement("div",{ref:H([u,a]),...o,"cmdk-list":"",role:"listbox","aria-label":"Suggestions",id:p.listId,"aria-labelledby":p.inputId},external_React_namespaceObject.createElement("div",{ref:l,"cmdk-list-sizer":""},r))}),be=external_React_namespaceObject.forwardRef((n,a)=>{let{open:r,onOpenChange:o,container:u,...l}=n;return external_React_namespaceObject.createElement($5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9,{open:r,onOpenChange:o},external_React_namespaceObject.createElement($5d3850c4d0b4e6c7$export$602eac185826482c,{container:u},external_React_namespaceObject.createElement($5d3850c4d0b4e6c7$export$c6fdb837b070b4ff,{"cmdk-overlay":""}),external_React_namespaceObject.createElement($5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2,{"aria-label":n.label,"cmdk-dialog":""},external_React_namespaceObject.createElement(oe,{ref:a,...l}))))}),he=external_React_namespaceObject.forwardRef((n,a)=>{let r=external_React_namespaceObject.useRef(!0),o=T(u=>u.filtered.count===0);return external_React_namespaceObject.useEffect(()=>{r.current=!1},[]),r.current||!o?null:external_React_namespaceObject.createElement("div",{ref:a,...n,"cmdk-empty":"",role:"presentation"})}),Ee=external_React_namespaceObject.forwardRef((n,a)=>{let{progress:r,children:o,...u}=n;return external_React_namespaceObject.createElement("div",{ref:a,...u,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Loading..."},external_React_namespaceObject.createElement("div",{"aria-hidden":!0},o))}),Le=Object.assign(oe,{List:Re,Item:me,Input:ve,Group:pe,Separator:ge,Dialog:be,Empty:he,Loading:Ee});function Se(n,a){let r=n.nextElementSibling;for(;r;){if(r.matches(a))return r;r=r.nextElementSibling}}function Ce(n,a){let r=n.previousElementSibling;for(;r;){if(r.matches(a))return r;r=r.previousElementSibling}}function ae(n){let a=external_React_namespaceObject.useRef(n);return L(()=>{a.current=n}),a}var L=typeof window>"u"?external_React_namespaceObject.useEffect:external_React_namespaceObject.useLayoutEffect;function x(n){let a=external_React_namespaceObject.useRef();return a.current===void 0&&(a.current=n()),a}function H(n){return a=>{n.forEach(r=>{typeof r=="function"?r(a):r!=null&&(r.current=a)})}}function T(n){let a=U(),r=()=>n(a.snapshot());return external_React_namespaceObject.useSyncExternalStore(a.subscribe,r,r)}function se(n,a,r){let o=external_React_namespaceObject.useRef(),u=k();return L(()=>{var p;let l=(()=>{var f;for(let d of r){if(typeof d=="string")return d.trim().toLowerCase();if(typeof d=="object"&&"current"in d&&d.current)return(f=d.current.textContent)==null?void 0:f.trim().toLowerCase()}})();u.value(n,l),(p=a.current)==null||p.setAttribute(S,l),o.current=l}),o}var ye=()=>{let[n,a]=external_React_namespaceObject.useState(),r=x(()=>new Map);return L(()=>{r.current.forEach(o=>o()),r.current=new Map},[n]),(o,u)=>{r.current.set(o,u),a({})}},xe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__(5755);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
;// CONCATENATED MODULE: external ["wp","data"]
const external_wp_data_namespaceObject = window["wp"]["data"];
;// CONCATENATED MODULE: external ["wp","element"]
const external_wp_element_namespaceObject = window["wp"]["element"];
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// CONCATENATED MODULE: external ["wp","components"]
const external_wp_components_namespaceObject = window["wp"]["components"];
;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
;// 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
* @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element.
*
* @return {JSX.Element} Icon component
*/
function Icon({
icon,
size = 24,
...props
}, ref) {
return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
width: size,
height: size,
...props,
ref
});
}
/* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon));
;// CONCATENATED MODULE: external ["wp","primitives"]
const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js
/**
* WordPress dependencies
*/
const search = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"
}));
/* harmony default export */ const library_search = (search);
;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/store/reducer.js
/**
* WordPress dependencies
*/
/**
* Reducer returning the registered commands
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function commands(state = {}, action) {
switch (action.type) {
case 'REGISTER_COMMAND':
return {
...state,
[action.name]: {
name: action.name,
label: action.label,
searchLabel: action.searchLabel,
context: action.context,
callback: action.callback,
icon: action.icon
}
};
case 'UNREGISTER_COMMAND':
{
const {
[action.name]: _,
...remainingState
} = state;
return remainingState;
}
}
return state;
}
/**
* Reducer returning the command loaders
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Object} Updated state.
*/
function commandLoaders(state = {}, action) {
switch (action.type) {
case 'REGISTER_COMMAND_LOADER':
return {
...state,
[action.name]: {
name: action.name,
context: action.context,
hook: action.hook
}
};
case 'UNREGISTER_COMMAND_LOADER':
{
const {
[action.name]: _,
...remainingState
} = state;
return remainingState;
}
}
return state;
}
/**
* Reducer returning the command palette open state.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {boolean} Updated state.
*/
function isOpen(state = false, action) {
switch (action.type) {
case 'OPEN':
return true;
case 'CLOSE':
return false;
}
return state;
}
/**
* Reducer returning the command palette's active context.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
*
* @return {boolean} Updated state.
*/
function context(state = 'root', action) {
switch (action.type) {
case 'SET_CONTEXT':
return action.context;
}
return state;
}
const reducer = (0,external_wp_data_namespaceObject.combineReducers)({
commands,
commandLoaders,
isOpen,
context
});
/* harmony default export */ const store_reducer = (reducer);
;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/store/actions.js
/** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */
/**
* Configuration of a registered keyboard shortcut.
*
* @typedef {Object} WPCommandConfig
*
* @property {string} name Command name.
* @property {string} label Command label.
* @property {string=} searchLabel Command search label.
* @property {string=} context Command context.
* @property {JSX.Element} icon Command icon.
* @property {Function} callback Command callback.
* @property {boolean} disabled Whether to disable the command.
*/
/**
* @typedef {(search: string) => WPCommandConfig[]} WPCommandLoaderHook hoo
*/
/**
* Command loader config.
*
* @typedef {Object} WPCommandLoaderConfig
*
* @property {string} name Command loader name.
* @property {string=} context Command loader context.
* @property {WPCommandLoaderHook} hook Command loader hook.
* @property {boolean} disabled Whether to disable the command loader.
*/
/**
* Returns an action object used to register a new command.
*
* @param {WPCommandConfig} config Command config.
*
* @return {Object} action.
*/
function registerCommand(config) {
return {
type: 'REGISTER_COMMAND',
...config
};
}
/**
* Returns an action object used to unregister a command.
*
* @param {string} name Command name.
*
* @return {Object} action.
*/
function unregisterCommand(name) {
return {
type: 'UNREGISTER_COMMAND',
name
};
}
/**
* Register command loader.
*
* @param {WPCommandLoaderConfig} config Command loader config.
*
* @return {Object} action.
*/
function registerCommandLoader(config) {
return {
type: 'REGISTER_COMMAND_LOADER',
...config
};
}
/**
* Unregister command loader hook.
*
* @param {string} name Command loader name.
*
* @return {Object} action.
*/
function unregisterCommandLoader(name) {
return {
type: 'UNREGISTER_COMMAND_LOADER',
name
};
}
/**
* Opens the command palette.
*
* @return {Object} action.
*/
function actions_open() {
return {
type: 'OPEN'
};
}
/**
* Closes the command palette.
*
* @return {Object} action.
*/
function actions_close() {
return {
type: 'CLOSE'
};
}
;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js
/** @typedef {(...args: any[]) => *[]} GetDependants */
/** @typedef {() => void} Clear */
/**
* @typedef {{
* getDependants: GetDependants,
* clear: Clear
* }} EnhancedSelector
*/
/**
* Internal cache entry.
*
* @typedef CacheNode
*
* @property {?CacheNode|undefined} [prev] Previous node.
* @property {?CacheNode|undefined} [next] Next node.
* @property {*[]} args Function arguments for cache entry.
* @property {*} val Function result.
*/
/**
* @typedef Cache
*
* @property {Clear} clear Function to clear cache.
* @property {boolean} [isUniqueByDependants] Whether dependants are valid in
* considering cache uniqueness. A cache is unique if dependents are all arrays
* or objects.
* @property {CacheNode?} [head] Cache head.
* @property {*[]} [lastDependants] Dependants from previous invocation.
*/
/**
* Arbitrary value used as key for referencing cache object in WeakMap tree.
*
* @type {{}}
*/
var LEAF_KEY = {};
/**
* Returns the first argument as the sole entry in an array.
*
* @template T
*
* @param {T} value Value to return.
*
* @return {[T]} 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 {Cache} Cache object.
*/
function createCache() {
/** @type {Cache} */
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 {*[]} a First array.
* @param {*[]} 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.
*
* @template {(...args: *[]) => *} S
*
* @param {S} selector Selector function.
* @param {GetDependants=} getDependants Dependant getter returning an array of
* references used in cache bust consideration.
*/
/* harmony default export */ function rememo(selector, getDependants) {
/** @type {WeakMap<*,*>} */
var rootCache;
/** @type {GetDependants} */
var normalizedGetDependants = getDependants ? getDependants : arrayOf;
/**
* 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 {*[]} dependants Selector dependants.
*
* @return {Cache} Cache object.
*/
function getCache(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);
}
/**
* Resets root memoization cache.
*/
function clear() {
rootCache = new WeakMap();
}
/* eslint-disable jsdoc/check-param-names */
/**
* The augmented selector call, considering first whether dependants have
* changed before passing it to underlying memoize function.
*
* @param {*} source Source object for derivation.
* @param {...*} extraArgs Additional arguments to pass to selector.
*
* @return {*} Selector result.
*/
/* eslint-enable jsdoc/check-param-names */
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 = normalizedGetDependants.apply(null, args);
cache = getCache(dependants);
// If not guaranteed uniqueness by dependants (primitive type), 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.
/** @type {CacheNode} */ (node.prev).next = node.next;
if (node.next) {
node.next.prev = node.prev;
}
node.next = cache.head;
node.prev = null;
/** @type {CacheNode} */ (cache.head).prev = node;
cache.head = node;
}
// Return immediately
return node.val;
}
// No cached value found. Continue to insertion phase:
node = /** @type {CacheNode} */ ({
// 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 = normalizedGetDependants;
callSelector.clear = clear;
clear();
return /** @type {S & EnhancedSelector} */ (callSelector);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/store/selectors.js
/**
* External dependencies
*/
/**
* Returns the registered static commands.
*
* @param {Object} state State tree.
* @param {boolean} contextual Whether to return only contextual commands.
*
* @return {import('./actions').WPCommandConfig[]} The list of registered commands.
*/
const getCommands = rememo((state, contextual = false) => Object.values(state.commands).filter(command => {
const isContextual = command.context && command.context === state.context;
return contextual ? isContextual : !isContextual;
}), state => [state.commands, state.context]);
/**
* Returns the registered command loaders.
*
* @param {Object} state State tree.
* @param {boolean} contextual Whether to return only contextual command loaders.
*
* @return {import('./actions').WPCommandLoaderConfig[]} The list of registered command loaders.
*/
const getCommandLoaders = rememo((state, contextual = false) => Object.values(state.commandLoaders).filter(loader => {
const isContextual = loader.context && loader.context === state.context;
return contextual ? isContextual : !isContextual;
}), state => [state.commandLoaders, state.context]);
/**
* Returns whether the command palette is open.
*
* @param {Object} state State tree.
*
* @return {boolean} Returns whether the command palette is open.
*/
function selectors_isOpen(state) {
return state.isOpen;
}
/**
* Returns whether the active context.
*
* @param {Object} state State tree.
*
* @return {string} Context.
*/
function getContext(state) {
return state.context;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/store/private-actions.js
/**
* Sets the active context.
*
* @param {string} context Context.
*
* @return {Object} action.
*/
function setContext(context) {
return {
type: 'SET_CONTEXT',
context
};
}
;// CONCATENATED MODULE: external ["wp","privateApis"]
const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/lock-unlock.js
/**
* WordPress dependencies
*/
const {
lock,
unlock
} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/commands');
;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/store/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const STORE_NAME = 'core/commands';
/**
* Store definition for the commands namespace.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*
* @type {Object}
*
* @example
* ```js
* import { store as commandsStore } from '@wordpress/commands';
* import { useDispatch } from '@wordpress/data';
* ...
* const { open: openCommandCenter } = useDispatch( commandsStore );
* ```
*/
const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
reducer: store_reducer,
actions: actions_namespaceObject,
selectors: selectors_namespaceObject
});
(0,external_wp_data_namespaceObject.register)(store);
unlock(store).registerPrivateActions(private_actions_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/components/command-menu.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const inputLabel = (0,external_wp_i18n_namespaceObject.__)('Search for commands');
function CommandMenuLoader({
name,
search,
hook,
setLoader,
close
}) {
var _hook;
const {
isLoading,
commands = []
} = (_hook = hook({
search
})) !== null && _hook !== void 0 ? _hook : {};
(0,external_wp_element_namespaceObject.useEffect)(() => {
setLoader(name, isLoading);
}, [setLoader, name, isLoading]);
if (!commands.length) {
return null;
}
return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, commands.map(command => {
var _command$searchLabel;
return (0,external_React_namespaceObject.createElement)(Le.Item, {
key: command.name,
value: (_command$searchLabel = command.searchLabel) !== null && _command$searchLabel !== void 0 ? _command$searchLabel : command.label,
onSelect: () => command.callback({
close
}),
id: command.name
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
alignment: "left",
className: classnames_default()('commands-command-menu__item', {
'has-icon': command.icon
})
}, command.icon && (0,external_React_namespaceObject.createElement)(icon, {
icon: command.icon
}), (0,external_React_namespaceObject.createElement)("span", null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextHighlight, {
text: command.label,
highlight: search
}))));
}));
}
function CommandMenuLoaderWrapper({
hook,
search,
setLoader,
close
}) {
// The "hook" prop is actually a custom React hook
// so to avoid breaking the rules of hooks
// the CommandMenuLoaderWrapper component need to be
// remounted on each hook prop change
// We use the key state to make sure we do that properly.
const currentLoader = (0,external_wp_element_namespaceObject.useRef)(hook);
const [key, setKey] = (0,external_wp_element_namespaceObject.useState)(0);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (currentLoader.current !== hook) {
currentLoader.current = hook;
setKey(prevKey => prevKey + 1);
}
}, [hook]);
return (0,external_React_namespaceObject.createElement)(CommandMenuLoader, {
key: key,
hook: currentLoader.current,
search: search,
setLoader: setLoader,
close: close
});
}
function CommandMenuGroup({
isContextual,
search,
setLoader,
close
}) {
const {
commands,
loaders
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getCommands,
getCommandLoaders
} = select(store);
return {
commands: getCommands(isContextual),
loaders: getCommandLoaders(isContextual)
};
}, [isContextual]);
if (!commands.length && !loaders.length) {
return null;
}
return (0,external_React_namespaceObject.createElement)(Le.Group, null, commands.map(command => {
var _command$searchLabel2;
return (0,external_React_namespaceObject.createElement)(Le.Item, {
key: command.name,
value: (_command$searchLabel2 = command.searchLabel) !== null && _command$searchLabel2 !== void 0 ? _command$searchLabel2 : command.label,
onSelect: () => command.callback({
close
}),
id: command.name
}, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
alignment: "left",
className: classnames_default()('commands-command-menu__item', {
'has-icon': command.icon
})
}, command.icon && (0,external_React_namespaceObject.createElement)(icon, {
icon: command.icon
}), (0,external_React_namespaceObject.createElement)("span", null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextHighlight, {
text: command.label,
highlight: search
}))));
}), loaders.map(loader => (0,external_React_namespaceObject.createElement)(CommandMenuLoaderWrapper, {
key: loader.name,
hook: loader.hook,
search: search,
setLoader: setLoader,
close: close
})));
}
function CommandInput({
isOpen,
search,
setSearch
}) {
const commandMenuInput = (0,external_wp_element_namespaceObject.useRef)();
const _value = T(state => state.value);
const selectedItemId = (0,external_wp_element_namespaceObject.useMemo)(() => {
const item = document.querySelector(`[cmdk-item=""][data-value="${_value}"]`);
return item?.getAttribute('id');
}, [_value]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Focus the command palette input when mounting the modal.
if (isOpen) {
commandMenuInput.current.focus();
}
}, [isOpen]);
return (0,external_React_namespaceObject.createElement)(Le.Input, {
ref: commandMenuInput,
value: search,
onValueChange: setSearch,
placeholder: inputLabel,
"aria-activedescendant": selectedItemId,
icon: search
});
}
/**
* @ignore
*/
function CommandMenu() {
const {
registerShortcut
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)('');
const isOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isOpen(), []);
const {
open,
close
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const [loaders, setLoaders] = (0,external_wp_element_namespaceObject.useState)({});
const commandListRef = (0,external_wp_element_namespaceObject.useRef)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
registerShortcut({
name: 'core/commands',
category: 'global',
description: (0,external_wp_i18n_namespaceObject.__)('Open the command palette.'),
keyCombination: {
modifier: 'primary',
character: 'k'
}
});
}, [registerShortcut]);
// Temporary fix for the suggestions Listbox labeling.
// See https://github.com/pacocoursey/cmdk/issues/196
(0,external_wp_element_namespaceObject.useEffect)(() => {
commandListRef.current?.removeAttribute('aria-labelledby');
commandListRef.current?.setAttribute('aria-label', (0,external_wp_i18n_namespaceObject.__)('Command suggestions'));
}, [commandListRef.current]);
(0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/commands', /** @type {import('react').KeyboardEventHandler} */
event => {
// Bails to avoid obscuring the effect of the preceding handler(s).
if (event.defaultPrevented) return;
event.preventDefault();
if (isOpen) {
close();
} else {
open();
}
}, {
bindGlobal: true
});
const setLoader = (0,external_wp_element_namespaceObject.useCallback)((name, value) => setLoaders(current => ({
...current,
[name]: value
})), []);
const closeAndReset = () => {
setSearch('');
close();
};
if (!isOpen) {
return false;
}
const onKeyDown = event => {
if (
// Ignore keydowns from IMEs
event.nativeEvent.isComposing ||
// Workaround for Mac Safari where the final Enter/Backspace of an IME composition
// is `isComposing=false`, even though it's technically still part of the composition.
// These can only be detected by keyCode.
event.keyCode === 229) {
event.preventDefault();
}
};
const isLoading = Object.values(loaders).some(Boolean);
return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
className: "commands-command-menu",
overlayClassName: "commands-command-menu__overlay",
onRequestClose: closeAndReset,
__experimentalHideHeader: true,
contentLabel: (0,external_wp_i18n_namespaceObject.__)('Command palette')
}, (0,external_React_namespaceObject.createElement)("div", {
className: "commands-command-menu__container"
}, (0,external_React_namespaceObject.createElement)(Le, {
label: inputLabel,
onKeyDown: onKeyDown
}, (0,external_React_namespaceObject.createElement)("div", {
className: "commands-command-menu__header"
}, (0,external_React_namespaceObject.createElement)(icon, {
icon: library_search
}), (0,external_React_namespaceObject.createElement)(CommandInput, {
search: search,
setSearch: setSearch,
isOpen: isOpen
})), (0,external_React_namespaceObject.createElement)(Le.List, {
ref: commandListRef
}, search && !isLoading && (0,external_React_namespaceObject.createElement)(Le.Empty, null, (0,external_wp_i18n_namespaceObject.__)('No results found.')), (0,external_React_namespaceObject.createElement)(CommandMenuGroup, {
search: search,
setLoader: setLoader,
close: closeAndReset,
isContextual: true
}), search && (0,external_React_namespaceObject.createElement)(CommandMenuGroup, {
search: search,
setLoader: setLoader,
close: closeAndReset
})))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/hooks/use-command-context.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Sets the active context of the command palette
*
* @param {string} context Context to set.
*/
function useCommandContext(context) {
const {
getContext
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const initialContext = (0,external_wp_element_namespaceObject.useRef)(getContext());
const {
setContext
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
(0,external_wp_element_namespaceObject.useEffect)(() => {
setContext(context);
}, [context, setContext]);
// This effects ensures that on unmount, we restore the context
// that was set before the component actually mounts.
(0,external_wp_element_namespaceObject.useEffect)(() => {
const initialContextRef = initialContext.current;
return () => setContext(initialContextRef);
}, [setContext]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/private-apis.js
/**
* Internal dependencies
*/
/**
* @private
*/
const privateApis = {};
lock(privateApis, {
useCommandContext: useCommandContext
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/hooks/use-command.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Attach a command to the command palette. Used for static commands.
*
* @param {import('../store/actions').WPCommandConfig} command command config.
*
* @example
* ```js
* import { useCommand } from '@wordpress/commands';
* import { plus } from '@wordpress/icons';
*
* useCommand( {
* name: 'myplugin/my-command-name',
* label: __( 'Add new post' ),
* icon: plus,
* callback: ({ close }) => {
* document.location.href = 'post-new.php';
* close();
* },
* } );
* ```
*/
function useCommand(command) {
const {
registerCommand,
unregisterCommand
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const currentCallback = (0,external_wp_element_namespaceObject.useRef)(command.callback);
(0,external_wp_element_namespaceObject.useEffect)(() => {
currentCallback.current = command.callback;
}, [command.callback]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (command.disabled) {
return;
}
registerCommand({
name: command.name,
context: command.context,
label: command.label,
searchLabel: command.searchLabel,
icon: command.icon,
callback: (...args) => currentCallback.current(...args)
});
return () => {
unregisterCommand(command.name);
};
}, [command.name, command.label, command.searchLabel, command.icon, command.context, command.disabled, registerCommand, unregisterCommand]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/hooks/use-command-loader.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Attach a command loader to the command palette. Used for dynamic commands.
*
* @param {import('../store/actions').WPCommandLoaderConfig} loader command loader config.
*
* @example
* ```js
* import { useCommandLoader } from '@wordpress/commands';
* import { post, page, layout, symbolFilled } from '@wordpress/icons';
*
* const icons = {
* post,
* page,
* wp_template: layout,
* wp_template_part: symbolFilled,
* };
*
* function usePageSearchCommandLoader( { search } ) {
* // Retrieve the pages for the "search" term.
* const { records, isLoading } = useSelect( ( select ) => {
* const { getEntityRecords } = select( coreStore );
* const query = {
* search: !! search ? search : undefined,
* per_page: 10,
* orderby: search ? 'relevance' : 'date',
* };
* return {
* records: getEntityRecords( 'postType', 'page', query ),
* isLoading: ! select( coreStore ).hasFinishedResolution(
* 'getEntityRecords',
* 'postType', 'page', query ]
* ),
* };
* }, [ search ] );
*
* // Create the commands.
* const commands = useMemo( () => {
* return ( records ?? [] ).slice( 0, 10 ).map( ( record ) => {
* return {
* name: record.title?.rendered + ' ' + record.id,
* label: record.title?.rendered
* ? record.title?.rendered
* : __( '(no title)' ),
* icon: icons[ postType ],
* callback: ( { close } ) => {
* const args = {
* postType,
* postId: record.id,
* ...extraArgs,
* };
* document.location = addQueryArgs( 'site-editor.php', args );
* close();
* },
* };
* } );
* }, [ records, history ] );
*
* return {
* commands,
* isLoading,
* };
* }
*
* useCommandLoader( {
* name: 'myplugin/page-search',
* hook: usePageSearchCommandLoader,
* } );
* ```
*/
function useCommandLoader(loader) {
const {
registerCommandLoader,
unregisterCommandLoader
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (loader.disabled) {
return;
}
registerCommandLoader({
name: loader.name,
hook: loader.hook,
context: loader.context
});
return () => {
unregisterCommandLoader(loader.name);
};
}, [loader.name, loader.hook, loader.context, loader.disabled, registerCommandLoader, unregisterCommandLoader]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/commands/build-module/index.js
})();
(window.wp = window.wp || {}).commands = __webpack_exports__;
/******/ })()
;/*! This file is auto-generated */
(()=>{var e={5755:(e,t)=>{var n;
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)){if(n.length){var c=o.apply(null,n);c&&e.push(c)}}else if("object"===a){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var u in n)r.call(n,u)&&n[u]&&e.push(u)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},6007:e=>{var t=1,n=.9,r=.3,o=.1,a=0,c=.999,u=.9999,i=.99,l=/[\\\/\-_+.# \t"@\[\(\{&]/,s=/[\\\/\-_+.# \t"@\[\(\{&]/g;function d(e,f,m,p,v,h){if(h===f.length)return v===e.length?t:i;for(var g,E,b,y=p.charAt(h),w=m.indexOf(y,v),C=0;w>=0;)(g=d(e,f,m,p,w+1,h+1))>C&&(w===v?g*=t:l.test(e.charAt(w-1))?(g*=n,(b=e.slice(v,w-1).match(s))&&v>0&&(g*=Math.pow(c,b.length))):l.test(e.slice(v,w-1))?(g*=a,v>0&&(g*=Math.pow(c,w-v))):(g*=r,v>0&&(g*=Math.pow(c,w-v))),e.charAt(w)!==f.charAt(h)&&(g*=u)),g<o&&m.charAt(w-1)===p.charAt(h+1)&&m.charAt(w-1)!==p.charAt(h)&&(E=d(e,f,m,p,w+1,h+2))*o>g&&(g=E*o),g>C&&(C=g),w=m.indexOf(y,w+1);return C}e.exports=function(e,t){return d(e,t,e.toLowerCase(),t.toLowerCase(),0,0)}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nc=void 0;var r={};(()=>{"use strict";n.r(r),n.d(r,{CommandMenu:()=>An,privateApis:()=>Dn,store:()=>Sn,useCommand:()=>Nn,useCommandLoader:()=>Mn});var e={};n.r(e),n.d(e,{close:()=>sn,open:()=>ln,registerCommand:()=>on,registerCommandLoader:()=>cn,unregisterCommand:()=>an,unregisterCommandLoader:()=>un});var t={};n.r(t),n.d(t,{getCommandLoaders:()=>hn,getCommands:()=>vn,getContext:()=>En,isOpen:()=>gn});var o={};n.r(o),n.d(o,{setContext:()=>bn});const a=window.React;function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(this,arguments)}function u(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(null==e||e(r),!1===n||!r.defaultPrevented)return null==t?void 0:t(r)}}function i(...e){return t=>e.forEach((e=>function(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}(e,t)))}function l(...e){return(0,a.useCallback)(i(...e),e)}function s(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return(0,a.useMemo)((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}const d=Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)?a.useLayoutEffect:()=>{},f=a["useId".toString()]||(()=>{});let m=0;function p(e){const[t,n]=a.useState(f());return d((()=>{e||n((e=>null!=e?e:String(m++)))}),[e]),e||(t?`radix-${t}`:"")}function v(e){const t=(0,a.useRef)(e);return(0,a.useEffect)((()=>{t.current=e})),(0,a.useMemo)((()=>(...e)=>{var n;return null===(n=t.current)||void 0===n?void 0:n.call(t,...e)}),[])}function h({prop:e,defaultProp:t,onChange:n=(()=>{})}){const[r,o]=function({defaultProp:e,onChange:t}){const n=(0,a.useState)(e),[r]=n,o=(0,a.useRef)(r),c=v(t);return(0,a.useEffect)((()=>{o.current!==r&&(c(r),o.current=r)}),[r,o,c]),n}({defaultProp:t,onChange:n}),c=void 0!==e,u=c?e:r,i=v(n);return[u,(0,a.useCallback)((t=>{if(c){const n="function"==typeof t?t(e):t;n!==e&&i(n)}else o(t)}),[c,e,o,i])]}const g=window.ReactDOM;var E=n.n(g);const b=(0,a.forwardRef)(((e,t)=>{const{children:n,...r}=e,o=a.Children.toArray(n),u=o.find(C);if(u){const e=u.props.children,n=o.map((t=>t===u?a.Children.count(e)>1?a.Children.only(null):(0,a.isValidElement)(e)?e.props.children:null:t));return(0,a.createElement)(y,c({},r,{ref:t}),(0,a.isValidElement)(e)?(0,a.cloneElement)(e,void 0,n):null)}return(0,a.createElement)(y,c({},r,{ref:t}),n)}));b.displayName="Slot";const y=(0,a.forwardRef)(((e,t)=>{const{children:n,...r}=e;return(0,a.isValidElement)(n)?(0,a.cloneElement)(n,{...S(r,n.props),ref:i(t,n.ref)}):a.Children.count(n)>1?a.Children.only(null):null}));y.displayName="SlotClone";const w=({children:e})=>(0,a.createElement)(a.Fragment,null,e);function C(e){return(0,a.isValidElement)(e)&&e.type===w}function S(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?n[r]=(...e)=>{null==a||a(...e),null==o||o(...e)}:"style"===r?n[r]={...o,...a}:"className"===r&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}const x=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"].reduce(((e,t)=>{const n=(0,a.forwardRef)(((e,n)=>{const{asChild:r,...o}=e,u=r?b:t;return(0,a.useEffect)((()=>{window[Symbol.for("radix-ui")]=!0}),[]),(0,a.createElement)(u,c({},o,{ref:n}))}));return n.displayName=`Primitive.${t}`,{...e,[t]:n}}),{});const O="dismissableLayer.update",k="dismissableLayer.pointerDownOutside",R="dismissableLayer.focusOutside";let L;const A=(0,a.createContext)({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),D=(0,a.forwardRef)(((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:d,...f}=e,m=(0,a.useContext)(A),[p,h]=(0,a.useState)(null),[,g]=(0,a.useState)({}),E=l(t,(e=>h(e))),b=Array.from(m.layers),[y]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),w=b.indexOf(y),C=p?b.indexOf(p):-1,S=m.layersWithOutsidePointerEventsDisabled.size>0,D=C>=w,_=function(e){const t=v(e),n=(0,a.useRef)(!1),r=(0,a.useRef)((()=>{}));return(0,a.useEffect)((()=>{const e=e=>{if(e.target&&!n.current){const o={originalEvent:e};function a(){M(k,t,o,{discrete:!0})}"touch"===e.pointerType?(document.removeEventListener("click",r.current),r.current=a,document.addEventListener("click",r.current,{once:!0})):a()}n.current=!1},o=window.setTimeout((()=>{document.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(o),document.removeEventListener("pointerdown",e),document.removeEventListener("click",r.current)}}),[t]),{onPointerDownCapture:()=>n.current=!0}}((e=>{const t=e.target,n=[...m.branches].some((e=>e.contains(t)));D&&!n&&(null==o||o(e),null==s||s(e),e.defaultPrevented||null==d||d())})),P=function(e){const t=v(e),n=(0,a.useRef)(!1);return(0,a.useEffect)((()=>{const e=e=>{if(e.target&&!n.current){M(R,t,{originalEvent:e},{discrete:!1})}};return document.addEventListener("focusin",e),()=>document.removeEventListener("focusin",e)}),[t]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}((e=>{const t=e.target;[...m.branches].some((e=>e.contains(t)))||(null==i||i(e),null==s||s(e),e.defaultPrevented||null==d||d())}));return function(e){const t=v(e);(0,a.useEffect)((()=>{const e=e=>{"Escape"===e.key&&t(e)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[t])}((e=>{C===m.layers.size-1&&(null==r||r(e),!e.defaultPrevented&&d&&(e.preventDefault(),d()))})),(0,a.useEffect)((()=>{if(p)return n&&(0===m.layersWithOutsidePointerEventsDisabled.size&&(L=document.body.style.pointerEvents,document.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(p)),m.layers.add(p),N(),()=>{n&&1===m.layersWithOutsidePointerEventsDisabled.size&&(document.body.style.pointerEvents=L)}}),[p,n,m]),(0,a.useEffect)((()=>()=>{p&&(m.layers.delete(p),m.layersWithOutsidePointerEventsDisabled.delete(p),N())}),[p,m]),(0,a.useEffect)((()=>{const e=()=>g({});return document.addEventListener(O,e),()=>document.removeEventListener(O,e)}),[]),(0,a.createElement)(x.div,c({},f,{ref:E,style:{pointerEvents:S?D?"auto":"none":void 0,...e.style},onFocusCapture:u(e.onFocusCapture,P.onFocusCapture),onBlurCapture:u(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:u(e.onPointerDownCapture,_.onPointerDownCapture)}))}));function N(){const e=new CustomEvent(O);document.dispatchEvent(e)}function M(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&(0,g.flushSync)((()=>e.dispatchEvent(t)))}(o,a):o.dispatchEvent(a)}const _="focusScope.autoFocusOnMount",P="focusScope.autoFocusOnUnmount",I={bubbles:!1,cancelable:!0},T=(0,a.forwardRef)(((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:u,...i}=e,[s,d]=(0,a.useState)(null),f=v(o),m=v(u),p=(0,a.useRef)(null),h=l(t,(e=>d(e))),g=(0,a.useRef)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;(0,a.useEffect)((()=>{if(r){function e(e){if(g.paused||!s)return;const t=e.target;s.contains(t)?p.current=t:U(p.current,{select:!0})}function t(e){!g.paused&&s&&(s.contains(e.relatedTarget)||U(p.current,{select:!0}))}return document.addEventListener("focusin",e),document.addEventListener("focusout",t),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t)}}}),[r,s,g.paused]),(0,a.useEffect)((()=>{if(s){B.add(g);const t=document.activeElement;if(!s.contains(t)){const n=new CustomEvent(_,I);s.addEventListener(_,f),s.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(U(r,{select:t}),document.activeElement!==n)return}((e=F(s),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&U(s))}return()=>{s.removeEventListener(_,f),setTimeout((()=>{const e=new CustomEvent(P,I);s.addEventListener(P,m),s.dispatchEvent(e),e.defaultPrevented||U(null!=t?t:document.body,{select:!0}),s.removeEventListener(P,m),B.remove(g)}),0)}}var e}),[s,f,m,g]);const E=(0,a.useCallback)((e=>{if(!n&&!r)return;if(g.paused)return;const t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,o=document.activeElement;if(t&&o){const t=e.currentTarget,[r,a]=function(e){const t=F(e),n=j(t,e),r=j(t.reverse(),e);return[n,r]}(t);r&&a?e.shiftKey||o!==a?e.shiftKey&&o===r&&(e.preventDefault(),n&&U(a,{select:!0})):(e.preventDefault(),n&&U(r,{select:!0})):o===t&&e.preventDefault()}}),[n,r,g.paused]);return(0,a.createElement)(x.div,c({tabIndex:-1},i,{ref:h,onKeyDown:E}))}));function F(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function j(e,t){for(const n of e)if(!W(n,{upTo:t}))return n}function W(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function U(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}const B=function(){let e=[];return{add(t){const n=e[0];t!==n&&(null==n||n.pause()),e=K(e,t),e.unshift(t)},remove(t){var n;e=K(e,t),null===(n=e[0])||void 0===n||n.resume()}}}();function K(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}const $=(0,a.forwardRef)(((e,t)=>{var n;const{container:r=(null===globalThis||void 0===globalThis||null===(n=globalThis.document)||void 0===n?void 0:n.body),...o}=e;return r?E().createPortal((0,a.createElement)(x.div,c({},o,{ref:t})),r):null}));const q=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=(0,a.useState)(),r=(0,a.useRef)({}),o=(0,a.useRef)(e),c=(0,a.useRef)("none"),u=e?"mounted":"unmounted",[i,l]=function(e,t){return(0,a.useReducer)(((e,n)=>{const r=t[e][n];return null!=r?r:e}),e)}(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,a.useEffect)((()=>{const e=z(r.current);c.current="mounted"===i?e:"none"}),[i]),d((()=>{const t=r.current,n=o.current;if(n!==e){const r=c.current,a=z(t);if(e)l("MOUNT");else if("none"===a||"none"===(null==t?void 0:t.display))l("UNMOUNT");else{l(n&&r!==a?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,l]),d((()=>{if(t){const e=e=>{const n=z(r.current).includes(e.animationName);e.target===t&&n&&(0,g.flushSync)((()=>l("ANIMATION_END")))},n=e=>{e.target===t&&(c.current=z(r.current))};return t.addEventListener("animationstart",n),t.addEventListener("animationcancel",e),t.addEventListener("animationend",e),()=>{t.removeEventListener("animationstart",n),t.removeEventListener("animationcancel",e),t.removeEventListener("animationend",e)}}l("ANIMATION_END")}),[t,l]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:(0,a.useCallback)((e=>{e&&(r.current=getComputedStyle(e)),n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):a.Children.only(n),c=l(r.ref,o.ref);return"function"==typeof n||r.isPresent?(0,a.cloneElement)(o,{ref:c}):null};function z(e){return(null==e?void 0:e.animationName)||"none"}q.displayName="Presence";let G=0;function H(){(0,a.useEffect)((()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=n[0])&&void 0!==e?e:V()),document.body.insertAdjacentElement("beforeend",null!==(t=n[1])&&void 0!==t?t:V()),G++,()=>{1===G&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),G--}}),[])}function V(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var X=function(){return X=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},X.apply(this,arguments)};function Y(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}Object.create;function Z(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}Object.create;"function"==typeof SuppressedError&&SuppressedError;var J="right-scroll-bar-position",Q="width-before-scroll-bar";function ee(e,t){return n=t||null,r=function(t){return e.forEach((function(e){return function(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}(e,t)}))},(o=(0,a.useState)((function(){return{value:n,callback:r,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}}))[0]).callback=r,o.facade;var n,r,o}function te(e){return e}function ne(e,t){void 0===t&&(t=te);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var o=t(e,r);return n.push(o),function(){n=n.filter((function(e){return e!==o}))}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var o=n;n=[],o.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},c=function(){return Promise.resolve().then(a)};c(),n={push:function(e){t.push(e),c()},filter:function(e){return t=t.filter(e),n}}}};return o}var re=function(e){void 0===e&&(e={});var t=ne(null);return t.options=X({async:!0,ssr:!1},e),t}(),oe=function(){},ae=a.forwardRef((function(e,t){var n=a.useRef(null),r=a.useState({onScrollCapture:oe,onWheelCapture:oe,onTouchMoveCapture:oe}),o=r[0],c=r[1],u=e.forwardProps,i=e.children,l=e.className,s=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,p=e.noIsolation,v=e.inert,h=e.allowPinchZoom,g=e.as,E=void 0===g?"div":g,b=Y(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),y=m,w=ee([n,t]),C=X(X({},b),o);return a.createElement(a.Fragment,null,d&&a.createElement(y,{sideCar:re,removeScrollBar:s,shards:f,noIsolation:p,inert:v,setCallbacks:c,allowPinchZoom:!!h,lockRef:n}),u?a.cloneElement(a.Children.only(i),X(X({},C),{ref:w})):a.createElement(E,X({},C,{className:l,ref:w}),i))}));ae.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},ae.classNames={fullWidth:Q,zeroRight:J};var ce,ue=function(e){var t=e.sideCar,n=Y(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return a.createElement(r,X({},n))};ue.isSideCarExport=!0;function ie(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ce||n.nc;return t&&e.setAttribute("nonce",t),e}var le=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=ie())&&(o=n,(r=t).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},se=function(){var e,t=(e=le(),function(t,n){a.useEffect((function(){return e.add(t),function(){e.remove()}}),[t&&n])});return function(e){var n=e.styles,r=e.dynamic;return t(n,r),null}},de={left:0,top:0,right:0,gap:0},fe=function(e){return parseInt(e||"",10)||0},me=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return de;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[fe(n),fe(r),fe(o)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},pe=se(),ve=function(e,t,n,r){var o=e.left,a=e.top,c=e.right,u=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(u,"px ").concat(r,";\n }\n body {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(a,"px;\n padding-right: ").concat(c,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(u,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(J," {\n right: ").concat(u,"px ").concat(r,";\n }\n \n .").concat(Q," {\n margin-right: ").concat(u,"px ").concat(r,";\n }\n \n .").concat(J," .").concat(J," {\n right: 0 ").concat(r,";\n }\n \n .").concat(Q," .").concat(Q," {\n margin-right: 0 ").concat(r,";\n }\n \n body {\n ").concat("--removed-body-scroll-bar-size",": ").concat(u,"px;\n }\n")},he=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=void 0===r?"margin":r,c=a.useMemo((function(){return me(o)}),[o]);return a.createElement(pe,{styles:ve(c,!t,o,n?"":"!important")})},ge=!1;if("undefined"!=typeof window)try{var Ee=Object.defineProperty({},"passive",{get:function(){return ge=!0,!0}});window.addEventListener("test",Ee,Ee),window.removeEventListener("test",Ee,Ee)}catch(e){ge=!1}var be=!!ge&&{passive:!1},ye=function(e,t){var n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),we(e,n)){var r=Ce(e,n);if(r[1]>r[2])return!0}n=n.parentNode}while(n&&n!==document.body);return!1},we=function(e,t){return"v"===e?function(e){var t=window.getComputedStyle(e);return"hidden"!==t.overflowY&&!(t.overflowY===t.overflowX&&"visible"===t.overflowY)}(t):function(e){var t=window.getComputedStyle(e);return"hidden"!==t.overflowX&&!(t.overflowY===t.overflowX&&"visible"===t.overflowX)}(t)},Ce=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},Se=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},xe=function(e){return[e.deltaX,e.deltaY]},Oe=function(e){return e&&"current"in e?e.current:e},ke=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},Re=0,Le=[];const Ae=(De=function(e){var t=a.useRef([]),n=a.useRef([0,0]),r=a.useRef(),o=a.useState(Re++)[0],c=a.useState((function(){return se()}))[0],u=a.useRef(e);a.useEffect((function(){u.current=e}),[e]),a.useEffect((function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var t=Z([e.lockRef.current],(e.shards||[]).map(Oe),!0).filter(Boolean);return t.forEach((function(e){return e.classList.add("allow-interactivity-".concat(o))})),function(){document.body.classList.remove("block-interactivity-".concat(o)),t.forEach((function(e){return e.classList.remove("allow-interactivity-".concat(o))}))}}}),[e.inert,e.lockRef.current,e.shards]);var i=a.useCallback((function(e,t){if("touches"in e&&2===e.touches.length)return!u.current.allowPinchZoom;var o,a=Se(e),c=n.current,i="deltaX"in e?e.deltaX:c[0]-a[0],l="deltaY"in e?e.deltaY:c[1]-a[1],s=e.target,d=Math.abs(i)>Math.abs(l)?"h":"v";if("touches"in e&&"h"===d&&"range"===s.type)return!1;var f=ye(d,s);if(!f)return!0;if(f?o=d:(o="v"===d?"h":"v",f=ye(d,s)),!f)return!1;if(!r.current&&"changedTouches"in e&&(i||l)&&(r.current=o),!o)return!0;var m=r.current||o;return function(e,t,n,r,o){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),c=a*r,u=n.target,i=t.contains(u),l=!1,s=c>0,d=0,f=0;do{var m=Ce(e,u),p=m[0],v=m[1]-m[2]-a*p;(p||v)&&we(e,u)&&(d+=v,f+=p),u=u.parentNode}while(!i&&u!==document.body||i&&(t.contains(u)||t===u));return(s&&(o&&0===d||!o&&c>d)||!s&&(o&&0===f||!o&&-c>f))&&(l=!0),l}(m,t,e,"h"===m?i:l,!0)}),[]),l=a.useCallback((function(e){var n=e;if(Le.length&&Le[Le.length-1]===c){var r="deltaY"in n?xe(n):Se(n),o=t.current.filter((function(e){return e.name===n.type&&e.target===n.target&&function(e,t){return e[0]===t[0]&&e[1]===t[1]}(e.delta,r)}))[0];if(o&&o.should)n.preventDefault();else if(!o){var a=(u.current.shards||[]).map(Oe).filter(Boolean).filter((function(e){return e.contains(n.target)}));(a.length>0?i(n,a[0]):!u.current.noIsolation)&&n.preventDefault()}}}),[]),s=a.useCallback((function(e,n,r,o){var a={name:e,delta:n,target:r,should:o};t.current.push(a),setTimeout((function(){t.current=t.current.filter((function(e){return e!==a}))}),1)}),[]),d=a.useCallback((function(e){n.current=Se(e),r.current=void 0}),[]),f=a.useCallback((function(t){s(t.type,xe(t),t.target,i(t,e.lockRef.current))}),[]),m=a.useCallback((function(t){s(t.type,Se(t),t.target,i(t,e.lockRef.current))}),[]);a.useEffect((function(){return Le.push(c),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",l,be),document.addEventListener("touchmove",l,be),document.addEventListener("touchstart",d,be),function(){Le=Le.filter((function(e){return e!==c})),document.removeEventListener("wheel",l,be),document.removeEventListener("touchmove",l,be),document.removeEventListener("touchstart",d,be)}}),[]);var p=e.removeScrollBar,v=e.inert;return a.createElement(a.Fragment,null,v?a.createElement(c,{styles:ke(o)}):null,p?a.createElement(he,{gapMode:"margin"}):null)},re.useMedium(De),ue);var De,Ne=a.forwardRef((function(e,t){return a.createElement(ae,X({},e,{ref:t,sideCar:Ae}))}));Ne.classNames=ae.classNames;const Me=Ne;var _e=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Pe=new WeakMap,Ie=new WeakMap,Te={},Fe=0,je=function(e){return e&&(e.host||je(e.parentNode))},We=function(e,t,n,r){var o=function(e,t){return t.map((function(t){if(e.contains(t))return t;var n=je(t);return n&&e.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",e,". Doing nothing"),null)})).filter((function(e){return Boolean(e)}))}(t,Array.isArray(e)?e:[e]);Te[n]||(Te[n]=new WeakMap);var a=Te[n],c=[],u=new Set,i=new Set(o),l=function(e){e&&!u.has(e)&&(u.add(e),l(e.parentNode))};o.forEach(l);var s=function(e){e&&!i.has(e)&&Array.prototype.forEach.call(e.children,(function(e){if(u.has(e))s(e);else{var t=e.getAttribute(r),o=null!==t&&"false"!==t,i=(Pe.get(e)||0)+1,l=(a.get(e)||0)+1;Pe.set(e,i),a.set(e,l),c.push(e),1===i&&o&&Ie.set(e,!0),1===l&&e.setAttribute(n,"true"),o||e.setAttribute(r,"true")}}))};return s(t),u.clear(),Fe++,function(){c.forEach((function(e){var t=Pe.get(e)-1,o=a.get(e)-1;Pe.set(e,t),a.set(e,o),t||(Ie.has(e)||e.removeAttribute(r),Ie.delete(e)),o||e.removeAttribute(n)})),--Fe||(Pe=new WeakMap,Pe=new WeakMap,Ie=new WeakMap,Te={})}},Ue=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||_e(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),We(r,o,n,"aria-hidden")):function(){return null}};const Be="Dialog",[Ke,$e]=function(e,t=[]){let n=[];const r=()=>{const t=n.map((e=>(0,a.createContext)(e)));return function(n){const r=(null==n?void 0:n[e])||t;return(0,a.useMemo)((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return r.scopeName=e,[function(t,r){const o=(0,a.createContext)(r),c=n.length;function u(t){const{scope:n,children:r,...u}=t,i=(null==n?void 0:n[e][c])||o,l=(0,a.useMemo)((()=>u),Object.values(u));return(0,a.createElement)(i.Provider,{value:l},r)}return n=[...n,r],u.displayName=t+"Provider",[u,function(n,u){const i=(null==u?void 0:u[e][c])||o,l=(0,a.useContext)(i);if(l)return l;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},s(r,...t)]}(Be),[qe,ze]=Ke(Be),Ge=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:c,modal:u=!0}=e,i=(0,a.useRef)(null),l=(0,a.useRef)(null),[s=!1,d]=h({prop:r,defaultProp:o,onChange:c});return(0,a.createElement)(qe,{scope:t,triggerRef:i,contentRef:l,contentId:p(),titleId:p(),descriptionId:p(),open:s,onOpenChange:d,onOpenToggle:(0,a.useCallback)((()=>d((e=>!e))),[d]),modal:u},n)},He="DialogPortal",[Ve,Xe]=Ke(He,{forceMount:void 0}),Ye=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,c=ze(He,t);return(0,a.createElement)(Ve,{scope:t,forceMount:n},a.Children.map(r,(e=>(0,a.createElement)(q,{present:n||c.open},(0,a.createElement)($,{asChild:!0,container:o},e)))))},Ze="DialogOverlay",Je=(0,a.forwardRef)(((e,t)=>{const n=Xe(Ze,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,u=ze(Ze,e.__scopeDialog);return u.modal?(0,a.createElement)(q,{present:r||u.open},(0,a.createElement)(Qe,c({},o,{ref:t}))):null})),Qe=(0,a.forwardRef)(((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Ze,n);return(0,a.createElement)(Me,{as:b,allowPinchZoom:!0,shards:[o.contentRef]},(0,a.createElement)(x.div,c({"data-state":ct(o.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))})),et="DialogContent",tt=(0,a.forwardRef)(((e,t)=>{const n=Xe(et,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,u=ze(et,e.__scopeDialog);return(0,a.createElement)(q,{present:r||u.open},u.modal?(0,a.createElement)(nt,c({},o,{ref:t})):(0,a.createElement)(rt,c({},o,{ref:t})))})),nt=(0,a.forwardRef)(((e,t)=>{const n=ze(et,e.__scopeDialog),r=(0,a.useRef)(null),o=l(t,n.contentRef,r);return(0,a.useEffect)((()=>{const e=r.current;if(e)return Ue(e)}),[]),(0,a.createElement)(ot,c({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:u(e.onCloseAutoFocus,(e=>{var t;e.preventDefault(),null===(t=n.triggerRef.current)||void 0===t||t.focus()})),onPointerDownOutside:u(e.onPointerDownOutside,(e=>{const t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()})),onFocusOutside:u(e.onFocusOutside,(e=>e.preventDefault()))}))})),rt=(0,a.forwardRef)(((e,t)=>{const n=ze(et,e.__scopeDialog),r=(0,a.useRef)(!1);return(0,a.createElement)(ot,c({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var o,a;(null===(o=e.onCloseAutoFocus)||void 0===o||o.call(e,t),t.defaultPrevented)||(r.current||null===(a=n.triggerRef.current)||void 0===a||a.focus(),t.preventDefault());r.current=!1},onInteractOutside:t=>{var o,a;null===(o=e.onInteractOutside)||void 0===o||o.call(e,t),t.defaultPrevented||(r.current=!0);const c=t.target;(null===(a=n.triggerRef.current)||void 0===a?void 0:a.contains(c))&&t.preventDefault()}}))})),ot=(0,a.forwardRef)(((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:u,...i}=e,s=ze(et,n),d=l(t,(0,a.useRef)(null));return H(),(0,a.createElement)(a.Fragment,null,(0,a.createElement)(T,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:u},(0,a.createElement)(D,c({role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":ct(s.open)},i,{ref:d,onDismiss:()=>s.onOpenChange(!1)}))),!1)})),at="DialogTitle";function ct(e){return e?"open":"closed"}const ut="DialogTitleWarning",[it,lt]=function(e,t){const n=(0,a.createContext)(t);function r(e){const{children:t,...r}=e,o=(0,a.useMemo)((()=>r),Object.values(r));return(0,a.createElement)(n.Provider,{value:o},t)}return r.displayName=e+"Provider",[r,function(r){const o=(0,a.useContext)(n);if(o)return o;if(void 0!==t)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}]}(ut,{contentName:et,titleName:at,docsSlug:"dialog"}),st=Ge,dt=Ye,ft=Je,mt=tt;var pt=n(6007),vt='[cmdk-group=""]',ht='[cmdk-group-items=""]',gt='[cmdk-item=""]',Et=`${gt}:not([aria-disabled="true"])`,bt="cmdk-item-select",yt="data-value",wt=(e,t)=>pt(e,t),Ct=a.createContext(void 0),St=()=>a.useContext(Ct),xt=a.createContext(void 0),Ot=()=>a.useContext(xt),kt=a.createContext(void 0),Rt=a.forwardRef(((e,t)=>{let n=a.useRef(null),r=Bt((()=>({search:"",value:"",filtered:{count:0,items:new Map,groups:new Set}}))),o=Bt((()=>new Set)),c=Bt((()=>new Map)),u=Bt((()=>new Map)),i=Bt((()=>new Set)),l=Wt(e),{label:s,children:d,value:f,onValueChange:m,filter:p,shouldFilter:v,...h}=e,g=a.useId(),E=a.useId(),b=a.useId(),y=zt();Ut((()=>{if(void 0!==f){let e=f.trim().toLowerCase();r.current.value=e,y(6,R),w.emit()}}),[f]);let w=a.useMemo((()=>({subscribe:e=>(i.current.add(e),()=>i.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var o,a,c;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)k(),x(),y(1,O);else if("value"===e){if(void 0!==(null==(o=l.current)?void 0:o.value))return void(null==(c=(a=l.current).onValueChange)||c.call(a,t));n||y(5,R)}w.emit()}},emit:()=>{i.current.forEach((e=>e()))}})),[]),C=a.useMemo((()=>({value:(e,t)=>{t!==u.current.get(e)&&(u.current.set(e,t),r.current.filtered.items.set(e,S(t)),y(2,(()=>{x(),w.emit()})))},item:(e,t)=>(o.current.add(e),t&&(c.current.has(t)?c.current.get(t).add(e):c.current.set(t,new Set([e]))),y(3,(()=>{k(),x(),r.current.value||O(),w.emit()})),()=>{u.current.delete(e),o.current.delete(e),r.current.filtered.items.delete(e),y(4,(()=>{k(),O(),w.emit()}))}),group:e=>(c.current.has(e)||c.current.set(e,new Set),()=>{u.current.delete(e),c.current.delete(e)}),filter:()=>l.current.shouldFilter,label:s||e["aria-label"],listId:g,inputId:b,labelId:E})),[]);function S(e){var t;let n=(null==(t=l.current)?void 0:t.filter)??wt;return e?n(e,r.current.search):0}function x(){if(!n.current||!r.current.search||!1===l.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach((n=>{let r=c.current.get(n),o=0;r.forEach((t=>{let n=e.get(t);o=Math.max(n,o)})),t.push([n,o])}));let o=n.current.querySelector('[cmdk-list-sizer=""]');A().sort(((t,n)=>{let r=t.getAttribute(yt),o=n.getAttribute(yt);return(e.get(o)??0)-(e.get(r)??0)})).forEach((e=>{let t=e.closest(ht);t?t.appendChild(e.parentElement===t?e:e.closest(`${ht} > *`)):o.appendChild(e.parentElement===o?e:e.closest(`${ht} > *`))})),t.sort(((e,t)=>t[1]-e[1])).forEach((e=>{let t=n.current.querySelector(`${vt}[${yt}="${e[0]}"]`);null==t||t.parentElement.appendChild(t)}))}function O(){let e=A().find((e=>!e.ariaDisabled)),t=null==e?void 0:e.getAttribute(yt);w.setState("value",t||void 0)}function k(){if(!r.current.search||!1===l.current.shouldFilter)return void(r.current.filtered.count=o.current.size);r.current.filtered.groups=new Set;let e=0;for(let t of o.current){let n=S(u.current.get(t));r.current.filtered.items.set(t,n),n>0&&e++}for(let[e,t]of c.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=e}function R(){var e,t,n;let r=L();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(vt))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function L(){return n.current.querySelector(`${gt}[aria-selected="true"]`)}function A(){return Array.from(n.current.querySelectorAll(Et))}function D(e){let t=A()[e];t&&w.setState("value",t.getAttribute(yt))}function N(e){var t;let n=L(),r=A(),o=r.findIndex((e=>e===n)),a=r[o+e];null!=(t=l.current)&&t.loop&&(a=o+e<0?r[r.length-1]:o+e===r.length?r[0]:r[o+e]),a&&w.setState("value",a.getAttribute(yt))}function M(e){let t,n=L(),r=null==n?void 0:n.closest(vt);for(;r&&!t;)r=e>0?Ft(r,vt):jt(r,vt),t=null==r?void 0:r.querySelector(Et);t?w.setState("value",t.getAttribute(yt)):N(e)}let _=()=>D(A().length-1),P=e=>{e.preventDefault(),e.metaKey?_():e.altKey?M(1):N(1)},I=e=>{e.preventDefault(),e.metaKey?D(0):e.altKey?M(-1):N(-1)};return a.createElement("div",{ref:Kt([n,t]),...h,"cmdk-root":"",onKeyDown:e=>{var t;if(null==(t=h.onKeyDown)||t.call(h,e),!e.defaultPrevented)switch(e.key){case"n":case"j":e.ctrlKey&&P(e);break;case"ArrowDown":P(e);break;case"p":case"k":e.ctrlKey&&I(e);break;case"ArrowUp":I(e);break;case"Home":e.preventDefault(),D(0);break;case"End":e.preventDefault(),_();break;case"Enter":{e.preventDefault();let t=L();if(t){let e=new Event(bt);t.dispatchEvent(e)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:C.inputId,id:C.labelId,style:Gt},s),a.createElement(xt.Provider,{value:w},a.createElement(Ct.Provider,{value:C},d)))})),Lt=a.forwardRef(((e,t)=>{let n=a.useId(),r=a.useRef(null),o=a.useContext(kt),c=St(),u=Wt(e);Ut((()=>c.item(n,o)),[]);let i=qt(n,r,[e.value,e.children,r]),l=Ot(),s=$t((e=>e.value&&e.value===i.current)),d=$t((e=>!1===c.filter()||(!e.search||e.filtered.items.get(n)>0)));function f(){var e,t;null==(t=(e=u.current).onSelect)||t.call(e,i.current)}if(a.useEffect((()=>{let t=r.current;if(t&&!e.disabled)return t.addEventListener(bt,f),()=>t.removeEventListener(bt,f)}),[d,e.onSelect,e.disabled]),!d)return null;let{disabled:m,value:p,onSelect:v,...h}=e;return a.createElement("div",{ref:Kt([r,t]),...h,"cmdk-item":"",role:"option","aria-disabled":m||void 0,"aria-selected":s||void 0,"data-selected":s||void 0,onPointerMove:m?void 0:function(){l.setState("value",i.current,!0)},onClick:m?void 0:f},e.children)})),At=a.forwardRef(((e,t)=>{let{heading:n,children:r,...o}=e,c=a.useId(),u=a.useRef(null),i=a.useRef(null),l=a.useId(),s=St(),d=$t((e=>!1===s.filter()||(!e.search||e.filtered.groups.has(c))));Ut((()=>s.group(c)),[]),qt(c,u,[e.value,e.heading,i]);let f=a.createElement(kt.Provider,{value:c},r);return a.createElement("div",{ref:Kt([u,t]),...o,"cmdk-group":"",role:"presentation",hidden:!d||void 0},n&&a.createElement("div",{ref:i,"cmdk-group-heading":"","aria-hidden":!0,id:l},n),a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?l:void 0},f))})),Dt=a.forwardRef(((e,t)=>{let{alwaysRender:n,...r}=e,o=a.useRef(null),c=$t((e=>!e.search));return n||c?a.createElement("div",{ref:Kt([o,t]),...r,"cmdk-separator":"",role:"separator"}):null})),Nt=a.forwardRef(((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,c=Ot(),u=$t((e=>e.search)),i=St();return a.useEffect((()=>{null!=e.value&&c.setState("search",e.value)}),[e.value]),a.createElement("input",{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":i.listId,"aria-labelledby":i.labelId,id:i.inputId,type:"text",value:o?e.value:u,onChange:e=>{o||c.setState("search",e.target.value),null==n||n(e.target.value)}})})),Mt=a.forwardRef(((e,t)=>{let{children:n,...r}=e,o=a.useRef(null),c=a.useRef(null),u=St();return a.useEffect((()=>{if(c.current&&o.current){let e,t=c.current,n=o.current,r=new ResizeObserver((()=>{e=requestAnimationFrame((()=>{let e=t.getBoundingClientRect().height;n.style.setProperty("--cmdk-list-height",e.toFixed(1)+"px")}))}));return r.observe(t),()=>{cancelAnimationFrame(e),r.unobserve(t)}}}),[]),a.createElement("div",{ref:Kt([o,t]),...r,"cmdk-list":"",role:"listbox","aria-label":"Suggestions",id:u.listId,"aria-labelledby":u.inputId},a.createElement("div",{ref:c,"cmdk-list-sizer":""},n))})),_t=a.forwardRef(((e,t)=>{let{open:n,onOpenChange:r,container:o,...c}=e;return a.createElement(st,{open:n,onOpenChange:r},a.createElement(dt,{container:o},a.createElement(ft,{"cmdk-overlay":""}),a.createElement(mt,{"aria-label":e.label,"cmdk-dialog":""},a.createElement(Rt,{ref:t,...c}))))})),Pt=a.forwardRef(((e,t)=>{let n=a.useRef(!0),r=$t((e=>0===e.filtered.count));return a.useEffect((()=>{n.current=!1}),[]),n.current||!r?null:a.createElement("div",{ref:t,...e,"cmdk-empty":"",role:"presentation"})})),It=a.forwardRef(((e,t)=>{let{progress:n,children:r,...o}=e;return a.createElement("div",{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Loading..."},a.createElement("div",{"aria-hidden":!0},r))})),Tt=Object.assign(Rt,{List:Mt,Item:Lt,Input:Nt,Group:At,Separator:Dt,Dialog:_t,Empty:Pt,Loading:It});function Ft(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function jt(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Wt(e){let t=a.useRef(e);return Ut((()=>{t.current=e})),t}var Ut=typeof window>"u"?a.useEffect:a.useLayoutEffect;function Bt(e){let t=a.useRef();return void 0===t.current&&(t.current=e()),t}function Kt(e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}function $t(e){let t=Ot(),n=()=>e(t.snapshot());return a.useSyncExternalStore(t.subscribe,n,n)}function qt(e,t,n){let r=a.useRef(),o=St();return Ut((()=>{var a;let c=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim().toLowerCase();if("object"==typeof t&&"current"in t&&t.current)return null==(e=t.current.textContent)?void 0:e.trim().toLowerCase()}})();o.value(e,c),null==(a=t.current)||a.setAttribute(yt,c),r.current=c})),r}var zt=()=>{let[e,t]=a.useState(),n=Bt((()=>new Map));return Ut((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,r)=>{n.current.set(e,r),t({})}},Gt={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},Ht=n(5755),Vt=n.n(Ht);const Xt=window.wp.data,Yt=window.wp.element,Zt=window.wp.i18n,Jt=window.wp.components,Qt=window.wp.keyboardShortcuts;const en=(0,Yt.forwardRef)((function({icon:e,size:t=24,...n},r){return(0,Yt.cloneElement)(e,{width:t,height:t,...n,ref:r})})),tn=window.wp.primitives,nn=(0,a.createElement)(tn.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(tn.Path,{d:"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"}));const rn=(0,Xt.combineReducers)({commands:function(e={},t){switch(t.type){case"REGISTER_COMMAND":return{...e,[t.name]:{name:t.name,label:t.label,searchLabel:t.searchLabel,context:t.context,callback:t.callback,icon:t.icon}};case"UNREGISTER_COMMAND":{const{[t.name]:n,...r}=e;return r}}return e},commandLoaders:function(e={},t){switch(t.type){case"REGISTER_COMMAND_LOADER":return{...e,[t.name]:{name:t.name,context:t.context,hook:t.hook}};case"UNREGISTER_COMMAND_LOADER":{const{[t.name]:n,...r}=e;return r}}return e},isOpen:function(e=!1,t){switch(t.type){case"OPEN":return!0;case"CLOSE":return!1}return e},context:function(e="root",t){return"SET_CONTEXT"===t.type?t.context:e}});function on(e){return{type:"REGISTER_COMMAND",...e}}function an(e){return{type:"UNREGISTER_COMMAND",name:e}}function cn(e){return{type:"REGISTER_COMMAND_LOADER",...e}}function un(e){return{type:"UNREGISTER_COMMAND_LOADER",name:e}}function ln(){return{type:"OPEN"}}function sn(){return{type:"CLOSE"}}var dn={};function fn(e){return[e]}function mn(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function pn(e,t){var n,r=t||fn;function o(){n=new WeakMap}function a(){var t,o,a,c,u,i=arguments.length;for(c=new Array(i),a=0;a<i;a++)c[a]=arguments[a];for(t=function(e){var t,r,o,a,c,u=n,i=!0;for(t=0;t<e.length;t++){if(!(c=r=e[t])||"object"!=typeof c){i=!1;break}u.has(r)?u=u.get(r):(o=new WeakMap,u.set(r,o),u=o)}return u.has(dn)||((a=function(){var e={clear:function(){e.head=null}};return e}()).isUniqueByDependants=i,u.set(dn,a)),u.get(dn)}(u=r.apply(null,c)),t.isUniqueByDependants||(t.lastDependants&&!mn(u,t.lastDependants,0)&&t.clear(),t.lastDependants=u),o=t.head;o;){if(mn(o.args,c,1))return o!==t.head&&(o.prev.next=o.next,o.next&&(o.next.prev=o.prev),o.next=t.head,o.prev=null,t.head.prev=o,t.head=o),o.val;o=o.next}return o={val:e.apply(null,c)},c[0]=null,o.args=c,t.head&&(t.head.prev=o,o.next=t.head),t.head=o,o.val}return a.getDependants=r,a.clear=o,o(),a}const vn=pn(((e,t=!1)=>Object.values(e.commands).filter((n=>{const r=n.context&&n.context===e.context;return t?r:!r}))),(e=>[e.commands,e.context])),hn=pn(((e,t=!1)=>Object.values(e.commandLoaders).filter((n=>{const r=n.context&&n.context===e.context;return t?r:!r}))),(e=>[e.commandLoaders,e.context]));function gn(e){return e.isOpen}function En(e){return e.context}function bn(e){return{type:"SET_CONTEXT",context:e}}const yn=window.wp.privateApis,{lock:wn,unlock:Cn}=(0,yn.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.","@wordpress/commands"),Sn=(0,Xt.createReduxStore)("core/commands",{reducer:rn,actions:e,selectors:t});(0,Xt.register)(Sn),Cn(Sn).registerPrivateActions(o);const xn=(0,Zt.__)("Search for commands");function On({name:e,search:t,hook:n,setLoader:r,close:o}){var c;const{isLoading:u,commands:i=[]}=null!==(c=n({search:t}))&&void 0!==c?c:{};return(0,Yt.useEffect)((()=>{r(e,u)}),[r,e,u]),i.length?(0,a.createElement)(a.Fragment,null,i.map((e=>{var n;return(0,a.createElement)(Tt.Item,{key:e.name,value:null!==(n=e.searchLabel)&&void 0!==n?n:e.label,onSelect:()=>e.callback({close:o}),id:e.name},(0,a.createElement)(Jt.__experimentalHStack,{alignment:"left",className:Vt()("commands-command-menu__item",{"has-icon":e.icon})},e.icon&&(0,a.createElement)(en,{icon:e.icon}),(0,a.createElement)("span",null,(0,a.createElement)(Jt.TextHighlight,{text:e.label,highlight:t}))))}))):null}function kn({hook:e,search:t,setLoader:n,close:r}){const o=(0,Yt.useRef)(e),[c,u]=(0,Yt.useState)(0);return(0,Yt.useEffect)((()=>{o.current!==e&&(o.current=e,u((e=>e+1)))}),[e]),(0,a.createElement)(On,{key:c,hook:o.current,search:t,setLoader:n,close:r})}function Rn({isContextual:e,search:t,setLoader:n,close:r}){const{commands:o,loaders:c}=(0,Xt.useSelect)((t=>{const{getCommands:n,getCommandLoaders:r}=t(Sn);return{commands:n(e),loaders:r(e)}}),[e]);return o.length||c.length?(0,a.createElement)(Tt.Group,null,o.map((e=>{var n;return(0,a.createElement)(Tt.Item,{key:e.name,value:null!==(n=e.searchLabel)&&void 0!==n?n:e.label,onSelect:()=>e.callback({close:r}),id:e.name},(0,a.createElement)(Jt.__experimentalHStack,{alignment:"left",className:Vt()("commands-command-menu__item",{"has-icon":e.icon})},e.icon&&(0,a.createElement)(en,{icon:e.icon}),(0,a.createElement)("span",null,(0,a.createElement)(Jt.TextHighlight,{text:e.label,highlight:t}))))})),c.map((e=>(0,a.createElement)(kn,{key:e.name,hook:e.hook,search:t,setLoader:n,close:r})))):null}function Ln({isOpen:e,search:t,setSearch:n}){const r=(0,Yt.useRef)(),o=$t((e=>e.value)),c=(0,Yt.useMemo)((()=>{const e=document.querySelector(`[cmdk-item=""][data-value="${o}"]`);return e?.getAttribute("id")}),[o]);return(0,Yt.useEffect)((()=>{e&&r.current.focus()}),[e]),(0,a.createElement)(Tt.Input,{ref:r,value:t,onValueChange:n,placeholder:xn,"aria-activedescendant":c,icon:t})}function An(){const{registerShortcut:e}=(0,Xt.useDispatch)(Qt.store),[t,n]=(0,Yt.useState)(""),r=(0,Xt.useSelect)((e=>e(Sn).isOpen()),[]),{open:o,close:c}=(0,Xt.useDispatch)(Sn),[u,i]=(0,Yt.useState)({}),l=(0,Yt.useRef)();(0,Yt.useEffect)((()=>{e({name:"core/commands",category:"global",description:(0,Zt.__)("Open the command palette."),keyCombination:{modifier:"primary",character:"k"}})}),[e]),(0,Yt.useEffect)((()=>{l.current?.removeAttribute("aria-labelledby"),l.current?.setAttribute("aria-label",(0,Zt.__)("Command suggestions"))}),[l.current]),(0,Qt.useShortcut)("core/commands",(e=>{e.defaultPrevented||(e.preventDefault(),r?c():o())}),{bindGlobal:!0});const s=(0,Yt.useCallback)(((e,t)=>i((n=>({...n,[e]:t})))),[]),d=()=>{n(""),c()};if(!r)return!1;const f=Object.values(u).some(Boolean);return(0,a.createElement)(Jt.Modal,{className:"commands-command-menu",overlayClassName:"commands-command-menu__overlay",onRequestClose:d,__experimentalHideHeader:!0,contentLabel:(0,Zt.__)("Command palette")},(0,a.createElement)("div",{className:"commands-command-menu__container"},(0,a.createElement)(Tt,{label:xn,onKeyDown:e=>{(e.nativeEvent.isComposing||229===e.keyCode)&&e.preventDefault()}},(0,a.createElement)("div",{className:"commands-command-menu__header"},(0,a.createElement)(en,{icon:nn}),(0,a.createElement)(Ln,{search:t,setSearch:n,isOpen:r})),(0,a.createElement)(Tt.List,{ref:l},t&&!f&&(0,a.createElement)(Tt.Empty,null,(0,Zt.__)("No results found.")),(0,a.createElement)(Rn,{search:t,setLoader:s,close:d,isContextual:!0}),t&&(0,a.createElement)(Rn,{search:t,setLoader:s,close:d})))))}const Dn={};function Nn(e){const{registerCommand:t,unregisterCommand:n}=(0,Xt.useDispatch)(Sn),r=(0,Yt.useRef)(e.callback);(0,Yt.useEffect)((()=>{r.current=e.callback}),[e.callback]),(0,Yt.useEffect)((()=>{if(!e.disabled)return t({name:e.name,context:e.context,label:e.label,searchLabel:e.searchLabel,icon:e.icon,callback:(...e)=>r.current(...e)}),()=>{n(e.name)}}),[e.name,e.label,e.searchLabel,e.icon,e.context,e.disabled,t,n])}function Mn(e){const{registerCommandLoader:t,unregisterCommandLoader:n}=(0,Xt.useDispatch)(Sn);(0,Yt.useEffect)((()=>{if(!e.disabled)return t({name:e.name,hook:e.hook,context:e.context}),()=>{n(e.name)}}),[e.name,e.hook,e.context,e.disabled,t,n])}wn(Dn,{useCommandContext:function(e){const{getContext:t}=(0,Xt.useSelect)(Sn),n=(0,Yt.useRef)(t()),{setContext:r}=Cn((0,Xt.useDispatch)(Sn));(0,Yt.useEffect)((()=>{r(e)}),[e,r]),(0,Yt.useEffect)((()=>{const e=n.current;return()=>r(e)}),[r])}})})(),(window.wp=window.wp||{}).commands=r})();/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 5755:
/***/ ((module, exports) => {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
var nativeCodeString = '[native code]';
function classNames() {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
if (arg.length) {
var inner = classNames.apply(null, arg);
if (inner) {
classes.push(inner);
}
}
} else if (argType === 'object') {
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
classes.push(arg.toString());
continue;
}
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if ( true && module.exports) {
classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}());
/***/ }),
/***/ 66:
/***/ ((module) => {
"use strict";
var isMergeableObject = function isMergeableObject(value) {
return isNonNullObject(value)
&& !isSpecial(value)
};
function isNonNullObject(value) {
return !!value && typeof value === 'object'
}
function isSpecial(value) {
var stringValue = Object.prototype.toString.call(value);
return stringValue === '[object RegExp]'
|| stringValue === '[object Date]'
|| isReactElement(value)
}
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
function isReactElement(value) {
return value.$$typeof === REACT_ELEMENT_TYPE
}
function emptyTarget(val) {
return Array.isArray(val) ? [] : {}
}
function cloneUnlessOtherwiseSpecified(value, options) {
return (options.clone !== false && options.isMergeableObject(value))
? deepmerge(emptyTarget(value), value, options)
: value
}
function defaultArrayMerge(target, source, options) {
return target.concat(source).map(function(element) {
return cloneUnlessOtherwiseSpecified(element, options)
})
}
function getMergeFunction(key, options) {
if (!options.customMerge) {
return deepmerge
}
var customMerge = options.customMerge(key);
return typeof customMerge === 'function' ? customMerge : deepmerge
}
function getEnumerableOwnPropertySymbols(target) {
return Object.getOwnPropertySymbols
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
return Object.propertyIsEnumerable.call(target, symbol)
})
: []
}
function getKeys(target) {
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
}
function propertyIsOnObject(object, property) {
try {
return property in object
} catch(_) {
return false
}
}
// Protects from prototype poisoning and unexpected merging up the prototype chain.
function propertyIsUnsafe(target, key) {
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
}
function mergeObject(target, source, options) {
var destination = {};
if (options.isMergeableObject(target)) {
getKeys(target).forEach(function(key) {
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
});
}
getKeys(source).forEach(function(key) {
if (propertyIsUnsafe(target, key)) {
return
}
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
} else {
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
}
});
return destination
}
function deepmerge(target, source, options) {
options = options || {};
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
// implementations can use it. The caller may not replace it.
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
var sourceIsArray = Array.isArray(source);
var targetIsArray = Array.isArray(target);
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
if (!sourceAndTargetTypesMatch) {
return cloneUnlessOtherwiseSpecified(source, options)
} else if (sourceIsArray) {
return options.arrayMerge(target, source, options)
} else {
return mergeObject(target, source, options)
}
}
deepmerge.all = function deepmergeAll(array, options) {
if (!Array.isArray(array)) {
throw new Error('first argument should be an array')
}
return array.reduce(function(prev, next) {
return deepmerge(prev, next, options)
}, {})
};
var deepmerge_1 = deepmerge;
module.exports = deepmerge_1;
/***/ }),
/***/ 1637:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var util = __webpack_require__(3062);
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;
/***/ }),
/***/ 5428:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
module.exports = __webpack_require__(1637);
/***/ }),
/***/ 3062:
/***/ ((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);
/***/ }),
/***/ 2287:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
var __webpack_unused_export__;
/** @license React v17.0.2
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131;
if("function"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x("react.element");c=x("react.portal");d=x("react.fragment");e=x("react.strict_mode");f=x("react.profiler");g=x("react.provider");h=x("react.context");k=x("react.forward_ref");l=x("react.suspense");m=x("react.suspense_list");n=x("react.memo");p=x("react.lazy");q=x("react.block");r=x("react.server.block");u=x("react.fundamental");v=x("react.debug_trace_mode");w=x("react.legacy_hidden")}
function y(a){if("object"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;__webpack_unused_export__=h;__webpack_unused_export__=z;__webpack_unused_export__=A;__webpack_unused_export__=B;__webpack_unused_export__=C;__webpack_unused_export__=D;__webpack_unused_export__=E;__webpack_unused_export__=F;__webpack_unused_export__=G;__webpack_unused_export__=H;
__webpack_unused_export__=I;__webpack_unused_export__=function(){return!1};__webpack_unused_export__=function(){return!1};__webpack_unused_export__=function(a){return y(a)===h};__webpack_unused_export__=function(a){return y(a)===g};__webpack_unused_export__=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};__webpack_unused_export__=function(a){return y(a)===k};__webpack_unused_export__=function(a){return y(a)===d};__webpack_unused_export__=function(a){return y(a)===p};__webpack_unused_export__=function(a){return y(a)===n};
__webpack_unused_export__=function(a){return y(a)===c};__webpack_unused_export__=function(a){return y(a)===f};__webpack_unused_export__=function(a){return y(a)===e};__webpack_unused_export__=function(a){return y(a)===l};__webpack_unused_export__=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||"object"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1};
__webpack_unused_export__=y;
/***/ }),
/***/ 1915:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
if (true) {
/* unused reexport */ __webpack_require__(2287);
} else {}
/***/ }),
/***/ 7734:
/***/ ((module) => {
"use strict";
// do not edit .js files directly - edit src/index.jst
var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
module.exports = function equal(a, b) {
if (a === b) return true;
if (a && b && typeof a == 'object' && typeof b == 'object') {
if (a.constructor !== b.constructor) return false;
var length, i, keys;
if (Array.isArray(a)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (!equal(a[i], b[i])) return false;
return true;
}
if ((a instanceof Map) && (b instanceof Map)) {
if (a.size !== b.size) return false;
for (i of a.entries())
if (!b.has(i[0])) return false;
for (i of a.entries())
if (!equal(i[1], b.get(i[0]))) return false;
return true;
}
if ((a instanceof Set) && (b instanceof Set)) {
if (a.size !== b.size) return false;
for (i of a.entries())
if (!b.has(i[0])) return false;
return true;
}
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (a[i] !== b[i]) return false;
return true;
}
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) return false;
for (i = length; i-- !== 0;)
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
for (i = length; i-- !== 0;) {
var key = keys[i];
if (!equal(a[key], b[key])) return false;
}
return true;
}
// true if both NaN, false otherwise
return a!==a && b!==b;
};
/***/ }),
/***/ 8924:
/***/ ((__unused_webpack_module, exports) => {
// Copyright (c) 2014 Rafael Caricio. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var GradientParser = {};
GradientParser.parse = (function() {
var tokens = {
linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,
repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,
radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,
repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
positionKeywords: /^(left|center|right|top|bottom)/i,
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
startCall: /^\(/,
endCall: /^\)/,
comma: /^,/,
hexColor: /^\#([0-9a-fA-F]+)/,
literalColor: /^([a-zA-Z]+)/,
rgbColor: /^rgb/i,
rgbaColor: /^rgba/i,
number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
};
var input = '';
function error(msg) {
var err = new Error(input + ': ' + msg);
err.source = input;
throw err;
}
function getAST() {
var ast = matchListDefinitions();
if (input.length > 0) {
error('Invalid input not EOF');
}
return ast;
}
function matchListDefinitions() {
return matchListing(matchDefinition);
}
function matchDefinition() {
return matchGradient(
'linear-gradient',
tokens.linearGradient,
matchLinearOrientation) ||
matchGradient(
'repeating-linear-gradient',
tokens.repeatingLinearGradient,
matchLinearOrientation) ||
matchGradient(
'radial-gradient',
tokens.radialGradient,
matchListRadialOrientations) ||
matchGradient(
'repeating-radial-gradient',
tokens.repeatingRadialGradient,
matchListRadialOrientations);
}
function matchGradient(gradientType, pattern, orientationMatcher) {
return matchCall(pattern, function(captures) {
var orientation = orientationMatcher();
if (orientation) {
if (!scan(tokens.comma)) {
error('Missing comma before color stops');
}
}
return {
type: gradientType,
orientation: orientation,
colorStops: matchListing(matchColorStop)
};
});
}
function matchCall(pattern, callback) {
var captures = scan(pattern);
if (captures) {
if (!scan(tokens.startCall)) {
error('Missing (');
}
result = callback(captures);
if (!scan(tokens.endCall)) {
error('Missing )');
}
return result;
}
}
function matchLinearOrientation() {
return matchSideOrCorner() ||
matchAngle();
}
function matchSideOrCorner() {
return match('directional', tokens.sideOrCorner, 1);
}
function matchAngle() {
return match('angular', tokens.angleValue, 1);
}
function matchListRadialOrientations() {
var radialOrientations,
radialOrientation = matchRadialOrientation(),
lookaheadCache;
if (radialOrientation) {
radialOrientations = [];
radialOrientations.push(radialOrientation);
lookaheadCache = input;
if (scan(tokens.comma)) {
radialOrientation = matchRadialOrientation();
if (radialOrientation) {
radialOrientations.push(radialOrientation);
} else {
input = lookaheadCache;
}
}
}
return radialOrientations;
}
function matchRadialOrientation() {
var radialType = matchCircle() ||
matchEllipse();
if (radialType) {
radialType.at = matchAtPosition();
} else {
var defaultPosition = matchPositioning();
if (defaultPosition) {
radialType = {
type: 'default-radial',
at: defaultPosition
};
}
}
return radialType;
}
function matchCircle() {
var circle = match('shape', /^(circle)/i, 0);
if (circle) {
circle.style = matchLength() || matchExtentKeyword();
}
return circle;
}
function matchEllipse() {
var ellipse = match('shape', /^(ellipse)/i, 0);
if (ellipse) {
ellipse.style = matchDistance() || matchExtentKeyword();
}
return ellipse;
}
function matchExtentKeyword() {
return match('extent-keyword', tokens.extentKeywords, 1);
}
function matchAtPosition() {
if (match('position', /^at/, 0)) {
var positioning = matchPositioning();
if (!positioning) {
error('Missing positioning value');
}
return positioning;
}
}
function matchPositioning() {
var location = matchCoordinates();
if (location.x || location.y) {
return {
type: 'position',
value: location
};
}
}
function matchCoordinates() {
return {
x: matchDistance(),
y: matchDistance()
};
}
function matchListing(matcher) {
var captures = matcher(),
result = [];
if (captures) {
result.push(captures);
while (scan(tokens.comma)) {
captures = matcher();
if (captures) {
result.push(captures);
} else {
error('One extra comma');
}
}
}
return result;
}
function matchColorStop() {
var color = matchColor();
if (!color) {
error('Expected color definition');
}
color.length = matchDistance();
return color;
}
function matchColor() {
return matchHexColor() ||
matchRGBAColor() ||
matchRGBColor() ||
matchLiteralColor();
}
function matchLiteralColor() {
return match('literal', tokens.literalColor, 0);
}
function matchHexColor() {
return match('hex', tokens.hexColor, 1);
}
function matchRGBColor() {
return matchCall(tokens.rgbColor, function() {
return {
type: 'rgb',
value: matchListing(matchNumber)
};
});
}
function matchRGBAColor() {
return matchCall(tokens.rgbaColor, function() {
return {
type: 'rgba',
value: matchListing(matchNumber)
};
});
}
function matchNumber() {
return scan(tokens.number)[1];
}
function matchDistance() {
return match('%', tokens.percentageValue, 1) ||
matchPositionKeyword() ||
matchLength();
}
function matchPositionKeyword() {
return match('position-keyword', tokens.positionKeywords, 1);
}
function matchLength() {
return match('px', tokens.pixelValue, 1) ||
match('em', tokens.emValue, 1);
}
function match(type, pattern, captureIndex) {
var captures = scan(pattern);
if (captures) {
return {
type: type,
value: captures[captureIndex]
};
}
}
function scan(regexp) {
var captures,
blankCaptures;
blankCaptures = /^[\n\r\t\s]+/.exec(input);
if (blankCaptures) {
consume(blankCaptures[0].length);
}
captures = regexp.exec(input);
if (captures) {
consume(captures[0].length);
}
return captures;
}
function consume(size) {
input = input.substr(size);
}
return function(code) {
input = code.toString();
return getAST();
};
})();
exports.parse = (GradientParser || {}).parse;
/***/ }),
/***/ 9664:
/***/ ((module) => {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __nested_webpack_require_187__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_187__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __nested_webpack_require_187__.m = modules;
/******/
/******/ // expose the module cache
/******/ __nested_webpack_require_187__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __nested_webpack_require_187__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __nested_webpack_require_187__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __nested_webpack_require_1468__) {
module.exports = __nested_webpack_require_1468__(1);
/***/ }),
/* 1 */
/***/ (function(module, exports, __nested_webpack_require_1587__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _utils = __nested_webpack_require_1587__(2);
Object.defineProperty(exports, 'combineChunks', {
enumerable: true,
get: function get() {
return _utils.combineChunks;
}
});
Object.defineProperty(exports, 'fillInChunks', {
enumerable: true,
get: function get() {
return _utils.fillInChunks;
}
});
Object.defineProperty(exports, 'findAll', {
enumerable: true,
get: function get() {
return _utils.findAll;
}
});
Object.defineProperty(exports, 'findChunks', {
enumerable: true,
get: function get() {
return _utils.findChunks;
}
});
/***/ }),
/* 2 */
/***/ (function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Creates an array of chunk objects representing both higlightable and non highlightable pieces of text that match each search word.
* @return Array of "chunks" (where a Chunk is { start:number, end:number, highlight:boolean })
*/
var findAll = exports.findAll = function findAll(_ref) {
var autoEscape = _ref.autoEscape,
_ref$caseSensitive = _ref.caseSensitive,
caseSensitive = _ref$caseSensitive === undefined ? false : _ref$caseSensitive,
_ref$findChunks = _ref.findChunks,
findChunks = _ref$findChunks === undefined ? defaultFindChunks : _ref$findChunks,
sanitize = _ref.sanitize,
searchWords = _ref.searchWords,
textToHighlight = _ref.textToHighlight;
return fillInChunks({
chunksToHighlight: combineChunks({
chunks: findChunks({
autoEscape: autoEscape,
caseSensitive: caseSensitive,
sanitize: sanitize,
searchWords: searchWords,
textToHighlight: textToHighlight
})
}),
totalLength: textToHighlight ? textToHighlight.length : 0
});
};
/**
* Takes an array of {start:number, end:number} objects and combines chunks that overlap into single chunks.
* @return {start:number, end:number}[]
*/
var combineChunks = exports.combineChunks = function combineChunks(_ref2) {
var chunks = _ref2.chunks;
chunks = chunks.sort(function (first, second) {
return first.start - second.start;
}).reduce(function (processedChunks, nextChunk) {
// First chunk just goes straight in the array...
if (processedChunks.length === 0) {
return [nextChunk];
} else {
// ... subsequent chunks get checked to see if they overlap...
var prevChunk = processedChunks.pop();
if (nextChunk.start <= prevChunk.end) {
// It may be the case that prevChunk completely surrounds nextChunk, so take the
// largest of the end indeces.
var endIndex = Math.max(prevChunk.end, nextChunk.end);
processedChunks.push({ highlight: false, start: prevChunk.start, end: endIndex });
} else {
processedChunks.push(prevChunk, nextChunk);
}
return processedChunks;
}
}, []);
return chunks;
};
/**
* Examine text for any matches.
* If we find matches, add them to the returned array as a "chunk" object ({start:number, end:number}).
* @return {start:number, end:number}[]
*/
var defaultFindChunks = function defaultFindChunks(_ref3) {
var autoEscape = _ref3.autoEscape,
caseSensitive = _ref3.caseSensitive,
_ref3$sanitize = _ref3.sanitize,
sanitize = _ref3$sanitize === undefined ? defaultSanitize : _ref3$sanitize,
searchWords = _ref3.searchWords,
textToHighlight = _ref3.textToHighlight;
textToHighlight = sanitize(textToHighlight);
return searchWords.filter(function (searchWord) {
return searchWord;
}) // Remove empty words
.reduce(function (chunks, searchWord) {
searchWord = sanitize(searchWord);
if (autoEscape) {
searchWord = escapeRegExpFn(searchWord);
}
var regex = new RegExp(searchWord, caseSensitive ? 'g' : 'gi');
var match = void 0;
while (match = regex.exec(textToHighlight)) {
var _start = match.index;
var _end = regex.lastIndex;
// We do not return zero-length matches
if (_end > _start) {
chunks.push({ highlight: false, start: _start, end: _end });
}
// Prevent browsers like Firefox from getting stuck in an infinite loop
// See http://www.regexguru.com/2008/04/watch-out-for-zero-length-matches/
if (match.index === regex.lastIndex) {
regex.lastIndex++;
}
}
return chunks;
}, []);
};
// Allow the findChunks to be overridden in findAll,
// but for backwards compatibility we export as the old name
exports.findChunks = defaultFindChunks;
/**
* Given a set of chunks to highlight, create an additional set of chunks
* to represent the bits of text between the highlighted text.
* @param chunksToHighlight {start:number, end:number}[]
* @param totalLength number
* @return {start:number, end:number, highlight:boolean}[]
*/
var fillInChunks = exports.fillInChunks = function fillInChunks(_ref4) {
var chunksToHighlight = _ref4.chunksToHighlight,
totalLength = _ref4.totalLength;
var allChunks = [];
var append = function append(start, end, highlight) {
if (end - start > 0) {
allChunks.push({
start: start,
end: end,
highlight: highlight
});
}
};
if (chunksToHighlight.length === 0) {
append(0, totalLength, false);
} else {
var lastIndex = 0;
chunksToHighlight.forEach(function (chunk) {
append(lastIndex, chunk.start, false);
append(chunk.start, chunk.end, true);
lastIndex = chunk.end;
});
append(lastIndex, totalLength, false);
}
return allChunks;
};
function defaultSanitize(string) {
return string;
}
function escapeRegExpFn(string) {
return string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
}
/***/ })
/******/ ]);
/***/ }),
/***/ 1880:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var reactIs = __webpack_require__(1178);
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
var REACT_STATICS = {
childContextTypes: true,
contextType: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
getDerivedStateFromError: true,
getDerivedStateFromProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
callee: true,
arguments: true,
arity: true
};
var FORWARD_REF_STATICS = {
'$$typeof': true,
render: true,
defaultProps: true,
displayName: true,
propTypes: true
};
var MEMO_STATICS = {
'$$typeof': true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
function getStatics(component) {
// React v16.11 and below
if (reactIs.isMemo(component)) {
return MEMO_STATICS;
} // React v16.12 and above
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = Object.prototype;
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== 'string') {
// don't hoist over string (html) components
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
}
var keys = getOwnPropertyNames(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
var targetStatics = getStatics(targetComponent);
var sourceStatics = getStatics(sourceComponent);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
try {
// Avoid failures from read-only properties
defineProperty(targetComponent, key, descriptor);
} catch (e) {}
}
}
}
return targetComponent;
}
module.exports = hoistNonReactStatics;
/***/ }),
/***/ 2950:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;
exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};
exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};
exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;
/***/ }),
/***/ 1178:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
if (true) {
module.exports = __webpack_require__(2950);
} else {}
/***/ }),
/***/ 628:
/***/ ((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__(4067);
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;
};
/***/ }),
/***/ 5826:
/***/ ((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__(628)();
}
/***/ }),
/***/ 4067:
/***/ ((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;
/***/ }),
/***/ 3394:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var f=__webpack_require__(1609),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;
/***/ }),
/***/ 4922:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
if (true) {
module.exports = __webpack_require__(3394);
} else {}
/***/ }),
/***/ 9681:
/***/ ((module) => {
var characterMap = {
"À": "A",
"Á": "A",
"Â": "A",
"Ã": "A",
"Ä": "A",
"Å": "A",
"Ấ": "A",
"Ắ": "A",
"Ẳ": "A",
"Ẵ": "A",
"Ặ": "A",
"Æ": "AE",
"Ầ": "A",
"Ằ": "A",
"Ȃ": "A",
"Ả": "A",
"Ạ": "A",
"Ẩ": "A",
"Ẫ": "A",
"Ậ": "A",
"Ç": "C",
"Ḉ": "C",
"È": "E",
"É": "E",
"Ê": "E",
"Ë": "E",
"Ế": "E",
"Ḗ": "E",
"Ề": "E",
"Ḕ": "E",
"Ḝ": "E",
"Ȇ": "E",
"Ẻ": "E",
"Ẽ": "E",
"Ẹ": "E",
"Ể": "E",
"Ễ": "E",
"Ệ": "E",
"Ì": "I",
"Í": "I",
"Î": "I",
"Ï": "I",
"Ḯ": "I",
"Ȋ": "I",
"Ỉ": "I",
"Ị": "I",
"Ð": "D",
"Ñ": "N",
"Ò": "O",
"Ó": "O",
"Ô": "O",
"Õ": "O",
"Ö": "O",
"Ø": "O",
"Ố": "O",
"Ṍ": "O",
"Ṓ": "O",
"Ȏ": "O",
"Ỏ": "O",
"Ọ": "O",
"Ổ": "O",
"Ỗ": "O",
"Ộ": "O",
"Ờ": "O",
"Ở": "O",
"Ỡ": "O",
"Ớ": "O",
"Ợ": "O",
"Ù": "U",
"Ú": "U",
"Û": "U",
"Ü": "U",
"Ủ": "U",
"Ụ": "U",
"Ử": "U",
"Ữ": "U",
"Ự": "U",
"Ý": "Y",
"à": "a",
"á": "a",
"â": "a",
"ã": "a",
"ä": "a",
"å": "a",
"ấ": "a",
"ắ": "a",
"ẳ": "a",
"ẵ": "a",
"ặ": "a",
"æ": "ae",
"ầ": "a",
"ằ": "a",
"ȃ": "a",
"ả": "a",
"ạ": "a",
"ẩ": "a",
"ẫ": "a",
"ậ": "a",
"ç": "c",
"ḉ": "c",
"è": "e",
"é": "e",
"ê": "e",
"ë": "e",
"ế": "e",
"ḗ": "e",
"ề": "e",
"ḕ": "e",
"ḝ": "e",
"ȇ": "e",
"ẻ": "e",
"ẽ": "e",
"ẹ": "e",
"ể": "e",
"ễ": "e",
"ệ": "e",
"ì": "i",
"í": "i",
"î": "i",
"ï": "i",
"ḯ": "i",
"ȋ": "i",
"ỉ": "i",
"ị": "i",
"ð": "d",
"ñ": "n",
"ò": "o",
"ó": "o",
"ô": "o",
"õ": "o",
"ö": "o",
"ø": "o",
"ố": "o",
"ṍ": "o",
"ṓ": "o",
"ȏ": "o",
"ỏ": "o",
"ọ": "o",
"ổ": "o",
"ỗ": "o",
"ộ": "o",
"ờ": "o",
"ở": "o",
"ỡ": "o",
"ớ": "o",
"ợ": "o",
"ù": "u",
"ú": "u",
"û": "u",
"ü": "u",
"ủ": "u",
"ụ": "u",
"ử": "u",
"ữ": "u",
"ự": "u",
"ý": "y",
"ÿ": "y",
"Ā": "A",
"ā": "a",
"Ă": "A",
"ă": "a",
"Ą": "A",
"ą": "a",
"Ć": "C",
"ć": "c",
"Ĉ": "C",
"ĉ": "c",
"Ċ": "C",
"ċ": "c",
"Č": "C",
"č": "c",
"C̆": "C",
"c̆": "c",
"Ď": "D",
"ď": "d",
"Đ": "D",
"đ": "d",
"Ē": "E",
"ē": "e",
"Ĕ": "E",
"ĕ": "e",
"Ė": "E",
"ė": "e",
"Ę": "E",
"ę": "e",
"Ě": "E",
"ě": "e",
"Ĝ": "G",
"Ǵ": "G",
"ĝ": "g",
"ǵ": "g",
"Ğ": "G",
"ğ": "g",
"Ġ": "G",
"ġ": "g",
"Ģ": "G",
"ģ": "g",
"Ĥ": "H",
"ĥ": "h",
"Ħ": "H",
"ħ": "h",
"Ḫ": "H",
"ḫ": "h",
"Ĩ": "I",
"ĩ": "i",
"Ī": "I",
"ī": "i",
"Ĭ": "I",
"ĭ": "i",
"Į": "I",
"į": "i",
"İ": "I",
"ı": "i",
"IJ": "IJ",
"ij": "ij",
"Ĵ": "J",
"ĵ": "j",
"Ķ": "K",
"ķ": "k",
"Ḱ": "K",
"ḱ": "k",
"K̆": "K",
"k̆": "k",
"Ĺ": "L",
"ĺ": "l",
"Ļ": "L",
"ļ": "l",
"Ľ": "L",
"ľ": "l",
"Ŀ": "L",
"ŀ": "l",
"Ł": "l",
"ł": "l",
"Ḿ": "M",
"ḿ": "m",
"M̆": "M",
"m̆": "m",
"Ń": "N",
"ń": "n",
"Ņ": "N",
"ņ": "n",
"Ň": "N",
"ň": "n",
"ʼn": "n",
"N̆": "N",
"n̆": "n",
"Ō": "O",
"ō": "o",
"Ŏ": "O",
"ŏ": "o",
"Ő": "O",
"ő": "o",
"Œ": "OE",
"œ": "oe",
"P̆": "P",
"p̆": "p",
"Ŕ": "R",
"ŕ": "r",
"Ŗ": "R",
"ŗ": "r",
"Ř": "R",
"ř": "r",
"R̆": "R",
"r̆": "r",
"Ȓ": "R",
"ȓ": "r",
"Ś": "S",
"ś": "s",
"Ŝ": "S",
"ŝ": "s",
"Ş": "S",
"Ș": "S",
"ș": "s",
"ş": "s",
"Š": "S",
"š": "s",
"Ţ": "T",
"ţ": "t",
"ț": "t",
"Ț": "T",
"Ť": "T",
"ť": "t",
"Ŧ": "T",
"ŧ": "t",
"T̆": "T",
"t̆": "t",
"Ũ": "U",
"ũ": "u",
"Ū": "U",
"ū": "u",
"Ŭ": "U",
"ŭ": "u",
"Ů": "U",
"ů": "u",
"Ű": "U",
"ű": "u",
"Ų": "U",
"ų": "u",
"Ȗ": "U",
"ȗ": "u",
"V̆": "V",
"v̆": "v",
"Ŵ": "W",
"ŵ": "w",
"Ẃ": "W",
"ẃ": "w",
"X̆": "X",
"x̆": "x",
"Ŷ": "Y",
"ŷ": "y",
"Ÿ": "Y",
"Y̆": "Y",
"y̆": "y",
"Ź": "Z",
"ź": "z",
"Ż": "Z",
"ż": "z",
"Ž": "Z",
"ž": "z",
"ſ": "s",
"ƒ": "f",
"Ơ": "O",
"ơ": "o",
"Ư": "U",
"ư": "u",
"Ǎ": "A",
"ǎ": "a",
"Ǐ": "I",
"ǐ": "i",
"Ǒ": "O",
"ǒ": "o",
"Ǔ": "U",
"ǔ": "u",
"Ǖ": "U",
"ǖ": "u",
"Ǘ": "U",
"ǘ": "u",
"Ǚ": "U",
"ǚ": "u",
"Ǜ": "U",
"ǜ": "u",
"Ứ": "U",
"ứ": "u",
"Ṹ": "U",
"ṹ": "u",
"Ǻ": "A",
"ǻ": "a",
"Ǽ": "AE",
"ǽ": "ae",
"Ǿ": "O",
"ǿ": "o",
"Þ": "TH",
"þ": "th",
"Ṕ": "P",
"ṕ": "p",
"Ṥ": "S",
"ṥ": "s",
"X́": "X",
"x́": "x",
"Ѓ": "Г",
"ѓ": "г",
"Ќ": "К",
"ќ": "к",
"A̋": "A",
"a̋": "a",
"E̋": "E",
"e̋": "e",
"I̋": "I",
"i̋": "i",
"Ǹ": "N",
"ǹ": "n",
"Ồ": "O",
"ồ": "o",
"Ṑ": "O",
"ṑ": "o",
"Ừ": "U",
"ừ": "u",
"Ẁ": "W",
"ẁ": "w",
"Ỳ": "Y",
"ỳ": "y",
"Ȁ": "A",
"ȁ": "a",
"Ȅ": "E",
"ȅ": "e",
"Ȉ": "I",
"ȉ": "i",
"Ȍ": "O",
"ȍ": "o",
"Ȑ": "R",
"ȑ": "r",
"Ȕ": "U",
"ȕ": "u",
"B̌": "B",
"b̌": "b",
"Č̣": "C",
"č̣": "c",
"Ê̌": "E",
"ê̌": "e",
"F̌": "F",
"f̌": "f",
"Ǧ": "G",
"ǧ": "g",
"Ȟ": "H",
"ȟ": "h",
"J̌": "J",
"ǰ": "j",
"Ǩ": "K",
"ǩ": "k",
"M̌": "M",
"m̌": "m",
"P̌": "P",
"p̌": "p",
"Q̌": "Q",
"q̌": "q",
"Ř̩": "R",
"ř̩": "r",
"Ṧ": "S",
"ṧ": "s",
"V̌": "V",
"v̌": "v",
"W̌": "W",
"w̌": "w",
"X̌": "X",
"x̌": "x",
"Y̌": "Y",
"y̌": "y",
"A̧": "A",
"a̧": "a",
"B̧": "B",
"b̧": "b",
"Ḑ": "D",
"ḑ": "d",
"Ȩ": "E",
"ȩ": "e",
"Ɛ̧": "E",
"ɛ̧": "e",
"Ḩ": "H",
"ḩ": "h",
"I̧": "I",
"i̧": "i",
"Ɨ̧": "I",
"ɨ̧": "i",
"M̧": "M",
"m̧": "m",
"O̧": "O",
"o̧": "o",
"Q̧": "Q",
"q̧": "q",
"U̧": "U",
"u̧": "u",
"X̧": "X",
"x̧": "x",
"Z̧": "Z",
"z̧": "z",
"й":"и",
"Й":"И",
"ё":"е",
"Ё":"Е",
};
var chars = Object.keys(characterMap).join('|');
var allAccents = new RegExp(chars, 'g');
var firstAccent = new RegExp(chars, '');
function matcher(match) {
return characterMap[match];
}
var removeAccents = function(string) {
return string.replace(allAccents, matcher);
};
var hasAccents = function(string) {
return !!string.match(firstAccent);
};
module.exports = removeAccents;
module.exports.has = hasAccents;
module.exports.remove = removeAccents;
/***/ }),
/***/ 8477:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/**
* @license React
* use-sync-external-store-shim.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var e=__webpack_require__(1609);function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k="function"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}
function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;
/***/ }),
/***/ 422:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
if (true) {
module.exports = __webpack_require__(8477);
} else {}
/***/ }),
/***/ 1609:
/***/ ((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](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/create fake namespace object */
/******/ (() => {
/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
/******/ var leafPrototypes;
/******/ // 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 & 16: return value when it's Promise-like
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = this(value);
/******/ if(mode & 8) return value;
/******/ if(typeof value === 'object' && value) {
/******/ if((mode & 4) && value.__esModule) return value;
/******/ if((mode & 16) && typeof value.then === 'function') return value;
/******/ }
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ var def = {};
/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
/******/ }
/******/ def['default'] = () => (value);
/******/ __webpack_require__.d(ns, def);
/******/ return ns;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (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 */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/nonce */
/******/ (() => {
/******/ __webpack_require__.nc = undefined;
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
AnglePickerControl: () => (/* reexport */ angle_picker_control),
Animate: () => (/* reexport */ animate),
Autocomplete: () => (/* reexport */ Autocomplete),
BaseControl: () => (/* reexport */ base_control),
BlockQuotation: () => (/* reexport */ external_wp_primitives_namespaceObject.BlockQuotation),
Button: () => (/* reexport */ build_module_button),
ButtonGroup: () => (/* reexport */ button_group),
Card: () => (/* reexport */ card_component),
CardBody: () => (/* reexport */ card_body_component),
CardDivider: () => (/* reexport */ card_divider_component),
CardFooter: () => (/* reexport */ card_footer_component),
CardHeader: () => (/* reexport */ card_header_component),
CardMedia: () => (/* reexport */ card_media_component),
CheckboxControl: () => (/* reexport */ checkbox_control),
Circle: () => (/* reexport */ external_wp_primitives_namespaceObject.Circle),
ClipboardButton: () => (/* reexport */ ClipboardButton),
ColorIndicator: () => (/* reexport */ color_indicator),
ColorPalette: () => (/* reexport */ color_palette),
ColorPicker: () => (/* reexport */ LegacyAdapter),
ComboboxControl: () => (/* reexport */ combobox_control),
CustomGradientPicker: () => (/* reexport */ custom_gradient_picker),
CustomSelectControl: () => (/* reexport */ StableCustomSelectControl),
Dashicon: () => (/* reexport */ dashicon),
DatePicker: () => (/* reexport */ date),
DateTimePicker: () => (/* reexport */ build_module_date_time),
Disabled: () => (/* reexport */ disabled),
Draggable: () => (/* reexport */ draggable),
DropZone: () => (/* reexport */ drop_zone),
DropZoneProvider: () => (/* reexport */ DropZoneProvider),
Dropdown: () => (/* reexport */ dropdown),
DropdownMenu: () => (/* reexport */ dropdown_menu),
DuotonePicker: () => (/* reexport */ duotone_picker),
DuotoneSwatch: () => (/* reexport */ duotone_swatch),
ExternalLink: () => (/* reexport */ external_link),
Fill: () => (/* reexport */ slot_fill_Fill),
Flex: () => (/* reexport */ flex_component),
FlexBlock: () => (/* reexport */ flex_block_component),
FlexItem: () => (/* reexport */ flex_item_component),
FocalPointPicker: () => (/* reexport */ focal_point_picker),
FocusReturnProvider: () => (/* reexport */ with_focus_return_Provider),
FocusableIframe: () => (/* reexport */ FocusableIframe),
FontSizePicker: () => (/* reexport */ font_size_picker),
FormFileUpload: () => (/* reexport */ form_file_upload),
FormToggle: () => (/* reexport */ form_toggle),
FormTokenField: () => (/* reexport */ form_token_field),
G: () => (/* reexport */ external_wp_primitives_namespaceObject.G),
GradientPicker: () => (/* reexport */ gradient_picker),
Guide: () => (/* reexport */ guide),
GuidePage: () => (/* reexport */ GuidePage),
HorizontalRule: () => (/* reexport */ external_wp_primitives_namespaceObject.HorizontalRule),
Icon: () => (/* reexport */ build_module_icon),
IconButton: () => (/* reexport */ deprecated),
IsolatedEventContainer: () => (/* reexport */ isolated_event_container),
KeyboardShortcuts: () => (/* reexport */ keyboard_shortcuts),
Line: () => (/* reexport */ external_wp_primitives_namespaceObject.Line),
MenuGroup: () => (/* reexport */ menu_group),
MenuItem: () => (/* reexport */ menu_item),
MenuItemsChoice: () => (/* reexport */ menu_items_choice),
Modal: () => (/* reexport */ modal),
NavigableMenu: () => (/* reexport */ navigable_container_menu),
Notice: () => (/* reexport */ build_module_notice),
NoticeList: () => (/* reexport */ list),
Panel: () => (/* reexport */ panel),
PanelBody: () => (/* reexport */ body),
PanelHeader: () => (/* reexport */ panel_header),
PanelRow: () => (/* reexport */ row),
Path: () => (/* reexport */ external_wp_primitives_namespaceObject.Path),
Placeholder: () => (/* reexport */ placeholder),
Polygon: () => (/* reexport */ external_wp_primitives_namespaceObject.Polygon),
Popover: () => (/* reexport */ popover),
QueryControls: () => (/* reexport */ query_controls),
RadioControl: () => (/* reexport */ radio_control),
RangeControl: () => (/* reexport */ range_control),
Rect: () => (/* reexport */ external_wp_primitives_namespaceObject.Rect),
ResizableBox: () => (/* reexport */ resizable_box),
ResponsiveWrapper: () => (/* reexport */ responsive_wrapper),
SVG: () => (/* reexport */ external_wp_primitives_namespaceObject.SVG),
SandBox: () => (/* reexport */ sandbox),
ScrollLock: () => (/* reexport */ scroll_lock),
SearchControl: () => (/* reexport */ search_control),
SelectControl: () => (/* reexport */ select_control),
Slot: () => (/* reexport */ slot_fill_Slot),
SlotFillProvider: () => (/* reexport */ Provider),
Snackbar: () => (/* reexport */ snackbar),
SnackbarList: () => (/* reexport */ snackbar_list),
Spinner: () => (/* reexport */ spinner),
TabPanel: () => (/* reexport */ tab_panel),
TabbableContainer: () => (/* reexport */ tabbable),
TextControl: () => (/* reexport */ text_control),
TextHighlight: () => (/* reexport */ text_highlight),
TextareaControl: () => (/* reexport */ textarea_control),
TimePicker: () => (/* reexport */ time),
Tip: () => (/* reexport */ build_module_tip),
ToggleControl: () => (/* reexport */ toggle_control),
Toolbar: () => (/* reexport */ toolbar),
ToolbarButton: () => (/* reexport */ toolbar_button),
ToolbarDropdownMenu: () => (/* reexport */ toolbar_dropdown_menu),
ToolbarGroup: () => (/* reexport */ toolbar_group),
ToolbarItem: () => (/* reexport */ toolbar_item),
Tooltip: () => (/* reexport */ tooltip),
TreeSelect: () => (/* reexport */ tree_select),
VisuallyHidden: () => (/* reexport */ visually_hidden_component),
__experimentalAlignmentMatrixControl: () => (/* reexport */ alignment_matrix_control),
__experimentalApplyValueToSides: () => (/* reexport */ applyValueToSides),
__experimentalBorderBoxControl: () => (/* reexport */ border_box_control_component),
__experimentalBorderControl: () => (/* reexport */ border_control_component),
__experimentalBoxControl: () => (/* reexport */ box_control),
__experimentalConfirmDialog: () => (/* reexport */ confirm_dialog_component),
__experimentalDimensionControl: () => (/* reexport */ dimension_control),
__experimentalDivider: () => (/* reexport */ divider_component),
__experimentalDropdownContentWrapper: () => (/* reexport */ dropdown_content_wrapper),
__experimentalElevation: () => (/* reexport */ elevation_component),
__experimentalGrid: () => (/* reexport */ grid_component),
__experimentalHStack: () => (/* reexport */ h_stack_component),
__experimentalHasSplitBorders: () => (/* reexport */ hasSplitBorders),
__experimentalHeading: () => (/* reexport */ heading_component),
__experimentalInputControl: () => (/* reexport */ input_control),
__experimentalInputControlPrefixWrapper: () => (/* reexport */ input_prefix_wrapper),
__experimentalInputControlSuffixWrapper: () => (/* reexport */ input_suffix_wrapper),
__experimentalIsDefinedBorder: () => (/* reexport */ isDefinedBorder),
__experimentalIsEmptyBorder: () => (/* reexport */ isEmptyBorder),
__experimentalItem: () => (/* reexport */ item_component),
__experimentalItemGroup: () => (/* reexport */ item_group_component),
__experimentalNavigation: () => (/* reexport */ navigation),
__experimentalNavigationBackButton: () => (/* reexport */ back_button),
__experimentalNavigationGroup: () => (/* reexport */ group),
__experimentalNavigationItem: () => (/* reexport */ navigation_item),
__experimentalNavigationMenu: () => (/* reexport */ navigation_menu),
__experimentalNavigatorBackButton: () => (/* reexport */ navigator_back_button_component),
__experimentalNavigatorButton: () => (/* reexport */ navigator_button_component),
__experimentalNavigatorProvider: () => (/* reexport */ navigator_provider_component),
__experimentalNavigatorScreen: () => (/* reexport */ navigator_screen_component),
__experimentalNavigatorToParentButton: () => (/* reexport */ navigator_to_parent_button_component),
__experimentalNumberControl: () => (/* reexport */ number_control),
__experimentalPaletteEdit: () => (/* reexport */ palette_edit),
__experimentalParseQuantityAndUnitFromRawValue: () => (/* reexport */ parseQuantityAndUnitFromRawValue),
__experimentalRadio: () => (/* reexport */ radio_group_radio),
__experimentalRadioGroup: () => (/* reexport */ radio_group),
__experimentalScrollable: () => (/* reexport */ scrollable_component),
__experimentalSpacer: () => (/* reexport */ spacer_component),
__experimentalStyleProvider: () => (/* reexport */ style_provider),
__experimentalSurface: () => (/* reexport */ surface_component),
__experimentalText: () => (/* reexport */ text_component),
__experimentalToggleGroupControl: () => (/* reexport */ toggle_group_control_component),
__experimentalToggleGroupControlOption: () => (/* reexport */ toggle_group_control_option_component),
__experimentalToggleGroupControlOptionIcon: () => (/* reexport */ toggle_group_control_option_icon_component),
__experimentalToolbarContext: () => (/* reexport */ toolbar_context),
__experimentalToolsPanel: () => (/* reexport */ tools_panel_component),
__experimentalToolsPanelContext: () => (/* reexport */ ToolsPanelContext),
__experimentalToolsPanelItem: () => (/* reexport */ tools_panel_item_component),
__experimentalTreeGrid: () => (/* reexport */ tree_grid),
__experimentalTreeGridCell: () => (/* reexport */ cell),
__experimentalTreeGridItem: () => (/* reexport */ tree_grid_item),
__experimentalTreeGridRow: () => (/* reexport */ tree_grid_row),
__experimentalTruncate: () => (/* reexport */ truncate_component),
__experimentalUnitControl: () => (/* reexport */ unit_control),
__experimentalUseCustomUnits: () => (/* reexport */ useCustomUnits),
__experimentalUseNavigator: () => (/* reexport */ use_navigator),
__experimentalUseSlot: () => (/* reexport */ useSlot),
__experimentalUseSlotFills: () => (/* reexport */ useSlotFills),
__experimentalVStack: () => (/* reexport */ v_stack_component),
__experimentalView: () => (/* reexport */ component),
__experimentalZStack: () => (/* reexport */ z_stack_component),
__unstableAnimatePresence: () => (/* reexport */ AnimatePresence),
__unstableComposite: () => (/* reexport */ legacy_Composite),
__unstableCompositeGroup: () => (/* reexport */ legacy_CompositeGroup),
__unstableCompositeItem: () => (/* reexport */ legacy_CompositeItem),
__unstableDisclosureContent: () => (/* reexport */ disclosure_DisclosureContent),
__unstableGetAnimateClassName: () => (/* reexport */ getAnimateClassName),
__unstableMotion: () => (/* reexport */ motion),
__unstableMotionContext: () => (/* reexport */ MotionContext),
__unstableUseAutocompleteProps: () => (/* reexport */ useAutocompleteProps),
__unstableUseCompositeState: () => (/* reexport */ useCompositeState),
__unstableUseNavigateRegions: () => (/* reexport */ useNavigateRegions),
createSlotFill: () => (/* reexport */ createSlotFill),
navigateRegions: () => (/* reexport */ navigate_regions),
privateApis: () => (/* reexport */ privateApis),
useBaseControlProps: () => (/* reexport */ useBaseControlProps),
withConstrainedTabbing: () => (/* reexport */ with_constrained_tabbing),
withFallbackStyles: () => (/* reexport */ with_fallback_styles),
withFilters: () => (/* reexport */ withFilters),
withFocusOutside: () => (/* reexport */ with_focus_outside),
withFocusReturn: () => (/* reexport */ with_focus_return),
withNotices: () => (/* reexport */ with_notices),
withSpokenMessages: () => (/* reexport */ with_spoken_messages)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/components/build-module/text/styles.js
var text_styles_namespaceObject = {};
__webpack_require__.r(text_styles_namespaceObject);
__webpack_require__.d(text_styles_namespaceObject, {
Text: () => (Text),
block: () => (styles_block),
destructive: () => (destructive),
highlighterText: () => (highlighterText),
muted: () => (muted),
positive: () => (positive),
upperCase: () => (upperCase)
});
// NAMESPACE OBJECT: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/styles.js
var toggle_group_control_option_base_styles_namespaceObject = {};
__webpack_require__.r(toggle_group_control_option_base_styles_namespaceObject);
__webpack_require__.d(toggle_group_control_option_base_styles_namespaceObject, {
ButtonContentView: () => (ButtonContentView),
LabelView: () => (LabelView),
ou: () => (backdropView),
uG: () => (buttonView),
eh: () => (labelBlock)
});
;// CONCATENATED MODULE: external ["wp","primitives"]
const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
// EXTERNAL MODULE: external "React"
var external_React_ = __webpack_require__(1609);
var external_React_namespaceObject = /*#__PURE__*/__webpack_require__.t(external_React_, 2);
var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_);
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__(5755);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// CONCATENATED MODULE: external ["wp","compose"]
const external_wp_compose_namespaceObject = window["wp"]["compose"];
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/SHA3WOPI.js
"use client";
// src/focusable/focusable-context.ts
var FocusableContext = (0,external_React_.createContext)(true);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/4R3V3JGP.js
"use client";
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var _4R3V3JGP_spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var _4R3V3JGP_spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/4R3V3JGP.js
"use client";
var _4R3V3JGP_defProp = Object.defineProperty;
var _4R3V3JGP_defProps = Object.defineProperties;
var _4R3V3JGP_getOwnPropDescs = Object.getOwnPropertyDescriptors;
var _4R3V3JGP_getOwnPropSymbols = Object.getOwnPropertySymbols;
var _4R3V3JGP_hasOwnProp = Object.prototype.hasOwnProperty;
var _4R3V3JGP_propIsEnum = Object.prototype.propertyIsEnumerable;
var _4R3V3JGP_defNormalProp = (obj, key, value) => key in obj ? _4R3V3JGP_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var _chunks_4R3V3JGP_spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (_4R3V3JGP_hasOwnProp.call(b, prop))
_4R3V3JGP_defNormalProp(a, prop, b[prop]);
if (_4R3V3JGP_getOwnPropSymbols)
for (var prop of _4R3V3JGP_getOwnPropSymbols(b)) {
if (_4R3V3JGP_propIsEnum.call(b, prop))
_4R3V3JGP_defNormalProp(a, prop, b[prop]);
}
return a;
};
var _chunks_4R3V3JGP_spreadProps = (a, b) => _4R3V3JGP_defProps(a, _4R3V3JGP_getOwnPropDescs(b));
var _4R3V3JGP_objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (_4R3V3JGP_hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && _4R3V3JGP_getOwnPropSymbols)
for (var prop of _4R3V3JGP_getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && _4R3V3JGP_propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/Y3OOHFCN.js
"use client";
// src/utils/misc.ts
function noop(..._) {
}
function shallowEqual(a, b) {
if (a === b)
return true;
if (!a)
return false;
if (!b)
return false;
if (typeof a !== "object")
return false;
if (typeof b !== "object")
return false;
const aKeys = Object.keys(a);
const bKeys = Object.keys(b);
const { length } = aKeys;
if (bKeys.length !== length)
return false;
for (const key of aKeys) {
if (a[key] !== b[key]) {
return false;
}
}
return true;
}
function Y3OOHFCN_applyState(argument, currentValue) {
if (isUpdater(argument)) {
const value = isLazyValue(currentValue) ? currentValue() : currentValue;
return argument(value);
}
return argument;
}
function isUpdater(argument) {
return typeof argument === "function";
}
function isLazyValue(value) {
return typeof value === "function";
}
function isObject(arg) {
return typeof arg === "object" && arg != null;
}
function isEmpty(arg) {
if (Array.isArray(arg))
return !arg.length;
if (isObject(arg))
return !Object.keys(arg).length;
if (arg == null)
return true;
if (arg === "")
return true;
return false;
}
function isInteger(arg) {
if (typeof arg === "number") {
return Math.floor(arg) === arg;
}
return String(Math.floor(Number(arg))) === arg;
}
function Y3OOHFCN_hasOwnProperty(object, prop) {
if (typeof Object.hasOwn === "function") {
return Object.hasOwn(object, prop);
}
return Object.prototype.hasOwnProperty.call(object, prop);
}
function chain(...fns) {
return (...args) => {
for (const fn of fns) {
if (typeof fn === "function") {
fn(...args);
}
}
};
}
function cx(...args) {
return args.filter(Boolean).join(" ") || void 0;
}
function normalizeString(str) {
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
}
function omit(object, keys) {
const result = _chunks_4R3V3JGP_spreadValues({}, object);
for (const key of keys) {
if (Y3OOHFCN_hasOwnProperty(result, key)) {
delete result[key];
}
}
return result;
}
function pick(object, paths) {
const result = {};
for (const key of paths) {
if (Y3OOHFCN_hasOwnProperty(object, key)) {
result[key] = object[key];
}
}
return result;
}
function identity(value) {
return value;
}
function beforePaint(cb = noop) {
const raf = requestAnimationFrame(cb);
return () => cancelAnimationFrame(raf);
}
function afterPaint(cb = noop) {
let raf = requestAnimationFrame(() => {
raf = requestAnimationFrame(cb);
});
return () => cancelAnimationFrame(raf);
}
function invariant(condition, message) {
if (condition)
return;
if (typeof message !== "string")
throw new Error("Invariant failed");
throw new Error(message);
}
function getKeys(obj) {
return Object.keys(obj);
}
function isFalsyBooleanCallback(booleanOrCallback, ...args) {
const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback;
if (result == null)
return false;
return !result;
}
function disabledFromProps(props) {
return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
}
function defaultValue(...values) {
for (const value of values) {
if (value !== void 0)
return value;
}
return void 0;
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/XM66DUTO.js
"use client";
// src/utils/misc.ts
function setRef(ref, value) {
if (typeof ref === "function") {
ref(value);
} else if (ref) {
ref.current = value;
}
}
function isValidElementWithRef(element) {
if (!element)
return false;
if (!(0,external_React_.isValidElement)(element))
return false;
if (!("ref" in element))
return false;
return true;
}
function getRefProperty(element) {
if (!isValidElementWithRef(element))
return null;
return element.ref;
}
function mergeProps(base, overrides) {
const props = _4R3V3JGP_spreadValues({}, base);
for (const key in overrides) {
if (!Y3OOHFCN_hasOwnProperty(overrides, key))
continue;
if (key === "className") {
const prop = "className";
props[prop] = base[prop] ? `${base[prop]} ${overrides[prop]}` : overrides[prop];
continue;
}
if (key === "style") {
const prop = "style";
props[prop] = base[prop] ? _4R3V3JGP_spreadValues(_4R3V3JGP_spreadValues({}, base[prop]), overrides[prop]) : overrides[prop];
continue;
}
const overrideValue = overrides[key];
if (typeof overrideValue === "function" && key.startsWith("on")) {
const baseValue = base[key];
if (typeof baseValue === "function") {
props[key] = (...args) => {
overrideValue(...args);
baseValue(...args);
};
continue;
}
}
props[key] = overrideValue;
}
return props;
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/DLOEKDPY.js
"use client";
// src/utils/dom.ts
var canUseDOM = checkIsBrowser();
function checkIsBrowser() {
var _a;
return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
}
function DLOEKDPY_getDocument(node) {
return node ? node.ownerDocument || node : document;
}
function getWindow(node) {
return DLOEKDPY_getDocument(node).defaultView || window;
}
function getActiveElement(node, activeDescendant = false) {
const { activeElement } = DLOEKDPY_getDocument(node);
if (!(activeElement == null ? void 0 : activeElement.nodeName)) {
return null;
}
if (isFrame(activeElement) && activeElement.contentDocument) {
return getActiveElement(
activeElement.contentDocument.body,
activeDescendant
);
}
if (activeDescendant) {
const id = activeElement.getAttribute("aria-activedescendant");
if (id) {
const element = DLOEKDPY_getDocument(activeElement).getElementById(id);
if (element) {
return element;
}
}
}
return activeElement;
}
function contains(parent, child) {
return parent === child || parent.contains(child);
}
function isFrame(element) {
return element.tagName === "IFRAME";
}
function isButton(element) {
const tagName = element.tagName.toLowerCase();
if (tagName === "button")
return true;
if (tagName === "input" && element.type) {
return buttonInputTypes.indexOf(element.type) !== -1;
}
return false;
}
var buttonInputTypes = [
"button",
"color",
"file",
"image",
"reset",
"submit"
];
function matches(element, selectors) {
if ("matches" in element) {
return element.matches(selectors);
}
if ("msMatchesSelector" in element) {
return element.msMatchesSelector(selectors);
}
return element.webkitMatchesSelector(selectors);
}
function isVisible(element) {
const htmlElement = element;
return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
}
function DLOEKDPY_closest(element, selectors) {
if ("closest" in element)
return element.closest(selectors);
do {
if (matches(element, selectors))
return element;
element = element.parentElement || element.parentNode;
} while (element !== null && element.nodeType === 1);
return null;
}
function DLOEKDPY_isTextField(element) {
try {
const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
const isTextArea = element.tagName === "TEXTAREA";
return isTextInput || isTextArea || false;
} catch (error) {
return false;
}
}
function getPopupRole(element, fallback) {
const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"];
const role = element == null ? void 0 : element.getAttribute("role");
if (role && allowedPopupRoles.indexOf(role) !== -1) {
return role;
}
return fallback;
}
function getPopupItemRole(element, fallback) {
var _a;
const itemRoleByPopupRole = {
menu: "menuitem",
listbox: "option",
tree: "treeitem",
grid: "gridcell"
};
const popupRole = getPopupRole(element);
if (!popupRole)
return fallback;
const key = popupRole;
return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback;
}
function getTextboxSelection(element) {
let start = 0;
let end = 0;
if (DLOEKDPY_isTextField(element)) {
start = element.selectionStart || 0;
end = element.selectionEnd || 0;
} else if (element.isContentEditable) {
const selection = DLOEKDPY_getDocument(element).getSelection();
if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) {
const range = selection.getRangeAt(0);
const nextRange = range.cloneRange();
nextRange.selectNodeContents(element);
nextRange.setEnd(range.startContainer, range.startOffset);
start = nextRange.toString().length;
nextRange.setEnd(range.endContainer, range.endOffset);
end = nextRange.toString().length;
}
}
return { start, end };
}
function scrollIntoViewIfNeeded(element, arg) {
if (isPartiallyHidden(element) && "scrollIntoView" in element) {
element.scrollIntoView(arg);
}
}
function getScrollingElement(element) {
if (!element)
return null;
if (element.clientHeight && element.scrollHeight > element.clientHeight) {
const { overflowY } = getComputedStyle(element);
const isScrollable = overflowY !== "visible" && overflowY !== "hidden";
if (isScrollable)
return element;
} else if (element.clientWidth && element.scrollWidth > element.clientWidth) {
const { overflowX } = getComputedStyle(element);
const isScrollable = overflowX !== "visible" && overflowX !== "hidden";
if (isScrollable)
return element;
}
return getScrollingElement(element.parentElement) || document.scrollingElement || document.body;
}
function isPartiallyHidden(element) {
const elementRect = element.getBoundingClientRect();
const scroller = getScrollingElement(element);
if (!scroller)
return false;
const scrollerRect = scroller.getBoundingClientRect();
const isHTML = scroller.tagName === "HTML";
const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top;
const scrollerBottom = isHTML ? scroller.clientHeight : scrollerRect.bottom;
const scrollerLeft = isHTML ? scrollerRect.left + scroller.scrollLeft : scrollerRect.left;
const scrollerRight = isHTML ? scroller.clientWidth : scrollerRect.right;
const top = elementRect.top < scrollerTop;
const left = elementRect.left < scrollerLeft;
const bottom = elementRect.bottom > scrollerBottom;
const right = elementRect.right > scrollerRight;
return top || left || bottom || right;
}
function setSelectionRange(element, ...args) {
if (/text|search|password|tel|url/i.test(element.type)) {
element.setSelectionRange(...args);
}
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/MHPO2BXA.js
"use client";
// src/utils/platform.ts
function isTouchDevice() {
return canUseDOM && !!navigator.maxTouchPoints;
}
function isApple() {
if (!canUseDOM)
return false;
return /mac|iphone|ipad|ipod/i.test(navigator.platform);
}
function isSafari() {
return canUseDOM && isApple() && /apple/i.test(navigator.vendor);
}
function isFirefox() {
return canUseDOM && /firefox\//i.test(navigator.userAgent);
}
function isMac() {
return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/utils/events.js
"use client";
// src/utils/events.ts
function isPortalEvent(event) {
return Boolean(
event.currentTarget && !contains(event.currentTarget, event.target)
);
}
function isSelfTarget(event) {
return event.target === event.currentTarget;
}
function isOpeningInNewTab(event) {
const element = event.currentTarget;
if (!element)
return false;
const isAppleDevice = isApple();
if (isAppleDevice && !event.metaKey)
return false;
if (!isAppleDevice && !event.ctrlKey)
return false;
const tagName = element.tagName.toLowerCase();
if (tagName === "a")
return true;
if (tagName === "button" && element.type === "submit")
return true;
if (tagName === "input" && element.type === "submit")
return true;
return false;
}
function isDownloading(event) {
const element = event.currentTarget;
if (!element)
return false;
const tagName = element.tagName.toLowerCase();
if (!event.altKey)
return false;
if (tagName === "a")
return true;
if (tagName === "button" && element.type === "submit")
return true;
if (tagName === "input" && element.type === "submit")
return true;
return false;
}
function fireEvent(element, type, eventInit) {
const event = new Event(type, eventInit);
return element.dispatchEvent(event);
}
function fireBlurEvent(element, eventInit) {
const event = new FocusEvent("blur", eventInit);
const defaultAllowed = element.dispatchEvent(event);
const bubbleInit = _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, eventInit), { bubbles: true });
element.dispatchEvent(new FocusEvent("focusout", bubbleInit));
return defaultAllowed;
}
function fireFocusEvent(element, eventInit) {
const event = new FocusEvent("focus", eventInit);
const defaultAllowed = element.dispatchEvent(event);
const bubbleInit = __spreadProps(__spreadValues({}, eventInit), { bubbles: true });
element.dispatchEvent(new FocusEvent("focusin", bubbleInit));
return defaultAllowed;
}
function fireKeyboardEvent(element, type, eventInit) {
const event = new KeyboardEvent(type, eventInit);
return element.dispatchEvent(event);
}
function fireClickEvent(element, eventInit) {
const event = new MouseEvent("click", eventInit);
return element.dispatchEvent(event);
}
function isFocusEventOutside(event, container) {
const containerElement = container || event.currentTarget;
const relatedTarget = event.relatedTarget;
return !relatedTarget || !contains(containerElement, relatedTarget);
}
function queueBeforeEvent(element, type, callback) {
const raf = requestAnimationFrame(() => {
element.removeEventListener(type, callImmediately, true);
callback();
});
const callImmediately = () => {
cancelAnimationFrame(raf);
callback();
};
element.addEventListener(type, callImmediately, {
once: true,
capture: true
});
return raf;
}
function addGlobalEventListener(type, listener, options, scope = window) {
const children = [];
try {
scope.document.addEventListener(type, listener, options);
for (const frame of Array.from(scope.frames)) {
children.push(addGlobalEventListener(type, listener, options, frame));
}
} catch (e) {
}
const removeEventListener = () => {
try {
scope.document.removeEventListener(type, listener, options);
} catch (e) {
}
children.forEach((remove) => remove());
};
return removeEventListener;
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/6O5OEQGF.js
"use client";
// src/utils/hooks.ts
var _React = _4R3V3JGP_spreadValues({}, external_React_namespaceObject);
var useReactId = _React.useId;
var useReactDeferredValue = _React.useDeferredValue;
var useReactInsertionEffect = _React.useInsertionEffect;
var useSafeLayoutEffect = canUseDOM ? external_React_.useLayoutEffect : external_React_.useEffect;
function useInitialValue(value) {
const [initialValue] = (0,external_React_.useState)(value);
return initialValue;
}
function useLazyValue(init) {
const ref = useRef();
if (ref.current === void 0) {
ref.current = init();
}
return ref.current;
}
function useLiveRef(value) {
const ref = (0,external_React_.useRef)(value);
useSafeLayoutEffect(() => {
ref.current = value;
});
return ref;
}
function usePreviousValue(value) {
const [previousValue, setPreviousValue] = useState(value);
if (value !== previousValue) {
setPreviousValue(value);
}
return previousValue;
}
function useEvent(callback) {
const ref = (0,external_React_.useRef)(() => {
throw new Error("Cannot call an event handler while rendering.");
});
if (useReactInsertionEffect) {
useReactInsertionEffect(() => {
ref.current = callback;
});
} else {
ref.current = callback;
}
return (0,external_React_.useCallback)((...args) => {
var _a;
return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args);
}, []);
}
function useMergeRefs(...refs) {
return (0,external_React_.useMemo)(() => {
if (!refs.some(Boolean))
return;
return (value) => {
refs.forEach((ref) => setRef(ref, value));
};
}, refs);
}
function useRefId(ref, deps) {
const [id, setId] = useState(void 0);
useSafeLayoutEffect(() => {
var _a;
setId((_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.id);
}, deps);
return id;
}
function useId(defaultId) {
if (useReactId) {
const reactId = useReactId();
if (defaultId)
return defaultId;
return reactId;
}
const [id, setId] = (0,external_React_.useState)(defaultId);
useSafeLayoutEffect(() => {
if (defaultId || id)
return;
const random = Math.random().toString(36).substr(2, 6);
setId(`id-${random}`);
}, [defaultId, id]);
return defaultId || id;
}
function useDeferredValue(value) {
if (useReactDeferredValue) {
return useReactDeferredValue(value);
}
const [deferredValue, setDeferredValue] = useState(value);
useEffect(() => {
const raf = requestAnimationFrame(() => setDeferredValue(value));
return () => cancelAnimationFrame(raf);
}, [value]);
return deferredValue;
}
function useTagName(refOrElement, type) {
const stringOrUndefined = (type2) => {
if (typeof type2 !== "string")
return;
return type2;
};
const [tagName, setTagName] = (0,external_React_.useState)(() => stringOrUndefined(type));
useSafeLayoutEffect(() => {
const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type));
}, [refOrElement, type]);
return tagName;
}
function useAttribute(refOrElement, attributeName, defaultValue) {
const [attribute, setAttribute] = useState(defaultValue);
useSafeLayoutEffect(() => {
const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
const value = element == null ? void 0 : element.getAttribute(attributeName);
if (value == null)
return;
setAttribute(value);
}, [refOrElement, attributeName]);
return attribute;
}
function useUpdateEffect(effect, deps) {
const mounted = (0,external_React_.useRef)(false);
(0,external_React_.useEffect)(() => {
if (mounted.current) {
return effect();
}
mounted.current = true;
}, deps);
(0,external_React_.useEffect)(
() => () => {
mounted.current = false;
},
[]
);
}
function useUpdateLayoutEffect(effect, deps) {
const mounted = useRef(false);
useSafeLayoutEffect(() => {
if (mounted.current) {
return effect();
}
mounted.current = true;
}, deps);
useSafeLayoutEffect(
() => () => {
mounted.current = false;
},
[]
);
}
function useControlledState(defaultState, state, setState) {
const [localState, setLocalState] = useState(defaultState);
const nextState = state !== void 0 ? state : localState;
const stateRef = useLiveRef(state);
const setStateRef = useLiveRef(setState);
const nextStateRef = useLiveRef(nextState);
const setNextState = useCallback((prevValue) => {
const setStateProp = setStateRef.current;
if (setStateProp) {
if (isSetNextState(setStateProp)) {
setStateProp(prevValue);
} else {
const nextValue = applyState(prevValue, nextStateRef.current);
nextStateRef.current = nextValue;
setStateProp(nextValue);
}
}
if (stateRef.current === void 0) {
setLocalState(prevValue);
}
}, []);
defineSetNextState(setNextState);
return [nextState, setNextState];
}
var SET_NEXT_STATE = Symbol("setNextState");
function isSetNextState(arg) {
return arg[SET_NEXT_STATE] === true;
}
function defineSetNextState(arg) {
if (!isSetNextState(arg)) {
Object.defineProperty(arg, SET_NEXT_STATE, { value: true });
}
}
function useForceUpdate() {
return (0,external_React_.useReducer)(() => [], []);
}
function useBooleanEvent(booleanOrCallback) {
return useEvent(
typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback
);
}
function useWrapElement(props, callback, deps = []) {
const wrapElement = (0,external_React_.useCallback)(
(element) => {
if (props.wrapElement) {
element = props.wrapElement(element);
}
return callback(element);
},
[...deps, props.wrapElement]
);
return _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { wrapElement });
}
function usePortalRef(portalProp = false, portalRefProp) {
const [portalNode, setPortalNode] = (0,external_React_.useState)(null);
const portalRef = useMergeRefs(setPortalNode, portalRefProp);
const domReady = !portalProp || portalNode;
return { portalRef, portalNode, domReady };
}
function useMetadataProps(props, key, value) {
const parent = props.onLoadedMetadataCapture;
const onLoadedMetadataCapture = (0,external_React_.useMemo)(() => {
return Object.assign(() => {
}, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, parent), { [key]: value }));
}, [parent, key, value]);
return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }];
}
function useIsMouseMoving() {
(0,external_React_.useEffect)(() => {
addGlobalEventListener("mousemove", setMouseMoving, true);
addGlobalEventListener("mousedown", resetMouseMoving, true);
addGlobalEventListener("mouseup", resetMouseMoving, true);
addGlobalEventListener("keydown", resetMouseMoving, true);
addGlobalEventListener("scroll", resetMouseMoving, true);
}, []);
const isMouseMoving = useEvent(() => mouseMoving);
return isMouseMoving;
}
var mouseMoving = false;
var previousScreenX = 0;
var previousScreenY = 0;
function hasMouseMovement(event) {
const movementX = event.movementX || event.screenX - previousScreenX;
const movementY = event.movementY || event.screenY - previousScreenY;
previousScreenX = event.screenX;
previousScreenY = event.screenY;
return movementX || movementY || "production" === "test";
}
function setMouseMoving(event) {
if (!hasMouseMovement(event))
return;
mouseMoving = true;
}
function resetMouseMoving() {
mouseMoving = false;
}
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
var jsx_runtime = __webpack_require__(4922);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/3ORBWXWF.js
"use client";
// src/utils/system.tsx
function isRenderProp(children) {
return typeof children === "function";
}
function forwardRef2(render) {
const Role = React.forwardRef((props, ref) => render(__spreadProps(__spreadValues({}, props), { ref })));
Role.displayName = render.displayName || render.name;
return Role;
}
function memo2(Component, propsAreEqual) {
const Role = React.memo(Component, propsAreEqual);
Role.displayName = Component.displayName || Component.name;
return Role;
}
function createComponent(render) {
const Role = (props, ref) => render(_4R3V3JGP_spreadValues({ ref }, props));
return external_React_.forwardRef(Role);
}
function createMemoComponent(render) {
const Role = createComponent(render);
return external_React_.memo(Role);
}
function _3ORBWXWF_createElement(Type, props) {
const _a = props, { as: As, wrapElement, render } = _a, rest = __objRest(_a, ["as", "wrapElement", "render"]);
let element;
const mergedRef = useMergeRefs(props.ref, getRefProperty(render));
if (false) {}
if (As && typeof As !== "string") {
element = /* @__PURE__ */ (0,jsx_runtime.jsx)(As, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, rest), { render }));
} else if (external_React_.isValidElement(render)) {
const renderProps = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, render.props), { ref: mergedRef });
element = external_React_.cloneElement(render, mergeProps(rest, renderProps));
} else if (render) {
element = render(rest);
} else if (isRenderProp(props.children)) {
if (false) {}
const _b = rest, { children } = _b, otherProps = __objRest(_b, ["children"]);
element = props.children(otherProps);
} else if (As) {
element = /* @__PURE__ */ (0,jsx_runtime.jsx)(As, _4R3V3JGP_spreadValues({}, rest));
} else {
element = /* @__PURE__ */ (0,jsx_runtime.jsx)(Type, _4R3V3JGP_spreadValues({}, rest));
}
if (wrapElement) {
return wrapElement(element);
}
return element;
}
function createHook(useProps) {
const useRole = (props = {}) => {
const htmlProps = useProps(props);
const copy = {};
for (const prop in htmlProps) {
if (Y3OOHFCN_hasOwnProperty(htmlProps, prop) && htmlProps[prop] !== void 0) {
copy[prop] = htmlProps[prop];
}
}
return copy;
};
return useRole;
}
function createStoreContext(providers = [], scopedProviders = []) {
const context = external_React_.createContext(void 0);
const scopedContext = external_React_.createContext(void 0);
const useContext2 = () => external_React_.useContext(context);
const useScopedContext = (onlyScoped = false) => {
const scoped = external_React_.useContext(scopedContext);
const store = useContext2();
if (onlyScoped)
return scoped;
return scoped || store;
};
const useProviderContext = () => {
const scoped = external_React_.useContext(scopedContext);
const store = useContext2();
if (scoped && scoped === store)
return;
return store;
};
const ContextProvider = (props) => {
return providers.reduceRight(
(children, Provider) => /* @__PURE__ */ (0,jsx_runtime.jsx)(Provider, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { children })),
/* @__PURE__ */ (0,jsx_runtime.jsx)(context.Provider, _4R3V3JGP_spreadValues({}, props))
);
};
const ScopedContextProvider = (props) => {
return /* @__PURE__ */ (0,jsx_runtime.jsx)(ContextProvider, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { children: scopedProviders.reduceRight(
(children, Provider) => /* @__PURE__ */ (0,jsx_runtime.jsx)(Provider, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { children })),
/* @__PURE__ */ (0,jsx_runtime.jsx)(scopedContext.Provider, _4R3V3JGP_spreadValues({}, props))
) }));
};
return {
context,
scopedContext,
useContext: useContext2,
useScopedContext,
useProviderContext,
ContextProvider,
ScopedContextProvider
};
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/utils/focus.js
"use client";
// src/utils/focus.ts
var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
function hasNegativeTabIndex(element) {
const tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
return tabIndex < 0;
}
function isFocusable(element) {
if (!matches(element, selector))
return false;
if (!isVisible(element))
return false;
if (DLOEKDPY_closest(element, "[inert]"))
return false;
return true;
}
function isTabbable(element) {
if (!isFocusable(element))
return false;
if (hasNegativeTabIndex(element))
return false;
if (!("form" in element))
return true;
if (!element.form)
return true;
if (element.checked)
return true;
if (element.type !== "radio")
return true;
const radioGroup = element.form.elements.namedItem(element.name);
if (!radioGroup)
return true;
if (!("length" in radioGroup))
return true;
const activeElement = getActiveElement(element);
if (!activeElement)
return true;
if (activeElement === element)
return true;
if (!("form" in activeElement))
return true;
if (activeElement.form !== element.form)
return true;
if (activeElement.name !== element.name)
return true;
return false;
}
function getAllFocusableIn(container, includeContainer) {
const elements = Array.from(
container.querySelectorAll(selector)
);
if (includeContainer) {
elements.unshift(container);
}
const focusableElements = elements.filter(isFocusable);
focusableElements.forEach((element, i) => {
if (isFrame(element) && element.contentDocument) {
const frameBody = element.contentDocument.body;
focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody));
}
});
return focusableElements;
}
function getAllFocusable(includeBody) {
return getAllFocusableIn(document.body, includeBody);
}
function getFirstFocusableIn(container, includeContainer) {
const [first] = getAllFocusableIn(container, includeContainer);
return first || null;
}
function getFirstFocusable(includeBody) {
return getFirstFocusableIn(document.body, includeBody);
}
function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
const elements = Array.from(
container.querySelectorAll(selector)
);
const tabbableElements = elements.filter(isTabbable);
if (includeContainer && isTabbable(container)) {
tabbableElements.unshift(container);
}
tabbableElements.forEach((element, i) => {
if (isFrame(element) && element.contentDocument) {
const frameBody = element.contentDocument.body;
const allFrameTabbable = getAllTabbableIn(
frameBody,
false,
fallbackToFocusable
);
tabbableElements.splice(i, 1, ...allFrameTabbable);
}
});
if (!tabbableElements.length && fallbackToFocusable) {
return elements;
}
return tabbableElements;
}
function getAllTabbable(fallbackToFocusable) {
return getAllTabbableIn(document.body, false, fallbackToFocusable);
}
function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) {
const [first] = getAllTabbableIn(
container,
includeContainer,
fallbackToFocusable
);
return first || null;
}
function getFirstTabbable(fallbackToFocusable) {
return getFirstTabbableIn(document.body, false, fallbackToFocusable);
}
function getLastTabbableIn(container, includeContainer, fallbackToFocusable) {
const allTabbable = getAllTabbableIn(
container,
includeContainer,
fallbackToFocusable
);
return allTabbable[allTabbable.length - 1] || null;
}
function getLastTabbable(fallbackToFocusable) {
return getLastTabbableIn(document.body, false, fallbackToFocusable);
}
function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
const activeElement = getActiveElement(container);
const allFocusable = getAllFocusableIn(container, includeContainer);
const activeIndex = allFocusable.indexOf(activeElement);
const nextFocusableElements = allFocusable.slice(activeIndex + 1);
return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null;
}
function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
return getNextTabbableIn(
document.body,
false,
fallbackToFirst,
fallbackToFocusable
);
}
function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
const activeElement = getActiveElement(container);
const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
const activeIndex = allFocusable.indexOf(activeElement);
const previousFocusableElements = allFocusable.slice(activeIndex + 1);
return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null;
}
function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
return getPreviousTabbableIn(
document.body,
false,
fallbackToFirst,
fallbackToFocusable
);
}
function getClosestFocusable(element) {
while (element && !isFocusable(element)) {
element = closest(element, selector);
}
return element || null;
}
function hasFocus(element) {
const activeElement = getActiveElement(element);
if (!activeElement)
return false;
if (activeElement === element)
return true;
const activeDescendant = activeElement.getAttribute("aria-activedescendant");
if (!activeDescendant)
return false;
return activeDescendant === element.id;
}
function hasFocusWithin(element) {
const activeElement = getActiveElement(element);
if (!activeElement)
return false;
if (contains(element, activeElement))
return true;
const activeDescendant = activeElement.getAttribute("aria-activedescendant");
if (!activeDescendant)
return false;
if (!("id" in element))
return false;
if (activeDescendant === element.id)
return true;
return !!element.querySelector(`#${CSS.escape(activeDescendant)}`);
}
function focusIfNeeded(element) {
if (!hasFocusWithin(element) && isFocusable(element)) {
element.focus();
}
}
function disableFocus(element) {
var _a;
const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : "";
element.setAttribute("data-tabindex", currentTabindex);
element.setAttribute("tabindex", "-1");
}
function disableFocusIn(container, includeContainer) {
const tabbableElements = getAllTabbableIn(container, includeContainer);
tabbableElements.forEach(disableFocus);
}
function restoreFocusIn(container) {
const elements = container.querySelectorAll("[data-tabindex]");
const restoreTabIndex = (element) => {
const tabindex = element.getAttribute("data-tabindex");
element.removeAttribute("data-tabindex");
if (tabindex) {
element.setAttribute("tabindex", tabindex);
} else {
element.removeAttribute("tabindex");
}
};
if (container.hasAttribute("data-tabindex")) {
restoreTabIndex(container);
}
elements.forEach(restoreTabIndex);
}
function focusIntoView(element, options) {
if (!("scrollIntoView" in element)) {
element.focus();
} else {
element.focus({ preventScroll: true });
element.scrollIntoView(_chunks_4R3V3JGP_spreadValues({ block: "nearest", inline: "nearest" }, options));
}
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/KK7H3W2B.js
"use client";
// src/focusable/focusable.ts
var isSafariBrowser = isSafari();
var alwaysFocusVisibleInputTypes = [
"text",
"search",
"url",
"tel",
"email",
"password",
"number",
"date",
"month",
"week",
"time",
"datetime",
"datetime-local"
];
function isAlwaysFocusVisible(element) {
const { tagName, readOnly, type } = element;
if (tagName === "TEXTAREA" && !readOnly)
return true;
if (tagName === "SELECT" && !readOnly)
return true;
if (tagName === "INPUT" && !readOnly) {
return alwaysFocusVisibleInputTypes.includes(type);
}
if (element.isContentEditable)
return true;
return false;
}
function isAlwaysFocusVisibleDelayed(element) {
const role = element.getAttribute("role");
if (role !== "combobox")
return false;
return !!element.dataset.name;
}
function getLabels(element) {
if ("labels" in element) {
return element.labels;
}
return null;
}
function isNativeCheckboxOrRadio(element) {
const tagName = element.tagName.toLowerCase();
if (tagName === "input" && element.type) {
return element.type === "radio" || element.type === "checkbox";
}
return false;
}
function isNativeTabbable(tagName) {
if (!tagName)
return true;
return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a";
}
function supportsDisabledAttribute(tagName) {
if (!tagName)
return true;
return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea";
}
function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) {
if (!focusable) {
return tabIndexProp;
}
if (trulyDisabled) {
if (nativeTabbable && !supportsDisabled) {
return -1;
}
return;
}
if (nativeTabbable) {
return tabIndexProp;
}
return tabIndexProp || 0;
}
function useDisableEvent(onEvent, disabled) {
return useEvent((event) => {
onEvent == null ? void 0 : onEvent(event);
if (event.defaultPrevented)
return;
if (disabled) {
event.stopPropagation();
event.preventDefault();
}
});
}
var isKeyboardModality = true;
function onGlobalMouseDown(event) {
const target = event.target;
if (target && "hasAttribute" in target) {
if (!target.hasAttribute("data-focus-visible")) {
isKeyboardModality = false;
}
}
}
function onGlobalKeyDown(event) {
if (event.metaKey)
return;
if (event.ctrlKey)
return;
if (event.altKey)
return;
isKeyboardModality = true;
}
var useFocusable = createHook(
(_a) => {
var _b = _a, {
focusable = true,
accessibleWhenDisabled,
autoFocus,
onFocusVisible
} = _b, props = __objRest(_b, [
"focusable",
"accessibleWhenDisabled",
"autoFocus",
"onFocusVisible"
]);
const ref = (0,external_React_.useRef)(null);
(0,external_React_.useEffect)(() => {
if (!focusable)
return;
addGlobalEventListener("mousedown", onGlobalMouseDown, true);
addGlobalEventListener("keydown", onGlobalKeyDown, true);
}, [focusable]);
if (isSafariBrowser) {
(0,external_React_.useEffect)(() => {
if (!focusable)
return;
const element = ref.current;
if (!element)
return;
if (!isNativeCheckboxOrRadio(element))
return;
const labels = getLabels(element);
if (!labels)
return;
const onMouseUp = () => queueMicrotask(() => element.focus());
labels.forEach((label) => label.addEventListener("mouseup", onMouseUp));
return () => {
labels.forEach(
(label) => label.removeEventListener("mouseup", onMouseUp)
);
};
}, [focusable]);
}
const disabled = focusable && disabledFromProps(props);
const trulyDisabled = !!disabled && !accessibleWhenDisabled;
const [focusVisible, setFocusVisible] = (0,external_React_.useState)(false);
(0,external_React_.useEffect)(() => {
if (!focusable)
return;
if (trulyDisabled && focusVisible) {
setFocusVisible(false);
}
}, [focusable, trulyDisabled, focusVisible]);
(0,external_React_.useEffect)(() => {
if (!focusable)
return;
if (!focusVisible)
return;
const element = ref.current;
if (!element)
return;
if (typeof IntersectionObserver === "undefined")
return;
const observer = new IntersectionObserver(() => {
if (!isFocusable(element)) {
setFocusVisible(false);
}
});
observer.observe(element);
return () => observer.disconnect();
}, [focusable, focusVisible]);
const onKeyPressCapture = useDisableEvent(
props.onKeyPressCapture,
disabled
);
const onMouseDownCapture = useDisableEvent(
props.onMouseDownCapture,
disabled
);
const onClickCapture = useDisableEvent(props.onClickCapture, disabled);
const onMouseDownProp = props.onMouseDown;
const onMouseDown = useEvent((event) => {
onMouseDownProp == null ? void 0 : onMouseDownProp(event);
if (event.defaultPrevented)
return;
if (!focusable)
return;
const element = event.currentTarget;
if (!isSafariBrowser)
return;
if (isPortalEvent(event))
return;
if (!isButton(element) && !isNativeCheckboxOrRadio(element))
return;
let receivedFocus = false;
const onFocus = () => {
receivedFocus = true;
};
const options = { capture: true, once: true };
element.addEventListener("focusin", onFocus, options);
queueBeforeEvent(element, "mouseup", () => {
element.removeEventListener("focusin", onFocus, true);
if (receivedFocus)
return;
focusIfNeeded(element);
});
});
const handleFocusVisible = (event, currentTarget) => {
if (currentTarget) {
event.currentTarget = currentTarget;
}
if (!focusable)
return;
const element = event.currentTarget;
if (!element)
return;
if (!hasFocus(element))
return;
onFocusVisible == null ? void 0 : onFocusVisible(event);
if (event.defaultPrevented)
return;
setFocusVisible(true);
};
const onKeyDownCaptureProp = props.onKeyDownCapture;
const onKeyDownCapture = useEvent(
(event) => {
onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event);
if (event.defaultPrevented)
return;
if (!focusable)
return;
if (focusVisible)
return;
if (event.metaKey)
return;
if (event.altKey)
return;
if (event.ctrlKey)
return;
if (!isSelfTarget(event))
return;
const element = event.currentTarget;
queueMicrotask(() => handleFocusVisible(event, element));
}
);
const onFocusCaptureProp = props.onFocusCapture;
const onFocusCapture = useEvent((event) => {
onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
if (event.defaultPrevented)
return;
if (!focusable)
return;
if (!isSelfTarget(event)) {
setFocusVisible(false);
return;
}
const element = event.currentTarget;
const applyFocusVisible = () => handleFocusVisible(event, element);
if (isKeyboardModality || isAlwaysFocusVisible(event.target)) {
queueMicrotask(applyFocusVisible);
} else if (isAlwaysFocusVisibleDelayed(event.target)) {
queueBeforeEvent(event.target, "focusout", applyFocusVisible);
} else {
setFocusVisible(false);
}
});
const onBlurProp = props.onBlur;
const onBlur = useEvent((event) => {
onBlurProp == null ? void 0 : onBlurProp(event);
if (!focusable)
return;
if (!isFocusEventOutside(event))
return;
setFocusVisible(false);
});
const autoFocusOnShow = (0,external_React_.useContext)(FocusableContext);
const autoFocusRef = useEvent((element) => {
if (!focusable)
return;
if (!autoFocus)
return;
if (!element)
return;
if (!autoFocusOnShow)
return;
queueMicrotask(() => {
if (hasFocus(element))
return;
if (!isFocusable(element))
return;
element.focus();
});
});
const tagName = useTagName(ref, props.as);
const nativeTabbable = focusable && isNativeTabbable(tagName);
const supportsDisabled = focusable && supportsDisabledAttribute(tagName);
const style = trulyDisabled ? _4R3V3JGP_spreadValues({ pointerEvents: "none" }, props.style) : props.style;
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
"data-focus-visible": focusable && focusVisible ? "" : void 0,
"data-autofocus": autoFocus ? true : void 0,
"aria-disabled": disabled ? true : void 0
}, props), {
ref: useMergeRefs(ref, autoFocusRef, props.ref),
style,
tabIndex: getTabIndex(
focusable,
trulyDisabled,
nativeTabbable,
supportsDisabled,
props.tabIndex
),
disabled: supportsDisabled && trulyDisabled ? true : void 0,
// TODO: Test Focusable contentEditable.
contentEditable: disabled ? void 0 : props.contentEditable,
onKeyPressCapture,
onClickCapture,
onMouseDownCapture,
onMouseDown,
onKeyDownCapture,
onFocusCapture,
onBlur
});
return props;
}
);
var Focusable = createComponent((props) => {
props = useFocusable(props);
return _3ORBWXWF_createElement("div", props);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/NWCBQ4CV.js
"use client";
// src/command/command.ts
function isNativeClick(event) {
if (!event.isTrusted)
return false;
const element = event.currentTarget;
if (event.key === "Enter") {
return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A";
}
if (event.key === " ") {
return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT";
}
return false;
}
var symbol = Symbol("command");
var useCommand = createHook(
(_a) => {
var _b = _a, { clickOnEnter = true, clickOnSpace = true } = _b, props = __objRest(_b, ["clickOnEnter", "clickOnSpace"]);
const ref = (0,external_React_.useRef)(null);
const tagName = useTagName(ref, props.as);
const type = props.type;
const [isNativeButton, setIsNativeButton] = (0,external_React_.useState)(
() => !!tagName && isButton({ tagName, type })
);
(0,external_React_.useEffect)(() => {
if (!ref.current)
return;
setIsNativeButton(isButton(ref.current));
}, []);
const [active, setActive] = (0,external_React_.useState)(false);
const activeRef = (0,external_React_.useRef)(false);
const disabled = disabledFromProps(props);
const [isDuplicate, metadataProps] = useMetadataProps(props, symbol, true);
const onKeyDownProp = props.onKeyDown;
const onKeyDown = useEvent((event) => {
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
const element = event.currentTarget;
if (event.defaultPrevented)
return;
if (isDuplicate)
return;
if (disabled)
return;
if (!isSelfTarget(event))
return;
if (DLOEKDPY_isTextField(element))
return;
if (element.isContentEditable)
return;
const isEnter = clickOnEnter && event.key === "Enter";
const isSpace = clickOnSpace && event.key === " ";
const shouldPreventEnter = event.key === "Enter" && !clickOnEnter;
const shouldPreventSpace = event.key === " " && !clickOnSpace;
if (shouldPreventEnter || shouldPreventSpace) {
event.preventDefault();
return;
}
if (isEnter || isSpace) {
const nativeClick = isNativeClick(event);
if (isEnter) {
if (!nativeClick) {
event.preventDefault();
const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]);
const click = () => fireClickEvent(element, eventInit);
if (isFirefox()) {
queueBeforeEvent(element, "keyup", click);
} else {
queueMicrotask(click);
}
}
} else if (isSpace) {
activeRef.current = true;
if (!nativeClick) {
event.preventDefault();
setActive(true);
}
}
}
});
const onKeyUpProp = props.onKeyUp;
const onKeyUp = useEvent((event) => {
onKeyUpProp == null ? void 0 : onKeyUpProp(event);
if (event.defaultPrevented)
return;
if (isDuplicate)
return;
if (disabled)
return;
if (event.metaKey)
return;
const isSpace = clickOnSpace && event.key === " ";
if (activeRef.current && isSpace) {
activeRef.current = false;
if (!isNativeClick(event)) {
event.preventDefault();
setActive(false);
const element = event.currentTarget;
const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]);
queueMicrotask(() => fireClickEvent(element, eventInit));
}
}
});
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues(_4R3V3JGP_spreadValues({
"data-active": active ? "" : void 0,
type: isNativeButton ? "button" : void 0
}, metadataProps), props), {
ref: useMergeRefs(ref, props.ref),
onKeyDown,
onKeyUp
});
props = useFocusable(props);
return props;
}
);
var Command = createComponent((props) => {
props = useCommand(props);
return _3ORBWXWF_createElement("button", props);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/4UUKJZ4V.js
"use client";
// src/collection/collection-context.tsx
var ctx = createStoreContext();
var useCollectionContext = ctx.useContext;
var useCollectionScopedContext = ctx.useScopedContext;
var useCollectionProviderContext = ctx.useProviderContext;
var CollectionContextProvider = ctx.ContextProvider;
var CollectionScopedContextProvider = ctx.ScopedContextProvider;
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/UH3I23HL.js
"use client";
// src/collection/collection-item.ts
var useCollectionItem = createHook(
(_a) => {
var _b = _a, {
store,
shouldRegisterItem = true,
getItem = identity,
element: element
} = _b, props = __objRest(_b, [
"store",
"shouldRegisterItem",
"getItem",
// @ts-expect-error This prop may come from a collection renderer.
"element"
]);
const context = useCollectionContext();
store = store || context;
const id = useId(props.id);
const ref = (0,external_React_.useRef)(element);
(0,external_React_.useEffect)(() => {
const element2 = ref.current;
if (!id)
return;
if (!element2)
return;
if (!shouldRegisterItem)
return;
const item = getItem({ id, element: element2 });
return store == null ? void 0 : store.renderItem(item);
}, [id, shouldRegisterItem, getItem, store]);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
ref: useMergeRefs(ref, props.ref)
});
return props;
}
);
var CollectionItem = createComponent(
(props) => {
const htmlProps = useCollectionItem(props);
return _3ORBWXWF_createElement("div", htmlProps);
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/3IEDWLST.js
"use client";
// src/composite/utils.ts
var NULL_ITEM = { id: null };
function flipItems(items, activeId, shouldInsertNullItem = false) {
const index = items.findIndex((item) => item.id === activeId);
return [
...items.slice(index + 1),
...shouldInsertNullItem ? [NULL_ITEM] : [],
...items.slice(0, index)
];
}
function findFirstEnabledItem(items, excludeId) {
return items.find((item) => {
if (excludeId) {
return !item.disabled && item.id !== excludeId;
}
return !item.disabled;
});
}
function getEnabledItem(store, id) {
if (!id)
return null;
return store.item(id) || null;
}
function groupItemsByRows(items) {
const rows = [];
for (const item of items) {
const row = rows.find((currentRow) => {
var _a;
return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
});
if (row) {
row.push(item);
} else {
rows.push([item]);
}
}
return rows;
}
function selectTextField(element, collapseToEnd = false) {
if (isTextField(element)) {
element.setSelectionRange(
collapseToEnd ? element.value.length : 0,
element.value.length
);
} else if (element.isContentEditable) {
const selection = getDocument(element).getSelection();
selection == null ? void 0 : selection.selectAllChildren(element);
if (collapseToEnd) {
selection == null ? void 0 : selection.collapseToEnd();
}
}
}
var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY");
function focusSilently(element) {
element[FOCUS_SILENTLY] = true;
element.focus({ preventScroll: true });
}
function silentlyFocused(element) {
const isSilentlyFocused = element[FOCUS_SILENTLY];
delete element[FOCUS_SILENTLY];
return isSilentlyFocused;
}
function isItem(store, element, exclude) {
if (!element)
return false;
if (element === exclude)
return false;
const item = store.item(element.id);
if (!item)
return false;
if (exclude && item.element === exclude)
return false;
return true;
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/IB7YUKH5.js
"use client";
// src/composite/composite-context.tsx
var IB7YUKH5_ctx = createStoreContext(
[CollectionContextProvider],
[CollectionScopedContextProvider]
);
var useCompositeContext = IB7YUKH5_ctx.useContext;
var useCompositeScopedContext = IB7YUKH5_ctx.useScopedContext;
var useCompositeProviderContext = IB7YUKH5_ctx.useProviderContext;
var CompositeContextProvider = IB7YUKH5_ctx.ContextProvider;
var CompositeScopedContextProvider = IB7YUKH5_ctx.ScopedContextProvider;
var CompositeItemContext = (0,external_React_.createContext)(
void 0
);
var CompositeRowContext = (0,external_React_.createContext)(
void 0
);
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/EAHJFCU4.js
"use client";
// src/utils/store.ts
function getInternal(store, key) {
const internals = store.__unstableInternals;
invariant(internals, "Invalid store");
return internals[key];
}
function createStore(initialState, ...stores) {
let state = initialState;
let prevStateBatch = state;
let lastUpdate = Symbol();
let destroy = noop;
const instances = /* @__PURE__ */ new Set();
const updatedKeys = /* @__PURE__ */ new Set();
const setups = /* @__PURE__ */ new Set();
const listeners = /* @__PURE__ */ new Set();
const batchListeners = /* @__PURE__ */ new Set();
const disposables = /* @__PURE__ */ new WeakMap();
const listenerKeys = /* @__PURE__ */ new WeakMap();
const storeSetup = (callback) => {
setups.add(callback);
return () => setups.delete(callback);
};
const storeInit = () => {
const initialized = instances.size;
const instance = Symbol();
instances.add(instance);
const maybeDestroy = () => {
instances.delete(instance);
if (instances.size)
return;
destroy();
};
if (initialized)
return maybeDestroy;
const desyncs = getKeys(state).map(
(key) => chain(
...stores.map((store) => {
var _a;
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
if (!storeState)
return;
if (!Y3OOHFCN_hasOwnProperty(storeState, key))
return;
return sync(store, [key], (state2) => {
setState(
key,
state2[key],
// @ts-expect-error - Not public API. This is just to prevent
// infinite loops.
true
);
});
})
)
);
const teardowns = [];
setups.forEach((setup2) => teardowns.push(setup2()));
const cleanups = stores.map(init);
destroy = chain(...desyncs, ...teardowns, ...cleanups);
return maybeDestroy;
};
const sub = (keys, listener, set = listeners) => {
set.add(listener);
listenerKeys.set(listener, keys);
return () => {
var _a;
(_a = disposables.get(listener)) == null ? void 0 : _a();
disposables.delete(listener);
listenerKeys.delete(listener);
set.delete(listener);
};
};
const storeSubscribe = (keys, listener) => sub(keys, listener);
const storeSync = (keys, listener) => {
disposables.set(listener, listener(state, state));
return sub(keys, listener);
};
const storeBatch = (keys, listener) => {
disposables.set(listener, listener(state, prevStateBatch));
return sub(keys, listener, batchListeners);
};
const storePick = (keys) => createStore(pick(state, keys), finalStore);
const storeOmit = (keys) => createStore(omit(state, keys), finalStore);
const getState = () => state;
const setState = (key, value, fromStores = false) => {
if (!Y3OOHFCN_hasOwnProperty(state, key))
return;
const nextValue = Y3OOHFCN_applyState(value, state[key]);
if (nextValue === state[key])
return;
if (!fromStores) {
stores.forEach((store) => {
var _a;
(_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
});
}
const prevState = state;
state = _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, state), { [key]: nextValue });
const thisUpdate = Symbol();
lastUpdate = thisUpdate;
updatedKeys.add(key);
const run = (listener, prev, uKeys) => {
var _a;
const keys = listenerKeys.get(listener);
const updated = (k) => uKeys ? uKeys.has(k) : k === key;
if (!keys || keys.some(updated)) {
(_a = disposables.get(listener)) == null ? void 0 : _a();
disposables.set(listener, listener(state, prev));
}
};
listeners.forEach((listener) => {
run(listener, prevState);
});
queueMicrotask(() => {
if (lastUpdate !== thisUpdate)
return;
const snapshot = state;
batchListeners.forEach((listener) => {
run(listener, prevStateBatch, updatedKeys);
});
prevStateBatch = snapshot;
updatedKeys.clear();
});
};
const finalStore = {
getState,
setState,
__unstableInternals: {
setup: storeSetup,
init: storeInit,
subscribe: storeSubscribe,
sync: storeSync,
batch: storeBatch,
pick: storePick,
omit: storeOmit
}
};
return finalStore;
}
function setup(store, ...args) {
if (!store)
return;
return getInternal(store, "setup")(...args);
}
function init(store, ...args) {
if (!store)
return;
return getInternal(store, "init")(...args);
}
function EAHJFCU4_subscribe(store, ...args) {
if (!store)
return;
return getInternal(store, "subscribe")(...args);
}
function sync(store, ...args) {
if (!store)
return;
return getInternal(store, "sync")(...args);
}
function batch(store, ...args) {
if (!store)
return;
return getInternal(store, "batch")(...args);
}
function omit2(store, ...args) {
if (!store)
return;
return getInternal(store, "omit")(...args);
}
function pick2(store, ...args) {
if (!store)
return;
return getInternal(store, "pick")(...args);
}
function mergeStore(...stores) {
const initialState = stores.reduce((state, store2) => {
var _a;
const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
if (!nextState)
return state;
return _chunks_4R3V3JGP_spreadValues(_chunks_4R3V3JGP_spreadValues({}, state), nextState);
}, {});
const store = createStore(initialState, ...stores);
return store;
}
function throwOnConflictingProps(props, store) {
if (true)
return;
if (!store)
return;
const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => {
var _a;
const stateKey = key.replace("default", "");
return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}${stateKey.slice(1)}`;
});
if (!defaultKeys.length)
return;
const storeState = store.getState();
const conflictingProps = defaultKeys.filter(
(key) => Y3OOHFCN_hasOwnProperty(storeState, key)
);
if (!conflictingProps.length)
return;
throw new Error(
`Passing a store prop in conjunction with a default state is not supported.
const store = useSelectStore();
<SelectProvider store={store} defaultValue="Apple" />
^ ^
Instead, pass the default state to the topmost store:
const store = useSelectStore({ defaultValue: "Apple" });
<SelectProvider store={store} />
See https://github.com/ariakit/ariakit/pull/2745 for more details.
If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit
`
);
}
// EXTERNAL MODULE: ./node_modules/use-sync-external-store/shim/index.js
var shim = __webpack_require__(422);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/EKQEJRUF.js
"use client";
// src/utils/store.tsx
var { useSyncExternalStore } = shim;
var noopSubscribe = () => () => {
};
function useStoreState(store, keyOrSelector = identity) {
const storeSubscribe = external_React_.useCallback(
(callback) => {
if (!store)
return noopSubscribe();
return EAHJFCU4_subscribe(store, null, callback);
},
[store]
);
const getSnapshot = () => {
const key = typeof keyOrSelector === "string" ? keyOrSelector : null;
const selector = typeof keyOrSelector === "function" ? keyOrSelector : null;
const state = store == null ? void 0 : store.getState();
if (selector)
return selector(state);
if (!state)
return;
if (!key)
return;
if (!Y3OOHFCN_hasOwnProperty(state, key))
return;
return state[key];
};
return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot);
}
function useStoreProps(store, props, key, setKey) {
const value = Y3OOHFCN_hasOwnProperty(props, key) ? props[key] : void 0;
const setValue = setKey ? props[setKey] : void 0;
const propsRef = useLiveRef({ value, setValue });
useSafeLayoutEffect(() => {
return sync(store, [key], (state, prev) => {
const { value: value2, setValue: setValue2 } = propsRef.current;
if (!setValue2)
return;
if (state[key] === prev[key])
return;
if (state[key] === value2)
return;
setValue2(state[key]);
});
}, [store, key]);
useSafeLayoutEffect(() => {
if (value === void 0)
return;
store.setState(key, value);
return batch(store, [key], () => {
if (value === void 0)
return;
store.setState(key, value);
});
});
}
function EKQEJRUF_useStore(createStore, props) {
const [store, setStore] = external_React_.useState(() => createStore(props));
useSafeLayoutEffect(() => init(store), [store]);
const useState2 = external_React_.useCallback(
(keyOrSelector) => useStoreState(store, keyOrSelector),
[store]
);
const memoizedStore = external_React_.useMemo(
() => _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, store), { useState: useState2 }),
[store, useState2]
);
const updateStore = useEvent(() => {
setStore((store2) => createStore(_4R3V3JGP_spreadValues(_4R3V3JGP_spreadValues({}, props), store2.getState())));
});
return [memoizedStore, updateStore];
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/QZLXIDNP.js
"use client";
// src/composite/composite-item.tsx
function isEditableElement(element) {
if (element.isContentEditable)
return true;
if (DLOEKDPY_isTextField(element))
return true;
return element.tagName === "INPUT" && !isButton(element);
}
function getNextPageOffset(scrollingElement, pageUp = false) {
const height = scrollingElement.clientHeight;
const { top } = scrollingElement.getBoundingClientRect();
const pageSize = Math.max(height * 0.875, height - 40) * 1.5;
const pageOffset = pageUp ? height - pageSize + top : pageSize + top;
if (scrollingElement.tagName === "HTML") {
return pageOffset + scrollingElement.scrollTop;
}
return pageOffset;
}
function getItemOffset(itemElement, pageUp = false) {
const { top } = itemElement.getBoundingClientRect();
if (pageUp) {
return top + itemElement.clientHeight;
}
return top;
}
function findNextPageItemId(element, store, next, pageUp = false) {
var _a;
if (!store)
return;
if (!next)
return;
const { renderedItems } = store.getState();
const scrollingElement = getScrollingElement(element);
if (!scrollingElement)
return;
const nextPageOffset = getNextPageOffset(scrollingElement, pageUp);
let id;
let prevDifference;
for (let i = 0; i < renderedItems.length; i += 1) {
const previousId = id;
id = next(i);
if (!id)
break;
if (id === previousId)
continue;
const itemElement = (_a = getEnabledItem(store, id)) == null ? void 0 : _a.element;
if (!itemElement)
continue;
const itemOffset = getItemOffset(itemElement, pageUp);
const difference = itemOffset - nextPageOffset;
const absDifference = Math.abs(difference);
if (pageUp && difference <= 0 || !pageUp && difference >= 0) {
if (prevDifference !== void 0 && prevDifference < absDifference) {
id = previousId;
}
break;
}
prevDifference = absDifference;
}
return id;
}
function targetIsAnotherItem(event, store) {
if (isSelfTarget(event))
return false;
return isItem(store, event.target);
}
function useRole(ref, props) {
const roleProp = props.role;
const [role, setRole] = (0,external_React_.useState)(roleProp);
useSafeLayoutEffect(() => {
const element = ref.current;
if (!element)
return;
setRole(element.getAttribute("role") || roleProp);
}, [roleProp]);
return role;
}
function requiresAriaSelected(role) {
return role === "option" || role === "treeitem";
}
function supportsAriaSelected(role) {
if (role === "option")
return true;
if (role === "tab")
return true;
if (role === "treeitem")
return true;
if (role === "gridcell")
return true;
if (role === "row")
return true;
if (role === "columnheader")
return true;
if (role === "rowheader")
return true;
return false;
}
var useCompositeItem = createHook(
(_a) => {
var _b = _a, {
store,
rowId: rowIdProp,
preventScrollOnKeyDown = false,
moveOnKeyPress = true,
tabbable = false,
getItem: getItemProp,
"aria-setsize": ariaSetSizeProp,
"aria-posinset": ariaPosInSetProp
} = _b, props = __objRest(_b, [
"store",
"rowId",
"preventScrollOnKeyDown",
"moveOnKeyPress",
"tabbable",
"getItem",
"aria-setsize",
"aria-posinset"
]);
const context = useCompositeContext();
store = store || context;
const id = useId(props.id);
const ref = (0,external_React_.useRef)(null);
const row = (0,external_React_.useContext)(CompositeRowContext);
const rowId = useStoreState(store, (state) => {
if (rowIdProp)
return rowIdProp;
if (!state)
return;
if (!(row == null ? void 0 : row.baseElement))
return;
if (row.baseElement !== state.baseElement)
return;
return row.id;
});
const disabled = disabledFromProps(props);
const trulyDisabled = disabled && !props.accessibleWhenDisabled;
const getItem = (0,external_React_.useCallback)(
(item) => {
const nextItem = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, item), {
id: id || item.id,
rowId,
disabled: !!trulyDisabled
});
if (getItemProp) {
return getItemProp(nextItem);
}
return nextItem;
},
[id, rowId, trulyDisabled, getItemProp]
);
const onFocusProp = props.onFocus;
const hasFocusedComposite = (0,external_React_.useRef)(false);
const onFocus = useEvent((event) => {
onFocusProp == null ? void 0 : onFocusProp(event);
if (event.defaultPrevented)
return;
if (isPortalEvent(event))
return;
if (!id)
return;
if (!store)
return;
const { activeId, virtualFocus: virtualFocus2, baseElement: baseElement2 } = store.getState();
if (targetIsAnotherItem(event, store))
return;
if (activeId !== id) {
store.setActiveId(id);
}
if (!virtualFocus2)
return;
if (!isSelfTarget(event))
return;
if (isEditableElement(event.currentTarget))
return;
if (!(baseElement2 == null ? void 0 : baseElement2.isConnected))
return;
hasFocusedComposite.current = true;
const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget);
if (fromComposite) {
focusSilently(baseElement2);
} else {
baseElement2.focus();
}
});
const onBlurCaptureProp = props.onBlurCapture;
const onBlurCapture = useEvent((event) => {
onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
if (event.defaultPrevented)
return;
const state = store == null ? void 0 : store.getState();
if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) {
hasFocusedComposite.current = false;
event.preventDefault();
event.stopPropagation();
}
});
const onKeyDownProp = props.onKeyDown;
const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown);
const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
const onKeyDown = useEvent((event) => {
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
if (event.defaultPrevented)
return;
if (!isSelfTarget(event))
return;
if (!store)
return;
const { currentTarget } = event;
const state = store.getState();
const item = store.item(id);
const isGrid = !!(item == null ? void 0 : item.rowId);
const isVertical = state.orientation !== "horizontal";
const isHorizontal = state.orientation !== "vertical";
const canHomeEnd = () => {
if (isGrid)
return true;
if (isHorizontal)
return true;
if (!state.baseElement)
return true;
if (!DLOEKDPY_isTextField(state.baseElement))
return true;
return false;
};
const keyMap = {
ArrowUp: (isGrid || isVertical) && store.up,
ArrowRight: (isGrid || isHorizontal) && store.next,
ArrowDown: (isGrid || isVertical) && store.down,
ArrowLeft: (isGrid || isHorizontal) && store.previous,
Home: () => {
if (!canHomeEnd())
return;
if (!isGrid || event.ctrlKey) {
return store == null ? void 0 : store.first();
}
return store == null ? void 0 : store.previous(-1);
},
End: () => {
if (!canHomeEnd())
return;
if (!isGrid || event.ctrlKey) {
return store == null ? void 0 : store.last();
}
return store == null ? void 0 : store.next(-1);
},
PageUp: () => {
return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true);
},
PageDown: () => {
return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down);
}
};
const action = keyMap[event.key];
if (action) {
const nextId = action();
if (preventScrollOnKeyDownProp(event) || nextId !== void 0) {
if (!moveOnKeyPressProp(event))
return;
event.preventDefault();
store.move(nextId);
}
}
});
const baseElement = useStoreState(
store,
(state) => (state == null ? void 0 : state.baseElement) || void 0
);
const providerValue = (0,external_React_.useMemo)(
() => ({ id, baseElement }),
[id, baseElement]
);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }),
[providerValue]
);
const isActiveItem = useStoreState(
store,
(state) => !!state && state.activeId === id
);
const virtualFocus = useStoreState(store, "virtualFocus");
const role = useRole(ref, props);
let ariaSelected;
if (isActiveItem) {
if (requiresAriaSelected(role)) {
ariaSelected = true;
} else if (virtualFocus && supportsAriaSelected(role)) {
ariaSelected = true;
}
}
const ariaSetSize = useStoreState(store, (state) => {
if (ariaSetSizeProp != null)
return ariaSetSizeProp;
if (!state)
return;
if (!(row == null ? void 0 : row.ariaSetSize))
return;
if (row.baseElement !== state.baseElement)
return;
return row.ariaSetSize;
});
const ariaPosInSet = useStoreState(store, (state) => {
if (ariaPosInSetProp != null)
return ariaPosInSetProp;
if (!state)
return;
if (!(row == null ? void 0 : row.ariaPosInSet))
return;
if (row.baseElement !== state.baseElement)
return;
const itemsInRow = state.renderedItems.filter(
(item) => item.rowId === rowId
);
return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id);
});
const isTabbable = useStoreState(store, (state) => {
if (!(state == null ? void 0 : state.renderedItems.length))
return true;
if (state.virtualFocus)
return false;
if (tabbable)
return true;
return state.activeId === id;
});
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
id,
"aria-selected": ariaSelected,
"data-active-item": isActiveItem ? "" : void 0
}, props), {
ref: useMergeRefs(ref, props.ref),
tabIndex: isTabbable ? props.tabIndex : -1,
onFocus,
onBlurCapture,
onKeyDown
});
props = useCommand(props);
props = useCollectionItem(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
store
}, props), {
getItem,
shouldRegisterItem: !!id ? props.shouldRegisterItem : false
}));
return _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
"aria-setsize": ariaSetSize,
"aria-posinset": ariaPosInSet
});
}
);
var CompositeItem = createMemoComponent(
(props) => {
const htmlProps = useCompositeItem(props);
return _3ORBWXWF_createElement("button", htmlProps);
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/Z5IGYIPT.js
"use client";
// src/disclosure/disclosure-store.ts
function createDisclosureStore(props = {}) {
const store = mergeStore(
props.store,
omit2(props.disclosure, ["contentElement", "disclosureElement"])
);
throwOnConflictingProps(props, store);
const syncState = store == null ? void 0 : store.getState();
const open = defaultValue(
props.open,
syncState == null ? void 0 : syncState.open,
props.defaultOpen,
false
);
const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false);
const initialState = {
open,
animated,
animating: !!animated && open,
mounted: open,
contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null),
disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null)
};
const disclosure = createStore(initialState, store);
setup(
disclosure,
() => sync(disclosure, ["animated", "animating"], (state) => {
if (state.animated)
return;
disclosure.setState("animating", false);
})
);
setup(
disclosure,
() => EAHJFCU4_subscribe(disclosure, ["open"], () => {
if (!disclosure.getState().animated)
return;
disclosure.setState("animating", true);
})
);
setup(
disclosure,
() => sync(disclosure, ["open", "animating"], (state) => {
disclosure.setState("mounted", state.open || state.animating);
})
);
return _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, disclosure), {
setOpen: (value) => disclosure.setState("open", value),
show: () => disclosure.setState("open", true),
hide: () => disclosure.setState("open", false),
toggle: () => disclosure.setState("open", (open2) => !open2),
stopAnimation: () => disclosure.setState("animating", false),
setContentElement: (value) => disclosure.setState("contentElement", value),
setDisclosureElement: (value) => disclosure.setState("disclosureElement", value)
});
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/SFCBA2JZ.js
"use client";
// src/disclosure/disclosure-store.ts
function useDisclosureStoreProps(store, update, props) {
useUpdateEffect(update, [props.store, props.disclosure]);
useStoreProps(store, props, "open", "setOpen");
useStoreProps(store, props, "mounted", "setMounted");
useStoreProps(store, props, "animated");
return store;
}
function useDisclosureStore(props = {}) {
const [store, update] = EKQEJRUF_useStore(createDisclosureStore, props);
return useDisclosureStoreProps(store, update, props);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/SX2XFD6A.js
"use client";
// src/dialog/dialog-store.ts
function createDialogStore(props = {}) {
return createDisclosureStore(props);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/ZSELSBRM.js
"use client";
// src/dialog/dialog-store.ts
function useDialogStoreProps(store, update, props) {
return useDisclosureStoreProps(store, update, props);
}
function useDialogStore(props = {}) {
const [store, update] = EKQEJRUF_useStore(createDialogStore, props);
return useDialogStoreProps(store, update, props);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/MG4P3223.js
"use client";
// src/popover/popover-store.ts
function usePopoverStoreProps(store, update, props) {
useUpdateEffect(update, [props.popover]);
store = useDialogStoreProps(store, update, props);
useStoreProps(store, props, "placement");
return store;
}
function usePopoverStore(props = {}) {
const [store, update] = useStore(Core.createPopoverStore, props);
return usePopoverStoreProps(store, update, props);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/ZU7LQC5V.js
"use client";
// src/hovercard/hovercard-store.ts
function useHovercardStoreProps(store, update, props) {
store = usePopoverStoreProps(store, update, props);
useStoreProps(store, props, "timeout");
useStoreProps(store, props, "showTimeout");
useStoreProps(store, props, "hideTimeout");
return store;
}
function useHovercardStore(props = {}) {
const [store, update] = useStore(Core.createHovercardStore, props);
return useHovercardStoreProps(store, update, props);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/AF6IUUFN.js
"use client";
// src/popover/popover-store.ts
function createPopoverStore(_a = {}) {
var _b = _a, {
popover: otherPopover
} = _b, props = _4R3V3JGP_objRest(_b, [
"popover"
]);
const store = mergeStore(
props.store,
omit2(otherPopover, [
"arrowElement",
"anchorElement",
"contentElement",
"popoverElement",
"disclosureElement"
])
);
throwOnConflictingProps(props, store);
const syncState = store == null ? void 0 : store.getState();
const dialog = createDialogStore(_chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, props), { store }));
const placement = defaultValue(
props.placement,
syncState == null ? void 0 : syncState.placement,
"bottom"
);
const initialState = _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, dialog.getState()), {
placement,
currentPlacement: placement,
anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null),
popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null),
arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null),
rendered: Symbol("rendered")
});
const popover = createStore(initialState, dialog, store);
return _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues(_chunks_4R3V3JGP_spreadValues({}, dialog), popover), {
setAnchorElement: (element) => popover.setState("anchorElement", element),
setPopoverElement: (element) => popover.setState("popoverElement", element),
setArrowElement: (element) => popover.setState("arrowElement", element),
render: () => popover.setState("rendered", Symbol("rendered"))
});
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/SOLWE6E5.js
"use client";
// src/hovercard/hovercard-store.ts
function createHovercardStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const popover = createPopoverStore(_chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, props), {
placement: defaultValue(
props.placement,
syncState == null ? void 0 : syncState.placement,
"bottom"
)
}));
const timeout = defaultValue(props.timeout, syncState == null ? void 0 : syncState.timeout, 500);
const initialState = _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, popover.getState()), {
timeout,
showTimeout: defaultValue(props.showTimeout, syncState == null ? void 0 : syncState.showTimeout),
hideTimeout: defaultValue(props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
autoFocusOnShow: defaultValue(syncState == null ? void 0 : syncState.autoFocusOnShow, false)
});
const hovercard = createStore(initialState, popover, props.store);
return _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues(_chunks_4R3V3JGP_spreadValues({}, popover), hovercard), {
setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
});
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/tooltip/tooltip-store.js
"use client";
// src/tooltip/tooltip-store.ts
function createTooltipStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const hovercard = createHovercardStore(_chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, props), {
placement: defaultValue(
props.placement,
syncState == null ? void 0 : syncState.placement,
"top"
),
hideTimeout: defaultValue(props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout, 0)
}));
const initialState = _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, hovercard.getState()), {
type: defaultValue(props.type, syncState == null ? void 0 : syncState.type, "description"),
skipTimeout: defaultValue(props.skipTimeout, syncState == null ? void 0 : syncState.skipTimeout, 300)
});
const tooltip = createStore(initialState, hovercard, props.store);
return _chunks_4R3V3JGP_spreadValues(_chunks_4R3V3JGP_spreadValues({}, hovercard), tooltip);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/2QMN5E6B.js
"use client";
// src/tooltip/tooltip-store.ts
function useTooltipStoreProps(store, update, props) {
store = useHovercardStoreProps(store, update, props);
useStoreProps(store, props, "type");
useStoreProps(store, props, "skipTimeout");
return store;
}
function useTooltipStore(props = {}) {
const [store, update] = EKQEJRUF_useStore(createTooltipStore, props);
return useTooltipStoreProps(store, update, props);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/FSFPRQFR.js
"use client";
// src/role/role.ts
var FSFPRQFR_elements = [
"a",
"button",
"details",
"dialog",
"div",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"header",
"img",
"input",
"label",
"li",
"nav",
"ol",
"p",
"section",
"select",
"span",
"textarea",
"ul",
"svg"
];
var FSFPRQFR_useRole = createHook((props) => {
return props;
});
var Role = createComponent((props) => {
return _3ORBWXWF_createElement("div", props);
});
if (false) {}
Object.assign(
Role,
FSFPRQFR_elements.reduce((acc, element) => {
acc[element] = createComponent((props) => {
return _3ORBWXWF_createElement(element, props);
});
return acc;
}, {})
);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/OAYFXAQ2.js
"use client";
// src/disclosure/disclosure-context.tsx
var OAYFXAQ2_ctx = createStoreContext();
var useDisclosureContext = OAYFXAQ2_ctx.useContext;
var useDisclosureScopedContext = OAYFXAQ2_ctx.useScopedContext;
var useDisclosureProviderContext = OAYFXAQ2_ctx.useProviderContext;
var DisclosureContextProvider = OAYFXAQ2_ctx.ContextProvider;
var DisclosureScopedContextProvider = OAYFXAQ2_ctx.ScopedContextProvider;
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/G6BJYYBK.js
"use client";
// src/dialog/dialog-context.tsx
var G6BJYYBK_ctx = createStoreContext(
[DisclosureContextProvider],
[DisclosureScopedContextProvider]
);
var useDialogContext = G6BJYYBK_ctx.useContext;
var useDialogScopedContext = G6BJYYBK_ctx.useScopedContext;
var useDialogProviderContext = G6BJYYBK_ctx.useProviderContext;
var DialogContextProvider = G6BJYYBK_ctx.ContextProvider;
var DialogScopedContextProvider = G6BJYYBK_ctx.ScopedContextProvider;
var DialogHeadingContext = (0,external_React_.createContext)(void 0);
var DialogDescriptionContext = (0,external_React_.createContext)(void 0);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/7H5KSHHF.js
"use client";
// src/popover/popover-context.tsx
var _7H5KSHHF_ctx = createStoreContext(
[DialogContextProvider],
[DialogScopedContextProvider]
);
var usePopoverContext = _7H5KSHHF_ctx.useContext;
var usePopoverScopedContext = _7H5KSHHF_ctx.useScopedContext;
var usePopoverProviderContext = _7H5KSHHF_ctx.useProviderContext;
var PopoverContextProvider = _7H5KSHHF_ctx.ContextProvider;
var PopoverScopedContextProvider = _7H5KSHHF_ctx.ScopedContextProvider;
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/TI7CMBHW.js
"use client";
// src/hovercard/hovercard-context.tsx
var TI7CMBHW_ctx = createStoreContext(
[PopoverContextProvider],
[PopoverScopedContextProvider]
);
var useHovercardContext = TI7CMBHW_ctx.useContext;
var useHovercardScopedContext = TI7CMBHW_ctx.useScopedContext;
var useHovercardProviderContext = TI7CMBHW_ctx.useProviderContext;
var HovercardContextProvider = TI7CMBHW_ctx.ContextProvider;
var HovercardScopedContextProvider = TI7CMBHW_ctx.ScopedContextProvider;
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/7X4DYKYU.js
"use client";
// src/hovercard/hovercard-anchor.ts
var useHovercardAnchor = createHook(
(_a) => {
var _b = _a, { store, showOnHover = true } = _b, props = __objRest(_b, ["store", "showOnHover"]);
const context = useHovercardProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const disabled = disabledFromProps(props);
const showTimeoutRef = (0,external_React_.useRef)(0);
(0,external_React_.useEffect)(() => () => window.clearTimeout(showTimeoutRef.current), []);
(0,external_React_.useEffect)(() => {
const onMouseLeave = (event) => {
if (!store)
return;
const { anchorElement } = store.getState();
if (!anchorElement)
return;
if (event.target !== anchorElement)
return;
window.clearTimeout(showTimeoutRef.current);
showTimeoutRef.current = 0;
};
return addGlobalEventListener("mouseleave", onMouseLeave, true);
}, [store]);
const onMouseMoveProp = props.onMouseMove;
const showOnHoverProp = useBooleanEvent(showOnHover);
const isMouseMoving = useIsMouseMoving();
const onMouseMove = useEvent(
(event) => {
onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
if (disabled)
return;
if (!store)
return;
if (event.defaultPrevented)
return;
if (showTimeoutRef.current)
return;
if (!isMouseMoving())
return;
if (!showOnHoverProp(event))
return;
const element = event.currentTarget;
store.setAnchorElement(element);
store.setDisclosureElement(element);
const { showTimeout, timeout } = store.getState();
const showHovercard = () => {
showTimeoutRef.current = 0;
if (!isMouseMoving())
return;
store == null ? void 0 : store.setAnchorElement(element);
store == null ? void 0 : store.show();
queueMicrotask(() => {
store == null ? void 0 : store.setDisclosureElement(element);
});
};
const timeoutMs = showTimeout != null ? showTimeout : timeout;
if (timeoutMs === 0) {
showHovercard();
} else {
showTimeoutRef.current = window.setTimeout(showHovercard, timeoutMs);
}
}
);
const ref = (0,external_React_.useCallback)(
(element) => {
if (!store)
return;
const { anchorElement } = store.getState();
if (anchorElement == null ? void 0 : anchorElement.isConnected)
return;
store.setAnchorElement(element);
},
[store]
);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
ref: useMergeRefs(ref, props.ref),
onMouseMove
});
props = useFocusable(props);
return props;
}
);
var HovercardAnchor = createComponent(
(props) => {
const htmlProps = useHovercardAnchor(props);
return _3ORBWXWF_createElement("a", htmlProps);
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/MNFF5YOJ.js
"use client";
// src/tooltip/tooltip-context.tsx
var MNFF5YOJ_ctx = createStoreContext(
[HovercardContextProvider],
[HovercardScopedContextProvider]
);
var useTooltipContext = MNFF5YOJ_ctx.useContext;
var useTooltipScopedContext = MNFF5YOJ_ctx.useScopedContext;
var useTooltipProviderContext = MNFF5YOJ_ctx.useProviderContext;
var TooltipContextProvider = MNFF5YOJ_ctx.ContextProvider;
var TooltipScopedContextProvider = MNFF5YOJ_ctx.ScopedContextProvider;
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/tooltip/tooltip-anchor.js
"use client";
// src/tooltip/tooltip-anchor.ts
var globalStore = createStore({
activeStore: null
});
var useTooltipAnchor = createHook(
(_a) => {
var _b = _a, { store, showOnHover = true } = _b, props = __objRest(_b, ["store", "showOnHover"]);
const context = useTooltipProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const canShowOnHoverRef = (0,external_React_.useRef)(false);
(0,external_React_.useEffect)(() => {
return sync(store, ["mounted"], (state) => {
if (state.mounted)
return;
canShowOnHoverRef.current = false;
});
}, [store]);
(0,external_React_.useEffect)(() => {
return sync(store, ["mounted", "skipTimeout"], (state) => {
if (!store)
return;
if (state.mounted) {
const { activeStore } = globalStore.getState();
if (activeStore !== store) {
activeStore == null ? void 0 : activeStore.hide();
}
return globalStore.setState("activeStore", store);
}
const id = setTimeout(() => {
const { activeStore } = globalStore.getState();
if (activeStore !== store)
return;
globalStore.setState("activeStore", null);
}, state.skipTimeout);
return () => clearTimeout(id);
});
}, [store]);
const onMouseEnterProp = props.onMouseEnter;
const onMouseEnter = useEvent((event) => {
onMouseEnterProp == null ? void 0 : onMouseEnterProp(event);
canShowOnHoverRef.current = true;
});
const onFocusVisibleProp = props.onFocusVisible;
const onFocusVisible = useEvent((event) => {
onFocusVisibleProp == null ? void 0 : onFocusVisibleProp(event);
if (event.defaultPrevented)
return;
store == null ? void 0 : store.setAnchorElement(event.currentTarget);
store == null ? void 0 : store.show();
});
const onBlurProp = props.onBlur;
const onBlur = useEvent((event) => {
onBlurProp == null ? void 0 : onBlurProp(event);
if (event.defaultPrevented)
return;
const { activeStore } = globalStore.getState();
if (activeStore === store) {
globalStore.setState("activeStore", null);
}
});
const type = store.useState("type");
const contentId = store.useState((state) => {
var _a2;
return (_a2 = state.contentElement) == null ? void 0 : _a2.id;
});
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
"aria-labelledby": type === "label" ? contentId : void 0,
"aria-describedby": type === "description" ? contentId : void 0
}, props), {
onMouseEnter,
onFocusVisible,
onBlur
});
props = useHovercardAnchor(_4R3V3JGP_spreadValues({
store,
showOnHover: (event) => {
if (!canShowOnHoverRef.current)
return false;
if (isFalsyBooleanCallback(showOnHover, event))
return false;
const { activeStore } = globalStore.getState();
if (!activeStore)
return true;
store == null ? void 0 : store.show();
return false;
}
}, props));
return props;
}
);
var TooltipAnchor = createComponent((props) => {
const htmlProps = useTooltipAnchor(props);
return _3ORBWXWF_createElement("div", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/YMV43K4F.js
"use client";
// src/hovercard/utils/polygon.ts
function getEventPoint(event) {
return [event.clientX, event.clientY];
}
function isPointInPolygon(point, polygon) {
const [x, y] = point;
let inside = false;
const length = polygon.length;
for (let l = length, i = 0, j = l - 1; i < l; j = i++) {
const [xi, yi] = polygon[i];
const [xj, yj] = polygon[j];
const [, vy] = polygon[j === 0 ? l - 1 : j - 1] || [0, 0];
const where = (yi - yj) * (x - xi) - (xi - xj) * (y - yi);
if (yj < yi) {
if (y >= yj && y < yi) {
if (where === 0)
return true;
if (where > 0) {
if (y === yj) {
if (y > vy) {
inside = !inside;
}
} else {
inside = !inside;
}
}
}
} else if (yi < yj) {
if (y > yi && y <= yj) {
if (where === 0)
return true;
if (where < 0) {
if (y === yj) {
if (y < vy) {
inside = !inside;
}
} else {
inside = !inside;
}
}
}
} else if (y == yi && (x >= xj && x <= xi || x >= xi && x <= xj)) {
return true;
}
}
return inside;
}
function getEnterPointPlacement(enterPoint, rect) {
const { top, right, bottom, left } = rect;
const [x, y] = enterPoint;
const placementX = x < left ? "left" : x > right ? "right" : null;
const placementY = y < top ? "top" : y > bottom ? "bottom" : null;
return [placementX, placementY];
}
function getElementPolygon(element, enterPoint) {
const rect = element.getBoundingClientRect();
const { top, right, bottom, left } = rect;
const [x, y] = getEnterPointPlacement(enterPoint, rect);
const polygon = [enterPoint];
if (x) {
if (y !== "top") {
polygon.push([x === "left" ? left : right, top]);
}
polygon.push([x === "left" ? right : left, top]);
polygon.push([x === "left" ? right : left, bottom]);
if (y !== "bottom") {
polygon.push([x === "left" ? left : right, bottom]);
}
} else if (y === "top") {
polygon.push([left, top]);
polygon.push([left, bottom]);
polygon.push([right, bottom]);
polygon.push([right, top]);
} else {
polygon.push([left, bottom]);
polygon.push([left, top]);
polygon.push([right, top]);
polygon.push([right, bottom]);
}
return polygon;
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/MKDDWKFK.js
"use client";
// src/dialog/utils/is-backdrop.ts
function MKDDWKFK_isBackdrop(element, ...ids) {
if (!element)
return false;
const backdrop = element.getAttribute("data-backdrop");
if (backdrop == null)
return false;
if (backdrop === "")
return true;
if (backdrop === "true")
return true;
if (!ids.length)
return true;
return ids.some((id) => backdrop === id);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/X6WIMZJE.js
"use client";
// src/dialog/utils/orchestrate.ts
var cleanups = /* @__PURE__ */ new WeakMap();
function orchestrate(element, key, setup) {
if (!cleanups.has(element)) {
cleanups.set(element, /* @__PURE__ */ new Map());
}
const elementCleanups = cleanups.get(element);
const prevCleanup = elementCleanups.get(key);
if (!prevCleanup) {
elementCleanups.set(key, setup());
return () => {
var _a;
(_a = elementCleanups.get(key)) == null ? void 0 : _a();
elementCleanups.delete(key);
};
}
const cleanup = setup();
const nextCleanup = () => {
cleanup();
prevCleanup();
elementCleanups.delete(key);
};
elementCleanups.set(key, nextCleanup);
return () => {
const isCurrent = elementCleanups.get(key) === nextCleanup;
if (!isCurrent)
return;
cleanup();
elementCleanups.set(key, prevCleanup);
};
}
function setAttribute(element, attr, value) {
const setup = () => {
const previousValue = element.getAttribute(attr);
element.setAttribute(attr, value);
return () => {
if (previousValue == null) {
element.removeAttribute(attr);
} else {
element.setAttribute(attr, previousValue);
}
};
};
return orchestrate(element, attr, setup);
}
function setProperty(element, property, value) {
const setup = () => {
const exists = property in element;
const previousValue = element[property];
element[property] = value;
return () => {
if (!exists) {
delete element[property];
} else {
element[property] = previousValue;
}
};
};
return orchestrate(element, property, setup);
}
function assignStyle(element, style) {
if (!element)
return () => {
};
const setup = () => {
const prevStyle = element.style.cssText;
Object.assign(element.style, style);
return () => {
element.style.cssText = prevStyle;
};
};
return orchestrate(element, "style", setup);
}
function setCSSProperty(element, property, value) {
if (!element)
return () => {
};
const setup = () => {
const previousValue = element.style.getPropertyValue(property);
element.style.setProperty(property, value);
return () => {
if (previousValue) {
element.style.setProperty(property, previousValue);
} else {
element.style.removeProperty(property);
}
};
};
return orchestrate(element, property, setup);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/72E5EPFF.js
"use client";
// src/dialog/utils/walk-tree-outside.ts
var ignoreTags = ["SCRIPT", "STYLE"];
function getSnapshotPropertyName(id) {
return `__ariakit-dialog-snapshot-${id}`;
}
function inSnapshot(id, element) {
const doc = DLOEKDPY_getDocument(element);
const propertyName = getSnapshotPropertyName(id);
if (!doc.body[propertyName])
return true;
do {
if (element === doc.body)
return false;
if (!!element[propertyName])
return true;
if (!element.parentElement)
return false;
element = element.parentElement;
} while (true);
}
function isValidElement(id, element, ignoredElements) {
if (ignoreTags.includes(element.tagName))
return false;
if (!inSnapshot(id, element))
return false;
return !ignoredElements.some(
(enabledElement) => enabledElement && contains(element, enabledElement)
);
}
function _72E5EPFF_walkTreeOutside(id, elements, callback, ancestorCallback) {
for (let element of elements) {
if (!(element == null ? void 0 : element.isConnected))
continue;
const hasAncestorAlready = elements.some((maybeAncestor) => {
if (!maybeAncestor)
return false;
if (maybeAncestor === element)
return false;
return maybeAncestor.contains(element);
});
const doc = DLOEKDPY_getDocument(element);
const originalElement = element;
while (element.parentElement && element !== doc.body) {
ancestorCallback == null ? void 0 : ancestorCallback(element.parentElement, originalElement);
if (!hasAncestorAlready) {
for (const child of element.parentElement.children) {
if (isValidElement(id, child, elements)) {
callback(child, originalElement);
}
}
}
element = element.parentElement;
}
}
}
function createWalkTreeSnapshot(id, elements) {
const { body } = DLOEKDPY_getDocument(elements[0]);
const cleanups = [];
const markElement = (element) => {
cleanups.push(setProperty(element, getSnapshotPropertyName(id), true));
};
_72E5EPFF_walkTreeOutside(id, elements, markElement);
return chain(
setProperty(body, getSnapshotPropertyName(id), true),
() => cleanups.forEach((fn) => fn())
);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/TL67WVI6.js
"use client";
// src/dialog/utils/mark-tree-outside.ts
function getPropertyName(id = "", ancestor = false) {
return `__ariakit-dialog-${ancestor ? "ancestor" : "outside"}${id ? `-${id}` : ""}`;
}
function markElement(element, id = "") {
return chain(
setProperty(element, getPropertyName(), true),
setProperty(element, getPropertyName(id), true)
);
}
function markAncestor(element, id = "") {
return chain(
setProperty(element, getPropertyName("", true), true),
setProperty(element, getPropertyName(id, true), true)
);
}
function isElementMarked(element, id) {
const ancestorProperty = getPropertyName(id, true);
if (element[ancestorProperty])
return true;
const elementProperty = getPropertyName(id);
do {
if (element[elementProperty])
return true;
if (!element.parentElement)
return false;
element = element.parentElement;
} while (true);
}
function markTreeOutside(id, elements) {
const cleanups = [];
const ids = elements.map((el) => el == null ? void 0 : el.id);
_72E5EPFF_walkTreeOutside(
id,
elements,
(element) => {
if (MKDDWKFK_isBackdrop(element, ...ids))
return;
cleanups.unshift(markElement(element, id));
},
(ancestor, element) => {
const isAnotherDialogAncestor = element.hasAttribute("data-dialog") && element.id !== id;
if (isAnotherDialogAncestor)
return;
cleanups.unshift(markAncestor(ancestor, id));
}
);
const restoreAccessibilityTree = () => {
cleanups.forEach((fn) => fn());
};
return restoreAccessibilityTree;
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/CLE7NTOY.js
"use client";
// src/disclosure/disclosure-content.tsx
function afterTimeout(timeoutMs, cb) {
const timeoutId = setTimeout(cb, timeoutMs);
return () => clearTimeout(timeoutId);
}
function CLE7NTOY_afterPaint(cb) {
let raf = requestAnimationFrame(() => {
raf = requestAnimationFrame(cb);
});
return () => cancelAnimationFrame(raf);
}
function parseCSSTime(...times) {
return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => {
const currentTime = parseFloat(currentTimeString || "0s") * 1e3;
if (currentTime > longestTime)
return currentTime;
return longestTime;
}, 0);
}
function isHidden(mounted, hidden, alwaysVisible) {
return !alwaysVisible && hidden !== false && (!mounted || !!hidden);
}
var useDisclosureContent = createHook(
(_a) => {
var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]);
const context = useDisclosureProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const id = useId(props.id);
const [transition, setTransition] = (0,external_React_.useState)(null);
const open = store.useState("open");
const mounted = store.useState("mounted");
const animated = store.useState("animated");
const contentElement = store.useState("contentElement");
useSafeLayoutEffect(() => {
if (!animated)
return;
if (!(contentElement == null ? void 0 : contentElement.isConnected)) {
setTransition(null);
return;
}
return CLE7NTOY_afterPaint(() => {
setTransition(open ? "enter" : "leave");
});
}, [animated, contentElement, open]);
useSafeLayoutEffect(() => {
if (!store)
return;
if (!animated)
return;
if (!contentElement)
return;
if (!transition)
return;
if (transition === "enter" && !open)
return;
if (transition === "leave" && open)
return;
if (typeof animated === "number") {
const timeoutMs2 = animated;
return afterTimeout(timeoutMs2, store.stopAnimation);
}
const {
transitionDuration,
animationDuration,
transitionDelay,
animationDelay
} = getComputedStyle(contentElement);
const delay = parseCSSTime(transitionDelay, animationDelay);
const duration = parseCSSTime(transitionDuration, animationDuration);
const timeoutMs = delay + duration;
if (!timeoutMs)
return;
return afterTimeout(timeoutMs, store.stopAnimation);
}, [store, animated, contentElement, open, transition]);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(DialogScopedContextProvider, { value: store, children: element }),
[store]
);
const hidden = isHidden(mounted, props.hidden, alwaysVisible);
const style = hidden ? _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props.style), { display: "none" }) : props.style;
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
id,
"data-enter": transition === "enter" ? "" : void 0,
"data-leave": transition === "leave" ? "" : void 0,
hidden
}, props), {
ref: useMergeRefs(id ? store.setContentElement : null, props.ref),
style
});
return props;
}
);
var DisclosureContentImpl = createComponent(
(props) => {
const htmlProps = useDisclosureContent(props);
return _3ORBWXWF_createElement("div", htmlProps);
}
);
var DisclosureContent = createComponent(
(_a) => {
var _b = _a, { unmountOnHide } = _b, props = __objRest(_b, ["unmountOnHide"]);
const context = useDisclosureProviderContext();
const store = props.store || context;
const mounted = useStoreState(
store,
(state) => !unmountOnHide || (state == null ? void 0 : state.mounted)
);
if (mounted === false)
return null;
return /* @__PURE__ */ (0,jsx_runtime.jsx)(DisclosureContentImpl, _4R3V3JGP_spreadValues({}, props));
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/LWHPHW7Q.js
"use client";
// src/dialog/dialog-backdrop.tsx
function DialogBackdrop({
store,
backdrop,
backdropProps,
alwaysVisible,
hidden
}) {
const ref = (0,external_React_.useRef)(null);
const disclosure = useDisclosureStore({ disclosure: store });
const contentElement = store.useState("contentElement");
useSafeLayoutEffect(() => {
const backdrop2 = ref.current;
const dialog = contentElement;
if (!backdrop2)
return;
if (!dialog)
return;
backdrop2.style.zIndex = getComputedStyle(dialog).zIndex;
}, [contentElement]);
useSafeLayoutEffect(() => {
const id = contentElement == null ? void 0 : contentElement.id;
if (!id)
return;
const backdrop2 = ref.current;
if (!backdrop2)
return;
return markAncestor(backdrop2, id);
}, [contentElement]);
if (hidden != null) {
backdropProps = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, backdropProps), { hidden });
}
const props = useDisclosureContent(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
store: disclosure,
role: "presentation",
"data-backdrop": (contentElement == null ? void 0 : contentElement.id) || "",
alwaysVisible
}, backdropProps), {
ref: useMergeRefs(backdropProps == null ? void 0 : backdropProps.ref, ref),
style: _4R3V3JGP_spreadValues({
position: "fixed",
top: 0,
right: 0,
bottom: 0,
left: 0
}, backdropProps == null ? void 0 : backdropProps.style)
}));
if (!backdrop)
return null;
if ((0,external_React_.isValidElement)(backdrop)) {
return /* @__PURE__ */ (0,jsx_runtime.jsx)(Role, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { render: backdrop }));
}
const Component = typeof backdrop !== "boolean" ? backdrop : "div";
return /* @__PURE__ */ (0,jsx_runtime.jsx)(Role, _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { render: /* @__PURE__ */ (0,jsx_runtime.jsx)(Component, {}) }));
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/BULCTPRV.js
"use client";
// src/dialog/utils/disable-accessibility-tree-outside.ts
function hideElementFromAccessibilityTree(element) {
return setAttribute(element, "aria-hidden", "true");
}
function disableAccessibilityTreeOutside(id, elements) {
const cleanups = [];
const ids = elements.map((el) => el == null ? void 0 : el.id);
walkTreeOutside(id, elements, (element) => {
if (isBackdrop(element, ...ids))
return;
cleanups.unshift(hideElementFromAccessibilityTree(element));
});
const restoreAccessibilityTree = () => {
cleanups.forEach((fn) => fn());
};
return restoreAccessibilityTree;
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/677M2CI3.js
"use client";
// src/dialog/utils/supports-inert.ts
function supportsInert() {
return "inert" in HTMLElement.prototype;
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/TQYOGOE2.js
"use client";
// src/dialog/utils/disable-tree.ts
function disableTree(element, ignoredElements) {
if (!("style" in element))
return noop;
if (supportsInert()) {
return setProperty(element, "inert", true);
}
const tabbableElements = getAllTabbableIn(element, true);
const enableElements = tabbableElements.map((element2) => {
if (ignoredElements == null ? void 0 : ignoredElements.some((el) => el && contains(el, element2)))
return noop;
return setAttribute(element2, "tabindex", "-1");
});
return chain(
...enableElements,
hideElementFromAccessibilityTree(element),
assignStyle(element, {
pointerEvents: "none",
userSelect: "none",
cursor: "default"
})
);
}
function disableTreeOutside(id, elements) {
const cleanups = [];
const ids = elements.map((el) => el == null ? void 0 : el.id);
_72E5EPFF_walkTreeOutside(id, elements, (element) => {
if (MKDDWKFK_isBackdrop(element, ...ids))
return;
cleanups.unshift(disableTree(element, elements));
});
const restoreTreeOutside = () => {
cleanups.forEach((fn) => fn());
};
return restoreTreeOutside;
}
;// CONCATENATED MODULE: external "ReactDOM"
const external_ReactDOM_namespaceObject = window["ReactDOM"];
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/CS347UVZ.js
"use client";
// src/dialog/utils/use-root-dialog.ts
function useRootDialog({
attribute,
contentId,
contentElement,
enabled
}) {
const [updated, retry] = useForceUpdate();
const isRootDialog = (0,external_React_.useCallback)(() => {
if (!enabled)
return false;
if (!contentElement)
return false;
const { body } = DLOEKDPY_getDocument(contentElement);
const id = body.getAttribute(attribute);
return !id || id === contentId;
}, [updated, enabled, contentElement, attribute, contentId]);
(0,external_React_.useEffect)(() => {
if (!enabled)
return;
if (!contentId)
return;
if (!contentElement)
return;
const { body } = DLOEKDPY_getDocument(contentElement);
if (isRootDialog()) {
body.setAttribute(attribute, contentId);
return () => body.removeAttribute(attribute);
}
const observer = new MutationObserver(() => (0,external_ReactDOM_namespaceObject.flushSync)(retry));
observer.observe(body, { attributeFilter: [attribute] });
return () => observer.disconnect();
}, [updated, enabled, contentId, contentElement, isRootDialog, attribute]);
return isRootDialog;
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/6BJGLK2C.js
"use client";
// src/dialog/utils/use-prevent-body-scroll.ts
function getPaddingProperty(documentElement) {
const documentLeft = documentElement.getBoundingClientRect().left;
const scrollbarX = Math.round(documentLeft) + documentElement.scrollLeft;
return scrollbarX ? "paddingLeft" : "paddingRight";
}
function usePreventBodyScroll(contentElement, contentId, enabled) {
const isRootDialog = useRootDialog({
attribute: "data-dialog-prevent-body-scroll",
contentElement,
contentId,
enabled
});
(0,external_React_.useEffect)(() => {
if (!isRootDialog())
return;
if (!contentElement)
return;
const doc = DLOEKDPY_getDocument(contentElement);
const win = getWindow(contentElement);
const { documentElement, body } = doc;
const cssScrollbarWidth = documentElement.style.getPropertyValue("--scrollbar-width");
const scrollbarWidth = cssScrollbarWidth ? parseInt(cssScrollbarWidth) : win.innerWidth - documentElement.clientWidth;
const setScrollbarWidthProperty = () => setCSSProperty(
documentElement,
"--scrollbar-width",
`${scrollbarWidth}px`
);
const paddingProperty = getPaddingProperty(documentElement);
const setStyle = () => assignStyle(body, {
overflow: "hidden",
[paddingProperty]: `${scrollbarWidth}px`
});
const setIOSStyle = () => {
var _a, _b;
const { scrollX, scrollY, visualViewport } = win;
const offsetLeft = (_a = visualViewport == null ? void 0 : visualViewport.offsetLeft) != null ? _a : 0;
const offsetTop = (_b = visualViewport == null ? void 0 : visualViewport.offsetTop) != null ? _b : 0;
const restoreStyle = assignStyle(body, {
position: "fixed",
overflow: "hidden",
top: `${-(scrollY - Math.floor(offsetTop))}px`,
left: `${-(scrollX - Math.floor(offsetLeft))}px`,
right: "0",
[paddingProperty]: `${scrollbarWidth}px`
});
return () => {
restoreStyle();
if (true) {
win.scrollTo(scrollX, scrollY);
}
};
};
const isIOS = isApple() && !isMac();
return chain(
setScrollbarWidthProperty(),
isIOS ? setIOSStyle() : setStyle()
);
}, [isRootDialog, contentElement]);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/IUB2BTEK.js
"use client";
// src/dialog/utils/use-nested-dialogs.tsx
var NestedDialogsContext = (0,external_React_.createContext)({});
function useNestedDialogs(store) {
const context = (0,external_React_.useContext)(NestedDialogsContext);
const [dialogs, setDialogs] = (0,external_React_.useState)([]);
const add = (0,external_React_.useCallback)(
(dialog) => {
var _a;
setDialogs((dialogs2) => [...dialogs2, dialog]);
return chain((_a = context.add) == null ? void 0 : _a.call(context, dialog), () => {
setDialogs((dialogs2) => dialogs2.filter((d) => d !== dialog));
});
},
[context]
);
useSafeLayoutEffect(() => {
return sync(store, ["open", "contentElement"], (state) => {
var _a;
if (!state.open)
return;
if (!state.contentElement)
return;
return (_a = context.add) == null ? void 0 : _a.call(context, store);
});
}, [store, context]);
const providerValue = (0,external_React_.useMemo)(() => ({ store, add }), [store, add]);
const wrapElement = (0,external_React_.useCallback)(
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(NestedDialogsContext.Provider, { value: providerValue, children: element }),
[providerValue]
);
return { wrapElement, nestedDialogs: dialogs };
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/OOBDFMJL.js
"use client";
// src/dialog/utils/use-previous-mouse-down-ref.ts
function usePreviousMouseDownRef(enabled) {
const previousMouseDownRef = (0,external_React_.useRef)();
(0,external_React_.useEffect)(() => {
if (!enabled) {
previousMouseDownRef.current = null;
return;
}
const onMouseDown = (event) => {
previousMouseDownRef.current = event.target;
};
return addGlobalEventListener("mousedown", onMouseDown, true);
}, [enabled]);
return previousMouseDownRef;
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/XHJGS6Z5.js
"use client";
// src/dialog/utils/use-hide-on-interact-outside.ts
function isInDocument(target) {
if (target.tagName === "HTML")
return true;
return contains(DLOEKDPY_getDocument(target).body, target);
}
function isDisclosure(disclosure, target) {
if (!disclosure)
return false;
if (contains(disclosure, target))
return true;
const activeId = target.getAttribute("aria-activedescendant");
if (activeId) {
const activeElement = DLOEKDPY_getDocument(disclosure).getElementById(activeId);
if (activeElement) {
return contains(disclosure, activeElement);
}
}
return false;
}
function isMouseEventOnDialog(event, dialog) {
if (!("clientY" in event))
return false;
const rect = dialog.getBoundingClientRect();
if (rect.width === 0 || rect.height === 0)
return false;
return rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
}
function useEventOutside({
store,
type,
listener,
capture,
domReady
}) {
const callListener = useEvent(listener);
const open = store.useState("open");
const focusedRef = (0,external_React_.useRef)(false);
useSafeLayoutEffect(() => {
if (!open)
return;
if (!domReady)
return;
const { contentElement } = store.getState();
if (!contentElement)
return;
const onFocus = () => {
focusedRef.current = true;
};
contentElement.addEventListener("focusin", onFocus, true);
return () => contentElement.removeEventListener("focusin", onFocus, true);
}, [store, open, domReady]);
(0,external_React_.useEffect)(() => {
if (!open)
return;
const onEvent = (event) => {
const { contentElement, disclosureElement } = store.getState();
const target = event.target;
if (!contentElement)
return;
if (!target)
return;
if (!isInDocument(target))
return;
if (contains(contentElement, target))
return;
if (isDisclosure(disclosureElement, target))
return;
if (target.hasAttribute("data-focus-trap"))
return;
if (isMouseEventOnDialog(event, contentElement))
return;
const focused = focusedRef.current;
if (focused && !isElementMarked(target, contentElement.id))
return;
callListener(event);
};
return addGlobalEventListener(type, onEvent, capture);
}, [open, capture]);
}
function shouldHideOnInteractOutside(hideOnInteractOutside, event) {
if (typeof hideOnInteractOutside === "function") {
return hideOnInteractOutside(event);
}
return !!hideOnInteractOutside;
}
function useHideOnInteractOutside(store, hideOnInteractOutside, domReady) {
const open = store.useState("open");
const previousMouseDownRef = usePreviousMouseDownRef(open);
const props = { store, domReady, capture: true };
useEventOutside(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
type: "click",
listener: (event) => {
const { contentElement } = store.getState();
const previousMouseDown = previousMouseDownRef.current;
if (!previousMouseDown)
return;
if (!isVisible(previousMouseDown))
return;
if (!isElementMarked(previousMouseDown, contentElement == null ? void 0 : contentElement.id))
return;
if (!shouldHideOnInteractOutside(hideOnInteractOutside, event))
return;
store.hide();
}
}));
useEventOutside(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
type: "focusin",
listener: (event) => {
const { contentElement } = store.getState();
if (!contentElement)
return;
if (event.target === DLOEKDPY_getDocument(contentElement))
return;
if (!shouldHideOnInteractOutside(hideOnInteractOutside, event))
return;
store.hide();
}
}));
useEventOutside(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
type: "contextmenu",
listener: (event) => {
if (!shouldHideOnInteractOutside(hideOnInteractOutside, event))
return;
store.hide();
}
}));
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/6GXEOXGT.js
"use client";
// src/dialog/utils/prepend-hidden-dismiss.ts
function prependHiddenDismiss(container, onClick) {
const document = DLOEKDPY_getDocument(container);
const button = document.createElement("button");
button.type = "button";
button.tabIndex = -1;
button.textContent = "Dismiss popup";
Object.assign(button.style, {
border: "0px",
clip: "rect(0 0 0 0)",
height: "1px",
margin: "-1px",
overflow: "hidden",
padding: "0px",
position: "absolute",
whiteSpace: "nowrap",
width: "1px"
});
button.addEventListener("click", onClick);
container.prepend(button);
const removeHiddenDismiss = () => {
button.removeEventListener("click", onClick);
button.remove();
};
return removeHiddenDismiss;
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/HPP6CWMY.js
"use client";
// src/focusable/focusable-container.tsx
var useFocusableContainer = createHook(
(_a) => {
var _b = _a, { autoFocusOnShow = true } = _b, props = __objRest(_b, ["autoFocusOnShow"]);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(FocusableContext.Provider, { value: autoFocusOnShow, children: element }),
[autoFocusOnShow]
);
return props;
}
);
var FocusableContainer = createComponent(
(props) => {
const htmlProps = useFocusableContainer(props);
return _3ORBWXWF_createElement("div", htmlProps);
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/XPF5GU3Q.js
"use client";
// src/heading/heading-context.ts
var HeadingContext = (0,external_React_.createContext)(0);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/UYRJLDVS.js
"use client";
// src/heading/heading-level.tsx
function HeadingLevel({ level, children }) {
const contextLevel = (0,external_React_.useContext)(HeadingContext);
const nextLevel = Math.max(
Math.min(level || contextLevel + 1, 6),
1
);
return /* @__PURE__ */ (0,jsx_runtime.jsx)(HeadingContext.Provider, { value: nextLevel, children });
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/BG6HZDS7.js
"use client";
// src/visually-hidden/visually-hidden.ts
var useVisuallyHidden = createHook((props) => {
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
style: _4R3V3JGP_spreadValues({
border: 0,
clip: "rect(0 0 0 0)",
height: "1px",
margin: "-1px",
overflow: "hidden",
padding: 0,
position: "absolute",
whiteSpace: "nowrap",
width: "1px"
}, props.style)
});
return props;
});
var VisuallyHidden = createComponent(
(props) => {
const htmlProps = useVisuallyHidden(props);
return _3ORBWXWF_createElement("span", htmlProps);
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/CHKJ74UC.js
"use client";
// src/focus-trap/focus-trap.ts
var useFocusTrap = createHook((props) => {
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
"data-focus-trap": "",
tabIndex: 0,
"aria-hidden": true
}, props), {
style: _4R3V3JGP_spreadValues({
// Prevents unintended scroll jumps.
position: "fixed",
top: 0,
left: 0
}, props.style)
});
props = useVisuallyHidden(props);
return props;
});
var FocusTrap = createComponent((props) => {
const htmlProps = useFocusTrap(props);
return _3ORBWXWF_createElement("span", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/7452U3HH.js
"use client";
// src/portal/portal-context.ts
var PortalContext = (0,external_React_.createContext)(null);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/JPXNJYSO.js
"use client";
// src/portal/portal.tsx
function getRootElement(element) {
return DLOEKDPY_getDocument(element).body;
}
function getPortalElement(element, portalElement) {
if (!portalElement) {
return DLOEKDPY_getDocument(element).createElement("div");
}
if (typeof portalElement === "function") {
return portalElement(element);
}
return portalElement;
}
function getRandomId(prefix = "id") {
return `${prefix ? `${prefix}-` : ""}${Math.random().toString(36).substr(2, 6)}`;
}
function queueFocus(element) {
queueMicrotask(() => {
element == null ? void 0 : element.focus();
});
}
var usePortal = createHook(
(_a) => {
var _b = _a, {
preserveTabOrder,
preserveTabOrderAnchor,
portalElement,
portalRef,
portal = true
} = _b, props = __objRest(_b, [
"preserveTabOrder",
"preserveTabOrderAnchor",
"portalElement",
"portalRef",
"portal"
]);
const ref = (0,external_React_.useRef)(null);
const refProp = useMergeRefs(ref, props.ref);
const context = (0,external_React_.useContext)(PortalContext);
const [portalNode, setPortalNode] = (0,external_React_.useState)(null);
const [anchorPortalNode, setAnchorPortalNode] = (0,external_React_.useState)(null);
const outerBeforeRef = (0,external_React_.useRef)(null);
const innerBeforeRef = (0,external_React_.useRef)(null);
const innerAfterRef = (0,external_React_.useRef)(null);
const outerAfterRef = (0,external_React_.useRef)(null);
useSafeLayoutEffect(() => {
const element = ref.current;
if (!element || !portal) {
setPortalNode(null);
return;
}
const portalEl = getPortalElement(element, portalElement);
if (!portalEl) {
setPortalNode(null);
return;
}
const isPortalInDocument = portalEl.isConnected;
if (!isPortalInDocument) {
const rootElement = context || getRootElement(element);
rootElement.appendChild(portalEl);
}
if (!portalEl.id) {
portalEl.id = element.id ? `portal/${element.id}` : getRandomId();
}
setPortalNode(portalEl);
setRef(portalRef, portalEl);
if (isPortalInDocument)
return;
return () => {
portalEl.remove();
setRef(portalRef, null);
};
}, [portal, portalElement, context, portalRef]);
useSafeLayoutEffect(() => {
if (!preserveTabOrder)
return;
if (!preserveTabOrderAnchor)
return;
const doc = DLOEKDPY_getDocument(preserveTabOrderAnchor);
const element = doc.createElement("span");
element.style.position = "fixed";
preserveTabOrderAnchor.insertAdjacentElement("afterend", element);
setAnchorPortalNode(element);
return () => {
element.remove();
setAnchorPortalNode(null);
};
}, [preserveTabOrder, preserveTabOrderAnchor]);
(0,external_React_.useEffect)(() => {
if (!portalNode)
return;
if (!preserveTabOrder)
return;
let raf = 0;
const onFocus = (event) => {
if (!isFocusEventOutside(event))
return;
const focusing = event.type === "focusin";
cancelAnimationFrame(raf);
if (focusing) {
return restoreFocusIn(portalNode);
}
raf = requestAnimationFrame(() => {
disableFocusIn(portalNode, true);
});
};
portalNode.addEventListener("focusin", onFocus, true);
portalNode.addEventListener("focusout", onFocus, true);
return () => {
cancelAnimationFrame(raf);
portalNode.removeEventListener("focusin", onFocus, true);
portalNode.removeEventListener("focusout", onFocus, true);
};
}, [portalNode, preserveTabOrder]);
props = useWrapElement(
props,
(element) => {
element = // While the portal node is not in the DOM, we need to pass the
// current context to the portal context, otherwise it's going to
// reset to the body element on nested portals.
/* @__PURE__ */ (0,jsx_runtime.jsx)(PortalContext.Provider, { value: portalNode || context, children: element });
if (!portal)
return element;
if (!portalNode) {
return /* @__PURE__ */ (0,jsx_runtime.jsx)(
"span",
{
ref: refProp,
id: props.id,
style: { position: "fixed" },
hidden: true
}
);
}
element = /* @__PURE__ */ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [
preserveTabOrder && portalNode && /* @__PURE__ */ (0,jsx_runtime.jsx)(
FocusTrap,
{
ref: innerBeforeRef,
className: "__focus-trap-inner-before",
onFocus: (event) => {
if (isFocusEventOutside(event, portalNode)) {
queueFocus(getNextTabbable());
} else {
queueFocus(outerBeforeRef.current);
}
}
}
),
element,
preserveTabOrder && portalNode && /* @__PURE__ */ (0,jsx_runtime.jsx)(
FocusTrap,
{
ref: innerAfterRef,
className: "__focus-trap-inner-after",
onFocus: (event) => {
if (isFocusEventOutside(event, portalNode)) {
queueFocus(getPreviousTabbable());
} else {
queueFocus(outerAfterRef.current);
}
}
}
)
] });
if (portalNode) {
element = (0,external_ReactDOM_namespaceObject.createPortal)(element, portalNode);
}
let preserveTabOrderElement = /* @__PURE__ */ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [
preserveTabOrder && portalNode && /* @__PURE__ */ (0,jsx_runtime.jsx)(
FocusTrap,
{
ref: outerBeforeRef,
className: "__focus-trap-outer-before",
onFocus: (event) => {
const fromOuter = event.relatedTarget === outerAfterRef.current;
if (!fromOuter && isFocusEventOutside(event, portalNode)) {
queueFocus(innerBeforeRef.current);
} else {
queueFocus(getPreviousTabbable());
}
}
}
),
preserveTabOrder && // We're using position: fixed here so that the browser doesn't
// add margin to the element when setting gap on a parent element.
/* @__PURE__ */ (0,jsx_runtime.jsx)("span", { "aria-owns": portalNode == null ? void 0 : portalNode.id, style: { position: "fixed" } }),
preserveTabOrder && portalNode && /* @__PURE__ */ (0,jsx_runtime.jsx)(
FocusTrap,
{
ref: outerAfterRef,
className: "__focus-trap-outer-after",
onFocus: (event) => {
if (isFocusEventOutside(event, portalNode)) {
queueFocus(innerAfterRef.current);
} else {
const nextTabbable = getNextTabbable();
if (nextTabbable === innerBeforeRef.current) {
requestAnimationFrame(() => {
var _a2;
return (_a2 = getNextTabbable()) == null ? void 0 : _a2.focus();
});
return;
}
queueFocus(nextTabbable);
}
}
}
)
] });
if (anchorPortalNode && preserveTabOrder) {
preserveTabOrderElement = (0,external_ReactDOM_namespaceObject.createPortal)(
preserveTabOrderElement,
anchorPortalNode
);
}
return /* @__PURE__ */ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [
preserveTabOrderElement,
element
] });
},
[
portalNode,
context,
portal,
props.id,
preserveTabOrder,
anchorPortalNode
]
);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
ref: refProp
});
return props;
}
);
var Portal = createComponent((props) => {
const htmlProps = usePortal(props);
return _3ORBWXWF_createElement("div", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/NERBASET.js
"use client";
// src/dialog/dialog.tsx
var NERBASET_isSafariBrowser = isSafari();
function isAlreadyFocusingAnotherElement(dialog) {
const activeElement = getActiveElement();
if (!activeElement)
return false;
if (dialog && contains(dialog, activeElement))
return false;
if (isFocusable(activeElement))
return true;
return false;
}
function getElementFromProp(prop, focusable = false) {
if (!prop)
return null;
const element = "current" in prop ? prop.current : prop;
if (!element)
return null;
if (focusable)
return isFocusable(element) ? element : null;
return element;
}
var useDialog = createHook(
(_a) => {
var _b = _a, {
store: storeProp,
open: openProp,
onClose,
focusable = true,
modal = true,
portal = !!modal,
backdrop = !!modal,
backdropProps,
hideOnEscape = true,
hideOnInteractOutside = true,
getPersistentElements,
preventBodyScroll = !!modal,
autoFocusOnShow = true,
autoFocusOnHide = true,
initialFocus,
finalFocus,
unmountOnHide
} = _b, props = __objRest(_b, [
"store",
"open",
"onClose",
"focusable",
"modal",
"portal",
"backdrop",
"backdropProps",
"hideOnEscape",
"hideOnInteractOutside",
"getPersistentElements",
"preventBodyScroll",
"autoFocusOnShow",
"autoFocusOnHide",
"initialFocus",
"finalFocus",
"unmountOnHide"
]);
const context = useDialogProviderContext();
const ref = (0,external_React_.useRef)(null);
const store = useDialogStore({
store: storeProp || context,
open: openProp,
setOpen(open2) {
if (open2)
return;
const dialog = ref.current;
if (!dialog)
return;
const event = new Event("close", { bubbles: false, cancelable: true });
if (onClose) {
dialog.addEventListener("close", onClose, { once: true });
}
dialog.dispatchEvent(event);
if (!event.defaultPrevented)
return;
store.setOpen(true);
}
});
const { portalRef, domReady } = usePortalRef(portal, props.portalRef);
const preserveTabOrderProp = props.preserveTabOrder;
const preserveTabOrder = store.useState(
(state) => preserveTabOrderProp && !modal && state.mounted
);
const id = useId(props.id);
const open = store.useState("open");
const mounted = store.useState("mounted");
const contentElement = store.useState("contentElement");
const hidden = isHidden(mounted, props.hidden, props.alwaysVisible);
usePreventBodyScroll(contentElement, id, preventBodyScroll && !hidden);
useHideOnInteractOutside(store, hideOnInteractOutside, domReady);
const { wrapElement, nestedDialogs } = useNestedDialogs(store);
props = useWrapElement(props, wrapElement, [wrapElement]);
if (false) {}
useSafeLayoutEffect(() => {
if (!open)
return;
const dialog = ref.current;
const activeElement = getActiveElement(dialog, true);
if (!activeElement)
return;
if (activeElement.tagName === "BODY")
return;
if (dialog && contains(dialog, activeElement))
return;
store.setDisclosureElement(activeElement);
}, [store, open]);
if (NERBASET_isSafariBrowser) {
(0,external_React_.useEffect)(() => {
if (!mounted)
return;
const { disclosureElement } = store.getState();
if (!disclosureElement)
return;
if (!isButton(disclosureElement))
return;
const onMouseDown = () => {
let receivedFocus = false;
const onFocus = () => {
receivedFocus = true;
};
const options = { capture: true, once: true };
disclosureElement.addEventListener("focusin", onFocus, options);
queueBeforeEvent(disclosureElement, "mouseup", () => {
disclosureElement.removeEventListener("focusin", onFocus, true);
if (receivedFocus)
return;
focusIfNeeded(disclosureElement);
});
};
disclosureElement.addEventListener("mousedown", onMouseDown);
return () => {
disclosureElement.removeEventListener("mousedown", onMouseDown);
};
}, [store, mounted]);
}
(0,external_React_.useEffect)(() => {
if (!modal)
return;
if (!mounted)
return;
if (!domReady)
return;
const dialog = ref.current;
if (!dialog)
return;
const existingDismiss = dialog.querySelector("[data-dialog-dismiss]");
if (existingDismiss)
return;
return prependHiddenDismiss(dialog, store.hide);
}, [store, modal, mounted, domReady]);
useSafeLayoutEffect(() => {
if (open)
return;
if (!mounted)
return;
if (!domReady)
return;
const dialog = ref.current;
if (!dialog)
return;
return disableTree(dialog);
}, [open, mounted, domReady]);
const canTakeTreeSnapshot = open && domReady;
useSafeLayoutEffect(() => {
if (!id)
return;
if (!canTakeTreeSnapshot)
return;
const dialog = ref.current;
return createWalkTreeSnapshot(id, [dialog]);
}, [id, canTakeTreeSnapshot]);
const getPersistentElementsProp = useEvent(getPersistentElements);
useSafeLayoutEffect(() => {
if (!id)
return;
if (!canTakeTreeSnapshot)
return;
const { disclosureElement } = store.getState();
const dialog = ref.current;
const persistentElements = getPersistentElementsProp() || [];
const allElements = [
dialog,
...persistentElements,
...nestedDialogs.map((dialog2) => dialog2.getState().contentElement)
];
if (modal) {
return chain(
markTreeOutside(id, allElements),
disableTreeOutside(id, allElements)
);
}
return markTreeOutside(id, [disclosureElement, ...allElements]);
}, [
id,
store,
canTakeTreeSnapshot,
getPersistentElementsProp,
nestedDialogs,
modal
]);
const mayAutoFocusOnShow = !!autoFocusOnShow;
const autoFocusOnShowProp = useBooleanEvent(autoFocusOnShow);
const [autoFocusEnabled, setAutoFocusEnabled] = (0,external_React_.useState)(false);
(0,external_React_.useEffect)(() => {
if (!open)
return;
if (!mayAutoFocusOnShow)
return;
if (!domReady)
return;
if (!(contentElement == null ? void 0 : contentElement.isConnected))
return;
const element = getElementFromProp(initialFocus, true) || // If no initial focus is specified, we try to focus the first element
// with the autofocus attribute. If it's an Ariakit component, the
// Focusable component will consume the autoFocus prop and add the
// data-autofocus attribute to the element instead.
contentElement.querySelector(
"[data-autofocus=true],[autofocus]"
) || // We have to fallback to the first focusable element otherwise portaled
// dialogs with preserveTabOrder set to true will not receive focus
// properly because the elements aren't tabbable until the dialog
// receives focus.
getFirstTabbableIn(contentElement, true, portal && preserveTabOrder) || // Finally, we fallback to the dialog element itself.
contentElement;
const isElementFocusable = isFocusable(element);
if (!autoFocusOnShowProp(isElementFocusable ? element : null))
return;
setAutoFocusEnabled(true);
queueMicrotask(() => {
element.focus();
if (!NERBASET_isSafariBrowser)
return;
element.scrollIntoView({ block: "nearest", inline: "nearest" });
});
}, [
open,
mayAutoFocusOnShow,
domReady,
contentElement,
initialFocus,
portal,
preserveTabOrder,
autoFocusOnShowProp
]);
const mayAutoFocusOnHide = !!autoFocusOnHide;
const autoFocusOnHideProp = useBooleanEvent(autoFocusOnHide);
const [hasOpened, setHasOpened] = (0,external_React_.useState)(false);
(0,external_React_.useEffect)(() => {
if (!open)
return;
setHasOpened(true);
return () => setHasOpened(false);
}, [open]);
const focusOnHide = (0,external_React_.useCallback)(
(dialog, retry = true) => {
const { disclosureElement } = store.getState();
if (isAlreadyFocusingAnotherElement(dialog))
return;
let element = getElementFromProp(finalFocus) || disclosureElement;
if (element == null ? void 0 : element.id) {
const doc = DLOEKDPY_getDocument(element);
const selector = `[aria-activedescendant="${element.id}"]`;
const composite = doc.querySelector(selector);
if (composite) {
element = composite;
}
}
if (element && !isFocusable(element)) {
const maybeParentDialog = DLOEKDPY_closest(element, "[data-dialog]");
if (maybeParentDialog && maybeParentDialog.id) {
const doc = DLOEKDPY_getDocument(maybeParentDialog);
const selector = `[aria-controls~="${maybeParentDialog.id}"]`;
const control = doc.querySelector(selector);
if (control) {
element = control;
}
}
}
const isElementFocusable = element && isFocusable(element);
if (!isElementFocusable && retry) {
requestAnimationFrame(() => focusOnHide(dialog, false));
return;
}
if (!autoFocusOnHideProp(isElementFocusable ? element : null))
return;
if (!isElementFocusable)
return;
element == null ? void 0 : element.focus();
},
[store, finalFocus, autoFocusOnHideProp]
);
useSafeLayoutEffect(() => {
if (open)
return;
if (!hasOpened)
return;
if (!mayAutoFocusOnHide)
return;
const dialog = ref.current;
focusOnHide(dialog);
}, [open, hasOpened, domReady, mayAutoFocusOnHide, focusOnHide]);
(0,external_React_.useEffect)(() => {
if (!hasOpened)
return;
if (!mayAutoFocusOnHide)
return;
const dialog = ref.current;
return () => focusOnHide(dialog);
}, [hasOpened, mayAutoFocusOnHide, focusOnHide]);
const hideOnEscapeProp = useBooleanEvent(hideOnEscape);
(0,external_React_.useEffect)(() => {
if (!domReady)
return;
if (!mounted)
return;
const onKeyDown = (event) => {
if (event.key !== "Escape")
return;
if (event.defaultPrevented)
return;
const dialog = ref.current;
if (!dialog)
return;
if (isElementMarked(dialog))
return;
const target = event.target;
if (!target)
return;
const { disclosureElement } = store.getState();
const isValidTarget = () => {
if (target.tagName === "BODY")
return true;
if (contains(dialog, target))
return true;
if (!disclosureElement)
return true;
if (contains(disclosureElement, target))
return true;
return false;
};
if (!isValidTarget())
return;
if (!hideOnEscapeProp(event))
return;
store.hide();
};
return addGlobalEventListener("keydown", onKeyDown, true);
}, [store, domReady, mounted, hideOnEscapeProp]);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(HeadingLevel, { level: modal ? 1 : void 0, children: element }),
[modal]
);
const hiddenProp = props.hidden;
const alwaysVisible = props.alwaysVisible;
props = useWrapElement(
props,
(element) => {
if (!backdrop)
return element;
return /* @__PURE__ */ (0,jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [
/* @__PURE__ */ (0,jsx_runtime.jsx)(
DialogBackdrop,
{
store,
backdrop,
backdropProps,
hidden: hiddenProp,
alwaysVisible
}
),
element
] });
},
[store, backdrop, backdropProps, hiddenProp, alwaysVisible]
);
const [headingId, setHeadingId] = (0,external_React_.useState)();
const [descriptionId, setDescriptionId] = (0,external_React_.useState)();
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(DialogScopedContextProvider, { value: store, children: /* @__PURE__ */ (0,jsx_runtime.jsx)(DialogHeadingContext.Provider, { value: setHeadingId, children: /* @__PURE__ */ (0,jsx_runtime.jsx)(DialogDescriptionContext.Provider, { value: setDescriptionId, children: element }) }) }),
[store]
);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
id,
"data-dialog": "",
role: "dialog",
tabIndex: focusable ? -1 : void 0,
"aria-labelledby": headingId,
"aria-describedby": descriptionId
}, props), {
ref: useMergeRefs(ref, props.ref)
});
props = useFocusableContainer(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
autoFocusOnShow: autoFocusEnabled
}));
props = useDisclosureContent(_4R3V3JGP_spreadValues({ store }, props));
props = useFocusable(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { focusable }));
props = usePortal(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({ portal }, props), { portalRef, preserveTabOrder }));
return props;
}
);
function createDialogComponent(Component, useProviderContext = useDialogProviderContext) {
return createComponent((props) => {
const context = useProviderContext();
const store = props.store || context;
const mounted = useStoreState(
store,
(state) => !props.unmountOnHide || (state == null ? void 0 : state.mounted) || !!props.open
);
if (!mounted)
return null;
return /* @__PURE__ */ (0,jsx_runtime.jsx)(Component, _4R3V3JGP_spreadValues({}, props));
});
}
var Dialog = createDialogComponent(
createComponent((props) => {
const htmlProps = useDialog(props);
return _3ORBWXWF_createElement("div", htmlProps);
}),
useDialogProviderContext
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
const floating_ui_utils_sides = (/* unused pure expression or super */ null && (['top', 'right', 'bottom', 'left']));
const alignments = (/* unused pure expression or super */ null && (['start', 'end']));
const floating_ui_utils_placements = /*#__PURE__*/(/* unused pure expression or super */ null && (floating_ui_utils_sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), [])));
const floating_ui_utils_min = Math.min;
const floating_ui_utils_max = Math.max;
const round = Math.round;
const floor = Math.floor;
const createCoords = v => ({
x: v,
y: v
});
const oppositeSideMap = {
left: 'right',
right: 'left',
bottom: 'top',
top: 'bottom'
};
const oppositeAlignmentMap = {
start: 'end',
end: 'start'
};
function clamp(start, value, end) {
return floating_ui_utils_max(start, floating_ui_utils_min(value, end));
}
function floating_ui_utils_evaluate(value, param) {
return typeof value === 'function' ? value(param) : value;
}
function floating_ui_utils_getSide(placement) {
return placement.split('-')[0];
}
function floating_ui_utils_getAlignment(placement) {
return placement.split('-')[1];
}
function getOppositeAxis(axis) {
return axis === 'x' ? 'y' : 'x';
}
function getAxisLength(axis) {
return axis === 'y' ? 'height' : 'width';
}
function floating_ui_utils_getSideAxis(placement) {
return ['top', 'bottom'].includes(floating_ui_utils_getSide(placement)) ? 'y' : 'x';
}
function getAlignmentAxis(placement) {
return getOppositeAxis(floating_ui_utils_getSideAxis(placement));
}
function floating_ui_utils_getAlignmentSides(placement, rects, rtl) {
if (rtl === void 0) {
rtl = false;
}
const alignment = floating_ui_utils_getAlignment(placement);
const alignmentAxis = getAlignmentAxis(placement);
const length = getAxisLength(alignmentAxis);
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
if (rects.reference[length] > rects.floating[length]) {
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
}
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
}
function getExpandedPlacements(placement) {
const oppositePlacement = getOppositePlacement(placement);
return [floating_ui_utils_getOppositeAlignmentPlacement(placement), oppositePlacement, floating_ui_utils_getOppositeAlignmentPlacement(oppositePlacement)];
}
function floating_ui_utils_getOppositeAlignmentPlacement(placement) {
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
}
function getSideList(side, isStart, rtl) {
const lr = ['left', 'right'];
const rl = ['right', 'left'];
const tb = ['top', 'bottom'];
const bt = ['bottom', 'top'];
switch (side) {
case 'top':
case 'bottom':
if (rtl) return isStart ? rl : lr;
return isStart ? lr : rl;
case 'left':
case 'right':
return isStart ? tb : bt;
default:
return [];
}
}
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
const alignment = floating_ui_utils_getAlignment(placement);
let list = getSideList(floating_ui_utils_getSide(placement), direction === 'start', rtl);
if (alignment) {
list = list.map(side => side + "-" + alignment);
if (flipAlignment) {
list = list.concat(list.map(floating_ui_utils_getOppositeAlignmentPlacement));
}
}
return list;
}
function getOppositePlacement(placement) {
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
}
function expandPaddingObject(padding) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...padding
};
}
function floating_ui_utils_getPaddingObject(padding) {
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
top: padding,
right: padding,
bottom: padding,
left: padding
};
}
function floating_ui_utils_rectToClientRect(rect) {
return {
...rect,
top: rect.y,
left: rect.x,
right: rect.x + rect.width,
bottom: rect.y + rect.height
};
}
;// CONCATENATED MODULE: ./node_modules/@floating-ui/core/dist/floating-ui.core.mjs
function computeCoordsFromPlacement(_ref, placement, rtl) {
let {
reference,
floating
} = _ref;
const sideAxis = floating_ui_utils_getSideAxis(placement);
const alignmentAxis = getAlignmentAxis(placement);
const alignLength = getAxisLength(alignmentAxis);
const side = floating_ui_utils_getSide(placement);
const isVertical = sideAxis === 'y';
const commonX = reference.x + reference.width / 2 - floating.width / 2;
const commonY = reference.y + reference.height / 2 - floating.height / 2;
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
let coords;
switch (side) {
case 'top':
coords = {
x: commonX,
y: reference.y - floating.height
};
break;
case 'bottom':
coords = {
x: commonX,
y: reference.y + reference.height
};
break;
case 'right':
coords = {
x: reference.x + reference.width,
y: commonY
};
break;
case 'left':
coords = {
x: reference.x - floating.width,
y: commonY
};
break;
default:
coords = {
x: reference.x,
y: reference.y
};
}
switch (floating_ui_utils_getAlignment(placement)) {
case 'start':
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
break;
case 'end':
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
break;
}
return coords;
}
/**
* Computes the `x` and `y` coordinates that will place the floating element
* next to a reference element when it is given a certain positioning strategy.
*
* This export does not have any `platform` interface logic. You will need to
* write one for the platform you are using Floating UI with.
*/
const computePosition = async (reference, floating, config) => {
const {
placement = 'bottom',
strategy = 'absolute',
middleware = [],
platform
} = config;
const validMiddleware = middleware.filter(Boolean);
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
let rects = await platform.getElementRects({
reference,
floating,
strategy
});
let {
x,
y
} = computeCoordsFromPlacement(rects, placement, rtl);
let statefulPlacement = placement;
let middlewareData = {};
let resetCount = 0;
for (let i = 0; i < validMiddleware.length; i++) {
const {
name,
fn
} = validMiddleware[i];
const {
x: nextX,
y: nextY,
data,
reset
} = await fn({
x,
y,
initialPlacement: placement,
placement: statefulPlacement,
strategy,
middlewareData,
rects,
platform,
elements: {
reference,
floating
}
});
x = nextX != null ? nextX : x;
y = nextY != null ? nextY : y;
middlewareData = {
...middlewareData,
[name]: {
...middlewareData[name],
...data
}
};
if (reset && resetCount <= 50) {
resetCount++;
if (typeof reset === 'object') {
if (reset.placement) {
statefulPlacement = reset.placement;
}
if (reset.rects) {
rects = reset.rects === true ? await platform.getElementRects({
reference,
floating,
strategy
}) : reset.rects;
}
({
x,
y
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
}
i = -1;
continue;
}
}
return {
x,
y,
placement: statefulPlacement,
strategy,
middlewareData
};
};
/**
* Resolves with an object of overflow side offsets that determine how much the
* element is overflowing a given clipping boundary on each side.
* - positive = overflowing the boundary by that number of pixels
* - negative = how many pixels left before it will overflow
* - 0 = lies flush with the boundary
* @see https://floating-ui.com/docs/detectOverflow
*/
async function detectOverflow(state, options) {
var _await$platform$isEle;
if (options === void 0) {
options = {};
}
const {
x,
y,
platform,
rects,
elements,
strategy
} = state;
const {
boundary = 'clippingAncestors',
rootBoundary = 'viewport',
elementContext = 'floating',
altBoundary = false,
padding = 0
} = floating_ui_utils_evaluate(options, state);
const paddingObject = floating_ui_utils_getPaddingObject(padding);
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
const element = elements[altBoundary ? altContext : elementContext];
const clippingClientRect = floating_ui_utils_rectToClientRect(await platform.getClippingRect({
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
boundary,
rootBoundary,
strategy
}));
const rect = elementContext === 'floating' ? {
...rects.floating,
x,
y
} : rects.reference;
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
x: 1,
y: 1
} : {
x: 1,
y: 1
};
const elementClientRect = floating_ui_utils_rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
rect,
offsetParent,
strategy
}) : rect);
return {
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
};
}
/**
* Provides data to position an inner element of the floating element so that it
* appears centered to the reference element.
* @see https://floating-ui.com/docs/arrow
*/
const arrow = options => ({
name: 'arrow',
options,
async fn(state) {
const {
x,
y,
placement,
rects,
platform,
elements,
middlewareData
} = state;
// Since `element` is required, we don't Partial<> the type.
const {
element,
padding = 0
} = floating_ui_utils_evaluate(options, state) || {};
if (element == null) {
return {};
}
const paddingObject = floating_ui_utils_getPaddingObject(padding);
const coords = {
x,
y
};
const axis = getAlignmentAxis(placement);
const length = getAxisLength(axis);
const arrowDimensions = await platform.getDimensions(element);
const isYAxis = axis === 'y';
const minProp = isYAxis ? 'top' : 'left';
const maxProp = isYAxis ? 'bottom' : 'right';
const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
const startDiff = coords[axis] - rects.reference[axis];
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
// DOM platform can return `window` as the `offsetParent`.
if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
clientSize = elements.floating[clientProp] || rects.floating[length];
}
const centerToReference = endDiff / 2 - startDiff / 2;
// If the padding is large enough that it causes the arrow to no longer be
// centered, modify the padding so that it is centered.
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
const minPadding = floating_ui_utils_min(paddingObject[minProp], largestPossiblePadding);
const maxPadding = floating_ui_utils_min(paddingObject[maxProp], largestPossiblePadding);
// Make sure the arrow doesn't overflow the floating element if the center
// point is outside the floating element's bounds.
const min$1 = minPadding;
const max = clientSize - arrowDimensions[length] - maxPadding;
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
const offset = clamp(min$1, center, max);
// If the reference is small enough that the arrow's padding causes it to
// to point to nothing for an aligned placement, adjust the offset of the
// floating element itself. To ensure `shift()` continues to take action,
// a single reset is performed when this is true.
const shouldAddOffset = !middlewareData.arrow && floating_ui_utils_getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
return {
[axis]: coords[axis] + alignmentOffset,
data: {
[axis]: offset,
centerOffset: center - offset - alignmentOffset,
...(shouldAddOffset && {
alignmentOffset
})
},
reset: shouldAddOffset
};
}
});
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
return allowedPlacementsSortedByAlignment.filter(placement => {
if (alignment) {
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
}
return true;
});
}
/**
* Optimizes the visibility of the floating element by choosing the placement
* that has the most space available automatically, without needing to specify a
* preferred placement. Alternative to `flip`.
* @see https://floating-ui.com/docs/autoPlacement
*/
const autoPlacement = function (options) {
if (options === void 0) {
options = {};
}
return {
name: 'autoPlacement',
options,
async fn(state) {
var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
const {
rects,
middlewareData,
placement,
platform,
elements
} = state;
const {
crossAxis = false,
alignment,
allowedPlacements = placements,
autoAlignment = true,
...detectOverflowOptions
} = evaluate(options, state);
const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
const overflow = await detectOverflow(state, detectOverflowOptions);
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
const currentPlacement = placements$1[currentIndex];
if (currentPlacement == null) {
return {};
}
const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
// Make `computeCoords` start from the right place.
if (placement !== currentPlacement) {
return {
reset: {
placement: placements$1[0]
}
};
}
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
placement: currentPlacement,
overflows: currentOverflows
}];
const nextPlacement = placements$1[currentIndex + 1];
// There are more placements to check.
if (nextPlacement) {
return {
data: {
index: currentIndex + 1,
overflows: allOverflows
},
reset: {
placement: nextPlacement
}
};
}
const placementsSortedByMostSpace = allOverflows.map(d => {
const alignment = getAlignment(d.placement);
return [d.placement, alignment && crossAxis ?
// Check along the mainAxis and main crossAxis side.
d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
// Check only the mainAxis.
d.overflows[0], d.overflows];
}).sort((a, b) => a[1] - b[1]);
const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
// Aligned placements should not check their opposite crossAxis
// side.
getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
if (resetPlacement !== placement) {
return {
data: {
index: currentIndex + 1,
overflows: allOverflows
},
reset: {
placement: resetPlacement
}
};
}
return {};
}
};
};
/**
* Optimizes the visibility of the floating element by flipping the `placement`
* in order to keep it in view when the preferred placement(s) will overflow the
* clipping boundary. Alternative to `autoPlacement`.
* @see https://floating-ui.com/docs/flip
*/
const flip = function (options) {
if (options === void 0) {
options = {};
}
return {
name: 'flip',
options,
async fn(state) {
var _middlewareData$arrow, _middlewareData$flip;
const {
placement,
middlewareData,
rects,
initialPlacement,
platform,
elements
} = state;
const {
mainAxis: checkMainAxis = true,
crossAxis: checkCrossAxis = true,
fallbackPlacements: specifiedFallbackPlacements,
fallbackStrategy = 'bestFit',
fallbackAxisSideDirection = 'none',
flipAlignment = true,
...detectOverflowOptions
} = floating_ui_utils_evaluate(options, state);
// If a reset by the arrow was caused due to an alignment offset being
// added, we should skip any logic now since `flip()` has already done its
// work.
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
return {};
}
const side = floating_ui_utils_getSide(placement);
const isBasePlacement = floating_ui_utils_getSide(initialPlacement) === initialPlacement;
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
}
const placements = [initialPlacement, ...fallbackPlacements];
const overflow = await detectOverflow(state, detectOverflowOptions);
const overflows = [];
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
if (checkMainAxis) {
overflows.push(overflow[side]);
}
if (checkCrossAxis) {
const sides = floating_ui_utils_getAlignmentSides(placement, rects, rtl);
overflows.push(overflow[sides[0]], overflow[sides[1]]);
}
overflowsData = [...overflowsData, {
placement,
overflows
}];
// One or more sides is overflowing.
if (!overflows.every(side => side <= 0)) {
var _middlewareData$flip2, _overflowsData$filter;
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
const nextPlacement = placements[nextIndex];
if (nextPlacement) {
// Try next placement and re-run the lifecycle.
return {
data: {
index: nextIndex,
overflows: overflowsData
},
reset: {
placement: nextPlacement
}
};
}
// First, find the candidates that fit on the mainAxis side of overflow,
// then find the placement that fits the best on the main crossAxis side.
let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
// Otherwise fallback.
if (!resetPlacement) {
switch (fallbackStrategy) {
case 'bestFit':
{
var _overflowsData$map$so;
const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
if (placement) {
resetPlacement = placement;
}
break;
}
case 'initialPlacement':
resetPlacement = initialPlacement;
break;
}
}
if (placement !== resetPlacement) {
return {
reset: {
placement: resetPlacement
}
};
}
}
return {};
}
};
};
function getSideOffsets(overflow, rect) {
return {
top: overflow.top - rect.height,
right: overflow.right - rect.width,
bottom: overflow.bottom - rect.height,
left: overflow.left - rect.width
};
}
function isAnySideFullyClipped(overflow) {
return sides.some(side => overflow[side] >= 0);
}
/**
* Provides data to hide the floating element in applicable situations, such as
* when it is not in the same clipping context as the reference element.
* @see https://floating-ui.com/docs/hide
*/
const hide = function (options) {
if (options === void 0) {
options = {};
}
return {
name: 'hide',
options,
async fn(state) {
const {
rects
} = state;
const {
strategy = 'referenceHidden',
...detectOverflowOptions
} = evaluate(options, state);
switch (strategy) {
case 'referenceHidden':
{
const overflow = await detectOverflow(state, {
...detectOverflowOptions,
elementContext: 'reference'
});
const offsets = getSideOffsets(overflow, rects.reference);
return {
data: {
referenceHiddenOffsets: offsets,
referenceHidden: isAnySideFullyClipped(offsets)
}
};
}
case 'escaped':
{
const overflow = await detectOverflow(state, {
...detectOverflowOptions,
altBoundary: true
});
const offsets = getSideOffsets(overflow, rects.floating);
return {
data: {
escapedOffsets: offsets,
escaped: isAnySideFullyClipped(offsets)
}
};
}
default:
{
return {};
}
}
}
};
};
function getBoundingRect(rects) {
const minX = min(...rects.map(rect => rect.left));
const minY = min(...rects.map(rect => rect.top));
const maxX = max(...rects.map(rect => rect.right));
const maxY = max(...rects.map(rect => rect.bottom));
return {
x: minX,
y: minY,
width: maxX - minX,
height: maxY - minY
};
}
function getRectsByLine(rects) {
const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
const groups = [];
let prevRect = null;
for (let i = 0; i < sortedRects.length; i++) {
const rect = sortedRects[i];
if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
groups.push([rect]);
} else {
groups[groups.length - 1].push(rect);
}
prevRect = rect;
}
return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
}
/**
* Provides improved positioning for inline reference elements that can span
* over multiple lines, such as hyperlinks or range selections.
* @see https://floating-ui.com/docs/inline
*/
const inline = function (options) {
if (options === void 0) {
options = {};
}
return {
name: 'inline',
options,
async fn(state) {
const {
placement,
elements,
rects,
platform,
strategy
} = state;
// A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
// ClientRect's bounds, despite the event listener being triggered. A
// padding of 2 seems to handle this issue.
const {
padding = 2,
x,
y
} = evaluate(options, state);
const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
const clientRects = getRectsByLine(nativeClientRects);
const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
const paddingObject = getPaddingObject(padding);
function getBoundingClientRect() {
// There are two rects and they are disjoined.
if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
// Find the first rect in which the point is fully inside.
return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
}
// There are 2 or more connected rects.
if (clientRects.length >= 2) {
if (getSideAxis(placement) === 'y') {
const firstRect = clientRects[0];
const lastRect = clientRects[clientRects.length - 1];
const isTop = getSide(placement) === 'top';
const top = firstRect.top;
const bottom = lastRect.bottom;
const left = isTop ? firstRect.left : lastRect.left;
const right = isTop ? firstRect.right : lastRect.right;
const width = right - left;
const height = bottom - top;
return {
top,
bottom,
left,
right,
width,
height,
x: left,
y: top
};
}
const isLeftSide = getSide(placement) === 'left';
const maxRight = max(...clientRects.map(rect => rect.right));
const minLeft = min(...clientRects.map(rect => rect.left));
const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
const top = measureRects[0].top;
const bottom = measureRects[measureRects.length - 1].bottom;
const left = minLeft;
const right = maxRight;
const width = right - left;
const height = bottom - top;
return {
top,
bottom,
left,
right,
width,
height,
x: left,
y: top
};
}
return fallback;
}
const resetRects = await platform.getElementRects({
reference: {
getBoundingClientRect
},
floating: elements.floating,
strategy
});
if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
return {
reset: {
rects: resetRects
}
};
}
return {};
}
};
};
// For type backwards-compatibility, the `OffsetOptions` type was also
// Derivable.
async function convertValueToCoords(state, options) {
const {
placement,
platform,
elements
} = state;
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
const side = floating_ui_utils_getSide(placement);
const alignment = floating_ui_utils_getAlignment(placement);
const isVertical = floating_ui_utils_getSideAxis(placement) === 'y';
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
const crossAxisMulti = rtl && isVertical ? -1 : 1;
const rawValue = floating_ui_utils_evaluate(options, state);
// eslint-disable-next-line prefer-const
let {
mainAxis,
crossAxis,
alignmentAxis
} = typeof rawValue === 'number' ? {
mainAxis: rawValue,
crossAxis: 0,
alignmentAxis: null
} : {
mainAxis: 0,
crossAxis: 0,
alignmentAxis: null,
...rawValue
};
if (alignment && typeof alignmentAxis === 'number') {
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
}
return isVertical ? {
x: crossAxis * crossAxisMulti,
y: mainAxis * mainAxisMulti
} : {
x: mainAxis * mainAxisMulti,
y: crossAxis * crossAxisMulti
};
}
/**
* Modifies the placement by translating the floating element along the
* specified axes.
* A number (shorthand for `mainAxis` or distance), or an axes configuration
* object may be passed.
* @see https://floating-ui.com/docs/offset
*/
const offset = function (options) {
if (options === void 0) {
options = 0;
}
return {
name: 'offset',
options,
async fn(state) {
const {
x,
y
} = state;
const diffCoords = await convertValueToCoords(state, options);
return {
x: x + diffCoords.x,
y: y + diffCoords.y,
data: diffCoords
};
}
};
};
/**
* Optimizes the visibility of the floating element by shifting it in order to
* keep it in view when it will overflow the clipping boundary.
* @see https://floating-ui.com/docs/shift
*/
const shift = function (options) {
if (options === void 0) {
options = {};
}
return {
name: 'shift',
options,
async fn(state) {
const {
x,
y,
placement
} = state;
const {
mainAxis: checkMainAxis = true,
crossAxis: checkCrossAxis = false,
limiter = {
fn: _ref => {
let {
x,
y
} = _ref;
return {
x,
y
};
}
},
...detectOverflowOptions
} = floating_ui_utils_evaluate(options, state);
const coords = {
x,
y
};
const overflow = await detectOverflow(state, detectOverflowOptions);
const crossAxis = floating_ui_utils_getSideAxis(floating_ui_utils_getSide(placement));
const mainAxis = getOppositeAxis(crossAxis);
let mainAxisCoord = coords[mainAxis];
let crossAxisCoord = coords[crossAxis];
if (checkMainAxis) {
const minSide = mainAxis === 'y' ? 'top' : 'left';
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
const min = mainAxisCoord + overflow[minSide];
const max = mainAxisCoord - overflow[maxSide];
mainAxisCoord = clamp(min, mainAxisCoord, max);
}
if (checkCrossAxis) {
const minSide = crossAxis === 'y' ? 'top' : 'left';
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
const min = crossAxisCoord + overflow[minSide];
const max = crossAxisCoord - overflow[maxSide];
crossAxisCoord = clamp(min, crossAxisCoord, max);
}
const limitedCoords = limiter.fn({
...state,
[mainAxis]: mainAxisCoord,
[crossAxis]: crossAxisCoord
});
return {
...limitedCoords,
data: {
x: limitedCoords.x - x,
y: limitedCoords.y - y
}
};
}
};
};
/**
* Built-in `limiter` that will stop `shift()` at a certain point.
*/
const limitShift = function (options) {
if (options === void 0) {
options = {};
}
return {
options,
fn(state) {
const {
x,
y,
placement,
rects,
middlewareData
} = state;
const {
offset = 0,
mainAxis: checkMainAxis = true,
crossAxis: checkCrossAxis = true
} = floating_ui_utils_evaluate(options, state);
const coords = {
x,
y
};
const crossAxis = floating_ui_utils_getSideAxis(placement);
const mainAxis = getOppositeAxis(crossAxis);
let mainAxisCoord = coords[mainAxis];
let crossAxisCoord = coords[crossAxis];
const rawOffset = floating_ui_utils_evaluate(offset, state);
const computedOffset = typeof rawOffset === 'number' ? {
mainAxis: rawOffset,
crossAxis: 0
} : {
mainAxis: 0,
crossAxis: 0,
...rawOffset
};
if (checkMainAxis) {
const len = mainAxis === 'y' ? 'height' : 'width';
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
if (mainAxisCoord < limitMin) {
mainAxisCoord = limitMin;
} else if (mainAxisCoord > limitMax) {
mainAxisCoord = limitMax;
}
}
if (checkCrossAxis) {
var _middlewareData$offse, _middlewareData$offse2;
const len = mainAxis === 'y' ? 'width' : 'height';
const isOriginSide = ['top', 'left'].includes(floating_ui_utils_getSide(placement));
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
if (crossAxisCoord < limitMin) {
crossAxisCoord = limitMin;
} else if (crossAxisCoord > limitMax) {
crossAxisCoord = limitMax;
}
}
return {
[mainAxis]: mainAxisCoord,
[crossAxis]: crossAxisCoord
};
}
};
};
/**
* Provides data that allows you to change the size of the floating element —
* for instance, prevent it from overflowing the clipping boundary or match the
* width of the reference element.
* @see https://floating-ui.com/docs/size
*/
const size = function (options) {
if (options === void 0) {
options = {};
}
return {
name: 'size',
options,
async fn(state) {
const {
placement,
rects,
platform,
elements
} = state;
const {
apply = () => {},
...detectOverflowOptions
} = floating_ui_utils_evaluate(options, state);
const overflow = await detectOverflow(state, detectOverflowOptions);
const side = floating_ui_utils_getSide(placement);
const alignment = floating_ui_utils_getAlignment(placement);
const isYAxis = floating_ui_utils_getSideAxis(placement) === 'y';
const {
width,
height
} = rects.floating;
let heightSide;
let widthSide;
if (side === 'top' || side === 'bottom') {
heightSide = side;
widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
} else {
widthSide = side;
heightSide = alignment === 'end' ? 'top' : 'bottom';
}
const overflowAvailableHeight = height - overflow[heightSide];
const overflowAvailableWidth = width - overflow[widthSide];
const noShift = !state.middlewareData.shift;
let availableHeight = overflowAvailableHeight;
let availableWidth = overflowAvailableWidth;
if (isYAxis) {
const maximumClippingWidth = width - overflow.left - overflow.right;
availableWidth = alignment || noShift ? floating_ui_utils_min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
} else {
const maximumClippingHeight = height - overflow.top - overflow.bottom;
availableHeight = alignment || noShift ? floating_ui_utils_min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
}
if (noShift && !alignment) {
const xMin = floating_ui_utils_max(overflow.left, 0);
const xMax = floating_ui_utils_max(overflow.right, 0);
const yMin = floating_ui_utils_max(overflow.top, 0);
const yMax = floating_ui_utils_max(overflow.bottom, 0);
if (isYAxis) {
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : floating_ui_utils_max(overflow.left, overflow.right));
} else {
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : floating_ui_utils_max(overflow.top, overflow.bottom));
}
}
await apply({
...state,
availableWidth,
availableHeight
});
const nextDimensions = await platform.getDimensions(elements.floating);
if (width !== nextDimensions.width || height !== nextDimensions.height) {
return {
reset: {
rects: true
}
};
}
return {};
}
};
};
;// CONCATENATED MODULE: ./node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
/**
* Custom positioning reference element.
* @see https://floating-ui.com/docs/virtual-elements
*/
const dist_floating_ui_utils_sides = (/* unused pure expression or super */ null && (['top', 'right', 'bottom', 'left']));
const floating_ui_utils_alignments = (/* unused pure expression or super */ null && (['start', 'end']));
const dist_floating_ui_utils_placements = /*#__PURE__*/(/* unused pure expression or super */ null && (dist_floating_ui_utils_sides.reduce((acc, side) => acc.concat(side, side + "-" + floating_ui_utils_alignments[0], side + "-" + floating_ui_utils_alignments[1]), [])));
const dist_floating_ui_utils_min = Math.min;
const dist_floating_ui_utils_max = Math.max;
const floating_ui_utils_round = Math.round;
const floating_ui_utils_floor = Math.floor;
const floating_ui_utils_createCoords = v => ({
x: v,
y: v
});
const floating_ui_utils_oppositeSideMap = {
left: 'right',
right: 'left',
bottom: 'top',
top: 'bottom'
};
const floating_ui_utils_oppositeAlignmentMap = {
start: 'end',
end: 'start'
};
function floating_ui_utils_clamp(start, value, end) {
return dist_floating_ui_utils_max(start, dist_floating_ui_utils_min(value, end));
}
function dist_floating_ui_utils_evaluate(value, param) {
return typeof value === 'function' ? value(param) : value;
}
function dist_floating_ui_utils_getSide(placement) {
return placement.split('-')[0];
}
function dist_floating_ui_utils_getAlignment(placement) {
return placement.split('-')[1];
}
function floating_ui_utils_getOppositeAxis(axis) {
return axis === 'x' ? 'y' : 'x';
}
function floating_ui_utils_getAxisLength(axis) {
return axis === 'y' ? 'height' : 'width';
}
function dist_floating_ui_utils_getSideAxis(placement) {
return ['top', 'bottom'].includes(dist_floating_ui_utils_getSide(placement)) ? 'y' : 'x';
}
function floating_ui_utils_getAlignmentAxis(placement) {
return floating_ui_utils_getOppositeAxis(dist_floating_ui_utils_getSideAxis(placement));
}
function dist_floating_ui_utils_getAlignmentSides(placement, rects, rtl) {
if (rtl === void 0) {
rtl = false;
}
const alignment = dist_floating_ui_utils_getAlignment(placement);
const alignmentAxis = floating_ui_utils_getAlignmentAxis(placement);
const length = floating_ui_utils_getAxisLength(alignmentAxis);
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
if (rects.reference[length] > rects.floating[length]) {
mainAlignmentSide = floating_ui_utils_getOppositePlacement(mainAlignmentSide);
}
return [mainAlignmentSide, floating_ui_utils_getOppositePlacement(mainAlignmentSide)];
}
function floating_ui_utils_getExpandedPlacements(placement) {
const oppositePlacement = floating_ui_utils_getOppositePlacement(placement);
return [dist_floating_ui_utils_getOppositeAlignmentPlacement(placement), oppositePlacement, dist_floating_ui_utils_getOppositeAlignmentPlacement(oppositePlacement)];
}
function dist_floating_ui_utils_getOppositeAlignmentPlacement(placement) {
return placement.replace(/start|end/g, alignment => floating_ui_utils_oppositeAlignmentMap[alignment]);
}
function floating_ui_utils_getSideList(side, isStart, rtl) {
const lr = ['left', 'right'];
const rl = ['right', 'left'];
const tb = ['top', 'bottom'];
const bt = ['bottom', 'top'];
switch (side) {
case 'top':
case 'bottom':
if (rtl) return isStart ? rl : lr;
return isStart ? lr : rl;
case 'left':
case 'right':
return isStart ? tb : bt;
default:
return [];
}
}
function floating_ui_utils_getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
const alignment = dist_floating_ui_utils_getAlignment(placement);
let list = floating_ui_utils_getSideList(dist_floating_ui_utils_getSide(placement), direction === 'start', rtl);
if (alignment) {
list = list.map(side => side + "-" + alignment);
if (flipAlignment) {
list = list.concat(list.map(dist_floating_ui_utils_getOppositeAlignmentPlacement));
}
}
return list;
}
function floating_ui_utils_getOppositePlacement(placement) {
return placement.replace(/left|right|bottom|top/g, side => floating_ui_utils_oppositeSideMap[side]);
}
function floating_ui_utils_expandPaddingObject(padding) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...padding
};
}
function dist_floating_ui_utils_getPaddingObject(padding) {
return typeof padding !== 'number' ? floating_ui_utils_expandPaddingObject(padding) : {
top: padding,
right: padding,
bottom: padding,
left: padding
};
}
function dist_floating_ui_utils_rectToClientRect(rect) {
return {
...rect,
top: rect.y,
left: rect.x,
right: rect.x + rect.width,
bottom: rect.y + rect.height
};
}
;// CONCATENATED MODULE: ./node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
function getNodeName(node) {
if (isNode(node)) {
return (node.nodeName || '').toLowerCase();
}
// Mocked nodes in testing environments may not be instances of Node. By
// returning `#document` an infinite loop won't occur.
// https://github.com/floating-ui/floating-ui/issues/2317
return '#document';
}
function floating_ui_utils_dom_getWindow(node) {
var _node$ownerDocument;
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
}
function getDocumentElement(node) {
var _ref;
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
}
function isNode(value) {
return value instanceof Node || value instanceof floating_ui_utils_dom_getWindow(value).Node;
}
function isElement(value) {
return value instanceof Element || value instanceof floating_ui_utils_dom_getWindow(value).Element;
}
function isHTMLElement(value) {
return value instanceof HTMLElement || value instanceof floating_ui_utils_dom_getWindow(value).HTMLElement;
}
function isShadowRoot(value) {
// Browsers without `ShadowRoot` support.
if (typeof ShadowRoot === 'undefined') {
return false;
}
return value instanceof ShadowRoot || value instanceof floating_ui_utils_dom_getWindow(value).ShadowRoot;
}
function isOverflowElement(element) {
const {
overflow,
overflowX,
overflowY,
display
} = floating_ui_utils_dom_getComputedStyle(element);
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
}
function isTableElement(element) {
return ['table', 'td', 'th'].includes(getNodeName(element));
}
function isContainingBlock(element) {
const webkit = isWebKit();
const css = floating_ui_utils_dom_getComputedStyle(element);
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
}
function getContainingBlock(element) {
let currentNode = getParentNode(element);
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
if (isContainingBlock(currentNode)) {
return currentNode;
} else {
currentNode = getParentNode(currentNode);
}
}
return null;
}
function isWebKit() {
if (typeof CSS === 'undefined' || !CSS.supports) return false;
return CSS.supports('-webkit-backdrop-filter', 'none');
}
function isLastTraversableNode(node) {
return ['html', 'body', '#document'].includes(getNodeName(node));
}
function floating_ui_utils_dom_getComputedStyle(element) {
return floating_ui_utils_dom_getWindow(element).getComputedStyle(element);
}
function getNodeScroll(element) {
if (isElement(element)) {
return {
scrollLeft: element.scrollLeft,
scrollTop: element.scrollTop
};
}
return {
scrollLeft: element.pageXOffset,
scrollTop: element.pageYOffset
};
}
function getParentNode(node) {
if (getNodeName(node) === 'html') {
return node;
}
const result =
// Step into the shadow DOM of the parent of a slotted node.
node.assignedSlot ||
// DOM Element detected.
node.parentNode ||
// ShadowRoot detected.
isShadowRoot(node) && node.host ||
// Fallback.
getDocumentElement(node);
return isShadowRoot(result) ? result.host : result;
}
function getNearestOverflowAncestor(node) {
const parentNode = getParentNode(node);
if (isLastTraversableNode(parentNode)) {
return node.ownerDocument ? node.ownerDocument.body : node.body;
}
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
return parentNode;
}
return getNearestOverflowAncestor(parentNode);
}
function getOverflowAncestors(node, list, traverseIframes) {
var _node$ownerDocument2;
if (list === void 0) {
list = [];
}
if (traverseIframes === void 0) {
traverseIframes = true;
}
const scrollableAncestor = getNearestOverflowAncestor(node);
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
const win = floating_ui_utils_dom_getWindow(scrollableAncestor);
if (isBody) {
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
}
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
}
;// CONCATENATED MODULE: ./node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
function getCssDimensions(element) {
const css = floating_ui_utils_dom_getComputedStyle(element);
// In testing environments, the `width` and `height` properties are empty
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
let width = parseFloat(css.width) || 0;
let height = parseFloat(css.height) || 0;
const hasOffset = isHTMLElement(element);
const offsetWidth = hasOffset ? element.offsetWidth : width;
const offsetHeight = hasOffset ? element.offsetHeight : height;
const shouldFallback = floating_ui_utils_round(width) !== offsetWidth || floating_ui_utils_round(height) !== offsetHeight;
if (shouldFallback) {
width = offsetWidth;
height = offsetHeight;
}
return {
width,
height,
$: shouldFallback
};
}
function unwrapElement(element) {
return !isElement(element) ? element.contextElement : element;
}
function getScale(element) {
const domElement = unwrapElement(element);
if (!isHTMLElement(domElement)) {
return floating_ui_utils_createCoords(1);
}
const rect = domElement.getBoundingClientRect();
const {
width,
height,
$
} = getCssDimensions(domElement);
let x = ($ ? floating_ui_utils_round(rect.width) : rect.width) / width;
let y = ($ ? floating_ui_utils_round(rect.height) : rect.height) / height;
// 0, NaN, or Infinity should always fallback to 1.
if (!x || !Number.isFinite(x)) {
x = 1;
}
if (!y || !Number.isFinite(y)) {
y = 1;
}
return {
x,
y
};
}
const noOffsets = /*#__PURE__*/floating_ui_utils_createCoords(0);
function getVisualOffsets(element) {
const win = floating_ui_utils_dom_getWindow(element);
if (!isWebKit() || !win.visualViewport) {
return noOffsets;
}
return {
x: win.visualViewport.offsetLeft,
y: win.visualViewport.offsetTop
};
}
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
if (isFixed === void 0) {
isFixed = false;
}
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== floating_ui_utils_dom_getWindow(element)) {
return false;
}
return isFixed;
}
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
if (includeScale === void 0) {
includeScale = false;
}
if (isFixedStrategy === void 0) {
isFixedStrategy = false;
}
const clientRect = element.getBoundingClientRect();
const domElement = unwrapElement(element);
let scale = floating_ui_utils_createCoords(1);
if (includeScale) {
if (offsetParent) {
if (isElement(offsetParent)) {
scale = getScale(offsetParent);
}
} else {
scale = getScale(element);
}
}
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : floating_ui_utils_createCoords(0);
let x = (clientRect.left + visualOffsets.x) / scale.x;
let y = (clientRect.top + visualOffsets.y) / scale.y;
let width = clientRect.width / scale.x;
let height = clientRect.height / scale.y;
if (domElement) {
const win = floating_ui_utils_dom_getWindow(domElement);
const offsetWin = offsetParent && isElement(offsetParent) ? floating_ui_utils_dom_getWindow(offsetParent) : offsetParent;
let currentWin = win;
let currentIFrame = currentWin.frameElement;
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
const iframeScale = getScale(currentIFrame);
const iframeRect = currentIFrame.getBoundingClientRect();
const css = floating_ui_utils_dom_getComputedStyle(currentIFrame);
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
x *= iframeScale.x;
y *= iframeScale.y;
width *= iframeScale.x;
height *= iframeScale.y;
x += left;
y += top;
currentWin = floating_ui_utils_dom_getWindow(currentIFrame);
currentIFrame = currentWin.frameElement;
}
}
return floating_ui_utils_rectToClientRect({
width,
height,
x,
y
});
}
const topLayerSelectors = [':popover-open', ':modal'];
function isTopLayer(floating) {
return topLayerSelectors.some(selector => {
try {
return floating.matches(selector);
} catch (e) {
return false;
}
});
}
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
let {
elements,
rect,
offsetParent,
strategy
} = _ref;
const isFixed = strategy === 'fixed';
const documentElement = getDocumentElement(offsetParent);
const topLayer = elements ? isTopLayer(elements.floating) : false;
if (offsetParent === documentElement || topLayer && isFixed) {
return rect;
}
let scroll = {
scrollLeft: 0,
scrollTop: 0
};
let scale = floating_ui_utils_createCoords(1);
const offsets = floating_ui_utils_createCoords(0);
const isOffsetParentAnElement = isHTMLElement(offsetParent);
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isHTMLElement(offsetParent)) {
const offsetRect = getBoundingClientRect(offsetParent);
scale = getScale(offsetParent);
offsets.x = offsetRect.x + offsetParent.clientLeft;
offsets.y = offsetRect.y + offsetParent.clientTop;
}
}
return {
width: rect.width * scale.x,
height: rect.height * scale.y,
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
};
}
function getClientRects(element) {
return Array.from(element.getClientRects());
}
function getWindowScrollBarX(element) {
// If <html> has a CSS width greater than the viewport, then this will be
// incorrect for RTL.
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
}
// Gets the entire size of the scrollable document area, even extending outside
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
function getDocumentRect(element) {
const html = getDocumentElement(element);
const scroll = getNodeScroll(element);
const body = element.ownerDocument.body;
const width = dist_floating_ui_utils_max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
const height = dist_floating_ui_utils_max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
const y = -scroll.scrollTop;
if (floating_ui_utils_dom_getComputedStyle(body).direction === 'rtl') {
x += dist_floating_ui_utils_max(html.clientWidth, body.clientWidth) - width;
}
return {
width,
height,
x,
y
};
}
function getViewportRect(element, strategy) {
const win = floating_ui_utils_dom_getWindow(element);
const html = getDocumentElement(element);
const visualViewport = win.visualViewport;
let width = html.clientWidth;
let height = html.clientHeight;
let x = 0;
let y = 0;
if (visualViewport) {
width = visualViewport.width;
height = visualViewport.height;
const visualViewportBased = isWebKit();
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
x = visualViewport.offsetLeft;
y = visualViewport.offsetTop;
}
}
return {
width,
height,
x,
y
};
}
// Returns the inner client rect, subtracting scrollbars if present.
function getInnerBoundingClientRect(element, strategy) {
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
const top = clientRect.top + element.clientTop;
const left = clientRect.left + element.clientLeft;
const scale = isHTMLElement(element) ? getScale(element) : floating_ui_utils_createCoords(1);
const width = element.clientWidth * scale.x;
const height = element.clientHeight * scale.y;
const x = left * scale.x;
const y = top * scale.y;
return {
width,
height,
x,
y
};
}
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
let rect;
if (clippingAncestor === 'viewport') {
rect = getViewportRect(element, strategy);
} else if (clippingAncestor === 'document') {
rect = getDocumentRect(getDocumentElement(element));
} else if (isElement(clippingAncestor)) {
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
} else {
const visualOffsets = getVisualOffsets(element);
rect = {
...clippingAncestor,
x: clippingAncestor.x - visualOffsets.x,
y: clippingAncestor.y - visualOffsets.y
};
}
return floating_ui_utils_rectToClientRect(rect);
}
function hasFixedPositionAncestor(element, stopNode) {
const parentNode = getParentNode(element);
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
return false;
}
return floating_ui_utils_dom_getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
}
// A "clipping ancestor" is an `overflow` element with the characteristic of
// clipping (or hiding) child elements. This returns all clipping ancestors
// of the given element up the tree.
function getClippingElementAncestors(element, cache) {
const cachedResult = cache.get(element);
if (cachedResult) {
return cachedResult;
}
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
let currentContainingBlockComputedStyle = null;
const elementIsFixed = floating_ui_utils_dom_getComputedStyle(element).position === 'fixed';
let currentNode = elementIsFixed ? getParentNode(element) : element;
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
const computedStyle = floating_ui_utils_dom_getComputedStyle(currentNode);
const currentNodeIsContaining = isContainingBlock(currentNode);
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
currentContainingBlockComputedStyle = null;
}
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
if (shouldDropCurrentNode) {
// Drop non-containing blocks.
result = result.filter(ancestor => ancestor !== currentNode);
} else {
// Record last containing block for next iteration.
currentContainingBlockComputedStyle = computedStyle;
}
currentNode = getParentNode(currentNode);
}
cache.set(element, result);
return result;
}
// Gets the maximum area that the element is visible in due to any number of
// clipping ancestors.
function getClippingRect(_ref) {
let {
element,
boundary,
rootBoundary,
strategy
} = _ref;
const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
const firstClippingAncestor = clippingAncestors[0];
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
accRect.top = dist_floating_ui_utils_max(rect.top, accRect.top);
accRect.right = dist_floating_ui_utils_min(rect.right, accRect.right);
accRect.bottom = dist_floating_ui_utils_min(rect.bottom, accRect.bottom);
accRect.left = dist_floating_ui_utils_max(rect.left, accRect.left);
return accRect;
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
return {
width: clippingRect.right - clippingRect.left,
height: clippingRect.bottom - clippingRect.top,
x: clippingRect.left,
y: clippingRect.top
};
}
function getDimensions(element) {
const {
width,
height
} = getCssDimensions(element);
return {
width,
height
};
}
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
const isOffsetParentAnElement = isHTMLElement(offsetParent);
const documentElement = getDocumentElement(offsetParent);
const isFixed = strategy === 'fixed';
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
let scroll = {
scrollLeft: 0,
scrollTop: 0
};
const offsets = floating_ui_utils_createCoords(0);
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isOffsetParentAnElement) {
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
offsets.x = offsetRect.x + offsetParent.clientLeft;
offsets.y = offsetRect.y + offsetParent.clientTop;
} else if (documentElement) {
offsets.x = getWindowScrollBarX(documentElement);
}
}
const x = rect.left + scroll.scrollLeft - offsets.x;
const y = rect.top + scroll.scrollTop - offsets.y;
return {
x,
y,
width: rect.width,
height: rect.height
};
}
function getTrueOffsetParent(element, polyfill) {
if (!isHTMLElement(element) || floating_ui_utils_dom_getComputedStyle(element).position === 'fixed') {
return null;
}
if (polyfill) {
return polyfill(element);
}
return element.offsetParent;
}
// Gets the closest ancestor positioned element. Handles some edge cases,
// such as table ancestors and cross browser bugs.
function getOffsetParent(element, polyfill) {
const window = floating_ui_utils_dom_getWindow(element);
if (!isHTMLElement(element) || isTopLayer(element)) {
return window;
}
let offsetParent = getTrueOffsetParent(element, polyfill);
while (offsetParent && isTableElement(offsetParent) && floating_ui_utils_dom_getComputedStyle(offsetParent).position === 'static') {
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
}
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && floating_ui_utils_dom_getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
return window;
}
return offsetParent || getContainingBlock(element) || window;
}
const getElementRects = async function (data) {
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
const getDimensionsFn = this.getDimensions;
return {
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
floating: {
x: 0,
y: 0,
...(await getDimensionsFn(data.floating))
}
};
};
function isRTL(element) {
return floating_ui_utils_dom_getComputedStyle(element).direction === 'rtl';
}
const platform = {
convertOffsetParentRelativeRectToViewportRelativeRect,
getDocumentElement: getDocumentElement,
getClippingRect,
getOffsetParent,
getElementRects,
getClientRects,
getDimensions,
getScale,
isElement: isElement,
isRTL
};
// https://samthor.au/2021/observing-dom/
function observeMove(element, onMove) {
let io = null;
let timeoutId;
const root = getDocumentElement(element);
function cleanup() {
var _io;
clearTimeout(timeoutId);
(_io = io) == null || _io.disconnect();
io = null;
}
function refresh(skip, threshold) {
if (skip === void 0) {
skip = false;
}
if (threshold === void 0) {
threshold = 1;
}
cleanup();
const {
left,
top,
width,
height
} = element.getBoundingClientRect();
if (!skip) {
onMove();
}
if (!width || !height) {
return;
}
const insetTop = floating_ui_utils_floor(top);
const insetRight = floating_ui_utils_floor(root.clientWidth - (left + width));
const insetBottom = floating_ui_utils_floor(root.clientHeight - (top + height));
const insetLeft = floating_ui_utils_floor(left);
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
const options = {
rootMargin,
threshold: dist_floating_ui_utils_max(0, dist_floating_ui_utils_min(1, threshold)) || 1
};
let isFirstUpdate = true;
function handleObserve(entries) {
const ratio = entries[0].intersectionRatio;
if (ratio !== threshold) {
if (!isFirstUpdate) {
return refresh();
}
if (!ratio) {
timeoutId = setTimeout(() => {
refresh(false, 1e-7);
}, 100);
} else {
refresh(false, ratio);
}
}
isFirstUpdate = false;
}
// Older browsers don't support a `document` as the root and will throw an
// error.
try {
io = new IntersectionObserver(handleObserve, {
...options,
// Handle <iframe>s
root: root.ownerDocument
});
} catch (e) {
io = new IntersectionObserver(handleObserve, options);
}
io.observe(element);
}
refresh(true);
return cleanup;
}
/**
* Automatically updates the position of the floating element when necessary.
* Should only be called when the floating element is mounted on the DOM or
* visible on the screen.
* @returns cleanup function that should be invoked when the floating element is
* removed from the DOM or hidden from the screen.
* @see https://floating-ui.com/docs/autoUpdate
*/
function autoUpdate(reference, floating, update, options) {
if (options === void 0) {
options = {};
}
const {
ancestorScroll = true,
ancestorResize = true,
elementResize = typeof ResizeObserver === 'function',
layoutShift = typeof IntersectionObserver === 'function',
animationFrame = false
} = options;
const referenceEl = unwrapElement(reference);
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
ancestors.forEach(ancestor => {
ancestorScroll && ancestor.addEventListener('scroll', update, {
passive: true
});
ancestorResize && ancestor.addEventListener('resize', update);
});
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
let reobserveFrame = -1;
let resizeObserver = null;
if (elementResize) {
resizeObserver = new ResizeObserver(_ref => {
let [firstEntry] = _ref;
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
// Prevent update loops when using the `size` middleware.
// https://github.com/floating-ui/floating-ui/issues/1740
resizeObserver.unobserve(floating);
cancelAnimationFrame(reobserveFrame);
reobserveFrame = requestAnimationFrame(() => {
var _resizeObserver;
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
});
}
update();
});
if (referenceEl && !animationFrame) {
resizeObserver.observe(referenceEl);
}
resizeObserver.observe(floating);
}
let frameId;
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
if (animationFrame) {
frameLoop();
}
function frameLoop() {
const nextRefRect = getBoundingClientRect(reference);
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
update();
}
prevRefRect = nextRefRect;
frameId = requestAnimationFrame(frameLoop);
}
update();
return () => {
var _resizeObserver2;
ancestors.forEach(ancestor => {
ancestorScroll && ancestor.removeEventListener('scroll', update);
ancestorResize && ancestor.removeEventListener('resize', update);
});
cleanupIo == null || cleanupIo();
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
resizeObserver = null;
if (animationFrame) {
cancelAnimationFrame(frameId);
}
};
}
/**
* Optimizes the visibility of the floating element by choosing the placement
* that has the most space available automatically, without needing to specify a
* preferred placement. Alternative to `flip`.
* @see https://floating-ui.com/docs/autoPlacement
*/
const floating_ui_dom_autoPlacement = (/* unused pure expression or super */ null && (autoPlacement$1));
/**
* Optimizes the visibility of the floating element by shifting it in order to
* keep it in view when it will overflow the clipping boundary.
* @see https://floating-ui.com/docs/shift
*/
const floating_ui_dom_shift = shift;
/**
* Optimizes the visibility of the floating element by flipping the `placement`
* in order to keep it in view when the preferred placement(s) will overflow the
* clipping boundary. Alternative to `autoPlacement`.
* @see https://floating-ui.com/docs/flip
*/
const floating_ui_dom_flip = flip;
/**
* Provides data that allows you to change the size of the floating element —
* for instance, prevent it from overflowing the clipping boundary or match the
* width of the reference element.
* @see https://floating-ui.com/docs/size
*/
const floating_ui_dom_size = size;
/**
* Provides data to hide the floating element in applicable situations, such as
* when it is not in the same clipping context as the reference element.
* @see https://floating-ui.com/docs/hide
*/
const floating_ui_dom_hide = (/* unused pure expression or super */ null && (hide$1));
/**
* Provides data to position an inner element of the floating element so that it
* appears centered to the reference element.
* @see https://floating-ui.com/docs/arrow
*/
const floating_ui_dom_arrow = arrow;
/**
* Provides improved positioning for inline reference elements that can span
* over multiple lines, such as hyperlinks or range selections.
* @see https://floating-ui.com/docs/inline
*/
const floating_ui_dom_inline = (/* unused pure expression or super */ null && (inline$1));
/**
* Built-in `limiter` that will stop `shift()` at a certain point.
*/
const floating_ui_dom_limitShift = limitShift;
/**
* Computes the `x` and `y` coordinates that will place the floating element
* next to a given reference element.
*/
const floating_ui_dom_computePosition = (reference, floating, options) => {
// This caches the expensive `getClippingElementAncestors` function so that
// multiple lifecycle resets re-use the same result. It only lives for a
// single call. If other functions become expensive, we can add them as well.
const cache = new Map();
const mergedOptions = {
platform,
...options
};
const platformWithCache = {
...mergedOptions.platform,
_c: cache
};
return computePosition(reference, floating, {
...mergedOptions,
platform: platformWithCache
});
};
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/IRX7SFUJ.js
"use client";
// src/popover/popover.tsx
function createDOMRect(x = 0, y = 0, width = 0, height = 0) {
if (typeof DOMRect === "function") {
return new DOMRect(x, y, width, height);
}
const rect = {
x,
y,
width,
height,
top: y,
right: x + width,
bottom: y + height,
left: x
};
return _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, rect), { toJSON: () => rect });
}
function getDOMRect(anchorRect) {
if (!anchorRect)
return createDOMRect();
const { x, y, width, height } = anchorRect;
return createDOMRect(x, y, width, height);
}
function getAnchorElement(anchorElement, getAnchorRect) {
const contextElement = anchorElement || void 0;
return {
contextElement,
getBoundingClientRect: () => {
const anchor = anchorElement;
const anchorRect = getAnchorRect == null ? void 0 : getAnchorRect(anchor);
if (anchorRect || !anchor) {
return getDOMRect(anchorRect);
}
return anchor.getBoundingClientRect();
}
};
}
function isValidPlacement(flip2) {
return /^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(flip2);
}
function roundByDPR(value) {
const dpr = window.devicePixelRatio || 1;
return Math.round(value * dpr) / dpr;
}
function getOffsetMiddleware(arrowElement, props) {
return offset(({ placement }) => {
var _a;
const arrowOffset = ((arrowElement == null ? void 0 : arrowElement.clientHeight) || 0) / 2;
const finalGutter = typeof props.gutter === "number" ? props.gutter + arrowOffset : (_a = props.gutter) != null ? _a : arrowOffset;
const hasAlignment = !!placement.split("-")[1];
return {
crossAxis: !hasAlignment ? props.shift : void 0,
mainAxis: finalGutter,
alignmentAxis: props.shift
};
});
}
function getFlipMiddleware(props) {
if (props.flip === false)
return;
const fallbackPlacements = typeof props.flip === "string" ? props.flip.split(" ") : void 0;
invariant(
!fallbackPlacements || fallbackPlacements.every(isValidPlacement),
false && 0
);
return floating_ui_dom_flip({
padding: props.overflowPadding,
fallbackPlacements
});
}
function getShiftMiddleware(props) {
if (!props.slide && !props.overlap)
return;
return floating_ui_dom_shift({
mainAxis: props.slide,
crossAxis: props.overlap,
padding: props.overflowPadding,
limiter: floating_ui_dom_limitShift()
});
}
function getSizeMiddleware(props) {
return floating_ui_dom_size({
padding: props.overflowPadding,
apply({ elements, availableWidth, availableHeight, rects }) {
const wrapper = elements.floating;
const referenceWidth = Math.round(rects.reference.width);
availableWidth = Math.floor(availableWidth);
availableHeight = Math.floor(availableHeight);
wrapper.style.setProperty(
"--popover-anchor-width",
`${referenceWidth}px`
);
wrapper.style.setProperty(
"--popover-available-width",
`${availableWidth}px`
);
wrapper.style.setProperty(
"--popover-available-height",
`${availableHeight}px`
);
if (props.sameWidth) {
wrapper.style.width = `${referenceWidth}px`;
}
if (props.fitViewport) {
wrapper.style.maxWidth = `${availableWidth}px`;
wrapper.style.maxHeight = `${availableHeight}px`;
}
}
});
}
function getArrowMiddleware(arrowElement, props) {
if (!arrowElement)
return;
return floating_ui_dom_arrow({
element: arrowElement,
padding: props.arrowPadding
});
}
var usePopover = createHook(
(_a) => {
var _b = _a, {
store,
modal = false,
portal = !!modal,
preserveTabOrder = true,
autoFocusOnShow = true,
wrapperProps,
fixed = false,
flip: flip2 = true,
shift: shift2 = 0,
slide = true,
overlap = false,
sameWidth = false,
fitViewport = false,
gutter,
arrowPadding = 4,
overflowPadding = 8,
getAnchorRect,
updatePosition
} = _b, props = __objRest(_b, [
"store",
"modal",
"portal",
"preserveTabOrder",
"autoFocusOnShow",
"wrapperProps",
"fixed",
"flip",
"shift",
"slide",
"overlap",
"sameWidth",
"fitViewport",
"gutter",
"arrowPadding",
"overflowPadding",
"getAnchorRect",
"updatePosition"
]);
const context = usePopoverProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const arrowElement = store.useState("arrowElement");
const anchorElement = store.useState("anchorElement");
const disclosureElement = store.useState("disclosureElement");
const popoverElement = store.useState("popoverElement");
const contentElement = store.useState("contentElement");
const placement = store.useState("placement");
const mounted = store.useState("mounted");
const rendered = store.useState("rendered");
const [positioned, setPositioned] = (0,external_React_.useState)(false);
const { portalRef, domReady } = usePortalRef(portal, props.portalRef);
const getAnchorRectProp = useEvent(getAnchorRect);
const updatePositionProp = useEvent(updatePosition);
const hasCustomUpdatePosition = !!updatePosition;
useSafeLayoutEffect(() => {
if (!(popoverElement == null ? void 0 : popoverElement.isConnected))
return;
popoverElement.style.setProperty(
"--popover-overflow-padding",
`${overflowPadding}px`
);
const anchor = getAnchorElement(anchorElement, getAnchorRectProp);
const updatePosition2 = async () => {
if (!mounted)
return;
const middleware = [
getOffsetMiddleware(arrowElement, { gutter, shift: shift2 }),
getFlipMiddleware({ flip: flip2, overflowPadding }),
getShiftMiddleware({ slide, shift: shift2, overlap, overflowPadding }),
getArrowMiddleware(arrowElement, { arrowPadding }),
getSizeMiddleware({
sameWidth,
fitViewport,
overflowPadding
})
];
const pos = await floating_ui_dom_computePosition(anchor, popoverElement, {
placement,
strategy: fixed ? "fixed" : "absolute",
middleware
});
store == null ? void 0 : store.setState("currentPlacement", pos.placement);
setPositioned(true);
const x = roundByDPR(pos.x);
const y = roundByDPR(pos.y);
Object.assign(popoverElement.style, {
top: "0",
left: "0",
transform: `translate3d(${x}px,${y}px,0)`
});
if (arrowElement && pos.middlewareData.arrow) {
const { x: arrowX, y: arrowY } = pos.middlewareData.arrow;
const dir = pos.placement.split("-")[0];
Object.assign(arrowElement.style, {
left: arrowX != null ? `${arrowX}px` : "",
top: arrowY != null ? `${arrowY}px` : "",
[dir]: "100%"
});
}
};
const update = async () => {
if (hasCustomUpdatePosition) {
await updatePositionProp({ updatePosition: updatePosition2 });
setPositioned(true);
} else {
await updatePosition2();
}
};
const cancelAutoUpdate = autoUpdate(anchor, popoverElement, update, {
// JSDOM doesn't support ResizeObserver
elementResize: typeof ResizeObserver === "function"
});
return () => {
setPositioned(false);
cancelAutoUpdate();
};
}, [
store,
rendered,
popoverElement,
arrowElement,
anchorElement,
popoverElement,
placement,
mounted,
domReady,
fixed,
flip2,
shift2,
slide,
overlap,
sameWidth,
fitViewport,
gutter,
arrowPadding,
overflowPadding,
getAnchorRectProp,
hasCustomUpdatePosition,
updatePositionProp
]);
useSafeLayoutEffect(() => {
if (!mounted)
return;
if (!domReady)
return;
if (!(popoverElement == null ? void 0 : popoverElement.isConnected))
return;
if (!(contentElement == null ? void 0 : contentElement.isConnected))
return;
const applyZIndex = () => {
popoverElement.style.zIndex = getComputedStyle(contentElement).zIndex;
};
applyZIndex();
let raf = requestAnimationFrame(() => {
raf = requestAnimationFrame(applyZIndex);
});
return () => cancelAnimationFrame(raf);
}, [mounted, domReady, popoverElement, contentElement]);
const position = fixed ? "fixed" : "absolute";
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(
"div",
_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
role: "presentation"
}, wrapperProps), {
style: _4R3V3JGP_spreadValues({
// https://floating-ui.com/docs/computeposition#initial-layout
position,
top: 0,
left: 0,
width: "max-content"
}, wrapperProps == null ? void 0 : wrapperProps.style),
ref: store == null ? void 0 : store.setPopoverElement,
children: element
})
),
[store, position, wrapperProps]
);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(PopoverScopedContextProvider, { value: store, children: element }),
[store]
);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
// data-placing is not part of the public API. We're setting this here so
// we can wait for the popover to be positioned before other components
// move focus into it. For example, this attribute is observed by the
// Combobox component with the autoSelect behavior.
"data-placing": !positioned ? "" : void 0
}, props), {
style: _4R3V3JGP_spreadValues({
position: "relative"
}, props.style)
});
props = useDialog(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
store,
modal,
portal,
preserveTabOrder,
preserveTabOrderAnchor: disclosureElement || anchorElement,
autoFocusOnShow: positioned && autoFocusOnShow
}, props), {
portalRef
}));
return props;
}
);
var Popover = createDialogComponent(
createComponent((props) => {
const htmlProps = usePopover(props);
return _3ORBWXWF_createElement("div", htmlProps);
}),
usePopoverProviderContext
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/QWSZGSIG.js
"use client";
// src/hovercard/hovercard.tsx
function isMovingOnHovercard(target, card, anchor, nested) {
if (hasFocusWithin(card))
return true;
if (!target)
return false;
if (contains(card, target))
return true;
if (anchor && contains(anchor, target))
return true;
if (nested == null ? void 0 : nested.some((card2) => isMovingOnHovercard(target, card2, anchor))) {
return true;
}
return false;
}
function useAutoFocusOnHide(_a) {
var _b = _a, {
store
} = _b, props = __objRest(_b, [
"store"
]);
const [autoFocusOnHide, setAutoFocusOnHide] = (0,external_React_.useState)(false);
const mounted = store.useState("mounted");
(0,external_React_.useEffect)(() => {
if (!mounted) {
setAutoFocusOnHide(false);
}
}, [mounted]);
const onFocusProp = props.onFocus;
const onFocus = useEvent((event) => {
onFocusProp == null ? void 0 : onFocusProp(event);
if (event.defaultPrevented)
return;
setAutoFocusOnHide(true);
});
const finalFocusRef = (0,external_React_.useRef)(null);
(0,external_React_.useEffect)(() => {
return sync(store, ["anchorElement"], (state) => {
finalFocusRef.current = state.anchorElement;
});
}, []);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
autoFocusOnHide,
finalFocus: finalFocusRef
}, props), {
onFocus
});
return props;
}
var NestedHovercardContext = (0,external_React_.createContext)(null);
var useHovercard = createHook(
(_a) => {
var _b = _a, {
store,
modal = false,
portal = !!modal,
hideOnEscape = true,
hideOnHoverOutside = true,
disablePointerEventsOnApproach = !!hideOnHoverOutside
} = _b, props = __objRest(_b, [
"store",
"modal",
"portal",
"hideOnEscape",
"hideOnHoverOutside",
"disablePointerEventsOnApproach"
]);
const context = useHovercardProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const ref = (0,external_React_.useRef)(null);
const [nestedHovercards, setNestedHovercards] = (0,external_React_.useState)([]);
const hideTimeoutRef = (0,external_React_.useRef)(0);
const enterPointRef = (0,external_React_.useRef)(null);
const { portalRef, domReady } = usePortalRef(portal, props.portalRef);
const mayHideOnHoverOutside = !!hideOnHoverOutside;
const hideOnHoverOutsideProp = useBooleanEvent(hideOnHoverOutside);
const mayDisablePointerEvents = !!disablePointerEventsOnApproach;
const disablePointerEventsProp = useBooleanEvent(
disablePointerEventsOnApproach
);
const open = store.useState("open");
const mounted = store.useState("mounted");
(0,external_React_.useEffect)(() => {
if (!domReady)
return;
if (!mounted)
return;
if (!mayHideOnHoverOutside && !mayDisablePointerEvents)
return;
const element = ref.current;
if (!element)
return;
const onMouseMove = (event) => {
if (!store)
return;
const { anchorElement, hideTimeout, timeout } = store.getState();
const enterPoint = enterPointRef.current;
const [target] = event.composedPath();
const anchor = anchorElement;
if (isMovingOnHovercard(target, element, anchor, nestedHovercards)) {
enterPointRef.current = target && anchor && contains(anchor, target) ? getEventPoint(event) : null;
window.clearTimeout(hideTimeoutRef.current);
hideTimeoutRef.current = 0;
return;
}
if (hideTimeoutRef.current)
return;
if (enterPoint) {
const currentPoint = getEventPoint(event);
const polygon = getElementPolygon(element, enterPoint);
if (isPointInPolygon(currentPoint, polygon)) {
enterPointRef.current = currentPoint;
if (!disablePointerEventsProp(event))
return;
event.preventDefault();
event.stopPropagation();
return;
}
}
if (!hideOnHoverOutsideProp(event))
return;
hideTimeoutRef.current = window.setTimeout(() => {
hideTimeoutRef.current = 0;
store == null ? void 0 : store.hide();
}, hideTimeout != null ? hideTimeout : timeout);
};
return chain(
addGlobalEventListener("mousemove", onMouseMove, true),
() => clearTimeout(hideTimeoutRef.current)
);
}, [
store,
domReady,
mounted,
mayHideOnHoverOutside,
mayDisablePointerEvents,
nestedHovercards,
disablePointerEventsProp,
hideOnHoverOutsideProp
]);
(0,external_React_.useEffect)(() => {
if (!domReady)
return;
if (!mounted)
return;
if (!mayDisablePointerEvents)
return;
const disableEvent = (event) => {
const element = ref.current;
if (!element)
return;
const enterPoint = enterPointRef.current;
if (!enterPoint)
return;
const polygon = getElementPolygon(element, enterPoint);
if (isPointInPolygon(getEventPoint(event), polygon)) {
if (!disablePointerEventsProp(event))
return;
event.preventDefault();
event.stopPropagation();
}
};
return chain(
// Note: we may need to add pointer events here in the future.
addGlobalEventListener("mouseenter", disableEvent, true),
addGlobalEventListener("mouseover", disableEvent, true),
addGlobalEventListener("mouseout", disableEvent, true),
addGlobalEventListener("mouseleave", disableEvent, true)
);
}, [domReady, mounted, mayDisablePointerEvents, disablePointerEventsProp]);
(0,external_React_.useEffect)(() => {
if (!domReady)
return;
if (open)
return;
store == null ? void 0 : store.setAutoFocusOnShow(false);
}, [store, domReady, open]);
const openRef = useLiveRef(open);
(0,external_React_.useEffect)(() => {
if (!domReady)
return;
return () => {
if (!openRef.current) {
store == null ? void 0 : store.setAutoFocusOnShow(false);
}
};
}, [store, domReady]);
const registerOnParent = (0,external_React_.useContext)(NestedHovercardContext);
useSafeLayoutEffect(() => {
if (modal)
return;
if (!portal)
return;
if (!mounted)
return;
if (!domReady)
return;
const element = ref.current;
if (!element)
return;
return registerOnParent == null ? void 0 : registerOnParent(element);
}, [modal, portal, mounted, domReady]);
const registerNestedHovercard = (0,external_React_.useCallback)(
(element) => {
setNestedHovercards((prevElements) => [...prevElements, element]);
const parentUnregister = registerOnParent == null ? void 0 : registerOnParent(element);
return () => {
setNestedHovercards(
(prevElements) => prevElements.filter((item) => item !== element)
);
parentUnregister == null ? void 0 : parentUnregister();
};
},
[registerOnParent]
);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(HovercardScopedContextProvider, { value: store, children: /* @__PURE__ */ (0,jsx_runtime.jsx)(NestedHovercardContext.Provider, { value: registerNestedHovercard, children: element }) }),
[store, registerNestedHovercard]
);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
ref: useMergeRefs(ref, props.ref)
});
props = useAutoFocusOnHide(_4R3V3JGP_spreadValues({ store }, props));
const autoFocusOnShow = store.useState(
(state) => modal || state.autoFocusOnShow
);
props = usePopover(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
store,
modal,
portal,
autoFocusOnShow
}, props), {
portalRef,
hideOnEscape(event) {
if (isFalsyBooleanCallback(hideOnEscape, event))
return false;
requestAnimationFrame(() => {
requestAnimationFrame(() => {
store == null ? void 0 : store.hide();
});
});
return true;
}
}));
return props;
}
);
var Hovercard = createDialogComponent(
createComponent((props) => {
const htmlProps = useHovercard(props);
return _3ORBWXWF_createElement("div", htmlProps);
}),
useHovercardProviderContext
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/tooltip/tooltip.js
"use client";
// src/tooltip/tooltip.tsx
var useTooltip = createHook(
(_a) => {
var _b = _a, {
store,
portal = true,
gutter = 8,
preserveTabOrder = false,
hideOnHoverOutside = true,
hideOnInteractOutside = true
} = _b, props = __objRest(_b, [
"store",
"portal",
"gutter",
"preserveTabOrder",
"hideOnHoverOutside",
"hideOnInteractOutside"
]);
const context = useTooltipProviderContext();
store = store || context;
invariant(
store,
false && 0
);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(TooltipScopedContextProvider, { value: store, children: element }),
[store]
);
const role = store.useState(
(state) => state.type === "description" ? "tooltip" : "none"
);
props = _4R3V3JGP_spreadValues({ role }, props);
props = useHovercard(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
store,
portal,
gutter,
preserveTabOrder,
hideOnHoverOutside: (event) => {
if (isFalsyBooleanCallback(hideOnHoverOutside, event))
return false;
const anchorElement = store == null ? void 0 : store.getState().anchorElement;
if (!anchorElement)
return true;
if ("focusVisible" in anchorElement.dataset)
return false;
return true;
},
hideOnInteractOutside: (event) => {
if (isFalsyBooleanCallback(hideOnInteractOutside, event))
return false;
const anchorElement = store == null ? void 0 : store.getState().anchorElement;
if (!anchorElement)
return true;
if (contains(anchorElement, event.target))
return false;
return true;
}
}));
return props;
}
);
var Tooltip = createDialogComponent(
createComponent((props) => {
const htmlProps = useTooltip(props);
return _3ORBWXWF_createElement("div", htmlProps);
}),
useTooltipProviderContext
);
if (false) {}
;// CONCATENATED MODULE: external ["wp","element"]
const external_wp_element_namespaceObject = window["wp"]["element"];
;// CONCATENATED MODULE: external ["wp","deprecated"]
const 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/components/build-module/shortcut/index.js
/**
* Internal dependencies
*/
/**
* Shortcut component is used to display keyboard shortcuts, and it can be customized with a custom display and aria label if needed.
*
* ```jsx
* import { Shortcut } from '@wordpress/components';
*
* const MyShortcut = () => {
* return (
* <Shortcut shortcut={{ display: 'Ctrl + S', ariaLabel: 'Save' }} />
* );
* };
* ```
*/
function Shortcut(props) {
const {
shortcut,
className
} = props;
if (!shortcut) {
return null;
}
let displayText;
let ariaLabel;
if (typeof shortcut === 'string') {
displayText = shortcut;
}
if (shortcut !== null && typeof shortcut === 'object') {
displayText = shortcut.display;
ariaLabel = shortcut.ariaLabel;
}
return (0,external_React_.createElement)("span", {
className: className,
"aria-label": ariaLabel
}, displayText);
}
/* harmony default export */ const build_module_shortcut = (Shortcut);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/utils.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* Internal dependencies
*/
const POSITION_TO_PLACEMENT = {
bottom: 'bottom',
top: 'top',
'middle left': 'left',
'middle right': 'right',
'bottom left': 'bottom-end',
'bottom center': 'bottom',
'bottom right': 'bottom-start',
'top left': 'top-end',
'top center': 'top',
'top right': 'top-start',
'middle left left': 'left',
'middle left right': 'left',
'middle left bottom': 'left-end',
'middle left top': 'left-start',
'middle right left': 'right',
'middle right right': 'right',
'middle right bottom': 'right-end',
'middle right top': 'right-start',
'bottom left left': 'bottom-end',
'bottom left right': 'bottom-end',
'bottom left bottom': 'bottom-end',
'bottom left top': 'bottom-end',
'bottom center left': 'bottom',
'bottom center right': 'bottom',
'bottom center bottom': 'bottom',
'bottom center top': 'bottom',
'bottom right left': 'bottom-start',
'bottom right right': 'bottom-start',
'bottom right bottom': 'bottom-start',
'bottom right top': 'bottom-start',
'top left left': 'top-end',
'top left right': 'top-end',
'top left bottom': 'top-end',
'top left top': 'top-end',
'top center left': 'top',
'top center right': 'top',
'top center bottom': 'top',
'top center top': 'top',
'top right left': 'top-start',
'top right right': 'top-start',
'top right bottom': 'top-start',
'top right top': 'top-start',
// `middle`/`middle center [corner?]` positions are associated to a fallback
// `bottom` placement because there aren't any corresponding placement values.
middle: 'bottom',
'middle center': 'bottom',
'middle center bottom': 'bottom',
'middle center left': 'bottom',
'middle center right': 'bottom',
'middle center top': 'bottom'
};
/**
* Converts the `Popover`'s legacy "position" prop to the new "placement" prop
* (used by `floating-ui`).
*
* @param position The legacy position
* @return The corresponding placement
*/
const positionToPlacement = position => {
var _POSITION_TO_PLACEMEN;
return (_POSITION_TO_PLACEMEN = POSITION_TO_PLACEMENT[position]) !== null && _POSITION_TO_PLACEMEN !== void 0 ? _POSITION_TO_PLACEMEN : 'bottom';
};
/**
* @typedef AnimationOrigin
* @type {Object}
* @property {number} originX A number between 0 and 1 (in CSS logical properties jargon, 0 is "start", 0.5 is "center", and 1 is "end")
* @property {number} originY A number between 0 and 1 (0 is top, 0.5 is center, and 1 is bottom)
*/
const PLACEMENT_TO_ANIMATION_ORIGIN = {
top: {
originX: 0.5,
originY: 1
},
// open from bottom, center
'top-start': {
originX: 0,
originY: 1
},
// open from bottom, left
'top-end': {
originX: 1,
originY: 1
},
// open from bottom, right
right: {
originX: 0,
originY: 0.5
},
// open from middle, left
'right-start': {
originX: 0,
originY: 0
},
// open from top, left
'right-end': {
originX: 0,
originY: 1
},
// open from bottom, left
bottom: {
originX: 0.5,
originY: 0
},
// open from top, center
'bottom-start': {
originX: 0,
originY: 0
},
// open from top, left
'bottom-end': {
originX: 1,
originY: 0
},
// open from top, right
left: {
originX: 1,
originY: 0.5
},
// open from middle, right
'left-start': {
originX: 1,
originY: 0
},
// open from top, right
'left-end': {
originX: 1,
originY: 1
},
// open from bottom, right
overlay: {
originX: 0.5,
originY: 0.5
} // open from center, center
};
/**
* Given the floating-ui `placement`, compute the framer-motion props for the
* popover's entry animation.
*
* @param placement A placement string from floating ui
* @return The object containing the motion props
*/
const placementToMotionAnimationProps = placement => {
const translateProp = placement.startsWith('top') || placement.startsWith('bottom') ? 'translateY' : 'translateX';
const translateDirection = placement.startsWith('top') || placement.startsWith('left') ? 1 : -1;
return {
style: PLACEMENT_TO_ANIMATION_ORIGIN[placement],
initial: {
opacity: 0,
scale: 0,
[translateProp]: `${2 * translateDirection}em`
},
animate: {
opacity: 1,
scale: 1,
[translateProp]: 0
},
transition: {
duration: 0.1,
ease: [0, 0, 0.2, 1]
}
};
};
function isTopBottom(anchorRef) {
return !!anchorRef?.top;
}
function isRef(anchorRef) {
return !!anchorRef?.current;
}
const getReferenceElement = ({
anchor,
anchorRef,
anchorRect,
getAnchorRect,
fallbackReferenceElement
}) => {
var _referenceElement;
let referenceElement = null;
if (anchor) {
referenceElement = anchor;
} else if (isTopBottom(anchorRef)) {
// Create a virtual element for the ref. The expectation is that
// if anchorRef.top is defined, then anchorRef.bottom is defined too.
// Seems to be used by the block toolbar, when multiple blocks are selected
// (top and bottom blocks are used to calculate the resulting rect).
referenceElement = {
getBoundingClientRect() {
const topRect = anchorRef.top.getBoundingClientRect();
const bottomRect = anchorRef.bottom.getBoundingClientRect();
return new window.DOMRect(topRect.x, topRect.y, topRect.width, bottomRect.bottom - topRect.top);
}
};
} else if (isRef(anchorRef)) {
// Standard React ref.
referenceElement = anchorRef.current;
} else if (anchorRef) {
// If `anchorRef` holds directly the element's value (no `current` key)
// This is a weird scenario and should be deprecated.
referenceElement = anchorRef;
} else if (anchorRect) {
// Create a virtual element for the ref.
referenceElement = {
getBoundingClientRect() {
return anchorRect;
}
};
} else if (getAnchorRect) {
// Create a virtual element for the ref.
referenceElement = {
getBoundingClientRect() {
var _rect$x, _rect$y, _rect$width, _rect$height;
const rect = getAnchorRect(fallbackReferenceElement);
return new window.DOMRect((_rect$x = rect.x) !== null && _rect$x !== void 0 ? _rect$x : rect.left, (_rect$y = rect.y) !== null && _rect$y !== void 0 ? _rect$y : rect.top, (_rect$width = rect.width) !== null && _rect$width !== void 0 ? _rect$width : rect.right - rect.left, (_rect$height = rect.height) !== null && _rect$height !== void 0 ? _rect$height : rect.bottom - rect.top);
}
};
} else if (fallbackReferenceElement) {
// If no explicit ref is passed via props, fall back to
// anchoring to the popover's parent node.
referenceElement = fallbackReferenceElement.parentElement;
}
// Convert any `undefined` value to `null`.
return (_referenceElement = referenceElement) !== null && _referenceElement !== void 0 ? _referenceElement : null;
};
/**
* Computes the final coordinate that needs to be applied to the floating
* element when applying transform inline styles, defaulting to `undefined`
* if the provided value is `null` or `NaN`.
*
* @param c input coordinate (usually as returned from floating-ui)
* @return The coordinate's value to be used for inline styles. An `undefined`
* return value means "no style set" for this coordinate.
*/
const computePopoverPosition = c => c === null || Number.isNaN(c) ? undefined : Math.round(c);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tooltip/index.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const TooltipInternalContext = (0,external_wp_element_namespaceObject.createContext)({
isNestedInTooltip: false
});
/**
* Time over anchor to wait before showing tooltip
*/
const TOOLTIP_DELAY = 700;
const CONTEXT_VALUE = {
isNestedInTooltip: true
};
function UnforwardedTooltip(props, ref) {
const {
children,
delay = TOOLTIP_DELAY,
hideOnClick = true,
placement,
position,
shortcut,
text,
...restProps
} = props;
const {
isNestedInTooltip
} = (0,external_wp_element_namespaceObject.useContext)(TooltipInternalContext);
const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(tooltip_Tooltip, 'tooltip');
const describedById = text || shortcut ? baseId : undefined;
const isOnlyChild = external_wp_element_namespaceObject.Children.count(children) === 1;
// console error if more than one child element is added
if (!isOnlyChild) {
if (false) {}
}
// Compute tooltip's placement:
// - give priority to `placement` prop, if defined
// - otherwise, compute it from the legacy `position` prop (if defined)
// - finally, fallback to the default placement: 'bottom'
let computedPlacement;
if (placement !== undefined) {
computedPlacement = placement;
} else if (position !== undefined) {
computedPlacement = positionToPlacement(position);
external_wp_deprecated_default()('`position` prop in wp.components.tooltip', {
since: '6.4',
alternative: '`placement` prop'
});
}
computedPlacement = computedPlacement || 'bottom';
// Removing the `Ariakit` namespace from the hook name allows ESLint to
// properly identify the hook, and apply the correct linting rules.
const useAriakitTooltipStore = useTooltipStore;
const tooltipStore = useAriakitTooltipStore({
placement: computedPlacement,
showTimeout: delay
});
if (isNestedInTooltip) {
return isOnlyChild ? (0,external_React_.createElement)(Role, {
...restProps,
render: children
}) : children;
}
return (0,external_React_.createElement)(TooltipInternalContext.Provider, {
value: CONTEXT_VALUE
}, (0,external_React_.createElement)(TooltipAnchor, {
onClick: hideOnClick ? tooltipStore.hide : undefined,
store: tooltipStore,
render: isOnlyChild ? children : undefined,
ref: ref
}, isOnlyChild ? undefined : children), isOnlyChild && (text || shortcut) && (0,external_React_.createElement)(Tooltip, {
...restProps,
className: "components-tooltip",
unmountOnHide: true,
gutter: 4,
id: describedById,
overflowPadding: 0.5,
store: tooltipStore
}, text, shortcut && (0,external_React_.createElement)(build_module_shortcut, {
className: text ? 'components-tooltip__shortcut' : '',
shortcut: shortcut
})));
}
const tooltip_Tooltip = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTooltip);
/* harmony default export */ const tooltip = (tooltip_Tooltip);
;// CONCATENATED MODULE: external ["wp","warning"]
const external_wp_warning_namespaceObject = window["wp"]["warning"];
var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject);
// EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js
var cjs = __webpack_require__(66);
var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
// EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js
var es6 = __webpack_require__(7734);
var es6_default = /*#__PURE__*/__webpack_require__.n(es6);
;// CONCATENATED MODULE: ./node_modules/is-plain-object/dist/is-plain-object.mjs
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function is_plain_object_isObject(o) {
return Object.prototype.toString.call(o) === '[object Object]';
}
function isPlainObject(o) {
var ctor,prot;
if (is_plain_object_isObject(o) === false) return false;
// If has modified constructor
ctor = o.constructor;
if (ctor === undefined) return true;
// If has modified prototype
prot = ctor.prototype;
if (is_plain_object_isObject(prot) === false) return false;
// If constructor does not have an Object-specific method
if (prot.hasOwnProperty('isPrototypeOf') === false) {
return false;
}
// Most likely a plain Object
return true;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.js
/**
* WordPress dependencies
*/
/**
* A `React.useEffect` that will not run on the first render.
* Source:
* https://github.com/ariakit/ariakit/blob/reakit/packages/reakit-utils/src/useUpdateEffect.ts
*
* @param {import('react').EffectCallback} effect
* @param {import('react').DependencyList} deps
*/
function use_update_effect_useUpdateEffect(effect, deps) {
const mounted = (0,external_wp_element_namespaceObject.useRef)(false);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (mounted.current) {
return effect();
}
mounted.current = true;
return undefined;
// Disable reasons:
// 1. This hook needs to pass a dep list that isn't an array literal
// 2. `effect` is missing from the array, and will need to be added carefully to avoid additional warnings
// see https://github.com/WordPress/gutenberg/pull/41166
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps);
}
/* harmony default export */ const use_update_effect = (use_update_effect_useUpdateEffect);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/context/context-system-provider.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ComponentsContext = (0,external_wp_element_namespaceObject.createContext)( /** @type {Record<string, any>} */{});
const useComponentsContext = () => (0,external_wp_element_namespaceObject.useContext)(ComponentsContext);
/**
* Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.
*
* Note: This function will warn if it detects an un-memoized `value`
*
* @param {Object} props
* @param {Record<string, any>} props.value
* @return {Record<string, any>} The consolidated value.
*/
function useContextSystemBridge({
value
}) {
const parentContext = useComponentsContext();
const valueRef = (0,external_wp_element_namespaceObject.useRef)(value);
use_update_effect(() => {
if (
// Objects are equivalent.
es6_default()(valueRef.current, value) &&
// But not the same reference.
valueRef.current !== value) {
true ? external_wp_warning_default()(`Please memoize your context: ${JSON.stringify(value)}`) : 0;
}
}, [value]);
// `parentContext` will always be memoized (i.e., the result of this hook itself)
// or the default value from when the `ComponentsContext` was originally
// initialized (which will never change, it's a static variable)
// so this memoization will prevent `deepmerge()` from rerunning unless
// the references to `value` change OR the `parentContext` has an actual material change
// (because again, it's guaranteed to be memoized or a static reference to the empty object
// so we know that the only changes for `parentContext` are material ones... i.e., why we
// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only
// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are
// correctly warning when the `value` isn't being properly memoized. All of that to say
// that this should be super safe to assume that `useMemo` will only run on actual
// changes to the two dependencies, therefore saving us calls to `deepmerge()`!
const config = (0,external_wp_element_namespaceObject.useMemo)(() => {
// Deep clone `parentContext` to avoid mutating it later.
return cjs_default()(parentContext !== null && parentContext !== void 0 ? parentContext : {}, value !== null && value !== void 0 ? value : {}, {
isMergeableObject: isPlainObject
});
}, [parentContext, value]);
return config;
}
/**
* A Provider component that can modify props for connected components within
* the Context system.
*
* @example
* ```jsx
* <ContextSystemProvider value={{ Button: { size: 'small' }}}>
* <Button>...</Button>
* </ContextSystemProvider>
* ```
*
* @template {Record<string, any>} T
* @param {Object} options
* @param {import('react').ReactNode} options.children Children to render.
* @param {T} options.value Props to render into connected components.
* @return {JSX.Element} A Provider wrapped component.
*/
const BaseContextSystemProvider = ({
children,
value
}) => {
const contextValue = useContextSystemBridge({
value
});
return (0,external_React_.createElement)(ComponentsContext.Provider, {
value: contextValue
}, children);
};
const ContextSystemProvider = (0,external_wp_element_namespaceObject.memo)(BaseContextSystemProvider);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/context/constants.js
const COMPONENT_NAMESPACE = 'data-wp-component';
const CONNECTED_NAMESPACE = 'data-wp-c16t';
/**
* Special key where the connected namespaces are stored.
* This is attached to Context connected components as a static property.
*/
const CONNECT_STATIC_NAMESPACE = '__contextSystemKey__';
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/context/utils.js
/**
* Internal dependencies
*/
/**
* Creates a dedicated context namespace HTML attribute for components.
* ns is short for "namespace"
*
* @example
* ```jsx
* <div {...ns('Container')} />
* ```
*
* @param {string} componentName The name for the component.
* @return {Record<string, any>} A props object with the namespaced HTML attribute.
*/
function getNamespace(componentName) {
return {
[COMPONENT_NAMESPACE]: componentName
};
}
/**
* Creates a dedicated connected context namespace HTML attribute for components.
* ns is short for "namespace"
*
* @example
* ```jsx
* <div {...cns()} />
* ```
*
* @return {Record<string, any>} A props object with the namespaced HTML attribute.
*/
function getConnectedNamespace() {
return {
[CONNECTED_NAMESPACE]: true
};
}
;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
/******************************************************************************
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, SuppressedError, Symbol */
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) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
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 __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
};
function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
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 (g && (g = 0, op[0] && (_ = 0)), _) 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;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (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;
}
/** @deprecated */
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
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 __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
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: false } : 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, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
function next() {
while (env.stack.length) {
var rec = env.stack.pop();
try {
var result = rec.dispose && rec.dispose.call(rec.value);
if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
catch (e) {
fail(e);
}
}
if (env.hasError) throw env.error;
}
return next();
}
/* harmony default export */ const tslib_es6 = ({
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__createBinding,
__exportStar,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
});
;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
/**
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
*/
var SUPPORTED_LOCALE = {
tr: {
regexp: /\u0130|\u0049|\u0049\u0307/g,
map: {
İ: "\u0069",
I: "\u0131",
İ: "\u0069",
},
},
az: {
regexp: /\u0130/g,
map: {
İ: "\u0069",
I: "\u0131",
İ: "\u0069",
},
},
lt: {
regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
map: {
I: "\u0069\u0307",
J: "\u006A\u0307",
Į: "\u012F\u0307",
Ì: "\u0069\u0307\u0300",
Í: "\u0069\u0307\u0301",
Ĩ: "\u0069\u0307\u0303",
},
},
};
/**
* Localized lower case.
*/
function localeLowerCase(str, locale) {
var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
if (lang)
return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
return lowerCase(str);
}
/**
* Lower case as a function.
*/
function lowerCase(str) {
return str.toLowerCase();
}
;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
// Remove all non-word characters.
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
/**
* Normalize the string into something other libraries can manipulate easier.
*/
function noCase(input, options) {
if (options === void 0) { options = {}; }
var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
var result = dist_es2015_replace(dist_es2015_replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
var start = 0;
var end = result.length;
// Trim the delimiter from around the output string.
while (result.charAt(start) === "\0")
start++;
while (result.charAt(end - 1) === "\0")
end--;
// Transform each token independently.
return result.slice(start, end).split("\0").map(transform).join(delimiter);
}
/**
* Replace `re` in the input string with the replacement value.
*/
function dist_es2015_replace(input, re, value) {
if (re instanceof RegExp)
return input.replace(re, value);
return re.reduce(function (input, re) { return input.replace(re, value); }, input);
}
;// CONCATENATED MODULE: ./node_modules/dot-case/dist.es2015/index.js
function dotCase(input, options) {
if (options === void 0) { options = {}; }
return noCase(input, __assign({ delimiter: "." }, options));
}
;// CONCATENATED MODULE: ./node_modules/param-case/dist.es2015/index.js
function paramCase(input, options) {
if (options === void 0) { options = {}; }
return dotCase(input, __assign({ delimiter: "-" }, options));
}
;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js
/**
* 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 {(...args: any[]) => any} F
*
* @param {F} fn Function to memoize.
* @param {MemizeOptions} [options] Options object.
*
* @return {((...args: Parameters<F>) => ReturnType<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;
};
// 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;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.js
/**
* External dependencies
*/
/**
* Generates the connected component CSS className based on the namespace.
*
* @param namespace The name of the connected component.
* @return The generated CSS className.
*/
function getStyledClassName(namespace) {
const kebab = paramCase(namespace);
return `components-${kebab}`;
}
const getStyledClassNameFromKey = memize(getStyledClassName);
;// CONCATENATED MODULE: ./node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js
/*
Based off glamor's StyleSheet, thanks Sunil ❤️
high performance StyleSheet for css-in-js systems
- uses multiple style tags behind the scenes for millions of rules
- uses `insertRule` for appending in production for *much* faster performance
// usage
import { StyleSheet } from '@emotion/sheet'
let styleSheet = new StyleSheet({ key: '', container: document.head })
styleSheet.insert('#box { border: 1px solid red; }')
- appends a css rule into the stylesheet
styleSheet.flush()
- empties the stylesheet of all its contents
*/
// $FlowFixMe
function sheetForTag(tag) {
if (tag.sheet) {
// $FlowFixMe
return tag.sheet;
} // this weirdness brought to you by firefox
/* istanbul ignore next */
for (var i = 0; i < document.styleSheets.length; i++) {
if (document.styleSheets[i].ownerNode === tag) {
// $FlowFixMe
return document.styleSheets[i];
}
}
}
function createStyleElement(options) {
var tag = document.createElement('style');
tag.setAttribute('data-emotion', options.key);
if (options.nonce !== undefined) {
tag.setAttribute('nonce', options.nonce);
}
tag.appendChild(document.createTextNode(''));
tag.setAttribute('data-s', '');
return tag;
}
var StyleSheet = /*#__PURE__*/function () {
// Using Node instead of HTMLElement since container may be a ShadowRoot
function StyleSheet(options) {
var _this = this;
this._insertTag = function (tag) {
var before;
if (_this.tags.length === 0) {
if (_this.insertionPoint) {
before = _this.insertionPoint.nextSibling;
} else if (_this.prepend) {
before = _this.container.firstChild;
} else {
before = _this.before;
}
} else {
before = _this.tags[_this.tags.length - 1].nextSibling;
}
_this.container.insertBefore(tag, before);
_this.tags.push(tag);
};
this.isSpeedy = options.speedy === undefined ? "production" === 'production' : options.speedy;
this.tags = [];
this.ctr = 0;
this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
this.key = options.key;
this.container = options.container;
this.prepend = options.prepend;
this.insertionPoint = options.insertionPoint;
this.before = null;
}
var _proto = StyleSheet.prototype;
_proto.hydrate = function hydrate(nodes) {
nodes.forEach(this._insertTag);
};
_proto.insert = function insert(rule) {
// the max length is how many rules we have per style tag, it's 65000 in speedy mode
// it's 1 in dev because we insert source maps that map a single rule to a location
// and you can only have one source map per style tag
if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
this._insertTag(createStyleElement(this));
}
var tag = this.tags[this.tags.length - 1];
if (false) { var isImportRule; }
if (this.isSpeedy) {
var sheet = sheetForTag(tag);
try {
// this is the ultrafast version, works across browsers
// the big drawback is that the css won't be editable in devtools
sheet.insertRule(rule, sheet.cssRules.length);
} catch (e) {
if (false) {}
}
} else {
tag.appendChild(document.createTextNode(rule));
}
this.ctr++;
};
_proto.flush = function flush() {
// $FlowFixMe
this.tags.forEach(function (tag) {
return tag.parentNode && tag.parentNode.removeChild(tag);
});
this.tags = [];
this.ctr = 0;
if (false) {}
};
return StyleSheet;
}();
;// CONCATENATED MODULE: ./node_modules/stylis/src/Utility.js
/**
* @param {number}
* @return {number}
*/
var abs = Math.abs
/**
* @param {number}
* @return {string}
*/
var Utility_from = String.fromCharCode
/**
* @param {object}
* @return {object}
*/
var Utility_assign = Object.assign
/**
* @param {string} value
* @param {number} length
* @return {number}
*/
function hash (value, length) {
return Utility_charat(value, 0) ^ 45 ? (((((((length << 2) ^ Utility_charat(value, 0)) << 2) ^ Utility_charat(value, 1)) << 2) ^ Utility_charat(value, 2)) << 2) ^ Utility_charat(value, 3) : 0
}
/**
* @param {string} value
* @return {string}
*/
function trim (value) {
return value.trim()
}
/**
* @param {string} value
* @param {RegExp} pattern
* @return {string?}
*/
function Utility_match (value, pattern) {
return (value = pattern.exec(value)) ? value[0] : value
}
/**
* @param {string} value
* @param {(string|RegExp)} pattern
* @param {string} replacement
* @return {string}
*/
function Utility_replace (value, pattern, replacement) {
return value.replace(pattern, replacement)
}
/**
* @param {string} value
* @param {string} search
* @return {number}
*/
function indexof (value, search) {
return value.indexOf(search)
}
/**
* @param {string} value
* @param {number} index
* @return {number}
*/
function Utility_charat (value, index) {
return value.charCodeAt(index) | 0
}
/**
* @param {string} value
* @param {number} begin
* @param {number} end
* @return {string}
*/
function Utility_substr (value, begin, end) {
return value.slice(begin, end)
}
/**
* @param {string} value
* @return {number}
*/
function Utility_strlen (value) {
return value.length
}
/**
* @param {any[]} value
* @return {number}
*/
function Utility_sizeof (value) {
return value.length
}
/**
* @param {any} value
* @param {any[]} array
* @return {any}
*/
function Utility_append (value, array) {
return array.push(value), value
}
/**
* @param {string[]} array
* @param {function} callback
* @return {string}
*/
function Utility_combine (array, callback) {
return array.map(callback).join('')
}
;// CONCATENATED MODULE: ./node_modules/stylis/src/Tokenizer.js
var line = 1
var column = 1
var Tokenizer_length = 0
var position = 0
var character = 0
var characters = ''
/**
* @param {string} value
* @param {object | null} root
* @param {object | null} parent
* @param {string} type
* @param {string[] | string} props
* @param {object[] | string} children
* @param {number} length
*/
function node (value, root, parent, type, props, children, length) {
return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}
}
/**
* @param {object} root
* @param {object} props
* @return {object}
*/
function Tokenizer_copy (root, props) {
return Utility_assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)
}
/**
* @return {number}
*/
function Tokenizer_char () {
return character
}
/**
* @return {number}
*/
function prev () {
character = position > 0 ? Utility_charat(characters, --position) : 0
if (column--, character === 10)
column = 1, line--
return character
}
/**
* @return {number}
*/
function next () {
character = position < Tokenizer_length ? Utility_charat(characters, position++) : 0
if (column++, character === 10)
column = 1, line++
return character
}
/**
* @return {number}
*/
function peek () {
return Utility_charat(characters, position)
}
/**
* @return {number}
*/
function caret () {
return position
}
/**
* @param {number} begin
* @param {number} end
* @return {string}
*/
function slice (begin, end) {
return Utility_substr(characters, begin, end)
}
/**
* @param {number} type
* @return {number}
*/
function token (type) {
switch (type) {
// \0 \t \n \r \s whitespace token
case 0: case 9: case 10: case 13: case 32:
return 5
// ! + , / > @ ~ isolate token
case 33: case 43: case 44: case 47: case 62: case 64: case 126:
// ; { } breakpoint token
case 59: case 123: case 125:
return 4
// : accompanied token
case 58:
return 3
// " ' ( [ opening delimit token
case 34: case 39: case 40: case 91:
return 2
// ) ] closing delimit token
case 41: case 93:
return 1
}
return 0
}
/**
* @param {string} value
* @return {any[]}
*/
function alloc (value) {
return line = column = 1, Tokenizer_length = Utility_strlen(characters = value), position = 0, []
}
/**
* @param {any} value
* @return {any}
*/
function dealloc (value) {
return characters = '', value
}
/**
* @param {number} type
* @return {string}
*/
function delimit (type) {
return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
}
/**
* @param {string} value
* @return {string[]}
*/
function Tokenizer_tokenize (value) {
return dealloc(tokenizer(alloc(value)))
}
/**
* @param {number} type
* @return {string}
*/
function whitespace (type) {
while (character = peek())
if (character < 33)
next()
else
break
return token(type) > 2 || token(character) > 3 ? '' : ' '
}
/**
* @param {string[]} children
* @return {string[]}
*/
function tokenizer (children) {
while (next())
switch (token(character)) {
case 0: append(identifier(position - 1), children)
break
case 2: append(delimit(character), children)
break
default: append(from(character), children)
}
return children
}
/**
* @param {number} index
* @param {number} count
* @return {string}
*/
function escaping (index, count) {
while (--count && next())
// not 0-9 A-F a-f
if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))
break
return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))
}
/**
* @param {number} type
* @return {number}
*/
function delimiter (type) {
while (next())
switch (character) {
// ] ) " '
case type:
return position
// " '
case 34: case 39:
if (type !== 34 && type !== 39)
delimiter(character)
break
// (
case 40:
if (type === 41)
delimiter(type)
break
// \
case 92:
next()
break
}
return position
}
/**
* @param {number} type
* @param {number} index
* @return {number}
*/
function commenter (type, index) {
while (next())
// //
if (type + character === 47 + 10)
break
// /*
else if (type + character === 42 + 42 && peek() === 47)
break
return '/*' + slice(index, position - 1) + '*' + Utility_from(type === 47 ? type : next())
}
/**
* @param {number} index
* @return {string}
*/
function identifier (index) {
while (!token(peek()))
next()
return slice(index, position)
}
;// CONCATENATED MODULE: ./node_modules/stylis/src/Enum.js
var Enum_MS = '-ms-'
var Enum_MOZ = '-moz-'
var Enum_WEBKIT = '-webkit-'
var COMMENT = 'comm'
var Enum_RULESET = 'rule'
var Enum_DECLARATION = 'decl'
var PAGE = '@page'
var MEDIA = '@media'
var IMPORT = '@import'
var CHARSET = '@charset'
var VIEWPORT = '@viewport'
var SUPPORTS = '@supports'
var DOCUMENT = '@document'
var NAMESPACE = '@namespace'
var Enum_KEYFRAMES = '@keyframes'
var FONT_FACE = '@font-face'
var COUNTER_STYLE = '@counter-style'
var FONT_FEATURE_VALUES = '@font-feature-values'
;// CONCATENATED MODULE: ./node_modules/stylis/src/Serializer.js
/**
* @param {object[]} children
* @param {function} callback
* @return {string}
*/
function Serializer_serialize (children, callback) {
var output = ''
var length = Utility_sizeof(children)
for (var i = 0; i < length; i++)
output += callback(children[i], i, children, callback) || ''
return output
}
/**
* @param {object} element
* @param {number} index
* @param {object[]} children
* @param {function} callback
* @return {string}
*/
function stringify (element, index, children, callback) {
switch (element.type) {
case IMPORT: case Enum_DECLARATION: return element.return = element.return || element.value
case COMMENT: return ''
case Enum_KEYFRAMES: return element.return = element.value + '{' + Serializer_serialize(element.children, callback) + '}'
case Enum_RULESET: element.value = element.props.join(',')
}
return Utility_strlen(children = Serializer_serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
}
;// CONCATENATED MODULE: ./node_modules/stylis/src/Middleware.js
/**
* @param {function[]} collection
* @return {function}
*/
function middleware (collection) {
var length = Utility_sizeof(collection)
return function (element, index, children, callback) {
var output = ''
for (var i = 0; i < length; i++)
output += collection[i](element, index, children, callback) || ''
return output
}
}
/**
* @param {function} callback
* @return {function}
*/
function rulesheet (callback) {
return function (element) {
if (!element.root)
if (element = element.return)
callback(element)
}
}
/**
* @param {object} element
* @param {number} index
* @param {object[]} children
* @param {function} callback
*/
function prefixer (element, index, children, callback) {
if (element.length > -1)
if (!element.return)
switch (element.type) {
case DECLARATION: element.return = prefix(element.value, element.length, children)
return
case KEYFRAMES:
return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)
case RULESET:
if (element.length)
return combine(element.props, function (value) {
switch (match(value, /(::plac\w+|:read-\w+)/)) {
// :read-(only|write)
case ':read-only': case ':read-write':
return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback)
// :placeholder
case '::placeholder':
return serialize([
copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}),
copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}),
copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]})
], callback)
}
return ''
})
}
}
/**
* @param {object} element
* @param {number} index
* @param {object[]} children
*/
function namespace (element) {
switch (element.type) {
case RULESET:
element.props = element.props.map(function (value) {
return combine(tokenize(value), function (value, index, children) {
switch (charat(value, 0)) {
// \f
case 12:
return substr(value, 1, strlen(value))
// \0 ( + > ~
case 0: case 40: case 43: case 62: case 126:
return value
// :
case 58:
if (children[++index] === 'global')
children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1)
// \s
case 32:
return index === 1 ? '' : value
default:
switch (index) {
case 0: element = value
return sizeof(children) > 1 ? '' : value
case index = sizeof(children) - 1: case 2:
return index === 2 ? value + element + element : value + element
default:
return value
}
}
})
})
}
}
;// CONCATENATED MODULE: ./node_modules/stylis/src/Parser.js
/**
* @param {string} value
* @return {object[]}
*/
function compile (value) {
return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))
}
/**
* @param {string} value
* @param {object} root
* @param {object?} parent
* @param {string[]} rule
* @param {string[]} rules
* @param {string[]} rulesets
* @param {number[]} pseudo
* @param {number[]} points
* @param {string[]} declarations
* @return {object}
*/
function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
var index = 0
var offset = 0
var length = pseudo
var atrule = 0
var property = 0
var previous = 0
var variable = 1
var scanning = 1
var ampersand = 1
var character = 0
var type = ''
var props = rules
var children = rulesets
var reference = rule
var characters = type
while (scanning)
switch (previous = character, character = next()) {
// (
case 40:
if (previous != 108 && Utility_charat(characters, length - 1) == 58) {
if (indexof(characters += Utility_replace(delimit(character), '&', '&\f'), '&\f') != -1)
ampersand = -1
break
}
// " ' [
case 34: case 39: case 91:
characters += delimit(character)
break
// \t \n \r \s
case 9: case 10: case 13: case 32:
characters += whitespace(previous)
break
// \
case 92:
characters += escaping(caret() - 1, 7)
continue
// /
case 47:
switch (peek()) {
case 42: case 47:
Utility_append(comment(commenter(next(), caret()), root, parent), declarations)
break
default:
characters += '/'
}
break
// {
case 123 * variable:
points[index++] = Utility_strlen(characters) * ampersand
// } ; \0
case 125 * variable: case 59: case 0:
switch (character) {
// \0 }
case 0: case 125: scanning = 0
// ;
case 59 + offset:
if (property > 0 && (Utility_strlen(characters) - length))
Utility_append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(Utility_replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)
break
// @ ;
case 59: characters += ';'
// { rule/at-rule
default:
Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)
if (character === 123)
if (offset === 0)
parse(characters, root, reference, reference, props, rulesets, length, points, children)
else
switch (atrule === 99 && Utility_charat(characters, 3) === 110 ? 100 : atrule) {
// d m s
case 100: case 109: case 115:
parse(value, reference, reference, rule && Utility_append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children)
break
default:
parse(characters, reference, reference, reference, [''], children, 0, points, children)
}
}
index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo
break
// :
case 58:
length = 1 + Utility_strlen(characters), property = previous
default:
if (variable < 1)
if (character == 123)
--variable
else if (character == 125 && variable++ == 0 && prev() == 125)
continue
switch (characters += Utility_from(character), character * variable) {
// &
case 38:
ampersand = offset > 0 ? 1 : (characters += '\f', -1)
break
// ,
case 44:
points[index++] = (Utility_strlen(characters) - 1) * ampersand, ampersand = 1
break
// @
case 64:
// -
if (peek() === 45)
characters += delimit(next())
atrule = peek(), offset = length = Utility_strlen(type = characters += identifier(caret())), character++
break
// -
case 45:
if (previous === 45 && Utility_strlen(characters) == 2)
variable = 0
}
}
return rulesets
}
/**
* @param {string} value
* @param {object} root
* @param {object?} parent
* @param {number} index
* @param {number} offset
* @param {string[]} rules
* @param {number[]} points
* @param {string} type
* @param {string[]} props
* @param {string[]} children
* @param {number} length
* @return {object}
*/
function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {
var post = offset - 1
var rule = offset === 0 ? rules : ['']
var size = Utility_sizeof(rule)
for (var i = 0, j = 0, k = 0; i < index; ++i)
for (var x = 0, y = Utility_substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
if (z = trim(j > 0 ? rule[x] + ' ' + y : Utility_replace(y, /&\f/g, rule[x])))
props[k++] = z
return node(value, root, parent, offset === 0 ? Enum_RULESET : type, props, children, length)
}
/**
* @param {number} value
* @param {object} root
* @param {object?} parent
* @return {object}
*/
function comment (value, root, parent) {
return node(value, root, parent, COMMENT, Utility_from(Tokenizer_char()), Utility_substr(value, 2, -2), 0)
}
/**
* @param {string} value
* @param {object} root
* @param {object?} parent
* @param {number} length
* @return {object}
*/
function declaration (value, root, parent, length) {
return node(value, root, parent, Enum_DECLARATION, Utility_substr(value, 0, length), Utility_substr(value, length + 1, -1), length)
}
;// CONCATENATED MODULE: ./node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
var previous = 0;
var character = 0;
while (true) {
previous = character;
character = peek(); // &\f
if (previous === 38 && character === 12) {
points[index] = 1;
}
if (token(character)) {
break;
}
next();
}
return slice(begin, position);
};
var toRules = function toRules(parsed, points) {
// pretend we've started with a comma
var index = -1;
var character = 44;
do {
switch (token(character)) {
case 0:
// &\f
if (character === 38 && peek() === 12) {
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
// and when it should just concatenate the outer and inner selectors
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
points[index] = 1;
}
parsed[index] += identifierWithPointTracking(position - 1, points, index);
break;
case 2:
parsed[index] += delimit(character);
break;
case 4:
// comma
if (character === 44) {
// colon
parsed[++index] = peek() === 58 ? '&\f' : '';
points[index] = parsed[index].length;
break;
}
// fallthrough
default:
parsed[index] += Utility_from(character);
}
} while (character = next());
return parsed;
};
var getRules = function getRules(value, points) {
return dealloc(toRules(alloc(value), points));
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
var fixedElements = /* #__PURE__ */new WeakMap();
var compat = function compat(element) {
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
// negative .length indicates that this rule has been already prefixed
element.length < 1) {
return;
}
var value = element.value,
parent = element.parent;
var isImplicitRule = element.column === parent.column && element.line === parent.line;
while (parent.type !== 'rule') {
parent = parent.parent;
if (!parent) return;
} // short-circuit for the simplest case
if (element.props.length === 1 && value.charCodeAt(0) !== 58
/* colon */
&& !fixedElements.get(parent)) {
return;
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
if (isImplicitRule) {
return;
}
fixedElements.set(element, true);
var points = [];
var rules = getRules(value, points);
var parentRules = parent.props;
for (var i = 0, k = 0; i < rules.length; i++) {
for (var j = 0; j < parentRules.length; j++, k++) {
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
}
}
};
var removeLabel = function removeLabel(element) {
if (element.type === 'decl') {
var value = element.value;
if ( // charcode for l
value.charCodeAt(0) === 108 && // charcode for b
value.charCodeAt(2) === 98) {
// this ignores label
element["return"] = '';
element.value = '';
}
}
};
var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
var isIgnoringComment = function isIgnoringComment(element) {
return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
};
var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
return function (element, index, children) {
if (element.type !== 'rule' || cache.compat) return;
var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
if (unsafePseudoClasses) {
var isNested = element.parent === children[0]; // in nested rules comments become children of the "auto-inserted" rule
//
// considering this input:
// .a {
// .b /* comm */ {}
// color: hotpink;
// }
// we get output corresponding to this:
// .a {
// & {
// /* comm */
// color: hotpink;
// }
// .b {}
// }
var commentContainer = isNested ? children[0].children : // global rule at the root level
children;
for (var i = commentContainer.length - 1; i >= 0; i--) {
var node = commentContainer[i];
if (node.line < element.line) {
break;
} // it is quite weird but comments are *usually* put at `column: element.column - 1`
// so we seek *from the end* for the node that is earlier than the rule's `element` and check that
// this will also match inputs like this:
// .a {
// /* comm */
// .b {}
// }
//
// but that is fine
//
// it would be the easiest to change the placement of the comment to be the first child of the rule:
// .a {
// .b { /* comm */ }
// }
// with such inputs we wouldn't have to search for the comment at all
// TODO: consider changing this comment placement in the next major version
if (node.column < element.column) {
if (isIgnoringComment(node)) {
return;
}
break;
}
}
unsafePseudoClasses.forEach(function (unsafePseudoClass) {
console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
});
}
};
};
var isImportRule = function isImportRule(element) {
return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
};
var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
for (var i = index - 1; i >= 0; i--) {
if (!isImportRule(children[i])) {
return true;
}
}
return false;
}; // use this to remove incorrect elements from further processing
// so they don't get handed to the `sheet` (or anything else)
// as that could potentially lead to additional logs which in turn could be overhelming to the user
var nullifyElement = function nullifyElement(element) {
element.type = '';
element.value = '';
element["return"] = '';
element.children = '';
element.props = '';
};
var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
if (!isImportRule(element)) {
return;
}
if (element.parent) {
console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
nullifyElement(element);
} else if (isPrependedWithRegularRules(index, children)) {
console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
nullifyElement(element);
}
};
/* eslint-disable no-fallthrough */
function emotion_cache_browser_esm_prefix(value, length) {
switch (hash(value, length)) {
// color-adjust
case 5103:
return Enum_WEBKIT + 'print-' + value + value;
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
case 5737:
case 4201:
case 3177:
case 3433:
case 1641:
case 4457:
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
case 5572:
case 6356:
case 5844:
case 3191:
case 6645:
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
case 6391:
case 5879:
case 5623:
case 6135:
case 4599:
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
case 4215:
case 6389:
case 5109:
case 5365:
case 5621:
case 3829:
return Enum_WEBKIT + value + value;
// appearance, user-select, transform, hyphens, text-size-adjust
case 5349:
case 4246:
case 4810:
case 6968:
case 2756:
return Enum_WEBKIT + value + Enum_MOZ + value + Enum_MS + value + value;
// flex, flex-direction
case 6828:
case 4268:
return Enum_WEBKIT + value + Enum_MS + value + value;
// order
case 6165:
return Enum_WEBKIT + value + Enum_MS + 'flex-' + value + value;
// align-items
case 5187:
return Enum_WEBKIT + value + Utility_replace(value, /(\w+).+(:[^]+)/, Enum_WEBKIT + 'box-$1$2' + Enum_MS + 'flex-$1$2') + value;
// align-self
case 5443:
return Enum_WEBKIT + value + Enum_MS + 'flex-item-' + Utility_replace(value, /flex-|-self/, '') + value;
// align-content
case 4675:
return Enum_WEBKIT + value + Enum_MS + 'flex-line-pack' + Utility_replace(value, /align-content|flex-|-self/, '') + value;
// flex-shrink
case 5548:
return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'shrink', 'negative') + value;
// flex-basis
case 5292:
return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'basis', 'preferred-size') + value;
// flex-grow
case 6060:
return Enum_WEBKIT + 'box-' + Utility_replace(value, '-grow', '') + Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'grow', 'positive') + value;
// transition
case 4554:
return Enum_WEBKIT + Utility_replace(value, /([^-])(transform)/g, '$1' + Enum_WEBKIT + '$2') + value;
// cursor
case 6187:
return Utility_replace(Utility_replace(Utility_replace(value, /(zoom-|grab)/, Enum_WEBKIT + '$1'), /(image-set)/, Enum_WEBKIT + '$1'), value, '') + value;
// background, background-image
case 5495:
case 3959:
return Utility_replace(value, /(image-set\([^]*)/, Enum_WEBKIT + '$1' + '$`$1');
// justify-content
case 4968:
return Utility_replace(Utility_replace(value, /(.+:)(flex-)?(.*)/, Enum_WEBKIT + 'box-pack:$3' + Enum_MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + Enum_WEBKIT + value + value;
// (margin|padding)-inline-(start|end)
case 4095:
case 3583:
case 4068:
case 2532:
return Utility_replace(value, /(.+)-inline(.+)/, Enum_WEBKIT + '$1$2') + value;
// (min|max)?(width|height|inline-size|block-size)
case 8116:
case 7059:
case 5753:
case 5535:
case 5445:
case 5701:
case 4933:
case 4677:
case 5533:
case 5789:
case 5021:
case 4765:
// stretch, max-content, min-content, fill-available
if (Utility_strlen(value) - 1 - length > 6) switch (Utility_charat(value, length + 1)) {
// (m)ax-content, (m)in-content
case 109:
// -
if (Utility_charat(value, length + 4) !== 45) break;
// (f)ill-available, (f)it-content
case 102:
return Utility_replace(value, /(.+:)(.+)-([^]+)/, '$1' + Enum_WEBKIT + '$2-$3' + '$1' + Enum_MOZ + (Utility_charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
// (s)tretch
case 115:
return ~indexof(value, 'stretch') ? emotion_cache_browser_esm_prefix(Utility_replace(value, 'stretch', 'fill-available'), length) + value : value;
}
break;
// position: sticky
case 4949:
// (s)ticky?
if (Utility_charat(value, length + 1) !== 115) break;
// display: (flex|inline-flex)
case 6444:
switch (Utility_charat(value, Utility_strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
// stic(k)y
case 107:
return Utility_replace(value, ':', ':' + Enum_WEBKIT) + value;
// (inline-)?fl(e)x
case 101:
return Utility_replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + Enum_WEBKIT + (Utility_charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + Enum_WEBKIT + '$2$3' + '$1' + Enum_MS + '$2box$3') + value;
}
break;
// writing-mode
case 5936:
switch (Utility_charat(value, length + 11)) {
// vertical-l(r)
case 114:
return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
// vertical-r(l)
case 108:
return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
// horizontal(-)tb
case 45:
return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
}
return Enum_WEBKIT + value + Enum_MS + value + value;
}
return value;
}
var emotion_cache_browser_esm_prefixer = function prefixer(element, index, children, callback) {
if (element.length > -1) if (!element["return"]) switch (element.type) {
case Enum_DECLARATION:
element["return"] = emotion_cache_browser_esm_prefix(element.value, element.length);
break;
case Enum_KEYFRAMES:
return Serializer_serialize([Tokenizer_copy(element, {
value: Utility_replace(element.value, '@', '@' + Enum_WEBKIT)
})], callback);
case Enum_RULESET:
if (element.length) return Utility_combine(element.props, function (value) {
switch (Utility_match(value, /(::plac\w+|:read-\w+)/)) {
// :read-(only|write)
case ':read-only':
case ':read-write':
return Serializer_serialize([Tokenizer_copy(element, {
props: [Utility_replace(value, /:(read-\w+)/, ':' + Enum_MOZ + '$1')]
})], callback);
// :placeholder
case '::placeholder':
return Serializer_serialize([Tokenizer_copy(element, {
props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_WEBKIT + 'input-$1')]
}), Tokenizer_copy(element, {
props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_MOZ + '$1')]
}), Tokenizer_copy(element, {
props: [Utility_replace(value, /:(plac\w+)/, Enum_MS + 'input-$1')]
})], callback);
}
return '';
});
}
};
var defaultStylisPlugins = [emotion_cache_browser_esm_prefixer];
var createCache = function createCache(options) {
var key = options.key;
if (false) {}
if ( key === 'css') {
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
// note this very very intentionally targets all style elements regardless of the key to ensure
// that creating a cache works inside of render of a React component
Array.prototype.forEach.call(ssrStyles, function (node) {
// we want to only move elements which have a space in the data-emotion attribute value
// because that indicates that it is an Emotion 11 server-side rendered style elements
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
// will not result in the Emotion 10 styles being destroyed
var dataEmotionAttribute = node.getAttribute('data-emotion');
if (dataEmotionAttribute.indexOf(' ') === -1) {
return;
}
document.head.appendChild(node);
node.setAttribute('data-s', '');
});
}
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
if (false) {}
var inserted = {};
var container;
var nodesToHydrate = [];
{
container = options.container || document.head;
Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe
for (var i = 1; i < attrib.length; i++) {
inserted[attrib[i]] = true;
}
nodesToHydrate.push(node);
});
}
var _insert;
var omnipresentPlugins = [compat, removeLabel];
if (false) {}
{
var currentSheet;
var finalizingPlugins = [stringify, false ? 0 : rulesheet(function (rule) {
currentSheet.insert(rule);
})];
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
var stylis = function stylis(styles) {
return Serializer_serialize(compile(styles), serializer);
};
_insert = function insert(selector, serialized, sheet, shouldCache) {
currentSheet = sheet;
if (false) {}
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
if (shouldCache) {
cache.inserted[serialized.name] = true;
}
};
}
var cache = {
key: key,
sheet: new StyleSheet({
key: key,
container: container,
nonce: options.nonce,
speedy: options.speedy,
prepend: options.prepend,
insertionPoint: options.insertionPoint
}),
nonce: options.nonce,
inserted: inserted,
registered: {},
insert: _insert
};
cache.sheet.hydrate(nodesToHydrate);
return cache;
};
/* harmony default export */ const emotion_cache_browser_esm = (createCache);
;// CONCATENATED MODULE: ./node_modules/@emotion/hash/dist/emotion-hash.esm.js
/* eslint-disable */
// Inspired by https://github.com/garycourt/murmurhash-js
// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
function murmur2(str) {
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
// const m = 0x5bd1e995;
// const r = 24;
// Initialize the hash
var h = 0; // Mix 4 bytes at a time into the hash
var k,
i = 0,
len = str.length;
for (; len >= 4; ++i, len -= 4) {
k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
k =
/* Math.imul(k, m): */
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
k ^=
/* k >>> r: */
k >>> 24;
h =
/* Math.imul(k, m): */
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
/* Math.imul(h, m): */
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
} // Handle the last few bytes of the input array
switch (len) {
case 3:
h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
case 2:
h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
case 1:
h ^= str.charCodeAt(i) & 0xff;
h =
/* Math.imul(h, m): */
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
} // Do a few final mixes of the hash to ensure the last few
// bytes are well-incorporated.
h ^= h >>> 13;
h =
/* Math.imul(h, m): */
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
return ((h ^ h >>> 15) >>> 0).toString(36);
}
/* harmony default export */ const emotion_hash_esm = (murmur2);
;// CONCATENATED MODULE: ./node_modules/@emotion/unitless/dist/emotion-unitless.esm.js
var unitlessKeys = {
animationIterationCount: 1,
borderImageOutset: 1,
borderImageSlice: 1,
borderImageWidth: 1,
boxFlex: 1,
boxFlexGroup: 1,
boxOrdinalGroup: 1,
columnCount: 1,
columns: 1,
flex: 1,
flexGrow: 1,
flexPositive: 1,
flexShrink: 1,
flexNegative: 1,
flexOrder: 1,
gridRow: 1,
gridRowEnd: 1,
gridRowSpan: 1,
gridRowStart: 1,
gridColumn: 1,
gridColumnEnd: 1,
gridColumnSpan: 1,
gridColumnStart: 1,
msGridRow: 1,
msGridRowSpan: 1,
msGridColumn: 1,
msGridColumnSpan: 1,
fontWeight: 1,
lineHeight: 1,
opacity: 1,
order: 1,
orphans: 1,
tabSize: 1,
widows: 1,
zIndex: 1,
zoom: 1,
WebkitLineClamp: 1,
// SVG-related properties
fillOpacity: 1,
floodOpacity: 1,
stopOpacity: 1,
strokeDasharray: 1,
strokeDashoffset: 1,
strokeMiterlimit: 1,
strokeOpacity: 1,
strokeWidth: 1
};
/* harmony default export */ const emotion_unitless_esm = (unitlessKeys);
;// CONCATENATED MODULE: ./node_modules/@emotion/serialize/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
function memoize(fn) {
var cache = Object.create(null);
return function (arg) {
if (cache[arg] === undefined) cache[arg] = fn(arg);
return cache[arg];
};
}
;// CONCATENATED MODULE: ./node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js
var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).";
var hyphenateRegex = /[A-Z]|^ms/g;
var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
var isCustomProperty = function isCustomProperty(property) {
return property.charCodeAt(1) === 45;
};
var isProcessableValue = function isProcessableValue(value) {
return value != null && typeof value !== 'boolean';
};
var processStyleName = /* #__PURE__ */memoize(function (styleName) {
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
});
var processStyleValue = function processStyleValue(key, value) {
switch (key) {
case 'animation':
case 'animationName':
{
if (typeof value === 'string') {
return value.replace(animationRegex, function (match, p1, p2) {
cursor = {
name: p1,
styles: p2,
next: cursor
};
return p1;
});
}
}
}
if (emotion_unitless_esm[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {
return value + 'px';
}
return value;
};
if (false) { var hyphenatedCache, hyphenPattern, msPattern, oldProcessStyleValue, contentValues, contentValuePattern; }
var noComponentSelectorMessage = (/* unused pure expression or super */ null && ('Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.'));
function handleInterpolation(mergedProps, registered, interpolation) {
if (interpolation == null) {
return '';
}
if (interpolation.__emotion_styles !== undefined) {
if (false) {}
return interpolation;
}
switch (typeof interpolation) {
case 'boolean':
{
return '';
}
case 'object':
{
if (interpolation.anim === 1) {
cursor = {
name: interpolation.name,
styles: interpolation.styles,
next: cursor
};
return interpolation.name;
}
if (interpolation.styles !== undefined) {
var next = interpolation.next;
if (next !== undefined) {
// not the most efficient thing ever but this is a pretty rare case
// and there will be very few iterations of this generally
while (next !== undefined) {
cursor = {
name: next.name,
styles: next.styles,
next: cursor
};
next = next.next;
}
}
var styles = interpolation.styles + ";";
if (false) {}
return styles;
}
return createStringFromObject(mergedProps, registered, interpolation);
}
case 'function':
{
if (mergedProps !== undefined) {
var previousCursor = cursor;
var result = interpolation(mergedProps);
cursor = previousCursor;
return handleInterpolation(mergedProps, registered, result);
} else if (false) {}
break;
}
case 'string':
if (false) { var replaced, matched; }
break;
} // finalize string values (regular strings and functions interpolated into css calls)
if (registered == null) {
return interpolation;
}
var cached = registered[interpolation];
return cached !== undefined ? cached : interpolation;
}
function createStringFromObject(mergedProps, registered, obj) {
var string = '';
if (Array.isArray(obj)) {
for (var i = 0; i < obj.length; i++) {
string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
}
} else {
for (var _key in obj) {
var value = obj[_key];
if (typeof value !== 'object') {
if (registered != null && registered[value] !== undefined) {
string += _key + "{" + registered[value] + "}";
} else if (isProcessableValue(value)) {
string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";";
}
} else {
if (_key === 'NO_COMPONENT_SELECTOR' && "production" !== 'production') {}
if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
for (var _i = 0; _i < value.length; _i++) {
if (isProcessableValue(value[_i])) {
string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";";
}
}
} else {
var interpolated = handleInterpolation(mergedProps, registered, value);
switch (_key) {
case 'animation':
case 'animationName':
{
string += processStyleName(_key) + ":" + interpolated + ";";
break;
}
default:
{
if (false) {}
string += _key + "{" + interpolated + "}";
}
}
}
}
}
}
return string;
}
var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g;
var sourceMapPattern;
if (false) {} // this is the cursor for keyframes
// keyframes are stored on the SerializedStyles object as a linked list
var cursor;
var emotion_serialize_browser_esm_serializeStyles = function serializeStyles(args, registered, mergedProps) {
if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
return args[0];
}
var stringMode = true;
var styles = '';
cursor = undefined;
var strings = args[0];
if (strings == null || strings.raw === undefined) {
stringMode = false;
styles += handleInterpolation(mergedProps, registered, strings);
} else {
if (false) {}
styles += strings[0];
} // we start at 1 since we've already handled the first arg
for (var i = 1; i < args.length; i++) {
styles += handleInterpolation(mergedProps, registered, args[i]);
if (stringMode) {
if (false) {}
styles += strings[i];
}
}
var sourceMap;
if (false) {} // using a global regex with .exec is stateful so lastIndex has to be reset each time
labelPattern.lastIndex = 0;
var identifierName = '';
var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
while ((match = labelPattern.exec(styles)) !== null) {
identifierName += '-' + // $FlowFixMe we know it's not null
match[1];
}
var name = emotion_hash_esm(styles) + identifierName;
if (false) {}
return {
name: name,
styles: styles,
next: cursor
};
};
;// CONCATENATED MODULE: ./node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js
var syncFallback = function syncFallback(create) {
return create();
};
var useInsertionEffect = external_React_['useInsertion' + 'Effect'] ? external_React_['useInsertion' + 'Effect'] : false;
var emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback;
var emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectWithLayoutFallback = (/* unused pure expression or super */ null && (useInsertionEffect || useLayoutEffect));
;// CONCATENATED MODULE: ./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js
var emotion_element_6a883da9_browser_esm_hasOwnProperty = {}.hasOwnProperty;
var EmotionCacheContext = /* #__PURE__ */(0,external_React_.createContext)( // we're doing this to avoid preconstruct's dead code elimination in this one case
// because this module is primarily intended for the browser and node
// but it's also required in react native and similar environments sometimes
// and we could have a special build just for that
// but this is much easier and the native packages
// might use a different theme context in the future anyway
typeof HTMLElement !== 'undefined' ? /* #__PURE__ */emotion_cache_browser_esm({
key: 'css'
}) : null);
if (false) {}
var CacheProvider = EmotionCacheContext.Provider;
var __unsafe_useEmotionCache = function useEmotionCache() {
return (0,external_React_.useContext)(EmotionCacheContext);
};
var emotion_element_6a883da9_browser_esm_withEmotionCache = function withEmotionCache(func) {
// $FlowFixMe
return /*#__PURE__*/(0,external_React_.forwardRef)(function (props, ref) {
// the cache will never be null in the browser
var cache = (0,external_React_.useContext)(EmotionCacheContext);
return func(props, cache, ref);
});
};
var emotion_element_6a883da9_browser_esm_ThemeContext = /* #__PURE__ */(0,external_React_.createContext)({});
if (false) {}
var useTheme = function useTheme() {
return useContext(emotion_element_6a883da9_browser_esm_ThemeContext);
};
var getTheme = function getTheme(outerTheme, theme) {
if (typeof theme === 'function') {
var mergedTheme = theme(outerTheme);
if (false) {}
return mergedTheme;
}
if (false) {}
return _extends({}, outerTheme, theme);
};
var createCacheWithTheme = /* #__PURE__ */(/* unused pure expression or super */ null && (weakMemoize(function (outerTheme) {
return weakMemoize(function (theme) {
return getTheme(outerTheme, theme);
});
})));
var ThemeProvider = function ThemeProvider(props) {
var theme = useContext(emotion_element_6a883da9_browser_esm_ThemeContext);
if (props.theme !== theme) {
theme = createCacheWithTheme(theme)(props.theme);
}
return /*#__PURE__*/createElement(emotion_element_6a883da9_browser_esm_ThemeContext.Provider, {
value: theme
}, props.children);
};
function withTheme(Component) {
var componentName = Component.displayName || Component.name || 'Component';
var render = function render(props, ref) {
var theme = useContext(emotion_element_6a883da9_browser_esm_ThemeContext);
return /*#__PURE__*/createElement(Component, _extends({
theme: theme,
ref: ref
}, props));
}; // $FlowFixMe
var WithTheme = /*#__PURE__*/forwardRef(render);
WithTheme.displayName = "WithTheme(" + componentName + ")";
return hoistNonReactStatics(WithTheme, Component);
}
var getLastPart = function getLastPart(functionName) {
// The match may be something like 'Object.createEmotionProps' or
// 'Loader.prototype.render'
var parts = functionName.split('.');
return parts[parts.length - 1];
};
var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
// V8
var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
if (match) return getLastPart(match[1]); // Safari / Firefox
match = /^([A-Za-z0-9$.]+)@/.exec(line);
if (match) return getLastPart(match[1]);
return undefined;
};
var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS
// identifiers, thus we only need to replace what is a valid character for JS,
// but not for CSS.
var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
return identifier.replace(/\$/g, '-');
};
var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
if (!stackTrace) return undefined;
var lines = stackTrace.split('\n');
for (var i = 0; i < lines.length; i++) {
var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error"
if (!functionName) continue; // If we reach one of these, we have gone too far and should quit
if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an
// uppercase letter
if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);
}
return undefined;
};
var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
var emotion_element_6a883da9_browser_esm_createEmotionProps = function createEmotionProps(type, props) {
if (false) {}
var newProps = {};
for (var key in props) {
if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key)) {
newProps[key] = props[key];
}
}
newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when
// the label hasn't already been computed
if (false) { var label; }
return newProps;
};
var Insertion = function Insertion(_ref) {
var cache = _ref.cache,
serialized = _ref.serialized,
isStringTag = _ref.isStringTag;
registerStyles(cache, serialized, isStringTag);
var rules = useInsertionEffectAlwaysWithSyncFallback(function () {
return insertStyles(cache, serialized, isStringTag);
});
return null;
};
var emotion_element_6a883da9_browser_esm_Emotion = /* #__PURE__ */(/* unused pure expression or super */ null && (emotion_element_6a883da9_browser_esm_withEmotionCache(function (props, cache, ref) {
var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
// not passing the registered cache to serializeStyles because it would
// make certain babel optimisations not possible
if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {
cssProp = cache.registered[cssProp];
}
var WrappedComponent = props[typePropName];
var registeredStyles = [cssProp];
var className = '';
if (typeof props.className === 'string') {
className = getRegisteredStyles(cache.registered, registeredStyles, props.className);
} else if (props.className != null) {
className = props.className + " ";
}
var serialized = serializeStyles(registeredStyles, undefined, useContext(emotion_element_6a883da9_browser_esm_ThemeContext));
if (false) { var labelFromStack; }
className += cache.key + "-" + serialized.name;
var newProps = {};
for (var key in props) {
if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && ( true || 0)) {
newProps[key] = props[key];
}
}
newProps.ref = ref;
newProps.className = className;
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, {
cache: cache,
serialized: serialized,
isStringTag: typeof WrappedComponent === 'string'
}), /*#__PURE__*/createElement(WrappedComponent, newProps));
})));
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js
var isBrowser = "object" !== 'undefined';
function emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, classNames) {
var rawClassName = '';
classNames.split(' ').forEach(function (className) {
if (registered[className] !== undefined) {
registeredStyles.push(registered[className] + ";");
} else {
rawClassName += className + " ";
}
});
return rawClassName;
}
var emotion_utils_browser_esm_registerStyles = function registerStyles(cache, serialized, isStringTag) {
var className = cache.key + "-" + serialized.name;
if ( // we only need to add the styles to the registered cache if the
// class name could be used further down
// the tree but if it's a string tag, we know it won't
// so we don't have to add it to registered cache.
// this improves memory usage since we can avoid storing the whole style string
(isStringTag === false || // we need to always store it if we're in compat mode and
// in node since emotion-server relies on whether a style is in
// the registered cache to know whether a style is global or not
// also, note that this check will be dead code eliminated in the browser
isBrowser === false ) && cache.registered[className] === undefined) {
cache.registered[className] = serialized.styles;
}
};
var emotion_utils_browser_esm_insertStyles = function insertStyles(cache, serialized, isStringTag) {
emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag);
var className = cache.key + "-" + serialized.name;
if (cache.inserted[serialized.name] === undefined) {
var current = serialized;
do {
var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
current = current.next;
} while (current !== undefined);
}
};
;// CONCATENATED MODULE: ./node_modules/@emotion/css/create-instance/dist/emotion-css-create-instance.esm.js
function insertWithoutScoping(cache, serialized) {
if (cache.inserted[serialized.name] === undefined) {
return cache.insert('', serialized, cache.sheet, true);
}
}
function merge(registered, css, className) {
var registeredStyles = [];
var rawClassName = emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, className);
if (registeredStyles.length < 2) {
return className;
}
return rawClassName + css(registeredStyles);
}
var createEmotion = function createEmotion(options) {
var cache = emotion_cache_browser_esm(options); // $FlowFixMe
cache.sheet.speedy = function (value) {
if (false) {}
this.isSpeedy = value;
};
cache.compat = true;
var css = function css() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var serialized = emotion_serialize_browser_esm_serializeStyles(args, cache.registered, undefined);
emotion_utils_browser_esm_insertStyles(cache, serialized, false);
return cache.key + "-" + serialized.name;
};
var keyframes = function keyframes() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
var serialized = emotion_serialize_browser_esm_serializeStyles(args, cache.registered);
var animation = "animation-" + serialized.name;
insertWithoutScoping(cache, {
name: serialized.name,
styles: "@keyframes " + animation + "{" + serialized.styles + "}"
});
return animation;
};
var injectGlobal = function injectGlobal() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
var serialized = emotion_serialize_browser_esm_serializeStyles(args, cache.registered);
insertWithoutScoping(cache, serialized);
};
var cx = function cx() {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
return merge(cache.registered, css, emotion_css_create_instance_esm_classnames(args));
};
return {
css: css,
cx: cx,
injectGlobal: injectGlobal,
keyframes: keyframes,
hydrate: function hydrate(ids) {
ids.forEach(function (key) {
cache.inserted[key] = true;
});
},
flush: function flush() {
cache.registered = {};
cache.inserted = {};
cache.sheet.flush();
},
// $FlowFixMe
sheet: cache.sheet,
cache: cache,
getRegisteredStyles: emotion_utils_browser_esm_getRegisteredStyles.bind(null, cache.registered),
merge: merge.bind(null, cache.registered, css)
};
};
var emotion_css_create_instance_esm_classnames = function classnames(args) {
var cls = '';
for (var i = 0; i < args.length; i++) {
var arg = args[i];
if (arg == null) continue;
var toAdd = void 0;
switch (typeof arg) {
case 'boolean':
break;
case 'object':
{
if (Array.isArray(arg)) {
toAdd = classnames(arg);
} else {
toAdd = '';
for (var k in arg) {
if (arg[k] && k) {
toAdd && (toAdd += ' ');
toAdd += k;
}
}
}
break;
}
default:
{
toAdd = arg;
}
}
if (toAdd) {
cls && (cls += ' ');
cls += toAdd;
}
}
return cls;
};
/* harmony default export */ const emotion_css_create_instance_esm = (createEmotion);
;// CONCATENATED MODULE: ./node_modules/@emotion/css/dist/emotion-css.esm.js
var _createEmotion = emotion_css_create_instance_esm({
key: 'css'
}),
flush = _createEmotion.flush,
hydrate = _createEmotion.hydrate,
emotion_css_esm_cx = _createEmotion.cx,
emotion_css_esm_merge = _createEmotion.merge,
emotion_css_esm_getRegisteredStyles = _createEmotion.getRegisteredStyles,
injectGlobal = _createEmotion.injectGlobal,
keyframes = _createEmotion.keyframes,
css = _createEmotion.css,
sheet = _createEmotion.sheet,
cache = _createEmotion.cache;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
const isSerializedStyles = o => typeof o !== 'undefined' && o !== null && ['name', 'styles'].every(p => typeof o[p] !== 'undefined');
/**
* Retrieve a `cx` function that knows how to handle `SerializedStyles`
* returned by the `@emotion/react` `css` function in addition to what
* `cx` normally knows how to handle. It also hooks into the Emotion
* Cache, allowing `css` calls to work inside iframes.
*
* ```jsx
* import { css } from '@emotion/react';
*
* const styles = css`
* color: red
* `;
*
* function RedText( { className, ...props } ) {
* const cx = useCx();
*
* const classes = cx(styles, className);
*
* return <span className={classes} {...props} />;
* }
* ```
*/
const useCx = () => {
const cache = __unsafe_useEmotionCache();
const cx = (0,external_wp_element_namespaceObject.useCallback)((...classNames) => {
if (cache === null) {
throw new Error('The `useCx` hook should be only used within a valid Emotion Cache Context');
}
return emotion_css_esm_cx(...classNames.map(arg => {
if (isSerializedStyles(arg)) {
emotion_utils_browser_esm_insertStyles(cache, arg, false);
return `${cache.key}-${arg.name}`;
}
return arg;
}));
}, [cache]);
return cx;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/context/use-context-system.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @template TProps
* @typedef {TProps & { className: string }} ConnectedProps
*/
/**
* Custom hook that derives registered props from the Context system.
* These derived props are then consolidated with incoming component props.
*
* @template {{ className?: string }} P
* @param {P} props Incoming props from the component.
* @param {string} namespace The namespace to register and to derive context props from.
* @return {ConnectedProps<P>} The connected props.
*/
function useContextSystem(props, namespace) {
const contextSystemProps = useComponentsContext();
if (typeof namespace === 'undefined') {
true ? external_wp_warning_default()('useContextSystem: Please provide a namespace') : 0;
}
const contextProps = contextSystemProps?.[namespace] || {};
/* eslint-disable jsdoc/no-undefined-types */
/** @type {ConnectedProps<P>} */
// @ts-ignore We fill in the missing properties below
const finalComponentProps = {
...getConnectedNamespace(),
...getNamespace(namespace)
};
/* eslint-enable jsdoc/no-undefined-types */
const {
_overrides: overrideProps,
...otherContextProps
} = contextProps;
const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;
const cx = useCx();
const classes = cx(getStyledClassNameFromKey(namespace), props.className);
// Provides the ability to customize the render of the component.
const rendered = typeof initialMergedProps.renderChildren === 'function' ? initialMergedProps.renderChildren(initialMergedProps) : initialMergedProps.children;
for (const key in initialMergedProps) {
// @ts-ignore filling in missing props
finalComponentProps[key] = initialMergedProps[key];
}
for (const key in overrideProps) {
// @ts-ignore filling in missing props
finalComponentProps[key] = overrideProps[key];
}
// Setting an `undefined` explicitly can cause unintended overwrites
// when a `cloneElement()` is involved.
if (rendered !== undefined) {
// @ts-ignore
finalComponentProps.children = rendered;
}
finalComponentProps.className = classes;
return finalComponentProps;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/context/context-connect.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Forwards ref (React.ForwardRef) and "Connects" (or registers) a component
* within the Context system under a specified namespace.
*
* @param Component The component to register into the Context system.
* @param namespace The namespace to register the component under.
* @return The connected WordPressComponent
*/
function contextConnect(Component, namespace) {
return _contextConnect(Component, namespace, {
forwardsRef: true
});
}
/**
* "Connects" (or registers) a component within the Context system under a specified namespace.
* Does not forward a ref.
*
* @param Component The component to register into the Context system.
* @param namespace The namespace to register the component under.
* @return The connected WordPressComponent
*/
function contextConnectWithoutRef(Component, namespace) {
return _contextConnect(Component, namespace);
}
// This is an (experimental) evolution of the initial connect() HOC.
// The hope is that we can improve render performance by removing functional
// component wrappers.
function _contextConnect(Component, namespace, options) {
const WrappedComponent = options?.forwardsRef ? (0,external_wp_element_namespaceObject.forwardRef)(Component) : Component;
if (typeof namespace === 'undefined') {
true ? external_wp_warning_default()('contextConnect: Please provide a namespace') : 0;
}
// @ts-expect-error internal property
let mergedNamespace = WrappedComponent[CONNECT_STATIC_NAMESPACE] || [namespace];
/**
* Consolidate (merge) namespaces before attaching it to the WrappedComponent.
*/
if (Array.isArray(namespace)) {
mergedNamespace = [...mergedNamespace, ...namespace];
}
if (typeof namespace === 'string') {
mergedNamespace = [...mergedNamespace, namespace];
}
// @ts-expect-error We can't rely on inferred types here because of the
// `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/4f3a11243c365f94892e479bff0b922ccc4ccda3/packages/components/src/context/wordpress-component.ts#L32-L33
return Object.assign(WrappedComponent, {
[CONNECT_STATIC_NAMESPACE]: [...new Set(mergedNamespace)],
displayName: namespace,
selector: `.${getStyledClassNameFromKey(namespace)}`
});
}
/**
* Attempts to retrieve the connected namespace from a component.
*
* @param Component The component to retrieve a namespace from.
* @return The connected namespaces.
*/
function getConnectNamespace(Component) {
if (!Component) return [];
let namespaces = [];
// @ts-ignore internal property
if (Component[CONNECT_STATIC_NAMESPACE]) {
// @ts-ignore internal property
namespaces = Component[CONNECT_STATIC_NAMESPACE];
}
// @ts-ignore
if (Component.type && Component.type[CONNECT_STATIC_NAMESPACE]) {
// @ts-ignore
namespaces = Component.type[CONNECT_STATIC_NAMESPACE];
}
return namespaces;
}
/**
* Checks to see if a component is connected within the Context system.
*
* @param Component The component to retrieve a namespace from.
* @param match The namespace to check.
*/
function hasConnectNamespace(Component, match) {
if (!Component) return false;
if (typeof match === 'string') {
return getConnectNamespace(Component).includes(match);
}
if (Array.isArray(match)) {
return match.some(result => getConnectNamespace(Component).includes(result));
}
return false;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/visually-hidden/styles.js
/**
* External dependencies
*/
const visuallyHidden = {
border: 0,
clip: 'rect(1px, 1px, 1px, 1px)',
WebkitClipPath: 'inset( 50% )',
clipPath: 'inset( 50% )',
height: '1px',
margin: '-1px',
overflow: 'hidden',
padding: 0,
position: 'absolute',
width: '1px',
wordWrap: 'normal'
};
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
function extends_extends() {
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_extends.apply(this, arguments);
}
;// CONCATENATED MODULE: ./node_modules/@emotion/styled/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
function emotion_memoize_esm_memoize(fn) {
var cache = Object.create(null);
return function (arg) {
if (cache[arg] === undefined) cache[arg] = fn(arg);
return cache[arg];
};
}
;// CONCATENATED MODULE: ./node_modules/@emotion/styled/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
var isPropValid = /* #__PURE__ */emotion_memoize_esm_memoize(function (prop) {
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
/* o */
&& prop.charCodeAt(1) === 110
/* n */
&& prop.charCodeAt(2) < 91;
}
/* Z+1 */
);
;// CONCATENATED MODULE: ./node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js
var testOmitPropsOnStringTag = isPropValid;
var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) {
return key !== 'theme';
};
var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) {
return typeof tag === 'string' && // 96 is one less than the char code
// for "a" so this is checking that
// it's a lowercase character
tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent;
};
var composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) {
var shouldForwardProp;
if (options) {
var optionsShouldForwardProp = options.shouldForwardProp;
shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) {
return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName);
} : optionsShouldForwardProp;
}
if (typeof shouldForwardProp !== 'function' && isReal) {
shouldForwardProp = tag.__emotion_forwardProp;
}
return shouldForwardProp;
};
var emotion_styled_base_browser_esm_ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
var emotion_styled_base_browser_esm_Insertion = function Insertion(_ref) {
var cache = _ref.cache,
serialized = _ref.serialized,
isStringTag = _ref.isStringTag;
emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag);
var rules = emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback(function () {
return emotion_utils_browser_esm_insertStyles(cache, serialized, isStringTag);
});
return null;
};
var createStyled = function createStyled(tag, options) {
if (false) {}
var isReal = tag.__emotion_real === tag;
var baseTag = isReal && tag.__emotion_base || tag;
var identifierName;
var targetClassName;
if (options !== undefined) {
identifierName = options.label;
targetClassName = options.target;
}
var shouldForwardProp = composeShouldForwardProps(tag, options, isReal);
var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag);
var shouldUseAs = !defaultShouldForwardProp('as');
return function () {
var args = arguments;
var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : [];
if (identifierName !== undefined) {
styles.push("label:" + identifierName + ";");
}
if (args[0] == null || args[0].raw === undefined) {
styles.push.apply(styles, args);
} else {
if (false) {}
styles.push(args[0][0]);
var len = args.length;
var i = 1;
for (; i < len; i++) {
if (false) {}
styles.push(args[i], args[0][i]);
}
} // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class
var Styled = emotion_element_6a883da9_browser_esm_withEmotionCache(function (props, cache, ref) {
var FinalTag = shouldUseAs && props.as || baseTag;
var className = '';
var classInterpolations = [];
var mergedProps = props;
if (props.theme == null) {
mergedProps = {};
for (var key in props) {
mergedProps[key] = props[key];
}
mergedProps.theme = (0,external_React_.useContext)(emotion_element_6a883da9_browser_esm_ThemeContext);
}
if (typeof props.className === 'string') {
className = emotion_utils_browser_esm_getRegisteredStyles(cache.registered, classInterpolations, props.className);
} else if (props.className != null) {
className = props.className + " ";
}
var serialized = emotion_serialize_browser_esm_serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps);
className += cache.key + "-" + serialized.name;
if (targetClassName !== undefined) {
className += " " + targetClassName;
}
var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;
var newProps = {};
for (var _key in props) {
if (shouldUseAs && _key === 'as') continue;
if ( // $FlowFixMe
finalShouldForwardProp(_key)) {
newProps[_key] = props[_key];
}
}
newProps.className = className;
newProps.ref = ref;
return /*#__PURE__*/(0,external_React_.createElement)(external_React_.Fragment, null, /*#__PURE__*/(0,external_React_.createElement)(emotion_styled_base_browser_esm_Insertion, {
cache: cache,
serialized: serialized,
isStringTag: typeof FinalTag === 'string'
}), /*#__PURE__*/(0,external_React_.createElement)(FinalTag, newProps));
});
Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")";
Styled.defaultProps = tag.defaultProps;
Styled.__emotion_real = Styled;
Styled.__emotion_base = baseTag;
Styled.__emotion_styles = styles;
Styled.__emotion_forwardProp = shouldForwardProp;
Object.defineProperty(Styled, 'toString', {
value: function value() {
if (targetClassName === undefined && "production" !== 'production') {} // $FlowFixMe: coerce undefined to string
return "." + targetClassName;
}
});
Styled.withComponent = function (nextTag, nextOptions) {
return createStyled(nextTag, extends_extends({}, options, nextOptions, {
shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)
})).apply(void 0, styles);
};
return Styled;
};
};
/* harmony default export */ const emotion_styled_base_browser_esm = (createStyled);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/view/component.js
/**
* External dependencies
*/
/**
* `View` is a core component that renders everything in the library.
* It is the principle component in the entire library.
*
* ```jsx
* import { View } from `@wordpress/components`;
*
* function Example() {
* return (
* <View>
* Code is Poetry
* </View>
* );
* }
* ```
*/
const View = emotion_styled_base_browser_esm("div", true ? {
target: "e19lxcc00"
} : 0)( true ? "" : 0);
View.selector = '.components-view';
View.displayName = 'View';
/* harmony default export */ const component = (View);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/visually-hidden/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedVisuallyHidden(props, forwardedRef) {
const {
style: styleProp,
...contextProps
} = useContextSystem(props, 'VisuallyHidden');
return (0,external_React_.createElement)(component, {
ref: forwardedRef,
...contextProps,
style: {
...visuallyHidden,
...(styleProp || {})
}
});
}
/**
* `VisuallyHidden` is a component used to render text intended to be visually
* hidden, but will show for alternate devices, for example a screen reader.
*
* ```jsx
* import { VisuallyHidden } from `@wordpress/components`;
*
* function Example() {
* return (
* <VisuallyHidden>
* <label>Code is Poetry</label>
* </VisuallyHidden>
* );
* }
* ```
*/
const component_VisuallyHidden = contextConnect(UnconnectedVisuallyHidden, 'VisuallyHidden');
/* harmony default export */ const visually_hidden_component = (component_VisuallyHidden);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const GRID = [['top left', 'top center', 'top right'], ['center left', 'center center', 'center right'], ['bottom left', 'bottom center', 'bottom right']];
// Stored as map as i18n __() only accepts strings (not variables)
const ALIGNMENT_LABEL = {
'top left': (0,external_wp_i18n_namespaceObject.__)('Top Left'),
'top center': (0,external_wp_i18n_namespaceObject.__)('Top Center'),
'top right': (0,external_wp_i18n_namespaceObject.__)('Top Right'),
'center left': (0,external_wp_i18n_namespaceObject.__)('Center Left'),
'center center': (0,external_wp_i18n_namespaceObject.__)('Center'),
center: (0,external_wp_i18n_namespaceObject.__)('Center'),
'center right': (0,external_wp_i18n_namespaceObject.__)('Center Right'),
'bottom left': (0,external_wp_i18n_namespaceObject.__)('Bottom Left'),
'bottom center': (0,external_wp_i18n_namespaceObject.__)('Bottom Center'),
'bottom right': (0,external_wp_i18n_namespaceObject.__)('Bottom Right')
};
// Transforms GRID into a flat Array of values.
const ALIGNMENTS = GRID.flat();
/**
* Normalizes and transforms an incoming value to better match the alignment values
*
* @param value An alignment value to parse.
*
* @return The parsed value.
*/
function normalize(value) {
const normalized = value === 'center' ? 'center center' : value;
// Strictly speaking, this could be `string | null | undefined`,
// but will be validated shortly, so we're typecasting to an
// `AlignmentMatrixControlValue` to keep TypeScript happy.
const transformed = normalized?.replace('-', ' ');
return ALIGNMENTS.includes(transformed) ? transformed : undefined;
}
/**
* Creates an item ID based on a prefix ID and an alignment value.
*
* @param prefixId An ID to prefix.
* @param value An alignment value.
*
* @return The item id.
*/
function getItemId(prefixId, value) {
const normalized = normalize(value);
if (!normalized) return;
const id = normalized.replace(' ', '-');
return `${prefixId}-${id}`;
}
/**
* Extracts an item value from its ID
*
* @param prefixId An ID prefix to remove
* @param id An item ID
* @return The item value
*/
function getItemValue(prefixId, id) {
const value = id?.replace(prefixId + '-', '');
return normalize(value);
}
/**
* Retrieves the alignment index from a value.
*
* @param alignment Value to check.
*
* @return The index of a matching alignment.
*/
function getAlignmentIndex(alignment = 'center') {
const normalized = normalize(alignment);
if (!normalized) return undefined;
const index = ALIGNMENTS.indexOf(normalized);
return index > -1 ? index : undefined;
}
// EXTERNAL MODULE: ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js
var hoist_non_react_statics_cjs = __webpack_require__(1880);
;// CONCATENATED MODULE: ./node_modules/@emotion/react/dist/emotion-react.browser.esm.js
var pkg = {
name: "@emotion/react",
version: "11.10.6",
main: "dist/emotion-react.cjs.js",
module: "dist/emotion-react.esm.js",
browser: {
"./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js"
},
exports: {
".": {
module: {
worker: "./dist/emotion-react.worker.esm.js",
browser: "./dist/emotion-react.browser.esm.js",
"default": "./dist/emotion-react.esm.js"
},
"default": "./dist/emotion-react.cjs.js"
},
"./jsx-runtime": {
module: {
worker: "./jsx-runtime/dist/emotion-react-jsx-runtime.worker.esm.js",
browser: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js",
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js"
},
"default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js"
},
"./_isolated-hnrs": {
module: {
worker: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.worker.esm.js",
browser: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js",
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js"
},
"default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js"
},
"./jsx-dev-runtime": {
module: {
worker: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.worker.esm.js",
browser: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js",
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js"
},
"default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js"
},
"./package.json": "./package.json",
"./types/css-prop": "./types/css-prop.d.ts",
"./macro": "./macro.js"
},
types: "types/index.d.ts",
files: [
"src",
"dist",
"jsx-runtime",
"jsx-dev-runtime",
"_isolated-hnrs",
"types/*.d.ts",
"macro.js",
"macro.d.ts",
"macro.js.flow"
],
sideEffects: false,
author: "Emotion Contributors",
license: "MIT",
scripts: {
"test:typescript": "dtslint types"
},
dependencies: {
"@babel/runtime": "^7.18.3",
"@emotion/babel-plugin": "^11.10.6",
"@emotion/cache": "^11.10.5",
"@emotion/serialize": "^1.1.1",
"@emotion/use-insertion-effect-with-fallbacks": "^1.0.0",
"@emotion/utils": "^1.2.0",
"@emotion/weak-memoize": "^0.3.0",
"hoist-non-react-statics": "^3.3.1"
},
peerDependencies: {
react: ">=16.8.0"
},
peerDependenciesMeta: {
"@types/react": {
optional: true
}
},
devDependencies: {
"@definitelytyped/dtslint": "0.0.112",
"@emotion/css": "11.10.6",
"@emotion/css-prettifier": "1.1.1",
"@emotion/server": "11.10.0",
"@emotion/styled": "11.10.6",
"html-tag-names": "^1.1.2",
react: "16.14.0",
"svg-tag-names": "^1.1.1",
typescript: "^4.5.5"
},
repository: "https://github.com/emotion-js/emotion/tree/main/packages/react",
publishConfig: {
access: "public"
},
"umd:main": "dist/emotion-react.umd.min.js",
preconstruct: {
entrypoints: [
"./index.js",
"./jsx-runtime.js",
"./jsx-dev-runtime.js",
"./_isolated-hnrs.js"
],
umdName: "emotionReact",
exports: {
envConditions: [
"browser",
"worker"
],
extra: {
"./types/css-prop": "./types/css-prop.d.ts",
"./macro": "./macro.js"
}
}
}
};
var jsx = function jsx(type, props) {
var args = arguments;
if (props == null || !hasOwnProperty.call(props, 'css')) {
// $FlowFixMe
return createElement.apply(undefined, args);
}
var argsLength = args.length;
var createElementArgArray = new Array(argsLength);
createElementArgArray[0] = Emotion;
createElementArgArray[1] = createEmotionProps(type, props);
for (var i = 2; i < argsLength; i++) {
createElementArgArray[i] = args[i];
} // $FlowFixMe
return createElement.apply(null, createElementArgArray);
};
var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
// initial client-side render from SSR, use place of hydrating tag
var Global = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache) {
if (false) {}
var styles = props.styles;
var serialized = serializeStyles([styles], undefined, useContext(ThemeContext));
// but it is based on a constant that will never change at runtime
// it's effectively like having two implementations and switching them out
// so it's not actually breaking anything
var sheetRef = useRef();
useInsertionEffectWithLayoutFallback(function () {
var key = cache.key + "-global"; // use case of https://github.com/emotion-js/emotion/issues/2675
var sheet = new cache.sheet.constructor({
key: key,
nonce: cache.sheet.nonce,
container: cache.sheet.container,
speedy: cache.sheet.isSpeedy
});
var rehydrating = false; // $FlowFixMe
var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]");
if (cache.sheet.tags.length) {
sheet.before = cache.sheet.tags[0];
}
if (node !== null) {
rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s
node.setAttribute('data-emotion', key);
sheet.hydrate([node]);
}
sheetRef.current = [sheet, rehydrating];
return function () {
sheet.flush();
};
}, [cache]);
useInsertionEffectWithLayoutFallback(function () {
var sheetRefCurrent = sheetRef.current;
var sheet = sheetRefCurrent[0],
rehydrating = sheetRefCurrent[1];
if (rehydrating) {
sheetRefCurrent[1] = false;
return;
}
if (serialized.next !== undefined) {
// insert keyframes
insertStyles(cache, serialized.next, true);
}
if (sheet.tags.length) {
// if this doesn't exist then it will be null so the style element will be appended
var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;
sheet.before = element;
sheet.flush();
}
cache.insert("", serialized, sheet, false);
}, [cache, serialized.name]);
return null;
})));
if (false) {}
function emotion_react_browser_esm_css() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return emotion_serialize_browser_esm_serializeStyles(args);
}
var emotion_react_browser_esm_keyframes = function keyframes() {
var insertable = emotion_react_browser_esm_css.apply(void 0, arguments);
var name = "animation-" + insertable.name; // $FlowFixMe
return {
name: name,
styles: "@keyframes " + name + "{" + insertable.styles + "}",
anim: 1,
toString: function toString() {
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
}
};
};
var emotion_react_browser_esm_classnames = function classnames(args) {
var len = args.length;
var i = 0;
var cls = '';
for (; i < len; i++) {
var arg = args[i];
if (arg == null) continue;
var toAdd = void 0;
switch (typeof arg) {
case 'boolean':
break;
case 'object':
{
if (Array.isArray(arg)) {
toAdd = classnames(arg);
} else {
if (false) {}
toAdd = '';
for (var k in arg) {
if (arg[k] && k) {
toAdd && (toAdd += ' ');
toAdd += k;
}
}
}
break;
}
default:
{
toAdd = arg;
}
}
if (toAdd) {
cls && (cls += ' ');
cls += toAdd;
}
}
return cls;
};
function emotion_react_browser_esm_merge(registered, css, className) {
var registeredStyles = [];
var rawClassName = getRegisteredStyles(registered, registeredStyles, className);
if (registeredStyles.length < 2) {
return className;
}
return rawClassName + css(registeredStyles);
}
var emotion_react_browser_esm_Insertion = function Insertion(_ref) {
var cache = _ref.cache,
serializedArr = _ref.serializedArr;
var rules = useInsertionEffectAlwaysWithSyncFallback(function () {
for (var i = 0; i < serializedArr.length; i++) {
var res = insertStyles(cache, serializedArr[i], false);
}
});
return null;
};
var ClassNames = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache) {
var hasRendered = false;
var serializedArr = [];
var css = function css() {
if (hasRendered && "production" !== 'production') {}
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var serialized = serializeStyles(args, cache.registered);
serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`
registerStyles(cache, serialized, false);
return cache.key + "-" + serialized.name;
};
var cx = function cx() {
if (hasRendered && "production" !== 'production') {}
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return emotion_react_browser_esm_merge(cache.registered, css, emotion_react_browser_esm_classnames(args));
};
var content = {
css: css,
cx: cx,
theme: useContext(ThemeContext)
};
var ele = props.children(content);
hasRendered = true;
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(emotion_react_browser_esm_Insertion, {
cache: cache,
serializedArr: serializedArr
}), ele);
})));
if (false) {}
if (false) { var globalKey, globalContext, isTestEnv, emotion_react_browser_esm_isBrowser; }
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/colors-values.js
/**
* Internal dependencies
*/
const white = '#fff';
// Matches the grays in @wordpress/base-styles
const GRAY = {
900: '#1e1e1e',
800: '#2f2f2f',
/** Meets 4.6:1 text contrast against white. */
700: '#757575',
/** Meets 3:1 UI or large text contrast against white. */
600: '#949494',
400: '#ccc',
/** Used for most borders. */
300: '#ddd',
/** Used sparingly for light borders. */
200: '#e0e0e0',
/** Used for light gray backgrounds. */
100: '#f0f0f0'
};
// Matches @wordpress/base-styles
const ALERT = {
yellow: '#f0b849',
red: '#d94f4f',
green: '#4ab866'
};
// Should match packages/components/src/utils/theme-variables.scss
const THEME = {
accent: `var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9))`,
accentDarker10: `var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6))`,
accentDarker20: `var(--wp-components-color-accent-darker-20, var(--wp-admin-theme-color-darker-20, #183ad6))`,
/** Used when placing text on the accent color. */
accentInverted: `var(--wp-components-color-accent-inverted, ${white})`,
background: `var(--wp-components-color-background, ${white})`,
foreground: `var(--wp-components-color-foreground, ${GRAY[900]})`,
/** Used when placing text on the foreground color. */
foregroundInverted: `var(--wp-components-color-foreground-inverted, ${white})`,
gray: {
/** @deprecated Use `COLORS.theme.foreground` instead. */
900: `var(--wp-components-color-foreground, ${GRAY[900]})`,
800: `var(--wp-components-color-gray-800, ${GRAY[800]})`,
700: `var(--wp-components-color-gray-700, ${GRAY[700]})`,
600: `var(--wp-components-color-gray-600, ${GRAY[600]})`,
400: `var(--wp-components-color-gray-400, ${GRAY[400]})`,
300: `var(--wp-components-color-gray-300, ${GRAY[300]})`,
200: `var(--wp-components-color-gray-200, ${GRAY[200]})`,
100: `var(--wp-components-color-gray-100, ${GRAY[100]})`
}
};
const UI = {
background: THEME.background,
backgroundDisabled: THEME.gray[100],
border: THEME.gray[600],
borderHover: THEME.gray[700],
borderFocus: THEME.accent,
borderDisabled: THEME.gray[400],
textDisabled: THEME.gray[600],
// Matches @wordpress/base-styles
darkGrayPlaceholder: `color-mix(in srgb, ${THEME.foreground}, transparent 38%)`,
lightGrayPlaceholder: `color-mix(in srgb, ${THEME.background}, transparent 35%)`
};
const COLORS = Object.freeze({
/**
* The main gray color object.
*
* @deprecated Use semantic aliases in `COLORS.ui` or theme-ready variables in `COLORS.theme.gray`.
*/
gray: GRAY,
// TODO: Stop exporting this when everything is migrated to `theme` or `ui`
white,
alert: ALERT,
/**
* Theme-ready variables with fallbacks.
*
* Prefer semantic aliases in `COLORS.ui` when applicable.
*/
theme: THEME,
/**
* Semantic aliases (prefer these over raw variables when applicable).
*/
ui: UI
});
/* harmony default export */ const colors_values = ((/* unused pure expression or super */ null && (COLORS)));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/reduce-motion.js
/**
* Allows users to opt-out of animations via OS-level preferences.
*
* @param {'transition' | 'animation' | string} [prop='transition'] CSS Property name
* @return {string} Generated CSS code for the reduced style
*/
function reduceMotion(prop = 'transition') {
let style;
switch (prop) {
case 'transition':
style = 'transition-duration: 0ms;';
break;
case 'animation':
style = 'animation-duration: 1ms;';
break;
default:
style = `
animation-duration: 1ms;
transition-duration: 0ms;
`;
}
return `
@media ( prefers-reduced-motion: reduce ) {
${style};
}
`;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
var _ref = true ? {
name: "93uojk",
styles: "border-radius:2px;box-sizing:border-box;direction:ltr;display:grid;grid-template-columns:repeat( 3, 1fr );outline:none"
} : 0;
const rootBase = () => {
return _ref;
};
const rootSize = ({
size = 92
}) => {
return /*#__PURE__*/emotion_react_browser_esm_css("grid-template-rows:repeat( 3, calc( ", size, "px / 3 ) );width:", size, "px;" + ( true ? "" : 0), true ? "" : 0);
};
const Root = emotion_styled_base_browser_esm("div", true ? {
target: "ecapk1j3"
} : 0)(rootBase, ";border:1px solid transparent;cursor:pointer;grid-template-columns:auto;", rootSize, ";" + ( true ? "" : 0));
const Row = emotion_styled_base_browser_esm("div", true ? {
target: "ecapk1j2"
} : 0)( true ? {
name: "1x5gbbj",
styles: "box-sizing:border-box;display:grid;grid-template-columns:repeat( 3, 1fr )"
} : 0);
const pointActive = ({
isActive
}) => {
const boxShadow = isActive ? `0 0 0 2px ${COLORS.gray[900]}` : null;
const pointColor = isActive ? COLORS.gray[900] : COLORS.gray[400];
const pointColorHover = isActive ? COLORS.gray[900] : COLORS.theme.accent;
return /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:", boxShadow, ";color:", pointColor, ";*:hover>&{color:", pointColorHover, ";}" + ( true ? "" : 0), true ? "" : 0);
};
const pointBase = props => {
return /*#__PURE__*/emotion_react_browser_esm_css("background:currentColor;box-sizing:border-box;display:grid;margin:auto;transition:all 120ms linear;", reduceMotion('transition'), " ", pointActive(props), ";" + ( true ? "" : 0), true ? "" : 0);
};
const Point = emotion_styled_base_browser_esm("span", true ? {
target: "ecapk1j1"
} : 0)("height:6px;width:6px;", pointBase, ";" + ( true ? "" : 0));
const Cell = emotion_styled_base_browser_esm("span", true ? {
target: "ecapk1j0"
} : 0)( true ? {
name: "rjf3ub",
styles: "appearance:none;border:none;box-sizing:border-box;margin:0;display:flex;position:relative;outline:none;align-items:center;justify-content:center;padding:0"
} : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/cell.js
/**
* Internal dependencies
*/
/**
* Internal dependencies
*/
function cell_Cell({
id,
isActive = false,
value,
...props
}) {
const tooltipText = ALIGNMENT_LABEL[value];
return (0,external_React_.createElement)(tooltip, {
text: tooltipText
}, (0,external_React_.createElement)(CompositeItem, {
id: id,
render: (0,external_React_.createElement)(Cell, {
...props,
role: "gridcell"
})
}, (0,external_React_.createElement)(visually_hidden_component, null, value), (0,external_React_.createElement)(Point, {
isActive: isActive,
role: "presentation"
})));
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/Y6GYTNQ2.js
"use client";
// src/collection/collection-store.ts
function useCollectionStoreProps(store, update, props) {
useUpdateEffect(update, [props.store]);
useStoreProps(store, props, "items", "setItems");
return store;
}
function useCollectionStore(props = {}) {
const [store, update] = useStore(Core.createCollectionStore, props);
return useCollectionStoreProps(store, update, props);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/22K762VQ.js
"use client";
// src/collection/collection-store.ts
function isElementPreceding(a, b) {
return Boolean(
b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING
);
}
function sortBasedOnDOMPosition(items) {
const pairs = items.map((item, index) => [index, item]);
let isOrderDifferent = false;
pairs.sort(([indexA, a], [indexB, b]) => {
const elementA = a.element;
const elementB = b.element;
if (elementA === elementB)
return 0;
if (!elementA || !elementB)
return 0;
if (isElementPreceding(elementA, elementB)) {
if (indexA > indexB) {
isOrderDifferent = true;
}
return -1;
}
if (indexA < indexB) {
isOrderDifferent = true;
}
return 1;
});
if (isOrderDifferent) {
return pairs.map(([_, item]) => item);
}
return items;
}
function getCommonParent(items) {
var _a;
const firstItem = items.find((item) => !!item.element);
const lastItem = [...items].reverse().find((item) => !!item.element);
let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement;
while (parentElement && (lastItem == null ? void 0 : lastItem.element)) {
const parent = parentElement;
if (lastItem && parent.contains(lastItem.element)) {
return parentElement;
}
parentElement = parentElement.parentElement;
}
return DLOEKDPY_getDocument(parentElement).body;
}
function getPrivateStore(store) {
return store == null ? void 0 : store.__unstablePrivateStore;
}
function createCollectionStore(props = {}) {
var _a;
throwOnConflictingProps(props, props.store);
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const items = defaultValue(
props.items,
syncState == null ? void 0 : syncState.items,
props.defaultItems,
[]
);
const itemsMap = new Map(items.map((item) => [item.id, item]));
const initialState = {
items,
renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, [])
};
const syncPrivateStore = getPrivateStore(props.store);
const privateStore = createStore(
{ items, renderedItems: initialState.renderedItems },
syncPrivateStore
);
const collection = createStore(initialState, props.store);
const sortItems = (renderedItems) => {
const sortedItems = sortBasedOnDOMPosition(renderedItems);
privateStore.setState("renderedItems", sortedItems);
collection.setState("renderedItems", sortedItems);
};
setup(collection, () => init(privateStore));
setup(privateStore, () => {
return batch(privateStore, ["items"], (state) => {
collection.setState("items", state.items);
});
});
setup(privateStore, () => {
return batch(privateStore, ["renderedItems"], (state) => {
let firstRun = true;
let raf = requestAnimationFrame(() => {
const { renderedItems } = collection.getState();
if (state.renderedItems === renderedItems)
return;
sortItems(state.renderedItems);
});
if (typeof IntersectionObserver !== "function") {
return () => cancelAnimationFrame(raf);
}
const ioCallback = () => {
if (firstRun) {
firstRun = false;
return;
}
cancelAnimationFrame(raf);
raf = requestAnimationFrame(() => sortItems(state.renderedItems));
};
const root = getCommonParent(state.renderedItems);
const observer = new IntersectionObserver(ioCallback, { root });
for (const item of state.renderedItems) {
if (!item.element)
continue;
observer.observe(item.element);
}
return () => {
cancelAnimationFrame(raf);
observer.disconnect();
};
});
});
const mergeItem = (item, setItems, canDeleteFromMap = false) => {
let prevItem;
setItems((items2) => {
const index = items2.findIndex(({ id }) => id === item.id);
const nextItems = items2.slice();
if (index !== -1) {
prevItem = items2[index];
const nextItem = _chunks_4R3V3JGP_spreadValues(_chunks_4R3V3JGP_spreadValues({}, prevItem), item);
nextItems[index] = nextItem;
itemsMap.set(item.id, nextItem);
} else {
nextItems.push(item);
itemsMap.set(item.id, item);
}
return nextItems;
});
const unmergeItem = () => {
setItems((items2) => {
if (!prevItem) {
if (canDeleteFromMap) {
itemsMap.delete(item.id);
}
return items2.filter(({ id }) => id !== item.id);
}
const index = items2.findIndex(({ id }) => id === item.id);
if (index === -1)
return items2;
const nextItems = items2.slice();
nextItems[index] = prevItem;
itemsMap.set(item.id, prevItem);
return nextItems;
});
};
return unmergeItem;
};
const registerItem = (item) => mergeItem(
item,
(getItems) => privateStore.setState("items", getItems),
true
);
return _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, collection), {
registerItem,
renderItem: (item) => chain(
registerItem(item),
mergeItem(
item,
(getItems) => privateStore.setState("renderedItems", getItems)
)
),
item: (id) => {
if (!id)
return null;
let item = itemsMap.get(id);
if (!item) {
const { items: items2 } = collection.getState();
item = items2.find((item2) => item2.id === id);
if (item) {
itemsMap.set(id, item);
}
}
return item || null;
},
// @ts-expect-error Internal
__unstablePrivateStore: privateStore
});
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js
"use client";
// src/utils/array.ts
function toArray(arg) {
if (Array.isArray(arg)) {
return arg;
}
return typeof arg !== "undefined" ? [arg] : [];
}
function addItemToArray(array, item, index = -1) {
if (!(index in array)) {
return [...array, item];
}
return [...array.slice(0, index), item, ...array.slice(index)];
}
function flatten2DArray(array) {
const flattened = [];
for (const row of array) {
flattened.push(...row);
}
return flattened;
}
function reverseArray(array) {
return array.slice().reverse();
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/IERTEJ3A.js
"use client";
// src/composite/composite-store.ts
var IERTEJ3A_NULL_ITEM = { id: null };
function IERTEJ3A_findFirstEnabledItem(items, excludeId) {
return items.find((item) => {
if (excludeId) {
return !item.disabled && item.id !== excludeId;
}
return !item.disabled;
});
}
function getEnabledItems(items, excludeId) {
return items.filter((item) => {
if (excludeId) {
return !item.disabled && item.id !== excludeId;
}
return !item.disabled;
});
}
function getOppositeOrientation(orientation) {
if (orientation === "vertical")
return "horizontal";
if (orientation === "horizontal")
return "vertical";
return;
}
function getItemsInRow(items, rowId) {
return items.filter((item) => item.rowId === rowId);
}
function IERTEJ3A_flipItems(items, activeId, shouldInsertNullItem = false) {
const index = items.findIndex((item) => item.id === activeId);
return [
...items.slice(index + 1),
...shouldInsertNullItem ? [IERTEJ3A_NULL_ITEM] : [],
...items.slice(0, index)
];
}
function IERTEJ3A_groupItemsByRows(items) {
const rows = [];
for (const item of items) {
const row = rows.find((currentRow) => {
var _a;
return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId;
});
if (row) {
row.push(item);
} else {
rows.push([item]);
}
}
return rows;
}
function getMaxRowLength(array) {
let maxLength = 0;
for (const { length } of array) {
if (length > maxLength) {
maxLength = length;
}
}
return maxLength;
}
function createEmptyItem(rowId) {
return {
id: "__EMPTY_ITEM__",
disabled: true,
rowId
};
}
function normalizeRows(rows, activeId, focusShift) {
const maxLength = getMaxRowLength(rows);
for (const row of rows) {
for (let i = 0; i < maxLength; i += 1) {
const item = row[i];
if (!item || focusShift && item.disabled) {
const isFirst = i === 0;
const previousItem = isFirst && focusShift ? IERTEJ3A_findFirstEnabledItem(row) : row[i - 1];
row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
}
}
}
return rows;
}
function verticalizeItems(items) {
const rows = IERTEJ3A_groupItemsByRows(items);
const maxLength = getMaxRowLength(rows);
const verticalized = [];
for (let i = 0; i < maxLength; i += 1) {
for (const row of rows) {
const item = row[i];
if (item) {
verticalized.push(_chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, item), {
// If there's no rowId, it means that it's not a grid composite, but
// a single row instead. So, instead of verticalizing it, that is,
// assigning a different rowId based on the column index, we keep it
// undefined so they will be part of the same row. This is useful
// when using up/down on one-dimensional composites.
rowId: item.rowId ? `${i}` : void 0
}));
}
}
}
return verticalized;
}
function createCompositeStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const collection = createCollectionStore(props);
const activeId = defaultValue(
props.activeId,
syncState == null ? void 0 : syncState.activeId,
props.defaultActiveId
);
const initialState = _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, collection.getState()), {
activeId,
baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null),
includesBaseElement: defaultValue(
props.includesBaseElement,
syncState == null ? void 0 : syncState.includesBaseElement,
activeId === null
),
moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0),
orientation: defaultValue(
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"both"
),
rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false),
virtualFocus: defaultValue(
props.virtualFocus,
syncState == null ? void 0 : syncState.virtualFocus,
false
),
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
});
const composite = createStore(initialState, collection, props.store);
setup(
composite,
() => sync(composite, ["renderedItems", "activeId"], (state) => {
composite.setState("activeId", (activeId2) => {
var _a2;
if (activeId2 !== void 0)
return activeId2;
return (_a2 = IERTEJ3A_findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
});
})
);
const getNextId = (items, orientation, hasNullItem, skip) => {
var _a2, _b;
const { activeId: activeId2, rtl, focusLoop, focusWrap, includesBaseElement } = composite.getState();
const isHorizontal = orientation !== "vertical";
const isRTL = rtl && isHorizontal;
const allItems = isRTL ? reverseArray(items) : items;
if (activeId2 == null) {
return (_a2 = IERTEJ3A_findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id;
}
const activeItem = allItems.find((item) => item.id === activeId2);
if (!activeItem) {
return (_b = IERTEJ3A_findFirstEnabledItem(allItems)) == null ? void 0 : _b.id;
}
const isGrid = !!activeItem.rowId;
const activeIndex = allItems.indexOf(activeItem);
const nextItems = allItems.slice(activeIndex + 1);
const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
if (skip !== void 0) {
const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
return nextItem2 == null ? void 0 : nextItem2.id;
}
const oppositeOrientation = getOppositeOrientation(
// If it's a grid and orientation is not set, it's a next/previous call,
// which is inherently horizontal. up/down will call next with orientation
// set to vertical by default (see below on up/down methods).
isGrid ? orientation || "horizontal" : orientation
);
const canLoop = focusLoop && focusLoop !== oppositeOrientation;
const canWrap = isGrid && focusWrap && focusWrap !== oppositeOrientation;
hasNullItem = hasNullItem || !isGrid && canLoop && includesBaseElement;
if (canLoop) {
const loopItems = canWrap && !hasNullItem ? allItems : getItemsInRow(allItems, activeItem.rowId);
const sortedItems = IERTEJ3A_flipItems(loopItems, activeId2, hasNullItem);
const nextItem2 = IERTEJ3A_findFirstEnabledItem(sortedItems, activeId2);
return nextItem2 == null ? void 0 : nextItem2.id;
}
if (canWrap) {
const nextItem2 = IERTEJ3A_findFirstEnabledItem(
// We can use nextItems, which contains all the next items, including
// items from other rows, to wrap between rows. However, if there is a
// null item (the composite container), we'll only use the next items in
// the row. So moving next from the last item will focus on the
// composite container. On grid composites, horizontal navigation never
// focuses on the composite container, only vertical.
hasNullItem ? nextItemsInRow : nextItems,
activeId2
);
const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
return nextId;
}
const nextItem = IERTEJ3A_findFirstEnabledItem(nextItemsInRow, activeId2);
if (!nextItem && hasNullItem) {
return null;
}
return nextItem == null ? void 0 : nextItem.id;
};
return _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues(_chunks_4R3V3JGP_spreadValues({}, collection), composite), {
setBaseElement: (element) => composite.setState("baseElement", element),
setActiveId: (id) => composite.setState("activeId", id),
move: (id) => {
if (id === void 0)
return;
composite.setState("activeId", id);
composite.setState("moves", (moves) => moves + 1);
},
first: () => {
var _a2;
return (_a2 = IERTEJ3A_findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
},
last: () => {
var _a2;
return (_a2 = IERTEJ3A_findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
},
next: (skip) => {
const { renderedItems, orientation } = composite.getState();
return getNextId(renderedItems, orientation, false, skip);
},
previous: (skip) => {
var _a2;
const { renderedItems, orientation, includesBaseElement } = composite.getState();
const isGrid = !!((_a2 = IERTEJ3A_findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId);
const hasNullItem = !isGrid && includesBaseElement;
return getNextId(
reverseArray(renderedItems),
orientation,
hasNullItem,
skip
);
},
down: (skip) => {
const {
activeId: activeId2,
renderedItems,
focusShift,
focusLoop,
includesBaseElement
} = composite.getState();
const shouldShift = focusShift && !skip;
const verticalItems = verticalizeItems(
flatten2DArray(
normalizeRows(IERTEJ3A_groupItemsByRows(renderedItems), activeId2, shouldShift)
)
);
const canLoop = focusLoop && focusLoop !== "horizontal";
const hasNullItem = canLoop && includesBaseElement;
return getNextId(verticalItems, "vertical", hasNullItem, skip);
},
up: (skip) => {
const { activeId: activeId2, renderedItems, focusShift, includesBaseElement } = composite.getState();
const shouldShift = focusShift && !skip;
const verticalItems = verticalizeItems(
reverseArray(
flatten2DArray(
normalizeRows(
IERTEJ3A_groupItemsByRows(renderedItems),
activeId2,
shouldShift
)
)
)
);
const hasNullItem = includesBaseElement;
return getNextId(verticalItems, "vertical", hasNullItem, skip);
}
});
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/7GBW5FLS.js
"use client";
// src/composite/composite-store.ts
function useCompositeStoreProps(store, update, props) {
store = useCollectionStoreProps(store, update, props);
useStoreProps(store, props, "activeId", "setActiveId");
useStoreProps(store, props, "includesBaseElement");
useStoreProps(store, props, "virtualFocus");
useStoreProps(store, props, "orientation");
useStoreProps(store, props, "rtl");
useStoreProps(store, props, "focusLoop");
useStoreProps(store, props, "focusWrap");
useStoreProps(store, props, "focusShift");
return store;
}
function useCompositeStore(props = {}) {
const [store, update] = EKQEJRUF_useStore(createCompositeStore, props);
return useCompositeStoreProps(store, update, props);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/7QTPYGNZ.js
"use client";
// src/composite/composite.tsx
function isGrid(items) {
return items.some((item) => !!item.rowId);
}
function isPrintableKey(event) {
const target = event.target;
if (target && !DLOEKDPY_isTextField(target))
return false;
return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
}
function isModifierKey(event) {
return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta";
}
function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) {
return useEvent((event) => {
var _a;
onKeyboardEvent == null ? void 0 : onKeyboardEvent(event);
if (event.defaultPrevented)
return;
if (event.isPropagationStopped())
return;
if (!isSelfTarget(event))
return;
if (isModifierKey(event))
return;
if (isPrintableKey(event))
return;
const state = store.getState();
const activeElement = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element;
if (!activeElement)
return;
const _b = event, { view } = _b, eventInit = __objRest(_b, ["view"]);
const previousElement = previousElementRef == null ? void 0 : previousElementRef.current;
if (activeElement !== previousElement) {
activeElement.focus();
}
if (!fireKeyboardEvent(activeElement, event.type, eventInit)) {
event.preventDefault();
}
if (event.currentTarget.contains(activeElement)) {
event.stopPropagation();
}
});
}
function findFirstEnabledItemInTheLastRow(items) {
return findFirstEnabledItem(
flatten2DArray(reverseArray(groupItemsByRows(items)))
);
}
function useScheduleFocus(store) {
const [scheduled, setScheduled] = (0,external_React_.useState)(false);
const schedule = (0,external_React_.useCallback)(() => setScheduled(true), []);
const activeItem = store.useState(
(state) => getEnabledItem(store, state.activeId)
);
(0,external_React_.useEffect)(() => {
const activeElement = activeItem == null ? void 0 : activeItem.element;
if (!scheduled)
return;
if (!activeElement)
return;
setScheduled(false);
activeElement.focus({ preventScroll: true });
}, [activeItem, scheduled]);
return schedule;
}
var useComposite = createHook(
(_a) => {
var _b = _a, {
store,
composite = true,
focusOnMove = composite,
moveOnKeyPress = true
} = _b, props = __objRest(_b, [
"store",
"composite",
"focusOnMove",
"moveOnKeyPress"
]);
const context = useCompositeProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const previousElementRef = (0,external_React_.useRef)(null);
const scheduleFocus = useScheduleFocus(store);
const moves = store.useState("moves");
(0,external_React_.useEffect)(() => {
var _a2;
if (!store)
return;
if (!moves)
return;
if (!composite)
return;
if (!focusOnMove)
return;
const { activeId: activeId2 } = store.getState();
const itemElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element;
if (!itemElement)
return;
focusIntoView(itemElement);
}, [store, moves, composite, focusOnMove]);
useSafeLayoutEffect(() => {
if (!store)
return;
if (!moves)
return;
if (!composite)
return;
const { baseElement, activeId: activeId2 } = store.getState();
const isSelfAcive = activeId2 === null;
if (!isSelfAcive)
return;
if (!baseElement)
return;
const previousElement = previousElementRef.current;
previousElementRef.current = null;
if (previousElement) {
fireBlurEvent(previousElement, { relatedTarget: baseElement });
}
if (!hasFocus(baseElement)) {
baseElement.focus();
}
}, [store, moves, composite]);
const activeId = store.useState("activeId");
const virtualFocus = store.useState("virtualFocus");
useSafeLayoutEffect(() => {
var _a2;
if (!store)
return;
if (!composite)
return;
if (!virtualFocus)
return;
const previousElement = previousElementRef.current;
previousElementRef.current = null;
if (!previousElement)
return;
const activeElement = (_a2 = getEnabledItem(store, activeId)) == null ? void 0 : _a2.element;
const relatedTarget = activeElement || getActiveElement(previousElement);
if (relatedTarget === previousElement)
return;
fireBlurEvent(previousElement, { relatedTarget });
}, [store, activeId, virtualFocus, composite]);
const onKeyDownCapture = useKeyboardEventProxy(
store,
props.onKeyDownCapture,
previousElementRef
);
const onKeyUpCapture = useKeyboardEventProxy(
store,
props.onKeyUpCapture,
previousElementRef
);
const onFocusCaptureProp = props.onFocusCapture;
const onFocusCapture = useEvent((event) => {
onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
if (event.defaultPrevented)
return;
if (!store)
return;
const { virtualFocus: virtualFocus2 } = store.getState();
if (!virtualFocus2)
return;
const previousActiveElement = event.relatedTarget;
const isSilentlyFocused = silentlyFocused(event.currentTarget);
if (isSelfTarget(event) && isSilentlyFocused) {
event.stopPropagation();
previousElementRef.current = previousActiveElement;
}
});
const onFocusProp = props.onFocus;
const onFocus = useEvent((event) => {
onFocusProp == null ? void 0 : onFocusProp(event);
if (event.defaultPrevented)
return;
if (!composite)
return;
if (!store)
return;
const { relatedTarget } = event;
const { virtualFocus: virtualFocus2 } = store.getState();
if (virtualFocus2) {
if (isSelfTarget(event) && !isItem(store, relatedTarget)) {
queueMicrotask(scheduleFocus);
}
} else if (isSelfTarget(event)) {
store.setActiveId(null);
}
});
const onBlurCaptureProp = props.onBlurCapture;
const onBlurCapture = useEvent((event) => {
var _a2;
onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
if (event.defaultPrevented)
return;
if (!store)
return;
const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState();
if (!virtualFocus2)
return;
const activeElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element;
const nextActiveElement = event.relatedTarget;
const nextActiveElementIsItem = isItem(store, nextActiveElement);
const previousElement = previousElementRef.current;
previousElementRef.current = null;
if (isSelfTarget(event) && nextActiveElementIsItem) {
if (nextActiveElement === activeElement) {
if (previousElement && previousElement !== nextActiveElement) {
fireBlurEvent(previousElement, event);
}
} else if (activeElement) {
fireBlurEvent(activeElement, event);
} else if (previousElement) {
fireBlurEvent(previousElement, event);
}
event.stopPropagation();
} else {
const targetIsItem = isItem(store, event.target);
if (!targetIsItem && activeElement) {
fireBlurEvent(activeElement, event);
}
}
});
const onKeyDownProp = props.onKeyDown;
const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
const onKeyDown = useEvent((event) => {
var _a2;
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
if (event.defaultPrevented)
return;
if (!store)
return;
if (!isSelfTarget(event))
return;
const { orientation, items, renderedItems, activeId: activeId2 } = store.getState();
const activeItem = getEnabledItem(store, activeId2);
if ((_a2 = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a2.isConnected)
return;
const isVertical = orientation !== "horizontal";
const isHorizontal = orientation !== "vertical";
const grid = isGrid(renderedItems);
const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End";
if (isHorizontalKey && DLOEKDPY_isTextField(event.currentTarget))
return;
const up = () => {
if (grid) {
const item = items && findFirstEnabledItemInTheLastRow(items);
return item == null ? void 0 : item.id;
}
return store == null ? void 0 : store.last();
};
const keyMap = {
ArrowUp: (grid || isVertical) && up,
ArrowRight: (grid || isHorizontal) && store.first,
ArrowDown: (grid || isVertical) && store.first,
ArrowLeft: (grid || isHorizontal) && store.last,
Home: store.first,
End: store.last,
PageUp: store.first,
PageDown: store.last
};
const action = keyMap[event.key];
if (action) {
const id = action();
if (id !== void 0) {
if (!moveOnKeyPressProp(event))
return;
event.preventDefault();
store.move(id);
}
}
});
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(CompositeContextProvider, { value: store, children: element }),
[store]
);
const activeDescendant = store.useState((state) => {
var _a2;
if (!store)
return;
if (!composite)
return;
if (!state.virtualFocus)
return;
return (_a2 = getEnabledItem(store, state.activeId)) == null ? void 0 : _a2.id;
});
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
"aria-activedescendant": activeDescendant
}, props), {
ref: useMergeRefs(composite ? store.setBaseElement : null, props.ref),
onKeyDownCapture,
onKeyUpCapture,
onFocusCapture,
onFocus,
onBlurCapture,
onKeyDown
});
const focusable = store.useState(
(state) => composite && (state.virtualFocus || state.activeId === null)
);
props = useFocusable(_4R3V3JGP_spreadValues({ focusable }, props));
return props;
}
);
var Composite = createComponent((props) => {
const htmlProps = useComposite(props);
return _3ORBWXWF_createElement("div", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/BNUFNEVY.js
"use client";
// src/composite/composite-row.tsx
var useCompositeRow = createHook(
(_a) => {
var _b = _a, {
store,
"aria-setsize": ariaSetSize,
"aria-posinset": ariaPosInSet
} = _b, props = __objRest(_b, [
"store",
"aria-setsize",
"aria-posinset"
]);
const context = useCompositeContext();
store = store || context;
invariant(
store,
false && 0
);
const id = useId(props.id);
const baseElement = store.useState(
(state) => state.baseElement || void 0
);
const providerValue = (0,external_React_.useMemo)(
() => ({ id, baseElement, ariaSetSize, ariaPosInSet }),
[id, baseElement, ariaSetSize, ariaPosInSet]
);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(CompositeRowContext.Provider, { value: providerValue, children: element }),
[providerValue]
);
props = _4R3V3JGP_spreadValues({ id }, props);
return props;
}
);
var CompositeRow = createComponent((props) => {
const htmlProps = useCompositeRow(props);
return _3ORBWXWF_createElement("div", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js
function alignment_matrix_control_icon_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const alignment_matrix_control_icon_styles_rootSize = () => {
const padding = 1.5;
const size = 24;
return /*#__PURE__*/emotion_react_browser_esm_css({
gridTemplateRows: `repeat( 3, calc( ${size - padding * 2}px / 3))`,
padding,
maxHeight: size,
maxWidth: size
}, true ? "" : 0, true ? "" : 0);
};
const rootPointerEvents = ({
disablePointerEvents
}) => {
return /*#__PURE__*/emotion_react_browser_esm_css({
pointerEvents: disablePointerEvents ? 'none' : undefined
}, true ? "" : 0, true ? "" : 0);
};
const Wrapper = emotion_styled_base_browser_esm("div", true ? {
target: "erowt52"
} : 0)( true ? {
name: "ogl07i",
styles: "box-sizing:border-box;padding:2px"
} : 0);
const alignment_matrix_control_icon_styles_Root = emotion_styled_base_browser_esm("div", true ? {
target: "erowt51"
} : 0)("transform-origin:top left;height:100%;width:100%;", rootBase, ";", alignment_matrix_control_icon_styles_rootSize, ";", rootPointerEvents, ";" + ( true ? "" : 0));
const alignment_matrix_control_icon_styles_pointActive = ({
isActive
}) => {
const boxShadow = isActive ? `0 0 0 1px currentColor` : null;
return /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:", boxShadow, ";color:currentColor;*:hover>&{color:currentColor;}" + ( true ? "" : 0), true ? "" : 0);
};
const alignment_matrix_control_icon_styles_Point = emotion_styled_base_browser_esm("span", true ? {
target: "erowt50"
} : 0)("height:2px;width:2px;", pointBase, ";", alignment_matrix_control_icon_styles_pointActive, ";" + ( true ? "" : 0));
const alignment_matrix_control_icon_styles_Cell = Cell;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/icon.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const BASE_SIZE = 24;
function AlignmentMatrixControlIcon({
className,
disablePointerEvents = true,
size = BASE_SIZE,
style = {},
value = 'center',
...props
}) {
const alignIndex = getAlignmentIndex(value);
const scale = (size / BASE_SIZE).toFixed(2);
const classes = classnames_default()('component-alignment-matrix-control-icon', className);
const styles = {
...style,
transform: `scale(${scale})`
};
return (0,external_React_.createElement)(alignment_matrix_control_icon_styles_Root, {
...props,
className: classes,
disablePointerEvents: disablePointerEvents,
role: "presentation",
style: styles
}, ALIGNMENTS.map((align, index) => {
const isActive = alignIndex === index;
return (0,external_React_.createElement)(alignment_matrix_control_icon_styles_Cell, {
key: align
}, (0,external_React_.createElement)(alignment_matrix_control_icon_styles_Point, {
isActive: isActive
}));
}));
}
/* harmony default export */ const icon = (AlignmentMatrixControlIcon);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
*
* AlignmentMatrixControl components enable adjustments to horizontal and vertical alignments for UI.
*
* ```jsx
* import { __experimentalAlignmentMatrixControl as AlignmentMatrixControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const Example = () => {
* const [ alignment, setAlignment ] = useState( 'center center' );
*
* return (
* <AlignmentMatrixControl
* value={ alignment }
* onChange={ setAlignment }
* />
* );
* };
* ```
*/
function AlignmentMatrixControl({
className,
id,
label = (0,external_wp_i18n_namespaceObject.__)('Alignment Matrix Control'),
defaultValue = 'center center',
value,
onChange,
width = 92,
...props
}) {
const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(AlignmentMatrixControl, 'alignment-matrix-control', id);
const compositeStore = useCompositeStore({
defaultActiveId: getItemId(baseId, defaultValue),
activeId: getItemId(baseId, value),
setActiveId: nextActiveId => {
const nextValue = getItemValue(baseId, nextActiveId);
if (nextValue) onChange?.(nextValue);
},
rtl: (0,external_wp_i18n_namespaceObject.isRTL)()
});
const activeId = compositeStore.useState('activeId');
const classes = classnames_default()('component-alignment-matrix-control', className);
return (0,external_React_.createElement)(Composite, {
store: compositeStore,
render: (0,external_React_.createElement)(Root, {
...props,
"aria-label": label,
className: classes,
id: baseId,
role: "grid",
size: width
})
}, GRID.map((cells, index) => (0,external_React_.createElement)(CompositeRow, {
render: (0,external_React_.createElement)(Row, {
role: "row"
}),
key: index
}, cells.map(cell => {
const cellId = getItemId(baseId, cell);
const isActive = cellId === activeId;
return (0,external_React_.createElement)(cell_Cell, {
id: cellId,
isActive: isActive,
key: cell,
value: cell
});
}))));
}
AlignmentMatrixControl.Icon = icon;
/* harmony default export */ const alignment_matrix_control = (AlignmentMatrixControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/animate/index.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/**
* @param type The animation type
* @return Default origin
*/
function getDefaultOrigin(type) {
return type === 'appear' ? 'top' : 'left';
}
/**
* @param options
*
* @return ClassName that applies the animations
*/
function getAnimateClassName(options) {
if (options.type === 'loading') {
return classnames_default()('components-animate__loading');
}
const {
type,
origin = getDefaultOrigin(type)
} = options;
if (type === 'appear') {
const [yAxis, xAxis = 'center'] = origin.split(' ');
return classnames_default()('components-animate__appear', {
['is-from-' + xAxis]: xAxis !== 'center',
['is-from-' + yAxis]: yAxis !== 'middle'
});
}
if (type === 'slide-in') {
return classnames_default()('components-animate__slide-in', 'is-from-' + origin);
}
return undefined;
}
/**
* Simple interface to introduce animations to components.
*
* ```jsx
* import { Animate, Notice } from '@wordpress/components';
*
* const MyAnimatedNotice = () => (
* <Animate type="slide-in" options={ { origin: 'top' } }>
* { ( { className } ) => (
* <Notice className={ className } status="success">
* <p>Animation finished.</p>
* </Notice>
* ) }
* </Animate>
* );
* ```
*/
function Animate({
type,
options = {},
children
}) {
return children({
className: getAnimateClassName({
type,
...options
})
});
}
/* harmony default export */ const animate = (Animate);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionConfigContext.mjs
/**
* @public
*/
const MotionConfigContext = (0,external_React_.createContext)({
transformPagePoint: (p) => p,
isStatic: false,
reducedMotion: "never",
});
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionContext/index.mjs
const MotionContext = (0,external_React_.createContext)({});
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/PresenceContext.mjs
/**
* @public
*/
const PresenceContext_PresenceContext = (0,external_React_.createContext)(null);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-browser.mjs
const is_browser_isBrowser = typeof document !== "undefined";
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs
const useIsomorphicLayoutEffect = is_browser_isBrowser ? external_React_.useLayoutEffect : external_React_.useEffect;
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/LazyContext.mjs
const LazyContext = (0,external_React_.createContext)({ strict: false });
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs
function useVisualElement(Component, visualState, props, createVisualElement) {
const { visualElement: parent } = (0,external_React_.useContext)(MotionContext);
const lazyContext = (0,external_React_.useContext)(LazyContext);
const presenceContext = (0,external_React_.useContext)(PresenceContext_PresenceContext);
const reducedMotionConfig = (0,external_React_.useContext)(MotionConfigContext).reducedMotion;
const visualElementRef = (0,external_React_.useRef)();
/**
* If we haven't preloaded a renderer, check to see if we have one lazy-loaded
*/
createVisualElement = createVisualElement || lazyContext.renderer;
if (!visualElementRef.current && createVisualElement) {
visualElementRef.current = createVisualElement(Component, {
visualState,
parent,
props,
presenceContext,
blockInitialAnimation: presenceContext
? presenceContext.initial === false
: false,
reducedMotionConfig,
});
}
const visualElement = visualElementRef.current;
(0,external_React_.useInsertionEffect)(() => {
visualElement && visualElement.update(props, presenceContext);
});
/**
* Cache this value as we want to know whether HandoffAppearAnimations
* was present on initial render - it will be deleted after this.
*/
const canHandoff = (0,external_React_.useRef)(Boolean(window.HandoffAppearAnimations));
useIsomorphicLayoutEffect(() => {
if (!visualElement)
return;
visualElement.render();
/**
* Ideally this function would always run in a useEffect.
*
* However, if we have optimised appear animations to handoff from,
* it needs to happen synchronously to ensure there's no flash of
* incorrect styles in the event of a hydration error.
*
* So if we detect a situtation where optimised appear animations
* are running, we use useLayoutEffect to trigger animations.
*/
if (canHandoff.current && visualElement.animationState) {
visualElement.animationState.animateChanges();
}
});
(0,external_React_.useEffect)(() => {
if (!visualElement)
return;
visualElement.updateFeatures();
if (!canHandoff.current && visualElement.animationState) {
visualElement.animationState.animateChanges();
}
/**
* Once we've handed off animations we can delete HandoffAppearAnimations
* so components added after the initial render can animate changes
* in useEffect vs useLayoutEffect.
*/
window.HandoffAppearAnimations = undefined;
canHandoff.current = false;
});
return visualElement;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-ref-object.mjs
function isRefObject(ref) {
return (typeof ref === "object" &&
Object.prototype.hasOwnProperty.call(ref, "current"));
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.mjs
/**
* Creates a ref function that, when called, hydrates the provided
* external ref and VisualElement.
*/
function useMotionRef(visualState, visualElement, externalRef) {
return (0,external_React_.useCallback)((instance) => {
instance && visualState.mount && visualState.mount(instance);
if (visualElement) {
instance
? visualElement.mount(instance)
: visualElement.unmount();
}
if (externalRef) {
if (typeof externalRef === "function") {
externalRef(instance);
}
else if (isRefObject(externalRef)) {
externalRef.current = instance;
}
}
},
/**
* Only pass a new ref callback to React if we've received a visual element
* factory. Otherwise we'll be mounting/remounting every time externalRef
* or other dependencies change.
*/
[visualElement]);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/is-variant-label.mjs
/**
* Decides if the supplied variable is variant label
*/
function isVariantLabel(v) {
return typeof v === "string" || Array.isArray(v);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-animation-controls.mjs
function isAnimationControls(v) {
return typeof v === "object" && typeof v.start === "function";
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/variant-props.mjs
const variantPriorityOrder = [
"animate",
"whileInView",
"whileFocus",
"whileHover",
"whileTap",
"whileDrag",
"exit",
];
const variantProps = ["initial", ...variantPriorityOrder];
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/is-controlling-variants.mjs
function isControllingVariants(props) {
return (isAnimationControls(props.animate) ||
variantProps.some((name) => isVariantLabel(props[name])));
}
function isVariantNode(props) {
return Boolean(isControllingVariants(props) || props.variants);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionContext/utils.mjs
function getCurrentTreeVariants(props, context) {
if (isControllingVariants(props)) {
const { initial, animate } = props;
return {
initial: initial === false || isVariantLabel(initial)
? initial
: undefined,
animate: isVariantLabel(animate) ? animate : undefined,
};
}
return props.inherit !== false ? context : {};
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionContext/create.mjs
function useCreateMotionContext(props) {
const { initial, animate } = getCurrentTreeVariants(props, (0,external_React_.useContext)(MotionContext));
return (0,external_React_.useMemo)(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
}
function variantLabelsAsDependency(prop) {
return Array.isArray(prop) ? prop.join(" ") : prop;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/definitions.mjs
const featureProps = {
animation: [
"animate",
"variants",
"whileHover",
"whileTap",
"exit",
"whileInView",
"whileFocus",
"whileDrag",
],
exit: ["exit"],
drag: ["drag", "dragControls"],
focus: ["whileFocus"],
hover: ["whileHover", "onHoverStart", "onHoverEnd"],
tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
layout: ["layout", "layoutId"],
};
const featureDefinitions = {};
for (const key in featureProps) {
featureDefinitions[key] = {
isEnabled: (props) => featureProps[key].some((name) => !!props[name]),
};
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/load-features.mjs
function loadFeatures(features) {
for (const key in features) {
featureDefinitions[key] = {
...featureDefinitions[key],
...features[key],
};
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs
const LayoutGroupContext = (0,external_React_.createContext)({});
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs
/**
* Internal, exported only for usage in Framer
*/
const SwitchLayoutGroupContext = (0,external_React_.createContext)({});
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/symbol.mjs
const motionComponentSymbol = Symbol.for("motionComponentSymbol");
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/index.mjs
/**
* Create a `motion` component.
*
* This function accepts a Component argument, which can be either a string (ie "div"
* for `motion.div`), or an actual React component.
*
* Alongside this is a config option which provides a way of rendering the provided
* component "offline", or outside the React render cycle.
*/
function motion_createMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }) {
preloadedFeatures && loadFeatures(preloadedFeatures);
function MotionComponent(props, externalRef) {
/**
* If we need to measure the element we load this functionality in a
* separate class component in order to gain access to getSnapshotBeforeUpdate.
*/
let MeasureLayout;
const configAndProps = {
...(0,external_React_.useContext)(MotionConfigContext),
...props,
layoutId: useLayoutId(props),
};
const { isStatic } = configAndProps;
const context = useCreateMotionContext(props);
const visualState = useVisualState(props, isStatic);
if (!isStatic && is_browser_isBrowser) {
/**
* Create a VisualElement for this component. A VisualElement provides a common
* interface to renderer-specific APIs (ie DOM/Three.js etc) as well as
* providing a way of rendering to these APIs outside of the React render loop
* for more performant animations and interactions
*/
context.visualElement = useVisualElement(Component, visualState, configAndProps, createVisualElement);
/**
* Load Motion gesture and animation features. These are rendered as renderless
* components so each feature can optionally make use of React lifecycle methods.
*/
const initialLayoutGroupConfig = (0,external_React_.useContext)(SwitchLayoutGroupContext);
const isStrict = (0,external_React_.useContext)(LazyContext).strict;
if (context.visualElement) {
MeasureLayout = context.visualElement.loadFeatures(
// Note: Pass the full new combined props to correctly re-render dynamic feature components.
configAndProps, isStrict, preloadedFeatures, initialLayoutGroupConfig);
}
}
/**
* The mount order and hierarchy is specific to ensure our element ref
* is hydrated by the time features fire their effects.
*/
return (external_React_.createElement(MotionContext.Provider, { value: context },
MeasureLayout && context.visualElement ? (external_React_.createElement(MeasureLayout, { visualElement: context.visualElement, ...configAndProps })) : null,
useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement)));
}
const ForwardRefComponent = (0,external_React_.forwardRef)(MotionComponent);
ForwardRefComponent[motionComponentSymbol] = Component;
return ForwardRefComponent;
}
function useLayoutId({ layoutId }) {
const layoutGroupId = (0,external_React_.useContext)(LayoutGroupContext).id;
return layoutGroupId && layoutId !== undefined
? layoutGroupId + "-" + layoutId
: layoutId;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/motion-proxy.mjs
/**
* Convert any React component into a `motion` component. The provided component
* **must** use `React.forwardRef` to the underlying DOM component you want to animate.
*
* ```jsx
* const Component = React.forwardRef((props, ref) => {
* return <div ref={ref} />
* })
*
* const MotionComponent = motion(Component)
* ```
*
* @public
*/
function createMotionProxy(createConfig) {
function custom(Component, customMotionComponentConfig = {}) {
return motion_createMotionComponent(createConfig(Component, customMotionComponentConfig));
}
if (typeof Proxy === "undefined") {
return custom;
}
/**
* A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc.
* Rather than generating them anew every render.
*/
const componentCache = new Map();
return new Proxy(custom, {
/**
* Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
* The prop name is passed through as `key` and we can use that to generate a `motion`
* DOM component with that name.
*/
get: (_target, key) => {
/**
* If this element doesn't exist in the component cache, create it and cache.
*/
if (!componentCache.has(key)) {
componentCache.set(key, custom(key));
}
return componentCache.get(key);
},
});
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/lowercase-elements.mjs
/**
* We keep these listed seperately as we use the lowercase tag names as part
* of the runtime bundle to detect SVG components
*/
const lowercaseSVGElements = [
"animate",
"circle",
"defs",
"desc",
"ellipse",
"g",
"image",
"line",
"filter",
"marker",
"mask",
"metadata",
"path",
"pattern",
"polygon",
"polyline",
"rect",
"stop",
"switch",
"symbol",
"svg",
"text",
"tspan",
"use",
"view",
];
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs
function isSVGComponent(Component) {
if (
/**
* If it's not a string, it's a custom React component. Currently we only support
* HTML custom React components.
*/
typeof Component !== "string" ||
/**
* If it contains a dash, the element is a custom HTML webcomponent.
*/
Component.includes("-")) {
return false;
}
else if (
/**
* If it's in our list of lowercase SVG tags, it's an SVG component
*/
lowercaseSVGElements.indexOf(Component) > -1 ||
/**
* If it contains a capital letter, it's an SVG component
*/
/[A-Z]/.test(Component)) {
return true;
}
return false;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/styles/scale-correction.mjs
const scaleCorrectors = {};
function addScaleCorrector(correctors) {
Object.assign(scaleCorrectors, correctors);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/transform.mjs
/**
* Generate a list of every possible transform key.
*/
const transformPropOrder = [
"transformPerspective",
"x",
"y",
"z",
"translateX",
"translateY",
"translateZ",
"scale",
"scaleX",
"scaleY",
"rotate",
"rotateX",
"rotateY",
"rotateZ",
"skew",
"skewX",
"skewY",
];
/**
* A quick lookup for transform props.
*/
const transformProps = new Set(transformPropOrder);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs
function isForcedMotionValue(key, { layout, layoutId }) {
return (transformProps.has(key) ||
key.startsWith("origin") ||
((layout || layoutId !== undefined) &&
(!!scaleCorrectors[key] || key === "opacity")));
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/utils/is-motion-value.mjs
const isMotionValue = (value) => Boolean(value && value.getVelocity);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/build-transform.mjs
const translateAlias = {
x: "translateX",
y: "translateY",
z: "translateZ",
transformPerspective: "perspective",
};
const numTransforms = transformPropOrder.length;
/**
* Build a CSS transform style from individual x/y/scale etc properties.
*
* This outputs with a default order of transforms/scales/rotations, this can be customised by
* providing a transformTemplate function.
*/
function buildTransform(transform, { enableHardwareAcceleration = true, allowTransformNone = true, }, transformIsDefault, transformTemplate) {
// The transform string we're going to build into.
let transformString = "";
/**
* Loop over all possible transforms in order, adding the ones that
* are present to the transform string.
*/
for (let i = 0; i < numTransforms; i++) {
const key = transformPropOrder[i];
if (transform[key] !== undefined) {
const transformName = translateAlias[key] || key;
transformString += `${transformName}(${transform[key]}) `;
}
}
if (enableHardwareAcceleration && !transform.z) {
transformString += "translateZ(0)";
}
transformString = transformString.trim();
// If we have a custom `transform` template, pass our transform values and
// generated transformString to that before returning
if (transformTemplate) {
transformString = transformTemplate(transform, transformIsDefault ? "" : transformString);
}
else if (allowTransformNone && transformIsDefault) {
transformString = "none";
}
return transformString;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs
const checkStringStartsWith = (token) => (key) => typeof key === "string" && key.startsWith(token);
const isCSSVariableName = checkStringStartsWith("--");
const isCSSVariableToken = checkStringStartsWith("var(--");
const cssVariableRegex = /var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g;
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs
/**
* Provided a value and a ValueType, returns the value as that value type.
*/
const getValueAsType = (value, type) => {
return type && typeof value === "number"
? type.transform(value)
: value;
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/clamp.mjs
const clamp_clamp = (min, max, v) => Math.min(Math.max(v, min), max);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/types/numbers/index.mjs
const number = {
test: (v) => typeof v === "number",
parse: parseFloat,
transform: (v) => v,
};
const alpha = {
...number,
transform: (v) => clamp_clamp(0, 1, v),
};
const scale = {
...number,
default: 1,
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/types/utils.mjs
/**
* TODO: When we move from string as a source of truth to data models
* everything in this folder should probably be referred to as models vs types
*/
// If this number is a decimal, make it just five decimal places
// to avoid exponents
const sanitize = (v) => Math.round(v * 100000) / 100000;
const floatRegex = /(-)?([\d]*\.?[\d])+/g;
const colorRegex = /(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi;
const singleColorRegex = /^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;
function isString(v) {
return typeof v === "string";
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/types/numbers/units.mjs
const createUnitType = (unit) => ({
test: (v) => isString(v) && v.endsWith(unit) && v.split(" ").length === 1,
parse: parseFloat,
transform: (v) => `${v}${unit}`,
});
const degrees = createUnitType("deg");
const percent = createUnitType("%");
const px = createUnitType("px");
const vh = createUnitType("vh");
const vw = createUnitType("vw");
const progressPercentage = {
...percent,
parse: (v) => percent.parse(v) / 100,
transform: (v) => percent.transform(v * 100),
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/type-int.mjs
const type_int_int = {
...number,
transform: Math.round,
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/number.mjs
const numberValueTypes = {
// Border props
borderWidth: px,
borderTopWidth: px,
borderRightWidth: px,
borderBottomWidth: px,
borderLeftWidth: px,
borderRadius: px,
radius: px,
borderTopLeftRadius: px,
borderTopRightRadius: px,
borderBottomRightRadius: px,
borderBottomLeftRadius: px,
// Positioning props
width: px,
maxWidth: px,
height: px,
maxHeight: px,
size: px,
top: px,
right: px,
bottom: px,
left: px,
// Spacing props
padding: px,
paddingTop: px,
paddingRight: px,
paddingBottom: px,
paddingLeft: px,
margin: px,
marginTop: px,
marginRight: px,
marginBottom: px,
marginLeft: px,
// Transform props
rotate: degrees,
rotateX: degrees,
rotateY: degrees,
rotateZ: degrees,
scale: scale,
scaleX: scale,
scaleY: scale,
scaleZ: scale,
skew: degrees,
skewX: degrees,
skewY: degrees,
distance: px,
translateX: px,
translateY: px,
translateZ: px,
x: px,
y: px,
z: px,
perspective: px,
transformPerspective: px,
opacity: alpha,
originX: progressPercentage,
originY: progressPercentage,
originZ: px,
// Misc
zIndex: type_int_int,
// SVG
fillOpacity: alpha,
strokeOpacity: alpha,
numOctaves: type_int_int,
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/build-styles.mjs
function buildHTMLStyles(state, latestValues, options, transformTemplate) {
const { style, vars, transform, transformOrigin } = state;
// Track whether we encounter any transform or transformOrigin values.
let hasTransform = false;
let hasTransformOrigin = false;
// Does the calculated transform essentially equal "none"?
let transformIsNone = true;
/**
* Loop over all our latest animated values and decide whether to handle them
* as a style or CSS variable.
*
* Transforms and transform origins are kept seperately for further processing.
*/
for (const key in latestValues) {
const value = latestValues[key];
/**
* If this is a CSS variable we don't do any further processing.
*/
if (isCSSVariableName(key)) {
vars[key] = value;
continue;
}
// Convert the value to its default value type, ie 0 -> "0px"
const valueType = numberValueTypes[key];
const valueAsType = getValueAsType(value, valueType);
if (transformProps.has(key)) {
// If this is a transform, flag to enable further transform processing
hasTransform = true;
transform[key] = valueAsType;
// If we already know we have a non-default transform, early return
if (!transformIsNone)
continue;
// Otherwise check to see if this is a default transform
if (value !== (valueType.default || 0))
transformIsNone = false;
}
else if (key.startsWith("origin")) {
// If this is a transform origin, flag and enable further transform-origin processing
hasTransformOrigin = true;
transformOrigin[key] = valueAsType;
}
else {
style[key] = valueAsType;
}
}
if (!latestValues.transform) {
if (hasTransform || transformTemplate) {
style.transform = buildTransform(state.transform, options, transformIsNone, transformTemplate);
}
else if (style.transform) {
/**
* If we have previously created a transform but currently don't have any,
* reset transform style to none.
*/
style.transform = "none";
}
}
/**
* Build a transformOrigin style. Uses the same defaults as the browser for
* undefined origins.
*/
if (hasTransformOrigin) {
const { originX = "50%", originY = "50%", originZ = 0, } = transformOrigin;
style.transformOrigin = `${originX} ${originY} ${originZ}`;
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/create-render-state.mjs
const createHtmlRenderState = () => ({
style: {},
transform: {},
transformOrigin: {},
vars: {},
});
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/use-props.mjs
function copyRawValuesOnly(target, source, props) {
for (const key in source) {
if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
target[key] = source[key];
}
}
}
function useInitialMotionValues({ transformTemplate }, visualState, isStatic) {
return (0,external_React_.useMemo)(() => {
const state = createHtmlRenderState();
buildHTMLStyles(state, visualState, { enableHardwareAcceleration: !isStatic }, transformTemplate);
return Object.assign({}, state.vars, state.style);
}, [visualState]);
}
function useStyle(props, visualState, isStatic) {
const styleProp = props.style || {};
const style = {};
/**
* Copy non-Motion Values straight into style
*/
copyRawValuesOnly(style, styleProp, props);
Object.assign(style, useInitialMotionValues(props, visualState, isStatic));
return props.transformValues ? props.transformValues(style) : style;
}
function useHTMLProps(props, visualState, isStatic) {
// The `any` isn't ideal but it is the type of createElement props argument
const htmlProps = {};
const style = useStyle(props, visualState, isStatic);
if (props.drag && props.dragListener !== false) {
// Disable the ghost element when a user drags
htmlProps.draggable = false;
// Disable text selection
style.userSelect =
style.WebkitUserSelect =
style.WebkitTouchCallout =
"none";
// Disable scrolling on the draggable direction
style.touchAction =
props.drag === true
? "none"
: `pan-${props.drag === "x" ? "y" : "x"}`;
}
if (props.tabIndex === undefined &&
(props.onTap || props.onTapStart || props.whileTap)) {
htmlProps.tabIndex = 0;
}
htmlProps.style = style;
return htmlProps;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs
/**
* A list of all valid MotionProps.
*
* @privateRemarks
* This doesn't throw if a `MotionProp` name is missing - it should.
*/
const validMotionProps = new Set([
"animate",
"exit",
"variants",
"initial",
"style",
"values",
"variants",
"transition",
"transformTemplate",
"transformValues",
"custom",
"inherit",
"onLayoutAnimationStart",
"onLayoutAnimationComplete",
"onLayoutMeasure",
"onBeforeLayoutMeasure",
"onAnimationStart",
"onAnimationComplete",
"onUpdate",
"onDragStart",
"onDrag",
"onDragEnd",
"onMeasureDragConstraints",
"onDirectionLock",
"onDragTransitionEnd",
"_dragX",
"_dragY",
"onHoverStart",
"onHoverEnd",
"onViewportEnter",
"onViewportLeave",
"ignoreStrict",
"viewport",
]);
/**
* Check whether a prop name is a valid `MotionProp` key.
*
* @param key - Name of the property to check
* @returns `true` is key is a valid `MotionProp`.
*
* @public
*/
function isValidMotionProp(key) {
return (key.startsWith("while") ||
(key.startsWith("drag") && key !== "draggable") ||
key.startsWith("layout") ||
key.startsWith("onTap") ||
key.startsWith("onPan") ||
validMotionProps.has(key));
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/filter-props.mjs
let shouldForward = (key) => !isValidMotionProp(key);
function loadExternalIsValidProp(isValidProp) {
if (!isValidProp)
return;
// Explicitly filter our events
shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
}
/**
* Emotion and Styled Components both allow users to pass through arbitrary props to their components
* to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which
* of these should be passed to the underlying DOM node.
*
* However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props
* as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props
* passed through the `custom` prop so it doesn't *need* the payload or computational overhead of
* `@emotion/is-prop-valid`, however to fix this problem we need to use it.
*
* By making it an optionalDependency we can offer this functionality only in the situations where it's
* actually required.
*/
try {
/**
* We attempt to import this package but require won't be defined in esm environments, in that case
* isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed
* in favour of explicit injection.
*/
loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
}
catch (_a) {
// We don't need to actually do anything here - the fallback is the existing `isPropValid`.
}
function filterProps(props, isDom, forwardMotionProps) {
const filteredProps = {};
for (const key in props) {
/**
* values is considered a valid prop by Emotion, so if it's present
* this will be rendered out to the DOM unless explicitly filtered.
*
* We check the type as it could be used with the `feColorMatrix`
* element, which we support.
*/
if (key === "values" && typeof props.values === "object")
continue;
if (shouldForward(key) ||
(forwardMotionProps === true && isValidMotionProp(key)) ||
(!isDom && !isValidMotionProp(key)) ||
// If trying to use native HTML drag events, forward drag listeners
(props["draggable"] && key.startsWith("onDrag"))) {
filteredProps[key] = props[key];
}
}
return filteredProps;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/transform-origin.mjs
function calcOrigin(origin, offset, size) {
return typeof origin === "string"
? origin
: px.transform(offset + size * origin);
}
/**
* The SVG transform origin defaults are different to CSS and is less intuitive,
* so we use the measured dimensions of the SVG to reconcile these.
*/
function calcSVGTransformOrigin(dimensions, originX, originY) {
const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
return `${pxOriginX} ${pxOriginY}`;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/path.mjs
const dashKeys = {
offset: "stroke-dashoffset",
array: "stroke-dasharray",
};
const camelKeys = {
offset: "strokeDashoffset",
array: "strokeDasharray",
};
/**
* Build SVG path properties. Uses the path's measured length to convert
* our custom pathLength, pathSpacing and pathOffset into stroke-dashoffset
* and stroke-dasharray attributes.
*
* This function is mutative to reduce per-frame GC.
*/
function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true) {
// Normalise path length by setting SVG attribute pathLength to 1
attrs.pathLength = 1;
// We use dash case when setting attributes directly to the DOM node and camel case
// when defining props on a React component.
const keys = useDashCase ? dashKeys : camelKeys;
// Build the dash offset
attrs[keys.offset] = px.transform(-offset);
// Build the dash array
const pathLength = px.transform(length);
const pathSpacing = px.transform(spacing);
attrs[keys.array] = `${pathLength} ${pathSpacing}`;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.mjs
/**
* Build SVG visual attrbutes, like cx and style.transform
*/
function buildSVGAttrs(state, { attrX, attrY, attrScale, originX, originY, pathLength, pathSpacing = 1, pathOffset = 0,
// This is object creation, which we try to avoid per-frame.
...latest }, options, isSVGTag, transformTemplate) {
buildHTMLStyles(state, latest, options, transformTemplate);
/**
* For svg tags we just want to make sure viewBox is animatable and treat all the styles
* as normal HTML tags.
*/
if (isSVGTag) {
if (state.style.viewBox) {
state.attrs.viewBox = state.style.viewBox;
}
return;
}
state.attrs = state.style;
state.style = {};
const { attrs, style, dimensions } = state;
/**
* However, we apply transforms as CSS transforms. So if we detect a transform we take it from attrs
* and copy it into style.
*/
if (attrs.transform) {
if (dimensions)
style.transform = attrs.transform;
delete attrs.transform;
}
// Parse transformOrigin
if (dimensions &&
(originX !== undefined || originY !== undefined || style.transform)) {
style.transformOrigin = calcSVGTransformOrigin(dimensions, originX !== undefined ? originX : 0.5, originY !== undefined ? originY : 0.5);
}
// Render attrX/attrY/attrScale as attributes
if (attrX !== undefined)
attrs.x = attrX;
if (attrY !== undefined)
attrs.y = attrY;
if (attrScale !== undefined)
attrs.scale = attrScale;
// Build SVG path if one has been defined
if (pathLength !== undefined) {
buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.mjs
const createSvgRenderState = () => ({
...createHtmlRenderState(),
attrs: {},
});
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/use-props.mjs
function useSVGProps(props, visualState, _isStatic, Component) {
const visualProps = (0,external_React_.useMemo)(() => {
const state = createSvgRenderState();
buildSVGAttrs(state, visualState, { enableHardwareAcceleration: false }, isSVGTag(Component), props.transformTemplate);
return {
...state.attrs,
style: { ...state.style },
};
}, [visualState]);
if (props.style) {
const rawStyles = {};
copyRawValuesOnly(rawStyles, props.style, props);
visualProps.style = { ...rawStyles, ...visualProps.style };
}
return visualProps;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/use-render.mjs
function createUseRender(forwardMotionProps = false) {
const useRender = (Component, props, ref, { latestValues }, isStatic) => {
const useVisualProps = isSVGComponent(Component)
? useSVGProps
: useHTMLProps;
const visualProps = useVisualProps(props, latestValues, isStatic, Component);
const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
const elementProps = {
...filteredProps,
...visualProps,
ref,
};
/**
* If component has been handed a motion value as its child,
* memoise its initial value and render that. Subsequent updates
* will be handled by the onChange handler
*/
const { children } = props;
const renderedChildren = (0,external_React_.useMemo)(() => (isMotionValue(children) ? children.get() : children), [children]);
return (0,external_React_.createElement)(Component, {
...elementProps,
children: renderedChildren,
});
};
return useRender;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs
/**
* Convert camelCase to dash-case properties.
*/
const camelToDash = (str) => str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/render.mjs
function renderHTML(element, { style, vars }, styleProp, projection) {
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
// Loop over any CSS variables and assign those.
for (const key in vars) {
element.style.setProperty(key, vars[key]);
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs
/**
* A set of attribute names that are always read/written as camel case.
*/
const camelCaseAttributes = new Set([
"baseFrequency",
"diffuseConstant",
"kernelMatrix",
"kernelUnitLength",
"keySplines",
"keyTimes",
"limitingConeAngle",
"markerHeight",
"markerWidth",
"numOctaves",
"targetX",
"targetY",
"surfaceScale",
"specularConstant",
"specularExponent",
"stdDeviation",
"tableValues",
"viewBox",
"gradientTransform",
"pathLength",
"startOffset",
"textLength",
"lengthAdjust",
]);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/render.mjs
function renderSVG(element, renderState, _styleProp, projection) {
renderHTML(element, renderState, undefined, projection);
for (const key in renderState.attrs) {
element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]);
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs
function scrapeMotionValuesFromProps(props, prevProps) {
const { style } = props;
const newValues = {};
for (const key in style) {
if (isMotionValue(style[key]) ||
(prevProps.style && isMotionValue(prevProps.style[key])) ||
isForcedMotionValue(key, props)) {
newValues[key] = style[key];
}
}
return newValues;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs
function scrape_motion_values_scrapeMotionValuesFromProps(props, prevProps) {
const newValues = scrapeMotionValuesFromProps(props, prevProps);
for (const key in props) {
if (isMotionValue(props[key]) || isMotionValue(prevProps[key])) {
const targetKey = transformPropOrder.indexOf(key) !== -1
? "attr" + key.charAt(0).toUpperCase() + key.substring(1)
: key;
newValues[targetKey] = props[key];
}
}
return newValues;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/resolve-variants.mjs
function resolveVariantFromProps(props, definition, custom, currentValues = {}, currentVelocity = {}) {
/**
* If the variant definition is a function, resolve.
*/
if (typeof definition === "function") {
definition = definition(custom !== undefined ? custom : props.custom, currentValues, currentVelocity);
}
/**
* If the variant definition is a variant label, or
* the function returned a variant label, resolve.
*/
if (typeof definition === "string") {
definition = props.variants && props.variants[definition];
}
/**
* At this point we've resolved both functions and variant labels,
* but the resolved variant label might itself have been a function.
* If so, resolve. This can only have returned a valid target object.
*/
if (typeof definition === "function") {
definition = definition(custom !== undefined ? custom : props.custom, currentValues, currentVelocity);
}
return definition;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-constant.mjs
/**
* Creates a constant value over the lifecycle of a component.
*
* Even if `useMemo` is provided an empty array as its final argument, it doesn't offer
* a guarantee that it won't re-run for performance reasons later on. By using `useConstant`
* you can ensure that initialisers don't execute twice or more.
*/
function useConstant(init) {
const ref = (0,external_React_.useRef)(null);
if (ref.current === null) {
ref.current = init();
}
return ref.current;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs
const isKeyframesTarget = (v) => {
return Array.isArray(v);
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/resolve-value.mjs
const isCustomValue = (v) => {
return Boolean(v && typeof v === "object" && v.mix && v.toValue);
};
const resolveFinalValueInKeyframes = (v) => {
// TODO maybe throw if v.length - 1 is placeholder token?
return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.mjs
/**
* If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself
*
* TODO: Remove and move to library
*/
function resolveMotionValue(value) {
const unwrappedValue = isMotionValue(value) ? value.get() : value;
return isCustomValue(unwrappedValue)
? unwrappedValue.toValue()
: unwrappedValue;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/use-visual-state.mjs
function makeState({ scrapeMotionValuesFromProps, createRenderState, onMount, }, props, context, presenceContext) {
const state = {
latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps),
renderState: createRenderState(),
};
if (onMount) {
state.mount = (instance) => onMount(props, instance, state);
}
return state;
}
const makeUseVisualState = (config) => (props, isStatic) => {
const context = (0,external_React_.useContext)(MotionContext);
const presenceContext = (0,external_React_.useContext)(PresenceContext_PresenceContext);
const make = () => makeState(config, props, context, presenceContext);
return isStatic ? make() : useConstant(make);
};
function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
const values = {};
const motionValues = scrapeMotionValues(props, {});
for (const key in motionValues) {
values[key] = resolveMotionValue(motionValues[key]);
}
let { initial, animate } = props;
const isControllingVariants$1 = isControllingVariants(props);
const isVariantNode$1 = isVariantNode(props);
if (context &&
isVariantNode$1 &&
!isControllingVariants$1 &&
props.inherit !== false) {
if (initial === undefined)
initial = context.initial;
if (animate === undefined)
animate = context.animate;
}
let isInitialAnimationBlocked = presenceContext
? presenceContext.initial === false
: false;
isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false;
const variantToSet = isInitialAnimationBlocked ? animate : initial;
if (variantToSet &&
typeof variantToSet !== "boolean" &&
!isAnimationControls(variantToSet)) {
const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
list.forEach((definition) => {
const resolved = resolveVariantFromProps(props, definition);
if (!resolved)
return;
const { transitionEnd, transition, ...target } = resolved;
for (const key in target) {
let valueTarget = target[key];
if (Array.isArray(valueTarget)) {
/**
* Take final keyframe if the initial animation is blocked because
* we want to initialise at the end of that blocked animation.
*/
const index = isInitialAnimationBlocked
? valueTarget.length - 1
: 0;
valueTarget = valueTarget[index];
}
if (valueTarget !== null) {
values[key] = valueTarget;
}
}
for (const key in transitionEnd)
values[key] = transitionEnd[key];
});
}
return values;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/noop.mjs
const noop_noop = (any) => any;
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/frameloop/render-step.mjs
class Queue {
constructor() {
this.order = [];
this.scheduled = new Set();
}
add(process) {
if (!this.scheduled.has(process)) {
this.scheduled.add(process);
this.order.push(process);
return true;
}
}
remove(process) {
const index = this.order.indexOf(process);
if (index !== -1) {
this.order.splice(index, 1);
this.scheduled.delete(process);
}
}
clear() {
this.order.length = 0;
this.scheduled.clear();
}
}
function createRenderStep(runNextFrame) {
/**
* We create and reuse two queues, one to queue jobs for the current frame
* and one for the next. We reuse to avoid triggering GC after x frames.
*/
let thisFrame = new Queue();
let nextFrame = new Queue();
let numToRun = 0;
/**
* Track whether we're currently processing jobs in this step. This way
* we can decide whether to schedule new jobs for this frame or next.
*/
let isProcessing = false;
let flushNextFrame = false;
/**
* A set of processes which were marked keepAlive when scheduled.
*/
const toKeepAlive = new WeakSet();
const step = {
/**
* Schedule a process to run on the next frame.
*/
schedule: (callback, keepAlive = false, immediate = false) => {
const addToCurrentFrame = immediate && isProcessing;
const queue = addToCurrentFrame ? thisFrame : nextFrame;
if (keepAlive)
toKeepAlive.add(callback);
if (queue.add(callback) && addToCurrentFrame && isProcessing) {
// If we're adding it to the currently running queue, update its measured size
numToRun = thisFrame.order.length;
}
return callback;
},
/**
* Cancel the provided callback from running on the next frame.
*/
cancel: (callback) => {
nextFrame.remove(callback);
toKeepAlive.delete(callback);
},
/**
* Execute all schedule callbacks.
*/
process: (frameData) => {
/**
* If we're already processing we've probably been triggered by a flushSync
* inside an existing process. Instead of executing, mark flushNextFrame
* as true and ensure we flush the following frame at the end of this one.
*/
if (isProcessing) {
flushNextFrame = true;
return;
}
isProcessing = true;
[thisFrame, nextFrame] = [nextFrame, thisFrame];
// Clear the next frame queue
nextFrame.clear();
// Execute this frame
numToRun = thisFrame.order.length;
if (numToRun) {
for (let i = 0; i < numToRun; i++) {
const callback = thisFrame.order[i];
callback(frameData);
if (toKeepAlive.has(callback)) {
step.schedule(callback);
runNextFrame();
}
}
}
isProcessing = false;
if (flushNextFrame) {
flushNextFrame = false;
step.process(frameData);
}
},
};
return step;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/frameloop/batcher.mjs
const stepsOrder = [
"prepare",
"read",
"update",
"preRender",
"render",
"postRender",
];
const maxElapsed = 40;
function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
let runNextFrame = false;
let useDefaultElapsed = true;
const state = {
delta: 0,
timestamp: 0,
isProcessing: false,
};
const steps = stepsOrder.reduce((acc, key) => {
acc[key] = createRenderStep(() => (runNextFrame = true));
return acc;
}, {});
const processStep = (stepId) => steps[stepId].process(state);
const processBatch = () => {
const timestamp = performance.now();
runNextFrame = false;
state.delta = useDefaultElapsed
? 1000 / 60
: Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);
state.timestamp = timestamp;
state.isProcessing = true;
stepsOrder.forEach(processStep);
state.isProcessing = false;
if (runNextFrame && allowKeepAlive) {
useDefaultElapsed = false;
scheduleNextBatch(processBatch);
}
};
const wake = () => {
runNextFrame = true;
useDefaultElapsed = true;
if (!state.isProcessing) {
scheduleNextBatch(processBatch);
}
};
const schedule = stepsOrder.reduce((acc, key) => {
const step = steps[key];
acc[key] = (process, keepAlive = false, immediate = false) => {
if (!runNextFrame)
wake();
return step.schedule(process, keepAlive, immediate);
};
return acc;
}, {});
const cancel = (process) => stepsOrder.forEach((key) => steps[key].cancel(process));
return { schedule, cancel, state, steps };
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/frameloop/frame.mjs
const { schedule: frame_frame, cancel: cancelFrame, state: frameData, steps, } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop_noop, true);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/config-motion.mjs
const svgMotionConfig = {
useVisualState: makeUseVisualState({
scrapeMotionValuesFromProps: scrape_motion_values_scrapeMotionValuesFromProps,
createRenderState: createSvgRenderState,
onMount: (props, instance, { renderState, latestValues }) => {
frame_frame.read(() => {
try {
renderState.dimensions =
typeof instance.getBBox ===
"function"
? instance.getBBox()
: instance.getBoundingClientRect();
}
catch (e) {
// Most likely trying to measure an unrendered element under Firefox
renderState.dimensions = {
x: 0,
y: 0,
width: 0,
height: 0,
};
}
});
frame_frame.render(() => {
buildSVGAttrs(renderState, latestValues, { enableHardwareAcceleration: false }, isSVGTag(instance.tagName), props.transformTemplate);
renderSVG(instance, renderState);
});
},
}),
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/config-motion.mjs
const htmlMotionConfig = {
useVisualState: makeUseVisualState({
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,
createRenderState: createHtmlRenderState,
}),
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/create-config.mjs
function create_config_createDomMotionConfig(Component, { forwardMotionProps = false }, preloadedFeatures, createVisualElement) {
const baseConfig = isSVGComponent(Component)
? svgMotionConfig
: htmlMotionConfig;
return {
...baseConfig,
preloadedFeatures,
useRender: createUseRender(forwardMotionProps),
createVisualElement,
Component,
};
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/add-dom-event.mjs
function addDomEvent(target, eventName, handler, options = { passive: true }) {
target.addEventListener(eventName, handler, options);
return () => target.removeEventListener(eventName, handler);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/utils/is-primary-pointer.mjs
const isPrimaryPointer = (event) => {
if (event.pointerType === "mouse") {
return typeof event.button !== "number" || event.button <= 0;
}
else {
/**
* isPrimary is true for all mice buttons, whereas every touch point
* is regarded as its own input. So subsequent concurrent touch points
* will be false.
*
* Specifically match against false here as incomplete versions of
* PointerEvents in very old browser might have it set as undefined.
*/
return event.isPrimary !== false;
}
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/event-info.mjs
function extractEventInfo(event, pointType = "page") {
return {
point: {
x: event[pointType + "X"],
y: event[pointType + "Y"],
},
};
}
const addPointerInfo = (handler) => {
return (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event));
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/add-pointer-event.mjs
function addPointerEvent(target, eventName, handler, options) {
return addDomEvent(target, eventName, addPointerInfo(handler), options);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/pipe.mjs
/**
* Pipe
* Compose other transformers to run linearily
* pipe(min(20), max(40))
* @param {...functions} transformers
* @return {function}
*/
const combineFunctions = (a, b) => (v) => b(a(v));
const pipe = (...transformers) => transformers.reduce(combineFunctions);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/utils/lock.mjs
function createLock(name) {
let lock = null;
return () => {
const openLock = () => {
lock = null;
};
if (lock === null) {
lock = name;
return openLock;
}
return false;
};
}
const globalHorizontalLock = createLock("dragHorizontal");
const globalVerticalLock = createLock("dragVertical");
function getGlobalLock(drag) {
let lock = false;
if (drag === "y") {
lock = globalVerticalLock();
}
else if (drag === "x") {
lock = globalHorizontalLock();
}
else {
const openHorizontal = globalHorizontalLock();
const openVertical = globalVerticalLock();
if (openHorizontal && openVertical) {
lock = () => {
openHorizontal();
openVertical();
};
}
else {
// Release the locks because we don't use them
if (openHorizontal)
openHorizontal();
if (openVertical)
openVertical();
}
}
return lock;
}
function isDragActive() {
// Check the gesture lock - if we get it, it means no drag gesture is active
// and we can safely fire the tap gesture.
const openGestureLock = getGlobalLock(true);
if (!openGestureLock)
return true;
openGestureLock();
return false;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/Feature.mjs
class Feature {
constructor(node) {
this.isMounted = false;
this.node = node;
}
update() { }
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/hover.mjs
function addHoverEvent(node, isActive) {
const eventName = "pointer" + (isActive ? "enter" : "leave");
const callbackName = "onHover" + (isActive ? "Start" : "End");
const handleEvent = (event, info) => {
if (event.type === "touch" || isDragActive())
return;
const props = node.getProps();
if (node.animationState && props.whileHover) {
node.animationState.setActive("whileHover", isActive);
}
if (props[callbackName]) {
frame_frame.update(() => props[callbackName](event, info));
}
};
return addPointerEvent(node.current, eventName, handleEvent, {
passive: !node.getProps()[callbackName],
});
}
class HoverGesture extends Feature {
mount() {
this.unmount = pipe(addHoverEvent(this.node, true), addHoverEvent(this.node, false));
}
unmount() { }
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/focus.mjs
class FocusGesture extends Feature {
constructor() {
super(...arguments);
this.isActive = false;
}
onFocus() {
let isFocusVisible = false;
/**
* If this element doesn't match focus-visible then don't
* apply whileHover. But, if matches throws that focus-visible
* is not a valid selector then in that browser outline styles will be applied
* to the element by default and we want to match that behaviour with whileFocus.
*/
try {
isFocusVisible = this.node.current.matches(":focus-visible");
}
catch (e) {
isFocusVisible = true;
}
if (!isFocusVisible || !this.node.animationState)
return;
this.node.animationState.setActive("whileFocus", true);
this.isActive = true;
}
onBlur() {
if (!this.isActive || !this.node.animationState)
return;
this.node.animationState.setActive("whileFocus", false);
this.isActive = false;
}
mount() {
this.unmount = pipe(addDomEvent(this.node.current, "focus", () => this.onFocus()), addDomEvent(this.node.current, "blur", () => this.onBlur()));
}
unmount() { }
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/utils/is-node-or-child.mjs
/**
* Recursively traverse up the tree to check whether the provided child node
* is the parent or a descendant of it.
*
* @param parent - Element to find
* @param child - Element to test against parent
*/
const isNodeOrChild = (parent, child) => {
if (!child) {
return false;
}
else if (parent === child) {
return true;
}
else {
return isNodeOrChild(parent, child.parentElement);
}
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/press.mjs
function fireSyntheticPointerEvent(name, handler) {
if (!handler)
return;
const syntheticPointerEvent = new PointerEvent("pointer" + name);
handler(syntheticPointerEvent, extractEventInfo(syntheticPointerEvent));
}
class PressGesture extends Feature {
constructor() {
super(...arguments);
this.removeStartListeners = noop_noop;
this.removeEndListeners = noop_noop;
this.removeAccessibleListeners = noop_noop;
this.startPointerPress = (startEvent, startInfo) => {
this.removeEndListeners();
if (this.isPressing)
return;
const props = this.node.getProps();
const endPointerPress = (endEvent, endInfo) => {
if (!this.checkPressEnd())
return;
const { onTap, onTapCancel } = this.node.getProps();
frame_frame.update(() => {
/**
* We only count this as a tap gesture if the event.target is the same
* as, or a child of, this component's element
*/
!isNodeOrChild(this.node.current, endEvent.target)
? onTapCancel && onTapCancel(endEvent, endInfo)
: onTap && onTap(endEvent, endInfo);
});
};
const removePointerUpListener = addPointerEvent(window, "pointerup", endPointerPress, { passive: !(props.onTap || props["onPointerUp"]) });
const removePointerCancelListener = addPointerEvent(window, "pointercancel", (cancelEvent, cancelInfo) => this.cancelPress(cancelEvent, cancelInfo), { passive: !(props.onTapCancel || props["onPointerCancel"]) });
this.removeEndListeners = pipe(removePointerUpListener, removePointerCancelListener);
this.startPress(startEvent, startInfo);
};
this.startAccessiblePress = () => {
const handleKeydown = (keydownEvent) => {
if (keydownEvent.key !== "Enter" || this.isPressing)
return;
const handleKeyup = (keyupEvent) => {
if (keyupEvent.key !== "Enter" || !this.checkPressEnd())
return;
fireSyntheticPointerEvent("up", (event, info) => {
const { onTap } = this.node.getProps();
if (onTap) {
frame_frame.update(() => onTap(event, info));
}
});
};
this.removeEndListeners();
this.removeEndListeners = addDomEvent(this.node.current, "keyup", handleKeyup);
fireSyntheticPointerEvent("down", (event, info) => {
this.startPress(event, info);
});
};
const removeKeydownListener = addDomEvent(this.node.current, "keydown", handleKeydown);
const handleBlur = () => {
if (!this.isPressing)
return;
fireSyntheticPointerEvent("cancel", (cancelEvent, cancelInfo) => this.cancelPress(cancelEvent, cancelInfo));
};
const removeBlurListener = addDomEvent(this.node.current, "blur", handleBlur);
this.removeAccessibleListeners = pipe(removeKeydownListener, removeBlurListener);
};
}
startPress(event, info) {
this.isPressing = true;
const { onTapStart, whileTap } = this.node.getProps();
/**
* Ensure we trigger animations before firing event callback
*/
if (whileTap && this.node.animationState) {
this.node.animationState.setActive("whileTap", true);
}
if (onTapStart) {
frame_frame.update(() => onTapStart(event, info));
}
}
checkPressEnd() {
this.removeEndListeners();
this.isPressing = false;
const props = this.node.getProps();
if (props.whileTap && this.node.animationState) {
this.node.animationState.setActive("whileTap", false);
}
return !isDragActive();
}
cancelPress(event, info) {
if (!this.checkPressEnd())
return;
const { onTapCancel } = this.node.getProps();
if (onTapCancel) {
frame_frame.update(() => onTapCancel(event, info));
}
}
mount() {
const props = this.node.getProps();
const removePointerListener = addPointerEvent(this.node.current, "pointerdown", this.startPointerPress, { passive: !(props.onTapStart || props["onPointerStart"]) });
const removeFocusListener = addDomEvent(this.node.current, "focus", this.startAccessiblePress);
this.removeStartListeners = pipe(removePointerListener, removeFocusListener);
}
unmount() {
this.removeStartListeners();
this.removeEndListeners();
this.removeAccessibleListeners();
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/viewport/observers.mjs
/**
* Map an IntersectionHandler callback to an element. We only ever make one handler for one
* element, so even though these handlers might all be triggered by different
* observers, we can keep them in the same map.
*/
const observerCallbacks = new WeakMap();
/**
* Multiple observers can be created for multiple element/document roots. Each with
* different settings. So here we store dictionaries of observers to each root,
* using serialised settings (threshold/margin) as lookup keys.
*/
const observers = new WeakMap();
const fireObserverCallback = (entry) => {
const callback = observerCallbacks.get(entry.target);
callback && callback(entry);
};
const fireAllObserverCallbacks = (entries) => {
entries.forEach(fireObserverCallback);
};
function initIntersectionObserver({ root, ...options }) {
const lookupRoot = root || document;
/**
* If we don't have an observer lookup map for this root, create one.
*/
if (!observers.has(lookupRoot)) {
observers.set(lookupRoot, {});
}
const rootObservers = observers.get(lookupRoot);
const key = JSON.stringify(options);
/**
* If we don't have an observer for this combination of root and settings,
* create one.
*/
if (!rootObservers[key]) {
rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, { root, ...options });
}
return rootObservers[key];
}
function observeIntersection(element, options, callback) {
const rootInteresectionObserver = initIntersectionObserver(options);
observerCallbacks.set(element, callback);
rootInteresectionObserver.observe(element);
return () => {
observerCallbacks.delete(element);
rootInteresectionObserver.unobserve(element);
};
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/viewport/index.mjs
const thresholdNames = {
some: 0,
all: 1,
};
class InViewFeature extends Feature {
constructor() {
super(...arguments);
this.hasEnteredView = false;
this.isInView = false;
}
startObserver() {
this.unmount();
const { viewport = {} } = this.node.getProps();
const { root, margin: rootMargin, amount = "some", once } = viewport;
const options = {
root: root ? root.current : undefined,
rootMargin,
threshold: typeof amount === "number" ? amount : thresholdNames[amount],
};
const onIntersectionUpdate = (entry) => {
const { isIntersecting } = entry;
/**
* If there's been no change in the viewport state, early return.
*/
if (this.isInView === isIntersecting)
return;
this.isInView = isIntersecting;
/**
* Handle hasEnteredView. If this is only meant to run once, and
* element isn't visible, early return. Otherwise set hasEnteredView to true.
*/
if (once && !isIntersecting && this.hasEnteredView) {
return;
}
else if (isIntersecting) {
this.hasEnteredView = true;
}
if (this.node.animationState) {
this.node.animationState.setActive("whileInView", isIntersecting);
}
/**
* Use the latest committed props rather than the ones in scope
* when this observer is created
*/
const { onViewportEnter, onViewportLeave } = this.node.getProps();
const callback = isIntersecting ? onViewportEnter : onViewportLeave;
callback && callback(entry);
};
return observeIntersection(this.node.current, options, onIntersectionUpdate);
}
mount() {
this.startObserver();
}
update() {
if (typeof IntersectionObserver === "undefined")
return;
const { props, prevProps } = this.node;
const hasOptionsChanged = ["amount", "margin", "root"].some(hasViewportOptionChanged(props, prevProps));
if (hasOptionsChanged) {
this.startObserver();
}
}
unmount() { }
}
function hasViewportOptionChanged({ viewport = {} }, { viewport: prevViewport = {} } = {}) {
return (name) => viewport[name] !== prevViewport[name];
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/gestures.mjs
const gestureAnimations = {
inView: {
Feature: InViewFeature,
},
tap: {
Feature: PressGesture,
},
focus: {
Feature: FocusGesture,
},
hover: {
Feature: HoverGesture,
},
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/shallow-compare.mjs
function shallowCompare(next, prev) {
if (!Array.isArray(prev))
return false;
const prevLength = prev.length;
if (prevLength !== next.length)
return false;
for (let i = 0; i < prevLength; i++) {
if (prev[i] !== next[i])
return false;
}
return true;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs
/**
* Creates an object containing the latest state of every MotionValue on a VisualElement
*/
function getCurrent(visualElement) {
const current = {};
visualElement.values.forEach((value, key) => (current[key] = value.get()));
return current;
}
/**
* Creates an object containing the latest velocity of every MotionValue on a VisualElement
*/
function getVelocity(visualElement) {
const velocity = {};
visualElement.values.forEach((value, key) => (velocity[key] = value.getVelocity()));
return velocity;
}
function resolveVariant(visualElement, definition, custom) {
const props = visualElement.getProps();
return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom, getCurrent(visualElement), getVelocity(visualElement));
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/optimized-appear/data-id.mjs
const optimizedAppearDataId = "framerAppearId";
const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/errors.mjs
let warning = noop_noop;
let errors_invariant = noop_noop;
if (false) {}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/time-conversion.mjs
/**
* Converts seconds to milliseconds
*
* @param seconds - Time in seconds.
* @return milliseconds - Converted time in milliseconds.
*/
const secondsToMilliseconds = (seconds) => seconds * 1000;
const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-instant-transition-state.mjs
const instantAnimationState = {
current: false,
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/easing/utils/is-bezier-definition.mjs
const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/animators/waapi/easing.mjs
function isWaapiSupportedEasing(easing) {
return Boolean(!easing ||
(typeof easing === "string" && supportedWaapiEasing[easing]) ||
isBezierDefinition(easing) ||
(Array.isArray(easing) && easing.every(isWaapiSupportedEasing)));
}
const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
const supportedWaapiEasing = {
linear: "linear",
ease: "ease",
easeIn: "ease-in",
easeOut: "ease-out",
easeInOut: "ease-in-out",
circIn: cubicBezierAsString([0, 0.65, 0.55, 1]),
circOut: cubicBezierAsString([0.55, 0, 1, 0.45]),
backIn: cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
backOut: cubicBezierAsString([0.33, 1.53, 0.69, 0.99]),
};
function mapEasingToNativeEasing(easing) {
if (!easing)
return undefined;
return isBezierDefinition(easing)
? cubicBezierAsString(easing)
: Array.isArray(easing)
? easing.map(mapEasingToNativeEasing)
: supportedWaapiEasing[easing];
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/animators/waapi/index.mjs
function animateStyle(element, valueName, keyframes, { delay = 0, duration, repeat = 0, repeatType = "loop", ease, times, } = {}) {
const keyframeOptions = { [valueName]: keyframes };
if (times)
keyframeOptions.offset = times;
const easing = mapEasingToNativeEasing(ease);
/**
* If this is an easing array, apply to keyframes, not animation as a whole
*/
if (Array.isArray(easing))
keyframeOptions.easing = easing;
return element.animate(keyframeOptions, {
delay,
duration,
easing: !Array.isArray(easing) ? easing : "linear",
fill: "both",
iterations: repeat + 1,
direction: repeatType === "reverse" ? "alternate" : "normal",
});
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs
function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }) {
const index = repeat && repeatType !== "loop" && repeat % 2 === 1
? 0
: keyframes.length - 1;
return keyframes[index];
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/easing/cubic-bezier.mjs
/*
Bezier function generator
This has been modified from Gaëtan Renaudeau's BezierEasing
https://github.com/gre/bezier-easing/blob/master/src/index.js
https://github.com/gre/bezier-easing/blob/master/LICENSE
I've removed the newtonRaphsonIterate algo because in benchmarking it
wasn't noticiably faster than binarySubdivision, indeed removing it
usually improved times, depending on the curve.
I also removed the lookup table, as for the added bundle size and loop we're
only cutting ~4 or so subdivision iterations. I bumped the max iterations up
to 12 to compensate and this still tended to be faster for no perceivable
loss in accuracy.
Usage
const easeOut = cubicBezier(.17,.67,.83,.67);
const x = easeOut(0.5); // returns 0.627...
*/
// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
const calcBezier = (t, a1, a2) => (((1.0 - 3.0 * a2 + 3.0 * a1) * t + (3.0 * a2 - 6.0 * a1)) * t + 3.0 * a1) *
t;
const subdivisionPrecision = 0.0000001;
const subdivisionMaxIterations = 12;
function binarySubdivide(x, lowerBound, upperBound, mX1, mX2) {
let currentX;
let currentT;
let i = 0;
do {
currentT = lowerBound + (upperBound - lowerBound) / 2.0;
currentX = calcBezier(currentT, mX1, mX2) - x;
if (currentX > 0.0) {
upperBound = currentT;
}
else {
lowerBound = currentT;
}
} while (Math.abs(currentX) > subdivisionPrecision &&
++i < subdivisionMaxIterations);
return currentT;
}
function cubicBezier(mX1, mY1, mX2, mY2) {
// If this is a linear gradient, return linear easing
if (mX1 === mY1 && mX2 === mY2)
return noop_noop;
const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2);
// If animation is at start/end, return t without easing
return (t) => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/easing/ease.mjs
const easeIn = cubicBezier(0.42, 0, 1, 1);
const easeOut = cubicBezier(0, 0, 0.58, 1);
const easeInOut = cubicBezier(0.42, 0, 0.58, 1);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/easing/utils/is-easing-array.mjs
const isEasingArray = (ease) => {
return Array.isArray(ease) && typeof ease[0] !== "number";
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/easing/modifiers/mirror.mjs
// Accepts an easing function and returns a new one that outputs mirrored values for
// the second half of the animation. Turns easeIn into easeInOut.
const mirrorEasing = (easing) => (p) => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/easing/modifiers/reverse.mjs
// Accepts an easing function and returns a new one that outputs reversed values.
// Turns easeIn into easeOut.
const reverseEasing = (easing) => (p) => 1 - easing(1 - p);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/easing/circ.mjs
const circIn = (p) => 1 - Math.sin(Math.acos(p));
const circOut = reverseEasing(circIn);
const circInOut = mirrorEasing(circOut);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/easing/back.mjs
const backOut = cubicBezier(0.33, 1.53, 0.69, 0.99);
const backIn = reverseEasing(backOut);
const backInOut = mirrorEasing(backIn);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/easing/anticipate.mjs
const anticipate = (p) => (p *= 2) < 1 ? 0.5 * backIn(p) : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/easing/utils/map.mjs
const easingLookup = {
linear: noop_noop,
easeIn: easeIn,
easeInOut: easeInOut,
easeOut: easeOut,
circIn: circIn,
circInOut: circInOut,
circOut: circOut,
backIn: backIn,
backInOut: backInOut,
backOut: backOut,
anticipate: anticipate,
};
const easingDefinitionToFunction = (definition) => {
if (Array.isArray(definition)) {
// If cubic bezier definition, create bezier curve
errors_invariant(definition.length === 4, `Cubic bezier arrays must contain four numerical values.`);
const [x1, y1, x2, y2] = definition;
return cubicBezier(x1, y1, x2, y2);
}
else if (typeof definition === "string") {
// Else lookup from table
errors_invariant(easingLookup[definition] !== undefined, `Invalid easing type '${definition}'`);
return easingLookup[definition];
}
return definition;
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/types/color/utils.mjs
/**
* Returns true if the provided string is a color, ie rgba(0,0,0,0) or #000,
* but false if a number or multiple colors
*/
const isColorString = (type, testProp) => (v) => {
return Boolean((isString(v) && singleColorRegex.test(v) && v.startsWith(type)) ||
(testProp && Object.prototype.hasOwnProperty.call(v, testProp)));
};
const splitColor = (aName, bName, cName) => (v) => {
if (!isString(v))
return v;
const [a, b, c, alpha] = v.match(floatRegex);
return {
[aName]: parseFloat(a),
[bName]: parseFloat(b),
[cName]: parseFloat(c),
alpha: alpha !== undefined ? parseFloat(alpha) : 1,
};
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/types/color/rgba.mjs
const clampRgbUnit = (v) => clamp_clamp(0, 255, v);
const rgbUnit = {
...number,
transform: (v) => Math.round(clampRgbUnit(v)),
};
const rgba = {
test: isColorString("rgb", "red"),
parse: splitColor("red", "green", "blue"),
transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => "rgba(" +
rgbUnit.transform(red) +
", " +
rgbUnit.transform(green) +
", " +
rgbUnit.transform(blue) +
", " +
sanitize(alpha.transform(alpha$1)) +
")",
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/types/color/hex.mjs
function parseHex(v) {
let r = "";
let g = "";
let b = "";
let a = "";
// If we have 6 characters, ie #FF0000
if (v.length > 5) {
r = v.substring(1, 3);
g = v.substring(3, 5);
b = v.substring(5, 7);
a = v.substring(7, 9);
// Or we have 3 characters, ie #F00
}
else {
r = v.substring(1, 2);
g = v.substring(2, 3);
b = v.substring(3, 4);
a = v.substring(4, 5);
r += r;
g += g;
b += b;
a += a;
}
return {
red: parseInt(r, 16),
green: parseInt(g, 16),
blue: parseInt(b, 16),
alpha: a ? parseInt(a, 16) / 255 : 1,
};
}
const hex = {
test: isColorString("#"),
parse: parseHex,
transform: rgba.transform,
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/types/color/hsla.mjs
const hsla = {
test: isColorString("hsl", "hue"),
parse: splitColor("hue", "saturation", "lightness"),
transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
return ("hsla(" +
Math.round(hue) +
", " +
percent.transform(sanitize(saturation)) +
", " +
percent.transform(sanitize(lightness)) +
", " +
sanitize(alpha.transform(alpha$1)) +
")");
},
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/types/color/index.mjs
const color = {
test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
parse: (v) => {
if (rgba.test(v)) {
return rgba.parse(v);
}
else if (hsla.test(v)) {
return hsla.parse(v);
}
else {
return hex.parse(v);
}
},
transform: (v) => {
return isString(v)
? v
: v.hasOwnProperty("red")
? rgba.transform(v)
: hsla.transform(v);
},
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/mix.mjs
/*
Value in range from progress
Given a lower limit and an upper limit, we return the value within
that range as expressed by progress (usually a number from 0 to 1)
So progress = 0.5 would change
from -------- to
to
from ---- to
E.g. from = 10, to = 20, progress = 0.5 => 15
@param [number]: Lower limit of range
@param [number]: Upper limit of range
@param [number]: The progress between lower and upper limits expressed 0-1
@return [number]: Value as calculated from progress within range (not limited within range)
*/
const mix = (from, to, progress) => -progress * from + progress * to + from;
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/hsla-to-rgba.mjs
// Adapted from https://gist.github.com/mjackson/5311256
function hueToRgb(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 hslaToRgba({ hue, saturation, lightness, alpha }) {
hue /= 360;
saturation /= 100;
lightness /= 100;
let red = 0;
let green = 0;
let blue = 0;
if (!saturation) {
red = green = blue = lightness;
}
else {
const q = lightness < 0.5
? lightness * (1 + saturation)
: lightness + saturation - lightness * saturation;
const p = 2 * lightness - q;
red = hueToRgb(p, q, hue + 1 / 3);
green = hueToRgb(p, q, hue);
blue = hueToRgb(p, q, hue - 1 / 3);
}
return {
red: Math.round(red * 255),
green: Math.round(green * 255),
blue: Math.round(blue * 255),
alpha,
};
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/mix-color.mjs
// Linear color space blending
// Explained https://www.youtube.com/watch?v=LKnqECcg6Gw
// Demonstrated http://codepen.io/osublake/pen/xGVVaN
const mixLinearColor = (from, to, v) => {
const fromExpo = from * from;
return Math.sqrt(Math.max(0, v * (to * to - fromExpo) + fromExpo));
};
const colorTypes = [hex, rgba, hsla];
const getColorType = (v) => colorTypes.find((type) => type.test(v));
function asRGBA(color) {
const type = getColorType(color);
errors_invariant(Boolean(type), `'${color}' is not an animatable color. Use the equivalent color code instead.`);
let model = type.parse(color);
if (type === hsla) {
// TODO Remove this cast - needed since Framer Motion's stricter typing
model = hslaToRgba(model);
}
return model;
}
const mixColor = (from, to) => {
const fromRGBA = asRGBA(from);
const toRGBA = asRGBA(to);
const blended = { ...fromRGBA };
return (v) => {
blended.red = mixLinearColor(fromRGBA.red, toRGBA.red, v);
blended.green = mixLinearColor(fromRGBA.green, toRGBA.green, v);
blended.blue = mixLinearColor(fromRGBA.blue, toRGBA.blue, v);
blended.alpha = mix(fromRGBA.alpha, toRGBA.alpha, v);
return rgba.transform(blended);
};
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/types/complex/index.mjs
function test(v) {
var _a, _b;
return (isNaN(v) &&
isString(v) &&
(((_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) || 0) +
(((_b = v.match(colorRegex)) === null || _b === void 0 ? void 0 : _b.length) || 0) >
0);
}
const cssVarTokeniser = {
regex: cssVariableRegex,
countKey: "Vars",
token: "${v}",
parse: noop_noop,
};
const colorTokeniser = {
regex: colorRegex,
countKey: "Colors",
token: "${c}",
parse: color.parse,
};
const numberTokeniser = {
regex: floatRegex,
countKey: "Numbers",
token: "${n}",
parse: number.parse,
};
function tokenise(info, { regex, countKey, token, parse }) {
const matches = info.tokenised.match(regex);
if (!matches)
return;
info["num" + countKey] = matches.length;
info.tokenised = info.tokenised.replace(regex, token);
info.values.push(...matches.map(parse));
}
function analyseComplexValue(value) {
const originalValue = value.toString();
const info = {
value: originalValue,
tokenised: originalValue,
values: [],
numVars: 0,
numColors: 0,
numNumbers: 0,
};
if (info.value.includes("var(--"))
tokenise(info, cssVarTokeniser);
tokenise(info, colorTokeniser);
tokenise(info, numberTokeniser);
return info;
}
function parseComplexValue(v) {
return analyseComplexValue(v).values;
}
function createTransformer(source) {
const { values, numColors, numVars, tokenised } = analyseComplexValue(source);
const numValues = values.length;
return (v) => {
let output = tokenised;
for (let i = 0; i < numValues; i++) {
if (i < numVars) {
output = output.replace(cssVarTokeniser.token, v[i]);
}
else if (i < numVars + numColors) {
output = output.replace(colorTokeniser.token, color.transform(v[i]));
}
else {
output = output.replace(numberTokeniser.token, sanitize(v[i]));
}
}
return output;
};
}
const convertNumbersToZero = (v) => typeof v === "number" ? 0 : v;
function getAnimatableNone(v) {
const parsed = parseComplexValue(v);
const transformer = createTransformer(v);
return transformer(parsed.map(convertNumbersToZero));
}
const complex = {
test,
parse: parseComplexValue,
createTransformer,
getAnimatableNone,
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/mix-complex.mjs
const mixImmediate = (origin, target) => (p) => `${p > 0 ? target : origin}`;
function getMixer(origin, target) {
if (typeof origin === "number") {
return (v) => mix(origin, target, v);
}
else if (color.test(origin)) {
return mixColor(origin, target);
}
else {
return origin.startsWith("var(")
? mixImmediate(origin, target)
: mixComplex(origin, target);
}
}
const mixArray = (from, to) => {
const output = [...from];
const numValues = output.length;
const blendValue = from.map((fromThis, i) => getMixer(fromThis, to[i]));
return (v) => {
for (let i = 0; i < numValues; i++) {
output[i] = blendValue[i](v);
}
return output;
};
};
const mixObject = (origin, target) => {
const output = { ...origin, ...target };
const blendValue = {};
for (const key in output) {
if (origin[key] !== undefined && target[key] !== undefined) {
blendValue[key] = getMixer(origin[key], target[key]);
}
}
return (v) => {
for (const key in blendValue) {
output[key] = blendValue[key](v);
}
return output;
};
};
const mixComplex = (origin, target) => {
const template = complex.createTransformer(target);
const originStats = analyseComplexValue(origin);
const targetStats = analyseComplexValue(target);
const canInterpolate = originStats.numVars === targetStats.numVars &&
originStats.numColors === targetStats.numColors &&
originStats.numNumbers >= targetStats.numNumbers;
if (canInterpolate) {
return pipe(mixArray(originStats.values, targetStats.values), template);
}
else {
warning(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`);
return mixImmediate(origin, target);
}
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/progress.mjs
/*
Progress within given range
Given a lower limit and an upper limit, we return the progress
(expressed as a number 0-1) represented by the given value, and
limit that progress to within 0-1.
@param [number]: Lower limit
@param [number]: Upper limit
@param [number]: Value to find progress within given range
@return [number]: Progress of value within range as expressed 0-1
*/
const progress = (from, to, value) => {
const toFromDifference = to - from;
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/interpolate.mjs
const mixNumber = (from, to) => (p) => mix(from, to, p);
function detectMixerFactory(v) {
if (typeof v === "number") {
return mixNumber;
}
else if (typeof v === "string") {
return color.test(v) ? mixColor : mixComplex;
}
else if (Array.isArray(v)) {
return mixArray;
}
else if (typeof v === "object") {
return mixObject;
}
return mixNumber;
}
function createMixers(output, ease, customMixer) {
const mixers = [];
const mixerFactory = customMixer || detectMixerFactory(output[0]);
const numMixers = output.length - 1;
for (let i = 0; i < numMixers; i++) {
let mixer = mixerFactory(output[i], output[i + 1]);
if (ease) {
const easingFunction = Array.isArray(ease) ? ease[i] || noop_noop : ease;
mixer = pipe(easingFunction, mixer);
}
mixers.push(mixer);
}
return mixers;
}
/**
* Create a function that maps from a numerical input array to a generic output array.
*
* Accepts:
* - Numbers
* - Colors (hex, hsl, hsla, rgb, rgba)
* - Complex (combinations of one or more numbers or strings)
*
* ```jsx
* const mixColor = interpolate([0, 1], ['#fff', '#000'])
*
* mixColor(0.5) // 'rgba(128, 128, 128, 1)'
* ```
*
* TODO Revist this approach once we've moved to data models for values,
* probably not needed to pregenerate mixer functions.
*
* @public
*/
function interpolate(input, output, { clamp: isClamp = true, ease, mixer } = {}) {
const inputLength = input.length;
errors_invariant(inputLength === output.length, "Both input and output ranges must be the same length");
/**
* If we're only provided a single input, we can just make a function
* that returns the output.
*/
if (inputLength === 1)
return () => output[0];
// If input runs highest -> lowest, reverse both arrays
if (input[0] > input[inputLength - 1]) {
input = [...input].reverse();
output = [...output].reverse();
}
const mixers = createMixers(output, ease, mixer);
const numMixers = mixers.length;
const interpolator = (v) => {
let i = 0;
if (numMixers > 1) {
for (; i < input.length - 2; i++) {
if (v < input[i + 1])
break;
}
}
const progressInRange = progress(input[i], input[i + 1], v);
return mixers[i](progressInRange);
};
return isClamp
? (v) => interpolator(clamp_clamp(input[0], input[inputLength - 1], v))
: interpolator;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/offsets/fill.mjs
function fillOffset(offset, remaining) {
const min = offset[offset.length - 1];
for (let i = 1; i <= remaining; i++) {
const offsetProgress = progress(0, remaining, i);
offset.push(mix(min, 1, offsetProgress));
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/offsets/default.mjs
function defaultOffset(arr) {
const offset = [0];
fillOffset(offset, arr.length - 1);
return offset;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/offsets/time.mjs
function convertOffsetToTimes(offset, duration) {
return offset.map((o) => o * duration);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/generators/keyframes.mjs
function defaultEasing(values, easing) {
return values.map(() => easing || easeInOut).splice(0, values.length - 1);
}
function keyframes_keyframes({ duration = 300, keyframes: keyframeValues, times, ease = "easeInOut", }) {
/**
* Easing functions can be externally defined as strings. Here we convert them
* into actual functions.
*/
const easingFunctions = isEasingArray(ease)
? ease.map(easingDefinitionToFunction)
: easingDefinitionToFunction(ease);
/**
* This is the Iterator-spec return value. We ensure it's mutable rather than using a generator
* to reduce GC during animation.
*/
const state = {
done: false,
value: keyframeValues[0],
};
/**
* Create a times array based on the provided 0-1 offsets
*/
const absoluteTimes = convertOffsetToTimes(
// Only use the provided offsets if they're the correct length
// TODO Maybe we should warn here if there's a length mismatch
times && times.length === keyframeValues.length
? times
: defaultOffset(keyframeValues), duration);
const mapTimeToKeyframe = interpolate(absoluteTimes, keyframeValues, {
ease: Array.isArray(easingFunctions)
? easingFunctions
: defaultEasing(keyframeValues, easingFunctions),
});
return {
calculatedDuration: duration,
next: (t) => {
state.value = mapTimeToKeyframe(t);
state.done = t >= duration;
return state;
},
};
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/velocity-per-second.mjs
/*
Convert velocity into velocity per second
@param [number]: Unit per frame
@param [number]: Frame duration in ms
*/
function velocityPerSecond(velocity, frameDuration) {
return frameDuration ? velocity * (1000 / frameDuration) : 0;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/generators/utils/velocity.mjs
const velocitySampleDuration = 5; // ms
function calcGeneratorVelocity(resolveValue, t, current) {
const prevT = Math.max(t - velocitySampleDuration, 0);
return velocityPerSecond(current - resolveValue(prevT), t - prevT);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/generators/spring/find.mjs
const safeMin = 0.001;
const minDuration = 0.01;
const maxDuration = 10.0;
const minDamping = 0.05;
const maxDamping = 1;
function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, }) {
let envelope;
let derivative;
warning(duration <= secondsToMilliseconds(maxDuration), "Spring duration must be 10 seconds or less");
let dampingRatio = 1 - bounce;
/**
* Restrict dampingRatio and duration to within acceptable ranges.
*/
dampingRatio = clamp_clamp(minDamping, maxDamping, dampingRatio);
duration = clamp_clamp(minDuration, maxDuration, millisecondsToSeconds(duration));
if (dampingRatio < 1) {
/**
* Underdamped spring
*/
envelope = (undampedFreq) => {
const exponentialDecay = undampedFreq * dampingRatio;
const delta = exponentialDecay * duration;
const a = exponentialDecay - velocity;
const b = calcAngularFreq(undampedFreq, dampingRatio);
const c = Math.exp(-delta);
return safeMin - (a / b) * c;
};
derivative = (undampedFreq) => {
const exponentialDecay = undampedFreq * dampingRatio;
const delta = exponentialDecay * duration;
const d = delta * velocity + velocity;
const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration;
const f = Math.exp(-delta);
const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio);
const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1;
return (factor * ((d - e) * f)) / g;
};
}
else {
/**
* Critically-damped spring
*/
envelope = (undampedFreq) => {
const a = Math.exp(-undampedFreq * duration);
const b = (undampedFreq - velocity) * duration + 1;
return -safeMin + a * b;
};
derivative = (undampedFreq) => {
const a = Math.exp(-undampedFreq * duration);
const b = (velocity - undampedFreq) * (duration * duration);
return a * b;
};
}
const initialGuess = 5 / duration;
const undampedFreq = approximateRoot(envelope, derivative, initialGuess);
duration = secondsToMilliseconds(duration);
if (isNaN(undampedFreq)) {
return {
stiffness: 100,
damping: 10,
duration,
};
}
else {
const stiffness = Math.pow(undampedFreq, 2) * mass;
return {
stiffness,
damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
duration,
};
}
}
const rootIterations = 12;
function approximateRoot(envelope, derivative, initialGuess) {
let result = initialGuess;
for (let i = 1; i < rootIterations; i++) {
result = result - envelope(result) / derivative(result);
}
return result;
}
function calcAngularFreq(undampedFreq, dampingRatio) {
return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/generators/spring/index.mjs
const durationKeys = ["duration", "bounce"];
const physicsKeys = ["stiffness", "damping", "mass"];
function isSpringType(options, keys) {
return keys.some((key) => options[key] !== undefined);
}
function getSpringOptions(options) {
let springOptions = {
velocity: 0.0,
stiffness: 100,
damping: 10,
mass: 1.0,
isResolvedFromDuration: false,
...options,
};
// stiffness/damping/mass overrides duration/bounce
if (!isSpringType(options, physicsKeys) &&
isSpringType(options, durationKeys)) {
const derived = findSpring(options);
springOptions = {
...springOptions,
...derived,
velocity: 0.0,
mass: 1.0,
};
springOptions.isResolvedFromDuration = true;
}
return springOptions;
}
function spring({ keyframes, restDelta, restSpeed, ...options }) {
const origin = keyframes[0];
const target = keyframes[keyframes.length - 1];
/**
* This is the Iterator-spec return value. We ensure it's mutable rather than using a generator
* to reduce GC during animation.
*/
const state = { done: false, value: origin };
const { stiffness, damping, mass, velocity, duration, isResolvedFromDuration, } = getSpringOptions(options);
const initialVelocity = velocity ? -millisecondsToSeconds(velocity) : 0.0;
const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
const initialDelta = target - origin;
const undampedAngularFreq = millisecondsToSeconds(Math.sqrt(stiffness / mass));
/**
* If we're working on a granular scale, use smaller defaults for determining
* when the spring is finished.
*
* These defaults have been selected emprically based on what strikes a good
* ratio between feeling good and finishing as soon as changes are imperceptible.
*/
const isGranularScale = Math.abs(initialDelta) < 5;
restSpeed || (restSpeed = isGranularScale ? 0.01 : 2);
restDelta || (restDelta = isGranularScale ? 0.005 : 0.5);
let resolveSpring;
if (dampingRatio < 1) {
const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
// Underdamped spring
resolveSpring = (t) => {
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
return (target -
envelope *
(((initialVelocity +
dampingRatio * undampedAngularFreq * initialDelta) /
angularFreq) *
Math.sin(angularFreq * t) +
initialDelta * Math.cos(angularFreq * t)));
};
}
else if (dampingRatio === 1) {
// Critically damped spring
resolveSpring = (t) => target -
Math.exp(-undampedAngularFreq * t) *
(initialDelta +
(initialVelocity + undampedAngularFreq * initialDelta) * t);
}
else {
// Overdamped spring
const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
resolveSpring = (t) => {
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
// When performing sinh or cosh values can hit Infinity so we cap them here
const freqForT = Math.min(dampedAngularFreq * t, 300);
return (target -
(envelope *
((initialVelocity +
dampingRatio * undampedAngularFreq * initialDelta) *
Math.sinh(freqForT) +
dampedAngularFreq *
initialDelta *
Math.cosh(freqForT))) /
dampedAngularFreq);
};
}
return {
calculatedDuration: isResolvedFromDuration ? duration || null : null,
next: (t) => {
const current = resolveSpring(t);
if (!isResolvedFromDuration) {
let currentVelocity = initialVelocity;
if (t !== 0) {
/**
* We only need to calculate velocity for under-damped springs
* as over- and critically-damped springs can't overshoot, so
* checking only for displacement is enough.
*/
if (dampingRatio < 1) {
currentVelocity = calcGeneratorVelocity(resolveSpring, t, current);
}
else {
currentVelocity = 0;
}
}
const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
const isBelowDisplacementThreshold = Math.abs(target - current) <= restDelta;
state.done =
isBelowVelocityThreshold && isBelowDisplacementThreshold;
}
else {
state.done = t >= duration;
}
state.value = state.done ? target : current;
return state;
},
};
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/generators/inertia.mjs
function inertia({ keyframes, velocity = 0.0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed, }) {
const origin = keyframes[0];
const state = {
done: false,
value: origin,
};
const isOutOfBounds = (v) => (min !== undefined && v < min) || (max !== undefined && v > max);
const nearestBoundary = (v) => {
if (min === undefined)
return max;
if (max === undefined)
return min;
return Math.abs(min - v) < Math.abs(max - v) ? min : max;
};
let amplitude = power * velocity;
const ideal = origin + amplitude;
const target = modifyTarget === undefined ? ideal : modifyTarget(ideal);
/**
* If the target has changed we need to re-calculate the amplitude, otherwise
* the animation will start from the wrong position.
*/
if (target !== ideal)
amplitude = target - origin;
const calcDelta = (t) => -amplitude * Math.exp(-t / timeConstant);
const calcLatest = (t) => target + calcDelta(t);
const applyFriction = (t) => {
const delta = calcDelta(t);
const latest = calcLatest(t);
state.done = Math.abs(delta) <= restDelta;
state.value = state.done ? target : latest;
};
/**
* Ideally this would resolve for t in a stateless way, we could
* do that by always precalculating the animation but as we know
* this will be done anyway we can assume that spring will
* be discovered during that.
*/
let timeReachedBoundary;
let spring$1;
const checkCatchBoundary = (t) => {
if (!isOutOfBounds(state.value))
return;
timeReachedBoundary = t;
spring$1 = spring({
keyframes: [state.value, nearestBoundary(state.value)],
velocity: calcGeneratorVelocity(calcLatest, t, state.value),
damping: bounceDamping,
stiffness: bounceStiffness,
restDelta,
restSpeed,
});
};
checkCatchBoundary(0);
return {
calculatedDuration: null,
next: (t) => {
/**
* We need to resolve the friction to figure out if we need a
* spring but we don't want to do this twice per frame. So here
* we flag if we updated for this frame and later if we did
* we can skip doing it again.
*/
let hasUpdatedFrame = false;
if (!spring$1 && timeReachedBoundary === undefined) {
hasUpdatedFrame = true;
applyFriction(t);
checkCatchBoundary(t);
}
/**
* If we have a spring and the provided t is beyond the moment the friction
* animation crossed the min/max boundary, use the spring.
*/
if (timeReachedBoundary !== undefined && t > timeReachedBoundary) {
return spring$1.next(t - timeReachedBoundary);
}
else {
!hasUpdatedFrame && applyFriction(t);
return state;
}
},
};
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/animators/js/driver-frameloop.mjs
const frameloopDriver = (update) => {
const passTimestamp = ({ timestamp }) => update(timestamp);
return {
start: () => frame_frame.update(passTimestamp, true),
stop: () => cancelFrame(passTimestamp),
/**
* If we're processing this frame we can use the
* framelocked timestamp to keep things in sync.
*/
now: () => frameData.isProcessing ? frameData.timestamp : performance.now(),
};
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/generators/utils/calc-duration.mjs
/**
* Implement a practical max duration for keyframe generation
* to prevent infinite loops
*/
const maxGeneratorDuration = 20000;
function calcGeneratorDuration(generator) {
let duration = 0;
const timeStep = 50;
let state = generator.next(duration);
while (!state.done && duration < maxGeneratorDuration) {
duration += timeStep;
state = generator.next(duration);
}
return duration >= maxGeneratorDuration ? Infinity : duration;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/animators/js/index.mjs
const types = {
decay: inertia,
inertia: inertia,
tween: keyframes_keyframes,
keyframes: keyframes_keyframes,
spring: spring,
};
/**
* Animate a single value on the main thread.
*
* This function is written, where functionality overlaps,
* to be largely spec-compliant with WAAPI to allow fungibility
* between the two.
*/
function animateValue({ autoplay = true, delay = 0, driver = frameloopDriver, keyframes: keyframes$1, type = "keyframes", repeat = 0, repeatDelay = 0, repeatType = "loop", onPlay, onStop, onComplete, onUpdate, ...options }) {
let speed = 1;
let hasStopped = false;
let resolveFinishedPromise;
let currentFinishedPromise;
/**
* Resolve the current Promise every time we enter the
* finished state. This is WAAPI-compatible behaviour.
*/
const updateFinishedPromise = () => {
currentFinishedPromise = new Promise((resolve) => {
resolveFinishedPromise = resolve;
});
};
// Create the first finished promise
updateFinishedPromise();
let animationDriver;
const generatorFactory = types[type] || keyframes_keyframes;
/**
* If this isn't the keyframes generator and we've been provided
* strings as keyframes, we need to interpolate these.
* TODO: Support velocity for units and complex value types/
*/
let mapNumbersToKeyframes;
if (generatorFactory !== keyframes_keyframes &&
typeof keyframes$1[0] !== "number") {
mapNumbersToKeyframes = interpolate([0, 100], keyframes$1, {
clamp: false,
});
keyframes$1 = [0, 100];
}
const generator = generatorFactory({ ...options, keyframes: keyframes$1 });
let mirroredGenerator;
if (repeatType === "mirror") {
mirroredGenerator = generatorFactory({
...options,
keyframes: [...keyframes$1].reverse(),
velocity: -(options.velocity || 0),
});
}
let playState = "idle";
let holdTime = null;
let startTime = null;
let cancelTime = null;
/**
* If duration is undefined and we have repeat options,
* we need to calculate a duration from the generator.
*
* We set it to the generator itself to cache the duration.
* Any timeline resolver will need to have already precalculated
* the duration by this step.
*/
if (generator.calculatedDuration === null && repeat) {
generator.calculatedDuration = calcGeneratorDuration(generator);
}
const { calculatedDuration } = generator;
let resolvedDuration = Infinity;
let totalDuration = Infinity;
if (calculatedDuration !== null) {
resolvedDuration = calculatedDuration + repeatDelay;
totalDuration = resolvedDuration * (repeat + 1) - repeatDelay;
}
let currentTime = 0;
const tick = (timestamp) => {
if (startTime === null)
return;
/**
* requestAnimationFrame timestamps can come through as lower than
* the startTime as set by performance.now(). Here we prevent this,
* though in the future it could be possible to make setting startTime
* a pending operation that gets resolved here.
*/
if (speed > 0)
startTime = Math.min(startTime, timestamp);
if (speed < 0)
startTime = Math.min(timestamp - totalDuration / speed, startTime);
if (holdTime !== null) {
currentTime = holdTime;
}
else {
// Rounding the time because floating point arithmetic is not always accurate, e.g. 3000.367 - 1000.367 =
// 2000.0000000000002. This is a problem when we are comparing the currentTime with the duration, for
// example.
currentTime = Math.round(timestamp - startTime) * speed;
}
// Rebase on delay
const timeWithoutDelay = currentTime - delay * (speed >= 0 ? 1 : -1);
const isInDelayPhase = speed >= 0 ? timeWithoutDelay < 0 : timeWithoutDelay > totalDuration;
currentTime = Math.max(timeWithoutDelay, 0);
/**
* If this animation has finished, set the current time
* to the total duration.
*/
if (playState === "finished" && holdTime === null) {
currentTime = totalDuration;
}
let elapsed = currentTime;
let frameGenerator = generator;
if (repeat) {
/**
* Get the current progress (0-1) of the animation. If t is >
* than duration we'll get values like 2.5 (midway through the
* third iteration)
*/
const progress = currentTime / resolvedDuration;
/**
* Get the current iteration (0 indexed). For instance the floor of
* 2.5 is 2.
*/
let currentIteration = Math.floor(progress);
/**
* Get the current progress of the iteration by taking the remainder
* so 2.5 is 0.5 through iteration 2
*/
let iterationProgress = progress % 1.0;
/**
* If iteration progress is 1 we count that as the end
* of the previous iteration.
*/
if (!iterationProgress && progress >= 1) {
iterationProgress = 1;
}
iterationProgress === 1 && currentIteration--;
currentIteration = Math.min(currentIteration, repeat + 1);
/**
* Reverse progress if we're not running in "normal" direction
*/
const iterationIsOdd = Boolean(currentIteration % 2);
if (iterationIsOdd) {
if (repeatType === "reverse") {
iterationProgress = 1 - iterationProgress;
if (repeatDelay) {
iterationProgress -= repeatDelay / resolvedDuration;
}
}
else if (repeatType === "mirror") {
frameGenerator = mirroredGenerator;
}
}
let p = clamp_clamp(0, 1, iterationProgress);
if (currentTime > totalDuration) {
p = repeatType === "reverse" && iterationIsOdd ? 1 : 0;
}
elapsed = p * resolvedDuration;
}
/**
* If we're in negative time, set state as the initial keyframe.
* This prevents delay: x, duration: 0 animations from finishing
* instantly.
*/
const state = isInDelayPhase
? { done: false, value: keyframes$1[0] }
: frameGenerator.next(elapsed);
if (mapNumbersToKeyframes) {
state.value = mapNumbersToKeyframes(state.value);
}
let { done } = state;
if (!isInDelayPhase && calculatedDuration !== null) {
done = speed >= 0 ? currentTime >= totalDuration : currentTime <= 0;
}
const isAnimationFinished = holdTime === null &&
(playState === "finished" || (playState === "running" && done));
if (onUpdate) {
onUpdate(state.value);
}
if (isAnimationFinished) {
finish();
}
return state;
};
const stopAnimationDriver = () => {
animationDriver && animationDriver.stop();
animationDriver = undefined;
};
const cancel = () => {
playState = "idle";
stopAnimationDriver();
resolveFinishedPromise();
updateFinishedPromise();
startTime = cancelTime = null;
};
const finish = () => {
playState = "finished";
onComplete && onComplete();
stopAnimationDriver();
resolveFinishedPromise();
};
const play = () => {
if (hasStopped)
return;
if (!animationDriver)
animationDriver = driver(tick);
const now = animationDriver.now();
onPlay && onPlay();
if (holdTime !== null) {
startTime = now - holdTime;
}
else if (!startTime || playState === "finished") {
startTime = now;
}
if (playState === "finished") {
updateFinishedPromise();
}
cancelTime = startTime;
holdTime = null;
/**
* Set playState to running only after we've used it in
* the previous logic.
*/
playState = "running";
animationDriver.start();
};
if (autoplay) {
play();
}
const controls = {
then(resolve, reject) {
return currentFinishedPromise.then(resolve, reject);
},
get time() {
return millisecondsToSeconds(currentTime);
},
set time(newTime) {
newTime = secondsToMilliseconds(newTime);
currentTime = newTime;
if (holdTime !== null || !animationDriver || speed === 0) {
holdTime = newTime;
}
else {
startTime = animationDriver.now() - newTime / speed;
}
},
get duration() {
const duration = generator.calculatedDuration === null
? calcGeneratorDuration(generator)
: generator.calculatedDuration;
return millisecondsToSeconds(duration);
},
get speed() {
return speed;
},
set speed(newSpeed) {
if (newSpeed === speed || !animationDriver)
return;
speed = newSpeed;
controls.time = millisecondsToSeconds(currentTime);
},
get state() {
return playState;
},
play,
pause: () => {
playState = "paused";
holdTime = currentTime;
},
stop: () => {
hasStopped = true;
if (playState === "idle")
return;
playState = "idle";
onStop && onStop();
cancel();
},
cancel: () => {
if (cancelTime !== null)
tick(cancelTime);
cancel();
},
complete: () => {
playState = "finished";
},
sample: (elapsed) => {
startTime = 0;
return tick(elapsed);
},
};
return controls;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/memo.mjs
function memo(callback) {
let result;
return () => {
if (result === undefined)
result = callback();
return result;
};
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/animators/waapi/create-accelerated-animation.mjs
const supportsWaapi = memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
/**
* A list of values that can be hardware-accelerated.
*/
const acceleratedValues = new Set([
"opacity",
"clipPath",
"filter",
"transform",
"backgroundColor",
]);
/**
* 10ms is chosen here as it strikes a balance between smooth
* results (more than one keyframe per frame at 60fps) and
* keyframe quantity.
*/
const sampleDelta = 10; //ms
/**
* Implement a practical max duration for keyframe generation
* to prevent infinite loops
*/
const create_accelerated_animation_maxDuration = 20000;
const requiresPregeneratedKeyframes = (valueName, options) => options.type === "spring" ||
valueName === "backgroundColor" ||
!isWaapiSupportedEasing(options.ease);
function createAcceleratedAnimation(value, valueName, { onUpdate, onComplete, ...options }) {
const canAccelerateAnimation = supportsWaapi() &&
acceleratedValues.has(valueName) &&
!options.repeatDelay &&
options.repeatType !== "mirror" &&
options.damping !== 0 &&
options.type !== "inertia";
if (!canAccelerateAnimation)
return false;
/**
* TODO: Unify with js/index
*/
let hasStopped = false;
let resolveFinishedPromise;
let currentFinishedPromise;
/**
* Resolve the current Promise every time we enter the
* finished state. This is WAAPI-compatible behaviour.
*/
const updateFinishedPromise = () => {
currentFinishedPromise = new Promise((resolve) => {
resolveFinishedPromise = resolve;
});
};
// Create the first finished promise
updateFinishedPromise();
let { keyframes, duration = 300, ease, times } = options;
/**
* If this animation needs pre-generated keyframes then generate.
*/
if (requiresPregeneratedKeyframes(valueName, options)) {
const sampleAnimation = animateValue({
...options,
repeat: 0,
delay: 0,
});
let state = { done: false, value: keyframes[0] };
const pregeneratedKeyframes = [];
/**
* Bail after 20 seconds of pre-generated keyframes as it's likely
* we're heading for an infinite loop.
*/
let t = 0;
while (!state.done && t < create_accelerated_animation_maxDuration) {
state = sampleAnimation.sample(t);
pregeneratedKeyframes.push(state.value);
t += sampleDelta;
}
times = undefined;
keyframes = pregeneratedKeyframes;
duration = t - sampleDelta;
ease = "linear";
}
const animation = animateStyle(value.owner.current, valueName, keyframes, {
...options,
duration,
/**
* This function is currently not called if ease is provided
* as a function so the cast is safe.
*
* However it would be possible for a future refinement to port
* in easing pregeneration from Motion One for browsers that
* support the upcoming `linear()` easing function.
*/
ease: ease,
times,
});
/**
* WAAPI animations don't resolve startTime synchronously. But a blocked
* thread could delay the startTime resolution by a noticeable amount.
* For synching handoff animations with the new Motion animation we want
* to ensure startTime is synchronously set.
*/
if (options.syncStart) {
animation.startTime = frameData.isProcessing
? frameData.timestamp
: document.timeline
? document.timeline.currentTime
: performance.now();
}
const cancelAnimation = () => animation.cancel();
const safeCancel = () => {
frame_frame.update(cancelAnimation);
resolveFinishedPromise();
updateFinishedPromise();
};
/**
* Prefer the `onfinish` prop as it's more widely supported than
* the `finished` promise.
*
* Here, we synchronously set the provided MotionValue to the end
* keyframe. If we didn't, when the WAAPI animation is finished it would
* be removed from the element which would then revert to its old styles.
*/
animation.onfinish = () => {
value.set(getFinalKeyframe(keyframes, options));
onComplete && onComplete();
safeCancel();
};
/**
* Animation interrupt callback.
*/
const controls = {
then(resolve, reject) {
return currentFinishedPromise.then(resolve, reject);
},
attachTimeline(timeline) {
animation.timeline = timeline;
animation.onfinish = null;
return noop_noop;
},
get time() {
return millisecondsToSeconds(animation.currentTime || 0);
},
set time(newTime) {
animation.currentTime = secondsToMilliseconds(newTime);
},
get speed() {
return animation.playbackRate;
},
set speed(newSpeed) {
animation.playbackRate = newSpeed;
},
get duration() {
return millisecondsToSeconds(duration);
},
play: () => {
if (hasStopped)
return;
animation.play();
/**
* Cancel any pending cancel tasks
*/
cancelFrame(cancelAnimation);
},
pause: () => animation.pause(),
stop: () => {
hasStopped = true;
if (animation.playState === "idle")
return;
/**
* WAAPI doesn't natively have any interruption capabilities.
*
* Rather than read commited styles back out of the DOM, we can
* create a renderless JS animation and sample it twice to calculate
* its current value, "previous" value, and therefore allow
* Motion to calculate velocity for any subsequent animation.
*/
const { currentTime } = animation;
if (currentTime) {
const sampleAnimation = animateValue({
...options,
autoplay: false,
});
value.setWithVelocity(sampleAnimation.sample(currentTime - sampleDelta).value, sampleAnimation.sample(currentTime).value, sampleDelta);
}
safeCancel();
},
complete: () => animation.finish(),
cancel: safeCancel,
};
return controls;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/animators/instant.mjs
function createInstantAnimation({ keyframes, delay, onUpdate, onComplete, }) {
const setValue = () => {
onUpdate && onUpdate(keyframes[keyframes.length - 1]);
onComplete && onComplete();
/**
* TODO: As this API grows it could make sense to always return
* animateValue. This will be a bigger project as animateValue
* is frame-locked whereas this function resolves instantly.
* This is a behavioural change and also has ramifications regarding
* assumptions within tests.
*/
return {
time: 0,
speed: 1,
duration: 0,
play: (noop_noop),
pause: (noop_noop),
stop: (noop_noop),
then: (resolve) => {
resolve();
return Promise.resolve();
},
cancel: (noop_noop),
complete: (noop_noop),
};
};
return delay
? animateValue({
keyframes: [0, 1],
duration: 0,
delay,
onComplete: setValue,
})
: setValue();
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/default-transitions.mjs
const underDampedSpring = {
type: "spring",
stiffness: 500,
damping: 25,
restSpeed: 10,
};
const criticallyDampedSpring = (target) => ({
type: "spring",
stiffness: 550,
damping: target === 0 ? 2 * Math.sqrt(550) : 30,
restSpeed: 10,
});
const keyframesTransition = {
type: "keyframes",
duration: 0.8,
};
/**
* Default easing curve is a slightly shallower version of
* the default browser easing curve.
*/
const ease = {
type: "keyframes",
ease: [0.25, 0.1, 0.35, 1],
duration: 0.3,
};
const getDefaultTransition = (valueKey, { keyframes }) => {
if (keyframes.length > 2) {
return keyframesTransition;
}
else if (transformProps.has(valueKey)) {
return valueKey.startsWith("scale")
? criticallyDampedSpring(keyframes[1])
: underDampedSpring;
}
return ease;
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-animatable.mjs
/**
* Check if a value is animatable. Examples:
*
* ✅: 100, "100px", "#fff"
* ❌: "block", "url(2.jpg)"
* @param value
*
* @internal
*/
const isAnimatable = (key, value) => {
// If the list of keys tat might be non-animatable grows, replace with Set
if (key === "zIndex")
return false;
// If it's a number or a keyframes array, we can animate it. We might at some point
// need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,
// but for now lets leave it like this for performance reasons
if (typeof value === "number" || Array.isArray(value))
return true;
if (typeof value === "string" && // It's animatable if we have a string
(complex.test(value) || value === "0") && // And it contains numbers and/or colors
!value.startsWith("url(") // Unless it starts with "url("
) {
return true;
}
return false;
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/types/complex/filter.mjs
/**
* Properties that should default to 1 or 100%
*/
const maxDefaults = new Set(["brightness", "contrast", "saturate", "opacity"]);
function applyDefaultFilter(v) {
const [name, value] = v.slice(0, -1).split("(");
if (name === "drop-shadow")
return v;
const [number] = value.match(floatRegex) || [];
if (!number)
return v;
const unit = value.replace(number, "");
let defaultValue = maxDefaults.has(name) ? 1 : 0;
if (number !== value)
defaultValue *= 100;
return name + "(" + defaultValue + unit + ")";
}
const functionRegex = /([a-z-]*)\(.*?\)/g;
const filter = {
...complex,
getAnimatableNone: (v) => {
const functions = v.match(functionRegex);
return functions ? functions.map(applyDefaultFilter).join(" ") : v;
},
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/defaults.mjs
/**
* A map of default value types for common values
*/
const defaultValueTypes = {
...numberValueTypes,
// Color props
color: color,
backgroundColor: color,
outlineColor: color,
fill: color,
stroke: color,
// Border props
borderColor: color,
borderTopColor: color,
borderRightColor: color,
borderBottomColor: color,
borderLeftColor: color,
filter: filter,
WebkitFilter: filter,
};
/**
* Gets the default ValueType for the provided value key
*/
const getDefaultValueType = (key) => defaultValueTypes[key];
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/animatable-none.mjs
function animatable_none_getAnimatableNone(key, value) {
let defaultValueType = getDefaultValueType(key);
if (defaultValueType !== filter)
defaultValueType = complex;
// If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
return defaultValueType.getAnimatableNone
? defaultValueType.getAnimatableNone(value)
: undefined;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-zero-value-string.mjs
/**
* Check if the value is a zero value string like "0px" or "0%"
*/
const isZeroValueString = (v) => /^0[^.\s]+$/.test(v);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-none.mjs
function isNone(value) {
if (typeof value === "number") {
return value === 0;
}
else if (value !== null) {
return value === "none" || value === "0" || isZeroValueString(value);
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/keyframes.mjs
function getKeyframes(value, valueName, target, transition) {
const isTargetAnimatable = isAnimatable(valueName, target);
let keyframes;
if (Array.isArray(target)) {
keyframes = [...target];
}
else {
keyframes = [null, target];
}
const defaultOrigin = transition.from !== undefined ? transition.from : value.get();
let animatableTemplateValue = undefined;
const noneKeyframeIndexes = [];
for (let i = 0; i < keyframes.length; i++) {
/**
* Fill null/wildcard keyframes
*/
if (keyframes[i] === null) {
keyframes[i] = i === 0 ? defaultOrigin : keyframes[i - 1];
}
if (isNone(keyframes[i])) {
noneKeyframeIndexes.push(i);
}
// TODO: Clean this conditional, it works for now
if (typeof keyframes[i] === "string" &&
keyframes[i] !== "none" &&
keyframes[i] !== "0") {
animatableTemplateValue = keyframes[i];
}
}
if (isTargetAnimatable &&
noneKeyframeIndexes.length &&
animatableTemplateValue) {
for (let i = 0; i < noneKeyframeIndexes.length; i++) {
const index = noneKeyframeIndexes[i];
keyframes[index] = animatable_none_getAnimatableNone(valueName, animatableTemplateValue);
}
}
return keyframes;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/transitions.mjs
/**
* Decide whether a transition is defined on a given Transition.
* This filters out orchestration options and returns true
* if any options are left.
*/
function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from, elapsed, ...transition }) {
return !!Object.keys(transition).length;
}
function getValueTransition(transition, key) {
return transition[key] || transition["default"] || transition;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/interfaces/motion-value.mjs
const animateMotionValue = (valueName, value, target, transition = {}) => {
return (onComplete) => {
const valueTransition = getValueTransition(transition, valueName) || {};
/**
* Most transition values are currently completely overwritten by value-specific
* transitions. In the future it'd be nicer to blend these transitions. But for now
* delay actually does inherit from the root transition if not value-specific.
*/
const delay = valueTransition.delay || transition.delay || 0;
/**
* Elapsed isn't a public transition option but can be passed through from
* optimized appear effects in milliseconds.
*/
let { elapsed = 0 } = transition;
elapsed = elapsed - secondsToMilliseconds(delay);
const keyframes = getKeyframes(value, valueName, target, valueTransition);
/**
* Check if we're able to animate between the start and end keyframes,
* and throw a warning if we're attempting to animate between one that's
* animatable and another that isn't.
*/
const originKeyframe = keyframes[0];
const targetKeyframe = keyframes[keyframes.length - 1];
const isOriginAnimatable = isAnimatable(valueName, originKeyframe);
const isTargetAnimatable = isAnimatable(valueName, targetKeyframe);
warning(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${valueName} from "${originKeyframe}" to "${targetKeyframe}". ${originKeyframe} is not an animatable value - to enable this animation set ${originKeyframe} to a value animatable to ${targetKeyframe} via the \`style\` property.`);
let options = {
keyframes,
velocity: value.getVelocity(),
ease: "easeOut",
...valueTransition,
delay: -elapsed,
onUpdate: (v) => {
value.set(v);
valueTransition.onUpdate && valueTransition.onUpdate(v);
},
onComplete: () => {
onComplete();
valueTransition.onComplete && valueTransition.onComplete();
},
};
/**
* If there's no transition defined for this value, we can generate
* unqiue transition settings for this value.
*/
if (!isTransitionDefined(valueTransition)) {
options = {
...options,
...getDefaultTransition(valueName, options),
};
}
/**
* Both WAAPI and our internal animation functions use durations
* as defined by milliseconds, while our external API defines them
* as seconds.
*/
if (options.duration) {
options.duration = secondsToMilliseconds(options.duration);
}
if (options.repeatDelay) {
options.repeatDelay = secondsToMilliseconds(options.repeatDelay);
}
if (!isOriginAnimatable ||
!isTargetAnimatable ||
instantAnimationState.current ||
valueTransition.type === false) {
/**
* If we can't animate this value, or the global instant animation flag is set,
* or this is simply defined as an instant transition, return an instant transition.
*/
return createInstantAnimation(instantAnimationState.current
? { ...options, delay: 0 }
: options);
}
/**
* Animate via WAAPI if possible.
*/
if (value.owner &&
value.owner.current instanceof HTMLElement &&
!value.owner.getProps().onUpdate) {
const acceleratedAnimation = createAcceleratedAnimation(value, valueName, options);
if (acceleratedAnimation)
return acceleratedAnimation;
}
/**
* If we didn't create an accelerated animation, create a JS animation
*/
return animateValue(options);
};
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/use-will-change/is.mjs
function isWillChangeMotionValue(value) {
return Boolean(isMotionValue(value) && value.add);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-numerical-string.mjs
/**
* Check if value is a numerical string, ie a string that is purely a number eg "100" or "-100.1"
*/
const isNumericalString = (v) => /^\-?\d*\.?\d+$/.test(v);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/array.mjs
function addUniqueItem(arr, item) {
if (arr.indexOf(item) === -1)
arr.push(item);
}
function removeItem(arr, item) {
const index = arr.indexOf(item);
if (index > -1)
arr.splice(index, 1);
}
// Adapted from array-move
function moveItem([...arr], fromIndex, toIndex) {
const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex;
if (startIndex >= 0 && startIndex < arr.length) {
const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex;
const [item] = arr.splice(fromIndex, 1);
arr.splice(endIndex, 0, item);
}
return arr;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/subscription-manager.mjs
class SubscriptionManager {
constructor() {
this.subscriptions = [];
}
add(handler) {
addUniqueItem(this.subscriptions, handler);
return () => removeItem(this.subscriptions, handler);
}
notify(a, b, c) {
const numSubscriptions = this.subscriptions.length;
if (!numSubscriptions)
return;
if (numSubscriptions === 1) {
/**
* If there's only a single handler we can just call it without invoking a loop.
*/
this.subscriptions[0](a, b, c);
}
else {
for (let i = 0; i < numSubscriptions; i++) {
/**
* Check whether the handler exists before firing as it's possible
* the subscriptions were modified during this loop running.
*/
const handler = this.subscriptions[i];
handler && handler(a, b, c);
}
}
}
getSize() {
return this.subscriptions.length;
}
clear() {
this.subscriptions.length = 0;
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/index.mjs
const isFloat = (value) => {
return !isNaN(parseFloat(value));
};
const collectMotionValues = {
current: undefined,
};
/**
* `MotionValue` is used to track the state and velocity of motion values.
*
* @public
*/
class MotionValue {
/**
* @param init - The initiating value
* @param config - Optional configuration options
*
* - `transformer`: A function to transform incoming values with.
*
* @internal
*/
constructor(init, options = {}) {
/**
* This will be replaced by the build step with the latest version number.
* When MotionValues are provided to motion components, warn if versions are mixed.
*/
this.version = "10.16.4";
/**
* Duration, in milliseconds, since last updating frame.
*
* @internal
*/
this.timeDelta = 0;
/**
* Timestamp of the last time this `MotionValue` was updated.
*
* @internal
*/
this.lastUpdated = 0;
/**
* Tracks whether this value can output a velocity. Currently this is only true
* if the value is numerical, but we might be able to widen the scope here and support
* other value types.
*
* @internal
*/
this.canTrackVelocity = false;
/**
* An object containing a SubscriptionManager for each active event.
*/
this.events = {};
this.updateAndNotify = (v, render = true) => {
this.prev = this.current;
this.current = v;
// Update timestamp
const { delta, timestamp } = frameData;
if (this.lastUpdated !== timestamp) {
this.timeDelta = delta;
this.lastUpdated = timestamp;
frame_frame.postRender(this.scheduleVelocityCheck);
}
// Update update subscribers
if (this.prev !== this.current && this.events.change) {
this.events.change.notify(this.current);
}
// Update velocity subscribers
if (this.events.velocityChange) {
this.events.velocityChange.notify(this.getVelocity());
}
// Update render subscribers
if (render && this.events.renderRequest) {
this.events.renderRequest.notify(this.current);
}
};
/**
* Schedule a velocity check for the next frame.
*
* This is an instanced and bound function to prevent generating a new
* function once per frame.
*
* @internal
*/
this.scheduleVelocityCheck = () => frame_frame.postRender(this.velocityCheck);
/**
* Updates `prev` with `current` if the value hasn't been updated this frame.
* This ensures velocity calculations return `0`.
*
* This is an instanced and bound function to prevent generating a new
* function once per frame.
*
* @internal
*/
this.velocityCheck = ({ timestamp }) => {
if (timestamp !== this.lastUpdated) {
this.prev = this.current;
if (this.events.velocityChange) {
this.events.velocityChange.notify(this.getVelocity());
}
}
};
this.hasAnimated = false;
this.prev = this.current = init;
this.canTrackVelocity = isFloat(this.current);
this.owner = options.owner;
}
/**
* Adds a function that will be notified when the `MotionValue` is updated.
*
* It returns a function that, when called, will cancel the subscription.
*
* When calling `onChange` inside a React component, it should be wrapped with the
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
* from the `useEffect` function to ensure you don't add duplicate subscribers..
*
* ```jsx
* export const MyComponent = () => {
* const x = useMotionValue(0)
* const y = useMotionValue(0)
* const opacity = useMotionValue(1)
*
* useEffect(() => {
* function updateOpacity() {
* const maxXY = Math.max(x.get(), y.get())
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
* opacity.set(newOpacity)
* }
*
* const unsubscribeX = x.on("change", updateOpacity)
* const unsubscribeY = y.on("change", updateOpacity)
*
* return () => {
* unsubscribeX()
* unsubscribeY()
* }
* }, [])
*
* return <motion.div style={{ x }} />
* }
* ```
*
* @param subscriber - A function that receives the latest value.
* @returns A function that, when called, will cancel this subscription.
*
* @deprecated
*/
onChange(subscription) {
if (false) {}
return this.on("change", subscription);
}
on(eventName, callback) {
if (!this.events[eventName]) {
this.events[eventName] = new SubscriptionManager();
}
const unsubscribe = this.events[eventName].add(callback);
if (eventName === "change") {
return () => {
unsubscribe();
/**
* If we have no more change listeners by the start
* of the next frame, stop active animations.
*/
frame_frame.read(() => {
if (!this.events.change.getSize()) {
this.stop();
}
});
};
}
return unsubscribe;
}
clearListeners() {
for (const eventManagers in this.events) {
this.events[eventManagers].clear();
}
}
/**
* Attaches a passive effect to the `MotionValue`.
*
* @internal
*/
attach(passiveEffect, stopPassiveEffect) {
this.passiveEffect = passiveEffect;
this.stopPassiveEffect = stopPassiveEffect;
}
/**
* Sets the state of the `MotionValue`.
*
* @remarks
*
* ```jsx
* const x = useMotionValue(0)
* x.set(10)
* ```
*
* @param latest - Latest value to set.
* @param render - Whether to notify render subscribers. Defaults to `true`
*
* @public
*/
set(v, render = true) {
if (!render || !this.passiveEffect) {
this.updateAndNotify(v, render);
}
else {
this.passiveEffect(v, this.updateAndNotify);
}
}
setWithVelocity(prev, current, delta) {
this.set(current);
this.prev = prev;
this.timeDelta = delta;
}
/**
* Set the state of the `MotionValue`, stopping any active animations,
* effects, and resets velocity to `0`.
*/
jump(v) {
this.updateAndNotify(v);
this.prev = v;
this.stop();
if (this.stopPassiveEffect)
this.stopPassiveEffect();
}
/**
* Returns the latest state of `MotionValue`
*
* @returns - The latest state of `MotionValue`
*
* @public
*/
get() {
if (collectMotionValues.current) {
collectMotionValues.current.push(this);
}
return this.current;
}
/**
* @public
*/
getPrevious() {
return this.prev;
}
/**
* Returns the latest velocity of `MotionValue`
*
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
*
* @public
*/
getVelocity() {
// This could be isFloat(this.prev) && isFloat(this.current), but that would be wasteful
return this.canTrackVelocity
? // These casts could be avoided if parseFloat would be typed better
velocityPerSecond(parseFloat(this.current) -
parseFloat(this.prev), this.timeDelta)
: 0;
}
/**
* Registers a new animation to control this `MotionValue`. Only one
* animation can drive a `MotionValue` at one time.
*
* ```jsx
* value.start()
* ```
*
* @param animation - A function that starts the provided animation
*
* @internal
*/
start(startAnimation) {
this.stop();
return new Promise((resolve) => {
this.hasAnimated = true;
this.animation = startAnimation(resolve);
if (this.events.animationStart) {
this.events.animationStart.notify();
}
}).then(() => {
if (this.events.animationComplete) {
this.events.animationComplete.notify();
}
this.clearAnimation();
});
}
/**
* Stop the currently active animation.
*
* @public
*/
stop() {
if (this.animation) {
this.animation.stop();
if (this.events.animationCancel) {
this.events.animationCancel.notify();
}
}
this.clearAnimation();
}
/**
* Returns `true` if this value is currently animating.
*
* @public
*/
isAnimating() {
return !!this.animation;
}
clearAnimation() {
delete this.animation;
}
/**
* Destroy and clean up subscribers to this `MotionValue`.
*
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
* created a `MotionValue` via the `motionValue` function.
*
* @public
*/
destroy() {
this.clearListeners();
this.stop();
if (this.stopPassiveEffect) {
this.stopPassiveEffect();
}
}
}
function motionValue(init, options) {
return new MotionValue(init, options);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/test.mjs
/**
* Tests a provided value against a ValueType
*/
const testValueType = (v) => (type) => type.test(v);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/type-auto.mjs
/**
* ValueType for "auto"
*/
const auto = {
test: (v) => v === "auto",
parse: (v) => v,
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/dimensions.mjs
/**
* A list of value types commonly used for dimensions
*/
const dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];
/**
* Tests a dimensional value against the list of dimension ValueTypes
*/
const findDimensionValueType = (v) => dimensionValueTypes.find(testValueType(v));
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/find.mjs
/**
* A list of all ValueTypes
*/
const valueTypes = [...dimensionValueTypes, color, complex];
/**
* Tests a value against the list of ValueTypes
*/
const findValueType = (v) => valueTypes.find(testValueType(v));
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/setters.mjs
/**
* Set VisualElement's MotionValue, creating a new MotionValue for it if
* it doesn't exist.
*/
function setMotionValue(visualElement, key, value) {
if (visualElement.hasValue(key)) {
visualElement.getValue(key).set(value);
}
else {
visualElement.addValue(key, motionValue(value));
}
}
function setTarget(visualElement, definition) {
const resolved = resolveVariant(visualElement, definition);
let { transitionEnd = {}, transition = {}, ...target } = resolved ? visualElement.makeTargetAnimatable(resolved, false) : {};
target = { ...target, ...transitionEnd };
for (const key in target) {
const value = resolveFinalValueInKeyframes(target[key]);
setMotionValue(visualElement, key, value);
}
}
function setVariants(visualElement, variantLabels) {
const reversedLabels = [...variantLabels].reverse();
reversedLabels.forEach((key) => {
const variant = visualElement.getVariant(key);
variant && setTarget(visualElement, variant);
if (visualElement.variantChildren) {
visualElement.variantChildren.forEach((child) => {
setVariants(child, variantLabels);
});
}
});
}
function setValues(visualElement, definition) {
if (Array.isArray(definition)) {
return setVariants(visualElement, definition);
}
else if (typeof definition === "string") {
return setVariants(visualElement, [definition]);
}
else {
setTarget(visualElement, definition);
}
}
function checkTargetForNewValues(visualElement, target, origin) {
var _a, _b;
const newValueKeys = Object.keys(target).filter((key) => !visualElement.hasValue(key));
const numNewValues = newValueKeys.length;
if (!numNewValues)
return;
for (let i = 0; i < numNewValues; i++) {
const key = newValueKeys[i];
const targetValue = target[key];
let value = null;
/**
* If the target is a series of keyframes, we can use the first value
* in the array. If this first value is null, we'll still need to read from the DOM.
*/
if (Array.isArray(targetValue)) {
value = targetValue[0];
}
/**
* If the target isn't keyframes, or the first keyframe was null, we need to
* first check if an origin value was explicitly defined in the transition as "from",
* if not read the value from the DOM. As an absolute fallback, take the defined target value.
*/
if (value === null) {
value = (_b = (_a = origin[key]) !== null && _a !== void 0 ? _a : visualElement.readValue(key)) !== null && _b !== void 0 ? _b : target[key];
}
/**
* If value is still undefined or null, ignore it. Preferably this would throw,
* but this was causing issues in Framer.
*/
if (value === undefined || value === null)
continue;
if (typeof value === "string" &&
(isNumericalString(value) || isZeroValueString(value))) {
// If this is a number read as a string, ie "0" or "200", convert it to a number
value = parseFloat(value);
}
else if (!findValueType(value) && complex.test(targetValue)) {
value = animatable_none_getAnimatableNone(key, targetValue);
}
visualElement.addValue(key, motionValue(value, { owner: visualElement }));
if (origin[key] === undefined) {
origin[key] = value;
}
if (value !== null)
visualElement.setBaseTarget(key, value);
}
}
function getOriginFromTransition(key, transition) {
if (!transition)
return;
const valueTransition = transition[key] || transition["default"] || transition;
return valueTransition.from;
}
function getOrigin(target, transition, visualElement) {
const origin = {};
for (const key in target) {
const transitionOrigin = getOriginFromTransition(key, transition);
if (transitionOrigin !== undefined) {
origin[key] = transitionOrigin;
}
else {
const value = visualElement.getValue(key);
if (value) {
origin[key] = value.get();
}
}
}
return origin;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs
/**
* Decide whether we should block this animation. Previously, we achieved this
* just by checking whether the key was listed in protectedKeys, but this
* posed problems if an animation was triggered by afterChildren and protectedKeys
* had been set to true in the meantime.
*/
function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;
needsAnimating[key] = false;
return shouldBlock;
}
function animateTarget(visualElement, definition, { delay = 0, transitionOverride, type } = {}) {
let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = visualElement.makeTargetAnimatable(definition);
const willChange = visualElement.getValue("willChange");
if (transitionOverride)
transition = transitionOverride;
const animations = [];
const animationTypeState = type &&
visualElement.animationState &&
visualElement.animationState.getState()[type];
for (const key in target) {
const value = visualElement.getValue(key);
const valueTarget = target[key];
if (!value ||
valueTarget === undefined ||
(animationTypeState &&
shouldBlockAnimation(animationTypeState, key))) {
continue;
}
const valueTransition = {
delay,
elapsed: 0,
...transition,
};
/**
* If this is the first time a value is being animated, check
* to see if we're handling off from an existing animation.
*/
if (window.HandoffAppearAnimations && !value.hasAnimated) {
const appearId = visualElement.getProps()[optimizedAppearDataAttribute];
if (appearId) {
valueTransition.elapsed = window.HandoffAppearAnimations(appearId, key, value, frame_frame);
valueTransition.syncStart = true;
}
}
value.start(animateMotionValue(key, value, valueTarget, visualElement.shouldReduceMotion && transformProps.has(key)
? { type: false }
: valueTransition));
const animation = value.animation;
if (isWillChangeMotionValue(willChange)) {
willChange.add(key);
animation.then(() => willChange.remove(key));
}
animations.push(animation);
}
if (transitionEnd) {
Promise.all(animations).then(() => {
transitionEnd && setTarget(visualElement, transitionEnd);
});
}
return animations;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs
function animateVariant(visualElement, variant, options = {}) {
const resolved = resolveVariant(visualElement, variant, options.custom);
let { transition = visualElement.getDefaultTransition() || {} } = resolved || {};
if (options.transitionOverride) {
transition = options.transitionOverride;
}
/**
* If we have a variant, create a callback that runs it as an animation.
* Otherwise, we resolve a Promise immediately for a composable no-op.
*/
const getAnimation = resolved
? () => Promise.all(animateTarget(visualElement, resolved, options))
: () => Promise.resolve();
/**
* If we have children, create a callback that runs all their animations.
* Otherwise, we resolve a Promise immediately for a composable no-op.
*/
const getChildAnimations = visualElement.variantChildren && visualElement.variantChildren.size
? (forwardDelay = 0) => {
const { delayChildren = 0, staggerChildren, staggerDirection, } = transition;
return animateChildren(visualElement, variant, delayChildren + forwardDelay, staggerChildren, staggerDirection, options);
}
: () => Promise.resolve();
/**
* If the transition explicitly defines a "when" option, we need to resolve either
* this animation or all children animations before playing the other.
*/
const { when } = transition;
if (when) {
const [first, last] = when === "beforeChildren"
? [getAnimation, getChildAnimations]
: [getChildAnimations, getAnimation];
return first().then(() => last());
}
else {
return Promise.all([getAnimation(), getChildAnimations(options.delay)]);
}
}
function animateChildren(visualElement, variant, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) {
const animations = [];
const maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren;
const generateStaggerDuration = staggerDirection === 1
? (i = 0) => i * staggerChildren
: (i = 0) => maxStaggerDuration - i * staggerChildren;
Array.from(visualElement.variantChildren)
.sort(sortByTreeOrder)
.forEach((child, i) => {
child.notify("AnimationStart", variant);
animations.push(animateVariant(child, variant, {
...options,
delay: delayChildren + generateStaggerDuration(i),
}).then(() => child.notify("AnimationComplete", variant)));
});
return Promise.all(animations);
}
function sortByTreeOrder(a, b) {
return a.sortNodePosition(b);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/interfaces/visual-element.mjs
function animateVisualElement(visualElement, definition, options = {}) {
visualElement.notify("AnimationStart", definition);
let animation;
if (Array.isArray(definition)) {
const animations = definition.map((variant) => animateVariant(visualElement, variant, options));
animation = Promise.all(animations);
}
else if (typeof definition === "string") {
animation = animateVariant(visualElement, definition, options);
}
else {
const resolvedDefinition = typeof definition === "function"
? resolveVariant(visualElement, definition, options.custom)
: definition;
animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options));
}
return animation.then(() => visualElement.notify("AnimationComplete", definition));
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/animation-state.mjs
const reversePriorityOrder = [...variantPriorityOrder].reverse();
const numAnimationTypes = variantPriorityOrder.length;
function animateList(visualElement) {
return (animations) => Promise.all(animations.map(({ animation, options }) => animateVisualElement(visualElement, animation, options)));
}
function createAnimationState(visualElement) {
let animate = animateList(visualElement);
const state = createState();
let isInitialRender = true;
/**
* This function will be used to reduce the animation definitions for
* each active animation type into an object of resolved values for it.
*/
const buildResolvedTypeValues = (acc, definition) => {
const resolved = resolveVariant(visualElement, definition);
if (resolved) {
const { transition, transitionEnd, ...target } = resolved;
acc = { ...acc, ...target, ...transitionEnd };
}
return acc;
};
/**
* This just allows us to inject mocked animation functions
* @internal
*/
function setAnimateFunction(makeAnimator) {
animate = makeAnimator(visualElement);
}
/**
* When we receive new props, we need to:
* 1. Create a list of protected keys for each type. This is a directory of
* value keys that are currently being "handled" by types of a higher priority
* so that whenever an animation is played of a given type, these values are
* protected from being animated.
* 2. Determine if an animation type needs animating.
* 3. Determine if any values have been removed from a type and figure out
* what to animate those to.
*/
function animateChanges(options, changedActiveType) {
const props = visualElement.getProps();
const context = visualElement.getVariantContext(true) || {};
/**
* A list of animations that we'll build into as we iterate through the animation
* types. This will get executed at the end of the function.
*/
const animations = [];
/**
* Keep track of which values have been removed. Then, as we hit lower priority
* animation types, we can check if they contain removed values and animate to that.
*/
const removedKeys = new Set();
/**
* A dictionary of all encountered keys. This is an object to let us build into and
* copy it without iteration. Each time we hit an animation type we set its protected
* keys - the keys its not allowed to animate - to the latest version of this object.
*/
let encounteredKeys = {};
/**
* If a variant has been removed at a given index, and this component is controlling
* variant animations, we want to ensure lower-priority variants are forced to animate.
*/
let removedVariantIndex = Infinity;
/**
* Iterate through all animation types in reverse priority order. For each, we want to
* detect which values it's handling and whether or not they've changed (and therefore
* need to be animated). If any values have been removed, we want to detect those in
* lower priority props and flag for animation.
*/
for (let i = 0; i < numAnimationTypes; i++) {
const type = reversePriorityOrder[i];
const typeState = state[type];
const prop = props[type] !== undefined ? props[type] : context[type];
const propIsVariant = isVariantLabel(prop);
/**
* If this type has *just* changed isActive status, set activeDelta
* to that status. Otherwise set to null.
*/
const activeDelta = type === changedActiveType ? typeState.isActive : null;
if (activeDelta === false)
removedVariantIndex = i;
/**
* If this prop is an inherited variant, rather than been set directly on the
* component itself, we want to make sure we allow the parent to trigger animations.
*
* TODO: Can probably change this to a !isControllingVariants check
*/
let isInherited = prop === context[type] && prop !== props[type] && propIsVariant;
/**
*
*/
if (isInherited &&
isInitialRender &&
visualElement.manuallyAnimateOnMount) {
isInherited = false;
}
/**
* Set all encountered keys so far as the protected keys for this type. This will
* be any key that has been animated or otherwise handled by active, higher-priortiy types.
*/
typeState.protectedKeys = { ...encounteredKeys };
// Check if we can skip analysing this prop early
if (
// If it isn't active and hasn't *just* been set as inactive
(!typeState.isActive && activeDelta === null) ||
// If we didn't and don't have any defined prop for this animation type
(!prop && !typeState.prevProp) ||
// Or if the prop doesn't define an animation
isAnimationControls(prop) ||
typeof prop === "boolean") {
continue;
}
/**
* As we go look through the values defined on this type, if we detect
* a changed value or a value that was removed in a higher priority, we set
* this to true and add this prop to the animation list.
*/
const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
let shouldAnimateType = variantDidChange ||
// If we're making this variant active, we want to always make it active
(type === changedActiveType &&
typeState.isActive &&
!isInherited &&
propIsVariant) ||
// If we removed a higher-priority variant (i is in reverse order)
(i > removedVariantIndex && propIsVariant);
/**
* As animations can be set as variant lists, variants or target objects, we
* coerce everything to an array if it isn't one already
*/
const definitionList = Array.isArray(prop) ? prop : [prop];
/**
* Build an object of all the resolved values. We'll use this in the subsequent
* animateChanges calls to determine whether a value has changed.
*/
let resolvedValues = definitionList.reduce(buildResolvedTypeValues, {});
if (activeDelta === false)
resolvedValues = {};
/**
* Now we need to loop through all the keys in the prev prop and this prop,
* and decide:
* 1. If the value has changed, and needs animating
* 2. If it has been removed, and needs adding to the removedKeys set
* 3. If it has been removed in a higher priority type and needs animating
* 4. If it hasn't been removed in a higher priority but hasn't changed, and
* needs adding to the type's protectedKeys list.
*/
const { prevResolvedValues = {} } = typeState;
const allKeys = {
...prevResolvedValues,
...resolvedValues,
};
const markToAnimate = (key) => {
shouldAnimateType = true;
removedKeys.delete(key);
typeState.needsAnimating[key] = true;
};
for (const key in allKeys) {
const next = resolvedValues[key];
const prev = prevResolvedValues[key];
// If we've already handled this we can just skip ahead
if (encounteredKeys.hasOwnProperty(key))
continue;
/**
* If the value has changed, we probably want to animate it.
*/
if (next !== prev) {
/**
* If both values are keyframes, we need to shallow compare them to
* detect whether any value has changed. If it has, we animate it.
*/
if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
if (!shallowCompare(next, prev) || variantDidChange) {
markToAnimate(key);
}
else {
/**
* If it hasn't changed, we want to ensure it doesn't animate by
* adding it to the list of protected keys.
*/
typeState.protectedKeys[key] = true;
}
}
else if (next !== undefined) {
// If next is defined and doesn't equal prev, it needs animating
markToAnimate(key);
}
else {
// If it's undefined, it's been removed.
removedKeys.add(key);
}
}
else if (next !== undefined && removedKeys.has(key)) {
/**
* If next hasn't changed and it isn't undefined, we want to check if it's
* been removed by a higher priority
*/
markToAnimate(key);
}
else {
/**
* If it hasn't changed, we add it to the list of protected values
* to ensure it doesn't get animated.
*/
typeState.protectedKeys[key] = true;
}
}
/**
* Update the typeState so next time animateChanges is called we can compare the
* latest prop and resolvedValues to these.
*/
typeState.prevProp = prop;
typeState.prevResolvedValues = resolvedValues;
/**
*
*/
if (typeState.isActive) {
encounteredKeys = { ...encounteredKeys, ...resolvedValues };
}
if (isInitialRender && visualElement.blockInitialAnimation) {
shouldAnimateType = false;
}
/**
* If this is an inherited prop we want to hard-block animations
* TODO: Test as this should probably still handle animations triggered
* by removed values?
*/
if (shouldAnimateType && !isInherited) {
animations.push(...definitionList.map((animation) => ({
animation: animation,
options: { type, ...options },
})));
}
}
/**
* If there are some removed value that haven't been dealt with,
* we need to create a new animation that falls back either to the value
* defined in the style prop, or the last read value.
*/
if (removedKeys.size) {
const fallbackAnimation = {};
removedKeys.forEach((key) => {
const fallbackTarget = visualElement.getBaseTarget(key);
if (fallbackTarget !== undefined) {
fallbackAnimation[key] = fallbackTarget;
}
});
animations.push({ animation: fallbackAnimation });
}
let shouldAnimate = Boolean(animations.length);
if (isInitialRender &&
props.initial === false &&
!visualElement.manuallyAnimateOnMount) {
shouldAnimate = false;
}
isInitialRender = false;
return shouldAnimate ? animate(animations) : Promise.resolve();
}
/**
* Change whether a certain animation type is active.
*/
function setActive(type, isActive, options) {
var _a;
// If the active state hasn't changed, we can safely do nothing here
if (state[type].isActive === isActive)
return Promise.resolve();
// Propagate active change to children
(_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach((child) => { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });
state[type].isActive = isActive;
const animations = animateChanges(options, type);
for (const key in state) {
state[key].protectedKeys = {};
}
return animations;
}
return {
animateChanges,
setActive,
setAnimateFunction,
getState: () => state,
};
}
function checkVariantsDidChange(prev, next) {
if (typeof next === "string") {
return next !== prev;
}
else if (Array.isArray(next)) {
return !shallowCompare(next, prev);
}
return false;
}
function createTypeState(isActive = false) {
return {
isActive,
protectedKeys: {},
needsAnimating: {},
prevResolvedValues: {},
};
}
function createState() {
return {
animate: createTypeState(true),
whileInView: createTypeState(),
whileHover: createTypeState(),
whileTap: createTypeState(),
whileDrag: createTypeState(),
whileFocus: createTypeState(),
exit: createTypeState(),
};
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/animation/index.mjs
class AnimationFeature extends Feature {
/**
* We dynamically generate the AnimationState manager as it contains a reference
* to the underlying animation library. We only want to load that if we load this,
* so people can optionally code split it out using the `m` component.
*/
constructor(node) {
super(node);
node.animationState || (node.animationState = createAnimationState(node));
}
updateAnimationControlsSubscription() {
const { animate } = this.node.getProps();
this.unmount();
if (isAnimationControls(animate)) {
this.unmount = animate.subscribe(this.node);
}
}
/**
* Subscribe any provided AnimationControls to the component's VisualElement
*/
mount() {
this.updateAnimationControlsSubscription();
}
update() {
const { animate } = this.node.getProps();
const { animate: prevAnimate } = this.node.prevProps || {};
if (animate !== prevAnimate) {
this.updateAnimationControlsSubscription();
}
}
unmount() { }
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/animation/exit.mjs
let id = 0;
class ExitAnimationFeature extends Feature {
constructor() {
super(...arguments);
this.id = id++;
}
update() {
if (!this.node.presenceContext)
return;
const { isPresent, onExitComplete, custom } = this.node.presenceContext;
const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {};
if (!this.node.animationState || isPresent === prevIsPresent) {
return;
}
const exitAnimation = this.node.animationState.setActive("exit", !isPresent, { custom: custom !== null && custom !== void 0 ? custom : this.node.getProps().custom });
if (onExitComplete && !isPresent) {
exitAnimation.then(() => onExitComplete(this.id));
}
}
mount() {
const { register } = this.node.presenceContext || {};
if (register) {
this.unmount = register(this.id);
}
}
unmount() { }
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/animations.mjs
const animations = {
animation: {
Feature: AnimationFeature,
},
exit: {
Feature: ExitAnimationFeature,
},
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/distance.mjs
const distance = (a, b) => Math.abs(a - b);
function distance2D(a, b) {
// Multi-dimensional
const xDelta = distance(a.x, b.x);
const yDelta = distance(a.y, b.y);
return Math.sqrt(xDelta ** 2 + yDelta ** 2);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs
/**
* @internal
*/
class PanSession {
constructor(event, handlers, { transformPagePoint } = {}) {
/**
* @internal
*/
this.startEvent = null;
/**
* @internal
*/
this.lastMoveEvent = null;
/**
* @internal
*/
this.lastMoveEventInfo = null;
/**
* @internal
*/
this.handlers = {};
this.updatePoint = () => {
if (!(this.lastMoveEvent && this.lastMoveEventInfo))
return;
const info = getPanInfo(this.lastMoveEventInfo, this.history);
const isPanStarted = this.startEvent !== null;
// Only start panning if the offset is larger than 3 pixels. If we make it
// any larger than this we'll want to reset the pointer history
// on the first update to avoid visual snapping to the cursoe.
const isDistancePastThreshold = distance2D(info.offset, { x: 0, y: 0 }) >= 3;
if (!isPanStarted && !isDistancePastThreshold)
return;
const { point } = info;
const { timestamp } = frameData;
this.history.push({ ...point, timestamp });
const { onStart, onMove } = this.handlers;
if (!isPanStarted) {
onStart && onStart(this.lastMoveEvent, info);
this.startEvent = this.lastMoveEvent;
}
onMove && onMove(this.lastMoveEvent, info);
};
this.handlePointerMove = (event, info) => {
this.lastMoveEvent = event;
this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint);
// Throttle mouse move event to once per frame
frame_frame.update(this.updatePoint, true);
};
this.handlePointerUp = (event, info) => {
this.end();
if (!(this.lastMoveEvent && this.lastMoveEventInfo))
return;
const { onEnd, onSessionEnd } = this.handlers;
const panInfo = getPanInfo(event.type === "pointercancel"
? this.lastMoveEventInfo
: transformPoint(info, this.transformPagePoint), this.history);
if (this.startEvent && onEnd) {
onEnd(event, panInfo);
}
onSessionEnd && onSessionEnd(event, panInfo);
};
// If we have more than one touch, don't start detecting this gesture
if (!isPrimaryPointer(event))
return;
this.handlers = handlers;
this.transformPagePoint = transformPagePoint;
const info = extractEventInfo(event);
const initialInfo = transformPoint(info, this.transformPagePoint);
const { point } = initialInfo;
const { timestamp } = frameData;
this.history = [{ ...point, timestamp }];
const { onSessionStart } = handlers;
onSessionStart &&
onSessionStart(event, getPanInfo(initialInfo, this.history));
this.removeListeners = pipe(addPointerEvent(window, "pointermove", this.handlePointerMove), addPointerEvent(window, "pointerup", this.handlePointerUp), addPointerEvent(window, "pointercancel", this.handlePointerUp));
}
updateHandlers(handlers) {
this.handlers = handlers;
}
end() {
this.removeListeners && this.removeListeners();
cancelFrame(this.updatePoint);
}
}
function transformPoint(info, transformPagePoint) {
return transformPagePoint ? { point: transformPagePoint(info.point) } : info;
}
function subtractPoint(a, b) {
return { x: a.x - b.x, y: a.y - b.y };
}
function getPanInfo({ point }, history) {
return {
point,
delta: subtractPoint(point, lastDevicePoint(history)),
offset: subtractPoint(point, startDevicePoint(history)),
velocity: PanSession_getVelocity(history, 0.1),
};
}
function startDevicePoint(history) {
return history[0];
}
function lastDevicePoint(history) {
return history[history.length - 1];
}
function PanSession_getVelocity(history, timeDelta) {
if (history.length < 2) {
return { x: 0, y: 0 };
}
let i = history.length - 1;
let timestampedPoint = null;
const lastPoint = lastDevicePoint(history);
while (i >= 0) {
timestampedPoint = history[i];
if (lastPoint.timestamp - timestampedPoint.timestamp >
secondsToMilliseconds(timeDelta)) {
break;
}
i--;
}
if (!timestampedPoint) {
return { x: 0, y: 0 };
}
const time = millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp);
if (time === 0) {
return { x: 0, y: 0 };
}
const currentVelocity = {
x: (lastPoint.x - timestampedPoint.x) / time,
y: (lastPoint.y - timestampedPoint.y) / time,
};
if (currentVelocity.x === Infinity) {
currentVelocity.x = 0;
}
if (currentVelocity.y === Infinity) {
currentVelocity.y = 0;
}
return currentVelocity;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/delta-calc.mjs
function calcLength(axis) {
return axis.max - axis.min;
}
function isNear(value, target = 0, maxDistance = 0.01) {
return Math.abs(value - target) <= maxDistance;
}
function calcAxisDelta(delta, source, target, origin = 0.5) {
delta.origin = origin;
delta.originPoint = mix(source.min, source.max, delta.origin);
delta.scale = calcLength(target) / calcLength(source);
if (isNear(delta.scale, 1, 0.0001) || isNaN(delta.scale))
delta.scale = 1;
delta.translate =
mix(target.min, target.max, delta.origin) - delta.originPoint;
if (isNear(delta.translate) || isNaN(delta.translate))
delta.translate = 0;
}
function calcBoxDelta(delta, source, target, origin) {
calcAxisDelta(delta.x, source.x, target.x, origin ? origin.originX : undefined);
calcAxisDelta(delta.y, source.y, target.y, origin ? origin.originY : undefined);
}
function calcRelativeAxis(target, relative, parent) {
target.min = parent.min + relative.min;
target.max = target.min + calcLength(relative);
}
function calcRelativeBox(target, relative, parent) {
calcRelativeAxis(target.x, relative.x, parent.x);
calcRelativeAxis(target.y, relative.y, parent.y);
}
function calcRelativeAxisPosition(target, layout, parent) {
target.min = layout.min - parent.min;
target.max = target.min + calcLength(layout);
}
function calcRelativePosition(target, layout, parent) {
calcRelativeAxisPosition(target.x, layout.x, parent.x);
calcRelativeAxisPosition(target.y, layout.y, parent.y);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.mjs
/**
* Apply constraints to a point. These constraints are both physical along an
* axis, and an elastic factor that determines how much to constrain the point
* by if it does lie outside the defined parameters.
*/
function applyConstraints(point, { min, max }, elastic) {
if (min !== undefined && point < min) {
// If we have a min point defined, and this is outside of that, constrain
point = elastic ? mix(min, point, elastic.min) : Math.max(point, min);
}
else if (max !== undefined && point > max) {
// If we have a max point defined, and this is outside of that, constrain
point = elastic ? mix(max, point, elastic.max) : Math.min(point, max);
}
return point;
}
/**
* Calculate constraints in terms of the viewport when defined relatively to the
* measured axis. This is measured from the nearest edge, so a max constraint of 200
* on an axis with a max value of 300 would return a constraint of 500 - axis length
*/
function calcRelativeAxisConstraints(axis, min, max) {
return {
min: min !== undefined ? axis.min + min : undefined,
max: max !== undefined
? axis.max + max - (axis.max - axis.min)
: undefined,
};
}
/**
* Calculate constraints in terms of the viewport when
* defined relatively to the measured bounding box.
*/
function calcRelativeConstraints(layoutBox, { top, left, bottom, right }) {
return {
x: calcRelativeAxisConstraints(layoutBox.x, left, right),
y: calcRelativeAxisConstraints(layoutBox.y, top, bottom),
};
}
/**
* Calculate viewport constraints when defined as another viewport-relative axis
*/
function calcViewportAxisConstraints(layoutAxis, constraintsAxis) {
let min = constraintsAxis.min - layoutAxis.min;
let max = constraintsAxis.max - layoutAxis.max;
// If the constraints axis is actually smaller than the layout axis then we can
// flip the constraints
if (constraintsAxis.max - constraintsAxis.min <
layoutAxis.max - layoutAxis.min) {
[min, max] = [max, min];
}
return { min, max };
}
/**
* Calculate viewport constraints when defined as another viewport-relative box
*/
function calcViewportConstraints(layoutBox, constraintsBox) {
return {
x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),
y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y),
};
}
/**
* Calculate a transform origin relative to the source axis, between 0-1, that results
* in an asthetically pleasing scale/transform needed to project from source to target.
*/
function constraints_calcOrigin(source, target) {
let origin = 0.5;
const sourceLength = calcLength(source);
const targetLength = calcLength(target);
if (targetLength > sourceLength) {
origin = progress(target.min, target.max - sourceLength, source.min);
}
else if (sourceLength > targetLength) {
origin = progress(source.min, source.max - targetLength, target.min);
}
return clamp_clamp(0, 1, origin);
}
/**
* Rebase the calculated viewport constraints relative to the layout.min point.
*/
function rebaseAxisConstraints(layout, constraints) {
const relativeConstraints = {};
if (constraints.min !== undefined) {
relativeConstraints.min = constraints.min - layout.min;
}
if (constraints.max !== undefined) {
relativeConstraints.max = constraints.max - layout.min;
}
return relativeConstraints;
}
const defaultElastic = 0.35;
/**
* Accepts a dragElastic prop and returns resolved elastic values for each axis.
*/
function resolveDragElastic(dragElastic = defaultElastic) {
if (dragElastic === false) {
dragElastic = 0;
}
else if (dragElastic === true) {
dragElastic = defaultElastic;
}
return {
x: resolveAxisElastic(dragElastic, "left", "right"),
y: resolveAxisElastic(dragElastic, "top", "bottom"),
};
}
function resolveAxisElastic(dragElastic, minLabel, maxLabel) {
return {
min: resolvePointElastic(dragElastic, minLabel),
max: resolvePointElastic(dragElastic, maxLabel),
};
}
function resolvePointElastic(dragElastic, label) {
return typeof dragElastic === "number"
? dragElastic
: dragElastic[label] || 0;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/models.mjs
const createAxisDelta = () => ({
translate: 0,
scale: 1,
origin: 0,
originPoint: 0,
});
const createDelta = () => ({
x: createAxisDelta(),
y: createAxisDelta(),
});
const createAxis = () => ({ min: 0, max: 0 });
const createBox = () => ({
x: createAxis(),
y: createAxis(),
});
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/utils/each-axis.mjs
function eachAxis(callback) {
return [callback("x"), callback("y")];
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/conversion.mjs
/**
* Bounding boxes tend to be defined as top, left, right, bottom. For various operations
* it's easier to consider each axis individually. This function returns a bounding box
* as a map of single-axis min/max values.
*/
function convertBoundingBoxToBox({ top, left, right, bottom, }) {
return {
x: { min: left, max: right },
y: { min: top, max: bottom },
};
}
function convertBoxToBoundingBox({ x, y }) {
return { top: y.min, right: x.max, bottom: y.max, left: x.min };
}
/**
* Applies a TransformPoint function to a bounding box. TransformPoint is usually a function
* provided by Framer to allow measured points to be corrected for device scaling. This is used
* when measuring DOM elements and DOM event points.
*/
function transformBoxPoints(point, transformPoint) {
if (!transformPoint)
return point;
const topLeft = transformPoint({ x: point.left, y: point.top });
const bottomRight = transformPoint({ x: point.right, y: point.bottom });
return {
top: topLeft.y,
left: topLeft.x,
bottom: bottomRight.y,
right: bottomRight.x,
};
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/utils/has-transform.mjs
function isIdentityScale(scale) {
return scale === undefined || scale === 1;
}
function hasScale({ scale, scaleX, scaleY }) {
return (!isIdentityScale(scale) ||
!isIdentityScale(scaleX) ||
!isIdentityScale(scaleY));
}
function hasTransform(values) {
return (hasScale(values) ||
has2DTranslate(values) ||
values.z ||
values.rotate ||
values.rotateX ||
values.rotateY);
}
function has2DTranslate(values) {
return is2DTranslate(values.x) || is2DTranslate(values.y);
}
function is2DTranslate(value) {
return value && value !== "0%";
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/delta-apply.mjs
/**
* Scales a point based on a factor and an originPoint
*/
function scalePoint(point, scale, originPoint) {
const distanceFromOrigin = point - originPoint;
const scaled = scale * distanceFromOrigin;
return originPoint + scaled;
}
/**
* Applies a translate/scale delta to a point
*/
function applyPointDelta(point, translate, scale, originPoint, boxScale) {
if (boxScale !== undefined) {
point = scalePoint(point, boxScale, originPoint);
}
return scalePoint(point, scale, originPoint) + translate;
}
/**
* Applies a translate/scale delta to an axis
*/
function applyAxisDelta(axis, translate = 0, scale = 1, originPoint, boxScale) {
axis.min = applyPointDelta(axis.min, translate, scale, originPoint, boxScale);
axis.max = applyPointDelta(axis.max, translate, scale, originPoint, boxScale);
}
/**
* Applies a translate/scale delta to a box
*/
function applyBoxDelta(box, { x, y }) {
applyAxisDelta(box.x, x.translate, x.scale, x.originPoint);
applyAxisDelta(box.y, y.translate, y.scale, y.originPoint);
}
/**
* Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms
* in a tree upon our box before then calculating how to project it into our desired viewport-relative box
*
* This is the final nested loop within updateLayoutDelta for future refactoring
*/
function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
const treeLength = treePath.length;
if (!treeLength)
return;
// Reset the treeScale
treeScale.x = treeScale.y = 1;
let node;
let delta;
for (let i = 0; i < treeLength; i++) {
node = treePath[i];
delta = node.projectionDelta;
/**
* TODO: Prefer to remove this, but currently we have motion components with
* display: contents in Framer.
*/
const instance = node.instance;
if (instance &&
instance.style &&
instance.style.display === "contents") {
continue;
}
if (isSharedTransition &&
node.options.layoutScroll &&
node.scroll &&
node !== node.root) {
transformBox(box, {
x: -node.scroll.offset.x,
y: -node.scroll.offset.y,
});
}
if (delta) {
// Incoporate each ancestor's scale into a culmulative treeScale for this component
treeScale.x *= delta.x.scale;
treeScale.y *= delta.y.scale;
// Apply each ancestor's calculated delta into this component's recorded layout box
applyBoxDelta(box, delta);
}
if (isSharedTransition && hasTransform(node.latestValues)) {
transformBox(box, node.latestValues);
}
}
/**
* Snap tree scale back to 1 if it's within a non-perceivable threshold.
* This will help reduce useless scales getting rendered.
*/
treeScale.x = snapToDefault(treeScale.x);
treeScale.y = snapToDefault(treeScale.y);
}
function snapToDefault(scale) {
if (Number.isInteger(scale))
return scale;
return scale > 1.0000000000001 || scale < 0.999999999999 ? scale : 1;
}
function translateAxis(axis, distance) {
axis.min = axis.min + distance;
axis.max = axis.max + distance;
}
/**
* Apply a transform to an axis from the latest resolved motion values.
* This function basically acts as a bridge between a flat motion value map
* and applyAxisDelta
*/
function transformAxis(axis, transforms, [key, scaleKey, originKey]) {
const axisOrigin = transforms[originKey] !== undefined ? transforms[originKey] : 0.5;
const originPoint = mix(axis.min, axis.max, axisOrigin);
// Apply the axis delta to the final axis
applyAxisDelta(axis, transforms[key], transforms[scaleKey], originPoint, transforms.scale);
}
/**
* The names of the motion values we want to apply as translation, scale and origin.
*/
const xKeys = ["x", "scaleX", "originX"];
const yKeys = ["y", "scaleY", "originY"];
/**
* Apply a transform to a box from the latest resolved motion values.
*/
function transformBox(box, transform) {
transformAxis(box.x, transform, xKeys);
transformAxis(box.y, transform, yKeys);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/utils/measure.mjs
function measureViewportBox(instance, transformPoint) {
return convertBoundingBoxToBox(transformBoxPoints(instance.getBoundingClientRect(), transformPoint));
}
function measurePageBox(element, rootProjectionNode, transformPagePoint) {
const viewportBox = measureViewportBox(element, transformPagePoint);
const { scroll } = rootProjectionNode;
if (scroll) {
translateAxis(viewportBox.x, scroll.offset.x);
translateAxis(viewportBox.y, scroll.offset.y);
}
return viewportBox;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs
const elementDragControls = new WeakMap();
/**
*
*/
// let latestPointerEvent: PointerEvent
class VisualElementDragControls {
constructor(visualElement) {
// This is a reference to the global drag gesture lock, ensuring only one component
// can "capture" the drag of one or both axes.
// TODO: Look into moving this into pansession?
this.openGlobalLock = null;
this.isDragging = false;
this.currentDirection = null;
this.originPoint = { x: 0, y: 0 };
/**
* The permitted boundaries of travel, in pixels.
*/
this.constraints = false;
this.hasMutatedConstraints = false;
/**
* The per-axis resolved elastic values.
*/
this.elastic = createBox();
this.visualElement = visualElement;
}
start(originEvent, { snapToCursor = false } = {}) {
/**
* Don't start dragging if this component is exiting
*/
const { presenceContext } = this.visualElement;
if (presenceContext && presenceContext.isPresent === false)
return;
const onSessionStart = (event) => {
// Stop any animations on both axis values immediately. This allows the user to throw and catch
// the component.
this.stopAnimation();
if (snapToCursor) {
this.snapToCursor(extractEventInfo(event, "page").point);
}
};
const onStart = (event, info) => {
// Attempt to grab the global drag gesture lock - maybe make this part of PanSession
const { drag, dragPropagation, onDragStart } = this.getProps();
if (drag && !dragPropagation) {
if (this.openGlobalLock)
this.openGlobalLock();
this.openGlobalLock = getGlobalLock(drag);
// If we don 't have the lock, don't start dragging
if (!this.openGlobalLock)
return;
}
this.isDragging = true;
this.currentDirection = null;
this.resolveConstraints();
if (this.visualElement.projection) {
this.visualElement.projection.isAnimationBlocked = true;
this.visualElement.projection.target = undefined;
}
/**
* Record gesture origin
*/
eachAxis((axis) => {
let current = this.getAxisMotionValue(axis).get() || 0;
/**
* If the MotionValue is a percentage value convert to px
*/
if (percent.test(current)) {
const { projection } = this.visualElement;
if (projection && projection.layout) {
const measuredAxis = projection.layout.layoutBox[axis];
if (measuredAxis) {
const length = calcLength(measuredAxis);
current = length * (parseFloat(current) / 100);
}
}
}
this.originPoint[axis] = current;
});
// Fire onDragStart event
if (onDragStart) {
frame_frame.update(() => onDragStart(event, info), false, true);
}
const { animationState } = this.visualElement;
animationState && animationState.setActive("whileDrag", true);
};
const onMove = (event, info) => {
// latestPointerEvent = event
const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();
// If we didn't successfully receive the gesture lock, early return.
if (!dragPropagation && !this.openGlobalLock)
return;
const { offset } = info;
// Attempt to detect drag direction if directionLock is true
if (dragDirectionLock && this.currentDirection === null) {
this.currentDirection = getCurrentDirection(offset);
// If we've successfully set a direction, notify listener
if (this.currentDirection !== null) {
onDirectionLock && onDirectionLock(this.currentDirection);
}
return;
}
// Update each point with the latest position
this.updateAxis("x", info.point, offset);
this.updateAxis("y", info.point, offset);
/**
* Ideally we would leave the renderer to fire naturally at the end of
* this frame but if the element is about to change layout as the result
* of a re-render we want to ensure the browser can read the latest
* bounding box to ensure the pointer and element don't fall out of sync.
*/
this.visualElement.render();
/**
* This must fire after the render call as it might trigger a state
* change which itself might trigger a layout update.
*/
onDrag && onDrag(event, info);
};
const onSessionEnd = (event, info) => this.stop(event, info);
this.panSession = new PanSession(originEvent, {
onSessionStart,
onStart,
onMove,
onSessionEnd,
}, { transformPagePoint: this.visualElement.getTransformPagePoint() });
}
stop(event, info) {
const isDragging = this.isDragging;
this.cancel();
if (!isDragging)
return;
const { velocity } = info;
this.startAnimation(velocity);
const { onDragEnd } = this.getProps();
if (onDragEnd) {
frame_frame.update(() => onDragEnd(event, info));
}
}
cancel() {
this.isDragging = false;
const { projection, animationState } = this.visualElement;
if (projection) {
projection.isAnimationBlocked = false;
}
this.panSession && this.panSession.end();
this.panSession = undefined;
const { dragPropagation } = this.getProps();
if (!dragPropagation && this.openGlobalLock) {
this.openGlobalLock();
this.openGlobalLock = null;
}
animationState && animationState.setActive("whileDrag", false);
}
updateAxis(axis, _point, offset) {
const { drag } = this.getProps();
// If we're not dragging this axis, do an early return.
if (!offset || !shouldDrag(axis, drag, this.currentDirection))
return;
const axisValue = this.getAxisMotionValue(axis);
let next = this.originPoint[axis] + offset[axis];
// Apply constraints
if (this.constraints && this.constraints[axis]) {
next = applyConstraints(next, this.constraints[axis], this.elastic[axis]);
}
axisValue.set(next);
}
resolveConstraints() {
const { dragConstraints, dragElastic } = this.getProps();
const { layout } = this.visualElement.projection || {};
const prevConstraints = this.constraints;
if (dragConstraints && isRefObject(dragConstraints)) {
if (!this.constraints) {
this.constraints = this.resolveRefConstraints();
}
}
else {
if (dragConstraints && layout) {
this.constraints = calcRelativeConstraints(layout.layoutBox, dragConstraints);
}
else {
this.constraints = false;
}
}
this.elastic = resolveDragElastic(dragElastic);
/**
* If we're outputting to external MotionValues, we want to rebase the measured constraints
* from viewport-relative to component-relative.
*/
if (prevConstraints !== this.constraints &&
layout &&
this.constraints &&
!this.hasMutatedConstraints) {
eachAxis((axis) => {
if (this.getAxisMotionValue(axis)) {
this.constraints[axis] = rebaseAxisConstraints(layout.layoutBox[axis], this.constraints[axis]);
}
});
}
}
resolveRefConstraints() {
const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps();
if (!constraints || !isRefObject(constraints))
return false;
const constraintsElement = constraints.current;
errors_invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");
const { projection } = this.visualElement;
// TODO
if (!projection || !projection.layout)
return false;
const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());
let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox);
/**
* If there's an onMeasureDragConstraints listener we call it and
* if different constraints are returned, set constraints to that
*/
if (onMeasureDragConstraints) {
const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));
this.hasMutatedConstraints = !!userConstraints;
if (userConstraints) {
measuredConstraints = convertBoundingBoxToBox(userConstraints);
}
}
return measuredConstraints;
}
startAnimation(velocity) {
const { drag, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd, } = this.getProps();
const constraints = this.constraints || {};
const momentumAnimations = eachAxis((axis) => {
if (!shouldDrag(axis, drag, this.currentDirection)) {
return;
}
let transition = (constraints && constraints[axis]) || {};
if (dragSnapToOrigin)
transition = { min: 0, max: 0 };
/**
* Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame
* of spring animations so we should look into adding a disable spring option to `inertia`.
* We could do something here where we affect the `bounceStiffness` and `bounceDamping`
* using the value of `dragElastic`.
*/
const bounceStiffness = dragElastic ? 200 : 1000000;
const bounceDamping = dragElastic ? 40 : 10000000;
const inertia = {
type: "inertia",
velocity: dragMomentum ? velocity[axis] : 0,
bounceStiffness,
bounceDamping,
timeConstant: 750,
restDelta: 1,
restSpeed: 10,
...dragTransition,
...transition,
};
// If we're not animating on an externally-provided `MotionValue` we can use the
// component's animation controls which will handle interactions with whileHover (etc),
// otherwise we just have to animate the `MotionValue` itself.
return this.startAxisValueAnimation(axis, inertia);
});
// Run all animations and then resolve the new drag constraints.
return Promise.all(momentumAnimations).then(onDragTransitionEnd);
}
startAxisValueAnimation(axis, transition) {
const axisValue = this.getAxisMotionValue(axis);
return axisValue.start(animateMotionValue(axis, axisValue, 0, transition));
}
stopAnimation() {
eachAxis((axis) => this.getAxisMotionValue(axis).stop());
}
/**
* Drag works differently depending on which props are provided.
*
* - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
* - Otherwise, we apply the delta to the x/y motion values.
*/
getAxisMotionValue(axis) {
const dragKey = "_drag" + axis.toUpperCase();
const props = this.visualElement.getProps();
const externalMotionValue = props[dragKey];
return externalMotionValue
? externalMotionValue
: this.visualElement.getValue(axis, (props.initial ? props.initial[axis] : undefined) || 0);
}
snapToCursor(point) {
eachAxis((axis) => {
const { drag } = this.getProps();
// If we're not dragging this axis, do an early return.
if (!shouldDrag(axis, drag, this.currentDirection))
return;
const { projection } = this.visualElement;
const axisValue = this.getAxisMotionValue(axis);
if (projection && projection.layout) {
const { min, max } = projection.layout.layoutBox[axis];
axisValue.set(point[axis] - mix(min, max, 0.5));
}
});
}
/**
* When the viewport resizes we want to check if the measured constraints
* have changed and, if so, reposition the element within those new constraints
* relative to where it was before the resize.
*/
scalePositionWithinConstraints() {
if (!this.visualElement.current)
return;
const { drag, dragConstraints } = this.getProps();
const { projection } = this.visualElement;
if (!isRefObject(dragConstraints) || !projection || !this.constraints)
return;
/**
* Stop current animations as there can be visual glitching if we try to do
* this mid-animation
*/
this.stopAnimation();
/**
* Record the relative position of the dragged element relative to the
* constraints box and save as a progress value.
*/
const boxProgress = { x: 0, y: 0 };
eachAxis((axis) => {
const axisValue = this.getAxisMotionValue(axis);
if (axisValue) {
const latest = axisValue.get();
boxProgress[axis] = constraints_calcOrigin({ min: latest, max: latest }, this.constraints[axis]);
}
});
/**
* Update the layout of this element and resolve the latest drag constraints
*/
const { transformTemplate } = this.visualElement.getProps();
this.visualElement.current.style.transform = transformTemplate
? transformTemplate({}, "")
: "none";
projection.root && projection.root.updateScroll();
projection.updateLayout();
this.resolveConstraints();
/**
* For each axis, calculate the current progress of the layout axis
* within the new constraints.
*/
eachAxis((axis) => {
if (!shouldDrag(axis, drag, null))
return;
/**
* Calculate a new transform based on the previous box progress
*/
const axisValue = this.getAxisMotionValue(axis);
const { min, max } = this.constraints[axis];
axisValue.set(mix(min, max, boxProgress[axis]));
});
}
addListeners() {
if (!this.visualElement.current)
return;
elementDragControls.set(this.visualElement, this);
const element = this.visualElement.current;
/**
* Attach a pointerdown event listener on this DOM element to initiate drag tracking.
*/
const stopPointerListener = addPointerEvent(element, "pointerdown", (event) => {
const { drag, dragListener = true } = this.getProps();
drag && dragListener && this.start(event);
});
const measureDragConstraints = () => {
const { dragConstraints } = this.getProps();
if (isRefObject(dragConstraints)) {
this.constraints = this.resolveRefConstraints();
}
};
const { projection } = this.visualElement;
const stopMeasureLayoutListener = projection.addEventListener("measure", measureDragConstraints);
if (projection && !projection.layout) {
projection.root && projection.root.updateScroll();
projection.updateLayout();
}
measureDragConstraints();
/**
* Attach a window resize listener to scale the draggable target within its defined
* constraints as the window resizes.
*/
const stopResizeListener = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints());
/**
* If the element's layout changes, calculate the delta and apply that to
* the drag gesture's origin point.
*/
const stopLayoutUpdateListener = projection.addEventListener("didUpdate", (({ delta, hasLayoutChanged }) => {
if (this.isDragging && hasLayoutChanged) {
eachAxis((axis) => {
const motionValue = this.getAxisMotionValue(axis);
if (!motionValue)
return;
this.originPoint[axis] += delta[axis].translate;
motionValue.set(motionValue.get() + delta[axis].translate);
});
this.visualElement.render();
}
}));
return () => {
stopResizeListener();
stopPointerListener();
stopMeasureLayoutListener();
stopLayoutUpdateListener && stopLayoutUpdateListener();
};
}
getProps() {
const props = this.visualElement.getProps();
const { drag = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true, } = props;
return {
...props,
drag,
dragDirectionLock,
dragPropagation,
dragConstraints,
dragElastic,
dragMomentum,
};
}
}
function shouldDrag(direction, drag, currentDirection) {
return ((drag === true || drag === direction) &&
(currentDirection === null || currentDirection === direction));
}
/**
* Based on an x/y offset determine the current drag direction. If both axis' offsets are lower
* than the provided threshold, return `null`.
*
* @param offset - The x/y offset from origin.
* @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.
*/
function getCurrentDirection(offset, lockThreshold = 10) {
let direction = null;
if (Math.abs(offset.y) > lockThreshold) {
direction = "y";
}
else if (Math.abs(offset.x) > lockThreshold) {
direction = "x";
}
return direction;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/index.mjs
class DragGesture extends Feature {
constructor(node) {
super(node);
this.removeGroupControls = noop_noop;
this.removeListeners = noop_noop;
this.controls = new VisualElementDragControls(node);
}
mount() {
// If we've been provided a DragControls for manual control over the drag gesture,
// subscribe this component to it on mount.
const { dragControls } = this.node.getProps();
if (dragControls) {
this.removeGroupControls = dragControls.subscribe(this.controls);
}
this.removeListeners = this.controls.addListeners() || noop_noop;
}
unmount() {
this.removeGroupControls();
this.removeListeners();
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/pan/index.mjs
const asyncHandler = (handler) => (event, info) => {
if (handler) {
frame_frame.update(() => handler(event, info));
}
};
class PanGesture extends Feature {
constructor() {
super(...arguments);
this.removePointerDownListener = noop_noop;
}
onPointerDown(pointerDownEvent) {
this.session = new PanSession(pointerDownEvent, this.createPanHandlers(), { transformPagePoint: this.node.getTransformPagePoint() });
}
createPanHandlers() {
const { onPanSessionStart, onPanStart, onPan, onPanEnd } = this.node.getProps();
return {
onSessionStart: asyncHandler(onPanSessionStart),
onStart: asyncHandler(onPanStart),
onMove: onPan,
onEnd: (event, info) => {
delete this.session;
if (onPanEnd) {
frame_frame.update(() => onPanEnd(event, info));
}
},
};
}
mount() {
this.removePointerDownListener = addPointerEvent(this.node.current, "pointerdown", (event) => this.onPointerDown(event));
}
update() {
this.session && this.session.updateHandlers(this.createPanHandlers());
}
unmount() {
this.removePointerDownListener();
this.session && this.session.end();
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs
/**
* When a component is the child of `AnimatePresence`, it can use `usePresence`
* to access information about whether it's still present in the React tree.
*
* ```jsx
* import { usePresence } from "framer-motion"
*
* export const Component = () => {
* const [isPresent, safeToRemove] = usePresence()
*
* useEffect(() => {
* !isPresent && setTimeout(safeToRemove, 1000)
* }, [isPresent])
*
* return <div />
* }
* ```
*
* If `isPresent` is `false`, it means that a component has been removed the tree, but
* `AnimatePresence` won't really remove it until `safeToRemove` has been called.
*
* @public
*/
function usePresence() {
const context = (0,external_React_.useContext)(PresenceContext_PresenceContext);
if (context === null)
return [true, null];
const { isPresent, onExitComplete, register } = context;
// It's safe to call the following hooks conditionally (after an early return) because the context will always
// either be null or non-null for the lifespan of the component.
const id = (0,external_React_.useId)();
(0,external_React_.useEffect)(() => register(id), []);
const safeToRemove = () => onExitComplete && onExitComplete(id);
return !isPresent && onExitComplete ? [false, safeToRemove] : [true];
}
/**
* Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.
* There is no `safeToRemove` function.
*
* ```jsx
* import { useIsPresent } from "framer-motion"
*
* export const Component = () => {
* const isPresent = useIsPresent()
*
* useEffect(() => {
* !isPresent && console.log("I've been removed!")
* }, [isPresent])
*
* return <div />
* }
* ```
*
* @public
*/
function useIsPresent() {
return isPresent(useContext(PresenceContext));
}
function isPresent(context) {
return context === null ? true : context.isPresent;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/state.mjs
/**
* This should only ever be modified on the client otherwise it'll
* persist through server requests. If we need instanced states we
* could lazy-init via root.
*/
const globalProjectionState = {
/**
* Global flag as to whether the tree has animated since the last time
* we resized the window
*/
hasAnimatedSinceResize: true,
/**
* We set this to true once, on the first update. Any nodes added to the tree beyond that
* update will be given a `data-projection-id` attribute.
*/
hasEverUpdated: false,
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/styles/scale-border-radius.mjs
function pixelsToPercent(pixels, axis) {
if (axis.max === axis.min)
return 0;
return (pixels / (axis.max - axis.min)) * 100;
}
/**
* We always correct borderRadius as a percentage rather than pixels to reduce paints.
* For example, if you are projecting a box that is 100px wide with a 10px borderRadius
* into a box that is 200px wide with a 20px borderRadius, that is actually a 10%
* borderRadius in both states. If we animate between the two in pixels that will trigger
* a paint each time. If we animate between the two in percentage we'll avoid a paint.
*/
const correctBorderRadius = {
correct: (latest, node) => {
if (!node.target)
return latest;
/**
* If latest is a string, if it's a percentage we can return immediately as it's
* going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number.
*/
if (typeof latest === "string") {
if (px.test(latest)) {
latest = parseFloat(latest);
}
else {
return latest;
}
}
/**
* If latest is a number, it's a pixel value. We use the current viewportBox to calculate that
* pixel value as a percentage of each axis
*/
const x = pixelsToPercent(latest, node.target.x);
const y = pixelsToPercent(latest, node.target.y);
return `${x}% ${y}%`;
},
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs
const correctBoxShadow = {
correct: (latest, { treeScale, projectionDelta }) => {
const original = latest;
const shadow = complex.parse(latest);
// TODO: Doesn't support multiple shadows
if (shadow.length > 5)
return original;
const template = complex.createTransformer(latest);
const offset = typeof shadow[0] !== "number" ? 1 : 0;
// Calculate the overall context scale
const xScale = projectionDelta.x.scale * treeScale.x;
const yScale = projectionDelta.y.scale * treeScale.y;
shadow[0 + offset] /= xScale;
shadow[1 + offset] /= yScale;
/**
* Ideally we'd correct x and y scales individually, but because blur and
* spread apply to both we have to take a scale average and apply that instead.
* We could potentially improve the outcome of this by incorporating the ratio between
* the two scales.
*/
const averageScale = mix(xScale, yScale, 0.5);
// Blur
if (typeof shadow[2 + offset] === "number")
shadow[2 + offset] /= averageScale;
// Spread
if (typeof shadow[3 + offset] === "number")
shadow[3 + offset] /= averageScale;
return template(shadow);
},
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs
class MeasureLayoutWithContext extends external_React_.Component {
/**
* This only mounts projection nodes for components that
* need measuring, we might want to do it for all components
* in order to incorporate transforms
*/
componentDidMount() {
const { visualElement, layoutGroup, switchLayoutGroup, layoutId } = this.props;
const { projection } = visualElement;
addScaleCorrector(defaultScaleCorrectors);
if (projection) {
if (layoutGroup.group)
layoutGroup.group.add(projection);
if (switchLayoutGroup && switchLayoutGroup.register && layoutId) {
switchLayoutGroup.register(projection);
}
projection.root.didUpdate();
projection.addEventListener("animationComplete", () => {
this.safeToRemove();
});
projection.setOptions({
...projection.options,
onExitComplete: () => this.safeToRemove(),
});
}
globalProjectionState.hasEverUpdated = true;
}
getSnapshotBeforeUpdate(prevProps) {
const { layoutDependency, visualElement, drag, isPresent } = this.props;
const projection = visualElement.projection;
if (!projection)
return null;
/**
* TODO: We use this data in relegate to determine whether to
* promote a previous element. There's no guarantee its presence data
* will have updated by this point - if a bug like this arises it will
* have to be that we markForRelegation and then find a new lead some other way,
* perhaps in didUpdate
*/
projection.isPresent = isPresent;
if (drag ||
prevProps.layoutDependency !== layoutDependency ||
layoutDependency === undefined) {
projection.willUpdate();
}
else {
this.safeToRemove();
}
if (prevProps.isPresent !== isPresent) {
if (isPresent) {
projection.promote();
}
else if (!projection.relegate()) {
/**
* If there's another stack member taking over from this one,
* it's in charge of the exit animation and therefore should
* be in charge of the safe to remove. Otherwise we call it here.
*/
frame_frame.postRender(() => {
const stack = projection.getStack();
if (!stack || !stack.members.length) {
this.safeToRemove();
}
});
}
}
return null;
}
componentDidUpdate() {
const { projection } = this.props.visualElement;
if (projection) {
projection.root.didUpdate();
queueMicrotask(() => {
if (!projection.currentAnimation && projection.isLead()) {
this.safeToRemove();
}
});
}
}
componentWillUnmount() {
const { visualElement, layoutGroup, switchLayoutGroup: promoteContext, } = this.props;
const { projection } = visualElement;
if (projection) {
projection.scheduleCheckAfterUnmount();
if (layoutGroup && layoutGroup.group)
layoutGroup.group.remove(projection);
if (promoteContext && promoteContext.deregister)
promoteContext.deregister(projection);
}
}
safeToRemove() {
const { safeToRemove } = this.props;
safeToRemove && safeToRemove();
}
render() {
return null;
}
}
function MeasureLayout(props) {
const [isPresent, safeToRemove] = usePresence();
const layoutGroup = (0,external_React_.useContext)(LayoutGroupContext);
return (external_React_.createElement(MeasureLayoutWithContext, { ...props, layoutGroup: layoutGroup, switchLayoutGroup: (0,external_React_.useContext)(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove }));
}
const defaultScaleCorrectors = {
borderRadius: {
...correctBorderRadius,
applyTo: [
"borderTopLeftRadius",
"borderTopRightRadius",
"borderBottomLeftRadius",
"borderBottomRightRadius",
],
},
borderTopLeftRadius: correctBorderRadius,
borderTopRightRadius: correctBorderRadius,
borderBottomLeftRadius: correctBorderRadius,
borderBottomRightRadius: correctBorderRadius,
boxShadow: correctBoxShadow,
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/animation/mix-values.mjs
const borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"];
const numBorders = borders.length;
const asNumber = (value) => typeof value === "string" ? parseFloat(value) : value;
const isPx = (value) => typeof value === "number" || px.test(value);
function mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) {
if (shouldCrossfadeOpacity) {
target.opacity = mix(0,
// TODO Reinstate this if only child
lead.opacity !== undefined ? lead.opacity : 1, easeCrossfadeIn(progress));
target.opacityExit = mix(follow.opacity !== undefined ? follow.opacity : 1, 0, easeCrossfadeOut(progress));
}
else if (isOnlyMember) {
target.opacity = mix(follow.opacity !== undefined ? follow.opacity : 1, lead.opacity !== undefined ? lead.opacity : 1, progress);
}
/**
* Mix border radius
*/
for (let i = 0; i < numBorders; i++) {
const borderLabel = `border${borders[i]}Radius`;
let followRadius = getRadius(follow, borderLabel);
let leadRadius = getRadius(lead, borderLabel);
if (followRadius === undefined && leadRadius === undefined)
continue;
followRadius || (followRadius = 0);
leadRadius || (leadRadius = 0);
const canMix = followRadius === 0 ||
leadRadius === 0 ||
isPx(followRadius) === isPx(leadRadius);
if (canMix) {
target[borderLabel] = Math.max(mix(asNumber(followRadius), asNumber(leadRadius), progress), 0);
if (percent.test(leadRadius) || percent.test(followRadius)) {
target[borderLabel] += "%";
}
}
else {
target[borderLabel] = leadRadius;
}
}
/**
* Mix rotation
*/
if (follow.rotate || lead.rotate) {
target.rotate = mix(follow.rotate || 0, lead.rotate || 0, progress);
}
}
function getRadius(values, radiusName) {
return values[radiusName] !== undefined
? values[radiusName]
: values.borderRadius;
}
// /**
// * We only want to mix the background color if there's a follow element
// * that we're not crossfading opacity between. For instance with switch
// * AnimateSharedLayout animations, this helps the illusion of a continuous
// * element being animated but also cuts down on the number of paints triggered
// * for elements where opacity is doing that work for us.
// */
// if (
// !hasFollowElement &&
// latestLeadValues.backgroundColor &&
// latestFollowValues.backgroundColor
// ) {
// /**
// * This isn't ideal performance-wise as mixColor is creating a new function every frame.
// * We could probably create a mixer that runs at the start of the animation but
// * the idea behind the crossfader is that it runs dynamically between two potentially
// * changing targets (ie opacity or borderRadius may be animating independently via variants)
// */
// leadState.backgroundColor = followState.backgroundColor = mixColor(
// latestFollowValues.backgroundColor as string,
// latestLeadValues.backgroundColor as string
// )(p)
// }
const easeCrossfadeIn = compress(0, 0.5, circOut);
const easeCrossfadeOut = compress(0.5, 0.95, noop_noop);
function compress(min, max, easing) {
return (p) => {
// Could replace ifs with clamp
if (p < min)
return 0;
if (p > max)
return 1;
return easing(progress(min, max, p));
};
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/copy.mjs
/**
* Reset an axis to the provided origin box.
*
* This is a mutative operation.
*/
function copyAxisInto(axis, originAxis) {
axis.min = originAxis.min;
axis.max = originAxis.max;
}
/**
* Reset a box to the provided origin box.
*
* This is a mutative operation.
*/
function copyBoxInto(box, originBox) {
copyAxisInto(box.x, originBox.x);
copyAxisInto(box.y, originBox.y);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/delta-remove.mjs
/**
* Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse
*/
function removePointDelta(point, translate, scale, originPoint, boxScale) {
point -= translate;
point = scalePoint(point, 1 / scale, originPoint);
if (boxScale !== undefined) {
point = scalePoint(point, 1 / boxScale, originPoint);
}
return point;
}
/**
* Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse
*/
function removeAxisDelta(axis, translate = 0, scale = 1, origin = 0.5, boxScale, originAxis = axis, sourceAxis = axis) {
if (percent.test(translate)) {
translate = parseFloat(translate);
const relativeProgress = mix(sourceAxis.min, sourceAxis.max, translate / 100);
translate = relativeProgress - sourceAxis.min;
}
if (typeof translate !== "number")
return;
let originPoint = mix(originAxis.min, originAxis.max, origin);
if (axis === originAxis)
originPoint -= translate;
axis.min = removePointDelta(axis.min, translate, scale, originPoint, boxScale);
axis.max = removePointDelta(axis.max, translate, scale, originPoint, boxScale);
}
/**
* Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse
* and acts as a bridge between motion values and removeAxisDelta
*/
function removeAxisTransforms(axis, transforms, [key, scaleKey, originKey], origin, sourceAxis) {
removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale, origin, sourceAxis);
}
/**
* The names of the motion values we want to apply as translation, scale and origin.
*/
const delta_remove_xKeys = ["x", "scaleX", "originX"];
const delta_remove_yKeys = ["y", "scaleY", "originY"];
/**
* Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse
* and acts as a bridge between motion values and removeAxisDelta
*/
function removeBoxTransforms(box, transforms, originBox, sourceBox) {
removeAxisTransforms(box.x, transforms, delta_remove_xKeys, originBox ? originBox.x : undefined, sourceBox ? sourceBox.x : undefined);
removeAxisTransforms(box.y, transforms, delta_remove_yKeys, originBox ? originBox.y : undefined, sourceBox ? sourceBox.y : undefined);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/utils.mjs
function isAxisDeltaZero(delta) {
return delta.translate === 0 && delta.scale === 1;
}
function isDeltaZero(delta) {
return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);
}
function boxEquals(a, b) {
return (a.x.min === b.x.min &&
a.x.max === b.x.max &&
a.y.min === b.y.min &&
a.y.max === b.y.max);
}
function boxEqualsRounded(a, b) {
return (Math.round(a.x.min) === Math.round(b.x.min) &&
Math.round(a.x.max) === Math.round(b.x.max) &&
Math.round(a.y.min) === Math.round(b.y.min) &&
Math.round(a.y.max) === Math.round(b.y.max));
}
function aspectRatio(box) {
return calcLength(box.x) / calcLength(box.y);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/shared/stack.mjs
class NodeStack {
constructor() {
this.members = [];
}
add(node) {
addUniqueItem(this.members, node);
node.scheduleRender();
}
remove(node) {
removeItem(this.members, node);
if (node === this.prevLead) {
this.prevLead = undefined;
}
if (node === this.lead) {
const prevLead = this.members[this.members.length - 1];
if (prevLead) {
this.promote(prevLead);
}
}
}
relegate(node) {
const indexOfNode = this.members.findIndex((member) => node === member);
if (indexOfNode === 0)
return false;
/**
* Find the next projection node that is present
*/
let prevLead;
for (let i = indexOfNode; i >= 0; i--) {
const member = this.members[i];
if (member.isPresent !== false) {
prevLead = member;
break;
}
}
if (prevLead) {
this.promote(prevLead);
return true;
}
else {
return false;
}
}
promote(node, preserveFollowOpacity) {
const prevLead = this.lead;
if (node === prevLead)
return;
this.prevLead = prevLead;
this.lead = node;
node.show();
if (prevLead) {
prevLead.instance && prevLead.scheduleRender();
node.scheduleRender();
node.resumeFrom = prevLead;
if (preserveFollowOpacity) {
node.resumeFrom.preserveOpacity = true;
}
if (prevLead.snapshot) {
node.snapshot = prevLead.snapshot;
node.snapshot.latestValues =
prevLead.animationValues || prevLead.latestValues;
}
if (node.root && node.root.isUpdating) {
node.isLayoutDirty = true;
}
const { crossfade } = node.options;
if (crossfade === false) {
prevLead.hide();
}
/**
* TODO:
* - Test border radius when previous node was deleted
* - boxShadow mixing
* - Shared between element A in scrolled container and element B (scroll stays the same or changes)
* - Shared between element A in transformed container and element B (transform stays the same or changes)
* - Shared between element A in scrolled page and element B (scroll stays the same or changes)
* ---
* - Crossfade opacity of root nodes
* - layoutId changes after animation
* - layoutId changes mid animation
*/
}
}
exitAnimationComplete() {
this.members.forEach((node) => {
const { options, resumingFrom } = node;
options.onExitComplete && options.onExitComplete();
if (resumingFrom) {
resumingFrom.options.onExitComplete &&
resumingFrom.options.onExitComplete();
}
});
}
scheduleRender() {
this.members.forEach((node) => {
node.instance && node.scheduleRender(false);
});
}
/**
* Clear any leads that have been removed this render to prevent them from being
* used in future animations and to prevent memory leaks
*/
removeLeadSnapshot() {
if (this.lead && this.lead.snapshot) {
this.lead.snapshot = undefined;
}
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/styles/transform.mjs
function buildProjectionTransform(delta, treeScale, latestTransform) {
let transform = "";
/**
* The translations we use to calculate are always relative to the viewport coordinate space.
* But when we apply scales, we also scale the coordinate space of an element and its children.
* For instance if we have a treeScale (the culmination of all parent scales) of 0.5 and we need
* to move an element 100 pixels, we actually need to move it 200 in within that scaled space.
*/
const xTranslate = delta.x.translate / treeScale.x;
const yTranslate = delta.y.translate / treeScale.y;
if (xTranslate || yTranslate) {
transform = `translate3d(${xTranslate}px, ${yTranslate}px, 0) `;
}
/**
* Apply scale correction for the tree transform.
* This will apply scale to the screen-orientated axes.
*/
if (treeScale.x !== 1 || treeScale.y !== 1) {
transform += `scale(${1 / treeScale.x}, ${1 / treeScale.y}) `;
}
if (latestTransform) {
const { rotate, rotateX, rotateY } = latestTransform;
if (rotate)
transform += `rotate(${rotate}deg) `;
if (rotateX)
transform += `rotateX(${rotateX}deg) `;
if (rotateY)
transform += `rotateY(${rotateY}deg) `;
}
/**
* Apply scale to match the size of the element to the size we want it.
* This will apply scale to the element-orientated axes.
*/
const elementScaleX = delta.x.scale * treeScale.x;
const elementScaleY = delta.y.scale * treeScale.y;
if (elementScaleX !== 1 || elementScaleY !== 1) {
transform += `scale(${elementScaleX}, ${elementScaleY})`;
}
return transform || "none";
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/compare-by-depth.mjs
const compareByDepth = (a, b) => a.depth - b.depth;
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/flat-tree.mjs
class FlatTree {
constructor() {
this.children = [];
this.isDirty = false;
}
add(child) {
addUniqueItem(this.children, child);
this.isDirty = true;
}
remove(child) {
removeItem(this.children, child);
this.isDirty = true;
}
forEach(callback) {
this.isDirty && this.children.sort(compareByDepth);
this.isDirty = false;
this.children.forEach(callback);
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/delay.mjs
/**
* Timeout defined in ms
*/
function delay(callback, timeout) {
const start = performance.now();
const checkElapsed = ({ timestamp }) => {
const elapsed = timestamp - start;
if (elapsed >= timeout) {
cancelFrame(checkElapsed);
callback(elapsed - timeout);
}
};
frame_frame.read(checkElapsed, true);
return () => cancelFrame(checkElapsed);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/debug/record.mjs
function record(data) {
if (window.MotionDebug) {
window.MotionDebug.record(data);
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/is-svg-element.mjs
function isSVGElement(element) {
return element instanceof SVGElement && element.tagName !== "svg";
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/interfaces/single-value.mjs
function animateSingleValue(value, keyframes, options) {
const motionValue$1 = isMotionValue(value) ? value : motionValue(value);
motionValue$1.start(animateMotionValue("", motionValue$1, keyframes, options));
return motionValue$1.animation;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/create-projection-node.mjs
const transformAxes = ["", "X", "Y", "Z"];
/**
* We use 1000 as the animation target as 0-1000 maps better to pixels than 0-1
* which has a noticeable difference in spring animations
*/
const animationTarget = 1000;
let create_projection_node_id = 0;
/**
* Use a mutable data object for debug data so as to not create a new
* object every frame.
*/
const projectionFrameData = {
type: "projectionFrame",
totalNodes: 0,
resolvedTargetDeltas: 0,
recalculatedProjection: 0,
};
function createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform, }) {
return class ProjectionNode {
constructor(latestValues = {}, parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent()) {
/**
* A unique ID generated for every projection node.
*/
this.id = create_projection_node_id++;
/**
* An id that represents a unique session instigated by startUpdate.
*/
this.animationId = 0;
/**
* A Set containing all this component's children. This is used to iterate
* through the children.
*
* TODO: This could be faster to iterate as a flat array stored on the root node.
*/
this.children = new Set();
/**
* Options for the node. We use this to configure what kind of layout animations
* we should perform (if any).
*/
this.options = {};
/**
* We use this to detect when its safe to shut down part of a projection tree.
* We have to keep projecting children for scale correction and relative projection
* until all their parents stop performing layout animations.
*/
this.isTreeAnimating = false;
this.isAnimationBlocked = false;
/**
* Flag to true if we think this layout has been changed. We can't always know this,
* currently we set it to true every time a component renders, or if it has a layoutDependency
* if that has changed between renders. Additionally, components can be grouped by LayoutGroup
* and if one node is dirtied, they all are.
*/
this.isLayoutDirty = false;
/**
* Flag to true if we think the projection calculations for this node needs
* recalculating as a result of an updated transform or layout animation.
*/
this.isProjectionDirty = false;
/**
* Flag to true if the layout *or* transform has changed. This then gets propagated
* throughout the projection tree, forcing any element below to recalculate on the next frame.
*/
this.isSharedProjectionDirty = false;
/**
* Flag transform dirty. This gets propagated throughout the whole tree but is only
* respected by shared nodes.
*/
this.isTransformDirty = false;
/**
* Block layout updates for instant layout transitions throughout the tree.
*/
this.updateManuallyBlocked = false;
this.updateBlockedByResize = false;
/**
* Set to true between the start of the first `willUpdate` call and the end of the `didUpdate`
* call.
*/
this.isUpdating = false;
/**
* If this is an SVG element we currently disable projection transforms
*/
this.isSVG = false;
/**
* Flag to true (during promotion) if a node doing an instant layout transition needs to reset
* its projection styles.
*/
this.needsReset = false;
/**
* Flags whether this node should have its transform reset prior to measuring.
*/
this.shouldResetTransform = false;
/**
* An object representing the calculated contextual/accumulated/tree scale.
* This will be used to scale calculcated projection transforms, as these are
* calculated in screen-space but need to be scaled for elements to layoutly
* make it to their calculated destinations.
*
* TODO: Lazy-init
*/
this.treeScale = { x: 1, y: 1 };
/**
*
*/
this.eventHandlers = new Map();
this.hasTreeAnimated = false;
// Note: Currently only running on root node
this.updateScheduled = false;
this.checkUpdateFailed = () => {
if (this.isUpdating) {
this.isUpdating = false;
this.clearAllSnapshots();
}
};
/**
* This is a multi-step process as shared nodes might be of different depths. Nodes
* are sorted by depth order, so we need to resolve the entire tree before moving to
* the next step.
*/
this.updateProjection = () => {
/**
* Reset debug counts. Manually resetting rather than creating a new
* object each frame.
*/
projectionFrameData.totalNodes =
projectionFrameData.resolvedTargetDeltas =
projectionFrameData.recalculatedProjection =
0;
this.nodes.forEach(propagateDirtyNodes);
this.nodes.forEach(resolveTargetDelta);
this.nodes.forEach(calcProjection);
this.nodes.forEach(cleanDirtyNodes);
record(projectionFrameData);
};
this.hasProjected = false;
this.isVisible = true;
this.animationProgress = 0;
/**
* Shared layout
*/
// TODO Only running on root node
this.sharedNodes = new Map();
this.latestValues = latestValues;
this.root = parent ? parent.root || parent : this;
this.path = parent ? [...parent.path, parent] : [];
this.parent = parent;
this.depth = parent ? parent.depth + 1 : 0;
for (let i = 0; i < this.path.length; i++) {
this.path[i].shouldResetTransform = true;
}
if (this.root === this)
this.nodes = new FlatTree();
}
addEventListener(name, handler) {
if (!this.eventHandlers.has(name)) {
this.eventHandlers.set(name, new SubscriptionManager());
}
return this.eventHandlers.get(name).add(handler);
}
notifyListeners(name, ...args) {
const subscriptionManager = this.eventHandlers.get(name);
subscriptionManager && subscriptionManager.notify(...args);
}
hasListeners(name) {
return this.eventHandlers.has(name);
}
/**
* Lifecycles
*/
mount(instance, isLayoutDirty = this.root.hasTreeAnimated) {
if (this.instance)
return;
this.isSVG = isSVGElement(instance);
this.instance = instance;
const { layoutId, layout, visualElement } = this.options;
if (visualElement && !visualElement.current) {
visualElement.mount(instance);
}
this.root.nodes.add(this);
this.parent && this.parent.children.add(this);
if (isLayoutDirty && (layout || layoutId)) {
this.isLayoutDirty = true;
}
if (attachResizeListener) {
let cancelDelay;
const resizeUnblockUpdate = () => (this.root.updateBlockedByResize = false);
attachResizeListener(instance, () => {
this.root.updateBlockedByResize = true;
cancelDelay && cancelDelay();
cancelDelay = delay(resizeUnblockUpdate, 250);
if (globalProjectionState.hasAnimatedSinceResize) {
globalProjectionState.hasAnimatedSinceResize = false;
this.nodes.forEach(finishAnimation);
}
});
}
if (layoutId) {
this.root.registerSharedNode(layoutId, this);
}
// Only register the handler if it requires layout animation
if (this.options.animate !== false &&
visualElement &&
(layoutId || layout)) {
this.addEventListener("didUpdate", ({ delta, hasLayoutChanged, hasRelativeTargetChanged, layout: newLayout, }) => {
if (this.isTreeAnimationBlocked()) {
this.target = undefined;
this.relativeTarget = undefined;
return;
}
// TODO: Check here if an animation exists
const layoutTransition = this.options.transition ||
visualElement.getDefaultTransition() ||
defaultLayoutTransition;
const { onLayoutAnimationStart, onLayoutAnimationComplete, } = visualElement.getProps();
/**
* The target layout of the element might stay the same,
* but its position relative to its parent has changed.
*/
const targetChanged = !this.targetLayout ||
!boxEqualsRounded(this.targetLayout, newLayout) ||
hasRelativeTargetChanged;
/**
* If the layout hasn't seemed to have changed, it might be that the
* element is visually in the same place in the document but its position
* relative to its parent has indeed changed. So here we check for that.
*/
const hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeTargetChanged;
if (this.options.layoutRoot ||
(this.resumeFrom && this.resumeFrom.instance) ||
hasOnlyRelativeTargetChanged ||
(hasLayoutChanged &&
(targetChanged || !this.currentAnimation))) {
if (this.resumeFrom) {
this.resumingFrom = this.resumeFrom;
this.resumingFrom.resumingFrom = undefined;
}
this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
const animationOptions = {
...getValueTransition(layoutTransition, "layout"),
onPlay: onLayoutAnimationStart,
onComplete: onLayoutAnimationComplete,
};
if (visualElement.shouldReduceMotion ||
this.options.layoutRoot) {
animationOptions.delay = 0;
animationOptions.type = false;
}
this.startAnimation(animationOptions);
}
else {
/**
* If the layout hasn't changed and we have an animation that hasn't started yet,
* finish it immediately. Otherwise it will be animating from a location
* that was probably never commited to screen and look like a jumpy box.
*/
if (!hasLayoutChanged) {
finishAnimation(this);
}
if (this.isLead() && this.options.onExitComplete) {
this.options.onExitComplete();
}
}
this.targetLayout = newLayout;
});
}
}
unmount() {
this.options.layoutId && this.willUpdate();
this.root.nodes.remove(this);
const stack = this.getStack();
stack && stack.remove(this);
this.parent && this.parent.children.delete(this);
this.instance = undefined;
cancelFrame(this.updateProjection);
}
// only on the root
blockUpdate() {
this.updateManuallyBlocked = true;
}
unblockUpdate() {
this.updateManuallyBlocked = false;
}
isUpdateBlocked() {
return this.updateManuallyBlocked || this.updateBlockedByResize;
}
isTreeAnimationBlocked() {
return (this.isAnimationBlocked ||
(this.parent && this.parent.isTreeAnimationBlocked()) ||
false);
}
// Note: currently only running on root node
startUpdate() {
if (this.isUpdateBlocked())
return;
this.isUpdating = true;
this.nodes && this.nodes.forEach(resetRotation);
this.animationId++;
}
getTransformTemplate() {
const { visualElement } = this.options;
return visualElement && visualElement.getProps().transformTemplate;
}
willUpdate(shouldNotifyListeners = true) {
this.root.hasTreeAnimated = true;
if (this.root.isUpdateBlocked()) {
this.options.onExitComplete && this.options.onExitComplete();
return;
}
!this.root.isUpdating && this.root.startUpdate();
if (this.isLayoutDirty)
return;
this.isLayoutDirty = true;
for (let i = 0; i < this.path.length; i++) {
const node = this.path[i];
node.shouldResetTransform = true;
node.updateScroll("snapshot");
if (node.options.layoutRoot) {
node.willUpdate(false);
}
}
const { layoutId, layout } = this.options;
if (layoutId === undefined && !layout)
return;
const transformTemplate = this.getTransformTemplate();
this.prevTransformTemplateValue = transformTemplate
? transformTemplate(this.latestValues, "")
: undefined;
this.updateSnapshot();
shouldNotifyListeners && this.notifyListeners("willUpdate");
}
update() {
this.updateScheduled = false;
const updateWasBlocked = this.isUpdateBlocked();
// When doing an instant transition, we skip the layout update,
// but should still clean up the measurements so that the next
// snapshot could be taken correctly.
if (updateWasBlocked) {
this.unblockUpdate();
this.clearAllSnapshots();
this.nodes.forEach(clearMeasurements);
return;
}
if (!this.isUpdating) {
this.nodes.forEach(clearIsLayoutDirty);
}
this.isUpdating = false;
/**
* Write
*/
this.nodes.forEach(resetTransformStyle);
/**
* Read ==================
*/
// Update layout measurements of updated children
this.nodes.forEach(updateLayout);
/**
* Write
*/
// Notify listeners that the layout is updated
this.nodes.forEach(notifyLayoutUpdate);
this.clearAllSnapshots();
/**
* Manually flush any pending updates. Ideally
* we could leave this to the following requestAnimationFrame but this seems
* to leave a flash of incorrectly styled content.
*/
const now = performance.now();
frameData.delta = clamp_clamp(0, 1000 / 60, now - frameData.timestamp);
frameData.timestamp = now;
frameData.isProcessing = true;
steps.update.process(frameData);
steps.preRender.process(frameData);
steps.render.process(frameData);
frameData.isProcessing = false;
}
didUpdate() {
if (!this.updateScheduled) {
this.updateScheduled = true;
queueMicrotask(() => this.update());
}
}
clearAllSnapshots() {
this.nodes.forEach(clearSnapshot);
this.sharedNodes.forEach(removeLeadSnapshots);
}
scheduleUpdateProjection() {
frame_frame.preRender(this.updateProjection, false, true);
}
scheduleCheckAfterUnmount() {
/**
* If the unmounting node is in a layoutGroup and did trigger a willUpdate,
* we manually call didUpdate to give a chance to the siblings to animate.
* Otherwise, cleanup all snapshots to prevents future nodes from reusing them.
*/
frame_frame.postRender(() => {
if (this.isLayoutDirty) {
this.root.didUpdate();
}
else {
this.root.checkUpdateFailed();
}
});
}
/**
* Update measurements
*/
updateSnapshot() {
if (this.snapshot || !this.instance)
return;
this.snapshot = this.measure();
}
updateLayout() {
if (!this.instance)
return;
// TODO: Incorporate into a forwarded scroll offset
this.updateScroll();
if (!(this.options.alwaysMeasureLayout && this.isLead()) &&
!this.isLayoutDirty) {
return;
}
/**
* When a node is mounted, it simply resumes from the prevLead's
* snapshot instead of taking a new one, but the ancestors scroll
* might have updated while the prevLead is unmounted. We need to
* update the scroll again to make sure the layout we measure is
* up to date.
*/
if (this.resumeFrom && !this.resumeFrom.instance) {
for (let i = 0; i < this.path.length; i++) {
const node = this.path[i];
node.updateScroll();
}
}
const prevLayout = this.layout;
this.layout = this.measure(false);
this.layoutCorrected = createBox();
this.isLayoutDirty = false;
this.projectionDelta = undefined;
this.notifyListeners("measure", this.layout.layoutBox);
const { visualElement } = this.options;
visualElement &&
visualElement.notify("LayoutMeasure", this.layout.layoutBox, prevLayout ? prevLayout.layoutBox : undefined);
}
updateScroll(phase = "measure") {
let needsMeasurement = Boolean(this.options.layoutScroll && this.instance);
if (this.scroll &&
this.scroll.animationId === this.root.animationId &&
this.scroll.phase === phase) {
needsMeasurement = false;
}
if (needsMeasurement) {
this.scroll = {
animationId: this.root.animationId,
phase,
isRoot: checkIsScrollRoot(this.instance),
offset: measureScroll(this.instance),
};
}
}
resetTransform() {
if (!resetTransform)
return;
const isResetRequested = this.isLayoutDirty || this.shouldResetTransform;
const hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta);
const transformTemplate = this.getTransformTemplate();
const transformTemplateValue = transformTemplate
? transformTemplate(this.latestValues, "")
: undefined;
const transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue;
if (isResetRequested &&
(hasProjection ||
hasTransform(this.latestValues) ||
transformTemplateHasChanged)) {
resetTransform(this.instance, transformTemplateValue);
this.shouldResetTransform = false;
this.scheduleRender();
}
}
measure(removeTransform = true) {
const pageBox = this.measurePageBox();
let layoutBox = this.removeElementScroll(pageBox);
/**
* Measurements taken during the pre-render stage
* still have transforms applied so we remove them
* via calculation.
*/
if (removeTransform) {
layoutBox = this.removeTransform(layoutBox);
}
roundBox(layoutBox);
return {
animationId: this.root.animationId,
measuredBox: pageBox,
layoutBox,
latestValues: {},
source: this.id,
};
}
measurePageBox() {
const { visualElement } = this.options;
if (!visualElement)
return createBox();
const box = visualElement.measureViewportBox();
// Remove viewport scroll to give page-relative coordinates
const { scroll } = this.root;
if (scroll) {
translateAxis(box.x, scroll.offset.x);
translateAxis(box.y, scroll.offset.y);
}
return box;
}
removeElementScroll(box) {
const boxWithoutScroll = createBox();
copyBoxInto(boxWithoutScroll, box);
/**
* Performance TODO: Keep a cumulative scroll offset down the tree
* rather than loop back up the path.
*/
for (let i = 0; i < this.path.length; i++) {
const node = this.path[i];
const { scroll, options } = node;
if (node !== this.root && scroll && options.layoutScroll) {
/**
* If this is a new scroll root, we want to remove all previous scrolls
* from the viewport box.
*/
if (scroll.isRoot) {
copyBoxInto(boxWithoutScroll, box);
const { scroll: rootScroll } = this.root;
/**
* Undo the application of page scroll that was originally added
* to the measured bounding box.
*/
if (rootScroll) {
translateAxis(boxWithoutScroll.x, -rootScroll.offset.x);
translateAxis(boxWithoutScroll.y, -rootScroll.offset.y);
}
}
translateAxis(boxWithoutScroll.x, scroll.offset.x);
translateAxis(boxWithoutScroll.y, scroll.offset.y);
}
}
return boxWithoutScroll;
}
applyTransform(box, transformOnly = false) {
const withTransforms = createBox();
copyBoxInto(withTransforms, box);
for (let i = 0; i < this.path.length; i++) {
const node = this.path[i];
if (!transformOnly &&
node.options.layoutScroll &&
node.scroll &&
node !== node.root) {
transformBox(withTransforms, {
x: -node.scroll.offset.x,
y: -node.scroll.offset.y,
});
}
if (!hasTransform(node.latestValues))
continue;
transformBox(withTransforms, node.latestValues);
}
if (hasTransform(this.latestValues)) {
transformBox(withTransforms, this.latestValues);
}
return withTransforms;
}
removeTransform(box) {
const boxWithoutTransform = createBox();
copyBoxInto(boxWithoutTransform, box);
for (let i = 0; i < this.path.length; i++) {
const node = this.path[i];
if (!node.instance)
continue;
if (!hasTransform(node.latestValues))
continue;
hasScale(node.latestValues) && node.updateSnapshot();
const sourceBox = createBox();
const nodeBox = node.measurePageBox();
copyBoxInto(sourceBox, nodeBox);
removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot ? node.snapshot.layoutBox : undefined, sourceBox);
}
if (hasTransform(this.latestValues)) {
removeBoxTransforms(boxWithoutTransform, this.latestValues);
}
return boxWithoutTransform;
}
setTargetDelta(delta) {
this.targetDelta = delta;
this.root.scheduleUpdateProjection();
this.isProjectionDirty = true;
}
setOptions(options) {
this.options = {
...this.options,
...options,
crossfade: options.crossfade !== undefined ? options.crossfade : true,
};
}
clearMeasurements() {
this.scroll = undefined;
this.layout = undefined;
this.snapshot = undefined;
this.prevTransformTemplateValue = undefined;
this.targetDelta = undefined;
this.target = undefined;
this.isLayoutDirty = false;
}
forceRelativeParentToResolveTarget() {
if (!this.relativeParent)
return;
/**
* If the parent target isn't up-to-date, force it to update.
* This is an unfortunate de-optimisation as it means any updating relative
* projection will cause all the relative parents to recalculate back
* up the tree.
*/
if (this.relativeParent.resolvedRelativeTargetAt !==
frameData.timestamp) {
this.relativeParent.resolveTargetDelta(true);
}
}
resolveTargetDelta(forceRecalculation = false) {
var _a;
/**
* Once the dirty status of nodes has been spread through the tree, we also
* need to check if we have a shared node of a different depth that has itself
* been dirtied.
*/
const lead = this.getLead();
this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty);
this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);
this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
const isShared = Boolean(this.resumingFrom) || this !== lead;
/**
* We don't use transform for this step of processing so we don't
* need to check whether any nodes have changed transform.
*/
const canSkip = !(forceRecalculation ||
(isShared && this.isSharedProjectionDirty) ||
this.isProjectionDirty ||
((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) ||
this.attemptToResolveRelativeTarget);
if (canSkip)
return;
const { layout, layoutId } = this.options;
/**
* If we have no layout, we can't perform projection, so early return
*/
if (!this.layout || !(layout || layoutId))
return;
this.resolvedRelativeTargetAt = frameData.timestamp;
/**
* If we don't have a targetDelta but do have a layout, we can attempt to resolve
* a relativeParent. This will allow a component to perform scale correction
* even if no animation has started.
*/
// TODO If this is unsuccessful this currently happens every frame
if (!this.targetDelta && !this.relativeTarget) {
// TODO: This is a semi-repetition of further down this function, make DRY
const relativeParent = this.getClosestProjectingParent();
if (relativeParent &&
relativeParent.layout &&
this.animationProgress !== 1) {
this.relativeParent = relativeParent;
this.forceRelativeParentToResolveTarget();
this.relativeTarget = createBox();
this.relativeTargetOrigin = createBox();
calcRelativePosition(this.relativeTargetOrigin, this.layout.layoutBox, relativeParent.layout.layoutBox);
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
}
else {
this.relativeParent = this.relativeTarget = undefined;
}
}
/**
* If we have no relative target or no target delta our target isn't valid
* for this frame.
*/
if (!this.relativeTarget && !this.targetDelta)
return;
/**
* Lazy-init target data structure
*/
if (!this.target) {
this.target = createBox();
this.targetWithTransforms = createBox();
}
/**
* If we've got a relative box for this component, resolve it into a target relative to the parent.
*/
if (this.relativeTarget &&
this.relativeTargetOrigin &&
this.relativeParent &&
this.relativeParent.target) {
this.forceRelativeParentToResolveTarget();
calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
/**
* If we've only got a targetDelta, resolve it into a target
*/
}
else if (this.targetDelta) {
if (Boolean(this.resumingFrom)) {
// TODO: This is creating a new object every frame
this.target = this.applyTransform(this.layout.layoutBox);
}
else {
copyBoxInto(this.target, this.layout.layoutBox);
}
applyBoxDelta(this.target, this.targetDelta);
}
else {
/**
* If no target, use own layout as target
*/
copyBoxInto(this.target, this.layout.layoutBox);
}
/**
* If we've been told to attempt to resolve a relative target, do so.
*/
if (this.attemptToResolveRelativeTarget) {
this.attemptToResolveRelativeTarget = false;
const relativeParent = this.getClosestProjectingParent();
if (relativeParent &&
Boolean(relativeParent.resumingFrom) ===
Boolean(this.resumingFrom) &&
!relativeParent.options.layoutScroll &&
relativeParent.target &&
this.animationProgress !== 1) {
this.relativeParent = relativeParent;
this.forceRelativeParentToResolveTarget();
this.relativeTarget = createBox();
this.relativeTargetOrigin = createBox();
calcRelativePosition(this.relativeTargetOrigin, this.target, relativeParent.target);
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
}
else {
this.relativeParent = this.relativeTarget = undefined;
}
}
/**
* Increase debug counter for resolved target deltas
*/
projectionFrameData.resolvedTargetDeltas++;
}
getClosestProjectingParent() {
if (!this.parent ||
hasScale(this.parent.latestValues) ||
has2DTranslate(this.parent.latestValues)) {
return undefined;
}
if (this.parent.isProjecting()) {
return this.parent;
}
else {
return this.parent.getClosestProjectingParent();
}
}
isProjecting() {
return Boolean((this.relativeTarget ||
this.targetDelta ||
this.options.layoutRoot) &&
this.layout);
}
calcProjection() {
var _a;
const lead = this.getLead();
const isShared = Boolean(this.resumingFrom) || this !== lead;
let canSkip = true;
/**
* If this is a normal layout animation and neither this node nor its nearest projecting
* is dirty then we can't skip.
*/
if (this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty)) {
canSkip = false;
}
/**
* If this is a shared layout animation and this node's shared projection is dirty then
* we can't skip.
*/
if (isShared &&
(this.isSharedProjectionDirty || this.isTransformDirty)) {
canSkip = false;
}
/**
* If we have resolved the target this frame we must recalculate the
* projection to ensure it visually represents the internal calculations.
*/
if (this.resolvedRelativeTargetAt === frameData.timestamp) {
canSkip = false;
}
if (canSkip)
return;
const { layout, layoutId } = this.options;
/**
* If this section of the tree isn't animating we can
* delete our target sources for the following frame.
*/
this.isTreeAnimating = Boolean((this.parent && this.parent.isTreeAnimating) ||
this.currentAnimation ||
this.pendingAnimation);
if (!this.isTreeAnimating) {
this.targetDelta = this.relativeTarget = undefined;
}
if (!this.layout || !(layout || layoutId))
return;
/**
* Reset the corrected box with the latest values from box, as we're then going
* to perform mutative operations on it.
*/
copyBoxInto(this.layoutCorrected, this.layout.layoutBox);
/**
* Record previous tree scales before updating.
*/
const prevTreeScaleX = this.treeScale.x;
const prevTreeScaleY = this.treeScale.y;
/**
* Apply all the parent deltas to this box to produce the corrected box. This
* is the layout box, as it will appear on screen as a result of the transforms of its parents.
*/
applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, isShared);
/**
* If this layer needs to perform scale correction but doesn't have a target,
* use the layout as the target.
*/
if (lead.layout &&
!lead.target &&
(this.treeScale.x !== 1 || this.treeScale.y !== 1)) {
lead.target = lead.layout.layoutBox;
}
const { target } = lead;
if (!target) {
/**
* If we don't have a target to project into, but we were previously
* projecting, we want to remove the stored transform and schedule
* a render to ensure the elements reflect the removed transform.
*/
if (this.projectionTransform) {
this.projectionDelta = createDelta();
this.projectionTransform = "none";
this.scheduleRender();
}
return;
}
if (!this.projectionDelta) {
this.projectionDelta = createDelta();
this.projectionDeltaWithTransform = createDelta();
}
const prevProjectionTransform = this.projectionTransform;
/**
* Update the delta between the corrected box and the target box before user-set transforms were applied.
* This will allow us to calculate the corrected borderRadius and boxShadow to compensate
* for our layout reprojection, but still allow them to be scaled correctly by the user.
* It might be that to simplify this we may want to accept that user-set scale is also corrected
* and we wouldn't have to keep and calc both deltas, OR we could support a user setting
* to allow people to choose whether these styles are corrected based on just the
* layout reprojection or the final bounding box.
*/
calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);
this.projectionTransform = buildProjectionTransform(this.projectionDelta, this.treeScale);
if (this.projectionTransform !== prevProjectionTransform ||
this.treeScale.x !== prevTreeScaleX ||
this.treeScale.y !== prevTreeScaleY) {
this.hasProjected = true;
this.scheduleRender();
this.notifyListeners("projectionUpdate", target);
}
/**
* Increase debug counter for recalculated projections
*/
projectionFrameData.recalculatedProjection++;
}
hide() {
this.isVisible = false;
// TODO: Schedule render
}
show() {
this.isVisible = true;
// TODO: Schedule render
}
scheduleRender(notifyAll = true) {
this.options.scheduleRender && this.options.scheduleRender();
if (notifyAll) {
const stack = this.getStack();
stack && stack.scheduleRender();
}
if (this.resumingFrom && !this.resumingFrom.instance) {
this.resumingFrom = undefined;
}
}
setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false) {
const snapshot = this.snapshot;
const snapshotLatestValues = snapshot
? snapshot.latestValues
: {};
const mixedValues = { ...this.latestValues };
const targetDelta = createDelta();
if (!this.relativeParent ||
!this.relativeParent.options.layoutRoot) {
this.relativeTarget = this.relativeTargetOrigin = undefined;
}
this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;
const relativeLayout = createBox();
const snapshotSource = snapshot ? snapshot.source : undefined;
const layoutSource = this.layout ? this.layout.source : undefined;
const isSharedLayoutAnimation = snapshotSource !== layoutSource;
const stack = this.getStack();
const isOnlyMember = !stack || stack.members.length <= 1;
const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation &&
!isOnlyMember &&
this.options.crossfade === true &&
!this.path.some(hasOpacityCrossfade));
this.animationProgress = 0;
let prevRelativeTarget;
this.mixTargetDelta = (latest) => {
const progress = latest / 1000;
mixAxisDelta(targetDelta.x, delta.x, progress);
mixAxisDelta(targetDelta.y, delta.y, progress);
this.setTargetDelta(targetDelta);
if (this.relativeTarget &&
this.relativeTargetOrigin &&
this.layout &&
this.relativeParent &&
this.relativeParent.layout) {
calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox);
mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress);
/**
* If this is an unchanged relative target we can consider the
* projection not dirty.
*/
if (prevRelativeTarget &&
boxEquals(this.relativeTarget, prevRelativeTarget)) {
this.isProjectionDirty = false;
}
if (!prevRelativeTarget)
prevRelativeTarget = createBox();
copyBoxInto(prevRelativeTarget, this.relativeTarget);
}
if (isSharedLayoutAnimation) {
this.animationValues = mixedValues;
mixValues(mixedValues, snapshotLatestValues, this.latestValues, progress, shouldCrossfadeOpacity, isOnlyMember);
}
this.root.scheduleUpdateProjection();
this.scheduleRender();
this.animationProgress = progress;
};
this.mixTargetDelta(this.options.layoutRoot ? 1000 : 0);
}
startAnimation(options) {
this.notifyListeners("animationStart");
this.currentAnimation && this.currentAnimation.stop();
if (this.resumingFrom && this.resumingFrom.currentAnimation) {
this.resumingFrom.currentAnimation.stop();
}
if (this.pendingAnimation) {
cancelFrame(this.pendingAnimation);
this.pendingAnimation = undefined;
}
/**
* Start the animation in the next frame to have a frame with progress 0,
* where the target is the same as when the animation started, so we can
* calculate the relative positions correctly for instant transitions.
*/
this.pendingAnimation = frame_frame.update(() => {
globalProjectionState.hasAnimatedSinceResize = true;
this.currentAnimation = animateSingleValue(0, animationTarget, {
...options,
onUpdate: (latest) => {
this.mixTargetDelta(latest);
options.onUpdate && options.onUpdate(latest);
},
onComplete: () => {
options.onComplete && options.onComplete();
this.completeAnimation();
},
});
if (this.resumingFrom) {
this.resumingFrom.currentAnimation = this.currentAnimation;
}
this.pendingAnimation = undefined;
});
}
completeAnimation() {
if (this.resumingFrom) {
this.resumingFrom.currentAnimation = undefined;
this.resumingFrom.preserveOpacity = undefined;
}
const stack = this.getStack();
stack && stack.exitAnimationComplete();
this.resumingFrom =
this.currentAnimation =
this.animationValues =
undefined;
this.notifyListeners("animationComplete");
}
finishAnimation() {
if (this.currentAnimation) {
this.mixTargetDelta && this.mixTargetDelta(animationTarget);
this.currentAnimation.stop();
}
this.completeAnimation();
}
applyTransformsToTarget() {
const lead = this.getLead();
let { targetWithTransforms, target, layout, latestValues } = lead;
if (!targetWithTransforms || !target || !layout)
return;
/**
* If we're only animating position, and this element isn't the lead element,
* then instead of projecting into the lead box we instead want to calculate
* a new target that aligns the two boxes but maintains the layout shape.
*/
if (this !== lead &&
this.layout &&
layout &&
shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, layout.layoutBox)) {
target = this.target || createBox();
const xLength = calcLength(this.layout.layoutBox.x);
target.x.min = lead.target.x.min;
target.x.max = target.x.min + xLength;
const yLength = calcLength(this.layout.layoutBox.y);
target.y.min = lead.target.y.min;
target.y.max = target.y.min + yLength;
}
copyBoxInto(targetWithTransforms, target);
/**
* Apply the latest user-set transforms to the targetBox to produce the targetBoxFinal.
* This is the final box that we will then project into by calculating a transform delta and
* applying it to the corrected box.
*/
transformBox(targetWithTransforms, latestValues);
/**
* Update the delta between the corrected box and the final target box, after
* user-set transforms are applied to it. This will be used by the renderer to
* create a transform style that will reproject the element from its layout layout
* into the desired bounding box.
*/
calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues);
}
registerSharedNode(layoutId, node) {
if (!this.sharedNodes.has(layoutId)) {
this.sharedNodes.set(layoutId, new NodeStack());
}
const stack = this.sharedNodes.get(layoutId);
stack.add(node);
const config = node.options.initialPromotionConfig;
node.promote({
transition: config ? config.transition : undefined,
preserveFollowOpacity: config && config.shouldPreserveFollowOpacity
? config.shouldPreserveFollowOpacity(node)
: undefined,
});
}
isLead() {
const stack = this.getStack();
return stack ? stack.lead === this : true;
}
getLead() {
var _a;
const { layoutId } = this.options;
return layoutId ? ((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.lead) || this : this;
}
getPrevLead() {
var _a;
const { layoutId } = this.options;
return layoutId ? (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.prevLead : undefined;
}
getStack() {
const { layoutId } = this.options;
if (layoutId)
return this.root.sharedNodes.get(layoutId);
}
promote({ needsReset, transition, preserveFollowOpacity, } = {}) {
const stack = this.getStack();
if (stack)
stack.promote(this, preserveFollowOpacity);
if (needsReset) {
this.projectionDelta = undefined;
this.needsReset = true;
}
if (transition)
this.setOptions({ transition });
}
relegate() {
const stack = this.getStack();
if (stack) {
return stack.relegate(this);
}
else {
return false;
}
}
resetRotation() {
const { visualElement } = this.options;
if (!visualElement)
return;
// If there's no detected rotation values, we can early return without a forced render.
let hasRotate = false;
/**
* An unrolled check for rotation values. Most elements don't have any rotation and
* skipping the nested loop and new object creation is 50% faster.
*/
const { latestValues } = visualElement;
if (latestValues.rotate ||
latestValues.rotateX ||
latestValues.rotateY ||
latestValues.rotateZ) {
hasRotate = true;
}
// If there's no rotation values, we don't need to do any more.
if (!hasRotate)
return;
const resetValues = {};
// Check the rotate value of all axes and reset to 0
for (let i = 0; i < transformAxes.length; i++) {
const key = "rotate" + transformAxes[i];
// Record the rotation and then temporarily set it to 0
if (latestValues[key]) {
resetValues[key] = latestValues[key];
visualElement.setStaticValue(key, 0);
}
}
// Force a render of this element to apply the transform with all rotations
// set to 0.
visualElement.render();
// Put back all the values we reset
for (const key in resetValues) {
visualElement.setStaticValue(key, resetValues[key]);
}
// Schedule a render for the next frame. This ensures we won't visually
// see the element with the reset rotate value applied.
visualElement.scheduleRender();
}
getProjectionStyles(styleProp = {}) {
var _a, _b;
// TODO: Return lifecycle-persistent object
const styles = {};
if (!this.instance || this.isSVG)
return styles;
if (!this.isVisible) {
return { visibility: "hidden" };
}
else {
styles.visibility = "";
}
const transformTemplate = this.getTransformTemplate();
if (this.needsReset) {
this.needsReset = false;
styles.opacity = "";
styles.pointerEvents =
resolveMotionValue(styleProp.pointerEvents) || "";
styles.transform = transformTemplate
? transformTemplate(this.latestValues, "")
: "none";
return styles;
}
const lead = this.getLead();
if (!this.projectionDelta || !this.layout || !lead.target) {
const emptyStyles = {};
if (this.options.layoutId) {
emptyStyles.opacity =
this.latestValues.opacity !== undefined
? this.latestValues.opacity
: 1;
emptyStyles.pointerEvents =
resolveMotionValue(styleProp.pointerEvents) || "";
}
if (this.hasProjected && !hasTransform(this.latestValues)) {
emptyStyles.transform = transformTemplate
? transformTemplate({}, "")
: "none";
this.hasProjected = false;
}
return emptyStyles;
}
const valuesToRender = lead.animationValues || lead.latestValues;
this.applyTransformsToTarget();
styles.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);
if (transformTemplate) {
styles.transform = transformTemplate(valuesToRender, styles.transform);
}
const { x, y } = this.projectionDelta;
styles.transformOrigin = `${x.origin * 100}% ${y.origin * 100}% 0`;
if (lead.animationValues) {
/**
* If the lead component is animating, assign this either the entering/leaving
* opacity
*/
styles.opacity =
lead === this
? (_b = (_a = valuesToRender.opacity) !== null && _a !== void 0 ? _a : this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1
: this.preserveOpacity
? this.latestValues.opacity
: valuesToRender.opacityExit;
}
else {
/**
* Or we're not animating at all, set the lead component to its layout
* opacity and other components to hidden.
*/
styles.opacity =
lead === this
? valuesToRender.opacity !== undefined
? valuesToRender.opacity
: ""
: valuesToRender.opacityExit !== undefined
? valuesToRender.opacityExit
: 0;
}
/**
* Apply scale correction
*/
for (const key in scaleCorrectors) {
if (valuesToRender[key] === undefined)
continue;
const { correct, applyTo } = scaleCorrectors[key];
/**
* Only apply scale correction to the value if we have an
* active projection transform. Otherwise these values become
* vulnerable to distortion if the element changes size without
* a corresponding layout animation.
*/
const corrected = styles.transform === "none"
? valuesToRender[key]
: correct(valuesToRender[key], lead);
if (applyTo) {
const num = applyTo.length;
for (let i = 0; i < num; i++) {
styles[applyTo[i]] = corrected;
}
}
else {
styles[key] = corrected;
}
}
/**
* Disable pointer events on follow components. This is to ensure
* that if a follow component covers a lead component it doesn't block
* pointer events on the lead.
*/
if (this.options.layoutId) {
styles.pointerEvents =
lead === this
? resolveMotionValue(styleProp.pointerEvents) || ""
: "none";
}
return styles;
}
clearSnapshot() {
this.resumeFrom = this.snapshot = undefined;
}
// Only run on root
resetTree() {
this.root.nodes.forEach((node) => { var _a; return (_a = node.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop(); });
this.root.nodes.forEach(clearMeasurements);
this.root.sharedNodes.clear();
}
};
}
function updateLayout(node) {
node.updateLayout();
}
function notifyLayoutUpdate(node) {
var _a;
const snapshot = ((_a = node.resumeFrom) === null || _a === void 0 ? void 0 : _a.snapshot) || node.snapshot;
if (node.isLead() &&
node.layout &&
snapshot &&
node.hasListeners("didUpdate")) {
const { layoutBox: layout, measuredBox: measuredLayout } = node.layout;
const { animationType } = node.options;
const isShared = snapshot.source !== node.layout.source;
// TODO Maybe we want to also resize the layout snapshot so we don't trigger
// animations for instance if layout="size" and an element has only changed position
if (animationType === "size") {
eachAxis((axis) => {
const axisSnapshot = isShared
? snapshot.measuredBox[axis]
: snapshot.layoutBox[axis];
const length = calcLength(axisSnapshot);
axisSnapshot.min = layout[axis].min;
axisSnapshot.max = axisSnapshot.min + length;
});
}
else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout)) {
eachAxis((axis) => {
const axisSnapshot = isShared
? snapshot.measuredBox[axis]
: snapshot.layoutBox[axis];
const length = calcLength(layout[axis]);
axisSnapshot.max = axisSnapshot.min + length;
/**
* Ensure relative target gets resized and rerendererd
*/
if (node.relativeTarget && !node.currentAnimation) {
node.isProjectionDirty = true;
node.relativeTarget[axis].max =
node.relativeTarget[axis].min + length;
}
});
}
const layoutDelta = createDelta();
calcBoxDelta(layoutDelta, layout, snapshot.layoutBox);
const visualDelta = createDelta();
if (isShared) {
calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot.measuredBox);
}
else {
calcBoxDelta(visualDelta, layout, snapshot.layoutBox);
}
const hasLayoutChanged = !isDeltaZero(layoutDelta);
let hasRelativeTargetChanged = false;
if (!node.resumeFrom) {
const relativeParent = node.getClosestProjectingParent();
/**
* If the relativeParent is itself resuming from a different element then
* the relative snapshot is not relavent
*/
if (relativeParent && !relativeParent.resumeFrom) {
const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent;
if (parentSnapshot && parentLayout) {
const relativeSnapshot = createBox();
calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox);
const relativeLayout = createBox();
calcRelativePosition(relativeLayout, layout, parentLayout.layoutBox);
if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) {
hasRelativeTargetChanged = true;
}
if (relativeParent.options.layoutRoot) {
node.relativeTarget = relativeLayout;
node.relativeTargetOrigin = relativeSnapshot;
node.relativeParent = relativeParent;
}
}
}
}
node.notifyListeners("didUpdate", {
layout,
snapshot,
delta: visualDelta,
layoutDelta,
hasLayoutChanged,
hasRelativeTargetChanged,
});
}
else if (node.isLead()) {
const { onExitComplete } = node.options;
onExitComplete && onExitComplete();
}
/**
* Clearing transition
* TODO: Investigate why this transition is being passed in as {type: false } from Framer
* and why we need it at all
*/
node.options.transition = undefined;
}
function propagateDirtyNodes(node) {
/**
* Increase debug counter for nodes encountered this frame
*/
projectionFrameData.totalNodes++;
if (!node.parent)
return;
/**
* If this node isn't projecting, propagate isProjectionDirty. It will have
* no performance impact but it will allow the next child that *is* projecting
* but *isn't* dirty to just check its parent to see if *any* ancestor needs
* correcting.
*/
if (!node.isProjecting()) {
node.isProjectionDirty = node.parent.isProjectionDirty;
}
/**
* Propagate isSharedProjectionDirty and isTransformDirty
* throughout the whole tree. A future revision can take another look at
* this but for safety we still recalcualte shared nodes.
*/
node.isSharedProjectionDirty || (node.isSharedProjectionDirty = Boolean(node.isProjectionDirty ||
node.parent.isProjectionDirty ||
node.parent.isSharedProjectionDirty));
node.isTransformDirty || (node.isTransformDirty = node.parent.isTransformDirty);
}
function cleanDirtyNodes(node) {
node.isProjectionDirty =
node.isSharedProjectionDirty =
node.isTransformDirty =
false;
}
function clearSnapshot(node) {
node.clearSnapshot();
}
function clearMeasurements(node) {
node.clearMeasurements();
}
function clearIsLayoutDirty(node) {
node.isLayoutDirty = false;
}
function resetTransformStyle(node) {
const { visualElement } = node.options;
if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) {
visualElement.notify("BeforeLayoutMeasure");
}
node.resetTransform();
}
function finishAnimation(node) {
node.finishAnimation();
node.targetDelta = node.relativeTarget = node.target = undefined;
node.isProjectionDirty = true;
}
function resolveTargetDelta(node) {
node.resolveTargetDelta();
}
function calcProjection(node) {
node.calcProjection();
}
function resetRotation(node) {
node.resetRotation();
}
function removeLeadSnapshots(stack) {
stack.removeLeadSnapshot();
}
function mixAxisDelta(output, delta, p) {
output.translate = mix(delta.translate, 0, p);
output.scale = mix(delta.scale, 1, p);
output.origin = delta.origin;
output.originPoint = delta.originPoint;
}
function mixAxis(output, from, to, p) {
output.min = mix(from.min, to.min, p);
output.max = mix(from.max, to.max, p);
}
function mixBox(output, from, to, p) {
mixAxis(output.x, from.x, to.x, p);
mixAxis(output.y, from.y, to.y, p);
}
function hasOpacityCrossfade(node) {
return (node.animationValues && node.animationValues.opacityExit !== undefined);
}
const defaultLayoutTransition = {
duration: 0.45,
ease: [0.4, 0, 0.1, 1],
};
const userAgentContains = (string) => typeof navigator !== "undefined" &&
navigator.userAgent.toLowerCase().includes(string);
/**
* Measured bounding boxes must be rounded in Safari and
* left untouched in Chrome, otherwise non-integer layouts within scaled-up elements
* can appear to jump.
*/
const roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/")
? Math.round
: noop_noop;
function roundAxis(axis) {
// Round to the nearest .5 pixels to support subpixel layouts
axis.min = roundPoint(axis.min);
axis.max = roundPoint(axis.max);
}
function roundBox(box) {
roundAxis(box.x);
roundAxis(box.y);
}
function shouldAnimatePositionOnly(animationType, snapshot, layout) {
return (animationType === "position" ||
(animationType === "preserve-aspect" &&
!isNear(aspectRatio(snapshot), aspectRatio(layout), 0.2)));
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs
const DocumentProjectionNode = createProjectionNode({
attachResizeListener: (ref, notify) => addDomEvent(ref, "resize", notify),
measureScroll: () => ({
x: document.documentElement.scrollLeft || document.body.scrollLeft,
y: document.documentElement.scrollTop || document.body.scrollTop,
}),
checkIsScrollRoot: () => true,
});
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs
const rootProjectionNode = {
current: undefined,
};
const HTMLProjectionNode = createProjectionNode({
measureScroll: (instance) => ({
x: instance.scrollLeft,
y: instance.scrollTop,
}),
defaultParent: () => {
if (!rootProjectionNode.current) {
const documentNode = new DocumentProjectionNode({});
documentNode.mount(window);
documentNode.setOptions({ layoutScroll: true });
rootProjectionNode.current = documentNode;
}
return rootProjectionNode.current;
},
resetTransform: (instance, value) => {
instance.style.transform = value !== undefined ? value : "none";
},
checkIsScrollRoot: (instance) => Boolean(window.getComputedStyle(instance).position === "fixed"),
});
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/drag.mjs
const drag = {
pan: {
Feature: PanGesture,
},
drag: {
Feature: DragGesture,
ProjectionNode: HTMLProjectionNode,
MeasureLayout: MeasureLayout,
},
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs
/**
* Parse Framer's special CSS variable format into a CSS token and a fallback.
*
* ```
* `var(--foo, #fff)` => [`--foo`, '#fff']
* ```
*
* @param current
*/
const splitCSSVariableRegex = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;
function parseCSSVariable(current) {
const match = splitCSSVariableRegex.exec(current);
if (!match)
return [,];
const [, token, fallback] = match;
return [token, fallback];
}
const maxDepth = 4;
function getVariableValue(current, element, depth = 1) {
errors_invariant(depth <= maxDepth, `Max CSS variable fallback depth detected in property "${current}". This may indicate a circular fallback dependency.`);
const [token, fallback] = parseCSSVariable(current);
// No CSS variable detected
if (!token)
return;
// Attempt to read this CSS variable off the element
const resolved = window.getComputedStyle(element).getPropertyValue(token);
if (resolved) {
const trimmed = resolved.trim();
return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed;
}
else if (isCSSVariableToken(fallback)) {
// The fallback might itself be a CSS variable, in which case we attempt to resolve it too.
return getVariableValue(fallback, element, depth + 1);
}
else {
return fallback;
}
}
/**
* Resolve CSS variables from
*
* @internal
*/
function resolveCSSVariables(visualElement, { ...target }, transitionEnd) {
const element = visualElement.current;
if (!(element instanceof Element))
return { target, transitionEnd };
// If `transitionEnd` isn't `undefined`, clone it. We could clone `target` and `transitionEnd`
// only if they change but I think this reads clearer and this isn't a performance-critical path.
if (transitionEnd) {
transitionEnd = { ...transitionEnd };
}
// Go through existing `MotionValue`s and ensure any existing CSS variables are resolved
visualElement.values.forEach((value) => {
const current = value.get();
if (!isCSSVariableToken(current))
return;
const resolved = getVariableValue(current, element);
if (resolved)
value.set(resolved);
});
// Cycle through every target property and resolve CSS variables. Currently
// we only read single-var properties like `var(--foo)`, not `calc(var(--foo) + 20px)`
for (const key in target) {
const current = target[key];
if (!isCSSVariableToken(current))
continue;
const resolved = getVariableValue(current, element);
if (!resolved)
continue;
// Clone target if it hasn't already been
target[key] = resolved;
if (!transitionEnd)
transitionEnd = {};
// If the user hasn't already set this key on `transitionEnd`, set it to the unresolved
// CSS variable. This will ensure that after the animation the component will reflect
// changes in the value of the CSS variable.
if (transitionEnd[key] === undefined) {
transitionEnd[key] = current;
}
}
return { target, transitionEnd };
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/unit-conversion.mjs
const positionalKeys = new Set([
"width",
"height",
"top",
"left",
"right",
"bottom",
"x",
"y",
"translateX",
"translateY",
]);
const isPositionalKey = (key) => positionalKeys.has(key);
const hasPositionalKey = (target) => {
return Object.keys(target).some(isPositionalKey);
};
const isNumOrPxType = (v) => v === number || v === px;
const getPosFromMatrix = (matrix, pos) => parseFloat(matrix.split(", ")[pos]);
const getTranslateFromMatrix = (pos2, pos3) => (_bbox, { transform }) => {
if (transform === "none" || !transform)
return 0;
const matrix3d = transform.match(/^matrix3d\((.+)\)$/);
if (matrix3d) {
return getPosFromMatrix(matrix3d[1], pos3);
}
else {
const matrix = transform.match(/^matrix\((.+)\)$/);
if (matrix) {
return getPosFromMatrix(matrix[1], pos2);
}
else {
return 0;
}
}
};
const transformKeys = new Set(["x", "y", "z"]);
const nonTranslationalTransformKeys = transformPropOrder.filter((key) => !transformKeys.has(key));
function removeNonTranslationalTransform(visualElement) {
const removedTransforms = [];
nonTranslationalTransformKeys.forEach((key) => {
const value = visualElement.getValue(key);
if (value !== undefined) {
removedTransforms.push([key, value.get()]);
value.set(key.startsWith("scale") ? 1 : 0);
}
});
// Apply changes to element before measurement
if (removedTransforms.length)
visualElement.render();
return removedTransforms;
}
const positionalValues = {
// Dimensions
width: ({ x }, { paddingLeft = "0", paddingRight = "0" }) => x.max - x.min - parseFloat(paddingLeft) - parseFloat(paddingRight),
height: ({ y }, { paddingTop = "0", paddingBottom = "0" }) => y.max - y.min - parseFloat(paddingTop) - parseFloat(paddingBottom),
top: (_bbox, { top }) => parseFloat(top),
left: (_bbox, { left }) => parseFloat(left),
bottom: ({ y }, { top }) => parseFloat(top) + (y.max - y.min),
right: ({ x }, { left }) => parseFloat(left) + (x.max - x.min),
// Transform
x: getTranslateFromMatrix(4, 13),
y: getTranslateFromMatrix(5, 14),
};
// Alias translate longform names
positionalValues.translateX = positionalValues.x;
positionalValues.translateY = positionalValues.y;
const convertChangedValueTypes = (target, visualElement, changedKeys) => {
const originBbox = visualElement.measureViewportBox();
const element = visualElement.current;
const elementComputedStyle = getComputedStyle(element);
const { display } = elementComputedStyle;
const origin = {};
// If the element is currently set to display: "none", make it visible before
// measuring the target bounding box
if (display === "none") {
visualElement.setStaticValue("display", target.display || "block");
}
/**
* Record origins before we render and update styles
*/
changedKeys.forEach((key) => {
origin[key] = positionalValues[key](originBbox, elementComputedStyle);
});
// Apply the latest values (as set in checkAndConvertChangedValueTypes)
visualElement.render();
const targetBbox = visualElement.measureViewportBox();
changedKeys.forEach((key) => {
// Restore styles to their **calculated computed style**, not their actual
// originally set style. This allows us to animate between equivalent pixel units.
const value = visualElement.getValue(key);
value && value.jump(origin[key]);
target[key] = positionalValues[key](targetBbox, elementComputedStyle);
});
return target;
};
const checkAndConvertChangedValueTypes = (visualElement, target, origin = {}, transitionEnd = {}) => {
target = { ...target };
transitionEnd = { ...transitionEnd };
const targetPositionalKeys = Object.keys(target).filter(isPositionalKey);
// We want to remove any transform values that could affect the element's bounding box before
// it's measured. We'll reapply these later.
let removedTransformValues = [];
let hasAttemptedToRemoveTransformValues = false;
const changedValueTypeKeys = [];
targetPositionalKeys.forEach((key) => {
const value = visualElement.getValue(key);
if (!visualElement.hasValue(key))
return;
let from = origin[key];
let fromType = findDimensionValueType(from);
const to = target[key];
let toType;
// TODO: The current implementation of this basically throws an error
// if you try and do value conversion via keyframes. There's probably
// a way of doing this but the performance implications would need greater scrutiny,
// as it'd be doing multiple resize-remeasure operations.
if (isKeyframesTarget(to)) {
const numKeyframes = to.length;
const fromIndex = to[0] === null ? 1 : 0;
from = to[fromIndex];
fromType = findDimensionValueType(from);
for (let i = fromIndex; i < numKeyframes; i++) {
/**
* Don't allow wildcard keyframes to be used to detect
* a difference in value types.
*/
if (to[i] === null)
break;
if (!toType) {
toType = findDimensionValueType(to[i]);
errors_invariant(toType === fromType ||
(isNumOrPxType(fromType) && isNumOrPxType(toType)), "Keyframes must be of the same dimension as the current value");
}
else {
errors_invariant(findDimensionValueType(to[i]) === toType, "All keyframes must be of the same type");
}
}
}
else {
toType = findDimensionValueType(to);
}
if (fromType !== toType) {
// If they're both just number or px, convert them both to numbers rather than
// relying on resize/remeasure to convert (which is wasteful in this situation)
if (isNumOrPxType(fromType) && isNumOrPxType(toType)) {
const current = value.get();
if (typeof current === "string") {
value.set(parseFloat(current));
}
if (typeof to === "string") {
target[key] = parseFloat(to);
}
else if (Array.isArray(to) && toType === px) {
target[key] = to.map(parseFloat);
}
}
else if ((fromType === null || fromType === void 0 ? void 0 : fromType.transform) &&
(toType === null || toType === void 0 ? void 0 : toType.transform) &&
(from === 0 || to === 0)) {
// If one or the other value is 0, it's safe to coerce it to the
// type of the other without measurement
if (from === 0) {
value.set(toType.transform(from));
}
else {
target[key] = fromType.transform(to);
}
}
else {
// If we're going to do value conversion via DOM measurements, we first
// need to remove non-positional transform values that could affect the bbox measurements.
if (!hasAttemptedToRemoveTransformValues) {
removedTransformValues =
removeNonTranslationalTransform(visualElement);
hasAttemptedToRemoveTransformValues = true;
}
changedValueTypeKeys.push(key);
transitionEnd[key] =
transitionEnd[key] !== undefined
? transitionEnd[key]
: target[key];
value.jump(to);
}
}
});
if (changedValueTypeKeys.length) {
const scrollY = changedValueTypeKeys.indexOf("height") >= 0
? window.pageYOffset
: null;
const convertedTarget = convertChangedValueTypes(target, visualElement, changedValueTypeKeys);
// If we removed transform values, reapply them before the next render
if (removedTransformValues.length) {
removedTransformValues.forEach(([key, value]) => {
visualElement.getValue(key).set(value);
});
}
// Reapply original values
visualElement.render();
// Restore scroll position
if (is_browser_isBrowser && scrollY !== null) {
window.scrollTo({ top: scrollY });
}
return { target: convertedTarget, transitionEnd };
}
else {
return { target, transitionEnd };
}
};
/**
* Convert value types for x/y/width/height/top/left/bottom/right
*
* Allows animation between `'auto'` -> `'100%'` or `0` -> `'calc(50% - 10vw)'`
*
* @internal
*/
function unitConversion(visualElement, target, origin, transitionEnd) {
return hasPositionalKey(target)
? checkAndConvertChangedValueTypes(visualElement, target, origin, transitionEnd)
: { target, transitionEnd };
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/parse-dom-variant.mjs
/**
* Parse a DOM variant to make it animatable. This involves resolving CSS variables
* and ensuring animations like "20%" => "calc(50vw)" are performed in pixels.
*/
const parseDomVariant = (visualElement, target, origin, transitionEnd) => {
const resolved = resolveCSSVariables(visualElement, target, transitionEnd);
target = resolved.target;
transitionEnd = resolved.transitionEnd;
return unitConversion(visualElement, target, origin, transitionEnd);
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/reduced-motion/state.mjs
// Does this device prefer reduced motion? Returns `null` server-side.
const prefersReducedMotion = { current: null };
const hasReducedMotionListener = { current: false };
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/reduced-motion/index.mjs
function initPrefersReducedMotion() {
hasReducedMotionListener.current = true;
if (!is_browser_isBrowser)
return;
if (window.matchMedia) {
const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)");
const setReducedMotionPreferences = () => (prefersReducedMotion.current = motionMediaQuery.matches);
motionMediaQuery.addListener(setReducedMotionPreferences);
setReducedMotionPreferences();
}
else {
prefersReducedMotion.current = false;
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/motion-values.mjs
function updateMotionValuesFromProps(element, next, prev) {
const { willChange } = next;
for (const key in next) {
const nextValue = next[key];
const prevValue = prev[key];
if (isMotionValue(nextValue)) {
/**
* If this is a motion value found in props or style, we want to add it
* to our visual element's motion value map.
*/
element.addValue(key, nextValue);
if (isWillChangeMotionValue(willChange)) {
willChange.add(key);
}
/**
* Check the version of the incoming motion value with this version
* and warn against mismatches.
*/
if (false) {}
}
else if (isMotionValue(prevValue)) {
/**
* If we're swapping from a motion value to a static value,
* create a new motion value from that
*/
element.addValue(key, motionValue(nextValue, { owner: element }));
if (isWillChangeMotionValue(willChange)) {
willChange.remove(key);
}
}
else if (prevValue !== nextValue) {
/**
* If this is a flat value that has changed, update the motion value
* or create one if it doesn't exist. We only want to do this if we're
* not handling the value with our animation state.
*/
if (element.hasValue(key)) {
const existingValue = element.getValue(key);
// TODO: Only update values that aren't being animated or even looked at
!existingValue.hasAnimated && existingValue.set(nextValue);
}
else {
const latestValue = element.getStaticValue(key);
element.addValue(key, motionValue(latestValue !== undefined ? latestValue : nextValue, { owner: element }));
}
}
}
// Handle removed values
for (const key in prev) {
if (next[key] === undefined)
element.removeValue(key);
}
return next;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/store.mjs
const visualElementStore = new WeakMap();
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/VisualElement.mjs
const featureNames = Object.keys(featureDefinitions);
const numFeatures = featureNames.length;
const propEventHandlers = [
"AnimationStart",
"AnimationComplete",
"Update",
"BeforeLayoutMeasure",
"LayoutMeasure",
"LayoutAnimationStart",
"LayoutAnimationComplete",
];
const numVariantProps = variantProps.length;
/**
* A VisualElement is an imperative abstraction around UI elements such as
* HTMLElement, SVGElement, Three.Object3D etc.
*/
class VisualElement {
constructor({ parent, props, presenceContext, reducedMotionConfig, visualState, }, options = {}) {
/**
* A reference to the current underlying Instance, e.g. a HTMLElement
* or Three.Mesh etc.
*/
this.current = null;
/**
* A set containing references to this VisualElement's children.
*/
this.children = new Set();
/**
* Determine what role this visual element should take in the variant tree.
*/
this.isVariantNode = false;
this.isControllingVariants = false;
/**
* Decides whether this VisualElement should animate in reduced motion
* mode.
*
* TODO: This is currently set on every individual VisualElement but feels
* like it could be set globally.
*/
this.shouldReduceMotion = null;
/**
* A map of all motion values attached to this visual element. Motion
* values are source of truth for any given animated value. A motion
* value might be provided externally by the component via props.
*/
this.values = new Map();
/**
* Cleanup functions for active features (hover/tap/exit etc)
*/
this.features = {};
/**
* A map of every subscription that binds the provided or generated
* motion values onChange listeners to this visual element.
*/
this.valueSubscriptions = new Map();
/**
* A reference to the previously-provided motion values as returned
* from scrapeMotionValuesFromProps. We use the keys in here to determine
* if any motion values need to be removed after props are updated.
*/
this.prevMotionValues = {};
/**
* An object containing a SubscriptionManager for each active event.
*/
this.events = {};
/**
* An object containing an unsubscribe function for each prop event subscription.
* For example, every "Update" event can have multiple subscribers via
* VisualElement.on(), but only one of those can be defined via the onUpdate prop.
*/
this.propEventSubscriptions = {};
this.notifyUpdate = () => this.notify("Update", this.latestValues);
this.render = () => {
if (!this.current)
return;
this.triggerBuild();
this.renderInstance(this.current, this.renderState, this.props.style, this.projection);
};
this.scheduleRender = () => frame_frame.render(this.render, false, true);
const { latestValues, renderState } = visualState;
this.latestValues = latestValues;
this.baseTarget = { ...latestValues };
this.initialValues = props.initial ? { ...latestValues } : {};
this.renderState = renderState;
this.parent = parent;
this.props = props;
this.presenceContext = presenceContext;
this.depth = parent ? parent.depth + 1 : 0;
this.reducedMotionConfig = reducedMotionConfig;
this.options = options;
this.isControllingVariants = isControllingVariants(props);
this.isVariantNode = isVariantNode(props);
if (this.isVariantNode) {
this.variantChildren = new Set();
}
this.manuallyAnimateOnMount = Boolean(parent && parent.current);
/**
* Any motion values that are provided to the element when created
* aren't yet bound to the element, as this would technically be impure.
* However, we iterate through the motion values and set them to the
* initial values for this component.
*
* TODO: This is impure and we should look at changing this to run on mount.
* Doing so will break some tests but this isn't neccessarily a breaking change,
* more a reflection of the test.
*/
const { willChange, ...initialMotionValues } = this.scrapeMotionValuesFromProps(props, {});
for (const key in initialMotionValues) {
const value = initialMotionValues[key];
if (latestValues[key] !== undefined && isMotionValue(value)) {
value.set(latestValues[key], false);
if (isWillChangeMotionValue(willChange)) {
willChange.add(key);
}
}
}
}
/**
* This method takes React props and returns found MotionValues. For example, HTML
* MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
*
* This isn't an abstract method as it needs calling in the constructor, but it is
* intended to be one.
*/
scrapeMotionValuesFromProps(_props, _prevProps) {
return {};
}
mount(instance) {
this.current = instance;
visualElementStore.set(instance, this);
if (this.projection && !this.projection.instance) {
this.projection.mount(instance);
}
if (this.parent && this.isVariantNode && !this.isControllingVariants) {
this.removeFromVariantTree = this.parent.addVariantChild(this);
}
this.values.forEach((value, key) => this.bindToMotionValue(key, value));
if (!hasReducedMotionListener.current) {
initPrefersReducedMotion();
}
this.shouldReduceMotion =
this.reducedMotionConfig === "never"
? false
: this.reducedMotionConfig === "always"
? true
: prefersReducedMotion.current;
if (false) {}
if (this.parent)
this.parent.children.add(this);
this.update(this.props, this.presenceContext);
}
unmount() {
visualElementStore.delete(this.current);
this.projection && this.projection.unmount();
cancelFrame(this.notifyUpdate);
cancelFrame(this.render);
this.valueSubscriptions.forEach((remove) => remove());
this.removeFromVariantTree && this.removeFromVariantTree();
this.parent && this.parent.children.delete(this);
for (const key in this.events) {
this.events[key].clear();
}
for (const key in this.features) {
this.features[key].unmount();
}
this.current = null;
}
bindToMotionValue(key, value) {
const valueIsTransform = transformProps.has(key);
const removeOnChange = value.on("change", (latestValue) => {
this.latestValues[key] = latestValue;
this.props.onUpdate &&
frame_frame.update(this.notifyUpdate, false, true);
if (valueIsTransform && this.projection) {
this.projection.isTransformDirty = true;
}
});
const removeOnRenderRequest = value.on("renderRequest", this.scheduleRender);
this.valueSubscriptions.set(key, () => {
removeOnChange();
removeOnRenderRequest();
});
}
sortNodePosition(other) {
/**
* If these nodes aren't even of the same type we can't compare their depth.
*/
if (!this.current ||
!this.sortInstanceNodePosition ||
this.type !== other.type) {
return 0;
}
return this.sortInstanceNodePosition(this.current, other.current);
}
loadFeatures({ children, ...renderedProps }, isStrict, preloadedFeatures, initialLayoutGroupConfig) {
let ProjectionNodeConstructor;
let MeasureLayout;
/**
* If we're in development mode, check to make sure we're not rendering a motion component
* as a child of LazyMotion, as this will break the file-size benefits of using it.
*/
if (false) {}
for (let i = 0; i < numFeatures; i++) {
const name = featureNames[i];
const { isEnabled, Feature: FeatureConstructor, ProjectionNode, MeasureLayout: MeasureLayoutComponent, } = featureDefinitions[name];
if (ProjectionNode)
ProjectionNodeConstructor = ProjectionNode;
if (isEnabled(renderedProps)) {
if (!this.features[name] && FeatureConstructor) {
this.features[name] = new FeatureConstructor(this);
}
if (MeasureLayoutComponent) {
MeasureLayout = MeasureLayoutComponent;
}
}
}
if (!this.projection && ProjectionNodeConstructor) {
this.projection = new ProjectionNodeConstructor(this.latestValues, this.parent && this.parent.projection);
const { layoutId, layout, drag, dragConstraints, layoutScroll, layoutRoot, } = renderedProps;
this.projection.setOptions({
layoutId,
layout,
alwaysMeasureLayout: Boolean(drag) ||
(dragConstraints && isRefObject(dragConstraints)),
visualElement: this,
scheduleRender: () => this.scheduleRender(),
/**
* TODO: Update options in an effect. This could be tricky as it'll be too late
* to update by the time layout animations run.
* We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
* ensuring it gets called if there's no potential layout animations.
*
*/
animationType: typeof layout === "string" ? layout : "both",
initialPromotionConfig: initialLayoutGroupConfig,
layoutScroll,
layoutRoot,
});
}
return MeasureLayout;
}
updateFeatures() {
for (const key in this.features) {
const feature = this.features[key];
if (feature.isMounted) {
feature.update();
}
else {
feature.mount();
feature.isMounted = true;
}
}
}
triggerBuild() {
this.build(this.renderState, this.latestValues, this.options, this.props);
}
/**
* Measure the current viewport box with or without transforms.
* Only measures axis-aligned boxes, rotate and skew must be manually
* removed with a re-render to work.
*/
measureViewportBox() {
return this.current
? this.measureInstanceViewportBox(this.current, this.props)
: createBox();
}
getStaticValue(key) {
return this.latestValues[key];
}
setStaticValue(key, value) {
this.latestValues[key] = value;
}
/**
* Make a target animatable by Popmotion. For instance, if we're
* trying to animate width from 100px to 100vw we need to measure 100vw
* in pixels to determine what we really need to animate to. This is also
* pluggable to support Framer's custom value types like Color,
* and CSS variables.
*/
makeTargetAnimatable(target, canMutate = true) {
return this.makeTargetAnimatableFromInstance(target, this.props, canMutate);
}
/**
* Update the provided props. Ensure any newly-added motion values are
* added to our map, old ones removed, and listeners updated.
*/
update(props, presenceContext) {
if (props.transformTemplate || this.props.transformTemplate) {
this.scheduleRender();
}
this.prevProps = this.props;
this.props = props;
this.prevPresenceContext = this.presenceContext;
this.presenceContext = presenceContext;
/**
* Update prop event handlers ie onAnimationStart, onAnimationComplete
*/
for (let i = 0; i < propEventHandlers.length; i++) {
const key = propEventHandlers[i];
if (this.propEventSubscriptions[key]) {
this.propEventSubscriptions[key]();
delete this.propEventSubscriptions[key];
}
const listener = props["on" + key];
if (listener) {
this.propEventSubscriptions[key] = this.on(key, listener);
}
}
this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(props, this.prevProps), this.prevMotionValues);
if (this.handleChildMotionValue) {
this.handleChildMotionValue();
}
}
getProps() {
return this.props;
}
/**
* Returns the variant definition with a given name.
*/
getVariant(name) {
return this.props.variants ? this.props.variants[name] : undefined;
}
/**
* Returns the defined default transition on this component.
*/
getDefaultTransition() {
return this.props.transition;
}
getTransformPagePoint() {
return this.props.transformPagePoint;
}
getClosestVariantNode() {
return this.isVariantNode
? this
: this.parent
? this.parent.getClosestVariantNode()
: undefined;
}
getVariantContext(startAtParent = false) {
if (startAtParent) {
return this.parent ? this.parent.getVariantContext() : undefined;
}
if (!this.isControllingVariants) {
const context = this.parent
? this.parent.getVariantContext() || {}
: {};
if (this.props.initial !== undefined) {
context.initial = this.props.initial;
}
return context;
}
const context = {};
for (let i = 0; i < numVariantProps; i++) {
const name = variantProps[i];
const prop = this.props[name];
if (isVariantLabel(prop) || prop === false) {
context[name] = prop;
}
}
return context;
}
/**
* Add a child visual element to our set of children.
*/
addVariantChild(child) {
const closestVariantNode = this.getClosestVariantNode();
if (closestVariantNode) {
closestVariantNode.variantChildren &&
closestVariantNode.variantChildren.add(child);
return () => closestVariantNode.variantChildren.delete(child);
}
}
/**
* Add a motion value and bind it to this visual element.
*/
addValue(key, value) {
// Remove existing value if it exists
if (value !== this.values.get(key)) {
this.removeValue(key);
this.bindToMotionValue(key, value);
}
this.values.set(key, value);
this.latestValues[key] = value.get();
}
/**
* Remove a motion value and unbind any active subscriptions.
*/
removeValue(key) {
this.values.delete(key);
const unsubscribe = this.valueSubscriptions.get(key);
if (unsubscribe) {
unsubscribe();
this.valueSubscriptions.delete(key);
}
delete this.latestValues[key];
this.removeValueFromRenderState(key, this.renderState);
}
/**
* Check whether we have a motion value for this key
*/
hasValue(key) {
return this.values.has(key);
}
getValue(key, defaultValue) {
if (this.props.values && this.props.values[key]) {
return this.props.values[key];
}
let value = this.values.get(key);
if (value === undefined && defaultValue !== undefined) {
value = motionValue(defaultValue, { owner: this });
this.addValue(key, value);
}
return value;
}
/**
* If we're trying to animate to a previously unencountered value,
* we need to check for it in our state and as a last resort read it
* directly from the instance (which might have performance implications).
*/
readValue(key) {
var _a;
return this.latestValues[key] !== undefined || !this.current
? this.latestValues[key]
: (_a = this.getBaseTargetFromProps(this.props, key)) !== null && _a !== void 0 ? _a : this.readValueFromInstance(this.current, key, this.options);
}
/**
* Set the base target to later animate back to. This is currently
* only hydrated on creation and when we first read a value.
*/
setBaseTarget(key, value) {
this.baseTarget[key] = value;
}
/**
* Find the base target for a value thats been removed from all animation
* props.
*/
getBaseTarget(key) {
var _a;
const { initial } = this.props;
const valueFromInitial = typeof initial === "string" || typeof initial === "object"
? (_a = resolveVariantFromProps(this.props, initial)) === null || _a === void 0 ? void 0 : _a[key]
: undefined;
/**
* If this value still exists in the current initial variant, read that.
*/
if (initial && valueFromInitial !== undefined) {
return valueFromInitial;
}
/**
* Alternatively, if this VisualElement config has defined a getBaseTarget
* so we can read the value from an alternative source, try that.
*/
const target = this.getBaseTargetFromProps(this.props, key);
if (target !== undefined && !isMotionValue(target))
return target;
/**
* If the value was initially defined on initial, but it doesn't any more,
* return undefined. Otherwise return the value as initially read from the DOM.
*/
return this.initialValues[key] !== undefined &&
valueFromInitial === undefined
? undefined
: this.baseTarget[key];
}
on(eventName, callback) {
if (!this.events[eventName]) {
this.events[eventName] = new SubscriptionManager();
}
return this.events[eventName].add(callback);
}
notify(eventName, ...args) {
if (this.events[eventName]) {
this.events[eventName].notify(...args);
}
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/DOMVisualElement.mjs
class DOMVisualElement extends VisualElement {
sortInstanceNodePosition(a, b) {
/**
* compareDocumentPosition returns a bitmask, by using the bitwise &
* we're returning true if 2 in that bitmask is set to true. 2 is set
* to true if b preceeds a.
*/
return a.compareDocumentPosition(b) & 2 ? 1 : -1;
}
getBaseTargetFromProps(props, key) {
return props.style ? props.style[key] : undefined;
}
removeValueFromRenderState(key, { vars, style }) {
delete vars[key];
delete style[key];
}
makeTargetAnimatableFromInstance({ transition, transitionEnd, ...target }, { transformValues }, isMounted) {
let origin = getOrigin(target, transition || {}, this);
/**
* If Framer has provided a function to convert `Color` etc value types, convert them
*/
if (transformValues) {
if (transitionEnd)
transitionEnd = transformValues(transitionEnd);
if (target)
target = transformValues(target);
if (origin)
origin = transformValues(origin);
}
if (isMounted) {
checkTargetForNewValues(this, target, origin);
const parsed = parseDomVariant(this, target, origin, transitionEnd);
transitionEnd = parsed.transitionEnd;
target = parsed.target;
}
return {
transition,
transitionEnd,
...target,
};
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/HTMLVisualElement.mjs
function HTMLVisualElement_getComputedStyle(element) {
return window.getComputedStyle(element);
}
class HTMLVisualElement extends DOMVisualElement {
readValueFromInstance(instance, key) {
if (transformProps.has(key)) {
const defaultType = getDefaultValueType(key);
return defaultType ? defaultType.default || 0 : 0;
}
else {
const computedStyle = HTMLVisualElement_getComputedStyle(instance);
const value = (isCSSVariableName(key)
? computedStyle.getPropertyValue(key)
: computedStyle[key]) || 0;
return typeof value === "string" ? value.trim() : value;
}
}
measureInstanceViewportBox(instance, { transformPagePoint }) {
return measureViewportBox(instance, transformPagePoint);
}
build(renderState, latestValues, options, props) {
buildHTMLStyles(renderState, latestValues, options, props.transformTemplate);
}
scrapeMotionValuesFromProps(props, prevProps) {
return scrapeMotionValuesFromProps(props, prevProps);
}
handleChildMotionValue() {
if (this.childSubscription) {
this.childSubscription();
delete this.childSubscription;
}
const { children } = this.props;
if (isMotionValue(children)) {
this.childSubscription = children.on("change", (latest) => {
if (this.current)
this.current.textContent = `${latest}`;
});
}
}
renderInstance(instance, renderState, styleProp, projection) {
renderHTML(instance, renderState, styleProp, projection);
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/SVGVisualElement.mjs
class SVGVisualElement extends DOMVisualElement {
constructor() {
super(...arguments);
this.isSVGTag = false;
}
getBaseTargetFromProps(props, key) {
return props[key];
}
readValueFromInstance(instance, key) {
if (transformProps.has(key)) {
const defaultType = getDefaultValueType(key);
return defaultType ? defaultType.default || 0 : 0;
}
key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
return instance.getAttribute(key);
}
measureInstanceViewportBox() {
return createBox();
}
scrapeMotionValuesFromProps(props, prevProps) {
return scrape_motion_values_scrapeMotionValuesFromProps(props, prevProps);
}
build(renderState, latestValues, options, props) {
buildSVGAttrs(renderState, latestValues, options, this.isSVGTag, props.transformTemplate);
}
renderInstance(instance, renderState, styleProp, projection) {
renderSVG(instance, renderState, styleProp, projection);
}
mount(instance) {
this.isSVGTag = isSVGTag(instance.tagName);
super.mount(instance);
}
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/create-visual-element.mjs
const create_visual_element_createDomVisualElement = (Component, options) => {
return isSVGComponent(Component)
? new SVGVisualElement(options, { enableHardwareAcceleration: false })
: new HTMLVisualElement(options, { enableHardwareAcceleration: true });
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/layout.mjs
const layout = {
layout: {
ProjectionNode: HTMLProjectionNode,
MeasureLayout: MeasureLayout,
},
};
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/motion.mjs
const preloadedFeatures = {
...animations,
...gestureAnimations,
...drag,
...layout,
};
/**
* HTML & SVG components, optimised for use with gestures and animation. These can be used as
* drop-in replacements for any HTML & SVG component, all CSS & SVG properties are supported.
*
* @public
*/
const motion = /*@__PURE__*/ createMotionProxy((Component, config) => create_config_createDomMotionConfig(Component, config, preloadedFeatures, create_visual_element_createDomVisualElement));
/**
* Create a DOM `motion` component with the provided string. This is primarily intended
* as a full alternative to `motion` for consumers who have to support environments that don't
* support `Proxy`.
*
* ```javascript
* import { createDomMotionComponent } from "framer-motion"
*
* const motion = {
* div: createDomMotionComponent('div')
* }
* ```
*
* @public
*/
function createDomMotionComponent(key) {
return createMotionComponent(createDomMotionConfig(key, { forwardMotionProps: false }, preloadedFeatures, createDomVisualElement));
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-is-mounted.mjs
function useIsMounted() {
const isMounted = (0,external_React_.useRef)(false);
useIsomorphicLayoutEffect(() => {
isMounted.current = true;
return () => {
isMounted.current = false;
};
}, []);
return isMounted;
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-force-update.mjs
function use_force_update_useForceUpdate() {
const isMounted = useIsMounted();
const [forcedRenderCount, setForcedRenderCount] = (0,external_React_.useState)(0);
const forceRender = (0,external_React_.useCallback)(() => {
isMounted.current && setForcedRenderCount(forcedRenderCount + 1);
}, [forcedRenderCount]);
/**
* Defer this to the end of the next animation frame in case there are multiple
* synchronous calls.
*/
const deferredForceRender = (0,external_React_.useCallback)(() => frame_frame.postRender(forceRender), [forceRender]);
return [deferredForceRender, forcedRenderCount];
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs
/**
* Measurement functionality has to be within a separate component
* to leverage snapshot lifecycle.
*/
class PopChildMeasure extends external_React_.Component {
getSnapshotBeforeUpdate(prevProps) {
const element = this.props.childRef.current;
if (element && prevProps.isPresent && !this.props.isPresent) {
const size = this.props.sizeRef.current;
size.height = element.offsetHeight || 0;
size.width = element.offsetWidth || 0;
size.top = element.offsetTop;
size.left = element.offsetLeft;
}
return null;
}
/**
* Required with getSnapshotBeforeUpdate to stop React complaining.
*/
componentDidUpdate() { }
render() {
return this.props.children;
}
}
function PopChild({ children, isPresent }) {
const id = (0,external_React_.useId)();
const ref = (0,external_React_.useRef)(null);
const size = (0,external_React_.useRef)({
width: 0,
height: 0,
top: 0,
left: 0,
});
/**
* We create and inject a style block so we can apply this explicit
* sizing in a non-destructive manner by just deleting the style block.
*
* We can't apply size via render as the measurement happens
* in getSnapshotBeforeUpdate (post-render), likewise if we apply the
* styles directly on the DOM node, we might be overwriting
* styles set via the style prop.
*/
(0,external_React_.useInsertionEffect)(() => {
const { width, height, top, left } = size.current;
if (isPresent || !ref.current || !width || !height)
return;
ref.current.dataset.motionPopId = id;
const style = document.createElement("style");
document.head.appendChild(style);
if (style.sheet) {
style.sheet.insertRule(`
[data-motion-pop-id="${id}"] {
position: absolute !important;
width: ${width}px !important;
height: ${height}px !important;
top: ${top}px !important;
left: ${left}px !important;
}
`);
}
return () => {
document.head.removeChild(style);
};
}, [isPresent]);
return (external_React_.createElement(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size }, external_React_.cloneElement(children, { ref })));
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs
const PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, }) => {
const presenceChildren = useConstant(newChildrenMap);
const id = (0,external_React_.useId)();
const context = (0,external_React_.useMemo)(() => ({
id,
initial,
isPresent,
custom,
onExitComplete: (childId) => {
presenceChildren.set(childId, true);
for (const isComplete of presenceChildren.values()) {
if (!isComplete)
return; // can stop searching when any is incomplete
}
onExitComplete && onExitComplete();
},
register: (childId) => {
presenceChildren.set(childId, false);
return () => presenceChildren.delete(childId);
},
}),
/**
* If the presence of a child affects the layout of the components around it,
* we want to make a new context value to ensure they get re-rendered
* so they can detect that layout change.
*/
presenceAffectsLayout ? undefined : [isPresent]);
(0,external_React_.useMemo)(() => {
presenceChildren.forEach((_, key) => presenceChildren.set(key, false));
}, [isPresent]);
/**
* If there's no `motion` components to fire exit animations, we want to remove this
* component immediately.
*/
external_React_.useEffect(() => {
!isPresent &&
!presenceChildren.size &&
onExitComplete &&
onExitComplete();
}, [isPresent]);
if (mode === "popLayout") {
children = external_React_.createElement(PopChild, { isPresent: isPresent }, children);
}
return (external_React_.createElement(PresenceContext_PresenceContext.Provider, { value: context }, children));
};
function newChildrenMap() {
return new Map();
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-unmount-effect.mjs
function useUnmountEffect(callback) {
return (0,external_React_.useEffect)(() => () => callback(), []);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs
const getChildKey = (child) => child.key || "";
function updateChildLookup(children, allChildren) {
children.forEach((child) => {
const key = getChildKey(child);
allChildren.set(key, child);
});
}
function onlyElements(children) {
const filtered = [];
// We use forEach here instead of map as map mutates the component key by preprending `.$`
external_React_.Children.forEach(children, (child) => {
if ((0,external_React_.isValidElement)(child))
filtered.push(child);
});
return filtered;
}
/**
* `AnimatePresence` enables the animation of components that have been removed from the tree.
*
* When adding/removing more than a single child, every child **must** be given a unique `key` prop.
*
* Any `motion` components that have an `exit` property defined will animate out when removed from
* the tree.
*
* ```jsx
* import { motion, AnimatePresence } from 'framer-motion'
*
* export const Items = ({ items }) => (
* <AnimatePresence>
* {items.map(item => (
* <motion.div
* key={item.id}
* initial={{ opacity: 0 }}
* animate={{ opacity: 1 }}
* exit={{ opacity: 0 }}
* />
* ))}
* </AnimatePresence>
* )
* ```
*
* You can sequence exit animations throughout a tree using variants.
*
* If a child contains multiple `motion` components with `exit` props, it will only unmount the child
* once all `motion` components have finished animating out. Likewise, any components using
* `usePresence` all need to call `safeToRemove`.
*
* @public
*/
const AnimatePresence = ({ children, custom, initial = true, onExitComplete, exitBeforeEnter, presenceAffectsLayout = true, mode = "sync", }) => {
errors_invariant(!exitBeforeEnter, "Replace exitBeforeEnter with mode='wait'");
// We want to force a re-render once all exiting animations have finished. We
// either use a local forceRender function, or one from a parent context if it exists.
const forceRender = (0,external_React_.useContext)(LayoutGroupContext).forceRender || use_force_update_useForceUpdate()[0];
const isMounted = useIsMounted();
// Filter out any children that aren't ReactElements. We can only track ReactElements with a props.key
const filteredChildren = onlyElements(children);
let childrenToRender = filteredChildren;
const exitingChildren = (0,external_React_.useRef)(new Map()).current;
// Keep a living record of the children we're actually rendering so we
// can diff to figure out which are entering and exiting
const presentChildren = (0,external_React_.useRef)(childrenToRender);
// A lookup table to quickly reference components by key
const allChildren = (0,external_React_.useRef)(new Map()).current;
// If this is the initial component render, just deal with logic surrounding whether
// we play onMount animations or not.
const isInitialRender = (0,external_React_.useRef)(true);
useIsomorphicLayoutEffect(() => {
isInitialRender.current = false;
updateChildLookup(filteredChildren, allChildren);
presentChildren.current = childrenToRender;
});
useUnmountEffect(() => {
isInitialRender.current = true;
allChildren.clear();
exitingChildren.clear();
});
if (isInitialRender.current) {
return (external_React_.createElement(external_React_.Fragment, null, childrenToRender.map((child) => (external_React_.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, initial: initial ? undefined : false, presenceAffectsLayout: presenceAffectsLayout, mode: mode }, child)))));
}
// If this is a subsequent render, deal with entering and exiting children
childrenToRender = [...childrenToRender];
// Diff the keys of the currently-present and target children to update our
// exiting list.
const presentKeys = presentChildren.current.map(getChildKey);
const targetKeys = filteredChildren.map(getChildKey);
// Diff the present children with our target children and mark those that are exiting
const numPresent = presentKeys.length;
for (let i = 0; i < numPresent; i++) {
const key = presentKeys[i];
if (targetKeys.indexOf(key) === -1 && !exitingChildren.has(key)) {
exitingChildren.set(key, undefined);
}
}
// If we currently have exiting children, and we're deferring rendering incoming children
// until after all current children have exiting, empty the childrenToRender array
if (mode === "wait" && exitingChildren.size) {
childrenToRender = [];
}
// Loop through all currently exiting components and clone them to overwrite `animate`
// with any `exit` prop they might have defined.
exitingChildren.forEach((component, key) => {
// If this component is actually entering again, early return
if (targetKeys.indexOf(key) !== -1)
return;
const child = allChildren.get(key);
if (!child)
return;
const insertionIndex = presentKeys.indexOf(key);
let exitingComponent = component;
if (!exitingComponent) {
const onExit = () => {
allChildren.delete(key);
exitingChildren.delete(key);
// Remove this child from the present children
const removeIndex = presentChildren.current.findIndex((presentChild) => presentChild.key === key);
presentChildren.current.splice(removeIndex, 1);
// Defer re-rendering until all exiting children have indeed left
if (!exitingChildren.size) {
presentChildren.current = filteredChildren;
if (isMounted.current === false)
return;
forceRender();
onExitComplete && onExitComplete();
}
};
exitingComponent = (external_React_.createElement(PresenceChild, { key: getChildKey(child), isPresent: false, onExitComplete: onExit, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode }, child));
exitingChildren.set(key, exitingComponent);
}
childrenToRender.splice(insertionIndex, 0, exitingComponent);
});
// Add `MotionContext` even to children that don't need it to ensure we're rendering
// the same tree between renders
childrenToRender = childrenToRender.map((child) => {
const key = child.key;
return exitingChildren.has(key) ? (child) : (external_React_.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, presenceAffectsLayout: presenceAffectsLayout, mode: mode }, child));
});
if (false) {}
return (external_React_.createElement(external_React_.Fragment, null, exitingChildren.size
? childrenToRender
: childrenToRender.map((child) => (0,external_React_.cloneElement)(child))));
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/use-responsive-value.js
/**
* WordPress dependencies
*/
const breakpoints = ['40em', '52em', '64em'];
const useBreakpointIndex = (options = {}) => {
const {
defaultIndex = 0
} = options;
if (typeof defaultIndex !== 'number') {
throw new TypeError(`Default breakpoint index should be a number. Got: ${defaultIndex}, ${typeof defaultIndex}`);
} else if (defaultIndex < 0 || defaultIndex > breakpoints.length - 1) {
throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);
}
const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(defaultIndex);
(0,external_wp_element_namespaceObject.useEffect)(() => {
const getIndex = () => breakpoints.filter(bp => {
return typeof window !== 'undefined' ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false;
}).length;
const onResize = () => {
const newValue = getIndex();
if (value !== newValue) {
setValue(newValue);
}
};
onResize();
if (typeof window !== 'undefined') {
window.addEventListener('resize', onResize);
}
return () => {
if (typeof window !== 'undefined') {
window.removeEventListener('resize', onResize);
}
};
}, [value]);
return value;
};
function useResponsiveValue(values, options = {}) {
const index = useBreakpointIndex(options);
// Allow calling the function with a "normal" value without having to check on the outside.
if (!Array.isArray(values) && typeof values !== 'function') return values;
const array = values || [];
/* eslint-disable jsdoc/no-undefined-types */
return /** @type {T[]} */array[/* eslint-enable jsdoc/no-undefined-types */
index >= array.length ? array.length - 1 : index];
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/space.js
/**
* The argument value for the `space()` utility function.
*
* When this is a number or a numeric string, it will be interpreted as a
* multiplier for the grid base value (4px). For example, `space( 2 )` will be 8px.
*
* Otherwise, it will be interpreted as a literal CSS length value. For example,
* `space( 'auto' )` will be 'auto', and `space( '2px' )` will be 2px.
*/
const GRID_BASE = '4px';
/**
* A function that handles numbers, numeric strings, and unit values.
*
* When given a number or a numeric string, it will return the grid-based
* value as a factor of GRID_BASE, defined above.
*
* When given a unit value or one of the named CSS values like `auto`,
* it will simply return the value back.
*
* @param value A number, numeric string, or a unit value.
*/
function space(value) {
if (typeof value === 'undefined') {
return undefined;
}
// Handle empty strings, if it's the number 0 this still works.
if (!value) {
return '0';
}
const asInt = typeof value === 'number' ? value : Number(value);
// Test if the input has a unit, was NaN, or was one of the named CSS values (like `auto`), in which case just use that value.
if (typeof window !== 'undefined' && window.CSS?.supports?.('margin', value.toString()) || Number.isNaN(asInt)) {
return value.toString();
}
return `calc(${GRID_BASE} * ${value})`;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/styles.js
function styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
const Flex = true ? {
name: "zjik7",
styles: "display:flex"
} : 0;
const Item = true ? {
name: "qgaee5",
styles: "display:block;max-height:100%;max-width:100%;min-height:0;min-width:0"
} : 0;
const block = true ? {
name: "82a6rk",
styles: "flex:1"
} : 0;
/**
* Workaround to optimize DOM rendering.
* We'll enhance alignment with naive parent flex assumptions.
*
* Trade-off:
* Far less DOM less. However, UI rendering is not as reliable.
*/
/**
* Improves stability of width/height rendering.
* https://github.com/ItsJonQ/g2/pull/149
*/
const ItemsColumn = true ? {
name: "13nosa1",
styles: ">*{min-height:0;}"
} : 0;
const ItemsRow = true ? {
name: "1pwxzk4",
styles: ">*{min-width:0;}"
} : 0;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex/hook.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useDeprecatedProps(props) {
const {
isReversed,
...otherProps
} = props;
if (typeof isReversed !== 'undefined') {
external_wp_deprecated_default()('Flex isReversed', {
alternative: 'Flex direction="row-reverse" or "column-reverse"',
since: '5.9'
});
return {
...otherProps,
direction: isReversed ? 'row-reverse' : 'row'
};
}
return otherProps;
}
function useFlex(props) {
const {
align,
className,
direction: directionProp = 'row',
expanded = true,
gap = 2,
justify = 'space-between',
wrap = false,
...otherProps
} = useContextSystem(useDeprecatedProps(props), 'Flex');
const directionAsArray = Array.isArray(directionProp) ? directionProp : [directionProp];
const direction = useResponsiveValue(directionAsArray);
const isColumn = typeof direction === 'string' && !!direction.includes('column');
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
const base = /*#__PURE__*/emotion_react_browser_esm_css({
alignItems: align !== null && align !== void 0 ? align : isColumn ? 'normal' : 'center',
flexDirection: direction,
flexWrap: wrap ? 'wrap' : undefined,
gap: space(gap),
justifyContent: justify,
height: isColumn && expanded ? '100%' : undefined,
width: !isColumn && expanded ? '100%' : undefined
}, true ? "" : 0, true ? "" : 0);
return cx(Flex, base, isColumn ? ItemsColumn : ItemsRow, className);
}, [align, className, cx, direction, expanded, gap, isColumn, justify, wrap]);
return {
...otherProps,
className: classes,
isColumn
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/context.js
/**
* WordPress dependencies
*/
const FlexContext = (0,external_wp_element_namespaceObject.createContext)({
flexItemDisplay: undefined
});
const useFlexContext = () => (0,external_wp_element_namespaceObject.useContext)(FlexContext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedFlex(props, forwardedRef) {
const {
children,
isColumn,
...otherProps
} = useFlex(props);
return (0,external_React_.createElement)(FlexContext.Provider, {
value: {
flexItemDisplay: isColumn ? 'block' : undefined
}
}, (0,external_React_.createElement)(component, {
...otherProps,
ref: forwardedRef
}, children));
}
/**
* `Flex` is a primitive layout component that adaptively aligns child content
* horizontally or vertically. `Flex` powers components like `HStack` and
* `VStack`.
*
* `Flex` is used with any of its two sub-components, `FlexItem` and
* `FlexBlock`.
*
* ```jsx
* import { Flex, FlexBlock, FlexItem } from '@wordpress/components';
*
* function Example() {
* return (
* <Flex>
* <FlexItem>
* <p>Code</p>
* </FlexItem>
* <FlexBlock>
* <p>Poetry</p>
* </FlexBlock>
* </Flex>
* );
* }
* ```
*/
const component_Flex = contextConnect(UnconnectedFlex, 'Flex');
/* harmony default export */ const flex_component = (component_Flex);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-item/hook.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function useFlexItem(props) {
const {
className,
display: displayProp,
isBlock = false,
...otherProps
} = useContextSystem(props, 'FlexItem');
const sx = {};
const contextDisplay = useFlexContext().flexItemDisplay;
sx.Base = /*#__PURE__*/emotion_react_browser_esm_css({
display: displayProp || contextDisplay
}, true ? "" : 0, true ? "" : 0);
const cx = useCx();
const classes = cx(Item, sx.Base, isBlock && block, className);
return {
...otherProps,
className: classes
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-block/hook.js
/**
* Internal dependencies
*/
function useFlexBlock(props) {
const otherProps = useContextSystem(props, 'FlexBlock');
const flexItemProps = useFlexItem({
isBlock: true,
...otherProps
});
return flexItemProps;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-block/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedFlexBlock(props, forwardedRef) {
const flexBlockProps = useFlexBlock(props);
return (0,external_React_.createElement)(component, {
...flexBlockProps,
ref: forwardedRef
});
}
/**
* `FlexBlock` is a primitive layout component that adaptively resizes content
* within layout containers like `Flex`.
*
* ```jsx
* import { Flex, FlexBlock } from '@wordpress/components';
*
* function Example() {
* return (
* <Flex>
* <FlexBlock>...</FlexBlock>
* </Flex>
* );
* }
* ```
*/
const FlexBlock = contextConnect(UnconnectedFlexBlock, 'FlexBlock');
/* harmony default export */ const flex_block_component = (FlexBlock);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/rtl.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const LOWER_LEFT_REGEXP = new RegExp(/-left/g);
const LOWER_RIGHT_REGEXP = new RegExp(/-right/g);
const UPPER_LEFT_REGEXP = new RegExp(/Left/g);
const UPPER_RIGHT_REGEXP = new RegExp(/Right/g);
/**
* Flips a CSS property from left <-> right.
*
* @param {string} key The CSS property name.
*
* @return {string} The flipped CSS property name, if applicable.
*/
function getConvertedKey(key) {
if (key === 'left') {
return 'right';
}
if (key === 'right') {
return 'left';
}
if (LOWER_LEFT_REGEXP.test(key)) {
return key.replace(LOWER_LEFT_REGEXP, '-right');
}
if (LOWER_RIGHT_REGEXP.test(key)) {
return key.replace(LOWER_RIGHT_REGEXP, '-left');
}
if (UPPER_LEFT_REGEXP.test(key)) {
return key.replace(UPPER_LEFT_REGEXP, 'Right');
}
if (UPPER_RIGHT_REGEXP.test(key)) {
return key.replace(UPPER_RIGHT_REGEXP, 'Left');
}
return key;
}
/**
* An incredibly basic ltr -> rtl converter for style properties
*
* @param {import('react').CSSProperties} ltrStyles
*
* @return {import('react').CSSProperties} Converted ltr -> rtl styles
*/
const convertLTRToRTL = (ltrStyles = {}) => {
return Object.fromEntries(Object.entries(ltrStyles).map(([key, value]) => [getConvertedKey(key), value]));
};
/**
* A higher-order function that create an incredibly basic ltr -> rtl style converter for CSS objects.
*
* @param {import('react').CSSProperties} ltrStyles Ltr styles. Converts and renders from ltr -> rtl styles, if applicable.
* @param {import('react').CSSProperties} [rtlStyles] Rtl styles. Renders if provided.
*
* @return {() => import('@emotion/react').SerializedStyles} A function to output CSS styles for Emotion's renderer
*/
function rtl(ltrStyles = {}, rtlStyles) {
return () => {
if (rtlStyles) {
// @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css
return (0,external_wp_i18n_namespaceObject.isRTL)() ? /*#__PURE__*/emotion_react_browser_esm_css(rtlStyles, true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css(ltrStyles, true ? "" : 0);
}
// @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css
return (0,external_wp_i18n_namespaceObject.isRTL)() ? /*#__PURE__*/emotion_react_browser_esm_css(convertLTRToRTL(ltrStyles), true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css(ltrStyles, true ? "" : 0);
};
}
/**
* Call this in the `useMemo` dependency array to ensure that subsequent renders will
* cause rtl styles to update based on the `isRTL` return value even if all other dependencies
* remain the same.
*
* @example
* const styles = useMemo( () => {
* return css`
* ${ rtl( { marginRight: '10px' } ) }
* `;
* }, [ rtl.watch() ] );
*/
rtl.watch = () => (0,external_wp_i18n_namespaceObject.isRTL)();
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spacer/hook.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const isDefined = o => typeof o !== 'undefined' && o !== null;
function useSpacer(props) {
const {
className,
margin,
marginBottom = 2,
marginLeft,
marginRight,
marginTop,
marginX,
marginY,
padding,
paddingBottom,
paddingLeft,
paddingRight,
paddingTop,
paddingX,
paddingY,
...otherProps
} = useContextSystem(props, 'Spacer');
const cx = useCx();
const classes = cx(isDefined(margin) && /*#__PURE__*/emotion_react_browser_esm_css("margin:", space(margin), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginY) && /*#__PURE__*/emotion_react_browser_esm_css("margin-bottom:", space(marginY), ";margin-top:", space(marginY), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginX) && /*#__PURE__*/emotion_react_browser_esm_css("margin-left:", space(marginX), ";margin-right:", space(marginX), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginTop) && /*#__PURE__*/emotion_react_browser_esm_css("margin-top:", space(marginTop), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginBottom) && /*#__PURE__*/emotion_react_browser_esm_css("margin-bottom:", space(marginBottom), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(marginLeft) && rtl({
marginLeft: space(marginLeft)
})(), isDefined(marginRight) && rtl({
marginRight: space(marginRight)
})(), isDefined(padding) && /*#__PURE__*/emotion_react_browser_esm_css("padding:", space(padding), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingY) && /*#__PURE__*/emotion_react_browser_esm_css("padding-bottom:", space(paddingY), ";padding-top:", space(paddingY), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingX) && /*#__PURE__*/emotion_react_browser_esm_css("padding-left:", space(paddingX), ";padding-right:", space(paddingX), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingTop) && /*#__PURE__*/emotion_react_browser_esm_css("padding-top:", space(paddingTop), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingBottom) && /*#__PURE__*/emotion_react_browser_esm_css("padding-bottom:", space(paddingBottom), ";" + ( true ? "" : 0), true ? "" : 0), isDefined(paddingLeft) && rtl({
paddingLeft: space(paddingLeft)
})(), isDefined(paddingRight) && rtl({
paddingRight: space(paddingRight)
})(), className);
return {
...otherProps,
className: classes
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spacer/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedSpacer(props, forwardedRef) {
const spacerProps = useSpacer(props);
return (0,external_React_.createElement)(component, {
...spacerProps,
ref: forwardedRef
});
}
/**
* `Spacer` is a primitive layout component that providers inner (`padding`) or outer (`margin`) space in-between components. It can also be used to adaptively provide space within an `HStack` or `VStack`.
*
* `Spacer` comes with a bunch of shorthand props to adjust `margin` and `padding`. The values of these props
* can either be a number (which will act as a multiplier to the library's grid system base of 4px),
* or a literal CSS value string.
*
* ```jsx
* import { Spacer } from `@wordpress/components`
*
* function Example() {
* return (
* <View>
* <Spacer>
* <Heading>WordPress.org</Heading>
* </Spacer>
* <Text>
* Code is Poetry
* </Text>
* </View>
* );
* }
* ```
*/
const Spacer = contextConnect(UnconnectedSpacer, 'Spacer');
/* harmony default export */ const spacer_component = (Spacer);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
/**
* WordPress dependencies
*/
const plus = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"
}));
/* harmony default export */ const library_plus = (plus);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/reset.js
/**
* WordPress dependencies
*/
const reset_reset = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M7 11.5h10V13H7z"
}));
/* harmony default export */ const library_reset = (reset_reset);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-item/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedFlexItem(props, forwardedRef) {
const flexItemProps = useFlexItem(props);
return (0,external_React_.createElement)(component, {
...flexItemProps,
ref: forwardedRef
});
}
/**
* `FlexItem` is a primitive layout component that aligns content within layout
* containers like `Flex`.
*
* ```jsx
* import { Flex, FlexItem } from '@wordpress/components';
*
* function Example() {
* return (
* <Flex>
* <FlexItem>...</FlexItem>
* </Flex>
* );
* }
* ```
*/
const FlexItem = contextConnect(UnconnectedFlexItem, 'FlexItem');
/* harmony default export */ const flex_item_component = (FlexItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/styles.js
function truncate_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
const Truncate = true ? {
name: "hdknak",
styles: "display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"
} : 0;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/values.js
/* eslint-disable jsdoc/valid-types */
/**
* Determines if a value is null or undefined.
*
* @template T
*
* @param {T} value The value to check.
* @return {value is Exclude<T, null | undefined>} Whether value is not null or undefined.
*/
function isValueDefined(value) {
return value !== undefined && value !== null;
}
/* eslint-enable jsdoc/valid-types */
/* eslint-disable jsdoc/valid-types */
/**
* Determines if a value is empty, null, or undefined.
*
* @param {string | number | null | undefined} value The value to check.
* @return {value is ("" | null | undefined)} Whether value is empty.
*/
function isValueEmpty(value) {
const isEmptyString = value === '';
return !isValueDefined(value) || isEmptyString;
}
/* eslint-enable jsdoc/valid-types */
/**
* Get the first defined/non-null value from an array.
*
* @template T
*
* @param {Array<T | null | undefined>} values Values to derive from.
* @param {T} fallbackValue Fallback value if there are no defined values.
* @return {T} A defined value or the fallback value.
*/
function getDefinedValue(values = [], fallbackValue) {
var _values$find;
return (_values$find = values.find(isValueDefined)) !== null && _values$find !== void 0 ? _values$find : fallbackValue;
}
/**
* Converts a string to a number.
*
* @param {string} value
* @return {number} String as a number.
*/
const stringToNumber = value => {
return parseFloat(value);
};
/**
* Regardless of the input being a string or a number, returns a number.
*
* Returns `undefined` in case the string is `undefined` or not a valid numeric value.
*
* @param {string | number} value
* @return {number} The parsed number.
*/
const ensureNumber = value => {
return typeof value === 'string' ? stringToNumber(value) : value;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/utils.js
/**
* Internal dependencies
*/
const TRUNCATE_ELLIPSIS = '…';
const TRUNCATE_TYPE = {
auto: 'auto',
head: 'head',
middle: 'middle',
tail: 'tail',
none: 'none'
};
const TRUNCATE_DEFAULT_PROPS = {
ellipsis: TRUNCATE_ELLIPSIS,
ellipsizeMode: TRUNCATE_TYPE.auto,
limit: 0,
numberOfLines: 0
};
// Source
// https://github.com/kahwee/truncate-middle
function truncateMiddle(word, headLength, tailLength, ellipsis) {
if (typeof word !== 'string') {
return '';
}
const wordLength = word.length;
// Setting default values
// eslint-disable-next-line no-bitwise
const frontLength = ~~headLength; // Will cast to integer
// eslint-disable-next-line no-bitwise
const backLength = ~~tailLength;
/* istanbul ignore next */
const truncateStr = isValueDefined(ellipsis) ? ellipsis : TRUNCATE_ELLIPSIS;
if (frontLength === 0 && backLength === 0 || frontLength >= wordLength || backLength >= wordLength || frontLength + backLength >= wordLength) {
return word;
} else if (backLength === 0) {
return word.slice(0, frontLength) + truncateStr;
}
return word.slice(0, frontLength) + truncateStr + word.slice(wordLength - backLength);
}
function truncateContent(words = '', props) {
const mergedProps = {
...TRUNCATE_DEFAULT_PROPS,
...props
};
const {
ellipsis,
ellipsizeMode,
limit
} = mergedProps;
if (ellipsizeMode === TRUNCATE_TYPE.none) {
return words;
}
let truncateHead;
let truncateTail;
switch (ellipsizeMode) {
case TRUNCATE_TYPE.head:
truncateHead = 0;
truncateTail = limit;
break;
case TRUNCATE_TYPE.middle:
truncateHead = Math.floor(limit / 2);
truncateTail = Math.floor(limit / 2);
break;
default:
truncateHead = limit;
truncateTail = 0;
}
const truncatedContent = ellipsizeMode !== TRUNCATE_TYPE.auto ? truncateMiddle(words, truncateHead, truncateTail, ellipsis) : words;
return truncatedContent;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/hook.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useTruncate(props) {
const {
className,
children,
ellipsis = TRUNCATE_ELLIPSIS,
ellipsizeMode = TRUNCATE_TYPE.auto,
limit = 0,
numberOfLines = 0,
...otherProps
} = useContextSystem(props, 'Truncate');
const cx = useCx();
let childrenAsText;
if (typeof children === 'string') {
childrenAsText = children;
} else if (typeof children === 'number') {
childrenAsText = children.toString();
}
const truncatedContent = childrenAsText ? truncateContent(childrenAsText, {
ellipsis,
ellipsizeMode,
limit,
numberOfLines
}) : children;
const shouldTruncate = !!childrenAsText && ellipsizeMode === TRUNCATE_TYPE.auto;
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
const truncateLines = /*#__PURE__*/emotion_react_browser_esm_css("-webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + ( true ? "" : 0), true ? "" : 0);
return cx(shouldTruncate && !numberOfLines && Truncate, shouldTruncate && !!numberOfLines && truncateLines, className);
}, [className, cx, numberOfLines, shouldTruncate]);
return {
...otherProps,
className: classes,
children: truncatedContent
};
}
;// 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},colord_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},colord_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},colord_a=function(r){return{r:colord_e(r.r,0,255),g:colord_e(r.g,0,255),b:colord_e(r.b,0,255),a:colord_e(r.a)}},colord_o=function(r){return{r:colord_n(r.r),g:colord_n(r.g),b:colord_n(r.b),a:colord_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:colord_e(r.s,0,100),l:colord_e(r.l,0,100),a:colord_e(r.a)}},d=function(r){return{h:colord_n(r.h),s:colord_n(r.s),l:colord_n(r.l),a:colord_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?colord_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?colord_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:colord_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)?colord_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:colord_e(r.s,0,100),v:colord_e(r.v,0,100),a:colord_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<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:colord_e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:colord_e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return colord_n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=colord_o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(colord_n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return colord_o(this.rgba)},r.prototype.toRgbString=function(){return r=colord_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:colord_n(r.h),s:colord_n(r.s),v:colord_n(r.v),a:colord_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}):colord_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}):colord_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));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/colors.js
/**
* External dependencies
*/
/** @type {HTMLDivElement} */
let colorComputationNode;
k([names]);
/**
* Generating a CSS compliant rgba() color value.
*
* @param {string} hexValue The hex value to convert to rgba().
* @param {number} alpha The alpha value for opacity.
* @return {string} The converted rgba() color value.
*
* @example
* rgba( '#000000', 0.5 )
* // rgba(0, 0, 0, 0.5)
*/
function colors_rgba(hexValue = '', alpha = 1) {
return colord(hexValue).alpha(alpha).toRgbString();
}
/**
* @return {HTMLDivElement | undefined} The HTML element for color computation.
*/
function getColorComputationNode() {
if (typeof document === 'undefined') return;
if (!colorComputationNode) {
// Create a temporary element for style computation.
const el = document.createElement('div');
el.setAttribute('data-g2-color-computation-node', '');
// Inject for window computed style.
document.body.appendChild(el);
colorComputationNode = el;
}
return colorComputationNode;
}
/**
* @param {string | unknown} value
*
* @return {boolean} Whether the value is a valid color.
*/
function isColor(value) {
if (typeof value !== 'string') return false;
const test = w(value);
return test.isValid();
}
/**
* Retrieves the computed background color. This is useful for getting the
* value of a CSS variable color.
*
* @param {string | unknown} backgroundColor The background color to compute.
*
* @return {string} The computed background color.
*/
function _getComputedBackgroundColor(backgroundColor) {
if (typeof backgroundColor !== 'string') return '';
if (isColor(backgroundColor)) return backgroundColor;
if (!backgroundColor.includes('var(')) return '';
if (typeof document === 'undefined') return '';
// Attempts to gracefully handle CSS variables color values.
const el = getColorComputationNode();
if (!el) return '';
el.style.background = backgroundColor;
// Grab the style.
const computedColor = window?.getComputedStyle(el).background;
// Reset.
el.style.background = '';
return computedColor || '';
}
const getComputedBackgroundColor = memize(_getComputedBackgroundColor);
/**
* Get the text shade optimized for readability, based on a background color.
*
* @param {string | unknown} backgroundColor The background color.
*
* @return {string} The optimized text color (black or white).
*/
function getOptimalTextColor(backgroundColor) {
const background = getComputedBackgroundColor(backgroundColor);
return w(background).isLight() ? '#000000' : '#ffffff';
}
/**
* Get the text shade optimized for readability, based on a background color.
*
* @param {string | unknown} backgroundColor The background color.
*
* @return {string} The optimized text shade (dark or light).
*/
function getOptimalTextShade(backgroundColor) {
const result = getOptimalTextColor(backgroundColor);
return result === '#000000' ? 'dark' : 'light';
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/config-values.js
/**
* Internal dependencies
*/
const CONTROL_HEIGHT = '36px';
const CONTROL_PADDING_X = '12px';
const CONTROL_PROPS = {
controlSurfaceColor: COLORS.white,
controlTextActiveColor: COLORS.theme.accent,
controlPaddingX: CONTROL_PADDING_X,
controlPaddingXLarge: `calc(${CONTROL_PADDING_X} * 1.3334)`,
controlPaddingXSmall: `calc(${CONTROL_PADDING_X} / 1.3334)`,
controlBackgroundColor: COLORS.white,
controlBorderRadius: '2px',
controlBoxShadow: 'transparent',
controlBoxShadowFocus: `0 0 0 0.5px ${COLORS.theme.accent}`,
controlDestructiveBorderColor: COLORS.alert.red,
controlHeight: CONTROL_HEIGHT,
controlHeightXSmall: `calc( ${CONTROL_HEIGHT} * 0.6 )`,
controlHeightSmall: `calc( ${CONTROL_HEIGHT} * 0.8 )`,
controlHeightLarge: `calc( ${CONTROL_HEIGHT} * 1.2 )`,
controlHeightXLarge: `calc( ${CONTROL_HEIGHT} * 1.4 )`
};
const TOGGLE_GROUP_CONTROL_PROPS = {
toggleGroupControlBackgroundColor: CONTROL_PROPS.controlBackgroundColor,
toggleGroupControlBorderColor: COLORS.ui.border,
toggleGroupControlBackdropBackgroundColor: CONTROL_PROPS.controlSurfaceColor,
toggleGroupControlBackdropBorderColor: COLORS.ui.border,
toggleGroupControlButtonColorActive: CONTROL_PROPS.controlBackgroundColor
};
// Using Object.assign to avoid creating circular references when emitting
// TypeScript type declarations.
/* harmony default export */ const config_values = (Object.assign({}, CONTROL_PROPS, TOGGLE_GROUP_CONTROL_PROPS, {
colorDivider: 'rgba(0, 0, 0, 0.1)',
colorScrollbarThumb: 'rgba(0, 0, 0, 0.2)',
colorScrollbarThumbHover: 'rgba(0, 0, 0, 0.5)',
colorScrollbarTrack: 'rgba(0, 0, 0, 0.04)',
elevationIntensity: 1,
radiusBlockUi: '2px',
borderWidth: '1px',
borderWidthFocus: '1.5px',
borderWidthTab: '4px',
spinnerSize: 16,
fontSize: '13px',
fontSizeH1: 'calc(2.44 * 13px)',
fontSizeH2: 'calc(1.95 * 13px)',
fontSizeH3: 'calc(1.56 * 13px)',
fontSizeH4: 'calc(1.25 * 13px)',
fontSizeH5: '13px',
fontSizeH6: 'calc(0.8 * 13px)',
fontSizeInputMobile: '16px',
fontSizeMobile: '15px',
fontSizeSmall: 'calc(0.92 * 13px)',
fontSizeXSmall: 'calc(0.75 * 13px)',
fontLineHeightBase: '1.2',
fontWeight: 'normal',
fontWeightHeading: '600',
gridBase: '4px',
cardBorderRadius: '2px',
cardPaddingXSmall: `${space(2)}`,
cardPaddingSmall: `${space(4)}`,
cardPaddingMedium: `${space(4)} ${space(6)}`,
cardPaddingLarge: `${space(6)} ${space(8)}`,
popoverShadow: `0 0.7px 1px rgba(0, 0, 0, 0.1), 0 1.2px 1.7px -0.2px rgba(0, 0, 0, 0.1), 0 2.3px 3.3px -0.5px rgba(0, 0, 0, 0.1)`,
surfaceBackgroundColor: COLORS.white,
surfaceBackgroundSubtleColor: '#F3F3F3',
surfaceBackgroundTintColor: '#F5F5F5',
surfaceBorderColor: 'rgba(0, 0, 0, 0.1)',
surfaceBorderBoldColor: 'rgba(0, 0, 0, 0.15)',
surfaceBorderSubtleColor: 'rgba(0, 0, 0, 0.05)',
surfaceBackgroundTertiaryColor: COLORS.white,
surfaceColor: COLORS.white,
transitionDuration: '200ms',
transitionDurationFast: '160ms',
transitionDurationFaster: '120ms',
transitionDurationFastest: '100ms',
transitionTimingFunction: 'cubic-bezier(0.08, 0.52, 0.52, 1)',
transitionTimingFunctionControl: 'cubic-bezier(0.12, 0.8, 0.32, 1)'
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/styles.js
function text_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const Text = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.gray[900], ";line-height:", config_values.fontLineHeightBase, ";margin:0;" + ( true ? "" : 0), true ? "" : 0);
const styles_block = true ? {
name: "4zleql",
styles: "display:block"
} : 0;
const positive = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.alert.green, ";" + ( true ? "" : 0), true ? "" : 0);
const destructive = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.alert.red, ";" + ( true ? "" : 0), true ? "" : 0);
const muted = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.gray[700], ";" + ( true ? "" : 0), true ? "" : 0);
const highlighterText = /*#__PURE__*/emotion_react_browser_esm_css("mark{background:", COLORS.alert.yellow, ";border-radius:2px;box-shadow:0 0 0 1px rgba( 0, 0, 0, 0.05 ) inset,0 -1px 0 rgba( 0, 0, 0, 0.1 ) inset;}" + ( true ? "" : 0), true ? "" : 0);
const upperCase = true ? {
name: "50zrmy",
styles: "text-transform:uppercase"
} : 0;
// EXTERNAL MODULE: ./node_modules/highlight-words-core/dist/index.js
var dist = __webpack_require__(9664);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Source:
* https://github.com/bvaughn/react-highlight-words/blob/HEAD/src/Highlighter.js
*/
/**
* @typedef Options
* @property {string} [activeClassName=''] Classname for active highlighted areas.
* @property {number} [activeIndex=-1] The index of the active highlighted area.
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [activeStyle] Styles to apply to the active highlighted area.
* @property {boolean} [autoEscape] Whether to automatically escape text.
* @property {boolean} [caseSensitive=false] Whether to highlight in a case-sensitive manner.
* @property {string} children Children to highlight.
* @property {import('highlight-words-core').FindAllArgs['findChunks']} [findChunks] Custom `findChunks` function to pass to `highlight-words-core`.
* @property {string | Record<string, unknown>} [highlightClassName=''] Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key).
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [highlightStyle={}] Styles to apply to highlighted text.
* @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text.
* @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `santize` function to pass to `highlight-words-core`.
* @property {string[]} [searchWords=[]] Words to search for and highlight.
* @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text.
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [unhighlightStyle] Style to apply to unhighlighted text.
*/
/**
* Maps props to lowercase names.
*
* @param object Props to map.
* @return The mapped props.
*/
const lowercaseProps = object => {
const mapped = {};
for (const key in object) {
mapped[key.toLowerCase()] = object[key];
}
return mapped;
};
const memoizedLowercaseProps = memize(lowercaseProps);
/**
* @param options
* @param options.activeClassName
* @param options.activeIndex
* @param options.activeStyle
* @param options.autoEscape
* @param options.caseSensitive
* @param options.children
* @param options.findChunks
* @param options.highlightClassName
* @param options.highlightStyle
* @param options.highlightTag
* @param options.sanitize
* @param options.searchWords
* @param options.unhighlightClassName
* @param options.unhighlightStyle
*/
function createHighlighterText({
activeClassName = '',
activeIndex = -1,
activeStyle,
autoEscape,
caseSensitive = false,
children,
findChunks,
highlightClassName = '',
highlightStyle = {},
highlightTag = 'mark',
sanitize,
searchWords = [],
unhighlightClassName = '',
unhighlightStyle
}) {
if (!children) return null;
if (typeof children !== 'string') return children;
const textToHighlight = children;
const chunks = (0,dist.findAll)({
autoEscape,
caseSensitive,
findChunks,
sanitize,
searchWords,
textToHighlight
});
const HighlightTag = highlightTag;
let highlightIndex = -1;
let highlightClassNames = '';
let highlightStyles;
const textContent = chunks.map((chunk, index) => {
const text = textToHighlight.substr(chunk.start, chunk.end - chunk.start);
if (chunk.highlight) {
highlightIndex++;
let highlightClass;
if (typeof highlightClassName === 'object') {
if (!caseSensitive) {
highlightClassName = memoizedLowercaseProps(highlightClassName);
highlightClass = highlightClassName[text.toLowerCase()];
} else {
highlightClass = highlightClassName[text];
}
} else {
highlightClass = highlightClassName;
}
const isActive = highlightIndex === +activeIndex;
highlightClassNames = `${highlightClass} ${isActive ? activeClassName : ''}`;
highlightStyles = isActive === true && activeStyle !== null ? Object.assign({}, highlightStyle, activeStyle) : highlightStyle;
const props = {
children: text,
className: highlightClassNames,
key: index,
style: highlightStyles
};
// Don't attach arbitrary props to DOM elements; this triggers React DEV warnings (https://fb.me/react-unknown-prop)
// Only pass through the highlightIndex attribute for custom components.
if (typeof HighlightTag !== 'string') {
props.highlightIndex = highlightIndex;
}
return (0,external_wp_element_namespaceObject.createElement)(HighlightTag, props);
}
return (0,external_wp_element_namespaceObject.createElement)('span', {
children: text,
className: unhighlightClassName,
key: index,
style: unhighlightStyle
});
});
return textContent;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/font-size.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const BASE_FONT_SIZE = 13;
const PRESET_FONT_SIZES = {
body: BASE_FONT_SIZE,
caption: 10,
footnote: 11,
largeTitle: 28,
subheadline: 12,
title: 20
};
const HEADING_FONT_SIZES = [1, 2, 3, 4, 5, 6].flatMap(n => [n, n.toString()]);
function getFontSize(size = BASE_FONT_SIZE) {
if (size in PRESET_FONT_SIZES) {
return getFontSize(PRESET_FONT_SIZES[size]);
}
if (typeof size !== 'number') {
const parsed = parseFloat(size);
if (Number.isNaN(parsed)) return size;
size = parsed;
}
const ratio = `(${size} / ${BASE_FONT_SIZE})`;
return `calc(${ratio} * ${config_values.fontSize})`;
}
function getHeadingFontSize(size = 3) {
if (!HEADING_FONT_SIZES.includes(size)) {
return getFontSize(size);
}
const headingSize = `fontSizeH${size}`;
return config_values[headingSize];
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/get-line-height.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function getLineHeight(adjustLineHeightForInnerControls, lineHeight) {
if (lineHeight) return lineHeight;
if (!adjustLineHeightForInnerControls) return;
let value = `calc(${config_values.controlHeight} + ${space(2)})`;
switch (adjustLineHeightForInnerControls) {
case 'large':
value = `calc(${config_values.controlHeightLarge} + ${space(2)})`;
break;
case 'small':
value = `calc(${config_values.controlHeightSmall} + ${space(2)})`;
break;
case 'xSmall':
value = `calc(${config_values.controlHeightXSmall} + ${space(2)})`;
break;
default:
break;
}
return value;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/hook.js
function hook_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
var hook_ref = true ? {
name: "50zrmy",
styles: "text-transform:uppercase"
} : 0;
/**
* @param {import('../context').WordPressComponentProps<import('./types').Props, 'span'>} props
*/
function useText(props) {
const {
adjustLineHeightForInnerControls,
align,
children,
className,
color,
ellipsizeMode,
isDestructive = false,
display,
highlightEscape = false,
highlightCaseSensitive = false,
highlightWords,
highlightSanitize,
isBlock = false,
letterSpacing,
lineHeight: lineHeightProp,
optimizeReadabilityFor,
size,
truncate = false,
upperCase = false,
variant,
weight = config_values.fontWeight,
...otherProps
} = useContextSystem(props, 'Text');
let content = children;
const isHighlighter = Array.isArray(highlightWords);
const isCaption = size === 'caption';
if (isHighlighter) {
if (typeof children !== 'string') {
throw new TypeError('`children` of `Text` must only be `string` types when `highlightWords` is defined');
}
content = createHighlighterText({
autoEscape: highlightEscape,
children,
caseSensitive: highlightCaseSensitive,
searchWords: highlightWords,
sanitize: highlightSanitize
});
}
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
const sx = {};
const lineHeight = getLineHeight(adjustLineHeightForInnerControls, lineHeightProp);
sx.Base = /*#__PURE__*/emotion_react_browser_esm_css({
color,
display,
fontSize: getFontSize(size),
fontWeight: weight,
lineHeight,
letterSpacing,
textAlign: align
}, true ? "" : 0, true ? "" : 0);
sx.upperCase = hook_ref;
sx.optimalTextColor = null;
if (optimizeReadabilityFor) {
const isOptimalTextColorDark = getOptimalTextShade(optimizeReadabilityFor) === 'dark';
sx.optimalTextColor = isOptimalTextColorDark ? /*#__PURE__*/emotion_react_browser_esm_css({
color: COLORS.gray[900]
}, true ? "" : 0, true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css({
color: COLORS.white
}, true ? "" : 0, true ? "" : 0);
}
return cx(Text, sx.Base, sx.optimalTextColor, isDestructive && destructive, !!isHighlighter && highlighterText, isBlock && styles_block, isCaption && muted, variant && text_styles_namespaceObject[variant], upperCase && sx.upperCase, className);
}, [adjustLineHeightForInnerControls, align, className, color, cx, display, isBlock, isCaption, isDestructive, isHighlighter, letterSpacing, lineHeightProp, optimizeReadabilityFor, size, upperCase, variant, weight]);
let finalEllipsizeMode;
if (truncate === true) {
finalEllipsizeMode = 'auto';
}
if (truncate === false) {
finalEllipsizeMode = 'none';
}
const finalComponentProps = {
...otherProps,
className: classes,
children,
ellipsizeMode: ellipsizeMode || finalEllipsizeMode
};
const truncateProps = useTruncate(finalComponentProps);
/**
* Enhance child `<Link />` components to inherit font size.
*/
if (!truncate && Array.isArray(children)) {
content = external_wp_element_namespaceObject.Children.map(children, child => {
if (typeof child !== 'object' || child === null || !('props' in child)) {
return child;
}
const isLink = hasConnectNamespace(child, ['Link']);
if (isLink) {
return (0,external_wp_element_namespaceObject.cloneElement)(child, {
size: child.props.size || 'inherit'
});
}
return child;
});
}
return {
...truncateProps,
children: truncate ? truncateProps.children : content
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/component.js
/**
* Internal dependencies
*/
/**
* @param props
* @param forwardedRef
*/
function UnconnectedText(props, forwardedRef) {
const textProps = useText(props);
return (0,external_React_.createElement)(component, {
as: "span",
...textProps,
ref: forwardedRef
});
}
/**
* `Text` is a core component that renders text in the library, using the
* library's typography system.
*
* `Text` can be used to render any text-content, like an HTML `p` or `span`.
*
* @example
*
* ```jsx
* import { __experimentalText as Text } from `@wordpress/components`;
*
* function Example() {
* return <Text>Code is Poetry</Text>;
* }
* ```
*/
const component_Text = contextConnect(UnconnectedText, 'Text');
/* harmony default export */ const text_component = (component_Text);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/base-label.js
function base_label_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
// This is a very low-level mixin which you shouldn't have to use directly.
// Try to use BaseControl's StyledLabel or BaseControl.VisualLabel if you can.
const baseLabelTypography = true ? {
name: "9amh4a",
styles: "font-size:11px;font-weight:500;line-height:1.4;text-transform:uppercase"
} : 0;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js
function input_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
var _ref2 = true ? {
name: "1739oy8",
styles: "z-index:1"
} : 0;
const rootFocusedStyles = ({
isFocused
}) => {
if (!isFocused) return '';
return _ref2;
};
const input_control_styles_Root = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
target: "em5sgkm7"
} : 0)("box-sizing:border-box;position:relative;border-radius:2px;padding-top:0;", rootFocusedStyles, ";" + ( true ? "" : 0));
const containerDisabledStyles = ({
disabled
}) => {
const backgroundColor = disabled ? COLORS.ui.backgroundDisabled : COLORS.ui.background;
return /*#__PURE__*/emotion_react_browser_esm_css({
backgroundColor
}, true ? "" : 0, true ? "" : 0);
};
var input_control_styles_ref = true ? {
name: "1d3w5wq",
styles: "width:100%"
} : 0;
const containerWidthStyles = ({
__unstableInputWidth,
labelPosition
}) => {
if (!__unstableInputWidth) return input_control_styles_ref;
if (labelPosition === 'side') return '';
if (labelPosition === 'edge') {
return /*#__PURE__*/emotion_react_browser_esm_css({
flex: `0 0 ${__unstableInputWidth}`
}, true ? "" : 0, true ? "" : 0);
}
return /*#__PURE__*/emotion_react_browser_esm_css({
width: __unstableInputWidth
}, true ? "" : 0, true ? "" : 0);
};
const Container = emotion_styled_base_browser_esm("div", true ? {
target: "em5sgkm6"
} : 0)("align-items:center;box-sizing:border-box;border-radius:inherit;display:flex;flex:1;position:relative;", containerDisabledStyles, " ", containerWidthStyles, ";" + ( true ? "" : 0));
const disabledStyles = ({
disabled
}) => {
if (!disabled) return '';
return /*#__PURE__*/emotion_react_browser_esm_css({
color: COLORS.ui.textDisabled
}, true ? "" : 0, true ? "" : 0);
};
const fontSizeStyles = ({
inputSize: size
}) => {
const sizes = {
default: '13px',
small: '11px',
compact: '13px',
'__unstable-large': '13px'
};
const fontSize = sizes[size] || sizes.default;
const fontSizeMobile = '16px';
if (!fontSize) return '';
return /*#__PURE__*/emotion_react_browser_esm_css("font-size:", fontSizeMobile, ";@media ( min-width: 600px ){font-size:", fontSize, ";}" + ( true ? "" : 0), true ? "" : 0);
};
const getSizeConfig = ({
inputSize: size,
__next40pxDefaultSize
}) => {
// Paddings may be overridden by the custom paddings props.
const sizes = {
default: {
height: 40,
lineHeight: 1,
minHeight: 40,
paddingLeft: space(4),
paddingRight: space(4)
},
small: {
height: 24,
lineHeight: 1,
minHeight: 24,
paddingLeft: space(2),
paddingRight: space(2)
},
compact: {
height: 32,
lineHeight: 1,
minHeight: 32,
paddingLeft: space(2),
paddingRight: space(2)
},
'__unstable-large': {
height: 40,
lineHeight: 1,
minHeight: 40,
paddingLeft: space(4),
paddingRight: space(4)
}
};
if (!__next40pxDefaultSize) {
sizes.default = sizes.compact;
}
return sizes[size] || sizes.default;
};
const sizeStyles = props => {
return /*#__PURE__*/emotion_react_browser_esm_css(getSizeConfig(props), true ? "" : 0, true ? "" : 0);
};
const customPaddings = ({
paddingInlineStart,
paddingInlineEnd
}) => {
return /*#__PURE__*/emotion_react_browser_esm_css({
paddingInlineStart,
paddingInlineEnd
}, true ? "" : 0, true ? "" : 0);
};
const dragStyles = ({
isDragging,
dragCursor
}) => {
let defaultArrowStyles;
let activeDragCursorStyles;
if (isDragging) {
defaultArrowStyles = /*#__PURE__*/emotion_react_browser_esm_css("cursor:", dragCursor, ";user-select:none;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none!important;margin:0!important;}" + ( true ? "" : 0), true ? "" : 0);
}
if (isDragging && dragCursor) {
activeDragCursorStyles = /*#__PURE__*/emotion_react_browser_esm_css("&:active{cursor:", dragCursor, ";}" + ( true ? "" : 0), true ? "" : 0);
}
return /*#__PURE__*/emotion_react_browser_esm_css(defaultArrowStyles, " ", activeDragCursorStyles, ";" + ( true ? "" : 0), true ? "" : 0);
};
// TODO: Resolve need to use &&& to increase specificity
// https://github.com/WordPress/gutenberg/issues/18483
const Input = emotion_styled_base_browser_esm("input", true ? {
target: "em5sgkm5"
} : 0)("&&&{background-color:transparent;box-sizing:border-box;border:none;box-shadow:none!important;color:", COLORS.theme.foreground, ";display:block;font-family:inherit;margin:0;outline:none;width:100%;", dragStyles, " ", disabledStyles, " ", fontSizeStyles, " ", sizeStyles, " ", customPaddings, " &::-webkit-input-placeholder{line-height:normal;}}" + ( true ? "" : 0));
const BaseLabel = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? {
target: "em5sgkm4"
} : 0)("&&&{", baseLabelTypography, ";box-sizing:border-box;display:block;padding-top:0;padding-bottom:0;max-width:100%;z-index:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}" + ( true ? "" : 0));
const Label = props => (0,external_React_.createElement)(BaseLabel, {
...props,
as: "label"
});
const LabelWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_item_component, true ? {
target: "em5sgkm3"
} : 0)( true ? {
name: "1b6uupn",
styles: "max-width:calc( 100% - 10px )"
} : 0);
const backdropFocusedStyles = ({
disabled,
isBorderless,
isFocused
}) => {
let borderColor = isBorderless ? 'transparent' : COLORS.ui.border;
let boxShadow;
let outline;
let outlineOffset;
if (isFocused) {
borderColor = COLORS.ui.borderFocus;
boxShadow = config_values.controlBoxShadowFocus;
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline = `2px solid transparent`;
outlineOffset = `-2px`;
}
if (disabled) {
borderColor = isBorderless ? 'transparent' : COLORS.ui.borderDisabled;
}
return /*#__PURE__*/emotion_react_browser_esm_css({
boxShadow,
borderColor,
borderStyle: 'solid',
borderWidth: 1,
outline,
outlineOffset
}, true ? "" : 0, true ? "" : 0);
};
const BackdropUI = emotion_styled_base_browser_esm("div", true ? {
target: "em5sgkm2"
} : 0)("&&&{box-sizing:border-box;border-radius:inherit;bottom:0;left:0;margin:0;padding:0;pointer-events:none;position:absolute;right:0;top:0;", backdropFocusedStyles, " ", rtl({
paddingLeft: 2
}), ";}" + ( true ? "" : 0));
const Prefix = emotion_styled_base_browser_esm("span", true ? {
target: "em5sgkm1"
} : 0)( true ? {
name: "pvvbxf",
styles: "box-sizing:border-box;display:block"
} : 0);
const Suffix = emotion_styled_base_browser_esm("span", true ? {
target: "em5sgkm0"
} : 0)( true ? {
name: "jgf79h",
styles: "align-items:center;align-self:stretch;box-sizing:border-box;display:flex"
} : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/backdrop.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Backdrop({
disabled = false,
isBorderless = false,
isFocused = false
}) {
return (0,external_React_.createElement)(BackdropUI, {
"aria-hidden": "true",
className: "components-input-control__backdrop",
disabled: disabled,
isBorderless: isBorderless,
isFocused: isFocused
});
}
const MemoizedBackdrop = (0,external_wp_element_namespaceObject.memo)(Backdrop);
/* harmony default export */ const backdrop = (MemoizedBackdrop);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/label.js
/**
* Internal dependencies
*/
function label_Label({
children,
hideLabelFromVision,
htmlFor,
...props
}) {
if (!children) return null;
if (hideLabelFromVision) {
return (0,external_React_.createElement)(visually_hidden_component, {
as: "label",
htmlFor: htmlFor
}, children);
}
return (0,external_React_.createElement)(LabelWrapper, null, (0,external_React_.createElement)(Label, {
htmlFor: htmlFor,
...props
}, children));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/use-deprecated-props.js
function useDeprecated36pxDefaultSizeProp(props) {
const {
__next36pxDefaultSize,
__next40pxDefaultSize,
...otherProps
} = props;
return {
...otherProps,
__next40pxDefaultSize: __next40pxDefaultSize !== null && __next40pxDefaultSize !== void 0 ? __next40pxDefaultSize : __next36pxDefaultSize
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-base.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useUniqueId(idProp) {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(InputBase);
const id = `input-base-control-${instanceId}`;
return idProp || id;
}
// Adapter to map props for the new ui/flex component.
function getUIFlexProps(labelPosition) {
const props = {};
switch (labelPosition) {
case 'top':
props.direction = 'column';
props.expanded = false;
props.gap = 0;
break;
case 'bottom':
props.direction = 'column-reverse';
props.expanded = false;
props.gap = 0;
break;
case 'edge':
props.justify = 'space-between';
break;
}
return props;
}
function InputBase(props, ref) {
const {
__next40pxDefaultSize,
__unstableInputWidth,
children,
className,
disabled = false,
hideLabelFromVision = false,
labelPosition,
id: idProp,
isBorderless = false,
isFocused = false,
label,
prefix,
size = 'default',
suffix,
...restProps
} = useDeprecated36pxDefaultSizeProp(useContextSystem(props, 'InputBase'));
const id = useUniqueId(idProp);
const hideLabel = hideLabelFromVision || !label;
const {
paddingLeft,
paddingRight
} = getSizeConfig({
inputSize: size,
__next40pxDefaultSize
});
const prefixSuffixContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => {
return {
InputControlPrefixWrapper: {
paddingLeft
},
InputControlSuffixWrapper: {
paddingRight
}
};
}, [paddingLeft, paddingRight]);
return (
// @ts-expect-error The `direction` prop from Flex (FlexDirection) conflicts with legacy SVGAttributes `direction` (string) that come from React intrinsic prop definitions.
(0,external_React_.createElement)(input_control_styles_Root, {
...restProps,
...getUIFlexProps(labelPosition),
className: className,
gap: 2,
isFocused: isFocused,
labelPosition: labelPosition,
ref: ref
}, (0,external_React_.createElement)(label_Label, {
className: "components-input-control__label",
hideLabelFromVision: hideLabelFromVision,
labelPosition: labelPosition,
htmlFor: id
}, label), (0,external_React_.createElement)(Container, {
__unstableInputWidth: __unstableInputWidth,
className: "components-input-control__container",
disabled: disabled,
hideLabel: hideLabel,
labelPosition: labelPosition
}, (0,external_React_.createElement)(ContextSystemProvider, {
value: prefixSuffixContextValue
}, prefix && (0,external_React_.createElement)(Prefix, {
className: "components-input-control__prefix"
}, prefix), children, suffix && (0,external_React_.createElement)(Suffix, {
className: "components-input-control__suffix"
}, suffix)), (0,external_React_.createElement)(backdrop, {
disabled: disabled,
isBorderless: isBorderless,
isFocused: isFocused
})))
);
}
/* harmony default export */ const input_base = (contextConnect(InputBase, 'InputBase'));
;// CONCATENATED MODULE: ./node_modules/@use-gesture/core/dist/maths-0ab39ae9.esm.js
function maths_0ab39ae9_esm_clamp(v, min, max) {
return Math.max(min, Math.min(v, max));
}
const V = {
toVector(v, fallback) {
if (v === undefined) v = fallback;
return Array.isArray(v) ? v : [v, v];
},
add(v1, v2) {
return [v1[0] + v2[0], v1[1] + v2[1]];
},
sub(v1, v2) {
return [v1[0] - v2[0], v1[1] - v2[1]];
},
addTo(v1, v2) {
v1[0] += v2[0];
v1[1] += v2[1];
},
subTo(v1, v2) {
v1[0] -= v2[0];
v1[1] -= v2[1];
}
};
function rubberband(distance, dimension, constant) {
if (dimension === 0 || Math.abs(dimension) === Infinity) return Math.pow(distance, constant * 5);
return distance * dimension * constant / (dimension + constant * distance);
}
function rubberbandIfOutOfBounds(position, min, max, constant = 0.15) {
if (constant === 0) return maths_0ab39ae9_esm_clamp(position, min, max);
if (position < min) return -rubberband(min - position, max - min, constant) + min;
if (position > max) return +rubberband(position - max, max - min, constant) + max;
return position;
}
function computeRubberband(bounds, [Vx, Vy], [Rx, Ry]) {
const [[X0, X1], [Y0, Y1]] = bounds;
return [rubberbandIfOutOfBounds(Vx, X0, X1, Rx), rubberbandIfOutOfBounds(Vy, Y0, Y1, Ry)];
}
;// CONCATENATED MODULE: ./node_modules/@use-gesture/core/dist/actions-b1cc53c2.esm.js
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
const EVENT_TYPE_MAP = {
pointer: {
start: 'down',
change: 'move',
end: 'up'
},
mouse: {
start: 'down',
change: 'move',
end: 'up'
},
touch: {
start: 'start',
change: 'move',
end: 'end'
},
gesture: {
start: 'start',
change: 'change',
end: 'end'
}
};
function capitalize(string) {
if (!string) return '';
return string[0].toUpperCase() + string.slice(1);
}
const actionsWithoutCaptureSupported = ['enter', 'leave'];
function hasCapture(capture = false, actionKey) {
return capture && !actionsWithoutCaptureSupported.includes(actionKey);
}
function toHandlerProp(device, action = '', capture = false) {
const deviceProps = EVENT_TYPE_MAP[device];
const actionKey = deviceProps ? deviceProps[action] || action : action;
return 'on' + capitalize(device) + capitalize(actionKey) + (hasCapture(capture, actionKey) ? 'Capture' : '');
}
const pointerCaptureEvents = ['gotpointercapture', 'lostpointercapture'];
function parseProp(prop) {
let eventKey = prop.substring(2).toLowerCase();
const passive = !!~eventKey.indexOf('passive');
if (passive) eventKey = eventKey.replace('passive', '');
const captureKey = pointerCaptureEvents.includes(eventKey) ? 'capturecapture' : 'capture';
const capture = !!~eventKey.indexOf(captureKey);
if (capture) eventKey = eventKey.replace('capture', '');
return {
device: eventKey,
capture,
passive
};
}
function toDomEventType(device, action = '') {
const deviceProps = EVENT_TYPE_MAP[device];
const actionKey = deviceProps ? deviceProps[action] || action : action;
return device + actionKey;
}
function isTouch(event) {
return 'touches' in event;
}
function getPointerType(event) {
if (isTouch(event)) return 'touch';
if ('pointerType' in event) return event.pointerType;
return 'mouse';
}
function getCurrentTargetTouchList(event) {
return Array.from(event.touches).filter(e => {
var _event$currentTarget, _event$currentTarget$;
return e.target === event.currentTarget || ((_event$currentTarget = event.currentTarget) === null || _event$currentTarget === void 0 ? void 0 : (_event$currentTarget$ = _event$currentTarget.contains) === null || _event$currentTarget$ === void 0 ? void 0 : _event$currentTarget$.call(_event$currentTarget, e.target));
});
}
function getTouchList(event) {
return event.type === 'touchend' || event.type === 'touchcancel' ? event.changedTouches : event.targetTouches;
}
function getValueEvent(event) {
return isTouch(event) ? getTouchList(event)[0] : event;
}
function distanceAngle(P1, P2) {
const dx = P2.clientX - P1.clientX;
const dy = P2.clientY - P1.clientY;
const cx = (P2.clientX + P1.clientX) / 2;
const cy = (P2.clientY + P1.clientY) / 2;
const distance = Math.hypot(dx, dy);
const angle = -(Math.atan2(dx, dy) * 180) / Math.PI;
const origin = [cx, cy];
return {
angle,
distance,
origin
};
}
function touchIds(event) {
return getCurrentTargetTouchList(event).map(touch => touch.identifier);
}
function touchDistanceAngle(event, ids) {
const [P1, P2] = Array.from(event.touches).filter(touch => ids.includes(touch.identifier));
return distanceAngle(P1, P2);
}
function pointerId(event) {
const valueEvent = getValueEvent(event);
return isTouch(event) ? valueEvent.identifier : valueEvent.pointerId;
}
function pointerValues(event) {
const valueEvent = getValueEvent(event);
return [valueEvent.clientX, valueEvent.clientY];
}
const LINE_HEIGHT = 40;
const PAGE_HEIGHT = 800;
function wheelValues(event) {
let {
deltaX,
deltaY,
deltaMode
} = event;
if (deltaMode === 1) {
deltaX *= LINE_HEIGHT;
deltaY *= LINE_HEIGHT;
} else if (deltaMode === 2) {
deltaX *= PAGE_HEIGHT;
deltaY *= PAGE_HEIGHT;
}
return [deltaX, deltaY];
}
function scrollValues(event) {
var _ref, _ref2;
const {
scrollX,
scrollY,
scrollLeft,
scrollTop
} = event.currentTarget;
return [(_ref = scrollX !== null && scrollX !== void 0 ? scrollX : scrollLeft) !== null && _ref !== void 0 ? _ref : 0, (_ref2 = scrollY !== null && scrollY !== void 0 ? scrollY : scrollTop) !== null && _ref2 !== void 0 ? _ref2 : 0];
}
function getEventDetails(event) {
const payload = {};
if ('buttons' in event) payload.buttons = event.buttons;
if ('shiftKey' in event) {
const {
shiftKey,
altKey,
metaKey,
ctrlKey
} = event;
Object.assign(payload, {
shiftKey,
altKey,
metaKey,
ctrlKey
});
}
return payload;
}
function call(v, ...args) {
if (typeof v === 'function') {
return v(...args);
} else {
return v;
}
}
function actions_b1cc53c2_esm_noop() {}
function actions_b1cc53c2_esm_chain(...fns) {
if (fns.length === 0) return actions_b1cc53c2_esm_noop;
if (fns.length === 1) return fns[0];
return function () {
let result;
for (const fn of fns) {
result = fn.apply(this, arguments) || result;
}
return result;
};
}
function assignDefault(value, fallback) {
return Object.assign({}, fallback, value || {});
}
const BEFORE_LAST_KINEMATICS_DELAY = 32;
class Engine {
constructor(ctrl, args, key) {
this.ctrl = ctrl;
this.args = args;
this.key = key;
if (!this.state) {
this.state = {};
this.computeValues([0, 0]);
this.computeInitial();
if (this.init) this.init();
this.reset();
}
}
get state() {
return this.ctrl.state[this.key];
}
set state(state) {
this.ctrl.state[this.key] = state;
}
get shared() {
return this.ctrl.state.shared;
}
get eventStore() {
return this.ctrl.gestureEventStores[this.key];
}
get timeoutStore() {
return this.ctrl.gestureTimeoutStores[this.key];
}
get config() {
return this.ctrl.config[this.key];
}
get sharedConfig() {
return this.ctrl.config.shared;
}
get handler() {
return this.ctrl.handlers[this.key];
}
reset() {
const {
state,
shared,
ingKey,
args
} = this;
shared[ingKey] = state._active = state.active = state._blocked = state._force = false;
state._step = [false, false];
state.intentional = false;
state._movement = [0, 0];
state._distance = [0, 0];
state._direction = [0, 0];
state._delta = [0, 0];
state._bounds = [[-Infinity, Infinity], [-Infinity, Infinity]];
state.args = args;
state.axis = undefined;
state.memo = undefined;
state.elapsedTime = 0;
state.direction = [0, 0];
state.distance = [0, 0];
state.overflow = [0, 0];
state._movementBound = [false, false];
state.velocity = [0, 0];
state.movement = [0, 0];
state.delta = [0, 0];
state.timeStamp = 0;
}
start(event) {
const state = this.state;
const config = this.config;
if (!state._active) {
this.reset();
this.computeInitial();
state._active = true;
state.target = event.target;
state.currentTarget = event.currentTarget;
state.lastOffset = config.from ? call(config.from, state) : state.offset;
state.offset = state.lastOffset;
}
state.startTime = state.timeStamp = event.timeStamp;
}
computeValues(values) {
const state = this.state;
state._values = values;
state.values = this.config.transform(values);
}
computeInitial() {
const state = this.state;
state._initial = state._values;
state.initial = state.values;
}
compute(event) {
const {
state,
config,
shared
} = this;
state.args = this.args;
let dt = 0;
if (event) {
state.event = event;
if (config.preventDefault && event.cancelable) state.event.preventDefault();
state.type = event.type;
shared.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size;
shared.locked = !!document.pointerLockElement;
Object.assign(shared, getEventDetails(event));
shared.down = shared.pressed = shared.buttons % 2 === 1 || shared.touches > 0;
dt = event.timeStamp - state.timeStamp;
state.timeStamp = event.timeStamp;
state.elapsedTime = state.timeStamp - state.startTime;
}
if (state._active) {
const _absoluteDelta = state._delta.map(Math.abs);
V.addTo(state._distance, _absoluteDelta);
}
if (this.axisIntent) this.axisIntent(event);
const [_m0, _m1] = state._movement;
const [t0, t1] = config.threshold;
const {
_step,
values
} = state;
if (config.hasCustomTransform) {
if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && values[0];
if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && values[1];
} else {
if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && Math.sign(_m0) * t0;
if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && Math.sign(_m1) * t1;
}
state.intentional = _step[0] !== false || _step[1] !== false;
if (!state.intentional) return;
const movement = [0, 0];
if (config.hasCustomTransform) {
const [v0, v1] = values;
movement[0] = _step[0] !== false ? v0 - _step[0] : 0;
movement[1] = _step[1] !== false ? v1 - _step[1] : 0;
} else {
movement[0] = _step[0] !== false ? _m0 - _step[0] : 0;
movement[1] = _step[1] !== false ? _m1 - _step[1] : 0;
}
if (this.restrictToAxis && !state._blocked) this.restrictToAxis(movement);
const previousOffset = state.offset;
const gestureIsActive = state._active && !state._blocked || state.active;
if (gestureIsActive) {
state.first = state._active && !state.active;
state.last = !state._active && state.active;
state.active = shared[this.ingKey] = state._active;
if (event) {
if (state.first) {
if ('bounds' in config) state._bounds = call(config.bounds, state);
if (this.setup) this.setup();
}
state.movement = movement;
this.computeOffset();
}
}
const [ox, oy] = state.offset;
const [[x0, x1], [y0, y1]] = state._bounds;
state.overflow = [ox < x0 ? -1 : ox > x1 ? 1 : 0, oy < y0 ? -1 : oy > y1 ? 1 : 0];
state._movementBound[0] = state.overflow[0] ? state._movementBound[0] === false ? state._movement[0] : state._movementBound[0] : false;
state._movementBound[1] = state.overflow[1] ? state._movementBound[1] === false ? state._movement[1] : state._movementBound[1] : false;
const rubberband = state._active ? config.rubberband || [0, 0] : [0, 0];
state.offset = computeRubberband(state._bounds, state.offset, rubberband);
state.delta = V.sub(state.offset, previousOffset);
this.computeMovement();
if (gestureIsActive && (!state.last || dt > BEFORE_LAST_KINEMATICS_DELAY)) {
state.delta = V.sub(state.offset, previousOffset);
const absoluteDelta = state.delta.map(Math.abs);
V.addTo(state.distance, absoluteDelta);
state.direction = state.delta.map(Math.sign);
state._direction = state._delta.map(Math.sign);
if (!state.first && dt > 0) {
state.velocity = [absoluteDelta[0] / dt, absoluteDelta[1] / dt];
}
}
}
emit() {
const state = this.state;
const shared = this.shared;
const config = this.config;
if (!state._active) this.clean();
if ((state._blocked || !state.intentional) && !state._force && !config.triggerAllEvents) return;
const memo = this.handler(_objectSpread2(_objectSpread2(_objectSpread2({}, shared), state), {}, {
[this.aliasKey]: state.values
}));
if (memo !== undefined) state.memo = memo;
}
clean() {
this.eventStore.clean();
this.timeoutStore.clean();
}
}
function selectAxis([dx, dy], threshold) {
const absDx = Math.abs(dx);
const absDy = Math.abs(dy);
if (absDx > absDy && absDx > threshold) {
return 'x';
}
if (absDy > absDx && absDy > threshold) {
return 'y';
}
return undefined;
}
class CoordinatesEngine extends Engine {
constructor(...args) {
super(...args);
_defineProperty(this, "aliasKey", 'xy');
}
reset() {
super.reset();
this.state.axis = undefined;
}
init() {
this.state.offset = [0, 0];
this.state.lastOffset = [0, 0];
}
computeOffset() {
this.state.offset = V.add(this.state.lastOffset, this.state.movement);
}
computeMovement() {
this.state.movement = V.sub(this.state.offset, this.state.lastOffset);
}
axisIntent(event) {
const state = this.state;
const config = this.config;
if (!state.axis && event) {
const threshold = typeof config.axisThreshold === 'object' ? config.axisThreshold[getPointerType(event)] : config.axisThreshold;
state.axis = selectAxis(state._movement, threshold);
}
state._blocked = (config.lockDirection || !!config.axis) && !state.axis || !!config.axis && config.axis !== state.axis;
}
restrictToAxis(v) {
if (this.config.axis || this.config.lockDirection) {
switch (this.state.axis) {
case 'x':
v[1] = 0;
break;
case 'y':
v[0] = 0;
break;
}
}
}
}
const actions_b1cc53c2_esm_identity = v => v;
const DEFAULT_RUBBERBAND = 0.15;
const commonConfigResolver = {
enabled(value = true) {
return value;
},
eventOptions(value, _k, config) {
return _objectSpread2(_objectSpread2({}, config.shared.eventOptions), value);
},
preventDefault(value = false) {
return value;
},
triggerAllEvents(value = false) {
return value;
},
rubberband(value = 0) {
switch (value) {
case true:
return [DEFAULT_RUBBERBAND, DEFAULT_RUBBERBAND];
case false:
return [0, 0];
default:
return V.toVector(value);
}
},
from(value) {
if (typeof value === 'function') return value;
if (value != null) return V.toVector(value);
},
transform(value, _k, config) {
const transform = value || config.shared.transform;
this.hasCustomTransform = !!transform;
if (false) {}
return transform || actions_b1cc53c2_esm_identity;
},
threshold(value) {
return V.toVector(value, 0);
}
};
if (false) {}
const DEFAULT_AXIS_THRESHOLD = 0;
const coordinatesConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, {
axis(_v, _k, {
axis
}) {
this.lockDirection = axis === 'lock';
if (!this.lockDirection) return axis;
},
axisThreshold(value = DEFAULT_AXIS_THRESHOLD) {
return value;
},
bounds(value = {}) {
if (typeof value === 'function') {
return state => coordinatesConfigResolver.bounds(value(state));
}
if ('current' in value) {
return () => value.current;
}
if (typeof HTMLElement === 'function' && value instanceof HTMLElement) {
return value;
}
const {
left = -Infinity,
right = Infinity,
top = -Infinity,
bottom = Infinity
} = value;
return [[left, right], [top, bottom]];
}
});
const KEYS_DELTA_MAP = {
ArrowRight: (displacement, factor = 1) => [displacement * factor, 0],
ArrowLeft: (displacement, factor = 1) => [-1 * displacement * factor, 0],
ArrowUp: (displacement, factor = 1) => [0, -1 * displacement * factor],
ArrowDown: (displacement, factor = 1) => [0, displacement * factor]
};
class DragEngine extends CoordinatesEngine {
constructor(...args) {
super(...args);
_defineProperty(this, "ingKey", 'dragging');
}
reset() {
super.reset();
const state = this.state;
state._pointerId = undefined;
state._pointerActive = false;
state._keyboardActive = false;
state._preventScroll = false;
state._delayed = false;
state.swipe = [0, 0];
state.tap = false;
state.canceled = false;
state.cancel = this.cancel.bind(this);
}
setup() {
const state = this.state;
if (state._bounds instanceof HTMLElement) {
const boundRect = state._bounds.getBoundingClientRect();
const targetRect = state.currentTarget.getBoundingClientRect();
const _bounds = {
left: boundRect.left - targetRect.left + state.offset[0],
right: boundRect.right - targetRect.right + state.offset[0],
top: boundRect.top - targetRect.top + state.offset[1],
bottom: boundRect.bottom - targetRect.bottom + state.offset[1]
};
state._bounds = coordinatesConfigResolver.bounds(_bounds);
}
}
cancel() {
const state = this.state;
if (state.canceled) return;
state.canceled = true;
state._active = false;
setTimeout(() => {
this.compute();
this.emit();
}, 0);
}
setActive() {
this.state._active = this.state._pointerActive || this.state._keyboardActive;
}
clean() {
this.pointerClean();
this.state._pointerActive = false;
this.state._keyboardActive = false;
super.clean();
}
pointerDown(event) {
const config = this.config;
const state = this.state;
if (event.buttons != null && (Array.isArray(config.pointerButtons) ? !config.pointerButtons.includes(event.buttons) : config.pointerButtons !== -1 && config.pointerButtons !== event.buttons)) return;
const ctrlIds = this.ctrl.setEventIds(event);
if (config.pointerCapture) {
event.target.setPointerCapture(event.pointerId);
}
if (ctrlIds && ctrlIds.size > 1 && state._pointerActive) return;
this.start(event);
this.setupPointer(event);
state._pointerId = pointerId(event);
state._pointerActive = true;
this.computeValues(pointerValues(event));
this.computeInitial();
if (config.preventScrollAxis && getPointerType(event) !== 'mouse') {
state._active = false;
this.setupScrollPrevention(event);
} else if (config.delay > 0) {
this.setupDelayTrigger(event);
if (config.triggerAllEvents) {
this.compute(event);
this.emit();
}
} else {
this.startPointerDrag(event);
}
}
startPointerDrag(event) {
const state = this.state;
state._active = true;
state._preventScroll = true;
state._delayed = false;
this.compute(event);
this.emit();
}
pointerMove(event) {
const state = this.state;
const config = this.config;
if (!state._pointerActive) return;
if (state.type === event.type && event.timeStamp === state.timeStamp) return;
const id = pointerId(event);
if (state._pointerId !== undefined && id !== state._pointerId) return;
const _values = pointerValues(event);
if (document.pointerLockElement === event.target) {
state._delta = [event.movementX, event.movementY];
} else {
state._delta = V.sub(_values, state._values);
this.computeValues(_values);
}
V.addTo(state._movement, state._delta);
this.compute(event);
if (state._delayed && state.intentional) {
this.timeoutStore.remove('dragDelay');
state.active = false;
this.startPointerDrag(event);
return;
}
if (config.preventScrollAxis && !state._preventScroll) {
if (state.axis) {
if (state.axis === config.preventScrollAxis || config.preventScrollAxis === 'xy') {
state._active = false;
this.clean();
return;
} else {
this.timeoutStore.remove('startPointerDrag');
this.startPointerDrag(event);
return;
}
} else {
return;
}
}
this.emit();
}
pointerUp(event) {
this.ctrl.setEventIds(event);
try {
if (this.config.pointerCapture && event.target.hasPointerCapture(event.pointerId)) {
;
event.target.releasePointerCapture(event.pointerId);
}
} catch (_unused) {
if (false) {}
}
const state = this.state;
const config = this.config;
if (!state._active || !state._pointerActive) return;
const id = pointerId(event);
if (state._pointerId !== undefined && id !== state._pointerId) return;
this.state._pointerActive = false;
this.setActive();
this.compute(event);
const [dx, dy] = state._distance;
state.tap = dx <= config.tapsThreshold && dy <= config.tapsThreshold;
if (state.tap && config.filterTaps) {
state._force = true;
} else {
const [dirx, diry] = state.direction;
const [vx, vy] = state.velocity;
const [mx, my] = state.movement;
const [svx, svy] = config.swipe.velocity;
const [sx, sy] = config.swipe.distance;
const sdt = config.swipe.duration;
if (state.elapsedTime < sdt) {
if (Math.abs(vx) > svx && Math.abs(mx) > sx) state.swipe[0] = dirx;
if (Math.abs(vy) > svy && Math.abs(my) > sy) state.swipe[1] = diry;
}
}
this.emit();
}
pointerClick(event) {
if (!this.state.tap && event.detail > 0) {
event.preventDefault();
event.stopPropagation();
}
}
setupPointer(event) {
const config = this.config;
const device = config.device;
if (false) {}
if (config.pointerLock) {
event.currentTarget.requestPointerLock();
}
if (!config.pointerCapture) {
this.eventStore.add(this.sharedConfig.window, device, 'change', this.pointerMove.bind(this));
this.eventStore.add(this.sharedConfig.window, device, 'end', this.pointerUp.bind(this));
this.eventStore.add(this.sharedConfig.window, device, 'cancel', this.pointerUp.bind(this));
}
}
pointerClean() {
if (this.config.pointerLock && document.pointerLockElement === this.state.currentTarget) {
document.exitPointerLock();
}
}
preventScroll(event) {
if (this.state._preventScroll && event.cancelable) {
event.preventDefault();
}
}
setupScrollPrevention(event) {
this.state._preventScroll = false;
persistEvent(event);
const remove = this.eventStore.add(this.sharedConfig.window, 'touch', 'change', this.preventScroll.bind(this), {
passive: false
});
this.eventStore.add(this.sharedConfig.window, 'touch', 'end', remove);
this.eventStore.add(this.sharedConfig.window, 'touch', 'cancel', remove);
this.timeoutStore.add('startPointerDrag', this.startPointerDrag.bind(this), this.config.preventScrollDelay, event);
}
setupDelayTrigger(event) {
this.state._delayed = true;
this.timeoutStore.add('dragDelay', () => {
this.state._step = [0, 0];
this.startPointerDrag(event);
}, this.config.delay);
}
keyDown(event) {
const deltaFn = KEYS_DELTA_MAP[event.key];
if (deltaFn) {
const state = this.state;
const factor = event.shiftKey ? 10 : event.altKey ? 0.1 : 1;
this.start(event);
state._delta = deltaFn(this.config.keyboardDisplacement, factor);
state._keyboardActive = true;
V.addTo(state._movement, state._delta);
this.compute(event);
this.emit();
}
}
keyUp(event) {
if (!(event.key in KEYS_DELTA_MAP)) return;
this.state._keyboardActive = false;
this.setActive();
this.compute(event);
this.emit();
}
bind(bindFunction) {
const device = this.config.device;
bindFunction(device, 'start', this.pointerDown.bind(this));
if (this.config.pointerCapture) {
bindFunction(device, 'change', this.pointerMove.bind(this));
bindFunction(device, 'end', this.pointerUp.bind(this));
bindFunction(device, 'cancel', this.pointerUp.bind(this));
bindFunction('lostPointerCapture', '', this.pointerUp.bind(this));
}
if (this.config.keys) {
bindFunction('key', 'down', this.keyDown.bind(this));
bindFunction('key', 'up', this.keyUp.bind(this));
}
if (this.config.filterTaps) {
bindFunction('click', '', this.pointerClick.bind(this), {
capture: true,
passive: false
});
}
}
}
function persistEvent(event) {
'persist' in event && typeof event.persist === 'function' && event.persist();
}
const actions_b1cc53c2_esm_isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement;
function supportsTouchEvents() {
return actions_b1cc53c2_esm_isBrowser && 'ontouchstart' in window;
}
function isTouchScreen() {
return supportsTouchEvents() || actions_b1cc53c2_esm_isBrowser && window.navigator.maxTouchPoints > 1;
}
function supportsPointerEvents() {
return actions_b1cc53c2_esm_isBrowser && 'onpointerdown' in window;
}
function supportsPointerLock() {
return actions_b1cc53c2_esm_isBrowser && 'exitPointerLock' in window.document;
}
function supportsGestureEvents() {
try {
return 'constructor' in GestureEvent;
} catch (e) {
return false;
}
}
const SUPPORT = {
isBrowser: actions_b1cc53c2_esm_isBrowser,
gesture: supportsGestureEvents(),
touch: isTouchScreen(),
touchscreen: isTouchScreen(),
pointer: supportsPointerEvents(),
pointerLock: supportsPointerLock()
};
const DEFAULT_PREVENT_SCROLL_DELAY = 250;
const DEFAULT_DRAG_DELAY = 180;
const DEFAULT_SWIPE_VELOCITY = 0.5;
const DEFAULT_SWIPE_DISTANCE = 50;
const DEFAULT_SWIPE_DURATION = 250;
const DEFAULT_KEYBOARD_DISPLACEMENT = 10;
const DEFAULT_DRAG_AXIS_THRESHOLD = {
mouse: 0,
touch: 0,
pen: 8
};
const dragConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, {
device(_v, _k, {
pointer: {
touch = false,
lock = false,
mouse = false
} = {}
}) {
this.pointerLock = lock && SUPPORT.pointerLock;
if (SUPPORT.touch && touch) return 'touch';
if (this.pointerLock) return 'mouse';
if (SUPPORT.pointer && !mouse) return 'pointer';
if (SUPPORT.touch) return 'touch';
return 'mouse';
},
preventScrollAxis(value, _k, {
preventScroll
}) {
this.preventScrollDelay = typeof preventScroll === 'number' ? preventScroll : preventScroll || preventScroll === undefined && value ? DEFAULT_PREVENT_SCROLL_DELAY : undefined;
if (!SUPPORT.touchscreen || preventScroll === false) return undefined;
return value ? value : preventScroll !== undefined ? 'y' : undefined;
},
pointerCapture(_v, _k, {
pointer: {
capture = true,
buttons = 1,
keys = true
} = {}
}) {
this.pointerButtons = buttons;
this.keys = keys;
return !this.pointerLock && this.device === 'pointer' && capture;
},
threshold(value, _k, {
filterTaps = false,
tapsThreshold = 3,
axis = undefined
}) {
const threshold = V.toVector(value, filterTaps ? tapsThreshold : axis ? 1 : 0);
this.filterTaps = filterTaps;
this.tapsThreshold = tapsThreshold;
return threshold;
},
swipe({
velocity = DEFAULT_SWIPE_VELOCITY,
distance = DEFAULT_SWIPE_DISTANCE,
duration = DEFAULT_SWIPE_DURATION
} = {}) {
return {
velocity: this.transform(V.toVector(velocity)),
distance: this.transform(V.toVector(distance)),
duration
};
},
delay(value = 0) {
switch (value) {
case true:
return DEFAULT_DRAG_DELAY;
case false:
return 0;
default:
return value;
}
},
axisThreshold(value) {
if (!value) return DEFAULT_DRAG_AXIS_THRESHOLD;
return _objectSpread2(_objectSpread2({}, DEFAULT_DRAG_AXIS_THRESHOLD), value);
},
keyboardDisplacement(value = DEFAULT_KEYBOARD_DISPLACEMENT) {
return value;
}
});
if (false) {}
function clampStateInternalMovementToBounds(state) {
const [ox, oy] = state.overflow;
const [dx, dy] = state._delta;
const [dirx, diry] = state._direction;
if (ox < 0 && dx > 0 && dirx < 0 || ox > 0 && dx < 0 && dirx > 0) {
state._movement[0] = state._movementBound[0];
}
if (oy < 0 && dy > 0 && diry < 0 || oy > 0 && dy < 0 && diry > 0) {
state._movement[1] = state._movementBound[1];
}
}
const SCALE_ANGLE_RATIO_INTENT_DEG = 30;
const PINCH_WHEEL_RATIO = 100;
class PinchEngine extends Engine {
constructor(...args) {
super(...args);
_defineProperty(this, "ingKey", 'pinching');
_defineProperty(this, "aliasKey", 'da');
}
init() {
this.state.offset = [1, 0];
this.state.lastOffset = [1, 0];
this.state._pointerEvents = new Map();
}
reset() {
super.reset();
const state = this.state;
state._touchIds = [];
state.canceled = false;
state.cancel = this.cancel.bind(this);
state.turns = 0;
}
computeOffset() {
const {
type,
movement,
lastOffset
} = this.state;
if (type === 'wheel') {
this.state.offset = V.add(movement, lastOffset);
} else {
this.state.offset = [(1 + movement[0]) * lastOffset[0], movement[1] + lastOffset[1]];
}
}
computeMovement() {
const {
offset,
lastOffset
} = this.state;
this.state.movement = [offset[0] / lastOffset[0], offset[1] - lastOffset[1]];
}
axisIntent() {
const state = this.state;
const [_m0, _m1] = state._movement;
if (!state.axis) {
const axisMovementDifference = Math.abs(_m0) * SCALE_ANGLE_RATIO_INTENT_DEG - Math.abs(_m1);
if (axisMovementDifference < 0) state.axis = 'angle';else if (axisMovementDifference > 0) state.axis = 'scale';
}
}
restrictToAxis(v) {
if (this.config.lockDirection) {
if (this.state.axis === 'scale') v[1] = 0;else if (this.state.axis === 'angle') v[0] = 0;
}
}
cancel() {
const state = this.state;
if (state.canceled) return;
setTimeout(() => {
state.canceled = true;
state._active = false;
this.compute();
this.emit();
}, 0);
}
touchStart(event) {
this.ctrl.setEventIds(event);
const state = this.state;
const ctrlTouchIds = this.ctrl.touchIds;
if (state._active) {
if (state._touchIds.every(id => ctrlTouchIds.has(id))) return;
}
if (ctrlTouchIds.size < 2) return;
this.start(event);
state._touchIds = Array.from(ctrlTouchIds).slice(0, 2);
const payload = touchDistanceAngle(event, state._touchIds);
this.pinchStart(event, payload);
}
pointerStart(event) {
if (event.buttons != null && event.buttons % 2 !== 1) return;
this.ctrl.setEventIds(event);
event.target.setPointerCapture(event.pointerId);
const state = this.state;
const _pointerEvents = state._pointerEvents;
const ctrlPointerIds = this.ctrl.pointerIds;
if (state._active) {
if (Array.from(_pointerEvents.keys()).every(id => ctrlPointerIds.has(id))) return;
}
if (_pointerEvents.size < 2) {
_pointerEvents.set(event.pointerId, event);
}
if (state._pointerEvents.size < 2) return;
this.start(event);
const payload = distanceAngle(...Array.from(_pointerEvents.values()));
this.pinchStart(event, payload);
}
pinchStart(event, payload) {
const state = this.state;
state.origin = payload.origin;
this.computeValues([payload.distance, payload.angle]);
this.computeInitial();
this.compute(event);
this.emit();
}
touchMove(event) {
if (!this.state._active) return;
const payload = touchDistanceAngle(event, this.state._touchIds);
this.pinchMove(event, payload);
}
pointerMove(event) {
const _pointerEvents = this.state._pointerEvents;
if (_pointerEvents.has(event.pointerId)) {
_pointerEvents.set(event.pointerId, event);
}
if (!this.state._active) return;
const payload = distanceAngle(...Array.from(_pointerEvents.values()));
this.pinchMove(event, payload);
}
pinchMove(event, payload) {
const state = this.state;
const prev_a = state._values[1];
const delta_a = payload.angle - prev_a;
let delta_turns = 0;
if (Math.abs(delta_a) > 270) delta_turns += Math.sign(delta_a);
this.computeValues([payload.distance, payload.angle - 360 * delta_turns]);
state.origin = payload.origin;
state.turns = delta_turns;
state._movement = [state._values[0] / state._initial[0] - 1, state._values[1] - state._initial[1]];
this.compute(event);
this.emit();
}
touchEnd(event) {
this.ctrl.setEventIds(event);
if (!this.state._active) return;
if (this.state._touchIds.some(id => !this.ctrl.touchIds.has(id))) {
this.state._active = false;
this.compute(event);
this.emit();
}
}
pointerEnd(event) {
const state = this.state;
this.ctrl.setEventIds(event);
try {
event.target.releasePointerCapture(event.pointerId);
} catch (_unused) {}
if (state._pointerEvents.has(event.pointerId)) {
state._pointerEvents.delete(event.pointerId);
}
if (!state._active) return;
if (state._pointerEvents.size < 2) {
state._active = false;
this.compute(event);
this.emit();
}
}
gestureStart(event) {
if (event.cancelable) event.preventDefault();
const state = this.state;
if (state._active) return;
this.start(event);
this.computeValues([event.scale, event.rotation]);
state.origin = [event.clientX, event.clientY];
this.compute(event);
this.emit();
}
gestureMove(event) {
if (event.cancelable) event.preventDefault();
if (!this.state._active) return;
const state = this.state;
this.computeValues([event.scale, event.rotation]);
state.origin = [event.clientX, event.clientY];
const _previousMovement = state._movement;
state._movement = [event.scale - 1, event.rotation];
state._delta = V.sub(state._movement, _previousMovement);
this.compute(event);
this.emit();
}
gestureEnd(event) {
if (!this.state._active) return;
this.state._active = false;
this.compute(event);
this.emit();
}
wheel(event) {
const modifierKey = this.config.modifierKey;
if (modifierKey && !event[modifierKey]) return;
if (!this.state._active) this.wheelStart(event);else this.wheelChange(event);
this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this));
}
wheelStart(event) {
this.start(event);
this.wheelChange(event);
}
wheelChange(event) {
const isR3f = ('uv' in event);
if (!isR3f) {
if (event.cancelable) {
event.preventDefault();
}
if (false) {}
}
const state = this.state;
state._delta = [-wheelValues(event)[1] / PINCH_WHEEL_RATIO * state.offset[0], 0];
V.addTo(state._movement, state._delta);
clampStateInternalMovementToBounds(state);
this.state.origin = [event.clientX, event.clientY];
this.compute(event);
this.emit();
}
wheelEnd() {
if (!this.state._active) return;
this.state._active = false;
this.compute();
this.emit();
}
bind(bindFunction) {
const device = this.config.device;
if (!!device) {
bindFunction(device, 'start', this[device + 'Start'].bind(this));
bindFunction(device, 'change', this[device + 'Move'].bind(this));
bindFunction(device, 'end', this[device + 'End'].bind(this));
bindFunction(device, 'cancel', this[device + 'End'].bind(this));
}
if (this.config.pinchOnWheel) {
bindFunction('wheel', '', this.wheel.bind(this), {
passive: false
});
}
}
}
const pinchConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, {
device(_v, _k, {
shared,
pointer: {
touch = false
} = {}
}) {
const sharedConfig = shared;
if (sharedConfig.target && !SUPPORT.touch && SUPPORT.gesture) return 'gesture';
if (SUPPORT.touch && touch) return 'touch';
if (SUPPORT.touchscreen) {
if (SUPPORT.pointer) return 'pointer';
if (SUPPORT.touch) return 'touch';
}
},
bounds(_v, _k, {
scaleBounds = {},
angleBounds = {}
}) {
const _scaleBounds = state => {
const D = assignDefault(call(scaleBounds, state), {
min: -Infinity,
max: Infinity
});
return [D.min, D.max];
};
const _angleBounds = state => {
const A = assignDefault(call(angleBounds, state), {
min: -Infinity,
max: Infinity
});
return [A.min, A.max];
};
if (typeof scaleBounds !== 'function' && typeof angleBounds !== 'function') return [_scaleBounds(), _angleBounds()];
return state => [_scaleBounds(state), _angleBounds(state)];
},
threshold(value, _k, config) {
this.lockDirection = config.axis === 'lock';
const threshold = V.toVector(value, this.lockDirection ? [0.1, 3] : 0);
return threshold;
},
modifierKey(value) {
if (value === undefined) return 'ctrlKey';
return value;
},
pinchOnWheel(value = true) {
return value;
}
});
class MoveEngine extends CoordinatesEngine {
constructor(...args) {
super(...args);
_defineProperty(this, "ingKey", 'moving');
}
move(event) {
if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
if (!this.state._active) this.moveStart(event);else this.moveChange(event);
this.timeoutStore.add('moveEnd', this.moveEnd.bind(this));
}
moveStart(event) {
this.start(event);
this.computeValues(pointerValues(event));
this.compute(event);
this.computeInitial();
this.emit();
}
moveChange(event) {
if (!this.state._active) return;
const values = pointerValues(event);
const state = this.state;
state._delta = V.sub(values, state._values);
V.addTo(state._movement, state._delta);
this.computeValues(values);
this.compute(event);
this.emit();
}
moveEnd(event) {
if (!this.state._active) return;
this.state._active = false;
this.compute(event);
this.emit();
}
bind(bindFunction) {
bindFunction('pointer', 'change', this.move.bind(this));
bindFunction('pointer', 'leave', this.moveEnd.bind(this));
}
}
const moveConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, {
mouseOnly: (value = true) => value
});
class ScrollEngine extends CoordinatesEngine {
constructor(...args) {
super(...args);
_defineProperty(this, "ingKey", 'scrolling');
}
scroll(event) {
if (!this.state._active) this.start(event);
this.scrollChange(event);
this.timeoutStore.add('scrollEnd', this.scrollEnd.bind(this));
}
scrollChange(event) {
if (event.cancelable) event.preventDefault();
const state = this.state;
const values = scrollValues(event);
state._delta = V.sub(values, state._values);
V.addTo(state._movement, state._delta);
this.computeValues(values);
this.compute(event);
this.emit();
}
scrollEnd() {
if (!this.state._active) return;
this.state._active = false;
this.compute();
this.emit();
}
bind(bindFunction) {
bindFunction('scroll', '', this.scroll.bind(this));
}
}
const scrollConfigResolver = coordinatesConfigResolver;
class WheelEngine extends CoordinatesEngine {
constructor(...args) {
super(...args);
_defineProperty(this, "ingKey", 'wheeling');
}
wheel(event) {
if (!this.state._active) this.start(event);
this.wheelChange(event);
this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this));
}
wheelChange(event) {
const state = this.state;
state._delta = wheelValues(event);
V.addTo(state._movement, state._delta);
clampStateInternalMovementToBounds(state);
this.compute(event);
this.emit();
}
wheelEnd() {
if (!this.state._active) return;
this.state._active = false;
this.compute();
this.emit();
}
bind(bindFunction) {
bindFunction('wheel', '', this.wheel.bind(this));
}
}
const wheelConfigResolver = coordinatesConfigResolver;
class HoverEngine extends CoordinatesEngine {
constructor(...args) {
super(...args);
_defineProperty(this, "ingKey", 'hovering');
}
enter(event) {
if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
this.start(event);
this.computeValues(pointerValues(event));
this.compute(event);
this.emit();
}
leave(event) {
if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
const state = this.state;
if (!state._active) return;
state._active = false;
const values = pointerValues(event);
state._movement = state._delta = V.sub(values, state._values);
this.computeValues(values);
this.compute(event);
state.delta = state.movement;
this.emit();
}
bind(bindFunction) {
bindFunction('pointer', 'enter', this.enter.bind(this));
bindFunction('pointer', 'leave', this.leave.bind(this));
}
}
const hoverConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, {
mouseOnly: (value = true) => value
});
const actions_b1cc53c2_esm_EngineMap = new Map();
const ConfigResolverMap = new Map();
function actions_b1cc53c2_esm_registerAction(action) {
actions_b1cc53c2_esm_EngineMap.set(action.key, action.engine);
ConfigResolverMap.set(action.key, action.resolver);
}
const actions_b1cc53c2_esm_dragAction = {
key: 'drag',
engine: DragEngine,
resolver: dragConfigResolver
};
const actions_b1cc53c2_esm_hoverAction = {
key: 'hover',
engine: HoverEngine,
resolver: hoverConfigResolver
};
const actions_b1cc53c2_esm_moveAction = {
key: 'move',
engine: MoveEngine,
resolver: moveConfigResolver
};
const actions_b1cc53c2_esm_pinchAction = {
key: 'pinch',
engine: PinchEngine,
resolver: pinchConfigResolver
};
const actions_b1cc53c2_esm_scrollAction = {
key: 'scroll',
engine: ScrollEngine,
resolver: scrollConfigResolver
};
const actions_b1cc53c2_esm_wheelAction = {
key: 'wheel',
engine: WheelEngine,
resolver: wheelConfigResolver
};
;// CONCATENATED MODULE: ./node_modules/@use-gesture/core/dist/use-gesture-core.esm.js
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
const sharedConfigResolver = {
target(value) {
if (value) {
return () => 'current' in value ? value.current : value;
}
return undefined;
},
enabled(value = true) {
return value;
},
window(value = SUPPORT.isBrowser ? window : undefined) {
return value;
},
eventOptions({
passive = true,
capture = false
} = {}) {
return {
passive,
capture
};
},
transform(value) {
return value;
}
};
const _excluded = ["target", "eventOptions", "window", "enabled", "transform"];
function resolveWith(config = {}, resolvers) {
const result = {};
for (const [key, resolver] of Object.entries(resolvers)) {
switch (typeof resolver) {
case 'function':
if (false) {} else {
result[key] = resolver.call(result, config[key], key, config);
}
break;
case 'object':
result[key] = resolveWith(config[key], resolver);
break;
case 'boolean':
if (resolver) result[key] = config[key];
break;
}
}
return result;
}
function use_gesture_core_esm_parse(newConfig, gestureKey, _config = {}) {
const _ref = newConfig,
{
target,
eventOptions,
window,
enabled,
transform
} = _ref,
rest = _objectWithoutProperties(_ref, _excluded);
_config.shared = resolveWith({
target,
eventOptions,
window,
enabled,
transform
}, sharedConfigResolver);
if (gestureKey) {
const resolver = ConfigResolverMap.get(gestureKey);
_config[gestureKey] = resolveWith(_objectSpread2({
shared: _config.shared
}, rest), resolver);
} else {
for (const key in rest) {
const resolver = ConfigResolverMap.get(key);
if (resolver) {
_config[key] = resolveWith(_objectSpread2({
shared: _config.shared
}, rest[key]), resolver);
} else if (false) {}
}
}
return _config;
}
class EventStore {
constructor(ctrl, gestureKey) {
_defineProperty(this, "_listeners", new Set());
this._ctrl = ctrl;
this._gestureKey = gestureKey;
}
add(element, device, action, handler, options) {
const listeners = this._listeners;
const type = toDomEventType(device, action);
const _options = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {};
const eventOptions = _objectSpread2(_objectSpread2({}, _options), options);
element.addEventListener(type, handler, eventOptions);
const remove = () => {
element.removeEventListener(type, handler, eventOptions);
listeners.delete(remove);
};
listeners.add(remove);
return remove;
}
clean() {
this._listeners.forEach(remove => remove());
this._listeners.clear();
}
}
class TimeoutStore {
constructor() {
_defineProperty(this, "_timeouts", new Map());
}
add(key, callback, ms = 140, ...args) {
this.remove(key);
this._timeouts.set(key, window.setTimeout(callback, ms, ...args));
}
remove(key) {
const timeout = this._timeouts.get(key);
if (timeout) window.clearTimeout(timeout);
}
clean() {
this._timeouts.forEach(timeout => void window.clearTimeout(timeout));
this._timeouts.clear();
}
}
class Controller {
constructor(handlers) {
_defineProperty(this, "gestures", new Set());
_defineProperty(this, "_targetEventStore", new EventStore(this));
_defineProperty(this, "gestureEventStores", {});
_defineProperty(this, "gestureTimeoutStores", {});
_defineProperty(this, "handlers", {});
_defineProperty(this, "config", {});
_defineProperty(this, "pointerIds", new Set());
_defineProperty(this, "touchIds", new Set());
_defineProperty(this, "state", {
shared: {
shiftKey: false,
metaKey: false,
ctrlKey: false,
altKey: false
}
});
resolveGestures(this, handlers);
}
setEventIds(event) {
if (isTouch(event)) {
this.touchIds = new Set(touchIds(event));
return this.touchIds;
} else if ('pointerId' in event) {
if (event.type === 'pointerup' || event.type === 'pointercancel') this.pointerIds.delete(event.pointerId);else if (event.type === 'pointerdown') this.pointerIds.add(event.pointerId);
return this.pointerIds;
}
}
applyHandlers(handlers, nativeHandlers) {
this.handlers = handlers;
this.nativeHandlers = nativeHandlers;
}
applyConfig(config, gestureKey) {
this.config = use_gesture_core_esm_parse(config, gestureKey, this.config);
}
clean() {
this._targetEventStore.clean();
for (const key of this.gestures) {
this.gestureEventStores[key].clean();
this.gestureTimeoutStores[key].clean();
}
}
effect() {
if (this.config.shared.target) this.bind();
return () => this._targetEventStore.clean();
}
bind(...args) {
const sharedConfig = this.config.shared;
const props = {};
let target;
if (sharedConfig.target) {
target = sharedConfig.target();
if (!target) return;
}
if (sharedConfig.enabled) {
for (const gestureKey of this.gestures) {
const gestureConfig = this.config[gestureKey];
const bindFunction = bindToProps(props, gestureConfig.eventOptions, !!target);
if (gestureConfig.enabled) {
const Engine = actions_b1cc53c2_esm_EngineMap.get(gestureKey);
new Engine(this, args, gestureKey).bind(bindFunction);
}
}
const nativeBindFunction = bindToProps(props, sharedConfig.eventOptions, !!target);
for (const eventKey in this.nativeHandlers) {
nativeBindFunction(eventKey, '', event => this.nativeHandlers[eventKey](_objectSpread2(_objectSpread2({}, this.state.shared), {}, {
event,
args
})), undefined, true);
}
}
for (const handlerProp in props) {
props[handlerProp] = actions_b1cc53c2_esm_chain(...props[handlerProp]);
}
if (!target) return props;
for (const handlerProp in props) {
const {
device,
capture,
passive
} = parseProp(handlerProp);
this._targetEventStore.add(target, device, '', props[handlerProp], {
capture,
passive
});
}
}
}
function setupGesture(ctrl, gestureKey) {
ctrl.gestures.add(gestureKey);
ctrl.gestureEventStores[gestureKey] = new EventStore(ctrl, gestureKey);
ctrl.gestureTimeoutStores[gestureKey] = new TimeoutStore();
}
function resolveGestures(ctrl, internalHandlers) {
if (internalHandlers.drag) setupGesture(ctrl, 'drag');
if (internalHandlers.wheel) setupGesture(ctrl, 'wheel');
if (internalHandlers.scroll) setupGesture(ctrl, 'scroll');
if (internalHandlers.move) setupGesture(ctrl, 'move');
if (internalHandlers.pinch) setupGesture(ctrl, 'pinch');
if (internalHandlers.hover) setupGesture(ctrl, 'hover');
}
const bindToProps = (props, eventOptions, withPassiveOption) => (device, action, handler, options = {}, isNative = false) => {
var _options$capture, _options$passive;
const capture = (_options$capture = options.capture) !== null && _options$capture !== void 0 ? _options$capture : eventOptions.capture;
const passive = (_options$passive = options.passive) !== null && _options$passive !== void 0 ? _options$passive : eventOptions.passive;
let handlerProp = isNative ? device : toHandlerProp(device, action, capture);
if (withPassiveOption && passive) handlerProp += 'Passive';
props[handlerProp] = props[handlerProp] || [];
props[handlerProp].push(handler);
};
const RE_NOT_NATIVE = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;
function sortHandlers(_handlers) {
const native = {};
const handlers = {};
const actions = new Set();
for (let key in _handlers) {
if (RE_NOT_NATIVE.test(key)) {
actions.add(RegExp.lastMatch);
handlers[key] = _handlers[key];
} else {
native[key] = _handlers[key];
}
}
return [handlers, native, actions];
}
function registerGesture(actions, handlers, handlerKey, key, internalHandlers, config) {
if (!actions.has(handlerKey)) return;
if (!EngineMap.has(key)) {
if (false) {}
return;
}
const startKey = handlerKey + 'Start';
const endKey = handlerKey + 'End';
const fn = state => {
let memo = undefined;
if (state.first && startKey in handlers) handlers[startKey](state);
if (handlerKey in handlers) memo = handlers[handlerKey](state);
if (state.last && endKey in handlers) handlers[endKey](state);
return memo;
};
internalHandlers[key] = fn;
config[key] = config[key] || {};
}
function use_gesture_core_esm_parseMergedHandlers(mergedHandlers, mergedConfig) {
const [handlers, nativeHandlers, actions] = sortHandlers(mergedHandlers);
const internalHandlers = {};
registerGesture(actions, handlers, 'onDrag', 'drag', internalHandlers, mergedConfig);
registerGesture(actions, handlers, 'onWheel', 'wheel', internalHandlers, mergedConfig);
registerGesture(actions, handlers, 'onScroll', 'scroll', internalHandlers, mergedConfig);
registerGesture(actions, handlers, 'onPinch', 'pinch', internalHandlers, mergedConfig);
registerGesture(actions, handlers, 'onMove', 'move', internalHandlers, mergedConfig);
registerGesture(actions, handlers, 'onHover', 'hover', internalHandlers, mergedConfig);
return {
handlers: internalHandlers,
config: mergedConfig,
nativeHandlers
};
}
;// CONCATENATED MODULE: ./node_modules/@use-gesture/react/dist/use-gesture-react.esm.js
function useRecognizers(handlers, config = {}, gestureKey, nativeHandlers) {
const ctrl = external_React_default().useMemo(() => new Controller(handlers), []);
ctrl.applyHandlers(handlers, nativeHandlers);
ctrl.applyConfig(config, gestureKey);
external_React_default().useEffect(ctrl.effect.bind(ctrl));
external_React_default().useEffect(() => {
return ctrl.clean.bind(ctrl);
}, []);
if (config.target === undefined) {
return ctrl.bind.bind(ctrl);
}
return undefined;
}
function useDrag(handler, config) {
actions_b1cc53c2_esm_registerAction(actions_b1cc53c2_esm_dragAction);
return useRecognizers({
drag: handler
}, config || {}, 'drag');
}
function usePinch(handler, config) {
registerAction(pinchAction);
return useRecognizers({
pinch: handler
}, config || {}, 'pinch');
}
function useWheel(handler, config) {
registerAction(wheelAction);
return useRecognizers({
wheel: handler
}, config || {}, 'wheel');
}
function useScroll(handler, config) {
registerAction(scrollAction);
return useRecognizers({
scroll: handler
}, config || {}, 'scroll');
}
function useMove(handler, config) {
registerAction(moveAction);
return useRecognizers({
move: handler
}, config || {}, 'move');
}
function useHover(handler, config) {
registerAction(hoverAction);
return useRecognizers({
hover: handler
}, config || {}, 'hover');
}
function createUseGesture(actions) {
actions.forEach(registerAction);
return function useGesture(_handlers, _config) {
const {
handlers,
nativeHandlers,
config
} = parseMergedHandlers(_handlers, _config || {});
return useRecognizers(handlers, config, undefined, nativeHandlers);
};
}
function useGesture(handlers, config) {
const hook = createUseGesture([dragAction, pinchAction, scrollAction, wheelAction, moveAction, hoverAction]);
return hook(handlers, config || {});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Gets a CSS cursor value based on a drag direction.
*
* @param dragDirection The drag direction.
* @return The CSS cursor value.
*/
function getDragCursor(dragDirection) {
let dragCursor = 'ns-resize';
switch (dragDirection) {
case 'n':
case 's':
dragCursor = 'ns-resize';
break;
case 'e':
case 'w':
dragCursor = 'ew-resize';
break;
}
return dragCursor;
}
/**
* Custom hook that renders a drag cursor when dragging.
*
* @param {boolean} isDragging The dragging state.
* @param {string} dragDirection The drag direction.
*
* @return {string} The CSS cursor value.
*/
function useDragCursor(isDragging, dragDirection) {
const dragCursor = getDragCursor(dragDirection);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (isDragging) {
document.documentElement.style.cursor = dragCursor;
} else {
// @ts-expect-error
document.documentElement.style.cursor = null;
}
}, [isDragging, dragCursor]);
return dragCursor;
}
function useDraft(props) {
const refPreviousValue = (0,external_wp_element_namespaceObject.useRef)(props.value);
const [draft, setDraft] = (0,external_wp_element_namespaceObject.useState)({});
const value = draft.value !== undefined ? draft.value : props.value;
// Determines when to discard the draft value to restore controlled status.
// To do so, it tracks the previous value and marks the draft value as stale
// after each render.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
const {
current: previousValue
} = refPreviousValue;
refPreviousValue.current = props.value;
if (draft.value !== undefined && !draft.isStale) setDraft({
...draft,
isStale: true
});else if (draft.isStale && props.value !== previousValue) setDraft({});
}, [props.value, draft]);
const onChange = (nextValue, extra) => {
// Mutates the draft value to avoid an extra effect run.
setDraft(current => Object.assign(current, {
value: nextValue,
isStale: false
}));
props.onChange(nextValue, extra);
};
const onBlur = event => {
setDraft({});
props.onBlur?.(event);
};
return {
value,
onBlur,
onChange
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/reducer/state.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const initialStateReducer = state => state;
const initialInputControlState = {
error: null,
initialValue: '',
isDirty: false,
isDragEnabled: false,
isDragging: false,
isPressEnterToChange: false,
value: ''
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/reducer/actions.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const CHANGE = 'CHANGE';
const COMMIT = 'COMMIT';
const CONTROL = 'CONTROL';
const DRAG_END = 'DRAG_END';
const DRAG_START = 'DRAG_START';
const DRAG = 'DRAG';
const INVALIDATE = 'INVALIDATE';
const PRESS_DOWN = 'PRESS_DOWN';
const PRESS_ENTER = 'PRESS_ENTER';
const PRESS_UP = 'PRESS_UP';
const RESET = 'RESET';
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/reducer/reducer.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Prepares initialState for the reducer.
*
* @param initialState The initial state.
* @return Prepared initialState for the reducer
*/
function mergeInitialState(initialState = initialInputControlState) {
const {
value
} = initialState;
return {
...initialInputControlState,
...initialState,
initialValue: value
};
}
/**
* Creates the base reducer which may be coupled to a specializing reducer.
* As its final step, for all actions other than CONTROL, the base reducer
* passes the state and action on through the specializing reducer. The
* exception for CONTROL actions is because they represent controlled updates
* from props and no case has yet presented for their specialization.
*
* @param composedStateReducers A reducer to specialize state changes.
* @return The reducer.
*/
function inputControlStateReducer(composedStateReducers) {
return (state, action) => {
const nextState = {
...state
};
switch (action.type) {
/*
* Controlled updates
*/
case CONTROL:
nextState.value = action.payload.value;
nextState.isDirty = false;
nextState._event = undefined;
// Returns immediately to avoid invoking additional reducers.
return nextState;
/**
* Keyboard events
*/
case PRESS_UP:
nextState.isDirty = false;
break;
case PRESS_DOWN:
nextState.isDirty = false;
break;
/**
* Drag events
*/
case DRAG_START:
nextState.isDragging = true;
break;
case DRAG_END:
nextState.isDragging = false;
break;
/**
* Input events
*/
case CHANGE:
nextState.error = null;
nextState.value = action.payload.value;
if (state.isPressEnterToChange) {
nextState.isDirty = true;
}
break;
case COMMIT:
nextState.value = action.payload.value;
nextState.isDirty = false;
break;
case RESET:
nextState.error = null;
nextState.isDirty = false;
nextState.value = action.payload.value || state.initialValue;
break;
/**
* Validation
*/
case INVALIDATE:
nextState.error = action.payload.error;
break;
}
nextState._event = action.payload.event;
/**
* Send the nextState + action to the composedReducers via
* this "bridge" mechanism. This allows external stateReducers
* to hook into actions, and modify state if needed.
*/
return composedStateReducers(nextState, action);
};
}
/**
* A custom hook that connects and external stateReducer with an internal
* reducer. This hook manages the internal state of InputControl.
* However, by connecting an external stateReducer function, other
* components can react to actions as well as modify state before it is
* applied.
*
* This technique uses the "stateReducer" design pattern:
* https://kentcdodds.com/blog/the-state-reducer-pattern/
*
* @param stateReducer An external state reducer.
* @param initialState The initial state for the reducer.
* @param onChangeHandler A handler for the onChange event.
* @return State, dispatch, and a collection of actions.
*/
function useInputControlStateReducer(stateReducer = initialStateReducer, initialState = initialInputControlState, onChangeHandler) {
const [state, dispatch] = (0,external_wp_element_namespaceObject.useReducer)(inputControlStateReducer(stateReducer), mergeInitialState(initialState));
const createChangeEvent = type => (nextValue, event) => {
dispatch({
type,
payload: {
value: nextValue,
event
}
});
};
const createKeyEvent = type => event => {
dispatch({
type,
payload: {
event
}
});
};
const createDragEvent = type => payload => {
dispatch({
type,
payload
});
};
/**
* Actions for the reducer
*/
const change = createChangeEvent(CHANGE);
const invalidate = (error, event) => dispatch({
type: INVALIDATE,
payload: {
error,
event
}
});
const reset = createChangeEvent(RESET);
const commit = createChangeEvent(COMMIT);
const dragStart = createDragEvent(DRAG_START);
const drag = createDragEvent(DRAG);
const dragEnd = createDragEvent(DRAG_END);
const pressUp = createKeyEvent(PRESS_UP);
const pressDown = createKeyEvent(PRESS_DOWN);
const pressEnter = createKeyEvent(PRESS_ENTER);
const currentState = (0,external_wp_element_namespaceObject.useRef)(state);
const refProps = (0,external_wp_element_namespaceObject.useRef)({
value: initialState.value,
onChangeHandler
});
// Freshens refs to props and state so that subsequent effects have access
// to their latest values without their changes causing effect runs.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
currentState.current = state;
refProps.current = {
value: initialState.value,
onChangeHandler
};
});
// Propagates the latest state through onChange.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (currentState.current._event !== undefined && state.value !== refProps.current.value && !state.isDirty) {
var _state$value;
refProps.current.onChangeHandler((_state$value = state.value) !== null && _state$value !== void 0 ? _state$value : '', {
event: currentState.current._event
});
}
}, [state.value, state.isDirty]);
// Updates the state from props.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (initialState.value !== currentState.current.value && !currentState.current.isDirty) {
var _initialState$value;
dispatch({
type: CONTROL,
payload: {
value: (_initialState$value = initialState.value) !== null && _initialState$value !== void 0 ? _initialState$value : ''
}
});
}
}, [initialState.value]);
return {
change,
commit,
dispatch,
drag,
dragEnd,
dragStart,
invalidate,
pressDown,
pressEnter,
pressUp,
reset,
state
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-field.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const input_field_noop = () => {};
function InputField({
disabled = false,
dragDirection = 'n',
dragThreshold = 10,
id,
isDragEnabled = false,
isFocused,
isPressEnterToChange = false,
onBlur = input_field_noop,
onChange = input_field_noop,
onDrag = input_field_noop,
onDragEnd = input_field_noop,
onDragStart = input_field_noop,
onFocus = input_field_noop,
onKeyDown = input_field_noop,
onValidate = input_field_noop,
size = 'default',
setIsFocused,
stateReducer = state => state,
value: valueProp,
type,
...props
}, ref) {
const {
// State.
state,
// Actions.
change,
commit,
drag,
dragEnd,
dragStart,
invalidate,
pressDown,
pressEnter,
pressUp,
reset
} = useInputControlStateReducer(stateReducer, {
isDragEnabled,
value: valueProp,
isPressEnterToChange
}, onChange);
const {
value,
isDragging,
isDirty
} = state;
const wasDirtyOnBlur = (0,external_wp_element_namespaceObject.useRef)(false);
const dragCursor = useDragCursor(isDragging, dragDirection);
const handleOnBlur = event => {
onBlur(event);
setIsFocused?.(false);
/**
* If isPressEnterToChange is set, this commits the value to
* the onChange callback.
*/
if (isDirty || !event.target.validity.valid) {
wasDirtyOnBlur.current = true;
handleOnCommit(event);
}
};
const handleOnFocus = event => {
onFocus(event);
setIsFocused?.(true);
};
const handleOnChange = event => {
const nextValue = event.target.value;
change(nextValue, event);
};
const handleOnCommit = event => {
const nextValue = event.currentTarget.value;
try {
onValidate(nextValue);
commit(nextValue, event);
} catch (err) {
invalidate(err, event);
}
};
const handleOnKeyDown = event => {
const {
key
} = event;
onKeyDown(event);
switch (key) {
case 'ArrowUp':
pressUp(event);
break;
case 'ArrowDown':
pressDown(event);
break;
case 'Enter':
pressEnter(event);
if (isPressEnterToChange) {
event.preventDefault();
handleOnCommit(event);
}
break;
case 'Escape':
if (isPressEnterToChange && isDirty) {
event.preventDefault();
reset(valueProp, event);
}
break;
}
};
const dragGestureProps = useDrag(dragProps => {
const {
distance,
dragging,
event,
target
} = dragProps;
// The `target` prop always references the `input` element while, by
// default, the `dragProps.event.target` property would reference the real
// event target (i.e. any DOM element that the pointer is hovering while
// dragging). Ensuring that the `target` is always the `input` element
// allows consumers of `InputControl` (or any higher-level control) to
// check the input's validity by accessing `event.target.validity.valid`.
dragProps.event = {
...dragProps.event,
target
};
if (!distance) return;
event.stopPropagation();
/**
* Quick return if no longer dragging.
* This prevents unnecessary value calculations.
*/
if (!dragging) {
onDragEnd(dragProps);
dragEnd(dragProps);
return;
}
onDrag(dragProps);
drag(dragProps);
if (!isDragging) {
onDragStart(dragProps);
dragStart(dragProps);
}
}, {
axis: dragDirection === 'e' || dragDirection === 'w' ? 'x' : 'y',
threshold: dragThreshold,
enabled: isDragEnabled,
pointer: {
capture: false
}
});
const dragProps = isDragEnabled ? dragGestureProps() : {};
/*
* Works around the odd UA (e.g. Firefox) that does not focus inputs of
* type=number when their spinner arrows are pressed.
*/
let handleOnMouseDown;
if (type === 'number') {
handleOnMouseDown = event => {
props.onMouseDown?.(event);
if (event.currentTarget !== event.currentTarget.ownerDocument.activeElement) {
event.currentTarget.focus();
}
};
}
return (0,external_React_.createElement)(Input, {
...props,
...dragProps,
className: "components-input-control__input",
disabled: disabled,
dragCursor: dragCursor,
isDragging: isDragging,
id: id,
onBlur: handleOnBlur,
onChange: handleOnChange,
onFocus: handleOnFocus,
onKeyDown: handleOnKeyDown,
onMouseDown: handleOnMouseDown,
ref: ref,
inputSize: size
// Fallback to `''` to avoid "uncontrolled to controlled" warning.
// See https://github.com/WordPress/gutenberg/pull/47250 for details.
,
value: value !== null && value !== void 0 ? value : '',
type: type
});
}
const ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(InputField);
/* harmony default export */ const input_field = (ForwardedComponent);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/font-values.js
/* harmony default export */ const font_values = ({
'default.fontFamily': "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif",
'default.fontSize': '13px',
'helpText.fontSize': '12px',
mobileTextMinFontSize: '16px'
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/font.js
/**
* Internal dependencies
*/
/**
*
* @param {keyof FONT} value Path of value from `FONT`
* @return {string} Font rule value
*/
function font(value) {
var _FONT$value;
return (_FONT$value = font_values[value]) !== null && _FONT$value !== void 0 ? _FONT$value : '';
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/box-sizing.js
function box_sizing_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
const boxSizingReset = true ? {
name: "kv6lnz",
styles: "box-sizing:border-box;*,*::before,*::after{box-sizing:inherit;}"
} : 0;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/base-control/styles/base-control-styles.js
function base_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const base_control_styles_Wrapper = emotion_styled_base_browser_esm("div", true ? {
target: "ej5x27r4"
} : 0)("font-family:", font('default.fontFamily'), ";font-size:", font('default.fontSize'), ";", boxSizingReset, ";" + ( true ? "" : 0));
const deprecatedMarginField = ({
__nextHasNoMarginBottom = false
}) => {
return !__nextHasNoMarginBottom && /*#__PURE__*/emotion_react_browser_esm_css("margin-bottom:", space(2), ";" + ( true ? "" : 0), true ? "" : 0);
};
const StyledField = emotion_styled_base_browser_esm("div", true ? {
target: "ej5x27r3"
} : 0)(deprecatedMarginField, " .components-panel__row &{margin-bottom:inherit;}" + ( true ? "" : 0));
const labelStyles = /*#__PURE__*/emotion_react_browser_esm_css(baseLabelTypography, ";display:inline-block;margin-bottom:", space(2), ";padding:0;" + ( true ? "" : 0), true ? "" : 0);
const StyledLabel = emotion_styled_base_browser_esm("label", true ? {
target: "ej5x27r2"
} : 0)(labelStyles, ";" + ( true ? "" : 0));
var base_control_styles_ref = true ? {
name: "11yad0w",
styles: "margin-bottom:revert"
} : 0;
const deprecatedMarginHelp = ({
__nextHasNoMarginBottom = false
}) => {
return !__nextHasNoMarginBottom && base_control_styles_ref;
};
const StyledHelp = emotion_styled_base_browser_esm("p", true ? {
target: "ej5x27r1"
} : 0)("margin-top:", space(2), ";margin-bottom:0;font-size:", font('helpText.fontSize'), ";font-style:normal;color:", COLORS.gray[700], ";", deprecatedMarginHelp, ";" + ( true ? "" : 0));
const StyledVisualLabel = emotion_styled_base_browser_esm("span", true ? {
target: "ej5x27r0"
} : 0)(labelStyles, ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/base-control/index.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/**
* `BaseControl` is a component used to generate labels and help text for components handling user inputs.
*
* ```jsx
* import { BaseControl, useBaseControlProps } from '@wordpress/components';
*
* // Render a `BaseControl` for a textarea input
* const MyCustomTextareaControl = ({ children, ...baseProps }) => (
* // `useBaseControlProps` is a convenience hook to get the props for the `BaseControl`
* // and the inner control itself. Namely, it takes care of generating a unique `id`,
* // properly associating it with the `label` and `help` elements.
* const { baseControlProps, controlProps } = useBaseControlProps( baseProps );
*
* return (
* <BaseControl { ...baseControlProps } __nextHasNoMarginBottom={ true }>
* <textarea { ...controlProps }>
* { children }
* </textarea>
* </BaseControl>
* );
* );
* ```
*/
const UnconnectedBaseControl = props => {
const {
__nextHasNoMarginBottom = false,
id,
label,
hideLabelFromVision = false,
help,
className,
children
} = useContextSystem(props, 'BaseControl');
return (0,external_React_.createElement)(base_control_styles_Wrapper, {
className: className
}, (0,external_React_.createElement)(StyledField, {
className: "components-base-control__field"
// TODO: Official deprecation for this should start after all internal usages have been migrated
,
__nextHasNoMarginBottom: __nextHasNoMarginBottom
}, label && id && (hideLabelFromVision ? (0,external_React_.createElement)(visually_hidden_component, {
as: "label",
htmlFor: id
}, label) : (0,external_React_.createElement)(StyledLabel, {
className: "components-base-control__label",
htmlFor: id
}, label)), label && !id && (hideLabelFromVision ? (0,external_React_.createElement)(visually_hidden_component, {
as: "label"
}, label) : (0,external_React_.createElement)(VisualLabel, null, label)), children), !!help && (0,external_React_.createElement)(StyledHelp, {
id: id ? id + '__help' : undefined,
className: "components-base-control__help",
__nextHasNoMarginBottom: __nextHasNoMarginBottom
}, help));
};
/**
* `BaseControl.VisualLabel` is used to render a purely visual label inside a `BaseControl` component.
*
* It should only be used in cases where the children being rendered inside `BaseControl` are already accessibly labeled,
* e.g., a button, but we want an additional visual label for that section equivalent to the labels `BaseControl` would
* otherwise use if the `label` prop was passed.
*
* @example
* import { BaseControl } from '@wordpress/components';
*
* const MyBaseControl = () => (
* <BaseControl help="This button is already accessibly labeled.">
* <BaseControl.VisualLabel>Author</BaseControl.VisualLabel>
* <Button>Select an author</Button>
* </BaseControl>
* );
*/
const VisualLabel = ({
className,
children,
...props
}) => {
return (0,external_React_.createElement)(StyledVisualLabel, {
...props,
className: classnames_default()('components-base-control__label', className)
}, children);
};
const BaseControl = Object.assign(contextConnectWithoutRef(UnconnectedBaseControl, 'BaseControl'), {
VisualLabel
});
/* harmony default export */ const base_control = (BaseControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const input_control_noop = () => {};
function input_control_useUniqueId(idProp) {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(InputControl);
const id = `inspector-input-control-${instanceId}`;
return idProp || id;
}
function UnforwardedInputControl(props, ref) {
const {
__next40pxDefaultSize,
__unstableStateReducer: stateReducer = state => state,
__unstableInputWidth,
className,
disabled = false,
help,
hideLabelFromVision = false,
id: idProp,
isPressEnterToChange = false,
label,
labelPosition = 'top',
onChange = input_control_noop,
onValidate = input_control_noop,
onKeyDown = input_control_noop,
prefix,
size = 'default',
style,
suffix,
value,
...restProps
} = useDeprecated36pxDefaultSizeProp(props);
const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
const id = input_control_useUniqueId(idProp);
const classes = classnames_default()('components-input-control', className);
const draftHookProps = useDraft({
value,
onBlur: restProps.onBlur,
onChange
});
// ARIA descriptions can only contain plain text, so fall back to aria-details if not.
const helpPropName = typeof help === 'string' ? 'aria-describedby' : 'aria-details';
const helpProp = !!help ? {
[helpPropName]: `${id}__help`
} : {};
return (0,external_React_.createElement)(base_control, {
className: classes,
help: help,
id: id,
__nextHasNoMarginBottom: true
}, (0,external_React_.createElement)(input_base, {
__next40pxDefaultSize: __next40pxDefaultSize,
__unstableInputWidth: __unstableInputWidth,
disabled: disabled,
gap: 3,
hideLabelFromVision: hideLabelFromVision,
id: id,
isFocused: isFocused,
justify: "left",
label: label,
labelPosition: labelPosition,
prefix: prefix,
size: size,
style: style,
suffix: suffix
}, (0,external_React_.createElement)(input_field, {
...restProps,
...helpProp,
__next40pxDefaultSize: __next40pxDefaultSize,
className: "components-input-control__input",
disabled: disabled,
id: id,
isFocused: isFocused,
isPressEnterToChange: isPressEnterToChange,
onKeyDown: onKeyDown,
onValidate: onValidate,
paddingInlineStart: prefix ? space(2) : undefined,
paddingInlineEnd: suffix ? space(2) : undefined,
ref: ref,
setIsFocused: setIsFocused,
size: size,
stateReducer: stateReducer,
...draftHookProps
})));
}
/**
* InputControl components let users enter and edit text. This is an experimental component
* intended to (in time) merge with or replace `TextControl`.
*
* ```jsx
* import { __experimentalInputControl as InputControl } from '@wordpress/components';
* import { useState } from '@wordpress/compose';
*
* const Example = () => {
* const [ value, setValue ] = useState( '' );
*
* return (
* <InputControl
* value={ value }
* onChange={ ( nextValue ) => setValue( nextValue ?? '' ) }
* />
* );
* };
* ```
*/
const InputControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedInputControl);
/* harmony default export */ const input_control = (InputControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dashicon/index.js
/**
* @typedef OwnProps
*
* @property {import('./types').IconKey} icon Icon name
* @property {string} [className] Class name
* @property {number} [size] Size of the icon
*/
/**
* Internal dependencies
*/
function Dashicon({
icon,
className,
size = 20,
style = {},
...extraProps
}) {
const iconClass = ['dashicon', 'dashicons', 'dashicons-' + icon, className].filter(Boolean).join(' ');
// For retro-compatibility reasons (for example if people are overriding icon size with CSS), we add inline styles just if the size is different to the default
const sizeStyles =
// using `!=` to catch both 20 and "20"
// eslint-disable-next-line eqeqeq
20 != size ? {
fontSize: `${size}px`,
width: `${size}px`,
height: `${size}px`
} : {};
const styles = {
...sizeStyles,
...style
};
return (0,external_React_.createElement)("span", {
className: iconClass,
style: styles,
...extraProps
});
}
/* harmony default export */ const dashicon = (Dashicon);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/icon/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Icon({
icon = null,
size = 'string' === typeof icon ? 20 : 24,
...additionalProps
}) {
if ('string' === typeof icon) {
return (0,external_wp_element_namespaceObject.createElement)(dashicon, {
icon: icon,
size: size,
...additionalProps
});
}
if ((0,external_wp_element_namespaceObject.isValidElement)(icon) && dashicon === icon.type) {
return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
...additionalProps
});
}
if ('function' === typeof icon) {
return (0,external_wp_element_namespaceObject.createElement)(icon, {
size,
...additionalProps
});
}
if (icon && (icon.type === 'svg' || icon.type === external_wp_primitives_namespaceObject.SVG)) {
const appliedProps = {
...icon.props,
width: size,
height: size,
...additionalProps
};
return (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
...appliedProps
});
}
if ((0,external_wp_element_namespaceObject.isValidElement)(icon)) {
return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
// @ts-ignore Just forwarding the size prop along
size,
...additionalProps
});
}
return icon;
}
/* harmony default export */ const build_module_icon = (Icon);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/button/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const disabledEventsOnDisabledButton = ['onMouseDown', 'onClick'];
function button_useDeprecatedProps({
isDefault,
isPrimary,
isSecondary,
isTertiary,
isLink,
isPressed,
isSmall,
size,
variant,
...otherProps
}) {
let computedSize = size;
let computedVariant = variant;
const newProps = {
// @TODO Mark `isPressed` as deprecated
'aria-pressed': isPressed
};
if (isSmall) {
var _computedSize;
(_computedSize = computedSize) !== null && _computedSize !== void 0 ? _computedSize : computedSize = 'small';
}
if (isPrimary) {
var _computedVariant;
(_computedVariant = computedVariant) !== null && _computedVariant !== void 0 ? _computedVariant : computedVariant = 'primary';
}
if (isTertiary) {
var _computedVariant2;
(_computedVariant2 = computedVariant) !== null && _computedVariant2 !== void 0 ? _computedVariant2 : computedVariant = 'tertiary';
}
if (isSecondary) {
var _computedVariant3;
(_computedVariant3 = computedVariant) !== null && _computedVariant3 !== void 0 ? _computedVariant3 : computedVariant = 'secondary';
}
if (isDefault) {
var _computedVariant4;
external_wp_deprecated_default()('Button isDefault prop', {
since: '5.4',
alternative: 'variant="secondary"',
version: '6.2'
});
(_computedVariant4 = computedVariant) !== null && _computedVariant4 !== void 0 ? _computedVariant4 : computedVariant = 'secondary';
}
if (isLink) {
var _computedVariant5;
(_computedVariant5 = computedVariant) !== null && _computedVariant5 !== void 0 ? _computedVariant5 : computedVariant = 'link';
}
return {
...newProps,
...otherProps,
size: computedSize,
variant: computedVariant
};
}
function UnforwardedButton(props, ref) {
const {
__next40pxDefaultSize,
isBusy,
isDestructive,
className,
disabled,
icon,
iconPosition = 'left',
iconSize,
showTooltip,
tooltipPosition,
shortcut,
label,
children,
size = 'default',
text,
variant,
__experimentalIsFocusable: isFocusable,
describedBy,
...buttonOrAnchorProps
} = button_useDeprecatedProps(props);
const {
href,
target,
'aria-checked': ariaChecked,
'aria-pressed': ariaPressed,
'aria-selected': ariaSelected,
...additionalProps
} = 'href' in buttonOrAnchorProps ? buttonOrAnchorProps : {
href: undefined,
target: undefined,
...buttonOrAnchorProps
};
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Button, 'components-button__description');
const hasChildren = 'string' === typeof children && !!children || Array.isArray(children) && children?.[0] && children[0] !== null &&
// Tooltip should not considered as a child
children?.[0]?.props?.className !== 'components-tooltip';
const truthyAriaPressedValues = [true, 'true', 'mixed'];
const classes = classnames_default()('components-button', className, {
'is-next-40px-default-size': __next40pxDefaultSize,
'is-secondary': variant === 'secondary',
'is-primary': variant === 'primary',
'is-small': size === 'small',
'is-compact': size === 'compact',
'is-tertiary': variant === 'tertiary',
'is-pressed': truthyAriaPressedValues.includes(ariaPressed),
'is-pressed-mixed': ariaPressed === 'mixed',
'is-busy': isBusy,
'is-link': variant === 'link',
'is-destructive': isDestructive,
'has-text': !!icon && (hasChildren || text),
'has-icon': !!icon
});
const trulyDisabled = disabled && !isFocusable;
const Tag = href !== undefined && !trulyDisabled ? 'a' : 'button';
const buttonProps = Tag === 'button' ? {
type: 'button',
disabled: trulyDisabled,
'aria-checked': ariaChecked,
'aria-pressed': ariaPressed,
'aria-selected': ariaSelected
} : {};
const anchorProps = Tag === 'a' ? {
href,
target
} : {};
if (disabled && isFocusable) {
// In this case, the button will be disabled, but still focusable and
// perceivable by screen reader users.
buttonProps['aria-disabled'] = true;
anchorProps['aria-disabled'] = true;
for (const disabledEvent of disabledEventsOnDisabledButton) {
additionalProps[disabledEvent] = event => {
if (event) {
event.stopPropagation();
event.preventDefault();
}
};
}
}
// Should show the tooltip if...
const shouldShowTooltip = !trulyDisabled && (
// An explicit tooltip is passed or...
showTooltip && !!label ||
// There's a shortcut or...
!!shortcut ||
// There's a label and...
!!label &&
// The children are empty and...
!children?.length &&
// The tooltip is not explicitly disabled.
false !== showTooltip);
const descriptionId = describedBy ? instanceId : undefined;
const describedById = additionalProps['aria-describedby'] || descriptionId;
const commonProps = {
className: classes,
'aria-label': additionalProps['aria-label'] || label,
'aria-describedby': describedById,
ref
};
const elementChildren = (0,external_React_.createElement)(external_React_.Fragment, null, icon && iconPosition === 'left' && (0,external_React_.createElement)(build_module_icon, {
icon: icon,
size: iconSize
}), text && (0,external_React_.createElement)(external_React_.Fragment, null, text), icon && iconPosition === 'right' && (0,external_React_.createElement)(build_module_icon, {
icon: icon,
size: iconSize
}), children);
const element = Tag === 'a' ? (0,external_React_.createElement)("a", {
...anchorProps,
...additionalProps,
...commonProps
}, elementChildren) : (0,external_React_.createElement)("button", {
...buttonProps,
...additionalProps,
...commonProps
}, elementChildren);
// In order to avoid some React reconciliation issues, we are always rendering
// the `Tooltip` component even when `shouldShowTooltip` is `false`.
// In order to make sure that the tooltip doesn't show when it shouldn't,
// we don't pass the props to the `Tooltip` component.
const tooltipProps = shouldShowTooltip ? {
text: children?.length && describedBy ? describedBy : label,
shortcut,
placement: tooltipPosition &&
// Convert legacy `position` values to be used with the new `placement` prop
positionToPlacement(tooltipPosition)
} : {};
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(tooltip, {
...tooltipProps
}, element), describedBy && (0,external_React_.createElement)(visually_hidden_component, null, (0,external_React_.createElement)("span", {
id: descriptionId
}, describedBy)));
}
/**
* Lets users take actions and make choices with a single click or tap.
*
* ```jsx
* import { Button } from '@wordpress/components';
* const Mybutton = () => (
* <Button
* variant="primary"
* onClick={ handleClick }
* >
* Click here
* </Button>
* );
* ```
*/
const Button = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedButton);
/* harmony default export */ const build_module_button = (Button);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/number-control/styles/number-control-styles.js
function number_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
var number_control_styles_ref = true ? {
name: "euqsgg",
styles: "input[type='number']::-webkit-outer-spin-button,input[type='number']::-webkit-inner-spin-button{-webkit-appearance:none!important;margin:0!important;}input[type='number']{-moz-appearance:textfield;}"
} : 0;
const htmlArrowStyles = ({
hideHTMLArrows
}) => {
if (!hideHTMLArrows) {
return ``;
}
return number_control_styles_ref;
};
const number_control_styles_Input = /*#__PURE__*/emotion_styled_base_browser_esm(input_control, true ? {
target: "ep09it41"
} : 0)(htmlArrowStyles, ";" + ( true ? "" : 0));
const SpinButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
target: "ep09it40"
} : 0)("&&&&&{color:", COLORS.theme.accent, ";}" + ( true ? "" : 0));
const smallSpinButtons = /*#__PURE__*/emotion_react_browser_esm_css("width:", space(5), ";min-width:", space(5), ";height:", space(5), ";" + ( true ? "" : 0), true ? "" : 0);
const styles = {
smallSpinButtons
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/math.js
/**
* Parses and retrieves a number value.
*
* @param {unknown} value The incoming value.
*
* @return {number} The parsed number value.
*/
function getNumber(value) {
const number = Number(value);
return isNaN(number) ? 0 : number;
}
/**
* Safely adds 2 values.
*
* @param {Array<number|string>} args Values to add together.
*
* @return {number} The sum of values.
*/
function add(...args) {
return args.reduce( /** @type {(sum:number, arg: number|string) => number} */
(sum, arg) => sum + getNumber(arg), 0);
}
/**
* Safely subtracts 2 values.
*
* @param {Array<number|string>} args Values to subtract together.
*
* @return {number} The difference of the values.
*/
function subtract(...args) {
return args.reduce( /** @type {(diff:number, arg: number|string, index:number) => number} */
(diff, arg, index) => {
const value = getNumber(arg);
return index === 0 ? value : diff - value;
}, 0);
}
/**
* Determines the decimal position of a number value.
*
* @param {number} value The number to evaluate.
*
* @return {number} The number of decimal places.
*/
function getPrecision(value) {
const split = (value + '').split('.');
return split[1] !== undefined ? split[1].length : 0;
}
/**
* Clamps a value based on a min/max range.
*
* @param {number} value The value.
* @param {number} min The minimum range.
* @param {number} max The maximum range.
*
* @return {number} The clamped value.
*/
function math_clamp(value, min, max) {
const baseValue = getNumber(value);
return Math.max(min, Math.min(baseValue, max));
}
/**
* Clamps a value based on a min/max range with rounding
*
* @param {number | string} value The value.
* @param {number} min The minimum range.
* @param {number} max The maximum range.
* @param {number} step A multiplier for the value.
*
* @return {number} The rounded and clamped value.
*/
function roundClamp(value = 0, min = Infinity, max = Infinity, step = 1) {
const baseValue = getNumber(value);
const stepValue = getNumber(step);
const precision = getPrecision(step);
const rounded = Math.round(baseValue / stepValue) * stepValue;
const clampedValue = math_clamp(rounded, min, max);
return precision ? getNumber(clampedValue.toFixed(precision)) : clampedValue;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/h-stack/utils.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const H_ALIGNMENTS = {
bottom: {
align: 'flex-end',
justify: 'center'
},
bottomLeft: {
align: 'flex-end',
justify: 'flex-start'
},
bottomRight: {
align: 'flex-end',
justify: 'flex-end'
},
center: {
align: 'center',
justify: 'center'
},
edge: {
align: 'center',
justify: 'space-between'
},
left: {
align: 'center',
justify: 'flex-start'
},
right: {
align: 'center',
justify: 'flex-end'
},
stretch: {
align: 'stretch'
},
top: {
align: 'flex-start',
justify: 'center'
},
topLeft: {
align: 'flex-start',
justify: 'flex-start'
},
topRight: {
align: 'flex-start',
justify: 'flex-end'
}
};
const V_ALIGNMENTS = {
bottom: {
justify: 'flex-end',
align: 'center'
},
bottomLeft: {
justify: 'flex-end',
align: 'flex-start'
},
bottomRight: {
justify: 'flex-end',
align: 'flex-end'
},
center: {
justify: 'center',
align: 'center'
},
edge: {
justify: 'space-between',
align: 'center'
},
left: {
justify: 'center',
align: 'flex-start'
},
right: {
justify: 'center',
align: 'flex-end'
},
stretch: {
align: 'stretch'
},
top: {
justify: 'flex-start',
align: 'center'
},
topLeft: {
justify: 'flex-start',
align: 'flex-start'
},
topRight: {
justify: 'flex-start',
align: 'flex-end'
}
};
function getAlignmentProps(alignment, direction = 'row') {
if (!isValueDefined(alignment)) {
return {};
}
const isVertical = direction === 'column';
const props = isVertical ? V_ALIGNMENTS : H_ALIGNMENTS;
const alignmentProps = alignment in props ? props[alignment] : {
align: alignment
};
return alignmentProps;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/get-valid-children.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Gets a collection of available children elements from a React component's children prop.
*
* @param children
*
* @return An array of available children.
*/
function getValidChildren(children) {
if (typeof children === 'string') return [children];
return external_wp_element_namespaceObject.Children.toArray(children).filter(child => (0,external_wp_element_namespaceObject.isValidElement)(child));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/h-stack/hook.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function useHStack(props) {
const {
alignment = 'edge',
children,
direction,
spacing = 2,
...otherProps
} = useContextSystem(props, 'HStack');
const align = getAlignmentProps(alignment, direction);
const validChildren = getValidChildren(children);
const clonedChildren = validChildren.map((child, index) => {
const _isSpacer = hasConnectNamespace(child, ['Spacer']);
if (_isSpacer) {
const childElement = child;
const _key = childElement.key || `hstack-${index}`;
return (0,external_React_.createElement)(flex_item_component, {
isBlock: true,
key: _key,
...childElement.props
});
}
return child;
});
const propsForFlex = {
children: clonedChildren,
direction,
justify: 'center',
...align,
...otherProps,
gap: spacing
};
const flexProps = useFlex(propsForFlex);
return flexProps;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/h-stack/component.js
/**
* Internal dependencies
*/
function UnconnectedHStack(props, forwardedRef) {
const hStackProps = useHStack(props);
return (0,external_React_.createElement)(component, {
...hStackProps,
ref: forwardedRef
});
}
/**
* `HStack` (Horizontal Stack) arranges child elements in a horizontal line.
*
* `HStack` can render anything inside.
*
* ```jsx
* import {
* __experimentalHStack as HStack,
* __experimentalText as Text,
* } from `@wordpress/components`;
*
* function Example() {
* return (
* <HStack>
* <Text>Code</Text>
* <Text>is</Text>
* <Text>Poetry</Text>
* </HStack>
* );
* }
* ```
*/
const HStack = contextConnect(UnconnectedHStack, 'HStack');
/* harmony default export */ const h_stack_component = (HStack);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/number-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const number_control_noop = () => {};
function UnforwardedNumberControl(props, forwardedRef) {
const {
__unstableStateReducer: stateReducerProp,
className,
dragDirection = 'n',
hideHTMLArrows = false,
spinControls = hideHTMLArrows ? 'none' : 'native',
isDragEnabled = true,
isShiftStepEnabled = true,
label,
max = Infinity,
min = -Infinity,
required = false,
shiftStep = 10,
step = 1,
spinFactor = 1,
type: typeProp = 'number',
value: valueProp,
size = 'default',
suffix,
onChange = number_control_noop,
...restProps
} = useDeprecated36pxDefaultSizeProp(props);
if (hideHTMLArrows) {
external_wp_deprecated_default()('wp.components.NumberControl hideHTMLArrows prop ', {
alternative: 'spinControls="none"',
since: '6.2',
version: '6.3'
});
}
const inputRef = (0,external_wp_element_namespaceObject.useRef)();
const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([inputRef, forwardedRef]);
const isStepAny = step === 'any';
const baseStep = isStepAny ? 1 : ensureNumber(step);
const baseSpin = ensureNumber(spinFactor) * baseStep;
const baseValue = roundClamp(0, min, max, baseStep);
const constrainValue = (value, stepOverride) => {
// When step is "any" clamp the value, otherwise round and clamp it.
// Use '' + to convert to string for use in input value attribute.
return isStepAny ? '' + Math.min(max, Math.max(min, ensureNumber(value))) : '' + roundClamp(value, min, max, stepOverride !== null && stepOverride !== void 0 ? stepOverride : baseStep);
};
const autoComplete = typeProp === 'number' ? 'off' : undefined;
const classes = classnames_default()('components-number-control', className);
const cx = useCx();
const spinButtonClasses = cx(size === 'small' && styles.smallSpinButtons);
const spinValue = (value, direction, event) => {
event?.preventDefault();
const shift = event?.shiftKey && isShiftStepEnabled;
const delta = shift ? ensureNumber(shiftStep) * baseSpin : baseSpin;
let nextValue = isValueEmpty(value) ? baseValue : value;
if (direction === 'up') {
nextValue = add(nextValue, delta);
} else if (direction === 'down') {
nextValue = subtract(nextValue, delta);
}
return constrainValue(nextValue, shift ? delta : undefined);
};
/**
* "Middleware" function that intercepts updates from InputControl.
* This allows us to tap into actions to transform the (next) state for
* InputControl.
*
* @return The updated state to apply to InputControl
*/
const numberControlStateReducer = (state, action) => {
const nextState = {
...state
};
const {
type,
payload
} = action;
const event = payload.event;
const currentValue = nextState.value;
/**
* Handles custom UP and DOWN Keyboard events
*/
if (type === PRESS_UP || type === PRESS_DOWN) {
nextState.value = spinValue(currentValue, type === PRESS_UP ? 'up' : 'down', event);
}
/**
* Handles drag to update events
*/
if (type === DRAG && isDragEnabled) {
const [x, y] = payload.delta;
const enableShift = payload.shiftKey && isShiftStepEnabled;
const modifier = enableShift ? ensureNumber(shiftStep) * baseSpin : baseSpin;
let directionModifier;
let delta;
switch (dragDirection) {
case 'n':
delta = y;
directionModifier = -1;
break;
case 'e':
delta = x;
directionModifier = (0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1;
break;
case 's':
delta = y;
directionModifier = 1;
break;
case 'w':
delta = x;
directionModifier = (0,external_wp_i18n_namespaceObject.isRTL)() ? 1 : -1;
break;
}
if (delta !== 0) {
delta = Math.ceil(Math.abs(delta)) * Math.sign(delta);
const distance = delta * modifier * directionModifier;
nextState.value = constrainValue(
// @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined
add(currentValue, distance), enableShift ? modifier : undefined);
}
}
/**
* Handles commit (ENTER key press or blur)
*/
if (type === PRESS_ENTER || type === COMMIT) {
const applyEmptyValue = required === false && currentValue === '';
nextState.value = applyEmptyValue ? currentValue :
// @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined
constrainValue(currentValue);
}
return nextState;
};
const buildSpinButtonClickHandler = direction => event => onChange(String(spinValue(valueProp, direction, event)), {
// Set event.target to the <input> so that consumers can use
// e.g. event.target.validity.
event: {
...event,
target: inputRef.current
}
});
return (0,external_React_.createElement)(number_control_styles_Input, {
autoComplete: autoComplete,
inputMode: "numeric",
...restProps,
className: classes,
dragDirection: dragDirection,
hideHTMLArrows: spinControls !== 'native',
isDragEnabled: isDragEnabled,
label: label,
max: max,
min: min,
ref: mergedRef,
required: required,
step: step,
type: typeProp
// @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components
,
value: valueProp,
__unstableStateReducer: (state, action) => {
var _stateReducerProp;
const baseState = numberControlStateReducer(state, action);
return (_stateReducerProp = stateReducerProp?.(baseState, action)) !== null && _stateReducerProp !== void 0 ? _stateReducerProp : baseState;
},
size: size,
suffix: spinControls === 'custom' ? (0,external_React_.createElement)(external_React_.Fragment, null, suffix, (0,external_React_.createElement)(spacer_component, {
marginBottom: 0,
marginRight: 2
}, (0,external_React_.createElement)(h_stack_component, {
spacing: 1
}, (0,external_React_.createElement)(SpinButton, {
className: spinButtonClasses,
icon: library_plus,
size: "small",
label: (0,external_wp_i18n_namespaceObject.__)('Increment'),
onClick: buildSpinButtonClickHandler('up')
}), (0,external_React_.createElement)(SpinButton, {
className: spinButtonClasses,
icon: library_reset,
size: "small",
label: (0,external_wp_i18n_namespaceObject.__)('Decrement'),
onClick: buildSpinButtonClickHandler('down')
})))) : suffix,
onChange: onChange
});
}
const NumberControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedNumberControl);
/* harmony default export */ const number_control = (NumberControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/styles/angle-picker-control-styles.js
function angle_picker_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const CIRCLE_SIZE = 32;
const INNER_CIRCLE_SIZE = 6;
const CircleRoot = emotion_styled_base_browser_esm("div", true ? {
target: "eln3bjz3"
} : 0)("border-radius:50%;border:", config_values.borderWidth, " solid ", COLORS.ui.border, ";box-sizing:border-box;cursor:grab;height:", CIRCLE_SIZE, "px;overflow:hidden;width:", CIRCLE_SIZE, "px;:active{cursor:grabbing;}" + ( true ? "" : 0));
const CircleIndicatorWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "eln3bjz2"
} : 0)( true ? {
name: "1r307gh",
styles: "box-sizing:border-box;position:relative;width:100%;height:100%;:focus-visible{outline:none;}"
} : 0);
const CircleIndicator = emotion_styled_base_browser_esm("div", true ? {
target: "eln3bjz1"
} : 0)("background:", COLORS.theme.accent, ";border-radius:50%;box-sizing:border-box;display:block;left:50%;top:4px;transform:translateX( -50% );position:absolute;width:", INNER_CIRCLE_SIZE, "px;height:", INNER_CIRCLE_SIZE, "px;" + ( true ? "" : 0));
const UnitText = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? {
target: "eln3bjz0"
} : 0)("color:", COLORS.theme.accent, ";margin-right:", space(3), ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/angle-circle.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function AngleCircle({
value,
onChange,
...props
}) {
const angleCircleRef = (0,external_wp_element_namespaceObject.useRef)(null);
const angleCircleCenter = (0,external_wp_element_namespaceObject.useRef)();
const previousCursorValue = (0,external_wp_element_namespaceObject.useRef)();
const setAngleCircleCenter = () => {
if (angleCircleRef.current === null) {
return;
}
const rect = angleCircleRef.current.getBoundingClientRect();
angleCircleCenter.current = {
x: rect.x + rect.width / 2,
y: rect.y + rect.height / 2
};
};
const changeAngleToPosition = event => {
if (event === undefined) {
return;
}
// Prevent (drag) mouse events from selecting and accidentally
// triggering actions from other elements.
event.preventDefault();
// Input control needs to lose focus and by preventDefault above, it doesn't.
event.target?.focus();
if (angleCircleCenter.current !== undefined && onChange !== undefined) {
const {
x: centerX,
y: centerY
} = angleCircleCenter.current;
onChange(getAngle(centerX, centerY, event.clientX, event.clientY));
}
};
const {
startDrag,
isDragging
} = (0,external_wp_compose_namespaceObject.__experimentalUseDragging)({
onDragStart: event => {
setAngleCircleCenter();
changeAngleToPosition(event);
},
onDragMove: changeAngleToPosition,
onDragEnd: changeAngleToPosition
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (isDragging) {
if (previousCursorValue.current === undefined) {
previousCursorValue.current = document.body.style.cursor;
}
document.body.style.cursor = 'grabbing';
} else {
document.body.style.cursor = previousCursorValue.current || '';
previousCursorValue.current = undefined;
}
}, [isDragging]);
return (0,external_React_.createElement)(CircleRoot, {
ref: angleCircleRef,
onMouseDown: startDrag,
className: "components-angle-picker-control__angle-circle",
...props
}, (0,external_React_.createElement)(CircleIndicatorWrapper, {
style: value ? {
transform: `rotate(${value}deg)`
} : undefined,
className: "components-angle-picker-control__angle-circle-indicator-wrapper",
tabIndex: -1
}, (0,external_React_.createElement)(CircleIndicator, {
className: "components-angle-picker-control__angle-circle-indicator"
})));
}
function getAngle(centerX, centerY, pointX, pointY) {
const y = pointY - centerY;
const x = pointX - centerX;
const angleInRadians = Math.atan2(y, x);
const angleInDeg = Math.round(angleInRadians * (180 / Math.PI)) + 90;
if (angleInDeg < 0) {
return 360 + angleInDeg;
}
return angleInDeg;
}
/* harmony default export */ const angle_circle = (AngleCircle);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedAnglePickerControl(props, ref) {
const {
className,
label = (0,external_wp_i18n_namespaceObject.__)('Angle'),
onChange,
value,
...restProps
} = props;
const handleOnNumberChange = unprocessedValue => {
if (onChange === undefined) {
return;
}
const inputValue = unprocessedValue !== undefined && unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : 0;
onChange(inputValue);
};
const classes = classnames_default()('components-angle-picker-control', className);
const unitText = (0,external_React_.createElement)(UnitText, null, "\xB0");
const [prefixedUnitText, suffixedUnitText] = (0,external_wp_i18n_namespaceObject.isRTL)() ? [unitText, null] : [null, unitText];
return (0,external_React_.createElement)(flex_component, {
...restProps,
ref: ref,
className: classes,
gap: 2
}, (0,external_React_.createElement)(flex_block_component, null, (0,external_React_.createElement)(number_control, {
label: label,
className: "components-angle-picker-control__input-field",
max: 360,
min: 0,
onChange: handleOnNumberChange,
size: "__unstable-large",
step: "1",
value: value,
spinControls: "none",
prefix: prefixedUnitText,
suffix: suffixedUnitText
})), (0,external_React_.createElement)(spacer_component, {
marginBottom: "1",
marginTop: "auto"
}, (0,external_React_.createElement)(angle_circle, {
"aria-hidden": "true",
value: value,
onChange: onChange
})));
}
/**
* `AnglePickerControl` is a React component to render a UI that allows users to
* pick an angle. Users can choose an angle in a visual UI with the mouse by
* dragging an angle indicator inside a circle or by directly inserting the
* desired angle in a text field.
*
* ```jsx
* import { useState } from '@wordpress/element';
* import { AnglePickerControl } from '@wordpress/components';
*
* function Example() {
* const [ angle, setAngle ] = useState( 0 );
* return (
* <AnglePickerControl
* value={ angle }
* onChange={ setAngle }
* </>
* );
* }
* ```
*/
const AnglePickerControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedAnglePickerControl);
/* harmony default export */ const angle_picker_control = (AnglePickerControl);
// EXTERNAL MODULE: ./node_modules/remove-accents/index.js
var remove_accents = __webpack_require__(9681);
var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
;// CONCATENATED MODULE: external ["wp","richText"]
const external_wp_richText_namespaceObject = window["wp"]["richText"];
;// CONCATENATED MODULE: external ["wp","a11y"]
const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
;// CONCATENATED MODULE: external ["wp","keycodes"]
const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/strings.js
/**
* External dependencies
*/
const ALL_UNICODE_DASH_CHARACTERS = new RegExp(`[${[
// - (hyphen-minus)
'\u002d',
// ~ (tilde)
'\u007e',
// (soft hyphen)
'\u00ad',
// ֊ (armenian hyphen)
'\u058a',
// ־ (hebrew punctuation maqaf)
'\u05be',
// ᐀ (canadian syllabics hyphen)
'\u1400',
// ᠆ (mongolian todo soft hyphen)
'\u1806',
// ‐ (hyphen)
'\u2010',
// non-breaking hyphen)
'\u2011',
// ‒ (figure dash)
'\u2012',
// – (en dash)
'\u2013',
// — (em dash)
'\u2014',
// ― (horizontal bar)
'\u2015',
// ⁓ (swung dash)
'\u2053',
// superscript minus)
'\u207b',
// subscript minus)
'\u208b',
// − (minus sign)
'\u2212',
// ⸗ (double oblique hyphen)
'\u2e17',
// ⸺ (two-em dash)
'\u2e3a',
// ⸻ (three-em dash)
'\u2e3b',
// 〜 (wave dash)
'\u301c',
// 〰 (wavy dash)
'\u3030',
// ゠ (katakana-hiragana double hyphen)
'\u30a0',
// ︱ (presentation form for vertical em dash)
'\ufe31',
// ︲ (presentation form for vertical en dash)
'\ufe32',
// ﹘ (small em dash)
'\ufe58',
// ﹣ (small hyphen-minus)
'\ufe63',
// - (fullwidth hyphen-minus)
'\uff0d'].join('')}]`, 'g');
const normalizeTextString = value => {
return remove_accents_default()(value).toLocaleLowerCase().replace(ALL_UNICODE_DASH_CHARACTERS, '-');
};
/**
* Converts any string to kebab case.
* Backwards compatible with Lodash's `_.kebabCase()`.
* Backwards compatible with `_wp_to_kebab_case()`.
*
* @see https://lodash.com/docs/4.17.15#kebabCase
* @see https://developer.wordpress.org/reference/functions/_wp_to_kebab_case/
*
* @param str String to convert.
* @return Kebab-cased string
*/
function kebabCase(str) {
var _str$toString;
let input = (_str$toString = str?.toString?.()) !== null && _str$toString !== void 0 ? _str$toString : '';
// See https://github.com/lodash/lodash/blob/b185fcee26b2133bd071f4aaca14b455c2ed1008/lodash.js#L4970
input = input.replace(/['\u2019]/, '');
return paramCase(input, {
splitRegexp: [/(?!(?:1ST|2ND|3RD|[4-9]TH)(?![a-z]))([a-z0-9])([A-Z])/g,
// fooBar => foo-bar, 3Bar => 3-bar
/(?!(?:1st|2nd|3rd|[4-9]th)(?![a-z]))([0-9])([a-z])/g,
// 3bar => 3-bar
/([A-Za-z])([0-9])/g,
// Foo3 => foo-3, foo3 => foo-3
/([A-Z])([A-Z][a-z])/g // FOOBar => foo-bar
]
});
}
/**
* Escapes the RegExp special characters.
*
* @param string Input string.
*
* @return Regex-escaped string.
*/
function escapeRegExp(string) {
return string.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&');
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/autocomplete/get-default-use-items.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function filterOptions(search, options = [], maxResults = 10) {
const filtered = [];
for (let i = 0; i < options.length; i++) {
const option = options[i];
// Merge label into keywords.
let {
keywords = []
} = option;
if ('string' === typeof option.label) {
keywords = [...keywords, option.label];
}
const isMatch = keywords.some(keyword => search.test(remove_accents_default()(keyword)));
if (!isMatch) {
continue;
}
filtered.push(option);
// Abort early if max reached.
if (filtered.length === maxResults) {
break;
}
}
return filtered;
}
function getDefaultUseItems(autocompleter) {
return filterValue => {
const [items, setItems] = (0,external_wp_element_namespaceObject.useState)([]);
/*
* We support both synchronous and asynchronous retrieval of completer options
* but internally treat all as async so we maintain a single, consistent code path.
*
* Because networks can be slow, and the internet is wonderfully unpredictable,
* we don't want two promises updating the state at once. This ensures that only
* the most recent promise will act on `optionsData`. This doesn't use the state
* because `setState` is batched, and so there's no guarantee that setting
* `activePromise` in the state would result in it actually being in `this.state`
* before the promise resolves and we check to see if this is the active promise or not.
*/
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
const {
options,
isDebounced
} = autocompleter;
const loadOptions = (0,external_wp_compose_namespaceObject.debounce)(() => {
const promise = Promise.resolve(typeof options === 'function' ? options(filterValue) : options).then(optionsData => {
if (promise.canceled) {
return;
}
const keyedOptions = optionsData.map((optionData, optionIndex) => ({
key: `${autocompleter.name}-${optionIndex}`,
value: optionData,
label: autocompleter.getOptionLabel(optionData),
keywords: autocompleter.getOptionKeywords ? autocompleter.getOptionKeywords(optionData) : [],
isDisabled: autocompleter.isOptionDisabled ? autocompleter.isOptionDisabled(optionData) : false
}));
// Create a regular expression to filter the options.
const search = new RegExp('(?:\\b|\\s|^)' + escapeRegExp(filterValue), 'i');
setItems(filterOptions(search, keyedOptions));
});
return promise;
}, isDebounced ? 250 : 0);
const promise = loadOptions();
return () => {
loadOptions.cancel();
if (promise) {
promise.canceled = true;
}
};
}, [filterValue]);
return [items];
};
}
;// CONCATENATED MODULE: ./node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
/**
* Provides data to position an inner element of the floating element so that it
* appears centered to the reference element.
* This wraps the core `arrow` middleware to allow React refs as the element.
* @see https://floating-ui.com/docs/arrow
*/
const floating_ui_react_dom_arrow = options => {
function isRef(value) {
return {}.hasOwnProperty.call(value, 'current');
}
return {
name: 'arrow',
options,
fn(state) {
const {
element,
padding
} = typeof options === 'function' ? options(state) : options;
if (element && isRef(element)) {
if (element.current != null) {
return floating_ui_dom_arrow({
element: element.current,
padding
}).fn(state);
}
return {};
}
if (element) {
return floating_ui_dom_arrow({
element,
padding
}).fn(state);
}
return {};
}
};
};
var index = typeof document !== 'undefined' ? external_React_.useLayoutEffect : external_React_.useEffect;
// Fork of `fast-deep-equal` that only does the comparisons we need and compares
// functions
function deepEqual(a, b) {
if (a === b) {
return true;
}
if (typeof a !== typeof b) {
return false;
}
if (typeof a === 'function' && a.toString() === b.toString()) {
return true;
}
let length;
let i;
let keys;
if (a && b && typeof a === 'object') {
if (Array.isArray(a)) {
length = a.length;
if (length !== b.length) return false;
for (i = length; i-- !== 0;) {
if (!deepEqual(a[i], b[i])) {
return false;
}
}
return true;
}
keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) {
return false;
}
for (i = length; i-- !== 0;) {
if (!{}.hasOwnProperty.call(b, keys[i])) {
return false;
}
}
for (i = length; i-- !== 0;) {
const key = keys[i];
if (key === '_owner' && a.$$typeof) {
continue;
}
if (!deepEqual(a[key], b[key])) {
return false;
}
}
return true;
}
// biome-ignore lint/suspicious/noSelfCompare: in source
return a !== a && b !== b;
}
function getDPR(element) {
if (typeof window === 'undefined') {
return 1;
}
const win = element.ownerDocument.defaultView || window;
return win.devicePixelRatio || 1;
}
function floating_ui_react_dom_roundByDPR(element, value) {
const dpr = getDPR(element);
return Math.round(value * dpr) / dpr;
}
function useLatestRef(value) {
const ref = external_React_.useRef(value);
index(() => {
ref.current = value;
});
return ref;
}
/**
* Provides data to position a floating element.
* @see https://floating-ui.com/docs/useFloating
*/
function useFloating(options) {
if (options === void 0) {
options = {};
}
const {
placement = 'bottom',
strategy = 'absolute',
middleware = [],
platform,
elements: {
reference: externalReference,
floating: externalFloating
} = {},
transform = true,
whileElementsMounted,
open
} = options;
const [data, setData] = external_React_.useState({
x: 0,
y: 0,
strategy,
placement,
middlewareData: {},
isPositioned: false
});
const [latestMiddleware, setLatestMiddleware] = external_React_.useState(middleware);
if (!deepEqual(latestMiddleware, middleware)) {
setLatestMiddleware(middleware);
}
const [_reference, _setReference] = external_React_.useState(null);
const [_floating, _setFloating] = external_React_.useState(null);
const setReference = external_React_.useCallback(node => {
if (node !== referenceRef.current) {
referenceRef.current = node;
_setReference(node);
}
}, []);
const setFloating = external_React_.useCallback(node => {
if (node !== floatingRef.current) {
floatingRef.current = node;
_setFloating(node);
}
}, []);
const referenceEl = externalReference || _reference;
const floatingEl = externalFloating || _floating;
const referenceRef = external_React_.useRef(null);
const floatingRef = external_React_.useRef(null);
const dataRef = external_React_.useRef(data);
const hasWhileElementsMounted = whileElementsMounted != null;
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
const platformRef = useLatestRef(platform);
const update = external_React_.useCallback(() => {
if (!referenceRef.current || !floatingRef.current) {
return;
}
const config = {
placement,
strategy,
middleware: latestMiddleware
};
if (platformRef.current) {
config.platform = platformRef.current;
}
floating_ui_dom_computePosition(referenceRef.current, floatingRef.current, config).then(data => {
const fullData = {
...data,
isPositioned: true
};
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
dataRef.current = fullData;
external_ReactDOM_namespaceObject.flushSync(() => {
setData(fullData);
});
}
});
}, [latestMiddleware, placement, strategy, platformRef]);
index(() => {
if (open === false && dataRef.current.isPositioned) {
dataRef.current.isPositioned = false;
setData(data => ({
...data,
isPositioned: false
}));
}
}, [open]);
const isMountedRef = external_React_.useRef(false);
index(() => {
isMountedRef.current = true;
return () => {
isMountedRef.current = false;
};
}, []);
// biome-ignore lint/correctness/useExhaustiveDependencies: `hasWhileElementsMounted` is intentionally included.
index(() => {
if (referenceEl) referenceRef.current = referenceEl;
if (floatingEl) floatingRef.current = floatingEl;
if (referenceEl && floatingEl) {
if (whileElementsMountedRef.current) {
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
}
update();
}
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
const refs = external_React_.useMemo(() => ({
reference: referenceRef,
floating: floatingRef,
setReference,
setFloating
}), [setReference, setFloating]);
const elements = external_React_.useMemo(() => ({
reference: referenceEl,
floating: floatingEl
}), [referenceEl, floatingEl]);
const floatingStyles = external_React_.useMemo(() => {
const initialStyles = {
position: strategy,
left: 0,
top: 0
};
if (!elements.floating) {
return initialStyles;
}
const x = floating_ui_react_dom_roundByDPR(elements.floating, data.x);
const y = floating_ui_react_dom_roundByDPR(elements.floating, data.y);
if (transform) {
return {
...initialStyles,
transform: "translate(" + x + "px, " + y + "px)",
...(getDPR(elements.floating) >= 1.5 && {
willChange: 'transform'
})
};
}
return {
position: strategy,
left: x,
top: y
};
}, [strategy, transform, elements.floating, data.x, data.y]);
return external_React_.useMemo(() => ({
...data,
update,
refs,
elements,
floatingStyles
}), [data, update, refs, elements, floatingStyles]);
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.mjs
/**
* A hook that returns `true` if we should be using reduced motion based on the current device's Reduced Motion setting.
*
* This can be used to implement changes to your UI based on Reduced Motion. For instance, replacing motion-sickness inducing
* `x`/`y` animations with `opacity`, disabling the autoplay of background videos, or turning off parallax motion.
*
* It will actively respond to changes and re-render your components with the latest setting.
*
* ```jsx
* export function Sidebar({ isOpen }) {
* const shouldReduceMotion = useReducedMotion()
* const closedX = shouldReduceMotion ? 0 : "-100%"
*
* return (
* <motion.div animate={{
* opacity: isOpen ? 1 : 0,
* x: isOpen ? 0 : closedX
* }} />
* )
* }
* ```
*
* @return boolean
*
* @public
*/
function useReducedMotion() {
/**
* Lazy initialisation of prefersReducedMotion
*/
!hasReducedMotionListener.current && initPrefersReducedMotion();
const [shouldReduceMotion] = (0,external_React_.useState)(prefersReducedMotion.current);
if (false) {}
/**
* TODO See if people miss automatically updating shouldReduceMotion setting
*/
return shouldReduceMotion;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
/**
* WordPress dependencies
*/
const close_close = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const library_close = (close_close);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/scroll-lock/index.js
/**
* WordPress dependencies
*/
/*
* Setting `overflow: hidden` on html and body elements resets body scroll in iOS.
* Save scroll top so we can restore it after locking scroll.
*
* NOTE: It would be cleaner and possibly safer to find a localized solution such
* as preventing default on certain touchmove events.
*/
let previousScrollTop = 0;
function setLocked(locked) {
const scrollingElement = document.scrollingElement || document.body;
if (locked) {
previousScrollTop = scrollingElement.scrollTop;
}
const methodName = locked ? 'add' : 'remove';
scrollingElement.classList[methodName]('lockscroll');
// Adding the class to the document element seems to be necessary in iOS.
document.documentElement.classList[methodName]('lockscroll');
if (!locked) {
scrollingElement.scrollTop = previousScrollTop;
}
}
let lockCounter = 0;
/**
* ScrollLock is a content-free React component for declaratively preventing
* scroll bleed from modal UI to the page body. This component applies a
* `lockscroll` class to the `document.documentElement` and
* `document.scrollingElement` elements to stop the body from scrolling. When it
* is present, the lock is applied.
*
* ```jsx
* import { ScrollLock, Button } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyScrollLock = () => {
* const [ isScrollLocked, setIsScrollLocked ] = useState( false );
*
* const toggleLock = () => {
* setIsScrollLocked( ( locked ) => ! locked ) );
* };
*
* return (
* <div>
* <Button variant="secondary" onClick={ toggleLock }>
* Toggle scroll lock
* </Button>
* { isScrollLocked && <ScrollLock /> }
* <p>
* Scroll locked:
* <strong>{ isScrollLocked ? 'Yes' : 'No' }</strong>
* </p>
* </div>
* );
* };
* ```
*/
function ScrollLock() {
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (lockCounter === 0) {
setLocked(true);
}
++lockCounter;
return () => {
if (lockCounter === 1) {
setLocked(false);
}
--lockCounter;
};
}, []);
return null;
}
/* harmony default export */ const scroll_lock = (ScrollLock);
;// CONCATENATED MODULE: ./node_modules/proxy-compare/dist/index.modern.js
const index_modern_e=Symbol(),index_modern_t=Symbol(),index_modern_r=Symbol();let index_modern_n=(e,t)=>new Proxy(e,t);const index_modern_o=Object.getPrototypeOf,index_modern_s=new WeakMap,index_modern_c=e=>e&&(index_modern_s.has(e)?index_modern_s.get(e):index_modern_o(e)===Object.prototype||index_modern_o(e)===Array.prototype),index_modern_l=e=>"object"==typeof e&&null!==e,index_modern_a=new WeakMap,index_modern_f=e=>e[index_modern_r]||e,index_modern_i=(s,l,p)=>{if(!index_modern_c(s))return s;const y=index_modern_f(s),u=(e=>Object.isFrozen(e)||Object.values(Object.getOwnPropertyDescriptors(e)).some(e=>!e.writable))(y);let g=p&&p.get(y);return g&&g[1].f===u||(g=((n,o)=>{const s={f:o};let c=!1;const l=(t,r)=>{if(!c){let o=s.a.get(n);o||(o=new Set,s.a.set(n,o)),r&&o.has(index_modern_e)||o.add(t)}},a={get:(e,t)=>t===index_modern_r?n:(l(t),index_modern_i(e[t],s.a,s.c)),has:(e,r)=>r===index_modern_t?(c=!0,s.a.delete(n),!0):(l(r),r in e),getOwnPropertyDescriptor:(e,t)=>(l(t,!0),Object.getOwnPropertyDescriptor(e,t)),ownKeys:t=>(l(index_modern_e),Reflect.ownKeys(t))};return o&&(a.set=a.deleteProperty=()=>!1),[a,s]})(y,u),g[1].p=index_modern_n(u?(e=>{let t=index_modern_a.get(e);if(!t){if(Array.isArray(e))t=Array.from(e);else{const r=Object.getOwnPropertyDescriptors(e);Object.values(r).forEach(e=>{e.configurable=!0}),t=Object.create(index_modern_o(e),r)}index_modern_a.set(e,t)}return t})(y):y,g[0]),p&&p.set(y,g)),g[1].a=l,g[1].c=p,g[1].p},index_modern_p=(e,t)=>{const r=Reflect.ownKeys(e),n=Reflect.ownKeys(t);return r.length!==n.length||r.some((e,t)=>e!==n[t])},index_modern_y=(t,r,n,o)=>{if(Object.is(t,r))return!1;if(!index_modern_l(t)||!index_modern_l(r))return!0;const s=n.get(index_modern_f(t));if(!s)return!0;if(o){const e=o.get(t);if(e&&e.n===r)return e.g;o.set(t,{n:r,g:!1})}let c=null;for(const l of s){const s=l===index_modern_e?index_modern_p(t,r):index_modern_y(t[l],r[l],n,o);if(!0!==s&&!1!==s||(c=s),c)break}return null===c&&(c=!0),o&&o.set(t,{n:r,g:c}),c},index_modern_u=e=>!!index_modern_c(e)&&index_modern_t in e,index_modern_g=e=>index_modern_c(e)&&e[index_modern_r]||null,index_modern_b=(e,t=!0)=>{index_modern_s.set(e,t)},O=(e,t)=>{const r=[],n=new WeakSet,o=(e,s)=>{if(n.has(e))return;index_modern_l(e)&&n.add(e);const c=index_modern_l(e)&&t.get(index_modern_f(e));c?c.forEach(t=>{o(e[t],s?[...s,t]:[t])}):s&&r.push(s)};return o(e),r},index_modern_w=e=>{index_modern_n=e};
;// CONCATENATED MODULE: ./node_modules/valtio/esm/vanilla.js
const vanilla_isObject = (x) => typeof x === "object" && x !== null;
const refSet = /* @__PURE__ */ new WeakSet();
const VERSION = true ? Symbol("VERSION") : 0;
const LISTENERS = true ? Symbol("LISTENERS") : 0;
const SNAPSHOT = true ? Symbol("SNAPSHOT") : 0;
const buildProxyFunction = (objectIs = Object.is, newProxy = (target, handler) => new Proxy(target, handler), canProxy = (x) => vanilla_isObject(x) && !refSet.has(x) && (Array.isArray(x) || !(Symbol.iterator in x)) && !(x instanceof WeakMap) && !(x instanceof WeakSet) && !(x instanceof Error) && !(x instanceof Number) && !(x instanceof Date) && !(x instanceof String) && !(x instanceof RegExp) && !(x instanceof ArrayBuffer), PROMISE_RESULT = true ? Symbol("PROMISE_RESULT") : 0, PROMISE_ERROR = true ? Symbol("PROMISE_ERROR") : 0, snapshotCache = /* @__PURE__ */ new WeakMap(), createSnapshot = (version, target, receiver) => {
const cache = snapshotCache.get(receiver);
if ((cache == null ? void 0 : cache[0]) === version) {
return cache[1];
}
const snapshot2 = Array.isArray(target) ? [] : Object.create(Object.getPrototypeOf(target));
index_modern_b(snapshot2, true);
snapshotCache.set(receiver, [version, snapshot2]);
Reflect.ownKeys(target).forEach((key) => {
const value = Reflect.get(target, key, receiver);
if (refSet.has(value)) {
index_modern_b(value, false);
snapshot2[key] = value;
} else if (value instanceof Promise) {
if (PROMISE_RESULT in value) {
snapshot2[key] = value[PROMISE_RESULT];
} else {
const errorOrPromise = value[PROMISE_ERROR] || value;
Object.defineProperty(snapshot2, key, {
get() {
if (PROMISE_RESULT in value) {
return value[PROMISE_RESULT];
}
throw errorOrPromise;
}
});
}
} else if (value == null ? void 0 : value[LISTENERS]) {
snapshot2[key] = value[SNAPSHOT];
} else {
snapshot2[key] = value;
}
});
return Object.freeze(snapshot2);
}, proxyCache = /* @__PURE__ */ new WeakMap(), versionHolder = [1], proxyFunction2 = (initialObject) => {
if (!vanilla_isObject(initialObject)) {
throw new Error("object required");
}
const found = proxyCache.get(initialObject);
if (found) {
return found;
}
let version = versionHolder[0];
const listeners = /* @__PURE__ */ new Set();
const notifyUpdate = (op, nextVersion = ++versionHolder[0]) => {
if (version !== nextVersion) {
version = nextVersion;
listeners.forEach((listener) => listener(op, nextVersion));
}
};
const propListeners = /* @__PURE__ */ new Map();
const getPropListener = (prop) => {
let propListener = propListeners.get(prop);
if (!propListener) {
propListener = (op, nextVersion) => {
const newOp = [...op];
newOp[1] = [prop, ...newOp[1]];
notifyUpdate(newOp, nextVersion);
};
propListeners.set(prop, propListener);
}
return propListener;
};
const popPropListener = (prop) => {
const propListener = propListeners.get(prop);
propListeners.delete(prop);
return propListener;
};
const baseObject = Array.isArray(initialObject) ? [] : Object.create(Object.getPrototypeOf(initialObject));
const handler = {
get(target, prop, receiver) {
if (prop === VERSION) {
return version;
}
if (prop === LISTENERS) {
return listeners;
}
if (prop === SNAPSHOT) {
return createSnapshot(version, target, receiver);
}
return Reflect.get(target, prop, receiver);
},
deleteProperty(target, prop) {
const prevValue = Reflect.get(target, prop);
const childListeners = prevValue == null ? void 0 : prevValue[LISTENERS];
if (childListeners) {
childListeners.delete(popPropListener(prop));
}
const deleted = Reflect.deleteProperty(target, prop);
if (deleted) {
notifyUpdate(["delete", [prop], prevValue]);
}
return deleted;
},
set(target, prop, value, receiver) {
var _a;
const hasPrevValue = Reflect.has(target, prop);
const prevValue = Reflect.get(target, prop, receiver);
if (hasPrevValue && objectIs(prevValue, value)) {
return true;
}
const childListeners = prevValue == null ? void 0 : prevValue[LISTENERS];
if (childListeners) {
childListeners.delete(popPropListener(prop));
}
if (vanilla_isObject(value)) {
value = index_modern_g(value) || value;
}
let nextValue;
if ((_a = Object.getOwnPropertyDescriptor(target, prop)) == null ? void 0 : _a.set) {
nextValue = value;
} else if (value instanceof Promise) {
nextValue = value.then((v) => {
nextValue[PROMISE_RESULT] = v;
notifyUpdate(["resolve", [prop], v]);
return v;
}).catch((e) => {
nextValue[PROMISE_ERROR] = e;
notifyUpdate(["reject", [prop], e]);
});
} else if (value == null ? void 0 : value[LISTENERS]) {
nextValue = value;
nextValue[LISTENERS].add(getPropListener(prop));
} else if (canProxy(value)) {
nextValue = vanilla_proxy(value);
nextValue[LISTENERS].add(getPropListener(prop));
} else {
nextValue = value;
}
Reflect.set(target, prop, nextValue, receiver);
notifyUpdate(["set", [prop], value, prevValue]);
return true;
}
};
const proxyObject = newProxy(baseObject, handler);
proxyCache.set(initialObject, proxyObject);
Reflect.ownKeys(initialObject).forEach((key) => {
const desc = Object.getOwnPropertyDescriptor(
initialObject,
key
);
if (desc.get || desc.set) {
Object.defineProperty(baseObject, key, desc);
} else {
proxyObject[key] = initialObject[key];
}
});
return proxyObject;
}) => [
proxyFunction2,
refSet,
VERSION,
LISTENERS,
SNAPSHOT,
objectIs,
newProxy,
canProxy,
PROMISE_RESULT,
PROMISE_ERROR,
snapshotCache,
createSnapshot,
proxyCache,
versionHolder
];
const [proxyFunction] = buildProxyFunction();
function vanilla_proxy(initialObject = {}) {
return proxyFunction(initialObject);
}
function vanilla_getVersion(proxyObject) {
return vanilla_isObject(proxyObject) ? proxyObject[VERSION] : void 0;
}
function vanilla_subscribe(proxyObject, callback, notifyInSync) {
if ( true && !(proxyObject == null ? void 0 : proxyObject[LISTENERS])) {
console.warn("Please use proxy object");
}
let promise;
const ops = [];
const listener = (op) => {
ops.push(op);
if (notifyInSync) {
callback(ops.splice(0));
return;
}
if (!promise) {
promise = Promise.resolve().then(() => {
promise = void 0;
callback(ops.splice(0));
});
}
};
proxyObject[LISTENERS].add(listener);
return () => {
proxyObject[LISTENERS].delete(listener);
};
}
function vanilla_snapshot(proxyObject) {
if ( true && !(proxyObject == null ? void 0 : proxyObject[SNAPSHOT])) {
console.warn("Please use proxy object");
}
return proxyObject[SNAPSHOT];
}
function vanilla_ref(obj) {
refSet.add(obj);
return obj;
}
const unstable_buildProxyFunction = (/* unused pure expression or super */ null && (buildProxyFunction));
;// CONCATENATED MODULE: ./node_modules/valtio/esm/index.js
const { useSyncExternalStore: esm_useSyncExternalStore } = shim;
const useAffectedDebugValue = (state, affected) => {
const pathList = (0,external_React_.useRef)();
(0,external_React_.useEffect)(() => {
pathList.current = O(state, affected);
});
(0,external_React_.useDebugValue)(pathList.current);
};
function useSnapshot(proxyObject, options) {
const notifyInSync = options == null ? void 0 : options.sync;
const lastSnapshot = (0,external_React_.useRef)();
const lastAffected = (0,external_React_.useRef)();
let inRender = true;
const currSnapshot = esm_useSyncExternalStore(
(0,external_React_.useCallback)(
(callback) => {
const unsub = vanilla_subscribe(proxyObject, callback, notifyInSync);
callback();
return unsub;
},
[proxyObject, notifyInSync]
),
() => {
const nextSnapshot = vanilla_snapshot(proxyObject);
try {
if (!inRender && lastSnapshot.current && lastAffected.current && !index_modern_y(
lastSnapshot.current,
nextSnapshot,
lastAffected.current,
/* @__PURE__ */ new WeakMap()
)) {
return lastSnapshot.current;
}
} catch (e) {
}
return nextSnapshot;
},
() => vanilla_snapshot(proxyObject)
);
inRender = false;
const currAffected = /* @__PURE__ */ new WeakMap();
(0,external_React_.useEffect)(() => {
lastSnapshot.current = currSnapshot;
lastAffected.current = currAffected;
});
if (true) {
useAffectedDebugValue(currSnapshot, currAffected);
}
const proxyCache = (0,external_React_.useMemo)(() => /* @__PURE__ */ new WeakMap(), []);
return index_modern_i(currSnapshot, currAffected, proxyCache);
}
;// CONCATENATED MODULE: ./node_modules/valtio/esm/utils.js
function subscribeKey(proxyObject, key, callback, notifyInSync) {
return subscribe(
proxyObject,
(ops) => {
if (ops.some((op) => op[1][0] === key)) {
callback(proxyObject[key]);
}
},
notifyInSync
);
}
let currentCleanups;
function watch(callback, options) {
let alive = true;
const cleanups = /* @__PURE__ */ new Set();
const subscriptions = /* @__PURE__ */ new Map();
const cleanup = () => {
if (alive) {
alive = false;
cleanups.forEach((clean) => clean());
cleanups.clear();
subscriptions.forEach((unsubscribe) => unsubscribe());
subscriptions.clear();
}
};
const revalidate = () => {
if (!alive) {
return;
}
cleanups.forEach((clean) => clean());
cleanups.clear();
const proxiesToSubscribe = /* @__PURE__ */ new Set();
const parent = currentCleanups;
currentCleanups = cleanups;
try {
const cleanupReturn = callback((proxyObject) => {
proxiesToSubscribe.add(proxyObject);
return proxyObject;
});
if (cleanupReturn) {
cleanups.add(cleanupReturn);
}
} finally {
currentCleanups = parent;
}
subscriptions.forEach((unsubscribe, proxyObject) => {
if (proxiesToSubscribe.has(proxyObject)) {
proxiesToSubscribe.delete(proxyObject);
} else {
subscriptions.delete(proxyObject);
unsubscribe();
}
});
proxiesToSubscribe.forEach((proxyObject) => {
const unsubscribe = subscribe(proxyObject, revalidate, options == null ? void 0 : options.sync);
subscriptions.set(proxyObject, unsubscribe);
});
};
if (currentCleanups) {
currentCleanups.add(cleanup);
}
revalidate();
return cleanup;
}
const DEVTOOLS = Symbol();
function devtools(proxyObject, options) {
if (typeof options === "string") {
console.warn(
"string name option is deprecated, use { name }. https://github.com/pmndrs/valtio/pull/400"
);
options = { name: options };
}
const { enabled, name = "" } = options || {};
let extension;
try {
extension = (enabled != null ? enabled : (/* unsupported import.meta.env */ undefined && 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
} catch {
}
if (!extension) {
if ( true && enabled) {
console.warn("[Warning] Please install/enable Redux devtools extension");
}
return;
}
let isTimeTraveling = false;
const devtools2 = extension.connect({ name });
const unsub1 = subscribe(proxyObject, (ops) => {
const action = ops.filter(([_, path]) => path[0] !== DEVTOOLS).map(([op, path]) => `${op}:${path.map(String).join(".")}`).join(", ");
if (!action) {
return;
}
if (isTimeTraveling) {
isTimeTraveling = false;
} else {
const snapWithoutDevtools = Object.assign({}, snapshot(proxyObject));
delete snapWithoutDevtools[DEVTOOLS];
devtools2.send(
{
type: action,
updatedAt: new Date().toLocaleString()
},
snapWithoutDevtools
);
}
});
const unsub2 = devtools2.subscribe((message) => {
var _a, _b, _c, _d, _e, _f;
if (message.type === "ACTION" && message.payload) {
try {
Object.assign(proxyObject, JSON.parse(message.payload));
} catch (e) {
console.error(
"please dispatch a serializable value that JSON.parse() and proxy() support\n",
e
);
}
}
if (message.type === "DISPATCH" && message.state) {
if (((_a = message.payload) == null ? void 0 : _a.type) === "JUMP_TO_ACTION" || ((_b = message.payload) == null ? void 0 : _b.type) === "JUMP_TO_STATE") {
isTimeTraveling = true;
const state = JSON.parse(message.state);
Object.assign(proxyObject, state);
}
proxyObject[DEVTOOLS] = message;
} else if (message.type === "DISPATCH" && ((_c = message.payload) == null ? void 0 : _c.type) === "COMMIT") {
devtools2.init(snapshot(proxyObject));
} else if (message.type === "DISPATCH" && ((_d = message.payload) == null ? void 0 : _d.type) === "IMPORT_STATE") {
const actions = (_e = message.payload.nextLiftedState) == null ? void 0 : _e.actionsById;
const computedStates = ((_f = message.payload.nextLiftedState) == null ? void 0 : _f.computedStates) || [];
isTimeTraveling = true;
computedStates.forEach(({ state }, index) => {
const action = actions[index] || "No action found";
Object.assign(proxyObject, state);
if (index === 0) {
devtools2.init(snapshot(proxyObject));
} else {
devtools2.send(action, snapshot(proxyObject));
}
});
}
});
devtools2.init(snapshot(proxyObject));
return () => {
unsub1();
unsub2 == null ? void 0 : unsub2();
};
}
const sourceObjectMap = /* @__PURE__ */ new WeakMap();
const derivedObjectMap = /* @__PURE__ */ new WeakMap();
const markPending = (sourceObject, callback) => {
const sourceObjectEntry = sourceObjectMap.get(sourceObject);
if (sourceObjectEntry) {
sourceObjectEntry[0].forEach((subscription) => {
const { d: derivedObject } = subscription;
if (sourceObject !== derivedObject) {
markPending(derivedObject);
}
});
++sourceObjectEntry[2];
if (callback) {
sourceObjectEntry[3].add(callback);
}
}
};
const checkPending = (sourceObject, callback) => {
const sourceObjectEntry = sourceObjectMap.get(sourceObject);
if (sourceObjectEntry == null ? void 0 : sourceObjectEntry[2]) {
sourceObjectEntry[3].add(callback);
return true;
}
return false;
};
const unmarkPending = (sourceObject) => {
const sourceObjectEntry = sourceObjectMap.get(sourceObject);
if (sourceObjectEntry) {
--sourceObjectEntry[2];
if (!sourceObjectEntry[2]) {
sourceObjectEntry[3].forEach((callback) => callback());
sourceObjectEntry[3].clear();
}
sourceObjectEntry[0].forEach((subscription) => {
const { d: derivedObject } = subscription;
if (sourceObject !== derivedObject) {
unmarkPending(derivedObject);
}
});
}
};
const addSubscription = (subscription) => {
const { s: sourceObject, d: derivedObject } = subscription;
let derivedObjectEntry = derivedObjectMap.get(derivedObject);
if (!derivedObjectEntry) {
derivedObjectEntry = [/* @__PURE__ */ new Set()];
derivedObjectMap.set(subscription.d, derivedObjectEntry);
}
derivedObjectEntry[0].add(subscription);
let sourceObjectEntry = sourceObjectMap.get(sourceObject);
if (!sourceObjectEntry) {
const subscriptions = /* @__PURE__ */ new Set();
const unsubscribe = vanilla_subscribe(
sourceObject,
(ops) => {
subscriptions.forEach((subscription2) => {
const {
d: derivedObject2,
c: callback,
n: notifyInSync,
i: ignoreKeys
} = subscription2;
if (sourceObject === derivedObject2 && ops.every(
(op) => op[1].length === 1 && ignoreKeys.includes(op[1][0])
)) {
return;
}
if (subscription2.p) {
return;
}
markPending(sourceObject, callback);
if (notifyInSync) {
unmarkPending(sourceObject);
} else {
subscription2.p = Promise.resolve().then(() => {
delete subscription2.p;
unmarkPending(sourceObject);
});
}
});
},
true
);
sourceObjectEntry = [subscriptions, unsubscribe, 0, /* @__PURE__ */ new Set()];
sourceObjectMap.set(sourceObject, sourceObjectEntry);
}
sourceObjectEntry[0].add(subscription);
};
const removeSubscription = (subscription) => {
const { s: sourceObject, d: derivedObject } = subscription;
const derivedObjectEntry = derivedObjectMap.get(derivedObject);
derivedObjectEntry == null ? void 0 : derivedObjectEntry[0].delete(subscription);
if ((derivedObjectEntry == null ? void 0 : derivedObjectEntry[0].size) === 0) {
derivedObjectMap.delete(derivedObject);
}
const sourceObjectEntry = sourceObjectMap.get(sourceObject);
if (sourceObjectEntry) {
const [subscriptions, unsubscribe] = sourceObjectEntry;
subscriptions.delete(subscription);
if (!subscriptions.size) {
unsubscribe();
sourceObjectMap.delete(sourceObject);
}
}
};
const listSubscriptions = (derivedObject) => {
const derivedObjectEntry = derivedObjectMap.get(derivedObject);
if (derivedObjectEntry) {
return Array.from(derivedObjectEntry[0]);
}
return [];
};
const unstable_deriveSubscriptions = {
add: addSubscription,
remove: removeSubscription,
list: listSubscriptions
};
function derive(derivedFns, options) {
const proxyObject = (options == null ? void 0 : options.proxy) || proxy({});
const notifyInSync = !!(options == null ? void 0 : options.sync);
const derivedKeys = Object.keys(derivedFns);
derivedKeys.forEach((key) => {
if (Object.getOwnPropertyDescriptor(proxyObject, key)) {
throw new Error("object property already defined");
}
const fn = derivedFns[key];
let lastDependencies = null;
const evaluate = () => {
if (lastDependencies) {
if (Array.from(lastDependencies).map(([p]) => checkPending(p, evaluate)).some((isPending) => isPending)) {
return;
}
if (Array.from(lastDependencies).every(
([p, entry]) => getVersion(p) === entry.v
)) {
return;
}
}
const dependencies = /* @__PURE__ */ new Map();
const get = (p) => {
dependencies.set(p, { v: getVersion(p) });
return p;
};
const value = fn(get);
const subscribeToDependencies = () => {
dependencies.forEach((entry, p) => {
var _a;
const lastSubscription = (_a = lastDependencies == null ? void 0 : lastDependencies.get(p)) == null ? void 0 : _a.s;
if (lastSubscription) {
entry.s = lastSubscription;
} else {
const subscription = {
s: p,
d: proxyObject,
k: key,
c: evaluate,
n: notifyInSync,
i: derivedKeys
};
addSubscription(subscription);
entry.s = subscription;
}
});
lastDependencies == null ? void 0 : lastDependencies.forEach((entry, p) => {
if (!dependencies.has(p) && entry.s) {
removeSubscription(entry.s);
}
});
lastDependencies = dependencies;
};
if (value instanceof Promise) {
value.finally(subscribeToDependencies);
} else {
subscribeToDependencies();
}
proxyObject[key] = value;
};
evaluate();
});
return proxyObject;
}
function underive(proxyObject, options) {
const keysToDelete = (options == null ? void 0 : options.delete) ? /* @__PURE__ */ new Set() : null;
listSubscriptions(proxyObject).forEach((subscription) => {
const { k: key } = subscription;
if (!(options == null ? void 0 : options.keys) || options.keys.includes(key)) {
removeSubscription(subscription);
if (keysToDelete) {
keysToDelete.add(key);
}
}
});
if (keysToDelete) {
keysToDelete.forEach((key) => {
delete proxyObject[key];
});
}
}
function addComputed_DEPRECATED(proxyObject, computedFns_FAKE, targetObject = proxyObject) {
console.warn(
"addComputed is deprecated. Please consider using `derive` or `proxyWithComputed` instead. Falling back to emulation with derive. https://github.com/pmndrs/valtio/pull/201"
);
const derivedFns = {};
Object.keys(computedFns_FAKE).forEach((key) => {
derivedFns[key] = (get) => computedFns_FAKE[key](get(proxyObject));
});
return derive(derivedFns, { proxy: targetObject });
}
function proxyWithComputed(initialObject, computedFns) {
Object.keys(computedFns).forEach((key) => {
if (Object.getOwnPropertyDescriptor(initialObject, key)) {
throw new Error("object property already defined");
}
const computedFn = computedFns[key];
const { get, set } = typeof computedFn === "function" ? { get: computedFn } : computedFn;
const desc = {};
desc.get = () => get(snapshot(proxyObject));
if (set) {
desc.set = (newValue) => set(proxyObject, newValue);
}
Object.defineProperty(initialObject, key, desc);
});
const proxyObject = proxy(initialObject);
return proxyObject;
}
const utils_isObject = (x) => typeof x === "object" && x !== null;
const deepClone = (obj) => {
if (!utils_isObject(obj)) {
return obj;
}
const baseObject = Array.isArray(obj) ? [] : Object.create(Object.getPrototypeOf(obj));
Reflect.ownKeys(obj).forEach((key) => {
baseObject[key] = deepClone(obj[key]);
});
return baseObject;
};
function proxyWithHistory(initialValue, skipSubscribe = false) {
const proxyObject = proxy({
value: initialValue,
history: ref({
wip: void 0,
snapshots: [],
index: -1
}),
canUndo: () => proxyObject.history.index > 0,
undo: () => {
if (proxyObject.canUndo()) {
proxyObject.value = proxyObject.history.wip = deepClone(
proxyObject.history.snapshots[--proxyObject.history.index]
);
}
},
canRedo: () => proxyObject.history.index < proxyObject.history.snapshots.length - 1,
redo: () => {
if (proxyObject.canRedo()) {
proxyObject.value = proxyObject.history.wip = deepClone(
proxyObject.history.snapshots[++proxyObject.history.index]
);
}
},
saveHistory: () => {
proxyObject.history.snapshots.splice(proxyObject.history.index + 1);
proxyObject.history.snapshots.push(snapshot(proxyObject).value);
++proxyObject.history.index;
},
subscribe: () => subscribe(proxyObject, (ops) => {
if (ops.every(
(op) => op[1][0] === "value" && (op[0] !== "set" || op[2] !== proxyObject.history.wip)
)) {
proxyObject.saveHistory();
}
})
});
proxyObject.saveHistory();
if (!skipSubscribe) {
proxyObject.subscribe();
}
return proxyObject;
}
function proxySet(initialValues) {
const set = proxy({
data: Array.from(new Set(initialValues)),
has(value) {
return this.data.indexOf(value) !== -1;
},
add(value) {
let hasProxy = false;
if (typeof value === "object" && value !== null) {
hasProxy = this.data.indexOf(proxy(value)) !== -1;
}
if (this.data.indexOf(value) === -1 && !hasProxy) {
this.data.push(value);
}
return this;
},
delete(value) {
const index = this.data.indexOf(value);
if (index === -1) {
return false;
}
this.data.splice(index, 1);
return true;
},
clear() {
this.data.splice(0);
},
get size() {
return this.data.length;
},
forEach(cb) {
this.data.forEach((value) => {
cb(value, value, this);
});
},
get [Symbol.toStringTag]() {
return "Set";
},
toJSON() {
return {};
},
[Symbol.iterator]() {
return this.data[Symbol.iterator]();
},
values() {
return this.data.values();
},
keys() {
return this.data.values();
},
entries() {
return new Set(this.data).entries();
}
});
Object.defineProperties(set, {
data: {
enumerable: false
},
size: {
enumerable: false
},
toJSON: {
enumerable: false
}
});
Object.seal(set);
return set;
}
function proxyMap(entries) {
const map = vanilla_proxy({
data: Array.from(entries || []),
has(key) {
return this.data.some((p) => p[0] === key);
},
set(key, value) {
const record = this.data.find((p) => p[0] === key);
if (record) {
record[1] = value;
} else {
this.data.push([key, value]);
}
return this;
},
get(key) {
var _a;
return (_a = this.data.find((p) => p[0] === key)) == null ? void 0 : _a[1];
},
delete(key) {
const index = this.data.findIndex((p) => p[0] === key);
if (index === -1) {
return false;
}
this.data.splice(index, 1);
return true;
},
clear() {
this.data.splice(0);
},
get size() {
return this.data.length;
},
toJSON() {
return {};
},
forEach(cb) {
this.data.forEach((p) => {
cb(p[1], p[0], this);
});
},
keys() {
return this.data.map((p) => p[0]).values();
},
values() {
return this.data.map((p) => p[1]).values();
},
entries() {
return new Map(this.data).entries();
},
get [Symbol.toStringTag]() {
return "Map";
},
[Symbol.iterator]() {
return this.entries();
}
});
Object.defineProperties(map, {
data: {
enumerable: false
},
size: {
enumerable: false
},
toJSON: {
enumerable: false
}
});
Object.seal(map);
return map;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const initialContextValue = {
slots: proxyMap(),
fills: proxyMap(),
registerSlot: () => {
true ? external_wp_warning_default()('Components must be wrapped within `SlotFillProvider`. ' + 'See https://developer.wordpress.org/block-editor/components/slot-fill/') : 0;
},
updateSlot: () => {},
unregisterSlot: () => {},
registerFill: () => {},
unregisterFill: () => {},
// This helps the provider know if it's using the default context value or not.
isDefault: true
};
const SlotFillContext = (0,external_wp_element_namespaceObject.createContext)(initialContextValue);
/* harmony default export */ const slot_fill_context = (SlotFillContext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useSlot(name) {
const registry = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context);
const slots = useSnapshot(registry.slots, {
sync: true
});
// The important bit here is that the `useSnapshot` call ensures that the
// hook only causes a re-render if the slot with the given name changes,
// not any other slot.
const slot = slots.get(name);
const api = (0,external_wp_element_namespaceObject.useMemo)(() => ({
updateSlot: fillProps => registry.updateSlot(name, fillProps),
unregisterSlot: ref => registry.unregisterSlot(name, ref),
registerFill: ref => registry.registerFill(name, ref),
unregisterFill: ref => registry.unregisterFill(name, ref)
}), [name, registry]);
return {
...slot,
...api
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/context.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const initialValue = {
registerSlot: () => {},
unregisterSlot: () => {},
registerFill: () => {},
unregisterFill: () => {},
getSlot: () => undefined,
getFills: () => [],
subscribe: () => () => {}
};
const context_SlotFillContext = (0,external_wp_element_namespaceObject.createContext)(initialValue);
/* harmony default export */ const context = (context_SlotFillContext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/use-slot.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* React hook returning the active slot given a name.
*
* @param name Slot name.
* @return Slot object.
*/
const use_slot_useSlot = name => {
const {
getSlot,
subscribe
} = (0,external_wp_element_namespaceObject.useContext)(context);
return (0,external_wp_element_namespaceObject.useSyncExternalStore)(subscribe, () => getSlot(name), () => getSlot(name));
};
/* harmony default export */ const use_slot = (use_slot_useSlot);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/fill.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Fill({
name,
children
}) {
const {
registerFill,
unregisterFill
} = (0,external_wp_element_namespaceObject.useContext)(context);
const slot = use_slot(name);
const ref = (0,external_wp_element_namespaceObject.useRef)({
name,
children
});
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
const refValue = ref.current;
registerFill(name, refValue);
return () => unregisterFill(name, refValue);
// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
ref.current.children = children;
if (slot) {
slot.forceUpdate();
}
// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [children]);
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (name === ref.current.name) {
// Ignore initial effect.
return;
}
unregisterFill(ref.current.name, ref.current);
ref.current.name = name;
registerFill(name, ref.current);
// Ignore reason: the useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [name]);
return null;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/slot.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Whether the argument is a function.
*
* @param maybeFunc The argument to check.
* @return True if the argument is a function, false otherwise.
*/
function isFunction(maybeFunc) {
return typeof maybeFunc === 'function';
}
class SlotComponent extends external_wp_element_namespaceObject.Component {
constructor(props) {
super(props);
this.isUnmounted = false;
}
componentDidMount() {
const {
registerSlot
} = this.props;
this.isUnmounted = false;
registerSlot(this.props.name, this);
}
componentWillUnmount() {
const {
unregisterSlot
} = this.props;
this.isUnmounted = true;
unregisterSlot(this.props.name, this);
}
componentDidUpdate(prevProps) {
const {
name,
unregisterSlot,
registerSlot
} = this.props;
if (prevProps.name !== name) {
unregisterSlot(prevProps.name, this);
registerSlot(name, this);
}
}
forceUpdate() {
if (this.isUnmounted) {
return;
}
super.forceUpdate();
}
render() {
var _getFills;
const {
children,
name,
fillProps = {},
getFills
} = this.props;
const fills = ((_getFills = getFills(name, this)) !== null && _getFills !== void 0 ? _getFills : []).map(fill => {
const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
return external_wp_element_namespaceObject.Children.map(fillChildren, (child, childIndex) => {
if (!child || typeof child === 'string') {
return child;
}
let childKey = childIndex;
if (typeof child === 'object' && 'key' in child && child?.key) {
childKey = child.key;
}
return (0,external_wp_element_namespaceObject.cloneElement)(child, {
key: childKey
});
});
}).filter(
// In some cases fills are rendered only when some conditions apply.
// This ensures that we only use non-empty fills when rendering, i.e.,
// it allows us to render wrappers only when the fills are actually present.
element => !(0,external_wp_element_namespaceObject.isEmptyElement)(element));
return (0,external_React_.createElement)(external_React_.Fragment, null, isFunction(children) ? children(fills) : fills);
}
}
const Slot = props => (0,external_React_.createElement)(context.Consumer, null, ({
registerSlot,
unregisterSlot,
getFills
}) => (0,external_React_.createElement)(SlotComponent, {
...props,
registerSlot: registerSlot,
unregisterSlot: unregisterSlot,
getFills: getFills
}));
/* harmony default export */ const slot = (Slot);
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/native.js
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
/* harmony default export */ const esm_browser_native = ({
randomUUID
});
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js
// Unique ID creation requires a high quality random # generator. In the browser we therefore
// require the crypto API and do not support built-in fallback to lower quality random number
// generators (like Math.random()).
let getRandomValues;
const rnds8 = new Uint8Array(16);
function rng() {
// lazy load so that environments that need to polyfill have a chance to do so
if (!getRandomValues) {
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
if (!getRandomValues) {
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
}
}
return getRandomValues(rnds8);
}
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js
/**
* Convert array of 16 byte values to UUID string format of the form:
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
*/
const byteToHex = [];
for (let i = 0; i < 256; ++i) {
byteToHex.push((i + 0x100).toString(16).slice(1));
}
function unsafeStringify(arr, offset = 0) {
// Note: Be careful editing this code! It's been tuned for performance
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
}
function stringify_stringify(arr, offset = 0) {
const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
// of the following:
// - One or more input array values don't map to a hex octet (leading to
// "undefined" in the uuid)
// - Invalid input values for the RFC `version` or `variant` fields
if (!validate(uuid)) {
throw TypeError('Stringified UUID is invalid');
}
return uuid;
}
/* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify_stringify)));
;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js
function v4(options, buf, offset) {
if (esm_browser_native.randomUUID && !buf && !options) {
return esm_browser_native.randomUUID();
}
options = options || {};
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
rnds[6] = rnds[6] & 0x0f | 0x40;
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
if (buf) {
offset = offset || 0;
for (let i = 0; i < 16; ++i) {
buf[offset + i] = rnds[i];
}
return buf;
}
return unsafeStringify(rnds);
}
/* harmony default export */ const esm_browser_v4 = (v4);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/style-provider/index.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const uuidCache = new Set();
// Use a weak map so that when the container is detached it's automatically
// dereferenced to avoid memory leak.
const containerCacheMap = new WeakMap();
const memoizedCreateCacheWithContainer = container => {
if (containerCacheMap.has(container)) {
return containerCacheMap.get(container);
}
// Emotion only accepts alphabetical and hyphenated keys so we just
// strip the numbers from the UUID. It _should_ be fine.
let key = esm_browser_v4().replace(/[0-9]/g, '');
while (uuidCache.has(key)) {
key = esm_browser_v4().replace(/[0-9]/g, '');
}
uuidCache.add(key);
const cache = emotion_cache_browser_esm({
container,
key
});
containerCacheMap.set(container, cache);
return cache;
};
function StyleProvider(props) {
const {
children,
document
} = props;
if (!document) {
return null;
}
const cache = memoizedCreateCacheWithContainer(document.head);
return (0,external_React_.createElement)(CacheProvider, {
value: cache
}, children);
}
/* harmony default export */ const style_provider = (StyleProvider);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/fill.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function fill_useForceUpdate() {
const [, setState] = (0,external_wp_element_namespaceObject.useState)({});
const mounted = (0,external_wp_element_namespaceObject.useRef)(true);
(0,external_wp_element_namespaceObject.useEffect)(() => {
mounted.current = true;
return () => {
mounted.current = false;
};
}, []);
return () => {
if (mounted.current) {
setState({});
}
};
}
function fill_Fill(props) {
var _slot$fillProps;
const {
name,
children
} = props;
const {
registerFill,
unregisterFill,
...slot
} = useSlot(name);
const rerender = fill_useForceUpdate();
const ref = (0,external_wp_element_namespaceObject.useRef)({
rerender
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
// We register fills so we can keep track of their existence.
// Some Slot implementations need to know if there're already fills
// registered so they can choose to render themselves or not.
registerFill(ref);
return () => {
unregisterFill(ref);
};
}, [registerFill, unregisterFill]);
if (!slot.ref || !slot.ref.current) {
return null;
}
// When using a `Fill`, the `children` will be rendered in the document of the
// `Slot`. This means that we need to wrap the `children` in a `StyleProvider`
// to make sure we're referencing the right document/iframe (instead of the
// context of the `Fill`'s parent).
const wrappedChildren = (0,external_React_.createElement)(style_provider, {
document: slot.ref.current.ownerDocument
}, typeof children === 'function' ? children((_slot$fillProps = slot.fillProps) !== null && _slot$fillProps !== void 0 ? _slot$fillProps : {}) : children);
return (0,external_wp_element_namespaceObject.createPortal)(wrappedChildren, slot.ref.current);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function slot_Slot(props, forwardedRef) {
const {
name,
fillProps = {},
as,
// `children` is not allowed. However, if it is passed,
// it will be displayed as is, so remove `children`.
// @ts-ignore
children,
...restProps
} = props;
const {
registerSlot,
unregisterSlot,
...registry
} = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context);
const ref = (0,external_wp_element_namespaceObject.useRef)(null);
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
registerSlot(name, ref, fillProps);
return () => {
unregisterSlot(name, ref);
};
// Ignore reason: We don't want to unregister and register the slot whenever
// `fillProps` change, which would cause the fill to be re-mounted. Instead,
// we can just update the slot (see hook below).
// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [registerSlot, unregisterSlot, name]);
// fillProps may be an update that interacts with the layout, so we
// useLayoutEffect.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
registry.updateSlot(name, fillProps);
});
return (0,external_React_.createElement)(component, {
as: as,
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([forwardedRef, ref]),
...restProps
});
}
/* harmony default export */ const bubbles_virtually_slot = ((0,external_wp_element_namespaceObject.forwardRef)(slot_Slot));
;// CONCATENATED MODULE: external ["wp","isShallowEqual"]
const 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/components/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function createSlotRegistry() {
const slots = proxyMap();
const fills = proxyMap();
const registerSlot = (name, ref, fillProps) => {
const slot = slots.get(name);
slots.set(name, vanilla_ref({
...slot,
ref: ref || slot?.ref,
fillProps: fillProps || slot?.fillProps || {}
}));
};
const unregisterSlot = (name, ref) => {
// Make sure we're not unregistering a slot registered by another element
// See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412
if (slots.get(name)?.ref === ref) {
slots.delete(name);
}
};
const updateSlot = (name, fillProps) => {
const slot = slots.get(name);
if (!slot) {
return;
}
if (external_wp_isShallowEqual_default()(slot.fillProps, fillProps)) {
return;
}
slot.fillProps = fillProps;
const slotFills = fills.get(name);
if (slotFills) {
// Force update fills.
slotFills.forEach(fill => fill.current.rerender());
}
};
const registerFill = (name, ref) => {
fills.set(name, vanilla_ref([...(fills.get(name) || []), ref]));
};
const unregisterFill = (name, ref) => {
const fillsForName = fills.get(name);
if (!fillsForName) {
return;
}
fills.set(name, vanilla_ref(fillsForName.filter(fillRef => fillRef !== ref)));
};
return {
slots,
fills,
registerSlot,
updateSlot,
unregisterSlot,
registerFill,
unregisterFill
};
}
function SlotFillProvider({
children
}) {
const registry = (0,external_wp_element_namespaceObject.useMemo)(createSlotRegistry, []);
return (0,external_React_.createElement)(slot_fill_context.Provider, {
value: registry
}, children);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/provider.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function provider_createSlotRegistry() {
const slots = {};
const fills = {};
let listeners = [];
function registerSlot(name, slot) {
const previousSlot = slots[name];
slots[name] = slot;
triggerListeners();
// Sometimes the fills are registered after the initial render of slot
// But before the registerSlot call, we need to rerender the slot.
forceUpdateSlot(name);
// If a new instance of a slot is being mounted while another with the
// same name exists, force its update _after_ the new slot has been
// assigned into the instance, such that its own rendering of children
// will be empty (the new Slot will subsume all fills for this name).
if (previousSlot) {
previousSlot.forceUpdate();
}
}
function registerFill(name, instance) {
fills[name] = [...(fills[name] || []), instance];
forceUpdateSlot(name);
}
function unregisterSlot(name, instance) {
// If a previous instance of a Slot by this name unmounts, do nothing,
// as the slot and its fills should only be removed for the current
// known instance.
if (slots[name] !== instance) {
return;
}
delete slots[name];
triggerListeners();
}
function unregisterFill(name, instance) {
var _fills$name$filter;
fills[name] = (_fills$name$filter = fills[name]?.filter(fill => fill !== instance)) !== null && _fills$name$filter !== void 0 ? _fills$name$filter : [];
forceUpdateSlot(name);
}
function getSlot(name) {
return slots[name];
}
function getFills(name, slotInstance) {
// Fills should only be returned for the current instance of the slot
// in which they occupy.
if (slots[name] !== slotInstance) {
return [];
}
return fills[name];
}
function forceUpdateSlot(name) {
const slot = getSlot(name);
if (slot) {
slot.forceUpdate();
}
}
function triggerListeners() {
listeners.forEach(listener => listener());
}
function subscribe(listener) {
listeners.push(listener);
return () => {
listeners = listeners.filter(l => l !== listener);
};
}
return {
registerSlot,
unregisterSlot,
registerFill,
unregisterFill,
getSlot,
getFills,
subscribe
};
}
function provider_SlotFillProvider({
children
}) {
const contextValue = (0,external_wp_element_namespaceObject.useMemo)(provider_createSlotRegistry, []);
return (0,external_React_.createElement)(context.Provider, {
value: contextValue
}, children);
}
/* harmony default export */ const provider = (provider_SlotFillProvider);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function slot_fill_Fill(props) {
// We're adding both Fills here so they can register themselves before
// their respective slot has been registered. Only the Fill that has a slot
// will render. The other one will return null.
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(Fill, {
...props
}), (0,external_React_.createElement)(fill_Fill, {
...props
}));
}
function UnforwardedSlot(props, ref) {
const {
bubblesVirtually,
...restProps
} = props;
if (bubblesVirtually) {
return (0,external_React_.createElement)(bubbles_virtually_slot, {
...restProps,
ref: ref
});
}
return (0,external_React_.createElement)(slot, {
...restProps
});
}
const slot_fill_Slot = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSlot);
function Provider({
children,
passthrough = false
}) {
const parent = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context);
if (!parent.isDefault && passthrough) {
return (0,external_React_.createElement)(external_React_.Fragment, null, children);
}
return (0,external_React_.createElement)(provider, null, (0,external_React_.createElement)(SlotFillProvider, null, children));
}
function createSlotFill(key) {
const baseName = typeof key === 'symbol' ? key.description : key;
const FillComponent = props => (0,external_React_.createElement)(slot_fill_Fill, {
name: key,
...props
});
FillComponent.displayName = `${baseName}Fill`;
const SlotComponent = props => (0,external_React_.createElement)(slot_fill_Slot, {
name: key,
...props
});
SlotComponent.displayName = `${baseName}Slot`;
SlotComponent.__unstableName = key;
return {
Fill: FillComponent,
Slot: SlotComponent
};
}
const createPrivateSlotFill = name => {
const privateKey = Symbol(name);
const privateSlotFill = createSlotFill(privateKey);
return {
privateKey,
...privateSlotFill
};
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/overlay-middlewares.js
/**
* External dependencies
*/
function overlayMiddlewares() {
return [{
name: 'overlay',
fn({
rects
}) {
return rects.reference;
}
}, floating_ui_dom_size({
apply({
rects,
elements
}) {
var _elements$floating;
const {
firstElementChild
} = (_elements$floating = elements.floating) !== null && _elements$floating !== void 0 ? _elements$floating : {};
// Only HTMLElement instances have the `style` property.
if (!(firstElementChild instanceof HTMLElement)) return;
// Reduce the height of the popover to the available space.
Object.assign(firstElementChild.style, {
width: `${rects.reference.width}px`,
height: `${rects.reference.height}px`
});
}
})];
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/index.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Name of slot in which popover should fill.
*
* @type {string}
*/
const SLOT_NAME = 'Popover';
// An SVG displaying a triangle facing down, filled with a solid
// color and bordered in such a way to create an arrow-like effect.
// Keeping the SVG's viewbox squared simplify the arrow positioning
// calculations.
const ArrowTriangle = () => (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: `0 0 100 100`,
className: "components-popover__triangle",
role: "presentation"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
className: "components-popover__triangle-bg",
d: "M 0 0 L 50 50 L 100 0"
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
className: "components-popover__triangle-border",
d: "M 0 0 L 50 50 L 100 0",
vectorEffect: "non-scaling-stroke"
}));
const slotNameContext = (0,external_wp_element_namespaceObject.createContext)(undefined);
const fallbackContainerClassname = 'components-popover__fallback-container';
const getPopoverFallbackContainer = () => {
let container = document.body.querySelector('.' + fallbackContainerClassname);
if (!container) {
container = document.createElement('div');
container.className = fallbackContainerClassname;
document.body.append(container);
}
return container;
};
const UnconnectedPopover = (props, forwardedRef) => {
const {
animate = true,
headerTitle,
constrainTabbing,
onClose,
children,
className,
noArrow = true,
position,
placement: placementProp = 'bottom-start',
offset: offsetProp = 0,
focusOnMount = 'firstElement',
anchor,
expandOnMobile,
onFocusOutside,
__unstableSlotName = SLOT_NAME,
flip = true,
resize = true,
shift = false,
inline = false,
variant,
// Deprecated props
__unstableForcePosition,
anchorRef,
anchorRect,
getAnchorRect,
isAlternate,
// Rest
...contentProps
} = useContextSystem(props, 'Popover');
let computedFlipProp = flip;
let computedResizeProp = resize;
if (__unstableForcePosition !== undefined) {
external_wp_deprecated_default()('`__unstableForcePosition` prop in wp.components.Popover', {
since: '6.1',
version: '6.3',
alternative: '`flip={ false }` and `resize={ false }`'
});
// Back-compat, set the `flip` and `resize` props
// to `false` to replicate `__unstableForcePosition`.
computedFlipProp = !__unstableForcePosition;
computedResizeProp = !__unstableForcePosition;
}
if (anchorRef !== undefined) {
external_wp_deprecated_default()('`anchorRef` prop in wp.components.Popover', {
since: '6.1',
alternative: '`anchor` prop'
});
}
if (anchorRect !== undefined) {
external_wp_deprecated_default()('`anchorRect` prop in wp.components.Popover', {
since: '6.1',
alternative: '`anchor` prop'
});
}
if (getAnchorRect !== undefined) {
external_wp_deprecated_default()('`getAnchorRect` prop in wp.components.Popover', {
since: '6.1',
alternative: '`anchor` prop'
});
}
const computedVariant = isAlternate ? 'toolbar' : variant;
if (isAlternate !== undefined) {
external_wp_deprecated_default()('`isAlternate` prop in wp.components.Popover', {
since: '6.2',
alternative: "`variant` prop with the `'toolbar'` value"
});
}
const arrowRef = (0,external_wp_element_namespaceObject.useRef)(null);
const [fallbackReferenceElement, setFallbackReferenceElement] = (0,external_wp_element_namespaceObject.useState)(null);
const anchorRefFallback = (0,external_wp_element_namespaceObject.useCallback)(node => {
setFallbackReferenceElement(node);
}, []);
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
const isExpanded = expandOnMobile && isMobileViewport;
const hasArrow = !isExpanded && !noArrow;
const normalizedPlacementFromProps = position ? positionToPlacement(position) : placementProp;
const middleware = [...(placementProp === 'overlay' ? overlayMiddlewares() : []), offset(offsetProp), computedFlipProp && floating_ui_dom_flip(), computedResizeProp && floating_ui_dom_size({
apply(sizeProps) {
var _refs$floating$curren;
const {
firstElementChild
} = (_refs$floating$curren = refs.floating.current) !== null && _refs$floating$curren !== void 0 ? _refs$floating$curren : {};
// Only HTMLElement instances have the `style` property.
if (!(firstElementChild instanceof HTMLElement)) return;
// Reduce the height of the popover to the available space.
Object.assign(firstElementChild.style, {
maxHeight: `${sizeProps.availableHeight}px`,
overflow: 'auto'
});
}
}), shift && floating_ui_dom_shift({
crossAxis: true,
limiter: floating_ui_dom_limitShift(),
padding: 1 // Necessary to avoid flickering at the edge of the viewport.
}), floating_ui_react_dom_arrow({
element: arrowRef
})];
const slotName = (0,external_wp_element_namespaceObject.useContext)(slotNameContext) || __unstableSlotName;
const slot = useSlot(slotName);
let onDialogClose;
if (onClose || onFocusOutside) {
onDialogClose = (type, event) => {
// Ideally the popover should have just a single onClose prop and
// not three props that potentially do the same thing.
if (type === 'focus-outside' && onFocusOutside) {
onFocusOutside(event);
} else if (onClose) {
onClose();
}
};
}
const [dialogRef, dialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
constrainTabbing,
focusOnMount,
__unstableOnClose: onDialogClose,
// @ts-expect-error The __unstableOnClose property needs to be deprecated first (see https://github.com/WordPress/gutenberg/pull/27675)
onClose: onDialogClose
});
const {
// Positioning coordinates
x,
y,
// Object with "regular" refs to both "reference" and "floating"
refs,
// Type of CSS position property to use (absolute or fixed)
strategy,
update,
placement: computedPlacement,
middlewareData: {
arrow: arrowData
}
} = useFloating({
placement: normalizedPlacementFromProps === 'overlay' ? undefined : normalizedPlacementFromProps,
middleware,
whileElementsMounted: (referenceParam, floatingParam, updateParam) => autoUpdate(referenceParam, floatingParam, updateParam, {
layoutShift: false,
animationFrame: true
})
});
const arrowCallbackRef = (0,external_wp_element_namespaceObject.useCallback)(node => {
arrowRef.current = node;
update();
}, [update]);
// When any of the possible anchor "sources" change,
// recompute the reference element (real or virtual) and its owner document.
const anchorRefTop = anchorRef?.top;
const anchorRefBottom = anchorRef?.bottom;
const anchorRefStartContainer = anchorRef?.startContainer;
const anchorRefCurrent = anchorRef?.current;
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
const resultingReferenceElement = getReferenceElement({
anchor,
anchorRef,
anchorRect,
getAnchorRect,
fallbackReferenceElement
});
refs.setReference(resultingReferenceElement);
}, [anchor, anchorRef, anchorRefTop, anchorRefBottom, anchorRefStartContainer, anchorRefCurrent, anchorRect, getAnchorRect, fallbackReferenceElement, refs]);
const mergedFloatingRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([refs.setFloating, dialogRef, forwardedRef]);
const style = isExpanded ? undefined : {
position: strategy,
top: 0,
left: 0,
// `x` and `y` are framer-motion specific props and are shorthands
// for `translateX` and `translateY`. Currently it is not possible
// to use `translateX` and `translateY` because those values would
// be overridden by the return value of the
// `placementToMotionAnimationProps` function.
x: computePopoverPosition(x),
y: computePopoverPosition(y)
};
const shouldReduceMotion = useReducedMotion();
const shouldAnimate = animate && !isExpanded && !shouldReduceMotion;
const [animationFinished, setAnimationFinished] = (0,external_wp_element_namespaceObject.useState)(false);
const {
style: motionInlineStyles,
...otherMotionProps
} = (0,external_wp_element_namespaceObject.useMemo)(() => placementToMotionAnimationProps(computedPlacement), [computedPlacement]);
const animationProps = shouldAnimate ? {
style: {
...motionInlineStyles,
...style
},
onAnimationComplete: () => setAnimationFinished(true),
...otherMotionProps
} : {
animate: false,
style
};
// When Floating UI has finished positioning and Framer Motion has finished animating
// the popover, add the `is-positioned` class to signal that all transitions have finished.
const isPositioned = (!shouldAnimate || animationFinished) && x !== null && y !== null;
// In case a `ColorPicker` component is rendered as a child of `Popover`,
// the `Popover` component can be notified of when the user is dragging
// parts of the `ColorPicker` UI (this is possible because the `ColorPicker`
// component exposes the `onPickerDragStart` and `onPickerDragEnd` props
// via internal context).
// While the user is performing a pointer drag, the `Popover` will render
// a transparent backdrop element that will serve as a "pointer events trap",
// making sure that no pointer events reach any potential `iframe` element
// underneath (like, for example, the editor canvas in the WordPress editor).
const [showBackdrop, setShowBackdrop] = (0,external_wp_element_namespaceObject.useState)(false);
const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
ColorPicker: {
onPickerDragStart() {
setShowBackdrop(true);
},
onPickerDragEnd() {
setShowBackdrop(false);
}
}
}), []);
let content = (0,external_React_.createElement)(external_React_.Fragment, null, showBackdrop && (0,external_React_.createElement)("div", {
className: "components-popover-pointer-events-trap",
"aria-hidden": "true",
onClick: () => setShowBackdrop(false)
}), (0,external_React_.createElement)(motion.div, {
className: classnames_default()('components-popover', className, {
'is-expanded': isExpanded,
'is-positioned': isPositioned,
// Use the 'alternate' classname for 'toolbar' variant for back compat.
[`is-${computedVariant === 'toolbar' ? 'alternate' : computedVariant}`]: computedVariant
}),
...animationProps,
...contentProps,
ref: mergedFloatingRef,
...dialogProps,
tabIndex: -1
}, isExpanded && (0,external_React_.createElement)(scroll_lock, null), isExpanded && (0,external_React_.createElement)("div", {
className: "components-popover__header"
}, (0,external_React_.createElement)("span", {
className: "components-popover__header-title"
}, headerTitle), (0,external_React_.createElement)(build_module_button, {
className: "components-popover__close",
icon: library_close,
onClick: onClose
})), (0,external_React_.createElement)("div", {
className: "components-popover__content"
}, (0,external_React_.createElement)(ContextSystemProvider, {
value: contextValue
}, children)), hasArrow && (0,external_React_.createElement)("div", {
ref: arrowCallbackRef,
className: ['components-popover__arrow', `is-${computedPlacement.split('-')[0]}`].join(' '),
style: {
left: typeof arrowData?.x !== 'undefined' && Number.isFinite(arrowData.x) ? `${arrowData.x}px` : '',
top: typeof arrowData?.y !== 'undefined' && Number.isFinite(arrowData.y) ? `${arrowData.y}px` : ''
}
}, (0,external_React_.createElement)(ArrowTriangle, null))));
const shouldRenderWithinSlot = slot.ref && !inline;
const hasAnchor = anchorRef || anchorRect || anchor;
if (shouldRenderWithinSlot) {
content = (0,external_React_.createElement)(slot_fill_Fill, {
name: slotName
}, content);
} else if (!inline) {
content = (0,external_wp_element_namespaceObject.createPortal)((0,external_React_.createElement)(StyleProvider, {
document: document
}, content), getPopoverFallbackContainer());
}
if (hasAnchor) {
return content;
}
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)("span", {
ref: anchorRefFallback
}), content);
};
/**
* `Popover` renders its content in a floating modal. If no explicit anchor is passed via props, it anchors to its parent element by default.
*
* ```jsx
* import { Button, Popover } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyPopover = () => {
* const [ isVisible, setIsVisible ] = useState( false );
* const toggleVisible = () => {
* setIsVisible( ( state ) => ! state );
* };
*
* return (
* <Button variant="secondary" onClick={ toggleVisible }>
* Toggle Popover!
* { isVisible && <Popover>Popover is toggled!</Popover> }
* </Button>
* );
* };
* ```
*
*/
const popover_Popover = contextConnect(UnconnectedPopover, 'Popover');
function PopoverSlot({
name = SLOT_NAME
}, ref) {
return (0,external_React_.createElement)(slot_fill_Slot, {
bubblesVirtually: true,
name: name,
className: "popover-slot",
ref: ref
});
}
// @ts-expect-error For Legacy Reasons
popover_Popover.Slot = (0,external_wp_element_namespaceObject.forwardRef)(PopoverSlot);
// @ts-expect-error For Legacy Reasons
popover_Popover.__unstableSlotNameProvider = slotNameContext.Provider;
/* harmony default export */ const popover = (popover_Popover);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/autocomplete/autocompleter-ui.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function getAutoCompleterUI(autocompleter) {
const useItems = autocompleter.useItems ? autocompleter.useItems : getDefaultUseItems(autocompleter);
function AutocompleterUI({
filterValue,
instanceId,
listBoxId,
className,
selectedIndex,
onChangeOptions,
onSelect,
onReset,
reset,
contentRef
}) {
const [items] = useItems(filterValue);
const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
editableContentElement: contentRef.current
});
const [needsA11yCompat, setNeedsA11yCompat] = (0,external_wp_element_namespaceObject.useState)(false);
const popoverRef = (0,external_wp_element_namespaceObject.useRef)(null);
const popoverRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([popoverRef, (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
if (!contentRef.current) return;
// If the popover is rendered in a different document than
// the content, we need to duplicate the options list in the
// content document so that it's available to the screen
// readers, which check the DOM ID based aira-* attributes.
setNeedsA11yCompat(node.ownerDocument !== contentRef.current.ownerDocument);
}, [contentRef])]);
useOnClickOutside(popoverRef, reset);
const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
function announce(options) {
if (!debouncedSpeak) {
return;
}
if (!!options.length) {
if (filterValue) {
debouncedSpeak((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: 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.', options.length), options.length), 'assertive');
} else {
debouncedSpeak((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results. */
(0,external_wp_i18n_namespaceObject._n)('Initial %d result loaded. Type to filter all available results. Use up and down arrow keys to navigate.', 'Initial %d results loaded. Type to filter all available results. Use up and down arrow keys to navigate.', options.length), options.length), 'assertive');
}
} else {
debouncedSpeak((0,external_wp_i18n_namespaceObject.__)('No results.'), 'assertive');
}
}
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
onChangeOptions(items);
announce(items);
// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.
// See https://github.com/WordPress/gutenberg/pull/41820
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [items]);
if (items.length === 0) {
return null;
}
const ListBox = ({
Component = 'div'
}) => (0,external_React_.createElement)(Component, {
id: listBoxId,
role: "listbox",
className: "components-autocomplete__results"
}, items.map((option, index) => (0,external_React_.createElement)(build_module_button, {
key: option.key,
id: `components-autocomplete-item-${instanceId}-${option.key}`,
role: "option",
"aria-selected": index === selectedIndex,
disabled: option.isDisabled,
className: classnames_default()('components-autocomplete__result', className, {
'is-selected': index === selectedIndex
}),
onClick: () => onSelect(option)
}, option.label)));
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(popover, {
focusOnMount: false,
onClose: onReset,
placement: "top-start",
className: "components-autocomplete__popover",
anchor: popoverAnchor,
ref: popoverRefs
}, (0,external_React_.createElement)(ListBox, null)), contentRef.current && needsA11yCompat && (0,external_ReactDOM_namespaceObject.createPortal)((0,external_React_.createElement)(ListBox, {
Component: visually_hidden_component
}), contentRef.current.ownerDocument.body));
}
return AutocompleterUI;
}
function useOnClickOutside(ref, handler) {
(0,external_wp_element_namespaceObject.useEffect)(() => {
const listener = event => {
// Do nothing if clicking ref's element or descendent elements, or if the ref is not referencing an element
if (!ref.current || ref.current.contains(event.target)) {
return;
}
handler(event);
};
document.addEventListener('mousedown', listener);
document.addEventListener('touchstart', listener);
return () => {
document.removeEventListener('mousedown', listener);
document.removeEventListener('touchstart', listener);
};
// Disable reason: `ref` is a ref object and should not be included in a
// hook's dependency list.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [handler]);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/autocomplete/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const getNodeText = node => {
if (node === null) {
return '';
}
switch (typeof node) {
case 'string':
case 'number':
return node.toString();
break;
case 'boolean':
return '';
break;
case 'object':
{
if (node instanceof Array) {
return node.map(getNodeText).join('');
}
if ('props' in node) {
return getNodeText(node.props.children);
}
break;
}
default:
return '';
}
return '';
};
const EMPTY_FILTERED_OPTIONS = [];
function useAutocomplete({
record,
onChange,
onReplace,
completers,
contentRef
}) {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(useAutocomplete);
const [selectedIndex, setSelectedIndex] = (0,external_wp_element_namespaceObject.useState)(0);
const [filteredOptions, setFilteredOptions] = (0,external_wp_element_namespaceObject.useState)(EMPTY_FILTERED_OPTIONS);
const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
const [autocompleter, setAutocompleter] = (0,external_wp_element_namespaceObject.useState)(null);
const [AutocompleterUI, setAutocompleterUI] = (0,external_wp_element_namespaceObject.useState)(null);
const backspacing = (0,external_wp_element_namespaceObject.useRef)(false);
function insertCompletion(replacement) {
if (autocompleter === null) {
return;
}
const end = record.start;
const start = end - autocompleter.triggerPrefix.length - filterValue.length;
const toInsert = (0,external_wp_richText_namespaceObject.create)({
html: (0,external_wp_element_namespaceObject.renderToString)(replacement)
});
onChange((0,external_wp_richText_namespaceObject.insert)(record, toInsert, start, end));
}
function select(option) {
const {
getOptionCompletion
} = autocompleter || {};
if (option.isDisabled) {
return;
}
if (getOptionCompletion) {
const completion = getOptionCompletion(option.value, filterValue);
const isCompletionObject = obj => {
return obj !== null && typeof obj === 'object' && 'action' in obj && obj.action !== undefined && 'value' in obj && obj.value !== undefined;
};
const completionObject = isCompletionObject(completion) ? completion : {
action: 'insert-at-caret',
value: completion
};
if ('replace' === completionObject.action) {
onReplace([completionObject.value]);
// When replacing, the component will unmount, so don't reset
// state (below) on an unmounted component.
return;
} else if ('insert-at-caret' === completionObject.action) {
insertCompletion(completionObject.value);
}
}
// Reset autocomplete state after insertion rather than before
// so insertion events don't cause the completion menu to redisplay.
reset();
}
function reset() {
setSelectedIndex(0);
setFilteredOptions(EMPTY_FILTERED_OPTIONS);
setFilterValue('');
setAutocompleter(null);
setAutocompleterUI(null);
}
/**
* Load options for an autocompleter.
*
* @param {Array} options
*/
function onChangeOptions(options) {
setSelectedIndex(options.length === filteredOptions.length ? selectedIndex : 0);
setFilteredOptions(options);
}
function handleKeyDown(event) {
backspacing.current = event.key === 'Backspace';
if (!autocompleter) {
return;
}
if (filteredOptions.length === 0) {
return;
}
if (event.defaultPrevented ||
// Ignore keydowns from IMEs
event.isComposing ||
// Workaround for Mac Safari where the final Enter/Backspace of an IME composition
// is `isComposing=false`, even though it's technically still part of the composition.
// These can only be detected by keyCode.
event.keyCode === 229) {
return;
}
switch (event.key) {
case 'ArrowUp':
{
const newIndex = (selectedIndex === 0 ? filteredOptions.length : selectedIndex) - 1;
setSelectedIndex(newIndex);
// See the related PR as to why this is necessary: https://github.com/WordPress/gutenberg/pull/54902.
if ((0,external_wp_keycodes_namespaceObject.isAppleOS)()) {
(0,external_wp_a11y_namespaceObject.speak)(getNodeText(filteredOptions[newIndex].label), 'assertive');
}
break;
}
case 'ArrowDown':
{
const newIndex = (selectedIndex + 1) % filteredOptions.length;
setSelectedIndex(newIndex);
if ((0,external_wp_keycodes_namespaceObject.isAppleOS)()) {
(0,external_wp_a11y_namespaceObject.speak)(getNodeText(filteredOptions[newIndex].label), 'assertive');
}
break;
}
case 'Escape':
setAutocompleter(null);
setAutocompleterUI(null);
event.preventDefault();
break;
case 'Enter':
select(filteredOptions[selectedIndex]);
break;
case 'ArrowLeft':
case 'ArrowRight':
reset();
return;
default:
return;
}
// Any handled key should prevent original behavior. This relies on
// the early return in the default case.
event.preventDefault();
}
// textContent is a primitive (string), memoizing is not strictly necessary
// but this is a preemptive performance improvement, since the autocompleter
// is a potential bottleneck for the editor type metric.
const textContent = (0,external_wp_element_namespaceObject.useMemo)(() => {
if ((0,external_wp_richText_namespaceObject.isCollapsed)(record)) {
return (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(record, 0));
}
return '';
}, [record]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!textContent) {
if (autocompleter) reset();
return;
}
// Find the completer with the highest triggerPrefix index in the
// textContent.
const completer = completers.reduce((lastTrigger, currentCompleter) => {
const triggerIndex = textContent.lastIndexOf(currentCompleter.triggerPrefix);
const lastTriggerIndex = lastTrigger !== null ? textContent.lastIndexOf(lastTrigger.triggerPrefix) : -1;
return triggerIndex > lastTriggerIndex ? currentCompleter : lastTrigger;
}, null);
if (!completer) {
if (autocompleter) reset();
return;
}
const {
allowContext,
triggerPrefix
} = completer;
const triggerIndex = textContent.lastIndexOf(triggerPrefix);
const textWithoutTrigger = textContent.slice(triggerIndex + triggerPrefix.length);
const tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit.
// This is a final barrier to prevent the effect from completing with
// an extremely long string, which causes the editor to slow-down
// significantly. This could happen, for example, if `matchingWhileBackspacing`
// is true and one of the "words" end up being too long. If that's the case,
// it will be caught by this guard.
if (tooDistantFromTrigger) return;
const mismatch = filteredOptions.length === 0;
const wordsFromTrigger = textWithoutTrigger.split(/\s/);
// We need to allow the effect to run when not backspacing and if there
// was a mismatch. i.e when typing a trigger + the match string or when
// clicking in an existing trigger word on the page. We do that if we
// detect that we have one word from trigger in the current textual context.
//
// Ex.: "Some text @a" <-- "@a" will be detected as the trigger word and
// allow the effect to run. It will run until there's a mismatch.
const hasOneTriggerWord = wordsFromTrigger.length === 1;
// This is used to allow the effect to run when backspacing and if
// "touching" a word that "belongs" to a trigger. We consider a "trigger
// word" any word up to the limit of 3 from the trigger character.
// Anything beyond that is ignored if there's a mismatch. This allows
// us to "escape" a mismatch when backspacing, but still imposing some
// sane limits.
//
// Ex: "Some text @marcelo sekkkk" <--- "kkkk" caused a mismatch, but
// if the user presses backspace here, it will show the completion popup again.
const matchingWhileBackspacing = backspacing.current && wordsFromTrigger.length <= 3;
if (mismatch && !(matchingWhileBackspacing || hasOneTriggerWord)) {
if (autocompleter) reset();
return;
}
const textAfterSelection = (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(record, undefined, (0,external_wp_richText_namespaceObject.getTextContent)(record).length));
if (allowContext && !allowContext(textContent.slice(0, triggerIndex), textAfterSelection)) {
if (autocompleter) reset();
return;
}
if (/^\s/.test(textWithoutTrigger) || /\s\s+$/.test(textWithoutTrigger)) {
if (autocompleter) reset();
return;
}
if (!/[\u0000-\uFFFF]*$/.test(textWithoutTrigger)) {
if (autocompleter) reset();
return;
}
const safeTrigger = escapeRegExp(completer.triggerPrefix);
const text = remove_accents_default()(textContent);
const match = text.slice(text.lastIndexOf(completer.triggerPrefix)).match(new RegExp(`${safeTrigger}([\u0000-\uFFFF]*)$`));
const query = match && match[1];
setAutocompleter(completer);
setAutocompleterUI(() => completer !== autocompleter ? getAutoCompleterUI(completer) : AutocompleterUI);
setFilterValue(query === null ? '' : query);
// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.
// See https://github.com/WordPress/gutenberg/pull/41820
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [textContent]);
const {
key: selectedKey = ''
} = filteredOptions[selectedIndex] || {};
const {
className
} = autocompleter || {};
const isExpanded = !!autocompleter && filteredOptions.length > 0;
const listBoxId = isExpanded ? `components-autocomplete-listbox-${instanceId}` : undefined;
const activeId = isExpanded ? `components-autocomplete-item-${instanceId}-${selectedKey}` : null;
const hasSelection = record.start !== undefined;
return {
listBoxId,
activeId,
onKeyDown: handleKeyDown,
popover: hasSelection && AutocompleterUI && (0,external_React_.createElement)(AutocompleterUI, {
className: className,
filterValue: filterValue,
instanceId: instanceId,
listBoxId: listBoxId,
selectedIndex: selectedIndex,
onChangeOptions: onChangeOptions,
onSelect: select,
value: record,
contentRef: contentRef,
reset: reset
})
};
}
function useLastDifferentValue(value) {
const history = (0,external_wp_element_namespaceObject.useRef)(new Set());
history.current.add(value);
// Keep the history size to 2.
if (history.current.size > 2) {
history.current.delete(Array.from(history.current)[0]);
}
return Array.from(history.current)[0];
}
function useAutocompleteProps(options) {
const ref = (0,external_wp_element_namespaceObject.useRef)(null);
const onKeyDownRef = (0,external_wp_element_namespaceObject.useRef)();
const {
record
} = options;
const previousRecord = useLastDifferentValue(record);
const {
popover,
listBoxId,
activeId,
onKeyDown
} = useAutocomplete({
...options,
contentRef: ref
});
onKeyDownRef.current = onKeyDown;
const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
function _onKeyDown(event) {
onKeyDownRef.current?.(event);
}
element.addEventListener('keydown', _onKeyDown);
return () => {
element.removeEventListener('keydown', _onKeyDown);
};
}, [])]);
// We only want to show the popover if the user has typed something.
const didUserInput = record.text !== previousRecord?.text;
if (!didUserInput) {
return {
ref: mergedRefs
};
}
return {
ref: mergedRefs,
children: popover,
'aria-autocomplete': listBoxId ? 'list' : undefined,
'aria-owns': listBoxId,
'aria-activedescendant': activeId
};
}
function Autocomplete({
children,
isSelected,
...options
}) {
const {
popover,
...props
} = useAutocomplete(options);
return (0,external_React_.createElement)(external_React_.Fragment, null, children(props), isSelected && popover);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/base-control/hooks.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Generate props for the `BaseControl` and the inner control itself.
*
* Namely, it takes care of generating a unique `id`, properly associating it with the `label` and `help` elements.
*
* @param props
*/
function useBaseControlProps(props) {
const {
help,
id: preferredId,
...restProps
} = props;
const uniqueId = (0,external_wp_compose_namespaceObject.useInstanceId)(base_control, 'wp-components-base-control', preferredId);
// ARIA descriptions can only contain plain text, so fall back to aria-details if not.
const helpPropName = typeof help === 'string' ? 'aria-describedby' : 'aria-details';
return {
baseControlProps: {
id: uniqueId,
help,
...restProps
},
controlProps: {
id: uniqueId,
...(!!help ? {
[helpPropName]: `${uniqueId}__help`
} : {})
}
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js
/**
* WordPress dependencies
*/
const link_link = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"
}));
/* harmony default export */ const library_link = (link_link);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link-off.js
/**
* WordPress dependencies
*/
const linkOff = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"
}));
/* harmony default export */ const link_off = (linkOff);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/styles.js
function border_box_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const borderBoxControl = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
const linkedBorderControl = () => /*#__PURE__*/emotion_react_browser_esm_css("flex:1;", rtl({
marginRight: '24px'
})(), ";" + ( true ? "" : 0), true ? "" : 0);
const wrapper = true ? {
name: "bjn8wh",
styles: "position:relative"
} : 0;
const borderBoxControlLinkedButton = size => {
return /*#__PURE__*/emotion_react_browser_esm_css("position:absolute;top:", size === '__unstable-large' ? '8px' : '3px', ";", rtl({
right: 0
})(), " line-height:0;" + ( true ? "" : 0), true ? "" : 0);
};
const borderBoxStyleWithFallback = border => {
const {
color = COLORS.gray[200],
style = 'solid',
width = config_values.borderWidth
} = border || {};
const clampedWidth = width !== config_values.borderWidth ? `clamp(1px, ${width}, 10px)` : width;
const hasVisibleBorder = !!width && width !== '0' || !!color;
const borderStyle = hasVisibleBorder ? style || 'solid' : style;
return `${color} ${borderStyle} ${clampedWidth}`;
};
const borderBoxControlVisualizer = (borders, size) => {
return /*#__PURE__*/emotion_react_browser_esm_css("position:absolute;top:", size === '__unstable-large' ? '20px' : '15px', ";right:", size === '__unstable-large' ? '39px' : '29px', ";bottom:", size === '__unstable-large' ? '20px' : '15px', ";left:", size === '__unstable-large' ? '39px' : '29px', ";border-top:", borderBoxStyleWithFallback(borders?.top), ";border-bottom:", borderBoxStyleWithFallback(borders?.bottom), ";", rtl({
borderLeft: borderBoxStyleWithFallback(borders?.left)
})(), " ", rtl({
borderRight: borderBoxStyleWithFallback(borders?.right)
})(), ";" + ( true ? "" : 0), true ? "" : 0);
};
const borderBoxControlSplitControls = size => /*#__PURE__*/emotion_react_browser_esm_css("position:relative;flex:1;width:", size === '__unstable-large' ? undefined : '80%', ";" + ( true ? "" : 0), true ? "" : 0);
const centeredBorderControl = true ? {
name: "1nwbfnf",
styles: "grid-column:span 2;margin:0 auto"
} : 0;
const rightBorderControl = () => /*#__PURE__*/emotion_react_browser_esm_css(rtl({
marginLeft: 'auto'
})(), ";" + ( true ? "" : 0), true ? "" : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-linked-button/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useBorderBoxControlLinkedButton(props) {
const {
className,
size = 'default',
...otherProps
} = useContextSystem(props, 'BorderBoxControlLinkedButton');
// Generate class names.
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(borderBoxControlLinkedButton(size), className);
}, [className, cx, size]);
return {
...otherProps,
className: classes
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-linked-button/component.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const BorderBoxControlLinkedButton = (props, forwardedRef) => {
const {
className,
isLinked,
...buttonProps
} = useBorderBoxControlLinkedButton(props);
const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink sides') : (0,external_wp_i18n_namespaceObject.__)('Link sides');
return (0,external_React_.createElement)(tooltip, {
text: label
}, (0,external_React_.createElement)(component, {
className: className
}, (0,external_React_.createElement)(build_module_button, {
...buttonProps,
size: "small",
icon: isLinked ? library_link : link_off,
iconSize: 24,
"aria-label": label,
ref: forwardedRef
})));
};
const ConnectedBorderBoxControlLinkedButton = contextConnect(BorderBoxControlLinkedButton, 'BorderBoxControlLinkedButton');
/* harmony default export */ const border_box_control_linked_button_component = (ConnectedBorderBoxControlLinkedButton);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-visualizer/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useBorderBoxControlVisualizer(props) {
const {
className,
value,
size = 'default',
...otherProps
} = useContextSystem(props, 'BorderBoxControlVisualizer');
// Generate class names.
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(borderBoxControlVisualizer(value, size), className);
}, [cx, className, value, size]);
return {
...otherProps,
className: classes,
value
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-visualizer/component.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const BorderBoxControlVisualizer = (props, forwardedRef) => {
const {
value,
...otherProps
} = useBorderBoxControlVisualizer(props);
return (0,external_React_.createElement)(component, {
...otherProps,
ref: forwardedRef
});
};
const ConnectedBorderBoxControlVisualizer = contextConnect(BorderBoxControlVisualizer, 'BorderBoxControlVisualizer');
/* harmony default export */ const border_box_control_visualizer_component = (ConnectedBorderBoxControlVisualizer);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
/**
* WordPress dependencies
*/
const closeSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.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 */ const close_small = (closeSmall);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/line-solid.js
/**
* WordPress dependencies
*/
const lineSolid = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M5 11.25h14v1.5H5z"
}));
/* harmony default export */ const line_solid = (lineSolid);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/line-dashed.js
/**
* WordPress dependencies
*/
const lineDashed = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const line_dashed = (lineDashed);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/line-dotted.js
/**
* WordPress dependencies
*/
const lineDotted = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const line_dotted = (lineDotted);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/DeprecatedLayoutGroupContext.mjs
/**
* Note: Still used by components generated by old versions of Framer
*
* @deprecated
*/
const DeprecatedLayoutGroupContext = (0,external_React_.createContext)(null);
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/group.mjs
const notify = (node) => !node.isLayoutDirty && node.willUpdate(false);
function nodeGroup() {
const nodes = new Set();
const subscriptions = new WeakMap();
const dirtyAll = () => nodes.forEach(notify);
return {
add: (node) => {
nodes.add(node);
subscriptions.set(node, node.addEventListener("willUpdate", dirtyAll));
},
remove: (node) => {
nodes.delete(node);
const unsubscribe = subscriptions.get(node);
if (unsubscribe) {
unsubscribe();
subscriptions.delete(node);
}
dirtyAll();
},
dirty: dirtyAll,
};
}
;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/LayoutGroup/index.mjs
const shouldInheritGroup = (inherit) => inherit === true;
const shouldInheritId = (inherit) => shouldInheritGroup(inherit === true) || inherit === "id";
const LayoutGroup = ({ children, id, inherit = true }) => {
const layoutGroupContext = (0,external_React_.useContext)(LayoutGroupContext);
const deprecatedLayoutGroupContext = (0,external_React_.useContext)(DeprecatedLayoutGroupContext);
const [forceRender, key] = use_force_update_useForceUpdate();
const context = (0,external_React_.useRef)(null);
const upstreamId = layoutGroupContext.id || deprecatedLayoutGroupContext;
if (context.current === null) {
if (shouldInheritId(inherit) && upstreamId) {
id = id ? upstreamId + "-" + id : upstreamId;
}
context.current = {
id,
group: shouldInheritGroup(inherit)
? layoutGroupContext.group || nodeGroup()
: nodeGroup(),
};
}
const memoizedContext = (0,external_React_.useMemo)(() => ({ ...context.current, forceRender }), [key]);
return (external_React_.createElement(LayoutGroupContext.Provider, { value: memoizedContext }, children));
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/styles.js
function toggle_group_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const toggleGroupControl = ({
isBlock,
isDeselectable,
size
}) => /*#__PURE__*/emotion_react_browser_esm_css("background:", COLORS.ui.background, ";border:1px solid transparent;border-radius:", config_values.controlBorderRadius, ";display:inline-flex;min-width:0;position:relative;", toggleGroupControlSize(size), " ", !isDeselectable && enclosingBorders(isBlock), ";" + ( true ? "" : 0), true ? "" : 0);
const enclosingBorders = isBlock => {
const enclosingBorder = /*#__PURE__*/emotion_react_browser_esm_css("border-color:", COLORS.ui.border, ";" + ( true ? "" : 0), true ? "" : 0);
return /*#__PURE__*/emotion_react_browser_esm_css(isBlock && enclosingBorder, " &:hover{border-color:", COLORS.ui.borderHover, ";}&:focus-within{border-color:", COLORS.ui.borderFocus, ";box-shadow:", config_values.controlBoxShadowFocus, ";z-index:1;outline:2px solid transparent;outline-offset:-2px;}" + ( true ? "" : 0), true ? "" : 0);
};
var styles_ref = true ? {
name: "1aqh2c7",
styles: "min-height:40px;padding:3px"
} : 0;
var styles_ref2 = true ? {
name: "1ndywgm",
styles: "min-height:36px;padding:2px"
} : 0;
const toggleGroupControlSize = size => {
const styles = {
default: styles_ref2,
'__unstable-large': styles_ref
};
return styles[size];
};
const toggle_group_control_styles_block = true ? {
name: "7whenc",
styles: "display:flex;width:100%"
} : 0;
const VisualLabelWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "eakva830"
} : 0)( true ? {
name: "zjik7",
styles: "display:flex"
} : 0);
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/radio/radio-store.js
"use client";
// src/radio/radio-store.ts
function createRadioStore(_a = {}) {
var props = _4R3V3JGP_objRest(_a, []);
var _a2;
const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState();
const composite = createCompositeStore(_chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, props), {
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
}));
const initialState = _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, composite.getState()), {
value: defaultValue(
props.value,
syncState == null ? void 0 : syncState.value,
props.defaultValue,
null
)
});
const radio = createStore(initialState, composite, props.store);
return _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues(_chunks_4R3V3JGP_spreadValues({}, composite), radio), {
setValue: (value) => radio.setState("value", value)
});
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/LEIRFLRL.js
"use client";
// src/radio/radio-store.ts
function useRadioStoreProps(store, update, props) {
store = useCompositeStoreProps(store, update, props);
useStoreProps(store, props, "value", "setValue");
return store;
}
function useRadioStore(props = {}) {
const [store, update] = EKQEJRUF_useStore(createRadioStore, props);
return useRadioStoreProps(store, update, props);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/XEV62JUQ.js
"use client";
// src/radio/radio-context.tsx
var XEV62JUQ_ctx = createStoreContext(
[CompositeContextProvider],
[CompositeScopedContextProvider]
);
var useRadioContext = XEV62JUQ_ctx.useContext;
var useRadioScopedContext = XEV62JUQ_ctx.useScopedContext;
var useRadioProviderContext = XEV62JUQ_ctx.useProviderContext;
var RadioContextProvider = XEV62JUQ_ctx.ContextProvider;
var RadioScopedContextProvider = XEV62JUQ_ctx.ScopedContextProvider;
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/radio/radio-group.js
"use client";
// src/radio/radio-group.tsx
var useRadioGroup = createHook(
(_a) => {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
const context = useRadioProviderContext();
store = store || context;
invariant(
store,
false && 0
);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(RadioScopedContextProvider, { value: store, children: element }),
[store]
);
props = _4R3V3JGP_spreadValues({
role: "radiogroup"
}, props);
props = useComposite(_4R3V3JGP_spreadValues({ store }, props));
return props;
}
);
var RadioGroup = createComponent((props) => {
const htmlProps = useRadioGroup(props);
return _3ORBWXWF_createElement("div", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/context.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ToggleGroupControlContext = (0,external_wp_element_namespaceObject.createContext)({});
const useToggleGroupControlContext = () => (0,external_wp_element_namespaceObject.useContext)(ToggleGroupControlContext);
/* harmony default export */ const toggle_group_control_context = (ToggleGroupControlContext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Used to determine, via an internal heuristics, whether an `undefined` value
* received for the `value` prop should be interpreted as the component being
* used in uncontrolled mode, or as an "empty" value for controlled mode.
*
* @param valueProp The received `value`
*/
function useComputeControlledOrUncontrolledValue(valueProp) {
const isInitialRender = (0,external_wp_element_namespaceObject.useRef)(true);
const prevValueProp = (0,external_wp_compose_namespaceObject.usePrevious)(valueProp);
const prevIsControlled = (0,external_wp_element_namespaceObject.useRef)(false);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (isInitialRender.current) {
isInitialRender.current = false;
}
}, []);
// Assume the component is being used in controlled mode on the first re-render
// that has a different `valueProp` from the previous render.
const isControlled = prevIsControlled.current || !isInitialRender.current && prevValueProp !== valueProp;
(0,external_wp_element_namespaceObject.useEffect)(() => {
prevIsControlled.current = isControlled;
}, [isControlled]);
if (isControlled) {
// When in controlled mode, use `''` instead of `undefined`
return {
value: valueProp !== null && valueProp !== void 0 ? valueProp : '',
defaultValue: undefined
};
}
// When in uncontrolled mode, the `value` should be intended as the initial value
return {
value: undefined,
defaultValue: valueProp
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/as-radio-group.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedToggleGroupControlAsRadioGroup({
children,
isAdaptiveWidth,
label,
onChange: onChangeProp,
size,
value: valueProp,
id: idProp,
...otherProps
}, forwardedRef) {
const generatedId = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleGroupControlAsRadioGroup, 'toggle-group-control-as-radio-group');
const baseId = idProp || generatedId;
// Use a heuristic to understand if the component is being used in controlled
// or uncontrolled mode, and consequently:
// - when controlled, convert `undefined` values to `''` (ie. "no value")
// - use the `value` prop as the `defaultValue` when uncontrolled
const {
value,
defaultValue
} = useComputeControlledOrUncontrolledValue(valueProp);
// `useRadioStore`'s `setValue` prop can be called with `null`, while
// the component's `onChange` prop only expects `undefined`
const wrappedOnChangeProp = onChangeProp ? v => {
onChangeProp(v !== null && v !== void 0 ? v : undefined);
} : undefined;
const radio = useRadioStore({
defaultValue,
value,
setValue: wrappedOnChangeProp
});
const selectedValue = radio.useState('value');
const setValue = radio.setValue;
const groupContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
baseId,
isBlock: !isAdaptiveWidth,
size,
value: selectedValue,
setValue
}), [baseId, isAdaptiveWidth, size, selectedValue, setValue]);
return (0,external_React_.createElement)(toggle_group_control_context.Provider, {
value: groupContextValue
}, (0,external_React_.createElement)(RadioGroup, {
store: radio,
"aria-label": label,
render: (0,external_React_.createElement)(component, null),
...otherProps,
id: baseId,
ref: forwardedRef
}, children));
}
const ToggleGroupControlAsRadioGroup = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleGroupControlAsRadioGroup);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-value.js
/**
* WordPress dependencies
*/
/**
* Simplified and improved implementation of useControlledState.
*
* @param props
* @param props.defaultValue
* @param props.value
* @param props.onChange
* @return The controlled value and the value setter.
*/
function useControlledValue({
defaultValue,
onChange,
value: valueProp
}) {
const hasValue = typeof valueProp !== 'undefined';
const initialValue = hasValue ? valueProp : defaultValue;
const [state, setState] = (0,external_wp_element_namespaceObject.useState)(initialValue);
const value = hasValue ? valueProp : state;
let setValue;
if (hasValue && typeof onChange === 'function') {
setValue = onChange;
} else if (!hasValue && typeof onChange === 'function') {
setValue = nextValue => {
onChange(nextValue);
setState(nextValue);
};
} else {
setValue = setState;
}
return [value, setValue];
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/as-button-group.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedToggleGroupControlAsButtonGroup({
children,
isAdaptiveWidth,
label,
onChange,
size,
value: valueProp,
id: idProp,
...otherProps
}, forwardedRef) {
const generatedId = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleGroupControlAsButtonGroup, 'toggle-group-control-as-button-group');
const baseId = idProp || generatedId;
// Use a heuristic to understand if the component is being used in controlled
// or uncontrolled mode, and consequently:
// - when controlled, convert `undefined` values to `''` (ie. "no value")
// - use the `value` prop as the `defaultValue` when uncontrolled
const {
value,
defaultValue
} = useComputeControlledOrUncontrolledValue(valueProp);
const [selectedValue, setSelectedValue] = useControlledValue({
defaultValue,
value,
onChange
});
const groupContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
baseId,
value: selectedValue,
setValue: setSelectedValue,
isBlock: !isAdaptiveWidth,
isDeselectable: true,
size
}), [baseId, selectedValue, setSelectedValue, isAdaptiveWidth, size]);
return (0,external_React_.createElement)(toggle_group_control_context.Provider, {
value: groupContextValue
}, (0,external_React_.createElement)(component, {
"aria-label": label,
...otherProps,
ref: forwardedRef,
role: "group"
}, children));
}
const ToggleGroupControlAsButtonGroup = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleGroupControlAsButtonGroup);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/component.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedToggleGroupControl(props, forwardedRef) {
const {
__nextHasNoMarginBottom = false,
__next40pxDefaultSize = false,
className,
isAdaptiveWidth = false,
isBlock = false,
isDeselectable = false,
label,
hideLabelFromVision = false,
help,
onChange,
size = 'default',
value,
children,
...otherProps
} = useContextSystem(props, 'ToggleGroupControl');
const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleGroupControl, 'toggle-group-control');
const normalizedSize = __next40pxDefaultSize && size === 'default' ? '__unstable-large' : size;
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(toggleGroupControl({
isBlock,
isDeselectable,
size: normalizedSize
}), isBlock && toggle_group_control_styles_block, className), [className, cx, isBlock, isDeselectable, normalizedSize]);
const MainControl = isDeselectable ? ToggleGroupControlAsButtonGroup : ToggleGroupControlAsRadioGroup;
return (0,external_React_.createElement)(base_control, {
help: help,
__nextHasNoMarginBottom: __nextHasNoMarginBottom
}, !hideLabelFromVision && (0,external_React_.createElement)(VisualLabelWrapper, null, (0,external_React_.createElement)(base_control.VisualLabel, null, label)), (0,external_React_.createElement)(MainControl, {
...otherProps,
className: classes,
isAdaptiveWidth: isAdaptiveWidth,
label: label,
onChange: onChange,
ref: forwardedRef,
size: normalizedSize,
value: value
}, (0,external_React_.createElement)(LayoutGroup, {
id: baseId
}, children)));
}
/**
* `ToggleGroupControl` is a form component that lets users choose options
* represented in horizontal segments. To render options for this control use
* `ToggleGroupControlOption` component.
*
* This component is intended for selecting a single persistent value from a set of options,
* similar to a how a radio button group would work. If you simply want a toggle to switch between views,
* use a `TabPanel` instead.
*
* Only use this control when you know for sure the labels of items inside won't
* wrap. For items with longer labels, you can consider a `SelectControl` or a
* `CustomSelectControl` component instead.
*
* ```jsx
* import {
* __experimentalToggleGroupControl as ToggleGroupControl,
* __experimentalToggleGroupControlOption as ToggleGroupControlOption,
* } from '@wordpress/components';
*
* function Example() {
* return (
* <ToggleGroupControl label="my label" value="vertical" isBlock>
* <ToggleGroupControlOption value="horizontal" label="Horizontal" />
* <ToggleGroupControlOption value="vertical" label="Vertical" />
* </ToggleGroupControl>
* );
* }
* ```
*/
const ToggleGroupControl = contextConnect(UnconnectedToggleGroupControl, 'ToggleGroupControl');
/* harmony default export */ const toggle_group_control_component = (ToggleGroupControl);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/JL6IRDFK.js
"use client";
// src/radio/radio.ts
function getIsChecked(value, storeValue) {
if (storeValue === void 0)
return;
if (value != null && storeValue != null) {
return storeValue === value;
}
return !!storeValue;
}
function isNativeRadio(tagName, type) {
return tagName === "input" && (!type || type === "radio");
}
var useRadio = createHook(
(_a) => {
var _b = _a, { store, name, value, checked } = _b, props = __objRest(_b, ["store", "name", "value", "checked"]);
const context = useRadioContext();
store = store || context;
const id = useId(props.id);
const ref = (0,external_React_.useRef)(null);
const isChecked = useStoreState(
store,
(state) => checked != null ? checked : getIsChecked(value, state == null ? void 0 : state.value)
);
(0,external_React_.useEffect)(() => {
if (!id)
return;
if (!isChecked)
return;
const isActiveItem = (store == null ? void 0 : store.getState().activeId) === id;
if (isActiveItem)
return;
store == null ? void 0 : store.setActiveId(id);
}, [store, isChecked, id]);
const onChangeProp = props.onChange;
const tagName = useTagName(ref, props.as || "input");
const nativeRadio = isNativeRadio(tagName, props.type);
const disabled = disabledFromProps(props);
const [propertyUpdated, schedulePropertyUpdate] = useForceUpdate();
(0,external_React_.useEffect)(() => {
const element = ref.current;
if (!element)
return;
if (nativeRadio)
return;
if (isChecked !== void 0) {
element.checked = isChecked;
}
if (name !== void 0) {
element.name = name;
}
if (value !== void 0) {
element.value = `${value}`;
}
}, [propertyUpdated, nativeRadio, isChecked, name, value]);
const onChange = useEvent((event) => {
if (disabled) {
event.preventDefault();
event.stopPropagation();
return;
}
if (!nativeRadio) {
event.currentTarget.checked = true;
schedulePropertyUpdate();
}
onChangeProp == null ? void 0 : onChangeProp(event);
if (event.defaultPrevented)
return;
store == null ? void 0 : store.setValue(value);
});
const onClickProp = props.onClick;
const onClick = useEvent((event) => {
onClickProp == null ? void 0 : onClickProp(event);
if (event.defaultPrevented)
return;
if (nativeRadio)
return;
onChange(event);
});
const onFocusProp = props.onFocus;
const onFocus = useEvent((event) => {
onFocusProp == null ? void 0 : onFocusProp(event);
if (event.defaultPrevented)
return;
if (!nativeRadio)
return;
if (!store)
return;
const { moves, activeId } = store.getState();
if (!moves)
return;
if (id && activeId !== id)
return;
onChange(event);
});
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
id,
role: !nativeRadio ? "radio" : void 0,
type: nativeRadio ? "radio" : void 0,
"aria-checked": isChecked
}, props), {
ref: useMergeRefs(ref, props.ref),
onChange,
onClick,
onFocus
});
props = useCompositeItem(_4R3V3JGP_spreadValues({ store, clickOnEnter: !nativeRadio }, props));
return _4R3V3JGP_spreadValues({
name: nativeRadio ? name : void 0,
value: nativeRadio ? value : void 0,
checked: isChecked
}, props);
}
);
var Radio = createMemoComponent((props) => {
const htmlProps = useRadio(props);
return _3ORBWXWF_createElement("input", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/styles.js
function toggle_group_control_option_base_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const LabelView = emotion_styled_base_browser_esm("div", true ? {
target: "et6ln9s1"
} : 0)( true ? {
name: "sln1fl",
styles: "display:inline-flex;max-width:100%;min-width:0;position:relative"
} : 0);
const labelBlock = true ? {
name: "82a6rk",
styles: "flex:1"
} : 0;
const buttonView = ({
isDeselectable,
isIcon,
isPressed,
size
}) => /*#__PURE__*/emotion_react_browser_esm_css("align-items:center;appearance:none;background:transparent;border:none;border-radius:", config_values.controlBorderRadius, ";color:", COLORS.gray[700], ";fill:currentColor;cursor:pointer;display:flex;font-family:inherit;height:100%;justify-content:center;line-height:100%;outline:none;padding:0 12px;position:relative;text-align:center;transition:background ", config_values.transitionDurationFast, " linear,color ", config_values.transitionDurationFast, " linear,font-weight 60ms linear;", reduceMotion('transition'), " user-select:none;width:100%;z-index:2;&::-moz-focus-inner{border:0;}&:active{background:", config_values.toggleGroupControlBackgroundColor, ";}", isDeselectable && deselectable, " ", isIcon && isIconStyles({
size
}), " ", isPressed && pressed, ";" + ( true ? "" : 0), true ? "" : 0);
const pressed = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.white, ";&:active{background:transparent;}" + ( true ? "" : 0), true ? "" : 0);
const deselectable = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.gray[900], ";&:focus{box-shadow:inset 0 0 0 1px ", COLORS.white, ",0 0 0 ", config_values.borderWidthFocus, " ", COLORS.theme.accent, ";outline:2px solid transparent;}" + ( true ? "" : 0), true ? "" : 0);
const ButtonContentView = emotion_styled_base_browser_esm("div", true ? {
target: "et6ln9s0"
} : 0)("display:flex;font-size:", config_values.fontSize, ";line-height:1;" + ( true ? "" : 0));
const isIconStyles = ({
size = 'default'
}) => {
const iconButtonSizes = {
default: '30px',
'__unstable-large': '32px'
};
return /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.gray[900], ";height:", iconButtonSizes[size], ";aspect-ratio:1;padding-left:0;padding-right:0;" + ( true ? "" : 0), true ? "" : 0);
};
const backdropView = /*#__PURE__*/emotion_react_browser_esm_css("background:", COLORS.gray[900], ";border-radius:", config_values.controlBorderRadius, ";position:absolute;inset:0;z-index:1;outline:2px solid transparent;outline-offset:-3px;" + ( true ? "" : 0), true ? "" : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/component.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
ButtonContentView: component_ButtonContentView,
LabelView: component_LabelView
} = toggle_group_control_option_base_styles_namespaceObject;
const REDUCED_MOTION_TRANSITION_CONFIG = {
duration: 0
};
const LAYOUT_ID = 'toggle-group-backdrop-shared-layout-id';
const WithToolTip = ({
showTooltip,
text,
children
}) => {
if (showTooltip && text) {
return (0,external_React_.createElement)(tooltip, {
text: text,
placement: "top"
}, children);
}
return (0,external_React_.createElement)(external_React_.Fragment, null, children);
};
function ToggleGroupControlOptionBase(props, forwardedRef) {
const shouldReduceMotion = useReducedMotion();
const toggleGroupControlContext = useToggleGroupControlContext();
const id = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleGroupControlOptionBase, toggleGroupControlContext.baseId || 'toggle-group-control-option-base');
const buttonProps = useContextSystem({
...props,
id
}, 'ToggleGroupControlOptionBase');
const {
isBlock = false,
isDeselectable = false,
size = 'default'
} = toggleGroupControlContext;
const {
className,
isIcon = false,
value,
children,
showTooltip = false,
onFocus: onFocusProp,
...otherButtonProps
} = buttonProps;
const isPressed = toggleGroupControlContext.value === value;
const cx = useCx();
const labelViewClasses = (0,external_wp_element_namespaceObject.useMemo)(() => cx(isBlock && labelBlock), [cx, isBlock]);
const itemClasses = (0,external_wp_element_namespaceObject.useMemo)(() => cx(buttonView({
isDeselectable,
isIcon,
isPressed,
size
}), className), [cx, isDeselectable, isIcon, isPressed, size, className]);
const backdropClasses = (0,external_wp_element_namespaceObject.useMemo)(() => cx(backdropView), [cx]);
const buttonOnClick = () => {
if (isDeselectable && isPressed) {
toggleGroupControlContext.setValue(undefined);
} else {
toggleGroupControlContext.setValue(value);
}
};
const commonProps = {
...otherButtonProps,
className: itemClasses,
'data-value': value,
ref: forwardedRef
};
return (0,external_React_.createElement)(component_LabelView, {
className: labelViewClasses
}, (0,external_React_.createElement)(WithToolTip, {
showTooltip: showTooltip,
text: otherButtonProps['aria-label']
}, isDeselectable ? (0,external_React_.createElement)("button", {
...commonProps,
onFocus: onFocusProp,
"aria-pressed": isPressed,
type: "button",
onClick: buttonOnClick
}, (0,external_React_.createElement)(component_ButtonContentView, null, children)) : (0,external_React_.createElement)(Radio, {
render: (0,external_React_.createElement)("button", {
type: "button",
...commonProps,
onFocus: event => {
onFocusProp?.(event);
if (event.defaultPrevented) return;
toggleGroupControlContext.setValue(value);
}
}),
value: value
}, (0,external_React_.createElement)(component_ButtonContentView, null, children))), isPressed ? (0,external_React_.createElement)(motion.div, {
className: backdropClasses,
transition: shouldReduceMotion ? REDUCED_MOTION_TRANSITION_CONFIG : undefined,
role: "presentation",
layoutId: LAYOUT_ID
}) : null);
}
/**
* `ToggleGroupControlOptionBase` is a form component and is meant to be used as an internal,
* generic component for any children of `ToggleGroupControl`.
*
* @example
* ```jsx
* import {
* __experimentalToggleGroupControl as ToggleGroupControl,
* __experimentalToggleGroupControlOptionBase as ToggleGroupControlOptionBase,
* } from '@wordpress/components';
*
* function Example() {
* return (
* <ToggleGroupControl label="my label" value="vertical" isBlock>
* <ToggleGroupControlOption value="horizontal" label="Horizontal" />
* <ToggleGroupControlOption value="vertical" label="Vertical" />
* </ToggleGroupControl>
* );
* }
* ```
*/
const ConnectedToggleGroupControlOptionBase = contextConnect(ToggleGroupControlOptionBase, 'ToggleGroupControlOptionBase');
/* harmony default export */ const toggle_group_control_option_base_component = (ConnectedToggleGroupControlOptionBase);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-icon/component.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedToggleGroupControlOptionIcon(props, ref) {
const {
icon,
label,
...restProps
} = props;
return (0,external_React_.createElement)(toggle_group_control_option_base_component, {
...restProps,
isIcon: true,
"aria-label": label,
showTooltip: true,
ref: ref
}, (0,external_React_.createElement)(build_module_icon, {
icon: icon
}));
}
/**
* `ToggleGroupControlOptionIcon` is a form component which is meant to be used as a
* child of `ToggleGroupControl` and displays an icon.
*
* ```jsx
*
* import {
* __experimentalToggleGroupControl as ToggleGroupControl,
* __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,
* from '@wordpress/components';
* import { formatLowercase, formatUppercase } from '@wordpress/icons';
*
* function Example() {
* return (
* <ToggleGroupControl>
* <ToggleGroupControlOptionIcon
* value="uppercase"
* label="Uppercase"
* icon={ formatUppercase }
* />
* <ToggleGroupControlOptionIcon
* value="lowercase"
* label="Lowercase"
* icon={ formatLowercase }
* />
* </ToggleGroupControl>
* );
* }
* ```
*/
const ToggleGroupControlOptionIcon = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleGroupControlOptionIcon);
/* harmony default export */ const toggle_group_control_option_icon_component = (ToggleGroupControlOptionIcon);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control-style-picker/component.js
/**
* WordPress dependencies
*/
/**
* Internal 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'
}];
function UnconnectedBorderControlStylePicker({
onChange,
...restProps
}, forwardedRef) {
return (0,external_React_.createElement)(toggle_group_control_component, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: true,
ref: forwardedRef,
isDeselectable: true,
onChange: value => {
onChange?.(value);
},
...restProps
}, BORDER_STYLES.map(borderStyle => (0,external_React_.createElement)(toggle_group_control_option_icon_component, {
key: borderStyle.value,
value: borderStyle.value,
icon: borderStyle.icon,
label: borderStyle.label
})));
}
const BorderControlStylePicker = contextConnect(UnconnectedBorderControlStylePicker, 'BorderControlStylePicker');
/* harmony default export */ const border_control_style_picker_component = (BorderControlStylePicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-indicator/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedColorIndicator(props, forwardedRef) {
const {
className,
colorValue,
...additionalProps
} = props;
return (0,external_React_.createElement)("span", {
className: classnames_default()('component-color-indicator', className),
style: {
background: colorValue
},
ref: forwardedRef,
...additionalProps
});
}
/**
* ColorIndicator is a React component that renders a specific color in a
* circle. It's often used to summarize a collection of used colors in a child
* component.
*
* ```jsx
* import { ColorIndicator } from '@wordpress/components';
*
* const MyColorIndicator = () => <ColorIndicator colorValue="#0073aa" />;
* ```
*/
const ColorIndicator = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedColorIndicator);
/* harmony default export */ const color_indicator = (ColorIndicator);
;// CONCATENATED MODULE: ./node_modules/colord/plugins/a11y.mjs
var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(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}}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const UnconnectedDropdown = (props, forwardedRef) => {
const {
renderContent,
renderToggle,
className,
contentClassName,
expandOnMobile,
headerTitle,
focusOnMount,
popoverProps,
onClose,
onToggle,
style,
open,
defaultOpen,
// Deprecated props
position,
// From context system
variant
} = useContextSystem(props, 'Dropdown');
if (position !== undefined) {
external_wp_deprecated_default()('`position` prop in wp.components.Dropdown', {
since: '6.2',
alternative: '`popoverProps.placement` prop',
hint: 'Note that the `position` prop will override any values passed through the `popoverProps.placement` prop.'
});
}
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [fallbackPopoverAnchor, setFallbackPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
const containerRef = (0,external_wp_element_namespaceObject.useRef)();
const [isOpen, setIsOpen] = useControlledValue({
defaultValue: defaultOpen,
value: open,
onChange: onToggle
});
/**
* Closes the popover when focus leaves it unless the toggle was pressed or
* focus has moved to a separate dialog. The former is to let the toggle
* handle closing the popover and the latter is to preserve presence in
* case a dialog has opened, allowing focus to return when it's dismissed.
*/
function closeIfFocusOutside() {
if (!containerRef.current) {
return;
}
const {
ownerDocument
} = containerRef.current;
const dialog = ownerDocument?.activeElement?.closest('[role="dialog"]');
if (!containerRef.current.contains(ownerDocument.activeElement) && (!dialog || dialog.contains(containerRef.current))) {
close();
}
}
function close() {
onClose?.();
setIsOpen(false);
}
const args = {
isOpen: !!isOpen,
onToggle: () => setIsOpen(!isOpen),
onClose: close
};
const popoverPropsHaveAnchor = !!popoverProps?.anchor ||
// Note: `anchorRef`, `getAnchorRect` and `anchorRect` are deprecated and
// be removed from `Popover` from WordPress 6.3
!!popoverProps?.anchorRef || !!popoverProps?.getAnchorRect || !!popoverProps?.anchorRect;
return (0,external_React_.createElement)("div", {
className: className,
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([containerRef, forwardedRef, setFallbackPopoverAnchor])
// Some UAs focus the closest focusable parent when the toggle is
// clicked. Making this div focusable ensures such UAs will focus
// it and `closeIfFocusOutside` can tell if the toggle was clicked.
,
tabIndex: -1,
style: style
}, renderToggle(args), isOpen && (0,external_React_.createElement)(popover, {
position: position,
onClose: close,
onFocusOutside: closeIfFocusOutside,
expandOnMobile: expandOnMobile,
headerTitle: headerTitle,
focusOnMount: focusOnMount
// This value is used to ensure that the dropdowns
// align with the editor header by default.
,
offset: 13,
anchor: !popoverPropsHaveAnchor ? fallbackPopoverAnchor : undefined,
variant: variant,
...popoverProps,
className: classnames_default()('components-dropdown__content', popoverProps?.className, contentClassName)
}, renderContent(args)));
};
/**
* Renders a button that opens a floating content modal when clicked.
*
* ```jsx
* import { Button, Dropdown } from '@wordpress/components';
*
* const MyDropdown = () => (
* <Dropdown
* className="my-container-class-name"
* contentClassName="my-dropdown-content-classname"
* popoverProps={ { placement: 'bottom-start' } }
* renderToggle={ ( { isOpen, onToggle } ) => (
* <Button
* variant="primary"
* onClick={ onToggle }
* aria-expanded={ isOpen }
* >
* Toggle Dropdown!
* </Button>
* ) }
* renderContent={ () => <div>This is the content of the dropdown.</div> }
* />
* );
* ```
*/
const Dropdown = contextConnect(UnconnectedDropdown, 'Dropdown');
/* harmony default export */ const dropdown = (Dropdown);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-suffix-wrapper.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedInputControlSuffixWrapper(props, forwardedRef) {
const derivedProps = useContextSystem(props, 'InputControlSuffixWrapper');
return (0,external_React_.createElement)(spacer_component, {
marginBottom: 0,
...derivedProps,
ref: forwardedRef
});
}
/**
* A convenience wrapper for the `suffix` when you want to apply
* standard padding in accordance with the size variant.
*
* ```jsx
* import {
* __experimentalInputControl as InputControl,
* __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
* } from '@wordpress/components';
*
* <InputControl
* suffix={<InputControlSuffixWrapper>%</InputControlSuffixWrapper>}
* />
* ```
*/
const InputControlSuffixWrapper = contextConnect(UnconnectedInputControlSuffixWrapper, 'InputControlSuffixWrapper');
/* harmony default export */ const input_suffix_wrapper = (InputControlSuffixWrapper);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/select-control/styles/select-control-styles.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const select_control_styles_disabledStyles = ({
disabled
}) => {
if (!disabled) return '';
return /*#__PURE__*/emotion_react_browser_esm_css({
color: COLORS.ui.textDisabled
}, true ? "" : 0, true ? "" : 0);
};
const select_control_styles_sizeStyles = ({
__next40pxDefaultSize,
multiple,
selectSize = 'default'
}) => {
if (multiple) {
// When `multiple`, just use the native browser styles
// without setting explicit height.
return;
}
const sizes = {
default: {
height: 40,
minHeight: 40,
paddingTop: 0,
paddingBottom: 0
},
small: {
height: 24,
minHeight: 24,
paddingTop: 0,
paddingBottom: 0
},
compact: {
height: 32,
minHeight: 32,
paddingTop: 0,
paddingBottom: 0
},
'__unstable-large': {
height: 40,
minHeight: 40,
paddingTop: 0,
paddingBottom: 0
}
};
if (!__next40pxDefaultSize) {
sizes.default = sizes.compact;
}
const style = sizes[selectSize] || sizes.default;
return /*#__PURE__*/emotion_react_browser_esm_css(style, true ? "" : 0, true ? "" : 0);
};
const chevronIconSize = 18;
const sizePaddings = ({
__next40pxDefaultSize,
multiple,
selectSize = 'default'
}) => {
const padding = {
default: 16,
small: 8,
compact: 8,
'__unstable-large': 16
};
if (!__next40pxDefaultSize) {
padding.default = padding.compact;
}
const selectedPadding = padding[selectSize] || padding.default;
return rtl({
paddingLeft: selectedPadding,
paddingRight: selectedPadding + chevronIconSize,
...(multiple ? {
paddingTop: selectedPadding,
paddingBottom: selectedPadding
} : {})
});
};
const overflowStyles = ({
multiple
}) => {
return {
overflow: multiple ? 'auto' : 'hidden'
};
};
// TODO: Resolve need to use &&& to increase specificity
// https://github.com/WordPress/gutenberg/issues/18483
const Select = emotion_styled_base_browser_esm("select", true ? {
target: "e1mv6sxx2"
} : 0)("&&&{appearance:none;background:transparent;box-sizing:border-box;border:none;box-shadow:none!important;color:", COLORS.gray[900], ";display:block;font-family:inherit;margin:0;width:100%;max-width:none;cursor:pointer;white-space:nowrap;text-overflow:ellipsis;", select_control_styles_disabledStyles, ";", fontSizeStyles, ";", select_control_styles_sizeStyles, ";", sizePaddings, ";", overflowStyles, ";}" + ( true ? "" : 0));
const DownArrowWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "e1mv6sxx1"
} : 0)("margin-inline-end:", space(-1), ";line-height:0;" + ( true ? "" : 0));
const InputControlSuffixWrapperWithClickThrough = /*#__PURE__*/emotion_styled_base_browser_esm(input_suffix_wrapper, true ? {
target: "e1mv6sxx0"
} : 0)("position:absolute;pointer-events:none;", rtl({
right: 0
}), ";" + ( true ? "" : 0));
;// 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
* @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element.
*
* @return {JSX.Element} Icon component
*/
function icon_Icon({
icon,
size = 24,
...props
}, ref) {
return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
width: size,
height: size,
...props,
ref
});
}
/* harmony default export */ const icons_build_module_icon = ((0,external_wp_element_namespaceObject.forwardRef)(icon_Icon));
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
/**
* WordPress dependencies
*/
const chevronDown = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.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 */ const chevron_down = (chevronDown);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/select-control/chevron-down.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const SelectControlChevronDown = () => {
return (0,external_React_.createElement)(InputControlSuffixWrapperWithClickThrough, null, (0,external_React_.createElement)(DownArrowWrapper, null, (0,external_React_.createElement)(icons_build_module_icon, {
icon: chevron_down,
size: chevronIconSize
})));
};
/* harmony default export */ const select_control_chevron_down = (SelectControlChevronDown);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/select-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const select_control_noop = () => {};
function select_control_useUniqueId(idProp) {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(SelectControl);
const id = `inspector-select-control-${instanceId}`;
return idProp || id;
}
function UnforwardedSelectControl(props, ref) {
const {
className,
disabled = false,
help,
hideLabelFromVision,
id: idProp,
label,
multiple = false,
onBlur = select_control_noop,
onChange,
onFocus = select_control_noop,
options = [],
size = 'default',
value: valueProp,
labelPosition = 'top',
children,
prefix,
suffix,
__next40pxDefaultSize = false,
__nextHasNoMarginBottom = false,
...restProps
} = useDeprecated36pxDefaultSizeProp(props);
const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
const id = select_control_useUniqueId(idProp);
const helpId = help ? `${id}__help` : undefined;
// Disable reason: A select with an onchange throws a warning.
if (!options?.length && !children) return null;
const handleOnBlur = event => {
onBlur(event);
setIsFocused(false);
};
const handleOnFocus = event => {
onFocus(event);
setIsFocused(true);
};
const handleOnChange = event => {
if (props.multiple) {
const selectedOptions = Array.from(event.target.options).filter(({
selected
}) => selected);
const newValues = selectedOptions.map(({
value
}) => value);
props.onChange?.(newValues, {
event
});
return;
}
props.onChange?.(event.target.value, {
event
});
};
const classes = classnames_default()('components-select-control', className);
return (0,external_React_.createElement)(base_control, {
help: help,
id: id,
__nextHasNoMarginBottom: __nextHasNoMarginBottom
}, (0,external_React_.createElement)(input_base, {
className: classes,
disabled: disabled,
hideLabelFromVision: hideLabelFromVision,
id: id,
isFocused: isFocused,
label: label,
size: size,
suffix: suffix || !multiple && (0,external_React_.createElement)(select_control_chevron_down, null),
prefix: prefix,
labelPosition: labelPosition,
__next40pxDefaultSize: __next40pxDefaultSize
}, (0,external_React_.createElement)(Select, {
...restProps,
__next40pxDefaultSize: __next40pxDefaultSize,
"aria-describedby": helpId,
className: "components-select-control__input",
disabled: disabled,
id: id,
multiple: multiple,
onBlur: handleOnBlur,
onChange: handleOnChange,
onFocus: handleOnFocus,
ref: ref,
selectSize: size,
value: valueProp
}, children || options.map((option, index) => {
const key = option.id || `${option.label}-${option.value}-${index}`;
return (0,external_React_.createElement)("option", {
key: key,
value: option.value,
disabled: option.disabled,
hidden: option.hidden
}, option.label);
}))));
}
/**
* `SelectControl` allows users to select from a single or multiple option menu.
* It functions as a wrapper around the browser's native `<select>` element.
*
* ```jsx
* import { SelectControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MySelectControl = () => {
* const [ size, setSize ] = useState( '50%' );
*
* return (
* <SelectControl
* label="Size"
* value={ size }
* options={ [
* { label: 'Big', value: '100%' },
* { label: 'Medium', value: '50%' },
* { label: 'Small', value: '25%' },
* ] }
* onChange={ setSize }
* />
* );
* };
* ```
*/
const SelectControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSelectControl);
/* harmony default export */ const select_control = (SelectControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-state.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @template T
* @typedef Options
* @property {T} [initial] Initial value
* @property {T | ""} fallback Fallback value
*/
/** @type {Readonly<{ initial: undefined, fallback: '' }>} */
const defaultOptions = {
initial: undefined,
/**
* Defaults to empty string, as that is preferred for usage with
* <input />, <textarea />, and <select /> form elements.
*/
fallback: ''
};
/**
* Custom hooks for "controlled" components to track and consolidate internal
* state and incoming values. This is useful for components that render
* `input`, `textarea`, or `select` HTML elements.
*
* https://reactjs.org/docs/forms.html#controlled-components
*
* At first, a component using useControlledState receives an initial prop
* value, which is used as initial internal state.
*
* This internal state can be maintained and updated without
* relying on new incoming prop values.
*
* Unlike the basic useState hook, useControlledState's state can
* be updated if a new incoming prop value is changed.
*
* @template T
*
* @param {T | undefined} currentState The current value.
* @param {Options<T>} [options=defaultOptions] Additional options for the hook.
*
* @return {[T | "", (nextState: T) => void]} The controlled value and the value setter.
*/
function use_controlled_state_useControlledState(currentState, options = defaultOptions) {
const {
initial,
fallback
} = {
...defaultOptions,
...options
};
const [internalState, setInternalState] = (0,external_wp_element_namespaceObject.useState)(currentState);
const hasCurrentState = isValueDefined(currentState);
/*
* Resets internal state if value every changes from uncontrolled <-> controlled.
*/
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (hasCurrentState && internalState) {
setInternalState(undefined);
}
}, [hasCurrentState, internalState]);
const state = getDefinedValue([currentState, internalState, initial], fallback);
/* eslint-disable jsdoc/no-undefined-types */
/** @type {(nextState: T) => void} */
const setState = (0,external_wp_element_namespaceObject.useCallback)(nextState => {
if (!hasCurrentState) {
setInternalState(nextState);
}
}, [hasCurrentState]);
/* eslint-enable jsdoc/no-undefined-types */
return [state, setState];
}
/* harmony default export */ const use_controlled_state = (use_controlled_state_useControlledState);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* A float supported clamp function for a specific value.
*
* @param value The value to clamp.
* @param min The minimum value.
* @param max The maximum value.
*
* @return A (float) number
*/
function floatClamp(value, min, max) {
if (typeof value !== 'number') {
return null;
}
return parseFloat(`${math_clamp(value, min, max)}`);
}
/**
* Hook to store a clamped value, derived from props.
*
* @param settings
* @return The controlled value and the value setter.
*/
function useControlledRangeValue(settings) {
const {
min,
max,
value: valueProp,
initial
} = settings;
const [state, setInternalState] = use_controlled_state(floatClamp(valueProp, min, max), {
initial: floatClamp(initial !== null && initial !== void 0 ? initial : null, min, max),
fallback: null
});
const setState = (0,external_wp_element_namespaceObject.useCallback)(nextValue => {
if (nextValue === null) {
setInternalState(null);
} else {
setInternalState(floatClamp(nextValue, min, max));
}
}, [min, max, setInternalState]);
// `state` can't be an empty string because we specified a fallback value of
// `null` in `useControlledState`
return [state, setState];
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/styles/range-control-styles.js
function range_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const rangeHeightValue = 30;
const railHeight = 4;
const rangeHeight = () => /*#__PURE__*/emotion_react_browser_esm_css({
height: rangeHeightValue,
minHeight: rangeHeightValue
}, true ? "" : 0, true ? "" : 0);
const thumbSize = 12;
const deprecatedHeight = ({
__next40pxDefaultSize
}) => !__next40pxDefaultSize && /*#__PURE__*/emotion_react_browser_esm_css({
minHeight: rangeHeightValue
}, true ? "" : 0, true ? "" : 0);
const range_control_styles_Root = emotion_styled_base_browser_esm("div", true ? {
target: "e1epgpqk14"
} : 0)("-webkit-tap-highlight-color:transparent;align-items:center;display:flex;justify-content:flex-start;padding:0;position:relative;touch-action:none;width:100%;min-height:40px;", deprecatedHeight, ";" + ( true ? "" : 0));
const wrapperColor = ({
color = COLORS.ui.borderFocus
}) => /*#__PURE__*/emotion_react_browser_esm_css({
color
}, true ? "" : 0, true ? "" : 0);
const wrapperMargin = ({
marks,
__nextHasNoMarginBottom
}) => {
if (!__nextHasNoMarginBottom) {
return /*#__PURE__*/emotion_react_browser_esm_css({
marginBottom: marks ? 16 : undefined
}, true ? "" : 0, true ? "" : 0);
}
return '';
};
const range_control_styles_Wrapper = emotion_styled_base_browser_esm("div", true ? {
target: "e1epgpqk13"
} : 0)("display:block;flex:1;position:relative;width:100%;", wrapperColor, ";", rangeHeight, ";", wrapperMargin, ";" + ( true ? "" : 0));
const BeforeIconWrapper = emotion_styled_base_browser_esm("span", true ? {
target: "e1epgpqk12"
} : 0)("display:flex;margin-top:", railHeight, "px;", rtl({
marginRight: 6
}), ";" + ( true ? "" : 0));
const AfterIconWrapper = emotion_styled_base_browser_esm("span", true ? {
target: "e1epgpqk11"
} : 0)("display:flex;margin-top:", railHeight, "px;", rtl({
marginLeft: 6
}), ";" + ( true ? "" : 0));
const railBackgroundColor = ({
disabled,
railColor
}) => {
let background = railColor || '';
if (disabled) {
background = COLORS.ui.backgroundDisabled;
}
return /*#__PURE__*/emotion_react_browser_esm_css({
background
}, true ? "" : 0, true ? "" : 0);
};
const Rail = emotion_styled_base_browser_esm("span", true ? {
target: "e1epgpqk10"
} : 0)("background-color:", COLORS.gray[300], ";left:0;pointer-events:none;right:0;display:block;height:", railHeight, "px;position:absolute;margin-top:", (rangeHeightValue - railHeight) / 2, "px;top:0;border-radius:", railHeight, "px;", railBackgroundColor, ";" + ( true ? "" : 0));
const trackBackgroundColor = ({
disabled,
trackColor
}) => {
let background = trackColor || 'currentColor';
if (disabled) {
background = COLORS.gray[400];
}
return /*#__PURE__*/emotion_react_browser_esm_css({
background
}, true ? "" : 0, true ? "" : 0);
};
const Track = emotion_styled_base_browser_esm("span", true ? {
target: "e1epgpqk9"
} : 0)("background-color:currentColor;border-radius:", railHeight, "px;height:", railHeight, "px;pointer-events:none;display:block;position:absolute;margin-top:", (rangeHeightValue - railHeight) / 2, "px;top:0;", trackBackgroundColor, ";" + ( true ? "" : 0));
const MarksWrapper = emotion_styled_base_browser_esm("span", true ? {
target: "e1epgpqk8"
} : 0)( true ? {
name: "l7tjj5",
styles: "display:block;pointer-events:none;position:relative;width:100%;user-select:none"
} : 0);
const markFill = ({
disabled,
isFilled
}) => {
let backgroundColor = isFilled ? 'currentColor' : COLORS.gray[300];
if (disabled) {
backgroundColor = COLORS.gray[400];
}
return /*#__PURE__*/emotion_react_browser_esm_css({
backgroundColor
}, true ? "" : 0, true ? "" : 0);
};
const Mark = emotion_styled_base_browser_esm("span", true ? {
target: "e1epgpqk7"
} : 0)("height:", thumbSize, "px;left:0;position:absolute;top:-4px;width:1px;", markFill, ";" + ( true ? "" : 0));
const markLabelFill = ({
isFilled
}) => {
return /*#__PURE__*/emotion_react_browser_esm_css({
color: isFilled ? COLORS.gray[700] : COLORS.gray[300]
}, true ? "" : 0, true ? "" : 0);
};
const MarkLabel = emotion_styled_base_browser_esm("span", true ? {
target: "e1epgpqk6"
} : 0)("color:", COLORS.gray[300], ";left:0;font-size:11px;position:absolute;top:12px;transform:translateX( -50% );white-space:nowrap;", markLabelFill, ";" + ( true ? "" : 0));
const thumbColor = ({
disabled
}) => disabled ? /*#__PURE__*/emotion_react_browser_esm_css("background-color:", COLORS.gray[400], ";" + ( true ? "" : 0), true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css("background-color:", COLORS.theme.accent, ";" + ( true ? "" : 0), true ? "" : 0);
const ThumbWrapper = emotion_styled_base_browser_esm("span", true ? {
target: "e1epgpqk5"
} : 0)("align-items:center;display:flex;height:", thumbSize, "px;justify-content:center;margin-top:", (rangeHeightValue - thumbSize) / 2, "px;outline:0;pointer-events:none;position:absolute;top:0;user-select:none;width:", thumbSize, "px;border-radius:50%;", thumbColor, ";", rtl({
marginLeft: -10
}), ";", rtl({
transform: 'translateX( 4.5px )'
}, {
transform: 'translateX( -4.5px )'
}), ";" + ( true ? "" : 0));
const thumbFocus = ({
isFocused
}) => {
return isFocused ? /*#__PURE__*/emotion_react_browser_esm_css("&::before{content:' ';position:absolute;background-color:", COLORS.theme.accent, ";opacity:0.4;border-radius:50%;height:", thumbSize + 8, "px;width:", thumbSize + 8, "px;top:-4px;left:-4px;}" + ( true ? "" : 0), true ? "" : 0) : '';
};
const Thumb = emotion_styled_base_browser_esm("span", true ? {
target: "e1epgpqk4"
} : 0)("align-items:center;border-radius:50%;height:100%;outline:0;position:absolute;user-select:none;width:100%;", thumbColor, ";", thumbFocus, ";" + ( true ? "" : 0));
const InputRange = emotion_styled_base_browser_esm("input", true ? {
target: "e1epgpqk3"
} : 0)("box-sizing:border-box;cursor:pointer;display:block;height:100%;left:0;margin:0 -", thumbSize / 2, "px;opacity:0;outline:none;position:absolute;right:0;top:0;width:calc( 100% + ", thumbSize, "px );" + ( true ? "" : 0));
const tooltipShow = ({
show
}) => {
return /*#__PURE__*/emotion_react_browser_esm_css({
opacity: show ? 1 : 0
}, true ? "" : 0, true ? "" : 0);
};
var range_control_styles_ref = true ? {
name: "1cypxip",
styles: "top:-80%"
} : 0;
var range_control_styles_ref2 = true ? {
name: "1lr98c4",
styles: "bottom:-80%"
} : 0;
const tooltipPosition = ({
position
}) => {
const isBottom = position === 'bottom';
if (isBottom) {
return range_control_styles_ref2;
}
return range_control_styles_ref;
};
const range_control_styles_Tooltip = emotion_styled_base_browser_esm("span", true ? {
target: "e1epgpqk2"
} : 0)("background:rgba( 0, 0, 0, 0.8 );border-radius:2px;color:white;display:inline-block;font-size:12px;min-width:32px;opacity:0;padding:4px 8px;pointer-events:none;position:absolute;text-align:center;transition:opacity 120ms ease;user-select:none;line-height:1.4;", tooltipShow, ";", tooltipPosition, ";", reduceMotion('transition'), ";", rtl({
transform: 'translateX(-50%)'
}, {
transform: 'translateX(50%)'
}), ";" + ( true ? "" : 0));
// @todo: Refactor RangeControl with latest HStack configuration
// @see: packages/components/src/h-stack
const InputNumber = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
target: "e1epgpqk1"
} : 0)("display:inline-block;font-size:13px;margin-top:0;input[type='number']&{", rangeHeight, ";}", rtl({
marginLeft: `${space(4)} !important`
}), ";" + ( true ? "" : 0));
const ActionRightWrapper = emotion_styled_base_browser_esm("span", true ? {
target: "e1epgpqk0"
} : 0)("display:block;margin-top:0;button,button.is-small{margin-left:0;", rangeHeight, ";}", rtl({
marginLeft: 8
}), ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/input-range.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function input_range_InputRange(props, ref) {
const {
describedBy,
label,
value,
...otherProps
} = props;
return (0,external_React_.createElement)(InputRange, {
...otherProps,
"aria-describedby": describedBy,
"aria-label": label,
"aria-hidden": false,
ref: ref,
tabIndex: 0,
type: "range",
value: value
});
}
const input_range_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(input_range_InputRange);
/* harmony default export */ const input_range = (input_range_ForwardedComponent);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/mark.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function RangeMark(props) {
const {
className,
isFilled = false,
label,
style = {},
...otherProps
} = props;
const classes = classnames_default()('components-range-control__mark', isFilled && 'is-filled', className);
const labelClasses = classnames_default()('components-range-control__mark-label', isFilled && 'is-filled');
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(Mark, {
...otherProps,
"aria-hidden": "true",
className: classes,
isFilled: isFilled,
style: style
}), label && (0,external_React_.createElement)(MarkLabel, {
"aria-hidden": "true",
className: labelClasses,
isFilled: isFilled,
style: style
}, label));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/rail.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function RangeRail(props) {
const {
disabled = false,
marks = false,
min = 0,
max = 100,
step = 1,
value = 0,
...restProps
} = props;
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(Rail, {
disabled: disabled,
...restProps
}), marks && (0,external_React_.createElement)(Marks, {
disabled: disabled,
marks: marks,
min: min,
max: max,
step: step,
value: value
}));
}
function Marks(props) {
const {
disabled = false,
marks = false,
min = 0,
max = 100,
step: stepProp = 1,
value = 0
} = props;
const step = stepProp === 'any' ? 1 : stepProp;
const marksData = useMarks({
marks,
min,
max,
step,
value
});
return (0,external_React_.createElement)(MarksWrapper, {
"aria-hidden": "true",
className: "components-range-control__marks"
}, marksData.map(mark => (0,external_React_.createElement)(RangeMark, {
...mark,
key: mark.key,
"aria-hidden": "true",
disabled: disabled
})));
}
function useMarks({
marks,
min = 0,
max = 100,
step = 1,
value = 0
}) {
if (!marks) {
return [];
}
const range = max - min;
if (!Array.isArray(marks)) {
marks = [];
const count = 1 + Math.round(range / step);
while (count > marks.push({
value: step * marks.length + min
}));
}
const placedMarks = [];
marks.forEach((mark, index) => {
if (mark.value < min || mark.value > max) {
return;
}
const key = `mark-${index}`;
const isFilled = mark.value <= value;
const offset = `${(mark.value - min) / range * 100}%`;
const offsetStyle = {
[(0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left']: offset
};
placedMarks.push({
...mark,
isFilled,
key,
style: offsetStyle
});
});
return placedMarks;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/tooltip.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function SimpleTooltip(props) {
const {
className,
inputRef,
tooltipPosition,
show = false,
style = {},
value = 0,
renderTooltipContent = v => v,
zIndex = 100,
...restProps
} = props;
const position = useTooltipPosition({
inputRef,
tooltipPosition
});
const classes = classnames_default()('components-simple-tooltip', className);
const styles = {
...style,
zIndex
};
return (0,external_React_.createElement)(range_control_styles_Tooltip, {
...restProps,
"aria-hidden": show,
className: classes,
position: position,
show: show,
role: "tooltip",
style: styles
}, renderTooltipContent(value));
}
function useTooltipPosition({
inputRef,
tooltipPosition
}) {
const [position, setPosition] = (0,external_wp_element_namespaceObject.useState)();
const setTooltipPosition = (0,external_wp_element_namespaceObject.useCallback)(() => {
if (inputRef && inputRef.current) {
setPosition(tooltipPosition);
}
}, [tooltipPosition, inputRef]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
setTooltipPosition();
}, [setTooltipPosition]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
window.addEventListener('resize', setTooltipPosition);
return () => {
window.removeEventListener('resize', setTooltipPosition);
};
});
return position;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const range_control_noop = () => {};
function UnforwardedRangeControl(props, forwardedRef) {
const {
__nextHasNoMarginBottom = false,
afterIcon,
allowReset = false,
beforeIcon,
className,
color: colorProp = COLORS.theme.accent,
currentInput,
disabled = false,
help,
hideLabelFromVision = false,
initialPosition,
isShiftStepEnabled = true,
label,
marks = false,
max = 100,
min = 0,
onBlur = range_control_noop,
onChange = range_control_noop,
onFocus = range_control_noop,
onMouseLeave = range_control_noop,
onMouseMove = range_control_noop,
railColor,
renderTooltipContent = v => v,
resetFallbackValue,
__next40pxDefaultSize = false,
shiftStep = 10,
showTooltip: showTooltipProp,
step = 1,
trackColor,
value: valueProp,
withInputField = true,
...otherProps
} = props;
const [value, setValue] = useControlledRangeValue({
min,
max,
value: valueProp !== null && valueProp !== void 0 ? valueProp : null,
initial: initialPosition
});
const isResetPendent = (0,external_wp_element_namespaceObject.useRef)(false);
let hasTooltip = showTooltipProp;
let hasInputField = withInputField;
if (step === 'any') {
// The tooltip and number input field are hidden when the step is "any"
// because the decimals get too lengthy to fit well.
hasTooltip = false;
hasInputField = false;
}
const [showTooltip, setShowTooltip] = (0,external_wp_element_namespaceObject.useState)(hasTooltip);
const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
const inputRef = (0,external_wp_element_namespaceObject.useRef)();
const isCurrentlyFocused = inputRef.current?.matches(':focus');
const isThumbFocused = !disabled && isFocused;
const isValueReset = value === null;
const currentValue = value !== undefined ? value : currentInput;
const inputSliderValue = isValueReset ? '' : currentValue;
const rangeFillValue = isValueReset ? (max - min) / 2 + min : value;
const fillValue = isValueReset ? 50 : (value - min) / (max - min) * 100;
const fillValueOffset = `${math_clamp(fillValue, 0, 100)}%`;
const classes = classnames_default()('components-range-control', className);
const wrapperClasses = classnames_default()('components-range-control__wrapper', !!marks && 'is-marked');
const id = (0,external_wp_compose_namespaceObject.useInstanceId)(UnforwardedRangeControl, 'inspector-range-control');
const describedBy = !!help ? `${id}__help` : undefined;
const enableTooltip = hasTooltip !== false && Number.isFinite(value);
const handleOnRangeChange = event => {
const nextValue = parseFloat(event.target.value);
setValue(nextValue);
onChange(nextValue);
};
const handleOnChange = next => {
// @ts-expect-error TODO: Investigate if it's problematic for setValue() to
// potentially receive a NaN when next is undefined.
let nextValue = parseFloat(next);
setValue(nextValue);
/*
* Calls onChange only when nextValue is numeric
* otherwise may queue a reset for the blur event.
*/
if (!isNaN(nextValue)) {
if (nextValue < min || nextValue > max) {
nextValue = floatClamp(nextValue, min, max);
}
onChange(nextValue);
isResetPendent.current = false;
} else if (allowReset) {
isResetPendent.current = true;
}
};
const handleOnInputNumberBlur = () => {
if (isResetPendent.current) {
handleOnReset();
isResetPendent.current = false;
}
};
const handleOnReset = () => {
let resetValue = parseFloat(`${resetFallbackValue}`);
let onChangeResetValue = resetValue;
if (isNaN(resetValue)) {
resetValue = null;
onChangeResetValue = undefined;
}
setValue(resetValue);
/**
* Previously, this callback would always receive undefined as
* an argument. This behavior is unexpected, specifically
* when resetFallbackValue is defined.
*
* The value of undefined is not ideal. Passing it through
* to internal <input /> elements would change it from a
* controlled component to an uncontrolled component.
*
* For now, to minimize unexpected regressions, we're going to
* preserve the undefined callback argument, except when a
* resetFallbackValue is defined.
*/
onChange(onChangeResetValue);
};
const handleShowTooltip = () => setShowTooltip(true);
const handleHideTooltip = () => setShowTooltip(false);
const handleOnBlur = event => {
onBlur(event);
setIsFocused(false);
handleHideTooltip();
};
const handleOnFocus = event => {
onFocus(event);
setIsFocused(true);
handleShowTooltip();
};
const offsetStyle = {
[(0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left']: fillValueOffset
};
return (0,external_React_.createElement)(base_control, {
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
className: classes,
label: label,
hideLabelFromVision: hideLabelFromVision,
id: `${id}`,
help: help
}, (0,external_React_.createElement)(range_control_styles_Root, {
className: "components-range-control__root",
__next40pxDefaultSize: __next40pxDefaultSize
}, beforeIcon && (0,external_React_.createElement)(BeforeIconWrapper, null, (0,external_React_.createElement)(build_module_icon, {
icon: beforeIcon
})), (0,external_React_.createElement)(range_control_styles_Wrapper, {
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
className: wrapperClasses,
color: colorProp,
marks: !!marks
}, (0,external_React_.createElement)(input_range, {
...otherProps,
className: "components-range-control__slider",
describedBy: describedBy,
disabled: disabled,
id: `${id}`,
label: label,
max: max,
min: min,
onBlur: handleOnBlur,
onChange: handleOnRangeChange,
onFocus: handleOnFocus,
onMouseMove: onMouseMove,
onMouseLeave: onMouseLeave,
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([inputRef, forwardedRef]),
step: step,
value: inputSliderValue !== null && inputSliderValue !== void 0 ? inputSliderValue : undefined
}), (0,external_React_.createElement)(RangeRail, {
"aria-hidden": true,
disabled: disabled,
marks: marks,
max: max,
min: min,
railColor: railColor,
step: step,
value: rangeFillValue
}), (0,external_React_.createElement)(Track, {
"aria-hidden": true,
className: "components-range-control__track",
disabled: disabled,
style: {
width: fillValueOffset
},
trackColor: trackColor
}), (0,external_React_.createElement)(ThumbWrapper, {
className: "components-range-control__thumb-wrapper",
style: offsetStyle,
disabled: disabled
}, (0,external_React_.createElement)(Thumb, {
"aria-hidden": true,
isFocused: isThumbFocused,
disabled: disabled
})), enableTooltip && (0,external_React_.createElement)(SimpleTooltip, {
className: "components-range-control__tooltip",
inputRef: inputRef,
tooltipPosition: "bottom",
renderTooltipContent: renderTooltipContent,
show: isCurrentlyFocused || showTooltip,
style: offsetStyle,
value: value
})), afterIcon && (0,external_React_.createElement)(AfterIconWrapper, null, (0,external_React_.createElement)(build_module_icon, {
icon: afterIcon
})), hasInputField && (0,external_React_.createElement)(InputNumber, {
"aria-label": label,
className: "components-range-control__number",
disabled: disabled,
inputMode: "decimal",
isShiftStepEnabled: isShiftStepEnabled,
max: max,
min: min,
onBlur: handleOnInputNumberBlur,
onChange: handleOnChange,
shiftStep: shiftStep,
size: __next40pxDefaultSize ? '__unstable-large' : 'default',
__unstableInputWidth: __next40pxDefaultSize ? space(20) : space(16),
step: step
// @ts-expect-error TODO: Investigate if the `null` value is necessary
,
value: inputSliderValue
}), allowReset && (0,external_React_.createElement)(ActionRightWrapper, null, (0,external_React_.createElement)(build_module_button, {
className: "components-range-control__reset",
disabled: disabled || value === undefined,
variant: "secondary",
size: "small",
onClick: handleOnReset
}, (0,external_wp_i18n_namespaceObject.__)('Reset')))));
}
/**
* RangeControls are used to make selections from a range of incremental values.
*
* ```jsx
* import { RangeControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyRangeControl = () => {
* const [ isChecked, setChecked ] = useState( true );
* return (
* <RangeControl
* help="Please select how transparent you would like this."
* initialPosition={50}
* label="Opacity"
* max={100}
* min={0}
* onChange={() => {}}
* />
* );
* };
* ```
*/
const RangeControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedRangeControl);
/* harmony default export */ const range_control = (RangeControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/styles.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const NumberControlWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
target: "ez9hsf47"
} : 0)(Container, "{width:", space(24), ";}" + ( true ? "" : 0));
const styles_SelectControl = /*#__PURE__*/emotion_styled_base_browser_esm(select_control, true ? {
target: "ez9hsf46"
} : 0)("margin-left:", space(-2), ";width:5em;select:not( :focus )~", BackdropUI, BackdropUI, BackdropUI, "{border-color:transparent;}" + ( true ? "" : 0));
const styles_RangeControl = /*#__PURE__*/emotion_styled_base_browser_esm(range_control, true ? {
target: "ez9hsf45"
} : 0)("flex:1;margin-right:", space(2), ";" + ( true ? "" : 0));
// Make the Hue circle picker not go out of the bar.
const interactiveHueStyles = `
.react-colorful__interactive {
width: calc( 100% - ${space(2)} );
margin-left: ${space(1)};
}`;
const AuxiliaryColorArtefactWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "ez9hsf44"
} : 0)("padding-top:", space(2), ";padding-right:0;padding-left:0;padding-bottom:0;" + ( true ? "" : 0));
const AuxiliaryColorArtefactHStackHeader = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? {
target: "ez9hsf43"
} : 0)("padding-left:", space(4), ";padding-right:", space(4), ";" + ( true ? "" : 0));
const ColorInputWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
target: "ez9hsf42"
} : 0)("padding-top:", space(4), ";padding-left:", space(4), ";padding-right:", space(3), ";padding-bottom:", space(5), ";" + ( true ? "" : 0));
const ColorfulWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "ez9hsf41"
} : 0)(boxSizingReset, ";width:216px;.react-colorful{display:flex;flex-direction:column;align-items:center;width:216px;height:auto;}.react-colorful__saturation{width:100%;border-radius:0;height:216px;margin-bottom:", space(4), ";border-bottom:none;}.react-colorful__hue,.react-colorful__alpha{width:184px;height:16px;border-radius:16px;margin-bottom:", space(2), ";}.react-colorful__pointer{height:16px;width:16px;border:none;box-shadow:0 0 2px 0 rgba( 0, 0, 0, 0.25 );outline:2px solid transparent;}.react-colorful__pointer-fill{box-shadow:inset 0 0 0 ", config_values.borderWidthFocus, " #fff;}", interactiveHueStyles, ";" + ( true ? "" : 0));
const CopyButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
target: "ez9hsf40"
} : 0)("&&&&&{min-width:", space(6), ";padding:0;>svg{margin-right:0;}}" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/copy.js
/**
* WordPress dependencies
*/
const copy_copy = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
fillRule: "evenodd",
clipRule: "evenodd",
d: "M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"
}));
/* harmony default export */ const library_copy = (copy_copy);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/color-copy-button.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ColorCopyButton = props => {
const {
color,
colorType
} = props;
const [copiedColor, setCopiedColor] = (0,external_wp_element_namespaceObject.useState)(null);
const copyTimer = (0,external_wp_element_namespaceObject.useRef)();
const copyRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(() => {
switch (colorType) {
case 'hsl':
{
return color.toHslString();
}
case 'rgb':
{
return color.toRgbString();
}
default:
case 'hex':
{
return color.toHex();
}
}
}, () => {
if (copyTimer.current) {
clearTimeout(copyTimer.current);
}
setCopiedColor(color.toHex());
copyTimer.current = setTimeout(() => {
setCopiedColor(null);
copyTimer.current = undefined;
}, 3000);
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Clear copyTimer on component unmount.
return () => {
if (copyTimer.current) {
clearTimeout(copyTimer.current);
}
};
}, []);
return (0,external_React_.createElement)(tooltip, {
delay: 0,
hideOnClick: false,
text: copiedColor === color.toHex() ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy')
}, (0,external_React_.createElement)(CopyButton, {
size: "small",
ref: copyRef,
icon: library_copy,
showTooltip: false
}));
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/input-with-slider.js
/**
* Internal dependencies
*/
const InputWithSlider = ({
min,
max,
label,
abbreviation,
onChange,
value
}) => {
const onNumberControlChange = newValue => {
if (!newValue) {
onChange(0);
return;
}
if (typeof newValue === 'string') {
onChange(parseInt(newValue, 10));
return;
}
onChange(newValue);
};
return (0,external_React_.createElement)(h_stack_component, {
spacing: 4
}, (0,external_React_.createElement)(NumberControlWrapper, {
min: min,
max: max,
label: label,
hideLabelFromVision: true,
value: value,
onChange: onNumberControlChange,
prefix: (0,external_React_.createElement)(spacer_component, {
as: text_component,
paddingLeft: space(4),
color: COLORS.theme.accent,
lineHeight: 1
}, abbreviation),
spinControls: "none",
size: "__unstable-large"
}), (0,external_React_.createElement)(styles_RangeControl, {
__nextHasNoMarginBottom: true,
label: label,
hideLabelFromVision: true,
min: min,
max: max,
value: value
// @ts-expect-error
// See: https://github.com/WordPress/gutenberg/pull/40535#issuecomment-1172418185
,
onChange: onChange,
withInputField: false
}));
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/rgb-input.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const RgbInput = ({
color,
onChange,
enableAlpha
}) => {
const {
r,
g,
b,
a
} = color.toRgb();
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(InputWithSlider, {
min: 0,
max: 255,
label: "Red",
abbreviation: "R",
value: r,
onChange: nextR => onChange(w({
r: nextR,
g,
b,
a
}))
}), (0,external_React_.createElement)(InputWithSlider, {
min: 0,
max: 255,
label: "Green",
abbreviation: "G",
value: g,
onChange: nextG => onChange(w({
r,
g: nextG,
b,
a
}))
}), (0,external_React_.createElement)(InputWithSlider, {
min: 0,
max: 255,
label: "Blue",
abbreviation: "B",
value: b,
onChange: nextB => onChange(w({
r,
g,
b: nextB,
a
}))
}), enableAlpha && (0,external_React_.createElement)(InputWithSlider, {
min: 0,
max: 100,
label: "Alpha",
abbreviation: "A",
value: Math.trunc(a * 100),
onChange: nextA => onChange(w({
r,
g,
b,
a: nextA / 100
}))
}));
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/hsl-input.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const HslInput = ({
color,
onChange,
enableAlpha
}) => {
const colorPropHSLA = (0,external_wp_element_namespaceObject.useMemo)(() => color.toHsl(), [color]);
const [internalHSLA, setInternalHSLA] = (0,external_wp_element_namespaceObject.useState)({
...colorPropHSLA
});
const isInternalColorSameAsReceivedColor = color.isEqual(w(internalHSLA));
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isInternalColorSameAsReceivedColor) {
// Keep internal HSLA color up to date with the received color prop
setInternalHSLA(colorPropHSLA);
}
}, [colorPropHSLA, isInternalColorSameAsReceivedColor]);
// If the internal color is equal to the received color prop, we can use the
// HSLA values from the local state which, compared to the received color prop,
// retain more details about the actual H and S values that the user selected,
// and thus allow for better UX when interacting with the H and S sliders.
const colorValue = isInternalColorSameAsReceivedColor ? internalHSLA : colorPropHSLA;
const updateHSLAValue = partialNewValue => {
const nextOnChangeValue = w({
...colorValue,
...partialNewValue
});
// Fire `onChange` only if the resulting color is different from the
// current one.
// Otherwise, update the internal HSLA color to cause a re-render.
if (!color.isEqual(nextOnChangeValue)) {
onChange(nextOnChangeValue);
} else {
setInternalHSLA(prevHSLA => ({
...prevHSLA,
...partialNewValue
}));
}
};
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(InputWithSlider, {
min: 0,
max: 359,
label: "Hue",
abbreviation: "H",
value: colorValue.h,
onChange: nextH => {
updateHSLAValue({
h: nextH
});
}
}), (0,external_React_.createElement)(InputWithSlider, {
min: 0,
max: 100,
label: "Saturation",
abbreviation: "S",
value: colorValue.s,
onChange: nextS => {
updateHSLAValue({
s: nextS
});
}
}), (0,external_React_.createElement)(InputWithSlider, {
min: 0,
max: 100,
label: "Lightness",
abbreviation: "L",
value: colorValue.l,
onChange: nextL => {
updateHSLAValue({
l: nextL
});
}
}), enableAlpha && (0,external_React_.createElement)(InputWithSlider, {
min: 0,
max: 100,
label: "Alpha",
abbreviation: "A",
value: Math.trunc(100 * colorValue.a),
onChange: nextA => {
updateHSLAValue({
a: nextA / 100
});
}
}));
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/hex-input.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const HexInput = ({
color,
onChange,
enableAlpha
}) => {
const handleChange = nextValue => {
if (!nextValue) return;
const hexValue = nextValue.startsWith('#') ? nextValue : '#' + nextValue;
onChange(w(hexValue));
};
const stateReducer = (state, action) => {
const nativeEvent = action.payload?.event?.nativeEvent;
if ('insertFromPaste' !== nativeEvent?.inputType) {
return {
...state
};
}
const value = state.value?.startsWith('#') ? state.value.slice(1).toUpperCase() : state.value?.toUpperCase();
return {
...state,
value
};
};
return (0,external_React_.createElement)(InputControl, {
prefix: (0,external_React_.createElement)(spacer_component, {
as: text_component,
marginLeft: space(4),
color: COLORS.theme.accent,
lineHeight: 1
}, "#"),
value: color.toHex().slice(1).toUpperCase(),
onChange: handleChange,
maxLength: enableAlpha ? 9 : 7,
label: (0,external_wp_i18n_namespaceObject.__)('Hex color'),
hideLabelFromVision: true,
size: "__unstable-large",
__unstableStateReducer: stateReducer,
__unstableInputWidth: "9em"
});
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/color-input.js
/**
* Internal dependencies
*/
const ColorInput = ({
colorType,
color,
onChange,
enableAlpha
}) => {
const props = {
color,
onChange,
enableAlpha
};
switch (colorType) {
case 'hsl':
return (0,external_React_.createElement)(HslInput, {
...props
});
case 'rgb':
return (0,external_React_.createElement)(RgbInput, {
...props
});
default:
case 'hex':
return (0,external_React_.createElement)(HexInput, {
...props
});
}
};
;// CONCATENATED MODULE: ./node_modules/react-colorful/dist/index.mjs
function dist_u(){return(dist_u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function dist_c(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r.indexOf(t=a[n])>=0||(o[t]=e[t]);return o}function dist_i(e){var t=(0,external_React_.useRef)(e),n=(0,external_React_.useRef)(function(e){t.current&&t.current(e)});return t.current=e,n.current}var dist_s=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=1),e>t?t:e<r?r:e},dist_f=function(e){return"touches"in e},dist_v=function(e){return e&&e.ownerDocument.defaultView||self},dist_d=function(e,r,t){var n=e.getBoundingClientRect(),o=dist_f(r)?function(e,r){for(var t=0;t<e.length;t++)if(e[t].identifier===r)return e[t];return e[0]}(r.touches,t):r;return{left:dist_s((o.pageX-(n.left+dist_v(e).pageXOffset))/n.width),top:dist_s((o.pageY-(n.top+dist_v(e).pageYOffset))/n.height)}},dist_h=function(e){!dist_f(e)&&e.preventDefault()},dist_m=external_React_.memo(function(o){var a=o.onMove,l=o.onKey,s=dist_c(o,["onMove","onKey"]),m=(0,external_React_.useRef)(null),g=dist_i(a),p=dist_i(l),b=(0,external_React_.useRef)(null),_=(0,external_React_.useRef)(!1),x=(0,external_React_.useMemo)(function(){var e=function(e){dist_h(e),(dist_f(e)?e.touches.length>0:e.buttons>0)&&m.current?g(dist_d(m.current,e,b.current)):t(!1)},r=function(){return t(!1)};function t(t){var n=_.current,o=dist_v(m.current),a=t?o.addEventListener:o.removeEventListener;a(n?"touchmove":"mousemove",e),a(n?"touchend":"mouseup",r)}return[function(e){var r=e.nativeEvent,n=m.current;if(n&&(dist_h(r),!function(e,r){return r&&!dist_f(e)}(r,_.current)&&n)){if(dist_f(r)){_.current=!0;var o=r.changedTouches||[];o.length&&(b.current=o[0].identifier)}n.focus(),g(dist_d(n,r,b.current)),t(!0)}},function(e){var r=e.which||e.keyCode;r<37||r>40||(e.preventDefault(),p({left:39===r?.05:37===r?-.05:0,top:40===r?.05:38===r?-.05:0}))},t]},[p,g]),C=x[0],E=x[1],H=x[2];return (0,external_React_.useEffect)(function(){return H},[H]),external_React_.createElement("div",dist_u({},s,{onTouchStart:C,onMouseDown:C,className:"react-colorful__interactive",ref:m,onKeyDown:E,tabIndex:0,role:"slider"}))}),dist_g=function(e){return e.filter(Boolean).join(" ")},dist_p=function(r){var t=r.color,n=r.left,o=r.top,a=void 0===o?.5:o,l=dist_g(["react-colorful__pointer",r.className]);return external_React_.createElement("div",{className:l,style:{top:100*a+"%",left:100*n+"%"}},external_React_.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},dist_b=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=Math.pow(10,r)),Math.round(t*e)/t},_={grad:.9,turn:360,rad:360/(2*Math.PI)},dist_x=function(e){return L(C(e))},C=function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?dist_b(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?dist_b(parseInt(e.substring(6,8),16)/255,2):1}},dist_E=function(e,r){return void 0===r&&(r="deg"),Number(e)*(_[r]||1)},dist_H=function(e){var r=/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?dist_N({h:dist_E(r[1],r[2]),s:Number(r[3]),l:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?100:1)}):{h:0,s:0,v:0,a:1}},dist_M=dist_H,dist_N=function(e){var r=e.s,t=e.l;return{h:e.h,s:(r*=(t<50?t:100-t)/100)>0?2*r/(t+r)*100:0,v:t+r,a:e.a}},dist_w=function(e){return K(dist_I(e))},dist_y=function(e){var r=e.s,t=e.v,n=e.a,o=(200-r)*t/100;return{h:dist_b(e.h),s:dist_b(o>0&&o<200?r*t/100/(o<=100?o:200-o)*100:0),l:dist_b(o/2),a:dist_b(n,2)}},q=function(e){var r=dist_y(e);return"hsl("+r.h+", "+r.s+"%, "+r.l+"%)"},dist_k=function(e){var r=dist_y(e);return"hsla("+r.h+", "+r.s+"%, "+r.l+"%, "+r.a+")"},dist_I=function(e){var r=e.h,t=e.s,n=e.v,o=e.a;r=r/360*6,t/=100,n/=100;var a=Math.floor(r),l=n*(1-t),u=n*(1-(r-a)*t),c=n*(1-(1-r+a)*t),i=a%6;return{r:dist_b(255*[n,u,l,l,c,n][i]),g:dist_b(255*[c,n,n,u,l,l][i]),b:dist_b(255*[l,l,c,n,n,u][i]),a:dist_b(o,2)}},dist_O=function(e){var r=/hsva?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?A({h:dist_E(r[1],r[2]),s:Number(r[3]),v:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?100:1)}):{h:0,s:0,v:0,a:1}},dist_j=dist_O,z=function(e){var r=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?L({r:Number(r[1])/(r[2]?100/255:1),g:Number(r[3])/(r[4]?100/255:1),b:Number(r[5])/(r[6]?100/255:1),a:void 0===r[7]?1:Number(r[7])/(r[8]?100:1)}):{h:0,s:0,v:0,a:1}},B=z,D=function(e){var r=e.toString(16);return r.length<2?"0"+r:r},K=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=o<1?D(dist_b(255*o)):"";return"#"+D(r)+D(t)+D(n)+a},L=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=Math.max(r,t,n),l=a-Math.min(r,t,n),u=l?a===r?(t-n)/l:a===t?2+(n-r)/l:4+(r-t)/l:0;return{h:dist_b(60*(u<0?u+6:u)),s:dist_b(a?l/a*100:0),v:dist_b(a/255*100),a:o}},A=function(e){return{h:dist_b(e.h),s:dist_b(e.s),v:dist_b(e.v),a:dist_b(e.a,2)}},dist_S=external_React_.memo(function(r){var t=r.hue,n=r.onChange,o=dist_g(["react-colorful__hue",r.className]);return external_React_.createElement("div",{className:o},external_React_.createElement(dist_m,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:dist_s(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":dist_b(t),"aria-valuemax":"360","aria-valuemin":"0"},external_React_.createElement(dist_p,{className:"react-colorful__hue-pointer",left:t/360,color:q({h:t,s:100,v:100,a:1})})))}),T=external_React_.memo(function(r){var t=r.hsva,n=r.onChange,o={backgroundColor:q({h:t.h,s:100,v:100,a:1})};return external_React_.createElement("div",{className:"react-colorful__saturation",style:o},external_React_.createElement(dist_m,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:dist_s(t.s+100*e.left,0,100),v:dist_s(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+dist_b(t.s)+"%, Brightness "+dist_b(t.v)+"%"},external_React_.createElement(dist_p,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:q(t)})))}),F=function(e,r){if(e===r)return!0;for(var t in e)if(e[t]!==r[t])return!1;return!0},P=function(e,r){return e.replace(/\s/g,"")===r.replace(/\s/g,"")},X=function(e,r){return e.toLowerCase()===r.toLowerCase()||F(C(e),C(r))};function Y(e,t,l){var u=dist_i(l),c=(0,external_React_.useState)(function(){return e.toHsva(t)}),s=c[0],f=c[1],v=(0,external_React_.useRef)({color:t,hsva:s});(0,external_React_.useEffect)(function(){if(!e.equal(t,v.current.color)){var r=e.toHsva(t);v.current={hsva:r,color:t},f(r)}},[t,e]),(0,external_React_.useEffect)(function(){var r;F(s,v.current.hsva)||e.equal(r=e.fromHsva(s),v.current.color)||(v.current={hsva:s,color:r},u(r))},[s,e,u]);var d=(0,external_React_.useCallback)(function(e){f(function(r){return Object.assign({},r,e)})},[]);return[s,d]}var R,dist_V="undefined"!=typeof window?external_React_.useLayoutEffect:external_React_.useEffect,dist_$=function(){return R||( true?__webpack_require__.nc:0)},G=function(e){R=e},J=new Map,Q=function(e){dist_V(function(){var r=e.current?e.current.ownerDocument:document;if(void 0!==r&&!J.has(r)){var t=r.createElement("style");t.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',J.set(r,t);var n=dist_$();n&&t.setAttribute("nonce",n),r.head.appendChild(t)}},[])},U=function(t){var n=t.className,o=t.colorModel,a=t.color,l=void 0===a?o.defaultColor:a,i=t.onChange,s=dist_c(t,["className","colorModel","color","onChange"]),f=(0,external_React_.useRef)(null);Q(f);var v=Y(o,l,i),d=v[0],h=v[1],m=dist_g(["react-colorful",n]);return external_React_.createElement("div",dist_u({},s,{ref:f,className:m}),external_React_.createElement(T,{hsva:d,onChange:h}),external_React_.createElement(dist_S,{hue:d.h,onChange:h,className:"react-colorful__last-control"}))},W={defaultColor:"000",toHsva:dist_x,fromHsva:function(e){return dist_w({h:e.h,s:e.s,v:e.v,a:1})},equal:X},Z=function(r){return e.createElement(U,dist_u({},r,{colorModel:W}))},ee=function(r){var t=r.className,n=r.hsva,o=r.onChange,a={backgroundImage:"linear-gradient(90deg, "+dist_k(Object.assign({},n,{a:0}))+", "+dist_k(Object.assign({},n,{a:1}))+")"},l=dist_g(["react-colorful__alpha",t]),u=dist_b(100*n.a);return external_React_.createElement("div",{className:l},external_React_.createElement("div",{className:"react-colorful__alpha-gradient",style:a}),external_React_.createElement(dist_m,{onMove:function(e){o({a:e.left})},onKey:function(e){o({a:dist_s(n.a+e.left)})},"aria-label":"Alpha","aria-valuetext":u+"%","aria-valuenow":u,"aria-valuemin":"0","aria-valuemax":"100"},external_React_.createElement(dist_p,{className:"react-colorful__alpha-pointer",left:n.a,color:dist_k(n)})))},re=function(t){var n=t.className,o=t.colorModel,a=t.color,l=void 0===a?o.defaultColor:a,i=t.onChange,s=dist_c(t,["className","colorModel","color","onChange"]),f=(0,external_React_.useRef)(null);Q(f);var v=Y(o,l,i),d=v[0],h=v[1],m=dist_g(["react-colorful",n]);return external_React_.createElement("div",dist_u({},s,{ref:f,className:m}),external_React_.createElement(T,{hsva:d,onChange:h}),external_React_.createElement(dist_S,{hue:d.h,onChange:h}),external_React_.createElement(ee,{hsva:d,onChange:h,className:"react-colorful__last-control"}))},te={defaultColor:"0001",toHsva:dist_x,fromHsva:dist_w,equal:X},ne=function(r){return e.createElement(re,dist_u({},r,{colorModel:te}))},oe={defaultColor:{h:0,s:0,l:0,a:1},toHsva:dist_N,fromHsva:dist_y,equal:F},ae=function(r){return e.createElement(re,dist_u({},r,{colorModel:oe}))},le={defaultColor:"hsla(0, 0%, 0%, 1)",toHsva:dist_H,fromHsva:dist_k,equal:P},ue=function(r){return e.createElement(re,dist_u({},r,{colorModel:le}))},ce={defaultColor:{h:0,s:0,l:0},toHsva:function(e){return dist_N({h:e.h,s:e.s,l:e.l,a:1})},fromHsva:function(e){return{h:(r=dist_y(e)).h,s:r.s,l:r.l};var r},equal:F},ie=function(r){return e.createElement(U,dist_u({},r,{colorModel:ce}))},se={defaultColor:"hsl(0, 0%, 0%)",toHsva:dist_M,fromHsva:q,equal:P},fe=function(r){return e.createElement(U,dist_u({},r,{colorModel:se}))},ve={defaultColor:{h:0,s:0,v:0,a:1},toHsva:function(e){return e},fromHsva:A,equal:F},de=function(r){return e.createElement(re,dist_u({},r,{colorModel:ve}))},he={defaultColor:"hsva(0, 0%, 0%, 1)",toHsva:dist_O,fromHsva:function(e){var r=A(e);return"hsva("+r.h+", "+r.s+"%, "+r.v+"%, "+r.a+")"},equal:P},me=function(r){return e.createElement(re,dist_u({},r,{colorModel:he}))},ge={defaultColor:{h:0,s:0,v:0},toHsva:function(e){return{h:e.h,s:e.s,v:e.v,a:1}},fromHsva:function(e){var r=A(e);return{h:r.h,s:r.s,v:r.v}},equal:F},pe=function(r){return e.createElement(U,dist_u({},r,{colorModel:ge}))},be={defaultColor:"hsv(0, 0%, 0%)",toHsva:dist_j,fromHsva:function(e){var r=A(e);return"hsv("+r.h+", "+r.s+"%, "+r.v+"%)"},equal:P},_e=function(r){return e.createElement(U,dist_u({},r,{colorModel:be}))},xe={defaultColor:{r:0,g:0,b:0,a:1},toHsva:L,fromHsva:dist_I,equal:F},Ce=function(r){return e.createElement(re,dist_u({},r,{colorModel:xe}))},Ee={defaultColor:"rgba(0, 0, 0, 1)",toHsva:z,fromHsva:function(e){var r=dist_I(e);return"rgba("+r.r+", "+r.g+", "+r.b+", "+r.a+")"},equal:P},He=function(r){return external_React_.createElement(re,dist_u({},r,{colorModel:Ee}))},Me={defaultColor:{r:0,g:0,b:0},toHsva:function(e){return L({r:e.r,g:e.g,b:e.b,a:1})},fromHsva:function(e){return{r:(r=dist_I(e)).r,g:r.g,b:r.b};var r},equal:F},Ne=function(r){return e.createElement(U,dist_u({},r,{colorModel:Me}))},we={defaultColor:"rgb(0, 0, 0)",toHsva:B,fromHsva:function(e){var r=dist_I(e);return"rgb("+r.r+", "+r.g+", "+r.b+")"},equal:P},ye=function(r){return external_React_.createElement(U,dist_u({},r,{colorModel:we}))},qe=/^#?([0-9A-F]{3,8})$/i,ke=function(r){var t=r.color,l=void 0===t?"":t,s=r.onChange,f=r.onBlur,v=r.escape,d=r.validate,h=r.format,m=r.process,g=dist_c(r,["color","onChange","onBlur","escape","validate","format","process"]),p=o(function(){return v(l)}),b=p[0],_=p[1],x=dist_i(s),C=dist_i(f),E=a(function(e){var r=v(e.target.value);_(r),d(r)&&x(m?m(r):r)},[v,m,d,x]),H=a(function(e){d(e.target.value)||_(v(l)),C(e)},[l,v,d,C]);return n(function(){_(v(l))},[l,v]),e.createElement("input",dist_u({},g,{value:h?h(b):b,spellCheck:"false",onChange:E,onBlur:H}))},Ie=function(e){return"#"+e},Oe=function(r){var t=r.prefixed,n=r.alpha,o=dist_c(r,["prefixed","alpha"]),l=a(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),i=a(function(e){return function(e,r){var t=qe.exec(e),n=t?t[1].length:0;return 3===n||6===n||!!r&&4===n||!!r&&8===n}(e,n)},[n]);return e.createElement(ke,dist_u({},o,{escape:l,format:t?Ie:void 0,process:Ie,validate:i}))};
//# sourceMappingURL=index.module.js.map
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/picker.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Track the start and the end of drag pointer events related to controlling
* the picker's saturation / hue / alpha, and fire the corresponding callbacks.
* This is particularly useful to implement synergies like the one with the
* `Popover` component, where a pointer events "trap" is rendered while
* the user is dragging the pointer to avoid potential interference with iframe
* elements.
*
* @param props
* @param props.containerEl
* @param props.onDragStart
* @param props.onDragEnd
*/
const useOnPickerDrag = ({
containerEl,
onDragStart,
onDragEnd
}) => {
const isDragging = (0,external_wp_element_namespaceObject.useRef)(false);
const leftWhileDragging = (0,external_wp_element_namespaceObject.useRef)(false);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!containerEl || !onDragStart && !onDragEnd) {
return;
}
const interactiveElements = [containerEl.querySelector('.react-colorful__saturation'), containerEl.querySelector('.react-colorful__hue'), containerEl.querySelector('.react-colorful__alpha')].filter(el => !!el);
if (interactiveElements.length === 0) {
return;
}
const doc = containerEl.ownerDocument;
const onPointerUp = event => {
isDragging.current = false;
leftWhileDragging.current = false;
onDragEnd?.(event);
};
const onPointerDown = event => {
isDragging.current = true;
onDragStart?.(event);
};
const onPointerLeave = () => {
leftWhileDragging.current = isDragging.current;
};
// Try to detect if the user released the pointer while away from the
// current window. If the check is successfull, the dragEnd callback will
// called as soon as the pointer re-enters the window (better late than never)
const onPointerEnter = event => {
const noPointerButtonsArePressed = event.buttons === 0;
if (leftWhileDragging.current && noPointerButtonsArePressed) {
onPointerUp(event);
}
};
// The pointerdown event is added on the interactive elements,
// while the remaining events are added on the document object since
// the pointer wouldn't necessarily be hovering the initial interactive
// element at that point.
interactiveElements.forEach(el => el.addEventListener('pointerdown', onPointerDown));
doc.addEventListener('pointerup', onPointerUp);
doc.addEventListener('pointerenter', onPointerEnter);
doc.addEventListener('pointerleave', onPointerLeave);
return () => {
interactiveElements.forEach(el => el.removeEventListener('pointerdown', onPointerDown));
doc.removeEventListener('pointerup', onPointerUp);
doc.removeEventListener('pointerenter', onPointerEnter);
doc.removeEventListener('pointerleave', onPointerUp);
};
}, [onDragStart, onDragEnd, containerEl]);
};
const Picker = ({
color,
enableAlpha,
onChange,
onDragStart,
onDragEnd,
containerEl
}) => {
const Component = enableAlpha ? He : ye;
const rgbColor = (0,external_wp_element_namespaceObject.useMemo)(() => color.toRgbString(), [color]);
useOnPickerDrag({
containerEl,
onDragStart,
onDragEnd
});
return (0,external_React_.createElement)(Component, {
color: rgbColor,
onChange: nextColor => {
onChange(w(nextColor));
}
});
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/component.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
k([names]);
const options = [{
label: 'RGB',
value: 'rgb'
}, {
label: 'HSL',
value: 'hsl'
}, {
label: 'Hex',
value: 'hex'
}];
const UnconnectedColorPicker = (props, forwardedRef) => {
const {
enableAlpha = false,
color: colorProp,
onChange,
defaultValue = '#fff',
copyFormat,
// Context
onPickerDragStart,
onPickerDragEnd,
...divProps
} = useContextSystem(props, 'ColorPicker');
const [containerEl, setContainerEl] = (0,external_wp_element_namespaceObject.useState)(null);
const containerRef = node => {
setContainerEl(node);
};
// Use a safe default value for the color and remove the possibility of `undefined`.
const [color, setColor] = useControlledValue({
onChange,
value: colorProp,
defaultValue
});
const safeColordColor = (0,external_wp_element_namespaceObject.useMemo)(() => {
return w(color || '');
}, [color]);
const debouncedSetColor = (0,external_wp_compose_namespaceObject.useDebounce)(setColor);
const handleChange = (0,external_wp_element_namespaceObject.useCallback)(nextValue => {
debouncedSetColor(nextValue.toHex());
}, [debouncedSetColor]);
const [colorType, setColorType] = (0,external_wp_element_namespaceObject.useState)(copyFormat || 'hex');
return (0,external_React_.createElement)(ColorfulWrapper, {
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([containerRef, forwardedRef]),
...divProps
}, (0,external_React_.createElement)(Picker, {
containerEl: containerEl,
onChange: handleChange,
color: safeColordColor,
enableAlpha: enableAlpha,
onDragStart: onPickerDragStart,
onDragEnd: onPickerDragEnd
}), (0,external_React_.createElement)(AuxiliaryColorArtefactWrapper, null, (0,external_React_.createElement)(AuxiliaryColorArtefactHStackHeader, {
justify: "space-between"
}, (0,external_React_.createElement)(styles_SelectControl, {
__nextHasNoMarginBottom: true,
options: options,
value: colorType,
onChange: nextColorType => setColorType(nextColorType),
label: (0,external_wp_i18n_namespaceObject.__)('Color format'),
hideLabelFromVision: true
}), (0,external_React_.createElement)(ColorCopyButton, {
color: safeColordColor,
colorType: copyFormat || colorType
})), (0,external_React_.createElement)(ColorInputWrapper, {
direction: "column",
gap: 2
}, (0,external_React_.createElement)(ColorInput, {
colorType: colorType,
color: safeColordColor,
onChange: handleChange,
enableAlpha: enableAlpha
}))));
};
const ColorPicker = contextConnect(UnconnectedColorPicker, 'ColorPicker');
/* harmony default export */ const color_picker_component = (ColorPicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/use-deprecated-props.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function isLegacyProps(props) {
return typeof props.onChangeComplete !== 'undefined' || typeof props.disableAlpha !== 'undefined' || typeof props.color?.hex === 'string';
}
function getColorFromLegacyProps(color) {
if (color === undefined) return;
if (typeof color === 'string') return color;
if (color.hex) return color.hex;
return undefined;
}
const transformColorStringToLegacyColor = memize(color => {
const colordColor = w(color);
const hex = colordColor.toHex();
const rgb = colordColor.toRgb();
const hsv = colordColor.toHsv();
const hsl = colordColor.toHsl();
return {
hex,
rgb,
hsv,
hsl,
source: 'hex',
oldHue: hsl.h
};
});
function use_deprecated_props_useDeprecatedProps(props) {
const {
onChangeComplete
} = props;
const legacyChangeHandler = (0,external_wp_element_namespaceObject.useCallback)(color => {
onChangeComplete(transformColorStringToLegacyColor(color));
}, [onChangeComplete]);
if (isLegacyProps(props)) {
return {
color: getColorFromLegacyProps(props.color),
enableAlpha: !props.disableAlpha,
onChange: legacyChangeHandler
};
}
return {
...props,
color: props.color,
enableAlpha: props.enableAlpha,
onChange: props.onChange
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/legacy-adapter.js
/**
* Internal dependencies
*/
const LegacyAdapter = props => {
return (0,external_React_.createElement)(color_picker_component, {
...use_deprecated_props_useDeprecatedProps(props)
});
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/circular-option-picker/circular-option-picker-context.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const CircularOptionPickerContext = (0,external_wp_element_namespaceObject.createContext)({});
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
/**
* WordPress dependencies
*/
const check = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const library_check = (check);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/circular-option-picker/circular-option-picker-option.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedOptionAsButton(props, forwardedRef) {
const {
isPressed,
...additionalProps
} = props;
return (0,external_React_.createElement)(build_module_button, {
...additionalProps,
"aria-pressed": isPressed,
ref: forwardedRef
});
}
const OptionAsButton = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedOptionAsButton);
function UnforwardedOptionAsOption(props, forwardedRef) {
const {
id,
isSelected,
compositeStore,
...additionalProps
} = props;
const activeId = compositeStore.useState('activeId');
if (isSelected && !activeId) {
compositeStore.setActiveId(id);
}
return (0,external_React_.createElement)(CompositeItem, {
render: (0,external_React_.createElement)(build_module_button, {
...additionalProps,
role: "option",
"aria-selected": !!isSelected,
ref: forwardedRef
}),
store: compositeStore,
id: id
});
}
const OptionAsOption = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedOptionAsOption);
function Option({
className,
isSelected,
selectedIconProps = {},
tooltipText,
...additionalProps
}) {
const {
baseId,
compositeStore
} = (0,external_wp_element_namespaceObject.useContext)(CircularOptionPickerContext);
const id = (0,external_wp_compose_namespaceObject.useInstanceId)(Option, baseId || 'components-circular-option-picker__option');
const commonProps = {
id,
className: 'components-circular-option-picker__option',
...additionalProps
};
const optionControl = compositeStore ? (0,external_React_.createElement)(OptionAsOption, {
...commonProps,
compositeStore: compositeStore,
isSelected: isSelected
}) : (0,external_React_.createElement)(OptionAsButton, {
...commonProps,
isPressed: isSelected
});
return (0,external_React_.createElement)("div", {
className: classnames_default()(className, 'components-circular-option-picker__option-wrapper')
}, tooltipText ? (0,external_React_.createElement)(tooltip, {
text: tooltipText
}, optionControl) : optionControl, isSelected && (0,external_React_.createElement)(icons_build_module_icon, {
icon: library_check,
...selectedIconProps
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/circular-option-picker/circular-option-picker-option-group.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function OptionGroup({
className,
options,
...additionalProps
}) {
const role = 'aria-label' in additionalProps || 'aria-labelledby' in additionalProps ? 'group' : undefined;
return (0,external_React_.createElement)("div", {
...additionalProps,
role: role,
className: classnames_default()('components-circular-option-picker__option-group', 'components-circular-option-picker__swatches', className)
}, options);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/circular-option-picker/circular-option-picker-actions.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function DropdownLinkAction({
buttonProps,
className,
dropdownProps,
linkText
}) {
return (0,external_React_.createElement)(dropdown, {
className: classnames_default()('components-circular-option-picker__dropdown-link-action', className),
renderToggle: ({
isOpen,
onToggle
}) => (0,external_React_.createElement)(build_module_button, {
"aria-expanded": isOpen,
"aria-haspopup": "true",
onClick: onToggle,
variant: "link",
...buttonProps
}, linkText),
...dropdownProps
});
}
function ButtonAction({
className,
children,
...additionalProps
}) {
return (0,external_React_.createElement)(build_module_button, {
className: classnames_default()('components-circular-option-picker__clear', className),
variant: "tertiary",
...additionalProps
}, children);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/circular-option-picker/circular-option-picker.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
*`CircularOptionPicker` is a component that displays a set of options as circular buttons.
*
* ```jsx
* import { CircularOptionPicker } from '../circular-option-picker';
* import { useState } from '@wordpress/element';
*
* const Example = () => {
* const [ currentColor, setCurrentColor ] = useState();
* const colors = [
* { color: '#f00', name: 'Red' },
* { color: '#0f0', name: 'Green' },
* { color: '#00f', name: 'Blue' },
* ];
* const colorOptions = (
* <>
* { colors.map( ( { color, name }, index ) => {
* return (
* <CircularOptionPicker.Option
* key={ `${ color }-${ index }` }
* tooltipText={ name }
* style={ { backgroundColor: color, color } }
* isSelected={ index === currentColor }
* onClick={ () => setCurrentColor( index ) }
* aria-label={ name }
* />
* );
* } ) }
* </>
* );
* return (
* <CircularOptionPicker
* options={ colorOptions }
* actions={
* <CircularOptionPicker.ButtonAction
* onClick={ () => setCurrentColor( undefined ) }
* >
* { 'Clear' }
* </CircularOptionPicker.ButtonAction>
* }
* />
* );
* };
* ```
*/
function ListboxCircularOptionPicker(props) {
const {
actions,
options,
baseId,
className,
loop = true,
children,
...additionalProps
} = props;
const compositeStore = useCompositeStore({
focusLoop: loop,
rtl: (0,external_wp_i18n_namespaceObject.isRTL)()
});
const compositeContext = {
baseId,
compositeStore
};
return (0,external_React_.createElement)("div", {
className: className
}, (0,external_React_.createElement)(CircularOptionPickerContext.Provider, {
value: compositeContext
}, (0,external_React_.createElement)(Composite, {
...additionalProps,
id: baseId,
store: compositeStore,
role: 'listbox'
}, options), children, actions));
}
function ButtonsCircularOptionPicker(props) {
const {
actions,
options,
children,
baseId,
...additionalProps
} = props;
return (0,external_React_.createElement)("div", {
...additionalProps,
id: baseId
}, (0,external_React_.createElement)(CircularOptionPickerContext.Provider, {
value: {
baseId
}
}, options, children, actions));
}
function CircularOptionPicker(props) {
const {
asButtons,
actions: actionsProp,
options: optionsProp,
children,
className,
...additionalProps
} = props;
const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(CircularOptionPicker, 'components-circular-option-picker', additionalProps.id);
const OptionPickerImplementation = asButtons ? ButtonsCircularOptionPicker : ListboxCircularOptionPicker;
const actions = actionsProp ? (0,external_React_.createElement)("div", {
className: "components-circular-option-picker__custom-clear-wrapper"
}, actionsProp) : undefined;
const options = (0,external_React_.createElement)("div", {
className: 'components-circular-option-picker__swatches'
}, optionsProp);
return (0,external_React_.createElement)(OptionPickerImplementation, {
...additionalProps,
baseId: baseId,
className: classnames_default()('components-circular-option-picker', className),
actions: actions,
options: options
}, children);
}
CircularOptionPicker.Option = Option;
CircularOptionPicker.OptionGroup = OptionGroup;
CircularOptionPicker.ButtonAction = ButtonAction;
CircularOptionPicker.DropdownLinkAction = DropdownLinkAction;
/* harmony default export */ const circular_option_picker = (CircularOptionPicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/circular-option-picker/index.js
/**
* Internal dependencies
*/
/* harmony default export */ const build_module_circular_option_picker = (circular_option_picker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/v-stack/hook.js
/**
* Internal dependencies
*/
function useVStack(props) {
const {
expanded = false,
alignment = 'stretch',
...otherProps
} = useContextSystem(props, 'VStack');
const hStackProps = useHStack({
direction: 'column',
expanded,
alignment,
...otherProps
});
return hStackProps;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/v-stack/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedVStack(props, forwardedRef) {
const vStackProps = useVStack(props);
return (0,external_React_.createElement)(component, {
...vStackProps,
ref: forwardedRef
});
}
/**
* `VStack` (or Vertical Stack) is a layout component that arranges child
* elements in a vertical line.
*
* `VStack` can render anything inside.
*
* ```jsx
* import {
* __experimentalText as Text,
* __experimentalVStack as VStack,
* } from `@wordpress/components`;
*
* function Example() {
* return (
* <VStack>
* <Text>Code</Text>
* <Text>is</Text>
* <Text>Poetry</Text>
* </VStack>
* );
* }
* ```
*/
const VStack = contextConnect(UnconnectedVStack, 'VStack');
/* harmony default export */ const v_stack_component = (VStack);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedTruncate(props, forwardedRef) {
const truncateProps = useTruncate(props);
return (0,external_React_.createElement)(component, {
as: "span",
...truncateProps,
ref: forwardedRef
});
}
/**
* `Truncate` is a typography primitive that trims text content.
* For almost all cases, it is recommended that `Text`, `Heading`, or
* `Subheading` is used to render text content. However,`Truncate` is
* available for custom implementations.
*
* ```jsx
* import { __experimentalTruncate as Truncate } from `@wordpress/components`;
*
* function Example() {
* return (
* <Truncate>
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ex
* neque, vulputate a diam et, luctus convallis lacus. Vestibulum ac
* mollis mi. Morbi id elementum massa.
* </Truncate>
* );
* }
* ```
*/
const component_Truncate = contextConnect(UnconnectedTruncate, 'Truncate');
/* harmony default export */ const truncate_component = (component_Truncate);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/heading/hook.js
/**
* Internal dependencies
*/
function useHeading(props) {
const {
as: asProp,
level = 2,
color = COLORS.gray[900],
isBlock = true,
weight = config_values.fontWeightHeading,
...otherProps
} = useContextSystem(props, 'Heading');
const as = asProp || `h${level}`;
const a11yProps = {};
if (typeof as === 'string' && as[0] !== 'h') {
// If not a semantic `h` element, add a11y props:
a11yProps.role = 'heading';
a11yProps['aria-level'] = typeof level === 'string' ? parseInt(level) : level;
}
const textProps = useText({
color,
isBlock,
weight,
size: getHeadingFontSize(level),
...otherProps
});
return {
...textProps,
...a11yProps,
as
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/heading/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedHeading(props, forwardedRef) {
const headerProps = useHeading(props);
return (0,external_React_.createElement)(component, {
...headerProps,
ref: forwardedRef
});
}
/**
* `Heading` renders headings and titles using the library's typography system.
*
* ```jsx
* import { __experimentalHeading as Heading } from "@wordpress/components";
*
* function Example() {
* return <Heading>Code is Poetry</Heading>;
* }
* ```
*/
const Heading = contextConnect(UnconnectedHeading, 'Heading');
/* harmony default export */ const heading_component = (Heading);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-palette/styles.js
function color_palette_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const ColorHeading = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? {
target: "ev9wop70"
} : 0)( true ? {
name: "13lxv2o",
styles: "text-transform:uppercase;line-height:24px;font-weight:500;&&&{font-size:11px;margin-bottom:0;}"
} : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown/styles.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const padding = ({
paddingSize = 'small'
}) => {
if (paddingSize === 'none') return;
const paddingValues = {
small: space(2),
medium: space(4)
};
return /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingValues[paddingSize] || paddingValues.small, ";" + ( true ? "" : 0), true ? "" : 0);
};
const DropdownContentWrapperDiv = emotion_styled_base_browser_esm("div", true ? {
target: "eovvns30"
} : 0)("margin-left:", space(-2), ";margin-right:", space(-2), ";&:first-of-type{margin-top:", space(-2), ";}&:last-of-type{margin-bottom:", space(-2), ";}", padding, ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown/dropdown-content-wrapper.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedDropdownContentWrapper(props, forwardedRef) {
const {
paddingSize = 'small',
...derivedProps
} = useContextSystem(props, 'DropdownContentWrapper');
return (0,external_React_.createElement)(DropdownContentWrapperDiv, {
...derivedProps,
paddingSize: paddingSize,
ref: forwardedRef
});
}
/**
* A convenience wrapper for the `renderContent` when you want to apply
* different padding. (Default is `paddingSize="small"`).
*
* ```jsx
* import {
* Dropdown,
* __experimentalDropdownContentWrapper as DropdownContentWrapper,
* } from '@wordpress/components';
*
* <Dropdown
* renderContent={ () => (
* <DropdownContentWrapper paddingSize="medium">
* My dropdown content
* </DropdownContentWrapper>
* ) }
* />
* ```
*/
const DropdownContentWrapper = contextConnect(UnconnectedDropdownContentWrapper, 'DropdownContentWrapper');
/* harmony default export */ const dropdown_content_wrapper = (DropdownContentWrapper);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-palette/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
k([names, a11y]);
const extractColorNameFromCurrentValue = (currentValue, colors = [], showMultiplePalettes = false) => {
if (!currentValue) {
return '';
}
const currentValueIsCssVariable = /^var\(/.test(currentValue);
const normalizedCurrentValue = currentValueIsCssVariable ? currentValue : w(currentValue).toHex();
// Normalize format of `colors` to simplify the following loop
const colorPalettes = showMultiplePalettes ? colors : [{
colors: colors
}];
for (const {
colors: paletteColors
} of colorPalettes) {
for (const {
name: colorName,
color: colorValue
} of paletteColors) {
const normalizedColorValue = currentValueIsCssVariable ? colorValue : w(colorValue).toHex();
if (normalizedCurrentValue === normalizedColorValue) {
return colorName;
}
}
}
// translators: shown when the user has picked a custom color (i.e not in the palette of colors).
return (0,external_wp_i18n_namespaceObject.__)('Custom');
};
// The PaletteObject type has a `colors` property (an array of ColorObject),
// while the ColorObject type has a `color` property (the CSS color value).
const isMultiplePaletteObject = obj => Array.isArray(obj.colors) && !('color' in obj);
const isMultiplePaletteArray = arr => {
return arr.length > 0 && arr.every(colorObj => isMultiplePaletteObject(colorObj));
};
/**
* Transform a CSS variable used as background color into the color value itself.
*
* @param value The color value that may be a CSS variable.
* @param element The element for which to get the computed style.
* @return The background color value computed from a element.
*/
const normalizeColorValue = (value, element) => {
const currentValueIsCssVariable = /^var\(/.test(value !== null && value !== void 0 ? value : '');
if (!currentValueIsCssVariable || element === null) {
return value;
}
const {
ownerDocument
} = element;
const {
defaultView
} = ownerDocument;
const computedBackgroundColor = defaultView?.getComputedStyle(element).backgroundColor;
return computedBackgroundColor ? w(computedBackgroundColor).toHex() : value;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-palette/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
k([names, a11y]);
function SinglePalette({
className,
clearColor,
colors,
onChange,
value,
...additionalProps
}) {
const colorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
return colors.map(({
color,
name
}, index) => {
const colordColor = w(color);
const isSelected = value === color;
return (0,external_React_.createElement)(build_module_circular_option_picker.Option, {
key: `${color}-${index}`,
isSelected: isSelected,
selectedIconProps: isSelected ? {
fill: colordColor.contrast() > colordColor.contrast('#000') ? '#fff' : '#000'
} : {},
tooltipText: name ||
// translators: %s: color hex code e.g: "#f00".
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Color code: %s'), color),
style: {
backgroundColor: color,
color
},
onClick: isSelected ? clearColor : () => onChange(color, index),
"aria-label": name ?
// translators: %s: The name of the color e.g: "vivid red".
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Color: %s'), name) :
// translators: %s: color hex code e.g: "#f00".
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Color code: %s'), color)
});
});
}, [colors, value, onChange, clearColor]);
return (0,external_React_.createElement)(build_module_circular_option_picker.OptionGroup, {
className: className,
options: colorOptions,
...additionalProps
});
}
function MultiplePalettes({
className,
clearColor,
colors,
onChange,
value,
headingLevel
}) {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(MultiplePalettes, 'color-palette');
if (colors.length === 0) {
return null;
}
return (0,external_React_.createElement)(v_stack_component, {
spacing: 3,
className: className
}, colors.map(({
name,
colors: colorPalette
}, index) => {
const id = `${instanceId}-${index}`;
return (0,external_React_.createElement)(v_stack_component, {
spacing: 2,
key: index
}, (0,external_React_.createElement)(ColorHeading, {
id: id,
level: headingLevel
}, name), (0,external_React_.createElement)(SinglePalette, {
clearColor: clearColor,
colors: colorPalette,
onChange: newColor => onChange(newColor, index),
value: value,
"aria-labelledby": id
}));
}));
}
function CustomColorPickerDropdown({
isRenderedInSidebar,
popoverProps: receivedPopoverProps,
...props
}) {
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
shift: true,
// Disabling resize as it would otherwise cause the popover to show
// scrollbars while dragging the color picker's handle close to the
// popover edge.
resize: false,
...(isRenderedInSidebar ? {
// When in the sidebar: open to the left (stacking),
// leaving the same gap as the parent popover.
placement: 'left-start',
offset: 34
} : {
// Default behavior: open below the anchor
placement: 'bottom',
offset: 8
}),
...receivedPopoverProps
}), [isRenderedInSidebar, receivedPopoverProps]);
return (0,external_React_.createElement)(dropdown, {
contentClassName: "components-color-palette__custom-color-dropdown-content",
popoverProps: popoverProps,
...props
});
}
function UnforwardedColorPalette(props, forwardedRef) {
const {
asButtons,
loop,
clearable = true,
colors = [],
disableCustomColors = false,
enableAlpha = false,
onChange,
value,
__experimentalIsRenderedInSidebar = false,
headingLevel = 2,
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledby,
...additionalProps
} = props;
const [normalizedColorValue, setNormalizedColorValue] = (0,external_wp_element_namespaceObject.useState)(value);
const clearColor = (0,external_wp_element_namespaceObject.useCallback)(() => onChange(undefined), [onChange]);
const customColorPaletteCallbackRef = (0,external_wp_element_namespaceObject.useCallback)(node => {
setNormalizedColorValue(normalizeColorValue(value, node));
}, [value]);
const hasMultipleColorOrigins = isMultiplePaletteArray(colors);
const buttonLabelName = (0,external_wp_element_namespaceObject.useMemo)(() => extractColorNameFromCurrentValue(value, colors, hasMultipleColorOrigins), [value, colors, hasMultipleColorOrigins]);
const renderCustomColorPicker = () => (0,external_React_.createElement)(dropdown_content_wrapper, {
paddingSize: "none"
}, (0,external_React_.createElement)(LegacyAdapter, {
color: normalizedColorValue,
onChange: color => onChange(color),
enableAlpha: enableAlpha
}));
const isHex = value?.startsWith('#');
// Leave hex values as-is. Remove the `var()` wrapper from CSS vars.
const displayValue = value?.replace(/^var\((.+)\)$/, '$1');
const customColorAccessibleLabel = !!displayValue ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1$s: The name of the color e.g: "vivid red". %2$s: The color's hex code e.g: "#f00".
(0,external_wp_i18n_namespaceObject.__)('Custom color picker. The currently selected color is called "%1$s" and has a value of "%2$s".'), buttonLabelName, displayValue) : (0,external_wp_i18n_namespaceObject.__)('Custom color picker.');
const paletteCommonProps = {
clearColor,
onChange,
value
};
const actions = !!clearable && (0,external_React_.createElement)(build_module_circular_option_picker.ButtonAction, {
onClick: clearColor
}, (0,external_wp_i18n_namespaceObject.__)('Clear'));
let metaProps;
if (asButtons) {
metaProps = {
asButtons: true
};
} else {
const _metaProps = {
asButtons: false,
loop
};
if (ariaLabel) {
metaProps = {
..._metaProps,
'aria-label': ariaLabel
};
} else if (ariaLabelledby) {
metaProps = {
..._metaProps,
'aria-labelledby': ariaLabelledby
};
} else {
metaProps = {
..._metaProps,
'aria-label': (0,external_wp_i18n_namespaceObject.__)('Custom color picker.')
};
}
}
return (0,external_React_.createElement)(v_stack_component, {
spacing: 3,
ref: forwardedRef,
...additionalProps
}, !disableCustomColors && (0,external_React_.createElement)(CustomColorPickerDropdown, {
isRenderedInSidebar: __experimentalIsRenderedInSidebar,
renderContent: renderCustomColorPicker,
renderToggle: ({
isOpen,
onToggle
}) => (0,external_React_.createElement)(v_stack_component, {
className: "components-color-palette__custom-color-wrapper",
spacing: 0
}, (0,external_React_.createElement)("button", {
ref: customColorPaletteCallbackRef,
className: "components-color-palette__custom-color-button",
"aria-expanded": isOpen,
"aria-haspopup": "true",
onClick: onToggle,
"aria-label": customColorAccessibleLabel,
style: {
background: value
},
type: "button"
}), (0,external_React_.createElement)(v_stack_component, {
className: "components-color-palette__custom-color-text-wrapper",
spacing: 0.5
}, (0,external_React_.createElement)(truncate_component, {
className: "components-color-palette__custom-color-name"
}, value ? buttonLabelName : (0,external_wp_i18n_namespaceObject.__)('No color selected')), (0,external_React_.createElement)(truncate_component, {
className: classnames_default()('components-color-palette__custom-color-value', {
'components-color-palette__custom-color-value--is-hex': isHex
})
}, displayValue)))
}), (0,external_React_.createElement)(build_module_circular_option_picker, {
...metaProps,
actions: actions,
options: hasMultipleColorOrigins ? (0,external_React_.createElement)(MultiplePalettes, {
...paletteCommonProps,
headingLevel: headingLevel,
colors: colors,
value: value
}) : (0,external_React_.createElement)(SinglePalette, {
...paletteCommonProps,
colors: colors,
value: value
})
}));
}
/**
* Allows the user to pick a color from a list of pre-defined color entries.
*
* ```jsx
* import { ColorPalette } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyColorPalette = () => {
* const [ color, setColor ] = useState ( '#f00' )
* const colors = [
* { name: 'red', color: '#f00' },
* { name: 'white', color: '#fff' },
* { name: 'blue', color: '#00f' },
* ];
* return (
* <ColorPalette
* colors={ colors }
* value={ color }
* onChange={ ( color ) => setColor( color ) }
* />
* );
* } );
* ```
*/
const ColorPalette = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedColorPalette);
/* harmony default export */ const color_palette = (ColorPalette);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/styles/unit-control-styles.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
// Using `selectSize` instead of `size` to avoid a type conflict with the
// `size` HTML attribute of the `select` element.
// TODO: Resolve need to use &&& to increase specificity
// https://github.com/WordPress/gutenberg/issues/18483
const ValueInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
target: "e1bagdl32"
} : 0)("&&&{input{display:block;width:100%;}", BackdropUI, "{transition:box-shadow 0.1s linear;}}" + ( true ? "" : 0));
const baseUnitLabelStyles = ({
selectSize
}) => {
const sizes = {
small: /*#__PURE__*/emotion_react_browser_esm_css("box-sizing:border-box;padding:2px 1px;width:20px;color:", COLORS.gray[800], ";font-size:8px;line-height:1;letter-spacing:-0.5px;text-transform:uppercase;text-align-last:center;" + ( true ? "" : 0), true ? "" : 0),
default: /*#__PURE__*/emotion_react_browser_esm_css("box-sizing:border-box;min-width:24px;max-width:48px;height:24px;margin-inline-end:", space(2), ";padding:", space(1), ";color:", COLORS.theme.accent, ";font-size:13px;line-height:1;text-align-last:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" + ( true ? "" : 0), true ? "" : 0)
};
return sizes[selectSize];
};
const UnitLabel = emotion_styled_base_browser_esm("div", true ? {
target: "e1bagdl31"
} : 0)("&&&{pointer-events:none;", baseUnitLabelStyles, ";color:", COLORS.gray[900], ";}" + ( true ? "" : 0));
const unitSelectSizes = ({
selectSize = 'default'
}) => {
const sizes = {
small: /*#__PURE__*/emotion_react_browser_esm_css("height:100%;border:1px solid transparent;transition:box-shadow 0.1s linear,border 0.1s linear;", rtl({
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0
})(), " &:not(:disabled):hover{background-color:", COLORS.gray[100], ";}&:focus{border:1px solid ", COLORS.ui.borderFocus, ";box-shadow:inset 0 0 0 ", config_values.borderWidth + ' ' + COLORS.ui.borderFocus, ";outline-offset:0;outline:2px solid transparent;z-index:1;}" + ( true ? "" : 0), true ? "" : 0),
default: /*#__PURE__*/emotion_react_browser_esm_css("display:flex;justify-content:center;align-items:center;&:hover{color:", COLORS.ui.borderFocus, ";box-shadow:inset 0 0 0 ", config_values.borderWidth + ' ' + COLORS.ui.borderFocus, ";outline:", config_values.borderWidth, " solid transparent;}&:focus{box-shadow:0 0 0 ", config_values.borderWidthFocus + ' ' + COLORS.ui.borderFocus, ";outline:", config_values.borderWidthFocus, " solid transparent;}" + ( true ? "" : 0), true ? "" : 0)
};
return sizes[selectSize];
};
const UnitSelect = emotion_styled_base_browser_esm("select", true ? {
target: "e1bagdl30"
} : 0)("&&&{appearance:none;background:transparent;border-radius:2px;border:none;display:block;outline:none;margin:0;min-height:auto;font-family:inherit;", baseUnitLabelStyles, ";", unitSelectSizes, ";&:not( :disabled ){cursor:pointer;}}" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/styles.js
function border_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const styles_labelStyles = true ? {
name: "f3vz0n",
styles: "font-weight:500"
} : 0;
const focusBoxShadow = /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:inset ", config_values.controlBoxShadowFocus, ";" + ( true ? "" : 0), true ? "" : 0);
const borderControl = /*#__PURE__*/emotion_react_browser_esm_css("border:0;padding:0;margin:0;", boxSizingReset, ";" + ( true ? "" : 0), true ? "" : 0);
const innerWrapper = () => /*#__PURE__*/emotion_react_browser_esm_css(ValueInput, "{flex:1 1 40%;}&& ", UnitSelect, "{min-height:0;}" + ( true ? "" : 0), true ? "" : 0);
/*
* This style is only applied to the UnitControl wrapper when the border width
* field should be a set width. Omitting this allows the UnitControl &
* RangeControl to share the available width in a 40/60 split respectively.
*/
const styles_wrapperWidth = /*#__PURE__*/emotion_react_browser_esm_css(ValueInput, "{flex:0 0 auto;}" + ( true ? "" : 0), true ? "" : 0);
const wrapperHeight = size => {
return /*#__PURE__*/emotion_react_browser_esm_css("height:", size === '__unstable-large' ? '40px' : '30px', ";" + ( true ? "" : 0), true ? "" : 0);
};
const borderControlDropdown = /*#__PURE__*/emotion_react_browser_esm_css("background:#fff;&&>button{aspect-ratio:1;padding:0;display:flex;align-items:center;justify-content:center;", rtl({
borderRadius: `2px 0 0 2px`
}, {
borderRadius: `0 2px 2px 0`
})(), " border:", config_values.borderWidth, " solid ", COLORS.ui.border, ";&:focus,&:hover:not( :disabled ){", focusBoxShadow, " border-color:", COLORS.ui.borderFocus, ";z-index:1;position:relative;}}" + ( true ? "" : 0), true ? "" : 0);
const colorIndicatorBorder = border => {
const {
color,
style
} = border || {};
const fallbackColor = !!style && style !== 'none' ? COLORS.gray[300] : undefined;
return /*#__PURE__*/emotion_react_browser_esm_css("border-style:", style === 'none' ? 'solid' : style, ";border-color:", color || fallbackColor, ";" + ( true ? "" : 0), true ? "" : 0);
};
const colorIndicatorWrapper = (border, size) => {
const {
style
} = border || {};
return /*#__PURE__*/emotion_react_browser_esm_css("border-radius:9999px;border:2px solid transparent;", style ? colorIndicatorBorder(border) : undefined, " width:", size === '__unstable-large' ? '24px' : '22px', ";height:", size === '__unstable-large' ? '24px' : '22px', ";padding:", size === '__unstable-large' ? '2px' : '1px', ";&>span{height:", space(4), ";width:", space(4), ";background:linear-gradient(\n\t\t\t\t-45deg,\n\t\t\t\ttransparent 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 52%,\n\t\t\t\ttransparent 52%\n\t\t\t);}" + ( true ? "" : 0), true ? "" : 0);
};
// Must equal $color-palette-circle-size from:
// @wordpress/components/src/circular-option-picker/style.scss
const swatchSize = 28;
const swatchGap = 12;
const borderControlPopoverControls = /*#__PURE__*/emotion_react_browser_esm_css("width:", swatchSize * 6 + swatchGap * 5, "px;>div:first-of-type>", StyledLabel, "{margin-bottom:0;", styles_labelStyles, ";}&& ", StyledLabel, "+button:not( .has-text ){min-width:24px;padding:0;}" + ( true ? "" : 0), true ? "" : 0);
const borderControlPopoverContent = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
const borderColorIndicator = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
const resetButton = /*#__PURE__*/emotion_react_browser_esm_css("justify-content:center;width:100%;&&{border-top:", config_values.borderWidth, " solid ", COLORS.gray[400], ";border-top-left-radius:0;border-top-right-radius:0;height:40px;}" + ( true ? "" : 0), true ? "" : 0);
const borderSlider = () => /*#__PURE__*/emotion_react_browser_esm_css("flex:1 1 60%;", rtl({
marginRight: space(3)
})(), ";" + ( true ? "" : 0), true ? "" : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web';
const allUnits = {
px: {
value: 'px',
label: isWeb ? 'px' : (0,external_wp_i18n_namespaceObject.__)('Pixels (px)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Pixels (px)'),
step: 1
},
'%': {
value: '%',
label: isWeb ? '%' : (0,external_wp_i18n_namespaceObject.__)('Percentage (%)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Percent (%)'),
step: 0.1
},
em: {
value: 'em',
label: isWeb ? 'em' : (0,external_wp_i18n_namespaceObject.__)('Relative to parent font size (em)'),
a11yLabel: (0,external_wp_i18n_namespaceObject._x)('ems', 'Relative to parent font size (em)'),
step: 0.01
},
rem: {
value: 'rem',
label: isWeb ? 'rem' : (0,external_wp_i18n_namespaceObject.__)('Relative to root font size (rem)'),
a11yLabel: (0,external_wp_i18n_namespaceObject._x)('rems', 'Relative to root font size (rem)'),
step: 0.01
},
vw: {
value: 'vw',
label: isWeb ? 'vw' : (0,external_wp_i18n_namespaceObject.__)('Viewport width (vw)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport width (vw)'),
step: 0.1
},
vh: {
value: 'vh',
label: isWeb ? 'vh' : (0,external_wp_i18n_namespaceObject.__)('Viewport height (vh)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport height (vh)'),
step: 0.1
},
vmin: {
value: 'vmin',
label: isWeb ? 'vmin' : (0,external_wp_i18n_namespaceObject.__)('Viewport smallest dimension (vmin)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport smallest dimension (vmin)'),
step: 0.1
},
vmax: {
value: 'vmax',
label: isWeb ? 'vmax' : (0,external_wp_i18n_namespaceObject.__)('Viewport largest dimension (vmax)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport largest dimension (vmax)'),
step: 0.1
},
ch: {
value: 'ch',
label: isWeb ? 'ch' : (0,external_wp_i18n_namespaceObject.__)('Width of the zero (0) character (ch)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Width of the zero (0) character (ch)'),
step: 0.01
},
ex: {
value: 'ex',
label: isWeb ? 'ex' : (0,external_wp_i18n_namespaceObject.__)('x-height of the font (ex)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('x-height of the font (ex)'),
step: 0.01
},
cm: {
value: 'cm',
label: isWeb ? 'cm' : (0,external_wp_i18n_namespaceObject.__)('Centimeters (cm)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Centimeters (cm)'),
step: 0.001
},
mm: {
value: 'mm',
label: isWeb ? 'mm' : (0,external_wp_i18n_namespaceObject.__)('Millimeters (mm)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Millimeters (mm)'),
step: 0.1
},
in: {
value: 'in',
label: isWeb ? 'in' : (0,external_wp_i18n_namespaceObject.__)('Inches (in)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Inches (in)'),
step: 0.001
},
pc: {
value: 'pc',
label: isWeb ? 'pc' : (0,external_wp_i18n_namespaceObject.__)('Picas (pc)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Picas (pc)'),
step: 1
},
pt: {
value: 'pt',
label: isWeb ? 'pt' : (0,external_wp_i18n_namespaceObject.__)('Points (pt)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Points (pt)'),
step: 1
},
svw: {
value: 'svw',
label: isWeb ? 'svw' : (0,external_wp_i18n_namespaceObject.__)('Small viewport width (svw)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport width (svw)'),
step: 0.1
},
svh: {
value: 'svh',
label: isWeb ? 'svh' : (0,external_wp_i18n_namespaceObject.__)('Small viewport height (svh)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport height (svh)'),
step: 0.1
},
svi: {
value: 'svi',
label: isWeb ? 'svi' : (0,external_wp_i18n_namespaceObject.__)('Viewport smallest size in the inline direction (svi)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport width or height (svi)'),
step: 0.1
},
svb: {
value: 'svb',
label: isWeb ? 'svb' : (0,external_wp_i18n_namespaceObject.__)('Viewport smallest size in the block direction (svb)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport width or height (svb)'),
step: 0.1
},
svmin: {
value: 'svmin',
label: isWeb ? 'svmin' : (0,external_wp_i18n_namespaceObject.__)('Small viewport smallest dimension (svmin)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport smallest dimension (svmin)'),
step: 0.1
},
lvw: {
value: 'lvw',
label: isWeb ? 'lvw' : (0,external_wp_i18n_namespaceObject.__)('Large viewport width (lvw)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport width (lvw)'),
step: 0.1
},
lvh: {
value: 'lvh',
label: isWeb ? 'lvh' : (0,external_wp_i18n_namespaceObject.__)('Large viewport height (lvh)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport height (lvh)'),
step: 0.1
},
lvi: {
value: 'lvi',
label: isWeb ? 'lvi' : (0,external_wp_i18n_namespaceObject.__)('Large viewport width or height (lvi)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport width or height (lvi)'),
step: 0.1
},
lvb: {
value: 'lvb',
label: isWeb ? 'lvb' : (0,external_wp_i18n_namespaceObject.__)('Large viewport width or height (lvb)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport width or height (lvb)'),
step: 0.1
},
lvmin: {
value: 'lvmin',
label: isWeb ? 'lvmin' : (0,external_wp_i18n_namespaceObject.__)('Large viewport smallest dimension (lvmin)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport smallest dimension (lvmin)'),
step: 0.1
},
dvw: {
value: 'dvw',
label: isWeb ? 'dvw' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width (dvw)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width (dvw)'),
step: 0.1
},
dvh: {
value: 'dvh',
label: isWeb ? 'dvh' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport height (dvh)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport height (dvh)'),
step: 0.1
},
dvi: {
value: 'dvi',
label: isWeb ? 'dvi' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width or height (dvi)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width or height (dvi)'),
step: 0.1
},
dvb: {
value: 'dvb',
label: isWeb ? 'dvb' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width or height (dvb)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width or height (dvb)'),
step: 0.1
},
dvmin: {
value: 'dvmin',
label: isWeb ? 'dvmin' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport smallest dimension (dvmin)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport smallest dimension (dvmin)'),
step: 0.1
},
dvmax: {
value: 'dvmax',
label: isWeb ? 'dvmax' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport largest dimension (dvmax)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport largest dimension (dvmax)'),
step: 0.1
},
svmax: {
value: 'svmax',
label: isWeb ? 'svmax' : (0,external_wp_i18n_namespaceObject.__)('Small viewport largest dimension (svmax)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport largest dimension (svmax)'),
step: 0.1
},
lvmax: {
value: 'lvmax',
label: isWeb ? 'lvmax' : (0,external_wp_i18n_namespaceObject.__)('Large viewport largest dimension (lvmax)'),
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport largest dimension (lvmax)'),
step: 0.1
}
};
/**
* An array of all available CSS length units.
*/
const ALL_CSS_UNITS = Object.values(allUnits);
/**
* Units of measurements. `a11yLabel` is used by screenreaders.
*/
const CSS_UNITS = [allUnits.px, allUnits['%'], allUnits.em, allUnits.rem, allUnits.vw, allUnits.vh];
const DEFAULT_UNIT = allUnits.px;
/**
* Handles legacy value + unit handling.
* This component use to manage both incoming value and units separately.
*
* Moving forward, ideally the value should be a string that contains both
* the value and unit, example: '10px'
*
* @param rawValue The raw value as a string (may or may not contain the unit)
* @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`
* @param allowedUnits Units to derive from.
* @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
* could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse
* from the raw value could not be matched against the list of allowed units.
*/
function getParsedQuantityAndUnit(rawValue, fallbackUnit, allowedUnits) {
const initialValue = fallbackUnit ? `${rawValue !== null && rawValue !== void 0 ? rawValue : ''}${fallbackUnit}` : rawValue;
return parseQuantityAndUnitFromRawValue(initialValue, allowedUnits);
}
/**
* Checks if units are defined.
*
* @param units List of units.
* @return Whether the list actually contains any units.
*/
function hasUnits(units) {
// Although the `isArray` check shouldn't be necessary (given the signature of
// this typed function), it's better to stay on the side of caution, since
// this function may be called from un-typed environments.
return Array.isArray(units) && !!units.length;
}
/**
* Parses a quantity and unit from a raw string value, given a list of allowed
* units and otherwise falling back to the default unit.
*
* @param rawValue The raw value as a string (may or may not contain the unit)
* @param allowedUnits Units to derive from.
* @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
* could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed
* from the raw value could not be matched against the list of allowed units.
*/
function parseQuantityAndUnitFromRawValue(rawValue, allowedUnits = ALL_CSS_UNITS) {
let trimmedValue;
let quantityToReturn;
if (typeof rawValue !== 'undefined' || rawValue === null) {
trimmedValue = `${rawValue}`.trim();
const parsedQuantity = parseFloat(trimmedValue);
quantityToReturn = !isFinite(parsedQuantity) ? undefined : parsedQuantity;
}
const unitMatch = trimmedValue?.match(/[\d.\-\+]*\s*(.*)/);
const matchedUnit = unitMatch?.[1]?.toLowerCase();
let unitToReturn;
if (hasUnits(allowedUnits)) {
const match = allowedUnits.find(item => item.value === matchedUnit);
unitToReturn = match?.value;
} else {
unitToReturn = DEFAULT_UNIT.value;
}
return [quantityToReturn, unitToReturn];
}
/**
* Parses quantity and unit from a raw value. Validates parsed value, using fallback
* value if invalid.
*
* @param rawValue The next value.
* @param allowedUnits Units to derive from.
* @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.
* @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.
* @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
* could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The
* unit can be `undefined` only if the unit parsed from the raw value could not be matched against
* the list of allowed units, the `fallbackQuantity` is also `undefined` and the list of
* `allowedUnits` is passed empty.
*/
function getValidParsedQuantityAndUnit(rawValue, allowedUnits, fallbackQuantity, fallbackUnit) {
const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(rawValue, allowedUnits);
// The parsed value from `parseQuantityAndUnitFromRawValue` should now be
// either a real number or undefined. If undefined, use the fallback value.
const quantityToReturn = parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : fallbackQuantity;
// If no unit is parsed from the raw value, or if the fallback unit is not
// defined, use the first value from the list of allowed units as fallback.
let unitToReturn = parsedUnit || fallbackUnit;
if (!unitToReturn && hasUnits(allowedUnits)) {
unitToReturn = allowedUnits[0].value;
}
return [quantityToReturn, unitToReturn];
}
/**
* Takes a unit value and finds the matching accessibility label for the
* unit abbreviation.
*
* @param unit Unit value (example: `px`)
* @return a11y label for the unit abbreviation
*/
function getAccessibleLabelForUnit(unit) {
const match = ALL_CSS_UNITS.find(item => item.value === unit);
return match?.a11yLabel ? match?.a11yLabel : match?.value;
}
/**
* Filters available units based on values defined a list of allowed unit values.
*
* @param allowedUnitValues Collection of allowed unit value strings.
* @param availableUnits Collection of available unit objects.
* @return Filtered units.
*/
function filterUnitsWithSettings(allowedUnitValues = [], availableUnits) {
// Although the `isArray` check shouldn't be necessary (given the signature of
// this typed function), it's better to stay on the side of caution, since
// this function may be called from un-typed environments.
return Array.isArray(availableUnits) ? availableUnits.filter(unit => allowedUnitValues.includes(unit.value)) : [];
}
/**
* Custom hook to retrieve and consolidate units setting from add_theme_support().
* TODO: ideally this hook shouldn't be needed
* https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823
*
* @param args An object containing units, settingPath & defaultUnits.
* @param args.units Collection of all potentially available units.
* @param args.availableUnits Collection of unit value strings for filtering available units.
* @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.
*
* @return Filtered list of units, with their default values updated following the `defaultValues`
* argument's property.
*/
const useCustomUnits = ({
units = ALL_CSS_UNITS,
availableUnits = [],
defaultValues
}) => {
const customUnitsToReturn = filterUnitsWithSettings(availableUnits, units);
if (defaultValues) {
customUnitsToReturn.forEach((unit, i) => {
if (defaultValues[unit.value]) {
const [parsedDefaultValue] = parseQuantityAndUnitFromRawValue(defaultValues[unit.value]);
customUnitsToReturn[i].default = parsedDefaultValue;
}
});
}
return customUnitsToReturn;
};
/**
* Get available units with the unit for the currently selected value
* prepended if it is not available in the list of units.
*
* This is useful to ensure that the current value's unit is always
* accurately displayed in the UI, even if the intention is to hide
* the availability of that unit.
*
* @param rawValue Selected value to parse.
* @param legacyUnit Legacy unit value, if rawValue needs it appended.
* @param units List of available units.
*
* @return A collection of units containing the unit for the current value.
*/
function getUnitsWithCurrentUnit(rawValue, legacyUnit, units = ALL_CSS_UNITS) {
const unitsToReturn = Array.isArray(units) ? [...units] : [];
const [, currentUnit] = getParsedQuantityAndUnit(rawValue, legacyUnit, ALL_CSS_UNITS);
if (currentUnit && !unitsToReturn.some(unit => unit.value === currentUnit)) {
if (allUnits[currentUnit]) {
unitsToReturn.unshift(allUnits[currentUnit]);
}
}
return unitsToReturn;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control-dropdown/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useBorderControlDropdown(props) {
const {
border,
className,
colors = [],
enableAlpha = false,
enableStyle = true,
onChange,
previousStyleSelection,
size = 'default',
__experimentalIsRenderedInSidebar = false,
...otherProps
} = useContextSystem(props, 'BorderControlDropdown');
const [widthValue] = parseQuantityAndUnitFromRawValue(border?.width);
const hasZeroWidth = widthValue === 0;
const onColorChange = color => {
const style = border?.style === 'none' ? previousStyleSelection : border?.style;
const width = hasZeroWidth && !!color ? '1px' : border?.width;
onChange({
color,
style,
width
});
};
const onStyleChange = style => {
const width = hasZeroWidth && !!style ? '1px' : border?.width;
onChange({
...border,
style,
width
});
};
const onReset = () => {
onChange({
...border,
color: undefined,
style: undefined
});
};
// Generate class names.
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(borderControlDropdown, className);
}, [className, cx]);
const indicatorClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(borderColorIndicator);
}, [cx]);
const indicatorWrapperClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(colorIndicatorWrapper(border, size));
}, [border, cx, size]);
const popoverControlsClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(borderControlPopoverControls);
}, [cx]);
const popoverContentClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(borderControlPopoverContent);
}, [cx]);
const resetButtonClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(resetButton);
}, [cx]);
return {
...otherProps,
border,
className: classes,
colors,
enableAlpha,
enableStyle,
indicatorClassName,
indicatorWrapperClassName,
onColorChange,
onStyleChange,
onReset,
popoverContentClassName,
popoverControlsClassName,
resetButtonClassName,
size,
__experimentalIsRenderedInSidebar
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control-dropdown/component.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const getAriaLabelColorValue = colorValue => {
// Leave hex values as-is. Remove the `var()` wrapper from CSS vars.
return colorValue.replace(/^var\((.+)\)$/, '$1');
};
const getColorObject = (colorValue, colors) => {
if (!colorValue || !colors) {
return;
}
if (isMultiplePaletteArray(colors)) {
// Multiple origins
let matchedColor;
colors.some(origin => origin.colors.some(color => {
if (color.color === colorValue) {
matchedColor = color;
return true;
}
return false;
}));
return matchedColor;
}
// Single origin
return colors.find(color => color.color === colorValue);
};
const getToggleAriaLabel = (colorValue, colorObject, style, isStyleEnabled) => {
if (isStyleEnabled) {
if (colorObject) {
const ariaLabelValue = getAriaLabelColorValue(colorObject.color);
return style ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1$s: The name of the color e.g. "vivid red". %2$s: The color's hex code e.g.: "#f00:". %3$s: The current border style selection e.g. "solid".
'Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s". The currently selected style is "%3$s".', colorObject.name, ariaLabelValue, style) : (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1$s: The name of the color e.g. "vivid red". %2$s: The color's hex code e.g.: "#f00:".
'Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s".', colorObject.name, ariaLabelValue);
}
if (colorValue) {
const ariaLabelValue = getAriaLabelColorValue(colorValue);
return style ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1$s: The color's hex code e.g.: "#f00:". %2$s: The current border style selection e.g. "solid".
'Border color and style picker. The currently selected color has a value of "%1$s". The currently selected style is "%2$s".', ariaLabelValue, style) : (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1$s: The color's hex code e.g: "#f00".
'Border color and style picker. The currently selected color has a value of "%1$s".', ariaLabelValue);
}
return (0,external_wp_i18n_namespaceObject.__)('Border color and style picker.');
}
if (colorObject) {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1$s: The name of the color e.g. "vivid red". %2$s: The color's hex code e.g: "#f00".
'Border color picker. The currently selected color is called "%1$s" and has a value of "%2$s".', colorObject.name, getAriaLabelColorValue(colorObject.color));
}
if (colorValue) {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1$s: The color's hex code e.g: "#f00".
'Border color picker. The currently selected color has a value of "%1$s".', getAriaLabelColorValue(colorValue));
}
return (0,external_wp_i18n_namespaceObject.__)('Border color picker.');
};
const BorderControlDropdown = (props, forwardedRef) => {
const {
__experimentalIsRenderedInSidebar,
border,
colors,
disableCustomColors,
enableAlpha,
enableStyle,
indicatorClassName,
indicatorWrapperClassName,
isStyleSettable,
onReset,
onColorChange,
onStyleChange,
popoverContentClassName,
popoverControlsClassName,
resetButtonClassName,
showDropdownHeader,
size,
__unstablePopoverProps,
...otherProps
} = useBorderControlDropdown(props);
const {
color,
style
} = border || {};
const colorObject = getColorObject(color, colors);
const toggleAriaLabel = getToggleAriaLabel(color, colorObject, style, enableStyle);
const showResetButton = color || style && style !== 'none';
const dropdownPosition = __experimentalIsRenderedInSidebar ? 'bottom left' : undefined;
const renderToggle = ({
onToggle
}) => (0,external_React_.createElement)(build_module_button, {
onClick: onToggle,
variant: "tertiary",
"aria-label": toggleAriaLabel,
tooltipPosition: dropdownPosition,
label: (0,external_wp_i18n_namespaceObject.__)('Border color and style picker'),
showTooltip: true,
__next40pxDefaultSize: size === '__unstable-large' ? true : false
}, (0,external_React_.createElement)("span", {
className: indicatorWrapperClassName
}, (0,external_React_.createElement)(color_indicator, {
className: indicatorClassName,
colorValue: color
})));
const renderContent = ({
onClose
}) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(dropdown_content_wrapper, {
paddingSize: "medium"
}, (0,external_React_.createElement)(v_stack_component, {
className: popoverControlsClassName,
spacing: 6
}, showDropdownHeader ? (0,external_React_.createElement)(h_stack_component, null, (0,external_React_.createElement)(StyledLabel, null, (0,external_wp_i18n_namespaceObject.__)('Border color')), (0,external_React_.createElement)(build_module_button, {
size: "small",
label: (0,external_wp_i18n_namespaceObject.__)('Close border color'),
icon: close_small,
onClick: onClose
})) : undefined, (0,external_React_.createElement)(color_palette, {
className: popoverContentClassName,
value: color,
onChange: onColorChange,
colors,
disableCustomColors,
__experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
clearable: false,
enableAlpha: enableAlpha
}), enableStyle && isStyleSettable && (0,external_React_.createElement)(border_control_style_picker_component, {
label: (0,external_wp_i18n_namespaceObject.__)('Style'),
value: style,
onChange: onStyleChange
}))), showResetButton && (0,external_React_.createElement)(dropdown_content_wrapper, {
paddingSize: "none"
}, (0,external_React_.createElement)(build_module_button, {
className: resetButtonClassName,
variant: "tertiary",
onClick: () => {
onReset();
onClose();
}
}, (0,external_wp_i18n_namespaceObject.__)('Reset'))));
return (0,external_React_.createElement)(dropdown, {
renderToggle: renderToggle,
renderContent: renderContent,
popoverProps: {
...__unstablePopoverProps
},
...otherProps,
ref: forwardedRef
});
};
const ConnectedBorderControlDropdown = contextConnect(BorderControlDropdown, 'BorderControlDropdown');
/* harmony default export */ const border_control_dropdown_component = (ConnectedBorderControlDropdown);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/unit-select-control.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnitSelectControl({
className,
isUnitSelectTabbable: isTabbable = true,
onChange,
size = 'default',
unit = 'px',
units = CSS_UNITS,
...props
}, ref) {
if (!hasUnits(units) || units?.length === 1) {
return (0,external_React_.createElement)(UnitLabel, {
className: "components-unit-control__unit-label",
selectSize: size
}, unit);
}
const handleOnChange = event => {
const {
value: unitValue
} = event.target;
const data = units.find(option => option.value === unitValue);
onChange?.(unitValue, {
event,
data
});
};
const classes = classnames_default()('components-unit-control__select', className);
return (0,external_React_.createElement)(UnitSelect, {
ref: ref,
className: classes,
onChange: handleOnChange,
selectSize: size,
tabIndex: isTabbable ? undefined : -1,
value: unit,
...props
}, units.map(option => (0,external_React_.createElement)("option", {
value: option.value,
key: option.value
}, option.label)));
}
/* harmony default export */ const unit_select_control = ((0,external_wp_element_namespaceObject.forwardRef)(UnitSelectControl));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedUnitControl(unitControlProps, forwardedRef) {
const {
__unstableStateReducer,
autoComplete = 'off',
// @ts-expect-error Ensure that children is omitted from restProps
children,
className,
disabled = false,
disableUnits = false,
isPressEnterToChange = false,
isResetValueOnUnitChange = false,
isUnitSelectTabbable = true,
label,
onChange: onChangeProp,
onUnitChange,
size = 'default',
unit: unitProp,
units: unitsProp = CSS_UNITS,
value: valueProp,
onFocus: onFocusProp,
...props
} = useDeprecated36pxDefaultSizeProp(unitControlProps);
if ('unit' in unitControlProps) {
external_wp_deprecated_default()('UnitControl unit prop', {
since: '5.6',
hint: 'The unit should be provided within the `value` prop.',
version: '6.2'
});
}
// The `value` prop, in theory, should not be `null`, but the following line
// ensures it fallback to `undefined` in case a consumer of `UnitControl`
// still passes `null` as a `value`.
const nonNullValueProp = valueProp !== null && valueProp !== void 0 ? valueProp : undefined;
const [units, reFirstCharacterOfUnits] = (0,external_wp_element_namespaceObject.useMemo)(() => {
const list = getUnitsWithCurrentUnit(nonNullValueProp, unitProp, unitsProp);
const [{
value: firstUnitValue = ''
} = {}, ...rest] = list;
const firstCharacters = rest.reduce((carry, {
value
}) => {
const first = escapeRegExp(value?.substring(0, 1) || '');
return carry.includes(first) ? carry : `${carry}|${first}`;
}, escapeRegExp(firstUnitValue.substring(0, 1)));
return [list, new RegExp(`^(?:${firstCharacters})$`, 'i')];
}, [nonNullValueProp, unitProp, unitsProp]);
const [parsedQuantity, parsedUnit] = getParsedQuantityAndUnit(nonNullValueProp, unitProp, units);
const [unit, setUnit] = use_controlled_state(units.length === 1 ? units[0].value : unitProp, {
initial: parsedUnit,
fallback: ''
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (parsedUnit !== undefined) {
setUnit(parsedUnit);
}
}, [parsedUnit, setUnit]);
const classes = classnames_default()('components-unit-control',
// This class is added for legacy purposes to maintain it on the outer
// wrapper. See: https://github.com/WordPress/gutenberg/pull/45139
'components-unit-control-wrapper', className);
const handleOnQuantityChange = (nextQuantityValue, changeProps) => {
if (nextQuantityValue === '' || typeof nextQuantityValue === 'undefined' || nextQuantityValue === null) {
onChangeProp?.('', changeProps);
return;
}
/*
* Customizing the onChange callback.
* This allows as to broadcast a combined value+unit to onChange.
*/
const onChangeValue = getValidParsedQuantityAndUnit(nextQuantityValue, units, parsedQuantity, unit).join('');
onChangeProp?.(onChangeValue, changeProps);
};
const handleOnUnitChange = (nextUnitValue, changeProps) => {
const {
data
} = changeProps;
let nextValue = `${parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : ''}${nextUnitValue}`;
if (isResetValueOnUnitChange && data?.default !== undefined) {
nextValue = `${data.default}${nextUnitValue}`;
}
onChangeProp?.(nextValue, changeProps);
onUnitChange?.(nextUnitValue, changeProps);
setUnit(nextUnitValue);
};
let handleOnKeyDown;
if (!disableUnits && isUnitSelectTabbable && units.length) {
handleOnKeyDown = event => {
props.onKeyDown?.(event);
// Unless the meta key was pressed (to avoid interfering with
// shortcuts, e.g. pastes), moves focus to the unit select if a key
// matches the first character of a unit.
if (!event.metaKey && reFirstCharacterOfUnits.test(event.key)) refInputSuffix.current?.focus();
};
}
const refInputSuffix = (0,external_wp_element_namespaceObject.useRef)(null);
const inputSuffix = !disableUnits ? (0,external_React_.createElement)(unit_select_control, {
ref: refInputSuffix,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Select unit'),
disabled: disabled,
isUnitSelectTabbable: isUnitSelectTabbable,
onChange: handleOnUnitChange,
size: ['small', 'compact'].includes(size) || size === 'default' && !props.__next40pxDefaultSize ? 'small' : 'default',
unit: unit,
units: units,
onFocus: onFocusProp,
onBlur: unitControlProps.onBlur
}) : null;
let step = props.step;
/*
* If no step prop has been passed, lookup the active unit and
* try to get step from `units`, or default to a value of `1`
*/
if (!step && units) {
var _activeUnit$step;
const activeUnit = units.find(option => option.value === unit);
step = (_activeUnit$step = activeUnit?.step) !== null && _activeUnit$step !== void 0 ? _activeUnit$step : 1;
}
return (0,external_React_.createElement)(ValueInput, {
...props,
autoComplete: autoComplete,
className: classes,
disabled: disabled,
spinControls: "none",
isPressEnterToChange: isPressEnterToChange,
label: label,
onKeyDown: handleOnKeyDown,
onChange: handleOnQuantityChange,
ref: forwardedRef,
size: size,
suffix: inputSuffix,
type: isPressEnterToChange ? 'text' : 'number',
value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : '',
step: step,
onFocus: onFocusProp,
__unstableStateReducer: __unstableStateReducer
});
}
/**
* `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).
*
*
* ```jsx
* import { __experimentalUnitControl as UnitControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const Example = () => {
* const [ value, setValue ] = useState( '10px' );
*
* return <UnitControl onChange={ setValue } value={ value } />;
* };
* ```
*/
const UnitControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedUnitControl);
/* harmony default export */ const unit_control = (UnitControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// If either width or color are defined, the border is considered valid
// and a border style can be set as well.
const isValidBorder = border => {
const hasWidth = border?.width !== undefined && border.width !== '';
const hasColor = border?.color !== undefined;
return hasWidth || hasColor;
};
function useBorderControl(props) {
const {
className,
colors = [],
isCompact,
onChange,
enableAlpha = true,
enableStyle = true,
shouldSanitizeBorder = true,
size = 'default',
value: border,
width,
__experimentalIsRenderedInSidebar = false,
__next40pxDefaultSize,
...otherProps
} = useContextSystem(props, 'BorderControl');
const computedSize = size === 'default' && __next40pxDefaultSize ? '__unstable-large' : size;
const [widthValue, originalWidthUnit] = parseQuantityAndUnitFromRawValue(border?.width);
const widthUnit = originalWidthUnit || 'px';
const hadPreviousZeroWidth = widthValue === 0;
const [colorSelection, setColorSelection] = (0,external_wp_element_namespaceObject.useState)();
const [styleSelection, setStyleSelection] = (0,external_wp_element_namespaceObject.useState)();
const isStyleSettable = shouldSanitizeBorder ? isValidBorder(border) : true;
const onBorderChange = (0,external_wp_element_namespaceObject.useCallback)(newBorder => {
if (shouldSanitizeBorder && !isValidBorder(newBorder)) {
onChange(undefined);
return;
}
onChange(newBorder);
}, [onChange, shouldSanitizeBorder]);
const onWidthChange = (0,external_wp_element_namespaceObject.useCallback)(newWidth => {
const newWidthValue = newWidth === '' ? undefined : newWidth;
const [parsedValue] = parseQuantityAndUnitFromRawValue(newWidth);
const hasZeroWidth = parsedValue === 0;
const updatedBorder = {
...border,
width: newWidthValue
};
// Setting the border width explicitly to zero will also set the
// border style to `none` and clear the border color.
if (hasZeroWidth && !hadPreviousZeroWidth) {
// Before clearing the 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(border?.color);
setStyleSelection(border?.style);
// Clear the color and style border properties.
updatedBorder.color = undefined;
updatedBorder.style = 'none';
}
// Selection has changed from zero border width to non-zero width.
if (!hasZeroWidth && hadPreviousZeroWidth) {
// Restore previous border color and style selections if width
// is now not zero.
if (updatedBorder.color === undefined) {
updatedBorder.color = colorSelection;
}
if (updatedBorder.style === 'none') {
updatedBorder.style = styleSelection;
}
}
onBorderChange(updatedBorder);
}, [border, hadPreviousZeroWidth, colorSelection, styleSelection, onBorderChange]);
const onSliderChange = (0,external_wp_element_namespaceObject.useCallback)(value => {
onWidthChange(`${value}${widthUnit}`);
}, [onWidthChange, widthUnit]);
// Generate class names.
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(borderControl, className);
}, [className, cx]);
let wrapperWidth = width;
if (isCompact) {
// Widths below represent the minimum usable width for compact controls.
// Taller controls contain greater internal padding, thus greater width.
wrapperWidth = size === '__unstable-large' ? '116px' : '90px';
}
const innerWrapperClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
const widthStyle = !!wrapperWidth && styles_wrapperWidth;
const heightStyle = wrapperHeight(computedSize);
return cx(innerWrapper(), widthStyle, heightStyle);
}, [wrapperWidth, cx, computedSize]);
const sliderClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(borderSlider());
}, [cx]);
return {
...otherProps,
className: classes,
colors,
enableAlpha,
enableStyle,
innerWrapperClassName,
inputWidth: wrapperWidth,
isStyleSettable,
onBorderChange,
onSliderChange,
onWidthChange,
previousStyleSelection: styleSelection,
sliderClassName,
value: border,
widthUnit,
widthValue,
size: computedSize,
__experimentalIsRenderedInSidebar,
__next40pxDefaultSize
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control/component.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const BorderLabel = props => {
const {
label,
hideLabelFromVision
} = props;
if (!label) {
return null;
}
return hideLabelFromVision ? (0,external_React_.createElement)(visually_hidden_component, {
as: "legend"
}, label) : (0,external_React_.createElement)(StyledLabel, {
as: "legend"
}, label);
};
const UnconnectedBorderControl = (props, forwardedRef) => {
const {
__next40pxDefaultSize = false,
colors,
disableCustomColors,
disableUnits,
enableAlpha,
enableStyle,
hideLabelFromVision,
innerWrapperClassName,
inputWidth,
isStyleSettable,
label,
onBorderChange,
onSliderChange,
onWidthChange,
placeholder,
__unstablePopoverProps,
previousStyleSelection,
showDropdownHeader,
size,
sliderClassName,
value: border,
widthUnit,
widthValue,
withSlider,
__experimentalIsRenderedInSidebar,
...otherProps
} = useBorderControl(props);
return (0,external_React_.createElement)(component, {
as: "fieldset",
...otherProps,
ref: forwardedRef
}, (0,external_React_.createElement)(BorderLabel, {
label: label,
hideLabelFromVision: hideLabelFromVision
}), (0,external_React_.createElement)(h_stack_component, {
spacing: 4,
className: innerWrapperClassName
}, (0,external_React_.createElement)(unit_control, {
prefix: (0,external_React_.createElement)(border_control_dropdown_component, {
border: border,
colors: colors,
__unstablePopoverProps: __unstablePopoverProps,
disableCustomColors: disableCustomColors,
enableAlpha: enableAlpha,
enableStyle: enableStyle,
isStyleSettable: isStyleSettable,
onChange: onBorderChange,
previousStyleSelection: previousStyleSelection,
showDropdownHeader: showDropdownHeader,
__experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
size: size
}),
label: (0,external_wp_i18n_namespaceObject.__)('Border width'),
hideLabelFromVision: true,
min: 0,
onChange: onWidthChange,
value: border?.width || '',
placeholder: placeholder,
disableUnits: disableUnits,
__unstableInputWidth: inputWidth,
size: size
}), withSlider && (0,external_React_.createElement)(range_control, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Border width'),
hideLabelFromVision: true,
className: sliderClassName,
initialPosition: 0,
max: 100,
min: 0,
onChange: onSliderChange,
step: ['px', '%'].includes(widthUnit) ? 1 : 0.1,
value: widthValue || undefined,
withInputField: false,
__next40pxDefaultSize: __next40pxDefaultSize
})));
};
/**
* The `BorderControl` brings together internal sub-components which allow users to
* set the various properties of a border. The first sub-component, a
* `BorderDropdown` contains options representing border color and style. The
* border width is controlled via a `UnitControl` and an optional `RangeControl`.
*
* Border radius is not covered by this control as it may be desired separate to
* color, style, and width. For example, the border radius may be absorbed under
* a "shape" abstraction.
*
* ```jsx
* import { __experimentalBorderControl as BorderControl } from '@wordpress/components';
* import { __ } from '@wordpress/i18n';
*
* const colors = [
* { name: 'Blue 20', color: '#72aee6' },
* // ...
* ];
*
* const MyBorderControl = () => {
* const [ border, setBorder ] = useState();
* const onChange = ( newBorder ) => setBorder( newBorder );
*
* return (
* <BorderControl
* colors={ colors }
* label={ __( 'Border' ) }
* onChange={ onChange }
* value={ border }
* />
* );
* };
* ```
*/
const BorderControl = contextConnect(UnconnectedBorderControl, 'BorderControl');
/* harmony default export */ const border_control_component = (BorderControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/grid/utils.js
/**
* External dependencies
*/
const utils_ALIGNMENTS = {
bottom: {
alignItems: 'flex-end',
justifyContent: 'center'
},
bottomLeft: {
alignItems: 'flex-start',
justifyContent: 'flex-end'
},
bottomRight: {
alignItems: 'flex-end',
justifyContent: 'flex-end'
},
center: {
alignItems: 'center',
justifyContent: 'center'
},
spaced: {
alignItems: 'center',
justifyContent: 'space-between'
},
left: {
alignItems: 'center',
justifyContent: 'flex-start'
},
right: {
alignItems: 'center',
justifyContent: 'flex-end'
},
stretch: {
alignItems: 'stretch'
},
top: {
alignItems: 'flex-start',
justifyContent: 'center'
},
topLeft: {
alignItems: 'flex-start',
justifyContent: 'flex-start'
},
topRight: {
alignItems: 'flex-start',
justifyContent: 'flex-end'
}
};
function utils_getAlignmentProps(alignment) {
const alignmentProps = alignment ? utils_ALIGNMENTS[alignment] : {};
return alignmentProps;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/grid/hook.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useGrid(props) {
const {
align,
alignment,
className,
columnGap,
columns = 2,
gap = 3,
isInline = false,
justify,
rowGap,
rows,
templateColumns,
templateRows,
...otherProps
} = useContextSystem(props, 'Grid');
const columnsAsArray = Array.isArray(columns) ? columns : [columns];
const column = useResponsiveValue(columnsAsArray);
const rowsAsArray = Array.isArray(rows) ? rows : [rows];
const row = useResponsiveValue(rowsAsArray);
const gridTemplateColumns = templateColumns || !!columns && `repeat( ${column}, 1fr )`;
const gridTemplateRows = templateRows || !!rows && `repeat( ${row}, 1fr )`;
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
const alignmentProps = utils_getAlignmentProps(alignment);
const gridClasses = /*#__PURE__*/emotion_react_browser_esm_css({
alignItems: align,
display: isInline ? 'inline-grid' : 'grid',
gap: `calc( ${config_values.gridBase} * ${gap} )`,
gridTemplateColumns: gridTemplateColumns || undefined,
gridTemplateRows: gridTemplateRows || undefined,
gridRowGap: rowGap,
gridColumnGap: columnGap,
justifyContent: justify,
verticalAlign: isInline ? 'middle' : undefined,
...alignmentProps
}, true ? "" : 0, true ? "" : 0);
return cx(gridClasses, className);
}, [align, alignment, className, columnGap, cx, gap, gridTemplateColumns, gridTemplateRows, isInline, justify, rowGap]);
return {
...otherProps,
className: classes
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/grid/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedGrid(props, forwardedRef) {
const gridProps = useGrid(props);
return (0,external_React_.createElement)(component, {
...gridProps,
ref: forwardedRef
});
}
/**
* `Grid` is a primitive layout component that can arrange content in a grid configuration.
*
* ```jsx
* import {
* __experimentalGrid as Grid,
* __experimentalText as Text
* } from `@wordpress/components`;
*
* function Example() {
* return (
* <Grid columns={ 3 }>
* <Text>Code</Text>
* <Text>is</Text>
* <Text>Poetry</Text>
* </Grid>
* );
* }
* ```
*/
const Grid = contextConnect(UnconnectedGrid, 'Grid');
/* harmony default export */ const grid_component = (Grid);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-split-controls/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useBorderBoxControlSplitControls(props) {
const {
className,
colors = [],
enableAlpha = false,
enableStyle = true,
size = 'default',
__experimentalIsRenderedInSidebar = false,
...otherProps
} = useContextSystem(props, 'BorderBoxControlSplitControls');
// Generate class names.
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(borderBoxControlSplitControls(size), className);
}, [cx, className, size]);
const centeredClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(centeredBorderControl, className);
}, [cx, className]);
const rightAlignedClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(rightBorderControl(), className);
}, [cx, className]);
return {
...otherProps,
centeredClassName,
className: classes,
colors,
enableAlpha,
enableStyle,
rightAlignedClassName,
size,
__experimentalIsRenderedInSidebar
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-split-controls/component.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const BorderBoxControlSplitControls = (props, forwardedRef) => {
const {
centeredClassName,
colors,
disableCustomColors,
enableAlpha,
enableStyle,
onChange,
popoverPlacement,
popoverOffset,
rightAlignedClassName,
size = 'default',
value,
__experimentalIsRenderedInSidebar,
...otherProps
} = useBorderBoxControlSplitControls(props);
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
// Memoize popoverProps to avoid returning a new object every time.
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => popoverPlacement ? {
placement: popoverPlacement,
offset: popoverOffset,
anchor: popoverAnchor,
shift: true
} : undefined, [popoverPlacement, popoverOffset, popoverAnchor]);
const sharedBorderControlProps = {
colors,
disableCustomColors,
enableAlpha,
enableStyle,
isCompact: true,
__experimentalIsRenderedInSidebar,
size
};
const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([setPopoverAnchor, forwardedRef]);
return (0,external_React_.createElement)(grid_component, {
...otherProps,
ref: mergedRef,
gap: 4
}, (0,external_React_.createElement)(border_box_control_visualizer_component, {
value: value,
size: size
}), (0,external_React_.createElement)(border_control_component, {
className: centeredClassName,
hideLabelFromVision: true,
label: (0,external_wp_i18n_namespaceObject.__)('Top border'),
onChange: newBorder => onChange(newBorder, 'top'),
__unstablePopoverProps: popoverProps,
value: value?.top,
...sharedBorderControlProps
}), (0,external_React_.createElement)(border_control_component, {
hideLabelFromVision: true,
label: (0,external_wp_i18n_namespaceObject.__)('Left border'),
onChange: newBorder => onChange(newBorder, 'left'),
__unstablePopoverProps: popoverProps,
value: value?.left,
...sharedBorderControlProps
}), (0,external_React_.createElement)(border_control_component, {
className: rightAlignedClassName,
hideLabelFromVision: true,
label: (0,external_wp_i18n_namespaceObject.__)('Right border'),
onChange: newBorder => onChange(newBorder, 'right'),
__unstablePopoverProps: popoverProps,
value: value?.right,
...sharedBorderControlProps
}), (0,external_React_.createElement)(border_control_component, {
className: centeredClassName,
hideLabelFromVision: true,
label: (0,external_wp_i18n_namespaceObject.__)('Bottom border'),
onChange: newBorder => onChange(newBorder, 'bottom'),
__unstablePopoverProps: popoverProps,
value: value?.bottom,
...sharedBorderControlProps
}));
};
const ConnectedBorderBoxControlSplitControls = contextConnect(BorderBoxControlSplitControls, 'BorderBoxControlSplitControls');
/* harmony default export */ const border_box_control_split_controls_component = (ConnectedBorderBoxControlSplitControls);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/unit-values.js
const UNITED_VALUE_REGEX = /^([\d.\-+]*)\s*(fr|cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|vw|vh|vmin|vmax|%|cap|ic|rlh|vi|vb|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx|svw|lvw|dvw|svh|lvh|dvh|svi|lvi|dvi|svb|lvb|dvb|svmin|lvmin|dvmin|svmax|lvmax|dvmax)?$/;
/**
* Parses a number and unit from a value.
*
* @param toParse Value to parse
*
* @return The extracted number and unit.
*/
function parseCSSUnitValue(toParse) {
const value = toParse.trim();
const matched = value.match(UNITED_VALUE_REGEX);
if (!matched) {
return [undefined, undefined];
}
const [, num, unit] = matched;
let numParsed = parseFloat(num);
numParsed = Number.isNaN(numParsed) ? undefined : numParsed;
return [numParsed, unit];
}
/**
* Combines a value and a unit into a unit value.
*
* @param value
* @param unit
*
* @return The unit value.
*/
function createCSSUnitValue(value, unit) {
return `${value}${unit}`;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/utils.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const utils_sides = ['top', 'right', 'bottom', 'left'];
const borderProps = ['color', 'style', 'width'];
const isEmptyBorder = border => {
if (!border) {
return true;
}
return !borderProps.some(prop => border[prop] !== undefined);
};
const isDefinedBorder = border => {
// No border, no worries :)
if (!border) {
return false;
}
// If we have individual borders per side within the border object we
// need to check whether any of those side borders have been set.
if (hasSplitBorders(border)) {
const allSidesEmpty = utils_sides.every(side => isEmptyBorder(border[side]));
return !allSidesEmpty;
}
// If we have a top-level border only, check if that is empty. e.g.
// { color: undefined, style: undefined, width: undefined }
// Border radius can still be set within the border object as it is
// handled separately.
return !isEmptyBorder(border);
};
const isCompleteBorder = border => {
if (!border) {
return false;
}
return borderProps.every(prop => border[prop] !== undefined);
};
const hasSplitBorders = (border = {}) => {
return Object.keys(border).some(side => utils_sides.indexOf(side) !== -1);
};
const hasMixedBorders = borders => {
if (!hasSplitBorders(borders)) {
return false;
}
const shorthandBorders = utils_sides.map(side => getShorthandBorderStyle(borders?.[side]));
return !shorthandBorders.every(border => border === shorthandBorders[0]);
};
const getSplitBorders = border => {
if (!border || isEmptyBorder(border)) {
return undefined;
}
return {
top: border,
right: border,
bottom: border,
left: border
};
};
const getBorderDiff = (original, updated) => {
const diff = {};
if (original.color !== updated.color) {
diff.color = updated.color;
}
if (original.style !== updated.style) {
diff.style = updated.style;
}
if (original.width !== updated.width) {
diff.width = updated.width;
}
return diff;
};
const getCommonBorder = borders => {
if (!borders) {
return undefined;
}
const colors = [];
const styles = [];
const widths = [];
utils_sides.forEach(side => {
colors.push(borders[side]?.color);
styles.push(borders[side]?.style);
widths.push(borders[side]?.width);
});
const allColorsMatch = colors.every(value => value === colors[0]);
const allStylesMatch = styles.every(value => value === styles[0]);
const allWidthsMatch = widths.every(value => value === widths[0]);
return {
color: allColorsMatch ? colors[0] : undefined,
style: allStylesMatch ? styles[0] : undefined,
width: allWidthsMatch ? widths[0] : getMostCommonUnit(widths)
};
};
const getShorthandBorderStyle = (border, fallbackBorder) => {
if (isEmptyBorder(border)) {
return fallbackBorder;
}
const {
color: fallbackColor,
style: fallbackStyle,
width: fallbackWidth
} = fallbackBorder || {};
const {
color = fallbackColor,
style = fallbackStyle,
width = fallbackWidth
} = border;
const hasVisibleBorder = !!width && width !== '0' || !!color;
const borderStyle = hasVisibleBorder ? style || 'solid' : style;
return [width, borderStyle, color].filter(Boolean).join(' ');
};
const getMostCommonUnit = values => {
// Collect all the CSS units.
const units = values.map(value => value === undefined ? undefined : parseCSSUnitValue(`${value}`)[1]);
// Return the most common unit out of only the defined CSS units.
const filteredUnits = units.filter(value => value !== undefined);
return mode(filteredUnits);
};
/**
* Finds the mode value out of the array passed favouring the first value
* as a tiebreaker.
*
* @param values Values to determine the mode from.
*
* @return The mode value.
*/
function mode(values) {
if (values.length === 0) {
return undefined;
}
const map = {};
let maxCount = 0;
let currentMode;
values.forEach(value => {
map[value] = map[value] === undefined ? 1 : map[value] + 1;
if (map[value] > maxCount) {
currentMode = value;
maxCount = map[value];
}
});
return currentMode;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useBorderBoxControl(props) {
const {
className,
colors = [],
onChange,
enableAlpha = false,
enableStyle = true,
size = 'default',
value,
__experimentalIsRenderedInSidebar = false,
__next40pxDefaultSize,
...otherProps
} = useContextSystem(props, 'BorderBoxControl');
const computedSize = size === 'default' && __next40pxDefaultSize ? '__unstable-large' : size;
const mixedBorders = hasMixedBorders(value);
const splitBorders = hasSplitBorders(value);
const linkedValue = splitBorders ? getCommonBorder(value) : value;
const splitValue = splitBorders ? value : getSplitBorders(value);
// If no numeric width value is set, the unit select will be disabled.
const hasWidthValue = !isNaN(parseFloat(`${linkedValue?.width}`));
const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)(!mixedBorders);
const toggleLinked = () => setIsLinked(!isLinked);
const onLinkedChange = newBorder => {
if (!newBorder) {
return onChange(undefined);
}
// If we have all props defined on the new border apply it.
if (!mixedBorders || isCompleteBorder(newBorder)) {
return onChange(isEmptyBorder(newBorder) ? undefined : newBorder);
}
// If we had mixed borders we might have had some shared border props
// that we need to maintain. For example; we could have mixed borders
// with all the same color but different widths. Then from the linked
// control we change the color. We should keep the separate widths.
const changes = getBorderDiff(linkedValue, newBorder);
const updatedBorders = {
top: {
...value?.top,
...changes
},
right: {
...value?.right,
...changes
},
bottom: {
...value?.bottom,
...changes
},
left: {
...value?.left,
...changes
}
};
if (hasMixedBorders(updatedBorders)) {
return onChange(updatedBorders);
}
const filteredResult = isEmptyBorder(updatedBorders.top) ? undefined : updatedBorders.top;
onChange(filteredResult);
};
const onSplitChange = (newBorder, side) => {
const updatedBorders = {
...splitValue,
[side]: newBorder
};
if (hasMixedBorders(updatedBorders)) {
onChange(updatedBorders);
} else {
onChange(newBorder);
}
};
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(borderBoxControl, className);
}, [cx, className]);
const linkedControlClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(linkedBorderControl());
}, [cx]);
const wrapperClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(wrapper);
}, [cx]);
return {
...otherProps,
className: classes,
colors,
disableUnits: mixedBorders && !hasWidthValue,
enableAlpha,
enableStyle,
hasMixedBorders: mixedBorders,
isLinked,
linkedControlClassName,
onLinkedChange,
onSplitChange,
toggleLinked,
linkedValue,
size: computedSize,
splitValue,
wrapperClassName,
__experimentalIsRenderedInSidebar
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control/component.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const component_BorderLabel = props => {
const {
label,
hideLabelFromVision
} = props;
if (!label) {
return null;
}
return hideLabelFromVision ? (0,external_React_.createElement)(visually_hidden_component, {
as: "label"
}, label) : (0,external_React_.createElement)(StyledLabel, null, label);
};
const UnconnectedBorderBoxControl = (props, forwardedRef) => {
const {
className,
colors,
disableCustomColors,
disableUnits,
enableAlpha,
enableStyle,
hasMixedBorders,
hideLabelFromVision,
isLinked,
label,
linkedControlClassName,
linkedValue,
onLinkedChange,
onSplitChange,
popoverPlacement,
popoverOffset,
size,
splitValue,
toggleLinked,
wrapperClassName,
__experimentalIsRenderedInSidebar,
...otherProps
} = useBorderBoxControl(props);
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
// Memoize popoverProps to avoid returning a new object every time.
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => popoverPlacement ? {
placement: popoverPlacement,
offset: popoverOffset,
anchor: popoverAnchor,
shift: true
} : undefined, [popoverPlacement, popoverOffset, popoverAnchor]);
const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([setPopoverAnchor, forwardedRef]);
return (0,external_React_.createElement)(component, {
className: className,
...otherProps,
ref: mergedRef
}, (0,external_React_.createElement)(component_BorderLabel, {
label: label,
hideLabelFromVision: hideLabelFromVision
}), (0,external_React_.createElement)(component, {
className: wrapperClassName
}, isLinked ? (0,external_React_.createElement)(border_control_component, {
className: linkedControlClassName,
colors: colors,
disableUnits: disableUnits,
disableCustomColors: disableCustomColors,
enableAlpha: enableAlpha,
enableStyle: enableStyle,
onChange: onLinkedChange,
placeholder: hasMixedBorders ? (0,external_wp_i18n_namespaceObject.__)('Mixed') : undefined,
__unstablePopoverProps: popoverProps,
shouldSanitizeBorder: false // This component will handle that.
,
value: linkedValue,
withSlider: true,
width: size === '__unstable-large' ? '116px' : '110px',
__experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
size: size
}) : (0,external_React_.createElement)(border_box_control_split_controls_component, {
colors: colors,
disableCustomColors: disableCustomColors,
enableAlpha: enableAlpha,
enableStyle: enableStyle,
onChange: onSplitChange,
popoverPlacement: popoverPlacement,
popoverOffset: popoverOffset,
value: splitValue,
__experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
size: size
}), (0,external_React_.createElement)(border_box_control_linked_button_component, {
onClick: toggleLinked,
isLinked: isLinked,
size: size
})));
};
/**
* The `BorderBoxControl` effectively has two view states. The first, a "linked"
* view, allows configuration of a flat border via a single `BorderControl`.
* The second, a "split" view, contains a `BorderControl` for each side
* as well as a visualizer for the currently selected borders. Each view also
* contains a button to toggle between the two.
*
* When switching from the "split" view to "linked", if the individual side
* borders are not consistent, the "linked" view will display any border
* properties selections that are consistent while showing a mixed state for
* those that aren't. For example, if all borders had the same color and style
* but different widths, then the border dropdown in the "linked" view's
* `BorderControl` would show that consistent color and style but the "linked"
* view's width input would show "Mixed" placeholder text.
*
* ```jsx
* import { __experimentalBorderBoxControl as BorderBoxControl } from '@wordpress/components';
* import { __ } from '@wordpress/i18n';
*
* const colors = [
* { name: 'Blue 20', color: '#72aee6' },
* // ...
* ];
*
* const MyBorderBoxControl = () => {
* const defaultBorder = {
* color: '#72aee6',
* style: 'dashed',
* width: '1px',
* };
* const [ borders, setBorders ] = useState( {
* top: defaultBorder,
* right: defaultBorder,
* bottom: defaultBorder,
* left: defaultBorder,
* } );
* const onChange = ( newBorders ) => setBorders( newBorders );
*
* return (
* <BorderBoxControl
* colors={ colors }
* label={ __( 'Borders' ) }
* onChange={ onChange }
* value={ borders }
* />
* );
* };
* ```
*/
const BorderBoxControl = contextConnect(UnconnectedBorderBoxControl, 'BorderBoxControl');
/* harmony default export */ const border_box_control_component = (BorderBoxControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/styles/box-control-icon-styles.js
function box_control_icon_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
const box_control_icon_styles_Root = emotion_styled_base_browser_esm("span", true ? {
target: "e1j5nr4z8"
} : 0)( true ? {
name: "1w884gc",
styles: "box-sizing:border-box;display:block;width:24px;height:24px;position:relative;padding:4px"
} : 0);
const Viewbox = emotion_styled_base_browser_esm("span", true ? {
target: "e1j5nr4z7"
} : 0)( true ? {
name: "i6vjox",
styles: "box-sizing:border-box;display:block;position:relative;width:100%;height:100%"
} : 0);
const strokeFocus = ({
isFocused
}) => {
return /*#__PURE__*/emotion_react_browser_esm_css({
backgroundColor: 'currentColor',
opacity: isFocused ? 1 : 0.3
}, true ? "" : 0, true ? "" : 0);
};
const Stroke = emotion_styled_base_browser_esm("span", true ? {
target: "e1j5nr4z6"
} : 0)("box-sizing:border-box;display:block;pointer-events:none;position:absolute;", strokeFocus, ";" + ( true ? "" : 0));
const VerticalStroke = /*#__PURE__*/emotion_styled_base_browser_esm(Stroke, true ? {
target: "e1j5nr4z5"
} : 0)( true ? {
name: "1k2w39q",
styles: "bottom:3px;top:3px;width:2px"
} : 0);
const HorizontalStroke = /*#__PURE__*/emotion_styled_base_browser_esm(Stroke, true ? {
target: "e1j5nr4z4"
} : 0)( true ? {
name: "1q9b07k",
styles: "height:2px;left:3px;right:3px"
} : 0);
const TopStroke = /*#__PURE__*/emotion_styled_base_browser_esm(HorizontalStroke, true ? {
target: "e1j5nr4z3"
} : 0)( true ? {
name: "abcix4",
styles: "top:0"
} : 0);
const RightStroke = /*#__PURE__*/emotion_styled_base_browser_esm(VerticalStroke, true ? {
target: "e1j5nr4z2"
} : 0)( true ? {
name: "1wf8jf",
styles: "right:0"
} : 0);
const BottomStroke = /*#__PURE__*/emotion_styled_base_browser_esm(HorizontalStroke, true ? {
target: "e1j5nr4z1"
} : 0)( true ? {
name: "8tapst",
styles: "bottom:0"
} : 0);
const LeftStroke = /*#__PURE__*/emotion_styled_base_browser_esm(VerticalStroke, true ? {
target: "e1j5nr4z0"
} : 0)( true ? {
name: "1ode3cm",
styles: "left:0"
} : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/icon.js
/**
* Internal dependencies
*/
const BASE_ICON_SIZE = 24;
function BoxControlIcon({
size = 24,
side = 'all',
sides,
...props
}) {
const isSideDisabled = value => sides?.length && !sides.includes(value);
const hasSide = value => {
if (isSideDisabled(value)) {
return false;
}
return side === 'all' || side === value;
};
const top = hasSide('top') || hasSide('vertical');
const right = hasSide('right') || hasSide('horizontal');
const bottom = hasSide('bottom') || hasSide('vertical');
const left = hasSide('left') || hasSide('horizontal');
// Simulates SVG Icon scaling.
const scale = size / BASE_ICON_SIZE;
return (0,external_React_.createElement)(box_control_icon_styles_Root, {
style: {
transform: `scale(${scale})`
},
...props
}, (0,external_React_.createElement)(Viewbox, null, (0,external_React_.createElement)(TopStroke, {
isFocused: top
}), (0,external_React_.createElement)(RightStroke, {
isFocused: right
}), (0,external_React_.createElement)(BottomStroke, {
isFocused: bottom
}), (0,external_React_.createElement)(LeftStroke, {
isFocused: left
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/styles/box-control-styles.js
function box_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const StyledUnitControl = /*#__PURE__*/emotion_styled_base_browser_esm(unit_control, true ? {
target: "e1jovhle5"
} : 0)( true ? {
name: "1ejyr19",
styles: "max-width:90px"
} : 0);
const InputWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? {
target: "e1jovhle4"
} : 0)( true ? {
name: "1j1lmoi",
styles: "grid-column:1/span 3"
} : 0);
const ResetButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
target: "e1jovhle3"
} : 0)( true ? {
name: "tkya7b",
styles: "grid-area:1/2;justify-self:end"
} : 0);
const LinkedButtonWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "e1jovhle2"
} : 0)( true ? {
name: "1dfa8al",
styles: "grid-area:1/3;justify-self:end"
} : 0);
const FlexedBoxControlIcon = /*#__PURE__*/emotion_styled_base_browser_esm(BoxControlIcon, true ? {
target: "e1jovhle1"
} : 0)( true ? {
name: "ou8xsw",
styles: "flex:0 0 auto"
} : 0);
const FlexedRangeControl = /*#__PURE__*/emotion_styled_base_browser_esm(range_control, true ? {
target: "e1jovhle0"
} : 0)("width:100%;margin-inline-end:", space(2), ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const CUSTOM_VALUE_SETTINGS = {
px: {
max: 300,
step: 1
},
'%': {
max: 100,
step: 1
},
vw: {
max: 100,
step: 1
},
vh: {
max: 100,
step: 1
},
em: {
max: 10,
step: 0.1
},
rm: {
max: 10,
step: 0.1
},
svw: {
max: 100,
step: 1
},
lvw: {
max: 100,
step: 1
},
dvw: {
max: 100,
step: 1
},
svh: {
max: 100,
step: 1
},
lvh: {
max: 100,
step: 1
},
dvh: {
max: 100,
step: 1
},
vi: {
max: 100,
step: 1
},
svi: {
max: 100,
step: 1
},
lvi: {
max: 100,
step: 1
},
dvi: {
max: 100,
step: 1
},
vb: {
max: 100,
step: 1
},
svb: {
max: 100,
step: 1
},
lvb: {
max: 100,
step: 1
},
dvb: {
max: 100,
step: 1
},
vmin: {
max: 100,
step: 1
},
svmin: {
max: 100,
step: 1
},
lvmin: {
max: 100,
step: 1
},
dvmin: {
max: 100,
step: 1
},
vmax: {
max: 100,
step: 1
},
svmax: {
max: 100,
step: 1
},
lvmax: {
max: 100,
step: 1
},
dvmax: {
max: 100,
step: 1
}
};
const LABELS = {
all: (0,external_wp_i18n_namespaceObject.__)('All sides'),
top: (0,external_wp_i18n_namespaceObject.__)('Top side'),
bottom: (0,external_wp_i18n_namespaceObject.__)('Bottom side'),
left: (0,external_wp_i18n_namespaceObject.__)('Left side'),
right: (0,external_wp_i18n_namespaceObject.__)('Right side'),
mixed: (0,external_wp_i18n_namespaceObject.__)('Mixed'),
vertical: (0,external_wp_i18n_namespaceObject.__)('Top and bottom sides'),
horizontal: (0,external_wp_i18n_namespaceObject.__)('Left and right sides')
};
const DEFAULT_VALUES = {
top: undefined,
right: undefined,
bottom: undefined,
left: undefined
};
const ALL_SIDES = ['top', 'right', 'bottom', 'left'];
/**
* Gets an items with the most occurrence within an array
* https://stackoverflow.com/a/20762713
*
* @param arr Array of items to check.
* @return The item with the most occurrences.
*/
function utils_mode(arr) {
return arr.sort((a, b) => arr.filter(v => v === a).length - arr.filter(v => v === b).length).pop();
}
/**
* Gets the 'all' input value and unit from values data.
*
* @param values Box values.
* @param selectedUnits Box units.
* @param availableSides Available box sides to evaluate.
*
* @return A value + unit for the 'all' input.
*/
function getAllValue(values = {}, selectedUnits, availableSides = ALL_SIDES) {
const sides = normalizeSides(availableSides);
const parsedQuantitiesAndUnits = sides.map(side => parseQuantityAndUnitFromRawValue(values[side]));
const allParsedQuantities = parsedQuantitiesAndUnits.map(value => {
var _value$;
return (_value$ = value[0]) !== null && _value$ !== void 0 ? _value$ : '';
});
const allParsedUnits = parsedQuantitiesAndUnits.map(value => value[1]);
const commonQuantity = allParsedQuantities.every(v => v === allParsedQuantities[0]) ? allParsedQuantities[0] : '';
/**
* The typeof === 'number' check is important. On reset actions, the incoming value
* may be null or an empty string.
*
* Also, the value may also be zero (0), which is considered a valid unit value.
*
* typeof === 'number' is more specific for these cases, rather than relying on a
* simple truthy check.
*/
let commonUnit;
if (typeof commonQuantity === 'number') {
commonUnit = utils_mode(allParsedUnits);
} else {
var _getAllUnitFallback;
// Set meaningful unit selection if no commonQuantity and user has previously
// selected units without assigning values while controls were unlinked.
commonUnit = (_getAllUnitFallback = getAllUnitFallback(selectedUnits)) !== null && _getAllUnitFallback !== void 0 ? _getAllUnitFallback : utils_mode(allParsedUnits);
}
return [commonQuantity, commonUnit].join('');
}
/**
* Determine the most common unit selection to use as a fallback option.
*
* @param selectedUnits Current unit selections for individual sides.
* @return Most common unit selection.
*/
function getAllUnitFallback(selectedUnits) {
if (!selectedUnits || typeof selectedUnits !== 'object') {
return undefined;
}
const filteredUnits = Object.values(selectedUnits).filter(Boolean);
return utils_mode(filteredUnits);
}
/**
* Checks to determine if values are mixed.
*
* @param values Box values.
* @param selectedUnits Box units.
* @param sides Available box sides to evaluate.
*
* @return Whether values are mixed.
*/
function isValuesMixed(values = {}, selectedUnits, sides = ALL_SIDES) {
const allValue = getAllValue(values, selectedUnits, sides);
const isMixed = isNaN(parseFloat(allValue));
return isMixed;
}
/**
* Checks to determine if values are defined.
*
* @param values Box values.
*
* @return Whether values are mixed.
*/
function isValuesDefined(values) {
return values !== undefined && Object.values(values).filter(
// Switching units when input is empty causes values only
// containing units. This gives false positive on mixed values
// unless filtered.
value => !!value && /\d/.test(value)).length > 0;
}
/**
* Get initial selected side, factoring in whether the sides are linked,
* and whether the vertical / horizontal directions are grouped via splitOnAxis.
*
* @param isLinked Whether the box control's fields are linked.
* @param splitOnAxis Whether splitting by horizontal or vertical axis.
* @return The initial side.
*/
function getInitialSide(isLinked, splitOnAxis) {
let initialSide = 'all';
if (!isLinked) {
initialSide = splitOnAxis ? 'vertical' : 'top';
}
return initialSide;
}
/**
* Normalizes provided sides configuration to an array containing only top,
* right, bottom and left. This essentially just maps `horizontal` or `vertical`
* to their appropriate sides to facilitate correctly determining value for
* all input control.
*
* @param sides Available sides for box control.
* @return Normalized sides configuration.
*/
function normalizeSides(sides) {
const filteredSides = [];
if (!sides?.length) {
return ALL_SIDES;
}
if (sides.includes('vertical')) {
filteredSides.push(...['top', 'bottom']);
} else if (sides.includes('horizontal')) {
filteredSides.push(...['left', 'right']);
} else {
const newSides = ALL_SIDES.filter(side => sides.includes(side));
filteredSides.push(...newSides);
}
return filteredSides;
}
/**
* Applies a value to an object representing top, right, bottom and left sides
* while taking into account any custom side configuration.
*
* @param currentValues The current values for each side.
* @param newValue The value to apply to the sides object.
* @param sides Array defining valid sides.
*
* @return Object containing the updated values for each side.
*/
function applyValueToSides(currentValues, newValue, sides) {
const newValues = {
...currentValues
};
if (sides?.length) {
sides.forEach(side => {
if (side === 'vertical') {
newValues.top = newValue;
newValues.bottom = newValue;
} else if (side === 'horizontal') {
newValues.left = newValue;
newValues.right = newValue;
} else {
newValues[side] = newValue;
}
});
} else {
ALL_SIDES.forEach(side => newValues[side] = newValue);
}
return newValues;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/all-input-control.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const all_input_control_noop = () => {};
function AllInputControl({
__next40pxDefaultSize,
onChange = all_input_control_noop,
onFocus = all_input_control_noop,
values,
sides,
selectedUnits,
setSelectedUnits,
...props
}) {
var _CUSTOM_VALUE_SETTING, _CUSTOM_VALUE_SETTING2;
const inputId = (0,external_wp_compose_namespaceObject.useInstanceId)(AllInputControl, 'box-control-input-all');
const allValue = getAllValue(values, selectedUnits, sides);
const hasValues = isValuesDefined(values);
const isMixed = hasValues && isValuesMixed(values, selectedUnits, sides);
const allPlaceholder = isMixed ? LABELS.mixed : undefined;
const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(allValue);
const handleOnFocus = event => {
onFocus(event, {
side: 'all'
});
};
const onValueChange = next => {
const isNumeric = next !== undefined && !isNaN(parseFloat(next));
const nextValue = isNumeric ? next : undefined;
const nextValues = applyValueToSides(values, nextValue, sides);
onChange(nextValues);
};
const sliderOnChange = next => {
onValueChange(next !== undefined ? [next, parsedUnit].join('') : undefined);
};
// Set selected unit so it can be used as fallback by unlinked controls
// when individual sides do not have a value containing a unit.
const handleOnUnitChange = unit => {
const newUnits = applyValueToSides(selectedUnits, unit, sides);
setSelectedUnits(newUnits);
};
return (0,external_React_.createElement)(h_stack_component, null, (0,external_React_.createElement)(StyledUnitControl, {
...props,
__next40pxDefaultSize: __next40pxDefaultSize,
className: "component-box-control__unit-control",
disableUnits: isMixed,
id: inputId,
isPressEnterToChange: true,
value: allValue,
onChange: onValueChange,
onUnitChange: handleOnUnitChange,
onFocus: handleOnFocus,
placeholder: allPlaceholder,
label: LABELS.all,
hideLabelFromVision: true
}), (0,external_React_.createElement)(FlexedRangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: __next40pxDefaultSize,
"aria-controls": inputId,
label: LABELS.all,
hideLabelFromVision: true,
onChange: sliderOnChange,
min: 0,
max: (_CUSTOM_VALUE_SETTING = CUSTOM_VALUE_SETTINGS[parsedUnit !== null && parsedUnit !== void 0 ? parsedUnit : 'px']?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10,
step: (_CUSTOM_VALUE_SETTING2 = CUSTOM_VALUE_SETTINGS[parsedUnit !== null && parsedUnit !== void 0 ? parsedUnit : 'px']?.step) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 0.1,
value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : 0,
withInputField: false
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/input-controls.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const input_controls_noop = () => {};
function BoxInputControls({
__next40pxDefaultSize,
onChange = input_controls_noop,
onFocus = input_controls_noop,
values,
selectedUnits,
setSelectedUnits,
sides,
...props
}) {
const generatedId = (0,external_wp_compose_namespaceObject.useInstanceId)(BoxInputControls, 'box-control-input');
const createHandleOnFocus = side => event => {
onFocus(event, {
side
});
};
const handleOnChange = nextValues => {
onChange(nextValues);
};
const handleOnValueChange = (side, next, extra) => {
const nextValues = {
...values
};
const isNumeric = next !== undefined && !isNaN(parseFloat(next));
const nextValue = isNumeric ? next : undefined;
nextValues[side] = nextValue;
/**
* Supports changing pair sides. For example, holding the ALT key
* when changing the TOP will also update BOTTOM.
*/
// @ts-expect-error - TODO: event.altKey is only present when the change event was
// triggered by a keyboard event. Should this feature be implemented differently so
// it also works with drag events?
if (extra?.event.altKey) {
switch (side) {
case 'top':
nextValues.bottom = nextValue;
break;
case 'bottom':
nextValues.top = nextValue;
break;
case 'left':
nextValues.right = nextValue;
break;
case 'right':
nextValues.left = nextValue;
break;
}
}
handleOnChange(nextValues);
};
const createHandleOnUnitChange = side => next => {
const newUnits = {
...selectedUnits
};
newUnits[side] = next;
setSelectedUnits(newUnits);
};
// Filter sides if custom configuration provided, maintaining default order.
const filteredSides = sides?.length ? ALL_SIDES.filter(side => sides.includes(side)) : ALL_SIDES;
return (0,external_React_.createElement)(external_React_.Fragment, null, filteredSides.map(side => {
var _CUSTOM_VALUE_SETTING, _CUSTOM_VALUE_SETTING2;
const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(values[side]);
const computedUnit = values[side] ? parsedUnit : selectedUnits[side];
const inputId = [generatedId, side].join('-');
return (0,external_React_.createElement)(InputWrapper, {
key: `box-control-${side}`,
expanded: true
}, (0,external_React_.createElement)(FlexedBoxControlIcon, {
side: side,
sides: sides
}), (0,external_React_.createElement)(tooltip, {
placement: "top-end",
text: LABELS[side]
}, (0,external_React_.createElement)(StyledUnitControl, {
...props,
__next40pxDefaultSize: __next40pxDefaultSize,
className: "component-box-control__unit-control",
id: inputId,
isPressEnterToChange: true,
value: [parsedQuantity, computedUnit].join(''),
onChange: (nextValue, extra) => handleOnValueChange(side, nextValue, extra),
onUnitChange: createHandleOnUnitChange(side),
onFocus: createHandleOnFocus(side),
label: LABELS[side],
hideLabelFromVision: true
})), (0,external_React_.createElement)(FlexedRangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: __next40pxDefaultSize,
"aria-controls": inputId,
label: LABELS[side],
hideLabelFromVision: true,
onChange: newValue => {
handleOnValueChange(side, newValue !== undefined ? [newValue, computedUnit].join('') : undefined);
},
min: 0,
max: (_CUSTOM_VALUE_SETTING = CUSTOM_VALUE_SETTINGS[computedUnit !== null && computedUnit !== void 0 ? computedUnit : 'px']?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10,
step: (_CUSTOM_VALUE_SETTING2 = CUSTOM_VALUE_SETTINGS[computedUnit !== null && computedUnit !== void 0 ? computedUnit : 'px']?.step) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 0.1,
value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : 0,
withInputField: false
}));
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/axial-input-controls.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const groupedSides = ['vertical', 'horizontal'];
function AxialInputControls({
__next40pxDefaultSize,
onChange,
onFocus,
values,
selectedUnits,
setSelectedUnits,
sides,
...props
}) {
const generatedId = (0,external_wp_compose_namespaceObject.useInstanceId)(AxialInputControls, `box-control-input`);
const createHandleOnFocus = side => event => {
if (!onFocus) {
return;
}
onFocus(event, {
side
});
};
const handleOnValueChange = (side, next) => {
if (!onChange) {
return;
}
const nextValues = {
...values
};
const isNumeric = next !== undefined && !isNaN(parseFloat(next));
const nextValue = isNumeric ? next : undefined;
if (side === 'vertical') {
nextValues.top = nextValue;
nextValues.bottom = nextValue;
}
if (side === 'horizontal') {
nextValues.left = nextValue;
nextValues.right = nextValue;
}
onChange(nextValues);
};
const createHandleOnUnitChange = side => next => {
const newUnits = {
...selectedUnits
};
if (side === 'vertical') {
newUnits.top = next;
newUnits.bottom = next;
}
if (side === 'horizontal') {
newUnits.left = next;
newUnits.right = next;
}
setSelectedUnits(newUnits);
};
// Filter sides if custom configuration provided, maintaining default order.
const filteredSides = sides?.length ? groupedSides.filter(side => sides.includes(side)) : groupedSides;
return (0,external_React_.createElement)(external_React_.Fragment, null, filteredSides.map(side => {
var _CUSTOM_VALUE_SETTING, _CUSTOM_VALUE_SETTING2;
const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(side === 'vertical' ? values.top : values.left);
const selectedUnit = side === 'vertical' ? selectedUnits.top : selectedUnits.left;
const inputId = [generatedId, side].join('-');
return (0,external_React_.createElement)(InputWrapper, {
key: side
}, (0,external_React_.createElement)(FlexedBoxControlIcon, {
side: side,
sides: sides
}), (0,external_React_.createElement)(tooltip, {
placement: "top-end",
text: LABELS[side]
}, (0,external_React_.createElement)(StyledUnitControl, {
...props,
__next40pxDefaultSize: __next40pxDefaultSize,
className: "component-box-control__unit-control",
id: inputId,
isPressEnterToChange: true,
value: [parsedQuantity, selectedUnit !== null && selectedUnit !== void 0 ? selectedUnit : parsedUnit].join(''),
onChange: newValue => handleOnValueChange(side, newValue),
onUnitChange: createHandleOnUnitChange(side),
onFocus: createHandleOnFocus(side),
label: LABELS[side],
hideLabelFromVision: true,
key: side
})), (0,external_React_.createElement)(FlexedRangeControl, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: __next40pxDefaultSize,
"aria-controls": inputId,
label: LABELS[side],
hideLabelFromVision: true,
onChange: newValue => handleOnValueChange(side, newValue !== undefined ? [newValue, selectedUnit !== null && selectedUnit !== void 0 ? selectedUnit : parsedUnit].join('') : undefined),
min: 0,
max: (_CUSTOM_VALUE_SETTING = CUSTOM_VALUE_SETTINGS[selectedUnit !== null && selectedUnit !== void 0 ? selectedUnit : 'px']?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10,
step: (_CUSTOM_VALUE_SETTING2 = CUSTOM_VALUE_SETTINGS[selectedUnit !== null && selectedUnit !== void 0 ? selectedUnit : 'px']?.step) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 0.1,
value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : 0,
withInputField: false
}));
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/linked-button.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function LinkedButton({
isLinked,
...props
}) {
const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink sides') : (0,external_wp_i18n_namespaceObject.__)('Link sides');
return (0,external_React_.createElement)(tooltip, {
text: label
}, (0,external_React_.createElement)(build_module_button, {
...props,
className: "component-box-control__linked-button",
size: "small",
icon: isLinked ? library_link : link_off,
iconSize: 24,
"aria-label": label
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const defaultInputProps = {
min: 0
};
const box_control_noop = () => {};
function box_control_useUniqueId(idProp) {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BoxControl, 'inspector-box-control');
return idProp || instanceId;
}
/**
* BoxControl components let users set values for Top, Right, Bottom, and Left.
* This can be used as an input control for values like `padding` or `margin`.
*
* ```jsx
* import { __experimentalBoxControl as BoxControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const Example = () => {
* const [ values, setValues ] = useState( {
* top: '50px',
* left: '10%',
* right: '10%',
* bottom: '50px',
* } );
*
* return (
* <BoxControl
* values={ values }
* onChange={ ( nextValues ) => setValues( nextValues ) }
* />
* );
* };
* ```
*/
function BoxControl({
__next40pxDefaultSize = false,
id: idProp,
inputProps = defaultInputProps,
onChange = box_control_noop,
label = (0,external_wp_i18n_namespaceObject.__)('Box Control'),
values: valuesProp,
units,
sides,
splitOnAxis = false,
allowReset = true,
resetValues = DEFAULT_VALUES,
onMouseOver,
onMouseOut
}) {
const [values, setValues] = use_controlled_state(valuesProp, {
fallback: DEFAULT_VALUES
});
const inputValues = values || DEFAULT_VALUES;
const hasInitialValue = isValuesDefined(valuesProp);
const hasOneSide = sides?.length === 1;
const [isDirty, setIsDirty] = (0,external_wp_element_namespaceObject.useState)(hasInitialValue);
const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)(!hasInitialValue || !isValuesMixed(inputValues) || hasOneSide);
const [side, setSide] = (0,external_wp_element_namespaceObject.useState)(getInitialSide(isLinked, splitOnAxis));
// Tracking selected units via internal state allows filtering of CSS unit
// only values from being saved while maintaining preexisting unit selection
// behaviour. Filtering CSS only values prevents invalid style values.
const [selectedUnits, setSelectedUnits] = (0,external_wp_element_namespaceObject.useState)({
top: parseQuantityAndUnitFromRawValue(valuesProp?.top)[1],
right: parseQuantityAndUnitFromRawValue(valuesProp?.right)[1],
bottom: parseQuantityAndUnitFromRawValue(valuesProp?.bottom)[1],
left: parseQuantityAndUnitFromRawValue(valuesProp?.left)[1]
});
const id = box_control_useUniqueId(idProp);
const headingId = `${id}-heading`;
const toggleLinked = () => {
setIsLinked(!isLinked);
setSide(getInitialSide(!isLinked, splitOnAxis));
};
const handleOnFocus = (_event, {
side: nextSide
}) => {
setSide(nextSide);
};
const handleOnChange = nextValues => {
onChange(nextValues);
setValues(nextValues);
setIsDirty(true);
};
const handleOnReset = () => {
onChange(resetValues);
setValues(resetValues);
setSelectedUnits(resetValues);
setIsDirty(false);
};
const inputControlProps = {
...inputProps,
onChange: handleOnChange,
onFocus: handleOnFocus,
isLinked,
units,
selectedUnits,
setSelectedUnits,
sides,
values: inputValues,
onMouseOver,
onMouseOut,
__next40pxDefaultSize
};
return (0,external_React_.createElement)(grid_component, {
id: id,
columns: 3,
templateColumns: "1fr min-content min-content",
role: "group",
"aria-labelledby": headingId
}, (0,external_React_.createElement)(BaseControl.VisualLabel, {
id: headingId
}, label), isLinked && (0,external_React_.createElement)(InputWrapper, null, (0,external_React_.createElement)(FlexedBoxControlIcon, {
side: side,
sides: sides
}), (0,external_React_.createElement)(AllInputControl, {
...inputControlProps
})), !hasOneSide && (0,external_React_.createElement)(LinkedButtonWrapper, null, (0,external_React_.createElement)(LinkedButton, {
onClick: toggleLinked,
isLinked: isLinked
})), !isLinked && splitOnAxis && (0,external_React_.createElement)(AxialInputControls, {
...inputControlProps
}), !isLinked && !splitOnAxis && (0,external_React_.createElement)(BoxInputControls, {
...inputControlProps
}), allowReset && (0,external_React_.createElement)(ResetButton, {
className: "component-box-control__reset-button",
variant: "secondary",
size: "small",
onClick: handleOnReset,
disabled: !isDirty
}, (0,external_wp_i18n_namespaceObject.__)('Reset')));
}
/* harmony default export */ const box_control = (BoxControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/button-group/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedButtonGroup(props, ref) {
const {
className,
...restProps
} = props;
const classes = classnames_default()('components-button-group', className);
return (0,external_React_.createElement)("div", {
ref: ref,
role: "group",
className: classes,
...restProps
});
}
/**
* ButtonGroup can be used to group any related buttons together. To emphasize
* related buttons, a group should share a common container.
*
* ```jsx
* import { Button, ButtonGroup } from '@wordpress/components';
*
* const MyButtonGroup = () => (
* <ButtonGroup>
* <Button variant="primary">Button 1</Button>
* <Button variant="primary">Button 2</Button>
* </ButtonGroup>
* );
* ```
*/
const ButtonGroup = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedButtonGroup);
/* harmony default export */ const button_group = (ButtonGroup);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/elevation/styles.js
function elevation_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
const Elevation = true ? {
name: "12ip69d",
styles: "background:transparent;display:block;margin:0!important;pointer-events:none;position:absolute;will-change:box-shadow"
} : 0;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/elevation/hook.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function getBoxShadow(value) {
const boxShadowColor = `rgba(0, 0, 0, ${value / 20})`;
const boxShadow = `0 ${value}px ${value * 2}px 0
${boxShadowColor}`;
return boxShadow;
}
function useElevation(props) {
const {
active,
borderRadius = 'inherit',
className,
focus,
hover,
isInteractive = false,
offset = 0,
value = 0,
...otherProps
} = useContextSystem(props, 'Elevation');
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
let hoverValue = isValueDefined(hover) ? hover : value * 2;
let activeValue = isValueDefined(active) ? active : value / 2;
if (!isInteractive) {
hoverValue = isValueDefined(hover) ? hover : undefined;
activeValue = isValueDefined(active) ? active : undefined;
}
const transition = `box-shadow ${config_values.transitionDuration} ${config_values.transitionTimingFunction}`;
const sx = {};
sx.Base = /*#__PURE__*/emotion_react_browser_esm_css({
borderRadius,
bottom: offset,
boxShadow: getBoxShadow(value),
opacity: config_values.elevationIntensity,
left: offset,
right: offset,
top: offset,
transition
}, reduceMotion('transition'), true ? "" : 0, true ? "" : 0);
if (isValueDefined(hoverValue)) {
sx.hover = /*#__PURE__*/emotion_react_browser_esm_css("*:hover>&{box-shadow:", getBoxShadow(hoverValue), ";}" + ( true ? "" : 0), true ? "" : 0);
}
if (isValueDefined(activeValue)) {
sx.active = /*#__PURE__*/emotion_react_browser_esm_css("*:active>&{box-shadow:", getBoxShadow(activeValue), ";}" + ( true ? "" : 0), true ? "" : 0);
}
if (isValueDefined(focus)) {
sx.focus = /*#__PURE__*/emotion_react_browser_esm_css("*:focus>&{box-shadow:", getBoxShadow(focus), ";}" + ( true ? "" : 0), true ? "" : 0);
}
return cx(Elevation, sx.Base, sx.hover, sx.focus, sx.active, className);
}, [active, borderRadius, className, cx, focus, hover, isInteractive, offset, value]);
return {
...otherProps,
className: classes,
'aria-hidden': true
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/elevation/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedElevation(props, forwardedRef) {
const elevationProps = useElevation(props);
return (0,external_React_.createElement)(component, {
...elevationProps,
ref: forwardedRef
});
}
/**
* `Elevation` is a core component that renders shadow, using the component
* system's shadow system.
*
* The shadow effect is generated using the `value` prop.
*
* ```jsx
* import {
* __experimentalElevation as Elevation,
* __experimentalSurface as Surface,
* __experimentalText as Text,
* } from '@wordpress/components';
*
* function Example() {
* return (
* <Surface>
* <Text>Code is Poetry</Text>
* <Elevation value={ 5 } />
* </Surface>
* );
* }
* ```
*/
const component_Elevation = contextConnect(UnconnectedElevation, 'Elevation');
/* harmony default export */ const elevation_component = (component_Elevation);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/styles.js
function card_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
// Since the border for `Card` is rendered via the `box-shadow` property
// (as opposed to the `border` property), the value of the border radius needs
// to be adjusted by removing 1px (this is because the `box-shadow` renders
// as an "outer radius").
const adjustedBorderRadius = `calc(${config_values.cardBorderRadius} - 1px)`;
const Card = /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:0 0 0 1px ", config_values.surfaceBorderColor, ";outline:none;" + ( true ? "" : 0), true ? "" : 0);
const Header = true ? {
name: "1showjb",
styles: "border-bottom:1px solid;box-sizing:border-box;&:last-child{border-bottom:none;}"
} : 0;
const Footer = true ? {
name: "14n5oej",
styles: "border-top:1px solid;box-sizing:border-box;&:first-of-type{border-top:none;}"
} : 0;
const Content = true ? {
name: "13udsys",
styles: "height:100%"
} : 0;
const Body = true ? {
name: "6ywzd",
styles: "box-sizing:border-box;height:auto;max-height:100%"
} : 0;
const Media = true ? {
name: "dq805e",
styles: "box-sizing:border-box;overflow:hidden;&>img,&>iframe{display:block;height:auto;max-width:100%;width:100%;}"
} : 0;
const Divider = true ? {
name: "c990dr",
styles: "box-sizing:border-box;display:block;width:100%"
} : 0;
const borderRadius = /*#__PURE__*/emotion_react_browser_esm_css("&:first-of-type{border-top-left-radius:", adjustedBorderRadius, ";border-top-right-radius:", adjustedBorderRadius, ";}&:last-of-type{border-bottom-left-radius:", adjustedBorderRadius, ";border-bottom-right-radius:", adjustedBorderRadius, ";}" + ( true ? "" : 0), true ? "" : 0);
const borderColor = /*#__PURE__*/emotion_react_browser_esm_css("border-color:", config_values.colorDivider, ";" + ( true ? "" : 0), true ? "" : 0);
const boxShadowless = true ? {
name: "1t90u8d",
styles: "box-shadow:none"
} : 0;
const borderless = true ? {
name: "1e1ncky",
styles: "border:none"
} : 0;
const rounded = /*#__PURE__*/emotion_react_browser_esm_css("border-radius:", adjustedBorderRadius, ";" + ( true ? "" : 0), true ? "" : 0);
const xSmallCardPadding = /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingXSmall, ";" + ( true ? "" : 0), true ? "" : 0);
const cardPaddings = {
large: /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingLarge, ";" + ( true ? "" : 0), true ? "" : 0),
medium: /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingMedium, ";" + ( true ? "" : 0), true ? "" : 0),
small: /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingSmall, ";" + ( true ? "" : 0), true ? "" : 0),
xSmall: xSmallCardPadding,
// The `extraSmall` size is not officially documented, but the following styles
// are kept for legacy reasons to support older values of the `size` prop.
extraSmall: xSmallCardPadding
};
const shady = /*#__PURE__*/emotion_react_browser_esm_css("background-color:", COLORS.ui.backgroundDisabled, ";" + ( true ? "" : 0), true ? "" : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/surface/styles.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const Surface = /*#__PURE__*/emotion_react_browser_esm_css("background-color:", config_values.surfaceColor, ";color:", COLORS.gray[900], ";position:relative;" + ( true ? "" : 0), true ? "" : 0);
const background = /*#__PURE__*/emotion_react_browser_esm_css("background-color:", config_values.surfaceBackgroundColor, ";" + ( true ? "" : 0), true ? "" : 0);
function getBorders({
borderBottom,
borderLeft,
borderRight,
borderTop
}) {
const borderStyle = `1px solid ${config_values.surfaceBorderColor}`;
return /*#__PURE__*/emotion_react_browser_esm_css({
borderBottom: borderBottom ? borderStyle : undefined,
borderLeft: borderLeft ? borderStyle : undefined,
borderRight: borderRight ? borderStyle : undefined,
borderTop: borderTop ? borderStyle : undefined
}, true ? "" : 0, true ? "" : 0);
}
const primary = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
const secondary = /*#__PURE__*/emotion_react_browser_esm_css("background:", config_values.surfaceBackgroundTintColor, ";" + ( true ? "" : 0), true ? "" : 0);
const tertiary = /*#__PURE__*/emotion_react_browser_esm_css("background:", config_values.surfaceBackgroundTertiaryColor, ";" + ( true ? "" : 0), true ? "" : 0);
const customBackgroundSize = surfaceBackgroundSize => [surfaceBackgroundSize, surfaceBackgroundSize].join(' ');
const dottedBackground1 = surfaceBackgroundSizeDotted => ['90deg', [config_values.surfaceBackgroundColor, surfaceBackgroundSizeDotted].join(' '), 'transparent 1%'].join(',');
const dottedBackground2 = surfaceBackgroundSizeDotted => [[config_values.surfaceBackgroundColor, surfaceBackgroundSizeDotted].join(' '), 'transparent 1%'].join(',');
const dottedBackgroundCombined = surfaceBackgroundSizeDotted => [`linear-gradient( ${dottedBackground1(surfaceBackgroundSizeDotted)} ) center`, `linear-gradient( ${dottedBackground2(surfaceBackgroundSizeDotted)} ) center`, config_values.surfaceBorderBoldColor].join(',');
const getDotted = (surfaceBackgroundSize, surfaceBackgroundSizeDotted) => /*#__PURE__*/emotion_react_browser_esm_css("background:", dottedBackgroundCombined(surfaceBackgroundSizeDotted), ";background-size:", customBackgroundSize(surfaceBackgroundSize), ";" + ( true ? "" : 0), true ? "" : 0);
const gridBackground1 = [`${config_values.surfaceBorderSubtleColor} 1px`, 'transparent 1px'].join(',');
const gridBackground2 = ['90deg', `${config_values.surfaceBorderSubtleColor} 1px`, 'transparent 1px'].join(',');
const gridBackgroundCombined = [`linear-gradient( ${gridBackground1} )`, `linear-gradient( ${gridBackground2} )`].join(',');
const getGrid = surfaceBackgroundSize => {
return /*#__PURE__*/emotion_react_browser_esm_css("background:", config_values.surfaceBackgroundColor, ";background-image:", gridBackgroundCombined, ";background-size:", customBackgroundSize(surfaceBackgroundSize), ";" + ( true ? "" : 0), true ? "" : 0);
};
const getVariant = (variant, surfaceBackgroundSize, surfaceBackgroundSizeDotted) => {
switch (variant) {
case 'dotted':
{
return getDotted(surfaceBackgroundSize, surfaceBackgroundSizeDotted);
}
case 'grid':
{
return getGrid(surfaceBackgroundSize);
}
case 'primary':
{
return primary;
}
case 'secondary':
{
return secondary;
}
case 'tertiary':
{
return tertiary;
}
}
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/surface/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useSurface(props) {
const {
backgroundSize = 12,
borderBottom = false,
borderLeft = false,
borderRight = false,
borderTop = false,
className,
variant = 'primary',
...otherProps
} = useContextSystem(props, 'Surface');
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
const sx = {
borders: getBorders({
borderBottom,
borderLeft,
borderRight,
borderTop
})
};
return cx(Surface, sx.borders, getVariant(variant, `${backgroundSize}px`, `${backgroundSize - 1}px`), className);
}, [backgroundSize, borderBottom, borderLeft, borderRight, borderTop, className, cx, variant]);
return {
...otherProps,
className: classes
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function hook_useDeprecatedProps({
elevation,
isElevated,
...otherProps
}) {
const propsToReturn = {
...otherProps
};
let computedElevation = elevation;
if (isElevated) {
var _computedElevation;
external_wp_deprecated_default()('Card isElevated prop', {
since: '5.9',
alternative: 'elevation'
});
(_computedElevation = computedElevation) !== null && _computedElevation !== void 0 ? _computedElevation : computedElevation = 2;
}
// The `elevation` prop should only be passed when it's not `undefined`,
// otherwise it will override the value that gets derived from `useContextSystem`.
if (typeof computedElevation !== 'undefined') {
propsToReturn.elevation = computedElevation;
}
return propsToReturn;
}
function useCard(props) {
const {
className,
elevation = 0,
isBorderless = false,
isRounded = true,
size = 'medium',
...otherProps
} = useContextSystem(hook_useDeprecatedProps(props), 'Card');
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(Card, isBorderless && boxShadowless, isRounded && rounded, className);
}, [className, cx, isBorderless, isRounded]);
const surfaceProps = useSurface({
...otherProps,
className: classes
});
return {
...surfaceProps,
elevation,
isBorderless,
isRounded,
size
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card/component.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedCard(props, forwardedRef) {
const {
children,
elevation,
isBorderless,
isRounded,
size,
...otherProps
} = useCard(props);
const elevationBorderRadius = isRounded ? config_values.cardBorderRadius : 0;
const cx = useCx();
const elevationClassName = (0,external_wp_element_namespaceObject.useMemo)(() => cx( /*#__PURE__*/emotion_react_browser_esm_css({
borderRadius: elevationBorderRadius
}, true ? "" : 0, true ? "" : 0)), [cx, elevationBorderRadius]);
const contextProviderValue = (0,external_wp_element_namespaceObject.useMemo)(() => {
const contextProps = {
size,
isBorderless
};
return {
CardBody: contextProps,
CardHeader: contextProps,
CardFooter: contextProps
};
}, [isBorderless, size]);
return (0,external_React_.createElement)(ContextSystemProvider, {
value: contextProviderValue
}, (0,external_React_.createElement)(component, {
...otherProps,
ref: forwardedRef
}, (0,external_React_.createElement)(component, {
className: cx(Content)
}, children), (0,external_React_.createElement)(elevation_component, {
className: elevationClassName,
isInteractive: false,
value: elevation ? 1 : 0
}), (0,external_React_.createElement)(elevation_component, {
className: elevationClassName,
isInteractive: false,
value: elevation
})));
}
/**
* `Card` provides a flexible and extensible content container.
* `Card` also provides a convenient set of sub-components such as `CardBody`,
* `CardHeader`, `CardFooter`, and more.
*
* ```jsx
* import {
* Card,
* CardHeader,
* CardBody,
* CardFooter,
* __experimentalText as Text,
* __experimentalHeading as Heading,
* } from `@wordpress/components`;
*
* function Example() {
* return (
* <Card>
* <CardHeader>
* <Heading level={ 4 }>Card Title</Heading>
* </CardHeader>
* <CardBody>
* <Text>Card Content</Text>
* </CardBody>
* <CardFooter>
* <Text>Card Footer</Text>
* </CardFooter>
* </Card>
* );
* }
* ```
*/
const component_Card = contextConnect(UnconnectedCard, 'Card');
/* harmony default export */ const card_component = (component_Card);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/scrollable/styles.js
function scrollable_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const scrollableScrollbar = /*#__PURE__*/emotion_react_browser_esm_css("@media only screen and ( min-device-width: 40em ){&::-webkit-scrollbar{height:12px;width:12px;}&::-webkit-scrollbar-track{background-color:transparent;}&::-webkit-scrollbar-track{background:", config_values.colorScrollbarTrack, ";border-radius:8px;}&::-webkit-scrollbar-thumb{background-clip:padding-box;background-color:", config_values.colorScrollbarThumb, ";border:2px solid rgba( 0, 0, 0, 0 );border-radius:7px;}&:hover::-webkit-scrollbar-thumb{background-color:", config_values.colorScrollbarThumbHover, ";}}" + ( true ? "" : 0), true ? "" : 0);
const Scrollable = true ? {
name: "13udsys",
styles: "height:100%"
} : 0;
const styles_Content = true ? {
name: "bjn8wh",
styles: "position:relative"
} : 0;
const styles_smoothScroll = true ? {
name: "7zq9w",
styles: "scroll-behavior:smooth"
} : 0;
const scrollX = true ? {
name: "q33xhg",
styles: "overflow-x:auto;overflow-y:hidden"
} : 0;
const scrollY = true ? {
name: "103x71s",
styles: "overflow-x:hidden;overflow-y:auto"
} : 0;
const scrollAuto = true ? {
name: "umwchj",
styles: "overflow-y:auto"
} : 0;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/scrollable/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useScrollable(props) {
const {
className,
scrollDirection = 'y',
smoothScroll = false,
...otherProps
} = useContextSystem(props, 'Scrollable');
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Scrollable, scrollableScrollbar, smoothScroll && styles_smoothScroll, scrollDirection === 'x' && scrollX, scrollDirection === 'y' && scrollY, scrollDirection === 'auto' && scrollAuto, className), [className, cx, scrollDirection, smoothScroll]);
return {
...otherProps,
className: classes
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/scrollable/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedScrollable(props, forwardedRef) {
const scrollableProps = useScrollable(props);
return (0,external_React_.createElement)(component, {
...scrollableProps,
ref: forwardedRef
});
}
/**
* `Scrollable` is a layout component that content in a scrollable container.
*
* ```jsx
* import { __experimentalScrollable as Scrollable } from `@wordpress/components`;
*
* function Example() {
* return (
* <Scrollable style={ { maxHeight: 200 } }>
* <div style={ { height: 500 } }>...</div>
* </Scrollable>
* );
* }
* ```
*/
const component_Scrollable = contextConnect(UnconnectedScrollable, 'Scrollable');
/* harmony default export */ const scrollable_component = (component_Scrollable);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-body/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useCardBody(props) {
const {
className,
isScrollable = false,
isShady = false,
size = 'medium',
...otherProps
} = useContextSystem(props, 'CardBody');
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Body, borderRadius, cardPaddings[size], isShady && shady,
// This classname is added for legacy compatibility reasons.
'components-card__body', className), [className, cx, isShady, size]);
return {
...otherProps,
className: classes,
isScrollable
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-body/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedCardBody(props, forwardedRef) {
const {
isScrollable,
...otherProps
} = useCardBody(props);
if (isScrollable) {
return (0,external_React_.createElement)(scrollable_component, {
...otherProps,
ref: forwardedRef
});
}
return (0,external_React_.createElement)(component, {
...otherProps,
ref: forwardedRef
});
}
/**
* `CardBody` renders an optional content area for a `Card`.
* Multiple `CardBody` components can be used within `Card` if needed.
*
* ```jsx
* import { Card, CardBody } from `@wordpress/components`;
*
* <Card>
* <CardBody>
* ...
* </CardBody>
* </Card>
* ```
*/
const CardBody = contextConnect(UnconnectedCardBody, 'CardBody');
/* harmony default export */ const card_body_component = (CardBody);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/YZEJGRDQ.js
"use client";
// src/separator/separator.ts
var useSeparator = createHook(
(_a) => {
var _b = _a, { orientation = "horizontal" } = _b, props = __objRest(_b, ["orientation"]);
props = _4R3V3JGP_spreadValues({
role: "separator",
"aria-orientation": orientation
}, props);
return props;
}
);
var Separator = createComponent((props) => {
const htmlProps = useSeparator(props);
return _3ORBWXWF_createElement("hr", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/divider/styles.js
function divider_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const MARGIN_DIRECTIONS = {
vertical: {
start: 'marginLeft',
end: 'marginRight'
},
horizontal: {
start: 'marginTop',
end: 'marginBottom'
}
};
// Renders the correct margins given the Divider's `orientation` and the writing direction.
// When both the generic `margin` and the specific `marginStart|marginEnd` props are defined,
// the latter will take priority.
const renderMargin = ({
'aria-orientation': orientation = 'horizontal',
margin,
marginStart,
marginEnd
}) => /*#__PURE__*/emotion_react_browser_esm_css(rtl({
[MARGIN_DIRECTIONS[orientation].start]: space(marginStart !== null && marginStart !== void 0 ? marginStart : margin),
[MARGIN_DIRECTIONS[orientation].end]: space(marginEnd !== null && marginEnd !== void 0 ? marginEnd : margin)
})(), true ? "" : 0, true ? "" : 0);
var divider_styles_ref = true ? {
name: "1u4hpl4",
styles: "display:inline"
} : 0;
const renderDisplay = ({
'aria-orientation': orientation = 'horizontal'
}) => {
return orientation === 'vertical' ? divider_styles_ref : undefined;
};
const renderBorder = ({
'aria-orientation': orientation = 'horizontal'
}) => {
return /*#__PURE__*/emotion_react_browser_esm_css({
[orientation === 'vertical' ? 'borderRight' : 'borderBottom']: '1px solid currentColor'
}, true ? "" : 0, true ? "" : 0);
};
const renderSize = ({
'aria-orientation': orientation = 'horizontal'
}) => /*#__PURE__*/emotion_react_browser_esm_css({
height: orientation === 'vertical' ? 'auto' : 0,
width: orientation === 'vertical' ? 0 : 'auto'
}, true ? "" : 0, true ? "" : 0);
const DividerView = emotion_styled_base_browser_esm("hr", true ? {
target: "e19on6iw0"
} : 0)("border:0;margin:0;", renderDisplay, " ", renderBorder, " ", renderSize, " ", renderMargin, ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/divider/component.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
function UnconnectedDivider(props, forwardedRef) {
const contextProps = useContextSystem(props, 'Divider');
return (0,external_React_.createElement)(Separator, {
render: (0,external_React_.createElement)(DividerView, null),
...contextProps,
ref: forwardedRef
});
}
/**
* `Divider` is a layout component that separates groups of related content.
*
* ```js
* import {
* __experimentalDivider as Divider,
* __experimentalText as Text,
* __experimentalVStack as VStack,
* } from `@wordpress/components`;
*
* function Example() {
* return (
* <VStack spacing={4}>
* <Text>Some text here</Text>
* <Divider />
* <Text>Some more text here</Text>
* </VStack>
* );
* }
* ```
*/
const component_Divider = contextConnect(UnconnectedDivider, 'Divider');
/* harmony default export */ const divider_component = (component_Divider);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-divider/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useCardDivider(props) {
const {
className,
...otherProps
} = useContextSystem(props, 'CardDivider');
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Divider, borderColor,
// This classname is added for legacy compatibility reasons.
'components-card__divider', className), [className, cx]);
return {
...otherProps,
className: classes
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-divider/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedCardDivider(props, forwardedRef) {
const dividerProps = useCardDivider(props);
return (0,external_React_.createElement)(divider_component, {
...dividerProps,
ref: forwardedRef
});
}
/**
* `CardDivider` renders an optional divider within a `Card`.
* It is typically used to divide multiple `CardBody` components from each other.
*
* ```jsx
* import { Card, CardBody, CardDivider } from `@wordpress/components`;
*
* <Card>
* <CardBody>...</CardBody>
* <CardDivider />
* <CardBody>...</CardBody>
* </Card>
* ```
*/
const CardDivider = contextConnect(UnconnectedCardDivider, 'CardDivider');
/* harmony default export */ const card_divider_component = (CardDivider);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-footer/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useCardFooter(props) {
const {
className,
justify,
isBorderless = false,
isShady = false,
size = 'medium',
...otherProps
} = useContextSystem(props, 'CardFooter');
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Footer, borderRadius, borderColor, cardPaddings[size], isBorderless && borderless, isShady && shady,
// This classname is added for legacy compatibility reasons.
'components-card__footer', className), [className, cx, isBorderless, isShady, size]);
return {
...otherProps,
className: classes,
justify
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-footer/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedCardFooter(props, forwardedRef) {
const footerProps = useCardFooter(props);
return (0,external_React_.createElement)(flex_component, {
...footerProps,
ref: forwardedRef
});
}
/**
* `CardFooter` renders an optional footer within a `Card`.
*
* ```jsx
* import { Card, CardBody, CardFooter } from `@wordpress/components`;
*
* <Card>
* <CardBody>...</CardBody>
* <CardFooter>...</CardFooter>
* </Card>
* ```
*/
const CardFooter = contextConnect(UnconnectedCardFooter, 'CardFooter');
/* harmony default export */ const card_footer_component = (CardFooter);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-header/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useCardHeader(props) {
const {
className,
isBorderless = false,
isShady = false,
size = 'medium',
...otherProps
} = useContextSystem(props, 'CardHeader');
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Header, borderRadius, borderColor, cardPaddings[size], isBorderless && borderless, isShady && shady,
// This classname is added for legacy compatibility reasons.
'components-card__header', className), [className, cx, isBorderless, isShady, size]);
return {
...otherProps,
className: classes
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-header/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedCardHeader(props, forwardedRef) {
const headerProps = useCardHeader(props);
return (0,external_React_.createElement)(flex_component, {
...headerProps,
ref: forwardedRef
});
}
/**
* `CardHeader` renders an optional header within a `Card`.
*
* ```jsx
* import { Card, CardBody, CardHeader } from `@wordpress/components`;
*
* <Card>
* <CardHeader>...</CardHeader>
* <CardBody>...</CardBody>
* </Card>
* ```
*/
const CardHeader = contextConnect(UnconnectedCardHeader, 'CardHeader');
/* harmony default export */ const card_header_component = (CardHeader);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-media/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useCardMedia(props) {
const {
className,
...otherProps
} = useContextSystem(props, 'CardMedia');
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Media, borderRadius,
// This classname is added for legacy compatibility reasons.
'components-card__media', className), [className, cx]);
return {
...otherProps,
className: classes
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-media/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedCardMedia(props, forwardedRef) {
const cardMediaProps = useCardMedia(props);
return (0,external_React_.createElement)(component, {
...cardMediaProps,
ref: forwardedRef
});
}
/**
* `CardMedia` provides a container for full-bleed content within a `Card`,
* such as images, video, or even just a background color.
*
* @example
* ```jsx
* import { Card, CardBody, CardMedia } from '@wordpress/components';
*
* const Example = () => (
* <Card>
* <CardMedia>
* <img src="..." />
* </CardMedia>
* <CardBody>...</CardBody>
* </Card>
* );
* ```
*/
const CardMedia = contextConnect(UnconnectedCardMedia, 'CardMedia');
/* harmony default export */ const card_media_component = (CardMedia);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/checkbox-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Checkboxes allow the user to select one or more items from a set.
*
* ```jsx
* import { CheckboxControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyCheckboxControl = () => {
* const [ isChecked, setChecked ] = useState( true );
* return (
* <CheckboxControl
* label="Is author"
* help="Is the user a author or not?"
* checked={ isChecked }
* onChange={ setChecked }
* />
* );
* };
* ```
*/
function CheckboxControl(props) {
const {
__nextHasNoMarginBottom,
label,
className,
heading,
checked,
indeterminate,
help,
id: idProp,
onChange,
...additionalProps
} = props;
if (heading) {
external_wp_deprecated_default()('`heading` prop in `CheckboxControl`', {
alternative: 'a separate element to implement a heading',
since: '5.8'
});
}
const [showCheckedIcon, setShowCheckedIcon] = (0,external_wp_element_namespaceObject.useState)(false);
const [showIndeterminateIcon, setShowIndeterminateIcon] = (0,external_wp_element_namespaceObject.useState)(false);
// Run the following callback every time the `ref` (and the additional
// dependencies) change.
const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
if (!node) {
return;
}
// It cannot be set using an HTML attribute.
node.indeterminate = !!indeterminate;
setShowCheckedIcon(node.matches(':checked'));
setShowIndeterminateIcon(node.matches(':indeterminate'));
}, [checked, indeterminate]);
const id = (0,external_wp_compose_namespaceObject.useInstanceId)(CheckboxControl, 'inspector-checkbox-control', idProp);
const onChangeValue = event => onChange(event.target.checked);
return (0,external_React_.createElement)(base_control, {
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
label: heading,
id: id,
help: help,
className: classnames_default()('components-checkbox-control', className)
}, (0,external_React_.createElement)("span", {
className: "components-checkbox-control__input-container"
}, (0,external_React_.createElement)("input", {
ref: ref,
id: id,
className: "components-checkbox-control__input",
type: "checkbox",
value: "1",
onChange: onChangeValue,
checked: checked,
"aria-describedby": !!help ? id + '__help' : undefined,
...additionalProps
}), showIndeterminateIcon ? (0,external_React_.createElement)(icons_build_module_icon, {
icon: library_reset,
className: "components-checkbox-control__indeterminate",
role: "presentation"
}) : null, showCheckedIcon ? (0,external_React_.createElement)(icons_build_module_icon, {
icon: library_check,
className: "components-checkbox-control__checked",
role: "presentation"
}) : null), label && (0,external_React_.createElement)("label", {
className: "components-checkbox-control__label",
htmlFor: id
}, label));
}
/* harmony default export */ const checkbox_control = (CheckboxControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/clipboard-button/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const TIMEOUT = 4000;
function ClipboardButton({
className,
children,
onCopy,
onFinishCopy,
text,
...buttonProps
}) {
external_wp_deprecated_default()('wp.components.ClipboardButton', {
since: '5.8',
alternative: 'wp.compose.useCopyToClipboard'
});
const timeoutId = (0,external_wp_element_namespaceObject.useRef)();
const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, () => {
onCopy();
if (timeoutId.current) {
clearTimeout(timeoutId.current);
}
if (onFinishCopy) {
timeoutId.current = setTimeout(() => onFinishCopy(), TIMEOUT);
}
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (timeoutId.current) {
clearTimeout(timeoutId.current);
}
}, []);
const classes = classnames_default()('components-clipboard-button', className);
// Workaround for inconsistent behavior in Safari, where <textarea> is not
// the document.activeElement at the moment when the copy event fires.
// This causes documentHasSelection() in the copy-handler component to
// mistakenly override the ClipboardButton, and copy a serialized string
// of the current block instead.
const focusOnCopyEventTarget = event => {
// @ts-expect-error: Should be currentTarget, but not changing because this component is deprecated.
event.target.focus();
};
return (0,external_React_.createElement)(build_module_button, {
...buttonProps,
className: classes,
ref: ref,
onCopy: focusOnCopyEventTarget
}, children);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
/**
* WordPress dependencies
*/
const moreVertical = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
}));
/* harmony default export */ const more_vertical = (moreVertical);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/styles.js
function item_group_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const unstyledButton = as => {
return /*#__PURE__*/emotion_react_browser_esm_css("font-size:", font('default.fontSize'), ";font-family:inherit;appearance:none;border:1px solid transparent;cursor:pointer;background:none;text-align:start;text-decoration:", as === 'a' ? 'none' : undefined, ";svg,path{fill:currentColor;}&:hover{color:", COLORS.theme.accent, ";}&:focus{box-shadow:none;outline:none;}&:focus-visible{box-shadow:0 0 0 var( --wp-admin-border-width-focus ) ", COLORS.theme.accent, ";outline:2px solid transparent;outline-offset:0;}" + ( true ? "" : 0), true ? "" : 0);
};
const itemWrapper = true ? {
name: "1bcj5ek",
styles: "width:100%;display:block"
} : 0;
const item = true ? {
name: "150ruhm",
styles: "box-sizing:border-box;width:100%;display:block;margin:0;color:inherit"
} : 0;
const bordered = /*#__PURE__*/emotion_react_browser_esm_css("border:1px solid ", config_values.surfaceBorderColor, ";" + ( true ? "" : 0), true ? "" : 0);
const separated = /*#__PURE__*/emotion_react_browser_esm_css(">*:not( marquee )>*{border-bottom:1px solid ", config_values.surfaceBorderColor, ";}>*:last-of-type>*:not( :focus ){border-bottom-color:transparent;}" + ( true ? "" : 0), true ? "" : 0);
const styles_borderRadius = config_values.controlBorderRadius;
const styles_spacedAround = /*#__PURE__*/emotion_react_browser_esm_css("border-radius:", styles_borderRadius, ";" + ( true ? "" : 0), true ? "" : 0);
const styles_rounded = /*#__PURE__*/emotion_react_browser_esm_css("border-radius:", styles_borderRadius, ";>*:first-of-type>*{border-top-left-radius:", styles_borderRadius, ";border-top-right-radius:", styles_borderRadius, ";}>*:last-of-type>*{border-bottom-left-radius:", styles_borderRadius, ";border-bottom-right-radius:", styles_borderRadius, ";}" + ( true ? "" : 0), true ? "" : 0);
const baseFontHeight = `calc(${config_values.fontSize} * ${config_values.fontLineHeightBase})`;
/*
* Math:
* - Use the desired height as the base value
* - Subtract the computed height of (default) text
* - Subtract the effects of border
* - Divide the calculated number by 2, in order to get an individual top/bottom padding
*/
const paddingY = `calc((${config_values.controlHeight} - ${baseFontHeight} - 2px) / 2)`;
const paddingYSmall = `calc((${config_values.controlHeightSmall} - ${baseFontHeight} - 2px) / 2)`;
const paddingYLarge = `calc((${config_values.controlHeightLarge} - ${baseFontHeight} - 2px) / 2)`;
const itemSizes = {
small: /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingYSmall, " ", config_values.controlPaddingXSmall, ";" + ( true ? "" : 0), true ? "" : 0),
medium: /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingY, " ", config_values.controlPaddingX, ";" + ( true ? "" : 0), true ? "" : 0),
large: /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingYLarge, " ", config_values.controlPaddingXLarge, ";" + ( true ? "" : 0), true ? "" : 0)
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/item-group/hook.js
/**
* Internal dependencies
*/
/**
* Internal dependencies
*/
function useItemGroup(props) {
const {
className,
isBordered = false,
isRounded = true,
isSeparated = false,
role = 'list',
...otherProps
} = useContextSystem(props, 'ItemGroup');
const cx = useCx();
const classes = cx(isBordered && bordered, isSeparated && separated, isRounded && styles_rounded, className);
return {
isBordered,
className: classes,
role,
isSeparated,
...otherProps
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/context.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ItemGroupContext = (0,external_wp_element_namespaceObject.createContext)({
size: 'medium'
});
const useItemGroupContext = () => (0,external_wp_element_namespaceObject.useContext)(ItemGroupContext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/item-group/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedItemGroup(props, forwardedRef) {
const {
isBordered,
isSeparated,
size: sizeProp,
...otherProps
} = useItemGroup(props);
const {
size: contextSize
} = useItemGroupContext();
const spacedAround = !isBordered && !isSeparated;
const size = sizeProp || contextSize;
const contextValue = {
spacedAround,
size
};
return (0,external_React_.createElement)(ItemGroupContext.Provider, {
value: contextValue
}, (0,external_React_.createElement)(component, {
...otherProps,
ref: forwardedRef
}));
}
/**
* `ItemGroup` displays a list of `Item`s grouped and styled together.
*
* ```jsx
* import {
* __experimentalItemGroup as ItemGroup,
* __experimentalItem as Item,
* } from '@wordpress/components';
*
* function Example() {
* return (
* <ItemGroup>
* <Item>Code</Item>
* <Item>is</Item>
* <Item>Poetry</Item>
* </ItemGroup>
* );
* }
* ```
*/
const ItemGroup = contextConnect(UnconnectedItemGroup, 'ItemGroup');
/* harmony default export */ const item_group_component = (ItemGroup);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/gradient-bar/constants.js
const GRADIENT_MARKERS_WIDTH = 16;
const INSERT_POINT_WIDTH = 16;
const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT = 10;
const MINIMUM_DISTANCE_BETWEEN_POINTS = 0;
const MINIMUM_SIGNIFICANT_MOVE = 5;
const KEYBOARD_CONTROL_POINT_VARIATION = MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;
const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER = (INSERT_POINT_WIDTH + GRADIENT_MARKERS_WIDTH) / 2;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/gradient-bar/utils.js
/**
* Internal dependencies
*/
/**
* Clamps a number between 0 and 100.
*
* @param value Value to clamp.
*
* @return Value clamped between 0 and 100.
*/
function clampPercent(value) {
return Math.max(0, Math.min(100, value));
}
/**
* Check if a control point is overlapping with another.
*
* @param value Array of control points.
* @param initialIndex Index of the position to test.
* @param newPosition New position of the control point.
* @param minDistance Distance considered to be overlapping.
*
* @return True if the point is overlapping.
*/
function isOverlapping(value, initialIndex, newPosition, minDistance = MINIMUM_DISTANCE_BETWEEN_POINTS) {
const initialPosition = value[initialIndex].position;
const minPosition = Math.min(initialPosition, newPosition);
const maxPosition = Math.max(initialPosition, newPosition);
return value.some(({
position
}, index) => {
return index !== initialIndex && (Math.abs(position - newPosition) < minDistance || minPosition < position && position < maxPosition);
});
}
/**
* Adds a control point from an array and returns the new array.
*
* @param points Array of control points.
* @param position Position to insert the new point.
* @param color Color to update the control point at index.
*
* @return New array of control points.
*/
function addControlPoint(points, position, color) {
const nextIndex = points.findIndex(point => point.position > position);
const newPoint = {
color,
position
};
const newPoints = points.slice();
newPoints.splice(nextIndex - 1, 0, newPoint);
return newPoints;
}
/**
* Removes a control point from an array and returns the new array.
*
* @param points Array of control points.
* @param index Index to remove.
*
* @return New array of control points.
*/
function removeControlPoint(points, index) {
return points.filter((_point, pointIndex) => {
return pointIndex !== index;
});
}
/**
* Updates a control point from an array and returns the new array.
*
* @param points Array of control points.
* @param index Index to update.
* @param newPoint New control point to replace the index.
*
* @return New array of control points.
*/
function updateControlPoint(points, index, newPoint) {
const newValue = points.slice();
newValue[index] = newPoint;
return newValue;
}
/**
* Updates the position of a control point from an array and returns the new array.
*
* @param points Array of control points.
* @param index Index to update.
* @param newPosition Position to move the control point at index.
*
* @return New array of control points.
*/
function updateControlPointPosition(points, index, newPosition) {
if (isOverlapping(points, index, newPosition)) {
return points;
}
const newPoint = {
...points[index],
position: newPosition
};
return updateControlPoint(points, index, newPoint);
}
/**
* Updates the position of a control point from an array and returns the new array.
*
* @param points Array of control points.
* @param index Index to update.
* @param newColor Color to update the control point at index.
*
* @return New array of control points.
*/
function updateControlPointColor(points, index, newColor) {
const newPoint = {
...points[index],
color: newColor
};
return updateControlPoint(points, index, newPoint);
}
/**
* Updates the position of a control point from an array and returns the new array.
*
* @param points Array of control points.
* @param position Position of the color stop.
* @param newColor Color to update the control point at index.
*
* @return New array of control points.
*/
function updateControlPointColorByPosition(points, position, newColor) {
const index = points.findIndex(point => point.position === position);
return updateControlPointColor(points, index, newColor);
}
/**
* Gets the horizontal coordinate when dragging a control point with the mouse.
*
* @param mouseXcoordinate Horizontal coordinate of the mouse position.
* @param containerElement Container for the gradient picker.
*
* @return Whole number percentage from the left.
*/
function getHorizontalRelativeGradientPosition(mouseXCoordinate, containerElement) {
if (!containerElement) {
return;
}
const {
x,
width
} = containerElement.getBoundingClientRect();
const absolutePositionValue = mouseXCoordinate - x;
return Math.round(clampPercent(absolutePositionValue * 100 / width));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/gradient-bar/control-points.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ControlPointButton({
isOpen,
position,
color,
...additionalProps
}) {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ControlPointButton);
const descriptionId = `components-custom-gradient-picker__control-point-button-description-${instanceId}`;
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(build_module_button, {
"aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1$s: gradient position e.g: 70, %2$s: gradient color code e.g: rgb(52,121,151).
(0,external_wp_i18n_namespaceObject.__)('Gradient control point at position %1$s%% with color code %2$s.'), position, color),
"aria-describedby": descriptionId,
"aria-haspopup": "true",
"aria-expanded": isOpen,
className: classnames_default()('components-custom-gradient-picker__control-point-button', {
'is-active': isOpen
}),
...additionalProps
}), (0,external_React_.createElement)(visually_hidden_component, {
id: descriptionId
}, (0,external_wp_i18n_namespaceObject.__)('Use your left or right arrow keys or drag and drop with the mouse to change the gradient position. Press the button to change the color or remove the control point.')));
}
function GradientColorPickerDropdown({
isRenderedInSidebar,
className,
...props
}) {
// Open the popover below the gradient control/insertion point
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
placement: 'bottom',
offset: 8,
// Disabling resize as it would otherwise cause the popover to show
// scrollbars while dragging the color picker's handle close to the
// popover edge.
resize: false
}), []);
const mergedClassName = classnames_default()('components-custom-gradient-picker__control-point-dropdown', className);
return (0,external_React_.createElement)(CustomColorPickerDropdown, {
isRenderedInSidebar: isRenderedInSidebar,
popoverProps: popoverProps,
className: mergedClassName,
...props
});
}
function ControlPoints({
disableRemove,
disableAlpha,
gradientPickerDomRef,
ignoreMarkerPosition,
value: controlPoints,
onChange,
onStartControlPointChange,
onStopControlPointChange,
__experimentalIsRenderedInSidebar
}) {
const controlPointMoveState = (0,external_wp_element_namespaceObject.useRef)();
const onMouseMove = event => {
if (controlPointMoveState.current === undefined || gradientPickerDomRef.current === null) {
return;
}
const relativePosition = getHorizontalRelativeGradientPosition(event.clientX, gradientPickerDomRef.current);
const {
initialPosition,
index,
significantMoveHappened
} = controlPointMoveState.current;
if (!significantMoveHappened && Math.abs(initialPosition - relativePosition) >= MINIMUM_SIGNIFICANT_MOVE) {
controlPointMoveState.current.significantMoveHappened = true;
}
onChange(updateControlPointPosition(controlPoints, index, relativePosition));
};
const cleanEventListeners = () => {
if (window && window.removeEventListener && controlPointMoveState.current && controlPointMoveState.current.listenersActivated) {
window.removeEventListener('mousemove', onMouseMove);
window.removeEventListener('mouseup', cleanEventListeners);
onStopControlPointChange();
controlPointMoveState.current.listenersActivated = false;
}
};
// Adding `cleanEventListeners` to the dependency array below requires the function itself to be wrapped in a `useCallback`
// This memoization would prevent the event listeners from being properly cleaned.
// Instead, we'll pass a ref to the function in our `useEffect` so `cleanEventListeners` itself is no longer a dependency.
const cleanEventListenersRef = (0,external_wp_element_namespaceObject.useRef)();
cleanEventListenersRef.current = cleanEventListeners;
(0,external_wp_element_namespaceObject.useEffect)(() => {
return () => {
cleanEventListenersRef.current?.();
};
}, []);
return (0,external_React_.createElement)(external_React_.Fragment, null, controlPoints.map((point, index) => {
const initialPosition = point?.position;
return ignoreMarkerPosition !== initialPosition && (0,external_React_.createElement)(GradientColorPickerDropdown, {
isRenderedInSidebar: __experimentalIsRenderedInSidebar,
key: index,
onClose: onStopControlPointChange,
renderToggle: ({
isOpen,
onToggle
}) => (0,external_React_.createElement)(ControlPointButton, {
key: index,
onClick: () => {
if (controlPointMoveState.current && controlPointMoveState.current.significantMoveHappened) {
return;
}
if (isOpen) {
onStopControlPointChange();
} else {
onStartControlPointChange();
}
onToggle();
},
onMouseDown: () => {
if (window && window.addEventListener) {
controlPointMoveState.current = {
initialPosition,
index,
significantMoveHappened: false,
listenersActivated: true
};
onStartControlPointChange();
window.addEventListener('mousemove', onMouseMove);
window.addEventListener('mouseup', cleanEventListeners);
}
},
onKeyDown: event => {
if (event.code === 'ArrowLeft') {
// Stop propagation of the key press event to avoid focus moving
// to another editor area.
event.stopPropagation();
onChange(updateControlPointPosition(controlPoints, index, clampPercent(point.position - KEYBOARD_CONTROL_POINT_VARIATION)));
} else if (event.code === 'ArrowRight') {
// Stop propagation of the key press event to avoid focus moving
// to another editor area.
event.stopPropagation();
onChange(updateControlPointPosition(controlPoints, index, clampPercent(point.position + KEYBOARD_CONTROL_POINT_VARIATION)));
}
},
isOpen: isOpen,
position: point.position,
color: point.color
}),
renderContent: ({
onClose
}) => (0,external_React_.createElement)(dropdown_content_wrapper, {
paddingSize: "none"
}, (0,external_React_.createElement)(LegacyAdapter, {
enableAlpha: !disableAlpha,
color: point.color,
onChange: color => {
onChange(updateControlPointColor(controlPoints, index, w(color).toRgbString()));
}
}), !disableRemove && controlPoints.length > 2 && (0,external_React_.createElement)(h_stack_component, {
className: "components-custom-gradient-picker__remove-control-point-wrapper",
alignment: "center"
}, (0,external_React_.createElement)(build_module_button, {
onClick: () => {
onChange(removeControlPoint(controlPoints, index));
onClose();
},
variant: "link"
}, (0,external_wp_i18n_namespaceObject.__)('Remove Control Point')))),
style: {
left: `${point.position}%`,
transform: 'translateX( -50% )'
}
});
}));
}
function InsertPoint({
value: controlPoints,
onChange,
onOpenInserter,
onCloseInserter,
insertPosition,
disableAlpha,
__experimentalIsRenderedInSidebar
}) {
const [alreadyInsertedPoint, setAlreadyInsertedPoint] = (0,external_wp_element_namespaceObject.useState)(false);
return (0,external_React_.createElement)(GradientColorPickerDropdown, {
isRenderedInSidebar: __experimentalIsRenderedInSidebar,
className: "components-custom-gradient-picker__inserter",
onClose: () => {
onCloseInserter();
},
renderToggle: ({
isOpen,
onToggle
}) => (0,external_React_.createElement)(build_module_button, {
"aria-expanded": isOpen,
"aria-haspopup": "true",
onClick: () => {
if (isOpen) {
onCloseInserter();
} else {
setAlreadyInsertedPoint(false);
onOpenInserter();
}
onToggle();
},
className: "components-custom-gradient-picker__insert-point-dropdown",
icon: library_plus
}),
renderContent: () => (0,external_React_.createElement)(dropdown_content_wrapper, {
paddingSize: "none"
}, (0,external_React_.createElement)(LegacyAdapter, {
enableAlpha: !disableAlpha,
onChange: color => {
if (!alreadyInsertedPoint) {
onChange(addControlPoint(controlPoints, insertPosition, w(color).toRgbString()));
setAlreadyInsertedPoint(true);
} else {
onChange(updateControlPointColorByPosition(controlPoints, insertPosition, w(color).toRgbString()));
}
}
})),
style: insertPosition !== null ? {
left: `${insertPosition}%`,
transform: 'translateX( -50% )'
} : undefined
});
}
ControlPoints.InsertPoint = InsertPoint;
/* harmony default export */ const control_points = (ControlPoints);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/gradient-bar/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const customGradientBarReducer = (state, action) => {
switch (action.type) {
case 'MOVE_INSERTER':
if (state.id === 'IDLE' || state.id === 'MOVING_INSERTER') {
return {
id: 'MOVING_INSERTER',
insertPosition: action.insertPosition
};
}
break;
case 'STOP_INSERTER_MOVE':
if (state.id === 'MOVING_INSERTER') {
return {
id: 'IDLE'
};
}
break;
case 'OPEN_INSERTER':
if (state.id === 'MOVING_INSERTER') {
return {
id: 'INSERTING_CONTROL_POINT',
insertPosition: state.insertPosition
};
}
break;
case 'CLOSE_INSERTER':
if (state.id === 'INSERTING_CONTROL_POINT') {
return {
id: 'IDLE'
};
}
break;
case 'START_CONTROL_CHANGE':
if (state.id === 'IDLE') {
return {
id: 'MOVING_CONTROL_POINT'
};
}
break;
case 'STOP_CONTROL_CHANGE':
if (state.id === 'MOVING_CONTROL_POINT') {
return {
id: 'IDLE'
};
}
break;
}
return state;
};
const customGradientBarReducerInitialState = {
id: 'IDLE'
};
function CustomGradientBar({
background,
hasGradient,
value: controlPoints,
onChange,
disableInserter = false,
disableAlpha = false,
__experimentalIsRenderedInSidebar = false
}) {
const gradientMarkersContainerDomRef = (0,external_wp_element_namespaceObject.useRef)(null);
const [gradientBarState, gradientBarStateDispatch] = (0,external_wp_element_namespaceObject.useReducer)(customGradientBarReducer, customGradientBarReducerInitialState);
const onMouseEnterAndMove = event => {
if (!gradientMarkersContainerDomRef.current) {
return;
}
const insertPosition = getHorizontalRelativeGradientPosition(event.clientX, gradientMarkersContainerDomRef.current);
// If the insert point is close to an existing control point don't show it.
if (controlPoints.some(({
position
}) => {
return Math.abs(insertPosition - position) < MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;
})) {
if (gradientBarState.id === 'MOVING_INSERTER') {
gradientBarStateDispatch({
type: 'STOP_INSERTER_MOVE'
});
}
return;
}
gradientBarStateDispatch({
type: 'MOVE_INSERTER',
insertPosition
});
};
const onMouseLeave = () => {
gradientBarStateDispatch({
type: 'STOP_INSERTER_MOVE'
});
};
const isMovingInserter = gradientBarState.id === 'MOVING_INSERTER';
const isInsertingControlPoint = gradientBarState.id === 'INSERTING_CONTROL_POINT';
return (0,external_React_.createElement)("div", {
className: classnames_default()('components-custom-gradient-picker__gradient-bar', {
'has-gradient': hasGradient
}),
onMouseEnter: onMouseEnterAndMove,
onMouseMove: onMouseEnterAndMove,
onMouseLeave: onMouseLeave
}, (0,external_React_.createElement)("div", {
className: "components-custom-gradient-picker__gradient-bar-background",
style: {
background,
opacity: hasGradient ? 1 : 0.4
}
}), (0,external_React_.createElement)("div", {
ref: gradientMarkersContainerDomRef,
className: "components-custom-gradient-picker__markers-container"
}, !disableInserter && (isMovingInserter || isInsertingControlPoint) && (0,external_React_.createElement)(control_points.InsertPoint, {
__experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
disableAlpha: disableAlpha,
insertPosition: gradientBarState.insertPosition,
value: controlPoints,
onChange: onChange,
onOpenInserter: () => {
gradientBarStateDispatch({
type: 'OPEN_INSERTER'
});
},
onCloseInserter: () => {
gradientBarStateDispatch({
type: 'CLOSE_INSERTER'
});
}
}), (0,external_React_.createElement)(control_points, {
__experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
disableAlpha: disableAlpha,
disableRemove: disableInserter,
gradientPickerDomRef: gradientMarkersContainerDomRef,
ignoreMarkerPosition: isInsertingControlPoint ? gradientBarState.insertPosition : undefined,
value: controlPoints,
onChange: onChange,
onStartControlPointChange: () => {
gradientBarStateDispatch({
type: 'START_CONTROL_CHANGE'
});
},
onStopControlPointChange: () => {
gradientBarStateDispatch({
type: 'STOP_CONTROL_CHANGE'
});
}
})));
}
// EXTERNAL MODULE: ./node_modules/gradient-parser/build/node.js
var build_node = __webpack_require__(8924);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/constants.js
/**
* WordPress dependencies
*/
const DEFAULT_GRADIENT = 'linear-gradient(135deg, rgba(6, 147, 227, 1) 0%, rgb(155, 81, 224) 100%)';
const DEFAULT_LINEAR_GRADIENT_ANGLE = 180;
const HORIZONTAL_GRADIENT_ORIENTATION = {
type: 'angular',
value: '90'
};
const GRADIENT_OPTIONS = [{
value: 'linear-gradient',
label: (0,external_wp_i18n_namespaceObject.__)('Linear')
}, {
value: 'radial-gradient',
label: (0,external_wp_i18n_namespaceObject.__)('Radial')
}];
const DIRECTIONAL_ORIENTATION_ANGLE_MAP = {
top: 0,
'top right': 45,
'right top': 45,
right: 90,
'right bottom': 135,
'bottom right': 135,
bottom: 180,
'bottom left': 225,
'left bottom': 225,
left: 270,
'top left': 315,
'left top': 315
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/serializer.js
/**
* External dependencies
*/
function serializeGradientColor({
type,
value
}) {
if (type === 'literal') {
return value;
}
if (type === 'hex') {
return `#${value}`;
}
return `${type}(${value.join(',')})`;
}
function serializeGradientPosition(position) {
if (!position) {
return '';
}
const {
value,
type
} = position;
return `${value}${type}`;
}
function serializeGradientColorStop({
type,
value,
length
}) {
return `${serializeGradientColor({
type,
value
})} ${serializeGradientPosition(length)}`;
}
function serializeGradientOrientation(orientation) {
if (Array.isArray(orientation) || !orientation || orientation.type !== 'angular') {
return;
}
return `${orientation.value}deg`;
}
function serializeGradient({
type,
orientation,
colorStops
}) {
const serializedOrientation = serializeGradientOrientation(orientation);
const serializedColorStops = colorStops.sort((colorStop1, colorStop2) => {
const getNumericStopValue = colorStop => {
return colorStop?.length?.value === undefined ? 0 : parseInt(colorStop.length.value);
};
return getNumericStopValue(colorStop1) - getNumericStopValue(colorStop2);
}).map(serializeGradientColorStop);
return `${type}(${[serializedOrientation, ...serializedColorStops].filter(Boolean).join(',')})`;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/utils.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
k([names]);
function getLinearGradientRepresentation(gradientAST) {
return serializeGradient({
type: 'linear-gradient',
orientation: HORIZONTAL_GRADIENT_ORIENTATION,
colorStops: gradientAST.colorStops
});
}
function hasUnsupportedLength(item) {
return item.length === undefined || item.length.type !== '%';
}
function getGradientAstWithDefault(value) {
// gradientAST will contain the gradient AST as parsed by gradient-parser npm module.
// More information of its structure available at https://www.npmjs.com/package/gradient-parser#ast.
let gradientAST;
let hasGradient = !!value;
const valueToParse = value !== null && value !== void 0 ? value : DEFAULT_GRADIENT;
try {
gradientAST = build_node.parse(valueToParse)[0];
} catch (error) {
// eslint-disable-next-line no-console
console.warn('wp.components.CustomGradientPicker failed to parse the gradient with error', error);
gradientAST = build_node.parse(DEFAULT_GRADIENT)[0];
hasGradient = false;
}
if (!Array.isArray(gradientAST.orientation) && gradientAST.orientation?.type === 'directional') {
gradientAST.orientation = {
type: 'angular',
value: DIRECTIONAL_ORIENTATION_ANGLE_MAP[gradientAST.orientation.value].toString()
};
}
if (gradientAST.colorStops.some(hasUnsupportedLength)) {
const {
colorStops
} = gradientAST;
const step = 100 / (colorStops.length - 1);
colorStops.forEach((stop, index) => {
stop.length = {
value: `${step * index}`,
type: '%'
};
});
}
return {
gradientAST,
hasGradient
};
}
function getGradientAstWithControlPoints(gradientAST, newControlPoints) {
return {
...gradientAST,
colorStops: newControlPoints.map(({
position,
color
}) => {
const {
r,
g,
b,
a
} = w(color).toRgb();
return {
length: {
type: '%',
value: position?.toString()
},
type: a < 1 ? 'rgba' : 'rgb',
value: a < 1 ? [`${r}`, `${g}`, `${b}`, `${a}`] : [`${r}`, `${g}`, `${b}`]
};
})
};
}
function getStopCssColor(colorStop) {
switch (colorStop.type) {
case 'hex':
return `#${colorStop.value}`;
case 'literal':
return colorStop.value;
case 'rgb':
case 'rgba':
return `${colorStop.type}(${colorStop.value.join(',')})`;
default:
// Should be unreachable if passing an AST from gradient-parser.
// See https://github.com/rafaelcaricio/gradient-parser#ast.
return 'transparent';
}
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js
function custom_gradient_picker_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const SelectWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_block_component, true ? {
target: "e10bzpgi1"
} : 0)( true ? {
name: "1gvx10y",
styles: "flex-grow:5"
} : 0);
const AccessoryWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_block_component, true ? {
target: "e10bzpgi0"
} : 0)( true ? {
name: "1gvx10y",
styles: "flex-grow:5"
} : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const GradientAnglePicker = ({
gradientAST,
hasGradient,
onChange
}) => {
var _gradientAST$orientat;
const angle = (_gradientAST$orientat = gradientAST?.orientation?.value) !== null && _gradientAST$orientat !== void 0 ? _gradientAST$orientat : DEFAULT_LINEAR_GRADIENT_ANGLE;
const onAngleChange = newAngle => {
onChange(serializeGradient({
...gradientAST,
orientation: {
type: 'angular',
value: `${newAngle}`
}
}));
};
return (0,external_React_.createElement)(angle_picker_control, {
onChange: onAngleChange,
value: hasGradient ? angle : ''
});
};
const GradientTypePicker = ({
gradientAST,
hasGradient,
onChange
}) => {
const {
type
} = gradientAST;
const onSetLinearGradient = () => {
onChange(serializeGradient({
...gradientAST,
orientation: gradientAST.orientation ? undefined : HORIZONTAL_GRADIENT_ORIENTATION,
type: 'linear-gradient'
}));
};
const onSetRadialGradient = () => {
const {
orientation,
...restGradientAST
} = gradientAST;
onChange(serializeGradient({
...restGradientAST,
type: 'radial-gradient'
}));
};
const handleOnChange = next => {
if (next === 'linear-gradient') {
onSetLinearGradient();
}
if (next === 'radial-gradient') {
onSetRadialGradient();
}
};
return (0,external_React_.createElement)(select_control, {
__nextHasNoMarginBottom: true,
className: "components-custom-gradient-picker__type-picker",
label: (0,external_wp_i18n_namespaceObject.__)('Type'),
labelPosition: "top",
onChange: handleOnChange,
options: GRADIENT_OPTIONS,
size: "__unstable-large",
value: hasGradient ? type : undefined
});
};
/**
* CustomGradientPicker is a React component that renders a UI for specifying
* linear or radial gradients. Radial gradients are displayed in the picker as
* a slice of the gradient from the center to the outside.
*
* ```jsx
* import { CustomGradientPicker } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyCustomGradientPicker = () => {
* const [ gradient, setGradient ] = useState();
*
* return (
* <CustomGradientPicker
* value={ gradient }
* onChange={ setGradient }
* />
* );
* };
* ```
*/
function CustomGradientPicker({
value,
onChange,
__experimentalIsRenderedInSidebar = false
}) {
const {
gradientAST,
hasGradient
} = getGradientAstWithDefault(value);
// On radial gradients the bar should display a linear gradient.
// On radial gradients the bar represents a slice of the gradient from the center until the outside.
// On liner gradients the bar represents the color stops from left to right independently of the angle.
const background = getLinearGradientRepresentation(gradientAST);
// Control points color option may be hex from presets, custom colors will be rgb.
// The position should always be a percentage.
const controlPoints = gradientAST.colorStops.map(colorStop => {
return {
color: getStopCssColor(colorStop),
// Although it's already been checked by `hasUnsupportedLength` in `getGradientAstWithDefault`,
// TypeScript doesn't know that `colorStop.length` is not undefined here.
// @ts-expect-error
position: parseInt(colorStop.length.value)
};
});
return (0,external_React_.createElement)(v_stack_component, {
spacing: 4,
className: "components-custom-gradient-picker"
}, (0,external_React_.createElement)(CustomGradientBar, {
__experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
background: background,
hasGradient: hasGradient,
value: controlPoints,
onChange: newControlPoints => {
onChange(serializeGradient(getGradientAstWithControlPoints(gradientAST, newControlPoints)));
}
}), (0,external_React_.createElement)(flex_component, {
gap: 3,
className: "components-custom-gradient-picker__ui-line"
}, (0,external_React_.createElement)(SelectWrapper, null, (0,external_React_.createElement)(GradientTypePicker, {
gradientAST: gradientAST,
hasGradient: hasGradient,
onChange: onChange
})), (0,external_React_.createElement)(AccessoryWrapper, null, gradientAST.type === 'linear-gradient' && (0,external_React_.createElement)(GradientAnglePicker, {
gradientAST: gradientAST,
hasGradient: hasGradient,
onChange: onChange
}))));
}
/* harmony default export */ const custom_gradient_picker = (CustomGradientPicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/gradient-picker/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// The Multiple Origin Gradients have a `gradients` property (an array of
// gradient objects), while Single Origin ones have a `gradient` property.
const isMultipleOriginObject = obj => Array.isArray(obj.gradients) && !('gradient' in obj);
const isMultipleOriginArray = arr => {
return arr.length > 0 && arr.every(gradientObj => isMultipleOriginObject(gradientObj));
};
function SingleOrigin({
className,
clearGradient,
gradients,
onChange,
value,
...additionalProps
}) {
const gradientOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
return gradients.map(({
gradient,
name,
slug
}, index) => (0,external_React_.createElement)(build_module_circular_option_picker.Option, {
key: slug,
value: gradient,
isSelected: value === gradient,
tooltipText: name ||
// translators: %s: gradient code e.g: "linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);".
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Gradient code: %s'), gradient),
style: {
color: 'rgba( 0,0,0,0 )',
background: gradient
},
onClick: value === gradient ? clearGradient : () => onChange(gradient, index),
"aria-label": name ?
// translators: %s: The name of the gradient e.g: "Angular red to blue".
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Gradient: %s'), name) :
// translators: %s: gradient code e.g: "linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);".
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Gradient code: %s'), gradient)
}));
}, [gradients, value, onChange, clearGradient]);
return (0,external_React_.createElement)(build_module_circular_option_picker.OptionGroup, {
className: className,
options: gradientOptions,
...additionalProps
});
}
function MultipleOrigin({
className,
clearGradient,
gradients,
onChange,
value,
headingLevel
}) {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(MultipleOrigin);
return (0,external_React_.createElement)(v_stack_component, {
spacing: 3,
className: className
}, gradients.map(({
name,
gradients: gradientSet
}, index) => {
const id = `color-palette-${instanceId}-${index}`;
return (0,external_React_.createElement)(v_stack_component, {
spacing: 2,
key: index
}, (0,external_React_.createElement)(ColorHeading, {
level: headingLevel,
id: id
}, name), (0,external_React_.createElement)(SingleOrigin, {
clearGradient: clearGradient,
gradients: gradientSet,
onChange: gradient => onChange(gradient, index),
value: value,
"aria-labelledby": id
}));
}));
}
function gradient_picker_Component(props) {
const {
asButtons,
loop,
actions,
headingLevel,
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledby,
...additionalProps
} = props;
const options = isMultipleOriginArray(props.gradients) ? (0,external_React_.createElement)(MultipleOrigin, {
headingLevel: headingLevel,
...additionalProps
}) : (0,external_React_.createElement)(SingleOrigin, {
...additionalProps
});
let metaProps;
if (asButtons) {
metaProps = {
asButtons: true
};
} else {
const _metaProps = {
asButtons: false,
loop
};
if (ariaLabel) {
metaProps = {
..._metaProps,
'aria-label': ariaLabel
};
} else if (ariaLabelledby) {
metaProps = {
..._metaProps,
'aria-labelledby': ariaLabelledby
};
} else {
metaProps = {
..._metaProps,
'aria-label': (0,external_wp_i18n_namespaceObject.__)('Custom color picker.')
};
}
}
return (0,external_React_.createElement)(build_module_circular_option_picker, {
...metaProps,
actions: actions,
options: options
});
}
/**
* GradientPicker is a React component that renders a color gradient picker to
* define a multi step gradient. There's either a _linear_ or a _radial_ type
* available.
*
* ```jsx
*import { GradientPicker } from '@wordpress/components';
*import { useState } from '@wordpress/element';
*
*const myGradientPicker = () => {
* const [ gradient, setGradient ] = useState( null );
*
* return (
* <GradientPicker
* value={ gradient }
* onChange={ ( currentGradient ) => setGradient( currentGradient ) }
* gradients={ [
* {
* name: 'JShine',
* gradient:
* 'linear-gradient(135deg,#12c2e9 0%,#c471ed 50%,#f64f59 100%)',
* slug: 'jshine',
* },
* {
* name: 'Moonlit Asteroid',
* gradient:
* 'linear-gradient(135deg,#0F2027 0%, #203A43 0%, #2c5364 100%)',
* slug: 'moonlit-asteroid',
* },
* {
* name: 'Rastafarie',
* gradient:
* 'linear-gradient(135deg,#1E9600 0%, #FFF200 0%, #FF0000 100%)',
* slug: 'rastafari',
* },
* ] }
* />
* );
*};
*```
*
*/
function GradientPicker({
className,
gradients = [],
onChange,
value,
clearable = true,
disableCustomGradients = false,
__experimentalIsRenderedInSidebar,
headingLevel = 2,
...additionalProps
}) {
const clearGradient = (0,external_wp_element_namespaceObject.useCallback)(() => onChange(undefined), [onChange]);
return (0,external_React_.createElement)(v_stack_component, {
spacing: gradients.length ? 4 : 0
}, !disableCustomGradients && (0,external_React_.createElement)(custom_gradient_picker, {
__experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
value: value,
onChange: onChange
}), (gradients.length > 0 || clearable) && (0,external_React_.createElement)(gradient_picker_Component, {
...additionalProps,
className: className,
clearGradient: clearGradient,
gradients: gradients,
onChange: onChange,
value: value,
actions: clearable && !disableCustomGradients && (0,external_React_.createElement)(build_module_circular_option_picker.ButtonAction, {
onClick: clearGradient
}, (0,external_wp_i18n_namespaceObject.__)('Clear')),
headingLevel: headingLevel
}));
}
/* harmony default export */ const gradient_picker = (GradientPicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/menu.js
/**
* WordPress dependencies
*/
const menu = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M5 5v1.5h14V5H5zm0 7.8h14v-1.5H5v1.5zM5 19h14v-1.5H5V19z"
}));
/* harmony default export */ const library_menu = (menu);
;// CONCATENATED MODULE: external ["wp","dom"]
const external_wp_dom_namespaceObject = window["wp"]["dom"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigable-container/container.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const container_noop = () => {};
const MENU_ITEM_ROLES = ['menuitem', 'menuitemradio', 'menuitemcheckbox'];
function cycleValue(value, total, offset) {
const nextValue = value + offset;
if (nextValue < 0) {
return total + nextValue;
} else if (nextValue >= total) {
return nextValue - total;
}
return nextValue;
}
class NavigableContainer extends external_wp_element_namespaceObject.Component {
constructor(args) {
super(args);
this.onKeyDown = this.onKeyDown.bind(this);
this.bindContainer = this.bindContainer.bind(this);
this.getFocusableContext = this.getFocusableContext.bind(this);
this.getFocusableIndex = this.getFocusableIndex.bind(this);
}
componentDidMount() {
if (!this.container) {
return;
}
// We use DOM event listeners instead of React event listeners
// because we want to catch events from the underlying DOM tree
// The React Tree can be different from the DOM tree when using
// portals. Block Toolbars for instance are rendered in a separate
// React Trees.
this.container.addEventListener('keydown', this.onKeyDown);
}
componentWillUnmount() {
if (!this.container) {
return;
}
this.container.removeEventListener('keydown', this.onKeyDown);
}
bindContainer(ref) {
const {
forwardedRef
} = this.props;
this.container = ref;
if (typeof forwardedRef === 'function') {
forwardedRef(ref);
} else if (forwardedRef && 'current' in forwardedRef) {
forwardedRef.current = ref;
}
}
getFocusableContext(target) {
if (!this.container) {
return null;
}
const {
onlyBrowserTabstops
} = this.props;
const finder = onlyBrowserTabstops ? external_wp_dom_namespaceObject.focus.tabbable : external_wp_dom_namespaceObject.focus.focusable;
const focusables = finder.find(this.container);
const index = this.getFocusableIndex(focusables, target);
if (index > -1 && target) {
return {
index,
target,
focusables
};
}
return null;
}
getFocusableIndex(focusables, target) {
return focusables.indexOf(target);
}
onKeyDown(event) {
if (this.props.onKeyDown) {
this.props.onKeyDown(event);
}
const {
getFocusableContext
} = this;
const {
cycle = true,
eventToOffset,
onNavigate = container_noop,
stopNavigationEvents
} = this.props;
const offset = eventToOffset(event);
// eventToOffset returns undefined if the event is not handled by the component.
if (offset !== undefined && stopNavigationEvents) {
// Prevents arrow key handlers bound to the document directly interfering.
event.stopImmediatePropagation();
// When navigating a collection of items, prevent scroll containers
// from scrolling. The preventDefault also prevents Voiceover from
// 'handling' the event, as voiceover will try to use arrow keys
// for highlighting text.
const targetRole = event.target?.getAttribute('role');
const targetHasMenuItemRole = !!targetRole && MENU_ITEM_ROLES.includes(targetRole);
if (targetHasMenuItemRole) {
event.preventDefault();
}
}
if (!offset) {
return;
}
const activeElement = event.target?.ownerDocument?.activeElement;
if (!activeElement) {
return;
}
const context = getFocusableContext(activeElement);
if (!context) {
return;
}
const {
index,
focusables
} = context;
const nextIndex = cycle ? cycleValue(index, focusables.length, offset) : index + offset;
if (nextIndex >= 0 && nextIndex < focusables.length) {
focusables[nextIndex].focus();
onNavigate(nextIndex, focusables[nextIndex]);
// `preventDefault()` on tab to avoid having the browser move the focus
// after this component has already moved it.
if (event.code === 'Tab') {
event.preventDefault();
}
}
}
render() {
const {
children,
stopNavigationEvents,
eventToOffset,
onNavigate,
onKeyDown,
cycle,
onlyBrowserTabstops,
forwardedRef,
...restProps
} = this.props;
return (0,external_React_.createElement)("div", {
ref: this.bindContainer,
...restProps
}, children);
}
}
const forwardedNavigableContainer = (props, ref) => {
return (0,external_React_.createElement)(NavigableContainer, {
...props,
forwardedRef: ref
});
};
forwardedNavigableContainer.displayName = 'NavigableContainer';
/* harmony default export */ const container = ((0,external_wp_element_namespaceObject.forwardRef)(forwardedNavigableContainer));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigable-container/menu.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedNavigableMenu({
role = 'menu',
orientation = 'vertical',
...rest
}, ref) {
const eventToOffset = evt => {
const {
code
} = evt;
let next = ['ArrowDown'];
let previous = ['ArrowUp'];
if (orientation === 'horizontal') {
next = ['ArrowRight'];
previous = ['ArrowLeft'];
}
if (orientation === 'both') {
next = ['ArrowRight', 'ArrowDown'];
previous = ['ArrowLeft', 'ArrowUp'];
}
if (next.includes(code)) {
return 1;
} else if (previous.includes(code)) {
return -1;
} else if (['ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight'].includes(code)) {
// Key press should be handled, e.g. have event propagation and
// default behavior handled by NavigableContainer but not result
// in an offset.
return 0;
}
return undefined;
};
return (0,external_React_.createElement)(container, {
ref: ref,
stopNavigationEvents: true,
onlyBrowserTabstops: false,
role: role,
"aria-orientation": role !== 'presentation' && (orientation === 'vertical' || orientation === 'horizontal') ? orientation : undefined,
eventToOffset: eventToOffset,
...rest
});
}
/**
* A container for a navigable menu.
*
* ```jsx
* import {
* NavigableMenu,
* Button,
* } from '@wordpress/components';
*
* function onNavigate( index, target ) {
* console.log( `Navigates to ${ index }`, target );
* }
*
* const MyNavigableContainer = () => (
* <div>
* <span>Navigable Menu:</span>
* <NavigableMenu onNavigate={ onNavigate } orientation="horizontal">
* <Button variant="secondary">Item 1</Button>
* <Button variant="secondary">Item 2</Button>
* <Button variant="secondary">Item 3</Button>
* </NavigableMenu>
* </div>
* );
* ```
*/
const NavigableMenu = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedNavigableMenu);
/* harmony default export */ const navigable_container_menu = (NavigableMenu);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown-menu/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function dropdown_menu_mergeProps(defaultProps = {}, props = {}) {
const mergedProps = {
...defaultProps,
...props
};
if (props.className && defaultProps.className) {
mergedProps.className = classnames_default()(props.className, defaultProps.className);
}
return mergedProps;
}
function dropdown_menu_isFunction(maybeFunc) {
return typeof maybeFunc === 'function';
}
function UnconnectedDropdownMenu(dropdownMenuProps) {
const {
children,
className,
controls,
icon = library_menu,
label,
popoverProps,
toggleProps,
menuProps,
disableOpenOnArrowDown = false,
text,
noIcons,
open,
defaultOpen,
onToggle: onToggleProp,
// Context
variant
} = useContextSystem(dropdownMenuProps, 'DropdownMenu');
if (!controls?.length && !dropdown_menu_isFunction(children)) {
return null;
}
// Normalize controls to nested array of objects (sets of controls)
let controlSets;
if (controls?.length) {
// @ts-expect-error The check below is needed because `DropdownMenus`
// rendered by `ToolBarGroup` receive controls as a nested array.
controlSets = controls;
if (!Array.isArray(controlSets[0])) {
// This is not ideal, but at this point we know that `controls` is
// not a nested array, even if TypeScript doesn't.
controlSets = [controls];
}
}
const mergedPopoverProps = dropdown_menu_mergeProps({
className: 'components-dropdown-menu__popover',
variant
}, popoverProps);
return (0,external_React_.createElement)(dropdown, {
className: className,
popoverProps: mergedPopoverProps,
renderToggle: ({
isOpen,
onToggle
}) => {
var _toggleProps$showTool;
const openOnArrowDown = event => {
if (disableOpenOnArrowDown) {
return;
}
if (!isOpen && event.code === 'ArrowDown') {
event.preventDefault();
onToggle();
}
};
const {
as: Toggle = build_module_button,
...restToggleProps
} = toggleProps !== null && toggleProps !== void 0 ? toggleProps : {};
const mergedToggleProps = dropdown_menu_mergeProps({
className: classnames_default()('components-dropdown-menu__toggle', {
'is-opened': isOpen
})
}, restToggleProps);
return (0,external_React_.createElement)(Toggle, {
...mergedToggleProps,
icon: icon,
onClick: event => {
onToggle();
if (mergedToggleProps.onClick) {
mergedToggleProps.onClick(event);
}
},
onKeyDown: event => {
openOnArrowDown(event);
if (mergedToggleProps.onKeyDown) {
mergedToggleProps.onKeyDown(event);
}
},
"aria-haspopup": "true",
"aria-expanded": isOpen,
label: label,
text: text,
showTooltip: (_toggleProps$showTool = toggleProps?.showTooltip) !== null && _toggleProps$showTool !== void 0 ? _toggleProps$showTool : true
}, mergedToggleProps.children);
},
renderContent: props => {
const mergedMenuProps = dropdown_menu_mergeProps({
'aria-label': label,
className: classnames_default()('components-dropdown-menu__menu', {
'no-icons': noIcons
})
}, menuProps);
return (0,external_React_.createElement)(navigable_container_menu, {
...mergedMenuProps,
role: "menu"
}, dropdown_menu_isFunction(children) ? children(props) : null, controlSets?.flatMap((controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => (0,external_React_.createElement)(build_module_button, {
key: [indexOfSet, indexOfControl].join(),
onClick: event => {
event.stopPropagation();
props.onClose();
if (control.onClick) {
control.onClick();
}
},
className: classnames_default()('components-dropdown-menu__menu-item', {
'has-separator': indexOfSet > 0 && indexOfControl === 0,
'is-active': control.isActive,
'is-icon-only': !control.title
}),
icon: control.icon,
label: control.label,
"aria-checked": control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.isActive : undefined,
role: control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.role : 'menuitem',
disabled: control.isDisabled
}, control.title))));
},
open: open,
defaultOpen: defaultOpen,
onToggle: onToggleProp
});
}
/**
*
* The DropdownMenu displays a list of actions (each contained in a MenuItem,
* MenuItemsChoice, or MenuGroup) in a compact way. It appears in a Popover
* after the user has interacted with an element (a button or icon) or when
* they perform a specific action.
*
* Render a Dropdown Menu with a set of controls:
*
* ```jsx
* import { DropdownMenu } from '@wordpress/components';
* import {
* more,
* arrowLeft,
* arrowRight,
* arrowUp,
* arrowDown,
* } from '@wordpress/icons';
*
* const MyDropdownMenu = () => (
* <DropdownMenu
* icon={ more }
* label="Select a direction"
* controls={ [
* {
* title: 'Up',
* icon: arrowUp,
* onClick: () => console.log( 'up' ),
* },
* {
* title: 'Right',
* icon: arrowRight,
* onClick: () => console.log( 'right' ),
* },
* {
* title: 'Down',
* icon: arrowDown,
* onClick: () => console.log( 'down' ),
* },
* {
* title: 'Left',
* icon: arrowLeft,
* onClick: () => console.log( 'left' ),
* },
* ] }
* />
* );
* ```
*
* Alternatively, specify a `children` function which returns elements valid for
* use in a DropdownMenu: `MenuItem`, `MenuItemsChoice`, or `MenuGroup`.
*
* ```jsx
* import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
* import { more, arrowUp, arrowDown, trash } from '@wordpress/icons';
*
* const MyDropdownMenu = () => (
* <DropdownMenu icon={ more } label="Select a direction">
* { ( { onClose } ) => (
* <>
* <MenuGroup>
* <MenuItem icon={ arrowUp } onClick={ onClose }>
* Move Up
* </MenuItem>
* <MenuItem icon={ arrowDown } onClick={ onClose }>
* Move Down
* </MenuItem>
* </MenuGroup>
* <MenuGroup>
* <MenuItem icon={ trash } onClick={ onClose }>
* Remove
* </MenuItem>
* </MenuGroup>
* </>
* ) }
* </DropdownMenu>
* );
* ```
*
*/
const DropdownMenu = contextConnectWithoutRef(UnconnectedDropdownMenu, 'DropdownMenu');
/* harmony default export */ const dropdown_menu = (DropdownMenu);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/palette-edit/styles.js
function palette_edit_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const IndicatorStyled = /*#__PURE__*/emotion_styled_base_browser_esm(color_indicator, true ? {
target: "e1lpqc909"
} : 0)("&&{flex-shrink:0;width:", space(6), ";height:", space(6), ";}" + ( true ? "" : 0));
const NameInputControl = /*#__PURE__*/emotion_styled_base_browser_esm(input_control, true ? {
target: "e1lpqc908"
} : 0)(Container, "{background:", COLORS.gray[100], ";border-radius:", config_values.controlBorderRadius, ";", Input, Input, Input, Input, "{height:", space(8), ";}", BackdropUI, BackdropUI, BackdropUI, "{border-color:transparent;box-shadow:none;}}" + ( true ? "" : 0));
const buttonStyleReset = ({
as
}) => {
if (as === 'button') {
return /*#__PURE__*/emotion_react_browser_esm_css("display:flex;align-items:center;width:100%;appearance:none;background:transparent;border:none;border-radius:0;padding:0;cursor:pointer;&:hover{color:", COLORS.theme.accent, ";}" + ( true ? "" : 0), true ? "" : 0);
}
return null;
};
const PaletteItem = /*#__PURE__*/emotion_styled_base_browser_esm(component, true ? {
target: "e1lpqc907"
} : 0)(buttonStyleReset, " padding-block:3px;padding-inline-start:", space(3), ";border:1px solid ", config_values.surfaceBorderColor, ";border-bottom-color:transparent;font-size:", font('default.fontSize'), ";&:focus-visible{border-color:transparent;box-shadow:0 0 0 var( --wp-admin-border-width-focus ) ", COLORS.theme.accent, ";outline:2px solid transparent;outline-offset:0;}border-top-left-radius:", config_values.controlBorderRadius, ";border-top-right-radius:", config_values.controlBorderRadius, ";&+&{border-top-left-radius:0;border-top-right-radius:0;}&:last-child{border-bottom-left-radius:", config_values.controlBorderRadius, ";border-bottom-right-radius:", config_values.controlBorderRadius, ";border-bottom-color:", config_values.surfaceBorderColor, ";}&.is-selected+&{border-top-color:transparent;}&.is-selected{border-color:", COLORS.theme.accent, ";}" + ( true ? "" : 0));
const NameContainer = emotion_styled_base_browser_esm("div", true ? {
target: "e1lpqc906"
} : 0)("line-height:", space(8), ";margin-left:", space(2), ";margin-right:", space(2), ";white-space:nowrap;overflow:hidden;" + ( true ? "" : 0));
const PaletteHeading = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? {
target: "e1lpqc905"
} : 0)("text-transform:uppercase;line-height:", space(6), ";font-weight:500;&&&{font-size:11px;margin-bottom:0;}" + ( true ? "" : 0));
const PaletteActionsContainer = /*#__PURE__*/emotion_styled_base_browser_esm(component, true ? {
target: "e1lpqc904"
} : 0)("height:", space(6), ";display:flex;" + ( true ? "" : 0));
const PaletteHStackHeader = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? {
target: "e1lpqc903"
} : 0)("margin-bottom:", space(2), ";" + ( true ? "" : 0));
const PaletteEditStyles = /*#__PURE__*/emotion_styled_base_browser_esm(component, true ? {
target: "e1lpqc902"
} : 0)( true ? {
name: "u6wnko",
styles: "&&&{.components-button.has-icon{min-width:0;padding:0;}}"
} : 0);
const DoneButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
target: "e1lpqc901"
} : 0)("&&{color:", COLORS.theme.accent, ";}" + ( true ? "" : 0));
const RemoveButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
target: "e1lpqc900"
} : 0)("&&{margin-top:", space(1), ";}" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/palette-edit/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DEFAULT_COLOR = '#000';
function NameInput({
value,
onChange,
label
}) {
return (0,external_React_.createElement)(NameInputControl, {
label: label,
hideLabelFromVision: true,
value: value,
onChange: onChange
});
}
/**
* Returns a name for a palette item in the format "Color + id".
* To ensure there are no duplicate ids, this function checks all slugs.
* It expects slugs to be in the format: slugPrefix + color- + number.
* It then sets the id component of the new name based on the incremented id of the highest existing slug id.
*
* @param elements An array of color palette items.
* @param slugPrefix The slug prefix used to match the element slug.
*
* @return A unique name for a palette item.
*/
function getNameForPosition(elements, slugPrefix) {
const nameRegex = new RegExp(`^${slugPrefix}color-([\\d]+)$`);
const position = elements.reduce((previousValue, currentValue) => {
if (typeof currentValue?.slug === 'string') {
const matches = currentValue?.slug.match(nameRegex);
if (matches) {
const id = parseInt(matches[1], 10);
if (id >= previousValue) {
return id + 1;
}
}
}
return previousValue;
}, 1);
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: is an id for a custom color */
(0,external_wp_i18n_namespaceObject.__)('Color %s'), position);
}
function ColorPickerPopover({
isGradient,
element,
onChange,
popoverProps: receivedPopoverProps,
onClose = () => {}
}) {
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
shift: true,
offset: 20,
// Disabling resize as it would otherwise cause the popover to show
// scrollbars while dragging the color picker's handle close to the
// popover edge.
resize: false,
placement: 'left-start',
...receivedPopoverProps,
className: classnames_default()('components-palette-edit__popover', receivedPopoverProps?.className)
}), [receivedPopoverProps]);
return (0,external_React_.createElement)(popover, {
...popoverProps,
onClose: onClose
}, !isGradient && (0,external_React_.createElement)(LegacyAdapter, {
color: element.color,
enableAlpha: true,
onChange: newColor => {
onChange({
...element,
color: newColor
});
}
}), isGradient && (0,external_React_.createElement)("div", {
className: "components-palette-edit__popover-gradient-picker"
}, (0,external_React_.createElement)(custom_gradient_picker, {
__experimentalIsRenderedInSidebar: true,
value: element.gradient,
onChange: newGradient => {
onChange({
...element,
gradient: newGradient
});
}
})));
}
function palette_edit_Option({
canOnlyChangeValues,
element,
onChange,
isEditing,
onStartEditing,
onRemove,
onStopEditing,
popoverProps: receivedPopoverProps,
slugPrefix,
isGradient
}) {
const focusOutsideProps = (0,external_wp_compose_namespaceObject.__experimentalUseFocusOutside)(onStopEditing);
const value = isGradient ? element.gradient : element.color;
// Use internal state instead of a ref to make sure that the component
// re-renders when the popover's anchor updates.
const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
...receivedPopoverProps,
// Use the custom palette color item as the popover anchor.
anchor: popoverAnchor
}), [popoverAnchor, receivedPopoverProps]);
return (0,external_React_.createElement)(PaletteItem, {
className: isEditing ? 'is-selected' : undefined,
as: isEditing ? 'div' : 'button',
onClick: onStartEditing,
"aria-label": isEditing ? undefined : (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s is a color or gradient name, e.g. "Red".
(0,external_wp_i18n_namespaceObject.__)('Edit: %s'), element.name.trim().length ? element.name : value),
ref: setPopoverAnchor,
...(isEditing ? {
...focusOutsideProps
} : {})
}, (0,external_React_.createElement)(h_stack_component, {
justify: "flex-start"
}, (0,external_React_.createElement)(IndicatorStyled, {
colorValue: value
}), (0,external_React_.createElement)(flex_item_component, null, isEditing && !canOnlyChangeValues ? (0,external_React_.createElement)(NameInput, {
label: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Gradient name') : (0,external_wp_i18n_namespaceObject.__)('Color name'),
value: element.name,
onChange: nextName => onChange({
...element,
name: nextName,
slug: slugPrefix + kebabCase(nextName !== null && nextName !== void 0 ? nextName : '')
})
}) : (0,external_React_.createElement)(NameContainer, null, element.name.trim().length ? element.name : /* Fall back to non-breaking space to maintain height */
'\u00A0')), isEditing && !canOnlyChangeValues && (0,external_React_.createElement)(flex_item_component, null, (0,external_React_.createElement)(RemoveButton, {
size: "small",
icon: line_solid,
label: (0,external_wp_i18n_namespaceObject.__)('Remove color'),
onClick: onRemove
}))), isEditing && (0,external_React_.createElement)(ColorPickerPopover, {
isGradient: isGradient,
onChange: onChange,
element: element,
popoverProps: popoverProps
}));
}
function PaletteEditListView({
elements,
onChange,
editingElement,
setEditingElement,
canOnlyChangeValues,
slugPrefix,
isGradient,
popoverProps
}) {
// When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.
const elementsReference = (0,external_wp_element_namespaceObject.useRef)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
elementsReference.current = elements;
}, [elements]);
const debounceOnChange = (0,external_wp_compose_namespaceObject.useDebounce)(onChange, 100);
return (0,external_React_.createElement)(v_stack_component, {
spacing: 3
}, (0,external_React_.createElement)(item_group_component, {
isRounded: true
}, elements.map((element, index) => (0,external_React_.createElement)(palette_edit_Option, {
isGradient: isGradient,
canOnlyChangeValues: canOnlyChangeValues,
key: index,
element: element,
onStartEditing: () => {
if (editingElement !== index) {
setEditingElement(index);
}
},
onChange: newElement => {
debounceOnChange(elements.map((currentElement, currentIndex) => {
if (currentIndex === index) {
return newElement;
}
return currentElement;
}));
},
onRemove: () => {
setEditingElement(null);
const newElements = elements.filter((_currentElement, currentIndex) => {
if (currentIndex === index) {
return false;
}
return true;
});
onChange(newElements.length ? newElements : undefined);
},
isEditing: index === editingElement,
onStopEditing: () => {
if (index === editingElement) {
setEditingElement(null);
}
},
slugPrefix: slugPrefix,
popoverProps: popoverProps
}))));
}
const EMPTY_ARRAY = [];
/**
* Allows editing a palette of colors or gradients.
*
* ```jsx
* import { PaletteEdit } from '@wordpress/components';
* const MyPaletteEdit = () => {
* const [ controlledColors, setControlledColors ] = useState( colors );
*
* return (
* <PaletteEdit
* colors={ controlledColors }
* onChange={ ( newColors?: Color[] ) => {
* setControlledColors( newColors );
* } }
* paletteLabel="Here is a label"
* />
* );
* };
* ```
*/
function PaletteEdit({
gradients,
colors = EMPTY_ARRAY,
onChange,
paletteLabel,
paletteLabelHeadingLevel = 2,
emptyMessage,
canOnlyChangeValues,
canReset,
slugPrefix = '',
popoverProps
}) {
const isGradient = !!gradients;
const elements = isGradient ? gradients : colors;
const [isEditing, setIsEditing] = (0,external_wp_element_namespaceObject.useState)(false);
const [editingElement, setEditingElement] = (0,external_wp_element_namespaceObject.useState)(null);
const isAdding = isEditing && !!editingElement && elements[editingElement] && !elements[editingElement].slug;
const elementsLength = elements.length;
const hasElements = elementsLength > 0;
const debounceOnChange = (0,external_wp_compose_namespaceObject.useDebounce)(onChange, 100);
const onSelectPaletteItem = (0,external_wp_element_namespaceObject.useCallback)((value, newEditingElementIndex) => {
const selectedElement = newEditingElementIndex === undefined ? undefined : elements[newEditingElementIndex];
const key = isGradient ? 'gradient' : 'color';
// Ensures that the index returned matches a known element value.
if (!!selectedElement && selectedElement[key] === value) {
setEditingElement(newEditingElementIndex);
} else {
setIsEditing(true);
}
}, [isGradient, elements]);
return (0,external_React_.createElement)(PaletteEditStyles, null, (0,external_React_.createElement)(PaletteHStackHeader, null, (0,external_React_.createElement)(PaletteHeading, {
level: paletteLabelHeadingLevel
}, paletteLabel), (0,external_React_.createElement)(PaletteActionsContainer, null, hasElements && isEditing && (0,external_React_.createElement)(DoneButton, {
size: "small",
onClick: () => {
setIsEditing(false);
setEditingElement(null);
}
}, (0,external_wp_i18n_namespaceObject.__)('Done')), !canOnlyChangeValues && (0,external_React_.createElement)(build_module_button, {
size: "small",
isPressed: isAdding,
icon: library_plus,
label: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Add gradient') : (0,external_wp_i18n_namespaceObject.__)('Add color'),
onClick: () => {
const optionName = getNameForPosition(elements, slugPrefix);
if (!!gradients) {
onChange([...gradients, {
gradient: DEFAULT_GRADIENT,
name: optionName,
slug: slugPrefix + kebabCase(optionName)
}]);
} else {
onChange([...colors, {
color: DEFAULT_COLOR,
name: optionName,
slug: slugPrefix + kebabCase(optionName)
}]);
}
setIsEditing(true);
setEditingElement(elements.length);
}
}), hasElements && (!isEditing || !canOnlyChangeValues || canReset) && (0,external_React_.createElement)(dropdown_menu, {
icon: more_vertical,
label: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Gradient options') : (0,external_wp_i18n_namespaceObject.__)('Color options'),
toggleProps: {
isSmall: true
}
}, ({
onClose
}) => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(navigable_container_menu, {
role: "menu"
}, !isEditing && (0,external_React_.createElement)(build_module_button, {
variant: "tertiary",
onClick: () => {
setIsEditing(true);
onClose();
},
className: "components-palette-edit__menu-button"
}, (0,external_wp_i18n_namespaceObject.__)('Show details')), !canOnlyChangeValues && (0,external_React_.createElement)(build_module_button, {
variant: "tertiary",
onClick: () => {
setEditingElement(null);
setIsEditing(false);
onChange();
onClose();
},
className: "components-palette-edit__menu-button"
}, isGradient ? (0,external_wp_i18n_namespaceObject.__)('Remove all gradients') : (0,external_wp_i18n_namespaceObject.__)('Remove all colors')), canReset && (0,external_React_.createElement)(build_module_button, {
variant: "tertiary",
onClick: () => {
setEditingElement(null);
onChange();
onClose();
}
}, isGradient ? (0,external_wp_i18n_namespaceObject.__)('Reset gradient') : (0,external_wp_i18n_namespaceObject.__)('Reset colors'))))))), hasElements && (0,external_React_.createElement)(external_React_.Fragment, null, isEditing && (0,external_React_.createElement)(PaletteEditListView, {
canOnlyChangeValues: canOnlyChangeValues,
elements: elements
// @ts-expect-error TODO: Don't know how to resolve
,
onChange: onChange,
editingElement: editingElement,
setEditingElement: setEditingElement,
slugPrefix: slugPrefix,
isGradient: isGradient,
popoverProps: popoverProps
}), !isEditing && editingElement !== null && (0,external_React_.createElement)(ColorPickerPopover, {
isGradient: isGradient,
onClose: () => setEditingElement(null),
onChange: newElement => {
debounceOnChange(
// @ts-expect-error TODO: Don't know how to resolve
elements.map((currentElement, currentIndex) => {
if (currentIndex === editingElement) {
return newElement;
}
return currentElement;
}));
},
element: elements[editingElement !== null && editingElement !== void 0 ? editingElement : -1],
popoverProps: popoverProps
}), !isEditing && (isGradient ? (0,external_React_.createElement)(gradient_picker, {
gradients: gradients,
onChange: onSelectPaletteItem,
clearable: false,
disableCustomGradients: true
}) : (0,external_React_.createElement)(color_palette, {
colors: colors,
onChange: onSelectPaletteItem,
clearable: false,
disableCustomColors: true
}))), !hasElements && emptyMessage);
}
/* harmony default export */ const palette_edit = (PaletteEdit);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/combobox-control/styles.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const deprecatedDefaultSize = ({
__next40pxDefaultSize
}) => !__next40pxDefaultSize && /*#__PURE__*/emotion_react_browser_esm_css("height:28px;padding-left:", space(1), ";padding-right:", space(1), ";" + ( true ? "" : 0), true ? "" : 0);
const InputWrapperFlex = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
target: "evuatpg0"
} : 0)("height:38px;padding-left:", space(2), ";padding-right:", space(2), ";", deprecatedDefaultSize, ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/token-input.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnForwardedTokenInput(props, ref) {
const {
value,
isExpanded,
instanceId,
selectedSuggestionIndex,
className,
onChange,
onFocus,
onBlur,
...restProps
} = props;
const [hasFocus, setHasFocus] = (0,external_wp_element_namespaceObject.useState)(false);
const size = value ? value.length + 1 : 0;
const onChangeHandler = event => {
if (onChange) {
onChange({
value: event.target.value
});
}
};
const onFocusHandler = e => {
setHasFocus(true);
onFocus?.(e);
};
const onBlurHandler = e => {
setHasFocus(false);
onBlur?.(e);
};
return (0,external_React_.createElement)("input", {
ref: ref,
id: `components-form-token-input-${instanceId}`,
type: "text",
...restProps,
value: value || '',
onChange: onChangeHandler,
onFocus: onFocusHandler,
onBlur: onBlurHandler,
size: size,
className: classnames_default()(className, 'components-form-token-field__input'),
autoComplete: "off",
role: "combobox",
"aria-expanded": isExpanded,
"aria-autocomplete": "list",
"aria-owns": isExpanded ? `components-form-token-suggestions-${instanceId}` : undefined,
"aria-activedescendant":
// Only add the `aria-activedescendant` attribute when:
// - the user is actively interacting with the input (`hasFocus`)
// - there is a selected suggestion (`selectedSuggestionIndex !== -1`)
// - the list of suggestions are rendered in the DOM (`isExpanded`)
hasFocus && selectedSuggestionIndex !== -1 && isExpanded ? `components-form-token-suggestions-${instanceId}-${selectedSuggestionIndex}` : undefined,
"aria-describedby": `components-form-token-suggestions-howto-${instanceId}`
});
}
const TokenInput = (0,external_wp_element_namespaceObject.forwardRef)(UnForwardedTokenInput);
/* harmony default export */ const token_input = (TokenInput);
// EXTERNAL MODULE: ./node_modules/dom-scroll-into-view/lib/index.js
var lib = __webpack_require__(5428);
var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/suggestions-list.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const handleMouseDown = e => {
// By preventing default here, we will not lose focus of <input> when clicking a suggestion.
e.preventDefault();
};
function SuggestionsList({
selectedIndex,
scrollIntoView,
match,
onHover,
onSelect,
suggestions = [],
displayTransform,
instanceId,
__experimentalRenderItem
}) {
const [scrollingIntoView, setScrollingIntoView] = (0,external_wp_element_namespaceObject.useState)(false);
const listRef = (0,external_wp_compose_namespaceObject.useRefEffect)(listNode => {
// only have to worry about scrolling selected suggestion into view
// when already expanded.
let rafId;
if (selectedIndex > -1 && scrollIntoView && listNode.children[selectedIndex]) {
setScrollingIntoView(true);
lib_default()(listNode.children[selectedIndex], listNode, {
onlyScrollIfNeeded: true
});
rafId = requestAnimationFrame(() => {
setScrollingIntoView(false);
});
}
return () => {
if (rafId !== undefined) {
cancelAnimationFrame(rafId);
}
};
}, [selectedIndex, scrollIntoView]);
const handleHover = suggestion => {
return () => {
if (!scrollingIntoView) {
onHover?.(suggestion);
}
};
};
const handleClick = suggestion => {
return () => {
onSelect?.(suggestion);
};
};
const computeSuggestionMatch = suggestion => {
const matchText = displayTransform(match).toLocaleLowerCase();
if (matchText.length === 0) {
return null;
}
const transformedSuggestion = displayTransform(suggestion);
const indexOfMatch = transformedSuggestion.toLocaleLowerCase().indexOf(matchText);
return {
suggestionBeforeMatch: transformedSuggestion.substring(0, indexOfMatch),
suggestionMatch: transformedSuggestion.substring(indexOfMatch, indexOfMatch + matchText.length),
suggestionAfterMatch: transformedSuggestion.substring(indexOfMatch + matchText.length)
};
};
return (0,external_React_.createElement)("ul", {
ref: listRef,
className: "components-form-token-field__suggestions-list",
id: `components-form-token-suggestions-${instanceId}`,
role: "listbox"
}, suggestions.map((suggestion, index) => {
const matchText = computeSuggestionMatch(suggestion);
const className = classnames_default()('components-form-token-field__suggestion', {
'is-selected': index === selectedIndex
});
let output;
if (typeof __experimentalRenderItem === 'function') {
output = __experimentalRenderItem({
item: suggestion
});
} else if (matchText) {
output = (0,external_React_.createElement)("span", {
"aria-label": displayTransform(suggestion)
}, matchText.suggestionBeforeMatch, (0,external_React_.createElement)("strong", {
className: "components-form-token-field__suggestion-match"
}, matchText.suggestionMatch), matchText.suggestionAfterMatch);
} else {
output = displayTransform(suggestion);
}
/* eslint-disable jsx-a11y/click-events-have-key-events */
return (0,external_React_.createElement)("li", {
id: `components-form-token-suggestions-${instanceId}-${index}`,
role: "option",
className: className,
key: typeof suggestion === 'object' && 'value' in suggestion ? suggestion?.value : displayTransform(suggestion),
onMouseDown: handleMouseDown,
onClick: handleClick(suggestion),
onMouseEnter: handleHover(suggestion),
"aria-selected": index === selectedIndex
}, output);
/* eslint-enable jsx-a11y/click-events-have-key-events */
}));
}
/* harmony default export */ const suggestions_list = (SuggestionsList);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-outside/index.js
/**
* WordPress dependencies
*/
/* harmony default export */ const with_focus_outside = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => {
const [handleFocusOutside, setHandleFocusOutside] = (0,external_wp_element_namespaceObject.useState)(undefined);
const bindFocusOutsideHandler = (0,external_wp_element_namespaceObject.useCallback)(node => setHandleFocusOutside(() => node?.handleFocusOutside ? node.handleFocusOutside.bind(node) : undefined), []);
return (0,external_React_.createElement)("div", {
...(0,external_wp_compose_namespaceObject.__experimentalUseFocusOutside)(handleFocusOutside)
}, (0,external_React_.createElement)(WrappedComponent, {
ref: bindFocusOutsideHandler,
...props
}));
}, 'withFocusOutside'));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/combobox-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const combobox_control_noop = () => {};
const DetectOutside = with_focus_outside(class extends external_wp_element_namespaceObject.Component {
handleFocusOutside(event) {
this.props.onFocusOutside(event);
}
render() {
return this.props.children;
}
});
const getIndexOfMatchingSuggestion = (selectedSuggestion, matchingSuggestions) => selectedSuggestion === null ? -1 : matchingSuggestions.indexOf(selectedSuggestion);
/**
* `ComboboxControl` is an enhanced version of a [`SelectControl`](../select-control/README.md) with the addition of
* being able to search for options using a search input.
*
* ```jsx
* import { ComboboxControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const options = [
* {
* value: 'small',
* label: 'Small',
* },
* {
* value: 'normal',
* label: 'Normal',
* },
* {
* value: 'large',
* label: 'Large',
* },
* ];
*
* function MyComboboxControl() {
* const [ fontSize, setFontSize ] = useState();
* const [ filteredOptions, setFilteredOptions ] = useState( options );
* return (
* <ComboboxControl
* label="Font Size"
* value={ fontSize }
* onChange={ setFontSize }
* options={ filteredOptions }
* onFilterValueChange={ ( inputValue ) =>
* setFilteredOptions(
* options.filter( ( option ) =>
* option.label
* .toLowerCase()
* .startsWith( inputValue.toLowerCase() )
* )
* )
* }
* />
* );
* }
* ```
*/
function ComboboxControl(props) {
var _currentOption$label;
const {
__nextHasNoMarginBottom = false,
__next40pxDefaultSize = false,
value: valueProp,
label,
options,
onChange: onChangeProp,
onFilterValueChange = combobox_control_noop,
hideLabelFromVision,
help,
allowReset = true,
className,
messages = {
selected: (0,external_wp_i18n_namespaceObject.__)('Item selected.')
},
__experimentalRenderItem
} = useDeprecated36pxDefaultSizeProp(props);
const [value, setValue] = useControlledValue({
value: valueProp,
onChange: onChangeProp
});
const currentOption = options.find(option => option.value === value);
const currentLabel = (_currentOption$label = currentOption?.label) !== null && _currentOption$label !== void 0 ? _currentOption$label : '';
// Use a custom prefix when generating the `instanceId` to avoid having
// duplicate input IDs when rendering this component and `FormTokenField`
// in the same page (see https://github.com/WordPress/gutenberg/issues/42112).
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ComboboxControl, 'combobox-control');
const [selectedSuggestion, setSelectedSuggestion] = (0,external_wp_element_namespaceObject.useState)(currentOption || null);
const [isExpanded, setIsExpanded] = (0,external_wp_element_namespaceObject.useState)(false);
const [inputHasFocus, setInputHasFocus] = (0,external_wp_element_namespaceObject.useState)(false);
const [inputValue, setInputValue] = (0,external_wp_element_namespaceObject.useState)('');
const inputContainer = (0,external_wp_element_namespaceObject.useRef)(null);
const matchingSuggestions = (0,external_wp_element_namespaceObject.useMemo)(() => {
const startsWithMatch = [];
const containsMatch = [];
const match = normalizeTextString(inputValue);
options.forEach(option => {
const index = normalizeTextString(option.label).indexOf(match);
if (index === 0) {
startsWithMatch.push(option);
} else if (index > 0) {
containsMatch.push(option);
}
});
return startsWithMatch.concat(containsMatch);
}, [inputValue, options]);
const onSuggestionSelected = newSelectedSuggestion => {
setValue(newSelectedSuggestion.value);
(0,external_wp_a11y_namespaceObject.speak)(messages.selected, 'assertive');
setSelectedSuggestion(newSelectedSuggestion);
setInputValue('');
setIsExpanded(false);
};
const handleArrowNavigation = (offset = 1) => {
const index = getIndexOfMatchingSuggestion(selectedSuggestion, matchingSuggestions);
let nextIndex = index + offset;
if (nextIndex < 0) {
nextIndex = matchingSuggestions.length - 1;
} else if (nextIndex >= matchingSuggestions.length) {
nextIndex = 0;
}
setSelectedSuggestion(matchingSuggestions[nextIndex]);
setIsExpanded(true);
};
const onKeyDown = event => {
let preventDefault = false;
if (event.defaultPrevented ||
// Ignore keydowns from IMEs
event.nativeEvent.isComposing ||
// Workaround for Mac Safari where the final Enter/Backspace of an IME composition
// is `isComposing=false`, even though it's technically still part of the composition.
// These can only be detected by keyCode.
event.keyCode === 229) {
return;
}
switch (event.code) {
case 'Enter':
if (selectedSuggestion) {
onSuggestionSelected(selectedSuggestion);
preventDefault = true;
}
break;
case 'ArrowUp':
handleArrowNavigation(-1);
preventDefault = true;
break;
case 'ArrowDown':
handleArrowNavigation(1);
preventDefault = true;
break;
case 'Escape':
setIsExpanded(false);
setSelectedSuggestion(null);
preventDefault = true;
break;
default:
break;
}
if (preventDefault) {
event.preventDefault();
}
};
const onBlur = () => {
setInputHasFocus(false);
};
const onFocus = () => {
setInputHasFocus(true);
setIsExpanded(true);
onFilterValueChange('');
setInputValue('');
};
const onFocusOutside = () => {
setIsExpanded(false);
};
const onInputChange = event => {
const text = event.value;
setInputValue(text);
onFilterValueChange(text);
if (inputHasFocus) {
setIsExpanded(true);
}
};
const handleOnReset = () => {
setValue(null);
inputContainer.current?.focus();
};
// Update current selections when the filter input changes.
(0,external_wp_element_namespaceObject.useEffect)(() => {
const hasMatchingSuggestions = matchingSuggestions.length > 0;
const hasSelectedMatchingSuggestions = getIndexOfMatchingSuggestion(selectedSuggestion, matchingSuggestions) > 0;
if (hasMatchingSuggestions && !hasSelectedMatchingSuggestions) {
// If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.
setSelectedSuggestion(matchingSuggestions[0]);
}
}, [matchingSuggestions, selectedSuggestion]);
// Announcements.
(0,external_wp_element_namespaceObject.useEffect)(() => {
const hasMatchingSuggestions = matchingSuggestions.length > 0;
if (isExpanded) {
const message = hasMatchingSuggestions ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: 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.', matchingSuggestions.length), matchingSuggestions.length) : (0,external_wp_i18n_namespaceObject.__)('No results.');
(0,external_wp_a11y_namespaceObject.speak)(message, 'polite');
}
}, [matchingSuggestions, isExpanded]);
// Disable reason: There is no appropriate role which describes the
// input container intended accessible usability.
// TODO: Refactor click detection to use blur to stop propagation.
/* eslint-disable jsx-a11y/no-static-element-interactions */
return (0,external_React_.createElement)(DetectOutside, {
onFocusOutside: onFocusOutside
}, (0,external_React_.createElement)(base_control, {
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
className: classnames_default()(className, 'components-combobox-control'),
label: label,
id: `components-form-token-input-${instanceId}`,
hideLabelFromVision: hideLabelFromVision,
help: help
}, (0,external_React_.createElement)("div", {
className: "components-combobox-control__suggestions-container",
tabIndex: -1,
onKeyDown: onKeyDown
}, (0,external_React_.createElement)(InputWrapperFlex, {
__next40pxDefaultSize: __next40pxDefaultSize
}, (0,external_React_.createElement)(flex_block_component, null, (0,external_React_.createElement)(token_input, {
className: "components-combobox-control__input",
instanceId: instanceId,
ref: inputContainer,
value: isExpanded ? inputValue : currentLabel,
onFocus: onFocus,
onBlur: onBlur,
isExpanded: isExpanded,
selectedSuggestionIndex: getIndexOfMatchingSuggestion(selectedSuggestion, matchingSuggestions),
onChange: onInputChange
})), allowReset && (0,external_React_.createElement)(flex_item_component, null, (0,external_React_.createElement)(build_module_button, {
className: "components-combobox-control__reset",
icon: close_small,
disabled: !value,
onClick: handleOnReset,
label: (0,external_wp_i18n_namespaceObject.__)('Reset')
}))), isExpanded && (0,external_React_.createElement)(suggestions_list, {
instanceId: instanceId
// The empty string for `value` here is not actually used, but is
// just a quick way to satisfy the TypeScript requirements of SuggestionsList.
// See: https://github.com/WordPress/gutenberg/pull/47581/files#r1091089330
,
match: {
label: inputValue,
value: ''
},
displayTransform: suggestion => suggestion.label,
suggestions: matchingSuggestions,
selectedIndex: getIndexOfMatchingSuggestion(selectedSuggestion, matchingSuggestions),
onHover: setSelectedSuggestion,
onSelect: onSuggestionSelected,
scrollIntoView: true,
__experimentalRenderItem: __experimentalRenderItem
}))));
/* eslint-enable jsx-a11y/no-static-element-interactions */
}
/* harmony default export */ const combobox_control = (ComboboxControl);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/3X3MDQGM.js
"use client";
// src/group/group-label-context.ts
var GroupLabelContext = (0,external_React_.createContext)(void 0);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/R2QZ3KXH.js
"use client";
// src/group/group.tsx
var useGroup = createHook((props) => {
const [labelId, setLabelId] = (0,external_React_.useState)();
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(GroupLabelContext.Provider, { value: setLabelId, children: element }),
[]
);
props = _4R3V3JGP_spreadValues({
role: "group",
"aria-labelledby": labelId
}, props);
return props;
});
var Group = createComponent((props) => {
const htmlProps = useGroup(props);
return _3ORBWXWF_createElement("div", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/636A7WVS.js
"use client";
// src/composite/composite-group.ts
var useCompositeGroup = createHook(
(_a) => {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
props = useGroup(props);
return props;
}
);
var CompositeGroup = createComponent(
(props) => {
const htmlProps = useCompositeGroup(props);
return _3ORBWXWF_createElement("div", htmlProps);
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/composite/legacy/index.js
/**
* Composite is a component that may contain navigable items represented by
* CompositeItem. It's inspired by the WAI-ARIA Composite Role and implements
* all the keyboard navigation mechanisms to ensure that there's only one
* tab stop for the whole Composite element. This means that it can behave as
* a roving tabindex or aria-activedescendant container.
*
* @see https://ariakit.org/components/composite
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function mapLegacyStatePropsToComponentProps(legacyProps) {
// If a `state` prop is provided, we unpack that; otherwise,
// the necessary props are provided directly in `legacyProps`.
if (legacyProps.state) {
const {
state,
...rest
} = legacyProps;
const {
store,
...props
} = mapLegacyStatePropsToComponentProps(state);
return {
...rest,
...props,
store
};
}
return legacyProps;
}
function proxyComposite(ProxiedComponent, propMap = {}) {
const displayName = ProxiedComponent.displayName;
const Component = legacyProps => {
const {
store,
...rest
} = mapLegacyStatePropsToComponentProps(legacyProps);
const props = rest;
props.id = (0,external_wp_compose_namespaceObject.useInstanceId)(store, props.baseId, props.id);
Object.entries(propMap).forEach(([from, to]) => {
if (props.hasOwnProperty(from)) {
Object.assign(props, {
[to]: props[from]
});
delete props[from];
}
});
delete props.baseId;
return (0,external_React_.createElement)(ProxiedComponent, {
...props,
store: store
});
};
Component.displayName = displayName;
return Component;
}
// The old `CompositeGroup` used to behave more like the current
// `CompositeRow`, but this has been split into two different
// components. We handle that difference by checking on the
// provided role, and returning the appropriate component.
const unproxiedCompositeGroup = (0,external_wp_element_namespaceObject.forwardRef)(({
role,
...props
}, ref) => {
const Component = role === 'row' ? CompositeRow : CompositeGroup;
return (0,external_React_.createElement)(Component, {
ref: ref,
role: role,
...props
});
});
unproxiedCompositeGroup.displayName = 'CompositeGroup';
const legacy_Composite = proxyComposite(Composite, {
baseId: 'id'
});
const legacy_CompositeGroup = proxyComposite(unproxiedCompositeGroup);
const legacy_CompositeItem = proxyComposite(CompositeItem, {
focusable: 'accessibleWhenDisabled'
});
function useCompositeState(legacyStateOptions = {}) {
const {
baseId,
currentId: defaultActiveId,
orientation,
rtl = false,
loop: focusLoop = false,
wrap: focusWrap = false,
shift: focusShift = false,
// eslint-disable-next-line camelcase
unstable_virtual: virtualFocus
} = legacyStateOptions;
return {
baseId: (0,external_wp_compose_namespaceObject.useInstanceId)(legacy_Composite, 'composite', baseId),
store: useCompositeStore({
defaultActiveId,
rtl,
orientation,
focusLoop,
focusShift,
focusWrap,
virtualFocus
})
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/modal/aria-helper.js
const LIVE_REGION_ARIA_ROLES = new Set(['alert', 'status', 'log', 'marquee', 'timer']);
const hiddenElementsByDepth = [];
/**
* Hides all elements in the body element from screen-readers except
* the provided element and elements that should not be hidden from
* screen-readers.
*
* The reason we do this is because `aria-modal="true"` currently is bugged
* in Safari, and support is spotty in other browsers overall. In the future
* we should consider removing these helper functions in favor of
* `aria-modal="true"`.
*
* @param modalElement The element that should not be hidden.
*/
function modalize(modalElement) {
const elements = Array.from(document.body.children);
const hiddenElements = [];
hiddenElementsByDepth.push(hiddenElements);
for (const element of elements) {
if (element === modalElement) continue;
if (elementShouldBeHidden(element)) {
element.setAttribute('aria-hidden', 'true');
hiddenElements.push(element);
}
}
}
/**
* Determines if the passed element should not be hidden from screen readers.
*
* @param element The element that should be checked.
*
* @return Whether the element should not be hidden from screen-readers.
*/
function elementShouldBeHidden(element) {
const role = element.getAttribute('role');
return !(element.tagName === 'SCRIPT' || element.hasAttribute('aria-hidden') || element.hasAttribute('aria-live') || role && LIVE_REGION_ARIA_ROLES.has(role));
}
/**
* Accessibly reveals the elements hidden by the latest modal.
*/
function unmodalize() {
const hiddenElements = hiddenElementsByDepth.pop();
if (!hiddenElements) return;
for (const element of hiddenElements) element.removeAttribute('aria-hidden');
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/modal/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// Used to track and dismiss the prior modal when another opens unless nested.
const ModalContext = (0,external_wp_element_namespaceObject.createContext)([]);
// Used to track body class names applied while modals are open.
const bodyOpenClasses = new Map();
function UnforwardedModal(props, forwardedRef) {
const {
bodyOpenClassName = 'modal-open',
role = 'dialog',
title = null,
focusOnMount = true,
shouldCloseOnEsc = true,
shouldCloseOnClickOutside = true,
isDismissible = true,
/* Accessibility. */
aria = {
labelledby: undefined,
describedby: undefined
},
onRequestClose,
icon,
closeButtonLabel,
children,
style,
overlayClassName,
className,
contentLabel,
onKeyDown,
isFullScreen = false,
size,
headerActions = null,
__experimentalHideHeader = false
} = props;
const ref = (0,external_wp_element_namespaceObject.useRef)();
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Modal);
const headingId = title ? `components-modal-header-${instanceId}` : aria.labelledby;
// The focus hook does not support 'firstContentElement' but this is a valid
// value for the Modal's focusOnMount prop. The following code ensures the focus
// hook will focus the first focusable node within the element to which it is applied.
// When `firstContentElement` is passed as the value of the focusOnMount prop,
// the focus hook is applied to the Modal's content element.
// Otherwise, the focus hook is applied to the Modal's ref. This ensures that the
// focus hook will focus the first element in the Modal's **content** when
// `firstContentElement` is passed.
const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)(focusOnMount === 'firstContentElement' ? 'firstElement' : focusOnMount);
const constrainedTabbingRef = (0,external_wp_compose_namespaceObject.useConstrainedTabbing)();
const focusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
const contentRef = (0,external_wp_element_namespaceObject.useRef)(null);
const childrenContainerRef = (0,external_wp_element_namespaceObject.useRef)(null);
const [hasScrolledContent, setHasScrolledContent] = (0,external_wp_element_namespaceObject.useState)(false);
const [hasScrollableContent, setHasScrollableContent] = (0,external_wp_element_namespaceObject.useState)(false);
let sizeClass;
if (isFullScreen || size === 'fill') {
sizeClass = 'is-full-screen';
} else if (size) {
sizeClass = `has-size-${size}`;
}
// Determines whether the Modal content is scrollable and updates the state.
const isContentScrollable = (0,external_wp_element_namespaceObject.useCallback)(() => {
if (!contentRef.current) {
return;
}
const closestScrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(contentRef.current);
if (contentRef.current === closestScrollContainer) {
setHasScrollableContent(true);
} else {
setHasScrollableContent(false);
}
}, [contentRef]);
// Accessibly isolates/unisolates the modal.
(0,external_wp_element_namespaceObject.useEffect)(() => {
modalize(ref.current);
return () => unmodalize();
}, []);
// Keeps a fresh ref for the subsequent effect.
const refOnRequestClose = (0,external_wp_element_namespaceObject.useRef)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
refOnRequestClose.current = onRequestClose;
}, [onRequestClose]);
// The list of `onRequestClose` callbacks of open (non-nested) Modals. Only
// one should remain open at a time and the list enables closing prior ones.
const dismissers = (0,external_wp_element_namespaceObject.useContext)(ModalContext);
// Used for the tracking and dismissing any nested modals.
const nestedDismissers = (0,external_wp_element_namespaceObject.useRef)([]);
// Updates the stack tracking open modals at this level and calls
// onRequestClose for any prior and/or nested modals as applicable.
(0,external_wp_element_namespaceObject.useEffect)(() => {
dismissers.push(refOnRequestClose);
const [first, second] = dismissers;
if (second) first?.current?.();
const nested = nestedDismissers.current;
return () => {
nested[0]?.current?.();
dismissers.shift();
};
}, [dismissers]);
// Adds/removes the value of bodyOpenClassName to body element.
(0,external_wp_element_namespaceObject.useEffect)(() => {
var _bodyOpenClasses$get;
const theClass = bodyOpenClassName;
const oneMore = 1 + ((_bodyOpenClasses$get = bodyOpenClasses.get(theClass)) !== null && _bodyOpenClasses$get !== void 0 ? _bodyOpenClasses$get : 0);
bodyOpenClasses.set(theClass, oneMore);
document.body.classList.add(bodyOpenClassName);
return () => {
const oneLess = bodyOpenClasses.get(theClass) - 1;
if (oneLess === 0) {
document.body.classList.remove(theClass);
bodyOpenClasses.delete(theClass);
} else {
bodyOpenClasses.set(theClass, oneLess);
}
};
}, [bodyOpenClassName]);
// Calls the isContentScrollable callback when the Modal children container resizes.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (!window.ResizeObserver || !childrenContainerRef.current) {
return;
}
const resizeObserver = new ResizeObserver(isContentScrollable);
resizeObserver.observe(childrenContainerRef.current);
isContentScrollable();
return () => {
resizeObserver.disconnect();
};
}, [isContentScrollable, childrenContainerRef]);
function handleEscapeKeyDown(event) {
if (
// Ignore keydowns from IMEs
event.nativeEvent.isComposing ||
// Workaround for Mac Safari where the final Enter/Backspace of an IME composition
// is `isComposing=false`, even though it's technically still part of the composition.
// These can only be detected by keyCode.
event.keyCode === 229) {
return;
}
if (shouldCloseOnEsc && (event.code === 'Escape' || event.key === 'Escape') && !event.defaultPrevented) {
event.preventDefault();
if (onRequestClose) {
onRequestClose(event);
}
}
}
const onContentContainerScroll = (0,external_wp_element_namespaceObject.useCallback)(e => {
var _e$currentTarget$scro;
const scrollY = (_e$currentTarget$scro = e?.currentTarget?.scrollTop) !== null && _e$currentTarget$scro !== void 0 ? _e$currentTarget$scro : -1;
if (!hasScrolledContent && scrollY > 0) {
setHasScrolledContent(true);
} else if (hasScrolledContent && scrollY <= 0) {
setHasScrolledContent(false);
}
}, [hasScrolledContent]);
let pressTarget = null;
const overlayPressHandlers = {
onPointerDown: event => {
if (event.target === event.currentTarget) {
pressTarget = event.target;
// Avoids focus changing so that focus return works as expected.
event.preventDefault();
}
},
// Closes the modal with two exceptions. 1. Opening the context menu on
// the overlay. 2. Pressing on the overlay then dragging the pointer
// over the modal and releasing. Due to the modal being a child of the
// overlay, such a gesture is a `click` on the overlay and cannot be
// excepted by a `click` handler. Thus the tactic of handling
// `pointerup` and comparing its target to that of the `pointerdown`.
onPointerUp: ({
target,
button
}) => {
const isSameTarget = target === pressTarget;
pressTarget = null;
if (button === 0 && isSameTarget) onRequestClose();
}
};
const modal =
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
(0,external_React_.createElement)("div", {
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, forwardedRef]),
className: classnames_default()('components-modal__screen-overlay', overlayClassName),
onKeyDown: handleEscapeKeyDown,
...(shouldCloseOnClickOutside ? overlayPressHandlers : {})
}, (0,external_React_.createElement)(style_provider, {
document: document
}, (0,external_React_.createElement)("div", {
className: classnames_default()('components-modal__frame', sizeClass, className),
style: style,
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([constrainedTabbingRef, focusReturnRef, focusOnMount !== 'firstContentElement' ? focusOnMountRef : null]),
role: role,
"aria-label": contentLabel,
"aria-labelledby": contentLabel ? undefined : headingId,
"aria-describedby": aria.describedby,
tabIndex: -1,
onKeyDown: onKeyDown
}, (0,external_React_.createElement)("div", {
className: classnames_default()('components-modal__content', {
'hide-header': __experimentalHideHeader,
'is-scrollable': hasScrollableContent,
'has-scrolled-content': hasScrolledContent
}),
role: "document",
onScroll: onContentContainerScroll,
ref: contentRef,
"aria-label": hasScrollableContent ? (0,external_wp_i18n_namespaceObject.__)('Scrollable section') : undefined,
tabIndex: hasScrollableContent ? 0 : undefined
}, !__experimentalHideHeader && (0,external_React_.createElement)("div", {
className: "components-modal__header"
}, (0,external_React_.createElement)("div", {
className: "components-modal__header-heading-container"
}, icon && (0,external_React_.createElement)("span", {
className: "components-modal__icon-container",
"aria-hidden": true
}, icon), title && (0,external_React_.createElement)("h1", {
id: headingId,
className: "components-modal__header-heading"
}, title)), headerActions, isDismissible && (0,external_React_.createElement)(build_module_button, {
onClick: onRequestClose,
icon: library_close,
label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)('Close')
})), (0,external_React_.createElement)("div", {
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([childrenContainerRef, focusOnMount === 'firstContentElement' ? focusOnMountRef : null])
}, children)))));
return (0,external_wp_element_namespaceObject.createPortal)((0,external_React_.createElement)(ModalContext.Provider, {
value: nestedDismissers.current
}, modal), document.body);
}
/**
* Modals give users information and choices related to a task they’re trying to
* accomplish. They can contain critical information, require decisions, or
* involve multiple tasks.
*
* ```jsx
* import { Button, Modal } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyModal = () => {
* const [ isOpen, setOpen ] = useState( false );
* const openModal = () => setOpen( true );
* const closeModal = () => setOpen( false );
*
* return (
* <>
* <Button variant="secondary" onClick={ openModal }>
* Open Modal
* </Button>
* { isOpen && (
* <Modal title="This is my modal" onRequestClose={ closeModal }>
* <Button variant="secondary" onClick={ closeModal }>
* My custom close button
* </Button>
* </Modal>
* ) }
* </>
* );
* };
* ```
*/
const Modal = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedModal);
/* harmony default export */ const modal = (Modal);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/confirm-dialog/styles.js
function confirm_dialog_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* The z-index for ConfirmDialog is being set here instead of in
* packages/base-styles/_z-index.scss, because this component uses
* emotion instead of sass.
*
* ConfirmDialog needs this higher z-index to ensure it renders on top of
* any parent Popover component.
*/
const styles_wrapper = true ? {
name: "7g5ii0",
styles: "&&{z-index:1000001;}"
} : 0;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/confirm-dialog/component.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const UnconnectedConfirmDialog = (props, forwardedRef) => {
const {
isOpen: isOpenProp,
onConfirm,
onCancel,
children,
confirmButtonText,
cancelButtonText,
...otherProps
} = useContextSystem(props, 'ConfirmDialog');
const cx = useCx();
const wrapperClassName = cx(styles_wrapper);
const cancelButtonRef = (0,external_wp_element_namespaceObject.useRef)();
const confirmButtonRef = (0,external_wp_element_namespaceObject.useRef)();
const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)();
const [shouldSelfClose, setShouldSelfClose] = (0,external_wp_element_namespaceObject.useState)();
(0,external_wp_element_namespaceObject.useEffect)(() => {
// We only allow the dialog to close itself if `isOpenProp` is *not* set.
// If `isOpenProp` is set, then it (probably) means it's controlled by a
// parent component. In that case, `shouldSelfClose` might do more harm than
// good, so we disable it.
const isIsOpenSet = typeof isOpenProp !== 'undefined';
setIsOpen(isIsOpenSet ? isOpenProp : true);
setShouldSelfClose(!isIsOpenSet);
}, [isOpenProp]);
const handleEvent = (0,external_wp_element_namespaceObject.useCallback)(callback => event => {
callback?.(event);
if (shouldSelfClose) {
setIsOpen(false);
}
}, [shouldSelfClose, setIsOpen]);
const handleEnter = (0,external_wp_element_namespaceObject.useCallback)(event => {
// Avoid triggering the 'confirm' action when a button is focused,
// as this can cause a double submission.
const isConfirmOrCancelButton = event.target === cancelButtonRef.current || event.target === confirmButtonRef.current;
if (!isConfirmOrCancelButton && event.key === 'Enter') {
handleEvent(onConfirm)(event);
}
}, [handleEvent, onConfirm]);
const cancelLabel = cancelButtonText !== null && cancelButtonText !== void 0 ? cancelButtonText : (0,external_wp_i18n_namespaceObject.__)('Cancel');
const confirmLabel = confirmButtonText !== null && confirmButtonText !== void 0 ? confirmButtonText : (0,external_wp_i18n_namespaceObject.__)('OK');
return (0,external_React_.createElement)(external_React_.Fragment, null, isOpen && (0,external_React_.createElement)(modal, {
onRequestClose: handleEvent(onCancel),
onKeyDown: handleEnter,
closeButtonLabel: cancelLabel,
isDismissible: true,
ref: forwardedRef,
overlayClassName: wrapperClassName,
__experimentalHideHeader: true,
...otherProps
}, (0,external_React_.createElement)(v_stack_component, {
spacing: 8
}, (0,external_React_.createElement)(text_component, null, children), (0,external_React_.createElement)(flex_component, {
direction: "row",
justify: "flex-end"
}, (0,external_React_.createElement)(build_module_button, {
__next40pxDefaultSize: true,
ref: cancelButtonRef,
variant: "tertiary",
onClick: handleEvent(onCancel)
}, cancelLabel), (0,external_React_.createElement)(build_module_button, {
__next40pxDefaultSize: true,
ref: confirmButtonRef,
variant: "primary",
onClick: handleEvent(onConfirm)
}, confirmLabel)))));
};
/**
* `ConfirmDialog` is built of top of [`Modal`](/packages/components/src/modal/README.md)
* and displays a confirmation dialog, with _confirm_ and _cancel_ buttons.
* The dialog is confirmed by clicking the _confirm_ button or by pressing the `Enter` key.
* It is cancelled (closed) by clicking the _cancel_ button, by pressing the `ESC` key, or by
* clicking outside the dialog focus (i.e, the overlay).
*
* `ConfirmDialog` has two main implicit modes: controlled and uncontrolled.
*
* UnControlled:
*
* Allows the component to be used standalone, just by declaring it as part of another React's component render method:
* - It will be automatically open (displayed) upon mounting;
* - It will be automatically closed when clicking the _cancel_ button, by pressing the `ESC` key, or by clicking outside the dialog focus (i.e, the overlay);
* - `onCancel` is not mandatory but can be passed. Even if passed, the dialog will still be able to close itself.
*
* Activating this mode is as simple as omitting the `isOpen` prop. The only mandatory prop, in this case, is the `onConfirm` callback. The message is passed as the `children`. You can pass any JSX you'd like, which allows to further format the message or include sub-component if you'd like:
*
* ```jsx
* import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';
*
* function Example() {
* return (
* <ConfirmDialog onConfirm={ () => console.debug( ' Confirmed! ' ) }>
* Are you sure? <strong>This action cannot be undone!</strong>
* </ConfirmDialog>
* );
* }
* ```
*
*
* Controlled mode:
* Let the parent component control when the dialog is open/closed. It's activated when a
* boolean value is passed to `isOpen`:
* - It will not be automatically closed. You need to let it know when to open/close by updating the value of the `isOpen` prop;
* - Both `onConfirm` and the `onCancel` callbacks are mandatory props in this mode;
* - You'll want to update the state that controls `isOpen` by updating it from the `onCancel` and `onConfirm` callbacks.
*
*```jsx
* import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* function Example() {
* const [ isOpen, setIsOpen ] = useState( true );
*
* const handleConfirm = () => {
* console.debug( 'Confirmed!' );
* setIsOpen( false );
* };
*
* const handleCancel = () => {
* console.debug( 'Cancelled!' );
* setIsOpen( false );
* };
*
* return (
* <ConfirmDialog
* isOpen={ isOpen }
* onConfirm={ handleConfirm }
* onCancel={ handleCancel }
* >
* Are you sure? <strong>This action cannot be undone!</strong>
* </ConfirmDialog>
* );
* }
* ```
*/
const ConfirmDialog = contextConnect(UnconnectedConfirmDialog, 'ConfirmDialog');
/* harmony default export */ const confirm_dialog_component = (ConfirmDialog);
// EXTERNAL MODULE: ./node_modules/prop-types/index.js
var prop_types = __webpack_require__(5826);
var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);
// EXTERNAL MODULE: ./node_modules/downshift/node_modules/react-is/index.js
var react_is = __webpack_require__(1915);
;// CONCATENATED MODULE: ./node_modules/compute-scroll-into-view/dist/index.mjs
function dist_t(t){return"object"==typeof t&&null!=t&&1===t.nodeType}function dist_e(t,e){return(!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function dist_n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return dist_e(r.overflowY,n)||dist_e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return!1}function dist_r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}var compute_scroll_into_view_dist_i=function(e,i){var o=window,l=i.scrollMode,d=i.block,f=i.inline,h=i.boundary,u=i.skipOverflowHiddenElements,s="function"==typeof h?h:function(t){return t!==h};if(!dist_t(e))throw new TypeError("Invalid target");for(var a,c,g=document.scrollingElement||document.documentElement,p=[],m=e;dist_t(m)&&s(m);){if((m=null==(c=(a=m).parentElement)?a.getRootNode().host||null:c)===g){p.push(m);break}null!=m&&m===document.body&&dist_n(m)&&!dist_n(document.documentElement)||null!=m&&dist_n(m,u)&&p.push(m)}for(var w=o.visualViewport?o.visualViewport.width:innerWidth,v=o.visualViewport?o.visualViewport.height:innerHeight,W=window.scrollX||pageXOffset,H=window.scrollY||pageYOffset,b=e.getBoundingClientRect(),y=b.height,E=b.width,M=b.top,V=b.right,x=b.bottom,I=b.left,C="start"===d||"nearest"===d?M:"end"===d?x:M+y/2,R="center"===f?I+E/2:"end"===f?V:I,T=[],k=0;k<p.length;k++){var B=p[k],D=B.getBoundingClientRect(),O=D.height,X=D.width,Y=D.top,L=D.right,S=D.bottom,j=D.left;if("if-needed"===l&&M>=0&&I>=0&&x<=v&&V<=w&&M>=Y&&x<=S&&I>=j&&V<=L)return T;var N=getComputedStyle(B),q=parseInt(N.borderLeftWidth,10),z=parseInt(N.borderTopWidth,10),A=parseInt(N.borderRightWidth,10),F=parseInt(N.borderBottomWidth,10),G=0,J=0,K="offsetWidth"in B?B.offsetWidth-B.clientWidth-q-A:0,P="offsetHeight"in B?B.offsetHeight-B.clientHeight-z-F:0,Q="offsetWidth"in B?0===B.offsetWidth?0:X/B.offsetWidth:0,U="offsetHeight"in B?0===B.offsetHeight?0:O/B.offsetHeight:0;if(g===B)G="start"===d?C:"end"===d?C-v:"nearest"===d?dist_r(H,H+v,v,z,F,H+C,H+C+y,y):C-v/2,J="start"===f?R:"center"===f?R-w/2:"end"===f?R-w:dist_r(W,W+w,w,q,A,W+R,W+R+E,E),G=Math.max(0,G+H),J=Math.max(0,J+W);else{G="start"===d?C-Y-z:"end"===d?C-S+F+P:"nearest"===d?dist_r(Y,S,O,z,F+P,C,C+y,y):C-(Y+O/2)+P/2,J="start"===f?R-j-q:"center"===f?R-(j+X/2)+K/2:"end"===f?R-L+A+K:dist_r(j,L,X,q,A+K,R,R+E,E);var Z=B.scrollLeft,$=B.scrollTop;C+=$-(G=Math.max(0,Math.min($+G/U,B.scrollHeight-O/U+P))),R+=Z-(J=Math.max(0,Math.min(Z+J/Q,B.scrollWidth-X/Q+K)))}T.push({el:B,top:G,left:J})}return T};
//# sourceMappingURL=index.mjs.map
;// CONCATENATED MODULE: ./node_modules/downshift/dist/downshift.esm.js
let idCounter = 0;
/**
* Accepts a parameter and returns it if it's a function
* or a noop function if it's not. This allows us to
* accept a callback, but not worry about it if it's not
* passed.
* @param {Function} cb the callback
* @return {Function} a function
*/
function cbToCb(cb) {
return typeof cb === 'function' ? cb : downshift_esm_noop;
}
function downshift_esm_noop() {}
/**
* Scroll node into view if necessary
* @param {HTMLElement} node the element that should scroll into view
* @param {HTMLElement} menuNode the menu element of the component
*/
function scrollIntoView(node, menuNode) {
if (!node) {
return;
}
const actions = compute_scroll_into_view_dist_i(node, {
boundary: menuNode,
block: 'nearest',
scrollMode: 'if-needed'
});
actions.forEach(_ref => {
let {
el,
top,
left
} = _ref;
el.scrollTop = top;
el.scrollLeft = left;
});
}
/**
* @param {HTMLElement} parent the parent node
* @param {HTMLElement} child the child node
* @param {Window} environment The window context where downshift renders.
* @return {Boolean} whether the parent is the child or the child is in the parent
*/
function isOrContainsNode(parent, child, environment) {
const result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
return result;
}
/**
* Simple debounce implementation. Will call the given
* function once after the time given has passed since
* it was last called.
* @param {Function} fn the function to call after the time
* @param {Number} time the time to wait
* @return {Function} the debounced function
*/
function debounce(fn, time) {
let timeoutId;
function cancel() {
if (timeoutId) {
clearTimeout(timeoutId);
}
}
function wrapper() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
cancel();
timeoutId = setTimeout(() => {
timeoutId = null;
fn(...args);
}, time);
}
wrapper.cancel = cancel;
return wrapper;
}
/**
* This is intended to be used to compose event handlers.
* They are executed in order until one of them sets
* `event.preventDownshiftDefault = true`.
* @param {...Function} fns the event handler functions
* @return {Function} the event handler to add to an element
*/
function callAllEventHandlers() {
for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
fns[_key2] = arguments[_key2];
}
return function (event) {
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
args[_key3 - 1] = arguments[_key3];
}
return fns.some(fn => {
if (fn) {
fn(event, ...args);
}
return event.preventDownshiftDefault || event.hasOwnProperty('nativeEvent') && event.nativeEvent.preventDownshiftDefault;
});
};
}
function handleRefs() {
for (var _len4 = arguments.length, refs = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
refs[_key4] = arguments[_key4];
}
return node => {
refs.forEach(ref => {
if (typeof ref === 'function') {
ref(node);
} else if (ref) {
ref.current = node;
}
});
};
}
/**
* This generates a unique ID for an instance of Downshift
* @return {String} the unique ID
*/
function generateId() {
return String(idCounter++);
}
/**
* Resets idCounter to 0. Used for SSR.
*/
function resetIdCounter() {
idCounter = 0;
}
/**
* Default implementation for status message. Only added when menu is open.
* Will specify if there are results in the list, and if so, how many,
* and what keys are relevant.
*
* @param {Object} param the downshift state and other relevant properties
* @return {String} the a11y status message
*/
function getA11yStatusMessage$1(_ref2) {
let {
isOpen,
resultCount,
previousResultCount
} = _ref2;
if (!isOpen) {
return '';
}
if (!resultCount) {
return 'No results are available.';
}
if (resultCount !== previousResultCount) {
return `${resultCount} result${resultCount === 1 ? ' is' : 's are'} available, use up and down arrow keys to navigate. Press Enter key to select.`;
}
return '';
}
/**
* Takes an argument and if it's an array, returns the first item in the array
* otherwise returns the argument
* @param {*} arg the maybe-array
* @param {*} defaultValue the value if arg is falsey not defined
* @return {*} the arg or it's first item
*/
function unwrapArray(arg, defaultValue) {
arg = Array.isArray(arg) ?
/* istanbul ignore next (preact) */
arg[0] : arg;
if (!arg && defaultValue) {
return defaultValue;
} else {
return arg;
}
}
/**
* @param {Object} element (P)react element
* @return {Boolean} whether it's a DOM element
*/
function isDOMElement(element) {
return typeof element.type === 'string';
}
/**
* @param {Object} element (P)react element
* @return {Object} the props
*/
function getElementProps(element) {
return element.props;
}
/**
* Throws a helpful error message for required properties. Useful
* to be used as a default in destructuring or object params.
* @param {String} fnName the function name
* @param {String} propName the prop name
*/
function requiredProp(fnName, propName) {
// eslint-disable-next-line no-console
console.error(`The property "${propName}" is required in "${fnName}"`);
}
const stateKeys = (/* unused pure expression or super */ null && (['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type']));
/**
* @param {Object} state the state object
* @return {Object} state that is relevant to downshift
*/
function pickState(state) {
if (state === void 0) {
state = {};
}
const result = {};
stateKeys.forEach(k => {
if (state.hasOwnProperty(k)) {
result[k] = state[k];
}
});
return result;
}
/**
* This will perform a shallow merge of the given state object
* with the state coming from props
* (for the controlled component scenario)
* This is used in state updater functions so they're referencing
* the right state regardless of where it comes from.
*
* @param {Object} state The state of the component/hook.
* @param {Object} props The props that may contain controlled values.
* @returns {Object} The merged controlled state.
*/
function getState(state, props) {
return Object.keys(state).reduce((prevState, key) => {
prevState[key] = isControlledProp(props, key) ? props[key] : state[key];
return prevState;
}, {});
}
/**
* This determines whether a prop is a "controlled prop" meaning it is
* state which is controlled by the outside of this component rather
* than within this component.
*
* @param {Object} props The props that may contain controlled values.
* @param {String} key the key to check
* @return {Boolean} whether it is a controlled controlled prop
*/
function isControlledProp(props, key) {
return props[key] !== undefined;
}
/**
* Normalizes the 'key' property of a KeyboardEvent in IE/Edge
* @param {Object} event a keyboardEvent object
* @return {String} keyboard key
*/
function normalizeArrowKey(event) {
const {
key,
keyCode
} = event;
/* istanbul ignore next (ie) */
if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {
return `Arrow${key}`;
}
return key;
}
/**
* Simple check if the value passed is object literal
* @param {*} obj any things
* @return {Boolean} whether it's object literal
*/
function downshift_esm_isPlainObject(obj) {
return Object.prototype.toString.call(obj) === '[object Object]';
}
/**
* Returns the new index in the list, in a circular way. If next value is out of bonds from the total,
* it will wrap to either 0 or itemCount - 1.
*
* @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.
* @param {number} baseIndex The initial position to move from.
* @param {number} itemCount The total number of items.
* @param {Function} getItemNodeFromIndex Used to check if item is disabled.
* @param {boolean} circular Specify if navigation is circular. Default is true.
* @returns {number} The new index after the move.
*/
function getNextWrappingIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {
if (circular === void 0) {
circular = true;
}
if (itemCount === 0) {
return -1;
}
const itemsLastIndex = itemCount - 1;
if (typeof baseIndex !== 'number' || baseIndex < 0 || baseIndex >= itemCount) {
baseIndex = moveAmount > 0 ? -1 : itemsLastIndex + 1;
}
let newIndex = baseIndex + moveAmount;
if (newIndex < 0) {
newIndex = circular ? itemsLastIndex : 0;
} else if (newIndex > itemsLastIndex) {
newIndex = circular ? 0 : itemsLastIndex;
}
const nonDisabledNewIndex = getNextNonDisabledIndex(moveAmount, newIndex, itemCount, getItemNodeFromIndex, circular);
if (nonDisabledNewIndex === -1) {
return baseIndex >= itemCount ? -1 : baseIndex;
}
return nonDisabledNewIndex;
}
/**
* Returns the next index in the list of an item that is not disabled.
*
* @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.
* @param {number} baseIndex The initial position to move from.
* @param {number} itemCount The total number of items.
* @param {Function} getItemNodeFromIndex Used to check if item is disabled.
* @param {boolean} circular Specify if navigation is circular. Default is true.
* @returns {number} The new index. Returns baseIndex if item is not disabled. Returns next non-disabled item otherwise. If no non-disabled found it will return -1.
*/
function getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {
const currentElementNode = getItemNodeFromIndex(baseIndex);
if (!currentElementNode || !currentElementNode.hasAttribute('disabled')) {
return baseIndex;
}
if (moveAmount > 0) {
for (let index = baseIndex + 1; index < itemCount; index++) {
if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {
return index;
}
}
} else {
for (let index = baseIndex - 1; index >= 0; index--) {
if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {
return index;
}
}
}
if (circular) {
return moveAmount > 0 ? getNextNonDisabledIndex(1, 0, itemCount, getItemNodeFromIndex, false) : getNextNonDisabledIndex(-1, itemCount - 1, itemCount, getItemNodeFromIndex, false);
}
return -1;
}
/**
* Checks if event target is within the downshift elements.
*
* @param {EventTarget} target Target to check.
* @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
* @param {Window} environment The window context where downshift renders.
* @param {boolean} checkActiveElement Whether to also check activeElement.
*
* @returns {boolean} Whether or not the target is within downshift elements.
*/
function targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) {
if (checkActiveElement === void 0) {
checkActiveElement = true;
}
return downshiftElements.some(contextNode => contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment)));
} // eslint-disable-next-line import/no-mutable-exports
let validateControlledUnchanged = (/* unused pure expression or super */ null && (downshift_esm_noop));
/* istanbul ignore next */
if (false) {}
const cleanupStatus = debounce(documentProp => {
getStatusDiv(documentProp).textContent = '';
}, 500);
/**
* @param {String} status the status message
* @param {Object} documentProp document passed by the user.
*/
function setStatus(status, documentProp) {
const div = getStatusDiv(documentProp);
if (!status) {
return;
}
div.textContent = status;
cleanupStatus(documentProp);
}
/**
* Get the status node or create it if it does not already exist.
* @param {Object} documentProp document passed by the user.
* @return {HTMLElement} the status node.
*/
function getStatusDiv(documentProp) {
if (documentProp === void 0) {
documentProp = document;
}
let statusDiv = documentProp.getElementById('a11y-status-message');
if (statusDiv) {
return statusDiv;
}
statusDiv = documentProp.createElement('div');
statusDiv.setAttribute('id', 'a11y-status-message');
statusDiv.setAttribute('role', 'status');
statusDiv.setAttribute('aria-live', 'polite');
statusDiv.setAttribute('aria-relevant', 'additions text');
Object.assign(statusDiv.style, {
border: '0',
clip: 'rect(0 0 0 0)',
height: '1px',
margin: '-1px',
overflow: 'hidden',
padding: '0',
position: 'absolute',
width: '1px'
});
documentProp.body.appendChild(statusDiv);
return statusDiv;
}
const unknown = false ? 0 : 0;
const mouseUp = false ? 0 : 1;
const itemMouseEnter = false ? 0 : 2;
const keyDownArrowUp = false ? 0 : 3;
const keyDownArrowDown = false ? 0 : 4;
const keyDownEscape = false ? 0 : 5;
const keyDownEnter = false ? 0 : 6;
const keyDownHome = false ? 0 : 7;
const keyDownEnd = false ? 0 : 8;
const clickItem = false ? 0 : 9;
const blurInput = false ? 0 : 10;
const changeInput = false ? 0 : 11;
const keyDownSpaceButton = false ? 0 : 12;
const clickButton = false ? 0 : 13;
const blurButton = false ? 0 : 14;
const controlledPropUpdatedSelectedItem = false ? 0 : 15;
const touchEnd = false ? 0 : 16;
var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
__proto__: null,
unknown: unknown,
mouseUp: mouseUp,
itemMouseEnter: itemMouseEnter,
keyDownArrowUp: keyDownArrowUp,
keyDownArrowDown: keyDownArrowDown,
keyDownEscape: keyDownEscape,
keyDownEnter: keyDownEnter,
keyDownHome: keyDownHome,
keyDownEnd: keyDownEnd,
clickItem: clickItem,
blurInput: blurInput,
changeInput: changeInput,
keyDownSpaceButton: keyDownSpaceButton,
clickButton: clickButton,
blurButton: blurButton,
controlledPropUpdatedSelectedItem: controlledPropUpdatedSelectedItem,
touchEnd: touchEnd
});
/* eslint camelcase:0 */
const Downshift = /*#__PURE__*/(/* unused pure expression or super */ null && ((() => {
class Downshift extends Component {
constructor(_props) {
var _this;
super(_props);
_this = this;
this.id = this.props.id || `downshift-${generateId()}`;
this.menuId = this.props.menuId || `${this.id}-menu`;
this.labelId = this.props.labelId || `${this.id}-label`;
this.inputId = this.props.inputId || `${this.id}-input`;
this.getItemId = this.props.getItemId || (index => `${this.id}-item-${index}`);
this.input = null;
this.items = [];
this.itemCount = null;
this.previousResultCount = 0;
this.timeoutIds = [];
this.internalSetTimeout = (fn, time) => {
const id = setTimeout(() => {
this.timeoutIds = this.timeoutIds.filter(i => i !== id);
fn();
}, time);
this.timeoutIds.push(id);
};
this.setItemCount = count => {
this.itemCount = count;
};
this.unsetItemCount = () => {
this.itemCount = null;
};
this.setHighlightedIndex = function (highlightedIndex, otherStateToSet) {
if (highlightedIndex === void 0) {
highlightedIndex = _this.props.defaultHighlightedIndex;
}
if (otherStateToSet === void 0) {
otherStateToSet = {};
}
otherStateToSet = pickState(otherStateToSet);
_this.internalSetState({
highlightedIndex,
...otherStateToSet
});
};
this.clearSelection = cb => {
this.internalSetState({
selectedItem: null,
inputValue: '',
highlightedIndex: this.props.defaultHighlightedIndex,
isOpen: this.props.defaultIsOpen
}, cb);
};
this.selectItem = (item, otherStateToSet, cb) => {
otherStateToSet = pickState(otherStateToSet);
this.internalSetState({
isOpen: this.props.defaultIsOpen,
highlightedIndex: this.props.defaultHighlightedIndex,
selectedItem: item,
inputValue: this.props.itemToString(item),
...otherStateToSet
}, cb);
};
this.selectItemAtIndex = (itemIndex, otherStateToSet, cb) => {
const item = this.items[itemIndex];
if (item == null) {
return;
}
this.selectItem(item, otherStateToSet, cb);
};
this.selectHighlightedItem = (otherStateToSet, cb) => {
return this.selectItemAtIndex(this.getState().highlightedIndex, otherStateToSet, cb);
};
this.internalSetState = (stateToSet, cb) => {
let isItemSelected, onChangeArg;
const onStateChangeArg = {};
const isStateToSetFunction = typeof stateToSet === 'function'; // we want to call `onInputValueChange` before the `setState` call
// so someone controlling the `inputValue` state gets notified of
// the input change as soon as possible. This avoids issues with
// preserving the cursor position.
// See https://github.com/downshift-js/downshift/issues/217 for more info.
if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {
this.props.onInputValueChange(stateToSet.inputValue, { ...this.getStateAndHelpers(),
...stateToSet
});
}
return this.setState(state => {
state = this.getState(state);
let newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet; // Your own function that could modify the state that will be set.
newStateToSet = this.props.stateReducer(state, newStateToSet); // checks if an item is selected, regardless of if it's different from
// what was selected before
// used to determine if onSelect and onChange callbacks should be called
isItemSelected = newStateToSet.hasOwnProperty('selectedItem'); // this keeps track of the object we want to call with setState
const nextState = {}; // this is just used to tell whether the state changed
// and we're trying to update that state. OR if the selection has changed and we're
// trying to update the selection
if (isItemSelected && newStateToSet.selectedItem !== state.selectedItem) {
onChangeArg = newStateToSet.selectedItem;
}
newStateToSet.type = newStateToSet.type || unknown;
Object.keys(newStateToSet).forEach(key => {
// onStateChangeArg should only have the state that is
// actually changing
if (state[key] !== newStateToSet[key]) {
onStateChangeArg[key] = newStateToSet[key];
} // the type is useful for the onStateChangeArg
// but we don't actually want to set it in internal state.
// this is an undocumented feature for now... Not all internalSetState
// calls support it and I'm not certain we want them to yet.
// But it enables users controlling the isOpen state to know when
// the isOpen state changes due to mouseup events which is quite handy.
if (key === 'type') {
return;
}
newStateToSet[key]; // if it's coming from props, then we don't care to set it internally
if (!isControlledProp(this.props, key)) {
nextState[key] = newStateToSet[key];
}
}); // if stateToSet is a function, then we weren't able to call onInputValueChange
// earlier, so we'll call it now that we know what the inputValue state will be.
if (isStateToSetFunction && newStateToSet.hasOwnProperty('inputValue')) {
this.props.onInputValueChange(newStateToSet.inputValue, { ...this.getStateAndHelpers(),
...newStateToSet
});
}
return nextState;
}, () => {
// call the provided callback if it's a function
cbToCb(cb)(); // only call the onStateChange and onChange callbacks if
// we have relevant information to pass them.
const hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1;
if (hasMoreStateThanType) {
this.props.onStateChange(onStateChangeArg, this.getStateAndHelpers());
}
if (isItemSelected) {
this.props.onSelect(stateToSet.selectedItem, this.getStateAndHelpers());
}
if (onChangeArg !== undefined) {
this.props.onChange(onChangeArg, this.getStateAndHelpers());
} // this is currently undocumented and therefore subject to change
// We'll try to not break it, but just be warned.
this.props.onUserAction(onStateChangeArg, this.getStateAndHelpers());
});
};
this.rootRef = node => this._rootNode = node;
this.getRootProps = function (_temp, _temp2) {
let {
refKey = 'ref',
ref,
...rest
} = _temp === void 0 ? {} : _temp;
let {
suppressRefError = false
} = _temp2 === void 0 ? {} : _temp2;
// this is used in the render to know whether the user has called getRootProps.
// It uses that to know whether to apply the props automatically
_this.getRootProps.called = true;
_this.getRootProps.refKey = refKey;
_this.getRootProps.suppressRefError = suppressRefError;
const {
isOpen
} = _this.getState();
return {
[refKey]: handleRefs(ref, _this.rootRef),
role: 'combobox',
'aria-expanded': isOpen,
'aria-haspopup': 'listbox',
'aria-owns': isOpen ? _this.menuId : null,
'aria-labelledby': _this.labelId,
...rest
};
};
this.keyDownHandlers = {
ArrowDown(event) {
event.preventDefault();
if (this.getState().isOpen) {
const amount = event.shiftKey ? 5 : 1;
this.moveHighlightedIndex(amount, {
type: keyDownArrowDown
});
} else {
this.internalSetState({
isOpen: true,
type: keyDownArrowDown
}, () => {
const itemCount = this.getItemCount();
if (itemCount > 0) {
const {
highlightedIndex
} = this.getState();
const nextHighlightedIndex = getNextWrappingIndex(1, highlightedIndex, itemCount, index => this.getItemNodeFromIndex(index));
this.setHighlightedIndex(nextHighlightedIndex, {
type: keyDownArrowDown
});
}
});
}
},
ArrowUp(event) {
event.preventDefault();
if (this.getState().isOpen) {
const amount = event.shiftKey ? -5 : -1;
this.moveHighlightedIndex(amount, {
type: keyDownArrowUp
});
} else {
this.internalSetState({
isOpen: true,
type: keyDownArrowUp
}, () => {
const itemCount = this.getItemCount();
if (itemCount > 0) {
const {
highlightedIndex
} = this.getState();
const nextHighlightedIndex = getNextWrappingIndex(-1, highlightedIndex, itemCount, index => this.getItemNodeFromIndex(index));
this.setHighlightedIndex(nextHighlightedIndex, {
type: keyDownArrowUp
});
}
});
}
},
Enter(event) {
if (event.which === 229) {
return;
}
const {
isOpen,
highlightedIndex
} = this.getState();
if (isOpen && highlightedIndex != null) {
event.preventDefault();
const item = this.items[highlightedIndex];
const itemNode = this.getItemNodeFromIndex(highlightedIndex);
if (item == null || itemNode && itemNode.hasAttribute('disabled')) {
return;
}
this.selectHighlightedItem({
type: keyDownEnter
});
}
},
Escape(event) {
event.preventDefault();
this.reset({
type: keyDownEscape,
...(!this.state.isOpen && {
selectedItem: null,
inputValue: ''
})
});
}
};
this.buttonKeyDownHandlers = { ...this.keyDownHandlers,
' '(event) {
event.preventDefault();
this.toggleMenu({
type: keyDownSpaceButton
});
}
};
this.inputKeyDownHandlers = { ...this.keyDownHandlers,
Home(event) {
const {
isOpen
} = this.getState();
if (!isOpen) {
return;
}
event.preventDefault();
const itemCount = this.getItemCount();
if (itemCount <= 0 || !isOpen) {
return;
} // get next non-disabled starting downwards from 0 if that's disabled.
const newHighlightedIndex = getNextNonDisabledIndex(1, 0, itemCount, index => this.getItemNodeFromIndex(index), false);
this.setHighlightedIndex(newHighlightedIndex, {
type: keyDownHome
});
},
End(event) {
const {
isOpen
} = this.getState();
if (!isOpen) {
return;
}
event.preventDefault();
const itemCount = this.getItemCount();
if (itemCount <= 0 || !isOpen) {
return;
} // get next non-disabled starting upwards from last index if that's disabled.
const newHighlightedIndex = getNextNonDisabledIndex(-1, itemCount - 1, itemCount, index => this.getItemNodeFromIndex(index), false);
this.setHighlightedIndex(newHighlightedIndex, {
type: keyDownEnd
});
}
};
this.getToggleButtonProps = function (_temp3) {
let {
onClick,
onPress,
onKeyDown,
onKeyUp,
onBlur,
...rest
} = _temp3 === void 0 ? {} : _temp3;
const {
isOpen
} = _this.getState();
const enabledEventHandlers = {
onClick: callAllEventHandlers(onClick, _this.buttonHandleClick),
onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown),
onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp),
onBlur: callAllEventHandlers(onBlur, _this.buttonHandleBlur)
};
const eventHandlers = rest.disabled ? {} : enabledEventHandlers;
return {
type: 'button',
role: 'button',
'aria-label': isOpen ? 'close menu' : 'open menu',
'aria-haspopup': true,
'data-toggle': true,
...eventHandlers,
...rest
};
};
this.buttonHandleKeyUp = event => {
// Prevent click event from emitting in Firefox
event.preventDefault();
};
this.buttonHandleKeyDown = event => {
const key = normalizeArrowKey(event);
if (this.buttonKeyDownHandlers[key]) {
this.buttonKeyDownHandlers[key].call(this, event);
}
};
this.buttonHandleClick = event => {
event.preventDefault(); // handle odd case for Safari and Firefox which
// don't give the button the focus properly.
/* istanbul ignore if (can't reasonably test this) */
if (this.props.environment.document.activeElement === this.props.environment.document.body) {
event.target.focus();
} // to simplify testing components that use downshift, we'll not wrap this in a setTimeout
// if the NODE_ENV is test. With the proper build system, this should be dead code eliminated
// when building for production and should therefore have no impact on production code.
if (false) {} else {
// Ensure that toggle of menu occurs after the potential blur event in iOS
this.internalSetTimeout(() => this.toggleMenu({
type: clickButton
}));
}
};
this.buttonHandleBlur = event => {
const blurTarget = event.target; // Save blur target for comparison with activeElement later
// Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element
this.internalSetTimeout(() => {
if (!this.isMouseDown && (this.props.environment.document.activeElement == null || this.props.environment.document.activeElement.id !== this.inputId) && this.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)
) {
this.reset({
type: blurButton
});
}
});
};
this.getLabelProps = props => {
return {
htmlFor: this.inputId,
id: this.labelId,
...props
};
};
this.getInputProps = function (_temp4) {
let {
onKeyDown,
onBlur,
onChange,
onInput,
onChangeText,
...rest
} = _temp4 === void 0 ? {} : _temp4;
let onChangeKey;
let eventHandlers = {};
/* istanbul ignore next (preact) */
{
onChangeKey = 'onChange';
}
const {
inputValue,
isOpen,
highlightedIndex
} = _this.getState();
if (!rest.disabled) {
eventHandlers = {
[onChangeKey]: callAllEventHandlers(onChange, onInput, _this.inputHandleChange),
onKeyDown: callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown),
onBlur: callAllEventHandlers(onBlur, _this.inputHandleBlur)
};
}
return {
'aria-autocomplete': 'list',
'aria-activedescendant': isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : null,
'aria-controls': isOpen ? _this.menuId : null,
'aria-labelledby': _this.labelId,
// https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
// revert back since autocomplete="nope" is ignored on latest Chrome and Opera
autoComplete: 'off',
value: inputValue,
id: _this.inputId,
...eventHandlers,
...rest
};
};
this.inputHandleKeyDown = event => {
const key = normalizeArrowKey(event);
if (key && this.inputKeyDownHandlers[key]) {
this.inputKeyDownHandlers[key].call(this, event);
}
};
this.inputHandleChange = event => {
this.internalSetState({
type: changeInput,
isOpen: true,
inputValue: event.target.value,
highlightedIndex: this.props.defaultHighlightedIndex
});
};
this.inputHandleBlur = () => {
// Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element
this.internalSetTimeout(() => {
const downshiftButtonIsActive = this.props.environment.document && !!this.props.environment.document.activeElement && !!this.props.environment.document.activeElement.dataset && this.props.environment.document.activeElement.dataset.toggle && this._rootNode && this._rootNode.contains(this.props.environment.document.activeElement);
if (!this.isMouseDown && !downshiftButtonIsActive) {
this.reset({
type: blurInput
});
}
});
};
this.menuRef = node => {
this._menuNode = node;
};
this.getMenuProps = function (_temp5, _temp6) {
let {
refKey = 'ref',
ref,
...props
} = _temp5 === void 0 ? {} : _temp5;
let {
suppressRefError = false
} = _temp6 === void 0 ? {} : _temp6;
_this.getMenuProps.called = true;
_this.getMenuProps.refKey = refKey;
_this.getMenuProps.suppressRefError = suppressRefError;
return {
[refKey]: handleRefs(ref, _this.menuRef),
role: 'listbox',
'aria-labelledby': props && props['aria-label'] ? null : _this.labelId,
id: _this.menuId,
...props
};
};
this.getItemProps = function (_temp7) {
let {
onMouseMove,
onMouseDown,
onClick,
onPress,
index,
item = true ?
/* istanbul ignore next */
undefined : 0,
...rest
} = _temp7 === void 0 ? {} : _temp7;
if (index === undefined) {
_this.items.push(item);
index = _this.items.indexOf(item);
} else {
_this.items[index] = item;
}
const onSelectKey = 'onClick';
const customClickHandler = onClick;
const enabledEventHandlers = {
// onMouseMove is used over onMouseEnter here. onMouseMove
// is only triggered on actual mouse movement while onMouseEnter
// can fire on DOM changes, interrupting keyboard navigation
onMouseMove: callAllEventHandlers(onMouseMove, () => {
if (index === _this.getState().highlightedIndex) {
return;
}
_this.setHighlightedIndex(index, {
type: itemMouseEnter
}); // We never want to manually scroll when changing state based
// on `onMouseMove` because we will be moving the element out
// from under the user which is currently scrolling/moving the
// cursor
_this.avoidScrolling = true;
_this.internalSetTimeout(() => _this.avoidScrolling = false, 250);
}),
onMouseDown: callAllEventHandlers(onMouseDown, event => {
// This prevents the activeElement from being changed
// to the item so it can remain with the current activeElement
// which is a more common use case.
event.preventDefault();
}),
[onSelectKey]: callAllEventHandlers(customClickHandler, () => {
_this.selectItemAtIndex(index, {
type: clickItem
});
})
}; // Passing down the onMouseDown handler to prevent redirect
// of the activeElement if clicking on disabled items
const eventHandlers = rest.disabled ? {
onMouseDown: enabledEventHandlers.onMouseDown
} : enabledEventHandlers;
return {
id: _this.getItemId(index),
role: 'option',
'aria-selected': _this.getState().highlightedIndex === index,
...eventHandlers,
...rest
};
};
this.clearItems = () => {
this.items = [];
};
this.reset = function (otherStateToSet, cb) {
if (otherStateToSet === void 0) {
otherStateToSet = {};
}
otherStateToSet = pickState(otherStateToSet);
_this.internalSetState(_ref => {
let {
selectedItem
} = _ref;
return {
isOpen: _this.props.defaultIsOpen,
highlightedIndex: _this.props.defaultHighlightedIndex,
inputValue: _this.props.itemToString(selectedItem),
...otherStateToSet
};
}, cb);
};
this.toggleMenu = function (otherStateToSet, cb) {
if (otherStateToSet === void 0) {
otherStateToSet = {};
}
otherStateToSet = pickState(otherStateToSet);
_this.internalSetState(_ref2 => {
let {
isOpen
} = _ref2;
return {
isOpen: !isOpen,
...(isOpen && {
highlightedIndex: _this.props.defaultHighlightedIndex
}),
...otherStateToSet
};
}, () => {
const {
isOpen,
highlightedIndex
} = _this.getState();
if (isOpen) {
if (_this.getItemCount() > 0 && typeof highlightedIndex === 'number') {
_this.setHighlightedIndex(highlightedIndex, otherStateToSet);
}
}
cbToCb(cb)();
});
};
this.openMenu = cb => {
this.internalSetState({
isOpen: true
}, cb);
};
this.closeMenu = cb => {
this.internalSetState({
isOpen: false
}, cb);
};
this.updateStatus = debounce(() => {
const state = this.getState();
const item = this.items[state.highlightedIndex];
const resultCount = this.getItemCount();
const status = this.props.getA11yStatusMessage({
itemToString: this.props.itemToString,
previousResultCount: this.previousResultCount,
resultCount,
highlightedItem: item,
...state
});
this.previousResultCount = resultCount;
setStatus(status, this.props.environment.document);
}, 200);
// fancy destructuring + defaults + aliases
// this basically says each value of state should either be set to
// the initial value or the default value if the initial value is not provided
const {
defaultHighlightedIndex,
initialHighlightedIndex: _highlightedIndex = defaultHighlightedIndex,
defaultIsOpen,
initialIsOpen: _isOpen = defaultIsOpen,
initialInputValue: _inputValue = '',
initialSelectedItem: _selectedItem = null
} = this.props;
const _state = this.getState({
highlightedIndex: _highlightedIndex,
isOpen: _isOpen,
inputValue: _inputValue,
selectedItem: _selectedItem
});
if (_state.selectedItem != null && this.props.initialInputValue === undefined) {
_state.inputValue = this.props.itemToString(_state.selectedItem);
}
this.state = _state;
}
/**
* Clear all running timeouts
*/
internalClearTimeouts() {
this.timeoutIds.forEach(id => {
clearTimeout(id);
});
this.timeoutIds = [];
}
/**
* Gets the state based on internal state or props
* If a state value is passed via props, then that
* is the value given, otherwise it's retrieved from
* stateToMerge
*
* @param {Object} stateToMerge defaults to this.state
* @return {Object} the state
*/
getState(stateToMerge) {
if (stateToMerge === void 0) {
stateToMerge = this.state;
}
return getState(stateToMerge, this.props);
}
getItemCount() {
// things read better this way. They're in priority order:
// 1. `this.itemCount`
// 2. `this.props.itemCount`
// 3. `this.items.length`
let itemCount = this.items.length;
if (this.itemCount != null) {
itemCount = this.itemCount;
} else if (this.props.itemCount !== undefined) {
itemCount = this.props.itemCount;
}
return itemCount;
}
getItemNodeFromIndex(index) {
return this.props.environment.document.getElementById(this.getItemId(index));
}
scrollHighlightedItemIntoView() {
/* istanbul ignore else (react-native) */
{
const node = this.getItemNodeFromIndex(this.getState().highlightedIndex);
this.props.scrollIntoView(node, this._menuNode);
}
}
moveHighlightedIndex(amount, otherStateToSet) {
const itemCount = this.getItemCount();
const {
highlightedIndex
} = this.getState();
if (itemCount > 0) {
const nextHighlightedIndex = getNextWrappingIndex(amount, highlightedIndex, itemCount, index => this.getItemNodeFromIndex(index));
this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet);
}
}
getStateAndHelpers() {
const {
highlightedIndex,
inputValue,
selectedItem,
isOpen
} = this.getState();
const {
itemToString
} = this.props;
const {
id
} = this;
const {
getRootProps,
getToggleButtonProps,
getLabelProps,
getMenuProps,
getInputProps,
getItemProps,
openMenu,
closeMenu,
toggleMenu,
selectItem,
selectItemAtIndex,
selectHighlightedItem,
setHighlightedIndex,
clearSelection,
clearItems,
reset,
setItemCount,
unsetItemCount,
internalSetState: setState
} = this;
return {
// prop getters
getRootProps,
getToggleButtonProps,
getLabelProps,
getMenuProps,
getInputProps,
getItemProps,
// actions
reset,
openMenu,
closeMenu,
toggleMenu,
selectItem,
selectItemAtIndex,
selectHighlightedItem,
setHighlightedIndex,
clearSelection,
clearItems,
setItemCount,
unsetItemCount,
setState,
// props
itemToString,
// derived
id,
// state
highlightedIndex,
inputValue,
isOpen,
selectedItem
};
} //////////////////////////// ROOT
componentDidMount() {
/* istanbul ignore if (react-native) */
if (false) {}
/* istanbul ignore if (react-native) */
{
// this.isMouseDown helps us track whether the mouse is currently held down.
// This is useful when the user clicks on an item in the list, but holds the mouse
// down long enough for the list to disappear (because the blur event fires on the input)
// this.isMouseDown is used in the blur handler on the input to determine whether the blur event should
// trigger hiding the menu.
const onMouseDown = () => {
this.isMouseDown = true;
};
const onMouseUp = event => {
this.isMouseDown = false; // if the target element or the activeElement is within a downshift node
// then we don't want to reset downshift
const contextWithinDownshift = targetWithinDownshift(event.target, [this._rootNode, this._menuNode], this.props.environment);
if (!contextWithinDownshift && this.getState().isOpen) {
this.reset({
type: mouseUp
}, () => this.props.onOuterClick(this.getStateAndHelpers()));
}
}; // Touching an element in iOS gives focus and hover states, but touching out of
// the element will remove hover, and persist the focus state, resulting in the
// blur event not being triggered.
// this.isTouchMove helps us track whether the user is tapping or swiping on a touch screen.
// If the user taps outside of Downshift, the component should be reset,
// but not if the user is swiping
const onTouchStart = () => {
this.isTouchMove = false;
};
const onTouchMove = () => {
this.isTouchMove = true;
};
const onTouchEnd = event => {
const contextWithinDownshift = targetWithinDownshift(event.target, [this._rootNode, this._menuNode], this.props.environment, false);
if (!this.isTouchMove && !contextWithinDownshift && this.getState().isOpen) {
this.reset({
type: touchEnd
}, () => this.props.onOuterClick(this.getStateAndHelpers()));
}
};
const {
environment
} = this.props;
environment.addEventListener('mousedown', onMouseDown);
environment.addEventListener('mouseup', onMouseUp);
environment.addEventListener('touchstart', onTouchStart);
environment.addEventListener('touchmove', onTouchMove);
environment.addEventListener('touchend', onTouchEnd);
this.cleanup = () => {
this.internalClearTimeouts();
this.updateStatus.cancel();
environment.removeEventListener('mousedown', onMouseDown);
environment.removeEventListener('mouseup', onMouseUp);
environment.removeEventListener('touchstart', onTouchStart);
environment.removeEventListener('touchmove', onTouchMove);
environment.removeEventListener('touchend', onTouchEnd);
};
}
}
shouldScroll(prevState, prevProps) {
const {
highlightedIndex: currentHighlightedIndex
} = this.props.highlightedIndex === undefined ? this.getState() : this.props;
const {
highlightedIndex: prevHighlightedIndex
} = prevProps.highlightedIndex === undefined ? prevState : prevProps;
const scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen;
const scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex;
return scrollWhenOpen || scrollWhenNavigating;
}
componentDidUpdate(prevProps, prevState) {
if (false) {}
if (isControlledProp(this.props, 'selectedItem') && this.props.selectedItemChanged(prevProps.selectedItem, this.props.selectedItem)) {
this.internalSetState({
type: controlledPropUpdatedSelectedItem,
inputValue: this.props.itemToString(this.props.selectedItem)
});
}
if (!this.avoidScrolling && this.shouldScroll(prevState, prevProps)) {
this.scrollHighlightedItemIntoView();
}
/* istanbul ignore else (react-native) */
{
this.updateStatus();
}
}
componentWillUnmount() {
this.cleanup(); // avoids memory leak
}
render() {
const children = unwrapArray(this.props.children, downshift_esm_noop); // because the items are rerendered every time we call the children
// we clear this out each render and it will be populated again as
// getItemProps is called.
this.clearItems(); // we reset this so we know whether the user calls getRootProps during
// this render. If they do then we don't need to do anything,
// if they don't then we need to clone the element they return and
// apply the props for them.
this.getRootProps.called = false;
this.getRootProps.refKey = undefined;
this.getRootProps.suppressRefError = undefined; // we do something similar for getMenuProps
this.getMenuProps.called = false;
this.getMenuProps.refKey = undefined;
this.getMenuProps.suppressRefError = undefined; // we do something similar for getLabelProps
this.getLabelProps.called = false; // and something similar for getInputProps
this.getInputProps.called = false;
const element = unwrapArray(children(this.getStateAndHelpers()));
if (!element) {
return null;
}
if (this.getRootProps.called || this.props.suppressRefError) {
if (false) {}
return element;
} else if (isDOMElement(element)) {
// they didn't apply the root props, but we can clone
// this and apply the props ourselves
return /*#__PURE__*/cloneElement(element, this.getRootProps(getElementProps(element)));
}
/* istanbul ignore else */
if (false) {}
/* istanbul ignore next */
return undefined;
}
}
Downshift.defaultProps = {
defaultHighlightedIndex: null,
defaultIsOpen: false,
getA11yStatusMessage: getA11yStatusMessage$1,
itemToString: i => {
if (i == null) {
return '';
}
if (false) {}
return String(i);
},
onStateChange: downshift_esm_noop,
onInputValueChange: downshift_esm_noop,
onUserAction: downshift_esm_noop,
onChange: downshift_esm_noop,
onSelect: downshift_esm_noop,
onOuterClick: downshift_esm_noop,
selectedItemChanged: (prevItem, item) => prevItem !== item,
environment:
/* istanbul ignore next (ssr) */
typeof window === 'undefined' ? {} : window,
stateReducer: (state, stateToSet) => stateToSet,
suppressRefError: false,
scrollIntoView
};
Downshift.stateChangeTypes = stateChangeTypes$3;
return Downshift;
})()));
false ? 0 : void 0;
var Downshift$1 = (/* unused pure expression or super */ null && (Downshift));
function validateGetMenuPropsCalledCorrectly(node, _ref3) {
let {
refKey
} = _ref3;
if (!node) {
// eslint-disable-next-line no-console
console.error(`downshift: The ref prop "${refKey}" from getMenuProps was not applied correctly on your menu element.`);
}
}
function validateGetRootPropsCalledCorrectly(element, _ref4) {
let {
refKey
} = _ref4;
const refKeySpecified = refKey !== 'ref';
const isComposite = !isDOMElement(element);
if (isComposite && !refKeySpecified && !isForwardRef(element)) {
// eslint-disable-next-line no-console
console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
} else if (!isComposite && refKeySpecified) {
// eslint-disable-next-line no-console
console.error(`downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "${refKey}"`);
}
if (!isForwardRef(element) && !getElementProps(element)[refKey]) {
// eslint-disable-next-line no-console
console.error(`downshift: You must apply the ref prop "${refKey}" from getRootProps onto your root element.`);
}
}
const dropdownDefaultStateValues = {
highlightedIndex: -1,
isOpen: false,
selectedItem: null,
inputValue: ''
};
function callOnChangeProps(action, state, newState) {
const {
props,
type
} = action;
const changes = {};
Object.keys(state).forEach(key => {
invokeOnChangeHandler(key, action, state, newState);
if (newState[key] !== state[key]) {
changes[key] = newState[key];
}
});
if (props.onStateChange && Object.keys(changes).length) {
props.onStateChange({
type,
...changes
});
}
}
function invokeOnChangeHandler(key, action, state, newState) {
const {
props,
type
} = action;
const handler = `on${capitalizeString(key)}Change`;
if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) {
props[handler]({
type,
...newState
});
}
}
/**
* Default state reducer that returns the changes.
*
* @param {Object} s state.
* @param {Object} a action with changes.
* @returns {Object} changes.
*/
function stateReducer(s, a) {
return a.changes;
}
/**
* Returns a message to be added to aria-live region when item is selected.
*
* @param {Object} selectionParameters Parameters required to build the message.
* @returns {string} The a11y message.
*/
function getA11ySelectionMessage(selectionParameters) {
const {
selectedItem,
itemToString: itemToStringLocal
} = selectionParameters;
return selectedItem ? `${itemToStringLocal(selectedItem)} has been selected.` : '';
}
/**
* Debounced call for updating the a11y message.
*/
const updateA11yStatus = debounce((getA11yMessage, document) => {
setStatus(getA11yMessage(), document);
}, 200); // istanbul ignore next
const downshift_esm_useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? external_React_.useLayoutEffect : external_React_.useEffect;
function useElementIds(_ref) {
let {
id = `downshift-${generateId()}`,
labelId,
menuId,
getItemId,
toggleButtonId,
inputId
} = _ref;
const elementIdsRef = (0,external_React_.useRef)({
labelId: labelId || `${id}-label`,
menuId: menuId || `${id}-menu`,
getItemId: getItemId || (index => `${id}-item-${index}`),
toggleButtonId: toggleButtonId || `${id}-toggle-button`,
inputId: inputId || `${id}-input`
});
return elementIdsRef.current;
}
function getItemIndex(index, item, items) {
if (index !== undefined) {
return index;
}
if (items.length === 0) {
return -1;
}
return items.indexOf(item);
}
function itemToString(item) {
return item ? String(item) : '';
}
function isAcceptedCharacterKey(key) {
return /^\S{1}$/.test(key);
}
function capitalizeString(string) {
return `${string.slice(0, 1).toUpperCase()}${string.slice(1)}`;
}
function downshift_esm_useLatestRef(val) {
const ref = (0,external_React_.useRef)(val); // technically this is not "concurrent mode safe" because we're manipulating
// the value during render (so it's not idempotent). However, the places this
// hook is used is to support memoizing callbacks which will be called
// *during* render, so we need the latest values *during* render.
// If not for this, then we'd probably want to use useLayoutEffect instead.
ref.current = val;
return ref;
}
/**
* Computes the controlled state using a the previous state, props,
* two reducers, one from downshift and an optional one from the user.
* Also calls the onChange handlers for state values that have changed.
*
* @param {Function} reducer Reducer function from downshift.
* @param {Object} initialState Initial state of the hook.
* @param {Object} props The hook props.
* @returns {Array} An array with the state and an action dispatcher.
*/
function useEnhancedReducer(reducer, initialState, props) {
const prevStateRef = (0,external_React_.useRef)();
const actionRef = (0,external_React_.useRef)();
const enhancedReducer = (0,external_React_.useCallback)((state, action) => {
actionRef.current = action;
state = getState(state, action.props);
const changes = reducer(state, action);
const newState = action.props.stateReducer(state, { ...action,
changes
});
return newState;
}, [reducer]);
const [state, dispatch] = (0,external_React_.useReducer)(enhancedReducer, initialState);
const propsRef = downshift_esm_useLatestRef(props);
const dispatchWithProps = (0,external_React_.useCallback)(action => dispatch({
props: propsRef.current,
...action
}), [propsRef]);
const action = actionRef.current;
(0,external_React_.useEffect)(() => {
if (action && prevStateRef.current && prevStateRef.current !== state) {
callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
}
prevStateRef.current = state;
}, [state, props, action]);
return [state, dispatchWithProps];
}
/**
* Wraps the useEnhancedReducer and applies the controlled prop values before
* returning the new state.
*
* @param {Function} reducer Reducer function from downshift.
* @param {Object} initialState Initial state of the hook.
* @param {Object} props The hook props.
* @returns {Array} An array with the state and an action dispatcher.
*/
function useControlledReducer$1(reducer, initialState, props) {
const [state, dispatch] = useEnhancedReducer(reducer, initialState, props);
return [getState(state, props), dispatch];
}
const defaultProps$3 = {
itemToString,
stateReducer,
getA11ySelectionMessage,
scrollIntoView,
circularNavigation: false,
environment:
/* istanbul ignore next (ssr) */
typeof window === 'undefined' ? {} : window
};
function getDefaultValue$1(props, propKey, defaultStateValues) {
if (defaultStateValues === void 0) {
defaultStateValues = dropdownDefaultStateValues;
}
const defaultValue = props[`default${capitalizeString(propKey)}`];
if (defaultValue !== undefined) {
return defaultValue;
}
return defaultStateValues[propKey];
}
function getInitialValue$1(props, propKey, defaultStateValues) {
if (defaultStateValues === void 0) {
defaultStateValues = dropdownDefaultStateValues;
}
const value = props[propKey];
if (value !== undefined) {
return value;
}
const initialValue = props[`initial${capitalizeString(propKey)}`];
if (initialValue !== undefined) {
return initialValue;
}
return getDefaultValue$1(props, propKey, defaultStateValues);
}
function getInitialState$2(props) {
const selectedItem = getInitialValue$1(props, 'selectedItem');
const isOpen = getInitialValue$1(props, 'isOpen');
const highlightedIndex = getInitialValue$1(props, 'highlightedIndex');
const inputValue = getInitialValue$1(props, 'inputValue');
return {
highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.indexOf(selectedItem) : highlightedIndex,
isOpen,
selectedItem,
inputValue
};
}
function getHighlightedIndexOnOpen(props, state, offset, getItemNodeFromIndex) {
const {
items,
initialHighlightedIndex,
defaultHighlightedIndex
} = props;
const {
selectedItem,
highlightedIndex
} = state;
if (items.length === 0) {
return -1;
} // initialHighlightedIndex will give value to highlightedIndex on initial state only.
if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex) {
return initialHighlightedIndex;
}
if (defaultHighlightedIndex !== undefined) {
return defaultHighlightedIndex;
}
if (selectedItem) {
if (offset === 0) {
return items.indexOf(selectedItem);
}
return getNextWrappingIndex(offset, items.indexOf(selectedItem), items.length, getItemNodeFromIndex, false);
}
if (offset === 0) {
return -1;
}
return offset < 0 ? items.length - 1 : 0;
}
/**
* Reuse the movement tracking of mouse and touch events.
*
* @param {boolean} isOpen Whether the dropdown is open or not.
* @param {Array<Object>} downshiftElementRefs Downshift element refs to track movement (toggleButton, menu etc.)
* @param {Object} environment Environment where component/hook exists.
* @param {Function} handleBlur Handler on blur from mouse or touch.
* @returns {Object} Ref containing whether mouseDown or touchMove event is happening
*/
function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, handleBlur) {
const mouseAndTouchTrackersRef = (0,external_React_.useRef)({
isMouseDown: false,
isTouchMove: false
});
(0,external_React_.useEffect)(() => {
// The same strategy for checking if a click occurred inside or outside downsift
// as in downshift.js.
const onMouseDown = () => {
mouseAndTouchTrackersRef.current.isMouseDown = true;
};
const onMouseUp = event => {
mouseAndTouchTrackersRef.current.isMouseDown = false;
if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(ref => ref.current), environment)) {
handleBlur();
}
};
const onTouchStart = () => {
mouseAndTouchTrackersRef.current.isTouchMove = false;
};
const onTouchMove = () => {
mouseAndTouchTrackersRef.current.isTouchMove = true;
};
const onTouchEnd = event => {
if (isOpen && !mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElementRefs.map(ref => ref.current), environment, false)) {
handleBlur();
}
};
environment.addEventListener('mousedown', onMouseDown);
environment.addEventListener('mouseup', onMouseUp);
environment.addEventListener('touchstart', onTouchStart);
environment.addEventListener('touchmove', onTouchMove);
environment.addEventListener('touchend', onTouchEnd);
return function cleanup() {
environment.removeEventListener('mousedown', onMouseDown);
environment.removeEventListener('mouseup', onMouseUp);
environment.removeEventListener('touchstart', onTouchStart);
environment.removeEventListener('touchmove', onTouchMove);
environment.removeEventListener('touchend', onTouchEnd);
}; // eslint-disable-next-line react-hooks/exhaustive-deps
}, [isOpen, environment]);
return mouseAndTouchTrackersRef;
}
/* istanbul ignore next */
// eslint-disable-next-line import/no-mutable-exports
let useGetterPropsCalledChecker = () => downshift_esm_noop;
/**
* Custom hook that checks if getter props are called correctly.
*
* @param {...any} propKeys Getter prop names to be handled.
* @returns {Function} Setter function called inside getter props to set call information.
*/
/* istanbul ignore next */
if (false) {}
function useA11yMessageSetter(getA11yMessage, dependencyArray, _ref2) {
let {
isInitialMount,
highlightedIndex,
items,
environment,
...rest
} = _ref2;
// Sets a11y status message on changes in state.
(0,external_React_.useEffect)(() => {
if (isInitialMount || false) {
return;
}
updateA11yStatus(() => getA11yMessage({
highlightedIndex,
highlightedItem: items[highlightedIndex],
resultCount: items.length,
...rest
}), environment.document); // eslint-disable-next-line react-hooks/exhaustive-deps
}, dependencyArray);
}
function useScrollIntoView(_ref3) {
let {
highlightedIndex,
isOpen,
itemRefs,
getItemNodeFromIndex,
menuElement,
scrollIntoView: scrollIntoViewProp
} = _ref3;
// used not to scroll on highlight by mouse.
const shouldScrollRef = (0,external_React_.useRef)(true); // Scroll on highlighted item if change comes from keyboard.
downshift_esm_useIsomorphicLayoutEffect(() => {
if (highlightedIndex < 0 || !isOpen || !Object.keys(itemRefs.current).length) {
return;
}
if (shouldScrollRef.current === false) {
shouldScrollRef.current = true;
} else {
scrollIntoViewProp(getItemNodeFromIndex(highlightedIndex), menuElement);
} // eslint-disable-next-line react-hooks/exhaustive-deps
}, [highlightedIndex]);
return shouldScrollRef;
} // eslint-disable-next-line import/no-mutable-exports
let useControlPropsValidator = downshift_esm_noop;
/* istanbul ignore next */
if (false) {}
/* eslint-disable complexity */
function downshiftCommonReducer(state, action, stateChangeTypes) {
const {
type,
props
} = action;
let changes;
switch (type) {
case stateChangeTypes.ItemMouseMove:
changes = {
highlightedIndex: action.disabled ? -1 : action.index
};
break;
case stateChangeTypes.MenuMouseLeave:
changes = {
highlightedIndex: -1
};
break;
case stateChangeTypes.ToggleButtonClick:
case stateChangeTypes.FunctionToggleMenu:
changes = {
isOpen: !state.isOpen,
highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props, state, 0)
};
break;
case stateChangeTypes.FunctionOpenMenu:
changes = {
isOpen: true,
highlightedIndex: getHighlightedIndexOnOpen(props, state, 0)
};
break;
case stateChangeTypes.FunctionCloseMenu:
changes = {
isOpen: false
};
break;
case stateChangeTypes.FunctionSetHighlightedIndex:
changes = {
highlightedIndex: action.highlightedIndex
};
break;
case stateChangeTypes.FunctionSetInputValue:
changes = {
inputValue: action.inputValue
};
break;
case stateChangeTypes.FunctionReset:
changes = {
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
isOpen: getDefaultValue$1(props, 'isOpen'),
selectedItem: getDefaultValue$1(props, 'selectedItem'),
inputValue: getDefaultValue$1(props, 'inputValue')
};
break;
default:
throw new Error('Reducer called without proper action type.');
}
return { ...state,
...changes
};
}
/* eslint-enable complexity */
function getItemIndexByCharacterKey(_a) {
var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, getItemNodeFromIndex = _a.getItemNodeFromIndex;
var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
for (var index = 0; index < items.length; index++) {
var offsetIndex = (index + highlightedIndex + 1) % items.length;
var item = items[offsetIndex];
if (item !== undefined &&
itemToString(item)
.toLowerCase()
.startsWith(lowerCasedKeysSoFar)) {
var element = getItemNodeFromIndex(offsetIndex);
if (!(element === null || element === void 0 ? void 0 : element.hasAttribute('disabled'))) {
return offsetIndex;
}
}
}
return highlightedIndex;
}
var propTypes$2 = {
items: (prop_types_default()).array.isRequired,
itemToString: (prop_types_default()).func,
getA11yStatusMessage: (prop_types_default()).func,
getA11ySelectionMessage: (prop_types_default()).func,
circularNavigation: (prop_types_default()).bool,
highlightedIndex: (prop_types_default()).number,
defaultHighlightedIndex: (prop_types_default()).number,
initialHighlightedIndex: (prop_types_default()).number,
isOpen: (prop_types_default()).bool,
defaultIsOpen: (prop_types_default()).bool,
initialIsOpen: (prop_types_default()).bool,
selectedItem: (prop_types_default()).any,
initialSelectedItem: (prop_types_default()).any,
defaultSelectedItem: (prop_types_default()).any,
id: (prop_types_default()).string,
labelId: (prop_types_default()).string,
menuId: (prop_types_default()).string,
getItemId: (prop_types_default()).func,
toggleButtonId: (prop_types_default()).string,
stateReducer: (prop_types_default()).func,
onSelectedItemChange: (prop_types_default()).func,
onHighlightedIndexChange: (prop_types_default()).func,
onStateChange: (prop_types_default()).func,
onIsOpenChange: (prop_types_default()).func,
environment: prop_types_default().shape({
addEventListener: (prop_types_default()).func,
removeEventListener: (prop_types_default()).func,
document: prop_types_default().shape({
getElementById: (prop_types_default()).func,
activeElement: (prop_types_default()).any,
body: (prop_types_default()).any
})
})
};
/**
* Default implementation for status message. Only added when menu is open.
* Will specift if there are results in the list, and if so, how many,
* and what keys are relevant.
*
* @param {Object} param the downshift state and other relevant properties
* @return {String} the a11y status message
*/
function getA11yStatusMessage(_a) {
var isOpen = _a.isOpen, resultCount = _a.resultCount, previousResultCount = _a.previousResultCount;
if (!isOpen) {
return '';
}
if (!resultCount) {
return 'No results are available.';
}
if (resultCount !== previousResultCount) {
return "".concat(resultCount, " result").concat(resultCount === 1 ? ' is' : 's are', " available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.");
}
return '';
}
var defaultProps$2 = __assign(__assign({}, defaultProps$3), { getA11yStatusMessage: getA11yStatusMessage });
// eslint-disable-next-line import/no-mutable-exports
var validatePropTypes$2 = downshift_esm_noop;
/* istanbul ignore next */
if (false) {}
const MenuKeyDownArrowDown = false ? 0 : 0;
const MenuKeyDownArrowUp = false ? 0 : 1;
const MenuKeyDownEscape = false ? 0 : 2;
const MenuKeyDownHome = false ? 0 : 3;
const MenuKeyDownEnd = false ? 0 : 4;
const MenuKeyDownEnter = false ? 0 : 5;
const MenuKeyDownSpaceButton = false ? 0 : 6;
const MenuKeyDownCharacter = false ? 0 : 7;
const MenuBlur = false ? 0 : 8;
const MenuMouseLeave$1 = false ? 0 : 9;
const ItemMouseMove$1 = false ? 0 : 10;
const ItemClick$1 = false ? 0 : 11;
const ToggleButtonClick$1 = false ? 0 : 12;
const ToggleButtonKeyDownArrowDown = false ? 0 : 13;
const ToggleButtonKeyDownArrowUp = false ? 0 : 14;
const ToggleButtonKeyDownCharacter = false ? 0 : 15;
const FunctionToggleMenu$1 = false ? 0 : 16;
const FunctionOpenMenu$1 = false ? 0 : 17;
const FunctionCloseMenu$1 = false ? 0 : 18;
const FunctionSetHighlightedIndex$1 = false ? 0 : 19;
const FunctionSelectItem$1 = false ? 0 : 20;
const FunctionSetInputValue$1 = false ? 0 : 21;
const FunctionReset$2 = false ? 0 : 22;
var stateChangeTypes$2 = /*#__PURE__*/Object.freeze({
__proto__: null,
MenuKeyDownArrowDown: MenuKeyDownArrowDown,
MenuKeyDownArrowUp: MenuKeyDownArrowUp,
MenuKeyDownEscape: MenuKeyDownEscape,
MenuKeyDownHome: MenuKeyDownHome,
MenuKeyDownEnd: MenuKeyDownEnd,
MenuKeyDownEnter: MenuKeyDownEnter,
MenuKeyDownSpaceButton: MenuKeyDownSpaceButton,
MenuKeyDownCharacter: MenuKeyDownCharacter,
MenuBlur: MenuBlur,
MenuMouseLeave: MenuMouseLeave$1,
ItemMouseMove: ItemMouseMove$1,
ItemClick: ItemClick$1,
ToggleButtonClick: ToggleButtonClick$1,
ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,
ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,
ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,
FunctionToggleMenu: FunctionToggleMenu$1,
FunctionOpenMenu: FunctionOpenMenu$1,
FunctionCloseMenu: FunctionCloseMenu$1,
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
FunctionSelectItem: FunctionSelectItem$1,
FunctionSetInputValue: FunctionSetInputValue$1,
FunctionReset: FunctionReset$2
});
/* eslint-disable complexity */
function downshiftSelectReducer(state, action) {
const {
type,
props,
shiftKey
} = action;
let changes;
switch (type) {
case ItemClick$1:
changes = {
isOpen: getDefaultValue$1(props, 'isOpen'),
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
selectedItem: props.items[action.index]
};
break;
case ToggleButtonKeyDownCharacter:
{
const lowercasedKey = action.key;
const inputValue = `${state.inputValue}${lowercasedKey}`;
const itemIndex = getItemIndexByCharacterKey({
keysSoFar: inputValue,
highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
items: props.items,
itemToString: props.itemToString,
getItemNodeFromIndex: action.getItemNodeFromIndex
});
changes = {
inputValue,
...(itemIndex >= 0 && {
selectedItem: props.items[itemIndex]
})
};
}
break;
case ToggleButtonKeyDownArrowDown:
changes = {
highlightedIndex: getHighlightedIndexOnOpen(props, state, 1, action.getItemNodeFromIndex),
isOpen: true
};
break;
case ToggleButtonKeyDownArrowUp:
changes = {
highlightedIndex: getHighlightedIndexOnOpen(props, state, -1, action.getItemNodeFromIndex),
isOpen: true
};
break;
case MenuKeyDownEnter:
case MenuKeyDownSpaceButton:
changes = {
isOpen: getDefaultValue$1(props, 'isOpen'),
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
...(state.highlightedIndex >= 0 && {
selectedItem: props.items[state.highlightedIndex]
})
};
break;
case MenuKeyDownHome:
changes = {
highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false)
};
break;
case MenuKeyDownEnd:
changes = {
highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false)
};
break;
case MenuKeyDownEscape:
changes = {
isOpen: false,
highlightedIndex: -1
};
break;
case MenuBlur:
changes = {
isOpen: false,
highlightedIndex: -1
};
break;
case MenuKeyDownCharacter:
{
const lowercasedKey = action.key;
const inputValue = `${state.inputValue}${lowercasedKey}`;
const highlightedIndex = getItemIndexByCharacterKey({
keysSoFar: inputValue,
highlightedIndex: state.highlightedIndex,
items: props.items,
itemToString: props.itemToString,
getItemNodeFromIndex: action.getItemNodeFromIndex
});
changes = {
inputValue,
...(highlightedIndex >= 0 && {
highlightedIndex
})
};
}
break;
case MenuKeyDownArrowDown:
changes = {
highlightedIndex: getNextWrappingIndex(shiftKey ? 5 : 1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
};
break;
case MenuKeyDownArrowUp:
changes = {
highlightedIndex: getNextWrappingIndex(shiftKey ? -5 : -1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
};
break;
case FunctionSelectItem$1:
changes = {
selectedItem: action.selectedItem
};
break;
default:
return downshiftCommonReducer(state, action, stateChangeTypes$2);
}
return { ...state,
...changes
};
}
/* eslint-enable complexity */
/* eslint-disable max-statements */
useSelect.stateChangeTypes = stateChangeTypes$2;
function useSelect(userProps) {
if (userProps === void 0) {
userProps = {};
}
validatePropTypes$2(userProps, useSelect); // Props defaults and destructuring.
const props = { ...defaultProps$2,
...userProps
};
const {
items,
scrollIntoView,
environment,
initialIsOpen,
defaultIsOpen,
itemToString,
getA11ySelectionMessage,
getA11yStatusMessage
} = props; // Initial state depending on controlled props.
const initialState = getInitialState$2(props);
const [state, dispatch] = useControlledReducer$1(downshiftSelectReducer, initialState, props);
const {
isOpen,
highlightedIndex,
selectedItem,
inputValue
} = state; // Element efs.
const toggleButtonRef = (0,external_React_.useRef)(null);
const menuRef = (0,external_React_.useRef)(null);
const itemRefs = (0,external_React_.useRef)({}); // used not to trigger menu blur action in some scenarios.
const shouldBlurRef = (0,external_React_.useRef)(true); // used to keep the inputValue clearTimeout object between renders.
const clearTimeoutRef = (0,external_React_.useRef)(null); // prevent id re-generation between renders.
const elementIds = useElementIds(props); // used to keep track of how many items we had on previous cycle.
const previousResultCountRef = (0,external_React_.useRef)();
const isInitialMountRef = (0,external_React_.useRef)(true); // utility callback to get item element.
const latest = downshift_esm_useLatestRef({
state,
props
}); // Some utils.
const getItemNodeFromIndex = (0,external_React_.useCallback)(index => itemRefs.current[elementIds.getItemId(index)], [elementIds]); // Effects.
// Sets a11y status message on changes in state.
useA11yMessageSetter(getA11yStatusMessage, [isOpen, highlightedIndex, inputValue, items], {
isInitialMount: isInitialMountRef.current,
previousResultCount: previousResultCountRef.current,
items,
environment,
itemToString,
...state
}); // Sets a11y status message on changes in selectedItem.
useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], {
isInitialMount: isInitialMountRef.current,
previousResultCount: previousResultCountRef.current,
items,
environment,
itemToString,
...state
}); // Scroll on highlighted item if change comes from keyboard.
const shouldScrollRef = useScrollIntoView({
menuElement: menuRef.current,
highlightedIndex,
isOpen,
itemRefs,
scrollIntoView,
getItemNodeFromIndex
}); // Sets cleanup for the keysSoFar callback, debounded after 500ms.
(0,external_React_.useEffect)(() => {
// init the clean function here as we need access to dispatch.
clearTimeoutRef.current = debounce(outerDispatch => {
outerDispatch({
type: FunctionSetInputValue$1,
inputValue: ''
});
}, 500); // Cancel any pending debounced calls on mount
return () => {
clearTimeoutRef.current.cancel();
};
}, []); // Invokes the keysSoFar callback set up above.
(0,external_React_.useEffect)(() => {
if (!inputValue) {
return;
}
clearTimeoutRef.current(dispatch);
}, [dispatch, inputValue]);
useControlPropsValidator({
isInitialMount: isInitialMountRef.current,
props,
state
});
/* Controls the focus on the menu or the toggle button. */
(0,external_React_.useEffect)(() => {
// Don't focus menu on first render.
if (isInitialMountRef.current) {
// Unless it was initialised as open.
if ((initialIsOpen || defaultIsOpen || isOpen) && menuRef.current) {
menuRef.current.focus();
}
return;
} // Focus menu on open.
if (isOpen) {
// istanbul ignore else
if (menuRef.current) {
menuRef.current.focus();
}
return;
} // Focus toggleButton on close, but not if it was closed with (Shift+)Tab.
if (environment.document.activeElement === menuRef.current) {
// istanbul ignore else
if (toggleButtonRef.current) {
shouldBlurRef.current = false;
toggleButtonRef.current.focus();
}
} // eslint-disable-next-line react-hooks/exhaustive-deps
}, [isOpen]);
(0,external_React_.useEffect)(() => {
if (isInitialMountRef.current) {
return;
}
previousResultCountRef.current = items.length;
}); // Add mouse/touch events to document.
const mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, () => {
dispatch({
type: MenuBlur
});
});
const setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps'); // Make initial ref false.
(0,external_React_.useEffect)(() => {
isInitialMountRef.current = false;
}, []); // Reset itemRefs on close.
(0,external_React_.useEffect)(() => {
if (!isOpen) {
itemRefs.current = {};
}
}, [isOpen]); // Event handler functions.
const toggleButtonKeyDownHandlers = (0,external_React_.useMemo)(() => ({
ArrowDown(event) {
event.preventDefault();
dispatch({
type: ToggleButtonKeyDownArrowDown,
getItemNodeFromIndex,
shiftKey: event.shiftKey
});
},
ArrowUp(event) {
event.preventDefault();
dispatch({
type: ToggleButtonKeyDownArrowUp,
getItemNodeFromIndex,
shiftKey: event.shiftKey
});
}
}), [dispatch, getItemNodeFromIndex]);
const menuKeyDownHandlers = (0,external_React_.useMemo)(() => ({
ArrowDown(event) {
event.preventDefault();
dispatch({
type: MenuKeyDownArrowDown,
getItemNodeFromIndex,
shiftKey: event.shiftKey
});
},
ArrowUp(event) {
event.preventDefault();
dispatch({
type: MenuKeyDownArrowUp,
getItemNodeFromIndex,
shiftKey: event.shiftKey
});
},
Home(event) {
event.preventDefault();
dispatch({
type: MenuKeyDownHome,
getItemNodeFromIndex
});
},
End(event) {
event.preventDefault();
dispatch({
type: MenuKeyDownEnd,
getItemNodeFromIndex
});
},
Escape() {
dispatch({
type: MenuKeyDownEscape
});
},
Enter(event) {
event.preventDefault();
dispatch({
type: MenuKeyDownEnter
});
},
' '(event) {
event.preventDefault();
dispatch({
type: MenuKeyDownSpaceButton
});
}
}), [dispatch, getItemNodeFromIndex]); // Action functions.
const toggleMenu = (0,external_React_.useCallback)(() => {
dispatch({
type: FunctionToggleMenu$1
});
}, [dispatch]);
const closeMenu = (0,external_React_.useCallback)(() => {
dispatch({
type: FunctionCloseMenu$1
});
}, [dispatch]);
const openMenu = (0,external_React_.useCallback)(() => {
dispatch({
type: FunctionOpenMenu$1
});
}, [dispatch]);
const setHighlightedIndex = (0,external_React_.useCallback)(newHighlightedIndex => {
dispatch({
type: FunctionSetHighlightedIndex$1,
highlightedIndex: newHighlightedIndex
});
}, [dispatch]);
const selectItem = (0,external_React_.useCallback)(newSelectedItem => {
dispatch({
type: FunctionSelectItem$1,
selectedItem: newSelectedItem
});
}, [dispatch]);
const reset = (0,external_React_.useCallback)(() => {
dispatch({
type: FunctionReset$2
});
}, [dispatch]);
const setInputValue = (0,external_React_.useCallback)(newInputValue => {
dispatch({
type: FunctionSetInputValue$1,
inputValue: newInputValue
});
}, [dispatch]); // Getter functions.
const getLabelProps = (0,external_React_.useCallback)(labelProps => ({
id: elementIds.labelId,
htmlFor: elementIds.toggleButtonId,
...labelProps
}), [elementIds]);
const getMenuProps = (0,external_React_.useCallback)(function (_temp, _temp2) {
let {
onMouseLeave,
refKey = 'ref',
onKeyDown,
onBlur,
ref,
...rest
} = _temp === void 0 ? {} : _temp;
let {
suppressRefError = false
} = _temp2 === void 0 ? {} : _temp2;
const latestState = latest.current.state;
const menuHandleKeyDown = event => {
const key = normalizeArrowKey(event);
if (key && menuKeyDownHandlers[key]) {
menuKeyDownHandlers[key](event);
} else if (isAcceptedCharacterKey(key)) {
dispatch({
type: MenuKeyDownCharacter,
key,
getItemNodeFromIndex
});
}
};
const menuHandleBlur = () => {
// if the blur was a result of selection, we don't trigger this action.
if (shouldBlurRef.current === false) {
shouldBlurRef.current = true;
return;
}
const shouldBlur = !mouseAndTouchTrackersRef.current.isMouseDown;
/* istanbul ignore else */
if (shouldBlur) {
dispatch({
type: MenuBlur
});
}
};
const menuHandleMouseLeave = () => {
dispatch({
type: MenuMouseLeave$1
});
};
setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);
return {
[refKey]: handleRefs(ref, menuNode => {
menuRef.current = menuNode;
}),
id: elementIds.menuId,
role: 'listbox',
'aria-labelledby': elementIds.labelId,
tabIndex: -1,
...(latestState.isOpen && latestState.highlightedIndex > -1 && {
'aria-activedescendant': elementIds.getItemId(latestState.highlightedIndex)
}),
onMouseLeave: callAllEventHandlers(onMouseLeave, menuHandleMouseLeave),
onKeyDown: callAllEventHandlers(onKeyDown, menuHandleKeyDown),
onBlur: callAllEventHandlers(onBlur, menuHandleBlur),
...rest
};
}, [dispatch, latest, menuKeyDownHandlers, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds, getItemNodeFromIndex]);
const getToggleButtonProps = (0,external_React_.useCallback)(function (_temp3, _temp4) {
let {
onClick,
onKeyDown,
refKey = 'ref',
ref,
...rest
} = _temp3 === void 0 ? {} : _temp3;
let {
suppressRefError = false
} = _temp4 === void 0 ? {} : _temp4;
const toggleButtonHandleClick = () => {
dispatch({
type: ToggleButtonClick$1
});
};
const toggleButtonHandleKeyDown = event => {
const key = normalizeArrowKey(event);
if (key && toggleButtonKeyDownHandlers[key]) {
toggleButtonKeyDownHandlers[key](event);
} else if (isAcceptedCharacterKey(key)) {
dispatch({
type: ToggleButtonKeyDownCharacter,
key,
getItemNodeFromIndex
});
}
};
const toggleProps = {
[refKey]: handleRefs(ref, toggleButtonNode => {
toggleButtonRef.current = toggleButtonNode;
}),
id: elementIds.toggleButtonId,
'aria-haspopup': 'listbox',
'aria-expanded': latest.current.state.isOpen,
'aria-labelledby': `${elementIds.labelId} ${elementIds.toggleButtonId}`,
...rest
};
if (!rest.disabled) {
toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);
toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);
}
setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);
return toggleProps;
}, [dispatch, latest, toggleButtonKeyDownHandlers, setGetterPropCallInfo, elementIds, getItemNodeFromIndex]);
const getItemProps = (0,external_React_.useCallback)(function (_temp5) {
let {
item,
index,
onMouseMove,
onClick,
refKey = 'ref',
ref,
disabled,
...rest
} = _temp5 === void 0 ? {} : _temp5;
const {
state: latestState,
props: latestProps
} = latest.current;
const itemHandleMouseMove = () => {
if (index === latestState.highlightedIndex) {
return;
}
shouldScrollRef.current = false;
dispatch({
type: ItemMouseMove$1,
index,
disabled
});
};
const itemHandleClick = () => {
dispatch({
type: ItemClick$1,
index
});
};
const itemIndex = getItemIndex(index, item, latestProps.items);
if (itemIndex < 0) {
throw new Error('Pass either item or item index in getItemProps!');
}
const itemProps = {
disabled,
role: 'option',
'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
id: elementIds.getItemId(itemIndex),
[refKey]: handleRefs(ref, itemNode => {
if (itemNode) {
itemRefs.current[elementIds.getItemId(itemIndex)] = itemNode;
}
}),
...rest
};
if (!disabled) {
itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);
}
itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);
return itemProps;
}, [dispatch, latest, shouldScrollRef, elementIds]);
return {
// prop getters.
getToggleButtonProps,
getLabelProps,
getMenuProps,
getItemProps,
// actions.
toggleMenu,
openMenu,
closeMenu,
setHighlightedIndex,
selectItem,
reset,
setInputValue,
// state.
highlightedIndex,
isOpen,
selectedItem,
inputValue
};
}
const InputKeyDownArrowDown = false ? 0 : 0;
const InputKeyDownArrowUp = false ? 0 : 1;
const InputKeyDownEscape = false ? 0 : 2;
const InputKeyDownHome = false ? 0 : 3;
const InputKeyDownEnd = false ? 0 : 4;
const InputKeyDownEnter = false ? 0 : 5;
const InputChange = false ? 0 : 6;
const InputBlur = false ? 0 : 7;
const MenuMouseLeave = false ? 0 : 8;
const ItemMouseMove = false ? 0 : 9;
const ItemClick = false ? 0 : 10;
const ToggleButtonClick = false ? 0 : 11;
const FunctionToggleMenu = false ? 0 : 12;
const FunctionOpenMenu = false ? 0 : 13;
const FunctionCloseMenu = false ? 0 : 14;
const FunctionSetHighlightedIndex = false ? 0 : 15;
const FunctionSelectItem = false ? 0 : 16;
const FunctionSetInputValue = false ? 0 : 17;
const FunctionReset$1 = false ? 0 : 18;
const ControlledPropUpdatedSelectedItem = false ? 0 : 19;
var stateChangeTypes$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
InputKeyDownArrowDown: InputKeyDownArrowDown,
InputKeyDownArrowUp: InputKeyDownArrowUp,
InputKeyDownEscape: InputKeyDownEscape,
InputKeyDownHome: InputKeyDownHome,
InputKeyDownEnd: InputKeyDownEnd,
InputKeyDownEnter: InputKeyDownEnter,
InputChange: InputChange,
InputBlur: InputBlur,
MenuMouseLeave: MenuMouseLeave,
ItemMouseMove: ItemMouseMove,
ItemClick: ItemClick,
ToggleButtonClick: ToggleButtonClick,
FunctionToggleMenu: FunctionToggleMenu,
FunctionOpenMenu: FunctionOpenMenu,
FunctionCloseMenu: FunctionCloseMenu,
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
FunctionSelectItem: FunctionSelectItem,
FunctionSetInputValue: FunctionSetInputValue,
FunctionReset: FunctionReset$1,
ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem
});
function getInitialState$1(props) {
const initialState = getInitialState$2(props);
const {
selectedItem
} = initialState;
let {
inputValue
} = initialState;
if (inputValue === '' && selectedItem && props.defaultInputValue === undefined && props.initialInputValue === undefined && props.inputValue === undefined) {
inputValue = props.itemToString(selectedItem);
}
return { ...initialState,
inputValue
};
}
const propTypes$1 = {
items: (prop_types_default()).array.isRequired,
itemToString: (prop_types_default()).func,
getA11yStatusMessage: (prop_types_default()).func,
getA11ySelectionMessage: (prop_types_default()).func,
circularNavigation: (prop_types_default()).bool,
highlightedIndex: (prop_types_default()).number,
defaultHighlightedIndex: (prop_types_default()).number,
initialHighlightedIndex: (prop_types_default()).number,
isOpen: (prop_types_default()).bool,
defaultIsOpen: (prop_types_default()).bool,
initialIsOpen: (prop_types_default()).bool,
selectedItem: (prop_types_default()).any,
initialSelectedItem: (prop_types_default()).any,
defaultSelectedItem: (prop_types_default()).any,
inputValue: (prop_types_default()).string,
defaultInputValue: (prop_types_default()).string,
initialInputValue: (prop_types_default()).string,
id: (prop_types_default()).string,
labelId: (prop_types_default()).string,
menuId: (prop_types_default()).string,
getItemId: (prop_types_default()).func,
inputId: (prop_types_default()).string,
toggleButtonId: (prop_types_default()).string,
stateReducer: (prop_types_default()).func,
onSelectedItemChange: (prop_types_default()).func,
onHighlightedIndexChange: (prop_types_default()).func,
onStateChange: (prop_types_default()).func,
onIsOpenChange: (prop_types_default()).func,
onInputValueChange: (prop_types_default()).func,
environment: prop_types_default().shape({
addEventListener: (prop_types_default()).func,
removeEventListener: (prop_types_default()).func,
document: prop_types_default().shape({
getElementById: (prop_types_default()).func,
activeElement: (prop_types_default()).any,
body: (prop_types_default()).any
})
})
};
/**
* The useCombobox version of useControlledReducer, which also
* checks if the controlled prop selectedItem changed between
* renders. If so, it will also update inputValue with its
* string equivalent. It uses the common useEnhancedReducer to
* compute the rest of the state.
*
* @param {Function} reducer Reducer function from downshift.
* @param {Object} initialState Initial state of the hook.
* @param {Object} props The hook props.
* @returns {Array} An array with the state and an action dispatcher.
*/
function useControlledReducer(reducer, initialState, props) {
const previousSelectedItemRef = (0,external_React_.useRef)();
const [state, dispatch] = useEnhancedReducer(reducer, initialState, props); // ToDo: if needed, make same approach as selectedItemChanged from Downshift.
(0,external_React_.useEffect)(() => {
if (isControlledProp(props, 'selectedItem')) {
if (previousSelectedItemRef.current !== props.selectedItem) {
dispatch({
type: ControlledPropUpdatedSelectedItem,
inputValue: props.itemToString(props.selectedItem)
});
}
previousSelectedItemRef.current = state.selectedItem === previousSelectedItemRef.current ? props.selectedItem : state.selectedItem;
}
});
return [getState(state, props), dispatch];
} // eslint-disable-next-line import/no-mutable-exports
let validatePropTypes$1 = downshift_esm_noop;
/* istanbul ignore next */
if (false) {}
const defaultProps$1 = { ...defaultProps$3,
getA11yStatusMessage: getA11yStatusMessage$1,
circularNavigation: true
};
/* eslint-disable complexity */
function downshiftUseComboboxReducer(state, action) {
const {
type,
props,
shiftKey
} = action;
let changes;
switch (type) {
case ItemClick:
changes = {
isOpen: getDefaultValue$1(props, 'isOpen'),
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
selectedItem: props.items[action.index],
inputValue: props.itemToString(props.items[action.index])
};
break;
case InputKeyDownArrowDown:
if (state.isOpen) {
changes = {
highlightedIndex: getNextWrappingIndex(shiftKey ? 5 : 1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
};
} else {
changes = {
highlightedIndex: getHighlightedIndexOnOpen(props, state, 1, action.getItemNodeFromIndex),
isOpen: props.items.length >= 0
};
}
break;
case InputKeyDownArrowUp:
if (state.isOpen) {
changes = {
highlightedIndex: getNextWrappingIndex(shiftKey ? -5 : -1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
};
} else {
changes = {
highlightedIndex: getHighlightedIndexOnOpen(props, state, -1, action.getItemNodeFromIndex),
isOpen: props.items.length >= 0
};
}
break;
case InputKeyDownEnter:
changes = { ...(state.isOpen && state.highlightedIndex >= 0 && {
selectedItem: props.items[state.highlightedIndex],
isOpen: getDefaultValue$1(props, 'isOpen'),
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
inputValue: props.itemToString(props.items[state.highlightedIndex])
})
};
break;
case InputKeyDownEscape:
changes = {
isOpen: false,
highlightedIndex: -1,
...(!state.isOpen && {
selectedItem: null,
inputValue: ''
})
};
break;
case InputKeyDownHome:
changes = {
highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false)
};
break;
case InputKeyDownEnd:
changes = {
highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false)
};
break;
case InputBlur:
changes = {
isOpen: false,
highlightedIndex: -1,
...(state.highlightedIndex >= 0 && action.selectItem && {
selectedItem: props.items[state.highlightedIndex],
inputValue: props.itemToString(props.items[state.highlightedIndex])
})
};
break;
case InputChange:
changes = {
isOpen: true,
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
inputValue: action.inputValue
};
break;
case FunctionSelectItem:
changes = {
selectedItem: action.selectedItem,
inputValue: props.itemToString(action.selectedItem)
};
break;
case ControlledPropUpdatedSelectedItem:
changes = {
inputValue: action.inputValue
};
break;
default:
return downshiftCommonReducer(state, action, stateChangeTypes$1);
}
return { ...state,
...changes
};
}
/* eslint-enable complexity */
/* eslint-disable max-statements */
useCombobox.stateChangeTypes = stateChangeTypes$1;
function useCombobox(userProps) {
if (userProps === void 0) {
userProps = {};
}
validatePropTypes$1(userProps, useCombobox); // Props defaults and destructuring.
const props = { ...defaultProps$1,
...userProps
};
const {
initialIsOpen,
defaultIsOpen,
items,
scrollIntoView,
environment,
getA11yStatusMessage,
getA11ySelectionMessage,
itemToString
} = props; // Initial state depending on controlled props.
const initialState = getInitialState$1(props);
const [state, dispatch] = useControlledReducer(downshiftUseComboboxReducer, initialState, props);
const {
isOpen,
highlightedIndex,
selectedItem,
inputValue
} = state; // Element refs.
const menuRef = (0,external_React_.useRef)(null);
const itemRefs = (0,external_React_.useRef)({});
const inputRef = (0,external_React_.useRef)(null);
const toggleButtonRef = (0,external_React_.useRef)(null);
const comboboxRef = (0,external_React_.useRef)(null);
const isInitialMountRef = (0,external_React_.useRef)(true); // prevent id re-generation between renders.
const elementIds = useElementIds(props); // used to keep track of how many items we had on previous cycle.
const previousResultCountRef = (0,external_React_.useRef)(); // utility callback to get item element.
const latest = downshift_esm_useLatestRef({
state,
props
});
const getItemNodeFromIndex = (0,external_React_.useCallback)(index => itemRefs.current[elementIds.getItemId(index)], [elementIds]); // Effects.
// Sets a11y status message on changes in state.
useA11yMessageSetter(getA11yStatusMessage, [isOpen, highlightedIndex, inputValue, items], {
isInitialMount: isInitialMountRef.current,
previousResultCount: previousResultCountRef.current,
items,
environment,
itemToString,
...state
}); // Sets a11y status message on changes in selectedItem.
useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], {
isInitialMount: isInitialMountRef.current,
previousResultCount: previousResultCountRef.current,
items,
environment,
itemToString,
...state
}); // Scroll on highlighted item if change comes from keyboard.
const shouldScrollRef = useScrollIntoView({
menuElement: menuRef.current,
highlightedIndex,
isOpen,
itemRefs,
scrollIntoView,
getItemNodeFromIndex
});
useControlPropsValidator({
isInitialMount: isInitialMountRef.current,
props,
state
}); // Focus the input on first render if required.
(0,external_React_.useEffect)(() => {
const focusOnOpen = initialIsOpen || defaultIsOpen || isOpen;
if (focusOnOpen && inputRef.current) {
inputRef.current.focus();
} // eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
(0,external_React_.useEffect)(() => {
if (isInitialMountRef.current) {
return;
}
previousResultCountRef.current = items.length;
}); // Add mouse/touch events to document.
const mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [comboboxRef, menuRef, toggleButtonRef], environment, () => {
dispatch({
type: InputBlur,
selectItem: false
});
});
const setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getComboboxProps', 'getMenuProps'); // Make initial ref false.
(0,external_React_.useEffect)(() => {
isInitialMountRef.current = false;
}, []); // Reset itemRefs on close.
(0,external_React_.useEffect)(() => {
if (!isOpen) {
itemRefs.current = {};
}
}, [isOpen]);
/* Event handler functions */
const inputKeyDownHandlers = (0,external_React_.useMemo)(() => ({
ArrowDown(event) {
event.preventDefault();
dispatch({
type: InputKeyDownArrowDown,
shiftKey: event.shiftKey,
getItemNodeFromIndex
});
},
ArrowUp(event) {
event.preventDefault();
dispatch({
type: InputKeyDownArrowUp,
shiftKey: event.shiftKey,
getItemNodeFromIndex
});
},
Home(event) {
if (!latest.current.state.isOpen) {
return;
}
event.preventDefault();
dispatch({
type: InputKeyDownHome,
getItemNodeFromIndex
});
},
End(event) {
if (!latest.current.state.isOpen) {
return;
}
event.preventDefault();
dispatch({
type: InputKeyDownEnd,
getItemNodeFromIndex
});
},
Escape(event) {
const latestState = latest.current.state;
if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {
event.preventDefault();
dispatch({
type: InputKeyDownEscape
});
}
},
Enter(event) {
const latestState = latest.current.state; // if closed or no highlighted index, do nothing.
if (!latestState.isOpen || latestState.highlightedIndex < 0 || event.which === 229 // if IME composing, wait for next Enter keydown event.
) {
return;
}
event.preventDefault();
dispatch({
type: InputKeyDownEnter,
getItemNodeFromIndex
});
}
}), [dispatch, latest, getItemNodeFromIndex]); // Getter props.
const getLabelProps = (0,external_React_.useCallback)(labelProps => ({
id: elementIds.labelId,
htmlFor: elementIds.inputId,
...labelProps
}), [elementIds]);
const getMenuProps = (0,external_React_.useCallback)(function (_temp, _temp2) {
let {
onMouseLeave,
refKey = 'ref',
ref,
...rest
} = _temp === void 0 ? {} : _temp;
let {
suppressRefError = false
} = _temp2 === void 0 ? {} : _temp2;
setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);
return {
[refKey]: handleRefs(ref, menuNode => {
menuRef.current = menuNode;
}),
id: elementIds.menuId,
role: 'listbox',
'aria-labelledby': elementIds.labelId,
onMouseLeave: callAllEventHandlers(onMouseLeave, () => {
dispatch({
type: MenuMouseLeave
});
}),
...rest
};
}, [dispatch, setGetterPropCallInfo, elementIds]);
const getItemProps = (0,external_React_.useCallback)(function (_temp3) {
let {
item,
index,
refKey = 'ref',
ref,
onMouseMove,
onMouseDown,
onClick,
onPress,
disabled,
...rest
} = _temp3 === void 0 ? {} : _temp3;
const {
props: latestProps,
state: latestState
} = latest.current;
const itemIndex = getItemIndex(index, item, latestProps.items);
if (itemIndex < 0) {
throw new Error('Pass either item or item index in getItemProps!');
}
const onSelectKey = 'onClick';
const customClickHandler = onClick;
const itemHandleMouseMove = () => {
if (index === latestState.highlightedIndex) {
return;
}
shouldScrollRef.current = false;
dispatch({
type: ItemMouseMove,
index,
disabled
});
};
const itemHandleClick = () => {
dispatch({
type: ItemClick,
index
});
};
const itemHandleMouseDown = e => e.preventDefault();
return {
[refKey]: handleRefs(ref, itemNode => {
if (itemNode) {
itemRefs.current[elementIds.getItemId(itemIndex)] = itemNode;
}
}),
disabled,
role: 'option',
'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
id: elementIds.getItemId(itemIndex),
...(!disabled && {
[onSelectKey]: callAllEventHandlers(customClickHandler, itemHandleClick)
}),
onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),
onMouseDown: callAllEventHandlers(onMouseDown, itemHandleMouseDown),
...rest
};
}, [dispatch, latest, shouldScrollRef, elementIds]);
const getToggleButtonProps = (0,external_React_.useCallback)(function (_temp4) {
let {
onClick,
onPress,
refKey = 'ref',
ref,
...rest
} = _temp4 === void 0 ? {} : _temp4;
const toggleButtonHandleClick = () => {
dispatch({
type: ToggleButtonClick
});
if (!latest.current.state.isOpen && inputRef.current) {
inputRef.current.focus();
}
};
return {
[refKey]: handleRefs(ref, toggleButtonNode => {
toggleButtonRef.current = toggleButtonNode;
}),
id: elementIds.toggleButtonId,
tabIndex: -1,
...(!rest.disabled && { ...({
onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)
})
}),
...rest
};
}, [dispatch, latest, elementIds]);
const getInputProps = (0,external_React_.useCallback)(function (_temp5, _temp6) {
let {
onKeyDown,
onChange,
onInput,
onBlur,
onChangeText,
refKey = 'ref',
ref,
...rest
} = _temp5 === void 0 ? {} : _temp5;
let {
suppressRefError = false
} = _temp6 === void 0 ? {} : _temp6;
setGetterPropCallInfo('getInputProps', suppressRefError, refKey, inputRef);
const latestState = latest.current.state;
const inputHandleKeyDown = event => {
const key = normalizeArrowKey(event);
if (key && inputKeyDownHandlers[key]) {
inputKeyDownHandlers[key](event);
}
};
const inputHandleChange = event => {
dispatch({
type: InputChange,
inputValue: event.target.value
});
};
const inputHandleBlur = () => {
/* istanbul ignore else */
if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
dispatch({
type: InputBlur,
selectItem: true
});
}
};
/* istanbul ignore next (preact) */
const onChangeKey = 'onChange';
let eventHandlers = {};
if (!rest.disabled) {
eventHandlers = {
[onChangeKey]: callAllEventHandlers(onChange, onInput, inputHandleChange),
onKeyDown: callAllEventHandlers(onKeyDown, inputHandleKeyDown),
onBlur: callAllEventHandlers(onBlur, inputHandleBlur)
};
}
return {
[refKey]: handleRefs(ref, inputNode => {
inputRef.current = inputNode;
}),
id: elementIds.inputId,
'aria-autocomplete': 'list',
'aria-controls': elementIds.menuId,
...(latestState.isOpen && latestState.highlightedIndex > -1 && {
'aria-activedescendant': elementIds.getItemId(latestState.highlightedIndex)
}),
'aria-labelledby': elementIds.labelId,
// https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
// revert back since autocomplete="nope" is ignored on latest Chrome and Opera
autoComplete: 'off',
value: latestState.inputValue,
...eventHandlers,
...rest
};
}, [dispatch, inputKeyDownHandlers, latest, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds]);
const getComboboxProps = (0,external_React_.useCallback)(function (_temp7, _temp8) {
let {
refKey = 'ref',
ref,
...rest
} = _temp7 === void 0 ? {} : _temp7;
let {
suppressRefError = false
} = _temp8 === void 0 ? {} : _temp8;
setGetterPropCallInfo('getComboboxProps', suppressRefError, refKey, comboboxRef);
return {
[refKey]: handleRefs(ref, comboboxNode => {
comboboxRef.current = comboboxNode;
}),
role: 'combobox',
'aria-haspopup': 'listbox',
'aria-owns': elementIds.menuId,
'aria-expanded': latest.current.state.isOpen,
...rest
};
}, [latest, setGetterPropCallInfo, elementIds]); // returns
const toggleMenu = (0,external_React_.useCallback)(() => {
dispatch({
type: FunctionToggleMenu
});
}, [dispatch]);
const closeMenu = (0,external_React_.useCallback)(() => {
dispatch({
type: FunctionCloseMenu
});
}, [dispatch]);
const openMenu = (0,external_React_.useCallback)(() => {
dispatch({
type: FunctionOpenMenu
});
}, [dispatch]);
const setHighlightedIndex = (0,external_React_.useCallback)(newHighlightedIndex => {
dispatch({
type: FunctionSetHighlightedIndex,
highlightedIndex: newHighlightedIndex
});
}, [dispatch]);
const selectItem = (0,external_React_.useCallback)(newSelectedItem => {
dispatch({
type: FunctionSelectItem,
selectedItem: newSelectedItem
});
}, [dispatch]);
const setInputValue = (0,external_React_.useCallback)(newInputValue => {
dispatch({
type: FunctionSetInputValue,
inputValue: newInputValue
});
}, [dispatch]);
const reset = (0,external_React_.useCallback)(() => {
dispatch({
type: FunctionReset$1
});
}, [dispatch]);
return {
// prop getters.
getItemProps,
getLabelProps,
getMenuProps,
getInputProps,
getComboboxProps,
getToggleButtonProps,
// actions.
toggleMenu,
openMenu,
closeMenu,
setHighlightedIndex,
setInputValue,
selectItem,
reset,
// state.
highlightedIndex,
isOpen,
selectedItem,
inputValue
};
}
const defaultStateValues = {
activeIndex: -1,
selectedItems: []
};
/**
* Returns the initial value for a state key in the following order:
* 1. controlled prop, 2. initial prop, 3. default prop, 4. default
* value from Downshift.
*
* @param {Object} props Props passed to the hook.
* @param {string} propKey Props key to generate the value for.
* @returns {any} The initial value for that prop.
*/
function getInitialValue(props, propKey) {
return getInitialValue$1(props, propKey, defaultStateValues);
}
/**
* Returns the default value for a state key in the following order:
* 1. controlled prop, 2. default prop, 3. default value from Downshift.
*
* @param {Object} props Props passed to the hook.
* @param {string} propKey Props key to generate the value for.
* @returns {any} The initial value for that prop.
*/
function getDefaultValue(props, propKey) {
return getDefaultValue$1(props, propKey, defaultStateValues);
}
/**
* Gets the initial state based on the provided props. It uses initial, default
* and controlled props related to state in order to compute the initial value.
*
* @param {Object} props Props passed to the hook.
* @returns {Object} The initial state.
*/
function getInitialState(props) {
const activeIndex = getInitialValue(props, 'activeIndex');
const selectedItems = getInitialValue(props, 'selectedItems');
return {
activeIndex,
selectedItems
};
}
/**
* Returns true if dropdown keydown operation is permitted. Should not be
* allowed on keydown with modifier keys (ctrl, alt, shift, meta), on
* input element with text content that is either highlighted or selection
* cursor is not at the starting position.
*
* @param {KeyboardEvent} event The event from keydown.
* @returns {boolean} Whether the operation is allowed.
*/
function isKeyDownOperationPermitted(event) {
if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {
return false;
}
const element = event.target;
if (element instanceof HTMLInputElement && // if element is a text input
element.value !== '' && ( // and we have text in it
// and cursor is either not at the start or is currently highlighting text.
element.selectionStart !== 0 || element.selectionEnd !== 0)) {
return false;
}
return true;
}
/**
* Returns a message to be added to aria-live region when item is removed.
*
* @param {Object} selectionParameters Parameters required to build the message.
* @returns {string} The a11y message.
*/
function getA11yRemovalMessage(selectionParameters) {
const {
removedSelectedItem,
itemToString: itemToStringLocal
} = selectionParameters;
return `${itemToStringLocal(removedSelectedItem)} has been removed.`;
}
const propTypes = {
selectedItems: (prop_types_default()).array,
initialSelectedItems: (prop_types_default()).array,
defaultSelectedItems: (prop_types_default()).array,
itemToString: (prop_types_default()).func,
getA11yRemovalMessage: (prop_types_default()).func,
stateReducer: (prop_types_default()).func,
activeIndex: (prop_types_default()).number,
initialActiveIndex: (prop_types_default()).number,
defaultActiveIndex: (prop_types_default()).number,
onActiveIndexChange: (prop_types_default()).func,
onSelectedItemsChange: (prop_types_default()).func,
keyNavigationNext: (prop_types_default()).string,
keyNavigationPrevious: (prop_types_default()).string,
environment: prop_types_default().shape({
addEventListener: (prop_types_default()).func,
removeEventListener: (prop_types_default()).func,
document: prop_types_default().shape({
getElementById: (prop_types_default()).func,
activeElement: (prop_types_default()).any,
body: (prop_types_default()).any
})
})
};
const defaultProps = {
itemToString: defaultProps$3.itemToString,
stateReducer: defaultProps$3.stateReducer,
environment: defaultProps$3.environment,
getA11yRemovalMessage,
keyNavigationNext: 'ArrowRight',
keyNavigationPrevious: 'ArrowLeft'
}; // eslint-disable-next-line import/no-mutable-exports
let validatePropTypes = downshift_esm_noop;
/* istanbul ignore next */
if (false) {}
const SelectedItemClick = false ? 0 : 0;
const SelectedItemKeyDownDelete = false ? 0 : 1;
const SelectedItemKeyDownBackspace = false ? 0 : 2;
const SelectedItemKeyDownNavigationNext = false ? 0 : 3;
const SelectedItemKeyDownNavigationPrevious = false ? 0 : 4;
const DropdownKeyDownNavigationPrevious = false ? 0 : 5;
const DropdownKeyDownBackspace = false ? 0 : 6;
const DropdownClick = false ? 0 : 7;
const FunctionAddSelectedItem = false ? 0 : 8;
const FunctionRemoveSelectedItem = false ? 0 : 9;
const FunctionSetSelectedItems = false ? 0 : 10;
const FunctionSetActiveIndex = false ? 0 : 11;
const FunctionReset = false ? 0 : 12;
var stateChangeTypes = /*#__PURE__*/Object.freeze({
__proto__: null,
SelectedItemClick: SelectedItemClick,
SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,
SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,
SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious,
DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,
DropdownKeyDownBackspace: DropdownKeyDownBackspace,
DropdownClick: DropdownClick,
FunctionAddSelectedItem: FunctionAddSelectedItem,
FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,
FunctionSetSelectedItems: FunctionSetSelectedItems,
FunctionSetActiveIndex: FunctionSetActiveIndex,
FunctionReset: FunctionReset
});
/* eslint-disable complexity */
function downshiftMultipleSelectionReducer(state, action) {
const {
type,
index,
props,
selectedItem
} = action;
const {
activeIndex,
selectedItems
} = state;
let changes;
switch (type) {
case SelectedItemClick:
changes = {
activeIndex: index
};
break;
case SelectedItemKeyDownNavigationPrevious:
changes = {
activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1
};
break;
case SelectedItemKeyDownNavigationNext:
changes = {
activeIndex: activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1
};
break;
case SelectedItemKeyDownBackspace:
case SelectedItemKeyDownDelete:
{
let newActiveIndex = activeIndex;
if (selectedItems.length === 1) {
newActiveIndex = -1;
} else if (activeIndex === selectedItems.length - 1) {
newActiveIndex = selectedItems.length - 2;
}
changes = {
selectedItems: [...selectedItems.slice(0, activeIndex), ...selectedItems.slice(activeIndex + 1)],
...{
activeIndex: newActiveIndex
}
};
break;
}
case DropdownKeyDownNavigationPrevious:
changes = {
activeIndex: selectedItems.length - 1
};
break;
case DropdownKeyDownBackspace:
changes = {
selectedItems: selectedItems.slice(0, selectedItems.length - 1)
};
break;
case FunctionAddSelectedItem:
changes = {
selectedItems: [...selectedItems, selectedItem]
};
break;
case DropdownClick:
changes = {
activeIndex: -1
};
break;
case FunctionRemoveSelectedItem:
{
let newActiveIndex = activeIndex;
const selectedItemIndex = selectedItems.indexOf(selectedItem);
if (selectedItemIndex >= 0) {
if (selectedItems.length === 1) {
newActiveIndex = -1;
} else if (selectedItemIndex === selectedItems.length - 1) {
newActiveIndex = selectedItems.length - 2;
}
changes = {
selectedItems: [...selectedItems.slice(0, selectedItemIndex), ...selectedItems.slice(selectedItemIndex + 1)],
activeIndex: newActiveIndex
};
}
break;
}
case FunctionSetSelectedItems:
{
const {
selectedItems: newSelectedItems
} = action;
changes = {
selectedItems: newSelectedItems
};
break;
}
case FunctionSetActiveIndex:
{
const {
activeIndex: newActiveIndex
} = action;
changes = {
activeIndex: newActiveIndex
};
break;
}
case FunctionReset:
changes = {
activeIndex: getDefaultValue(props, 'activeIndex'),
selectedItems: getDefaultValue(props, 'selectedItems')
};
break;
default:
throw new Error('Reducer called without proper action type.');
}
return { ...state,
...changes
};
}
useMultipleSelection.stateChangeTypes = stateChangeTypes;
function useMultipleSelection(userProps) {
if (userProps === void 0) {
userProps = {};
}
validatePropTypes(userProps, useMultipleSelection); // Props defaults and destructuring.
const props = { ...defaultProps,
...userProps
};
const {
getA11yRemovalMessage,
itemToString,
environment,
keyNavigationNext,
keyNavigationPrevious
} = props; // Reducer init.
const [state, dispatch] = useControlledReducer$1(downshiftMultipleSelectionReducer, getInitialState(props), props);
const {
activeIndex,
selectedItems
} = state; // Refs.
const isInitialMountRef = (0,external_React_.useRef)(true);
const dropdownRef = (0,external_React_.useRef)(null);
const previousSelectedItemsRef = (0,external_React_.useRef)(selectedItems);
const selectedItemRefs = (0,external_React_.useRef)();
selectedItemRefs.current = [];
const latest = downshift_esm_useLatestRef({
state,
props
}); // Effects.
/* Sets a11y status message on changes in selectedItem. */
(0,external_React_.useEffect)(() => {
if (isInitialMountRef.current) {
return;
}
if (selectedItems.length < previousSelectedItemsRef.current.length) {
const removedSelectedItem = previousSelectedItemsRef.current.find(item => selectedItems.indexOf(item) < 0);
setStatus(getA11yRemovalMessage({
itemToString,
resultCount: selectedItems.length,
removedSelectedItem,
activeIndex,
activeSelectedItem: selectedItems[activeIndex]
}), environment.document);
}
previousSelectedItemsRef.current = selectedItems; // eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedItems.length]); // Sets focus on active item.
(0,external_React_.useEffect)(() => {
if (isInitialMountRef.current) {
return;
}
if (activeIndex === -1 && dropdownRef.current) {
dropdownRef.current.focus();
} else if (selectedItemRefs.current[activeIndex]) {
selectedItemRefs.current[activeIndex].focus();
}
}, [activeIndex]);
useControlPropsValidator({
isInitialMount: isInitialMountRef.current,
props,
state
});
const setGetterPropCallInfo = useGetterPropsCalledChecker('getDropdownProps'); // Make initial ref false.
(0,external_React_.useEffect)(() => {
isInitialMountRef.current = false;
}, []); // Event handler functions.
const selectedItemKeyDownHandlers = (0,external_React_.useMemo)(() => ({
[keyNavigationPrevious]() {
dispatch({
type: SelectedItemKeyDownNavigationPrevious
});
},
[keyNavigationNext]() {
dispatch({
type: SelectedItemKeyDownNavigationNext
});
},
Delete() {
dispatch({
type: SelectedItemKeyDownDelete
});
},
Backspace() {
dispatch({
type: SelectedItemKeyDownBackspace
});
}
}), [dispatch, keyNavigationNext, keyNavigationPrevious]);
const dropdownKeyDownHandlers = (0,external_React_.useMemo)(() => ({
[keyNavigationPrevious](event) {
if (isKeyDownOperationPermitted(event)) {
dispatch({
type: DropdownKeyDownNavigationPrevious
});
}
},
Backspace(event) {
if (isKeyDownOperationPermitted(event)) {
dispatch({
type: DropdownKeyDownBackspace
});
}
}
}), [dispatch, keyNavigationPrevious]); // Getter props.
const getSelectedItemProps = (0,external_React_.useCallback)(function (_temp) {
let {
refKey = 'ref',
ref,
onClick,
onKeyDown,
selectedItem,
index,
...rest
} = _temp === void 0 ? {} : _temp;
const {
state: latestState
} = latest.current;
const itemIndex = getItemIndex(index, selectedItem, latestState.selectedItems);
if (itemIndex < 0) {
throw new Error('Pass either selectedItem or index in getSelectedItemProps!');
}
const selectedItemHandleClick = () => {
dispatch({
type: SelectedItemClick,
index
});
};
const selectedItemHandleKeyDown = event => {
const key = normalizeArrowKey(event);
if (key && selectedItemKeyDownHandlers[key]) {
selectedItemKeyDownHandlers[key](event);
}
};
return {
[refKey]: handleRefs(ref, selectedItemNode => {
if (selectedItemNode) {
selectedItemRefs.current.push(selectedItemNode);
}
}),
tabIndex: index === latestState.activeIndex ? 0 : -1,
onClick: callAllEventHandlers(onClick, selectedItemHandleClick),
onKeyDown: callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown),
...rest
};
}, [dispatch, latest, selectedItemKeyDownHandlers]);
const getDropdownProps = (0,external_React_.useCallback)(function (_temp2, _temp3) {
let {
refKey = 'ref',
ref,
onKeyDown,
onClick,
preventKeyAction = false,
...rest
} = _temp2 === void 0 ? {} : _temp2;
let {
suppressRefError = false
} = _temp3 === void 0 ? {} : _temp3;
setGetterPropCallInfo('getDropdownProps', suppressRefError, refKey, dropdownRef);
const dropdownHandleKeyDown = event => {
const key = normalizeArrowKey(event);
if (key && dropdownKeyDownHandlers[key]) {
dropdownKeyDownHandlers[key](event);
}
};
const dropdownHandleClick = () => {
dispatch({
type: DropdownClick
});
};
return {
[refKey]: handleRefs(ref, dropdownNode => {
if (dropdownNode) {
dropdownRef.current = dropdownNode;
}
}),
...(!preventKeyAction && {
onKeyDown: callAllEventHandlers(onKeyDown, dropdownHandleKeyDown),
onClick: callAllEventHandlers(onClick, dropdownHandleClick)
}),
...rest
};
}, [dispatch, dropdownKeyDownHandlers, setGetterPropCallInfo]); // returns
const addSelectedItem = (0,external_React_.useCallback)(selectedItem => {
dispatch({
type: FunctionAddSelectedItem,
selectedItem
});
}, [dispatch]);
const removeSelectedItem = (0,external_React_.useCallback)(selectedItem => {
dispatch({
type: FunctionRemoveSelectedItem,
selectedItem
});
}, [dispatch]);
const setSelectedItems = (0,external_React_.useCallback)(newSelectedItems => {
dispatch({
type: FunctionSetSelectedItems,
selectedItems: newSelectedItems
});
}, [dispatch]);
const setActiveIndex = (0,external_React_.useCallback)(newActiveIndex => {
dispatch({
type: FunctionSetActiveIndex,
activeIndex: newActiveIndex
});
}, [dispatch]);
const reset = (0,external_React_.useCallback)(() => {
dispatch({
type: FunctionReset
});
}, [dispatch]);
return {
getSelectedItemProps,
getDropdownProps,
addSelectedItem,
removeSelectedItem,
setSelectedItems,
setActiveIndex,
reset,
selectedItems,
activeIndex
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-select-control/styles.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const backCompatMinWidth = props => !props.__nextUnconstrainedWidth ? /*#__PURE__*/emotion_react_browser_esm_css(Container, "{min-width:130px;}" + ( true ? "" : 0), true ? "" : 0) : '';
const InputBaseWithBackCompatMinWidth = /*#__PURE__*/emotion_styled_base_browser_esm(input_base, true ? {
target: "eswuck60"
} : 0)(backCompatMinWidth, ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-select-control/index.js
// @ts-nocheck
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const custom_select_control_itemToString = item => item?.name;
// This is needed so that in Windows, where
// the menu does not necessarily open on
// key up/down, you can still switch between
// options with the menu closed.
const custom_select_control_stateReducer = ({
selectedItem
}, {
type,
changes,
props: {
items
}
}) => {
switch (type) {
case useSelect.stateChangeTypes.ToggleButtonKeyDownArrowDown:
// If we already have a selected item, try to select the next one,
// without circular navigation. Otherwise, select the first item.
return {
selectedItem: items[selectedItem ? Math.min(items.indexOf(selectedItem) + 1, items.length - 1) : 0]
};
case useSelect.stateChangeTypes.ToggleButtonKeyDownArrowUp:
// If we already have a selected item, try to select the previous one,
// without circular navigation. Otherwise, select the last item.
return {
selectedItem: items[selectedItem ? Math.max(items.indexOf(selectedItem) - 1, 0) : items.length - 1]
};
default:
return changes;
}
};
function CustomSelectControl(props) {
const {
/** Start opting into the larger default height that will become the default size in a future version. */
__next40pxDefaultSize = false,
/** Start opting into the unconstrained width that will become the default in a future version. */
__nextUnconstrainedWidth = false,
className,
hideLabelFromVision,
label,
describedBy,
options: items,
onChange: onSelectedItemChange,
/** @type {import('../select-control/types').SelectControlProps.size} */
size = 'default',
value: _selectedItem,
onMouseOver,
onMouseOut,
onFocus,
onBlur,
__experimentalShowSelectedHint = false
} = useDeprecated36pxDefaultSizeProp(props);
const {
getLabelProps,
getToggleButtonProps,
getMenuProps,
getItemProps,
isOpen,
highlightedIndex,
selectedItem
} = useSelect({
initialSelectedItem: items[0],
items,
itemToString: custom_select_control_itemToString,
onSelectedItemChange,
...(typeof _selectedItem !== 'undefined' && _selectedItem !== null ? {
selectedItem: _selectedItem
} : undefined),
stateReducer: custom_select_control_stateReducer
});
const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
function handleOnFocus(e) {
setIsFocused(true);
onFocus?.(e);
}
function handleOnBlur(e) {
setIsFocused(false);
onBlur?.(e);
}
if (!__nextUnconstrainedWidth) {
external_wp_deprecated_default()('Constrained width styles for wp.components.CustomSelectControl', {
since: '6.1',
version: '6.4',
hint: 'Set the `__nextUnconstrainedWidth` prop to true to start opting into the new styles, which will become the default in a future version'
});
}
function getDescribedBy() {
if (describedBy) {
return describedBy;
}
if (!selectedItem) {
return (0,external_wp_i18n_namespaceObject.__)('No selection');
}
// translators: %s: The selected option.
return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Currently selected: %s'), selectedItem.name);
}
const menuProps = getMenuProps({
className: 'components-custom-select-control__menu',
'aria-hidden': !isOpen
});
const onKeyDownHandler = (0,external_wp_element_namespaceObject.useCallback)(e => {
e.stopPropagation();
menuProps?.onKeyDown?.(e);
}, [menuProps]);
// We need this here, because the null active descendant is not fully ARIA compliant.
if (menuProps['aria-activedescendant']?.startsWith('downshift-null')) {
delete menuProps['aria-activedescendant'];
}
return (0,external_React_.createElement)("div", {
className: classnames_default()('components-custom-select-control', className)
}, hideLabelFromVision ? (0,external_React_.createElement)(visually_hidden_component, {
as: "label",
...getLabelProps()
}, label) : /* eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for */
(0,external_React_.createElement)(StyledLabel, {
...getLabelProps({
className: 'components-custom-select-control__label'
})
}, label), (0,external_React_.createElement)(InputBaseWithBackCompatMinWidth, {
__next40pxDefaultSize: __next40pxDefaultSize,
__nextUnconstrainedWidth: __nextUnconstrainedWidth,
isFocused: isOpen || isFocused,
__unstableInputWidth: __nextUnconstrainedWidth ? undefined : 'auto',
labelPosition: __nextUnconstrainedWidth ? undefined : 'top',
size: size,
suffix: (0,external_React_.createElement)(select_control_chevron_down, null)
}, (0,external_React_.createElement)(Select, {
onMouseOver: onMouseOver,
onMouseOut: onMouseOut,
as: "button",
onFocus: handleOnFocus,
onBlur: handleOnBlur,
selectSize: size,
__next40pxDefaultSize: __next40pxDefaultSize,
...getToggleButtonProps({
// This is needed because some speech recognition software don't support `aria-labelledby`.
'aria-label': label,
'aria-labelledby': undefined,
className: 'components-custom-select-control__button',
describedBy: getDescribedBy()
})
}, custom_select_control_itemToString(selectedItem), __experimentalShowSelectedHint && selectedItem.__experimentalHint && (0,external_React_.createElement)("span", {
className: "components-custom-select-control__hint"
}, selectedItem.__experimentalHint))), (0,external_React_.createElement)("ul", {
...menuProps,
onKeyDown: onKeyDownHandler
}, isOpen && items.map((item, index) =>
// eslint-disable-next-line react/jsx-key
(0,external_React_.createElement)("li", {
...getItemProps({
item,
index,
key: item.key,
className: classnames_default()(item.className, 'components-custom-select-control__item', {
'is-highlighted': index === highlightedIndex,
'has-hint': !!item.__experimentalHint,
'is-next-40px-default-size': __next40pxDefaultSize
}),
style: item.style
})
}, item.name, item.__experimentalHint && (0,external_React_.createElement)("span", {
className: "components-custom-select-control__item-hint"
}, item.__experimentalHint), item === selectedItem && (0,external_React_.createElement)(icons_build_module_icon, {
icon: library_check,
className: "components-custom-select-control__item-icon"
})))));
}
function StableCustomSelectControl(props) {
return (0,external_React_.createElement)(CustomSelectControl, {
...props,
__experimentalShowSelectedHint: false
});
}
;// CONCATENATED MODULE: ./node_modules/use-lilius/build/index.es.js
function toInteger(dirtyNumber) {
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
return NaN;
}
var number = Number(dirtyNumber);
if (isNaN(number)) {
return number;
}
return number < 0 ? Math.ceil(number) : Math.floor(number);
}
function requiredArgs(required, args) {
if (args.length < required) {
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
}
}
/**
* @name toDate
* @category Common Helpers
* @summary Convert the given argument to an instance of Date.
*
* @description
* Convert the given argument to an instance of Date.
*
* If the argument is an instance of Date, the function returns its clone.
*
* If the argument is a number, it is treated as a timestamp.
*
* If the argument is none of the above, the function returns Invalid Date.
*
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
*
* @param {Date|Number} argument - the value to convert
* @returns {Date} the parsed date in the local time zone
* @throws {TypeError} 1 argument required
*
* @example
* // Clone the date:
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
* //=> Tue Feb 11 2014 11:30:30
*
* @example
* // Convert the timestamp to date:
* const result = toDate(1392098430000)
* //=> Tue Feb 11 2014 11:30:30
*/
function toDate(argument) {
requiredArgs(1, arguments);
var argStr = Object.prototype.toString.call(argument); // Clone the date
if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
return new Date(argument.getTime());
} else if (typeof argument === 'number' || argStr === '[object Number]') {
return new Date(argument);
} else {
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
// eslint-disable-next-line no-console
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); // eslint-disable-next-line no-console
console.warn(new Error().stack);
}
return new Date(NaN);
}
}
/**
* @name addDays
* @category Day Helpers
* @summary Add the specified number of days to the given date.
*
* @description
* Add the specified number of days to the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @returns {Date} - the new date with the days added
* @throws {TypeError} - 2 arguments required
*
* @example
* // Add 10 days to 1 September 2014:
* const result = addDays(new Date(2014, 8, 1), 10)
* //=> Thu Sep 11 2014 00:00:00
*/
function addDays(dirtyDate, dirtyAmount) {
requiredArgs(2, arguments);
var date = toDate(dirtyDate);
var amount = toInteger(dirtyAmount);
if (isNaN(amount)) {
return new Date(NaN);
}
if (!amount) {
// If 0 days, no-op to avoid changing times in the hour before end of DST
return date;
}
date.setDate(date.getDate() + amount);
return date;
}
/**
* @name addMonths
* @category Month Helpers
* @summary Add the specified number of months to the given date.
*
* @description
* Add the specified number of months to the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @returns {Date} the new date with the months added
* @throws {TypeError} 2 arguments required
*
* @example
* // Add 5 months to 1 September 2014:
* const result = addMonths(new Date(2014, 8, 1), 5)
* //=> Sun Feb 01 2015 00:00:00
*/
function addMonths(dirtyDate, dirtyAmount) {
requiredArgs(2, arguments);
var date = toDate(dirtyDate);
var amount = toInteger(dirtyAmount);
if (isNaN(amount)) {
return new Date(NaN);
}
if (!amount) {
// If 0 months, no-op to avoid changing times in the hour before end of DST
return date;
}
var dayOfMonth = date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for
// month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
// new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
// want except that dates will wrap around the end of a month, meaning that
// new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
// we'll default to the end of the desired month by adding 1 to the desired
// month and using a date of 0 to back up one day to the end of the desired
// month.
var endOfDesiredMonth = new Date(date.getTime());
endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);
var daysInMonth = endOfDesiredMonth.getDate();
if (dayOfMonth >= daysInMonth) {
// If we're already at the end of the month, then this is the correct date
// and we're done.
return endOfDesiredMonth;
} else {
// Otherwise, we now know that setting the original day-of-month value won't
// cause an overflow, so set the desired day-of-month. Note that we can't
// just set the date of `endOfDesiredMonth` because that object may have had
// its time changed in the unusual case where where a DST transition was on
// the last day of the month and its local time was in the hour skipped or
// repeated next to a DST transition. So we use `date` instead which is
// guaranteed to still have the original time.
date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
return date;
}
}
var index_es_defaultOptions = {};
function getDefaultOptions() {
return index_es_defaultOptions;
}
/**
* @name startOfWeek
* @category Week Helpers
* @summary Return the start of a week for the given date.
*
* @description
* Return the start of a week for the given date.
* The result will be in the local timezone.
*
* @param {Date|Number} date - the original date
* @param {Object} [options] - an object with options.
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @returns {Date} the start of a week
* @throws {TypeError} 1 argument required
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
*
* @example
* // The start of a week for 2 September 2014 11:55:00:
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
* //=> Sun Aug 31 2014 00:00:00
*
* @example
* // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
* //=> Mon Sep 01 2014 00:00:00
*/
function startOfWeek(dirtyDate, options) {
var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
requiredArgs(1, arguments);
var defaultOptions = getDefaultOptions();
var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
}
var date = toDate(dirtyDate);
var day = date.getDay();
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
date.setDate(date.getDate() - diff);
date.setHours(0, 0, 0, 0);
return date;
}
/**
* @name startOfDay
* @category Day Helpers
* @summary Return the start of a day for the given date.
*
* @description
* Return the start of a day for the given date.
* The result will be in the local timezone.
*
* @param {Date|Number} date - the original date
* @returns {Date} the start of a day
* @throws {TypeError} 1 argument required
*
* @example
* // The start of a day for 2 September 2014 11:55:00:
* const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Sep 02 2014 00:00:00
*/
function startOfDay(dirtyDate) {
requiredArgs(1, arguments);
var date = toDate(dirtyDate);
date.setHours(0, 0, 0, 0);
return date;
}
/**
* @name addWeeks
* @category Week Helpers
* @summary Add the specified number of weeks to the given date.
*
* @description
* Add the specified number of week to the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of weeks to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @returns {Date} the new date with the weeks added
* @throws {TypeError} 2 arguments required
*
* @example
* // Add 4 weeks to 1 September 2014:
* const result = addWeeks(new Date(2014, 8, 1), 4)
* //=> Mon Sep 29 2014 00:00:00
*/
function addWeeks(dirtyDate, dirtyAmount) {
requiredArgs(2, arguments);
var amount = toInteger(dirtyAmount);
var days = amount * 7;
return addDays(dirtyDate, days);
}
/**
* @name addYears
* @category Year Helpers
* @summary Add the specified number of years to the given date.
*
* @description
* Add the specified number of years to the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of years to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @returns {Date} the new date with the years added
* @throws {TypeError} 2 arguments required
*
* @example
* // Add 5 years to 1 September 2014:
* const result = addYears(new Date(2014, 8, 1), 5)
* //=> Sun Sep 01 2019 00:00:00
*/
function addYears(dirtyDate, dirtyAmount) {
requiredArgs(2, arguments);
var amount = toInteger(dirtyAmount);
return addMonths(dirtyDate, amount * 12);
}
/**
* @name endOfMonth
* @category Month Helpers
* @summary Return the end of a month for the given date.
*
* @description
* Return the end of a month for the given date.
* The result will be in the local timezone.
*
* @param {Date|Number} date - the original date
* @returns {Date} the end of a month
* @throws {TypeError} 1 argument required
*
* @example
* // The end of a month for 2 September 2014 11:55:00:
* const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Sep 30 2014 23:59:59.999
*/
function endOfMonth(dirtyDate) {
requiredArgs(1, arguments);
var date = toDate(dirtyDate);
var month = date.getMonth();
date.setFullYear(date.getFullYear(), month + 1, 0);
date.setHours(23, 59, 59, 999);
return date;
}
/**
* @name eachDayOfInterval
* @category Interval Helpers
* @summary Return the array of dates within the specified time interval.
*
* @description
* Return the array of dates within the specified time interval.
*
* @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
* @param {Object} [options] - an object with options.
* @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.
* @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end
* @throws {TypeError} 1 argument required
* @throws {RangeError} `options.step` must be a number greater than 1
* @throws {RangeError} The start of an interval cannot be after its end
* @throws {RangeError} Date in interval cannot be `Invalid Date`
*
* @example
* // Each day between 6 October 2014 and 10 October 2014:
* const result = eachDayOfInterval({
* start: new Date(2014, 9, 6),
* end: new Date(2014, 9, 10)
* })
* //=> [
* // Mon Oct 06 2014 00:00:00,
* // Tue Oct 07 2014 00:00:00,
* // Wed Oct 08 2014 00:00:00,
* // Thu Oct 09 2014 00:00:00,
* // Fri Oct 10 2014 00:00:00
* // ]
*/
function eachDayOfInterval(dirtyInterval, options) {
var _options$step;
requiredArgs(1, arguments);
var interval = dirtyInterval || {};
var startDate = toDate(interval.start);
var endDate = toDate(interval.end);
var endTime = endDate.getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date`
if (!(startDate.getTime() <= endTime)) {
throw new RangeError('Invalid interval');
}
var dates = [];
var currentDate = startDate;
currentDate.setHours(0, 0, 0, 0);
var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1);
if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');
while (currentDate.getTime() <= endTime) {
dates.push(toDate(currentDate));
currentDate.setDate(currentDate.getDate() + step);
currentDate.setHours(0, 0, 0, 0);
}
return dates;
}
/**
* @name eachMonthOfInterval
* @category Interval Helpers
* @summary Return the array of months within the specified time interval.
*
* @description
* Return the array of months within the specified time interval.
*
* @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
* @returns {Date[]} the array with starts of months from the month of the interval start to the month of the interval end
* @throws {TypeError} 1 argument required
* @throws {RangeError} The start of an interval cannot be after its end
* @throws {RangeError} Date in interval cannot be `Invalid Date`
*
* @example
* // Each month between 6 February 2014 and 10 August 2014:
* const result = eachMonthOfInterval({
* start: new Date(2014, 1, 6),
* end: new Date(2014, 7, 10)
* })
* //=> [
* // Sat Feb 01 2014 00:00:00,
* // Sat Mar 01 2014 00:00:00,
* // Tue Apr 01 2014 00:00:00,
* // Thu May 01 2014 00:00:00,
* // Sun Jun 01 2014 00:00:00,
* // Tue Jul 01 2014 00:00:00,
* // Fri Aug 01 2014 00:00:00
* // ]
*/
function eachMonthOfInterval(dirtyInterval) {
requiredArgs(1, arguments);
var interval = dirtyInterval || {};
var startDate = toDate(interval.start);
var endDate = toDate(interval.end);
var endTime = endDate.getTime();
var dates = []; // Throw an exception if start date is after end date or if any date is `Invalid Date`
if (!(startDate.getTime() <= endTime)) {
throw new RangeError('Invalid interval');
}
var currentDate = startDate;
currentDate.setHours(0, 0, 0, 0);
currentDate.setDate(1);
while (currentDate.getTime() <= endTime) {
dates.push(toDate(currentDate));
currentDate.setMonth(currentDate.getMonth() + 1);
}
return dates;
}
/**
* @name eachWeekOfInterval
* @category Interval Helpers
* @summary Return the array of weeks within the specified time interval.
*
* @description
* Return the array of weeks within the specified time interval.
*
* @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
* @param {Object} [options] - an object with options.
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @returns {Date[]} the array with starts of weeks from the week of the interval start to the week of the interval end
* @throws {TypeError} 1 argument required
* @throws {RangeError} `options.weekStartsOn` must be 0, 1, ..., 6
* @throws {RangeError} The start of an interval cannot be after its end
* @throws {RangeError} Date in interval cannot be `Invalid Date`
*
* @example
* // Each week within interval 6 October 2014 - 23 November 2014:
* const result = eachWeekOfInterval({
* start: new Date(2014, 9, 6),
* end: new Date(2014, 10, 23)
* })
* //=> [
* // Sun Oct 05 2014 00:00:00,
* // Sun Oct 12 2014 00:00:00,
* // Sun Oct 19 2014 00:00:00,
* // Sun Oct 26 2014 00:00:00,
* // Sun Nov 02 2014 00:00:00,
* // Sun Nov 09 2014 00:00:00,
* // Sun Nov 16 2014 00:00:00,
* // Sun Nov 23 2014 00:00:00
* // ]
*/
function eachWeekOfInterval(dirtyInterval, options) {
requiredArgs(1, arguments);
var interval = dirtyInterval || {};
var startDate = toDate(interval.start);
var endDate = toDate(interval.end);
var endTime = endDate.getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date`
if (!(startDate.getTime() <= endTime)) {
throw new RangeError('Invalid interval');
}
var startDateWeek = startOfWeek(startDate, options);
var endDateWeek = startOfWeek(endDate, options); // Some timezones switch DST at midnight, making start of day unreliable in these timezones, 3pm is a safe bet
startDateWeek.setHours(15);
endDateWeek.setHours(15);
endTime = endDateWeek.getTime();
var weeks = [];
var currentWeek = startDateWeek;
while (currentWeek.getTime() <= endTime) {
currentWeek.setHours(0);
weeks.push(toDate(currentWeek));
currentWeek = addWeeks(currentWeek, 1);
currentWeek.setHours(15);
}
return weeks;
}
/**
* @name startOfMonth
* @category Month Helpers
* @summary Return the start of a month for the given date.
*
* @description
* Return the start of a month for the given date.
* The result will be in the local timezone.
*
* @param {Date|Number} date - the original date
* @returns {Date} the start of a month
* @throws {TypeError} 1 argument required
*
* @example
* // The start of a month for 2 September 2014 11:55:00:
* const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))
* //=> Mon Sep 01 2014 00:00:00
*/
function startOfMonth(dirtyDate) {
requiredArgs(1, arguments);
var date = toDate(dirtyDate);
date.setDate(1);
date.setHours(0, 0, 0, 0);
return date;
}
/**
* @name endOfWeek
* @category Week Helpers
* @summary Return the end of a week for the given date.
*
* @description
* Return the end of a week for the given date.
* The result will be in the local timezone.
*
* @param {Date|Number} date - the original date
* @param {Object} [options] - an object with options.
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @returns {Date} the end of a week
* @throws {TypeError} 1 argument required
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
*
* @example
* // The end of a week for 2 September 2014 11:55:00:
* const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
* //=> Sat Sep 06 2014 23:59:59.999
*
* @example
* // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
* const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
* //=> Sun Sep 07 2014 23:59:59.999
*/
function endOfWeek(dirtyDate, options) {
var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
requiredArgs(1, arguments);
var defaultOptions = getDefaultOptions();
var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
}
var date = toDate(dirtyDate);
var day = date.getDay();
var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
date.setDate(date.getDate() + diff);
date.setHours(23, 59, 59, 999);
return date;
}
/**
* @name getDaysInMonth
* @category Month Helpers
* @summary Get the number of days in a month of the given date.
*
* @description
* Get the number of days in a month of the given date.
*
* @param {Date|Number} date - the given date
* @returns {Number} the number of days in a month
* @throws {TypeError} 1 argument required
*
* @example
* // How many days are in February 2000?
* const result = getDaysInMonth(new Date(2000, 1))
* //=> 29
*/
function getDaysInMonth(dirtyDate) {
requiredArgs(1, arguments);
var date = toDate(dirtyDate);
var year = date.getFullYear();
var monthIndex = date.getMonth();
var lastDayOfMonth = new Date(0);
lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
lastDayOfMonth.setHours(0, 0, 0, 0);
return lastDayOfMonth.getDate();
}
/**
* @name isAfter
* @category Common Helpers
* @summary Is the first date after the second one?
*
* @description
* Is the first date after the second one?
*
* @param {Date|Number} date - the date that should be after the other one to return true
* @param {Date|Number} dateToCompare - the date to compare with
* @returns {Boolean} the first date is after the second date
* @throws {TypeError} 2 arguments required
*
* @example
* // Is 10 July 1989 after 11 February 1987?
* const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
* //=> true
*/
function isAfter(dirtyDate, dirtyDateToCompare) {
requiredArgs(2, arguments);
var date = toDate(dirtyDate);
var dateToCompare = toDate(dirtyDateToCompare);
return date.getTime() > dateToCompare.getTime();
}
/**
* @name isBefore
* @category Common Helpers
* @summary Is the first date before the second one?
*
* @description
* Is the first date before the second one?
*
* @param {Date|Number} date - the date that should be before the other one to return true
* @param {Date|Number} dateToCompare - the date to compare with
* @returns {Boolean} the first date is before the second date
* @throws {TypeError} 2 arguments required
*
* @example
* // Is 10 July 1989 before 11 February 1987?
* const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
* //=> false
*/
function isBefore(dirtyDate, dirtyDateToCompare) {
requiredArgs(2, arguments);
var date = toDate(dirtyDate);
var dateToCompare = toDate(dirtyDateToCompare);
return date.getTime() < dateToCompare.getTime();
}
/**
* @name isEqual
* @category Common Helpers
* @summary Are the given dates equal?
*
* @description
* Are the given dates equal?
*
* @param {Date|Number} dateLeft - the first date to compare
* @param {Date|Number} dateRight - the second date to compare
* @returns {Boolean} the dates are equal
* @throws {TypeError} 2 arguments required
*
* @example
* // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?
* const result = isEqual(
* new Date(2014, 6, 2, 6, 30, 45, 0),
* new Date(2014, 6, 2, 6, 30, 45, 500)
* )
* //=> false
*/
function isEqual(dirtyLeftDate, dirtyRightDate) {
requiredArgs(2, arguments);
var dateLeft = toDate(dirtyLeftDate);
var dateRight = toDate(dirtyRightDate);
return dateLeft.getTime() === dateRight.getTime();
}
/**
* @name setMonth
* @category Month Helpers
* @summary Set the month to the given date.
*
* @description
* Set the month to the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} month - the month of the new date
* @returns {Date} the new date with the month set
* @throws {TypeError} 2 arguments required
*
* @example
* // Set February to 1 September 2014:
* const result = setMonth(new Date(2014, 8, 1), 1)
* //=> Sat Feb 01 2014 00:00:00
*/
function setMonth(dirtyDate, dirtyMonth) {
requiredArgs(2, arguments);
var date = toDate(dirtyDate);
var month = toInteger(dirtyMonth);
var year = date.getFullYear();
var day = date.getDate();
var dateWithDesiredMonth = new Date(0);
dateWithDesiredMonth.setFullYear(year, month, 15);
dateWithDesiredMonth.setHours(0, 0, 0, 0);
var daysInMonth = getDaysInMonth(dateWithDesiredMonth); // Set the last day of the new month
// if the original date was the last day of the longer month
date.setMonth(month, Math.min(day, daysInMonth));
return date;
}
/**
* @name set
* @category Common Helpers
* @summary Set date values to a given date.
*
* @description
* Set date values to a given date.
*
* Sets time values to date from object `values`.
* A value is not set if it is undefined or null or doesn't exist in `values`.
*
* Note about bundle size: `set` does not internally use `setX` functions from date-fns but instead opts
* to use native `Date#setX` methods. If you use this function, you may not want to include the
* other `setX` functions that date-fns provides if you are concerned about the bundle size.
*
* @param {Date|Number} date - the date to be changed
* @param {Object} values - an object with options
* @param {Number} [values.year] - the number of years to be set
* @param {Number} [values.month] - the number of months to be set
* @param {Number} [values.date] - the number of days to be set
* @param {Number} [values.hours] - the number of hours to be set
* @param {Number} [values.minutes] - the number of minutes to be set
* @param {Number} [values.seconds] - the number of seconds to be set
* @param {Number} [values.milliseconds] - the number of milliseconds to be set
* @returns {Date} the new date with options set
* @throws {TypeError} 2 arguments required
* @throws {RangeError} `values` must be an object
*
* @example
* // Transform 1 September 2014 into 20 October 2015 in a single line:
* const result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 })
* //=> Tue Oct 20 2015 00:00:00
*
* @example
* // Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00:
* const result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 })
* //=> Mon Sep 01 2014 12:23:45
*/
function set(dirtyDate, values) {
requiredArgs(2, arguments);
if (typeof values !== 'object' || values === null) {
throw new RangeError('values parameter must be an object');
}
var date = toDate(dirtyDate); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
if (isNaN(date.getTime())) {
return new Date(NaN);
}
if (values.year != null) {
date.setFullYear(values.year);
}
if (values.month != null) {
date = setMonth(date, values.month);
}
if (values.date != null) {
date.setDate(toInteger(values.date));
}
if (values.hours != null) {
date.setHours(toInteger(values.hours));
}
if (values.minutes != null) {
date.setMinutes(toInteger(values.minutes));
}
if (values.seconds != null) {
date.setSeconds(toInteger(values.seconds));
}
if (values.milliseconds != null) {
date.setMilliseconds(toInteger(values.milliseconds));
}
return date;
}
/**
* @name setYear
* @category Year Helpers
* @summary Set the year to the given date.
*
* @description
* Set the year to the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} year - the year of the new date
* @returns {Date} the new date with the year set
* @throws {TypeError} 2 arguments required
*
* @example
* // Set year 2013 to 1 September 2014:
* const result = setYear(new Date(2014, 8, 1), 2013)
* //=> Sun Sep 01 2013 00:00:00
*/
function setYear(dirtyDate, dirtyYear) {
requiredArgs(2, arguments);
var date = toDate(dirtyDate);
var year = toInteger(dirtyYear); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
if (isNaN(date.getTime())) {
return new Date(NaN);
}
date.setFullYear(year);
return date;
}
/**
* @name startOfToday
* @category Day Helpers
* @summary Return the start of today.
* @pure false
*
* @description
* Return the start of today.
*
* > ⚠️ Please note that this function is not present in the FP submodule as
* > it uses `Date.now()` internally hence impure and can't be safely curried.
*
* @returns {Date} the start of today
*
* @example
* // If today is 6 October 2014:
* const result = startOfToday()
* //=> Mon Oct 6 2014 00:00:00
*/
function startOfToday() {
return startOfDay(Date.now());
}
/**
* @name subMonths
* @category Month Helpers
* @summary Subtract the specified number of months from the given date.
*
* @description
* Subtract the specified number of months from the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @returns {Date} the new date with the months subtracted
* @throws {TypeError} 2 arguments required
*
* @example
* // Subtract 5 months from 1 February 2015:
* const result = subMonths(new Date(2015, 1, 1), 5)
* //=> Mon Sep 01 2014 00:00:00
*/
function subMonths(dirtyDate, dirtyAmount) {
requiredArgs(2, arguments);
var amount = toInteger(dirtyAmount);
return addMonths(dirtyDate, -amount);
}
/**
* @name subYears
* @category Year Helpers
* @summary Subtract the specified number of years from the given date.
*
* @description
* Subtract the specified number of years from the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of years to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @returns {Date} the new date with the years subtracted
* @throws {TypeError} 2 arguments required
*
* @example
* // Subtract 5 years from 1 September 2014:
* const result = subYears(new Date(2014, 8, 1), 5)
* //=> Tue Sep 01 2009 00:00:00
*/
function subYears(dirtyDate, dirtyAmount) {
requiredArgs(2, arguments);
var amount = toInteger(dirtyAmount);
return addYears(dirtyDate, -amount);
}
var Month;
(function (Month) {
Month[Month["JANUARY"] = 0] = "JANUARY";
Month[Month["FEBRUARY"] = 1] = "FEBRUARY";
Month[Month["MARCH"] = 2] = "MARCH";
Month[Month["APRIL"] = 3] = "APRIL";
Month[Month["MAY"] = 4] = "MAY";
Month[Month["JUNE"] = 5] = "JUNE";
Month[Month["JULY"] = 6] = "JULY";
Month[Month["AUGUST"] = 7] = "AUGUST";
Month[Month["SEPTEMBER"] = 8] = "SEPTEMBER";
Month[Month["OCTOBER"] = 9] = "OCTOBER";
Month[Month["NOVEMBER"] = 10] = "NOVEMBER";
Month[Month["DECEMBER"] = 11] = "DECEMBER";
})(Month || (Month = {}));
var Day;
(function (Day) {
Day[Day["SUNDAY"] = 0] = "SUNDAY";
Day[Day["MONDAY"] = 1] = "MONDAY";
Day[Day["TUESDAY"] = 2] = "TUESDAY";
Day[Day["WEDNESDAY"] = 3] = "WEDNESDAY";
Day[Day["THURSDAY"] = 4] = "THURSDAY";
Day[Day["FRIDAY"] = 5] = "FRIDAY";
Day[Day["SATURDAY"] = 6] = "SATURDAY";
})(Day || (Day = {}));
var inRange = function (date, min, max) {
return (isEqual(date, min) || isAfter(date, min)) && (isEqual(date, max) || isBefore(date, max));
};
var clearTime = function (date) { return set(date, { hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }); };
var useLilius = function (_a) {
var _b = _a === void 0 ? {} : _a, _c = _b.weekStartsOn, weekStartsOn = _c === void 0 ? Day.SUNDAY : _c, _d = _b.viewing, initialViewing = _d === void 0 ? new Date() : _d, _e = _b.selected, initialSelected = _e === void 0 ? [] : _e, _f = _b.numberOfMonths, numberOfMonths = _f === void 0 ? 1 : _f;
var _g = (0,external_React_.useState)(initialViewing), viewing = _g[0], setViewing = _g[1];
var viewToday = (0,external_React_.useCallback)(function () { return setViewing(startOfToday()); }, [setViewing]);
var viewMonth = (0,external_React_.useCallback)(function (month) { return setViewing(function (v) { return setMonth(v, month); }); }, []);
var viewPreviousMonth = (0,external_React_.useCallback)(function () { return setViewing(function (v) { return subMonths(v, 1); }); }, []);
var viewNextMonth = (0,external_React_.useCallback)(function () { return setViewing(function (v) { return addMonths(v, 1); }); }, []);
var viewYear = (0,external_React_.useCallback)(function (year) { return setViewing(function (v) { return setYear(v, year); }); }, []);
var viewPreviousYear = (0,external_React_.useCallback)(function () { return setViewing(function (v) { return subYears(v, 1); }); }, []);
var viewNextYear = (0,external_React_.useCallback)(function () { return setViewing(function (v) { return addYears(v, 1); }); }, []);
var _h = (0,external_React_.useState)(initialSelected.map(clearTime)), selected = _h[0], setSelected = _h[1];
var clearSelected = function () { return setSelected([]); };
var isSelected = (0,external_React_.useCallback)(function (date) { return selected.findIndex(function (s) { return isEqual(s, date); }) > -1; }, [selected]);
var select = (0,external_React_.useCallback)(function (date, replaceExisting) {
if (replaceExisting) {
setSelected(Array.isArray(date) ? date : [date]);
}
else {
setSelected(function (selectedItems) { return selectedItems.concat(Array.isArray(date) ? date : [date]); });
}
}, []);
var deselect = (0,external_React_.useCallback)(function (date) {
return setSelected(function (selectedItems) {
return Array.isArray(date)
? selectedItems.filter(function (s) { return !date.map(function (d) { return d.getTime(); }).includes(s.getTime()); })
: selectedItems.filter(function (s) { return !isEqual(s, date); });
});
}, []);
var toggle = (0,external_React_.useCallback)(function (date, replaceExisting) { return (isSelected(date) ? deselect(date) : select(date, replaceExisting)); }, [deselect, isSelected, select]);
var selectRange = (0,external_React_.useCallback)(function (start, end, replaceExisting) {
if (replaceExisting) {
setSelected(eachDayOfInterval({ start: start, end: end }));
}
else {
setSelected(function (selectedItems) { return selectedItems.concat(eachDayOfInterval({ start: start, end: end })); });
}
}, []);
var deselectRange = (0,external_React_.useCallback)(function (start, end) {
setSelected(function (selectedItems) {
return selectedItems.filter(function (s) {
return !eachDayOfInterval({ start: start, end: end })
.map(function (d) { return d.getTime(); })
.includes(s.getTime());
});
});
}, []);
var calendar = (0,external_React_.useMemo)(function () {
return eachMonthOfInterval({
start: startOfMonth(viewing),
end: endOfMonth(addMonths(viewing, numberOfMonths - 1)),
}).map(function (month) {
return eachWeekOfInterval({
start: startOfMonth(month),
end: endOfMonth(month),
}, { weekStartsOn: weekStartsOn }).map(function (week) {
return eachDayOfInterval({
start: startOfWeek(week, { weekStartsOn: weekStartsOn }),
end: endOfWeek(week, { weekStartsOn: weekStartsOn }),
});
});
});
}, [viewing, weekStartsOn, numberOfMonths]);
return {
clearTime: clearTime,
inRange: inRange,
viewing: viewing,
setViewing: setViewing,
viewToday: viewToday,
viewMonth: viewMonth,
viewPreviousMonth: viewPreviousMonth,
viewNextMonth: viewNextMonth,
viewYear: viewYear,
viewPreviousYear: viewPreviousYear,
viewNextYear: viewNextYear,
selected: selected,
setSelected: setSelected,
clearSelected: clearSelected,
isSelected: isSelected,
select: select,
deselect: deselect,
toggle: toggle,
selectRange: selectRange,
deselectRange: deselectRange,
calendar: calendar,
};
};
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/requiredArgs/index.js
function requiredArgs_requiredArgs(required, args) {
if (args.length < required) {
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
}
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/toDate/index.js
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/**
* @name toDate
* @category Common Helpers
* @summary Convert the given argument to an instance of Date.
*
* @description
* Convert the given argument to an instance of Date.
*
* If the argument is an instance of Date, the function returns its clone.
*
* If the argument is a number, it is treated as a timestamp.
*
* If the argument is none of the above, the function returns Invalid Date.
*
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
*
* @param {Date|Number} argument - the value to convert
* @returns {Date} the parsed date in the local time zone
* @throws {TypeError} 1 argument required
*
* @example
* // Clone the date:
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
* //=> Tue Feb 11 2014 11:30:30
*
* @example
* // Convert the timestamp to date:
* const result = toDate(1392098430000)
* //=> Tue Feb 11 2014 11:30:30
*/
function toDate_toDate(argument) {
requiredArgs_requiredArgs(1, arguments);
var argStr = Object.prototype.toString.call(argument); // Clone the date
if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
return new Date(argument.getTime());
} else if (typeof argument === 'number' || argStr === '[object Number]') {
return new Date(argument);
} else {
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
// eslint-disable-next-line no-console
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); // eslint-disable-next-line no-console
console.warn(new Error().stack);
}
return new Date(NaN);
}
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/startOfDay/index.js
/**
* @name startOfDay
* @category Day Helpers
* @summary Return the start of a day for the given date.
*
* @description
* Return the start of a day for the given date.
* The result will be in the local timezone.
*
* @param {Date|Number} date - the original date
* @returns {Date} the start of a day
* @throws {TypeError} 1 argument required
*
* @example
* // The start of a day for 2 September 2014 11:55:00:
* const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Sep 02 2014 00:00:00
*/
function startOfDay_startOfDay(dirtyDate) {
requiredArgs_requiredArgs(1, arguments);
var date = toDate_toDate(dirtyDate);
date.setHours(0, 0, 0, 0);
return date;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/toInteger/index.js
function toInteger_toInteger(dirtyNumber) {
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
return NaN;
}
var number = Number(dirtyNumber);
if (isNaN(number)) {
return number;
}
return number < 0 ? Math.ceil(number) : Math.floor(number);
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/addMonths/index.js
/**
* @name addMonths
* @category Month Helpers
* @summary Add the specified number of months to the given date.
*
* @description
* Add the specified number of months to the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @returns {Date} the new date with the months added
* @throws {TypeError} 2 arguments required
*
* @example
* // Add 5 months to 1 September 2014:
* const result = addMonths(new Date(2014, 8, 1), 5)
* //=> Sun Feb 01 2015 00:00:00
*/
function addMonths_addMonths(dirtyDate, dirtyAmount) {
requiredArgs_requiredArgs(2, arguments);
var date = toDate_toDate(dirtyDate);
var amount = toInteger_toInteger(dirtyAmount);
if (isNaN(amount)) {
return new Date(NaN);
}
if (!amount) {
// If 0 months, no-op to avoid changing times in the hour before end of DST
return date;
}
var dayOfMonth = date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for
// month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
// new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
// want except that dates will wrap around the end of a month, meaning that
// new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
// we'll default to the end of the desired month by adding 1 to the desired
// month and using a date of 0 to back up one day to the end of the desired
// month.
var endOfDesiredMonth = new Date(date.getTime());
endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);
var daysInMonth = endOfDesiredMonth.getDate();
if (dayOfMonth >= daysInMonth) {
// If we're already at the end of the month, then this is the correct date
// and we're done.
return endOfDesiredMonth;
} else {
// Otherwise, we now know that setting the original day-of-month value won't
// cause an overflow, so set the desired day-of-month. Note that we can't
// just set the date of `endOfDesiredMonth` because that object may have had
// its time changed in the unusual case where where a DST transition was on
// the last day of the month and its local time was in the hour skipped or
// repeated next to a DST transition. So we use `date` instead which is
// guaranteed to still have the original time.
date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
return date;
}
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/subMonths/index.js
/**
* @name subMonths
* @category Month Helpers
* @summary Subtract the specified number of months from the given date.
*
* @description
* Subtract the specified number of months from the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @returns {Date} the new date with the months subtracted
* @throws {TypeError} 2 arguments required
*
* @example
* // Subtract 5 months from 1 February 2015:
* const result = subMonths(new Date(2015, 1, 1), 5)
* //=> Mon Sep 01 2014 00:00:00
*/
function subMonths_subMonths(dirtyDate, dirtyAmount) {
requiredArgs_requiredArgs(2, arguments);
var amount = toInteger_toInteger(dirtyAmount);
return addMonths_addMonths(dirtyDate, -amount);
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/isDate/index.js
function isDate_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { isDate_typeof = function _typeof(obj) { return typeof obj; }; } else { isDate_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return isDate_typeof(obj); }
/**
* @name isDate
* @category Common Helpers
* @summary Is the given value a date?
*
* @description
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
*
* @param {*} value - the value to check
* @returns {boolean} true if the given value is a date
* @throws {TypeError} 1 arguments required
*
* @example
* // For a valid date:
* const result = isDate(new Date())
* //=> true
*
* @example
* // For an invalid date:
* const result = isDate(new Date(NaN))
* //=> true
*
* @example
* // For some value:
* const result = isDate('2014-02-31')
* //=> false
*
* @example
* // For an object:
* const result = isDate({})
* //=> false
*/
function isDate(value) {
requiredArgs_requiredArgs(1, arguments);
return value instanceof Date || isDate_typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/isValid/index.js
/**
* @name isValid
* @category Common Helpers
* @summary Is the given date valid?
*
* @description
* Returns false if argument is Invalid Date and true otherwise.
* Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
* Invalid Date is a Date, whose time value is NaN.
*
* Time value of Date: http://es5.github.io/#x15.9.1.1
*
* @param {*} date - the date to check
* @returns {Boolean} the date is valid
* @throws {TypeError} 1 argument required
*
* @example
* // For the valid date:
* const result = isValid(new Date(2014, 1, 31))
* //=> true
*
* @example
* // For the value, convertable into a date:
* const result = isValid(1393804800000)
* //=> true
*
* @example
* // For the invalid date:
* const result = isValid(new Date(''))
* //=> false
*/
function isValid(dirtyDate) {
requiredArgs_requiredArgs(1, arguments);
if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
return false;
}
var date = toDate_toDate(dirtyDate);
return !isNaN(Number(date));
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/addMilliseconds/index.js
/**
* @name addMilliseconds
* @category Millisecond Helpers
* @summary Add the specified number of milliseconds to the given date.
*
* @description
* Add the specified number of milliseconds to the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @returns {Date} the new date with the milliseconds added
* @throws {TypeError} 2 arguments required
*
* @example
* // Add 750 milliseconds to 10 July 2014 12:45:30.000:
* const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
* //=> Thu Jul 10 2014 12:45:30.750
*/
function addMilliseconds(dirtyDate, dirtyAmount) {
requiredArgs_requiredArgs(2, arguments);
var timestamp = toDate_toDate(dirtyDate).getTime();
var amount = toInteger_toInteger(dirtyAmount);
return new Date(timestamp + amount);
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/subMilliseconds/index.js
/**
* @name subMilliseconds
* @category Millisecond Helpers
* @summary Subtract the specified number of milliseconds from the given date.
*
* @description
* Subtract the specified number of milliseconds from the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @returns {Date} the new date with the milliseconds subtracted
* @throws {TypeError} 2 arguments required
*
* @example
* // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
* const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
* //=> Thu Jul 10 2014 12:45:29.250
*/
function subMilliseconds(dirtyDate, dirtyAmount) {
requiredArgs_requiredArgs(2, arguments);
var amount = toInteger_toInteger(dirtyAmount);
return addMilliseconds(dirtyDate, -amount);
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js
var MILLISECONDS_IN_DAY = 86400000;
function getUTCDayOfYear(dirtyDate) {
requiredArgs_requiredArgs(1, arguments);
var date = toDate_toDate(dirtyDate);
var timestamp = date.getTime();
date.setUTCMonth(0, 1);
date.setUTCHours(0, 0, 0, 0);
var startOfYearTimestamp = date.getTime();
var difference = timestamp - startOfYearTimestamp;
return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js
function startOfUTCISOWeek(dirtyDate) {
requiredArgs_requiredArgs(1, arguments);
var weekStartsOn = 1;
var date = toDate_toDate(dirtyDate);
var day = date.getUTCDay();
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
date.setUTCDate(date.getUTCDate() - diff);
date.setUTCHours(0, 0, 0, 0);
return date;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js
function getUTCISOWeekYear(dirtyDate) {
requiredArgs_requiredArgs(1, arguments);
var date = toDate_toDate(dirtyDate);
var year = date.getUTCFullYear();
var fourthOfJanuaryOfNextYear = new Date(0);
fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
var fourthOfJanuaryOfThisYear = new Date(0);
fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
if (date.getTime() >= startOfNextYear.getTime()) {
return year + 1;
} else if (date.getTime() >= startOfThisYear.getTime()) {
return year;
} else {
return year - 1;
}
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js
function startOfUTCISOWeekYear(dirtyDate) {
requiredArgs_requiredArgs(1, arguments);
var year = getUTCISOWeekYear(dirtyDate);
var fourthOfJanuary = new Date(0);
fourthOfJanuary.setUTCFullYear(year, 0, 4);
fourthOfJanuary.setUTCHours(0, 0, 0, 0);
var date = startOfUTCISOWeek(fourthOfJanuary);
return date;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js
var MILLISECONDS_IN_WEEK = 604800000;
function getUTCISOWeek(dirtyDate) {
requiredArgs_requiredArgs(1, arguments);
var date = toDate_toDate(dirtyDate);
var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
// because the number of milliseconds in a week is not constant
// (e.g. it's different in the week of the daylight saving time clock shift)
return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/defaultOptions/index.js
var defaultOptions_defaultOptions = {};
function defaultOptions_getDefaultOptions() {
return defaultOptions_defaultOptions;
}
function setDefaultOptions(newOptions) {
defaultOptions_defaultOptions = newOptions;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js
function startOfUTCWeek(dirtyDate, options) {
var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
requiredArgs_requiredArgs(1, arguments);
var defaultOptions = defaultOptions_getDefaultOptions();
var weekStartsOn = toInteger_toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
}
var date = toDate_toDate(dirtyDate);
var day = date.getUTCDay();
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
date.setUTCDate(date.getUTCDate() - diff);
date.setUTCHours(0, 0, 0, 0);
return date;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js
function getUTCWeekYear(dirtyDate, options) {
var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
requiredArgs_requiredArgs(1, arguments);
var date = toDate_toDate(dirtyDate);
var year = date.getUTCFullYear();
var defaultOptions = defaultOptions_getDefaultOptions();
var firstWeekContainsDate = toInteger_toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
}
var firstWeekOfNextYear = new Date(0);
firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
var firstWeekOfThisYear = new Date(0);
firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
if (date.getTime() >= startOfNextYear.getTime()) {
return year + 1;
} else if (date.getTime() >= startOfThisYear.getTime()) {
return year;
} else {
return year - 1;
}
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js
function startOfUTCWeekYear(dirtyDate, options) {
var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
requiredArgs_requiredArgs(1, arguments);
var defaultOptions = defaultOptions_getDefaultOptions();
var firstWeekContainsDate = toInteger_toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
var year = getUTCWeekYear(dirtyDate, options);
var firstWeek = new Date(0);
firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
firstWeek.setUTCHours(0, 0, 0, 0);
var date = startOfUTCWeek(firstWeek, options);
return date;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/getUTCWeek/index.js
var getUTCWeek_MILLISECONDS_IN_WEEK = 604800000;
function getUTCWeek(dirtyDate, options) {
requiredArgs_requiredArgs(1, arguments);
var date = toDate_toDate(dirtyDate);
var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
// because the number of milliseconds in a week is not constant
// (e.g. it's different in the week of the daylight saving time clock shift)
return Math.round(diff / getUTCWeek_MILLISECONDS_IN_WEEK) + 1;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/addLeadingZeros/index.js
function addLeadingZeros(number, targetLength) {
var sign = number < 0 ? '-' : '';
var output = Math.abs(number).toString();
while (output.length < targetLength) {
output = '0' + output;
}
return sign + output;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/format/lightFormatters/index.js
/*
* | | Unit | | Unit |
* |-----|--------------------------------|-----|--------------------------------|
* | a | AM, PM | A* | |
* | d | Day of month | D | |
* | h | Hour [1-12] | H | Hour [0-23] |
* | m | Minute | M | Month |
* | s | Second | S | Fraction of second |
* | y | Year (abs) | Y | |
*
* Letters marked by * are not implemented but reserved by Unicode standard.
*/
var formatters = {
// Year
y: function y(date, token) {
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
// | Year | y | yy | yyy | yyyy | yyyyy |
// |----------|-------|----|-------|-------|-------|
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
// | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
// | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
// | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
// | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
var year = signedYear > 0 ? signedYear : 1 - signedYear;
return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
},
// Month
M: function M(date, token) {
var month = date.getUTCMonth();
return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
},
// Day of the month
d: function d(date, token) {
return addLeadingZeros(date.getUTCDate(), token.length);
},
// AM or PM
a: function a(date, token) {
var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
switch (token) {
case 'a':
case 'aa':
return dayPeriodEnumValue.toUpperCase();
case 'aaa':
return dayPeriodEnumValue;
case 'aaaaa':
return dayPeriodEnumValue[0];
case 'aaaa':
default:
return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
}
},
// Hour [1-12]
h: function h(date, token) {
return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
},
// Hour [0-23]
H: function H(date, token) {
return addLeadingZeros(date.getUTCHours(), token.length);
},
// Minute
m: function m(date, token) {
return addLeadingZeros(date.getUTCMinutes(), token.length);
},
// Second
s: function s(date, token) {
return addLeadingZeros(date.getUTCSeconds(), token.length);
},
// Fraction of second
S: function S(date, token) {
var numberOfDigits = token.length;
var milliseconds = date.getUTCMilliseconds();
var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
return addLeadingZeros(fractionalSeconds, token.length);
}
};
/* harmony default export */ const lightFormatters = (formatters);
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/format/formatters/index.js
var dayPeriodEnum = {
am: 'am',
pm: 'pm',
midnight: 'midnight',
noon: 'noon',
morning: 'morning',
afternoon: 'afternoon',
evening: 'evening',
night: 'night'
};
/*
* | | Unit | | Unit |
* |-----|--------------------------------|-----|--------------------------------|
* | a | AM, PM | A* | Milliseconds in day |
* | b | AM, PM, noon, midnight | B | Flexible day period |
* | c | Stand-alone local day of week | C* | Localized hour w/ day period |
* | d | Day of month | D | Day of year |
* | e | Local day of week | E | Day of week |
* | f | | F* | Day of week in month |
* | g* | Modified Julian day | G | Era |
* | h | Hour [1-12] | H | Hour [0-23] |
* | i! | ISO day of week | I! | ISO week of year |
* | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
* | k | Hour [1-24] | K | Hour [0-11] |
* | l* | (deprecated) | L | Stand-alone month |
* | m | Minute | M | Month |
* | n | | N | |
* | o! | Ordinal number modifier | O | Timezone (GMT) |
* | p! | Long localized time | P! | Long localized date |
* | q | Stand-alone quarter | Q | Quarter |
* | r* | Related Gregorian year | R! | ISO week-numbering year |
* | s | Second | S | Fraction of second |
* | t! | Seconds timestamp | T! | Milliseconds timestamp |
* | u | Extended year | U* | Cyclic year |
* | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
* | w | Local week of year | W* | Week of month |
* | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
* | y | Year (abs) | Y | Local week-numbering year |
* | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
*
* Letters marked by * are not implemented but reserved by Unicode standard.
*
* Letters marked by ! are non-standard, but implemented by date-fns:
* - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
* - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
* i.e. 7 for Sunday, 1 for Monday, etc.
* - `I` is ISO week of year, as opposed to `w` which is local week of year.
* - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
* `R` is supposed to be used in conjunction with `I` and `i`
* for universal ISO week-numbering date, whereas
* `Y` is supposed to be used in conjunction with `w` and `e`
* for week-numbering date specific to the locale.
* - `P` is long localized date format
* - `p` is long localized time format
*/
var formatters_formatters = {
// Era
G: function G(date, token, localize) {
var era = date.getUTCFullYear() > 0 ? 1 : 0;
switch (token) {
// AD, BC
case 'G':
case 'GG':
case 'GGG':
return localize.era(era, {
width: 'abbreviated'
});
// A, B
case 'GGGGG':
return localize.era(era, {
width: 'narrow'
});
// Anno Domini, Before Christ
case 'GGGG':
default:
return localize.era(era, {
width: 'wide'
});
}
},
// Year
y: function y(date, token, localize) {
// Ordinal number
if (token === 'yo') {
var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
var year = signedYear > 0 ? signedYear : 1 - signedYear;
return localize.ordinalNumber(year, {
unit: 'year'
});
}
return lightFormatters.y(date, token);
},
// Local week-numbering year
Y: function Y(date, token, localize, options) {
var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
if (token === 'YY') {
var twoDigitYear = weekYear % 100;
return addLeadingZeros(twoDigitYear, 2);
} // Ordinal number
if (token === 'Yo') {
return localize.ordinalNumber(weekYear, {
unit: 'year'
});
} // Padding
return addLeadingZeros(weekYear, token.length);
},
// ISO week-numbering year
R: function R(date, token) {
var isoWeekYear = getUTCISOWeekYear(date); // Padding
return addLeadingZeros(isoWeekYear, token.length);
},
// Extended year. This is a single number designating the year of this calendar system.
// The main difference between `y` and `u` localizers are B.C. years:
// | Year | `y` | `u` |
// |------|-----|-----|
// | AC 1 | 1 | 1 |
// | BC 1 | 1 | 0 |
// | BC 2 | 2 | -1 |
// Also `yy` always returns the last two digits of a year,
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
u: function u(date, token) {
var year = date.getUTCFullYear();
return addLeadingZeros(year, token.length);
},
// Quarter
Q: function Q(date, token, localize) {
var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
switch (token) {
// 1, 2, 3, 4
case 'Q':
return String(quarter);
// 01, 02, 03, 04
case 'QQ':
return addLeadingZeros(quarter, 2);
// 1st, 2nd, 3rd, 4th
case 'Qo':
return localize.ordinalNumber(quarter, {
unit: 'quarter'
});
// Q1, Q2, Q3, Q4
case 'QQQ':
return localize.quarter(quarter, {
width: 'abbreviated',
context: 'formatting'
});
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
case 'QQQQQ':
return localize.quarter(quarter, {
width: 'narrow',
context: 'formatting'
});
// 1st quarter, 2nd quarter, ...
case 'QQQQ':
default:
return localize.quarter(quarter, {
width: 'wide',
context: 'formatting'
});
}
},
// Stand-alone quarter
q: function q(date, token, localize) {
var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
switch (token) {
// 1, 2, 3, 4
case 'q':
return String(quarter);
// 01, 02, 03, 04
case 'qq':
return addLeadingZeros(quarter, 2);
// 1st, 2nd, 3rd, 4th
case 'qo':
return localize.ordinalNumber(quarter, {
unit: 'quarter'
});
// Q1, Q2, Q3, Q4
case 'qqq':
return localize.quarter(quarter, {
width: 'abbreviated',
context: 'standalone'
});
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
case 'qqqqq':
return localize.quarter(quarter, {
width: 'narrow',
context: 'standalone'
});
// 1st quarter, 2nd quarter, ...
case 'qqqq':
default:
return localize.quarter(quarter, {
width: 'wide',
context: 'standalone'
});
}
},
// Month
M: function M(date, token, localize) {
var month = date.getUTCMonth();
switch (token) {
case 'M':
case 'MM':
return lightFormatters.M(date, token);
// 1st, 2nd, ..., 12th
case 'Mo':
return localize.ordinalNumber(month + 1, {
unit: 'month'
});
// Jan, Feb, ..., Dec
case 'MMM':
return localize.month(month, {
width: 'abbreviated',
context: 'formatting'
});
// J, F, ..., D
case 'MMMMM':
return localize.month(month, {
width: 'narrow',
context: 'formatting'
});
// January, February, ..., December
case 'MMMM':
default:
return localize.month(month, {
width: 'wide',
context: 'formatting'
});
}
},
// Stand-alone month
L: function L(date, token, localize) {
var month = date.getUTCMonth();
switch (token) {
// 1, 2, ..., 12
case 'L':
return String(month + 1);
// 01, 02, ..., 12
case 'LL':
return addLeadingZeros(month + 1, 2);
// 1st, 2nd, ..., 12th
case 'Lo':
return localize.ordinalNumber(month + 1, {
unit: 'month'
});
// Jan, Feb, ..., Dec
case 'LLL':
return localize.month(month, {
width: 'abbreviated',
context: 'standalone'
});
// J, F, ..., D
case 'LLLLL':
return localize.month(month, {
width: 'narrow',
context: 'standalone'
});
// January, February, ..., December
case 'LLLL':
default:
return localize.month(month, {
width: 'wide',
context: 'standalone'
});
}
},
// Local week of year
w: function w(date, token, localize, options) {
var week = getUTCWeek(date, options);
if (token === 'wo') {
return localize.ordinalNumber(week, {
unit: 'week'
});
}
return addLeadingZeros(week, token.length);
},
// ISO week of year
I: function I(date, token, localize) {
var isoWeek = getUTCISOWeek(date);
if (token === 'Io') {
return localize.ordinalNumber(isoWeek, {
unit: 'week'
});
}
return addLeadingZeros(isoWeek, token.length);
},
// Day of the month
d: function d(date, token, localize) {
if (token === 'do') {
return localize.ordinalNumber(date.getUTCDate(), {
unit: 'date'
});
}
return lightFormatters.d(date, token);
},
// Day of year
D: function D(date, token, localize) {
var dayOfYear = getUTCDayOfYear(date);
if (token === 'Do') {
return localize.ordinalNumber(dayOfYear, {
unit: 'dayOfYear'
});
}
return addLeadingZeros(dayOfYear, token.length);
},
// Day of week
E: function E(date, token, localize) {
var dayOfWeek = date.getUTCDay();
switch (token) {
// Tue
case 'E':
case 'EE':
case 'EEE':
return localize.day(dayOfWeek, {
width: 'abbreviated',
context: 'formatting'
});
// T
case 'EEEEE':
return localize.day(dayOfWeek, {
width: 'narrow',
context: 'formatting'
});
// Tu
case 'EEEEEE':
return localize.day(dayOfWeek, {
width: 'short',
context: 'formatting'
});
// Tuesday
case 'EEEE':
default:
return localize.day(dayOfWeek, {
width: 'wide',
context: 'formatting'
});
}
},
// Local day of week
e: function e(date, token, localize, options) {
var dayOfWeek = date.getUTCDay();
var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
switch (token) {
// Numerical value (Nth day of week with current locale or weekStartsOn)
case 'e':
return String(localDayOfWeek);
// Padded numerical value
case 'ee':
return addLeadingZeros(localDayOfWeek, 2);
// 1st, 2nd, ..., 7th
case 'eo':
return localize.ordinalNumber(localDayOfWeek, {
unit: 'day'
});
case 'eee':
return localize.day(dayOfWeek, {
width: 'abbreviated',
context: 'formatting'
});
// T
case 'eeeee':
return localize.day(dayOfWeek, {
width: 'narrow',
context: 'formatting'
});
// Tu
case 'eeeeee':
return localize.day(dayOfWeek, {
width: 'short',
context: 'formatting'
});
// Tuesday
case 'eeee':
default:
return localize.day(dayOfWeek, {
width: 'wide',
context: 'formatting'
});
}
},
// Stand-alone local day of week
c: function c(date, token, localize, options) {
var dayOfWeek = date.getUTCDay();
var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
switch (token) {
// Numerical value (same as in `e`)
case 'c':
return String(localDayOfWeek);
// Padded numerical value
case 'cc':
return addLeadingZeros(localDayOfWeek, token.length);
// 1st, 2nd, ..., 7th
case 'co':
return localize.ordinalNumber(localDayOfWeek, {
unit: 'day'
});
case 'ccc':
return localize.day(dayOfWeek, {
width: 'abbreviated',
context: 'standalone'
});
// T
case 'ccccc':
return localize.day(dayOfWeek, {
width: 'narrow',
context: 'standalone'
});
// Tu
case 'cccccc':
return localize.day(dayOfWeek, {
width: 'short',
context: 'standalone'
});
// Tuesday
case 'cccc':
default:
return localize.day(dayOfWeek, {
width: 'wide',
context: 'standalone'
});
}
},
// ISO day of week
i: function i(date, token, localize) {
var dayOfWeek = date.getUTCDay();
var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
switch (token) {
// 2
case 'i':
return String(isoDayOfWeek);
// 02
case 'ii':
return addLeadingZeros(isoDayOfWeek, token.length);
// 2nd
case 'io':
return localize.ordinalNumber(isoDayOfWeek, {
unit: 'day'
});
// Tue
case 'iii':
return localize.day(dayOfWeek, {
width: 'abbreviated',
context: 'formatting'
});
// T
case 'iiiii':
return localize.day(dayOfWeek, {
width: 'narrow',
context: 'formatting'
});
// Tu
case 'iiiiii':
return localize.day(dayOfWeek, {
width: 'short',
context: 'formatting'
});
// Tuesday
case 'iiii':
default:
return localize.day(dayOfWeek, {
width: 'wide',
context: 'formatting'
});
}
},
// AM or PM
a: function a(date, token, localize) {
var hours = date.getUTCHours();
var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
switch (token) {
case 'a':
case 'aa':
return localize.dayPeriod(dayPeriodEnumValue, {
width: 'abbreviated',
context: 'formatting'
});
case 'aaa':
return localize.dayPeriod(dayPeriodEnumValue, {
width: 'abbreviated',
context: 'formatting'
}).toLowerCase();
case 'aaaaa':
return localize.dayPeriod(dayPeriodEnumValue, {
width: 'narrow',
context: 'formatting'
});
case 'aaaa':
default:
return localize.dayPeriod(dayPeriodEnumValue, {
width: 'wide',
context: 'formatting'
});
}
},
// AM, PM, midnight, noon
b: function b(date, token, localize) {
var hours = date.getUTCHours();
var dayPeriodEnumValue;
if (hours === 12) {
dayPeriodEnumValue = dayPeriodEnum.noon;
} else if (hours === 0) {
dayPeriodEnumValue = dayPeriodEnum.midnight;
} else {
dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
}
switch (token) {
case 'b':
case 'bb':
return localize.dayPeriod(dayPeriodEnumValue, {
width: 'abbreviated',
context: 'formatting'
});
case 'bbb':
return localize.dayPeriod(dayPeriodEnumValue, {
width: 'abbreviated',
context: 'formatting'
}).toLowerCase();
case 'bbbbb':
return localize.dayPeriod(dayPeriodEnumValue, {
width: 'narrow',
context: 'formatting'
});
case 'bbbb':
default:
return localize.dayPeriod(dayPeriodEnumValue, {
width: 'wide',
context: 'formatting'
});
}
},
// in the morning, in the afternoon, in the evening, at night
B: function B(date, token, localize) {
var hours = date.getUTCHours();
var dayPeriodEnumValue;
if (hours >= 17) {
dayPeriodEnumValue = dayPeriodEnum.evening;
} else if (hours >= 12) {
dayPeriodEnumValue = dayPeriodEnum.afternoon;
} else if (hours >= 4) {
dayPeriodEnumValue = dayPeriodEnum.morning;
} else {
dayPeriodEnumValue = dayPeriodEnum.night;
}
switch (token) {
case 'B':
case 'BB':
case 'BBB':
return localize.dayPeriod(dayPeriodEnumValue, {
width: 'abbreviated',
context: 'formatting'
});
case 'BBBBB':
return localize.dayPeriod(dayPeriodEnumValue, {
width: 'narrow',
context: 'formatting'
});
case 'BBBB':
default:
return localize.dayPeriod(dayPeriodEnumValue, {
width: 'wide',
context: 'formatting'
});
}
},
// Hour [1-12]
h: function h(date, token, localize) {
if (token === 'ho') {
var hours = date.getUTCHours() % 12;
if (hours === 0) hours = 12;
return localize.ordinalNumber(hours, {
unit: 'hour'
});
}
return lightFormatters.h(date, token);
},
// Hour [0-23]
H: function H(date, token, localize) {
if (token === 'Ho') {
return localize.ordinalNumber(date.getUTCHours(), {
unit: 'hour'
});
}
return lightFormatters.H(date, token);
},
// Hour [0-11]
K: function K(date, token, localize) {
var hours = date.getUTCHours() % 12;
if (token === 'Ko') {
return localize.ordinalNumber(hours, {
unit: 'hour'
});
}
return addLeadingZeros(hours, token.length);
},
// Hour [1-24]
k: function k(date, token, localize) {
var hours = date.getUTCHours();
if (hours === 0) hours = 24;
if (token === 'ko') {
return localize.ordinalNumber(hours, {
unit: 'hour'
});
}
return addLeadingZeros(hours, token.length);
},
// Minute
m: function m(date, token, localize) {
if (token === 'mo') {
return localize.ordinalNumber(date.getUTCMinutes(), {
unit: 'minute'
});
}
return lightFormatters.m(date, token);
},
// Second
s: function s(date, token, localize) {
if (token === 'so') {
return localize.ordinalNumber(date.getUTCSeconds(), {
unit: 'second'
});
}
return lightFormatters.s(date, token);
},
// Fraction of second
S: function S(date, token) {
return lightFormatters.S(date, token);
},
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
X: function X(date, token, _localize, options) {
var originalDate = options._originalDate || date;
var timezoneOffset = originalDate.getTimezoneOffset();
if (timezoneOffset === 0) {
return 'Z';
}
switch (token) {
// Hours and optional minutes
case 'X':
return formatTimezoneWithOptionalMinutes(timezoneOffset);
// Hours, minutes and optional seconds without `:` delimiter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `XX`
case 'XXXX':
case 'XX':
// Hours and minutes without `:` delimiter
return formatTimezone(timezoneOffset);
// Hours, minutes and optional seconds with `:` delimiter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `XXX`
case 'XXXXX':
case 'XXX': // Hours and minutes with `:` delimiter
default:
return formatTimezone(timezoneOffset, ':');
}
},
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
x: function x(date, token, _localize, options) {
var originalDate = options._originalDate || date;
var timezoneOffset = originalDate.getTimezoneOffset();
switch (token) {
// Hours and optional minutes
case 'x':
return formatTimezoneWithOptionalMinutes(timezoneOffset);
// Hours, minutes and optional seconds without `:` delimiter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `xx`
case 'xxxx':
case 'xx':
// Hours and minutes without `:` delimiter
return formatTimezone(timezoneOffset);
// Hours, minutes and optional seconds with `:` delimiter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `xxx`
case 'xxxxx':
case 'xxx': // Hours and minutes with `:` delimiter
default:
return formatTimezone(timezoneOffset, ':');
}
},
// Timezone (GMT)
O: function O(date, token, _localize, options) {
var originalDate = options._originalDate || date;
var timezoneOffset = originalDate.getTimezoneOffset();
switch (token) {
// Short
case 'O':
case 'OO':
case 'OOO':
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
// Long
case 'OOOO':
default:
return 'GMT' + formatTimezone(timezoneOffset, ':');
}
},
// Timezone (specific non-location)
z: function z(date, token, _localize, options) {
var originalDate = options._originalDate || date;
var timezoneOffset = originalDate.getTimezoneOffset();
switch (token) {
// Short
case 'z':
case 'zz':
case 'zzz':
return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
// Long
case 'zzzz':
default:
return 'GMT' + formatTimezone(timezoneOffset, ':');
}
},
// Seconds timestamp
t: function t(date, token, _localize, options) {
var originalDate = options._originalDate || date;
var timestamp = Math.floor(originalDate.getTime() / 1000);
return addLeadingZeros(timestamp, token.length);
},
// Milliseconds timestamp
T: function T(date, token, _localize, options) {
var originalDate = options._originalDate || date;
var timestamp = originalDate.getTime();
return addLeadingZeros(timestamp, token.length);
}
};
function formatTimezoneShort(offset, dirtyDelimiter) {
var sign = offset > 0 ? '-' : '+';
var absOffset = Math.abs(offset);
var hours = Math.floor(absOffset / 60);
var minutes = absOffset % 60;
if (minutes === 0) {
return sign + String(hours);
}
var delimiter = dirtyDelimiter || '';
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
}
function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
if (offset % 60 === 0) {
var sign = offset > 0 ? '-' : '+';
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
}
return formatTimezone(offset, dirtyDelimiter);
}
function formatTimezone(offset, dirtyDelimiter) {
var delimiter = dirtyDelimiter || '';
var sign = offset > 0 ? '-' : '+';
var absOffset = Math.abs(offset);
var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
var minutes = addLeadingZeros(absOffset % 60, 2);
return sign + hours + delimiter + minutes;
}
/* harmony default export */ const format_formatters = (formatters_formatters);
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/format/longFormatters/index.js
var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
switch (pattern) {
case 'P':
return formatLong.date({
width: 'short'
});
case 'PP':
return formatLong.date({
width: 'medium'
});
case 'PPP':
return formatLong.date({
width: 'long'
});
case 'PPPP':
default:
return formatLong.date({
width: 'full'
});
}
};
var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
switch (pattern) {
case 'p':
return formatLong.time({
width: 'short'
});
case 'pp':
return formatLong.time({
width: 'medium'
});
case 'ppp':
return formatLong.time({
width: 'long'
});
case 'pppp':
default:
return formatLong.time({
width: 'full'
});
}
};
var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
var matchResult = pattern.match(/(P+)(p+)?/) || [];
var datePattern = matchResult[1];
var timePattern = matchResult[2];
if (!timePattern) {
return dateLongFormatter(pattern, formatLong);
}
var dateTimeFormat;
switch (datePattern) {
case 'P':
dateTimeFormat = formatLong.dateTime({
width: 'short'
});
break;
case 'PP':
dateTimeFormat = formatLong.dateTime({
width: 'medium'
});
break;
case 'PPP':
dateTimeFormat = formatLong.dateTime({
width: 'long'
});
break;
case 'PPPP':
default:
dateTimeFormat = formatLong.dateTime({
width: 'full'
});
break;
}
return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
};
var longFormatters = {
p: timeLongFormatter,
P: dateTimeLongFormatter
};
/* harmony default export */ const format_longFormatters = (longFormatters);
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js
/**
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
* They usually appear for dates that denote time before the timezones were introduced
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
* and GMT+01:00:00 after that date)
*
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
* which would lead to incorrect calculations.
*
* This function returns the timezone offset in milliseconds that takes seconds in account.
*/
function getTimezoneOffsetInMilliseconds(date) {
var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
utcDate.setUTCFullYear(date.getFullYear());
return date.getTime() - utcDate.getTime();
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/protectedTokens/index.js
var protectedDayOfYearTokens = ['D', 'DD'];
var protectedWeekYearTokens = ['YY', 'YYYY'];
function isProtectedDayOfYearToken(token) {
return protectedDayOfYearTokens.indexOf(token) !== -1;
}
function isProtectedWeekYearToken(token) {
return protectedWeekYearTokens.indexOf(token) !== -1;
}
function throwProtectedError(token, format, input) {
if (token === 'YYYY') {
throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
} else if (token === 'YY') {
throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
} else if (token === 'D') {
throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
} else if (token === 'DD') {
throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
}
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js
var formatDistanceLocale = {
lessThanXSeconds: {
one: 'less than a second',
other: 'less than {{count}} seconds'
},
xSeconds: {
one: '1 second',
other: '{{count}} seconds'
},
halfAMinute: 'half a minute',
lessThanXMinutes: {
one: 'less than a minute',
other: 'less than {{count}} minutes'
},
xMinutes: {
one: '1 minute',
other: '{{count}} minutes'
},
aboutXHours: {
one: 'about 1 hour',
other: 'about {{count}} hours'
},
xHours: {
one: '1 hour',
other: '{{count}} hours'
},
xDays: {
one: '1 day',
other: '{{count}} days'
},
aboutXWeeks: {
one: 'about 1 week',
other: 'about {{count}} weeks'
},
xWeeks: {
one: '1 week',
other: '{{count}} weeks'
},
aboutXMonths: {
one: 'about 1 month',
other: 'about {{count}} months'
},
xMonths: {
one: '1 month',
other: '{{count}} months'
},
aboutXYears: {
one: 'about 1 year',
other: 'about {{count}} years'
},
xYears: {
one: '1 year',
other: '{{count}} years'
},
overXYears: {
one: 'over 1 year',
other: 'over {{count}} years'
},
almostXYears: {
one: 'almost 1 year',
other: 'almost {{count}} years'
}
};
var formatDistance = function formatDistance(token, count, options) {
var result;
var tokenValue = formatDistanceLocale[token];
if (typeof tokenValue === 'string') {
result = tokenValue;
} else if (count === 1) {
result = tokenValue.one;
} else {
result = tokenValue.other.replace('{{count}}', count.toString());
}
if (options !== null && options !== void 0 && options.addSuffix) {
if (options.comparison && options.comparison > 0) {
return 'in ' + result;
} else {
return result + ' ago';
}
}
return result;
};
/* harmony default export */ const _lib_formatDistance = (formatDistance);
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js
function buildFormatLongFn(args) {
return function () {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
// TODO: Remove String()
var width = options.width ? String(options.width) : args.defaultWidth;
var format = args.formats[width] || args.formats[args.defaultWidth];
return format;
};
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js
var dateFormats = {
full: 'EEEE, MMMM do, y',
long: 'MMMM do, y',
medium: 'MMM d, y',
short: 'MM/dd/yyyy'
};
var timeFormats = {
full: 'h:mm:ss a zzzz',
long: 'h:mm:ss a z',
medium: 'h:mm:ss a',
short: 'h:mm a'
};
var dateTimeFormats = {
full: "{{date}} 'at' {{time}}",
long: "{{date}} 'at' {{time}}",
medium: '{{date}}, {{time}}',
short: '{{date}}, {{time}}'
};
var formatLong = {
date: buildFormatLongFn({
formats: dateFormats,
defaultWidth: 'full'
}),
time: buildFormatLongFn({
formats: timeFormats,
defaultWidth: 'full'
}),
dateTime: buildFormatLongFn({
formats: dateTimeFormats,
defaultWidth: 'full'
})
};
/* harmony default export */ const _lib_formatLong = (formatLong);
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js
var formatRelativeLocale = {
lastWeek: "'last' eeee 'at' p",
yesterday: "'yesterday at' p",
today: "'today at' p",
tomorrow: "'tomorrow at' p",
nextWeek: "eeee 'at' p",
other: 'P'
};
var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
return formatRelativeLocale[token];
};
/* harmony default export */ const _lib_formatRelative = (formatRelative);
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js
function buildLocalizeFn(args) {
return function (dirtyIndex, options) {
var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
var valuesArray;
if (context === 'formatting' && args.formattingValues) {
var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
} else {
var _defaultWidth = args.defaultWidth;
var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
valuesArray = args.values[_width] || args.values[_defaultWidth];
}
var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
return valuesArray[index];
};
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js
var eraValues = {
narrow: ['B', 'A'],
abbreviated: ['BC', 'AD'],
wide: ['Before Christ', 'Anno Domini']
};
var quarterValues = {
narrow: ['1', '2', '3', '4'],
abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
}; // Note: in English, the names of days of the week and months are capitalized.
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
// Generally, formatted dates should look like they are in the middle of a sentence,
// e.g. in Spanish language the weekdays and months should be in the lowercase.
var monthValues = {
narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
};
var dayValues = {
narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
};
var dayPeriodValues = {
narrow: {
am: 'a',
pm: 'p',
midnight: 'mi',
noon: 'n',
morning: 'morning',
afternoon: 'afternoon',
evening: 'evening',
night: 'night'
},
abbreviated: {
am: 'AM',
pm: 'PM',
midnight: 'midnight',
noon: 'noon',
morning: 'morning',
afternoon: 'afternoon',
evening: 'evening',
night: 'night'
},
wide: {
am: 'a.m.',
pm: 'p.m.',
midnight: 'midnight',
noon: 'noon',
morning: 'morning',
afternoon: 'afternoon',
evening: 'evening',
night: 'night'
}
};
var formattingDayPeriodValues = {
narrow: {
am: 'a',
pm: 'p',
midnight: 'mi',
noon: 'n',
morning: 'in the morning',
afternoon: 'in the afternoon',
evening: 'in the evening',
night: 'at night'
},
abbreviated: {
am: 'AM',
pm: 'PM',
midnight: 'midnight',
noon: 'noon',
morning: 'in the morning',
afternoon: 'in the afternoon',
evening: 'in the evening',
night: 'at night'
},
wide: {
am: 'a.m.',
pm: 'p.m.',
midnight: 'midnight',
noon: 'noon',
morning: 'in the morning',
afternoon: 'in the afternoon',
evening: 'in the evening',
night: 'at night'
}
};
var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
// if they are different for different grammatical genders,
// use `options.unit`.
//
// `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
// 'day', 'hour', 'minute', 'second'.
var rem100 = number % 100;
if (rem100 > 20 || rem100 < 10) {
switch (rem100 % 10) {
case 1:
return number + 'st';
case 2:
return number + 'nd';
case 3:
return number + 'rd';
}
}
return number + 'th';
};
var localize = {
ordinalNumber: ordinalNumber,
era: buildLocalizeFn({
values: eraValues,
defaultWidth: 'wide'
}),
quarter: buildLocalizeFn({
values: quarterValues,
defaultWidth: 'wide',
argumentCallback: function argumentCallback(quarter) {
return quarter - 1;
}
}),
month: buildLocalizeFn({
values: monthValues,
defaultWidth: 'wide'
}),
day: buildLocalizeFn({
values: dayValues,
defaultWidth: 'wide'
}),
dayPeriod: buildLocalizeFn({
values: dayPeriodValues,
defaultWidth: 'wide',
formattingValues: formattingDayPeriodValues,
defaultFormattingWidth: 'wide'
})
};
/* harmony default export */ const _lib_localize = (localize);
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js
function buildMatchFn(args) {
return function (string) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var width = options.width;
var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
var matchResult = string.match(matchPattern);
if (!matchResult) {
return null;
}
var matchedString = matchResult[0];
var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
return pattern.test(matchedString);
}) : findKey(parsePatterns, function (pattern) {
return pattern.test(matchedString);
});
var value;
value = args.valueCallback ? args.valueCallback(key) : key;
value = options.valueCallback ? options.valueCallback(value) : value;
var rest = string.slice(matchedString.length);
return {
value: value,
rest: rest
};
};
}
function findKey(object, predicate) {
for (var key in object) {
if (object.hasOwnProperty(key) && predicate(object[key])) {
return key;
}
}
return undefined;
}
function findIndex(array, predicate) {
for (var key = 0; key < array.length; key++) {
if (predicate(array[key])) {
return key;
}
}
return undefined;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js
function buildMatchPatternFn(args) {
return function (string) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var matchResult = string.match(args.matchPattern);
if (!matchResult) return null;
var matchedString = matchResult[0];
var parseResult = string.match(args.parsePattern);
if (!parseResult) return null;
var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
value = options.valueCallback ? options.valueCallback(value) : value;
var rest = string.slice(matchedString.length);
return {
value: value,
rest: rest
};
};
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/en-US/_lib/match/index.js
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
var parseOrdinalNumberPattern = /\d+/i;
var matchEraPatterns = {
narrow: /^(b|a)/i,
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
wide: /^(before christ|before common era|anno domini|common era)/i
};
var parseEraPatterns = {
any: [/^b/i, /^(a|c)/i]
};
var matchQuarterPatterns = {
narrow: /^[1234]/i,
abbreviated: /^q[1234]/i,
wide: /^[1234](th|st|nd|rd)? quarter/i
};
var parseQuarterPatterns = {
any: [/1/i, /2/i, /3/i, /4/i]
};
var matchMonthPatterns = {
narrow: /^[jfmasond]/i,
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
};
var parseMonthPatterns = {
narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
};
var matchDayPatterns = {
narrow: /^[smtwf]/i,
short: /^(su|mo|tu|we|th|fr|sa)/i,
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
};
var parseDayPatterns = {
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
};
var matchDayPeriodPatterns = {
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
};
var parseDayPeriodPatterns = {
any: {
am: /^a/i,
pm: /^p/i,
midnight: /^mi/i,
noon: /^no/i,
morning: /morning/i,
afternoon: /afternoon/i,
evening: /evening/i,
night: /night/i
}
};
var match_match = {
ordinalNumber: buildMatchPatternFn({
matchPattern: matchOrdinalNumberPattern,
parsePattern: parseOrdinalNumberPattern,
valueCallback: function valueCallback(value) {
return parseInt(value, 10);
}
}),
era: buildMatchFn({
matchPatterns: matchEraPatterns,
defaultMatchWidth: 'wide',
parsePatterns: parseEraPatterns,
defaultParseWidth: 'any'
}),
quarter: buildMatchFn({
matchPatterns: matchQuarterPatterns,
defaultMatchWidth: 'wide',
parsePatterns: parseQuarterPatterns,
defaultParseWidth: 'any',
valueCallback: function valueCallback(index) {
return index + 1;
}
}),
month: buildMatchFn({
matchPatterns: matchMonthPatterns,
defaultMatchWidth: 'wide',
parsePatterns: parseMonthPatterns,
defaultParseWidth: 'any'
}),
day: buildMatchFn({
matchPatterns: matchDayPatterns,
defaultMatchWidth: 'wide',
parsePatterns: parseDayPatterns,
defaultParseWidth: 'any'
}),
dayPeriod: buildMatchFn({
matchPatterns: matchDayPeriodPatterns,
defaultMatchWidth: 'any',
parsePatterns: parseDayPeriodPatterns,
defaultParseWidth: 'any'
})
};
/* harmony default export */ const _lib_match = (match_match);
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/en-US/index.js
/**
* @type {Locale}
* @category Locales
* @summary English locale (United States).
* @language English
* @iso-639-2 eng
* @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
* @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
*/
var locale = {
code: 'en-US',
formatDistance: _lib_formatDistance,
formatLong: _lib_formatLong,
formatRelative: _lib_formatRelative,
localize: _lib_localize,
match: _lib_match,
options: {
weekStartsOn: 0
/* Sunday */
,
firstWeekContainsDate: 1
}
};
/* harmony default export */ const en_US = (locale);
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/defaultLocale/index.js
/* harmony default export */ const defaultLocale = (en_US);
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/format/index.js
// This RegExp consists of three parts separated by `|`:
// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
// (one of the certain letters followed by `o`)
// - (\w)\1* matches any sequences of the same letter
// - '' matches two quote characters in a row
// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
// except a single quote symbol, which ends the sequence.
// Two quote characters do not end the sequence.
// If there is no matching single quote
// then the sequence will continue until the end of the string.
// - . matches any single character unmatched by previous parts of the RegExps
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
var escapedStringRegExp = /^'([^]*?)'?$/;
var doubleQuoteRegExp = /''/g;
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
/**
* @name format
* @category Common Helpers
* @summary Format the date.
*
* @description
* Return the formatted date string in the given format. The result may vary by locale.
*
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
* > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
*
* The characters wrapped between two single quotes characters (') are escaped.
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
* (see the last example)
*
* Format of the string is based on Unicode Technical Standard #35:
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
* with a few additions (see note 7 below the table).
*
* Accepted patterns:
* | Unit | Pattern | Result examples | Notes |
* |---------------------------------|---------|-----------------------------------|-------|
* | Era | G..GGG | AD, BC | |
* | | GGGG | Anno Domini, Before Christ | 2 |
* | | GGGGG | A, B | |
* | Calendar year | y | 44, 1, 1900, 2017 | 5 |
* | | yo | 44th, 1st, 0th, 17th | 5,7 |
* | | yy | 44, 01, 00, 17 | 5 |
* | | yyy | 044, 001, 1900, 2017 | 5 |
* | | yyyy | 0044, 0001, 1900, 2017 | 5 |
* | | yyyyy | ... | 3,5 |
* | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
* | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
* | | YY | 44, 01, 00, 17 | 5,8 |
* | | YYY | 044, 001, 1900, 2017 | 5 |
* | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
* | | YYYYY | ... | 3,5 |
* | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
* | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
* | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
* | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
* | | RRRRR | ... | 3,5,7 |
* | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
* | | uu | -43, 01, 1900, 2017 | 5 |
* | | uuu | -043, 001, 1900, 2017 | 5 |
* | | uuuu | -0043, 0001, 1900, 2017 | 5 |
* | | uuuuu | ... | 3,5 |
* | Quarter (formatting) | Q | 1, 2, 3, 4 | |
* | | Qo | 1st, 2nd, 3rd, 4th | 7 |
* | | QQ | 01, 02, 03, 04 | |
* | | QQQ | Q1, Q2, Q3, Q4 | |
* | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
* | | QQQQQ | 1, 2, 3, 4 | 4 |
* | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
* | | qo | 1st, 2nd, 3rd, 4th | 7 |
* | | qq | 01, 02, 03, 04 | |
* | | qqq | Q1, Q2, Q3, Q4 | |
* | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
* | | qqqqq | 1, 2, 3, 4 | 4 |
* | Month (formatting) | M | 1, 2, ..., 12 | |
* | | Mo | 1st, 2nd, ..., 12th | 7 |
* | | MM | 01, 02, ..., 12 | |
* | | MMM | Jan, Feb, ..., Dec | |
* | | MMMM | January, February, ..., December | 2 |
* | | MMMMM | J, F, ..., D | |
* | Month (stand-alone) | L | 1, 2, ..., 12 | |
* | | Lo | 1st, 2nd, ..., 12th | 7 |
* | | LL | 01, 02, ..., 12 | |
* | | LLL | Jan, Feb, ..., Dec | |
* | | LLLL | January, February, ..., December | 2 |
* | | LLLLL | J, F, ..., D | |
* | Local week of year | w | 1, 2, ..., 53 | |
* | | wo | 1st, 2nd, ..., 53th | 7 |
* | | ww | 01, 02, ..., 53 | |
* | ISO week of year | I | 1, 2, ..., 53 | 7 |
* | | Io | 1st, 2nd, ..., 53th | 7 |
* | | II | 01, 02, ..., 53 | 7 |
* | Day of month | d | 1, 2, ..., 31 | |
* | | do | 1st, 2nd, ..., 31st | 7 |
* | | dd | 01, 02, ..., 31 | |
* | Day of year | D | 1, 2, ..., 365, 366 | 9 |
* | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
* | | DD | 01, 02, ..., 365, 366 | 9 |
* | | DDD | 001, 002, ..., 365, 366 | |
* | | DDDD | ... | 3 |
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
* | | EEEEE | M, T, W, T, F, S, S | |
* | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
* | | io | 1st, 2nd, ..., 7th | 7 |
* | | ii | 01, 02, ..., 07 | 7 |
* | | iii | Mon, Tue, Wed, ..., Sun | 7 |
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
* | | iiiii | M, T, W, T, F, S, S | 7 |
* | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
* | | eo | 2nd, 3rd, ..., 1st | 7 |
* | | ee | 02, 03, ..., 01 | |
* | | eee | Mon, Tue, Wed, ..., Sun | |
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
* | | eeeee | M, T, W, T, F, S, S | |
* | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
* | | co | 2nd, 3rd, ..., 1st | 7 |
* | | cc | 02, 03, ..., 01 | |
* | | ccc | Mon, Tue, Wed, ..., Sun | |
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
* | | ccccc | M, T, W, T, F, S, S | |
* | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
* | AM, PM | a..aa | AM, PM | |
* | | aaa | am, pm | |
* | | aaaa | a.m., p.m. | 2 |
* | | aaaaa | a, p | |
* | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
* | | bbb | am, pm, noon, midnight | |
* | | bbbb | a.m., p.m., noon, midnight | 2 |
* | | bbbbb | a, p, n, mi | |
* | Flexible day period | B..BBB | at night, in the morning, ... | |
* | | BBBB | at night, in the morning, ... | 2 |
* | | BBBBB | at night, in the morning, ... | |
* | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
* | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
* | | hh | 01, 02, ..., 11, 12 | |
* | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
* | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
* | | HH | 00, 01, 02, ..., 23 | |
* | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
* | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
* | | KK | 01, 02, ..., 11, 00 | |
* | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
* | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
* | | kk | 24, 01, 02, ..., 23 | |
* | Minute | m | 0, 1, ..., 59 | |
* | | mo | 0th, 1st, ..., 59th | 7 |
* | | mm | 00, 01, ..., 59 | |
* | Second | s | 0, 1, ..., 59 | |
* | | so | 0th, 1st, ..., 59th | 7 |
* | | ss | 00, 01, ..., 59 | |
* | Fraction of second | S | 0, 1, ..., 9 | |
* | | SS | 00, 01, ..., 99 | |
* | | SSS | 000, 001, ..., 999 | |
* | | SSSS | ... | 3 |
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
* | | XX | -0800, +0530, Z | |
* | | XXX | -08:00, +05:30, Z | |
* | | XXXX | -0800, +0530, Z, +123456 | 2 |
* | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
* | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
* | | xx | -0800, +0530, +0000 | |
* | | xxx | -08:00, +05:30, +00:00 | 2 |
* | | xxxx | -0800, +0530, +0000, +123456 | |
* | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
* | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
* | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
* | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
* | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
* | Seconds timestamp | t | 512969520 | 7 |
* | | tt | ... | 3,7 |
* | Milliseconds timestamp | T | 512969520900 | 7 |
* | | TT | ... | 3,7 |
* | Long localized date | P | 04/29/1453 | 7 |
* | | PP | Apr 29, 1453 | 7 |
* | | PPP | April 29th, 1453 | 7 |
* | | PPPP | Friday, April 29th, 1453 | 2,7 |
* | Long localized time | p | 12:00 AM | 7 |
* | | pp | 12:00:00 AM | 7 |
* | | ppp | 12:00:00 AM GMT+2 | 7 |
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
* | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
* | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
* | | PPPppp | April 29th, 1453 at ... | 7 |
* | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
* Notes:
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
* are the same as "stand-alone" units, but are different in some languages.
* "Formatting" units are declined according to the rules of the language
* in the context of a date. "Stand-alone" units are always nominative singular:
*
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
*
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
*
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
* the single quote characters (see below).
* If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
* the output will be the same as default pattern for this unit, usually
* the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
* are marked with "2" in the last column of the table.
*
* `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
*
* `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
*
* `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
*
* `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
*
* `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
*
* 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
* The output will be padded with zeros to match the length of the pattern.
*
* `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
*
* 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
* These tokens represent the shortest form of the quarter.
*
* 5. The main difference between `y` and `u` patterns are B.C. years:
*
* | Year | `y` | `u` |
* |------|-----|-----|
* | AC 1 | 1 | 1 |
* | BC 1 | 1 | 0 |
* | BC 2 | 2 | -1 |
*
* Also `yy` always returns the last two digits of a year,
* while `uu` pads single digit years to 2 characters and returns other years unchanged:
*
* | Year | `yy` | `uu` |
* |------|------|------|
* | 1 | 01 | 01 |
* | 14 | 14 | 14 |
* | 376 | 76 | 376 |
* | 1453 | 53 | 1453 |
*
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
* except local week-numbering years are dependent on `options.weekStartsOn`
* and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
* and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
*
* 6. Specific non-location timezones are currently unavailable in `date-fns`,
* so right now these tokens fall back to GMT timezones.
*
* 7. These patterns are not in the Unicode Technical Standard #35:
* - `i`: ISO day of week
* - `I`: ISO week of year
* - `R`: ISO week-numbering year
* - `t`: seconds timestamp
* - `T`: milliseconds timestamp
* - `o`: ordinal number modifier
* - `P`: long localized date
* - `p`: long localized time
*
* 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
*
* 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
*
* @param {Date|Number} date - the original date
* @param {String} format - the string of tokens
* @param {Object} [options] - an object with options.
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
* @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
* see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
* see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @returns {String} the formatted date string
* @throws {TypeError} 2 arguments required
* @throws {RangeError} `date` must not be Invalid Date
* @throws {RangeError} `options.locale` must contain `localize` property
* @throws {RangeError} `options.locale` must contain `formatLong` property
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
* @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
* @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @throws {RangeError} format string contains an unescaped latin alphabet character
*
* @example
* // Represent 11 February 2014 in middle-endian format:
* const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
* //=> '02/11/2014'
*
* @example
* // Represent 2 July 2014 in Esperanto:
* import { eoLocale } from 'date-fns/locale/eo'
* const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
* locale: eoLocale
* })
* //=> '2-a de julio 2014'
*
* @example
* // Escape string by single quote characters:
* const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
* //=> "3 o'clock"
*/
function format(dirtyDate, dirtyFormatStr, options) {
var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
requiredArgs_requiredArgs(2, arguments);
var formatStr = String(dirtyFormatStr);
var defaultOptions = defaultOptions_getDefaultOptions();
var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
var firstWeekContainsDate = toInteger_toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
}
var weekStartsOn = toInteger_toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
}
if (!locale.localize) {
throw new RangeError('locale must contain localize property');
}
if (!locale.formatLong) {
throw new RangeError('locale must contain formatLong property');
}
var originalDate = toDate_toDate(dirtyDate);
if (!isValid(originalDate)) {
throw new RangeError('Invalid time value');
} // Convert the date in system timezone to the same date in UTC+00:00 timezone.
// This ensures that when UTC functions will be implemented, locales will be compatible with them.
// See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
var utcDate = subMilliseconds(originalDate, timezoneOffset);
var formatterOptions = {
firstWeekContainsDate: firstWeekContainsDate,
weekStartsOn: weekStartsOn,
locale: locale,
_originalDate: originalDate
};
var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
var firstCharacter = substring[0];
if (firstCharacter === 'p' || firstCharacter === 'P') {
var longFormatter = format_longFormatters[firstCharacter];
return longFormatter(substring, locale.formatLong);
}
return substring;
}).join('').match(formattingTokensRegExp).map(function (substring) {
// Replace two single quote characters with one single quote character
if (substring === "''") {
return "'";
}
var firstCharacter = substring[0];
if (firstCharacter === "'") {
return cleanEscapedString(substring);
}
var formatter = format_formatters[firstCharacter];
if (formatter) {
if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
}
if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
}
return formatter(utcDate, substring, locale.localize, formatterOptions);
}
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
}
return substring;
}).join('');
return result;
}
function cleanEscapedString(input) {
var matched = input.match(escapedStringRegExp);
if (!matched) {
return input;
}
return matched[1].replace(doubleQuoteRegExp, "'");
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/isSameMonth/index.js
/**
* @name isSameMonth
* @category Month Helpers
* @summary Are the given dates in the same month (and year)?
*
* @description
* Are the given dates in the same month (and year)?
*
* @param {Date|Number} dateLeft - the first date to check
* @param {Date|Number} dateRight - the second date to check
* @returns {Boolean} the dates are in the same month (and year)
* @throws {TypeError} 2 arguments required
*
* @example
* // Are 2 September 2014 and 25 September 2014 in the same month?
* const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))
* //=> true
*
* @example
* // Are 2 September 2014 and 25 September 2015 in the same month?
* const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25))
* //=> false
*/
function isSameMonth(dirtyDateLeft, dirtyDateRight) {
requiredArgs_requiredArgs(2, arguments);
var dateLeft = toDate_toDate(dirtyDateLeft);
var dateRight = toDate_toDate(dirtyDateRight);
return dateLeft.getFullYear() === dateRight.getFullYear() && dateLeft.getMonth() === dateRight.getMonth();
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/isEqual/index.js
/**
* @name isEqual
* @category Common Helpers
* @summary Are the given dates equal?
*
* @description
* Are the given dates equal?
*
* @param {Date|Number} dateLeft - the first date to compare
* @param {Date|Number} dateRight - the second date to compare
* @returns {Boolean} the dates are equal
* @throws {TypeError} 2 arguments required
*
* @example
* // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?
* const result = isEqual(
* new Date(2014, 6, 2, 6, 30, 45, 0),
* new Date(2014, 6, 2, 6, 30, 45, 500)
* )
* //=> false
*/
function isEqual_isEqual(dirtyLeftDate, dirtyRightDate) {
requiredArgs_requiredArgs(2, arguments);
var dateLeft = toDate_toDate(dirtyLeftDate);
var dateRight = toDate_toDate(dirtyRightDate);
return dateLeft.getTime() === dateRight.getTime();
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/isSameDay/index.js
/**
* @name isSameDay
* @category Day Helpers
* @summary Are the given dates in the same day (and year and month)?
*
* @description
* Are the given dates in the same day (and year and month)?
*
* @param {Date|Number} dateLeft - the first date to check
* @param {Date|Number} dateRight - the second date to check
* @returns {Boolean} the dates are in the same day (and year and month)
* @throws {TypeError} 2 arguments required
*
* @example
* // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?
* const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))
* //=> true
*
* @example
* // Are 4 September and 4 October in the same day?
* const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))
* //=> false
*
* @example
* // Are 4 September, 2014 and 4 September, 2015 in the same day?
* const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))
* //=> false
*/
function isSameDay(dirtyDateLeft, dirtyDateRight) {
requiredArgs_requiredArgs(2, arguments);
var dateLeftStartOfDay = startOfDay_startOfDay(dirtyDateLeft);
var dateRightStartOfDay = startOfDay_startOfDay(dirtyDateRight);
return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime();
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/addDays/index.js
/**
* @name addDays
* @category Day Helpers
* @summary Add the specified number of days to the given date.
*
* @description
* Add the specified number of days to the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @returns {Date} - the new date with the days added
* @throws {TypeError} - 2 arguments required
*
* @example
* // Add 10 days to 1 September 2014:
* const result = addDays(new Date(2014, 8, 1), 10)
* //=> Thu Sep 11 2014 00:00:00
*/
function addDays_addDays(dirtyDate, dirtyAmount) {
requiredArgs_requiredArgs(2, arguments);
var date = toDate_toDate(dirtyDate);
var amount = toInteger_toInteger(dirtyAmount);
if (isNaN(amount)) {
return new Date(NaN);
}
if (!amount) {
// If 0 days, no-op to avoid changing times in the hour before end of DST
return date;
}
date.setDate(date.getDate() + amount);
return date;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/addWeeks/index.js
/**
* @name addWeeks
* @category Week Helpers
* @summary Add the specified number of weeks to the given date.
*
* @description
* Add the specified number of week to the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of weeks to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @returns {Date} the new date with the weeks added
* @throws {TypeError} 2 arguments required
*
* @example
* // Add 4 weeks to 1 September 2014:
* const result = addWeeks(new Date(2014, 8, 1), 4)
* //=> Mon Sep 29 2014 00:00:00
*/
function addWeeks_addWeeks(dirtyDate, dirtyAmount) {
requiredArgs_requiredArgs(2, arguments);
var amount = toInteger_toInteger(dirtyAmount);
var days = amount * 7;
return addDays_addDays(dirtyDate, days);
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/subWeeks/index.js
/**
* @name subWeeks
* @category Week Helpers
* @summary Subtract the specified number of weeks from the given date.
*
* @description
* Subtract the specified number of weeks from the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} amount - the amount of weeks to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
* @returns {Date} the new date with the weeks subtracted
* @throws {TypeError} 2 arguments required
*
* @example
* // Subtract 4 weeks from 1 September 2014:
* const result = subWeeks(new Date(2014, 8, 1), 4)
* //=> Mon Aug 04 2014 00:00:00
*/
function subWeeks(dirtyDate, dirtyAmount) {
requiredArgs_requiredArgs(2, arguments);
var amount = toInteger_toInteger(dirtyAmount);
return addWeeks_addWeeks(dirtyDate, -amount);
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/startOfWeek/index.js
/**
* @name startOfWeek
* @category Week Helpers
* @summary Return the start of a week for the given date.
*
* @description
* Return the start of a week for the given date.
* The result will be in the local timezone.
*
* @param {Date|Number} date - the original date
* @param {Object} [options] - an object with options.
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @returns {Date} the start of a week
* @throws {TypeError} 1 argument required
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
*
* @example
* // The start of a week for 2 September 2014 11:55:00:
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
* //=> Sun Aug 31 2014 00:00:00
*
* @example
* // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
* const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
* //=> Mon Sep 01 2014 00:00:00
*/
function startOfWeek_startOfWeek(dirtyDate, options) {
var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
requiredArgs_requiredArgs(1, arguments);
var defaultOptions = defaultOptions_getDefaultOptions();
var weekStartsOn = toInteger_toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
}
var date = toDate_toDate(dirtyDate);
var day = date.getDay();
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
date.setDate(date.getDate() - diff);
date.setHours(0, 0, 0, 0);
return date;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/endOfWeek/index.js
/**
* @name endOfWeek
* @category Week Helpers
* @summary Return the end of a week for the given date.
*
* @description
* Return the end of a week for the given date.
* The result will be in the local timezone.
*
* @param {Date|Number} date - the original date
* @param {Object} [options] - an object with options.
* @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
* @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @returns {Date} the end of a week
* @throws {TypeError} 1 argument required
* @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
*
* @example
* // The end of a week for 2 September 2014 11:55:00:
* const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
* //=> Sat Sep 06 2014 23:59:59.999
*
* @example
* // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
* const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
* //=> Sun Sep 07 2014 23:59:59.999
*/
function endOfWeek_endOfWeek(dirtyDate, options) {
var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
requiredArgs_requiredArgs(1, arguments);
var defaultOptions = defaultOptions_getDefaultOptions();
var weekStartsOn = toInteger_toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
}
var date = toDate_toDate(dirtyDate);
var day = date.getDay();
var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
date.setDate(date.getDate() + diff);
date.setHours(23, 59, 59, 999);
return date;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-right.js
/**
* WordPress dependencies
*/
const arrowRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"
}));
/* harmony default export */ const arrow_right = (arrowRight);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js
/**
* WordPress dependencies
*/
const arrowLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z"
}));
/* harmony default export */ const arrow_left = (arrowLeft);
;// CONCATENATED MODULE: external ["wp","date"]
const external_wp_date_namespaceObject = window["wp"]["date"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/date/styles.js
function date_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const styles_Wrapper = emotion_styled_base_browser_esm("div", true ? {
target: "e105ri6r5"
} : 0)( true ? {
name: "1khn195",
styles: "box-sizing:border-box"
} : 0);
const Navigator = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? {
target: "e105ri6r4"
} : 0)("margin-bottom:", space(4), ";" + ( true ? "" : 0));
const NavigatorHeading = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? {
target: "e105ri6r3"
} : 0)("font-size:", config_values.fontSize, ";font-weight:", config_values.fontWeight, ";strong{font-weight:", config_values.fontWeightHeading, ";}" + ( true ? "" : 0));
const Calendar = emotion_styled_base_browser_esm("div", true ? {
target: "e105ri6r2"
} : 0)("column-gap:", space(2), ";display:grid;grid-template-columns:0.5fr repeat( 5, 1fr ) 0.5fr;justify-items:center;row-gap:", space(2), ";" + ( true ? "" : 0));
const DayOfWeek = emotion_styled_base_browser_esm("div", true ? {
target: "e105ri6r1"
} : 0)("color:", COLORS.gray[700], ";font-size:", config_values.fontSize, ";line-height:", config_values.fontLineHeightBase, ";&:nth-of-type( 1 ){justify-self:start;}&:nth-of-type( 7 ){justify-self:end;}" + ( true ? "" : 0));
const DayButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
shouldForwardProp: prop => !['column', 'isSelected', 'isToday', 'hasEvents'].includes(prop),
target: "e105ri6r0"
} : 0)("grid-column:", props => props.column, ";position:relative;justify-content:center;", props => props.column === 1 && `
justify-self: start;
`, " ", props => props.column === 7 && `
justify-self: end;
`, " ", props => props.disabled && `
pointer-events: none;
`, " &&&{border-radius:100%;height:", space(7), ";width:", space(7), ";", props => props.isSelected && `
background: ${COLORS.theme.accent};
color: ${COLORS.white};
`, " ", props => !props.isSelected && props.isToday && `
background: ${COLORS.gray[200]};
`, ";}", props => props.hasEvents && `
::before {
background: ${props.isSelected ? COLORS.white : COLORS.theme.accent};
border-radius: 2px;
bottom: 2px;
content: " ";
height: 4px;
left: 50%;
margin-left: -2px;
position: absolute;
width: 4px;
}
`, ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/utils.js
/**
* External dependencies
*/
/**
* Like date-fn's toDate, but tries to guess the format when a string is
* given.
*
* @param input Value to turn into a date.
*/
function inputToDate(input) {
if (typeof input === 'string') {
return new Date(input);
}
return toDate_toDate(input);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/constants.js
const TIMEZONELESS_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/date/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* DatePicker is a React component that renders a calendar for date selection.
*
* ```jsx
* import { DatePicker } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyDatePicker = () => {
* const [ date, setDate ] = useState( new Date() );
*
* return (
* <DatePicker
* currentDate={ date }
* onChange={ ( newDate ) => setDate( newDate ) }
* />
* );
* };
* ```
*/
function DatePicker({
currentDate,
onChange,
events = [],
isInvalidDate,
onMonthPreviewed,
startOfWeek: weekStartsOn = 0
}) {
const date = currentDate ? inputToDate(currentDate) : new Date();
const {
calendar,
viewing,
setSelected,
setViewing,
isSelected,
viewPreviousMonth,
viewNextMonth
} = useLilius({
selected: [startOfDay_startOfDay(date)],
viewing: startOfDay_startOfDay(date),
weekStartsOn
});
// Used to implement a roving tab index. Tracks the day that receives focus
// when the user tabs into the calendar.
const [focusable, setFocusable] = (0,external_wp_element_namespaceObject.useState)(startOfDay_startOfDay(date));
// Allows us to only programmatically focus() a day when focus was already
// within the calendar. This stops us stealing focus from e.g. a TimePicker
// input.
const [isFocusWithinCalendar, setIsFocusWithinCalendar] = (0,external_wp_element_namespaceObject.useState)(false);
// Update internal state when currentDate prop changes.
const [prevCurrentDate, setPrevCurrentDate] = (0,external_wp_element_namespaceObject.useState)(currentDate);
if (currentDate !== prevCurrentDate) {
setPrevCurrentDate(currentDate);
setSelected([startOfDay_startOfDay(date)]);
setViewing(startOfDay_startOfDay(date));
setFocusable(startOfDay_startOfDay(date));
}
return (0,external_React_.createElement)(styles_Wrapper, {
className: "components-datetime__date",
role: "application",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Calendar')
}, (0,external_React_.createElement)(Navigator, null, (0,external_React_.createElement)(build_module_button, {
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? arrow_right : arrow_left,
variant: "tertiary",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('View previous month'),
onClick: () => {
viewPreviousMonth();
setFocusable(subMonths_subMonths(focusable, 1));
onMonthPreviewed?.(format(subMonths_subMonths(viewing, 1), TIMEZONELESS_FORMAT));
}
}), (0,external_React_.createElement)(NavigatorHeading, {
level: 3
}, (0,external_React_.createElement)("strong", null, (0,external_wp_date_namespaceObject.dateI18n)('F', viewing, -viewing.getTimezoneOffset())), ' ', (0,external_wp_date_namespaceObject.dateI18n)('Y', viewing, -viewing.getTimezoneOffset())), (0,external_React_.createElement)(build_module_button, {
icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? arrow_left : arrow_right,
variant: "tertiary",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('View next month'),
onClick: () => {
viewNextMonth();
setFocusable(addMonths_addMonths(focusable, 1));
onMonthPreviewed?.(format(addMonths_addMonths(viewing, 1), TIMEZONELESS_FORMAT));
}
})), (0,external_React_.createElement)(Calendar, {
onFocus: () => setIsFocusWithinCalendar(true),
onBlur: () => setIsFocusWithinCalendar(false)
}, calendar[0][0].map(day => (0,external_React_.createElement)(DayOfWeek, {
key: day.toString()
}, (0,external_wp_date_namespaceObject.dateI18n)('D', day, -day.getTimezoneOffset()))), calendar[0].map(week => week.map((day, index) => {
if (!isSameMonth(day, viewing)) {
return null;
}
return (0,external_React_.createElement)(date_Day, {
key: day.toString(),
day: day,
column: index + 1,
isSelected: isSelected(day),
isFocusable: isEqual_isEqual(day, focusable),
isFocusAllowed: isFocusWithinCalendar,
isToday: isSameDay(day, new Date()),
isInvalid: isInvalidDate ? isInvalidDate(day) : false,
numEvents: events.filter(event => isSameDay(event.date, day)).length,
onClick: () => {
setSelected([day]);
setFocusable(day);
onChange?.(format(
// Don't change the selected date's time fields.
new Date(day.getFullYear(), day.getMonth(), day.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()), TIMEZONELESS_FORMAT));
},
onKeyDown: event => {
let nextFocusable;
if (event.key === 'ArrowLeft') {
nextFocusable = addDays_addDays(day, (0,external_wp_i18n_namespaceObject.isRTL)() ? 1 : -1);
}
if (event.key === 'ArrowRight') {
nextFocusable = addDays_addDays(day, (0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1);
}
if (event.key === 'ArrowUp') {
nextFocusable = subWeeks(day, 1);
}
if (event.key === 'ArrowDown') {
nextFocusable = addWeeks_addWeeks(day, 1);
}
if (event.key === 'PageUp') {
nextFocusable = subMonths_subMonths(day, 1);
}
if (event.key === 'PageDown') {
nextFocusable = addMonths_addMonths(day, 1);
}
if (event.key === 'Home') {
nextFocusable = startOfWeek_startOfWeek(day);
}
if (event.key === 'End') {
nextFocusable = startOfDay_startOfDay(endOfWeek_endOfWeek(day));
}
if (nextFocusable) {
event.preventDefault();
setFocusable(nextFocusable);
if (!isSameMonth(nextFocusable, viewing)) {
setViewing(nextFocusable);
onMonthPreviewed?.(format(nextFocusable, TIMEZONELESS_FORMAT));
}
}
}
});
}))));
}
function date_Day({
day,
column,
isSelected,
isFocusable,
isFocusAllowed,
isToday,
isInvalid,
numEvents,
onClick,
onKeyDown
}) {
const ref = (0,external_wp_element_namespaceObject.useRef)();
// Focus the day when it becomes focusable, e.g. because an arrow key is
// pressed. Only do this if focus is allowed - this stops us stealing focus
// from e.g. a TimePicker input.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (ref.current && isFocusable && isFocusAllowed) {
ref.current.focus();
}
// isFocusAllowed is not a dep as there is no point calling focus() on
// an already focused element.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isFocusable]);
return (0,external_React_.createElement)(DayButton, {
ref: ref,
className: "components-datetime__date__day" // Unused, for backwards compatibility.
,
disabled: isInvalid,
tabIndex: isFocusable ? 0 : -1,
"aria-label": getDayLabel(day, isSelected, numEvents),
column: column,
isSelected: isSelected,
isToday: isToday,
hasEvents: numEvents > 0,
onClick: onClick,
onKeyDown: onKeyDown
}, (0,external_wp_date_namespaceObject.dateI18n)('j', day, -day.getTimezoneOffset()));
}
function getDayLabel(date, isSelected, numEvents) {
const {
formats
} = (0,external_wp_date_namespaceObject.getSettings)();
const localizedDate = (0,external_wp_date_namespaceObject.dateI18n)(formats.date, date, -date.getTimezoneOffset());
if (isSelected && numEvents > 0) {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: The calendar date. 2: Number of events on the calendar date.
(0,external_wp_i18n_namespaceObject._n)('%1$s. Selected. There is %2$d event', '%1$s. Selected. There are %2$d events', numEvents), localizedDate, numEvents);
} else if (isSelected) {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The calendar date.
(0,external_wp_i18n_namespaceObject.__)('%1$s. Selected'), localizedDate);
} else if (numEvents > 0) {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: The calendar date. 2: Number of events on the calendar date.
(0,external_wp_i18n_namespaceObject._n)('%1$s. There is %2$d event', '%1$s. There are %2$d events', numEvents), localizedDate, numEvents);
}
return localizedDate;
}
/* harmony default export */ const date = (DatePicker);
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/startOfMinute/index.js
/**
* @name startOfMinute
* @category Minute Helpers
* @summary Return the start of a minute for the given date.
*
* @description
* Return the start of a minute for the given date.
* The result will be in the local timezone.
*
* @param {Date|Number} date - the original date
* @returns {Date} the start of a minute
* @throws {TypeError} 1 argument required
*
* @example
* // The start of a minute for 1 December 2014 22:15:45.400:
* const result = startOfMinute(new Date(2014, 11, 1, 22, 15, 45, 400))
* //=> Mon Dec 01 2014 22:15:00
*/
function startOfMinute(dirtyDate) {
requiredArgs_requiredArgs(1, arguments);
var date = toDate_toDate(dirtyDate);
date.setSeconds(0, 0);
return date;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/getDaysInMonth/index.js
/**
* @name getDaysInMonth
* @category Month Helpers
* @summary Get the number of days in a month of the given date.
*
* @description
* Get the number of days in a month of the given date.
*
* @param {Date|Number} date - the given date
* @returns {Number} the number of days in a month
* @throws {TypeError} 1 argument required
*
* @example
* // How many days are in February 2000?
* const result = getDaysInMonth(new Date(2000, 1))
* //=> 29
*/
function getDaysInMonth_getDaysInMonth(dirtyDate) {
requiredArgs_requiredArgs(1, arguments);
var date = toDate_toDate(dirtyDate);
var year = date.getFullYear();
var monthIndex = date.getMonth();
var lastDayOfMonth = new Date(0);
lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
lastDayOfMonth.setHours(0, 0, 0, 0);
return lastDayOfMonth.getDate();
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/setMonth/index.js
/**
* @name setMonth
* @category Month Helpers
* @summary Set the month to the given date.
*
* @description
* Set the month to the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} month - the month of the new date
* @returns {Date} the new date with the month set
* @throws {TypeError} 2 arguments required
*
* @example
* // Set February to 1 September 2014:
* const result = setMonth(new Date(2014, 8, 1), 1)
* //=> Sat Feb 01 2014 00:00:00
*/
function setMonth_setMonth(dirtyDate, dirtyMonth) {
requiredArgs_requiredArgs(2, arguments);
var date = toDate_toDate(dirtyDate);
var month = toInteger_toInteger(dirtyMonth);
var year = date.getFullYear();
var day = date.getDate();
var dateWithDesiredMonth = new Date(0);
dateWithDesiredMonth.setFullYear(year, month, 15);
dateWithDesiredMonth.setHours(0, 0, 0, 0);
var daysInMonth = getDaysInMonth_getDaysInMonth(dateWithDesiredMonth); // Set the last day of the new month
// if the original date was the last day of the longer month
date.setMonth(month, Math.min(day, daysInMonth));
return date;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/set/index.js
function set_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { set_typeof = function _typeof(obj) { return typeof obj; }; } else { set_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return set_typeof(obj); }
/**
* @name set
* @category Common Helpers
* @summary Set date values to a given date.
*
* @description
* Set date values to a given date.
*
* Sets time values to date from object `values`.
* A value is not set if it is undefined or null or doesn't exist in `values`.
*
* Note about bundle size: `set` does not internally use `setX` functions from date-fns but instead opts
* to use native `Date#setX` methods. If you use this function, you may not want to include the
* other `setX` functions that date-fns provides if you are concerned about the bundle size.
*
* @param {Date|Number} date - the date to be changed
* @param {Object} values - an object with options
* @param {Number} [values.year] - the number of years to be set
* @param {Number} [values.month] - the number of months to be set
* @param {Number} [values.date] - the number of days to be set
* @param {Number} [values.hours] - the number of hours to be set
* @param {Number} [values.minutes] - the number of minutes to be set
* @param {Number} [values.seconds] - the number of seconds to be set
* @param {Number} [values.milliseconds] - the number of milliseconds to be set
* @returns {Date} the new date with options set
* @throws {TypeError} 2 arguments required
* @throws {RangeError} `values` must be an object
*
* @example
* // Transform 1 September 2014 into 20 October 2015 in a single line:
* const result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 })
* //=> Tue Oct 20 2015 00:00:00
*
* @example
* // Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00:
* const result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 })
* //=> Mon Sep 01 2014 12:23:45
*/
function set_set(dirtyDate, values) {
requiredArgs_requiredArgs(2, arguments);
if (set_typeof(values) !== 'object' || values === null) {
throw new RangeError('values parameter must be an object');
}
var date = toDate_toDate(dirtyDate); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
if (isNaN(date.getTime())) {
return new Date(NaN);
}
if (values.year != null) {
date.setFullYear(values.year);
}
if (values.month != null) {
date = setMonth_setMonth(date, values.month);
}
if (values.date != null) {
date.setDate(toInteger_toInteger(values.date));
}
if (values.hours != null) {
date.setHours(toInteger_toInteger(values.hours));
}
if (values.minutes != null) {
date.setMinutes(toInteger_toInteger(values.minutes));
}
if (values.seconds != null) {
date.setSeconds(toInteger_toInteger(values.seconds));
}
if (values.milliseconds != null) {
date.setMilliseconds(toInteger_toInteger(values.milliseconds));
}
return date;
}
;// CONCATENATED MODULE: ./node_modules/date-fns/esm/setHours/index.js
/**
* @name setHours
* @category Hour Helpers
* @summary Set the hours to the given date.
*
* @description
* Set the hours to the given date.
*
* @param {Date|Number} date - the date to be changed
* @param {Number} hours - the hours of the new date
* @returns {Date} the new date with the hours set
* @throws {TypeError} 2 arguments required
*
* @example
* // Set 4 hours to 1 September 2014 11:30:00:
* const result = setHours(new Date(2014, 8, 1, 11, 30), 4)
* //=> Mon Sep 01 2014 04:30:00
*/
function setHours(dirtyDate, dirtyHours) {
requiredArgs_requiredArgs(2, arguments);
var date = toDate_toDate(dirtyDate);
var hours = toInteger_toInteger(dirtyHours);
date.setHours(hours);
return date;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/time/styles.js
function time_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const time_styles_Wrapper = emotion_styled_base_browser_esm("div", true ? {
target: "evcr2319"
} : 0)("box-sizing:border-box;font-size:", config_values.fontSize, ";" + ( true ? "" : 0));
const Fieldset = emotion_styled_base_browser_esm("fieldset", true ? {
target: "evcr2318"
} : 0)("border:0;margin:0 0 ", space(2 * 2), " 0;padding:0;&:last-child{margin-bottom:0;}" + ( true ? "" : 0));
const TimeWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "evcr2317"
} : 0)( true ? {
name: "pd0mhc",
styles: "direction:ltr;display:flex"
} : 0);
const baseInput = /*#__PURE__*/emotion_react_browser_esm_css("&&& ", Input, "{padding-left:", space(2), ";padding-right:", space(2), ";text-align:center;}" + ( true ? "" : 0), true ? "" : 0);
const HoursInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
target: "evcr2316"
} : 0)(baseInput, " width:", space(9), ";&&& ", Input, "{padding-right:0;}&&& ", BackdropUI, "{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;}" + ( true ? "" : 0));
const TimeSeparator = emotion_styled_base_browser_esm("span", true ? {
target: "evcr2315"
} : 0)("border-top:", config_values.borderWidth, " solid ", COLORS.gray[700], ";border-bottom:", config_values.borderWidth, " solid ", COLORS.gray[700], ";line-height:calc(\n\t\t", config_values.controlHeight, " - ", config_values.borderWidth, " * 2\n\t);display:inline-block;" + ( true ? "" : 0));
const MinutesInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
target: "evcr2314"
} : 0)(baseInput, " width:", space(9), ";&&& ", Input, "{padding-left:0;}&&& ", BackdropUI, "{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0;}" + ( true ? "" : 0));
// Ideally we wouldn't need a wrapper, but can't otherwise target the
// <BaseControl> in <SelectControl>
const MonthSelectWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "evcr2313"
} : 0)( true ? {
name: "1ff36h2",
styles: "flex-grow:1"
} : 0);
const DayInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
target: "evcr2312"
} : 0)(baseInput, " width:", space(9), ";" + ( true ? "" : 0));
const YearInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
target: "evcr2311"
} : 0)(baseInput, " width:", space(14), ";" + ( true ? "" : 0));
const TimeZone = emotion_styled_base_browser_esm("div", true ? {
target: "evcr2310"
} : 0)( true ? {
name: "ebu3jh",
styles: "text-decoration:underline dotted"
} : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/time/timezone.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Displays timezone information when user timezone is different from site
* timezone.
*/
const timezone_TimeZone = () => {
const {
timezone
} = (0,external_wp_date_namespaceObject.getSettings)();
// Convert timezone offset to hours.
const userTimezoneOffset = -1 * (new Date().getTimezoneOffset() / 60);
// System timezone and user timezone match, nothing needed.
// Compare as numbers because it comes over as string.
if (Number(timezone.offset) === userTimezoneOffset) {
return null;
}
const offsetSymbol = Number(timezone.offset) >= 0 ? '+' : '';
const zoneAbbr = '' !== timezone.abbr && isNaN(Number(timezone.abbr)) ? timezone.abbr : `UTC${offsetSymbol}${timezone.offsetFormatted}`;
// Replace underscore with space in strings like `America/Costa_Rica`.
const prettyTimezoneString = timezone.string.replace('_', ' ');
const timezoneDetail = 'UTC' === timezone.string ? (0,external_wp_i18n_namespaceObject.__)('Coordinated Universal Time') : `(${zoneAbbr}) ${prettyTimezoneString}`;
// When the prettyTimezoneString is empty, there is no additional timezone
// detail information to show in a Tooltip.
const hasNoAdditionalTimezoneDetail = prettyTimezoneString.trim().length === 0;
return hasNoAdditionalTimezoneDetail ? (0,external_React_.createElement)(TimeZone, {
className: "components-datetime__timezone"
}, zoneAbbr) : (0,external_React_.createElement)(tooltip, {
placement: "top",
text: timezoneDetail
}, (0,external_React_.createElement)(TimeZone, {
className: "components-datetime__timezone"
}, zoneAbbr));
};
/* harmony default export */ const timezone = (timezone_TimeZone);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/time/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function from12hTo24h(hours, isPm) {
return isPm ? (hours % 12 + 12) % 24 : hours % 12;
}
/**
* Creates an InputControl reducer used to pad an input so that it is always a
* given width. For example, the hours and minutes inputs are padded to 2 so
* that '4' appears as '04'.
*
* @param pad How many digits the value should be.
*/
function buildPadInputStateReducer(pad) {
return (state, action) => {
const nextState = {
...state
};
if (action.type === COMMIT || action.type === PRESS_UP || action.type === PRESS_DOWN) {
if (nextState.value !== undefined) {
nextState.value = nextState.value.toString().padStart(pad, '0');
}
}
return nextState;
};
}
/**
* TimePicker is a React component that renders a clock for time selection.
*
* ```jsx
* import { TimePicker } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyTimePicker = () => {
* const [ time, setTime ] = useState( new Date() );
*
* return (
* <TimePicker
* currentTime={ date }
* onChange={ ( newTime ) => setTime( newTime ) }
* is12Hour
* />
* );
* };
* ```
*/
function TimePicker({
is12Hour,
currentTime,
onChange
}) {
const [date, setDate] = (0,external_wp_element_namespaceObject.useState)(() =>
// Truncate the date at the minutes, see: #15495.
currentTime ? startOfMinute(inputToDate(currentTime)) : new Date());
// Reset the state when currentTime changed.
// TODO: useEffect() shouldn't be used like this, causes an unnecessary render
(0,external_wp_element_namespaceObject.useEffect)(() => {
setDate(currentTime ? startOfMinute(inputToDate(currentTime)) : new Date());
}, [currentTime]);
const {
day,
month,
year,
minutes,
hours,
am
} = (0,external_wp_element_namespaceObject.useMemo)(() => ({
day: format(date, 'dd'),
month: format(date, 'MM'),
year: format(date, 'yyyy'),
minutes: format(date, 'mm'),
hours: format(date, is12Hour ? 'hh' : 'HH'),
am: format(date, 'a')
}), [date, is12Hour]);
const buildNumberControlChangeCallback = method => {
const callback = (value, {
event
}) => {
var _ownerDocument$defaul;
// `instanceof` checks need to get the instance definition from the
// corresponding window object — therefore, the following logic makes
// the component work correctly even when rendered inside an iframe.
const HTMLInputElementInstance = (_ownerDocument$defaul = event.target?.ownerDocument.defaultView?.HTMLInputElement) !== null && _ownerDocument$defaul !== void 0 ? _ownerDocument$defaul : HTMLInputElement;
if (!(event.target instanceof HTMLInputElementInstance)) {
return;
}
if (!event.target.validity.valid) {
return;
}
// We can safely assume value is a number if target is valid.
let numberValue = Number(value);
// If the 12-hour format is being used and the 'PM' period is
// selected, then the incoming value (which ranges 1-12) should be
// increased by 12 to match the expected 24-hour format.
if (method === 'hours' && is12Hour) {
numberValue = from12hTo24h(numberValue, am === 'PM');
}
const newDate = set_set(date, {
[method]: numberValue
});
setDate(newDate);
onChange?.(format(newDate, TIMEZONELESS_FORMAT));
};
return callback;
};
function buildAmPmChangeCallback(value) {
return () => {
if (am === value) {
return;
}
const parsedHours = parseInt(hours, 10);
const newDate = setHours(date, from12hTo24h(parsedHours, value === 'PM'));
setDate(newDate);
onChange?.(format(newDate, TIMEZONELESS_FORMAT));
};
}
const dayField = (0,external_React_.createElement)(DayInput, {
className: "components-datetime__time-field components-datetime__time-field-day" // Unused, for backwards compatibility.
,
label: (0,external_wp_i18n_namespaceObject.__)('Day'),
hideLabelFromVision: true,
__next40pxDefaultSize: true,
value: day,
step: 1,
min: 1,
max: 31,
required: true,
spinControls: "none",
isPressEnterToChange: true,
isDragEnabled: false,
isShiftStepEnabled: false,
onChange: buildNumberControlChangeCallback('date')
});
const monthField = (0,external_React_.createElement)(MonthSelectWrapper, null, (0,external_React_.createElement)(select_control, {
className: "components-datetime__time-field components-datetime__time-field-month" // Unused, for backwards compatibility.
,
label: (0,external_wp_i18n_namespaceObject.__)('Month'),
hideLabelFromVision: true,
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
value: month,
options: [{
value: '01',
label: (0,external_wp_i18n_namespaceObject.__)('January')
}, {
value: '02',
label: (0,external_wp_i18n_namespaceObject.__)('February')
}, {
value: '03',
label: (0,external_wp_i18n_namespaceObject.__)('March')
}, {
value: '04',
label: (0,external_wp_i18n_namespaceObject.__)('April')
}, {
value: '05',
label: (0,external_wp_i18n_namespaceObject.__)('May')
}, {
value: '06',
label: (0,external_wp_i18n_namespaceObject.__)('June')
}, {
value: '07',
label: (0,external_wp_i18n_namespaceObject.__)('July')
}, {
value: '08',
label: (0,external_wp_i18n_namespaceObject.__)('August')
}, {
value: '09',
label: (0,external_wp_i18n_namespaceObject.__)('September')
}, {
value: '10',
label: (0,external_wp_i18n_namespaceObject.__)('October')
}, {
value: '11',
label: (0,external_wp_i18n_namespaceObject.__)('November')
}, {
value: '12',
label: (0,external_wp_i18n_namespaceObject.__)('December')
}],
onChange: value => {
const newDate = setMonth_setMonth(date, Number(value) - 1);
setDate(newDate);
onChange?.(format(newDate, TIMEZONELESS_FORMAT));
}
}));
return (0,external_React_.createElement)(time_styles_Wrapper, {
className: "components-datetime__time" // Unused, for backwards compatibility.
}, (0,external_React_.createElement)(Fieldset, null, (0,external_React_.createElement)(base_control.VisualLabel, {
as: "legend",
className: "components-datetime__time-legend" // Unused, for backwards compatibility.
}, (0,external_wp_i18n_namespaceObject.__)('Time')), (0,external_React_.createElement)(h_stack_component, {
className: "components-datetime__time-wrapper" // Unused, for backwards compatibility.
}, (0,external_React_.createElement)(TimeWrapper, {
className: "components-datetime__time-field components-datetime__time-field-time" // Unused, for backwards compatibility.
}, (0,external_React_.createElement)(HoursInput, {
className: "components-datetime__time-field-hours-input" // Unused, for backwards compatibility.
,
label: (0,external_wp_i18n_namespaceObject.__)('Hours'),
hideLabelFromVision: true,
__next40pxDefaultSize: true,
value: hours,
step: 1,
min: is12Hour ? 1 : 0,
max: is12Hour ? 12 : 23,
required: true,
spinControls: "none",
isPressEnterToChange: true,
isDragEnabled: false,
isShiftStepEnabled: false,
onChange: buildNumberControlChangeCallback('hours'),
__unstableStateReducer: buildPadInputStateReducer(2)
}), (0,external_React_.createElement)(TimeSeparator, {
className: "components-datetime__time-separator" // Unused, for backwards compatibility.
,
"aria-hidden": "true"
}, ":"), (0,external_React_.createElement)(MinutesInput, {
className: "components-datetime__time-field-minutes-input" // Unused, for backwards compatibility.
,
label: (0,external_wp_i18n_namespaceObject.__)('Minutes'),
hideLabelFromVision: true,
__next40pxDefaultSize: true,
value: minutes,
step: 1,
min: 0,
max: 59,
required: true,
spinControls: "none",
isPressEnterToChange: true,
isDragEnabled: false,
isShiftStepEnabled: false,
onChange: buildNumberControlChangeCallback('minutes'),
__unstableStateReducer: buildPadInputStateReducer(2)
})), is12Hour && (0,external_React_.createElement)(button_group, {
className: "components-datetime__time-field components-datetime__time-field-am-pm" // Unused, for backwards compatibility.
}, (0,external_React_.createElement)(build_module_button, {
className: "components-datetime__time-am-button" // Unused, for backwards compatibility.
,
variant: am === 'AM' ? 'primary' : 'secondary',
__next40pxDefaultSize: true,
onClick: buildAmPmChangeCallback('AM')
}, (0,external_wp_i18n_namespaceObject.__)('AM')), (0,external_React_.createElement)(build_module_button, {
className: "components-datetime__time-pm-button" // Unused, for backwards compatibility.
,
variant: am === 'PM' ? 'primary' : 'secondary',
__next40pxDefaultSize: true,
onClick: buildAmPmChangeCallback('PM')
}, (0,external_wp_i18n_namespaceObject.__)('PM'))), (0,external_React_.createElement)(spacer_component, null), (0,external_React_.createElement)(timezone, null))), (0,external_React_.createElement)(Fieldset, null, (0,external_React_.createElement)(base_control.VisualLabel, {
as: "legend",
className: "components-datetime__time-legend" // Unused, for backwards compatibility.
}, (0,external_wp_i18n_namespaceObject.__)('Date')), (0,external_React_.createElement)(h_stack_component, {
className: "components-datetime__time-wrapper" // Unused, for backwards compatibility.
}, is12Hour ? (0,external_React_.createElement)(external_React_.Fragment, null, monthField, dayField) : (0,external_React_.createElement)(external_React_.Fragment, null, dayField, monthField), (0,external_React_.createElement)(YearInput, {
className: "components-datetime__time-field components-datetime__time-field-year" // Unused, for backwards compatibility.
,
label: (0,external_wp_i18n_namespaceObject.__)('Year'),
hideLabelFromVision: true,
__next40pxDefaultSize: true,
value: year,
step: 1,
min: 1,
max: 9999,
required: true,
spinControls: "none",
isPressEnterToChange: true,
isDragEnabled: false,
isShiftStepEnabled: false,
onChange: buildNumberControlChangeCallback('year'),
__unstableStateReducer: buildPadInputStateReducer(4)
}))));
}
/* harmony default export */ const time = (TimePicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/date-time/styles.js
function date_time_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const date_time_styles_Wrapper = /*#__PURE__*/emotion_styled_base_browser_esm(v_stack_component, true ? {
target: "e1p5onf00"
} : 0)( true ? {
name: "1khn195",
styles: "box-sizing:border-box"
} : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/date-time/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const date_time_noop = () => {};
function UnforwardedDateTimePicker({
currentDate,
is12Hour,
isInvalidDate,
onMonthPreviewed = date_time_noop,
onChange,
events,
startOfWeek
}, ref) {
return (0,external_React_.createElement)(date_time_styles_Wrapper, {
ref: ref,
className: "components-datetime",
spacing: 4
}, (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(time, {
currentTime: currentDate,
onChange: onChange,
is12Hour: is12Hour
}), (0,external_React_.createElement)(date, {
currentDate: currentDate,
onChange: onChange,
isInvalidDate: isInvalidDate,
events: events,
onMonthPreviewed: onMonthPreviewed,
startOfWeek: startOfWeek
})));
}
/**
* DateTimePicker is a React component that renders a calendar and clock for
* date and time selection. The calendar and clock components can be accessed
* individually using the `DatePicker` and `TimePicker` components respectively.
*
* ```jsx
* import { DateTimePicker } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyDateTimePicker = () => {
* const [ date, setDate ] = useState( new Date() );
*
* return (
* <DateTimePicker
* currentDate={ date }
* onChange={ ( newDate ) => setDate( newDate ) }
* is12Hour
* />
* );
* };
* ```
*/
const DateTimePicker = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedDateTimePicker);
/* harmony default export */ const date_time = (DateTimePicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/index.js
/**
* Internal dependencies
*/
/* harmony default export */ const build_module_date_time = (date_time);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dimension-control/sizes.js
/**
* Sizes
*
* defines the sizes used in dimension controls
* all hardcoded `size` values are based on the value of
* the Sass variable `$block-padding` from
* `packages/block-editor/src/components/dimension-control/sizes.js`.
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Finds the correct size object from the provided sizes
* table by size slug (eg: `medium`)
*
* @param sizes containing objects for each size definition.
* @param slug a string representation of the size (eg: `medium`).
*/
const findSizeBySlug = (sizes, slug) => sizes.find(size => slug === size.slug);
/* harmony default export */ const dimension_control_sizes = ([{
name: (0,external_wp_i18n_namespaceObject._x)('None', 'Size of a UI element'),
slug: 'none'
}, {
name: (0,external_wp_i18n_namespaceObject._x)('Small', 'Size of a UI element'),
slug: 'small'
}, {
name: (0,external_wp_i18n_namespaceObject._x)('Medium', 'Size of a UI element'),
slug: 'medium'
}, {
name: (0,external_wp_i18n_namespaceObject._x)('Large', 'Size of a UI element'),
slug: 'large'
}, {
name: (0,external_wp_i18n_namespaceObject._x)('Extra Large', 'Size of a UI element'),
slug: 'xlarge'
}]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dimension-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* `DimensionControl` is a component designed to provide a UI to control spacing and/or dimensions.
*
* This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
*
* ```jsx
* import { __experimentalDimensionControl as DimensionControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* export default function MyCustomDimensionControl() {
* const [ paddingSize, setPaddingSize ] = useState( '' );
*
* return (
* <DimensionControl
* label={ 'Padding' }
* icon={ 'desktop' }
* onChange={ ( value ) => setPaddingSize( value ) }
* value={ paddingSize }
* />
* );
* }
* ```
*/
function DimensionControl(props) {
const {
__next40pxDefaultSize = false,
label,
value,
sizes = dimension_control_sizes,
icon,
onChange,
className = ''
} = props;
const onChangeSpacingSize = val => {
const theSize = findSizeBySlug(sizes, val);
if (!theSize || value === theSize.slug) {
onChange?.(undefined);
} else if (typeof onChange === 'function') {
onChange(theSize.slug);
}
};
const formatSizesAsOptions = theSizes => {
const options = theSizes.map(({
name,
slug
}) => ({
label: name,
value: slug
}));
return [{
label: (0,external_wp_i18n_namespaceObject.__)('Default'),
value: ''
}, ...options];
};
const selectLabel = (0,external_React_.createElement)(external_React_.Fragment, null, icon && (0,external_React_.createElement)(build_module_icon, {
icon: icon
}), label);
return (0,external_React_.createElement)(select_control, {
__next40pxDefaultSize: __next40pxDefaultSize,
className: classnames_default()(className, 'block-editor-dimension-control'),
label: selectLabel,
hideLabelFromVision: false,
value: value,
onChange: onChangeSpacingSize,
options: formatSizesAsOptions(sizes)
});
}
/* harmony default export */ const dimension_control = (DimensionControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/disabled/styles/disabled-styles.js
function disabled_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
const disabled_styles_disabledStyles = true ? {
name: "u2jump",
styles: "position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;}"
} : 0;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/disabled/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const Context = (0,external_wp_element_namespaceObject.createContext)(false);
const {
Consumer,
Provider: disabled_Provider
} = Context;
/**
* `Disabled` is a component which disables descendant tabbable elements and
* prevents pointer interaction.
*
* _Note: this component may not behave as expected in browsers that don't
* support the `inert` HTML attribute. We recommend adding the official WICG
* polyfill when using this component in your project._
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert
*
* ```jsx
* import { Button, Disabled, TextControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyDisabled = () => {
* const [ isDisabled, setIsDisabled ] = useState( true );
*
* let input = <TextControl label="Input" onChange={ () => {} } />;
* if ( isDisabled ) {
* input = <Disabled>{ input }</Disabled>;
* }
*
* const toggleDisabled = () => {
* setIsDisabled( ( state ) => ! state );
* };
*
* return (
* <div>
* { input }
* <Button variant="primary" onClick={ toggleDisabled }>
* Toggle Disabled
* </Button>
* </div>
* );
* };
* ```
*/
function Disabled({
className,
children,
isDisabled = true,
...props
}) {
const cx = useCx();
return (0,external_React_.createElement)(disabled_Provider, {
value: isDisabled
}, (0,external_React_.createElement)("div", {
// @ts-ignore Reason: inert is a recent HTML attribute
inert: isDisabled ? 'true' : undefined,
className: isDisabled ? cx(disabled_styles_disabledStyles, className, 'components-disabled') : undefined,
...props
}, children));
}
Disabled.Context = Context;
Disabled.Consumer = Consumer;
/* harmony default export */ const disabled = (Disabled);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/disclosure/index.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Accessible Disclosure component that controls visibility of a section of
* content. It follows the WAI-ARIA Disclosure Pattern.
*/
const UnforwardedDisclosureContent = ({
visible,
children,
...props
}, ref) => {
const disclosure = useDisclosureStore({
open: visible
});
return (0,external_React_.createElement)(DisclosureContent, {
store: disclosure,
ref: ref,
...props
}, children);
};
const disclosure_DisclosureContent = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedDisclosureContent);
/* harmony default export */ const disclosure = ((/* unused pure expression or super */ null && (disclosure_DisclosureContent)));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/draggable/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const dragImageClass = 'components-draggable__invisible-drag-image';
const cloneWrapperClass = 'components-draggable__clone';
const clonePadding = 0;
const bodyClass = 'is-dragging-components-draggable';
/**
* `Draggable` is a Component that provides a way to set up a cross-browser
* (including IE) customizable drag image and the transfer data for the drag
* event. It decouples the drag handle and the element to drag: use it by
* wrapping the component that will become the drag handle and providing the DOM
* ID of the element to drag.
*
* Note that the drag handle needs to declare the `draggable="true"` property
* and bind the `Draggable`s `onDraggableStart` and `onDraggableEnd` event
* handlers to its own `onDragStart` and `onDragEnd` respectively. `Draggable`
* takes care of the logic to setup the drag image and the transfer data, but is
* not concerned with creating an actual DOM element that is draggable.
*
* ```jsx
* import { Draggable, Panel, PanelBody } from '@wordpress/components';
* import { Icon, more } from '@wordpress/icons';
*
* const MyDraggable = () => (
* <div id="draggable-panel">
* <Panel header="Draggable panel">
* <PanelBody>
* <Draggable elementId="draggable-panel" transferData={ {} }>
* { ( { onDraggableStart, onDraggableEnd } ) => (
* <div
* className="example-drag-handle"
* draggable
* onDragStart={ onDraggableStart }
* onDragEnd={ onDraggableEnd }
* >
* <Icon icon={ more } />
* </div>
* ) }
* </Draggable>
* </PanelBody>
* </Panel>
* </div>
* );
* ```
*/
function Draggable({
children,
onDragStart,
onDragOver,
onDragEnd,
appendToOwnerDocument = false,
cloneClassname,
elementId,
transferData,
__experimentalTransferDataType: transferDataType = 'text',
__experimentalDragComponent: dragComponent
}) {
const dragComponentRef = (0,external_wp_element_namespaceObject.useRef)(null);
const cleanup = (0,external_wp_element_namespaceObject.useRef)(() => {});
/**
* Removes the element clone, resets cursor, and removes drag listener.
*
* @param event The non-custom DragEvent.
*/
function end(event) {
event.preventDefault();
cleanup.current();
if (onDragEnd) {
onDragEnd(event);
}
}
/**
* This method does a couple of things:
*
* - Clones the current element and spawns clone over original element.
* - Adds a fake temporary drag image to avoid browser defaults.
* - Sets transfer data.
* - Adds dragover listener.
*
* @param event The non-custom DragEvent.
*/
function start(event) {
const {
ownerDocument
} = event.target;
event.dataTransfer.setData(transferDataType, JSON.stringify(transferData));
const cloneWrapper = ownerDocument.createElement('div');
// Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.
cloneWrapper.style.top = '0';
cloneWrapper.style.left = '0';
const dragImage = ownerDocument.createElement('div');
// Set a fake drag image to avoid browser defaults. Remove from DOM
// right after. event.dataTransfer.setDragImage is not supported yet in
// IE, we need to check for its existence first.
if ('function' === typeof event.dataTransfer.setDragImage) {
dragImage.classList.add(dragImageClass);
ownerDocument.body.appendChild(dragImage);
event.dataTransfer.setDragImage(dragImage, 0, 0);
}
cloneWrapper.classList.add(cloneWrapperClass);
if (cloneClassname) {
cloneWrapper.classList.add(cloneClassname);
}
let x = 0;
let y = 0;
// If a dragComponent is defined, the following logic will clone the
// HTML node and inject it into the cloneWrapper.
if (dragComponentRef.current) {
// Position dragComponent at the same position as the cursor.
x = event.clientX;
y = event.clientY;
cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`;
const clonedDragComponent = ownerDocument.createElement('div');
clonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;
cloneWrapper.appendChild(clonedDragComponent);
// Inject the cloneWrapper into the DOM.
ownerDocument.body.appendChild(cloneWrapper);
} else {
const element = ownerDocument.getElementById(elementId);
// Prepare element clone and append to element wrapper.
const elementRect = element.getBoundingClientRect();
const elementWrapper = element.parentNode;
const elementTopOffset = elementRect.top;
const elementLeftOffset = elementRect.left;
cloneWrapper.style.width = `${elementRect.width + clonePadding * 2}px`;
const clone = element.cloneNode(true);
clone.id = `clone-${elementId}`;
// Position clone right over the original element (20px padding).
x = elementLeftOffset - clonePadding;
y = elementTopOffset - clonePadding;
cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`;
// Hack: Remove iFrames as it's causing the embeds drag clone to freeze.
Array.from(clone.querySelectorAll('iframe')).forEach(child => child.parentNode?.removeChild(child));
cloneWrapper.appendChild(clone);
// Inject the cloneWrapper into the DOM.
if (appendToOwnerDocument) {
ownerDocument.body.appendChild(cloneWrapper);
} else {
elementWrapper?.appendChild(cloneWrapper);
}
}
// Mark the current cursor coordinates.
let cursorLeft = event.clientX;
let cursorTop = event.clientY;
function over(e) {
// Skip doing any work if mouse has not moved.
if (cursorLeft === e.clientX && cursorTop === e.clientY) {
return;
}
const nextX = x + e.clientX - cursorLeft;
const nextY = y + e.clientY - cursorTop;
cloneWrapper.style.transform = `translate( ${nextX}px, ${nextY}px )`;
cursorLeft = e.clientX;
cursorTop = e.clientY;
x = nextX;
y = nextY;
if (onDragOver) {
onDragOver(e);
}
}
// Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,
// note that browsers may throttle raf below 60fps in certain conditions.
// @ts-ignore
const throttledDragOver = (0,external_wp_compose_namespaceObject.throttle)(over, 16);
ownerDocument.addEventListener('dragover', throttledDragOver);
// Update cursor to 'grabbing', document wide.
ownerDocument.body.classList.add(bodyClass);
if (onDragStart) {
onDragStart(event);
}
cleanup.current = () => {
// Remove drag clone.
if (cloneWrapper && cloneWrapper.parentNode) {
cloneWrapper.parentNode.removeChild(cloneWrapper);
}
if (dragImage && dragImage.parentNode) {
dragImage.parentNode.removeChild(dragImage);
}
// Reset cursor.
ownerDocument.body.classList.remove(bodyClass);
ownerDocument.removeEventListener('dragover', throttledDragOver);
};
}
(0,external_wp_element_namespaceObject.useEffect)(() => () => {
cleanup.current();
}, []);
return (0,external_React_.createElement)(external_React_.Fragment, null, children({
onDraggableStart: start,
onDraggableEnd: end
}), dragComponent && (0,external_React_.createElement)("div", {
className: "components-draggable-drag-component-root",
style: {
display: 'none'
},
ref: dragComponentRef
}, dragComponent));
}
/* harmony default export */ const draggable = (Draggable);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js
/**
* WordPress dependencies
*/
const upload = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const library_upload = (upload);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/drop-zone/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* `DropZone` is a component creating a drop zone area taking the full size of its parent element. It supports dropping files, HTML content or any other HTML drop event.
*
* ```jsx
* import { DropZone } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyDropZone = () => {
* const [ hasDropped, setHasDropped ] = useState( false );
*
* return (
* <div>
* { hasDropped ? 'Dropped!' : 'Drop something here' }
* <DropZone
* onFilesDrop={ () => setHasDropped( true ) }
* onHTMLDrop={ () => setHasDropped( true ) }
* onDrop={ () => setHasDropped( true ) }
* />
* </div>
* );
* }
* ```
*/
function DropZoneComponent({
className,
label,
onFilesDrop,
onHTMLDrop,
onDrop,
...restProps
}) {
const [isDraggingOverDocument, setIsDraggingOverDocument] = (0,external_wp_element_namespaceObject.useState)();
const [isDraggingOverElement, setIsDraggingOverElement] = (0,external_wp_element_namespaceObject.useState)();
const [type, setType] = (0,external_wp_element_namespaceObject.useState)();
const ref = (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({
onDrop(event) {
const files = event.dataTransfer ? (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) {
onHTMLDrop(html);
} else if (files.length && onFilesDrop) {
onFilesDrop(files);
} else if (onDrop) {
onDrop(event);
}
},
onDragStart(event) {
setIsDraggingOverDocument(true);
let _type = 'default';
/**
* 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 (event.dataTransfer?.types.includes('text/html')) {
_type = 'html';
} else if (
// Check for the types because sometimes the files themselves
// are only available on drop.
event.dataTransfer?.types.includes('Files') || (event.dataTransfer ? (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(event.dataTransfer) : []).length > 0) {
_type = 'file';
}
setType(_type);
},
onDragEnd() {
setIsDraggingOverDocument(false);
setType(undefined);
},
onDragEnter() {
setIsDraggingOverElement(true);
},
onDragLeave() {
setIsDraggingOverElement(false);
}
});
const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
let children;
const backdrop = {
hidden: {
opacity: 0
},
show: {
opacity: 1,
transition: {
type: 'tween',
duration: 0.2,
delay: 0,
delayChildren: 0.1
}
},
exit: {
opacity: 0,
transition: {
duration: 0.2,
delayChildren: 0
}
}
};
const foreground = {
hidden: {
opacity: 0,
scale: 0.9
},
show: {
opacity: 1,
scale: 1,
transition: {
duration: 0.1
}
},
exit: {
opacity: 0,
scale: 0.9
}
};
if (isDraggingOverElement) {
children = (0,external_React_.createElement)(motion.div, {
variants: backdrop,
initial: disableMotion ? 'show' : 'hidden',
animate: "show",
exit: disableMotion ? 'show' : 'exit',
className: "components-drop-zone__content"
// Without this, when this div is shown,
// Safari calls a onDropZoneLeave causing a loop because of this bug
// https://bugs.webkit.org/show_bug.cgi?id=66547
,
style: {
pointerEvents: 'none'
}
}, (0,external_React_.createElement)(motion.div, {
variants: foreground
}, (0,external_React_.createElement)(icons_build_module_icon, {
icon: library_upload,
className: "components-drop-zone__content-icon"
}), (0,external_React_.createElement)("span", {
className: "components-drop-zone__content-text"
}, label ? label : (0,external_wp_i18n_namespaceObject.__)('Drop files to upload'))));
}
const classes = classnames_default()('components-drop-zone', className, {
'is-active': (isDraggingOverDocument || isDraggingOverElement) && (type === 'file' && onFilesDrop || type === 'html' && onHTMLDrop || type === 'default' && onDrop),
'is-dragging-over-document': isDraggingOverDocument,
'is-dragging-over-element': isDraggingOverElement,
[`is-dragging-${type}`]: !!type
});
return (0,external_React_.createElement)("div", {
...restProps,
ref: ref,
className: classes
}, disableMotion ? children : (0,external_React_.createElement)(AnimatePresence, null, children));
}
/* harmony default export */ const drop_zone = (DropZoneComponent);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/drop-zone/provider.js
/**
* WordPress dependencies
*/
function DropZoneProvider({
children
}) {
external_wp_deprecated_default()('wp.components.DropZoneProvider', {
since: '5.8',
hint: 'wp.component.DropZone no longer needs a provider. wp.components.DropZoneProvider is safe to remove from your code.'
});
return children;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/swatch.js
/**
* WordPress dependencies
*/
const swatch = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M5 17.7c.4.5.8.9 1.2 1.2l1.1-1.4c-.4-.3-.7-.6-1-1L5 17.7zM5 6.3l1.4 1.1c.3-.4.6-.7 1-1L6.3 5c-.5.4-.9.8-1.3 1.3zm.1 7.8l-1.7.5c.2.6.4 1.1.7 1.6l1.5-.8c-.2-.4-.4-.8-.5-1.3zM4.8 12v-.7L3 11.1v1.8l1.7-.2c.1-.2.1-.5.1-.7zm3 7.9c.5.3 1.1.5 1.6.7l.5-1.7c-.5-.1-.9-.3-1.3-.5l-.8 1.5zM19 6.3c-.4-.5-.8-.9-1.2-1.2l-1.1 1.4c.4.3.7.6 1 1L19 6.3zm-.1 3.6l1.7-.5c-.2-.6-.4-1.1-.7-1.6l-1.5.8c.2.4.4.8.5 1.3zM5.6 8.6l-1.5-.8c-.3.5-.5 1-.7 1.6l1.7.5c.1-.5.3-.9.5-1.3zm2.2-4.5l.8 1.5c.4-.2.8-.4 1.3-.5l-.5-1.7c-.6.2-1.1.4-1.6.7zm8.8 13.5l1.1 1.4c.5-.4.9-.8 1.2-1.2l-1.4-1.1c-.2.3-.5.6-.9.9zm1.8-2.2l1.5.8c.3-.5.5-1.1.7-1.6l-1.7-.5c-.1.5-.3.9-.5 1.3zm2.6-4.3l-1.7.2v1.4l1.7.2V12v-.9zM11.1 3l.2 1.7h1.4l.2-1.7h-1.8zm3 2.1c.5.1.9.3 1.3.5l.8-1.5c-.5-.3-1.1-.5-1.6-.7l-.5 1.7zM12 19.2h-.7l-.2 1.8h1.8l-.2-1.7c-.2-.1-.5-.1-.7-.1zm2.1-.3l.5 1.7c.6-.2 1.1-.4 1.6-.7l-.8-1.5c-.4.2-.8.4-1.3.5z"
}));
/* harmony default export */ const library_swatch = (swatch);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/utils.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
k([names]);
/**
* Object representation for a color.
*
* @typedef {Object} RGBColor
* @property {number} r Red component of the color in the range [0,1].
* @property {number} g Green component of the color in the range [0,1].
* @property {number} b Blue component of the color in the range [0,1].
*/
/**
* Calculate the brightest and darkest values from a color palette.
*
* @param palette Color palette for the theme.
*
* @return Tuple of the darkest color and brightest color.
*/
function getDefaultColors(palette) {
// A default dark and light color are required.
if (!palette || palette.length < 2) return ['#000', '#fff'];
return palette.map(({
color
}) => ({
color,
brightness: w(color).brightness()
})).reduce(([min, max], current) => {
return [current.brightness <= min.brightness ? current : min, current.brightness >= max.brightness ? current : max];
}, [{
brightness: 1,
color: ''
}, {
brightness: 0,
color: ''
}]).map(({
color
}) => color);
}
/**
* Generate a duotone gradient from a list of colors.
*
* @param colors CSS color strings.
* @param angle CSS gradient angle.
*
* @return CSS gradient string for the duotone swatch.
*/
function getGradientFromCSSColors(colors = [], angle = '90deg') {
const l = 100 / colors.length;
const stops = colors.map((c, i) => `${c} ${i * l}%, ${c} ${(i + 1) * l}%`).join(', ');
return `linear-gradient( ${angle}, ${stops} )`;
}
/**
* Convert a color array to an array of color stops.
*
* @param colors CSS colors array
*
* @return Color stop information.
*/
function getColorStopsFromColors(colors) {
return colors.map((color, i) => ({
position: i * 100 / (colors.length - 1),
color
}));
}
/**
* Convert a color stop array to an array colors.
*
* @param colorStops Color stop information.
*
* @return CSS colors array.
*/
function getColorsFromColorStops(colorStops = []) {
return colorStops.map(({
color
}) => color);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/duotone-swatch.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function DuotoneSwatch({
values
}) {
return values ? (0,external_React_.createElement)(color_indicator, {
colorValue: getGradientFromCSSColors(values, '135deg')
}) : (0,external_React_.createElement)(build_module_icon, {
icon: library_swatch
});
}
/* harmony default export */ const duotone_swatch = (DuotoneSwatch);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/color-list-picker/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ColorOption({
label,
value,
colors,
disableCustomColors,
enableAlpha,
onChange
}) {
const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false);
const idRoot = (0,external_wp_compose_namespaceObject.useInstanceId)(ColorOption, 'color-list-picker-option');
const labelId = `${idRoot}__label`;
const contentId = `${idRoot}__content`;
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(build_module_button, {
className: "components-color-list-picker__swatch-button",
onClick: () => setIsOpen(prev => !prev),
"aria-expanded": isOpen,
"aria-controls": contentId
}, (0,external_React_.createElement)(h_stack_component, {
justify: "flex-start",
spacing: 2
}, value ? (0,external_React_.createElement)(color_indicator, {
colorValue: value,
className: "components-color-list-picker__swatch-color"
}) : (0,external_React_.createElement)(build_module_icon, {
icon: library_swatch
}), (0,external_React_.createElement)("span", {
id: labelId
}, label))), (0,external_React_.createElement)("div", {
role: "group",
id: contentId,
"aria-labelledby": labelId,
"aria-hidden": !isOpen
}, isOpen && (0,external_React_.createElement)(color_palette, {
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Color options'),
className: "components-color-list-picker__color-picker",
colors: colors,
value: value,
clearable: false,
onChange: onChange,
disableCustomColors: disableCustomColors,
enableAlpha: enableAlpha
})));
}
function ColorListPicker({
colors,
labels,
value = [],
disableCustomColors,
enableAlpha,
onChange
}) {
return (0,external_React_.createElement)("div", {
className: "components-color-list-picker"
}, labels.map((label, index) => (0,external_React_.createElement)(ColorOption, {
key: index,
label: label,
value: value[index],
colors: colors,
disableCustomColors: disableCustomColors,
enableAlpha: enableAlpha,
onChange: newColor => {
const newColors = value.slice();
newColors[index] = newColor;
onChange(newColors);
}
})));
}
/* harmony default export */ const color_list_picker = (ColorListPicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/custom-duotone-bar.js
/**
* Internal dependencies
*/
const PLACEHOLDER_VALUES = ['#333', '#CCC'];
function CustomDuotoneBar({
value,
onChange
}) {
const hasGradient = !!value;
const values = hasGradient ? value : PLACEHOLDER_VALUES;
const background = getGradientFromCSSColors(values);
const controlPoints = getColorStopsFromColors(values);
return (0,external_React_.createElement)(CustomGradientBar, {
disableInserter: true,
background: background,
hasGradient: hasGradient,
value: controlPoints,
onChange: newColorStops => {
const newValue = getColorsFromColorStops(newColorStops);
onChange(newValue);
}
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/duotone-picker.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* ```jsx
* import { DuotonePicker, DuotoneSwatch } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const DUOTONE_PALETTE = [
* { colors: [ '#8c00b7', '#fcff41' ], name: 'Purple and yellow', slug: 'purple-yellow' },
* { colors: [ '#000097', '#ff4747' ], name: 'Blue and red', slug: 'blue-red' },
* ];
*
* const COLOR_PALETTE = [
* { color: '#ff4747', name: 'Red', slug: 'red' },
* { color: '#fcff41', name: 'Yellow', slug: 'yellow' },
* { color: '#000097', name: 'Blue', slug: 'blue' },
* { color: '#8c00b7', name: 'Purple', slug: 'purple' },
* ];
*
* const Example = () => {
* const [ duotone, setDuotone ] = useState( [ '#000000', '#ffffff' ] );
* return (
* <>
* <DuotonePicker
* duotonePalette={ DUOTONE_PALETTE }
* colorPalette={ COLOR_PALETTE }
* value={ duotone }
* onChange={ setDuotone }
* />
* <DuotoneSwatch values={ duotone } />
* </>
* );
* };
* ```
*/
function DuotonePicker({
asButtons,
loop,
clearable = true,
unsetable = true,
colorPalette,
duotonePalette,
disableCustomColors,
disableCustomDuotone,
value,
onChange,
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledby,
...otherProps
}) {
const [defaultDark, defaultLight] = (0,external_wp_element_namespaceObject.useMemo)(() => getDefaultColors(colorPalette), [colorPalette]);
const isUnset = value === 'unset';
const unsetOptionLabel = (0,external_wp_i18n_namespaceObject.__)('Unset');
const unsetOption = (0,external_React_.createElement)(build_module_circular_option_picker.Option, {
key: "unset",
value: "unset",
isSelected: isUnset,
tooltipText: unsetOptionLabel,
"aria-label": unsetOptionLabel,
className: "components-duotone-picker__color-indicator",
onClick: () => {
onChange(isUnset ? undefined : 'unset');
}
});
const duotoneOptions = duotonePalette.map(({
colors,
slug,
name
}) => {
const style = {
background: getGradientFromCSSColors(colors, '135deg'),
color: 'transparent'
};
const tooltipText = name !== null && name !== void 0 ? name : (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: duotone code e.g: "dark-grayscale" or "7f7f7f-ffffff".
(0,external_wp_i18n_namespaceObject.__)('Duotone code: %s'), slug);
const label = name ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The name of the option e.g: "Dark grayscale".
(0,external_wp_i18n_namespaceObject.__)('Duotone: %s'), name) : tooltipText;
const isSelected = es6_default()(colors, value);
return (0,external_React_.createElement)(build_module_circular_option_picker.Option, {
key: slug,
value: colors,
isSelected: isSelected,
"aria-label": label,
tooltipText: tooltipText,
style: style,
onClick: () => {
onChange(isSelected ? undefined : colors);
}
});
});
let metaProps;
if (asButtons) {
metaProps = {
asButtons: true
};
} else {
const _metaProps = {
asButtons: false,
loop
};
if (ariaLabel) {
metaProps = {
..._metaProps,
'aria-label': ariaLabel
};
} else if (ariaLabelledby) {
metaProps = {
..._metaProps,
'aria-labelledby': ariaLabelledby
};
} else {
metaProps = {
..._metaProps,
'aria-label': (0,external_wp_i18n_namespaceObject.__)('Custom color picker.')
};
}
}
const options = unsetable ? [unsetOption, ...duotoneOptions] : duotoneOptions;
return (0,external_React_.createElement)(build_module_circular_option_picker, {
...otherProps,
...metaProps,
options: options,
actions: !!clearable && (0,external_React_.createElement)(build_module_circular_option_picker.ButtonAction, {
onClick: () => onChange(undefined)
}, (0,external_wp_i18n_namespaceObject.__)('Clear'))
}, (0,external_React_.createElement)(spacer_component, {
paddingTop: options.length === 0 ? 0 : 4
}, (0,external_React_.createElement)(v_stack_component, {
spacing: 3
}, !disableCustomColors && !disableCustomDuotone && (0,external_React_.createElement)(CustomDuotoneBar, {
value: isUnset ? undefined : value,
onChange: onChange
}), !disableCustomDuotone && (0,external_React_.createElement)(color_list_picker, {
labels: [(0,external_wp_i18n_namespaceObject.__)('Shadows'), (0,external_wp_i18n_namespaceObject.__)('Highlights')],
colors: colorPalette,
value: isUnset ? undefined : value,
disableCustomColors: disableCustomColors,
enableAlpha: true,
onChange: newColors => {
if (!newColors[0]) {
newColors[0] = defaultDark;
}
if (!newColors[1]) {
newColors[1] = defaultLight;
}
const newValue = newColors.length >= 2 ? newColors : undefined;
// @ts-expect-error TODO: The color arrays for a DuotonePicker should be a tuple of two colors,
// but it's currently typed as a string[].
// See also https://github.com/WordPress/gutenberg/pull/49060#discussion_r1136951035
onChange(newValue);
}
}))));
}
/* harmony default export */ const duotone_picker = (DuotonePicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
/**
* WordPress dependencies
*/
const external = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"
}));
/* harmony default export */ const library_external = (external);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/external-link/styles/external-link-styles.js
function external_link_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const StyledIcon = /*#__PURE__*/emotion_styled_base_browser_esm(icons_build_module_icon, true ? {
target: "esh4a730"
} : 0)( true ? {
name: "rvs7bx",
styles: "width:1em;height:1em;margin:0;vertical-align:middle;fill:currentColor"
} : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/external-link/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedExternalLink(props, ref) {
const {
href,
children,
className,
rel = '',
...additionalProps
} = props;
const optimizedRel = [...new Set([...rel.split(' '), 'external', 'noreferrer', 'noopener'].filter(Boolean))].join(' ');
const classes = classnames_default()('components-external-link', className);
/* Anchor links are perceived as external links.
This constant helps check for on page anchor links,
to prevent them from being opened in the editor. */
const isInternalAnchor = !!href?.startsWith('#');
const onClickHandler = event => {
if (isInternalAnchor) {
event.preventDefault();
}
if (props.onClick) {
props.onClick(event);
}
};
return /* eslint-disable react/jsx-no-target-blank */(
(0,external_React_.createElement)("a", {
...additionalProps,
className: classes,
href: href,
onClick: onClickHandler,
target: "_blank",
rel: optimizedRel,
ref: ref
}, children, (0,external_React_.createElement)(visually_hidden_component, {
as: "span"
}, /* translators: accessibility text */
(0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')), (0,external_React_.createElement)(StyledIcon, {
icon: library_external,
className: "components-external-link__icon"
}))
/* eslint-enable react/jsx-no-target-blank */
);
}
/**
* Link to an external resource.
*
* ```jsx
* import { ExternalLink } from '@wordpress/components';
*
* const MyExternalLink = () => (
* <ExternalLink href="https://wordpress.org">WordPress.org</ExternalLink>
* );
* ```
*/
const ExternalLink = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedExternalLink);
/* harmony default export */ const external_link = (ExternalLink);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/utils.js
const INITIAL_BOUNDS = {
width: 200,
height: 170
};
const VIDEO_EXTENSIONS = ['avi', 'mpg', 'mpeg', 'mov', 'mp4', 'm4v', 'ogg', 'ogv', 'webm', 'wmv'];
/**
* Gets the extension of a file name.
*
* @param filename The file name.
* @return The extension of the file name.
*/
function getExtension(filename = '') {
const parts = filename.split('.');
return parts[parts.length - 1];
}
/**
* Checks if a file is a video.
*
* @param filename The file name.
* @return Whether the file is a video.
*/
function isVideoType(filename = '') {
if (!filename) return false;
return filename.startsWith('data:video/') || VIDEO_EXTENSIONS.includes(getExtension(filename));
}
/**
* Transforms a fraction value to a percentage value.
*
* @param fraction The fraction value.
* @return A percentage value.
*/
function fractionToPercentage(fraction) {
return Math.round(fraction * 100);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/styles/focal-point-picker-style.js
function focal_point_picker_style_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const MediaWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "eeew7dm8"
} : 0)( true ? {
name: "jqnsxy",
styles: "background-color:transparent;display:flex;text-align:center;width:100%"
} : 0);
const MediaContainer = emotion_styled_base_browser_esm("div", true ? {
target: "eeew7dm7"
} : 0)("align-items:center;border-radius:", config_values.radiusBlockUi, ";cursor:pointer;display:inline-flex;justify-content:center;margin:auto;position:relative;height:100%;&:after{border-radius:inherit;bottom:0;box-shadow:inset 0 0 0 1px rgba( 0, 0, 0, 0.1 );content:'';left:0;pointer-events:none;position:absolute;right:0;top:0;}img,video{border-radius:inherit;box-sizing:border-box;display:block;height:auto;margin:0;max-height:100%;max-width:100%;pointer-events:none;user-select:none;width:auto;}" + ( true ? "" : 0));
const MediaPlaceholder = emotion_styled_base_browser_esm("div", true ? {
target: "eeew7dm6"
} : 0)("background:", COLORS.gray[100], ";border-radius:inherit;box-sizing:border-box;height:", INITIAL_BOUNDS.height, "px;max-width:280px;min-width:", INITIAL_BOUNDS.width, "px;width:100%;" + ( true ? "" : 0));
const focal_point_picker_style_StyledUnitControl = /*#__PURE__*/emotion_styled_base_browser_esm(unit_control, true ? {
target: "eeew7dm5"
} : 0)( true ? {
name: "1d3w5wq",
styles: "width:100%"
} : 0);
var focal_point_picker_style_ref2 = true ? {
name: "1mn7kwb",
styles: "padding-bottom:1em"
} : 0;
const deprecatedBottomMargin = ({
__nextHasNoMarginBottom
}) => {
return !__nextHasNoMarginBottom ? focal_point_picker_style_ref2 : undefined;
};
var focal_point_picker_style_ref = true ? {
name: "1mn7kwb",
styles: "padding-bottom:1em"
} : 0;
const extraHelpTextMargin = ({
hasHelpText = false
}) => {
return hasHelpText ? focal_point_picker_style_ref : undefined;
};
const ControlWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
target: "eeew7dm4"
} : 0)("max-width:320px;padding-top:1em;", extraHelpTextMargin, " ", deprecatedBottomMargin, ";" + ( true ? "" : 0));
const GridView = emotion_styled_base_browser_esm("div", true ? {
target: "eeew7dm3"
} : 0)("left:50%;overflow:hidden;pointer-events:none;position:absolute;top:50%;transform:translate3d( -50%, -50%, 0 );transition:opacity 100ms linear;z-index:1;", reduceMotion('transition'), " opacity:", ({
showOverlay
}) => showOverlay ? 1 : 0, ";" + ( true ? "" : 0));
const GridLine = emotion_styled_base_browser_esm("div", true ? {
target: "eeew7dm2"
} : 0)( true ? {
name: "1yzbo24",
styles: "background:rgba( 255, 255, 255, 0.4 );backdrop-filter:blur( 16px ) saturate( 180% );position:absolute;transform:translateZ( 0 )"
} : 0);
const GridLineX = /*#__PURE__*/emotion_styled_base_browser_esm(GridLine, true ? {
target: "eeew7dm1"
} : 0)( true ? {
name: "1sw8ur",
styles: "height:1px;left:1px;right:1px"
} : 0);
const GridLineY = /*#__PURE__*/emotion_styled_base_browser_esm(GridLine, true ? {
target: "eeew7dm0"
} : 0)( true ? {
name: "188vg4t",
styles: "width:1px;top:1px;bottom:1px"
} : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/controls.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const TEXTCONTROL_MIN = 0;
const TEXTCONTROL_MAX = 100;
const controls_noop = () => {};
function FocalPointPickerControls({
__nextHasNoMarginBottom,
__next40pxDefaultSize,
hasHelpText,
onChange = controls_noop,
point = {
x: 0.5,
y: 0.5
}
}) {
const valueX = fractionToPercentage(point.x);
const valueY = fractionToPercentage(point.y);
const handleChange = (value, axis) => {
if (value === undefined) return;
const num = parseInt(value, 10);
if (!isNaN(num)) {
onChange({
...point,
[axis]: num / 100
});
}
};
return (0,external_React_.createElement)(ControlWrapper, {
className: "focal-point-picker__controls",
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
hasHelpText: hasHelpText,
gap: 4
}, (0,external_React_.createElement)(FocalPointUnitControl, {
__next40pxDefaultSize: __next40pxDefaultSize,
label: (0,external_wp_i18n_namespaceObject.__)('Left'),
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Focal point left position'),
value: [valueX, '%'].join(''),
onChange: next => handleChange(next, 'x'),
dragDirection: "e"
}), (0,external_React_.createElement)(FocalPointUnitControl, {
__next40pxDefaultSize: __next40pxDefaultSize,
label: (0,external_wp_i18n_namespaceObject.__)('Top'),
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Focal point top position'),
value: [valueY, '%'].join(''),
onChange: next => handleChange(next, 'y'),
dragDirection: "s"
}));
}
function FocalPointUnitControl(props) {
return (0,external_React_.createElement)(focal_point_picker_style_StyledUnitControl, {
className: "focal-point-picker__controls-position-unit-control",
labelPosition: "top",
max: TEXTCONTROL_MAX,
min: TEXTCONTROL_MIN,
units: [{
value: '%',
label: '%'
}],
...props
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/styles/focal-point-style.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const PointerCircle = emotion_styled_base_browser_esm("div", true ? {
target: "e19snlhg0"
} : 0)("background-color:transparent;cursor:grab;height:40px;margin:-20px 0 0 -20px;position:absolute;user-select:none;width:40px;will-change:transform;z-index:10000;background:rgba( 255, 255, 255, 0.4 );border:1px solid rgba( 255, 255, 255, 0.4 );border-radius:50%;backdrop-filter:blur( 16px ) saturate( 180% );box-shadow:rgb( 0 0 0 / 10% ) 0px 0px 8px;transition:transform 100ms linear;", reduceMotion('transition'), " ", ({
isDragging
}) => isDragging && `
box-shadow: rgb( 0 0 0 / 12% ) 0px 0px 10px;
transform: scale( 1.1 );
cursor: grabbing;
`, ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/focal-point.js
/**
* Internal dependencies
*/
/**
* External dependencies
*/
function FocalPoint({
left = '50%',
top = '50%',
...props
}) {
const classes = classnames_default()('components-focal-point-picker__icon_container');
const style = {
left,
top
};
return (0,external_React_.createElement)(PointerCircle, {
...props,
className: classes,
style: style
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/grid.js
/**
* Internal dependencies
*/
function FocalPointPickerGrid({
bounds,
...props
}) {
return (0,external_React_.createElement)(GridView, {
...props,
className: "components-focal-point-picker__grid",
style: {
width: bounds.width,
height: bounds.height
}
}, (0,external_React_.createElement)(GridLineX, {
style: {
top: '33%'
}
}), (0,external_React_.createElement)(GridLineX, {
style: {
top: '66%'
}
}), (0,external_React_.createElement)(GridLineY, {
style: {
left: '33%'
}
}), (0,external_React_.createElement)(GridLineY, {
style: {
left: '66%'
}
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/media.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function media_Media({
alt,
autoPlay,
src,
onLoad,
mediaRef,
// Exposing muted prop for test rendering purposes
// https://github.com/testing-library/react-testing-library/issues/470
muted = true,
...props
}) {
if (!src) {
return (0,external_React_.createElement)(MediaPlaceholder, {
className: "components-focal-point-picker__media components-focal-point-picker__media--placeholder",
ref: mediaRef,
...props
});
}
const isVideo = isVideoType(src);
return isVideo ? (0,external_React_.createElement)("video", {
...props,
autoPlay: autoPlay,
className: "components-focal-point-picker__media components-focal-point-picker__media--video",
loop: true,
muted: muted,
onLoadedData: onLoad,
ref: mediaRef,
src: src
}) : (0,external_React_.createElement)("img", {
...props,
alt: alt,
className: "components-focal-point-picker__media components-focal-point-picker__media--image",
onLoad: onLoad,
ref: mediaRef,
src: src
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const GRID_OVERLAY_TIMEOUT = 600;
/**
* Focal Point Picker is a component which creates a UI for identifying the most important visual point of an image.
*
* This component addresses a specific problem: with large background images it is common to see undesirable crops,
* especially when viewing on smaller viewports such as mobile phones. This component allows the selection of
* the point with the most important visual information and returns it as a pair of numbers between 0 and 1.
* This value can be easily converted into the CSS `background-position` attribute, and will ensure that the
* focal point is never cropped out, regardless of viewport.
*
* - Example focal point picker value: `{ x: 0.5, y: 0.1 }`
* - Corresponding CSS: `background-position: 50% 10%;`
*
* ```jsx
* import { FocalPointPicker } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const Example = () => {
* const [ focalPoint, setFocalPoint ] = useState( {
* x: 0.5,
* y: 0.5,
* } );
*
* const url = '/path/to/image';
*
* // Example function to render the CSS styles based on Focal Point Picker value
* const style = {
* backgroundImage: `url(${ url })`,
* backgroundPosition: `${ focalPoint.x * 100 }% ${ focalPoint.y * 100 }%`,
* };
*
* return (
* <>
* <FocalPointPicker
* url={ url }
* value={ focalPoint }
* onDragStart={ setFocalPoint }
* onDrag={ setFocalPoint }
* onChange={ setFocalPoint }
* />
* <div style={ style } />
* </>
* );
* };
* ```
*/
function FocalPointPicker({
__nextHasNoMarginBottom,
__next40pxDefaultSize = false,
autoPlay = true,
className,
help,
label,
onChange,
onDrag,
onDragEnd,
onDragStart,
resolvePoint,
url,
value: valueProp = {
x: 0.5,
y: 0.5
},
...restProps
}) {
const [point, setPoint] = (0,external_wp_element_namespaceObject.useState)(valueProp);
const [showGridOverlay, setShowGridOverlay] = (0,external_wp_element_namespaceObject.useState)(false);
const {
startDrag,
endDrag,
isDragging
} = (0,external_wp_compose_namespaceObject.__experimentalUseDragging)({
onDragStart: event => {
dragAreaRef.current?.focus();
const value = getValueWithinDragArea(event);
// `value` can technically be undefined if getValueWithinDragArea() is
// called before dragAreaRef is set, but this shouldn't happen in reality.
if (!value) return;
onDragStart?.(value, event);
setPoint(value);
},
onDragMove: event => {
// Prevents text-selection when dragging.
event.preventDefault();
const value = getValueWithinDragArea(event);
if (!value) return;
onDrag?.(value, event);
setPoint(value);
},
onDragEnd: () => {
onDragEnd?.();
onChange?.(point);
}
});
// Uses the internal point while dragging or else the value from props.
const {
x,
y
} = isDragging ? point : valueProp;
const dragAreaRef = (0,external_wp_element_namespaceObject.useRef)(null);
const [bounds, setBounds] = (0,external_wp_element_namespaceObject.useState)(INITIAL_BOUNDS);
const refUpdateBounds = (0,external_wp_element_namespaceObject.useRef)(() => {
if (!dragAreaRef.current) return;
const {
clientWidth: width,
clientHeight: height
} = dragAreaRef.current;
// Falls back to initial bounds if the ref has no size. Since styles
// give the drag area dimensions even when the media has not loaded
// this should only happen in unit tests (jsdom).
setBounds(width > 0 && height > 0 ? {
width,
height
} : {
...INITIAL_BOUNDS
});
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
const updateBounds = refUpdateBounds.current;
if (!dragAreaRef.current) return;
const {
defaultView
} = dragAreaRef.current.ownerDocument;
defaultView?.addEventListener('resize', updateBounds);
return () => defaultView?.removeEventListener('resize', updateBounds);
}, []);
// Updates the bounds to cover cases of unspecified media or load failures.
(0,external_wp_compose_namespaceObject.useIsomorphicLayoutEffect)(() => void refUpdateBounds.current(), []);
// TODO: Consider refactoring getValueWithinDragArea() into a pure function.
// https://github.com/WordPress/gutenberg/pull/43872#discussion_r963455173
const getValueWithinDragArea = ({
clientX,
clientY,
shiftKey
}) => {
if (!dragAreaRef.current) return;
const {
top,
left
} = dragAreaRef.current.getBoundingClientRect();
let nextX = (clientX - left) / bounds.width;
let nextY = (clientY - top) / bounds.height;
// Enables holding shift to jump values by 10%.
if (shiftKey) {
nextX = Math.round(nextX / 0.1) * 0.1;
nextY = Math.round(nextY / 0.1) * 0.1;
}
return getFinalValue({
x: nextX,
y: nextY
});
};
const getFinalValue = value => {
var _resolvePoint;
const resolvedValue = (_resolvePoint = resolvePoint?.(value)) !== null && _resolvePoint !== void 0 ? _resolvePoint : value;
resolvedValue.x = Math.max(0, Math.min(resolvedValue.x, 1));
resolvedValue.y = Math.max(0, Math.min(resolvedValue.y, 1));
const roundToTwoDecimalPlaces = n => Math.round(n * 1e2) / 1e2;
return {
x: roundToTwoDecimalPlaces(resolvedValue.x),
y: roundToTwoDecimalPlaces(resolvedValue.y)
};
};
const arrowKeyStep = event => {
const {
code,
shiftKey
} = event;
if (!['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(code)) return;
event.preventDefault();
const value = {
x,
y
};
const step = shiftKey ? 0.1 : 0.01;
const delta = code === 'ArrowUp' || code === 'ArrowLeft' ? -1 * step : step;
const axis = code === 'ArrowUp' || code === 'ArrowDown' ? 'y' : 'x';
value[axis] = value[axis] + delta;
onChange?.(getFinalValue(value));
};
const focalPointPosition = {
left: x !== undefined ? x * bounds.width : 0.5 * bounds.width,
top: y !== undefined ? y * bounds.height : 0.5 * bounds.height
};
const classes = classnames_default()('components-focal-point-picker-control', className);
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(FocalPointPicker);
const id = `inspector-focal-point-picker-control-${instanceId}`;
use_update_effect(() => {
setShowGridOverlay(true);
const timeout = window.setTimeout(() => {
setShowGridOverlay(false);
}, GRID_OVERLAY_TIMEOUT);
return () => window.clearTimeout(timeout);
}, [x, y]);
return (0,external_React_.createElement)(base_control, {
...restProps,
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
label: label,
id: id,
help: help,
className: classes
}, (0,external_React_.createElement)(MediaWrapper, {
className: "components-focal-point-picker-wrapper"
}, (0,external_React_.createElement)(MediaContainer, {
className: "components-focal-point-picker",
onKeyDown: arrowKeyStep,
onMouseDown: startDrag,
onBlur: () => {
if (isDragging) endDrag();
},
ref: dragAreaRef,
role: "button",
tabIndex: -1
}, (0,external_React_.createElement)(FocalPointPickerGrid, {
bounds: bounds,
showOverlay: showGridOverlay
}), (0,external_React_.createElement)(media_Media, {
alt: (0,external_wp_i18n_namespaceObject.__)('Media preview'),
autoPlay: autoPlay,
onLoad: refUpdateBounds.current,
src: url
}), (0,external_React_.createElement)(FocalPoint, {
...focalPointPosition,
isDragging: isDragging
}))), (0,external_React_.createElement)(FocalPointPickerControls, {
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
__next40pxDefaultSize: __next40pxDefaultSize,
hasHelpText: !!help,
point: {
x,
y
},
onChange: value => {
onChange?.(getFinalValue(value));
}
}));
}
/* harmony default export */ const focal_point_picker = (FocalPointPicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focusable-iframe/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function FocusableIframe({
iframeRef,
...props
}) {
const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([iframeRef, (0,external_wp_compose_namespaceObject.useFocusableIframe)()]);
external_wp_deprecated_default()('wp.components.FocusableIframe', {
since: '5.9',
alternative: 'wp.compose.useFocusableIframe'
});
// Disable reason: The rendered iframe is a pass-through component,
// assigning props inherited from the rendering parent. It's the
// responsibility of the parent to assign a title.
// eslint-disable-next-line jsx-a11y/iframe-has-title
return (0,external_React_.createElement)("iframe", {
ref: ref,
...props
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/settings.js
/**
* WordPress dependencies
*/
const settings = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"
}), (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"
}));
/* harmony default export */ const library_settings = (settings);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/utils.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Some themes use css vars for their font sizes, so until we
* have the way of calculating them don't display them.
*
* @param value The value that is checked.
* @return Whether the value is a simple css value.
*/
function isSimpleCssValue(value) {
const sizeRegex = /^[\d\.]+(px|em|rem|vw|vh|%|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)?$/i;
return sizeRegex.test(String(value));
}
/**
* If all of the given font sizes have the same unit (e.g. 'px'), return that
* unit. Otherwise return null.
*
* @param fontSizes List of font sizes.
* @return The common unit, or null.
*/
function getCommonSizeUnit(fontSizes) {
const [firstFontSize, ...otherFontSizes] = fontSizes;
if (!firstFontSize) {
return null;
}
const [, firstUnit] = parseQuantityAndUnitFromRawValue(firstFontSize.size);
const areAllSizesSameUnit = otherFontSizes.every(fontSize => {
const [, unit] = parseQuantityAndUnitFromRawValue(fontSize.size);
return unit === firstUnit;
});
return areAllSizesSameUnit ? firstUnit : null;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/styles.js
function font_size_picker_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const styles_Container = emotion_styled_base_browser_esm("fieldset", true ? {
target: "e8tqeku4"
} : 0)( true ? {
name: "1t1ytme",
styles: "border:0;margin:0;padding:0"
} : 0);
const styles_Header = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? {
target: "e8tqeku3"
} : 0)("height:", space(4), ";" + ( true ? "" : 0));
const HeaderToggle = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
target: "e8tqeku2"
} : 0)("margin-top:", space(-1), ";" + ( true ? "" : 0));
const HeaderLabel = /*#__PURE__*/emotion_styled_base_browser_esm(base_control.VisualLabel, true ? {
target: "e8tqeku1"
} : 0)("display:flex;gap:", space(1), ";justify-content:flex-start;margin-bottom:0;" + ( true ? "" : 0));
const HeaderHint = emotion_styled_base_browser_esm("span", true ? {
target: "e8tqeku0"
} : 0)("color:", COLORS.gray[700], ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/font-size-picker-select.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DEFAULT_OPTION = {
key: 'default',
name: (0,external_wp_i18n_namespaceObject.__)('Default'),
value: undefined
};
const CUSTOM_OPTION = {
key: 'custom',
name: (0,external_wp_i18n_namespaceObject.__)('Custom')
};
const FontSizePickerSelect = props => {
var _options$find;
const {
__next40pxDefaultSize,
fontSizes,
value,
disableCustomFontSizes,
size,
onChange,
onSelectCustom
} = props;
const areAllSizesSameUnit = !!getCommonSizeUnit(fontSizes);
const options = [DEFAULT_OPTION, ...fontSizes.map(fontSize => {
let hint;
if (areAllSizesSameUnit) {
const [quantity] = parseQuantityAndUnitFromRawValue(fontSize.size);
if (quantity !== undefined) {
hint = String(quantity);
}
} else if (isSimpleCssValue(fontSize.size)) {
hint = String(fontSize.size);
}
return {
key: fontSize.slug,
name: fontSize.name || fontSize.slug,
value: fontSize.size,
__experimentalHint: hint
};
}), ...(disableCustomFontSizes ? [] : [CUSTOM_OPTION])];
const selectedOption = value ? (_options$find = options.find(option => option.value === value)) !== null && _options$find !== void 0 ? _options$find : CUSTOM_OPTION : DEFAULT_OPTION;
return (0,external_React_.createElement)(CustomSelectControl, {
__next40pxDefaultSize: __next40pxDefaultSize,
__nextUnconstrainedWidth: true,
className: "components-font-size-picker__select",
label: (0,external_wp_i18n_namespaceObject.__)('Font size'),
hideLabelFromVision: true,
describedBy: (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Currently selected font size.
(0,external_wp_i18n_namespaceObject.__)('Currently selected font size: %s'), selectedOption.name),
options: options,
value: selectedOption,
__experimentalShowSelectedHint: true,
onChange: ({
selectedItem
}) => {
if (selectedItem === CUSTOM_OPTION) {
onSelectCustom();
} else {
onChange(selectedItem.value);
}
},
size: size
});
};
/* harmony default export */ const font_size_picker_select = (FontSizePickerSelect);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option/component.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedToggleGroupControlOption(props, ref) {
const {
label,
...restProps
} = props;
const optionLabel = restProps['aria-label'] || label;
return (0,external_React_.createElement)(toggle_group_control_option_base_component, {
...restProps,
"aria-label": optionLabel,
ref: ref
}, label);
}
/**
* `ToggleGroupControlOption` is a form component and is meant to be used as a
* child of `ToggleGroupControl`.
*
* ```jsx
* import {
* __experimentalToggleGroupControl as ToggleGroupControl,
* __experimentalToggleGroupControlOption as ToggleGroupControlOption,
* } from '@wordpress/components';
*
* function Example() {
* return (
* <ToggleGroupControl label="my label" value="vertical" isBlock>
* <ToggleGroupControlOption value="horizontal" label="Horizontal" />
* <ToggleGroupControlOption value="vertical" label="Vertical" />
* </ToggleGroupControl>
* );
* }
* ```
*/
const ToggleGroupControlOption = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleGroupControlOption);
/* harmony default export */ const toggle_group_control_option_component = (ToggleGroupControlOption);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/constants.js
/**
* WordPress dependencies
*/
/**
* List of T-shirt abbreviations.
*
* When there are 5 font sizes or fewer, we assume that the font sizes are
* ordered by size and show T-shirt labels.
*/
const T_SHIRT_ABBREVIATIONS = [/* translators: S stands for 'small' and is a size label. */
(0,external_wp_i18n_namespaceObject.__)('S'), /* translators: M stands for 'medium' and is a size label. */
(0,external_wp_i18n_namespaceObject.__)('M'), /* translators: L stands for 'large' and is a size label. */
(0,external_wp_i18n_namespaceObject.__)('L'), /* translators: XL stands for 'extra large' and is a size label. */
(0,external_wp_i18n_namespaceObject.__)('XL'), /* translators: XXL stands for 'extra extra large' and is a size label. */
(0,external_wp_i18n_namespaceObject.__)('XXL')];
/**
* List of T-shirt names.
*
* When there are 5 font sizes or fewer, we assume that the font sizes are
* ordered by size and show T-shirt labels.
*/
const T_SHIRT_NAMES = [(0,external_wp_i18n_namespaceObject.__)('Small'), (0,external_wp_i18n_namespaceObject.__)('Medium'), (0,external_wp_i18n_namespaceObject.__)('Large'), (0,external_wp_i18n_namespaceObject.__)('Extra Large'), (0,external_wp_i18n_namespaceObject.__)('Extra Extra Large')];
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/font-size-picker-toggle-group.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const FontSizePickerToggleGroup = props => {
const {
fontSizes,
value,
__next40pxDefaultSize,
size,
onChange
} = props;
return (0,external_React_.createElement)(toggle_group_control_component, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: __next40pxDefaultSize,
label: (0,external_wp_i18n_namespaceObject.__)('Font size'),
hideLabelFromVision: true,
value: value,
onChange: onChange,
isBlock: true,
size: size
}, fontSizes.map((fontSize, index) => (0,external_React_.createElement)(toggle_group_control_option_component, {
key: fontSize.slug,
value: fontSize.size,
label: T_SHIRT_ABBREVIATIONS[index],
"aria-label": fontSize.name || T_SHIRT_NAMES[index],
showTooltip: true
})));
};
/* harmony default export */ const font_size_picker_toggle_group = (FontSizePickerToggleGroup);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const UnforwardedFontSizePicker = (props, ref) => {
const {
__next40pxDefaultSize = false,
fallbackFontSize,
fontSizes = [],
disableCustomFontSizes = false,
onChange,
size = 'default',
units: unitsProp,
value,
withSlider = false,
withReset = true
} = props;
const units = useCustomUnits({
availableUnits: unitsProp || ['px', 'em', 'rem']
});
const shouldUseSelectControl = fontSizes.length > 5;
const selectedFontSize = fontSizes.find(fontSize => fontSize.size === value);
const isCustomValue = !!value && !selectedFontSize;
const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)(!disableCustomFontSizes && isCustomValue);
const headerHint = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (showCustomValueControl) {
return (0,external_wp_i18n_namespaceObject.__)('Custom');
}
if (!shouldUseSelectControl) {
if (selectedFontSize) {
return selectedFontSize.name || T_SHIRT_NAMES[fontSizes.indexOf(selectedFontSize)];
}
return '';
}
const commonUnit = getCommonSizeUnit(fontSizes);
if (commonUnit) {
return `(${commonUnit})`;
}
return '';
}, [showCustomValueControl, shouldUseSelectControl, selectedFontSize, fontSizes]);
if (fontSizes.length === 0 && disableCustomFontSizes) {
return null;
}
// If neither the value or first font size is a string, then FontSizePicker
// operates in a legacy "unitless" mode where UnitControl can only be used
// to select px values and onChange() is always called with number values.
const hasUnits = typeof value === 'string' || typeof fontSizes[0]?.size === 'string';
const [valueQuantity, valueUnit] = parseQuantityAndUnitFromRawValue(value, units);
const isValueUnitRelative = !!valueUnit && ['em', 'rem'].includes(valueUnit);
const isDisabled = value === undefined;
return (0,external_React_.createElement)(styles_Container, {
ref: ref,
className: "components-font-size-picker"
}, (0,external_React_.createElement)(visually_hidden_component, {
as: "legend"
}, (0,external_wp_i18n_namespaceObject.__)('Font size')), (0,external_React_.createElement)(spacer_component, null, (0,external_React_.createElement)(styles_Header, {
className: "components-font-size-picker__header"
}, (0,external_React_.createElement)(HeaderLabel, {
"aria-label": `${(0,external_wp_i18n_namespaceObject.__)('Size')} ${headerHint || ''}`
}, (0,external_wp_i18n_namespaceObject.__)('Size'), headerHint && (0,external_React_.createElement)(HeaderHint, {
className: "components-font-size-picker__header__hint"
}, headerHint)), !disableCustomFontSizes && (0,external_React_.createElement)(HeaderToggle, {
label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)('Use size preset') : (0,external_wp_i18n_namespaceObject.__)('Set custom size'),
icon: library_settings,
onClick: () => {
setShowCustomValueControl(!showCustomValueControl);
},
isPressed: showCustomValueControl,
size: "small"
}))), (0,external_React_.createElement)("div", null, !!fontSizes.length && shouldUseSelectControl && !showCustomValueControl && (0,external_React_.createElement)(font_size_picker_select, {
__next40pxDefaultSize: __next40pxDefaultSize,
fontSizes: fontSizes,
value: value,
disableCustomFontSizes: disableCustomFontSizes,
size: size,
onChange: newValue => {
if (newValue === undefined) {
onChange?.(undefined);
} else {
onChange?.(hasUnits ? newValue : Number(newValue), fontSizes.find(fontSize => fontSize.size === newValue));
}
},
onSelectCustom: () => setShowCustomValueControl(true)
}), !shouldUseSelectControl && !showCustomValueControl && (0,external_React_.createElement)(font_size_picker_toggle_group, {
fontSizes: fontSizes,
value: value,
__next40pxDefaultSize: __next40pxDefaultSize,
size: size,
onChange: newValue => {
if (newValue === undefined) {
onChange?.(undefined);
} else {
onChange?.(hasUnits ? newValue : Number(newValue), fontSizes.find(fontSize => fontSize.size === newValue));
}
}
}), !disableCustomFontSizes && showCustomValueControl && (0,external_React_.createElement)(flex_component, {
className: "components-font-size-picker__custom-size-control"
}, (0,external_React_.createElement)(flex_item_component, {
isBlock: true
}, (0,external_React_.createElement)(unit_control, {
__next40pxDefaultSize: __next40pxDefaultSize,
label: (0,external_wp_i18n_namespaceObject.__)('Custom'),
labelPosition: "top",
hideLabelFromVision: true,
value: value,
onChange: newValue => {
if (newValue === undefined) {
onChange?.(undefined);
} else {
onChange?.(hasUnits ? newValue : parseInt(newValue, 10));
}
},
size: size,
units: hasUnits ? units : [],
min: 0
})), withSlider && (0,external_React_.createElement)(flex_item_component, {
isBlock: true
}, (0,external_React_.createElement)(spacer_component, {
marginX: 2,
marginBottom: 0
}, (0,external_React_.createElement)(range_control, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: __next40pxDefaultSize,
className: "components-font-size-picker__custom-input",
label: (0,external_wp_i18n_namespaceObject.__)('Custom Size'),
hideLabelFromVision: true,
value: valueQuantity,
initialPosition: fallbackFontSize,
withInputField: false,
onChange: newValue => {
if (newValue === undefined) {
onChange?.(undefined);
} else if (hasUnits) {
onChange?.(newValue + (valueUnit !== null && valueUnit !== void 0 ? valueUnit : 'px'));
} else {
onChange?.(newValue);
}
},
min: 0,
max: isValueUnitRelative ? 10 : 100,
step: isValueUnitRelative ? 0.1 : 1
}))), withReset && (0,external_React_.createElement)(flex_item_component, null, (0,external_React_.createElement)(Button, {
disabled: isDisabled,
__experimentalIsFocusable: true,
onClick: () => {
onChange?.(undefined);
},
variant: "secondary",
__next40pxDefaultSize: true,
size: size === '__unstable-large' || props.__next40pxDefaultSize ? 'default' : 'small'
}, (0,external_wp_i18n_namespaceObject.__)('Reset'))))));
};
const FontSizePicker = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedFontSizePicker);
/* harmony default export */ const font_size_picker = (FontSizePicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-file-upload/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* FormFileUpload is a component that allows users to select files from their local device.
*
* ```jsx
* import { FormFileUpload } from '@wordpress/components';
*
* const MyFormFileUpload = () => (
* <FormFileUpload
* accept="image/*"
* onChange={ ( event ) => console.log( event.currentTarget.files ) }
* >
* Upload
* </FormFileUpload>
* );
* ```
*/
function FormFileUpload({
accept,
children,
multiple = false,
onChange,
onClick,
render,
...props
}) {
const ref = (0,external_wp_element_namespaceObject.useRef)(null);
const openFileDialog = () => {
ref.current?.click();
};
const ui = render ? render({
openFileDialog
}) : (0,external_React_.createElement)(build_module_button, {
onClick: openFileDialog,
...props
}, children);
return (0,external_React_.createElement)("div", {
className: "components-form-file-upload"
}, ui, (0,external_React_.createElement)("input", {
type: "file",
ref: ref,
multiple: multiple,
style: {
display: 'none'
},
accept: accept,
onChange: onChange,
onClick: onClick,
"data-testid": "form-file-upload-input"
}));
}
/* harmony default export */ const form_file_upload = (FormFileUpload);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-toggle/index.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const form_toggle_noop = () => {};
/**
* FormToggle switches a single setting on or off.
*
* ```jsx
* import { FormToggle } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyFormToggle = () => {
* const [ isChecked, setChecked ] = useState( true );
*
* return (
* <FormToggle
* checked={ isChecked }
* onChange={ () => setChecked( ( state ) => ! state ) }
* />
* );
* };
* ```
*/
function FormToggle(props) {
const {
className,
checked,
id,
disabled,
onChange = form_toggle_noop,
...additionalProps
} = props;
const wrapperClasses = classnames_default()('components-form-toggle', className, {
'is-checked': checked,
'is-disabled': disabled
});
return (0,external_React_.createElement)("span", {
className: wrapperClasses
}, (0,external_React_.createElement)("input", {
className: "components-form-toggle__input",
id: id,
type: "checkbox",
checked: checked,
onChange: onChange,
disabled: disabled,
...additionalProps
}), (0,external_React_.createElement)("span", {
className: "components-form-toggle__track"
}), (0,external_React_.createElement)("span", {
className: "components-form-toggle__thumb"
}));
}
/* harmony default export */ const form_toggle = (FormToggle);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/token.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const token_noop = () => {};
function Token({
value,
status,
title,
displayTransform,
isBorderless = false,
disabled = false,
onClickRemove = token_noop,
onMouseEnter,
onMouseLeave,
messages,
termPosition,
termsCount
}) {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Token);
const tokenClasses = classnames_default()('components-form-token-field__token', {
'is-error': 'error' === status,
'is-success': 'success' === status,
'is-validating': 'validating' === status,
'is-borderless': isBorderless,
'is-disabled': disabled
});
const onClick = () => onClickRemove({
value
});
const transformedValue = displayTransform(value);
const termPositionAndCount = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: term name, 2: term position in a set of terms, 3: total term set count. */
(0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s of %3$s)'), transformedValue, termPosition, termsCount);
return (0,external_React_.createElement)("span", {
className: tokenClasses,
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
title: title
}, (0,external_React_.createElement)("span", {
className: "components-form-token-field__token-text",
id: `components-form-token-field__token-text-${instanceId}`
}, (0,external_React_.createElement)(visually_hidden_component, {
as: "span"
}, termPositionAndCount), (0,external_React_.createElement)("span", {
"aria-hidden": "true"
}, transformedValue)), (0,external_React_.createElement)(build_module_button, {
className: "components-form-token-field__remove-token",
icon: close_small,
onClick: !disabled ? onClick : undefined,
disabled: disabled,
label: messages.remove,
"aria-describedby": `components-form-token-field__token-text-${instanceId}`
}));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/styles.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const deprecatedPaddings = ({
__next40pxDefaultSize,
hasTokens
}) => !__next40pxDefaultSize && /*#__PURE__*/emotion_react_browser_esm_css("padding-top:", space(hasTokens ? 1 : 0.5), ";padding-bottom:", space(hasTokens ? 1 : 0.5), ";" + ( true ? "" : 0), true ? "" : 0);
const TokensAndInputWrapperFlex = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
target: "ehq8nmi0"
} : 0)("padding:7px;", boxSizingReset, " ", deprecatedPaddings, ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const form_token_field_identity = value => value;
/**
* A `FormTokenField` is a field similar to the tags and categories fields in the interim editor chrome,
* or the "to" field in Mail on OS X. Tokens can be entered by typing them or selecting them from a list of suggested tokens.
*
* Up to one hundred suggestions that match what the user has typed so far will be shown from which the user can pick from (auto-complete).
* Tokens are separated by the "," character. Suggestions can be selected with the up or down arrows and added with the tab or enter key.
*
* The `value` property is handled in a manner similar to controlled form components.
* See [Forms](http://facebook.github.io/react/docs/forms.html) in the React Documentation for more information.
*/
function FormTokenField(props) {
const {
autoCapitalize,
autoComplete,
maxLength,
placeholder,
label = (0,external_wp_i18n_namespaceObject.__)('Add item'),
className,
suggestions = [],
maxSuggestions = 100,
value = [],
displayTransform = form_token_field_identity,
saveTransform = token => token.trim(),
onChange = () => {},
onInputChange = () => {},
onFocus = undefined,
isBorderless = false,
disabled = false,
tokenizeOnSpace = false,
messages = {
added: (0,external_wp_i18n_namespaceObject.__)('Item added.'),
removed: (0,external_wp_i18n_namespaceObject.__)('Item removed.'),
remove: (0,external_wp_i18n_namespaceObject.__)('Remove item'),
__experimentalInvalid: (0,external_wp_i18n_namespaceObject.__)('Invalid item')
},
__experimentalRenderItem,
__experimentalExpandOnFocus = false,
__experimentalValidateInput = () => true,
__experimentalShowHowTo = true,
__next40pxDefaultSize = false,
__experimentalAutoSelectFirstMatch = false,
__nextHasNoMarginBottom = false,
tokenizeOnBlur = false
} = useDeprecated36pxDefaultSizeProp(props);
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(FormTokenField);
// We reset to these initial values again in the onBlur
const [incompleteTokenValue, setIncompleteTokenValue] = (0,external_wp_element_namespaceObject.useState)('');
const [inputOffsetFromEnd, setInputOffsetFromEnd] = (0,external_wp_element_namespaceObject.useState)(0);
const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(false);
const [isExpanded, setIsExpanded] = (0,external_wp_element_namespaceObject.useState)(false);
const [selectedSuggestionIndex, setSelectedSuggestionIndex] = (0,external_wp_element_namespaceObject.useState)(-1);
const [selectedSuggestionScroll, setSelectedSuggestionScroll] = (0,external_wp_element_namespaceObject.useState)(false);
const prevSuggestions = (0,external_wp_compose_namespaceObject.usePrevious)(suggestions);
const prevValue = (0,external_wp_compose_namespaceObject.usePrevious)(value);
const input = (0,external_wp_element_namespaceObject.useRef)(null);
const tokensAndInput = (0,external_wp_element_namespaceObject.useRef)(null);
const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Make sure to focus the input when the isActive state is true.
if (isActive && !hasFocus()) {
focus();
}
}, [isActive]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
const suggestionsDidUpdate = !external_wp_isShallowEqual_default()(suggestions, prevSuggestions || []);
if (suggestionsDidUpdate || value !== prevValue) {
updateSuggestions(suggestionsDidUpdate);
}
// TODO: updateSuggestions() should first be refactored so its actual deps are clearer.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [suggestions, prevSuggestions, value, prevValue]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
updateSuggestions();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [incompleteTokenValue]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
updateSuggestions();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [__experimentalAutoSelectFirstMatch]);
if (disabled && isActive) {
setIsActive(false);
setIncompleteTokenValue('');
}
function focus() {
input.current?.focus();
}
function hasFocus() {
return input.current === input.current?.ownerDocument.activeElement;
}
function onFocusHandler(event) {
// If focus is on the input or on the container, set the isActive state to true.
if (hasFocus() || event.target === tokensAndInput.current) {
setIsActive(true);
setIsExpanded(__experimentalExpandOnFocus || isExpanded);
} else {
/*
* Otherwise, focus is on one of the token "remove" buttons and we
* set the isActive state to false to prevent the input to be
* re-focused, see componentDidUpdate().
*/
setIsActive(false);
}
if ('function' === typeof onFocus) {
onFocus(event);
}
}
function onBlur(event) {
if (inputHasValidValue() && __experimentalValidateInput(incompleteTokenValue)) {
setIsActive(false);
if (tokenizeOnBlur && inputHasValidValue()) {
addNewToken(incompleteTokenValue);
}
} else {
// Reset to initial state
setIncompleteTokenValue('');
setInputOffsetFromEnd(0);
setIsActive(false);
if (__experimentalExpandOnFocus) {
// If `__experimentalExpandOnFocus` is true, don't close the suggestions list when
// the user clicks on it (`tokensAndInput` will be the element that caused the blur).
const hasFocusWithin = event.relatedTarget === tokensAndInput.current;
setIsExpanded(hasFocusWithin);
} else {
// Else collapse the suggestion list. This will result in the suggestion list closing
// after a suggestion has been submitted since that causes a blur.
setIsExpanded(false);
}
setSelectedSuggestionIndex(-1);
setSelectedSuggestionScroll(false);
}
}
function onKeyDown(event) {
let preventDefault = false;
if (event.defaultPrevented ||
// Ignore keydowns from IMEs
event.nativeEvent.isComposing ||
// Workaround for Mac Safari where the final Enter/Backspace of an IME composition
// is `isComposing=false`, even though it's technically still part of the composition.
// These can only be detected by keyCode.
event.keyCode === 229) {
return;
}
switch (event.key) {
case 'Backspace':
preventDefault = handleDeleteKey(deleteTokenBeforeInput);
break;
case 'Enter':
preventDefault = addCurrentToken();
break;
case 'ArrowLeft':
preventDefault = handleLeftArrowKey();
break;
case 'ArrowUp':
preventDefault = handleUpArrowKey();
break;
case 'ArrowRight':
preventDefault = handleRightArrowKey();
break;
case 'ArrowDown':
preventDefault = handleDownArrowKey();
break;
case 'Delete':
preventDefault = handleDeleteKey(deleteTokenAfterInput);
break;
case 'Space':
if (tokenizeOnSpace) {
preventDefault = addCurrentToken();
}
break;
case 'Escape':
preventDefault = handleEscapeKey(event);
break;
default:
break;
}
if (preventDefault) {
event.preventDefault();
}
}
function onKeyPress(event) {
let preventDefault = false;
switch (event.key) {
case ',':
preventDefault = handleCommaKey();
break;
default:
break;
}
if (preventDefault) {
event.preventDefault();
}
}
function onContainerTouched(event) {
// Prevent clicking/touching the tokensAndInput container from blurring
// the input and adding the current token.
if (event.target === tokensAndInput.current && isActive) {
event.preventDefault();
}
}
function onTokenClickRemove(event) {
deleteToken(event.value);
focus();
}
function onSuggestionHovered(suggestion) {
const index = getMatchingSuggestions().indexOf(suggestion);
if (index >= 0) {
setSelectedSuggestionIndex(index);
setSelectedSuggestionScroll(false);
}
}
function onSuggestionSelected(suggestion) {
addNewToken(suggestion);
}
function onInputChangeHandler(event) {
const text = event.value;
const separator = tokenizeOnSpace ? /[ ,\t]+/ : /[,\t]+/;
const items = text.split(separator);
const tokenValue = items[items.length - 1] || '';
if (items.length > 1) {
addNewTokens(items.slice(0, -1));
}
setIncompleteTokenValue(tokenValue);
onInputChange(tokenValue);
}
function handleDeleteKey(_deleteToken) {
let preventDefault = false;
if (hasFocus() && isInputEmpty()) {
_deleteToken();
preventDefault = true;
}
return preventDefault;
}
function handleLeftArrowKey() {
let preventDefault = false;
if (isInputEmpty()) {
moveInputBeforePreviousToken();
preventDefault = true;
}
return preventDefault;
}
function handleRightArrowKey() {
let preventDefault = false;
if (isInputEmpty()) {
moveInputAfterNextToken();
preventDefault = true;
}
return preventDefault;
}
function handleUpArrowKey() {
setSelectedSuggestionIndex(index => {
return (index === 0 ? getMatchingSuggestions(incompleteTokenValue, suggestions, value, maxSuggestions, saveTransform).length : index) - 1;
});
setSelectedSuggestionScroll(true);
return true; // PreventDefault.
}
function handleDownArrowKey() {
setSelectedSuggestionIndex(index => {
return (index + 1) % getMatchingSuggestions(incompleteTokenValue, suggestions, value, maxSuggestions, saveTransform).length;
});
setSelectedSuggestionScroll(true);
return true; // PreventDefault.
}
function handleEscapeKey(event) {
if (event.target instanceof HTMLInputElement) {
setIncompleteTokenValue(event.target.value);
setIsExpanded(false);
setSelectedSuggestionIndex(-1);
setSelectedSuggestionScroll(false);
}
return true; // PreventDefault.
}
function handleCommaKey() {
if (inputHasValidValue()) {
addNewToken(incompleteTokenValue);
}
return true; // PreventDefault.
}
function moveInputToIndex(index) {
setInputOffsetFromEnd(value.length - Math.max(index, -1) - 1);
}
function moveInputBeforePreviousToken() {
setInputOffsetFromEnd(prevInputOffsetFromEnd => {
return Math.min(prevInputOffsetFromEnd + 1, value.length);
});
}
function moveInputAfterNextToken() {
setInputOffsetFromEnd(prevInputOffsetFromEnd => {
return Math.max(prevInputOffsetFromEnd - 1, 0);
});
}
function deleteTokenBeforeInput() {
const index = getIndexOfInput() - 1;
if (index > -1) {
deleteToken(value[index]);
}
}
function deleteTokenAfterInput() {
const index = getIndexOfInput();
if (index < value.length) {
deleteToken(value[index]);
// Update input offset since it's the offset from the last token.
moveInputToIndex(index);
}
}
function addCurrentToken() {
let preventDefault = false;
const selectedSuggestion = getSelectedSuggestion();
if (selectedSuggestion) {
addNewToken(selectedSuggestion);
preventDefault = true;
} else if (inputHasValidValue()) {
addNewToken(incompleteTokenValue);
preventDefault = true;
}
return preventDefault;
}
function addNewTokens(tokens) {
const tokensToAdd = [...new Set(tokens.map(saveTransform).filter(Boolean).filter(token => !valueContainsToken(token)))];
if (tokensToAdd.length > 0) {
const newValue = [...value];
newValue.splice(getIndexOfInput(), 0, ...tokensToAdd);
onChange(newValue);
}
}
function addNewToken(token) {
if (!__experimentalValidateInput(token)) {
(0,external_wp_a11y_namespaceObject.speak)(messages.__experimentalInvalid, 'assertive');
return;
}
addNewTokens([token]);
(0,external_wp_a11y_namespaceObject.speak)(messages.added, 'assertive');
setIncompleteTokenValue('');
setSelectedSuggestionIndex(-1);
setSelectedSuggestionScroll(false);
setIsExpanded(!__experimentalExpandOnFocus);
if (isActive && !tokenizeOnBlur) {
focus();
}
}
function deleteToken(token) {
const newTokens = value.filter(item => {
return getTokenValue(item) !== getTokenValue(token);
});
onChange(newTokens);
(0,external_wp_a11y_namespaceObject.speak)(messages.removed, 'assertive');
}
function getTokenValue(token) {
if ('object' === typeof token) {
return token.value;
}
return token;
}
function getMatchingSuggestions(searchValue = incompleteTokenValue, _suggestions = suggestions, _value = value, _maxSuggestions = maxSuggestions, _saveTransform = saveTransform) {
let match = _saveTransform(searchValue);
const startsWithMatch = [];
const containsMatch = [];
const normalizedValue = _value.map(item => {
if (typeof item === 'string') {
return item;
}
return item.value;
});
if (match.length === 0) {
_suggestions = _suggestions.filter(suggestion => !normalizedValue.includes(suggestion));
} else {
match = match.toLocaleLowerCase();
_suggestions.forEach(suggestion => {
const index = suggestion.toLocaleLowerCase().indexOf(match);
if (normalizedValue.indexOf(suggestion) === -1) {
if (index === 0) {
startsWithMatch.push(suggestion);
} else if (index > 0) {
containsMatch.push(suggestion);
}
}
});
_suggestions = startsWithMatch.concat(containsMatch);
}
return _suggestions.slice(0, _maxSuggestions);
}
function getSelectedSuggestion() {
if (selectedSuggestionIndex !== -1) {
return getMatchingSuggestions()[selectedSuggestionIndex];
}
return undefined;
}
function valueContainsToken(token) {
return value.some(item => {
return getTokenValue(token) === getTokenValue(item);
});
}
function getIndexOfInput() {
return value.length - inputOffsetFromEnd;
}
function isInputEmpty() {
return incompleteTokenValue.length === 0;
}
function inputHasValidValue() {
return saveTransform(incompleteTokenValue).length > 0;
}
function updateSuggestions(resetSelectedSuggestion = true) {
const inputHasMinimumChars = incompleteTokenValue.trim().length > 1;
const matchingSuggestions = getMatchingSuggestions(incompleteTokenValue);
const hasMatchingSuggestions = matchingSuggestions.length > 0;
const shouldExpandIfFocuses = hasFocus() && __experimentalExpandOnFocus;
setIsExpanded(shouldExpandIfFocuses || inputHasMinimumChars && hasMatchingSuggestions);
if (resetSelectedSuggestion) {
if (__experimentalAutoSelectFirstMatch && inputHasMinimumChars && hasMatchingSuggestions) {
setSelectedSuggestionIndex(0);
setSelectedSuggestionScroll(true);
} else {
setSelectedSuggestionIndex(-1);
setSelectedSuggestionScroll(false);
}
}
if (inputHasMinimumChars) {
const message = hasMatchingSuggestions ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: 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.', matchingSuggestions.length), matchingSuggestions.length) : (0,external_wp_i18n_namespaceObject.__)('No results.');
debouncedSpeak(message, 'assertive');
}
}
function renderTokensAndInput() {
const components = value.map(renderToken);
components.splice(getIndexOfInput(), 0, renderInput());
return components;
}
function renderToken(token, index, tokens) {
const _value = getTokenValue(token);
const status = typeof token !== 'string' ? token.status : undefined;
const termPosition = index + 1;
const termsCount = tokens.length;
return (0,external_React_.createElement)(flex_item_component, {
key: 'token-' + _value
}, (0,external_React_.createElement)(Token, {
value: _value,
status: status,
title: typeof token !== 'string' ? token.title : undefined,
displayTransform: displayTransform,
onClickRemove: onTokenClickRemove,
isBorderless: typeof token !== 'string' && token.isBorderless || isBorderless,
onMouseEnter: typeof token !== 'string' ? token.onMouseEnter : undefined,
onMouseLeave: typeof token !== 'string' ? token.onMouseLeave : undefined,
disabled: 'error' !== status && disabled,
messages: messages,
termsCount: termsCount,
termPosition: termPosition
}));
}
function renderInput() {
const inputProps = {
instanceId,
autoCapitalize,
autoComplete,
placeholder: value.length === 0 ? placeholder : '',
key: 'input',
disabled,
value: incompleteTokenValue,
onBlur,
isExpanded,
selectedSuggestionIndex
};
return (0,external_React_.createElement)(token_input, {
...inputProps,
onChange: !(maxLength && value.length >= maxLength) ? onInputChangeHandler : undefined,
ref: input
});
}
const classes = classnames_default()(className, 'components-form-token-field__input-container', {
'is-active': isActive,
'is-disabled': disabled
});
let tokenFieldProps = {
className: 'components-form-token-field',
tabIndex: -1
};
const matchingSuggestions = getMatchingSuggestions();
if (!disabled) {
tokenFieldProps = Object.assign({}, tokenFieldProps, {
onKeyDown,
onKeyPress,
onFocus: onFocusHandler
});
}
// Disable reason: There is no appropriate role which describes the
// input container intended accessible usability.
// TODO: Refactor click detection to use blur to stop propagation.
/* eslint-disable jsx-a11y/no-static-element-interactions */
return (0,external_React_.createElement)("div", {
...tokenFieldProps
}, (0,external_React_.createElement)(StyledLabel, {
htmlFor: `components-form-token-input-${instanceId}`,
className: "components-form-token-field__label"
}, label), (0,external_React_.createElement)("div", {
ref: tokensAndInput,
className: classes,
tabIndex: -1,
onMouseDown: onContainerTouched,
onTouchStart: onContainerTouched
}, (0,external_React_.createElement)(TokensAndInputWrapperFlex, {
justify: "flex-start",
align: "center",
gap: 1,
wrap: true,
__next40pxDefaultSize: __next40pxDefaultSize,
hasTokens: !!value.length
}, renderTokensAndInput()), isExpanded && (0,external_React_.createElement)(suggestions_list, {
instanceId: instanceId,
match: saveTransform(incompleteTokenValue),
displayTransform: displayTransform,
suggestions: matchingSuggestions,
selectedIndex: selectedSuggestionIndex,
scrollIntoView: selectedSuggestionScroll,
onHover: onSuggestionHovered,
onSelect: onSuggestionSelected,
__experimentalRenderItem: __experimentalRenderItem
})), !__nextHasNoMarginBottom && (0,external_React_.createElement)(spacer_component, {
marginBottom: 2
}), __experimentalShowHowTo && (0,external_React_.createElement)(StyledHelp, {
id: `components-form-token-suggestions-howto-${instanceId}`,
className: "components-form-token-field__help",
__nextHasNoMarginBottom: __nextHasNoMarginBottom
}, tokenizeOnSpace ? (0,external_wp_i18n_namespaceObject.__)('Separate with commas, spaces, or the Enter key.') : (0,external_wp_i18n_namespaceObject.__)('Separate with commas or the Enter key.')));
/* eslint-enable jsx-a11y/no-static-element-interactions */
}
/* harmony default export */ const form_token_field = (FormTokenField);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/icons.js
/**
* WordPress dependencies
*/
const PageControlIcon = () => (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
width: "8",
height: "8",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Circle, {
cx: "4",
cy: "4",
r: "4"
}));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/page-control.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PageControl({
currentPage,
numberOfPages,
setCurrentPage
}) {
return (0,external_React_.createElement)("ul", {
className: "components-guide__page-control",
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Guide controls')
}, Array.from({
length: numberOfPages
}).map((_, page) => (0,external_React_.createElement)("li", {
key: page
// Set aria-current="step" on the active page, see https://www.w3.org/TR/wai-aria-1.1/#aria-current
,
"aria-current": page === currentPage ? 'step' : undefined
}, (0,external_React_.createElement)(build_module_button, {
key: page,
icon: (0,external_React_.createElement)(PageControlIcon, null),
"aria-label": (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: current page number 2: total number of pages */
(0,external_wp_i18n_namespaceObject.__)('Page %1$d of %2$d'), page + 1, numberOfPages),
onClick: () => setCurrentPage(page)
}))));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* `Guide` is a React component that renders a _user guide_ in a modal. The guide consists of several pages which the user can step through one by one. The guide is finished when the modal is closed or when the user clicks _Finish_ on the last page of the guide.
*
* ```jsx
* function MyTutorial() {
* const [ isOpen, setIsOpen ] = useState( true );
*
* if ( ! isOpen ) {
* return null;
* }
*
* return (
* <Guide
* onFinish={ () => setIsOpen( false ) }
* pages={ [
* {
* content: <p>Welcome to the ACME Store!</p>,
* },
* {
* image: <img src="https://acmestore.com/add-to-cart.png" />,
* content: (
* <p>
* Click <i>Add to Cart</i> to buy a product.
* </p>
* ),
* },
* ] }
* />
* );
* }
* ```
*/
function Guide({
children,
className,
contentLabel,
finishButtonText = (0,external_wp_i18n_namespaceObject.__)('Finish'),
onFinish,
pages = []
}) {
const ref = (0,external_wp_element_namespaceObject.useRef)(null);
const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(0);
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Place focus at the top of the guide on mount and when the page changes.
const frame = ref.current?.querySelector('.components-guide');
if (frame instanceof HTMLElement) {
frame.focus();
}
}, [currentPage]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (external_wp_element_namespaceObject.Children.count(children)) {
external_wp_deprecated_default()('Passing children to <Guide>', {
since: '5.5',
alternative: 'the `pages` prop'
});
}
}, [children]);
if (external_wp_element_namespaceObject.Children.count(children)) {
var _Children$map;
pages = (_Children$map = external_wp_element_namespaceObject.Children.map(children, child => ({
content: child
}))) !== null && _Children$map !== void 0 ? _Children$map : [];
}
const canGoBack = currentPage > 0;
const canGoForward = currentPage < pages.length - 1;
const goBack = () => {
if (canGoBack) {
setCurrentPage(currentPage - 1);
}
};
const goForward = () => {
if (canGoForward) {
setCurrentPage(currentPage + 1);
}
};
if (pages.length === 0) {
return null;
}
return (0,external_React_.createElement)(modal, {
className: classnames_default()('components-guide', className),
contentLabel: contentLabel,
isDismissible: pages.length > 1,
onRequestClose: onFinish,
onKeyDown: event => {
if (event.code === 'ArrowLeft') {
goBack();
// Do not scroll the modal's contents.
event.preventDefault();
} else if (event.code === 'ArrowRight') {
goForward();
// Do not scroll the modal's contents.
event.preventDefault();
}
},
ref: ref
}, (0,external_React_.createElement)("div", {
className: "components-guide__container"
}, (0,external_React_.createElement)("div", {
className: "components-guide__page"
}, pages[currentPage].image, pages.length > 1 && (0,external_React_.createElement)(PageControl, {
currentPage: currentPage,
numberOfPages: pages.length,
setCurrentPage: setCurrentPage
}), pages[currentPage].content), (0,external_React_.createElement)("div", {
className: "components-guide__footer"
}, canGoBack && (0,external_React_.createElement)(build_module_button, {
className: "components-guide__back-button",
variant: "tertiary",
onClick: goBack
}, (0,external_wp_i18n_namespaceObject.__)('Previous')), canGoForward && (0,external_React_.createElement)(build_module_button, {
className: "components-guide__forward-button",
variant: "primary",
onClick: goForward
}, (0,external_wp_i18n_namespaceObject.__)('Next')), !canGoForward && (0,external_React_.createElement)(build_module_button, {
className: "components-guide__finish-button",
variant: "primary",
onClick: onFinish
}, finishButtonText))));
}
/* harmony default export */ const guide = (Guide);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/page.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function GuidePage(props) {
(0,external_wp_element_namespaceObject.useEffect)(() => {
external_wp_deprecated_default()('<GuidePage>', {
since: '5.5',
alternative: 'the `pages` prop in <Guide>'
});
}, []);
return (0,external_React_.createElement)("div", {
...props
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/button/deprecated.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedIconButton({
label,
labelPosition,
size,
tooltip,
...props
}, ref) {
external_wp_deprecated_default()('wp.components.IconButton', {
since: '5.4',
alternative: 'wp.components.Button',
version: '6.2'
});
return (0,external_React_.createElement)(build_module_button, {
...props,
ref: ref,
tooltipPosition: labelPosition,
iconSize: size,
showTooltip: tooltip !== undefined ? !!tooltip : undefined,
label: tooltip || label
});
}
/* harmony default export */ const deprecated = ((0,external_wp_element_namespaceObject.forwardRef)(UnforwardedIconButton));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/item/hook.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useItem(props) {
const {
as: asProp,
className,
onClick,
role = 'listitem',
size: sizeProp,
...otherProps
} = useContextSystem(props, 'Item');
const {
spacedAround,
size: contextSize
} = useItemGroupContext();
const size = sizeProp || contextSize;
const as = asProp || (typeof onClick !== 'undefined' ? 'button' : 'div');
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx((as === 'button' || as === 'a') && unstyledButton(as), itemSizes[size] || itemSizes.medium, item, spacedAround && styles_spacedAround, className), [as, className, cx, size, spacedAround]);
const wrapperClassName = cx(itemWrapper);
return {
as,
className: classes,
onClick,
wrapperClassName,
role,
...otherProps
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/item/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedItem(props, forwardedRef) {
const {
role,
wrapperClassName,
...otherProps
} = useItem(props);
return (0,external_React_.createElement)("div", {
role: role,
className: wrapperClassName
}, (0,external_React_.createElement)(component, {
...otherProps,
ref: forwardedRef
}));
}
/**
* `Item` is used in combination with `ItemGroup` to display a list of items
* grouped and styled together.
*
* ```jsx
* import {
* __experimentalItemGroup as ItemGroup,
* __experimentalItem as Item,
* } from '@wordpress/components';
*
* function Example() {
* return (
* <ItemGroup>
* <Item>Code</Item>
* <Item>is</Item>
* <Item>Poetry</Item>
* </ItemGroup>
* );
* }
* ```
*/
const component_Item = contextConnect(UnconnectedItem, 'Item');
/* harmony default export */ const item_component = (component_Item);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-prefix-wrapper.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedInputControlPrefixWrapper(props, forwardedRef) {
const derivedProps = useContextSystem(props, 'InputControlPrefixWrapper');
return (0,external_React_.createElement)(spacer_component, {
marginBottom: 0,
...derivedProps,
ref: forwardedRef
});
}
/**
* A convenience wrapper for the `prefix` when you want to apply
* standard padding in accordance with the size variant.
*
* ```jsx
* import {
* __experimentalInputControl as InputControl,
* __experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,
* } from '@wordpress/components';
*
* <InputControl
* prefix={<InputControlPrefixWrapper>@</InputControlPrefixWrapper>}
* />
* ```
*/
const InputControlPrefixWrapper = contextConnect(UnconnectedInputControlPrefixWrapper, 'InputControlPrefixWrapper');
/* harmony default export */ const input_prefix_wrapper = (InputControlPrefixWrapper);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/keyboard-shortcuts/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function KeyboardShortcut({
target,
callback,
shortcut,
bindGlobal,
eventName
}) {
(0,external_wp_compose_namespaceObject.useKeyboardShortcut)(shortcut, callback, {
bindGlobal,
target,
eventName
});
return null;
}
/**
* `KeyboardShortcuts` is a component which handles keyboard sequences during the lifetime of the rendering element.
*
* When passed children, it will capture key events which occur on or within the children. If no children are passed, events are captured on the document.
*
* It uses the [Mousetrap](https://craig.is/killing/mice) library to implement keyboard sequence bindings.
*
* ```jsx
* import { KeyboardShortcuts } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyKeyboardShortcuts = () => {
* const [ isAllSelected, setIsAllSelected ] = useState( false );
* const selectAll = () => {
* setIsAllSelected( true );
* };
*
* return (
* <div>
* <KeyboardShortcuts
* shortcuts={ {
* 'mod+a': selectAll,
* } }
* />
* [cmd/ctrl + A] Combination pressed? { isAllSelected ? 'Yes' : 'No' }
* </div>
* );
* };
* ```
*/
function KeyboardShortcuts({
children,
shortcuts,
bindGlobal,
eventName
}) {
const target = (0,external_wp_element_namespaceObject.useRef)(null);
const element = Object.entries(shortcuts !== null && shortcuts !== void 0 ? shortcuts : {}).map(([shortcut, callback]) => (0,external_React_.createElement)(KeyboardShortcut, {
key: shortcut,
shortcut: shortcut,
callback: callback,
bindGlobal: bindGlobal,
eventName: eventName,
target: target
}));
// Render as non-visual if there are no children pressed. Keyboard
// events will be bound to the document instead.
if (!external_wp_element_namespaceObject.Children.count(children)) {
return (0,external_React_.createElement)(external_React_.Fragment, null, element);
}
return (0,external_React_.createElement)("div", {
ref: target
}, element, children);
}
/* harmony default export */ const keyboard_shortcuts = (KeyboardShortcuts);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/menu-group/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* `MenuGroup` wraps a series of related `MenuItem` components into a common
* section.
*
* ```jsx
* import { MenuGroup, MenuItem } from '@wordpress/components';
*
* const MyMenuGroup = () => (
* <MenuGroup label="Settings">
* <MenuItem>Setting 1</MenuItem>
* <MenuItem>Setting 2</MenuItem>
* </MenuGroup>
* );
* ```
*/
function MenuGroup(props) {
const {
children,
className = '',
label,
hideSeparator
} = props;
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(MenuGroup);
if (!external_wp_element_namespaceObject.Children.count(children)) {
return null;
}
const labelId = `components-menu-group-label-${instanceId}`;
const classNames = classnames_default()(className, 'components-menu-group', {
'has-hidden-separator': hideSeparator
});
return (0,external_React_.createElement)("div", {
className: classNames
}, label && (0,external_React_.createElement)("div", {
className: "components-menu-group__label",
id: labelId,
"aria-hidden": "true"
}, label), (0,external_React_.createElement)("div", {
role: "group",
"aria-labelledby": label ? labelId : undefined
}, children));
}
/* harmony default export */ const menu_group = (MenuGroup);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/menu-item/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedMenuItem(props, ref) {
let {
children,
info,
className,
icon,
iconPosition = 'right',
shortcut,
isSelected,
role = 'menuitem',
suffix,
...buttonProps
} = props;
className = classnames_default()('components-menu-item__button', className);
if (info) {
children = (0,external_React_.createElement)("span", {
className: "components-menu-item__info-wrapper"
}, (0,external_React_.createElement)("span", {
className: "components-menu-item__item"
}, children), (0,external_React_.createElement)("span", {
className: "components-menu-item__info"
}, info));
}
if (icon && typeof icon !== 'string') {
icon = (0,external_wp_element_namespaceObject.cloneElement)(icon, {
className: classnames_default()('components-menu-items__item-icon', {
'has-icon-right': iconPosition === 'right'
})
});
}
return (0,external_React_.createElement)(build_module_button, {
ref: ref
// Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked
,
"aria-checked": role === 'menuitemcheckbox' || role === 'menuitemradio' ? isSelected : undefined,
role: role,
icon: iconPosition === 'left' ? icon : undefined,
className: className,
...buttonProps
}, (0,external_React_.createElement)("span", {
className: "components-menu-item__item"
}, children), !suffix && (0,external_React_.createElement)(build_module_shortcut, {
className: "components-menu-item__shortcut",
shortcut: shortcut
}), !suffix && icon && iconPosition === 'right' && (0,external_React_.createElement)(build_module_icon, {
icon: icon
}), suffix);
}
/**
* MenuItem is a component which renders a button intended to be used in combination with the `DropdownMenu` component.
*
* ```jsx
* import { MenuItem } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyMenuItem = () => {
* const [ isActive, setIsActive ] = useState( true );
*
* return (
* <MenuItem
* icon={ isActive ? 'yes' : 'no' }
* isSelected={ isActive }
* role="menuitemcheckbox"
* onClick={ () => setIsActive( ( state ) => ! state ) }
* >
* Toggle
* </MenuItem>
* );
* };
* ```
*/
const MenuItem = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedMenuItem);
/* harmony default export */ const menu_item = (MenuItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/menu-items-choice/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const menu_items_choice_noop = () => {};
/**
* `MenuItemsChoice` functions similarly to a set of `MenuItem`s, but allows the user to select one option from a set of multiple choices.
*
*
* ```jsx
* import { MenuGroup, MenuItemsChoice } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyMenuItemsChoice = () => {
* const [ mode, setMode ] = useState( 'visual' );
* const choices = [
* {
* value: 'visual',
* label: 'Visual editor',
* },
* {
* value: 'text',
* label: 'Code editor',
* },
* ];
*
* return (
* <MenuGroup label="Editor">
* <MenuItemsChoice
* choices={ choices }
* value={ mode }
* onSelect={ ( newMode ) => setMode( newMode ) }
* />
* </MenuGroup>
* );
* };
* ```
*/
function MenuItemsChoice({
choices = [],
onHover = menu_items_choice_noop,
onSelect,
value
}) {
return (0,external_React_.createElement)(external_React_.Fragment, null, choices.map(item => {
const isSelected = value === item.value;
return (0,external_React_.createElement)(menu_item, {
key: item.value,
role: "menuitemradio",
disabled: item.disabled,
icon: isSelected ? library_check : null,
info: item.info,
isSelected: isSelected,
shortcut: item.shortcut,
className: "components-menu-items-choice",
onClick: () => {
if (!isSelected) {
onSelect(item.value);
}
},
onMouseEnter: () => onHover(item.value),
onMouseLeave: () => onHover(null),
"aria-label": item['aria-label']
}, item.label);
}));
}
/* harmony default export */ const menu_items_choice = (MenuItemsChoice);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigable-container/tabbable.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedTabbableContainer({
eventToOffset,
...props
}, ref) {
const innerEventToOffset = evt => {
const {
code,
shiftKey
} = evt;
if ('Tab' === code) {
return shiftKey ? -1 : 1;
}
// Allow custom handling of keys besides Tab.
//
// By default, TabbableContainer will move focus forward on Tab and
// backward on Shift+Tab. The handler below will be used for all other
// events. The semantics for `eventToOffset`'s return
// values are the following:
//
// - +1: move focus forward
// - -1: move focus backward
// - 0: don't move focus, but acknowledge event and thus stop it
// - undefined: do nothing, let the event propagate.
if (eventToOffset) {
return eventToOffset(evt);
}
return undefined;
};
return (0,external_React_.createElement)(container, {
ref: ref,
stopNavigationEvents: true,
onlyBrowserTabstops: true,
eventToOffset: innerEventToOffset,
...props
});
}
/**
* A container for tabbable elements.
*
* ```jsx
* import {
* TabbableContainer,
* Button,
* } from '@wordpress/components';
*
* function onNavigate( index, target ) {
* console.log( `Navigates to ${ index }`, target );
* }
*
* const MyTabbableContainer = () => (
* <div>
* <span>Tabbable Container:</span>
* <TabbableContainer onNavigate={ onNavigate }>
* <Button variant="secondary" tabIndex="0">
* Section 1
* </Button>
* <Button variant="secondary" tabIndex="0">
* Section 2
* </Button>
* <Button variant="secondary" tabIndex="0">
* Section 3
* </Button>
* <Button variant="secondary" tabIndex="0">
* Section 4
* </Button>
* </TabbableContainer>
* </div>
* );
* ```
*/
const TabbableContainer = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTabbableContainer);
/* harmony default export */ const tabbable = (TabbableContainer);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/constants.js
const ROOT_MENU = 'root';
const SEARCH_FOCUS_DELAY = 100;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/context.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const context_noop = () => {};
const defaultIsEmpty = () => false;
const defaultGetter = () => undefined;
const NavigationContext = (0,external_wp_element_namespaceObject.createContext)({
activeItem: undefined,
activeMenu: ROOT_MENU,
setActiveMenu: context_noop,
navigationTree: {
items: {},
getItem: defaultGetter,
addItem: context_noop,
removeItem: context_noop,
menus: {},
getMenu: defaultGetter,
addMenu: context_noop,
removeMenu: context_noop,
childMenu: {},
traverseMenu: context_noop,
isMenuEmpty: defaultIsEmpty
}
});
const useNavigationContext = () => (0,external_wp_element_namespaceObject.useContext)(NavigationContext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/styles/navigation-styles.js
function navigation_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const NavigationUI = emotion_styled_base_browser_esm("div", true ? {
target: "eeiismy11"
} : 0)("width:100%;box-sizing:border-box;padding:0 ", space(4), ";overflow:hidden;" + ( true ? "" : 0));
const MenuUI = emotion_styled_base_browser_esm("div", true ? {
target: "eeiismy10"
} : 0)("margin-top:", space(6), ";margin-bottom:", space(6), ";display:flex;flex-direction:column;ul{padding:0;margin:0;list-style:none;}.components-navigation__back-button{margin-bottom:", space(6), ";}.components-navigation__group+.components-navigation__group{margin-top:", space(6), ";}" + ( true ? "" : 0));
const MenuBackButtonUI = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
target: "eeiismy9"
} : 0)( true ? {
name: "26l0q2",
styles: "&.is-tertiary{color:inherit;opacity:0.7;&:hover:not( :disabled ){opacity:1;box-shadow:none;color:inherit;}&:active:not( :disabled ){background:transparent;opacity:1;color:inherit;}}"
} : 0);
const MenuTitleUI = emotion_styled_base_browser_esm("div", true ? {
target: "eeiismy8"
} : 0)( true ? {
name: "1aubja5",
styles: "overflow:hidden;width:100%"
} : 0);
const MenuTitleSearchControlWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "eeiismy7"
} : 0)( true ? {
name: "rgorny",
styles: "margin:11px 0;padding:1px"
} : 0);
const MenuTitleActionsUI = emotion_styled_base_browser_esm("span", true ? {
target: "eeiismy6"
} : 0)("height:", space(6), ";.components-button.is-small{color:inherit;opacity:0.7;margin-right:", space(1), ";padding:0;&:active:not( :disabled ){background:none;opacity:1;color:inherit;}&:hover:not( :disabled ){box-shadow:none;opacity:1;color:inherit;}}" + ( true ? "" : 0));
const GroupTitleUI = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? {
target: "eeiismy5"
} : 0)("min-height:", space(12), ";align-items:center;color:inherit;display:flex;justify-content:space-between;margin-bottom:", space(2), ";padding:", () => (0,external_wp_i18n_namespaceObject.isRTL)() ? `${space(1)} ${space(4)} ${space(1)} ${space(2)}` : `${space(1)} ${space(2)} ${space(1)} ${space(4)}`, ";" + ( true ? "" : 0));
const ItemBaseUI = emotion_styled_base_browser_esm("li", true ? {
target: "eeiismy4"
} : 0)("border-radius:2px;color:inherit;margin-bottom:0;>button,>a.components-button,>a{width:100%;color:inherit;opacity:0.7;padding:", space(2), " ", space(4), ";", rtl({
textAlign: 'left'
}, {
textAlign: 'right'
}), " &:hover,&:focus:not( [aria-disabled='true'] ):active,&:active:not( [aria-disabled='true'] ):active{color:inherit;opacity:1;}}&.is-active{background-color:", COLORS.theme.accent, ";color:", COLORS.white, ";>button,>a{color:", COLORS.white, ";opacity:1;}}>svg path{color:", COLORS.gray[600], ";}" + ( true ? "" : 0));
const ItemUI = emotion_styled_base_browser_esm("div", true ? {
target: "eeiismy3"
} : 0)("display:flex;align-items:center;height:auto;min-height:40px;margin:0;padding:", space(1.5), " ", space(4), ";font-weight:400;line-height:20px;width:100%;color:inherit;opacity:0.7;" + ( true ? "" : 0));
const ItemIconUI = emotion_styled_base_browser_esm("span", true ? {
target: "eeiismy2"
} : 0)("display:flex;margin-right:", space(2), ";" + ( true ? "" : 0));
const ItemBadgeUI = emotion_styled_base_browser_esm("span", true ? {
target: "eeiismy1"
} : 0)("margin-left:", () => (0,external_wp_i18n_namespaceObject.isRTL)() ? '0' : space(2), ";margin-right:", () => (0,external_wp_i18n_namespaceObject.isRTL)() ? space(2) : '0', ";display:inline-flex;padding:", space(1), " ", space(3), ";border-radius:2px;animation:fade-in 250ms ease-out;@keyframes fade-in{from{opacity:0;}to{opacity:1;}}", reduceMotion('animation'), ";" + ( true ? "" : 0));
const ItemTitleUI = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? {
target: "eeiismy0"
} : 0)(() => (0,external_wp_i18n_namespaceObject.isRTL)() ? 'margin-left: auto;' : 'margin-right: auto;', " font-size:14px;line-height:20px;color:inherit;" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/use-navigation-tree-nodes.js
/**
* WordPress dependencies
*/
function useNavigationTreeNodes() {
const [nodes, setNodes] = (0,external_wp_element_namespaceObject.useState)({});
const getNode = key => nodes[key];
const addNode = (key, value) => {
const {
children,
...newNode
} = value;
return setNodes(original => ({
...original,
[key]: newNode
}));
};
const removeNode = key => {
return setNodes(original => {
const {
[key]: removedNode,
...remainingNodes
} = original;
return remainingNodes;
});
};
return {
nodes,
getNode,
addNode,
removeNode
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/use-create-navigation-tree.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const useCreateNavigationTree = () => {
const {
nodes: items,
getNode: getItem,
addNode: addItem,
removeNode: removeItem
} = useNavigationTreeNodes();
const {
nodes: menus,
getNode: getMenu,
addNode: addMenu,
removeNode: removeMenu
} = useNavigationTreeNodes();
/**
* Stores direct nested menus of menus
* This makes it easy to traverse menu tree
*
* Key is the menu prop of the menu
* Value is an array of menu keys
*/
const [childMenu, setChildMenu] = (0,external_wp_element_namespaceObject.useState)({});
const getChildMenu = menu => childMenu[menu] || [];
const traverseMenu = (startMenu, callback) => {
const visited = [];
let queue = [startMenu];
let current;
while (queue.length > 0) {
// Type cast to string is safe because of the `length > 0` check above.
current = getMenu(queue.shift());
if (!current || visited.includes(current.menu)) {
continue;
}
visited.push(current.menu);
queue = [...queue, ...getChildMenu(current.menu)];
if (callback(current) === false) {
break;
}
}
};
const isMenuEmpty = menuToCheck => {
let isEmpty = true;
traverseMenu(menuToCheck, current => {
if (!current.isEmpty) {
isEmpty = false;
return false;
}
return undefined;
});
return isEmpty;
};
return {
items,
getItem,
addItem,
removeItem,
menus,
getMenu,
addMenu: (key, value) => {
setChildMenu(state => {
const newState = {
...state
};
if (!value.parentMenu) {
return newState;
}
if (!newState[value.parentMenu]) {
newState[value.parentMenu] = [];
}
newState[value.parentMenu].push(key);
return newState;
});
addMenu(key, value);
},
removeMenu,
childMenu,
traverseMenu,
isMenuEmpty
};
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const navigation_noop = () => {};
/**
* Render a navigation list with optional groupings and hierarchy.
*
* ```jsx
* import {
* __experimentalNavigation as Navigation,
* __experimentalNavigationGroup as NavigationGroup,
* __experimentalNavigationItem as NavigationItem,
* __experimentalNavigationMenu as NavigationMenu,
* } from '@wordpress/components';
*
* const MyNavigation = () => (
* <Navigation>
* <NavigationMenu title="Home">
* <NavigationGroup title="Group 1">
* <NavigationItem item="item-1" title="Item 1" />
* <NavigationItem item="item-2" title="Item 2" />
* </NavigationGroup>
* <NavigationGroup title="Group 2">
* <NavigationItem
* item="item-3"
* navigateToMenu="category"
* title="Category"
* />
* </NavigationGroup>
* </NavigationMenu>
*
* <NavigationMenu
* backButtonLabel="Home"
* menu="category"
* parentMenu="root"
* title="Category"
* >
* <NavigationItem badge="1" item="child-1" title="Child 1" />
* <NavigationItem item="child-2" title="Child 2" />
* </NavigationMenu>
* </Navigation>
* );
* ```
*/
function Navigation({
activeItem,
activeMenu = ROOT_MENU,
children,
className,
onActivateMenu = navigation_noop
}) {
const [menu, setMenu] = (0,external_wp_element_namespaceObject.useState)(activeMenu);
const [slideOrigin, setSlideOrigin] = (0,external_wp_element_namespaceObject.useState)();
const navigationTree = useCreateNavigationTree();
const defaultSlideOrigin = (0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left';
const setActiveMenu = (menuId, slideInOrigin = defaultSlideOrigin) => {
if (!navigationTree.getMenu(menuId)) {
return;
}
setSlideOrigin(slideInOrigin);
setMenu(menuId);
onActivateMenu(menuId);
};
// Used to prevent the sliding animation on mount
const isMounted = (0,external_wp_element_namespaceObject.useRef)(false);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isMounted.current) {
isMounted.current = true;
}
}, []);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (activeMenu !== menu) {
setActiveMenu(activeMenu);
}
// Ignore exhaustive-deps here, as it would require either a larger refactor or some questionable workarounds.
// See https://github.com/WordPress/gutenberg/pull/41612 for context.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [activeMenu]);
const context = {
activeItem,
activeMenu: menu,
setActiveMenu,
navigationTree
};
const classes = classnames_default()('components-navigation', className);
const animateClassName = getAnimateClassName({
type: 'slide-in',
origin: slideOrigin
});
return (0,external_React_.createElement)(NavigationUI, {
className: classes
}, (0,external_React_.createElement)("div", {
key: menu,
className: animateClassName ? classnames_default()({
[animateClassName]: isMounted.current && slideOrigin
}) : undefined
}, (0,external_React_.createElement)(NavigationContext.Provider, {
value: context
}, children)));
}
/* harmony default export */ const navigation = (Navigation);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
/**
* WordPress dependencies
*/
const chevronRight = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const chevron_right = (chevronRight);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
/**
* WordPress dependencies
*/
const chevronLeft = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const chevron_left = (chevronLeft);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/back-button/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedNavigationBackButton({
backButtonLabel,
className,
href,
onClick,
parentMenu
}, ref) {
const {
setActiveMenu,
navigationTree
} = useNavigationContext();
const classes = classnames_default()('components-navigation__back-button', className);
const parentMenuTitle = parentMenu !== undefined ? navigationTree.getMenu(parentMenu)?.title : undefined;
const handleOnClick = event => {
if (typeof onClick === 'function') {
onClick(event);
}
const animationDirection = (0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right';
if (parentMenu && !event.defaultPrevented) {
setActiveMenu(parentMenu, animationDirection);
}
};
const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left;
return (0,external_React_.createElement)(MenuBackButtonUI, {
className: classes,
href: href,
variant: "tertiary",
ref: ref,
onClick: handleOnClick
}, (0,external_React_.createElement)(icons_build_module_icon, {
icon: icon
}), backButtonLabel || parentMenuTitle || (0,external_wp_i18n_namespaceObject.__)('Back'));
}
const NavigationBackButton = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedNavigationBackButton);
/* harmony default export */ const back_button = (NavigationBackButton);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/group/context.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const NavigationGroupContext = (0,external_wp_element_namespaceObject.createContext)({
group: undefined
});
const useNavigationGroupContext = () => (0,external_wp_element_namespaceObject.useContext)(NavigationGroupContext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/group/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
let uniqueId = 0;
function NavigationGroup({
children,
className,
title
}) {
const [groupId] = (0,external_wp_element_namespaceObject.useState)(`group-${++uniqueId}`);
const {
navigationTree: {
items
}
} = useNavigationContext();
const context = {
group: groupId
};
// Keep the children rendered to make sure invisible items are included in the navigation tree.
if (!Object.values(items).some(item => item.group === groupId && item._isVisible)) {
return (0,external_React_.createElement)(NavigationGroupContext.Provider, {
value: context
}, children);
}
const groupTitleId = `components-navigation__group-title-${groupId}`;
const classes = classnames_default()('components-navigation__group', className);
return (0,external_React_.createElement)(NavigationGroupContext.Provider, {
value: context
}, (0,external_React_.createElement)("li", {
className: classes
}, title && (0,external_React_.createElement)(GroupTitleUI, {
className: "components-navigation__group-title",
id: groupTitleId,
level: 3
}, title), (0,external_React_.createElement)("ul", {
"aria-labelledby": groupTitleId,
role: "group"
}, children)));
}
/* harmony default export */ const group = (NavigationGroup);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/base-content.js
/**
* Internal dependencies
*/
function NavigationItemBaseContent(props) {
const {
badge,
title
} = props;
return (0,external_React_.createElement)(external_React_.Fragment, null, title && (0,external_React_.createElement)(ItemTitleUI, {
className: "components-navigation__item-title",
as: "span"
}, title), badge && (0,external_React_.createElement)(ItemBadgeUI, {
className: "components-navigation__item-badge"
}, badge));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/context.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const NavigationMenuContext = (0,external_wp_element_namespaceObject.createContext)({
menu: undefined,
search: ''
});
const useNavigationMenuContext = () => (0,external_wp_element_namespaceObject.useContext)(NavigationMenuContext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/utils.js
/**
* External dependencies
*/
// @see packages/block-editor/src/components/inserter/search-items.js
const normalizeInput = input => remove_accents_default()(input).replace(/^\//, '').toLowerCase();
const normalizedSearch = (title, search) => -1 !== normalizeInput(title).indexOf(normalizeInput(search));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/use-navigation-tree-item.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const useNavigationTreeItem = (itemId, props) => {
const {
activeMenu,
navigationTree: {
addItem,
removeItem
}
} = useNavigationContext();
const {
group
} = useNavigationGroupContext();
const {
menu,
search
} = useNavigationMenuContext();
(0,external_wp_element_namespaceObject.useEffect)(() => {
const isMenuActive = activeMenu === menu;
const isItemVisible = !search || props.title !== undefined && normalizedSearch(props.title, search);
addItem(itemId, {
...props,
group,
menu,
_isVisible: isMenuActive && isItemVisible
});
return () => {
removeItem(itemId);
};
// Ignore exhaustive-deps rule for now. See https://github.com/WordPress/gutenberg/pull/41639
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [activeMenu, search]);
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/base.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
let base_uniqueId = 0;
function NavigationItemBase(props) {
// Also avoid to pass the `title` and `href` props to the ItemBaseUI styled component.
const {
children,
className,
title,
href,
...restProps
} = props;
const [itemId] = (0,external_wp_element_namespaceObject.useState)(`item-${++base_uniqueId}`);
useNavigationTreeItem(itemId, props);
const {
navigationTree
} = useNavigationContext();
if (!navigationTree.getItem(itemId)?._isVisible) {
return null;
}
const classes = classnames_default()('components-navigation__item', className);
return (0,external_React_.createElement)(ItemBaseUI, {
className: classes,
...restProps
}, children);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const item_noop = () => {};
function NavigationItem(props) {
const {
badge,
children,
className,
href,
item,
navigateToMenu,
onClick = item_noop,
title,
icon,
hideIfTargetMenuEmpty,
isText,
...restProps
} = props;
const {
activeItem,
setActiveMenu,
navigationTree: {
isMenuEmpty
}
} = useNavigationContext();
// If hideIfTargetMenuEmpty prop is true
// And the menu we are supposed to navigate to
// Is marked as empty, then we skip rendering the item.
if (hideIfTargetMenuEmpty && navigateToMenu && isMenuEmpty(navigateToMenu)) {
return null;
}
const isActive = item && activeItem === item;
const classes = classnames_default()(className, {
'is-active': isActive
});
const onItemClick = event => {
if (navigateToMenu) {
setActiveMenu(navigateToMenu);
}
onClick(event);
};
const navigationIcon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right;
const baseProps = children ? props : {
...props,
onClick: undefined
};
const itemProps = isText ? restProps : {
as: build_module_button,
href,
onClick: onItemClick,
'aria-current': isActive ? 'page' : undefined,
...restProps
};
return (0,external_React_.createElement)(NavigationItemBase, {
...baseProps,
className: classes
}, children || (0,external_React_.createElement)(ItemUI, {
...itemProps
}, icon && (0,external_React_.createElement)(ItemIconUI, null, (0,external_React_.createElement)(icons_build_module_icon, {
icon: icon
})), (0,external_React_.createElement)(NavigationItemBaseContent, {
title: title,
badge: badge
}), navigateToMenu && (0,external_React_.createElement)(icons_build_module_icon, {
icon: navigationIcon
})));
}
/* harmony default export */ const navigation_item = (NavigationItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/use-navigation-tree-menu.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const useNavigationTreeMenu = props => {
const {
navigationTree: {
addMenu,
removeMenu
}
} = useNavigationContext();
const key = props.menu || ROOT_MENU;
(0,external_wp_element_namespaceObject.useEffect)(() => {
addMenu(key, {
...props,
menu: key
});
return () => {
removeMenu(key);
};
// Ignore exhaustive-deps rule for now. See https://github.com/WordPress/gutenberg/pull/44090
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js
/**
* WordPress dependencies
*/
const search = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"
}));
/* harmony default export */ const library_search = (search);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-spoken-messages/index.js
/**
* WordPress dependencies
*/
/** @typedef {import('react').ComponentType} ComponentType */
/**
* A Higher Order Component used to be provide speak and debounced speak
* functions.
*
* @see https://developer.wordpress.org/block-editor/packages/packages-a11y/#speak
*
* @param {ComponentType} Component The component to be wrapped.
*
* @return {ComponentType} The wrapped component.
*/
/* harmony default export */ const with_spoken_messages = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(Component => props => (0,external_React_.createElement)(Component, {
...props,
speak: external_wp_a11y_namespaceObject.speak,
debouncedSpeak: (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500)
}), 'withSpokenMessages'));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/search-control/styles.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const inlinePadding = ({
size
}) => {
return space(size === 'compact' ? 1 : 2);
};
const SuffixItemWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "effl84m1"
} : 0)("display:flex;padding-inline-end:", inlinePadding, ";svg{fill:currentColor;}" + ( true ? "" : 0));
const StyledInputControl = /*#__PURE__*/emotion_styled_base_browser_esm(input_control, true ? {
target: "effl84m0"
} : 0)("input[type='search']{&::-webkit-search-decoration,&::-webkit-search-cancel-button,&::-webkit-search-results-button,&::-webkit-search-results-decoration{-webkit-appearance:none;}}&:not( :focus-within ){--wp-components-color-background:", COLORS.theme.gray[100], ";}" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/search-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function SuffixItem({
searchRef,
value,
onChange,
onClose
}) {
if (!onClose && !value) {
return (0,external_React_.createElement)(icons_build_module_icon, {
icon: library_search
});
}
const onReset = () => {
onChange('');
searchRef.current?.focus();
};
return (0,external_React_.createElement)(build_module_button, {
size: "small",
icon: close_small,
label: onClose ? (0,external_wp_i18n_namespaceObject.__)('Close search') : (0,external_wp_i18n_namespaceObject.__)('Reset search'),
onClick: onClose !== null && onClose !== void 0 ? onClose : onReset
});
}
function UnforwardedSearchControl({
__nextHasNoMarginBottom = false,
className,
onChange,
value,
label = (0,external_wp_i18n_namespaceObject.__)('Search'),
placeholder = (0,external_wp_i18n_namespaceObject.__)('Search'),
hideLabelFromVision = true,
onClose,
size = 'default',
...restProps
}, forwardedRef) {
// @ts-expect-error The `disabled` prop is not yet supported in the SearchControl component.
// Work with the design team (@WordPress/gutenberg-design) if you need this feature.
delete restProps.disabled;
const searchRef = (0,external_wp_element_namespaceObject.useRef)(null);
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(SearchControl, 'components-search-control');
const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
// Overrides the underlying BaseControl `__nextHasNoMarginBottom` via the context system
// to provide backwards compatibile margin for SearchControl.
// (In a standard InputControl, the BaseControl `__nextHasNoMarginBottom` is always set to true.)
BaseControl: {
_overrides: {
__nextHasNoMarginBottom
}
},
// `isBorderless` is still experimental and not a public prop for InputControl yet.
InputBase: {
isBorderless: true
}
}), [__nextHasNoMarginBottom]);
return (0,external_React_.createElement)(ContextSystemProvider, {
value: contextValue
}, (0,external_React_.createElement)(StyledInputControl, {
__next40pxDefaultSize: true,
id: instanceId,
hideLabelFromVision: hideLabelFromVision,
label: label,
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([searchRef, forwardedRef]),
type: "search",
size: size,
className: classnames_default()('components-search-control', className),
onChange: nextValue => onChange(nextValue !== null && nextValue !== void 0 ? nextValue : ''),
autoComplete: "off",
placeholder: placeholder,
value: value !== null && value !== void 0 ? value : '',
suffix: (0,external_React_.createElement)(SuffixItemWrapper, {
size: size
}, (0,external_React_.createElement)(SuffixItem, {
searchRef: searchRef,
value: value,
onChange: onChange,
onClose: onClose
})),
...restProps
}));
}
/**
* SearchControl components let users display a search control.
*
* ```jsx
* import { SearchControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* function MySearchControl( { className, setState } ) {
* const [ searchInput, setSearchInput ] = useState( '' );
*
* return (
* <SearchControl
* __nextHasNoMarginBottom
* value={ searchInput }
* onChange={ setSearchInput }
* />
* );
* }
* ```
*/
const SearchControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSearchControl);
/* harmony default export */ const search_control = (SearchControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/menu-title-search.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function MenuTitleSearch({
debouncedSpeak,
onCloseSearch,
onSearch,
search,
title
}) {
const {
navigationTree: {
items
}
} = useNavigationContext();
const {
menu
} = useNavigationMenuContext();
const inputRef = (0,external_wp_element_namespaceObject.useRef)(null);
// Wait for the slide-in animation to complete before autofocusing the input.
// This prevents scrolling to the input during the animation.
(0,external_wp_element_namespaceObject.useEffect)(() => {
const delayedFocus = setTimeout(() => {
inputRef.current?.focus();
}, SEARCH_FOCUS_DELAY);
return () => {
clearTimeout(delayedFocus);
};
}, []);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!search) {
return;
}
const count = Object.values(items).filter(item => item._isVisible).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);
// Ignore exhaustive-deps rule for now. See https://github.com/WordPress/gutenberg/pull/44090
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [items, search]);
const onClose = () => {
onSearch?.('');
onCloseSearch();
};
const onKeyDown = event => {
if (event.code === 'Escape' && !event.defaultPrevented) {
event.preventDefault();
onClose();
}
};
const inputId = `components-navigation__menu-title-search-${menu}`;
const placeholder = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: placeholder for menu search box. %s: menu title */
(0,external_wp_i18n_namespaceObject.__)('Search %s'), title?.toLowerCase()).trim();
return (0,external_React_.createElement)(MenuTitleSearchControlWrapper, null, (0,external_React_.createElement)(search_control, {
__nextHasNoMarginBottom: true,
className: "components-navigation__menu-search-input",
id: inputId,
onChange: value => onSearch?.(value),
onKeyDown: onKeyDown,
placeholder: placeholder,
onClose: onClose,
ref: inputRef,
value: search
}));
}
/* harmony default export */ const menu_title_search = (with_spoken_messages(MenuTitleSearch));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/menu-title.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NavigationMenuTitle({
hasSearch,
onSearch,
search,
title,
titleAction
}) {
const [isSearching, setIsSearching] = (0,external_wp_element_namespaceObject.useState)(false);
const {
menu
} = useNavigationMenuContext();
const searchButtonRef = (0,external_wp_element_namespaceObject.useRef)(null);
if (!title) {
return null;
}
const onCloseSearch = () => {
setIsSearching(false);
// Wait for the slide-in animation to complete before focusing the search button.
// eslint-disable-next-line @wordpress/react-no-unsafe-timeout
setTimeout(() => {
searchButtonRef.current?.focus();
}, SEARCH_FOCUS_DELAY);
};
const menuTitleId = `components-navigation__menu-title-${menu}`;
/* translators: search button label for menu search box. %s: menu title */
const searchButtonLabel = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Search in %s'), title);
return (0,external_React_.createElement)(MenuTitleUI, {
className: "components-navigation__menu-title"
}, !isSearching && (0,external_React_.createElement)(GroupTitleUI, {
as: "h2",
className: "components-navigation__menu-title-heading",
level: 3
}, (0,external_React_.createElement)("span", {
id: menuTitleId
}, title), (hasSearch || titleAction) && (0,external_React_.createElement)(MenuTitleActionsUI, null, titleAction, hasSearch && (0,external_React_.createElement)(build_module_button, {
size: "small",
variant: "tertiary",
label: searchButtonLabel,
onClick: () => setIsSearching(true),
ref: searchButtonRef
}, (0,external_React_.createElement)(icons_build_module_icon, {
icon: library_search
})))), isSearching && (0,external_React_.createElement)("div", {
className: getAnimateClassName({
type: 'slide-in',
origin: 'left'
})
}, (0,external_React_.createElement)(menu_title_search, {
onCloseSearch: onCloseSearch,
onSearch: onSearch,
search: search,
title: title
})));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/search-no-results-found.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NavigationSearchNoResultsFound({
search
}) {
const {
navigationTree: {
items
}
} = useNavigationContext();
const resultsCount = Object.values(items).filter(item => item._isVisible).length;
if (!search || !!resultsCount) {
return null;
}
return (0,external_React_.createElement)(ItemBaseUI, null, (0,external_React_.createElement)(ItemUI, null, (0,external_wp_i18n_namespaceObject.__)('No results found.'), " "));
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NavigationMenu(props) {
const {
backButtonLabel,
children,
className,
hasSearch,
menu = ROOT_MENU,
onBackButtonClick,
onSearch: setControlledSearch,
parentMenu,
search: controlledSearch,
isSearchDebouncing,
title,
titleAction
} = props;
const [uncontrolledSearch, setUncontrolledSearch] = (0,external_wp_element_namespaceObject.useState)('');
useNavigationTreeMenu(props);
const {
activeMenu
} = useNavigationContext();
const context = {
menu,
search: uncontrolledSearch
};
// Keep the children rendered to make sure invisible items are included in the navigation tree.
if (activeMenu !== menu) {
return (0,external_React_.createElement)(NavigationMenuContext.Provider, {
value: context
}, children);
}
const isControlledSearch = !!setControlledSearch;
const search = isControlledSearch ? controlledSearch : uncontrolledSearch;
const onSearch = isControlledSearch ? setControlledSearch : setUncontrolledSearch;
const menuTitleId = `components-navigation__menu-title-${menu}`;
const classes = classnames_default()('components-navigation__menu', className);
return (0,external_React_.createElement)(NavigationMenuContext.Provider, {
value: context
}, (0,external_React_.createElement)(MenuUI, {
className: classes
}, (parentMenu || onBackButtonClick) && (0,external_React_.createElement)(back_button, {
backButtonLabel: backButtonLabel,
parentMenu: parentMenu,
onClick: onBackButtonClick
}), title && (0,external_React_.createElement)(NavigationMenuTitle, {
hasSearch: hasSearch,
onSearch: onSearch,
search: search,
title: title,
titleAction: titleAction
}), (0,external_React_.createElement)(navigable_container_menu, null, (0,external_React_.createElement)("ul", {
"aria-labelledby": menuTitleId
}, children, search && !isSearchDebouncing && (0,external_React_.createElement)(NavigationSearchNoResultsFound, {
search: search
})))));
}
/* harmony default export */ const navigation_menu = (NavigationMenu);
;// CONCATENATED MODULE: ./node_modules/path-to-regexp/dist.es2015/index.js
/**
* Tokenize input string.
*/
function lexer(str) {
var tokens = [];
var i = 0;
while (i < str.length) {
var char = str[i];
if (char === "*" || char === "+" || char === "?") {
tokens.push({ type: "MODIFIER", index: i, value: str[i++] });
continue;
}
if (char === "\\") {
tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] });
continue;
}
if (char === "{") {
tokens.push({ type: "OPEN", index: i, value: str[i++] });
continue;
}
if (char === "}") {
tokens.push({ type: "CLOSE", index: i, value: str[i++] });
continue;
}
if (char === ":") {
var name = "";
var j = i + 1;
while (j < str.length) {
var code = str.charCodeAt(j);
if (
// `0-9`
(code >= 48 && code <= 57) ||
// `A-Z`
(code >= 65 && code <= 90) ||
// `a-z`
(code >= 97 && code <= 122) ||
// `_`
code === 95) {
name += str[j++];
continue;
}
break;
}
if (!name)
throw new TypeError("Missing parameter name at ".concat(i));
tokens.push({ type: "NAME", index: i, value: name });
i = j;
continue;
}
if (char === "(") {
var count = 1;
var pattern = "";
var j = i + 1;
if (str[j] === "?") {
throw new TypeError("Pattern cannot start with \"?\" at ".concat(j));
}
while (j < str.length) {
if (str[j] === "\\") {
pattern += str[j++] + str[j++];
continue;
}
if (str[j] === ")") {
count--;
if (count === 0) {
j++;
break;
}
}
else if (str[j] === "(") {
count++;
if (str[j + 1] !== "?") {
throw new TypeError("Capturing groups are not allowed at ".concat(j));
}
}
pattern += str[j++];
}
if (count)
throw new TypeError("Unbalanced pattern at ".concat(i));
if (!pattern)
throw new TypeError("Missing pattern at ".concat(i));
tokens.push({ type: "PATTERN", index: i, value: pattern });
i = j;
continue;
}
tokens.push({ type: "CHAR", index: i, value: str[i++] });
}
tokens.push({ type: "END", index: i, value: "" });
return tokens;
}
/**
* Parse a string for the raw tokens.
*/
function dist_es2015_parse(str, options) {
if (options === void 0) { options = {}; }
var tokens = lexer(str);
var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a;
var defaultPattern = "[^".concat(escapeString(options.delimiter || "/#?"), "]+?");
var result = [];
var key = 0;
var i = 0;
var path = "";
var tryConsume = function (type) {
if (i < tokens.length && tokens[i].type === type)
return tokens[i++].value;
};
var mustConsume = function (type) {
var value = tryConsume(type);
if (value !== undefined)
return value;
var _a = tokens[i], nextType = _a.type, index = _a.index;
throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type));
};
var consumeText = function () {
var result = "";
var value;
while ((value = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR"))) {
result += value;
}
return result;
};
while (i < tokens.length) {
var char = tryConsume("CHAR");
var name = tryConsume("NAME");
var pattern = tryConsume("PATTERN");
if (name || pattern) {
var prefix = char || "";
if (prefixes.indexOf(prefix) === -1) {
path += prefix;
prefix = "";
}
if (path) {
result.push(path);
path = "";
}
result.push({
name: name || key++,
prefix: prefix,
suffix: "",
pattern: pattern || defaultPattern,
modifier: tryConsume("MODIFIER") || "",
});
continue;
}
var value = char || tryConsume("ESCAPED_CHAR");
if (value) {
path += value;
continue;
}
if (path) {
result.push(path);
path = "";
}
var open = tryConsume("OPEN");
if (open) {
var prefix = consumeText();
var name_1 = tryConsume("NAME") || "";
var pattern_1 = tryConsume("PATTERN") || "";
var suffix = consumeText();
mustConsume("CLOSE");
result.push({
name: name_1 || (pattern_1 ? key++ : ""),
pattern: name_1 && !pattern_1 ? defaultPattern : pattern_1,
prefix: prefix,
suffix: suffix,
modifier: tryConsume("MODIFIER") || "",
});
continue;
}
mustConsume("END");
}
return result;
}
/**
* Compile a string to a template function for the path.
*/
function dist_es2015_compile(str, options) {
return tokensToFunction(dist_es2015_parse(str, options), options);
}
/**
* Expose a method for transforming tokens into the path function.
*/
function tokensToFunction(tokens, options) {
if (options === void 0) { options = {}; }
var reFlags = flags(options);
var _a = options.encode, encode = _a === void 0 ? function (x) { return x; } : _a, _b = options.validate, validate = _b === void 0 ? true : _b;
// Compile all the tokens into regexps.
var matches = tokens.map(function (token) {
if (typeof token === "object") {
return new RegExp("^(?:".concat(token.pattern, ")$"), reFlags);
}
});
return function (data) {
var path = "";
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
if (typeof token === "string") {
path += token;
continue;
}
var value = data ? data[token.name] : undefined;
var optional = token.modifier === "?" || token.modifier === "*";
var repeat = token.modifier === "*" || token.modifier === "+";
if (Array.isArray(value)) {
if (!repeat) {
throw new TypeError("Expected \"".concat(token.name, "\" to not repeat, but got an array"));
}
if (value.length === 0) {
if (optional)
continue;
throw new TypeError("Expected \"".concat(token.name, "\" to not be empty"));
}
for (var j = 0; j < value.length; j++) {
var segment = encode(value[j], token);
if (validate && !matches[i].test(segment)) {
throw new TypeError("Expected all \"".concat(token.name, "\" to match \"").concat(token.pattern, "\", but got \"").concat(segment, "\""));
}
path += token.prefix + segment + token.suffix;
}
continue;
}
if (typeof value === "string" || typeof value === "number") {
var segment = encode(String(value), token);
if (validate && !matches[i].test(segment)) {
throw new TypeError("Expected \"".concat(token.name, "\" to match \"").concat(token.pattern, "\", but got \"").concat(segment, "\""));
}
path += token.prefix + segment + token.suffix;
continue;
}
if (optional)
continue;
var typeOfMessage = repeat ? "an array" : "a string";
throw new TypeError("Expected \"".concat(token.name, "\" to be ").concat(typeOfMessage));
}
return path;
};
}
/**
* Create path match function from `path-to-regexp` spec.
*/
function dist_es2015_match(str, options) {
var keys = [];
var re = pathToRegexp(str, keys, options);
return regexpToFunction(re, keys, options);
}
/**
* Create a path match function from `path-to-regexp` output.
*/
function regexpToFunction(re, keys, options) {
if (options === void 0) { options = {}; }
var _a = options.decode, decode = _a === void 0 ? function (x) { return x; } : _a;
return function (pathname) {
var m = re.exec(pathname);
if (!m)
return false;
var path = m[0], index = m.index;
var params = Object.create(null);
var _loop_1 = function (i) {
if (m[i] === undefined)
return "continue";
var key = keys[i - 1];
if (key.modifier === "*" || key.modifier === "+") {
params[key.name] = m[i].split(key.prefix + key.suffix).map(function (value) {
return decode(value, key);
});
}
else {
params[key.name] = decode(m[i], key);
}
};
for (var i = 1; i < m.length; i++) {
_loop_1(i);
}
return { path: path, index: index, params: params };
};
}
/**
* Escape a regular expression string.
*/
function escapeString(str) {
return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
}
/**
* Get the flags for a regexp from the options.
*/
function flags(options) {
return options && options.sensitive ? "" : "i";
}
/**
* Pull out keys from a regexp.
*/
function regexpToRegexp(path, keys) {
if (!keys)
return path;
var groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g;
var index = 0;
var execResult = groupsRegex.exec(path.source);
while (execResult) {
keys.push({
// Use parenthesized substring match if available, index otherwise
name: execResult[1] || index++,
prefix: "",
suffix: "",
modifier: "",
pattern: "",
});
execResult = groupsRegex.exec(path.source);
}
return path;
}
/**
* Transform an array into a regexp.
*/
function arrayToRegexp(paths, keys, options) {
var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; });
return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options));
}
/**
* Create a path regexp from string input.
*/
function stringToRegexp(path, keys, options) {
return tokensToRegexp(dist_es2015_parse(path, options), keys, options);
}
/**
* Expose a function for taking tokens and returning a RegExp.
*/
function tokensToRegexp(tokens, keys, options) {
if (options === void 0) { options = {}; }
var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f;
var endsWithRe = "[".concat(escapeString(endsWith), "]|$");
var delimiterRe = "[".concat(escapeString(delimiter), "]");
var route = start ? "^" : "";
// Iterate over the tokens and create our regexp string.
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
var token = tokens_1[_i];
if (typeof token === "string") {
route += escapeString(encode(token));
}
else {
var prefix = escapeString(encode(token.prefix));
var suffix = escapeString(encode(token.suffix));
if (token.pattern) {
if (keys)
keys.push(token);
if (prefix || suffix) {
if (token.modifier === "+" || token.modifier === "*") {
var mod = token.modifier === "*" ? "?" : "";
route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod);
}
else {
route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier);
}
}
else {
if (token.modifier === "+" || token.modifier === "*") {
route += "((?:".concat(token.pattern, ")").concat(token.modifier, ")");
}
else {
route += "(".concat(token.pattern, ")").concat(token.modifier);
}
}
}
else {
route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier);
}
}
}
if (end) {
if (!strict)
route += "".concat(delimiterRe, "?");
route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")");
}
else {
var endToken = tokens[tokens.length - 1];
var isEndDelimited = typeof endToken === "string"
? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1
: endToken === undefined;
if (!strict) {
route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?");
}
if (!isEndDelimited) {
route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")");
}
}
return new RegExp(route, flags(options));
}
/**
* Normalize the given path string, returning a regular expression.
*
* An empty array can be passed in for the keys, which will hold the
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
*/
function pathToRegexp(path, keys, options) {
if (path instanceof RegExp)
return regexpToRegexp(path, keys);
if (Array.isArray(path))
return arrayToRegexp(path, keys, options);
return stringToRegexp(path, keys, options);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/utils/router.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function matchPath(path, pattern) {
const matchingFunction = dist_es2015_match(pattern, {
decode: decodeURIComponent
});
return matchingFunction(path);
}
function patternMatch(path, screens) {
for (const screen of screens) {
const matched = matchPath(path, screen.path);
if (matched) {
return {
params: matched.params,
id: screen.id
};
}
}
return undefined;
}
function findParent(path, screens) {
if (!path.startsWith('/')) {
return undefined;
}
const pathParts = path.split('/');
let parentPath;
while (pathParts.length > 1 && parentPath === undefined) {
pathParts.pop();
const potentialParentPath = pathParts.join('/') === '' ? '/' : pathParts.join('/');
if (screens.find(screen => {
return matchPath(potentialParentPath, screen.path) !== false;
})) {
parentPath = potentialParentPath;
}
}
return parentPath;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/context.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const context_initialContextValue = {
location: {},
goTo: () => {},
goBack: () => {},
goToParent: () => {},
addScreen: () => {},
removeScreen: () => {},
params: {}
};
const NavigatorContext = (0,external_wp_element_namespaceObject.createContext)(context_initialContextValue);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/styles.js
function navigator_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
const navigatorProviderWrapper = true ? {
name: "xpkswc",
styles: "overflow-x:hidden;contain:content"
} : 0;
const fadeInFromRight = emotion_react_browser_esm_keyframes({
'0%': {
opacity: 0,
transform: `translateX( 50px )`
},
'100%': {
opacity: 1,
transform: 'none'
}
});
const fadeInFromLeft = emotion_react_browser_esm_keyframes({
'0%': {
opacity: 0,
transform: `translateX( -50px )`
},
'100%': {
opacity: 1,
transform: 'none'
}
});
const navigatorScreenAnimation = ({
isInitial,
isBack,
isRTL
}) => {
if (isInitial && !isBack) {
return;
}
const animationName = isRTL && isBack || !isRTL && !isBack ? fadeInFromRight : fadeInFromLeft;
return /*#__PURE__*/emotion_react_browser_esm_css("animation-duration:0.14s;animation-timing-function:ease-in-out;will-change:transform,opacity;animation-name:", animationName, ";@media ( prefers-reduced-motion ){animation-duration:0s;}" + ( true ? "" : 0), true ? "" : 0);
};
const navigatorScreen = props => /*#__PURE__*/emotion_react_browser_esm_css("overflow-x:auto;max-height:100%;", navigatorScreenAnimation(props), ";" + ( true ? "" : 0), true ? "" : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-provider/component.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const MAX_HISTORY_LENGTH = 50;
function screensReducer(state = [], action) {
switch (action.type) {
case 'add':
return [...state, action.screen];
case 'remove':
return state.filter(s => s.id !== action.screen.id);
}
return state;
}
function UnconnectedNavigatorProvider(props, forwardedRef) {
const {
initialPath,
children,
className,
...otherProps
} = useContextSystem(props, 'NavigatorProvider');
const [locationHistory, setLocationHistory] = (0,external_wp_element_namespaceObject.useState)([{
path: initialPath
}]);
const currentLocationHistory = (0,external_wp_element_namespaceObject.useRef)([]);
const [screens, dispatch] = (0,external_wp_element_namespaceObject.useReducer)(screensReducer, []);
const currentScreens = (0,external_wp_element_namespaceObject.useRef)([]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
currentScreens.current = screens;
}, [screens]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
currentLocationHistory.current = locationHistory;
}, [locationHistory]);
const currentMatch = (0,external_wp_element_namespaceObject.useRef)();
const matchedPath = (0,external_wp_element_namespaceObject.useMemo)(() => {
let currentPath;
if (locationHistory.length === 0 || (currentPath = locationHistory[locationHistory.length - 1].path) === undefined) {
currentMatch.current = undefined;
return undefined;
}
const resolvePath = path => {
const newMatch = patternMatch(path, screens);
// If the new match is the same as the current match,
// return the previous one for performance reasons.
if (currentMatch.current && newMatch && external_wp_isShallowEqual_default()(newMatch.params, currentMatch.current.params) && newMatch.id === currentMatch.current.id) {
return currentMatch.current;
}
return newMatch;
};
const newMatch = resolvePath(currentPath);
currentMatch.current = newMatch;
return newMatch;
}, [screens, locationHistory]);
const addScreen = (0,external_wp_element_namespaceObject.useCallback)(screen => dispatch({
type: 'add',
screen
}), []);
const removeScreen = (0,external_wp_element_namespaceObject.useCallback)(screen => dispatch({
type: 'remove',
screen
}), []);
const goBack = (0,external_wp_element_namespaceObject.useCallback)(() => {
setLocationHistory(prevLocationHistory => {
if (prevLocationHistory.length <= 1) {
return prevLocationHistory;
}
return [...prevLocationHistory.slice(0, -2), {
...prevLocationHistory[prevLocationHistory.length - 2],
isBack: true,
hasRestoredFocus: false
}];
});
}, []);
const goTo = (0,external_wp_element_namespaceObject.useCallback)((path, options = {}) => {
const {
focusTargetSelector,
isBack = false,
skipFocus = false,
replace = false,
...restOptions
} = options;
const isNavigatingToPreviousPath = isBack && currentLocationHistory.current.length > 1 && currentLocationHistory.current[currentLocationHistory.current.length - 2].path === path;
if (isNavigatingToPreviousPath) {
goBack();
return;
}
setLocationHistory(prevLocationHistory => {
const newLocation = {
...restOptions,
path,
isBack,
hasRestoredFocus: false,
skipFocus
};
if (prevLocationHistory.length === 0) {
return replace ? [] : [newLocation];
}
const newLocationHistory = prevLocationHistory.slice(prevLocationHistory.length > MAX_HISTORY_LENGTH - 1 ? 1 : 0, -1);
if (!replace) {
newLocationHistory.push(
// Assign `focusTargetSelector` to the previous location in history
// (the one we just navigated from).
{
...prevLocationHistory[prevLocationHistory.length - 1],
focusTargetSelector
});
}
newLocationHistory.push(newLocation);
return newLocationHistory;
});
}, [goBack]);
const goToParent = (0,external_wp_element_namespaceObject.useCallback)((options = {}) => {
const currentPath = currentLocationHistory.current[currentLocationHistory.current.length - 1].path;
if (currentPath === undefined) {
return;
}
const parentPath = findParent(currentPath, currentScreens.current);
if (parentPath === undefined) {
return;
}
goTo(parentPath, {
...options,
isBack: true
});
}, [goTo]);
const navigatorContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
location: {
...locationHistory[locationHistory.length - 1],
isInitial: locationHistory.length === 1
},
params: matchedPath ? matchedPath.params : {},
match: matchedPath ? matchedPath.id : undefined,
goTo,
goBack,
goToParent,
addScreen,
removeScreen
}), [locationHistory, matchedPath, goTo, goBack, goToParent, addScreen, removeScreen]);
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(navigatorProviderWrapper, className), [className, cx]);
return (0,external_React_.createElement)(component, {
ref: forwardedRef,
className: classes,
...otherProps
}, (0,external_React_.createElement)(NavigatorContext.Provider, {
value: navigatorContextValue
}, children));
}
/**
* The `NavigatorProvider` component allows rendering nested views/panels/menus
* (via the `NavigatorScreen` component and navigate between these different
* view (via the `NavigatorButton` and `NavigatorBackButton` components or the
* `useNavigator` hook).
*
* ```jsx
* import {
* __experimentalNavigatorProvider as NavigatorProvider,
* __experimentalNavigatorScreen as NavigatorScreen,
* __experimentalNavigatorButton as NavigatorButton,
* __experimentalNavigatorBackButton as NavigatorBackButton,
* } from '@wordpress/components';
*
* const MyNavigation = () => (
* <NavigatorProvider initialPath="/">
* <NavigatorScreen path="/">
* <p>This is the home screen.</p>
* <NavigatorButton path="/child">
* Navigate to child screen.
* </NavigatorButton>
* </NavigatorScreen>
*
* <NavigatorScreen path="/child">
* <p>This is the child screen.</p>
* <NavigatorBackButton>
* Go back
* </NavigatorBackButton>
* </NavigatorScreen>
* </NavigatorProvider>
* );
* ```
*/
const NavigatorProvider = contextConnect(UnconnectedNavigatorProvider, 'NavigatorProvider');
/* harmony default export */ const navigator_provider_component = (NavigatorProvider);
;// CONCATENATED MODULE: external ["wp","escapeHtml"]
const external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-screen/component.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedNavigatorScreen(props, forwardedRef) {
const screenId = (0,external_wp_element_namespaceObject.useId)();
const {
children,
className,
path,
...otherProps
} = useContextSystem(props, 'NavigatorScreen');
const {
location,
match,
addScreen,
removeScreen
} = (0,external_wp_element_namespaceObject.useContext)(NavigatorContext);
const isMatch = match === screenId;
const wrapperRef = (0,external_wp_element_namespaceObject.useRef)(null);
(0,external_wp_element_namespaceObject.useEffect)(() => {
const screen = {
id: screenId,
path: (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(path)
};
addScreen(screen);
return () => removeScreen(screen);
}, [screenId, path, addScreen, removeScreen]);
const isRTL = (0,external_wp_i18n_namespaceObject.isRTL)();
const {
isInitial,
isBack
} = location;
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(navigatorScreen({
isInitial,
isBack,
isRTL
}), className), [className, cx, isInitial, isBack, isRTL]);
const locationRef = (0,external_wp_element_namespaceObject.useRef)(location);
(0,external_wp_element_namespaceObject.useEffect)(() => {
locationRef.current = location;
}, [location]);
// Focus restoration
const isInitialLocation = location.isInitial && !location.isBack;
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Only attempt to restore focus:
// - if the current location is not the initial one (to avoid moving focus on page load)
// - when the screen becomes visible
// - if the wrapper ref has been assigned
// - if focus hasn't already been restored for the current location
// - if the `skipFocus` option is not set to `true`. This is useful when we trigger the navigation outside of NavigatorScreen.
if (isInitialLocation || !isMatch || !wrapperRef.current || locationRef.current.hasRestoredFocus || location.skipFocus) {
return;
}
const activeElement = wrapperRef.current.ownerDocument.activeElement;
// If an element is already focused within the wrapper do not focus the
// element. This prevents inputs or buttons from losing focus unnecessarily.
if (wrapperRef.current.contains(activeElement)) {
return;
}
let elementToFocus = null;
// When navigating back, if a selector is provided, use it to look for the
// target element (assumed to be a node inside the current NavigatorScreen)
if (location.isBack && location?.focusTargetSelector) {
elementToFocus = wrapperRef.current.querySelector(location.focusTargetSelector);
}
// If the previous query didn't run or find any element to focus, fallback
// to the first tabbable element in the screen (or the screen itself).
if (!elementToFocus) {
const firstTabbable = external_wp_dom_namespaceObject.focus.tabbable.find(wrapperRef.current)[0];
elementToFocus = firstTabbable !== null && firstTabbable !== void 0 ? firstTabbable : wrapperRef.current;
}
locationRef.current.hasRestoredFocus = true;
elementToFocus.focus();
}, [isInitialLocation, isMatch, location.isBack, location.focusTargetSelector, location.skipFocus]);
const mergedWrapperRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([forwardedRef, wrapperRef]);
return isMatch ? (0,external_React_.createElement)(component, {
ref: mergedWrapperRef,
className: classes,
...otherProps
}, children) : null;
}
/**
* The `NavigatorScreen` component represents a single view/screen/panel and
* should be used in combination with the `NavigatorProvider`, the
* `NavigatorButton` and the `NavigatorBackButton` components (or the `useNavigator`
* hook).
*
* @example
* ```jsx
* import {
* __experimentalNavigatorProvider as NavigatorProvider,
* __experimentalNavigatorScreen as NavigatorScreen,
* __experimentalNavigatorButton as NavigatorButton,
* __experimentalNavigatorBackButton as NavigatorBackButton,
* } from '@wordpress/components';
*
* const MyNavigation = () => (
* <NavigatorProvider initialPath="/">
* <NavigatorScreen path="/">
* <p>This is the home screen.</p>
* <NavigatorButton path="/child">
* Navigate to child screen.
* </NavigatorButton>
* </NavigatorScreen>
*
* <NavigatorScreen path="/child">
* <p>This is the child screen.</p>
* <NavigatorBackButton>
* Go back
* </NavigatorBackButton>
* </NavigatorScreen>
* </NavigatorProvider>
* );
* ```
*/
const NavigatorScreen = contextConnect(UnconnectedNavigatorScreen, 'NavigatorScreen');
/* harmony default export */ const navigator_screen_component = (NavigatorScreen);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/use-navigator.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Retrieves a `navigator` instance.
*/
function useNavigator() {
const {
location,
params,
goTo,
goBack,
goToParent
} = (0,external_wp_element_namespaceObject.useContext)(NavigatorContext);
return {
location,
goTo,
goBack,
goToParent,
params
};
}
/* harmony default export */ const use_navigator = (useNavigator);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-button/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const cssSelectorForAttribute = (attrName, attrValue) => `[${attrName}="${attrValue}"]`;
function useNavigatorButton(props) {
const {
path,
onClick,
as = build_module_button,
attributeName = 'id',
...otherProps
} = useContextSystem(props, 'NavigatorButton');
const escapedPath = (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(path);
const {
goTo
} = use_navigator();
const handleClick = (0,external_wp_element_namespaceObject.useCallback)(e => {
e.preventDefault();
goTo(escapedPath, {
focusTargetSelector: cssSelectorForAttribute(attributeName, escapedPath)
});
onClick?.(e);
}, [goTo, onClick, attributeName, escapedPath]);
return {
as,
onClick: handleClick,
...otherProps,
[attributeName]: escapedPath
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-button/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedNavigatorButton(props, forwardedRef) {
const navigatorButtonProps = useNavigatorButton(props);
return (0,external_React_.createElement)(component, {
ref: forwardedRef,
...navigatorButtonProps
});
}
/**
* The `NavigatorButton` component can be used to navigate to a screen and should
* be used in combination with the `NavigatorProvider`, the `NavigatorScreen`
* and the `NavigatorBackButton` components (or the `useNavigator` hook).
*
* @example
* ```jsx
* import {
* __experimentalNavigatorProvider as NavigatorProvider,
* __experimentalNavigatorScreen as NavigatorScreen,
* __experimentalNavigatorButton as NavigatorButton,
* __experimentalNavigatorBackButton as NavigatorBackButton,
* } from '@wordpress/components';
*
* const MyNavigation = () => (
* <NavigatorProvider initialPath="/">
* <NavigatorScreen path="/">
* <p>This is the home screen.</p>
* <NavigatorButton path="/child">
* Navigate to child screen.
* </NavigatorButton>
* </NavigatorScreen>
*
* <NavigatorScreen path="/child">
* <p>This is the child screen.</p>
* <NavigatorBackButton>
* Go back
* </NavigatorBackButton>
* </NavigatorScreen>
* </NavigatorProvider>
* );
* ```
*/
const NavigatorButton = contextConnect(UnconnectedNavigatorButton, 'NavigatorButton');
/* harmony default export */ const navigator_button_component = (NavigatorButton);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-back-button/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useNavigatorBackButton(props) {
const {
onClick,
as = build_module_button,
goToParent: goToParentProp = false,
...otherProps
} = useContextSystem(props, 'NavigatorBackButton');
const {
goBack,
goToParent
} = use_navigator();
const handleClick = (0,external_wp_element_namespaceObject.useCallback)(e => {
e.preventDefault();
if (goToParentProp) {
goToParent();
} else {
goBack();
}
onClick?.(e);
}, [goToParentProp, goToParent, goBack, onClick]);
return {
as,
onClick: handleClick,
...otherProps
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-back-button/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedNavigatorBackButton(props, forwardedRef) {
const navigatorBackButtonProps = useNavigatorBackButton(props);
return (0,external_React_.createElement)(component, {
ref: forwardedRef,
...navigatorBackButtonProps
});
}
/**
* The `NavigatorBackButton` component can be used to navigate to a screen and
* should be used in combination with the `NavigatorProvider`, the
* `NavigatorScreen` and the `NavigatorButton` components (or the `useNavigator`
* hook).
*
* @example
* ```jsx
* import {
* __experimentalNavigatorProvider as NavigatorProvider,
* __experimentalNavigatorScreen as NavigatorScreen,
* __experimentalNavigatorButton as NavigatorButton,
* __experimentalNavigatorBackButton as NavigatorBackButton,
* } from '@wordpress/components';
*
* const MyNavigation = () => (
* <NavigatorProvider initialPath="/">
* <NavigatorScreen path="/">
* <p>This is the home screen.</p>
* <NavigatorButton path="/child">
* Navigate to child screen.
* </NavigatorButton>
* </NavigatorScreen>
*
* <NavigatorScreen path="/child">
* <p>This is the child screen.</p>
* <NavigatorBackButton>
* Go back
* </NavigatorBackButton>
* </NavigatorScreen>
* </NavigatorProvider>
* );
* ```
*/
const NavigatorBackButton = contextConnect(UnconnectedNavigatorBackButton, 'NavigatorBackButton');
/* harmony default export */ const navigator_back_button_component = (NavigatorBackButton);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-to-parent-button/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedNavigatorToParentButton(props, forwardedRef) {
const navigatorToParentButtonProps = useNavigatorBackButton({
...props,
goToParent: true
});
return (0,external_React_.createElement)(component, {
ref: forwardedRef,
...navigatorToParentButtonProps
});
}
/*
* The `NavigatorToParentButton` component can be used to navigate to a screen and
* should be used in combination with the `NavigatorProvider`, the
* `NavigatorScreen` and the `NavigatorButton` components (or the `useNavigator`
* hook).
*
* @example
* ```jsx
* import {
* __experimentalNavigatorProvider as NavigatorProvider,
* __experimentalNavigatorScreen as NavigatorScreen,
* __experimentalNavigatorButton as NavigatorButton,
* __experimentalNavigatorToParentButton as NavigatorToParentButton,
* } from '@wordpress/components';
*
* const MyNavigation = () => (
* <NavigatorProvider initialPath="/">
* <NavigatorScreen path="/">
* <p>This is the home screen.</p>
* <NavigatorButton path="/child">
* Navigate to child screen.
* </NavigatorButton>
* </NavigatorScreen>
*
* <NavigatorScreen path="/child">
* <p>This is the child screen.</p>
* <NavigatorToParentButton>
* Go to parent
* </NavigatorToParentButton>
* </NavigatorScreen>
* </NavigatorProvider>
* );
* ```
*/
const NavigatorToParentButton = contextConnect(UnconnectedNavigatorToParentButton, 'NavigatorToParentButton');
/* harmony default export */ const navigator_to_parent_button_component = (NavigatorToParentButton);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/notice/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const notice_noop = () => {};
/**
* Custom hook which announces the message with the given politeness, if a
* valid message is provided.
*/
function useSpokenMessage(message, politeness) {
const spokenMessage = typeof message === 'string' ? message : (0,external_wp_element_namespaceObject.renderToString)(message);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (spokenMessage) {
(0,external_wp_a11y_namespaceObject.speak)(spokenMessage, politeness);
}
}, [spokenMessage, politeness]);
}
function getDefaultPoliteness(status) {
switch (status) {
case 'success':
case 'warning':
case 'info':
return 'polite';
// The default will also catch the 'error' status.
default:
return 'assertive';
}
}
function getStatusLabel(status) {
switch (status) {
case 'warning':
return (0,external_wp_i18n_namespaceObject.__)('Warning notice');
case 'info':
return (0,external_wp_i18n_namespaceObject.__)('Information notice');
case 'error':
return (0,external_wp_i18n_namespaceObject.__)('Error notice');
// The default will also catch the 'success' status.
default:
return (0,external_wp_i18n_namespaceObject.__)('Notice');
}
}
/**
* `Notice` is a component used to communicate feedback to the user.
*
*```jsx
* import { Notice } from `@wordpress/components`;
*
* const MyNotice = () => (
* <Notice status="error">An unknown error occurred.</Notice>
* );
* ```
*/
function Notice({
className,
status = 'info',
children,
spokenMessage = children,
onRemove = notice_noop,
isDismissible = true,
actions = [],
politeness = getDefaultPoliteness(status),
__unstableHTML,
// onDismiss is a callback executed when the notice is dismissed.
// It is distinct from onRemove, which _looks_ like a callback but is
// actually the function to call to remove the notice from the UI.
onDismiss = notice_noop
}) {
useSpokenMessage(spokenMessage, politeness);
const classes = classnames_default()(className, 'components-notice', 'is-' + status, {
'is-dismissible': isDismissible
});
if (__unstableHTML && typeof children === 'string') {
children = (0,external_React_.createElement)(external_wp_element_namespaceObject.RawHTML, null, children);
}
const onDismissNotice = () => {
onDismiss();
onRemove();
};
return (0,external_React_.createElement)("div", {
className: classes
}, (0,external_React_.createElement)(visually_hidden_component, null, getStatusLabel(status)), (0,external_React_.createElement)("div", {
className: "components-notice__content"
}, children, (0,external_React_.createElement)("div", {
className: "components-notice__actions"
}, actions.map(({
className: buttonCustomClasses,
label,
isPrimary,
variant,
noDefaultClasses = false,
onClick,
url
}, index) => {
let computedVariant = variant;
if (variant !== 'primary' && !noDefaultClasses) {
computedVariant = !url ? 'secondary' : 'link';
}
if (typeof computedVariant === 'undefined' && isPrimary) {
computedVariant = 'primary';
}
return (0,external_React_.createElement)(build_module_button, {
key: index,
href: url,
variant: computedVariant,
onClick: url ? undefined : onClick,
className: classnames_default()('components-notice__action', buttonCustomClasses)
}, label);
}))), isDismissible && (0,external_React_.createElement)(build_module_button, {
className: "components-notice__dismiss",
icon: library_close,
label: (0,external_wp_i18n_namespaceObject.__)('Close'),
onClick: onDismissNotice
}));
}
/* harmony default export */ const build_module_notice = (Notice);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/notice/list.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const list_noop = () => {};
/**
* `NoticeList` is a component used to render a collection of notices.
*
*```jsx
* import { Notice, NoticeList } from `@wordpress/components`;
*
* const MyNoticeList = () => {
* const [ notices, setNotices ] = useState( [
* {
* id: 'second-notice',
* content: 'second notice content',
* },
* {
* id: 'fist-notice',
* content: 'first notice content',
* },
* ] );
*
* const removeNotice = ( id ) => {
* setNotices( notices.filter( ( notice ) => notice.id !== id ) );
* };
*
* return <NoticeList notices={ notices } onRemove={ removeNotice } />;
*};
*```
*/
function NoticeList({
notices,
onRemove = list_noop,
className,
children
}) {
const removeNotice = id => () => onRemove(id);
className = classnames_default()('components-notice-list', className);
return (0,external_React_.createElement)("div", {
className: className
}, children, [...notices].reverse().map(notice => {
const {
content,
...restNotice
} = notice;
return (0,external_React_.createElement)(build_module_notice, {
...restNotice,
key: notice.id,
onRemove: removeNotice(notice.id)
}, notice.content);
}));
}
/* harmony default export */ const list = (NoticeList);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/header.js
/**
* Internal dependencies
*/
/**
* `PanelHeader` renders the header for the `Panel`.
* This is used by the `Panel` component under the hood,
* so it does not typically need to be used.
*/
function PanelHeader({
label,
children
}) {
return (0,external_React_.createElement)("div", {
className: "components-panel__header"
}, label && (0,external_React_.createElement)("h2", null, label), children);
}
/* harmony default export */ const panel_header = (PanelHeader);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedPanel({
header,
className,
children
}, ref) {
const classNames = classnames_default()(className, 'components-panel');
return (0,external_React_.createElement)("div", {
className: classNames,
ref: ref
}, header && (0,external_React_.createElement)(panel_header, {
label: header
}), children);
}
/**
* `Panel` expands and collapses multiple sections of content.
*
* ```jsx
* import { Panel, PanelBody, PanelRow } from '@wordpress/components';
* import { more } from '@wordpress/icons';
*
* const MyPanel = () => (
* <Panel header="My Panel">
* <PanelBody title="My Block Settings" icon={ more } initialOpen={ true }>
* <PanelRow>My Panel Inputs and Labels</PanelRow>
* </PanelBody>
* </Panel>
* );
* ```
*/
const Panel = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedPanel);
/* harmony default export */ const panel = (Panel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js
/**
* WordPress dependencies
*/
const chevronUp = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, (0,external_React_.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 */ const chevron_up = (chevronUp);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/body.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const body_noop = () => {};
function UnforwardedPanelBody(props, ref) {
const {
buttonProps = {},
children,
className,
icon,
initialOpen,
onToggle = body_noop,
opened,
title,
scrollAfterOpen = true
} = props;
const [isOpened, setIsOpened] = use_controlled_state(opened, {
initial: initialOpen === undefined ? true : initialOpen,
fallback: false
});
const nodeRef = (0,external_wp_element_namespaceObject.useRef)(null);
// Defaults to 'smooth' scrolling
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
const scrollBehavior = (0,external_wp_compose_namespaceObject.useReducedMotion)() ? 'auto' : 'smooth';
const handleOnToggle = event => {
event.preventDefault();
const next = !isOpened;
setIsOpened(next);
onToggle(next);
};
// Ref is used so that the effect does not re-run upon scrollAfterOpen changing value.
const scrollAfterOpenRef = (0,external_wp_element_namespaceObject.useRef)();
scrollAfterOpenRef.current = scrollAfterOpen;
// Runs after initial render.
use_update_effect(() => {
if (isOpened && scrollAfterOpenRef.current && nodeRef.current?.scrollIntoView) {
/*
* Scrolls the content into view when visible.
* This improves the UX when there are multiple stacking <PanelBody />
* components in a scrollable container.
*/
nodeRef.current.scrollIntoView({
inline: 'nearest',
block: 'nearest',
behavior: scrollBehavior
});
}
}, [isOpened, scrollBehavior]);
const classes = classnames_default()('components-panel__body', className, {
'is-opened': isOpened
});
return (0,external_React_.createElement)("div", {
className: classes,
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([nodeRef, ref])
}, (0,external_React_.createElement)(PanelBodyTitle, {
icon: icon,
isOpened: Boolean(isOpened),
onClick: handleOnToggle,
title: title,
...buttonProps
}), typeof children === 'function' ? children({
opened: Boolean(isOpened)
}) : isOpened && children);
}
const PanelBodyTitle = (0,external_wp_element_namespaceObject.forwardRef)(({
isOpened,
icon,
title,
...props
}, ref) => {
if (!title) return null;
return (0,external_React_.createElement)("h2", {
className: "components-panel__body-title"
}, (0,external_React_.createElement)(build_module_button, {
className: "components-panel__body-toggle",
"aria-expanded": isOpened,
ref: ref,
...props
}, (0,external_React_.createElement)("span", {
"aria-hidden": "true"
}, (0,external_React_.createElement)(build_module_icon, {
className: "components-panel__arrow",
icon: isOpened ? chevron_up : chevron_down
})), title, icon && (0,external_React_.createElement)(build_module_icon, {
icon: icon,
className: "components-panel__icon",
size: 20
})));
});
const PanelBody = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedPanelBody);
/* harmony default export */ const body = (PanelBody);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/row.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function UnforwardedPanelRow({
className,
children
}, ref) {
return (0,external_React_.createElement)("div", {
className: classnames_default()('components-panel__row', className),
ref: ref
}, children);
}
/**
* `PanelRow` is a generic container for rows within a `PanelBody`.
* It is a flex container with a top margin for spacing.
*/
const PanelRow = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedPanelRow);
/* harmony default export */ const row = (PanelRow);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/placeholder/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const PlaceholderIllustration = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
className: "components-placeholder__illustration",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 60 60",
preserveAspectRatio: "none"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
vectorEffect: "non-scaling-stroke",
d: "M60 60 0 0"
}));
/**
* Renders a placeholder. Normally used by blocks to render their empty state.
*
* ```jsx
* import { Placeholder } from '@wordpress/components';
* import { more } from '@wordpress/icons';
*
* const MyPlaceholder = () => <Placeholder icon={ more } label="Placeholder" />;
* ```
*/
function Placeholder(props) {
const {
icon,
children,
label,
instructions,
className,
notices,
preview,
isColumnLayout,
withIllustration,
...additionalProps
} = props;
const [resizeListener, {
width
}] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
// Since `useResizeObserver` will report a width of `null` until after the
// first render, avoid applying any modifier classes until width is known.
let modifierClassNames;
if (typeof width === 'number') {
modifierClassNames = {
'is-large': width >= 480,
'is-medium': width >= 160 && width < 480,
'is-small': width < 160
};
}
const classes = classnames_default()('components-placeholder', className, modifierClassNames, withIllustration ? 'has-illustration' : null);
const fieldsetClasses = classnames_default()('components-placeholder__fieldset', {
'is-column-layout': isColumnLayout
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (instructions) {
(0,external_wp_a11y_namespaceObject.speak)(instructions);
}
}, [instructions]);
return (0,external_React_.createElement)("div", {
...additionalProps,
className: classes
}, withIllustration ? PlaceholderIllustration : null, resizeListener, notices, preview && (0,external_React_.createElement)("div", {
className: "components-placeholder__preview"
}, preview), (0,external_React_.createElement)("div", {
className: "components-placeholder__label"
}, (0,external_React_.createElement)(build_module_icon, {
icon: icon
}), label), !!instructions && (0,external_React_.createElement)("div", {
className: "components-placeholder__instructions"
}, instructions), (0,external_React_.createElement)("div", {
className: fieldsetClasses
}, children));
}
/* harmony default export */ const placeholder = (Placeholder);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/terms.js
/**
* Internal dependencies
*/
const ensureParentsAreDefined = terms => {
return terms.every(term => term.parent !== null);
};
/**
* Returns terms in a tree form.
*
* @param flatTerms Array of terms in flat format.
*
* @return Terms in tree format.
*/
function buildTermsTree(flatTerms) {
const flatTermsWithParentAndChildren = flatTerms.map(term => ({
children: [],
parent: null,
...term,
id: String(term.id)
}));
// We use a custom type guard here to ensure that the parent property is
// defined on all terms. The type of the `parent` property is `number | null`
// and we need to ensure that it is `number`. This is because we use the
// `parent` property as a key in the `termsByParent` object.
if (!ensureParentsAreDefined(flatTermsWithParentAndChildren)) {
return flatTermsWithParentAndChildren;
}
const termsByParent = flatTermsWithParentAndChildren.reduce((acc, term) => {
const {
parent
} = term;
if (!acc[parent]) {
acc[parent] = [];
}
acc[parent].push(term);
return acc;
}, {});
const fillWithChildren = terms => {
return terms.map(term => {
const children = termsByParent[term.id];
return {
...term,
children: children && children.length ? fillWithChildren(children) : []
};
});
};
return fillWithChildren(termsByParent['0'] || []);
}
;// CONCATENATED MODULE: external ["wp","htmlEntities"]
const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-select/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function getSelectOptions(tree, level = 0) {
return tree.flatMap(treeNode => [{
value: treeNode.id,
label: '\u00A0'.repeat(level * 3) + (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(treeNode.name)
}, ...getSelectOptions(treeNode.children || [], level + 1)]);
}
/**
* TreeSelect component is used to generate select input fields.
*
* ```jsx
* import { TreeSelect } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyTreeSelect = () => {
* const [ page, setPage ] = useState( 'p21' );
*
* return (
* <TreeSelect
* label="Parent page"
* noOptionLabel="No parent page"
* onChange={ ( newPage ) => setPage( newPage ) }
* selectedId={ page }
* tree={ [
* {
* name: 'Page 1',
* id: 'p1',
* children: [
* { name: 'Descend 1 of page 1', id: 'p11' },
* { name: 'Descend 2 of page 1', id: 'p12' },
* ],
* },
* {
* name: 'Page 2',
* id: 'p2',
* children: [
* {
* name: 'Descend 1 of page 2',
* id: 'p21',
* children: [
* {
* name: 'Descend 1 of Descend 1 of page 2',
* id: 'p211',
* },
* ],
* },
* ],
* },
* ] }
* />
* );
* }
* ```
*/
function TreeSelect(props) {
const {
label,
noOptionLabel,
onChange,
selectedId,
tree = [],
...restProps
} = useDeprecated36pxDefaultSizeProp(props);
const options = (0,external_wp_element_namespaceObject.useMemo)(() => {
return [noOptionLabel && {
value: '',
label: noOptionLabel
}, ...getSelectOptions(tree)].filter(option => !!option);
}, [noOptionLabel, tree]);
return (0,external_React_.createElement)(SelectControl, {
label,
options,
onChange,
value: selectedId,
...restProps
});
}
/* harmony default export */ const tree_select = (TreeSelect);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/author-select.js
/**
* Internal dependencies
*/
function AuthorSelect({
__next40pxDefaultSize,
label,
noOptionLabel,
authorList,
selectedAuthorId,
onChange: onChangeProp
}) {
if (!authorList) return null;
const termsTree = buildTermsTree(authorList);
return (0,external_React_.createElement)(tree_select, {
label,
noOptionLabel,
onChange: onChangeProp,
tree: termsTree,
selectedId: selectedAuthorId !== undefined ? String(selectedAuthorId) : undefined,
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: __next40pxDefaultSize
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/category-select.js
/**
* Internal dependencies
*/
/**
* WordPress dependencies
*/
function CategorySelect({
__next40pxDefaultSize,
label,
noOptionLabel,
categoriesList,
selectedCategoryId,
onChange: onChangeProp,
...props
}) {
const termsTree = (0,external_wp_element_namespaceObject.useMemo)(() => {
return buildTermsTree(categoriesList);
}, [categoriesList]);
return (0,external_React_.createElement)(tree_select, {
label,
noOptionLabel,
onChange: onChangeProp,
tree: termsTree,
selectedId: selectedCategoryId !== undefined ? String(selectedCategoryId) : undefined,
...props,
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: __next40pxDefaultSize
});
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DEFAULT_MIN_ITEMS = 1;
const DEFAULT_MAX_ITEMS = 100;
const MAX_CATEGORIES_SUGGESTIONS = 20;
function isSingleCategorySelection(props) {
return 'categoriesList' in props;
}
function isMultipleCategorySelection(props) {
return 'categorySuggestions' in props;
}
/**
* Controls to query for posts.
*
* ```jsx
* const MyQueryControls = () => (
* <QueryControls
* { ...{ maxItems, minItems, numberOfItems, order, orderBy } }
* onOrderByChange={ ( newOrderBy ) => {
* updateQuery( { orderBy: newOrderBy } )
* }
* onOrderChange={ ( newOrder ) => {
* updateQuery( { order: newOrder } )
* }
* categoriesList={ categories }
* selectedCategoryId={ category }
* onCategoryChange={ ( newCategory ) => {
* updateQuery( { category: newCategory } )
* }
* onNumberOfItemsChange={ ( newNumberOfItems ) => {
* updateQuery( { numberOfItems: newNumberOfItems } )
* } }
* />
* );
* ```
*/
function QueryControls({
__next40pxDefaultSize = false,
authorList,
selectedAuthorId,
numberOfItems,
order,
orderBy,
maxItems = DEFAULT_MAX_ITEMS,
minItems = DEFAULT_MIN_ITEMS,
onAuthorChange,
onNumberOfItemsChange,
onOrderChange,
onOrderByChange,
// Props for single OR multiple category selection are not destructured here,
// but instead are destructured inline where necessary.
...props
}) {
return (0,external_React_.createElement)(v_stack_component, {
spacing: "4",
className: "components-query-controls"
}, [onOrderChange && onOrderByChange && (0,external_React_.createElement)(select_control, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: __next40pxDefaultSize,
key: "query-controls-order-select",
label: (0,external_wp_i18n_namespaceObject.__)('Order by'),
value: `${orderBy}/${order}`,
options: [{
label: (0,external_wp_i18n_namespaceObject.__)('Newest to oldest'),
value: 'date/desc'
}, {
label: (0,external_wp_i18n_namespaceObject.__)('Oldest to newest'),
value: 'date/asc'
}, {
/* translators: Label for ordering posts by title in ascending order. */
label: (0,external_wp_i18n_namespaceObject.__)('A → Z'),
value: 'title/asc'
}, {
/* translators: Label for ordering posts by title in descending order. */
label: (0,external_wp_i18n_namespaceObject.__)('Z → A'),
value: 'title/desc'
}],
onChange: value => {
if (typeof value !== 'string') {
return;
}
const [newOrderBy, newOrder] = value.split('/');
if (newOrder !== order) {
onOrderChange(newOrder);
}
if (newOrderBy !== orderBy) {
onOrderByChange(newOrderBy);
}
}
}), isSingleCategorySelection(props) && props.categoriesList && props.onCategoryChange && (0,external_React_.createElement)(CategorySelect, {
__next40pxDefaultSize: __next40pxDefaultSize,
key: "query-controls-category-select",
categoriesList: props.categoriesList,
label: (0,external_wp_i18n_namespaceObject.__)('Category'),
noOptionLabel: (0,external_wp_i18n_namespaceObject._x)('All', 'categories'),
selectedCategoryId: props.selectedCategoryId,
onChange: props.onCategoryChange
}), isMultipleCategorySelection(props) && props.categorySuggestions && props.onCategoryChange && (0,external_React_.createElement)(form_token_field, {
__next40pxDefaultSize: __next40pxDefaultSize,
__nextHasNoMarginBottom: true,
key: "query-controls-categories-select",
label: (0,external_wp_i18n_namespaceObject.__)('Categories'),
value: props.selectedCategories && props.selectedCategories.map(item => ({
id: item.id,
// Keeping the fallback to `item.value` for legacy reasons,
// even if items of `selectedCategories` should not have a
// `value` property.
// @ts-expect-error
value: item.name || item.value
})),
suggestions: Object.keys(props.categorySuggestions),
onChange: props.onCategoryChange,
maxSuggestions: MAX_CATEGORIES_SUGGESTIONS
}), onAuthorChange && (0,external_React_.createElement)(AuthorSelect, {
__next40pxDefaultSize: __next40pxDefaultSize,
key: "query-controls-author-select",
authorList: authorList,
label: (0,external_wp_i18n_namespaceObject.__)('Author'),
noOptionLabel: (0,external_wp_i18n_namespaceObject._x)('All', 'authors'),
selectedAuthorId: selectedAuthorId,
onChange: onAuthorChange
}), onNumberOfItemsChange && (0,external_React_.createElement)(range_control, {
__nextHasNoMarginBottom: true,
__next40pxDefaultSize: __next40pxDefaultSize,
key: "query-controls-range-control",
label: (0,external_wp_i18n_namespaceObject.__)('Number of items'),
value: numberOfItems,
onChange: onNumberOfItemsChange,
min: minItems,
max: maxItems,
required: true
})]);
}
/* harmony default export */ const query_controls = (QueryControls);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-group/context.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
const RadioGroupContext = (0,external_wp_element_namespaceObject.createContext)({
store: undefined,
disabled: undefined
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-group/radio.js
/**
* WordPress dependencies
*/
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* Internal dependencies
*/
function UnforwardedRadio({
value,
children,
...props
}, ref) {
const {
store,
disabled
} = (0,external_wp_element_namespaceObject.useContext)(RadioGroupContext);
const selectedValue = store?.useState('value');
const isChecked = selectedValue !== undefined && selectedValue === value;
return (0,external_React_.createElement)(Radio, {
disabled: disabled,
store: store,
ref: ref,
value: value,
render: (0,external_React_.createElement)(build_module_button, {
variant: isChecked ? 'primary' : 'secondary',
...props
})
}, children || value);
}
/**
* @deprecated Use `RadioControl` or `ToggleGroupControl` instead.
*/
const radio_Radio = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedRadio);
/* harmony default export */ const radio_group_radio = (radio_Radio);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-group/index.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedRadioGroup({
label,
checked,
defaultChecked,
disabled,
onChange,
children,
...props
}, ref) {
const radioStore = useRadioStore({
value: checked,
defaultValue: defaultChecked,
setValue: newValue => {
onChange?.(newValue !== null && newValue !== void 0 ? newValue : undefined);
}
});
const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
store: radioStore,
disabled
}), [radioStore, disabled]);
return (0,external_React_.createElement)(RadioGroupContext.Provider, {
value: contextValue
}, (0,external_React_.createElement)(RadioGroup, {
store: radioStore,
render: (0,external_React_.createElement)(button_group, null, children),
"aria-label": label,
ref: ref,
...props
}));
}
/**
* @deprecated Use `RadioControl` or `ToggleGroupControl` instead.
*/
const radio_group_RadioGroup = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedRadioGroup);
/* harmony default export */ const radio_group = (radio_group_RadioGroup);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Render a user interface to select the user type using radio inputs.
*
* ```jsx
* import { RadioControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyRadioControl = () => {
* const [ option, setOption ] = useState( 'a' );
*
* return (
* <RadioControl
* label="User type"
* help="The type of the current user"
* selected={ option }
* options={ [
* { label: 'Author', value: 'a' },
* { label: 'Editor', value: 'e' },
* ] }
* onChange={ ( value ) => setOption( value ) }
* />
* );
* };
* ```
*/
function RadioControl(props) {
const {
label,
className,
selected,
help,
onChange,
hideLabelFromVision,
options = [],
...additionalProps
} = props;
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(RadioControl);
const id = `inspector-radio-control-${instanceId}`;
const onChangeValue = event => onChange(event.target.value);
if (!options?.length) {
return null;
}
return (0,external_React_.createElement)(base_control, {
__nextHasNoMarginBottom: true,
label: label,
id: id,
hideLabelFromVision: hideLabelFromVision,
help: help,
className: classnames_default()(className, 'components-radio-control')
}, (0,external_React_.createElement)(v_stack_component, {
spacing: 1
}, options.map((option, index) => (0,external_React_.createElement)("div", {
key: `${id}-${index}`,
className: "components-radio-control__option"
}, (0,external_React_.createElement)("input", {
id: `${id}-${index}`,
className: "components-radio-control__input",
type: "radio",
name: id,
value: option.value,
onChange: onChangeValue,
checked: option.value === selected,
"aria-describedby": !!help ? `${id}__help` : undefined,
...additionalProps
}), (0,external_React_.createElement)("label", {
className: "components-radio-control__label",
htmlFor: `${id}-${index}`
}, option.label)))));
}
/* harmony default export */ const radio_control = (RadioControl);
;// CONCATENATED MODULE: ./node_modules/re-resizable/lib/resizer.js
var resizer_extends = (undefined && undefined.__extends) || (function () {
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);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var resizer_assign = (undefined && undefined.__assign) || function () {
resizer_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;
};
return resizer_assign.apply(this, arguments);
};
var rowSizeBase = {
width: '100%',
height: '10px',
top: '0px',
left: '0px',
cursor: 'row-resize',
};
var colSizeBase = {
width: '10px',
height: '100%',
top: '0px',
left: '0px',
cursor: 'col-resize',
};
var edgeBase = {
width: '20px',
height: '20px',
position: 'absolute',
};
var resizer_styles = {
top: resizer_assign(resizer_assign({}, rowSizeBase), { top: '-5px' }),
right: resizer_assign(resizer_assign({}, colSizeBase), { left: undefined, right: '-5px' }),
bottom: resizer_assign(resizer_assign({}, rowSizeBase), { top: undefined, bottom: '-5px' }),
left: resizer_assign(resizer_assign({}, colSizeBase), { left: '-5px' }),
topRight: resizer_assign(resizer_assign({}, edgeBase), { right: '-10px', top: '-10px', cursor: 'ne-resize' }),
bottomRight: resizer_assign(resizer_assign({}, edgeBase), { right: '-10px', bottom: '-10px', cursor: 'se-resize' }),
bottomLeft: resizer_assign(resizer_assign({}, edgeBase), { left: '-10px', bottom: '-10px', cursor: 'sw-resize' }),
topLeft: resizer_assign(resizer_assign({}, edgeBase), { left: '-10px', top: '-10px', cursor: 'nw-resize' }),
};
var Resizer = /** @class */ (function (_super) {
resizer_extends(Resizer, _super);
function Resizer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.onMouseDown = function (e) {
_this.props.onResizeStart(e, _this.props.direction);
};
_this.onTouchStart = function (e) {
_this.props.onResizeStart(e, _this.props.direction);
};
return _this;
}
Resizer.prototype.render = function () {
return (external_React_.createElement("div", { className: this.props.className || '', style: resizer_assign(resizer_assign({ position: 'absolute', userSelect: 'none' }, resizer_styles[this.props.direction]), (this.props.replaceStyles || {})), onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart }, this.props.children));
};
return Resizer;
}(external_React_.PureComponent));
;// CONCATENATED MODULE: ./node_modules/re-resizable/lib/index.js
var lib_extends = (undefined && undefined.__extends) || (function () {
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);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var lib_assign = (undefined && undefined.__assign) || function () {
lib_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;
};
return lib_assign.apply(this, arguments);
};
var DEFAULT_SIZE = {
width: 'auto',
height: 'auto',
};
var lib_clamp = function (n, min, max) { return Math.max(Math.min(n, max), min); };
var snap = function (n, size) { return Math.round(n / size) * size; };
var hasDirection = function (dir, target) {
return new RegExp(dir, 'i').test(target);
};
// INFO: In case of window is a Proxy and does not porxy Events correctly, use isTouchEvent & isMouseEvent to distinguish event type instead of `instanceof`.
var isTouchEvent = function (event) {
return Boolean(event.touches && event.touches.length);
};
var isMouseEvent = function (event) {
return Boolean((event.clientX || event.clientX === 0) &&
(event.clientY || event.clientY === 0));
};
var findClosestSnap = function (n, snapArray, snapGap) {
if (snapGap === void 0) { snapGap = 0; }
var closestGapIndex = snapArray.reduce(function (prev, curr, index) { return (Math.abs(curr - n) < Math.abs(snapArray[prev] - n) ? index : prev); }, 0);
var gap = Math.abs(snapArray[closestGapIndex] - n);
return snapGap === 0 || gap < snapGap ? snapArray[closestGapIndex] : n;
};
var getStringSize = function (n) {
n = n.toString();
if (n === 'auto') {
return n;
}
if (n.endsWith('px')) {
return n;
}
if (n.endsWith('%')) {
return n;
}
if (n.endsWith('vh')) {
return n;
}
if (n.endsWith('vw')) {
return n;
}
if (n.endsWith('vmax')) {
return n;
}
if (n.endsWith('vmin')) {
return n;
}
return n + "px";
};
var getPixelSize = function (size, parentSize, innerWidth, innerHeight) {
if (size && typeof size === 'string') {
if (size.endsWith('px')) {
return Number(size.replace('px', ''));
}
if (size.endsWith('%')) {
var ratio = Number(size.replace('%', '')) / 100;
return parentSize * ratio;
}
if (size.endsWith('vw')) {
var ratio = Number(size.replace('vw', '')) / 100;
return innerWidth * ratio;
}
if (size.endsWith('vh')) {
var ratio = Number(size.replace('vh', '')) / 100;
return innerHeight * ratio;
}
}
return size;
};
var calculateNewMax = function (parentSize, innerWidth, innerHeight, maxWidth, maxHeight, minWidth, minHeight) {
maxWidth = getPixelSize(maxWidth, parentSize.width, innerWidth, innerHeight);
maxHeight = getPixelSize(maxHeight, parentSize.height, innerWidth, innerHeight);
minWidth = getPixelSize(minWidth, parentSize.width, innerWidth, innerHeight);
minHeight = getPixelSize(minHeight, parentSize.height, innerWidth, innerHeight);
return {
maxWidth: typeof maxWidth === 'undefined' ? undefined : Number(maxWidth),
maxHeight: typeof maxHeight === 'undefined' ? undefined : Number(maxHeight),
minWidth: typeof minWidth === 'undefined' ? undefined : Number(minWidth),
minHeight: typeof minHeight === 'undefined' ? undefined : Number(minHeight),
};
};
var definedProps = [
'as',
'style',
'className',
'grid',
'snap',
'bounds',
'boundsByDirection',
'size',
'defaultSize',
'minWidth',
'minHeight',
'maxWidth',
'maxHeight',
'lockAspectRatio',
'lockAspectRatioExtraWidth',
'lockAspectRatioExtraHeight',
'enable',
'handleStyles',
'handleClasses',
'handleWrapperStyle',
'handleWrapperClass',
'children',
'onResizeStart',
'onResize',
'onResizeStop',
'handleComponent',
'scale',
'resizeRatio',
'snapGap',
];
// HACK: This class is used to calculate % size.
var baseClassName = '__resizable_base__';
var Resizable = /** @class */ (function (_super) {
lib_extends(Resizable, _super);
function Resizable(props) {
var _this = _super.call(this, props) || this;
_this.ratio = 1;
_this.resizable = null;
// For parent boundary
_this.parentLeft = 0;
_this.parentTop = 0;
// For boundary
_this.resizableLeft = 0;
_this.resizableRight = 0;
_this.resizableTop = 0;
_this.resizableBottom = 0;
// For target boundary
_this.targetLeft = 0;
_this.targetTop = 0;
_this.appendBase = function () {
if (!_this.resizable || !_this.window) {
return null;
}
var parent = _this.parentNode;
if (!parent) {
return null;
}
var element = _this.window.document.createElement('div');
element.style.width = '100%';
element.style.height = '100%';
element.style.position = 'absolute';
element.style.transform = 'scale(0, 0)';
element.style.left = '0';
element.style.flex = '0 0 100%';
if (element.classList) {
element.classList.add(baseClassName);
}
else {
element.className += baseClassName;
}
parent.appendChild(element);
return element;
};
_this.removeBase = function (base) {
var parent = _this.parentNode;
if (!parent) {
return;
}
parent.removeChild(base);
};
_this.ref = function (c) {
if (c) {
_this.resizable = c;
}
};
_this.state = {
isResizing: false,
width: typeof (_this.propsSize && _this.propsSize.width) === 'undefined'
? 'auto'
: _this.propsSize && _this.propsSize.width,
height: typeof (_this.propsSize && _this.propsSize.height) === 'undefined'
? 'auto'
: _this.propsSize && _this.propsSize.height,
direction: 'right',
original: {
x: 0,
y: 0,
width: 0,
height: 0,
},
backgroundStyle: {
height: '100%',
width: '100%',
backgroundColor: 'rgba(0,0,0,0)',
cursor: 'auto',
opacity: 0,
position: 'fixed',
zIndex: 9999,
top: '0',
left: '0',
bottom: '0',
right: '0',
},
flexBasis: undefined,
};
_this.onResizeStart = _this.onResizeStart.bind(_this);
_this.onMouseMove = _this.onMouseMove.bind(_this);
_this.onMouseUp = _this.onMouseUp.bind(_this);
return _this;
}
Object.defineProperty(Resizable.prototype, "parentNode", {
get: function () {
if (!this.resizable) {
return null;
}
return this.resizable.parentNode;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Resizable.prototype, "window", {
get: function () {
if (!this.resizable) {
return null;
}
if (!this.resizable.ownerDocument) {
return null;
}
return this.resizable.ownerDocument.defaultView;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Resizable.prototype, "propsSize", {
get: function () {
return this.props.size || this.props.defaultSize || DEFAULT_SIZE;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Resizable.prototype, "size", {
get: function () {
var width = 0;
var height = 0;
if (this.resizable && this.window) {
var orgWidth = this.resizable.offsetWidth;
var orgHeight = this.resizable.offsetHeight;
// HACK: Set position `relative` to get parent size.
// This is because when re-resizable set `absolute`, I can not get base width correctly.
var orgPosition = this.resizable.style.position;
if (orgPosition !== 'relative') {
this.resizable.style.position = 'relative';
}
// INFO: Use original width or height if set auto.
width = this.resizable.style.width !== 'auto' ? this.resizable.offsetWidth : orgWidth;
height = this.resizable.style.height !== 'auto' ? this.resizable.offsetHeight : orgHeight;
// Restore original position
this.resizable.style.position = orgPosition;
}
return { width: width, height: height };
},
enumerable: false,
configurable: true
});
Object.defineProperty(Resizable.prototype, "sizeStyle", {
get: function () {
var _this = this;
var size = this.props.size;
var getSize = function (key) {
if (typeof _this.state[key] === 'undefined' || _this.state[key] === 'auto') {
return 'auto';
}
if (_this.propsSize && _this.propsSize[key] && _this.propsSize[key].toString().endsWith('%')) {
if (_this.state[key].toString().endsWith('%')) {
return _this.state[key].toString();
}
var parentSize = _this.getParentSize();
var value = Number(_this.state[key].toString().replace('px', ''));
var percent = (value / parentSize[key]) * 100;
return percent + "%";
}
return getStringSize(_this.state[key]);
};
var width = size && typeof size.width !== 'undefined' && !this.state.isResizing
? getStringSize(size.width)
: getSize('width');
var height = size && typeof size.height !== 'undefined' && !this.state.isResizing
? getStringSize(size.height)
: getSize('height');
return { width: width, height: height };
},
enumerable: false,
configurable: true
});
Resizable.prototype.getParentSize = function () {
if (!this.parentNode) {
if (!this.window) {
return { width: 0, height: 0 };
}
return { width: this.window.innerWidth, height: this.window.innerHeight };
}
var base = this.appendBase();
if (!base) {
return { width: 0, height: 0 };
}
// INFO: To calculate parent width with flex layout
var wrapChanged = false;
var wrap = this.parentNode.style.flexWrap;
if (wrap !== 'wrap') {
wrapChanged = true;
this.parentNode.style.flexWrap = 'wrap';
// HACK: Use relative to get parent padding size
}
base.style.position = 'relative';
base.style.minWidth = '100%';
base.style.minHeight = '100%';
var size = {
width: base.offsetWidth,
height: base.offsetHeight,
};
if (wrapChanged) {
this.parentNode.style.flexWrap = wrap;
}
this.removeBase(base);
return size;
};
Resizable.prototype.bindEvents = function () {
if (this.window) {
this.window.addEventListener('mouseup', this.onMouseUp);
this.window.addEventListener('mousemove', this.onMouseMove);
this.window.addEventListener('mouseleave', this.onMouseUp);
this.window.addEventListener('touchmove', this.onMouseMove, {
capture: true,
passive: false,
});
this.window.addEventListener('touchend', this.onMouseUp);
}
};
Resizable.prototype.unbindEvents = function () {
if (this.window) {
this.window.removeEventListener('mouseup', this.onMouseUp);
this.window.removeEventListener('mousemove', this.onMouseMove);
this.window.removeEventListener('mouseleave', this.onMouseUp);
this.window.removeEventListener('touchmove', this.onMouseMove, true);
this.window.removeEventListener('touchend', this.onMouseUp);
}
};
Resizable.prototype.componentDidMount = function () {
if (!this.resizable || !this.window) {
return;
}
var computedStyle = this.window.getComputedStyle(this.resizable);
this.setState({
width: this.state.width || this.size.width,
height: this.state.height || this.size.height,
flexBasis: computedStyle.flexBasis !== 'auto' ? computedStyle.flexBasis : undefined,
});
};
Resizable.prototype.componentWillUnmount = function () {
if (this.window) {
this.unbindEvents();
}
};
Resizable.prototype.createSizeForCssProperty = function (newSize, kind) {
var propsSize = this.propsSize && this.propsSize[kind];
return this.state[kind] === 'auto' &&
this.state.original[kind] === newSize &&
(typeof propsSize === 'undefined' || propsSize === 'auto')
? 'auto'
: newSize;
};
Resizable.prototype.calculateNewMaxFromBoundary = function (maxWidth, maxHeight) {
var boundsByDirection = this.props.boundsByDirection;
var direction = this.state.direction;
var widthByDirection = boundsByDirection && hasDirection('left', direction);
var heightByDirection = boundsByDirection && hasDirection('top', direction);
var boundWidth;
var boundHeight;
if (this.props.bounds === 'parent') {
var parent_1 = this.parentNode;
if (parent_1) {
boundWidth = widthByDirection
? this.resizableRight - this.parentLeft
: parent_1.offsetWidth + (this.parentLeft - this.resizableLeft);
boundHeight = heightByDirection
? this.resizableBottom - this.parentTop
: parent_1.offsetHeight + (this.parentTop - this.resizableTop);
}
}
else if (this.props.bounds === 'window') {
if (this.window) {
boundWidth = widthByDirection ? this.resizableRight : this.window.innerWidth - this.resizableLeft;
boundHeight = heightByDirection ? this.resizableBottom : this.window.innerHeight - this.resizableTop;
}
}
else if (this.props.bounds) {
boundWidth = widthByDirection
? this.resizableRight - this.targetLeft
: this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft);
boundHeight = heightByDirection
? this.resizableBottom - this.targetTop
: this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop);
}
if (boundWidth && Number.isFinite(boundWidth)) {
maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth;
}
if (boundHeight && Number.isFinite(boundHeight)) {
maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight;
}
return { maxWidth: maxWidth, maxHeight: maxHeight };
};
Resizable.prototype.calculateNewSizeFromDirection = function (clientX, clientY) {
var scale = this.props.scale || 1;
var resizeRatio = this.props.resizeRatio || 1;
var _a = this.state, direction = _a.direction, original = _a.original;
var _b = this.props, lockAspectRatio = _b.lockAspectRatio, lockAspectRatioExtraHeight = _b.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _b.lockAspectRatioExtraWidth;
var newWidth = original.width;
var newHeight = original.height;
var extraHeight = lockAspectRatioExtraHeight || 0;
var extraWidth = lockAspectRatioExtraWidth || 0;
if (hasDirection('right', direction)) {
newWidth = original.width + ((clientX - original.x) * resizeRatio) / scale;
if (lockAspectRatio) {
newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
}
}
if (hasDirection('left', direction)) {
newWidth = original.width - ((clientX - original.x) * resizeRatio) / scale;
if (lockAspectRatio) {
newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
}
}
if (hasDirection('bottom', direction)) {
newHeight = original.height + ((clientY - original.y) * resizeRatio) / scale;
if (lockAspectRatio) {
newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
}
}
if (hasDirection('top', direction)) {
newHeight = original.height - ((clientY - original.y) * resizeRatio) / scale;
if (lockAspectRatio) {
newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
}
}
return { newWidth: newWidth, newHeight: newHeight };
};
Resizable.prototype.calculateNewSizeFromAspectRatio = function (newWidth, newHeight, max, min) {
var _a = this.props, lockAspectRatio = _a.lockAspectRatio, lockAspectRatioExtraHeight = _a.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _a.lockAspectRatioExtraWidth;
var computedMinWidth = typeof min.width === 'undefined' ? 10 : min.width;
var computedMaxWidth = typeof max.width === 'undefined' || max.width < 0 ? newWidth : max.width;
var computedMinHeight = typeof min.height === 'undefined' ? 10 : min.height;
var computedMaxHeight = typeof max.height === 'undefined' || max.height < 0 ? newHeight : max.height;
var extraHeight = lockAspectRatioExtraHeight || 0;
var extraWidth = lockAspectRatioExtraWidth || 0;
if (lockAspectRatio) {
var extraMinWidth = (computedMinHeight - extraHeight) * this.ratio + extraWidth;
var extraMaxWidth = (computedMaxHeight - extraHeight) * this.ratio + extraWidth;
var extraMinHeight = (computedMinWidth - extraWidth) / this.ratio + extraHeight;
var extraMaxHeight = (computedMaxWidth - extraWidth) / this.ratio + extraHeight;
var lockedMinWidth = Math.max(computedMinWidth, extraMinWidth);
var lockedMaxWidth = Math.min(computedMaxWidth, extraMaxWidth);
var lockedMinHeight = Math.max(computedMinHeight, extraMinHeight);
var lockedMaxHeight = Math.min(computedMaxHeight, extraMaxHeight);
newWidth = lib_clamp(newWidth, lockedMinWidth, lockedMaxWidth);
newHeight = lib_clamp(newHeight, lockedMinHeight, lockedMaxHeight);
}
else {
newWidth = lib_clamp(newWidth, computedMinWidth, computedMaxWidth);
newHeight = lib_clamp(newHeight, computedMinHeight, computedMaxHeight);
}
return { newWidth: newWidth, newHeight: newHeight };
};
Resizable.prototype.setBoundingClientRect = function () {
// For parent boundary
if (this.props.bounds === 'parent') {
var parent_2 = this.parentNode;
if (parent_2) {
var parentRect = parent_2.getBoundingClientRect();
this.parentLeft = parentRect.left;
this.parentTop = parentRect.top;
}
}
// For target(html element) boundary
if (this.props.bounds && typeof this.props.bounds !== 'string') {
var targetRect = this.props.bounds.getBoundingClientRect();
this.targetLeft = targetRect.left;
this.targetTop = targetRect.top;
}
// For boundary
if (this.resizable) {
var _a = this.resizable.getBoundingClientRect(), left = _a.left, top_1 = _a.top, right = _a.right, bottom = _a.bottom;
this.resizableLeft = left;
this.resizableRight = right;
this.resizableTop = top_1;
this.resizableBottom = bottom;
}
};
Resizable.prototype.onResizeStart = function (event, direction) {
if (!this.resizable || !this.window) {
return;
}
var clientX = 0;
var clientY = 0;
if (event.nativeEvent && isMouseEvent(event.nativeEvent)) {
clientX = event.nativeEvent.clientX;
clientY = event.nativeEvent.clientY;
}
else if (event.nativeEvent && isTouchEvent(event.nativeEvent)) {
clientX = event.nativeEvent.touches[0].clientX;
clientY = event.nativeEvent.touches[0].clientY;
}
if (this.props.onResizeStart) {
if (this.resizable) {
var startResize = this.props.onResizeStart(event, direction, this.resizable);
if (startResize === false) {
return;
}
}
}
// Fix #168
if (this.props.size) {
if (typeof this.props.size.height !== 'undefined' && this.props.size.height !== this.state.height) {
this.setState({ height: this.props.size.height });
}
if (typeof this.props.size.width !== 'undefined' && this.props.size.width !== this.state.width) {
this.setState({ width: this.props.size.width });
}
}
// For lockAspectRatio case
this.ratio =
typeof this.props.lockAspectRatio === 'number' ? this.props.lockAspectRatio : this.size.width / this.size.height;
var flexBasis;
var computedStyle = this.window.getComputedStyle(this.resizable);
if (computedStyle.flexBasis !== 'auto') {
var parent_3 = this.parentNode;
if (parent_3) {
var dir = this.window.getComputedStyle(parent_3).flexDirection;
this.flexDir = dir.startsWith('row') ? 'row' : 'column';
flexBasis = computedStyle.flexBasis;
}
}
// For boundary
this.setBoundingClientRect();
this.bindEvents();
var state = {
original: {
x: clientX,
y: clientY,
width: this.size.width,
height: this.size.height,
},
isResizing: true,
backgroundStyle: lib_assign(lib_assign({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(event.target).cursor || 'auto' }),
direction: direction,
flexBasis: flexBasis,
};
this.setState(state);
};
Resizable.prototype.onMouseMove = function (event) {
var _this = this;
if (!this.state.isResizing || !this.resizable || !this.window) {
return;
}
if (this.window.TouchEvent && isTouchEvent(event)) {
try {
event.preventDefault();
event.stopPropagation();
}
catch (e) {
// Ignore on fail
}
}
var _a = this.props, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, minWidth = _a.minWidth, minHeight = _a.minHeight;
var clientX = isTouchEvent(event) ? event.touches[0].clientX : event.clientX;
var clientY = isTouchEvent(event) ? event.touches[0].clientY : event.clientY;
var _b = this.state, direction = _b.direction, original = _b.original, width = _b.width, height = _b.height;
var parentSize = this.getParentSize();
var max = calculateNewMax(parentSize, this.window.innerWidth, this.window.innerHeight, maxWidth, maxHeight, minWidth, minHeight);
maxWidth = max.maxWidth;
maxHeight = max.maxHeight;
minWidth = max.minWidth;
minHeight = max.minHeight;
// Calculate new size
var _c = this.calculateNewSizeFromDirection(clientX, clientY), newHeight = _c.newHeight, newWidth = _c.newWidth;
// Calculate max size from boundary settings
var boundaryMax = this.calculateNewMaxFromBoundary(maxWidth, maxHeight);
if (this.props.snap && this.props.snap.x) {
newWidth = findClosestSnap(newWidth, this.props.snap.x, this.props.snapGap);
}
if (this.props.snap && this.props.snap.y) {
newHeight = findClosestSnap(newHeight, this.props.snap.y, this.props.snapGap);
}
// Calculate new size from aspect ratio
var newSize = this.calculateNewSizeFromAspectRatio(newWidth, newHeight, { width: boundaryMax.maxWidth, height: boundaryMax.maxHeight }, { width: minWidth, height: minHeight });
newWidth = newSize.newWidth;
newHeight = newSize.newHeight;
if (this.props.grid) {
var newGridWidth = snap(newWidth, this.props.grid[0]);
var newGridHeight = snap(newHeight, this.props.grid[1]);
var gap = this.props.snapGap || 0;
newWidth = gap === 0 || Math.abs(newGridWidth - newWidth) <= gap ? newGridWidth : newWidth;
newHeight = gap === 0 || Math.abs(newGridHeight - newHeight) <= gap ? newGridHeight : newHeight;
}
var delta = {
width: newWidth - original.width,
height: newHeight - original.height,
};
if (width && typeof width === 'string') {
if (width.endsWith('%')) {
var percent = (newWidth / parentSize.width) * 100;
newWidth = percent + "%";
}
else if (width.endsWith('vw')) {
var vw = (newWidth / this.window.innerWidth) * 100;
newWidth = vw + "vw";
}
else if (width.endsWith('vh')) {
var vh = (newWidth / this.window.innerHeight) * 100;
newWidth = vh + "vh";
}
}
if (height && typeof height === 'string') {
if (height.endsWith('%')) {
var percent = (newHeight / parentSize.height) * 100;
newHeight = percent + "%";
}
else if (height.endsWith('vw')) {
var vw = (newHeight / this.window.innerWidth) * 100;
newHeight = vw + "vw";
}
else if (height.endsWith('vh')) {
var vh = (newHeight / this.window.innerHeight) * 100;
newHeight = vh + "vh";
}
}
var newState = {
width: this.createSizeForCssProperty(newWidth, 'width'),
height: this.createSizeForCssProperty(newHeight, 'height'),
};
if (this.flexDir === 'row') {
newState.flexBasis = newState.width;
}
else if (this.flexDir === 'column') {
newState.flexBasis = newState.height;
}
// For v18, update state sync
(0,external_ReactDOM_namespaceObject.flushSync)(function () {
_this.setState(newState);
});
if (this.props.onResize) {
this.props.onResize(event, direction, this.resizable, delta);
}
};
Resizable.prototype.onMouseUp = function (event) {
var _a = this.state, isResizing = _a.isResizing, direction = _a.direction, original = _a.original;
if (!isResizing || !this.resizable) {
return;
}
var delta = {
width: this.size.width - original.width,
height: this.size.height - original.height,
};
if (this.props.onResizeStop) {
this.props.onResizeStop(event, direction, this.resizable, delta);
}
if (this.props.size) {
this.setState(this.props.size);
}
this.unbindEvents();
this.setState({
isResizing: false,
backgroundStyle: lib_assign(lib_assign({}, this.state.backgroundStyle), { cursor: 'auto' }),
});
};
Resizable.prototype.updateSize = function (size) {
this.setState({ width: size.width, height: size.height });
};
Resizable.prototype.renderResizer = function () {
var _this = this;
var _a = this.props, enable = _a.enable, handleStyles = _a.handleStyles, handleClasses = _a.handleClasses, handleWrapperStyle = _a.handleWrapperStyle, handleWrapperClass = _a.handleWrapperClass, handleComponent = _a.handleComponent;
if (!enable) {
return null;
}
var resizers = Object.keys(enable).map(function (dir) {
if (enable[dir] !== false) {
return (external_React_.createElement(Resizer, { key: dir, direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir] }, handleComponent && handleComponent[dir] ? handleComponent[dir] : null));
}
return null;
});
// #93 Wrap the resize box in span (will not break 100% width/height)
return (external_React_.createElement("div", { className: handleWrapperClass, style: handleWrapperStyle }, resizers));
};
Resizable.prototype.render = function () {
var _this = this;
var extendsProps = Object.keys(this.props).reduce(function (acc, key) {
if (definedProps.indexOf(key) !== -1) {
return acc;
}
acc[key] = _this.props[key];
return acc;
}, {});
var style = lib_assign(lib_assign(lib_assign({ position: 'relative', userSelect: this.state.isResizing ? 'none' : 'auto' }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: 'border-box', flexShrink: 0 });
if (this.state.flexBasis) {
style.flexBasis = this.state.flexBasis;
}
var Wrapper = this.props.as || 'div';
return (external_React_.createElement(Wrapper, lib_assign({ ref: this.ref, style: style, className: this.props.className }, extendsProps),
this.state.isResizing && external_React_.createElement("div", { style: this.state.backgroundStyle }),
this.props.children,
this.renderResizer()));
};
Resizable.defaultProps = {
as: 'div',
onResizeStart: function () { },
onResize: function () { },
onResizeStop: function () { },
enable: {
top: true,
right: true,
bottom: true,
left: true,
topRight: true,
bottomRight: true,
bottomLeft: true,
topLeft: true,
},
style: {},
grid: [1, 1],
lockAspectRatio: false,
lockAspectRatioExtraWidth: 0,
lockAspectRatioExtraHeight: 0,
scale: 1,
resizeRatio: 1,
snapGap: 0,
};
return Resizable;
}(external_React_.PureComponent));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/utils.js
/**
* WordPress dependencies
*/
const utils_noop = () => {};
const POSITIONS = {
bottom: 'bottom',
corner: 'corner'
};
/**
* Custom hook that manages resize listener events. It also provides a label
* based on current resize width x height values.
*
* @param props
* @param props.axis Only shows the label corresponding to the axis.
* @param props.fadeTimeout Duration (ms) before deactivating the resize label.
* @param props.onResize Callback when a resize occurs. Provides { width, height } callback.
* @param props.position Adjusts label value.
* @param props.showPx Whether to add `PX` to the label.
*
* @return Properties for hook.
*/
function useResizeLabel({
axis,
fadeTimeout = 180,
onResize = utils_noop,
position = POSITIONS.bottom,
showPx = false
}) {
/*
* The width/height values derive from this special useResizeObserver hook.
* This custom hook uses the ResizeObserver API to listen for resize events.
*/
const [resizeListener, sizes] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
/*
* Indicates if the x/y axis is preferred.
* If set, we will avoid resetting the moveX and moveY values.
* This will allow for the preferred axis values to persist in the label.
*/
const isAxisControlled = !!axis;
/*
* The moveX and moveY values are used to track whether the label should
* display width, height, or width x height.
*/
const [moveX, setMoveX] = (0,external_wp_element_namespaceObject.useState)(false);
const [moveY, setMoveY] = (0,external_wp_element_namespaceObject.useState)(false);
/*
* Cached dimension values to check for width/height updates from the
* sizes property from useResizeAware()
*/
const {
width,
height
} = sizes;
const heightRef = (0,external_wp_element_namespaceObject.useRef)(height);
const widthRef = (0,external_wp_element_namespaceObject.useRef)(width);
/*
* This timeout is used with setMoveX and setMoveY to determine of
* both width and height values have changed at (roughly) the same time.
*/
const moveTimeoutRef = (0,external_wp_element_namespaceObject.useRef)();
const debounceUnsetMoveXY = (0,external_wp_element_namespaceObject.useCallback)(() => {
const unsetMoveXY = () => {
/*
* If axis is controlled, we will avoid resetting the moveX and moveY values.
* This will allow for the preferred axis values to persist in the label.
*/
if (isAxisControlled) return;
setMoveX(false);
setMoveY(false);
};
if (moveTimeoutRef.current) {
window.clearTimeout(moveTimeoutRef.current);
}
moveTimeoutRef.current = window.setTimeout(unsetMoveXY, fadeTimeout);
}, [fadeTimeout, isAxisControlled]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
/*
* On the initial render of useResizeAware, the height and width values are
* null. They are calculated then set using via an internal useEffect hook.
*/
const isRendered = width !== null || height !== null;
if (!isRendered) return;
const didWidthChange = width !== widthRef.current;
const didHeightChange = height !== heightRef.current;
if (!didWidthChange && !didHeightChange) return;
/*
* After the initial render, the useResizeAware will set the first
* width and height values. We'll sync those values with our
* width and height refs. However, we shouldn't render our Tooltip
* label on this first cycle.
*/
if (width && !widthRef.current && height && !heightRef.current) {
widthRef.current = width;
heightRef.current = height;
return;
}
/*
* After the first cycle, we can track width and height changes.
*/
if (didWidthChange) {
setMoveX(true);
widthRef.current = width;
}
if (didHeightChange) {
setMoveY(true);
heightRef.current = height;
}
onResize({
width,
height
});
debounceUnsetMoveXY();
}, [width, height, onResize, debounceUnsetMoveXY]);
const label = getSizeLabel({
axis,
height,
moveX,
moveY,
position,
showPx,
width
});
return {
label,
resizeListener
};
}
/**
* Gets the resize label based on width and height values (as well as recent changes).
*
* @param props
* @param props.axis Only shows the label corresponding to the axis.
* @param props.height Height value.
* @param props.moveX Recent width (x axis) changes.
* @param props.moveY Recent width (y axis) changes.
* @param props.position Adjusts label value.
* @param props.showPx Whether to add `PX` to the label.
* @param props.width Width value.
*
* @return The rendered label.
*/
function getSizeLabel({
axis,
height,
moveX = false,
moveY = false,
position = POSITIONS.bottom,
showPx = false,
width
}) {
if (!moveX && !moveY) return undefined;
/*
* Corner position...
* We want the label to appear like width x height.
*/
if (position === POSITIONS.corner) {
return `${width} x ${height}`;
}
/*
* Other POSITIONS...
* The label will combine both width x height values if both
* values have recently been changed.
*
* Otherwise, only width or height will be displayed.
* The `PX` unit will be added, if specified by the `showPx` prop.
*/
const labelUnit = showPx ? ' px' : '';
if (axis) {
if (axis === 'x' && moveX) {
return `${width}${labelUnit}`;
}
if (axis === 'y' && moveY) {
return `${height}${labelUnit}`;
}
}
if (moveX && moveY) {
return `${width} x ${height}`;
}
if (moveX) {
return `${width}${labelUnit}`;
}
if (moveY) {
return `${height}${labelUnit}`;
}
return undefined;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js
function resize_tooltip_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const resize_tooltip_styles_Root = emotion_styled_base_browser_esm("div", true ? {
target: "e1wq7y4k3"
} : 0)( true ? {
name: "1cd7zoc",
styles: "bottom:0;box-sizing:border-box;left:0;pointer-events:none;position:absolute;right:0;top:0"
} : 0);
const TooltipWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "e1wq7y4k2"
} : 0)( true ? {
name: "ajymcs",
styles: "align-items:center;box-sizing:border-box;display:inline-flex;justify-content:center;opacity:0;pointer-events:none;transition:opacity 120ms linear"
} : 0);
const resize_tooltip_styles_Tooltip = emotion_styled_base_browser_esm("div", true ? {
target: "e1wq7y4k1"
} : 0)("background:", COLORS.theme.foreground, ";border-radius:2px;box-sizing:border-box;font-family:", font('default.fontFamily'), ";font-size:12px;color:", COLORS.theme.foregroundInverted, ";padding:4px 8px;position:relative;" + ( true ? "" : 0));
// TODO: Resolve need to use &&& to increase specificity
// https://github.com/WordPress/gutenberg/issues/18483
const LabelText = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? {
target: "e1wq7y4k0"
} : 0)("&&&{color:", COLORS.theme.foregroundInverted, ";display:block;font-size:13px;line-height:1.4;white-space:nowrap;}" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/label.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const CORNER_OFFSET = 4;
const CURSOR_OFFSET_TOP = CORNER_OFFSET * 2.5;
function resize_tooltip_label_Label({
label,
position = POSITIONS.corner,
zIndex = 1000,
...props
}, ref) {
const showLabel = !!label;
const isBottom = position === POSITIONS.bottom;
const isCorner = position === POSITIONS.corner;
if (!showLabel) return null;
let style = {
opacity: showLabel ? 1 : undefined,
zIndex
};
let labelStyle = {};
if (isBottom) {
style = {
...style,
position: 'absolute',
bottom: CURSOR_OFFSET_TOP * -1,
left: '50%',
transform: 'translate(-50%, 0)'
};
labelStyle = {
transform: `translate(0, 100%)`
};
}
if (isCorner) {
style = {
...style,
position: 'absolute',
top: CORNER_OFFSET,
right: (0,external_wp_i18n_namespaceObject.isRTL)() ? undefined : CORNER_OFFSET,
left: (0,external_wp_i18n_namespaceObject.isRTL)() ? CORNER_OFFSET : undefined
};
}
return (0,external_React_.createElement)(TooltipWrapper, {
"aria-hidden": "true",
className: "components-resizable-tooltip__tooltip-wrapper",
ref: ref,
style: style,
...props
}, (0,external_React_.createElement)(resize_tooltip_styles_Tooltip, {
className: "components-resizable-tooltip__tooltip",
style: labelStyle
}, (0,external_React_.createElement)(LabelText, {
as: "span"
}, label)));
}
const label_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(resize_tooltip_label_Label);
/* harmony default export */ const resize_tooltip_label = (label_ForwardedComponent);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const resize_tooltip_noop = () => {};
function ResizeTooltip({
axis,
className,
fadeTimeout = 180,
isVisible = true,
labelRef,
onResize = resize_tooltip_noop,
position = POSITIONS.bottom,
showPx = true,
zIndex = 1000,
...props
}, ref) {
const {
label,
resizeListener
} = useResizeLabel({
axis,
fadeTimeout,
onResize,
showPx,
position
});
if (!isVisible) return null;
const classes = classnames_default()('components-resize-tooltip', className);
return (0,external_React_.createElement)(resize_tooltip_styles_Root, {
"aria-hidden": "true",
className: classes,
ref: ref,
...props
}, resizeListener, (0,external_React_.createElement)(resize_tooltip_label, {
"aria-hidden": props['aria-hidden'],
label: label,
position: position,
ref: labelRef,
zIndex: zIndex
}));
}
const resize_tooltip_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(ResizeTooltip);
/* harmony default export */ const resize_tooltip = (resize_tooltip_ForwardedComponent);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/index.js
/**
* WordPress dependencies
*/
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const HANDLE_CLASS_NAME = 'components-resizable-box__handle';
const SIDE_HANDLE_CLASS_NAME = 'components-resizable-box__side-handle';
const CORNER_HANDLE_CLASS_NAME = 'components-resizable-box__corner-handle';
const HANDLE_CLASSES = {
top: classnames_default()(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-top'),
right: classnames_default()(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-right'),
bottom: classnames_default()(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-bottom'),
left: classnames_default()(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-left'),
topLeft: classnames_default()(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-top', 'components-resizable-box__handle-left'),
topRight: classnames_default()(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-top', 'components-resizable-box__handle-right'),
bottomRight: classnames_default()(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-bottom', 'components-resizable-box__handle-right'),
bottomLeft: classnames_default()(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-bottom', 'components-resizable-box__handle-left')
};
// Removes the inline styles in the drag handles.
const HANDLE_STYLES_OVERRIDES = {
width: undefined,
height: undefined,
top: undefined,
right: undefined,
bottom: undefined,
left: undefined
};
const HANDLE_STYLES = {
top: HANDLE_STYLES_OVERRIDES,
right: HANDLE_STYLES_OVERRIDES,
bottom: HANDLE_STYLES_OVERRIDES,
left: HANDLE_STYLES_OVERRIDES,
topLeft: HANDLE_STYLES_OVERRIDES,
topRight: HANDLE_STYLES_OVERRIDES,
bottomRight: HANDLE_STYLES_OVERRIDES,
bottomLeft: HANDLE_STYLES_OVERRIDES
};
function UnforwardedResizableBox({
className,
children,
showHandle = true,
__experimentalShowTooltip: showTooltip = false,
__experimentalTooltipProps: tooltipProps = {},
...props
}, ref) {
return (0,external_React_.createElement)(Resizable, {
className: classnames_default()('components-resizable-box__container', showHandle && 'has-show-handle', className),
handleClasses: HANDLE_CLASSES,
handleStyles: HANDLE_STYLES,
ref: ref,
...props
}, children, showTooltip && (0,external_React_.createElement)(resize_tooltip, {
...tooltipProps
}));
}
const ResizableBox = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedResizableBox);
/* harmony default export */ const resizable_box = (ResizableBox);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/responsive-wrapper/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* A wrapper component that maintains its aspect ratio when resized.
*
* ```jsx
* import { ResponsiveWrapper } from '@wordpress/components';
*
* const MyResponsiveWrapper = () => (
* <ResponsiveWrapper naturalWidth={ 2000 } naturalHeight={ 680 }>
* <img
* src="https://s.w.org/style/images/about/WordPress-logotype-standard.png"
* alt="WordPress"
* />
* </ResponsiveWrapper>
* );
* ```
*/
function ResponsiveWrapper({
naturalWidth,
naturalHeight,
children,
isInline = false
}) {
if (external_wp_element_namespaceObject.Children.count(children) !== 1) {
return null;
}
const TagName = isInline ? 'span' : 'div';
let aspectRatio;
if (naturalWidth && naturalHeight) {
aspectRatio = `${naturalWidth} / ${naturalHeight}`;
}
return (0,external_React_.createElement)(TagName, {
className: "components-responsive-wrapper"
}, (0,external_React_.createElement)("div", null, (0,external_wp_element_namespaceObject.cloneElement)(children, {
className: classnames_default()('components-responsive-wrapper__content', children.props.className),
style: {
...children.props.style,
aspectRatio
}
})));
}
/* harmony default export */ const responsive_wrapper = (ResponsiveWrapper);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/sandbox/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const observeAndResizeJS = function () {
const {
MutationObserver
} = window;
if (!MutationObserver || !document.body || !window.parent) {
return;
}
function sendResize() {
const clientBoundingRect = document.body.getBoundingClientRect();
window.parent.postMessage({
action: 'resize',
width: clientBoundingRect.width,
height: clientBoundingRect.height
}, '*');
}
const observer = new MutationObserver(sendResize);
observer.observe(document.body, {
attributes: true,
attributeOldValue: false,
characterData: true,
characterDataOldValue: false,
childList: true,
subtree: true
});
window.addEventListener('load', sendResize, true);
// Hack: Remove viewport unit styles, as these are relative
// the iframe root and interfere with our mechanism for
// determining the unconstrained page bounds.
function removeViewportStyles(ruleOrNode) {
if (ruleOrNode.style) {
['width', 'height', 'minHeight', 'maxHeight'].forEach(function (style) {
if (/^\\d+(vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/.test(ruleOrNode.style[style])) {
ruleOrNode.style[style] = '';
}
});
}
}
Array.prototype.forEach.call(document.querySelectorAll('[style]'), removeViewportStyles);
Array.prototype.forEach.call(document.styleSheets, function (stylesheet) {
Array.prototype.forEach.call(stylesheet.cssRules || stylesheet.rules, removeViewportStyles);
});
document.body.style.position = 'absolute';
document.body.style.width = '100%';
document.body.setAttribute('data-resizable-iframe-connected', '');
sendResize();
// Resize events can change the width of elements with 100% width, but we don't
// get an DOM mutations for that, so do the resize when the window is resized, too.
window.addEventListener('resize', sendResize, true);
};
// TODO: These styles shouldn't be coupled with WordPress.
const style = `
body {
margin: 0;
}
html,
body,
body > div {
width: 100%;
}
html.wp-has-aspect-ratio,
body.wp-has-aspect-ratio,
body.wp-has-aspect-ratio > div,
body.wp-has-aspect-ratio > div iframe {
width: 100%;
height: 100%;
overflow: hidden; /* If it has an aspect ratio, it shouldn't scroll. */
}
body > div > * {
margin-top: 0 !important; /* Has to have !important to override inline styles. */
margin-bottom: 0 !important;
}
`;
/**
* This component provides an isolated environment for arbitrary HTML via iframes.
*
* ```jsx
* import { SandBox } from '@wordpress/components';
*
* const MySandBox = () => (
* <SandBox html="<p>Content</p>" title="SandBox" type="embed" />
* );
* ```
*/
function SandBox({
html = '',
title = '',
type,
styles = [],
scripts = [],
onFocus,
tabIndex
}) {
const ref = (0,external_wp_element_namespaceObject.useRef)();
const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(0);
const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(0);
function isFrameAccessible() {
try {
return !!ref.current?.contentDocument?.body;
} catch (e) {
return false;
}
}
function trySandBox(forceRerender = false) {
if (!isFrameAccessible()) {
return;
}
const {
contentDocument,
ownerDocument
} = ref.current;
if (!forceRerender && null !== contentDocument?.body.getAttribute('data-resizable-iframe-connected')) {
return;
}
// Put the html snippet into a html document, and then write it to the iframe's document
// we can use this in the future to inject custom styles or scripts.
// Scripts go into the body rather than the head, to support embedded content such as Instagram
// that expect the scripts to be part of the body.
const htmlDoc = (0,external_React_.createElement)("html", {
lang: ownerDocument.documentElement.lang,
className: type
}, (0,external_React_.createElement)("head", null, (0,external_React_.createElement)("title", null, title), (0,external_React_.createElement)("style", {
dangerouslySetInnerHTML: {
__html: style
}
}), styles.map((rules, i) => (0,external_React_.createElement)("style", {
key: i,
dangerouslySetInnerHTML: {
__html: rules
}
}))), (0,external_React_.createElement)("body", {
"data-resizable-iframe-connected": "data-resizable-iframe-connected",
className: type
}, (0,external_React_.createElement)("div", {
dangerouslySetInnerHTML: {
__html: html
}
}), (0,external_React_.createElement)("script", {
type: "text/javascript",
dangerouslySetInnerHTML: {
__html: `(${observeAndResizeJS.toString()})();`
}
}), scripts.map(src => (0,external_React_.createElement)("script", {
key: src,
src: src
}))));
// Writing the document like this makes it act in the same way as if it was
// loaded over the network, so DOM creation and mutation, script execution, etc.
// all work as expected.
contentDocument.open();
contentDocument.write('<!DOCTYPE html>' + (0,external_wp_element_namespaceObject.renderToString)(htmlDoc));
contentDocument.close();
}
(0,external_wp_element_namespaceObject.useEffect)(() => {
trySandBox();
function tryNoForceSandBox() {
trySandBox(false);
}
function checkMessageForResize(event) {
const iframe = ref.current;
// Verify that the mounted element is the source of the message.
if (!iframe || iframe.contentWindow !== event.source) {
return;
}
// Attempt to parse the message data as JSON if passed as string.
let data = event.data || {};
if ('string' === typeof data) {
try {
data = JSON.parse(data);
} catch (e) {}
}
// Update the state only if the message is formatted as we expect,
// i.e. as an object with a 'resize' action.
if ('resize' !== data.action) {
return;
}
setWidth(data.width);
setHeight(data.height);
}
const iframe = ref.current;
const defaultView = iframe?.ownerDocument?.defaultView;
// This used to be registered using <iframe onLoad={} />, but it made the iframe blank
// after reordering the containing block. See these two issues for more details:
// https://github.com/WordPress/gutenberg/issues/6146
// https://github.com/facebook/react/issues/18752
iframe?.addEventListener('load', tryNoForceSandBox, false);
defaultView?.addEventListener('message', checkMessageForResize);
return () => {
iframe?.removeEventListener('load', tryNoForceSandBox, false);
defaultView?.removeEventListener('message', checkMessageForResize);
};
// Ignore reason: passing `exhaustive-deps` will likely involve a more detailed refactor.
// See https://github.com/WordPress/gutenberg/pull/44378
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
(0,external_wp_element_namespaceObject.useEffect)(() => {
trySandBox();
// Ignore reason: passing `exhaustive-deps` will likely involve a more detailed refactor.
// See https://github.com/WordPress/gutenberg/pull/44378
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [title, styles, scripts]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
trySandBox(true);
// Ignore reason: passing `exhaustive-deps` will likely involve a more detailed refactor.
// See https://github.com/WordPress/gutenberg/pull/44378
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [html, type]);
return (0,external_React_.createElement)("iframe", {
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_compose_namespaceObject.useFocusableIframe)()]),
title: title,
tabIndex: tabIndex,
className: "components-sandbox",
sandbox: "allow-scripts allow-same-origin allow-presentation",
onFocus: onFocus,
width: Math.ceil(width),
height: Math.ceil(height)
});
}
/* harmony default export */ const sandbox = (SandBox);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/snackbar/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const NOTICE_TIMEOUT = 10000;
/**
* Custom hook which announces the message with the given politeness, if a
* valid message is provided.
*
* @param message Message to announce.
* @param politeness Politeness to announce.
*/
function snackbar_useSpokenMessage(message, politeness) {
const spokenMessage = typeof message === 'string' ? message : (0,external_wp_element_namespaceObject.renderToString)(message);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (spokenMessage) {
(0,external_wp_a11y_namespaceObject.speak)(spokenMessage, politeness);
}
}, [spokenMessage, politeness]);
}
function UnforwardedSnackbar({
className,
children,
spokenMessage = children,
politeness = 'polite',
actions = [],
onRemove,
icon = null,
explicitDismiss = false,
// onDismiss is a callback executed when the snackbar is dismissed.
// It is distinct from onRemove, which _looks_ like a callback but is
// actually the function to call to remove the snackbar from the UI.
onDismiss,
listRef
}, ref) {
function dismissMe(event) {
if (event && event.preventDefault) {
event.preventDefault();
}
// Prevent focus loss by moving it to the list element.
listRef?.current?.focus();
onDismiss?.();
onRemove?.();
}
function onActionClick(event, onClick) {
event.stopPropagation();
onRemove?.();
if (onClick) {
onClick(event);
}
}
snackbar_useSpokenMessage(spokenMessage, politeness);
// The `onDismiss/onRemove` can have unstable references,
// trigger side-effect cleanup, and reset timers.
const callbackRefs = (0,external_wp_element_namespaceObject.useRef)({
onDismiss,
onRemove
});
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
callbackRefs.current = {
onDismiss,
onRemove
};
});
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Only set up the timeout dismiss if we're not explicitly dismissing.
const timeoutHandle = setTimeout(() => {
if (!explicitDismiss) {
callbackRefs.current.onDismiss?.();
callbackRefs.current.onRemove?.();
}
}, NOTICE_TIMEOUT);
return () => clearTimeout(timeoutHandle);
}, [explicitDismiss]);
const classes = classnames_default()(className, 'components-snackbar', {
'components-snackbar-explicit-dismiss': !!explicitDismiss
});
if (actions && actions.length > 1) {
// We need to inform developers that snackbar only accepts 1 action.
true ? external_wp_warning_default()('Snackbar can only have one action. Use Notice if your message requires many actions.') : 0;
// return first element only while keeping it inside an array
actions = [actions[0]];
}
const snackbarContentClassnames = classnames_default()('components-snackbar__content', {
'components-snackbar__content-with-icon': !!icon
});
return (0,external_React_.createElement)("div", {
ref: ref,
className: classes,
onClick: !explicitDismiss ? dismissMe : undefined,
tabIndex: 0,
role: !explicitDismiss ? 'button' : '',
onKeyPress: !explicitDismiss ? dismissMe : undefined,
"aria-label": !explicitDismiss ? (0,external_wp_i18n_namespaceObject.__)('Dismiss this notice') : ''
}, (0,external_React_.createElement)("div", {
className: snackbarContentClassnames
}, icon && (0,external_React_.createElement)("div", {
className: "components-snackbar__icon"
}, icon), children, actions.map(({
label,
onClick,
url
}, index) => {
return (0,external_React_.createElement)(build_module_button, {
key: index,
href: url,
variant: "tertiary",
onClick: event => onActionClick(event, onClick),
className: "components-snackbar__action"
}, label);
}), explicitDismiss && (0,external_React_.createElement)("span", {
role: "button",
"aria-label": "Dismiss this notice",
tabIndex: 0,
className: "components-snackbar__dismiss-button",
onClick: dismissMe,
onKeyPress: dismissMe
}, "\u2715")));
}
/**
* A Snackbar displays a succinct message that is cleared out after a small delay.
*
* It can also offer the user options, like viewing a published post.
* But these options should also be available elsewhere in the UI.
*
* ```jsx
* const MySnackbarNotice = () => (
* <Snackbar>Post published successfully.</Snackbar>
* );
* ```
*/
const Snackbar = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSnackbar);
/* harmony default export */ const snackbar = (Snackbar);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/snackbar/list.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const SNACKBAR_VARIANTS = {
init: {
height: 0,
opacity: 0
},
open: {
height: 'auto',
opacity: 1,
transition: {
height: {
type: 'tween',
duration: 0.3,
ease: [0, 0, 0.2, 1]
},
opacity: {
type: 'tween',
duration: 0.25,
delay: 0.05,
ease: [0, 0, 0.2, 1]
}
}
},
exit: {
opacity: 0,
transition: {
type: 'tween',
duration: 0.1,
ease: [0, 0, 0.2, 1]
}
}
};
/**
* Renders a list of notices.
*
* ```jsx
* const MySnackbarListNotice = () => (
* <SnackbarList
* notices={ notices }
* onRemove={ removeNotice }
* />
* );
* ```
*/
function SnackbarList({
notices,
className,
children,
onRemove
}) {
const listRef = (0,external_wp_element_namespaceObject.useRef)(null);
const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
className = classnames_default()('components-snackbar-list', className);
const removeNotice = notice => () => onRemove?.(notice.id);
return (0,external_React_.createElement)("div", {
className: className,
tabIndex: -1,
ref: listRef
}, children, (0,external_React_.createElement)(AnimatePresence, null, notices.map(notice => {
const {
content,
...restNotice
} = notice;
return (0,external_React_.createElement)(motion.div, {
layout: !isReducedMotion // See https://www.framer.com/docs/animation/#layout-animations
,
initial: 'init',
animate: 'open',
exit: 'exit',
key: notice.id,
variants: isReducedMotion ? undefined : SNACKBAR_VARIANTS
}, (0,external_React_.createElement)("div", {
className: "components-snackbar-list__notice-container"
}, (0,external_React_.createElement)(snackbar, {
...restNotice,
onRemove: removeNotice(notice),
listRef: listRef
}, notice.content)));
})));
}
/* harmony default export */ const snackbar_list = (SnackbarList);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spinner/styles.js
function spinner_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const spinAnimation = emotion_react_browser_esm_keyframes`
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
`;
const StyledSpinner = emotion_styled_base_browser_esm("svg", true ? {
target: "ea4tfvq2"
} : 0)("width:", config_values.spinnerSize, "px;height:", config_values.spinnerSize, "px;display:inline-block;margin:5px 11px 0;position:relative;color:", COLORS.theme.accent, ";overflow:visible;opacity:1;background-color:transparent;" + ( true ? "" : 0));
const commonPathProps = true ? {
name: "9s4963",
styles: "fill:transparent;stroke-width:1.5px"
} : 0;
const SpinnerTrack = emotion_styled_base_browser_esm("circle", true ? {
target: "ea4tfvq1"
} : 0)(commonPathProps, ";stroke:", COLORS.gray[300], ";" + ( true ? "" : 0));
const SpinnerIndicator = emotion_styled_base_browser_esm("path", true ? {
target: "ea4tfvq0"
} : 0)(commonPathProps, ";stroke:currentColor;stroke-linecap:round;transform-origin:50% 50%;animation:1.4s linear infinite both ", spinAnimation, ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spinner/index.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/**
* WordPress dependencies
*/
function UnforwardedSpinner({
className,
...props
}, forwardedRef) {
return (0,external_React_.createElement)(StyledSpinner, {
className: classnames_default()('components-spinner', className),
viewBox: "0 0 100 100",
width: "16",
height: "16",
xmlns: "http://www.w3.org/2000/svg",
role: "presentation",
focusable: "false",
...props,
ref: forwardedRef
}, (0,external_React_.createElement)(SpinnerTrack, {
cx: "50",
cy: "50",
r: "50",
vectorEffect: "non-scaling-stroke"
}), (0,external_React_.createElement)(SpinnerIndicator, {
d: "m 50 0 a 50 50 0 0 1 50 50",
vectorEffect: "non-scaling-stroke"
}));
}
/**
* `Spinner` is a component used to notify users that their action is being processed.
*
* ```js
* import { Spinner } from '@wordpress/components';
*
* function Example() {
* return <Spinner />;
* }
* ```
*/
const Spinner = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSpinner);
/* harmony default export */ const spinner = (Spinner);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/surface/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedSurface(props, forwardedRef) {
const surfaceProps = useSurface(props);
return (0,external_React_.createElement)(component, {
...surfaceProps,
ref: forwardedRef
});
}
/**
* `Surface` is a core component that renders a primary background color.
*
* In the example below, notice how the `Surface` renders in white (or dark gray if in dark mode).
*
* ```jsx
* import {
* __experimentalSurface as Surface,
* __experimentalText as Text,
* } from '@wordpress/components';
*
* function Example() {
* return (
* <Surface>
* <Text>Code is Poetry</Text>
* </Surface>
* );
* }
* ```
*/
const component_Surface = contextConnect(UnconnectedSurface, 'Surface');
/* harmony default export */ const surface_component = (component_Surface);
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/tab/tab-store.js
"use client";
// src/tab/tab-store.ts
function createTabStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const composite = createCompositeStore(_chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, props), {
orientation: defaultValue(
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"horizontal"
),
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
}));
const panels = createCollectionStore();
const initialState = _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, composite.getState()), {
selectedId: defaultValue(
props.selectedId,
syncState == null ? void 0 : syncState.selectedId,
props.defaultSelectedId,
void 0
),
selectOnMove: defaultValue(
props.selectOnMove,
syncState == null ? void 0 : syncState.selectOnMove,
true
)
});
const tab = createStore(initialState, composite, props.store);
setup(
tab,
() => sync(tab, ["moves"], () => {
const { activeId, selectOnMove } = tab.getState();
if (!selectOnMove)
return;
if (!activeId)
return;
const tabItem = composite.item(activeId);
if (!tabItem)
return;
if (tabItem.dimmed)
return;
if (tabItem.disabled)
return;
tab.setState("selectedId", tabItem.id);
})
);
setup(
tab,
() => batch(
tab,
["selectedId"],
(state) => tab.setState("activeId", state.selectedId)
)
);
setup(
tab,
() => sync(tab, ["selectedId", "renderedItems"], (state) => {
if (state.selectedId !== void 0)
return;
const { activeId, renderedItems } = tab.getState();
const tabItem = composite.item(activeId);
if (tabItem && !tabItem.disabled && !tabItem.dimmed) {
tab.setState("selectedId", tabItem.id);
} else {
const tabItem2 = renderedItems.find(
(item) => !item.disabled && !item.dimmed
);
tab.setState("selectedId", tabItem2 == null ? void 0 : tabItem2.id);
}
})
);
setup(
tab,
() => sync(tab, ["renderedItems"], (state) => {
const tabs = state.renderedItems;
if (!tabs.length)
return;
return sync(panels, ["renderedItems"], (state2) => {
const items = state2.renderedItems;
const hasOrphanPanels = items.some((panel) => !panel.tabId);
if (!hasOrphanPanels)
return;
items.forEach((panel, i) => {
if (panel.tabId)
return;
const tabItem = tabs[i];
if (!tabItem)
return;
panels.renderItem(_chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, panel), { tabId: tabItem.id }));
});
});
})
);
return _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues(_chunks_4R3V3JGP_spreadValues({}, composite), tab), {
panels,
setSelectedId: (id) => tab.setState("selectedId", id),
select: (id) => {
tab.setState("selectedId", id);
composite.move(id);
}
});
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/CQMDBRG5.js
"use client";
// src/tab/tab-store.ts
function useTabStoreProps(store, update, props) {
store = useCompositeStoreProps(store, update, props);
useStoreProps(store, props, "selectedId", "setSelectedId");
useStoreProps(store, props, "selectOnMove");
const [panels, updatePanels] = EKQEJRUF_useStore(() => store.panels, {});
useUpdateEffect(updatePanels, [store, updatePanels]);
return (0,external_React_.useMemo)(() => _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, store), { panels }), [store, panels]);
}
function useTabStore(props = {}) {
const [store, update] = EKQEJRUF_useStore(createTabStore, props);
return useTabStoreProps(store, update, props);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/4B73HROV.js
"use client";
// src/tab/tab-context.tsx
var _4B73HROV_ctx = createStoreContext(
[CompositeContextProvider],
[CompositeScopedContextProvider]
);
var useTabContext = _4B73HROV_ctx.useContext;
var useTabScopedContext = _4B73HROV_ctx.useScopedContext;
var useTabProviderContext = _4B73HROV_ctx.useProviderContext;
var TabContextProvider = _4B73HROV_ctx.ContextProvider;
var TabScopedContextProvider = _4B73HROV_ctx.ScopedContextProvider;
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/tab/tab-list.js
"use client";
// src/tab/tab-list.tsx
var useTabList = createHook((_a) => {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
const context = useTabProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const orientation = store.useState(
(state) => state.orientation === "both" ? void 0 : state.orientation
);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(TabScopedContextProvider, { value: store, children: element }),
[store]
);
props = _4R3V3JGP_spreadValues({
role: "tablist",
"aria-orientation": orientation
}, props);
props = useComposite(_4R3V3JGP_spreadValues({ store }, props));
return props;
});
var tab_list_TabList = createComponent((props) => {
const htmlProps = useTabList(props);
return _3ORBWXWF_createElement("div", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/tab/tab.js
"use client";
// src/tab/tab.ts
var useTab = createHook(
(_a) => {
var _b = _a, {
store,
accessibleWhenDisabled = true,
getItem: getItemProp
} = _b, props = __objRest(_b, [
"store",
"accessibleWhenDisabled",
"getItem"
]);
const context = useTabScopedContext();
store = store || context;
invariant(
store,
false && 0
);
const defaultId = useId();
const id = props.id || defaultId;
const dimmed = disabledFromProps(props);
const getItem = (0,external_React_.useCallback)(
(item) => {
const nextItem = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, item), { dimmed });
if (getItemProp) {
return getItemProp(nextItem);
}
return nextItem;
},
[dimmed, getItemProp]
);
const onClickProp = props.onClick;
const onClick = useEvent((event) => {
onClickProp == null ? void 0 : onClickProp(event);
if (event.defaultPrevented)
return;
store == null ? void 0 : store.setSelectedId(id);
});
const panelId = store.panels.useState(
(state) => {
var _a2;
return (_a2 = state.items.find((item) => item.tabId === id)) == null ? void 0 : _a2.id;
}
);
const selected = store.useState((state) => !!id && state.selectedId === id);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
id,
role: "tab",
"aria-selected": selected,
"aria-controls": panelId || void 0
}, props), {
onClick
});
props = useCompositeItem(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
store
}, props), {
accessibleWhenDisabled,
getItem,
shouldRegisterItem: !!defaultId ? props.shouldRegisterItem : false
}));
return props;
}
);
var Tab = createMemoComponent((props) => {
const htmlProps = useTab(props);
return _3ORBWXWF_createElement("button", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/tab/tab-panel.js
"use client";
// src/tab/tab-panel.tsx
var useTabPanel = createHook(
(_a) => {
var _b = _a, { store, tabId: tabIdProp, getItem: getItemProp } = _b, props = __objRest(_b, ["store", "tabId", "getItem"]);
const context = useTabProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const ref = (0,external_React_.useRef)(null);
const id = useId(props.id);
const [hasTabbableChildren, setHasTabbableChildren] = (0,external_React_.useState)(false);
(0,external_React_.useEffect)(() => {
const element = ref.current;
if (!element)
return;
const tabbable = getAllTabbableIn(element);
setHasTabbableChildren(!!tabbable.length);
}, []);
const getItem = (0,external_React_.useCallback)(
(item) => {
const nextItem = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, item), { id: id || item.id, tabId: tabIdProp });
if (getItemProp) {
return getItemProp(nextItem);
}
return nextItem;
},
[id, tabIdProp, getItemProp]
);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(TabScopedContextProvider, { value: store, children: element }),
[store]
);
const tabId = store.panels.useState(
() => {
var _a2;
return tabIdProp || ((_a2 = store == null ? void 0 : store.panels.item(id)) == null ? void 0 : _a2.tabId);
}
);
const open = store.useState(
(state) => !!tabId && state.selectedId === tabId
);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
id,
role: "tabpanel",
"aria-labelledby": tabId || void 0
}, props), {
ref: useMergeRefs(ref, props.ref)
});
const disclosure = useDisclosureStore({ open });
props = useFocusable(_4R3V3JGP_spreadValues({ focusable: !hasTabbableChildren }, props));
props = useDisclosureContent(_4R3V3JGP_spreadValues({ store: disclosure }, props));
props = useCollectionItem(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({ store: store.panels }, props), { getItem }));
return props;
}
);
var TabPanel = createComponent((props) => {
const htmlProps = useTabPanel(props);
return _3ORBWXWF_createElement("div", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tab-panel/index.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// Separate the actual tab name from the instance ID. This is
// necessary because Ariakit internally uses the element ID when
// a new tab is selected, but our implementation looks specifically
// for the tab name to be passed to the `onSelect` callback.
const extractTabName = id => {
if (typeof id === 'undefined' || id === null) {
return;
}
return id.match(/^tab-panel-[0-9]*-(.*)/)?.[1];
};
/**
* TabPanel is an ARIA-compliant tabpanel.
*
* TabPanels organize content across different screens, data sets, and interactions.
* It has two sections: a list of tabs, and the view to show when tabs are chosen.
*
* ```jsx
* import { TabPanel } from '@wordpress/components';
*
* const onSelect = ( tabName ) => {
* console.log( 'Selecting tab', tabName );
* };
*
* const MyTabPanel = () => (
* <TabPanel
* className="my-tab-panel"
* activeClass="active-tab"
* onSelect={ onSelect }
* tabs={ [
* {
* name: 'tab1',
* title: 'Tab 1',
* className: 'tab-one',
* },
* {
* name: 'tab2',
* title: 'Tab 2',
* className: 'tab-two',
* },
* ] }
* >
* { ( tab ) => <p>{ tab.title }</p> }
* </TabPanel>
* );
* ```
*/
const UnforwardedTabPanel = ({
className,
children,
tabs,
selectOnMove = true,
initialTabName,
orientation = 'horizontal',
activeClass = 'is-active',
onSelect
}, ref) => {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(tab_panel_TabPanel, 'tab-panel');
const prependInstanceId = (0,external_wp_element_namespaceObject.useCallback)(tabName => {
if (typeof tabName === 'undefined') {
return;
}
return `${instanceId}-${tabName}`;
}, [instanceId]);
const tabStore = useTabStore({
setSelectedId: newTabValue => {
if (typeof newTabValue === 'undefined' || newTabValue === null) {
return;
}
const newTab = tabs.find(t => prependInstanceId(t.name) === newTabValue);
if (newTab?.disabled || newTab === selectedTab) {
return;
}
const simplifiedTabName = extractTabName(newTabValue);
if (typeof simplifiedTabName === 'undefined') {
return;
}
onSelect?.(simplifiedTabName);
},
orientation,
selectOnMove,
defaultSelectedId: prependInstanceId(initialTabName)
});
const selectedTabName = extractTabName(tabStore.useState('selectedId'));
const setTabStoreSelectedId = (0,external_wp_element_namespaceObject.useCallback)(tabName => {
tabStore.setState('selectedId', prependInstanceId(tabName));
}, [prependInstanceId, tabStore]);
const selectedTab = tabs.find(({
name
}) => name === selectedTabName);
const previousSelectedTabName = (0,external_wp_compose_namespaceObject.usePrevious)(selectedTabName);
// Ensure `onSelect` is called when the initial tab is selected.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (previousSelectedTabName !== selectedTabName && selectedTabName === initialTabName && !!selectedTabName) {
onSelect?.(selectedTabName);
}
}, [selectedTabName, initialTabName, onSelect, previousSelectedTabName]);
// Handle selecting the initial tab.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
// If there's a selected tab, don't override it.
if (selectedTab) {
return;
}
const initialTab = tabs.find(tab => tab.name === initialTabName);
// Wait for the denoted initial tab to be declared before making a
// selection. This ensures that if a tab is declared lazily it can
// still receive initial selection.
if (initialTabName && !initialTab) {
return;
}
if (initialTab && !initialTab.disabled) {
// Select the initial tab if it's not disabled.
setTabStoreSelectedId(initialTab.name);
} else {
// Fallback to the first enabled tab when the initial tab is
// disabled or it can't be found.
const firstEnabledTab = tabs.find(tab => !tab.disabled);
if (firstEnabledTab) {
setTabStoreSelectedId(firstEnabledTab.name);
}
}
}, [tabs, selectedTab, initialTabName, instanceId, setTabStoreSelectedId]);
// Handle the currently selected tab becoming disabled.
(0,external_wp_element_namespaceObject.useEffect)(() => {
// This effect only runs when the selected tab is defined and becomes disabled.
if (!selectedTab?.disabled) {
return;
}
const firstEnabledTab = tabs.find(tab => !tab.disabled);
// If the currently selected tab becomes disabled, select the first enabled tab.
// (if there is one).
if (firstEnabledTab) {
setTabStoreSelectedId(firstEnabledTab.name);
}
}, [tabs, selectedTab?.disabled, setTabStoreSelectedId, instanceId]);
return (0,external_React_.createElement)("div", {
className: className,
ref: ref
}, (0,external_React_.createElement)(tab_list_TabList, {
store: tabStore,
className: "components-tab-panel__tabs"
}, tabs.map(tab => {
return (0,external_React_.createElement)(Tab, {
key: tab.name,
id: prependInstanceId(tab.name),
className: classnames_default()('components-tab-panel__tabs-item', tab.className, {
[activeClass]: tab.name === selectedTabName
}),
disabled: tab.disabled,
"aria-controls": `${prependInstanceId(tab.name)}-view`,
render: (0,external_React_.createElement)(build_module_button, {
icon: tab.icon,
label: tab.icon && tab.title,
showTooltip: !!tab.icon
})
}, !tab.icon && tab.title);
})), selectedTab && (0,external_React_.createElement)(TabPanel, {
id: `${prependInstanceId(selectedTab.name)}-view`,
store: tabStore,
tabId: prependInstanceId(selectedTab.name),
className: 'components-tab-panel__tab-content'
}, children(selectedTab)));
};
const tab_panel_TabPanel = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTabPanel);
/* harmony default export */ const tab_panel = (tab_panel_TabPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedTextControl(props, ref) {
const {
__nextHasNoMarginBottom,
__next40pxDefaultSize = false,
label,
hideLabelFromVision,
value,
help,
id: idProp,
className,
onChange,
type = 'text',
...additionalProps
} = props;
const id = (0,external_wp_compose_namespaceObject.useInstanceId)(TextControl, 'inspector-text-control', idProp);
const onChangeValue = event => onChange(event.target.value);
return (0,external_React_.createElement)(base_control, {
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
label: label,
hideLabelFromVision: hideLabelFromVision,
id: id,
help: help,
className: className
}, (0,external_React_.createElement)("input", {
className: classnames_default()('components-text-control__input', {
'is-next-40px-default-size': __next40pxDefaultSize
}),
type: type,
id: id,
value: value,
onChange: onChangeValue,
"aria-describedby": !!help ? id + '__help' : undefined,
ref: ref,
...additionalProps
}));
}
/**
* TextControl components let users enter and edit text.
*
* ```jsx
* import { TextControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyTextControl = () => {
* const [ className, setClassName ] = useState( '' );
*
* return (
* <TextControl
* label="Additional CSS Class"
* value={ className }
* onChange={ ( value ) => setClassName( value ) }
* />
* );
* };
* ```
*/
const TextControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTextControl);
/* harmony default export */ const text_control = (TextControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/input/base.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const inputStyleNeutral = /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:0 0 0 transparent;transition:box-shadow 0.1s linear;border-radius:", config_values.radiusBlockUi, ";border:", config_values.borderWidth, " solid ", COLORS.ui.border, ";" + ( true ? "" : 0), true ? "" : 0);
const inputStyleFocus = /*#__PURE__*/emotion_react_browser_esm_css("border-color:", COLORS.theme.accent, ";box-shadow:0 0 0 calc( ", config_values.borderWidthFocus, " - ", config_values.borderWidth, " ) ", COLORS.theme.accent, ";outline:2px solid transparent;" + ( true ? "" : 0), true ? "" : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/breakpoint-values.js
/* harmony default export */ const breakpoint_values = ({
huge: '1440px',
wide: '1280px',
'x-large': '1080px',
large: '960px',
// admin sidebar auto folds
medium: '782px',
// Adminbar goes big.
small: '600px',
mobile: '480px',
'zoomed-in': '280px'
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/breakpoint.js
/**
* Internal dependencies
*/
/**
* @param {keyof breakpoints} point
* @return {string} Media query declaration.
*/
const breakpoint = point => `@media (min-width: ${breakpoint_values[point]})`;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/input/input-control.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const inputControl = /*#__PURE__*/emotion_react_browser_esm_css("display:block;font-family:", font('default.fontFamily'), ";padding:6px 8px;", inputStyleNeutral, ";font-size:", font('mobileTextMinFontSize'), ";line-height:normal;", breakpoint('small'), "{font-size:", font('default.fontSize'), ";line-height:normal;}&:focus{", inputStyleFocus, ";}&::-webkit-input-placeholder{color:", COLORS.ui.darkGrayPlaceholder, ";}&::-moz-placeholder{opacity:1;color:", COLORS.ui.darkGrayPlaceholder, ";}&:-ms-input-placeholder{color:", COLORS.ui.darkGrayPlaceholder, ";}.is-dark-theme &{&::-webkit-input-placeholder{color:", COLORS.ui.lightGrayPlaceholder, ";}&::-moz-placeholder{opacity:1;color:", COLORS.ui.lightGrayPlaceholder, ";}&:-ms-input-placeholder{color:", COLORS.ui.lightGrayPlaceholder, ";}}" + ( true ? "" : 0), true ? "" : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/textarea-control/styles/textarea-control-styles.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const StyledTextarea = emotion_styled_base_browser_esm("textarea", true ? {
target: "e1w5nnrk0"
} : 0)("width:100%;", inputControl, ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/textarea-control/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedTextareaControl(props, ref) {
const {
__nextHasNoMarginBottom,
label,
hideLabelFromVision,
value,
help,
onChange,
rows = 4,
className,
...additionalProps
} = props;
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(TextareaControl);
const id = `inspector-textarea-control-${instanceId}`;
const onChangeValue = event => onChange(event.target.value);
return (0,external_React_.createElement)(base_control, {
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
label: label,
hideLabelFromVision: hideLabelFromVision,
id: id,
help: help,
className: className
}, (0,external_React_.createElement)(StyledTextarea, {
className: "components-textarea-control__input",
id: id,
rows: rows,
onChange: onChangeValue,
"aria-describedby": !!help ? id + '__help' : undefined,
value: value,
ref: ref,
...additionalProps
}));
}
/**
* TextareaControls are TextControls that allow for multiple lines of text, and
* wrap overflow text onto a new line. They are a fixed height and scroll
* vertically when the cursor reaches the bottom of the field.
*
* ```jsx
* import { TextareaControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyTextareaControl = () => {
* const [ text, setText ] = useState( '' );
*
* return (
* <TextareaControl
* label="Text"
* help="Enter some text"
* value={ text }
* onChange={ ( value ) => setText( value ) }
* />
* );
* };
* ```
*/
const TextareaControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTextareaControl);
/* harmony default export */ const textarea_control = (TextareaControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text-highlight/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Highlights occurrences of a given string within another string of text. Wraps
* each match with a `<mark>` tag which provides browser default styling.
*
* ```jsx
* import { TextHighlight } from '@wordpress/components';
*
* const MyTextHighlight = () => (
* <TextHighlight
* text="Why do we like Gutenberg? Because Gutenberg is the best!"
* highlight="Gutenberg"
* />
* );
* ```
*/
const TextHighlight = props => {
const {
text = '',
highlight = ''
} = props;
const trimmedHighlightText = highlight.trim();
if (!trimmedHighlightText) {
return (0,external_React_.createElement)(external_React_.Fragment, null, text);
}
const regex = new RegExp(`(${escapeRegExp(trimmedHighlightText)})`, 'gi');
return (0,external_wp_element_namespaceObject.createInterpolateElement)(text.replace(regex, '<mark>$&</mark>'), {
mark: (0,external_React_.createElement)("mark", null)
});
};
/* harmony default export */ const text_highlight = (TextHighlight);
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tip.js
/**
* WordPress dependencies
*/
const tip = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Path, {
d: "M12 15.8c-3.7 0-6.8-3-6.8-6.8s3-6.8 6.8-6.8c3.7 0 6.8 3 6.8 6.8s-3.1 6.8-6.8 6.8zm0-12C9.1 3.8 6.8 6.1 6.8 9s2.4 5.2 5.2 5.2c2.9 0 5.2-2.4 5.2-5.2S14.9 3.8 12 3.8zM8 17.5h8V19H8zM10 20.5h4V22h-4z"
}));
/* harmony default export */ const library_tip = (tip);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tip/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Tip(props) {
const {
children
} = props;
return (0,external_React_.createElement)("div", {
className: "components-tip"
}, (0,external_React_.createElement)(icons_build_module_icon, {
icon: library_tip
}), (0,external_React_.createElement)("p", null, children));
}
/* harmony default export */ const build_module_tip = (Tip);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* ToggleControl is used to generate a toggle user interface.
*
* ```jsx
* import { ToggleControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
*
* const MyToggleControl = () => {
* const [ value, setValue ] = useState( false );
*
* return (
* <ToggleControl
* label="Fixed Background"
* checked={ value }
* onChange={ () => setValue( ( state ) => ! state ) }
* />
* );
* };
* ```
*/
function ToggleControl({
__nextHasNoMarginBottom,
label,
checked,
help,
className,
onChange,
disabled
}) {
function onChangeToggle(event) {
onChange(event.target.checked);
}
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleControl);
const id = `inspector-toggle-control-${instanceId}`;
const cx = useCx();
const classes = cx('components-toggle-control', className, !__nextHasNoMarginBottom && /*#__PURE__*/emotion_react_browser_esm_css({
marginBottom: space(3)
}, true ? "" : 0, true ? "" : 0));
let describedBy, helpLabel;
if (help) {
if (typeof help === 'function') {
// `help` as a function works only for controlled components where
// `checked` is passed down from parent component. Uncontrolled
// component can show only a static help label.
if (checked !== undefined) {
helpLabel = help(checked);
}
} else {
helpLabel = help;
}
if (helpLabel) {
describedBy = id + '__help';
}
}
return (0,external_React_.createElement)(base_control, {
id: id,
help: helpLabel,
className: classes,
__nextHasNoMarginBottom: true
}, (0,external_React_.createElement)(h_stack_component, {
justify: "flex-start",
spacing: 3
}, (0,external_React_.createElement)(form_toggle, {
id: id,
checked: checked,
onChange: onChangeToggle,
"aria-describedby": describedBy,
disabled: disabled
}), (0,external_React_.createElement)(flex_block_component, {
as: "label",
htmlFor: id,
className: "components-toggle-control__label"
}, label)));
}
/* harmony default export */ const toggle_control = (ToggleControl);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/SOK7T35T.js
"use client";
// src/toolbar/toolbar-context.tsx
var SOK7T35T_ctx = createStoreContext(
[CompositeContextProvider],
[CompositeScopedContextProvider]
);
var useToolbarContext = SOK7T35T_ctx.useContext;
var useToolbarScopedContext = SOK7T35T_ctx.useScopedContext;
var useToolbarProviderContext = SOK7T35T_ctx.useProviderContext;
var ToolbarContextProvider = SOK7T35T_ctx.ContextProvider;
var ToolbarScopedContextProvider = SOK7T35T_ctx.ScopedContextProvider;
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/7NHUGSTF.js
"use client";
// src/toolbar/toolbar-item.ts
var useToolbarItem = createHook(
(_a) => {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
const context = useToolbarContext();
store = store || context;
props = useCompositeItem(_4R3V3JGP_spreadValues({ store }, props));
return props;
}
);
var ToolbarItem = createMemoComponent((props) => {
const htmlProps = useToolbarItem(props);
return _3ORBWXWF_createElement("button", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar-context/index.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
const ToolbarContext = (0,external_wp_element_namespaceObject.createContext)(undefined);
/* harmony default export */ const toolbar_context = (ToolbarContext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar-item/index.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function toolbar_item_ToolbarItem({
children,
as: Component,
...props
}, ref) {
const accessibleToolbarStore = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
const isRenderProp = typeof children === 'function';
if (!isRenderProp && !Component) {
true ? external_wp_warning_default()('`ToolbarItem` is a generic headless component. You must pass either a `children` prop as a function or an `as` prop as a component. ' + 'See https://developer.wordpress.org/block-editor/components/toolbar-item/') : 0;
return null;
}
const allProps = {
...props,
ref,
'data-toolbar-item': true
};
if (!accessibleToolbarStore) {
if (Component) {
return (0,external_React_.createElement)(Component, {
...allProps
}, children);
}
if (!isRenderProp) {
return null;
}
return children(allProps);
}
const render = isRenderProp ? children : Component && (0,external_React_.createElement)(Component, null, children);
return (0,external_React_.createElement)(ToolbarItem, {
...allProps,
store: accessibleToolbarStore,
render: render
});
}
/* harmony default export */ const toolbar_item = ((0,external_wp_element_namespaceObject.forwardRef)(toolbar_item_ToolbarItem));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar-button/toolbar-button-container.js
/**
* Internal dependencies
*/
const ToolbarButtonContainer = ({
children,
className
}) => (0,external_React_.createElement)("div", {
className: className
}, children);
/* harmony default export */ const toolbar_button_container = (ToolbarButtonContainer);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar-button/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedToolbarButton({
children,
className,
containerClassName,
extraProps,
isActive,
isDisabled,
title,
...props
}, ref) {
const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
if (!accessibleToolbarState) {
return (0,external_React_.createElement)(toolbar_button_container, {
className: containerClassName
}, (0,external_React_.createElement)(build_module_button, {
ref: ref,
icon: props.icon,
label: title,
shortcut: props.shortcut,
"data-subscript": props.subscript,
onClick: event => {
event.stopPropagation();
// TODO: Possible bug; maybe use onClick instead of props.onClick.
if (props.onClick) {
props.onClick(event);
}
},
className: classnames_default()('components-toolbar__control', className),
isPressed: isActive,
disabled: isDisabled,
"data-toolbar-item": true,
...extraProps,
...props
}, children));
}
// ToobarItem will pass all props to the render prop child, which will pass
// all props to Button. This means that ToolbarButton has the same API as
// Button.
return (0,external_React_.createElement)(toolbar_item, {
className: classnames_default()('components-toolbar-button', className),
...extraProps,
...props,
ref: ref
}, toolbarItemProps => (0,external_React_.createElement)(build_module_button, {
label: title,
isPressed: isActive,
disabled: isDisabled,
...toolbarItemProps
}, children));
}
/**
* ToolbarButton can be used to add actions to a toolbar, usually inside a Toolbar
* or ToolbarGroup when used to create general interfaces.
*
* ```jsx
* import { Toolbar, ToolbarButton } from '@wordpress/components';
* import { edit } from '@wordpress/icons';
*
* function MyToolbar() {
* return (
* <Toolbar label="Options">
* <ToolbarButton
* icon={ edit }
* label="Edit"
* onClick={ () => alert( 'Editing' ) }
* />
* </Toolbar>
* );
* }
* ```
*/
const ToolbarButton = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToolbarButton);
/* harmony default export */ const toolbar_button = (ToolbarButton);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar-group/toolbar-group-container.js
/**
* Internal dependencies
*/
const ToolbarGroupContainer = ({
className,
children,
...props
}) => (0,external_React_.createElement)("div", {
className: className,
...props
}, children);
/* harmony default export */ const toolbar_group_container = (ToolbarGroupContainer);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ToolbarGroupCollapsed({
controls = [],
toggleProps,
...props
}) {
// It'll contain state if `ToolbarGroup` is being used within
// `<Toolbar label="label" />`
const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
const renderDropdownMenu = internalToggleProps => (0,external_React_.createElement)(dropdown_menu, {
controls: controls,
toggleProps: {
...internalToggleProps,
'data-toolbar-item': true
},
...props
});
if (accessibleToolbarState) {
return (0,external_React_.createElement)(toolbar_item, {
...toggleProps
}, renderDropdownMenu);
}
return renderDropdownMenu(toggleProps);
}
/* harmony default export */ const toolbar_group_collapsed = (ToolbarGroupCollapsed);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar-group/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function isNestedArray(arr) {
return Array.isArray(arr) && Array.isArray(arr[0]);
}
/**
* Renders a collapsible group of controls
*
* The `controls` prop accepts an array of sets. A set is an array of controls.
* Controls have the following shape:
*
* ```
* {
* icon: string,
* title: string,
* subscript: string,
* onClick: Function,
* isActive: boolean,
* isDisabled: boolean
* }
* ```
*
* For convenience it is also possible to pass only an array of controls. It is
* then assumed this is the only set.
*
* Either `controls` or `children` is required, otherwise this components
* renders nothing.
*
* @param props Component props.
* @param [props.controls] The controls to render in this toolbar.
* @param [props.children] Any other things to render inside the toolbar besides the controls.
* @param [props.className] Class to set on the container div.
* @param [props.isCollapsed] Turns ToolbarGroup into a dropdown menu.
* @param [props.title] ARIA label for dropdown menu if is collapsed.
*/
function ToolbarGroup({
controls = [],
children,
className,
isCollapsed,
title,
...props
}) {
// It'll contain state if `ToolbarGroup` is being used within
// `<Toolbar label="label" />`
const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
if ((!controls || !controls.length) && !children) {
return null;
}
const finalClassName = classnames_default()(
// Unfortunately, there's legacy code referencing to `.components-toolbar`
// So we can't get rid of it
accessibleToolbarState ? 'components-toolbar-group' : 'components-toolbar', className);
// Normalize controls to nested array of objects (sets of controls)
let controlSets;
if (isNestedArray(controls)) {
controlSets = controls;
} else {
controlSets = [controls];
}
if (isCollapsed) {
return (0,external_React_.createElement)(toolbar_group_collapsed, {
label: title,
controls: controlSets,
className: finalClassName,
children: children,
...props
});
}
return (0,external_React_.createElement)(toolbar_group_container, {
className: finalClassName,
...props
}, controlSets?.flatMap((controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => (0,external_React_.createElement)(toolbar_button, {
key: [indexOfSet, indexOfControl].join(),
containerClassName: indexOfSet > 0 && indexOfControl === 0 ? 'has-left-divider' : undefined,
...control
}))), children);
}
/* harmony default export */ const toolbar_group = (ToolbarGroup);
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/toolbar/toolbar-store.js
"use client";
// src/toolbar/toolbar-store.ts
function createToolbarStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
return createCompositeStore(_chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, props), {
orientation: defaultValue(
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"horizontal"
),
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
}));
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/BPNXFCFY.js
"use client";
// src/toolbar/toolbar-store.ts
function useToolbarStoreProps(store, update, props) {
return useCompositeStoreProps(store, update, props);
}
function useToolbarStore(props = {}) {
const [store, update] = EKQEJRUF_useStore(createToolbarStore, props);
return useToolbarStoreProps(store, update, props);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/toolbar/toolbar.js
"use client";
// src/toolbar/toolbar.tsx
var useToolbar = createHook(
(_a) => {
var _b = _a, {
store: storeProp,
orientation: orientationProp,
virtualFocus,
focusLoop,
rtl
} = _b, props = __objRest(_b, [
"store",
"orientation",
"virtualFocus",
"focusLoop",
"rtl"
]);
const context = useToolbarProviderContext();
storeProp = storeProp || context;
const store = useToolbarStore({
store: storeProp,
orientation: orientationProp,
virtualFocus,
focusLoop,
rtl
});
const orientation = store.useState(
(state) => state.orientation === "both" ? void 0 : state.orientation
);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(ToolbarScopedContextProvider, { value: store, children: element }),
[store]
);
props = _4R3V3JGP_spreadValues({
role: "toolbar",
"aria-orientation": orientation
}, props);
props = useComposite(_4R3V3JGP_spreadValues({ store }, props));
return props;
}
);
var Toolbar = createComponent((props) => {
const htmlProps = useToolbar(props);
return _3ORBWXWF_createElement("div", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar/toolbar-container.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedToolbarContainer({
label,
...props
}, ref) {
const toolbarStore = useToolbarStore({
focusLoop: true,
rtl: (0,external_wp_i18n_namespaceObject.isRTL)()
});
return (
// This will provide state for `ToolbarButton`'s
(0,external_React_.createElement)(toolbar_context.Provider, {
value: toolbarStore
}, (0,external_React_.createElement)(Toolbar, {
ref: ref,
"aria-label": label,
store: toolbarStore,
...props
}))
);
}
const ToolbarContainer = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToolbarContainer);
/* harmony default export */ const toolbar_container = (ToolbarContainer);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedToolbar({
className,
label,
variant,
...props
}, ref) {
const isVariantDefined = variant !== undefined;
const contextSystemValue = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (isVariantDefined) {
return {};
}
return {
DropdownMenu: {
variant: 'toolbar'
},
Dropdown: {
variant: 'toolbar'
}
};
}, [isVariantDefined]);
if (!label) {
external_wp_deprecated_default()('Using Toolbar without label prop', {
since: '5.6',
alternative: 'ToolbarGroup component',
link: 'https://developer.wordpress.org/block-editor/components/toolbar/'
});
// Extracting title from `props` because `ToolbarGroup` doesn't accept it.
const {
title: _title,
...restProps
} = props;
return (0,external_React_.createElement)(toolbar_group, {
isCollapsed: false,
...restProps,
className: className
});
}
// `ToolbarGroup` already uses components-toolbar for compatibility reasons.
const finalClassName = classnames_default()('components-accessible-toolbar', className, variant && `is-${variant}`);
return (0,external_React_.createElement)(ContextSystemProvider, {
value: contextSystemValue
}, (0,external_React_.createElement)(toolbar_container, {
className: finalClassName,
label: label,
ref: ref,
...props
}));
}
/**
* Renders a toolbar.
*
* To add controls, simply pass `ToolbarButton` components as children.
*
* ```jsx
* import { Toolbar, ToolbarButton } from '@wordpress/components';
* import { formatBold, formatItalic, link } from '@wordpress/icons';
*
* function MyToolbar() {
* return (
* <Toolbar label="Options">
* <ToolbarButton icon={ formatBold } label="Bold" />
* <ToolbarButton icon={ formatItalic } label="Italic" />
* <ToolbarButton icon={ link } label="Link" />
* </Toolbar>
* );
* }
* ```
*/
const toolbar_Toolbar = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToolbar);
/* harmony default export */ const toolbar = (toolbar_Toolbar);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar-dropdown-menu/index.js
/**
* WordPress dependencies
*/
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function ToolbarDropdownMenu(props, ref) {
const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
if (!accessibleToolbarState) {
return (0,external_React_.createElement)(dropdown_menu, {
...props
});
}
// ToolbarItem will pass all props to the render prop child, which will pass
// all props to the toggle of DropdownMenu. This means that ToolbarDropdownMenu
// has the same API as DropdownMenu.
return (0,external_React_.createElement)(toolbar_item, {
ref: ref,
...props.toggleProps
}, toolbarItemProps => (0,external_React_.createElement)(dropdown_menu, {
...props,
popoverProps: {
...props.popoverProps
},
toggleProps: toolbarItemProps
}));
}
/* harmony default export */ const toolbar_dropdown_menu = ((0,external_wp_element_namespaceObject.forwardRef)(ToolbarDropdownMenu));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/styles.js
function tools_panel_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const toolsPanelGrid = {
columns: columns => /*#__PURE__*/emotion_react_browser_esm_css("grid-template-columns:", `repeat( ${columns}, minmax(0, 1fr) )`, ";" + ( true ? "" : 0), true ? "" : 0),
spacing: /*#__PURE__*/emotion_react_browser_esm_css("column-gap:", space(2), ";row-gap:", space(4), ";" + ( true ? "" : 0), true ? "" : 0),
item: {
fullWidth: true ? {
name: "18iuzk9",
styles: "grid-column:1/-1"
} : 0
}
};
const ToolsPanel = columns => /*#__PURE__*/emotion_react_browser_esm_css(toolsPanelGrid.columns(columns), " ", toolsPanelGrid.spacing, " border-top:", config_values.borderWidth, " solid ", COLORS.gray[300], ";margin-top:-1px;padding:", space(4), ";" + ( true ? "" : 0), true ? "" : 0);
/**
* Items injected into a ToolsPanel via a virtual bubbling slot will require
* an inner dom element to be injected. The following rule allows for the
* CSS grid display to be re-established.
*/
const ToolsPanelWithInnerWrapper = columns => {
return /*#__PURE__*/emotion_react_browser_esm_css(">div:not( :first-of-type ){display:grid;", toolsPanelGrid.columns(columns), " ", toolsPanelGrid.spacing, " ", toolsPanelGrid.item.fullWidth, ";}" + ( true ? "" : 0), true ? "" : 0);
};
const ToolsPanelHiddenInnerWrapper = true ? {
name: "huufmu",
styles: ">div:not( :first-of-type ){display:none;}"
} : 0;
const ToolsPanelHeader = /*#__PURE__*/emotion_react_browser_esm_css(toolsPanelGrid.item.fullWidth, " gap:", space(2), ";.components-dropdown-menu{margin:", space(-1), " 0;line-height:0;}&&&& .components-dropdown-menu__toggle{padding:0;min-width:", space(6), ";}" + ( true ? "" : 0), true ? "" : 0);
const ToolsPanelHeading = true ? {
name: "1pmxm02",
styles: "font-size:inherit;font-weight:500;line-height:normal;&&{margin:0;}"
} : 0;
const ToolsPanelItem = /*#__PURE__*/emotion_react_browser_esm_css(toolsPanelGrid.item.fullWidth, "&>div,&>fieldset{padding-bottom:0;margin-bottom:0;max-width:100%;}&& ", base_control_styles_Wrapper, "{margin-bottom:0;", StyledField, ":last-child{margin-bottom:0;}}", StyledHelp, "{margin-bottom:0;}&& ", LabelWrapper, "{label{line-height:1.4em;}}" + ( true ? "" : 0), true ? "" : 0);
const ToolsPanelItemPlaceholder = true ? {
name: "eivff4",
styles: "display:none"
} : 0;
const styles_DropdownMenu = true ? {
name: "16gsvie",
styles: "min-width:200px"
} : 0;
const ResetLabel = emotion_styled_base_browser_esm("span", true ? {
target: "ews648u0"
} : 0)("color:", COLORS.theme.accentDarker10, ";font-size:11px;font-weight:500;line-height:1.4;", rtl({
marginLeft: space(3)
}), " text-transform:uppercase;" + ( true ? "" : 0));
const DefaultControlsItem = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.gray[900], ";&&[aria-disabled='true']{color:", COLORS.gray[700], ";opacity:1;&:hover{color:", COLORS.gray[700], ";}", ResetLabel, "{opacity:0.3;}}" + ( true ? "" : 0), true ? "" : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/context.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const tools_panel_context_noop = () => undefined;
const ToolsPanelContext = (0,external_wp_element_namespaceObject.createContext)({
menuItems: {
default: {},
optional: {}
},
hasMenuItems: false,
isResetting: false,
shouldRenderPlaceholderItems: false,
registerPanelItem: tools_panel_context_noop,
deregisterPanelItem: tools_panel_context_noop,
flagItemCustomization: tools_panel_context_noop,
registerResetAllFilter: tools_panel_context_noop,
deregisterResetAllFilter: tools_panel_context_noop,
areAllOptionalControlsHidden: true
});
const useToolsPanelContext = () => (0,external_wp_element_namespaceObject.useContext)(ToolsPanelContext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-header/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useToolsPanelHeader(props) {
const {
className,
headingLevel = 2,
...otherProps
} = useContextSystem(props, 'ToolsPanelHeader');
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(ToolsPanelHeader, className);
}, [className, cx]);
const dropdownMenuClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(styles_DropdownMenu);
}, [cx]);
const headingClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(ToolsPanelHeading);
}, [cx]);
const defaultControlsItemClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
return cx(DefaultControlsItem);
}, [cx]);
const {
menuItems,
hasMenuItems,
areAllOptionalControlsHidden
} = useToolsPanelContext();
return {
...otherProps,
areAllOptionalControlsHidden,
defaultControlsItemClassName,
dropdownMenuClassName,
hasMenuItems,
headingClassName,
headingLevel,
menuItems,
className: classes
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-header/component.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DefaultControlsGroup = ({
itemClassName,
items,
toggleItem
}) => {
if (!items.length) {
return null;
}
const resetSuffix = (0,external_React_.createElement)(ResetLabel, {
"aria-hidden": true
}, (0,external_wp_i18n_namespaceObject.__)('Reset'));
return (0,external_React_.createElement)(external_React_.Fragment, null, items.map(([label, hasValue]) => {
if (hasValue) {
return (0,external_React_.createElement)(menu_item, {
key: label,
className: itemClassName,
role: "menuitem",
label: (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The name of the control being reset e.g. "Padding".
(0,external_wp_i18n_namespaceObject.__)('Reset %s'), label),
onClick: () => {
toggleItem(label);
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The name of the control being reset e.g. "Padding".
(0,external_wp_i18n_namespaceObject.__)('%s reset to default'), label), 'assertive');
},
suffix: resetSuffix
}, label);
}
return (0,external_React_.createElement)(menu_item, {
key: label,
icon: library_check,
className: itemClassName,
role: "menuitemcheckbox",
isSelected: true,
"aria-disabled": true
}, label);
}));
};
const OptionalControlsGroup = ({
items,
toggleItem
}) => {
if (!items.length) {
return null;
}
return (0,external_React_.createElement)(external_React_.Fragment, null, items.map(([label, isSelected]) => {
const itemLabel = isSelected ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The name of the control being hidden and reset e.g. "Padding".
(0,external_wp_i18n_namespaceObject.__)('Hide and reset %s'), label) : (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The name of the control to display e.g. "Padding".
(0,external_wp_i18n_namespaceObject.__)('Show %s'), label);
return (0,external_React_.createElement)(menu_item, {
key: label,
icon: isSelected ? library_check : null,
isSelected: isSelected,
label: itemLabel,
onClick: () => {
if (isSelected) {
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The name of the control being reset e.g. "Padding".
(0,external_wp_i18n_namespaceObject.__)('%s hidden and reset to default'), label), 'assertive');
} else {
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The name of the control being reset e.g. "Padding".
(0,external_wp_i18n_namespaceObject.__)('%s is now visible'), label), 'assertive');
}
toggleItem(label);
},
role: "menuitemcheckbox"
}, label);
}));
};
const component_ToolsPanelHeader = (props, forwardedRef) => {
const {
areAllOptionalControlsHidden,
defaultControlsItemClassName,
dropdownMenuClassName,
hasMenuItems,
headingClassName,
headingLevel = 2,
label: labelText,
menuItems,
resetAll,
toggleItem,
dropdownMenuProps,
...headerProps
} = useToolsPanelHeader(props);
if (!labelText) {
return null;
}
const defaultItems = Object.entries(menuItems?.default || {});
const optionalItems = Object.entries(menuItems?.optional || {});
const dropDownMenuIcon = areAllOptionalControlsHidden ? library_plus : more_vertical;
const dropDownMenuLabelText = (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: The name of the tool e.g. "Color" or "Typography".
(0,external_wp_i18n_namespaceObject._x)('%s options', 'Button label to reveal tool panel options'), labelText);
const dropdownMenuDescriptionText = areAllOptionalControlsHidden ? (0,external_wp_i18n_namespaceObject.__)('All options are currently hidden') : undefined;
const canResetAll = [...defaultItems, ...optionalItems].some(([, isSelected]) => isSelected);
return (0,external_React_.createElement)(h_stack_component, {
...headerProps,
ref: forwardedRef
}, (0,external_React_.createElement)(heading_component, {
level: headingLevel,
className: headingClassName
}, labelText), hasMenuItems && (0,external_React_.createElement)(dropdown_menu, {
...dropdownMenuProps,
icon: dropDownMenuIcon,
label: dropDownMenuLabelText,
menuProps: {
className: dropdownMenuClassName
},
toggleProps: {
isSmall: true,
describedBy: dropdownMenuDescriptionText
}
}, () => (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(menu_group, {
label: labelText
}, (0,external_React_.createElement)(DefaultControlsGroup, {
items: defaultItems,
toggleItem: toggleItem,
itemClassName: defaultControlsItemClassName
}), (0,external_React_.createElement)(OptionalControlsGroup, {
items: optionalItems,
toggleItem: toggleItem
})), (0,external_React_.createElement)(menu_group, null, (0,external_React_.createElement)(menu_item, {
"aria-disabled": !canResetAll
// @ts-expect-error - TODO: If this "tertiary" style is something we really want to allow on MenuItem,
// we should rename it and explicitly allow it as an official API. All the other Button variants
// don't make sense in a MenuItem context, and should be disallowed.
,
variant: 'tertiary',
onClick: () => {
if (canResetAll) {
resetAll();
(0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('All options reset'), 'assertive');
}
}
}, (0,external_wp_i18n_namespaceObject.__)('Reset all'))))));
};
const ConnectedToolsPanelHeader = contextConnect(component_ToolsPanelHeader, 'ToolsPanelHeader');
/* harmony default export */ const tools_panel_header_component = (ConnectedToolsPanelHeader);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DEFAULT_COLUMNS = 2;
const generateMenuItems = ({
panelItems,
shouldReset,
currentMenuItems,
menuItemOrder
}) => {
const newMenuItems = {
default: {},
optional: {}
};
const menuItems = {
default: {},
optional: {}
};
panelItems.forEach(({
hasValue,
isShownByDefault,
label
}) => {
const group = isShownByDefault ? 'default' : 'optional';
// If a menu item for this label has already been flagged as customized
// (for default controls), or toggled on (for optional controls), do not
// overwrite its value as those controls would lose that state.
const existingItemValue = currentMenuItems?.[group]?.[label];
const value = existingItemValue ? existingItemValue : hasValue();
newMenuItems[group][label] = shouldReset ? false : value;
});
// Loop the known, previously registered items first to maintain menu order.
menuItemOrder.forEach(key => {
if (newMenuItems.default.hasOwnProperty(key)) {
menuItems.default[key] = newMenuItems.default[key];
}
if (newMenuItems.optional.hasOwnProperty(key)) {
menuItems.optional[key] = newMenuItems.optional[key];
}
});
// Loop newMenuItems object adding any that aren't in the known items order.
Object.keys(newMenuItems.default).forEach(key => {
if (!menuItems.default.hasOwnProperty(key)) {
menuItems.default[key] = newMenuItems.default[key];
}
});
Object.keys(newMenuItems.optional).forEach(key => {
if (!menuItems.optional.hasOwnProperty(key)) {
menuItems.optional[key] = newMenuItems.optional[key];
}
});
return menuItems;
};
const isMenuItemTypeEmpty = obj => obj && Object.keys(obj).length === 0;
function useToolsPanel(props) {
const {
className,
headingLevel = 2,
resetAll,
panelId,
hasInnerWrapper = false,
shouldRenderPlaceholderItems = false,
__experimentalFirstVisibleItemClass,
__experimentalLastVisibleItemClass,
...otherProps
} = useContextSystem(props, 'ToolsPanel');
const isResetting = (0,external_wp_element_namespaceObject.useRef)(false);
const wasResetting = isResetting.current;
// `isResetting` is cleared via this hook to effectively batch together
// the resetAll task. Without this, the flag is cleared after the first
// control updates and forces a rerender with subsequent controls then
// believing they need to reset, unfortunately using stale data.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (wasResetting) {
isResetting.current = false;
}
}, [wasResetting]);
// Allow panel items to register themselves.
const [panelItems, setPanelItems] = (0,external_wp_element_namespaceObject.useState)([]);
const [menuItemOrder, setMenuItemOrder] = (0,external_wp_element_namespaceObject.useState)([]);
const [resetAllFilters, setResetAllFilters] = (0,external_wp_element_namespaceObject.useState)([]);
const registerPanelItem = (0,external_wp_element_namespaceObject.useCallback)(item => {
// Add item to panel items.
setPanelItems(items => {
const newItems = [...items];
// If an item with this label has already been registered, remove it
// first. This can happen when an item is moved between the default
// and optional groups.
const existingIndex = newItems.findIndex(oldItem => oldItem.label === item.label);
if (existingIndex !== -1) {
newItems.splice(existingIndex, 1);
}
return [...newItems, item];
});
// Track the initial order of item registration. This is used for
// maintaining menu item order later.
setMenuItemOrder(items => {
if (items.includes(item.label)) {
return items;
}
return [...items, item.label];
});
}, [setPanelItems, setMenuItemOrder]);
// Panels need to deregister on unmount to avoid orphans in menu state.
// This is an issue when panel items are being injected via SlotFills.
const deregisterPanelItem = (0,external_wp_element_namespaceObject.useCallback)(label => {
// When switching selections between components injecting matching
// controls, e.g. both panels have a "padding" control, the
// deregistration of the first panel doesn't occur until after the
// registration of the next.
setPanelItems(items => {
const newItems = [...items];
const index = newItems.findIndex(item => item.label === label);
if (index !== -1) {
newItems.splice(index, 1);
}
return newItems;
});
}, [setPanelItems]);
const registerResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(newFilter => {
setResetAllFilters(filters => {
return [...filters, newFilter];
});
}, [setResetAllFilters]);
const deregisterResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(filterToRemove => {
setResetAllFilters(filters => {
return filters.filter(filter => filter !== filterToRemove);
});
}, [setResetAllFilters]);
// Manage and share display state of menu items representing child controls.
const [menuItems, setMenuItems] = (0,external_wp_element_namespaceObject.useState)({
default: {},
optional: {}
});
// Setup menuItems state as panel items register themselves.
(0,external_wp_element_namespaceObject.useEffect)(() => {
setMenuItems(prevState => {
const items = generateMenuItems({
panelItems,
shouldReset: false,
currentMenuItems: prevState,
menuItemOrder
});
return items;
});
}, [panelItems, setMenuItems, menuItemOrder]);
// Force a menu item to be checked.
// This is intended for use with default panel items. They are displayed
// separately to optional items and have different display states,
// we need to update that when their value is customized.
const flagItemCustomization = (0,external_wp_element_namespaceObject.useCallback)((label, group = 'default') => {
setMenuItems(items => {
const newState = {
...items,
[group]: {
...items[group],
[label]: true
}
};
return newState;
});
}, [setMenuItems]);
// Whether all optional menu items are hidden or not must be tracked
// in order to later determine if the panel display is empty and handle
// conditional display of a plus icon to indicate the presence of further
// menu items.
const [areAllOptionalControlsHidden, setAreAllOptionalControlsHidden] = (0,external_wp_element_namespaceObject.useState)(false);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (isMenuItemTypeEmpty(menuItems?.default) && !isMenuItemTypeEmpty(menuItems?.optional)) {
const allControlsHidden = !Object.entries(menuItems.optional).some(([, isSelected]) => isSelected);
setAreAllOptionalControlsHidden(allControlsHidden);
}
}, [menuItems, setAreAllOptionalControlsHidden]);
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
const wrapperStyle = hasInnerWrapper && ToolsPanelWithInnerWrapper(DEFAULT_COLUMNS);
const emptyStyle = isMenuItemTypeEmpty(menuItems?.default) && areAllOptionalControlsHidden && ToolsPanelHiddenInnerWrapper;
return cx(ToolsPanel(DEFAULT_COLUMNS), wrapperStyle, emptyStyle, className);
}, [areAllOptionalControlsHidden, className, cx, hasInnerWrapper, menuItems]);
// Toggle the checked state of a menu item which is then used to determine
// display of the item within the panel.
const toggleItem = (0,external_wp_element_namespaceObject.useCallback)(label => {
const currentItem = panelItems.find(item => item.label === label);
if (!currentItem) {
return;
}
const menuGroup = currentItem.isShownByDefault ? 'default' : 'optional';
const newMenuItems = {
...menuItems,
[menuGroup]: {
...menuItems[menuGroup],
[label]: !menuItems[menuGroup][label]
}
};
setMenuItems(newMenuItems);
}, [menuItems, panelItems, setMenuItems]);
// Resets display of children and executes resetAll callback if available.
const resetAllItems = (0,external_wp_element_namespaceObject.useCallback)(() => {
if (typeof resetAll === 'function') {
isResetting.current = true;
resetAll(resetAllFilters);
}
// Turn off display of all non-default items.
const resetMenuItems = generateMenuItems({
panelItems,
menuItemOrder,
shouldReset: true
});
setMenuItems(resetMenuItems);
}, [panelItems, resetAllFilters, resetAll, setMenuItems, menuItemOrder]);
// Assist ItemGroup styling when there are potentially hidden placeholder
// items by identifying first & last items that are toggled on for display.
const getFirstVisibleItemLabel = items => {
const optionalItems = menuItems.optional || {};
const firstItem = items.find(item => item.isShownByDefault || !!optionalItems[item.label]);
return firstItem?.label;
};
const firstDisplayedItem = getFirstVisibleItemLabel(panelItems);
const lastDisplayedItem = getFirstVisibleItemLabel([...panelItems].reverse());
const panelContext = (0,external_wp_element_namespaceObject.useMemo)(() => ({
areAllOptionalControlsHidden,
deregisterPanelItem,
deregisterResetAllFilter,
firstDisplayedItem,
flagItemCustomization,
hasMenuItems: !!panelItems.length,
isResetting: isResetting.current,
lastDisplayedItem,
menuItems,
panelId,
registerPanelItem,
registerResetAllFilter,
shouldRenderPlaceholderItems,
__experimentalFirstVisibleItemClass,
__experimentalLastVisibleItemClass
}), [areAllOptionalControlsHidden, deregisterPanelItem, deregisterResetAllFilter, firstDisplayedItem, flagItemCustomization, lastDisplayedItem, menuItems, panelId, panelItems, registerResetAllFilter, registerPanelItem, shouldRenderPlaceholderItems, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);
return {
...otherProps,
headingLevel,
panelContext,
resetAllItems,
toggleItem,
className: classes
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const UnconnectedToolsPanel = (props, forwardedRef) => {
const {
children,
label,
panelContext,
resetAllItems,
toggleItem,
headingLevel,
dropdownMenuProps,
...toolsPanelProps
} = useToolsPanel(props);
return (0,external_React_.createElement)(grid_component, {
...toolsPanelProps,
columns: 2,
ref: forwardedRef
}, (0,external_React_.createElement)(ToolsPanelContext.Provider, {
value: panelContext
}, (0,external_React_.createElement)(tools_panel_header_component, {
label: label,
resetAll: resetAllItems,
toggleItem: toggleItem,
headingLevel: headingLevel,
dropdownMenuProps: dropdownMenuProps
}), children));
};
/**
* The `ToolsPanel` is a container component that displays its children preceded
* by a header. The header includes a dropdown menu which is automatically
* generated from the panel's inner `ToolsPanelItems`.
*
* ```jsx
* import { __ } from '@wordpress/i18n';
* import {
* __experimentalToolsPanel as ToolsPanel,
* __experimentalToolsPanelItem as ToolsPanelItem,
* __experimentalUnitControl as UnitControl
* } from '@wordpress/components';
*
* function Example() {
* const [ height, setHeight ] = useState();
* const [ width, setWidth ] = useState();
*
* const resetAll = () => {
* setHeight();
* setWidth();
* }
*
* return (
* <ToolsPanel label={ __( 'Dimensions' ) } resetAll={ resetAll }>
* <ToolsPanelItem
* hasValue={ () => !! height }
* label={ __( 'Height' ) }
* onDeselect={ () => setHeight() }
* >
* <UnitControl
* label={ __( 'Height' ) }
* onChange={ setHeight }
* value={ height }
* />
* </ToolsPanelItem>
* <ToolsPanelItem
* hasValue={ () => !! width }
* label={ __( 'Width' ) }
* onDeselect={ () => setWidth() }
* >
* <UnitControl
* label={ __( 'Width' ) }
* onChange={ setWidth }
* value={ width }
* />
* </ToolsPanelItem>
* </ToolsPanel>
* );
* }
* ```
*/
const component_ToolsPanel = contextConnect(UnconnectedToolsPanel, 'ToolsPanel');
/* harmony default export */ const tools_panel_component = (component_ToolsPanel);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-item/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const hook_noop = () => {};
function useToolsPanelItem(props) {
const {
className,
hasValue,
isShownByDefault = false,
label,
panelId,
resetAllFilter = hook_noop,
onDeselect,
onSelect,
...otherProps
} = useContextSystem(props, 'ToolsPanelItem');
const {
panelId: currentPanelId,
menuItems,
registerResetAllFilter,
deregisterResetAllFilter,
registerPanelItem,
deregisterPanelItem,
flagItemCustomization,
isResetting,
shouldRenderPlaceholderItems: shouldRenderPlaceholder,
firstDisplayedItem,
lastDisplayedItem,
__experimentalFirstVisibleItemClass,
__experimentalLastVisibleItemClass
} = useToolsPanelContext();
// hasValue is a new function on every render, so do not add it as a
// dependency to the useCallback hook! If needed, we should use a ref.
// eslint-disable-next-line react-hooks/exhaustive-deps
const hasValueCallback = (0,external_wp_element_namespaceObject.useCallback)(hasValue, [panelId]);
// resetAllFilter is a new function on every render, so do not add it as a
// dependency to the useCallback hook! If needed, we should use a ref.
// eslint-disable-next-line react-hooks/exhaustive-deps
const resetAllFilterCallback = (0,external_wp_element_namespaceObject.useCallback)(resetAllFilter, [panelId]);
const previousPanelId = (0,external_wp_compose_namespaceObject.usePrevious)(currentPanelId);
const hasMatchingPanel = currentPanelId === panelId || currentPanelId === null;
// Registering the panel item allows the panel to include it in its
// automatically generated menu and determine its initial checked status.
//
// This is performed in a layout effect to ensure that the panel item
// is registered before it is rendered preventing a rendering glitch.
// See: https://github.com/WordPress/gutenberg/issues/56470
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (hasMatchingPanel && previousPanelId !== null) {
registerPanelItem({
hasValue: hasValueCallback,
isShownByDefault,
label,
panelId
});
}
return () => {
if (previousPanelId === null && !!currentPanelId || currentPanelId === panelId) {
deregisterPanelItem(label);
}
};
}, [currentPanelId, hasMatchingPanel, isShownByDefault, label, hasValueCallback, panelId, previousPanelId, registerPanelItem, deregisterPanelItem]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (hasMatchingPanel) {
registerResetAllFilter(resetAllFilterCallback);
}
return () => {
if (hasMatchingPanel) {
deregisterResetAllFilter(resetAllFilterCallback);
}
};
}, [registerResetAllFilter, deregisterResetAllFilter, resetAllFilterCallback, hasMatchingPanel]);
// Note: `label` is used as a key when building menu item state in
// `ToolsPanel`.
const menuGroup = isShownByDefault ? 'default' : 'optional';
const isMenuItemChecked = menuItems?.[menuGroup]?.[label];
const wasMenuItemChecked = (0,external_wp_compose_namespaceObject.usePrevious)(isMenuItemChecked);
const isRegistered = menuItems?.[menuGroup]?.[label] !== undefined;
const isValueSet = hasValue();
const wasValueSet = (0,external_wp_compose_namespaceObject.usePrevious)(isValueSet);
const newValueSet = isValueSet && !wasValueSet;
// Notify the panel when an item's value has been set.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!newValueSet) {
return;
}
flagItemCustomization(label, menuGroup);
}, [newValueSet, menuGroup, label, flagItemCustomization]);
// Determine if the panel item's corresponding menu is being toggled and
// trigger appropriate callback if it is.
(0,external_wp_element_namespaceObject.useEffect)(() => {
// We check whether this item is currently registered as items rendered
// via fills can persist through the parent panel being remounted.
// See: https://github.com/WordPress/gutenberg/pull/45673
if (!isRegistered || isResetting || !hasMatchingPanel) {
return;
}
if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) {
onSelect?.();
}
if (!isMenuItemChecked && wasMenuItemChecked) {
onDeselect?.();
}
}, [hasMatchingPanel, isMenuItemChecked, isRegistered, isResetting, isValueSet, wasMenuItemChecked, onSelect, onDeselect]);
// The item is shown if it is a default control regardless of whether it
// has a value. Optional items are shown when they are checked or have
// a value.
const isShown = isShownByDefault ? menuItems?.[menuGroup]?.[label] !== undefined : isMenuItemChecked;
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
const shouldApplyPlaceholderStyles = shouldRenderPlaceholder && !isShown;
const firstItemStyle = firstDisplayedItem === label && __experimentalFirstVisibleItemClass;
const lastItemStyle = lastDisplayedItem === label && __experimentalLastVisibleItemClass;
return cx(ToolsPanelItem, shouldApplyPlaceholderStyles && ToolsPanelItemPlaceholder, !shouldApplyPlaceholderStyles && className, firstItemStyle, lastItemStyle);
}, [isShown, shouldRenderPlaceholder, className, cx, firstDisplayedItem, lastDisplayedItem, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass, label]);
return {
...otherProps,
isShown,
shouldRenderPlaceholder,
className: classes
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-item/component.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
// This wraps controls to be conditionally displayed within a tools panel. It
// prevents props being applied to HTML elements that would make them invalid.
const UnconnectedToolsPanelItem = (props, forwardedRef) => {
const {
children,
isShown,
shouldRenderPlaceholder,
...toolsPanelItemProps
} = useToolsPanelItem(props);
if (!isShown) {
return shouldRenderPlaceholder ? (0,external_React_.createElement)(component, {
...toolsPanelItemProps,
ref: forwardedRef
}) : null;
}
return (0,external_React_.createElement)(component, {
...toolsPanelItemProps,
ref: forwardedRef
}, children);
};
const component_ToolsPanelItem = contextConnect(UnconnectedToolsPanelItem, 'ToolsPanelItem');
/* harmony default export */ const tools_panel_item_component = (component_ToolsPanelItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index-context.js
/**
* WordPress dependencies
*/
const RovingTabIndexContext = (0,external_wp_element_namespaceObject.createContext)(undefined);
const useRovingTabIndexContext = () => (0,external_wp_element_namespaceObject.useContext)(RovingTabIndexContext);
const RovingTabIndexProvider = RovingTabIndexContext.Provider;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Provider for adding roving tab index behaviors to tree grid structures.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
*/
function RovingTabIndex({
children
}) {
const [lastFocusedElement, setLastFocusedElement] = (0,external_wp_element_namespaceObject.useState)();
// Use `useMemo` to avoid creation of a new object for the providerValue
// on every render. Only create a new object when the `lastFocusedElement`
// value changes.
const providerValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
lastFocusedElement,
setLastFocusedElement
}), [lastFocusedElement]);
return (0,external_React_.createElement)(RovingTabIndexProvider, {
value: providerValue
}, children);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Return focusables in a row element, excluding those from other branches
* nested within the row.
*
* @param rowElement The DOM element representing the row.
*
* @return The array of focusables in the row.
*/
function getRowFocusables(rowElement) {
const focusablesInRow = external_wp_dom_namespaceObject.focus.focusable.find(rowElement, {
sequential: true
});
return focusablesInRow.filter(focusable => {
return focusable.closest('[role="row"]') === rowElement;
});
}
/**
* Renders both a table and tbody element, used to create a tree hierarchy.
*
*/
function UnforwardedTreeGrid({
children,
onExpandRow = () => {},
onCollapseRow = () => {},
onFocusRow = () => {},
applicationAriaLabel,
...props
}, /** A ref to the underlying DOM table element. */
ref) {
const onKeyDown = (0,external_wp_element_namespaceObject.useCallback)(event => {
const {
keyCode,
metaKey,
ctrlKey,
altKey
} = event;
// The shift key is intentionally absent from the following list,
// to enable shift + up/down to select items from the list.
const hasModifierKeyPressed = metaKey || ctrlKey || altKey;
if (hasModifierKeyPressed || ![external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN, external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT, external_wp_keycodes_namespaceObject.HOME, external_wp_keycodes_namespaceObject.END].includes(keyCode)) {
return;
}
// The event will be handled, stop propagation.
event.stopPropagation();
const {
activeElement
} = document;
const {
currentTarget: treeGridElement
} = event;
if (!activeElement || !treeGridElement.contains(activeElement)) {
return;
}
// Calculate the columnIndex of the active element.
const activeRow = activeElement.closest('[role="row"]');
if (!activeRow) {
return;
}
const focusablesInRow = getRowFocusables(activeRow);
const currentColumnIndex = focusablesInRow.indexOf(activeElement);
const canExpandCollapse = 0 === currentColumnIndex;
const cannotFocusNextColumn = canExpandCollapse && (activeRow.getAttribute('data-expanded') === 'false' || activeRow.getAttribute('aria-expanded') === 'false') && keyCode === external_wp_keycodes_namespaceObject.RIGHT;
if ([external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT].includes(keyCode)) {
// Calculate to the next element.
let nextIndex;
if (keyCode === external_wp_keycodes_namespaceObject.LEFT) {
nextIndex = Math.max(0, currentColumnIndex - 1);
} else {
nextIndex = Math.min(currentColumnIndex + 1, focusablesInRow.length - 1);
}
// Focus is at the left most column.
if (canExpandCollapse) {
if (keyCode === external_wp_keycodes_namespaceObject.LEFT) {
var _activeRow$getAttribu;
// Left:
// If a row is focused, and it is expanded, collapses the current row.
if (activeRow.getAttribute('data-expanded') === 'true' || activeRow.getAttribute('aria-expanded') === 'true') {
onCollapseRow(activeRow);
event.preventDefault();
return;
}
// If a row is focused, and it is collapsed, moves to the parent row (if there is one).
const level = Math.max(parseInt((_activeRow$getAttribu = activeRow?.getAttribute('aria-level')) !== null && _activeRow$getAttribu !== void 0 ? _activeRow$getAttribu : '1', 10) - 1, 1);
const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
let parentRow = activeRow;
const currentRowIndex = rows.indexOf(activeRow);
for (let i = currentRowIndex; i >= 0; i--) {
const ariaLevel = rows[i].getAttribute('aria-level');
if (ariaLevel !== null && parseInt(ariaLevel, 10) === level) {
parentRow = rows[i];
break;
}
}
getRowFocusables(parentRow)?.[0]?.focus();
}
if (keyCode === external_wp_keycodes_namespaceObject.RIGHT) {
// Right:
// If a row is focused, and it is collapsed, expands the current row.
if (activeRow.getAttribute('data-expanded') === 'false' || activeRow.getAttribute('aria-expanded') === 'false') {
onExpandRow(activeRow);
event.preventDefault();
return;
}
// If a row is focused, and it is expanded, focuses the next cell in the row.
const focusableItems = getRowFocusables(activeRow);
if (focusableItems.length > 0) {
focusableItems[nextIndex]?.focus();
}
}
// Prevent key use for anything else. For example, Voiceover
// will start reading text on continued use of left/right arrow
// keys.
event.preventDefault();
return;
}
// Focus the next element. If at most left column and row is collapsed, moving right is not allowed as this will expand. However, if row is collapsed, moving left is allowed.
if (cannotFocusNextColumn) {
return;
}
focusablesInRow[nextIndex].focus();
// Prevent key use for anything else. This ensures Voiceover
// doesn't try to handle key navigation.
event.preventDefault();
} else if ([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN].includes(keyCode)) {
// Calculate the rowIndex of the next row.
const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
const currentRowIndex = rows.indexOf(activeRow);
let nextRowIndex;
if (keyCode === external_wp_keycodes_namespaceObject.UP) {
nextRowIndex = Math.max(0, currentRowIndex - 1);
} else {
nextRowIndex = Math.min(currentRowIndex + 1, rows.length - 1);
}
// Focus is either at the top or bottom edge of the grid. Do nothing.
if (nextRowIndex === currentRowIndex) {
// Prevent key use for anything else. For example, Voiceover
// will start navigating horizontally when reaching the vertical
// bounds of a table.
event.preventDefault();
return;
}
// Get the focusables in the next row.
const focusablesInNextRow = getRowFocusables(rows[nextRowIndex]);
// If for some reason there are no focusables in the next row, do nothing.
if (!focusablesInNextRow || !focusablesInNextRow.length) {
// Prevent key use for anything else. For example, Voiceover
// will still focus text when using arrow keys, while this
// component should limit navigation to focusables.
event.preventDefault();
return;
}
// Try to focus the element in the next row that's at a similar column to the activeElement.
const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
focusablesInNextRow[nextIndex].focus();
// Let consumers know the row that was originally focused,
// and the row that is now in focus.
onFocusRow(event, activeRow, rows[nextRowIndex]);
// Prevent key use for anything else. This ensures Voiceover
// doesn't try to handle key navigation.
event.preventDefault();
} else if ([external_wp_keycodes_namespaceObject.HOME, external_wp_keycodes_namespaceObject.END].includes(keyCode)) {
// Calculate the rowIndex of the next row.
const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
const currentRowIndex = rows.indexOf(activeRow);
let nextRowIndex;
if (keyCode === external_wp_keycodes_namespaceObject.HOME) {
nextRowIndex = 0;
} else {
nextRowIndex = rows.length - 1;
}
// Focus is either at the top or bottom edge of the grid. Do nothing.
if (nextRowIndex === currentRowIndex) {
// Prevent key use for anything else. For example, Voiceover
// will start navigating horizontally when reaching the vertical
// bounds of a table.
event.preventDefault();
return;
}
// Get the focusables in the next row.
const focusablesInNextRow = getRowFocusables(rows[nextRowIndex]);
// If for some reason there are no focusables in the next row, do nothing.
if (!focusablesInNextRow || !focusablesInNextRow.length) {
// Prevent key use for anything else. For example, Voiceover
// will still focus text when using arrow keys, while this
// component should limit navigation to focusables.
event.preventDefault();
return;
}
// Try to focus the element in the next row that's at a similar column to the activeElement.
const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
focusablesInNextRow[nextIndex].focus();
// Let consumers know the row that was originally focused,
// and the row that is now in focus.
onFocusRow(event, activeRow, rows[nextRowIndex]);
// Prevent key use for anything else. This ensures Voiceover
// doesn't try to handle key navigation.
event.preventDefault();
}
}, [onExpandRow, onCollapseRow, onFocusRow]);
/* Disable reason: A treegrid is implemented using a table element. */
/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
return (0,external_React_.createElement)(RovingTabIndex, null, (0,external_React_.createElement)("div", {
role: "application",
"aria-label": applicationAriaLabel
}, (0,external_React_.createElement)("table", {
...props,
role: "treegrid",
onKeyDown: onKeyDown,
ref: ref
}, (0,external_React_.createElement)("tbody", null, children))));
/* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */
}
/**
* `TreeGrid` is used to create a tree hierarchy.
* It is not a visually styled component, but instead helps with adding
* keyboard navigation and roving tab index behaviors to tree grid structures.
*
* A tree grid is a hierarchical 2 dimensional UI component, for example it could be
* used to implement a file system browser.
*
* A tree grid allows the user to navigate using arrow keys.
* Up/down to navigate vertically across rows, and left/right to navigate horizontally
* between focusables in a row.
*
* The `TreeGrid` renders both a `table` and `tbody` element, and is intended to be used
* with `TreeGridRow` (`tr`) and `TreeGridCell` (`td`) to build out a grid.
*
* ```jsx
* function TreeMenu() {
* return (
* <TreeGrid>
* <TreeGridRow level={ 1 } positionInSet={ 1 } setSize={ 2 }>
* <TreeGridCell>
* { ( props ) => (
* <Button onClick={ onSelect } { ...props }>Select</Button>
* ) }
* </TreeGridCell>
* <TreeGridCell>
* { ( props ) => (
* <Button onClick={ onMove } { ...props }>Move</Button>
* ) }
* </TreeGridCell>
* </TreeGridRow>
* <TreeGridRow level={ 1 } positionInSet={ 2 } setSize={ 2 }>
* <TreeGridCell>
* { ( props ) => (
* <Button onClick={ onSelect } { ...props }>Select</Button>
* ) }
* </TreeGridCell>
* <TreeGridCell>
* { ( props ) => (
* <Button onClick={ onMove } { ...props }>Move</Button>
* ) }
* </TreeGridCell>
* </TreeGridRow>
* <TreeGridRow level={ 2 } positionInSet={ 1 } setSize={ 1 }>
* <TreeGridCell>
* { ( props ) => (
* <Button onClick={ onSelect } { ...props }>Select</Button>
* ) }
* </TreeGridCell>
* <TreeGridCell>
* { ( props ) => (
* <Button onClick={ onMove } { ...props }>Move</Button>
* ) }
* </TreeGridCell>
* </TreeGridRow>
* </TreeGrid>
* );
* }
* ```
*
* @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
*/
const TreeGrid = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTreeGrid);
/* harmony default export */ const tree_grid = (TreeGrid);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/row.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedTreeGridRow({
children,
level,
positionInSet,
setSize,
isExpanded,
...props
}, ref) {
return (0,external_React_.createElement)("tr", {
...props,
ref: ref,
role: "row",
"aria-level": level,
"aria-posinset": positionInSet,
"aria-setsize": setSize,
"aria-expanded": isExpanded
}, children);
}
/**
* `TreeGridRow` is used to create a tree hierarchy.
* It is not a visually styled component, but instead helps with adding
* keyboard navigation and roving tab index behaviors to tree grid structures.
*
* @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
*/
const TreeGridRow = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTreeGridRow);
/* harmony default export */ const tree_grid_row = (TreeGridRow);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index-item.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const RovingTabIndexItem = (0,external_wp_element_namespaceObject.forwardRef)(function UnforwardedRovingTabIndexItem({
children,
as: Component,
...props
}, forwardedRef) {
const localRef = (0,external_wp_element_namespaceObject.useRef)();
const ref = forwardedRef || localRef;
// @ts-expect-error - We actually want to throw an error if this is undefined.
const {
lastFocusedElement,
setLastFocusedElement
} = useRovingTabIndexContext();
let tabIndex;
if (lastFocusedElement) {
tabIndex = lastFocusedElement === (
// TODO: The original implementation simply used `ref.current` here, assuming
// that a forwarded ref would always be an object, which is not necessarily true.
// This workaround maintains the original runtime behavior in a type-safe way,
// but should be revisited.
'current' in ref ? ref.current : undefined) ? 0 : -1;
}
const onFocus = event => setLastFocusedElement?.(event.target);
const allProps = {
ref,
tabIndex,
onFocus,
...props
};
if (typeof children === 'function') {
return children(allProps);
}
if (!Component) return null;
return (0,external_React_.createElement)(Component, {
...allProps
}, children);
});
/* harmony default export */ const roving_tab_index_item = (RovingTabIndexItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/item.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedTreeGridItem({
children,
...props
}, ref) {
return (0,external_React_.createElement)(roving_tab_index_item, {
ref: ref,
...props
}, children);
}
/**
* `TreeGridItem` is used to create a tree hierarchy.
* It is not a visually styled component, but instead helps with adding
* keyboard navigation and roving tab index behaviors to tree grid structures.
*
* @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
*/
const TreeGridItem = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTreeGridItem);
/* harmony default export */ const tree_grid_item = (TreeGridItem);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/cell.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedTreeGridCell({
children,
withoutGridItem = false,
...props
}, ref) {
return (0,external_React_.createElement)("td", {
...props,
role: "gridcell"
}, withoutGridItem ? (0,external_React_.createElement)(external_React_.Fragment, null, children) : (0,external_React_.createElement)(tree_grid_item, {
ref: ref
}, children));
}
/**
* `TreeGridCell` is used to create a tree hierarchy.
* It is not a visually styled component, but instead helps with adding
* keyboard navigation and roving tab index behaviors to tree grid structures.
*
* @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
*/
const TreeGridCell = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTreeGridCell);
/* harmony default export */ const cell = (TreeGridCell);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/isolated-event-container/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function stopPropagation(event) {
event.stopPropagation();
}
const IsolatedEventContainer = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
external_wp_deprecated_default()('wp.components.IsolatedEventContainer', {
since: '5.7'
});
// Disable reason: this stops certain events from propagating outside of the component.
// - onMouseDown is disabled as this can cause interactions with other DOM elements.
/* eslint-disable jsx-a11y/no-static-element-interactions */
return (0,external_React_.createElement)("div", {
...props,
ref: ref,
onMouseDown: stopPropagation
});
/* eslint-enable jsx-a11y/no-static-element-interactions */
});
/* harmony default export */ const isolated_event_container = (IsolatedEventContainer);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot-fills.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useSlotFills(name) {
const registry = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context);
const fills = useSnapshot(registry.fills, {
sync: true
});
// The important bit here is that this call ensures that the hook
// only causes a re-render if the "fills" of a given slot name
// change, not any fills.
return fills.get(name);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/z-stack/styles.js
function z_stack_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
const ZStackChildView = emotion_styled_base_browser_esm("div", true ? {
target: "ebn2ljm1"
} : 0)("&:not( :first-of-type ){", ({
offsetAmount
}) => /*#__PURE__*/emotion_react_browser_esm_css({
marginInlineStart: offsetAmount
}, true ? "" : 0, true ? "" : 0), ";}", ({
zIndex
}) => /*#__PURE__*/emotion_react_browser_esm_css({
zIndex
}, true ? "" : 0, true ? "" : 0), ";" + ( true ? "" : 0));
var z_stack_styles_ref = true ? {
name: "rs0gp6",
styles: "grid-row-start:1;grid-column-start:1"
} : 0;
const ZStackView = emotion_styled_base_browser_esm("div", true ? {
target: "ebn2ljm0"
} : 0)("display:inline-grid;grid-auto-flow:column;position:relative;&>", ZStackChildView, "{position:relative;justify-self:start;", ({
isLayered
}) => isLayered ? // When `isLayered` is true, all items overlap in the same grid cell
z_stack_styles_ref : undefined, ";}" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/z-stack/component.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedZStack(props, forwardedRef) {
const {
children,
className,
isLayered = true,
isReversed = false,
offset = 0,
...otherProps
} = useContextSystem(props, 'ZStack');
const validChildren = getValidChildren(children);
const childrenLastIndex = validChildren.length - 1;
const clonedChildren = validChildren.map((child, index) => {
const zIndex = isReversed ? childrenLastIndex - index : index;
// Only when the component is layered, the offset needs to be multiplied by
// the item's index, so that items can correctly stack at the right distance
const offsetAmount = isLayered ? offset * index : offset;
const key = (0,external_wp_element_namespaceObject.isValidElement)(child) ? child.key : index;
return (0,external_React_.createElement)(ZStackChildView, {
offsetAmount: offsetAmount,
zIndex: zIndex,
key: key
}, child);
});
return (0,external_React_.createElement)(ZStackView, {
...otherProps,
className: className,
isLayered: isLayered,
ref: forwardedRef
}, clonedChildren);
}
/**
* `ZStack` allows you to stack things along the Z-axis.
*
* ```jsx
* import { __experimentalZStack as ZStack } from '@wordpress/components';
*
* function Example() {
* return (
* <ZStack offset={ 20 } isLayered>
* <ExampleImage />
* <ExampleImage />
* <ExampleImage />
* </ZStack>
* );
* }
* ```
*/
const ZStack = contextConnect(UnconnectedZStack, 'ZStack');
/* harmony default export */ const z_stack_component = (ZStack);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/navigate-regions/index.js
/**
* WordPress dependencies
*/
const defaultShortcuts = {
previous: [{
modifier: 'ctrlShift',
character: '`'
}, {
modifier: 'ctrlShift',
character: '~'
}, {
modifier: 'access',
character: 'p'
}],
next: [{
modifier: 'ctrl',
character: '`'
}, {
modifier: 'access',
character: 'n'
}]
};
function useNavigateRegions(shortcuts = defaultShortcuts) {
const ref = (0,external_wp_element_namespaceObject.useRef)(null);
const [isFocusingRegions, setIsFocusingRegions] = (0,external_wp_element_namespaceObject.useState)(false);
function focusRegion(offset) {
var _ref$current$querySel;
const regions = Array.from((_ref$current$querySel = ref.current?.querySelectorAll('[role="region"][tabindex="-1"]')) !== null && _ref$current$querySel !== void 0 ? _ref$current$querySel : []);
if (!regions.length) {
return;
}
let nextRegion = regions[0];
// Based off the current element, use closest to determine the wrapping region since this operates up the DOM. Also, match tabindex to avoid edge cases with regions we do not want.
const wrappingRegion = ref.current?.ownerDocument?.activeElement?.closest('[role="region"][tabindex="-1"]');
const selectedIndex = wrappingRegion ? regions.indexOf(wrappingRegion) : -1;
if (selectedIndex !== -1) {
let nextIndex = selectedIndex + offset;
nextIndex = nextIndex === -1 ? regions.length - 1 : nextIndex;
nextIndex = nextIndex === regions.length ? 0 : nextIndex;
nextRegion = regions[nextIndex];
}
nextRegion.focus();
setIsFocusingRegions(true);
}
const clickRef = (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
function onClick() {
setIsFocusingRegions(false);
}
element.addEventListener('click', onClick);
return () => {
element.removeEventListener('click', onClick);
};
}, [setIsFocusingRegions]);
return {
ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, clickRef]),
className: isFocusingRegions ? 'is-focusing-regions' : '',
onKeyDown(event) {
if (shortcuts.previous.some(({
modifier,
character
}) => {
return external_wp_keycodes_namespaceObject.isKeyboardEvent[modifier](event, character);
})) {
focusRegion(-1);
} else if (shortcuts.next.some(({
modifier,
character
}) => {
return external_wp_keycodes_namespaceObject.isKeyboardEvent[modifier](event, character);
})) {
focusRegion(1);
}
}
};
}
/**
* `navigateRegions` is a React [higher-order component](https://facebook.github.io/react/docs/higher-order-components.html)
* adding keyboard navigation to switch between the different DOM elements marked as "regions" (role="region").
* These regions should be focusable (By adding a tabIndex attribute for example). For better accessibility,
* these elements must be properly labelled to briefly describe the purpose of the content in the region.
* For more details, see "Landmark Roles" in the [WAI-ARIA specification](https://www.w3.org/TR/wai-aria/)
* and "Landmark Regions" in the [ARIA Authoring Practices Guide](https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/).
*
* ```jsx
* import { navigateRegions } from '@wordpress/components';
*
* const MyComponentWithNavigateRegions = navigateRegions( () => (
* <div>
* <div role="region" tabIndex="-1" aria-label="Header">
* Header
* </div>
* <div role="region" tabIndex="-1" aria-label="Content">
* Content
* </div>
* <div role="region" tabIndex="-1" aria-label="Sidebar">
* Sidebar
* </div>
* </div>
* ) );
* ```
*/
/* harmony default export */ const navigate_regions = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(Component => ({
shortcuts,
...props
}) => (0,external_React_.createElement)("div", {
...useNavigateRegions(shortcuts)
}, (0,external_React_.createElement)(Component, {
...props
})), 'navigateRegions'));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-constrained-tabbing/index.js
/**
* WordPress dependencies
*/
/**
* `withConstrainedTabbing` is a React [higher-order component](https://facebook.github.io/react/docs/higher-order-components.html)
* adding the ability to constrain keyboard navigation with the Tab key within a component.
* For accessibility reasons, some UI components need to constrain Tab navigation, for example
* modal dialogs or similar UI. Use of this component is recommended only in cases where a way to
* navigate away from the wrapped component is implemented by other means, usually by pressing
* the Escape key or using a specific UI control, e.g. a "Close" button.
*/
const withConstrainedTabbing = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => function ComponentWithConstrainedTabbing(props) {
const ref = (0,external_wp_compose_namespaceObject.useConstrainedTabbing)();
return (0,external_React_.createElement)("div", {
ref: ref,
tabIndex: -1
}, (0,external_React_.createElement)(WrappedComponent, {
...props
}));
}, 'withConstrainedTabbing');
/* harmony default export */ const with_constrained_tabbing = (withConstrainedTabbing);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-fallback-styles/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/* harmony default export */ const with_fallback_styles = (mapNodeToProps => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => {
return class extends external_wp_element_namespaceObject.Component {
constructor(props) {
super(props);
this.nodeRef = this.props.node;
this.state = {
fallbackStyles: undefined,
grabStylesCompleted: false
};
this.bindRef = this.bindRef.bind(this);
}
bindRef(node) {
if (!node) {
return;
}
this.nodeRef = node;
}
componentDidMount() {
this.grabFallbackStyles();
}
componentDidUpdate() {
this.grabFallbackStyles();
}
grabFallbackStyles() {
const {
grabStylesCompleted,
fallbackStyles
} = this.state;
if (this.nodeRef && !grabStylesCompleted) {
const newFallbackStyles = mapNodeToProps(this.nodeRef, this.props);
if (!es6_default()(newFallbackStyles, fallbackStyles)) {
this.setState({
fallbackStyles: newFallbackStyles,
grabStylesCompleted: Object.values(newFallbackStyles).every(Boolean)
});
}
}
}
render() {
const wrappedComponent = (0,external_React_.createElement)(WrappedComponent, {
...this.props,
...this.state.fallbackStyles
});
return this.props.node ? wrappedComponent : (0,external_React_.createElement)("div", {
ref: this.bindRef
}, " ", wrappedComponent, " ");
}
};
}, 'withFallbackStyles'));
;// CONCATENATED MODULE: external ["wp","hooks"]
const external_wp_hooks_namespaceObject = window["wp"]["hooks"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-filters/index.js
/**
* WordPress dependencies
*/
const ANIMATION_FRAME_PERIOD = 16;
/**
* Creates a higher-order component which adds filtering capability to the
* wrapped component. Filters get applied when the original component is about
* to be mounted. When a filter is added or removed that matches the hook name,
* the wrapped component re-renders.
*
* @param hookName Hook name exposed to be used by filters.
*
* @return Higher-order component factory.
*
* ```jsx
* import { withFilters } from '@wordpress/components';
* import { addFilter } from '@wordpress/hooks';
*
* const MyComponent = ( { title } ) => <h1>{ title }</h1>;
*
* const ComponentToAppend = () => <div>Appended component</div>;
*
* function withComponentAppended( FilteredComponent ) {
* return ( props ) => (
* <>
* <FilteredComponent { ...props } />
* <ComponentToAppend />
* </>
* );
* }
*
* addFilter(
* 'MyHookName',
* 'my-plugin/with-component-appended',
* withComponentAppended
* );
*
* const MyComponentWithFilters = withFilters( 'MyHookName' )( MyComponent );
* ```
*/
function withFilters(hookName) {
return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => {
const namespace = 'core/with-filters/' + hookName;
/**
* The component definition with current filters applied. Each instance
* reuse this shared reference as an optimization to avoid excessive
* calls to `applyFilters` when many instances exist.
*/
let FilteredComponent;
/**
* Initializes the FilteredComponent variable once, if not already
* assigned. Subsequent calls are effectively a noop.
*/
function ensureFilteredComponent() {
if (FilteredComponent === undefined) {
FilteredComponent = (0,external_wp_hooks_namespaceObject.applyFilters)(hookName, OriginalComponent);
}
}
class FilteredComponentRenderer extends external_wp_element_namespaceObject.Component {
constructor(props) {
super(props);
ensureFilteredComponent();
}
componentDidMount() {
FilteredComponentRenderer.instances.push(this);
// If there were previously no mounted instances for components
// filtered on this hook, add the hook handler.
if (FilteredComponentRenderer.instances.length === 1) {
(0,external_wp_hooks_namespaceObject.addAction)('hookRemoved', namespace, onHooksUpdated);
(0,external_wp_hooks_namespaceObject.addAction)('hookAdded', namespace, onHooksUpdated);
}
}
componentWillUnmount() {
FilteredComponentRenderer.instances = FilteredComponentRenderer.instances.filter(instance => instance !== this);
// If this was the last of the mounted components filtered on
// this hook, remove the hook handler.
if (FilteredComponentRenderer.instances.length === 0) {
(0,external_wp_hooks_namespaceObject.removeAction)('hookRemoved', namespace);
(0,external_wp_hooks_namespaceObject.removeAction)('hookAdded', namespace);
}
}
render() {
return (0,external_React_.createElement)(FilteredComponent, {
...this.props
});
}
}
FilteredComponentRenderer.instances = [];
/**
* Updates the FilteredComponent definition, forcing a render for each
* mounted instance. This occurs a maximum of once per animation frame.
*/
const throttledForceUpdate = (0,external_wp_compose_namespaceObject.debounce)(() => {
// Recreate the filtered component, only after delay so that it's
// computed once, even if many filters added.
FilteredComponent = (0,external_wp_hooks_namespaceObject.applyFilters)(hookName, OriginalComponent);
// Force each instance to render.
FilteredComponentRenderer.instances.forEach(instance => {
instance.forceUpdate();
});
}, ANIMATION_FRAME_PERIOD);
/**
* When a filter is added or removed for the matching hook name, each
* mounted instance should re-render with the new filters having been
* applied to the original component.
*
* @param updatedHookName Name of the hook that was updated.
*/
function onHooksUpdated(updatedHookName) {
if (updatedHookName === hookName) {
throttledForceUpdate();
}
}
return FilteredComponentRenderer;
}, 'withFilters');
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-return/index.js
/**
* WordPress dependencies
*/
/**
* Returns true if the given object is component-like. An object is component-
* like if it is an instance of wp.element.Component, or is a function.
*
* @param object Object to test.
*
* @return Whether object is component-like.
*/
function isComponentLike(object) {
return object instanceof external_wp_element_namespaceObject.Component || typeof object === 'function';
}
/**
* Higher Order Component used to be used to wrap disposable elements like
* sidebars, modals, dropdowns. When mounting the wrapped component, we track a
* reference to the current active element so we know where to restore focus
* when the component is unmounted.
*
* @param options The component to be enhanced with
* focus return behavior, or an object
* describing the component and the
* focus return characteristics.
*
* @return Higher Order Component with the focus restauration behaviour.
*/
/* harmony default export */ const with_focus_return = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(
// @ts-expect-error TODO: Reconcile with intended `createHigherOrderComponent` types
options => {
const HoC = ({
onFocusReturn
} = {}) => WrappedComponent => {
const WithFocusReturn = props => {
const ref = (0,external_wp_compose_namespaceObject.useFocusReturn)(onFocusReturn);
return (0,external_React_.createElement)("div", {
ref: ref
}, (0,external_React_.createElement)(WrappedComponent, {
...props
}));
};
return WithFocusReturn;
};
if (isComponentLike(options)) {
const WrappedComponent = options;
return HoC()(WrappedComponent);
}
return HoC(options);
}, 'withFocusReturn'));
const with_focus_return_Provider = ({
children
}) => {
external_wp_deprecated_default()('wp.components.FocusReturnProvider component', {
since: '5.7',
hint: 'This provider is not used anymore. You can just remove it from your codebase'
});
return children;
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-notices/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Override the default edit UI to include notices if supported.
*
* Wrapping the original component with `withNotices` encapsulates the component
* with the additional props `noticeOperations` and `noticeUI`.
*
* ```jsx
* import { withNotices, Button } from '@wordpress/components';
*
* const MyComponentWithNotices = withNotices(
* ( { noticeOperations, noticeUI } ) => {
* const addError = () =>
* noticeOperations.createErrorNotice( 'Error message' );
* return (
* <div>
* { noticeUI }
* <Button variant="secondary" onClick={ addError }>
* Add error
* </Button>
* </div>
* );
* }
* );
* ```
*
* @param OriginalComponent Original component.
*
* @return Wrapped component.
*/
/* harmony default export */ const with_notices = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => {
function Component(props, ref) {
const [noticeList, setNoticeList] = (0,external_wp_element_namespaceObject.useState)([]);
const noticeOperations = (0,external_wp_element_namespaceObject.useMemo)(() => {
const createNotice = notice => {
const noticeToAdd = notice.id ? notice : {
...notice,
id: esm_browser_v4()
};
setNoticeList(current => [...current, noticeToAdd]);
};
return {
createNotice,
createErrorNotice: msg => {
// @ts-expect-error TODO: Missing `id`, potentially a bug
createNotice({
status: 'error',
content: msg
});
},
removeNotice: id => {
setNoticeList(current => current.filter(notice => notice.id !== id));
},
removeAllNotices: () => {
setNoticeList([]);
}
};
}, []);
const propsOut = {
...props,
noticeList,
noticeOperations,
noticeUI: noticeList.length > 0 && (0,external_React_.createElement)(list, {
className: "components-with-notices-ui",
notices: noticeList,
onRemove: noticeOperations.removeNotice
})
};
return isForwardRef ? (0,external_React_.createElement)(OriginalComponent, {
...propsOut,
ref: ref
}) : (0,external_React_.createElement)(OriginalComponent, {
...propsOut
});
}
let isForwardRef;
// @ts-expect-error - `render` will only be present when OriginalComponent was wrapped with forwardRef().
const {
render
} = OriginalComponent;
// Returns a forwardRef if OriginalComponent appears to be a forwardRef.
if (typeof render === 'function') {
isForwardRef = true;
return (0,external_wp_element_namespaceObject.forwardRef)(Component);
}
return Component;
}, 'withNotices'));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/progress-bar/styles.js
function progress_bar_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const animateProgressBar = emotion_react_browser_esm_keyframes({
'0%': {
left: '-50%'
},
'100%': {
left: '100%'
}
});
// Width of the indicator for the indeterminate progress bar
const INDETERMINATE_TRACK_WIDTH = 50;
const styles_Track = emotion_styled_base_browser_esm("div", true ? {
target: "e15u147w2"
} : 0)("position:relative;overflow:hidden;width:100%;max-width:160px;height:", config_values.borderWidthFocus, ";background-color:color-mix(\n\t\tin srgb,\n\t\tvar( --wp-components-color-foreground, ", COLORS.gray[900], " ),\n\t\ttransparent 90%\n\t);border-radius:", config_values.radiusBlockUi, ";outline:2px solid transparent;outline-offset:2px;" + ( true ? "" : 0));
const Indicator = emotion_styled_base_browser_esm("div", true ? {
target: "e15u147w1"
} : 0)("display:inline-block;position:absolute;top:0;height:100%;border-radius:", config_values.radiusBlockUi, ";background-color:color-mix(\n\t\tin srgb,\n\t\tvar( --wp-components-color-foreground, ", COLORS.gray[900], " ),\n\t\ttransparent 10%\n\t);outline:2px solid transparent;outline-offset:-2px;", ({
isIndeterminate,
value
}) => isIndeterminate ? /*#__PURE__*/emotion_react_browser_esm_css({
animationDuration: '1.5s',
animationTimingFunction: 'ease-in-out',
animationIterationCount: 'infinite',
animationName: animateProgressBar,
width: `${INDETERMINATE_TRACK_WIDTH}%`
}, true ? "" : 0, true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css({
width: `${value}%`,
transition: 'width 0.4s ease-in-out'
}, true ? "" : 0, true ? "" : 0), ";" + ( true ? "" : 0));
const ProgressElement = emotion_styled_base_browser_esm("progress", true ? {
target: "e15u147w0"
} : 0)( true ? {
name: "11fb690",
styles: "position:absolute;top:0;left:0;opacity:0;width:100%;height:100%"
} : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/progress-bar/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedProgressBar(props, ref) {
const {
className,
value,
...progressProps
} = props;
const isIndeterminate = !Number.isFinite(value);
return (0,external_React_.createElement)(styles_Track, {
className: className
}, (0,external_React_.createElement)(Indicator, {
isIndeterminate: isIndeterminate,
value: value
}), (0,external_React_.createElement)(ProgressElement, {
max: 100,
value: value,
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Loading …'),
ref: ref,
...progressProps
}));
}
const ProgressBar = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedProgressBar);
/* harmony default export */ const progress_bar = (ProgressBar);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/YGMEBI3A.js
"use client";
// src/menu/menu-context.ts
var YGMEBI3A_menu = createStoreContext(
[CompositeContextProvider, HovercardContextProvider],
[CompositeScopedContextProvider, HovercardScopedContextProvider]
);
var useMenuContext = YGMEBI3A_menu.useContext;
var useMenuScopedContext = YGMEBI3A_menu.useScopedContext;
var useMenuProviderContext = YGMEBI3A_menu.useProviderContext;
var MenuContextProvider = YGMEBI3A_menu.ContextProvider;
var MenuScopedContextProvider = YGMEBI3A_menu.ScopedContextProvider;
var useMenuBarContext = (/* unused pure expression or super */ null && (useMenubarContext));
var useMenuBarScopedContext = (/* unused pure expression or super */ null && (useMenubarScopedContext));
var useMenuBarProviderContext = (/* unused pure expression or super */ null && (useMenubarProviderContext));
var MenuBarContextProvider = (/* unused pure expression or super */ null && (MenubarContextProvider));
var MenuBarScopedContextProvider = (/* unused pure expression or super */ null && (MenubarScopedContextProvider));
var MenuItemCheckedContext = (0,external_React_.createContext)(
void 0
);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/6XBVQI3K.js
"use client";
// src/checkbox/checkbox-checked-context.ts
var CheckboxCheckedContext = (0,external_React_.createContext)(false);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/MW2F7SEA.js
"use client";
// src/checkbox/checkbox-check.tsx
var checkmark = /* @__PURE__ */ (0,jsx_runtime.jsx)(
"svg",
{
display: "block",
fill: "none",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.5pt",
viewBox: "0 0 16 16",
height: "1em",
width: "1em",
children: /* @__PURE__ */ (0,jsx_runtime.jsx)("polyline", { points: "4,8 7,12 12,4" })
}
);
function getChildren(props) {
if (props.checked) {
return props.children || checkmark;
}
if (typeof props.children === "function") {
return props.children;
}
return null;
}
var useCheckboxCheck = createHook(
(_a) => {
var _b = _a, { store, checked } = _b, props = __objRest(_b, ["store", "checked"]);
const context = (0,external_React_.useContext)(CheckboxCheckedContext);
checked = checked != null ? checked : context;
const children = getChildren({ checked, children: props.children });
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
"aria-hidden": true
}, props), {
children,
style: _4R3V3JGP_spreadValues({
width: "1em",
height: "1em",
pointerEvents: "none"
}, props.style)
});
return props;
}
);
var CheckboxCheck = createComponent((props) => {
const htmlProps = useCheckboxCheck(props);
return _3ORBWXWF_createElement("span", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/menu/menu-item-check.js
"use client";
// src/menu/menu-item-check.ts
var useMenuItemCheck = createHook(
(_a) => {
var _b = _a, { store, checked } = _b, props = __objRest(_b, ["store", "checked"]);
const context = (0,external_React_.useContext)(MenuItemCheckedContext);
checked = checked != null ? checked : context;
props = useCheckboxCheck(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { checked }));
return props;
}
);
var MenuItemCheck = createComponent((props) => {
const htmlProps = useMenuItemCheck(props);
return _3ORBWXWF_createElement("span", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/KA4GX64Z.js
"use client";
// src/menubar/menubar-context.ts
var menubar = createStoreContext(
[CompositeContextProvider],
[CompositeScopedContextProvider]
);
var KA4GX64Z_useMenubarContext = menubar.useContext;
var KA4GX64Z_useMenubarScopedContext = menubar.useScopedContext;
var KA4GX64Z_useMenubarProviderContext = menubar.useProviderContext;
var KA4GX64Z_MenubarContextProvider = menubar.ContextProvider;
var KA4GX64Z_MenubarScopedContextProvider = menubar.ScopedContextProvider;
var KA4GX64Z_MenuItemCheckedContext = (0,external_React_.createContext)(
void 0
);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/W76OTZCC.js
"use client";
// src/combobox/combobox-context.tsx
var W76OTZCC_ctx = createStoreContext(
[PopoverContextProvider, CompositeContextProvider],
[PopoverScopedContextProvider, CompositeScopedContextProvider]
);
var useComboboxContext = W76OTZCC_ctx.useContext;
var useComboboxScopedContext = W76OTZCC_ctx.useScopedContext;
var useComboboxProviderContext = W76OTZCC_ctx.useProviderContext;
var ComboboxContextProvider = W76OTZCC_ctx.ContextProvider;
var ComboboxScopedContextProvider = W76OTZCC_ctx.ScopedContextProvider;
var ComboboxItemValueContext = (0,external_React_.createContext)(
void 0
);
var ComboboxItemCheckedContext = (0,external_React_.createContext)(false);
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/menu/menu-store.js
"use client";
// src/menu/menu-store.ts
function createMenuStore(_a = {}) {
var _b = _a, {
combobox,
parent,
menubar
} = _b, props = _4R3V3JGP_objRest(_b, [
"combobox",
"parent",
"menubar"
]);
const parentIsMenubar = !!menubar && !parent;
const store = mergeStore(
props.store,
pick2(parent, ["values"]),
omit2(combobox, [
"arrowElement",
"anchorElement",
"contentElement",
"popoverElement",
"disclosureElement"
])
);
throwOnConflictingProps(props, store);
const syncState = store.getState();
const composite = createCompositeStore(_chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, props), {
store,
orientation: defaultValue(
props.orientation,
syncState.orientation,
"vertical"
)
}));
const hovercard = createHovercardStore(_chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, props), {
store,
placement: defaultValue(
props.placement,
syncState.placement,
"bottom-start"
),
timeout: defaultValue(
props.timeout,
syncState.timeout,
parentIsMenubar ? 0 : 150
),
hideTimeout: defaultValue(props.hideTimeout, syncState.hideTimeout, 0)
}));
const initialState = _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues(_chunks_4R3V3JGP_spreadValues({}, composite.getState()), hovercard.getState()), {
initialFocus: defaultValue(syncState.initialFocus, "container"),
values: defaultValue(
props.values,
syncState.values,
props.defaultValues,
{}
)
});
const menu = createStore(initialState, composite, hovercard, store);
setup(
menu,
() => sync(menu, ["mounted"], (state) => {
if (state.mounted)
return;
menu.setState("activeId", null);
})
);
setup(
menu,
() => sync(parent, ["orientation"], (state) => {
menu.setState(
"placement",
state.orientation === "vertical" ? "right-start" : "bottom-start"
);
})
);
return _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues(_chunks_4R3V3JGP_spreadValues(_chunks_4R3V3JGP_spreadValues({}, composite), hovercard), menu), {
combobox,
parent,
menubar,
hideAll: () => {
hovercard.hide();
parent == null ? void 0 : parent.hideAll();
},
setInitialFocus: (value) => menu.setState("initialFocus", value),
setValues: (values) => menu.setState("values", values),
setValue: (name, value) => {
if (name === "__proto__")
return;
if (name === "constructor")
return;
if (Array.isArray(name))
return;
menu.setState("values", (values) => {
const prevValue = values[name];
const nextValue = Y3OOHFCN_applyState(value, prevValue);
if (nextValue === prevValue)
return values;
return _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, values), {
[name]: nextValue !== void 0 && nextValue
});
});
}
});
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/XJXP7ZSQ.js
"use client";
// src/menu/menu-store.ts
function useMenuStoreProps(store, update, props) {
useUpdateEffect(update, [props.combobox, props.parent, props.menubar]);
store = useCompositeStoreProps(store, update, props);
store = useHovercardStoreProps(store, update, props);
useStoreProps(store, props, "values", "setValues");
return Object.assign(store, {
combobox: props.combobox,
parent: props.parent,
menubar: props.menubar
});
}
function useMenuStore(props = {}) {
const parent = useMenuContext();
const menubar = KA4GX64Z_useMenubarContext();
const combobox = useComboboxProviderContext();
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
parent: props.parent !== void 0 ? props.parent : parent,
menubar: props.menubar !== void 0 ? props.menubar : menubar,
combobox: props.combobox !== void 0 ? props.combobox : combobox
});
const [store, update] = EKQEJRUF_useStore(createMenuStore, props);
return useMenuStoreProps(store, update, props);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/VDNZBO4W.js
"use client";
// src/button/button.ts
var useButton = createHook((props) => {
const ref = (0,external_React_.useRef)(null);
const tagName = useTagName(ref, props.as || "button");
const [isNativeButton, setIsNativeButton] = (0,external_React_.useState)(
() => !!tagName && isButton({ tagName, type: props.type })
);
(0,external_React_.useEffect)(() => {
if (!ref.current)
return;
setIsNativeButton(isButton(ref.current));
}, []);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
role: !isNativeButton && tagName !== "a" ? "button" : void 0
}, props), {
ref: useMergeRefs(ref, props.ref)
});
props = useCommand(props);
return props;
});
var VDNZBO4W_Button = createComponent((props) => {
const htmlProps = useButton(props);
return _3ORBWXWF_createElement("button", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/BHEJ6NUH.js
"use client";
// src/disclosure/disclosure.ts
var BHEJ6NUH_symbol = Symbol("disclosure");
var useDisclosure = createHook(
(_a) => {
var _b = _a, { store, toggleOnClick = true } = _b, props = __objRest(_b, ["store", "toggleOnClick"]);
const context = useDisclosureProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const ref = (0,external_React_.useRef)(null);
const [expanded, setExpanded] = (0,external_React_.useState)(false);
const disclosureElement = store.useState("disclosureElement");
const open = store.useState("open");
(0,external_React_.useEffect)(() => {
let isCurrentDisclosure = disclosureElement === ref.current;
if (!(disclosureElement == null ? void 0 : disclosureElement.isConnected)) {
store == null ? void 0 : store.setDisclosureElement(ref.current);
isCurrentDisclosure = true;
}
setExpanded(open && isCurrentDisclosure);
}, [disclosureElement, store, open]);
const onClickProp = props.onClick;
const toggleOnClickProp = useBooleanEvent(toggleOnClick);
const [isDuplicate, metadataProps] = useMetadataProps(props, BHEJ6NUH_symbol, true);
const onClick = useEvent((event) => {
onClickProp == null ? void 0 : onClickProp(event);
if (event.defaultPrevented)
return;
if (isDuplicate)
return;
if (!toggleOnClickProp(event))
return;
store == null ? void 0 : store.setDisclosureElement(event.currentTarget);
store == null ? void 0 : store.toggle();
});
const contentElement = store.useState("contentElement");
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues(_4R3V3JGP_spreadValues({
"aria-expanded": expanded,
"aria-controls": contentElement == null ? void 0 : contentElement.id
}, metadataProps), props), {
ref: useMergeRefs(ref, props.ref),
onClick
});
props = useButton(props);
return props;
}
);
var Disclosure = createComponent((props) => {
const htmlProps = useDisclosure(props);
return _3ORBWXWF_createElement("button", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/H3TG2CZP.js
"use client";
// src/dialog/dialog-disclosure.ts
var useDialogDisclosure = createHook(
(_a) => {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
const context = useDialogProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const contentElement = store.useState("contentElement");
props = _4R3V3JGP_spreadValues({
"aria-haspopup": getPopupRole(contentElement, "dialog")
}, props);
props = useDisclosure(_4R3V3JGP_spreadValues({ store }, props));
return props;
}
);
var DialogDisclosure = createComponent(
(props) => {
const htmlProps = useDialogDisclosure(props);
return _3ORBWXWF_createElement("button", htmlProps);
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/JCH6MLL2.js
"use client";
// src/popover/popover-anchor.ts
var usePopoverAnchor = createHook(
(_a) => {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
const context = usePopoverProviderContext();
store = store || context;
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref)
});
return props;
}
);
var PopoverAnchor = createComponent((props) => {
const htmlProps = usePopoverAnchor(props);
return _3ORBWXWF_createElement("div", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/4ZEZYKUR.js
"use client";
// src/popover/popover-disclosure.tsx
var usePopoverDisclosure = createHook(
(_a) => {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
const context = usePopoverProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const onClickProp = props.onClick;
const onClick = useEvent((event) => {
store == null ? void 0 : store.setAnchorElement(event.currentTarget);
onClickProp == null ? void 0 : onClickProp(event);
});
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(PopoverScopedContextProvider, { value: store, children: element }),
[store]
);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
onClick
});
props = usePopoverAnchor(_4R3V3JGP_spreadValues({ store }, props));
props = useDialogDisclosure(_4R3V3JGP_spreadValues({ store }, props));
return props;
}
);
var PopoverDisclosure = createComponent(
(props) => {
const htmlProps = usePopoverDisclosure(props);
return _3ORBWXWF_createElement("button", htmlProps);
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/346FK57L.js
"use client";
// src/composite/composite-typeahead.ts
var chars = "";
function clearChars() {
chars = "";
}
function isValidTypeaheadEvent(event) {
const target = event.target;
if (target && DLOEKDPY_isTextField(target))
return false;
if (event.key === " " && chars.length)
return true;
return event.key.length === 1 && !event.ctrlKey && !event.altKey && !event.metaKey && /^[\p{Letter}\p{Number}]$/u.test(event.key);
}
function isSelfTargetOrItem(event, items) {
if (isSelfTarget(event))
return true;
const target = event.target;
if (!target)
return false;
const isItem = items.some((item) => item.element === target);
return isItem;
}
function _346FK57L_getEnabledItems(items) {
return items.filter((item) => !item.disabled);
}
function itemTextStartsWith(item, text) {
var _a;
const itemText = ((_a = item.element) == null ? void 0 : _a.textContent) || item.children;
if (!itemText)
return false;
return normalizeString(itemText).trim().toLowerCase().startsWith(text.toLowerCase());
}
function getSameInitialItems(items, char, activeId) {
if (!activeId)
return items;
const activeItem = items.find((item) => item.id === activeId);
if (!activeItem)
return items;
if (!itemTextStartsWith(activeItem, char))
return items;
if (chars !== char && itemTextStartsWith(activeItem, chars))
return items;
chars = char;
return flipItems(
items.filter((item) => itemTextStartsWith(item, chars)),
activeId
).filter((item) => item.id !== activeId);
}
var useCompositeTypeahead = createHook(
(_a) => {
var _b = _a, { store, typeahead = true } = _b, props = __objRest(_b, ["store", "typeahead"]);
const context = useCompositeContext();
store = store || context;
invariant(
store,
false && 0
);
const onKeyDownCaptureProp = props.onKeyDownCapture;
const cleanupTimeoutRef = (0,external_React_.useRef)(0);
const onKeyDownCapture = useEvent(
(event) => {
onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event);
if (event.defaultPrevented)
return;
if (!typeahead)
return;
if (!store)
return;
const { items, activeId } = store.getState();
if (!isValidTypeaheadEvent(event))
return clearChars();
let enabledItems = _346FK57L_getEnabledItems(items);
if (!isSelfTargetOrItem(event, enabledItems))
return clearChars();
event.preventDefault();
window.clearTimeout(cleanupTimeoutRef.current);
cleanupTimeoutRef.current = window.setTimeout(() => {
chars = "";
}, 500);
const char = event.key.toLowerCase();
chars += char;
enabledItems = getSameInitialItems(enabledItems, char, activeId);
const item = enabledItems.find(
(item2) => itemTextStartsWith(item2, chars)
);
if (item) {
store.move(item.id);
} else {
clearChars();
}
}
);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
onKeyDownCapture
});
return props;
}
);
var CompositeTypeahead = createComponent(
(props) => {
const htmlProps = useCompositeTypeahead(props);
return _3ORBWXWF_createElement("div", htmlProps);
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/menu/menu-button.js
"use client";
// src/menu/menu-button.tsx
function getInitialFocus(event, dir) {
const keyMap = {
ArrowDown: dir === "bottom" || dir === "top" ? "first" : false,
ArrowUp: dir === "bottom" || dir === "top" ? "last" : false,
ArrowRight: dir === "right" ? "first" : false,
ArrowLeft: dir === "left" ? "first" : false
};
return keyMap[event.key];
}
function hasActiveItem(items, excludeElement) {
return !!(items == null ? void 0 : items.some((item) => {
if (!item.element)
return false;
if (item.element === excludeElement)
return false;
return item.element.getAttribute("aria-expanded") === "true";
}));
}
var useMenuButton = createHook(
(_a) => {
var _b = _a, { store, focusable, accessibleWhenDisabled, showOnHover } = _b, props = __objRest(_b, ["store", "focusable", "accessibleWhenDisabled", "showOnHover"]);
const context = useMenuProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const ref = (0,external_React_.useRef)(null);
const parentMenu = store.parent;
const parentMenubar = store.menubar;
const hasParentMenu = !!parentMenu;
const parentIsMenubar = !!parentMenubar && !hasParentMenu;
const disabled = disabledFromProps(props);
const showMenu = () => {
const trigger = ref.current;
if (!trigger)
return;
store == null ? void 0 : store.setDisclosureElement(trigger);
store == null ? void 0 : store.setAnchorElement(trigger);
store == null ? void 0 : store.show();
};
const onFocusProp = props.onFocus;
const onFocus = useEvent((event) => {
onFocusProp == null ? void 0 : onFocusProp(event);
if (disabled)
return;
if (event.defaultPrevented)
return;
store == null ? void 0 : store.setAutoFocusOnShow(false);
store == null ? void 0 : store.setActiveId(null);
if (!parentMenubar)
return;
if (!parentIsMenubar)
return;
const { items } = parentMenubar.getState();
if (hasActiveItem(items, event.currentTarget)) {
showMenu();
}
});
const dir = store.useState(
(state) => state.placement.split("-")[0]
);
const onKeyDownProp = props.onKeyDown;
const onKeyDown = useEvent((event) => {
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
if (disabled)
return;
if (event.defaultPrevented)
return;
const initialFocus = getInitialFocus(event, dir);
if (initialFocus) {
event.preventDefault();
showMenu();
store == null ? void 0 : store.setAutoFocusOnShow(true);
store == null ? void 0 : store.setInitialFocus(initialFocus);
}
});
const onClickProp = props.onClick;
const onClick = useEvent((event) => {
onClickProp == null ? void 0 : onClickProp(event);
if (event.defaultPrevented)
return;
if (!store)
return;
const isKeyboardClick = !event.detail;
const { open } = store.getState();
if (!open || isKeyboardClick) {
if (!hasParentMenu || isKeyboardClick) {
store.setAutoFocusOnShow(true);
}
store.setInitialFocus(isKeyboardClick ? "first" : "container");
}
if (hasParentMenu) {
showMenu();
}
});
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(MenuContextProvider, { value: store, children: element }),
[store]
);
if (hasParentMenu) {
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
render: /* @__PURE__ */ (0,jsx_runtime.jsx)(Role.div, { render: props.render })
});
}
const id = useId(props.id);
const parentContentElement = useStoreState(
(parentMenu == null ? void 0 : parentMenu.combobox) || parentMenu,
"contentElement"
);
const role = hasParentMenu || parentIsMenubar ? getPopupItemRole(parentContentElement, "menuitem") : void 0;
const contentElement = store.useState("contentElement");
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
id,
role,
"aria-haspopup": getPopupRole(contentElement, "menu")
}, props), {
ref: useMergeRefs(ref, props.ref),
onFocus,
onKeyDown,
onClick
});
props = useHovercardAnchor(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
store,
focusable,
accessibleWhenDisabled
}, props), {
showOnHover: (event) => {
const getShowOnHover = () => {
if (typeof showOnHover === "function")
return showOnHover(event);
if (showOnHover != null)
return showOnHover;
if (hasParentMenu)
return true;
if (!parentMenubar)
return false;
const { items } = parentMenubar.getState();
return parentIsMenubar && hasActiveItem(items);
};
const canShowOnHover = getShowOnHover();
if (!canShowOnHover)
return false;
const parent = parentIsMenubar ? parentMenubar : parentMenu;
if (!parent)
return true;
parent.setActiveId(event.currentTarget.id);
return true;
}
}));
props = usePopoverDisclosure(_4R3V3JGP_spreadValues({
store,
toggleOnClick: !hasParentMenu,
focusable,
accessibleWhenDisabled
}, props));
props = useCompositeTypeahead(_4R3V3JGP_spreadValues({
store,
typeahead: parentIsMenubar
}, props));
return props;
}
);
var MenuButton = createComponent((props) => {
const htmlProps = useMenuButton(props);
return _3ORBWXWF_createElement("button", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js
/**
* WordPress dependencies
*/
const chevronRightSmall = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.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 */ const chevron_right_small = (chevronRightSmall);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/HHNFDKU2.js
"use client";
// src/menu/menu-list.tsx
function useAriaLabelledBy(_a) {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
const [id, setId] = (0,external_React_.useState)(void 0);
const label = props["aria-label"];
const disclosureElement = useStoreState(store, "disclosureElement");
const contentElement = useStoreState(store, "contentElement");
(0,external_React_.useEffect)(() => {
const disclosure = disclosureElement;
if (!disclosure)
return;
const menu = contentElement;
if (!menu)
return;
const menuLabel = label || menu.hasAttribute("aria-label");
if (menuLabel) {
setId(void 0);
} else if (disclosure.id) {
setId(disclosure.id);
}
}, [label, disclosureElement, contentElement]);
return id;
}
var useMenuList = createHook(
(_a) => {
var _b = _a, { store, alwaysVisible, composite } = _b, props = __objRest(_b, ["store", "alwaysVisible", "composite"]);
const context = useMenuProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const parentMenu = store.parent;
const parentMenubar = store.menubar;
const hasParentMenu = !!parentMenu;
const id = useId(props.id);
const onKeyDownProp = props.onKeyDown;
const dir = store.useState(
(state) => state.placement.split("-")[0]
);
const orientation = store.useState(
(state) => state.orientation === "both" ? void 0 : state.orientation
);
const isHorizontal = orientation !== "vertical";
const isMenubarHorizontal = useStoreState(
parentMenubar,
(state) => !!state && state.orientation !== "vertical"
);
const onKeyDown = useEvent((event) => {
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
if (event.defaultPrevented)
return;
if (hasParentMenu || parentMenubar && !isHorizontal) {
const hideMap = {
ArrowRight: () => dir === "left" && !isHorizontal,
ArrowLeft: () => dir === "right" && !isHorizontal,
ArrowUp: () => dir === "bottom" && isHorizontal,
ArrowDown: () => dir === "top" && isHorizontal
};
const action = hideMap[event.key];
if (action == null ? void 0 : action()) {
event.stopPropagation();
event.preventDefault();
return store == null ? void 0 : store.hide();
}
}
if (parentMenubar) {
const keyMap = {
ArrowRight: () => {
if (!isMenubarHorizontal)
return;
return parentMenubar.next();
},
ArrowLeft: () => {
if (!isMenubarHorizontal)
return;
return parentMenubar.previous();
},
ArrowDown: () => {
if (isMenubarHorizontal)
return;
return parentMenubar.next();
},
ArrowUp: () => {
if (isMenubarHorizontal)
return;
return parentMenubar.previous();
}
};
const action = keyMap[event.key];
const id2 = action == null ? void 0 : action();
if (id2 !== void 0) {
event.stopPropagation();
event.preventDefault();
parentMenubar.move(id2);
}
}
});
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(MenuScopedContextProvider, { value: store, children: element }),
[store]
);
const ariaLabelledBy = useAriaLabelledBy(_4R3V3JGP_spreadValues({ store }, props));
const mounted = store.useState("mounted");
const hidden = isHidden(mounted, props.hidden, alwaysVisible);
const style = hidden ? _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props.style), { display: "none" }) : props.style;
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
id,
"aria-labelledby": ariaLabelledBy,
hidden
}, props), {
ref: useMergeRefs(id ? store.setContentElement : null, props.ref),
style,
onKeyDown
});
const hasCombobox = !!store.combobox;
composite = composite != null ? composite : !hasCombobox;
if (composite) {
props = _4R3V3JGP_spreadValues({
role: "menu",
"aria-orientation": orientation
}, props);
}
props = useComposite(_4R3V3JGP_spreadValues({ store, composite }, props));
props = useCompositeTypeahead(_4R3V3JGP_spreadValues({ store, typeahead: !hasCombobox }, props));
return props;
}
);
var MenuList = createComponent((props) => {
const htmlProps = useMenuList(props);
return _3ORBWXWF_createElement("div", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/menu/menu.js
"use client";
// src/menu/menu.tsx
var useMenu = createHook(
(_a) => {
var _b = _a, {
store,
modal: modalProp = false,
portal = !!modalProp,
hideOnEscape = true,
autoFocusOnShow = true,
hideOnHoverOutside,
alwaysVisible
} = _b, props = __objRest(_b, [
"store",
"modal",
"portal",
"hideOnEscape",
"autoFocusOnShow",
"hideOnHoverOutside",
"alwaysVisible"
]);
const context = useMenuProviderContext();
store = store || context;
invariant(
store,
false && 0
);
const ref = (0,external_React_.useRef)(null);
const parentMenu = store.parent;
const parentMenubar = store.menubar;
const hasParentMenu = !!parentMenu;
const parentIsMenubar = !!parentMenubar && !hasParentMenu;
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
ref: useMergeRefs(ref, props.ref)
});
const _a2 = useMenuList(
_4R3V3JGP_spreadValues({ store, alwaysVisible }, props)
), { "aria-labelledby": ariaLabelledBy } = _a2, menuListProps = __objRest(_a2, ["aria-labelledby"]);
props = menuListProps;
const [initialFocusRef, setInitialFocusRef] = (0,external_React_.useState)();
const autoFocusOnShowState = store.useState("autoFocusOnShow");
const initialFocus = store.useState("initialFocus");
const baseElement = store.useState("baseElement");
const items = store.useState("renderedItems");
(0,external_React_.useEffect)(() => {
let cleaning = false;
setInitialFocusRef((prevInitialFocusRef) => {
var _a3, _b2, _c;
if (cleaning)
return;
if (!autoFocusOnShowState)
return;
if ((_a3 = prevInitialFocusRef == null ? void 0 : prevInitialFocusRef.current) == null ? void 0 : _a3.isConnected)
return prevInitialFocusRef;
const ref2 = (0,external_React_.createRef)();
switch (initialFocus) {
case "first":
ref2.current = ((_b2 = items.find((item) => !item.disabled && item.element)) == null ? void 0 : _b2.element) || null;
break;
case "last":
ref2.current = ((_c = [...items].reverse().find((item) => !item.disabled && item.element)) == null ? void 0 : _c.element) || null;
break;
default:
ref2.current = baseElement;
}
return ref2;
});
return () => {
cleaning = true;
};
}, [store, autoFocusOnShowState, initialFocus, items, baseElement]);
const modal = hasParentMenu ? false : modalProp;
const mayAutoFocusOnShow = !!autoFocusOnShow;
const canAutoFocusOnShow = !!initialFocusRef || !!props.initialFocus || !!modal;
const contentElement = useStoreState(
store.combobox || store,
"contentElement"
);
const parentContentElement = useStoreState(
(parentMenu == null ? void 0 : parentMenu.combobox) || parentMenu,
"contentElement"
);
const preserveTabOrderAnchor = (0,external_React_.useMemo)(() => {
if (!parentContentElement)
return;
if (!contentElement)
return;
const role = contentElement.getAttribute("role");
const parentRole = parentContentElement.getAttribute("role");
const parentIsMenuOrMenubar = parentRole === "menu" || parentRole === "menubar";
if (parentIsMenuOrMenubar && role === "menu")
return;
return parentContentElement;
}, [contentElement, parentContentElement]);
if (preserveTabOrderAnchor !== void 0) {
props = _4R3V3JGP_spreadValues({
preserveTabOrderAnchor
}, props);
}
props = useHovercard(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
store,
alwaysVisible,
initialFocus: initialFocusRef,
autoFocusOnShow: mayAutoFocusOnShow ? canAutoFocusOnShow && autoFocusOnShow : autoFocusOnShowState || !!modal
}, props), {
hideOnEscape: (event) => {
if (isFalsyBooleanCallback(hideOnEscape, event))
return false;
store == null ? void 0 : store.hideAll();
return true;
},
hideOnHoverOutside: (event) => {
const disclosureElement = store == null ? void 0 : store.getState().disclosureElement;
const getHideOnHoverOutside = () => {
if (typeof hideOnHoverOutside === "function") {
return hideOnHoverOutside(event);
}
if (hideOnHoverOutside != null)
return hideOnHoverOutside;
if (hasParentMenu)
return true;
if (!parentIsMenubar)
return false;
if (!disclosureElement)
return true;
if (hasFocusWithin(disclosureElement))
return false;
return true;
};
if (!getHideOnHoverOutside())
return false;
if (event.defaultPrevented)
return true;
if (!hasParentMenu)
return true;
if (!disclosureElement)
return true;
fireEvent(disclosureElement, "mouseout", event);
if (!hasFocusWithin(disclosureElement))
return true;
requestAnimationFrame(() => {
if (hasFocusWithin(disclosureElement))
return;
store == null ? void 0 : store.hide();
});
return false;
},
modal,
portal,
backdrop: hasParentMenu ? false : props.backdrop
}));
props = _4R3V3JGP_spreadValues({
"aria-labelledby": ariaLabelledBy
}, props);
return props;
}
);
var Menu = createDialogComponent(
createComponent((props) => {
const htmlProps = useMenu(props);
return _3ORBWXWF_createElement("div", htmlProps);
}),
useMenuProviderContext
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/G6ONQ5EH.js
"use client";
// src/composite/composite-hover.ts
function getMouseDestination(event) {
const relatedTarget = event.relatedTarget;
if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) {
return relatedTarget;
}
return null;
}
function hoveringInside(event) {
const nextElement = getMouseDestination(event);
if (!nextElement)
return false;
return contains(event.currentTarget, nextElement);
}
var G6ONQ5EH_symbol = Symbol("composite-hover");
function movingToAnotherItem(event) {
let dest = getMouseDestination(event);
if (!dest)
return false;
do {
if (Y3OOHFCN_hasOwnProperty(dest, G6ONQ5EH_symbol) && dest[G6ONQ5EH_symbol])
return true;
dest = dest.parentElement;
} while (dest);
return false;
}
var useCompositeHover = createHook(
(_a) => {
var _b = _a, {
store,
focusOnHover = true,
blurOnHoverEnd = !!focusOnHover
} = _b, props = __objRest(_b, [
"store",
"focusOnHover",
"blurOnHoverEnd"
]);
const context = useCompositeContext();
store = store || context;
invariant(
store,
false && 0
);
const isMouseMoving = useIsMouseMoving();
const onMouseMoveProp = props.onMouseMove;
const focusOnHoverProp = useBooleanEvent(focusOnHover);
const onMouseMove = useEvent((event) => {
onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
if (event.defaultPrevented)
return;
if (!isMouseMoving())
return;
if (!focusOnHoverProp(event))
return;
if (!hasFocusWithin(event.currentTarget)) {
const baseElement = store == null ? void 0 : store.getState().baseElement;
if (baseElement && !hasFocus(baseElement)) {
baseElement.focus();
}
}
store == null ? void 0 : store.setActiveId(event.currentTarget.id);
});
const onMouseLeaveProp = props.onMouseLeave;
const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd);
const onMouseLeave = useEvent((event) => {
var _a2;
onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event);
if (event.defaultPrevented)
return;
if (!isMouseMoving())
return;
if (hoveringInside(event))
return;
if (movingToAnotherItem(event))
return;
if (!focusOnHoverProp(event))
return;
if (!blurOnHoverEndProp(event))
return;
store == null ? void 0 : store.setActiveId(null);
(_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus();
});
const ref = (0,external_React_.useCallback)((element) => {
if (!element)
return;
element[G6ONQ5EH_symbol] = true;
}, []);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), {
ref: useMergeRefs(ref, props.ref),
onMouseMove,
onMouseLeave
});
return props;
}
);
var CompositeHover = createMemoComponent(
(props) => {
const htmlProps = useCompositeHover(props);
return _3ORBWXWF_createElement("div", htmlProps);
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/Y6467XPW.js
"use client";
// src/menu/menu-item.ts
function menuHasFocus(baseElement, items, currentTarget) {
var _a;
if (!baseElement)
return false;
if (hasFocusWithin(baseElement))
return true;
const expandedItem = items == null ? void 0 : items.find((item) => {
var _a2;
if (item.element === currentTarget)
return false;
return ((_a2 = item.element) == null ? void 0 : _a2.getAttribute("aria-expanded")) === "true";
});
const expandedMenuId = (_a = expandedItem == null ? void 0 : expandedItem.element) == null ? void 0 : _a.getAttribute("aria-controls");
if (!expandedMenuId)
return false;
const doc = DLOEKDPY_getDocument(baseElement);
const expandedMenu = doc.getElementById(expandedMenuId);
if (!expandedMenu)
return false;
if (hasFocusWithin(expandedMenu))
return true;
return !!expandedMenu.querySelector("[role=menuitem][aria-expanded=true]");
}
var useMenuItem = createHook(
(_a) => {
var _b = _a, {
store,
hideOnClick = true,
preventScrollOnKeyDown = true,
focusOnHover,
blurOnHoverEnd
} = _b, props = __objRest(_b, [
"store",
"hideOnClick",
"preventScrollOnKeyDown",
"focusOnHover",
"blurOnHoverEnd"
]);
const menuContext = useMenuScopedContext(true);
const menubarContext = KA4GX64Z_useMenubarScopedContext();
store = store || menuContext || menubarContext;
invariant(
store,
false && 0
);
const onClickProp = props.onClick;
const hideOnClickProp = useBooleanEvent(hideOnClick);
const hideMenu = "hideAll" in store ? store.hideAll : void 0;
const isWithinMenu = !!hideMenu;
const onClick = useEvent((event) => {
onClickProp == null ? void 0 : onClickProp(event);
if (event.defaultPrevented)
return;
if (isDownloading(event))
return;
if (isOpeningInNewTab(event))
return;
if (!hideMenu)
return;
const popupType = event.currentTarget.getAttribute("aria-haspopup");
if (popupType === "menu")
return;
if (!hideOnClickProp(event))
return;
hideMenu();
});
const contentElement = useStoreState(
store,
(state) => "contentElement" in state ? state.contentElement : null
);
const role = getPopupItemRole(contentElement, "menuitem");
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
role
}, props), {
onClick
});
props = useCompositeItem(_4R3V3JGP_spreadValues({ store, preventScrollOnKeyDown }, props));
props = useCompositeHover(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
store
}, props), {
focusOnHover(event) {
const getFocusOnHover = () => {
if (typeof focusOnHover === "function")
return focusOnHover(event);
if (focusOnHover != null)
return focusOnHover;
return true;
};
if (!store)
return false;
if (!getFocusOnHover())
return false;
const { baseElement, items } = store.getState();
if (isWithinMenu) {
if (event.currentTarget.hasAttribute("aria-expanded")) {
event.currentTarget.focus();
}
return true;
}
if (menuHasFocus(baseElement, items, event.currentTarget)) {
event.currentTarget.focus();
return true;
}
return false;
},
blurOnHoverEnd(event) {
if (typeof blurOnHoverEnd === "function")
return blurOnHoverEnd(event);
if (blurOnHoverEnd != null)
return blurOnHoverEnd;
return isWithinMenu;
}
}));
return props;
}
);
var Y6467XPW_MenuItem = createMemoComponent((props) => {
const htmlProps = useMenuItem(props);
return _3ORBWXWF_createElement("div", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/checkbox/checkbox-store.js
"use client";
// src/checkbox/checkbox-store.ts
function createCheckboxStore(props = {}) {
var _a;
throwOnConflictingProps(props, props.store);
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const initialState = {
value: defaultValue(
props.value,
syncState == null ? void 0 : syncState.value,
props.defaultValue,
false
)
};
const checkbox = createStore(initialState, props.store);
return _chunks_4R3V3JGP_spreadProps(_chunks_4R3V3JGP_spreadValues({}, checkbox), {
setValue: (value) => checkbox.setState("value", value)
});
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/JIZ5C2JK.js
"use client";
// src/checkbox/checkbox-store.ts
function useCheckboxStoreProps(store, update, props) {
useUpdateEffect(update, [props.store]);
useStoreProps(store, props, "value", "setValue");
return store;
}
function useCheckboxStore(props = {}) {
const [store, update] = EKQEJRUF_useStore(createCheckboxStore, props);
return useCheckboxStoreProps(store, update, props);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/VPR2WHQV.js
"use client";
// src/checkbox/checkbox-context.tsx
var VPR2WHQV_ctx = createStoreContext();
var useCheckboxContext = VPR2WHQV_ctx.useContext;
var useCheckboxScopedContext = VPR2WHQV_ctx.useScopedContext;
var useCheckboxProviderContext = VPR2WHQV_ctx.useProviderContext;
var CheckboxContextProvider = VPR2WHQV_ctx.ContextProvider;
var CheckboxScopedContextProvider = VPR2WHQV_ctx.ScopedContextProvider;
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/3AHQ6JCP.js
"use client";
// src/checkbox/checkbox.tsx
function setMixed(element, mixed) {
if (mixed) {
element.indeterminate = true;
} else if (element.indeterminate) {
element.indeterminate = false;
}
}
function isNativeCheckbox(tagName, type) {
return tagName === "input" && (!type || type === "checkbox");
}
function getPrimitiveValue(value) {
if (Array.isArray(value)) {
return value.toString();
}
return value;
}
var useCheckbox = createHook(
(_a) => {
var _b = _a, {
store,
name,
value: valueProp,
checked: checkedProp,
defaultChecked
} = _b, props = __objRest(_b, [
"store",
"name",
"value",
"checked",
"defaultChecked"
]);
const context = useCheckboxContext();
store = store || context;
const [_checked, setChecked] = (0,external_React_.useState)(defaultChecked != null ? defaultChecked : false);
const checked = useStoreState(store, (state) => {
if (checkedProp !== void 0)
return checkedProp;
if ((state == null ? void 0 : state.value) === void 0)
return _checked;
if (valueProp != null) {
if (Array.isArray(state.value)) {
const primitiveValue = getPrimitiveValue(valueProp);
return state.value.includes(primitiveValue);
}
return state.value === valueProp;
}
if (Array.isArray(state.value))
return false;
if (typeof state.value === "boolean")
return state.value;
return false;
});
const ref = (0,external_React_.useRef)(null);
const tagName = useTagName(ref, props.as || "input");
const nativeCheckbox = isNativeCheckbox(tagName, props.type);
const mixed = checked ? checked === "mixed" : void 0;
const isChecked = checked === "mixed" ? false : checked;
const disabled = disabledFromProps(props);
const [propertyUpdated, schedulePropertyUpdate] = useForceUpdate();
(0,external_React_.useEffect)(() => {
const element = ref.current;
if (!element)
return;
setMixed(element, mixed);
if (nativeCheckbox)
return;
element.checked = isChecked;
if (name !== void 0) {
element.name = name;
}
if (valueProp !== void 0) {
element.value = `${valueProp}`;
}
}, [propertyUpdated, mixed, nativeCheckbox, isChecked, name, valueProp]);
const onChangeProp = props.onChange;
const onChange = useEvent((event) => {
if (disabled) {
event.stopPropagation();
event.preventDefault();
return;
}
setMixed(event.currentTarget, mixed);
if (!nativeCheckbox) {
event.currentTarget.checked = !event.currentTarget.checked;
schedulePropertyUpdate();
}
onChangeProp == null ? void 0 : onChangeProp(event);
if (event.defaultPrevented)
return;
const elementChecked = event.currentTarget.checked;
setChecked(elementChecked);
store == null ? void 0 : store.setValue((prevValue) => {
if (valueProp == null)
return elementChecked;
const primitiveValue = getPrimitiveValue(valueProp);
if (!Array.isArray(prevValue)) {
return prevValue === primitiveValue ? false : primitiveValue;
}
if (elementChecked) {
if (prevValue.includes(primitiveValue)) {
return prevValue;
}
return [...prevValue, primitiveValue];
}
return prevValue.filter((v) => v !== primitiveValue);
});
});
const onClickProp = props.onClick;
const onClick = useEvent((event) => {
onClickProp == null ? void 0 : onClickProp(event);
if (event.defaultPrevented)
return;
if (nativeCheckbox)
return;
onChange(event);
});
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(CheckboxCheckedContext.Provider, { value: isChecked, children: element }),
[isChecked]
);
props = _4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({
role: !nativeCheckbox ? "checkbox" : void 0,
type: nativeCheckbox ? "checkbox" : void 0,
"aria-checked": checked
}, props), {
ref: useMergeRefs(ref, props.ref),
onChange,
onClick
});
props = useCommand(_4R3V3JGP_spreadValues({ clickOnEnter: !nativeCheckbox }, props));
return _4R3V3JGP_spreadValues({
name: nativeCheckbox ? name : void 0,
value: nativeCheckbox ? valueProp : void 0,
checked: isChecked
}, props);
}
);
var Checkbox = createComponent((props) => {
const htmlProps = useCheckbox(props);
return _3ORBWXWF_createElement("input", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/menu/menu-item-checkbox.js
"use client";
// src/menu/menu-item-checkbox.ts
function menu_item_checkbox_getPrimitiveValue(value) {
if (Array.isArray(value)) {
return value.toString();
}
return value;
}
function getValue(storeValue, value, checked) {
if (value === void 0) {
if (Array.isArray(storeValue))
return storeValue;
return !!checked;
}
const primitiveValue = menu_item_checkbox_getPrimitiveValue(value);
if (!Array.isArray(storeValue)) {
if (checked) {
return primitiveValue;
}
return storeValue === primitiveValue ? false : storeValue;
}
if (checked) {
if (storeValue.includes(primitiveValue)) {
return storeValue;
}
return [...storeValue, primitiveValue];
}
return storeValue.filter((v) => v !== primitiveValue);
}
var useMenuItemCheckbox = createHook(
(_a) => {
var _b = _a, {
store,
name,
value,
checked,
defaultChecked: defaultCheckedProp,
hideOnClick = false
} = _b, props = __objRest(_b, [
"store",
"name",
"value",
"checked",
"defaultChecked",
"hideOnClick"
]);
const context = useMenuScopedContext();
store = store || context;
invariant(
store,
false && 0
);
const defaultChecked = useInitialValue(defaultCheckedProp);
(0,external_React_.useEffect)(() => {
store == null ? void 0 : store.setValue(name, (prevValue = []) => {
if (!defaultChecked)
return prevValue;
return getValue(prevValue, value, true);
});
}, [store, name, value, defaultChecked]);
(0,external_React_.useEffect)(() => {
if (checked === void 0)
return;
store == null ? void 0 : store.setValue(name, (prevValue) => {
return getValue(prevValue, value, checked);
});
}, [store, name, value, checked]);
const checkboxStore = useCheckboxStore({
value: store.useState((state) => state.values[name]),
setValue(internalValue) {
store == null ? void 0 : store.setValue(name, () => {
if (checked === void 0)
return internalValue;
const nextValue = getValue(internalValue, value, checked);
if (!Array.isArray(nextValue))
return nextValue;
if (!Array.isArray(internalValue))
return nextValue;
if (shallowEqual(internalValue, nextValue))
return internalValue;
return nextValue;
});
}
});
props = _4R3V3JGP_spreadValues({
role: "menuitemcheckbox"
}, props);
props = useCheckbox(_4R3V3JGP_spreadValues({
store: checkboxStore,
name,
value,
checked
}, props));
props = useMenuItem(_4R3V3JGP_spreadValues({ store, hideOnClick }, props));
return props;
}
);
var MenuItemCheckbox = createMemoComponent(
(props) => {
const htmlProps = useMenuItemCheckbox(props);
return _3ORBWXWF_createElement("div", htmlProps);
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/menu/menu-item-radio.js
"use client";
// src/menu/menu-item-radio.tsx
function menu_item_radio_getValue(prevValue, value, checked) {
if (checked === void 0)
return prevValue;
if (checked)
return value;
return prevValue;
}
var useMenuItemRadio = createHook(
(_a) => {
var _b = _a, {
store,
name,
value,
checked,
onChange: onChangeProp,
hideOnClick = false
} = _b, props = __objRest(_b, [
"store",
"name",
"value",
"checked",
"onChange",
"hideOnClick"
]);
const context = useMenuScopedContext();
store = store || context;
invariant(
store,
false && 0
);
const defaultChecked = useInitialValue(props.defaultChecked);
(0,external_React_.useEffect)(() => {
store == null ? void 0 : store.setValue(name, (prevValue = false) => {
return menu_item_radio_getValue(prevValue, value, defaultChecked);
});
}, [store, name, value, defaultChecked]);
(0,external_React_.useEffect)(() => {
if (checked === void 0)
return;
store == null ? void 0 : store.setValue(name, (prevValue) => {
return menu_item_radio_getValue(prevValue, value, checked);
});
}, [store, name, value, checked]);
const isChecked = store.useState((state) => state.values[name] === value);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0,jsx_runtime.jsx)(MenuItemCheckedContext.Provider, { value: !!isChecked, children: element }),
[isChecked]
);
props = _4R3V3JGP_spreadValues({
role: "menuitemradio"
}, props);
props = useRadio(_4R3V3JGP_spreadValues({
name,
value,
checked: isChecked,
onChange: (event) => {
onChangeProp == null ? void 0 : onChangeProp(event);
if (event.defaultPrevented)
return;
const element = event.currentTarget;
store == null ? void 0 : store.setValue(name, (prevValue) => {
return menu_item_radio_getValue(prevValue, value, checked != null ? checked : element.checked);
});
}
}, props));
props = useMenuItem(_4R3V3JGP_spreadValues({ store, hideOnClick }, props));
return props;
}
);
var MenuItemRadio = createMemoComponent(
(props) => {
const htmlProps = useMenuItemRadio(props);
return _3ORBWXWF_createElement("div", htmlProps);
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/menu/menu-group.js
"use client";
// src/menu/menu-group.ts
var useMenuGroup = createHook((props) => {
props = useCompositeGroup(props);
return props;
});
var menu_group_MenuGroup = createComponent((props) => {
const htmlProps = useMenuGroup(props);
return _3ORBWXWF_createElement("div", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/ENRQQ6LK.js
"use client";
// src/composite/composite-separator.ts
var useCompositeSeparator = createHook(
(_a) => {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
const context = useCompositeContext();
store = store || context;
invariant(
store,
false && 0
);
const orientation = store.useState(
(state) => state.orientation === "horizontal" ? "vertical" : "horizontal"
);
props = useSeparator(_4R3V3JGP_spreadProps(_4R3V3JGP_spreadValues({}, props), { orientation }));
return props;
}
);
var CompositeSeparator = createComponent(
(props) => {
const htmlProps = useCompositeSeparator(props);
return _3ORBWXWF_createElement("hr", htmlProps);
}
);
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/menu/menu-separator.js
"use client";
// src/menu/menu-separator.ts
var useMenuSeparator = createHook(
(_a) => {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
const context = useMenuContext();
store = store || context;
props = useCompositeSeparator(_4R3V3JGP_spreadValues({ store }, props));
return props;
}
);
var MenuSeparator = createComponent((props) => {
const htmlProps = useMenuSeparator(props);
return _3ORBWXWF_createElement("hr", htmlProps);
});
if (false) {}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown-menu-v2/styles.js
function dropdown_menu_v2_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* Internal dependencies
*/
const ANIMATION_PARAMS = {
SLIDE_AMOUNT: '2px',
DURATION: '400ms',
EASING: 'cubic-bezier( 0.16, 1, 0.3, 1 )'
};
const CONTENT_WRAPPER_PADDING = space(1);
const ITEM_PADDING_BLOCK = space(2);
const ITEM_PADDING_INLINE = space(3);
// TODO:
// - those values are different from saved variables?
// - should bring this into the config, and make themeable
// - border color and divider color are different?
const DEFAULT_BORDER_COLOR = COLORS.gray[300];
const DIVIDER_COLOR = COLORS.gray[200];
const TOOLBAR_VARIANT_BORDER_COLOR = COLORS.gray['900'];
const DEFAULT_BOX_SHADOW = `0 0 0 ${config_values.borderWidth} ${DEFAULT_BORDER_COLOR}, ${config_values.popoverShadow}`;
const TOOLBAR_VARIANT_BOX_SHADOW = `0 0 0 ${config_values.borderWidth} ${TOOLBAR_VARIANT_BORDER_COLOR}`;
const GRID_TEMPLATE_COLS = 'minmax( 0, max-content ) 1fr';
const slideUpAndFade = emotion_react_browser_esm_keyframes({
'0%': {
opacity: 0,
transform: `translateY(${ANIMATION_PARAMS.SLIDE_AMOUNT})`
},
'100%': {
opacity: 1,
transform: 'translateY(0)'
}
});
const slideRightAndFade = emotion_react_browser_esm_keyframes({
'0%': {
opacity: 0,
transform: `translateX(-${ANIMATION_PARAMS.SLIDE_AMOUNT})`
},
'100%': {
opacity: 1,
transform: 'translateX(0)'
}
});
const slideDownAndFade = emotion_react_browser_esm_keyframes({
'0%': {
opacity: 0,
transform: `translateY(-${ANIMATION_PARAMS.SLIDE_AMOUNT})`
},
'100%': {
opacity: 1,
transform: 'translateY(0)'
}
});
const slideLeftAndFade = emotion_react_browser_esm_keyframes({
'0%': {
opacity: 0,
transform: `translateX(${ANIMATION_PARAMS.SLIDE_AMOUNT})`
},
'100%': {
opacity: 1,
transform: 'translateX(0)'
}
});
const dropdown_menu_v2_styles_DropdownMenu = /*#__PURE__*/emotion_styled_base_browser_esm(Menu, true ? {
target: "e1kdzosf12"
} : 0)("position:relative;z-index:1000000;display:grid;grid-template-columns:", GRID_TEMPLATE_COLS, ";grid-template-rows:auto;box-sizing:border-box;min-width:160px;max-width:320px;max-height:var( --popover-available-height );padding:", CONTENT_WRAPPER_PADDING, ";background-color:", COLORS.ui.background, ";border-radius:4px;", props => /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:", props.variant === 'toolbar' ? TOOLBAR_VARIANT_BOX_SHADOW : DEFAULT_BOX_SHADOW, ";" + ( true ? "" : 0), true ? "" : 0), " overscroll-behavior:contain;overflow:auto;outline:2px solid transparent!important;animation-duration:", ANIMATION_PARAMS.DURATION, ";animation-timing-function:", ANIMATION_PARAMS.EASING, ";will-change:transform,opacity;animation-name:", slideDownAndFade, ";&[data-side='right']{animation-name:", slideLeftAndFade, ";}&[data-side='bottom']{animation-name:", slideUpAndFade, ";}&[data-side='left']{animation-name:", slideRightAndFade, ";}@media ( prefers-reduced-motion ){animation-duration:0s;}" + ( true ? "" : 0));
const baseItem = /*#__PURE__*/emotion_react_browser_esm_css("all:unset;position:relative;min-height:", space(10), ";box-sizing:border-box;grid-column:1/-1;display:grid;grid-template-columns:", GRID_TEMPLATE_COLS, ";align-items:center;@supports ( grid-template-columns: subgrid ){grid-template-columns:subgrid;}font-size:", font('default.fontSize'), ";font-family:inherit;font-weight:normal;line-height:20px;color:", COLORS.gray[900], ";border-radius:", config_values.radiusBlockUi, ";padding-block:", ITEM_PADDING_BLOCK, ";padding-inline:", ITEM_PADDING_INLINE, ";scroll-margin:", CONTENT_WRAPPER_PADDING, ";user-select:none;outline:none;&[aria-disabled='true']{color:", COLORS.ui.textDisabled, ";cursor:not-allowed;}&[data-active-item]:not( [data-focus-visible] ):not(\n\t\t\t[aria-disabled='true']\n\t\t){background-color:", COLORS.theme.accent, ";color:", COLORS.white, ";}&[data-focus-visible]{box-shadow:0 0 0 1.5px ", COLORS.theme.accent, ";outline:2px solid transparent;}&:active,&[data-active]{}", dropdown_menu_v2_styles_DropdownMenu, ":not(:focus) &:not(:focus)[aria-expanded=\"true\"]{background-color:", COLORS.gray[100], ";color:", COLORS.gray[900], ";}svg{fill:currentColor;}" + ( true ? "" : 0), true ? "" : 0);
const styles_DropdownMenuItem = /*#__PURE__*/emotion_styled_base_browser_esm(Y6467XPW_MenuItem, true ? {
target: "e1kdzosf11"
} : 0)(baseItem, ";" + ( true ? "" : 0));
const styles_DropdownMenuCheckboxItem = /*#__PURE__*/emotion_styled_base_browser_esm(MenuItemCheckbox, true ? {
target: "e1kdzosf10"
} : 0)(baseItem, ";" + ( true ? "" : 0));
const styles_DropdownMenuRadioItem = /*#__PURE__*/emotion_styled_base_browser_esm(MenuItemRadio, true ? {
target: "e1kdzosf9"
} : 0)(baseItem, ";" + ( true ? "" : 0));
const ItemPrefixWrapper = emotion_styled_base_browser_esm("span", true ? {
target: "e1kdzosf8"
} : 0)("grid-column:1;", styles_DropdownMenuCheckboxItem, ">&,", styles_DropdownMenuRadioItem, ">&{min-width:", space(6), ";}", styles_DropdownMenuCheckboxItem, ">&,", styles_DropdownMenuRadioItem, ">&,&:not( :empty ){margin-inline-end:", space(2), ";}display:flex;align-items:center;justify-content:center;color:", COLORS.gray['700'], ";[data-active-item]:not( [data-focus-visible] )>&,[aria-disabled='true']>&{color:inherit;}" + ( true ? "" : 0));
const DropdownMenuItemContentWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "e1kdzosf7"
} : 0)("grid-column:2;display:flex;align-items:center;justify-content:space-between;gap:", space(3), ";pointer-events:none;" + ( true ? "" : 0));
const DropdownMenuItemChildrenWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "e1kdzosf6"
} : 0)("flex:1;display:inline-flex;flex-direction:column;gap:", space(1), ";" + ( true ? "" : 0));
const ItemSuffixWrapper = emotion_styled_base_browser_esm("span", true ? {
target: "e1kdzosf5"
} : 0)("flex:0 1 fit-content;min-width:0;width:fit-content;display:flex;align-items:center;justify-content:center;gap:", space(3), ";color:", COLORS.gray['700'], ";[data-active-item]:not( [data-focus-visible] ) *:not(", dropdown_menu_v2_styles_DropdownMenu, ") &,[aria-disabled='true'] *:not(", dropdown_menu_v2_styles_DropdownMenu, ") &{color:inherit;}" + ( true ? "" : 0));
const styles_DropdownMenuGroup = /*#__PURE__*/emotion_styled_base_browser_esm(menu_group_MenuGroup, true ? {
target: "e1kdzosf4"
} : 0)( true ? {
name: "49aokf",
styles: "display:contents"
} : 0);
const styles_DropdownMenuSeparator = /*#__PURE__*/emotion_styled_base_browser_esm(MenuSeparator, true ? {
target: "e1kdzosf3"
} : 0)("grid-column:1/-1;border:none;height:", config_values.borderWidth, ";background-color:", props => props.variant === 'toolbar' ? TOOLBAR_VARIANT_BORDER_COLOR : DIVIDER_COLOR, ";margin-block:", space(2), ";margin-inline:", ITEM_PADDING_INLINE, ";outline:2px solid transparent;" + ( true ? "" : 0));
const SubmenuChevronIcon = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_icon, true ? {
target: "e1kdzosf2"
} : 0)("width:", space(1.5), ";", rtl({
transform: `scaleX(1)`
}, {
transform: `scaleX(-1)`
}), ";" + ( true ? "" : 0));
const styles_DropdownMenuItemLabel = /*#__PURE__*/emotion_styled_base_browser_esm(truncate_component, true ? {
target: "e1kdzosf1"
} : 0)("font-size:", font('default.fontSize'), ";line-height:20px;color:inherit;" + ( true ? "" : 0));
const styles_DropdownMenuItemHelpText = /*#__PURE__*/emotion_styled_base_browser_esm(truncate_component, true ? {
target: "e1kdzosf0"
} : 0)("font-size:", font('helpText.fontSize'), ";line-height:16px;color:", COLORS.gray['700'], ";[data-active-item]:not( [data-focus-visible] ) *:not( ", dropdown_menu_v2_styles_DropdownMenu, " ) &,[aria-disabled='true'] *:not( ", dropdown_menu_v2_styles_DropdownMenu, " ) &{color:inherit;}" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown-menu-v2/index.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DropdownMenuContext = (0,external_wp_element_namespaceObject.createContext)(undefined);
const DropdownMenuItem = (0,external_wp_element_namespaceObject.forwardRef)(function DropdownMenuItem({
prefix,
suffix,
children,
hideOnClick = true,
...props
}, ref) {
const dropdownMenuContext = (0,external_wp_element_namespaceObject.useContext)(DropdownMenuContext);
return (0,external_React_.createElement)(styles_DropdownMenuItem, {
ref: ref,
...props,
accessibleWhenDisabled: true,
hideOnClick: hideOnClick,
store: dropdownMenuContext?.store
}, (0,external_React_.createElement)(ItemPrefixWrapper, null, prefix), (0,external_React_.createElement)(DropdownMenuItemContentWrapper, null, (0,external_React_.createElement)(DropdownMenuItemChildrenWrapper, null, children), suffix && (0,external_React_.createElement)(ItemSuffixWrapper, null, suffix)));
});
const DropdownMenuCheckboxItem = (0,external_wp_element_namespaceObject.forwardRef)(function DropdownMenuCheckboxItem({
suffix,
children,
hideOnClick = false,
...props
}, ref) {
const dropdownMenuContext = (0,external_wp_element_namespaceObject.useContext)(DropdownMenuContext);
return (0,external_React_.createElement)(styles_DropdownMenuCheckboxItem, {
ref: ref,
...props,
accessibleWhenDisabled: true,
hideOnClick: hideOnClick,
store: dropdownMenuContext?.store
}, (0,external_React_.createElement)(MenuItemCheck, {
store: dropdownMenuContext?.store,
render: (0,external_React_.createElement)(ItemPrefixWrapper, null)
// Override some ariakit inline styles
,
style: {
width: 'auto',
height: 'auto'
}
}, (0,external_React_.createElement)(build_module_icon, {
icon: library_check,
size: 24
})), (0,external_React_.createElement)(DropdownMenuItemContentWrapper, null, (0,external_React_.createElement)(DropdownMenuItemChildrenWrapper, null, children), suffix && (0,external_React_.createElement)(ItemSuffixWrapper, null, suffix)));
});
const radioCheck = (0,external_React_.createElement)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, (0,external_React_.createElement)(external_wp_primitives_namespaceObject.Circle, {
cx: 12,
cy: 12,
r: 3
}));
const DropdownMenuRadioItem = (0,external_wp_element_namespaceObject.forwardRef)(function DropdownMenuRadioItem({
suffix,
children,
hideOnClick = false,
...props
}, ref) {
const dropdownMenuContext = (0,external_wp_element_namespaceObject.useContext)(DropdownMenuContext);
return (0,external_React_.createElement)(styles_DropdownMenuRadioItem, {
ref: ref,
...props,
accessibleWhenDisabled: true,
hideOnClick: hideOnClick,
store: dropdownMenuContext?.store
}, (0,external_React_.createElement)(MenuItemCheck, {
store: dropdownMenuContext?.store,
render: (0,external_React_.createElement)(ItemPrefixWrapper, null)
// Override some ariakit inline styles
,
style: {
width: 'auto',
height: 'auto'
}
}, (0,external_React_.createElement)(build_module_icon, {
icon: radioCheck,
size: 24
})), (0,external_React_.createElement)(DropdownMenuItemContentWrapper, null, (0,external_React_.createElement)(DropdownMenuItemChildrenWrapper, null, children), suffix && (0,external_React_.createElement)(ItemSuffixWrapper, null, suffix)));
});
const DropdownMenuGroup = (0,external_wp_element_namespaceObject.forwardRef)(function DropdownMenuGroup(props, ref) {
const dropdownMenuContext = (0,external_wp_element_namespaceObject.useContext)(DropdownMenuContext);
return (0,external_React_.createElement)(styles_DropdownMenuGroup, {
ref: ref,
...props,
store: dropdownMenuContext?.store
});
});
const dropdown_menu_v2_UnconnectedDropdownMenu = (props, ref) => {
var _props$placement;
const {
// Store props
open,
defaultOpen = false,
onOpenChange,
placement,
// Menu trigger props
trigger,
// Menu props
gutter,
children,
shift,
modal = true,
// From internal components context
variant,
// Rest
...otherProps
} = useContextSystem(props, 'DropdownMenu');
const parentContext = (0,external_wp_element_namespaceObject.useContext)(DropdownMenuContext);
const computedDirection = (0,external_wp_i18n_namespaceObject.isRTL)() ? 'rtl' : 'ltr';
// If an explicit value for the `placement` prop is not passed,
// apply a default placement of `bottom-start` for the root dropdown,
// and of `right-start` for nested dropdowns.
let computedPlacement = (_props$placement = props.placement) !== null && _props$placement !== void 0 ? _props$placement : parentContext?.store ? 'right-start' : 'bottom-start';
// Swap left/right in case of RTL direction
if (computedDirection === 'rtl') {
if (/right/.test(computedPlacement)) {
computedPlacement = computedPlacement.replace('right', 'left');
} else if (/left/.test(computedPlacement)) {
computedPlacement = computedPlacement.replace('left', 'right');
}
}
const dropdownMenuStore = useMenuStore({
parent: parentContext?.store,
open,
defaultOpen,
placement: computedPlacement,
focusLoop: true,
setOpen(willBeOpen) {
onOpenChange?.(willBeOpen);
},
rtl: computedDirection === 'rtl'
});
const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
store: dropdownMenuStore,
variant
}), [dropdownMenuStore, variant]);
// Extract the side from the applied placement — useful for animations.
const appliedPlacementSide = dropdownMenuStore.useState('placement').split('-')[0];
if (dropdownMenuStore.parent && !((0,external_wp_element_namespaceObject.isValidElement)(trigger) && DropdownMenuItem === trigger.type)) {
// eslint-disable-next-line no-console
console.warn('For nested DropdownMenus, the `trigger` should always be a `DropdownMenuItem`.');
}
const hideOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => {
// Pressing Escape can cause unexpected consequences (ie. exiting
// full screen mode on MacOs, close parent modals...).
event.preventDefault();
// Returning `true` causes the menu to hide.
return true;
}, []);
const wrapperProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
dir: computedDirection,
style: {
direction: computedDirection
}
}), [computedDirection]);
return (0,external_React_.createElement)(external_React_.Fragment, null, (0,external_React_.createElement)(MenuButton, {
ref: ref,
store: dropdownMenuStore,
render: dropdownMenuStore.parent ? (0,external_wp_element_namespaceObject.cloneElement)(trigger, {
// Add submenu arrow, unless a `suffix` is explicitly specified
suffix: (0,external_React_.createElement)(external_React_.Fragment, null, trigger.props.suffix, (0,external_React_.createElement)(SubmenuChevronIcon, {
"aria-hidden": "true",
icon: chevron_right_small,
size: 24,
preserveAspectRatio: "xMidYMid slice"
}))
}) : trigger
}), (0,external_React_.createElement)(dropdown_menu_v2_styles_DropdownMenu, {
...otherProps,
modal: modal,
store: dropdownMenuStore
// Root menu has an 8px distance from its trigger,
// otherwise 0 (which causes the submenu to slightly overlap)
,
gutter: gutter !== null && gutter !== void 0 ? gutter : dropdownMenuStore.parent ? 0 : 8
// Align nested menu by the same (but opposite) amount
// as the menu container's padding.
,
shift: shift !== null && shift !== void 0 ? shift : dropdownMenuStore.parent ? -4 : 0,
hideOnHoverOutside: false,
"data-side": appliedPlacementSide,
variant: variant,
wrapperProps: wrapperProps,
hideOnEscape: hideOnEscape,
unmountOnHide: true
}, (0,external_React_.createElement)(DropdownMenuContext.Provider, {
value: contextValue
}, children)));
};
const dropdown_menu_v2_DropdownMenu = contextConnect(dropdown_menu_v2_UnconnectedDropdownMenu, 'DropdownMenu');
const DropdownMenuSeparator = (0,external_wp_element_namespaceObject.forwardRef)(function DropdownMenuSeparator(props, ref) {
const dropdownMenuContext = (0,external_wp_element_namespaceObject.useContext)(DropdownMenuContext);
return (0,external_React_.createElement)(styles_DropdownMenuSeparator, {
ref: ref,
...props,
store: dropdownMenuContext?.store,
variant: dropdownMenuContext?.variant
});
});
const DropdownMenuItemLabel = (0,external_wp_element_namespaceObject.forwardRef)(function DropdownMenuItemLabel(props, ref) {
return (0,external_React_.createElement)(styles_DropdownMenuItemLabel, {
numberOfLines: 1,
ref: ref,
...props
});
});
const DropdownMenuItemHelpText = (0,external_wp_element_namespaceObject.forwardRef)(function DropdownMenuItemHelpText(props, ref) {
return (0,external_React_.createElement)(styles_DropdownMenuItemHelpText, {
numberOfLines: 2,
ref: ref,
...props
});
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/theme/styles.js
function theme_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const colorVariables = ({
colors
}) => {
const shades = Object.entries(colors.gray || {}).map(([k, v]) => `--wp-components-color-gray-${k}: ${v};`).join('');
return [/*#__PURE__*/emotion_react_browser_esm_css("--wp-components-color-accent:", colors.accent, ";--wp-components-color-accent-darker-10:", colors.accentDarker10, ";--wp-components-color-accent-darker-20:", colors.accentDarker20, ";--wp-components-color-accent-inverted:", colors.accentInverted, ";--wp-components-color-background:", colors.background, ";--wp-components-color-foreground:", colors.foreground, ";--wp-components-color-foreground-inverted:", colors.foregroundInverted, ";", shades, ";" + ( true ? "" : 0), true ? "" : 0)];
};
const theme_styles_Wrapper = emotion_styled_base_browser_esm("div", true ? {
target: "e1krjpvb0"
} : 0)( true ? {
name: "1a3idx0",
styles: "color:var( --wp-components-color-foreground, currentColor )"
} : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/theme/color-algorithms.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
k([names, a11y]);
function generateThemeVariables(inputs) {
validateInputs(inputs);
const generatedColors = {
...generateAccentDependentColors(inputs.accent),
...generateBackgroundDependentColors(inputs.background)
};
warnContrastIssues(checkContrasts(inputs, generatedColors));
return {
colors: generatedColors
};
}
function validateInputs(inputs) {
for (const [key, value] of Object.entries(inputs)) {
if (typeof value !== 'undefined' && !w(value).isValid()) {
true ? external_wp_warning_default()(`wp.components.Theme: "${value}" is not a valid color value for the '${key}' prop.`) : 0;
}
}
}
function checkContrasts(inputs, outputs) {
const background = inputs.background || COLORS.white;
const accent = inputs.accent || '#3858e9';
const foreground = outputs.foreground || COLORS.gray[900];
const gray = outputs.gray || COLORS.gray;
return {
accent: w(background).isReadable(accent) ? undefined : `The background color ("${background}") does not have sufficient contrast against the accent color ("${accent}").`,
foreground: w(background).isReadable(foreground) ? undefined : `The background color provided ("${background}") does not have sufficient contrast against the standard foreground colors.`,
grays: w(background).contrast(gray[600]) >= 3 && w(background).contrast(gray[700]) >= 4.5 ? undefined : `The background color provided ("${background}") cannot generate a set of grayscale foreground colors with sufficient contrast. Try adjusting the color to be lighter or darker.`
};
}
function warnContrastIssues(issues) {
for (const error of Object.values(issues)) {
if (error) {
true ? external_wp_warning_default()('wp.components.Theme: ' + error) : 0;
}
}
}
function generateAccentDependentColors(accent) {
if (!accent) return {};
return {
accent,
accentDarker10: w(accent).darken(0.1).toHex(),
accentDarker20: w(accent).darken(0.2).toHex(),
accentInverted: getForegroundForColor(accent)
};
}
function generateBackgroundDependentColors(background) {
if (!background) return {};
const foreground = getForegroundForColor(background);
return {
background,
foreground,
foregroundInverted: getForegroundForColor(foreground),
gray: generateShades(background, foreground)
};
}
function getForegroundForColor(color) {
return w(color).isDark() ? COLORS.white : COLORS.gray[900];
}
function generateShades(background, foreground) {
// How much darkness you need to add to #fff to get the COLORS.gray[n] color
const SHADES = {
100: 0.06,
200: 0.121,
300: 0.132,
400: 0.2,
600: 0.42,
700: 0.543,
800: 0.821
};
// Darkness of COLORS.gray[ 900 ], relative to #fff
const limit = 0.884;
const direction = w(background).isDark() ? 'lighten' : 'darken';
// Lightness delta between the background and foreground colors
const range = Math.abs(w(background).toHsl().l - w(foreground).toHsl().l) / 100;
const result = {};
Object.entries(SHADES).forEach(([key, value]) => {
result[parseInt(key)] = w(background)[direction](value / limit * range).toHex();
});
return result;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/theme/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* `Theme` allows defining theme variables for components in the `@wordpress/components` package.
*
* Multiple `Theme` components can be nested in order to override specific theme variables.
*
*
* ```jsx
* const Example = () => {
* return (
* <Theme accent="red">
* <Button variant="primary">I'm red</Button>
* <Theme accent="blue">
* <Button variant="primary">I'm blue</Button>
* </Theme>
* </Theme>
* );
* };
* ```
*/
function Theme({
accent,
background,
className,
...props
}) {
const cx = useCx();
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(...colorVariables(generateThemeVariables({
accent,
background
})), className), [accent, background, className, cx]);
return (0,external_React_.createElement)(theme_styles_Wrapper, {
className: classes,
...props
});
}
/* harmony default export */ const theme = (Theme);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tabs/context.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const TabsContext = (0,external_wp_element_namespaceObject.createContext)(undefined);
const useTabsContext = () => (0,external_wp_element_namespaceObject.useContext)(TabsContext);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tabs/styles.js
function tabs_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* Internal dependencies
*/
const TabListWrapper = emotion_styled_base_browser_esm("div", true ? {
target: "enfox0g2"
} : 0)( true ? {
name: "xbm4q1",
styles: "display:flex;align-items:stretch;flex-direction:row;&[aria-orientation='vertical']{flex-direction:column;}"
} : 0);
const styles_Tab = /*#__PURE__*/emotion_styled_base_browser_esm(Tab, true ? {
target: "enfox0g1"
} : 0)("&{display:inline-flex;align-items:center;position:relative;border-radius:0;height:", space(12), ";background:transparent;border:none;box-shadow:none;cursor:pointer;padding:3px ", space(4), ";margin-left:0;font-weight:500;&[aria-disabled='true']{cursor:default;opacity:0.3;}&:hover{color:", COLORS.theme.accent, ";}&:focus:not( :disabled ){position:relative;box-shadow:none;outline:none;}&::after{content:'';position:absolute;right:0;bottom:0;left:0;pointer-events:none;background:", COLORS.theme.accent, ";height:calc( 0 * var( --wp-admin-border-width-focus ) );border-radius:0;transition:all 0.1s linear;", reduceMotion('transition'), ";}&[aria-selected='true']::after{height:calc( 1 * var( --wp-admin-border-width-focus ) );outline:2px solid transparent;outline-offset:-1px;}&::before{content:'';position:absolute;top:", space(3), ";right:", space(3), ";bottom:", space(3), ";left:", space(3), ";pointer-events:none;box-shadow:0 0 0 0 transparent;border-radius:2px;transition:all 0.1s linear;", reduceMotion('transition'), ";}&:focus-visible::before{box-shadow:0 0 0 var( --wp-admin-border-width-focus ) ", COLORS.theme.accent, ";outline:2px solid transparent;}}" + ( true ? "" : 0));
const styles_TabPanel = /*#__PURE__*/emotion_styled_base_browser_esm(TabPanel, true ? {
target: "enfox0g0"
} : 0)("&:focus{box-shadow:none;outline:none;}&:focus-visible{border-radius:2px;box-shadow:0 0 0 var( --wp-admin-border-width-focus ) ", COLORS.theme.accent, ";outline:2px solid transparent;outline-offset:0;}" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tabs/tab.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const tab_Tab = (0,external_wp_element_namespaceObject.forwardRef)(function Tab({
children,
tabId,
disabled,
render,
...otherProps
}, ref) {
const context = useTabsContext();
if (!context) {
true ? external_wp_warning_default()('`Tabs.Tab` must be wrapped in a `Tabs` component.') : 0;
return null;
}
const {
store,
instanceId
} = context;
const instancedTabId = `${instanceId}-${tabId}`;
return (0,external_React_.createElement)(styles_Tab, {
ref: ref,
store: store,
id: instancedTabId,
disabled: disabled,
render: render,
...otherProps
}, children);
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tabs/tablist.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const TabList = (0,external_wp_element_namespaceObject.forwardRef)(function TabList({
children,
...otherProps
}, ref) {
const context = useTabsContext();
if (!context) {
true ? external_wp_warning_default()('`Tabs.TabList` must be wrapped in a `Tabs` component.') : 0;
return null;
}
const {
store
} = context;
const {
selectedId,
activeId,
selectOnMove
} = store.useState();
const {
setActiveId
} = store;
const onBlur = () => {
if (!selectOnMove) {
return;
}
// When automatic tab selection is on, make sure that the active tab is up
// to date with the selected tab when leaving the tablist. This makes sure
// that the selected tab will receive keyboard focus when tabbing back into
// the tablist.
if (selectedId !== activeId) {
setActiveId(selectedId);
}
};
return (0,external_React_.createElement)(tab_list_TabList, {
ref: ref,
store: store,
render: (0,external_React_.createElement)(TabListWrapper, null),
onBlur: onBlur,
...otherProps
}, children);
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tabs/tabpanel.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const tabpanel_TabPanel = (0,external_wp_element_namespaceObject.forwardRef)(function TabPanel({
children,
tabId,
focusable = true,
...otherProps
}, ref) {
const context = useTabsContext();
if (!context) {
true ? external_wp_warning_default()('`Tabs.TabPanel` must be wrapped in a `Tabs` component.') : 0;
return null;
}
const {
store,
instanceId
} = context;
const instancedTabId = `${instanceId}-${tabId}`;
const selectedId = store.useState(state => state.selectedId);
return (0,external_React_.createElement)(styles_TabPanel, {
ref: ref,
store: store
// For TabPanel, the id passed here is the id attribute of the DOM
// element.
// `tabId` is the id of the tab that controls this panel.
,
id: `${instancedTabId}-view`,
tabId: instancedTabId,
focusable: focusable,
...otherProps
}, selectedId === instancedTabId && children);
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tabs/index.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Tabs({
selectOnMove = true,
initialTabId,
orientation = 'horizontal',
onSelect,
children,
selectedTabId
}) {
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Tabs, 'tabs');
const store = useTabStore({
selectOnMove,
orientation,
defaultSelectedId: initialTabId && `${instanceId}-${initialTabId}`,
setSelectedId: selectedId => {
const strippedDownId = typeof selectedId === 'string' ? selectedId.replace(`${instanceId}-`, '') : selectedId;
onSelect?.(strippedDownId);
},
selectedId: selectedTabId && `${instanceId}-${selectedTabId}`
});
const isControlled = selectedTabId !== undefined;
const {
items,
selectedId,
activeId
} = store.useState();
const {
setSelectedId,
setActiveId
} = store;
// Keep track of whether tabs have been populated. This is used to prevent
// certain effects from firing too early while tab data and relevant
// variables are undefined during the initial render.
const tabsHavePopulated = (0,external_wp_element_namespaceObject.useRef)(false);
if (items.length > 0) {
tabsHavePopulated.current = true;
}
const selectedTab = items.find(item => item.id === selectedId);
const firstEnabledTab = items.find(item => {
// Ariakit internally refers to disabled tabs as `dimmed`.
return !item.dimmed;
});
const initialTab = items.find(item => item.id === `${instanceId}-${initialTabId}`);
// Handle selecting the initial tab.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (isControlled) {
return;
}
// Wait for the denoted initial tab to be declared before making a
// selection. This ensures that if a tab is declared lazily it can
// still receive initial selection, as well as ensuring no tab is
// selected if an invalid `initialTabId` is provided.
if (initialTabId && !initialTab) {
return;
}
// If the currently selected tab is missing (i.e. removed from the DOM),
// fall back to the initial tab or the first enabled tab if there is
// one. Otherwise, no tab should be selected.
if (!items.find(item => item.id === selectedId)) {
if (initialTab && !initialTab.dimmed) {
setSelectedId(initialTab?.id);
return;
}
if (firstEnabledTab) {
setSelectedId(firstEnabledTab.id);
} else if (tabsHavePopulated.current) {
setSelectedId(null);
}
}
}, [firstEnabledTab, initialTab, initialTabId, isControlled, items, selectedId, setSelectedId]);
// Handle the currently selected tab becoming disabled.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (!selectedTab?.dimmed) {
return;
}
// In controlled mode, we trust that disabling tabs is done
// intentionally, and don't select a new tab automatically.
if (isControlled) {
setSelectedId(null);
return;
}
// If the currently selected tab becomes disabled, fall back to the
// `initialTabId` if possible. Otherwise select the first
// enabled tab (if there is one).
if (initialTab && !initialTab.dimmed) {
setSelectedId(initialTab.id);
return;
}
if (firstEnabledTab) {
setSelectedId(firstEnabledTab.id);
}
}, [firstEnabledTab, initialTab, isControlled, selectedTab?.dimmed, setSelectedId]);
// Clear `selectedId` if the active tab is removed from the DOM in controlled mode.
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
if (!isControlled) {
return;
}
// Once the tabs have populated, if the `selectedTabId` still can't be
// found, clear the selection.
if (tabsHavePopulated.current && !!selectedTabId && !selectedTab) {
setSelectedId(null);
}
}, [isControlled, selectedTab, selectedTabId, setSelectedId]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!isControlled) {
return;
}
requestAnimationFrame(() => {
const focusedElement = items?.[0]?.element?.ownerDocument.activeElement;
if (!focusedElement || !items.some(item => focusedElement === item.element)) {
return; // Return early if no tabs are focused.
}
// If, after ariakit re-computes the active tab, that tab doesn't match
// the currently focused tab, then we force an update to ariakit to avoid
// any mismatches, especially when navigating to previous/next tab with
// arrow keys.
if (activeId !== focusedElement.id) {
setActiveId(focusedElement.id);
}
});
}, [activeId, isControlled, items, setActiveId]);
const contextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
store,
instanceId
}), [store, instanceId]);
return (0,external_React_.createElement)(TabsContext.Provider, {
value: contextValue
}, children);
}
Tabs.TabList = TabList;
Tabs.Tab = tab_Tab;
Tabs.TabPanel = tabpanel_TabPanel;
Tabs.Context = TabsContext;
/* harmony default export */ const tabs = (Tabs);
;// CONCATENATED MODULE: external ["wp","privateApis"]
const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/lock-unlock.js
/**
* WordPress dependencies
*/
const {
lock,
unlock
} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/components');
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/private-apis.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const privateApis = {};
lock(privateApis, {
CompositeV2: Composite,
CompositeGroupV2: CompositeGroup,
CompositeItemV2: CompositeItem,
CompositeRowV2: CompositeRow,
useCompositeStoreV2: useCompositeStore,
CustomSelectControl: CustomSelectControl,
__experimentalPopoverLegacyPositionToPlacement: positionToPlacement,
createPrivateSlotFill: createPrivateSlotFill,
ComponentsContext: ComponentsContext,
ProgressBar: progress_bar,
Tabs: tabs,
Theme: theme,
DropdownMenuV2: dropdown_menu_v2_DropdownMenu,
DropdownMenuGroupV2: DropdownMenuGroup,
DropdownMenuItemV2: DropdownMenuItem,
DropdownMenuCheckboxItemV2: DropdownMenuCheckboxItem,
DropdownMenuRadioItemV2: DropdownMenuRadioItem,
DropdownMenuSeparatorV2: DropdownMenuSeparator,
DropdownMenuItemLabelV2: DropdownMenuItemLabel,
DropdownMenuItemHelpTextV2: DropdownMenuItemHelpText,
kebabCase: kebabCase
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/index.js
// Primitives.
// Components.
// Higher-Order Components.
// Private APIs.
})();
(window.wp = window.wp || {}).components = __webpack_exports__;
/******/ })()
;/*! This file is auto-generated */
(()=>{var e,t,n={5755:(e,t)=>{var n;
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)){if(n.length){var a=o.apply(null,n);a&&e.push(a)}}else if("object"===i){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var s in n)r.call(n,s)&&n[s]&&e.push(s)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},66:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)};var n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return r(e,n)}))}function i(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function a(e,t){try{return t in e}catch(e){return!1}}function s(e,t,n){var o={};return n.isMergeableObject(e)&&i(e).forEach((function(t){o[t]=r(e[t],n)})),i(t).forEach((function(i){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(a(e,i)&&n.isMergeableObject(t[i])?o[i]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(i,n)(e[i],t[i],n):o[i]=r(t[i],n))})),o}function l(e,n,i){(i=i||{}).arrayMerge=i.arrayMerge||o,i.isMergeableObject=i.isMergeableObject||t,i.cloneUnlessOtherwiseSpecified=r;var a=Array.isArray(n);return a===Array.isArray(e)?a?i.arrayMerge(e,n,i):s(e,n,i):r(n,i)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var c=l;e.exports=c},1637:(e,t,n)=>{"use strict";var r=n(3062);e.exports=function(e,t,n){n=n||{},9===t.nodeType&&(t=r.getWindow(t));var o=n.allowHorizontalScroll,i=n.onlyScrollIfNeeded,a=n.alignWithTop,s=n.alignWithLeft,l=n.offsetTop||0,c=n.offsetLeft||0,u=n.offsetBottom||0,d=n.offsetRight||0;o=void 0===o||o;var f=r.isWindow(t),m=r.offset(e),p=r.outerHeight(e),h=r.outerWidth(e),g=void 0,v=void 0,b=void 0,y=void 0,x=void 0,w=void 0,E=void 0,_=void 0,S=void 0,C=void 0;f?(E=t,C=r.height(E),S=r.width(E),_={left:r.scrollLeft(E),top:r.scrollTop(E)},x={left:m.left-_.left-c,top:m.top-_.top-l},w={left:m.left+h-(_.left+S)+d,top:m.top+p-(_.top+C)+u},y=_):(g=r.offset(t),v=t.clientHeight,b=t.clientWidth,y={left:t.scrollLeft,top:t.scrollTop},x={left:m.left-(g.left+(parseFloat(r.css(t,"borderLeftWidth"))||0))-c,top:m.top-(g.top+(parseFloat(r.css(t,"borderTopWidth"))||0))-l},w={left:m.left+h-(g.left+b+(parseFloat(r.css(t,"borderRightWidth"))||0))+d,top:m.top+p-(g.top+v+(parseFloat(r.css(t,"borderBottomWidth"))||0))+u}),x.top<0||w.top>0?!0===a?r.scrollTop(t,y.top+x.top):!1===a?r.scrollTop(t,y.top+w.top):x.top<0?r.scrollTop(t,y.top+x.top):r.scrollTop(t,y.top+w.top):i||((a=void 0===a||!!a)?r.scrollTop(t,y.top+x.top):r.scrollTop(t,y.top+w.top)),o&&(x.left<0||w.left>0?!0===s?r.scrollLeft(t,y.left+x.left):!1===s?r.scrollLeft(t,y.left+w.left):x.left<0?r.scrollLeft(t,y.left+x.left):r.scrollLeft(t,y.left+w.left):i||((s=void 0===s||!!s)?r.scrollLeft(t,y.left+x.left):r.scrollLeft(t,y.left+w.left)))}},5428:(e,t,n)=>{"use strict";e.exports=n(1637)},3062:e=>{"use strict";var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};function r(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],r="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;"number"!=typeof(n=o.documentElement[r])&&(n=o.body[r])}return n}function o(e){return r(e)}function i(e){return r(e,!0)}function a(e){var t=function(e){var t,n=void 0,r=void 0,o=e.ownerDocument,i=o.body,a=o&&o.documentElement;return n=(t=e.getBoundingClientRect()).left,r=t.top,{left:n-=a.clientLeft||i.clientLeft||0,top:r-=a.clientTop||i.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=o(r),t.top+=i(r),t}var s=new RegExp("^("+/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source+")(?!px)[a-z%]+$","i"),l=/^(top|right|bottom|left)$/,c="currentStyle",u="runtimeStyle",d="left";var f=void 0;function m(e,t){for(var n=0;n<e.length;n++)t(e[n])}function p(e){return"border-box"===f(e,"boxSizing")}"undefined"!=typeof window&&(f=window.getComputedStyle?function(e,t,n){var r="",o=e.ownerDocument,i=n||o.defaultView.getComputedStyle(e,null);return i&&(r=i.getPropertyValue(t)||i[t]),r}:function(e,t){var n=e[c]&&e[c][t];if(s.test(n)&&!l.test(t)){var r=e.style,o=r[d],i=e[u][d];e[u][d]=e[c][d],r[d]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[d]=o,e[u][d]=i}return""===n?"auto":n});var h=["margin","border","padding"],g=-1,v=2,b=1;function y(e,t,n){var r=0,o=void 0,i=void 0,a=void 0;for(i=0;i<t.length;i++)if(o=t[i])for(a=0;a<n.length;a++){var s=void 0;s="border"===o?o+n[a]+"Width":o+n[a],r+=parseFloat(f(e,s))||0}return r}function x(e){return null!=e&&e==e.window}var w={};function E(e,t,n){if(x(e))return"width"===t?w.viewportWidth(e):w.viewportHeight(e);if(9===e.nodeType)return"width"===t?w.docWidth(e):w.docHeight(e);var r="width"===t?["Left","Right"]:["Top","Bottom"],o="width"===t?e.offsetWidth:e.offsetHeight,i=(f(e),p(e)),a=0;(null==o||o<=0)&&(o=void 0,(null==(a=f(e,t))||Number(a)<0)&&(a=e.style[t]||0),a=parseFloat(a)||0),void 0===n&&(n=i?b:g);var s=void 0!==o||i,l=o||a;if(n===g)return s?l-y(e,["border","padding"],r):a;if(s){var c=n===v?-y(e,["border"],r):y(e,["margin"],r);return l+(n===b?0:c)}return a+y(e,h.slice(n),r)}m(["Width","Height"],(function(e){w["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],w["viewport"+e](n))},w["viewport"+e]=function(t){var n="client"+e,r=t.document,o=r.body,i=r.documentElement[n];return"CSS1Compat"===r.compatMode&&i||o&&o[n]||i}}));var _={position:"absolute",visibility:"hidden",display:"block"};function S(e){var t=void 0,n=arguments;return 0!==e.offsetWidth?t=E.apply(void 0,n):function(e,t,n){var r={},o=e.style,i=void 0;for(i in t)t.hasOwnProperty(i)&&(r[i]=o[i],o[i]=t[i]);for(i in n.call(e),t)t.hasOwnProperty(i)&&(o[i]=r[i])}(e,_,(function(){t=E.apply(void 0,n)})),t}function C(e,t,r){var o=r;if("object"!==(void 0===t?"undefined":n(t)))return void 0!==o?("number"==typeof o&&(o+="px"),void(e.style[t]=o)):f(e,t);for(var i in t)t.hasOwnProperty(i)&&C(e,i,t[i])}m(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);w["outer"+t]=function(t,n){return t&&S(t,e,n?0:b)};var n="width"===e?["Left","Right"]:["Top","Bottom"];w[e]=function(t,r){if(void 0===r)return t&&S(t,e,g);if(t){f(t);return p(t)&&(r+=y(t,["padding","border"],n)),C(t,e,r)}}})),e.exports=t({getWindow:function(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t){if(void 0===t)return a(e);!function(e,t){"static"===C(e,"position")&&(e.style.position="relative");var n=a(e),r={},o=void 0,i=void 0;for(i in t)t.hasOwnProperty(i)&&(o=parseFloat(C(e,i))||0,r[i]=o+t[i]-n[i]);C(e,r)}(e,t)},isWindow:x,each:m,css:C,clone:function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);if(e.overflow)for(var n in e)e.hasOwnProperty(n)&&(t.overflow[n]=e.overflow[n]);return t},scrollLeft:function(e,t){if(x(e)){if(void 0===t)return o(e);window.scrollTo(t,i(e))}else{if(void 0===t)return e.scrollLeft;e.scrollLeft=t}},scrollTop:function(e,t){if(x(e)){if(void 0===t)return i(e);window.scrollTo(o(e),t)}else{if(void 0===t)return e.scrollTop;e.scrollTop=t}},viewportWidth:0,viewportHeight:0},w)},2287:(e,t)=>{"use strict";var n=60103,r=60106,o=60107,i=60108,a=60114,s=60109,l=60110,c=60112,u=60113,d=60120,f=60115,m=60116,p=60121,h=60122,g=60117,v=60129,b=60131;
/** @license React v17.0.2
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/if("function"==typeof Symbol&&Symbol.for){var y=Symbol.for;n=y("react.element"),r=y("react.portal"),o=y("react.fragment"),i=y("react.strict_mode"),a=y("react.profiler"),s=y("react.provider"),l=y("react.context"),c=y("react.forward_ref"),u=y("react.suspense"),d=y("react.suspense_list"),f=y("react.memo"),m=y("react.lazy"),p=y("react.block"),h=y("react.server.block"),g=y("react.fundamental"),v=y("react.debug_trace_mode"),b=y("react.legacy_hidden")}function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case o:case a:case i:case u:case d:return e;default:switch(e=e&&e.$$typeof){case l:case c:case m:case f:case s:return e;default:return t}}case r:return t}}}},1915:(e,t,n)=>{"use strict";n(2287)},7734:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,o,i;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;for(o of t.entries())if(!e(o[1],n.get(o[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(o of t.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((r=t.length)!=n.length)return!1;for(o=r;0!=o--;)if(t[o]!==n[o])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;0!=o--;){var a=i[o];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}},8924:(e,t)=>{var n={};n.parse=function(){var e={linearGradient:/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,repeatingLinearGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,radialGradient:/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,repeatingRadialGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},t="";function n(e){var n=new Error(t+": "+e);throw n.source=t,n}function r(){var e=f(o);return t.length>0&&n("Invalid input not EOF"),e}function o(){return i("linear-gradient",e.linearGradient,s)||i("repeating-linear-gradient",e.repeatingLinearGradient,s)||i("radial-gradient",e.radialGradient,l)||i("repeating-radial-gradient",e.repeatingRadialGradient,l)}function i(t,r,o){return a(r,(function(r){var i=o();return i&&(b(e.comma)||n("Missing comma before color stops")),{type:t,orientation:i,colorStops:f(m)}}))}function a(t,r){var o=b(t);if(o)return b(e.startCall)||n("Missing ("),result=r(o),b(e.endCall)||n("Missing )"),result}function s(){return v("directional",e.sideOrCorner,1)||v("angular",e.angleValue,1)}function l(){var n,r,o=c();return o&&((n=[]).push(o),r=t,b(e.comma)&&((o=c())?n.push(o):t=r)),n}function c(){var e=function(){var e=v("shape",/^(circle)/i,0);e&&(e.style=g()||u());return e}()||function(){var e=v("shape",/^(ellipse)/i,0);e&&(e.style=h()||u());return e}();if(e)e.at=function(){if(v("position",/^at/,0)){var e=d();return e||n("Missing positioning value"),e}}();else{var t=d();t&&(e={type:"default-radial",at:t})}return e}function u(){return v("extent-keyword",e.extentKeywords,1)}function d(){var e={x:h(),y:h()};if(e.x||e.y)return{type:"position",value:e}}function f(t){var r=t(),o=[];if(r)for(o.push(r);b(e.comma);)(r=t())?o.push(r):n("One extra comma");return o}function m(){var t=v("hex",e.hexColor,1)||a(e.rgbaColor,(function(){return{type:"rgba",value:f(p)}}))||a(e.rgbColor,(function(){return{type:"rgb",value:f(p)}}))||v("literal",e.literalColor,0);return t||n("Expected color definition"),t.length=h(),t}function p(){return b(e.number)[1]}function h(){return v("%",e.percentageValue,1)||v("position-keyword",e.positionKeywords,1)||g()}function g(){return v("px",e.pixelValue,1)||v("em",e.emValue,1)}function v(e,t,n){var r=b(t);if(r)return{type:e,value:r[n]}}function b(e){var n,r;return(r=/^[\n\r\t\s]+/.exec(t))&&y(r[0].length),(n=e.exec(t))&&y(n[0].length),n}function y(e){t=t.substr(e)}return function(e){return t=e.toString(),r()}}(),t.parse=(n||{}).parse},9664:e=>{e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);Object.defineProperty(t,"combineChunks",{enumerable:!0,get:function(){return r.combineChunks}}),Object.defineProperty(t,"fillInChunks",{enumerable:!0,get:function(){return r.fillInChunks}}),Object.defineProperty(t,"findAll",{enumerable:!0,get:function(){return r.findAll}}),Object.defineProperty(t,"findChunks",{enumerable:!0,get:function(){return r.findChunks}})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.findAll=function(e){var t=e.autoEscape,i=e.caseSensitive,a=void 0!==i&&i,s=e.findChunks,l=void 0===s?r:s,c=e.sanitize,u=e.searchWords,d=e.textToHighlight;return o({chunksToHighlight:n({chunks:l({autoEscape:t,caseSensitive:a,sanitize:c,searchWords:u,textToHighlight:d})}),totalLength:d?d.length:0})};var n=t.combineChunks=function(e){var t=e.chunks;return t=t.sort((function(e,t){return e.start-t.start})).reduce((function(e,t){if(0===e.length)return[t];var n=e.pop();if(t.start<=n.end){var r=Math.max(n.end,t.end);e.push({highlight:!1,start:n.start,end:r})}else e.push(n,t);return e}),[])},r=function(e){var t=e.autoEscape,n=e.caseSensitive,r=e.sanitize,o=void 0===r?i:r,a=e.searchWords,s=e.textToHighlight;return s=o(s),a.filter((function(e){return e})).reduce((function(e,r){r=o(r),t&&(r=r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"));for(var i=new RegExp(r,n?"g":"gi"),a=void 0;a=i.exec(s);){var l=a.index,c=i.lastIndex;c>l&&e.push({highlight:!1,start:l,end:c}),a.index===i.lastIndex&&i.lastIndex++}return e}),[])};t.findChunks=r;var o=t.fillInChunks=function(e){var t=e.chunksToHighlight,n=e.totalLength,r=[],o=function(e,t,n){t-e>0&&r.push({start:e,end:t,highlight:n})};if(0===t.length)o(0,n,!1);else{var i=0;t.forEach((function(e){o(i,e.start,!1),o(e.start,e.end,!0),i=e.end})),o(i,n,!1)}return r};function i(e){return e}}])},1880:(e,t,n)=>{"use strict";var r=n(1178),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};function l(e){return r.isMemo(e)?a:s[e.$$typeof]||o}s[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s[r.Memo]=a;var c=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,m=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(p){var o=m(n);o&&o!==p&&e(t,o,r)}var a=u(n);d&&(a=a.concat(d(n)));for(var s=l(t),h=l(n),g=0;g<a.length;++g){var v=a[g];if(!(i[v]||r&&r[v]||h&&h[v]||s&&s[v])){var b=f(n,v);try{c(t,v,b)}catch(e){}}}}return t}},2950:(e,t)=>{"use strict";
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,i=n?Symbol.for("react.fragment"):60107,a=n?Symbol.for("react.strict_mode"):60108,s=n?Symbol.for("react.profiler"):60114,l=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,d=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,m=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,v=n?Symbol.for("react.block"):60121,b=n?Symbol.for("react.fundamental"):60117,y=n?Symbol.for("react.responder"):60118,x=n?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case d:case i:case s:case a:case m:return e;default:switch(e=e&&e.$$typeof){case c:case f:case g:case h:case l:return e;default:return t}}case o:return t}}}function E(e){return w(e)===d}t.AsyncMode=u,t.ConcurrentMode=d,t.ContextConsumer=c,t.ContextProvider=l,t.Element=r,t.ForwardRef=f,t.Fragment=i,t.Lazy=g,t.Memo=h,t.Portal=o,t.Profiler=s,t.StrictMode=a,t.Suspense=m,t.isAsyncMode=function(e){return E(e)||w(e)===u},t.isConcurrentMode=E,t.isContextConsumer=function(e){return w(e)===c},t.isContextProvider=function(e){return w(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===f},t.isFragment=function(e){return w(e)===i},t.isLazy=function(e){return w(e)===g},t.isMemo=function(e){return w(e)===h},t.isPortal=function(e){return w(e)===o},t.isProfiler=function(e){return w(e)===s},t.isStrictMode=function(e){return w(e)===a},t.isSuspense=function(e){return w(e)===m},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===d||e===s||e===a||e===m||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===l||e.$$typeof===c||e.$$typeof===f||e.$$typeof===b||e.$$typeof===y||e.$$typeof===x||e.$$typeof===v)},t.typeOf=w},1178:(e,t,n)=>{"use strict";e.exports=n(2950)},628:(e,t,n)=>{"use strict";var r=n(4067);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var s=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");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},5826:(e,t,n)=>{e.exports=n(628)()},4067:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},3394:(e,t,n)=>{"use strict";
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var r=n(1609),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var r,i={},c=null,u=null;for(r in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,r)&&!l.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:c,ref:u,props:i,_owner:s.current}}t.Fragment=i,t.jsx=c,t.jsxs=c},4922:(e,t,n)=>{"use strict";e.exports=n(3394)},9681:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},n=Object.keys(t).join("|"),r=new RegExp(n,"g"),o=new RegExp(n,"");function i(e){return t[e]}var a=function(e){return e.replace(r,i)};e.exports=a,e.exports.has=function(e){return!!e.match(o)},e.exports.remove=a},8477:(e,t,n)=>{"use strict";
/**
* @license React
* use-sync-external-store-shim.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var r=n(1609);var o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,a=r.useEffect,s=r.useLayoutEffect,l=r.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return s((function(){o.value=n,o.getSnapshot=t,c(o)&&u({inst:o})}),[e,n,t]),a((function(){return c(o)&&u({inst:o}),e((function(){c(o)&&u({inst:o})}))}),[e]),l(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},422:(e,t,n)=>{"use strict";e.exports=n(8477)},1609:e=>{"use strict";e.exports=window.React}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={exports:{}};return n[e](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var i=Object.create(null);o.r(i);var a={};e=e||[null,t({}),t([]),t(t)];for(var s=2&r&&n;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>a[e]=()=>n[e]));return a.default=()=>n,o.d(i,a),i},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nc=void 0;var i={};(()=>{"use strict";o.r(i),o.d(i,{AnglePickerControl:()=>zy,Animate:()=>vl,Autocomplete:()=>Sw,BaseControl:()=>iy,BlockQuotation:()=>n.BlockQuotation,Button:()=>my,ButtonGroup:()=>Ok,Card:()=>gP,CardBody:()=>kP,CardDivider:()=>AP,CardFooter:()=>zP,CardHeader:()=>FP,CardMedia:()=>jP,CheckboxControl:()=>VP,Circle:()=>n.Circle,ClipboardButton:()=>$P,ColorIndicator:()=>DE,ColorPalette:()=>JS,ColorPicker:()=>MS,ComboboxControl:()=>II,CustomGradientPicker:()=>OT,CustomSelectControl:()=>EM,Dashicon:()=>cy,DatePicker:()=>fD,DateTimePicker:()=>AD,Disabled:()=>HD,Draggable:()=>UD,DropZone:()=>qD,DropZoneProvider:()=>YD,Dropdown:()=>FE,DropdownMenu:()=>QT,DuotonePicker:()=>nA,DuotoneSwatch:()=>ZD,ExternalLink:()=>iA,Fill:()=>cw,Flex:()=>$h,FlexBlock:()=>Uh,FlexItem:()=>og,FocalPointPicker:()=>MA,FocusReturnProvider:()=>oj,FocusableIframe:()=>NA,FontSizePicker:()=>YA,FormFileUpload:()=>KA,FormToggle:()=>ZA,FormTokenField:()=>rO,G:()=>n.G,GradientPicker:()=>jT,Guide:()=>aO,GuidePage:()=>sO,HorizontalRule:()=>n.HorizontalRule,Icon:()=>uy,IconButton:()=>lO,IsolatedEventContainer:()=>HB,KeyboardShortcuts:()=>mO,Line:()=>n.Line,MenuGroup:()=>pO,MenuItem:()=>gO,MenuItemsChoice:()=>bO,Modal:()=>qI,NavigableMenu:()=>KT,Notice:()=>jz,NoticeList:()=>Hz,Panel:()=>Wz,PanelBody:()=>Kz,PanelHeader:()=>$z,PanelRow:()=>Xz,Path:()=>n.Path,Placeholder:()=>Jz,Polygon:()=>n.Polygon,Popover:()=>bw,QueryControls:()=>lL,RadioControl:()=>pL,RangeControl:()=>k_,Rect:()=>n.Rect,ResizableBox:()=>QL,ResponsiveWrapper:()=>eF,SVG:()=>n.SVG,SandBox:()=>nF,ScrollLock:()=>ox,SearchControl:()=>cz,SelectControl:()=>YE,Slot:()=>uw,SlotFillProvider:()=>dw,Snackbar:()=>oF,SnackbarList:()=>aF,Spinner:()=>fF,TabPanel:()=>TF,TabbableContainer:()=>yO,TextControl:()=>RF,TextHighlight:()=>FF,TextareaControl:()=>LF,TimePicker:()=>RD,Tip:()=>jF,ToggleControl:()=>VF,Toolbar:()=>aB,ToolbarButton:()=>ZF,ToolbarDropdownMenu:()=>sB,ToolbarGroup:()=>eB,ToolbarItem:()=>KF,Tooltip:()=>ri,TreeSelect:()=>rL,VisuallyHidden:()=>ws,__experimentalAlignmentMatrixControl:()=>pl,__experimentalApplyValueToSides:()=>_k,__experimentalBorderBoxControl:()=>ZC,__experimentalBorderControl:()=>NC,__experimentalBoxControl:()=>Ak,__experimentalConfirmDialog:()=>KI,__experimentalDimensionControl:()=>zD,__experimentalDivider:()=>NP,__experimentalDropdownContentWrapper:()=>GS,__experimentalElevation:()=>Bk,__experimentalGrid:()=>OC,__experimentalHStack:()=>Py,__experimentalHasSplitBorders:()=>WC,__experimentalHeading:()=>$S,__experimentalInputControl:()=>ly,__experimentalInputControlPrefixWrapper:()=>dO,__experimentalInputControlSuffixWrapper:()=>BE,__experimentalIsDefinedBorder:()=>$C,__experimentalIsEmptyBorder:()=>HC,__experimentalItem:()=>uO,__experimentalItemGroup:()=>aT,__experimentalNavigation:()=>jO,__experimentalNavigationBackButton:()=>WO,__experimentalNavigationGroup:()=>qO,__experimentalNavigationItem:()=>nz,__experimentalNavigationMenu:()=>mz,__experimentalNavigatorBackButton:()=>zz,__experimentalNavigatorButton:()=>Az,__experimentalNavigatorProvider:()=>Tz,__experimentalNavigatorScreen:()=>Mz,__experimentalNavigatorToParentButton:()=>Lz,__experimentalNumberControl:()=>Ry,__experimentalPaletteEdit:()=>gI,__experimentalParseQuantityAndUnitFromRawValue:()=>xC,__experimentalRadio:()=>dL,__experimentalRadioGroup:()=>mL,__experimentalScrollable:()=>SP,__experimentalSpacer:()=>tg,__experimentalStyleProvider:()=>ew,__experimentalSurface:()=>mF,__experimentalText:()=>mv,__experimentalToggleGroupControl:()=>fE,__experimentalToggleGroupControlOption:()=>$A,__experimentalToggleGroupControlOptionIcon:()=>RE,__experimentalToolbarContext:()=>YF,__experimentalToolsPanel:()=>PB,__experimentalToolsPanelContext:()=>bB,__experimentalToolsPanelItem:()=>RB,__experimentalTreeGrid:()=>zB,__experimentalTreeGridCell:()=>jB,__experimentalTreeGridItem:()=>BB,__experimentalTreeGridRow:()=>LB,__experimentalTruncate:()=>VS,__experimentalUnitControl:()=>PC,__experimentalUseCustomUnits:()=>wC,__experimentalUseNavigator:()=>Nz,__experimentalUseSlot:()=>zx,__experimentalUseSlotFills:()=>$B,__experimentalVStack:()=>jS,__experimentalView:()=>xs,__experimentalZStack:()=>YB,__unstableAnimatePresence:()=>Ih,__unstableComposite:()=>LI,__unstableCompositeGroup:()=>FI,__unstableCompositeItem:()=>BI,__unstableDisclosureContent:()=>$D,__unstableGetAnimateClassName:()=>gl,__unstableMotion:()=>wh,__unstableMotionContext:()=>yl,__unstableUseAutocompleteProps:()=>_w,__unstableUseCompositeState:()=>jI,__unstableUseNavigateRegions:()=>XB,createSlotFill:()=>fw,navigateRegions:()=>ZB,privateApis:()=>_H,useBaseControlProps:()=>Cw,withConstrainedTabbing:()=>JB,withFallbackStyles:()=>QB,withFilters:()=>nj,withFocusOutside:()=>CI,withFocusReturn:()=>rj,withNotices:()=>ij,withSpokenMessages:()=>oz});var e={};o.r(e),o.d(e,{Text:()=>Zg,block:()=>Jg,destructive:()=>ev,highlighterText:()=>nv,muted:()=>tv,positive:()=>Qg,upperCase:()=>rv});var t={};o.r(t),o.d(t,{ButtonContentView:()=>xE,LabelView:()=>hE,ou:()=>EE,uG:()=>vE,eh:()=>gE});const n=window.wp.primitives;var r=o(1609),a=o.t(r,2),s=o.n(r),l=o(5755),c=o.n(l);const u=window.wp.i18n,d=window.wp.compose;var f=(0,r.createContext)(!0),m=Object.defineProperty,p=Object.defineProperties,h=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable,y=(e,t,n)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,x=(e,t)=>{for(var n in t||(t={}))v.call(t,n)&&y(e,n,t[n]);if(g)for(var n of g(t))b.call(t,n)&&y(e,n,t[n]);return e},w=(e,t)=>p(e,h(t)),E=(e,t)=>{var n={};for(var r in e)v.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&g)for(var r of g(e))t.indexOf(r)<0&&b.call(e,r)&&(n[r]=e[r]);return n},_=Object.defineProperty,S=Object.defineProperties,C=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,I=(e,t,n)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R=(e,t)=>{for(var n in t||(t={}))P.call(t,n)&&I(e,n,t[n]);if(k)for(var n of k(t))T.call(t,n)&&I(e,n,t[n]);return e},M=(e,t)=>S(e,C(t)),N=(e,t)=>{var n={};for(var r in e)P.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&k)for(var r of k(e))t.indexOf(r)<0&&T.call(e,r)&&(n[r]=e[r]);return n};function D(...e){}function A(e,t){if(function(e){return"function"==typeof e}(e)){return e(function(e){return"function"==typeof e}(t)?t():t)}return e}function O(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function z(...e){return(...t)=>{for(const n of e)"function"==typeof n&&n(...t)}}function L(e){return e}function F(e,t){if(!e){if("string"!=typeof t)throw new Error("Invariant failed");throw new Error(t)}}function B(e,...t){const n="function"==typeof e?e(...t):e;return null!=n&&!n}function j(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function V(...e){for(const t of e)if(void 0!==t)return t}function H(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function $(e){return function(e){return!!e&&!!(0,r.isValidElement)(e)&&"ref"in e}(e)?e.ref:null}var W,U="undefined"!=typeof window&&!!(null==(W=window.document)?void 0:W.createElement);function G(e){return e?e.ownerDocument||e:document}function q(e,t=!1){const{activeElement:n}=G(e);if(!(null==n?void 0:n.nodeName))return null;if(K(n)&&n.contentDocument)return q(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=G(n).getElementById(e);if(t)return t}}return n}function Y(e,t){return e===t||e.contains(t)}function K(e){return"IFRAME"===e.tagName}function X(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==Z.indexOf(e.type)}var Z=["button","color","file","image","reset","submit"];function J(e,t){return"matches"in e?e.matches(t):"msMatchesSelector"in e?e.msMatchesSelector(t):e.webkitMatchesSelector(t)}function Q(e){const t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}function ee(e,t){if("closest"in e)return e.closest(t);do{if(J(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}function te(e){try{const t=e instanceof HTMLInputElement&&null!==e.selectionStart,n="TEXTAREA"===e.tagName;return t||n||!1}catch(e){return!1}}function ne(e,t){const n=null==e?void 0:e.getAttribute("role");return n&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(n)?n:t}function re(e,t){var n;const r=ne(e);if(!r)return t;return null!=(n={menu:"menuitem",listbox:"option",tree:"treeitem",grid:"gridcell"}[r])?n:t}function oe(e){if(!e)return null;if(e.clientHeight&&e.scrollHeight>e.clientHeight){const{overflowY:t}=getComputedStyle(e);if("visible"!==t&&"hidden"!==t)return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){const{overflowX:t}=getComputedStyle(e);if("visible"!==t&&"hidden"!==t)return e}return oe(e.parentElement)||document.scrollingElement||document.body}function ie(){return!!U&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function ae(){return U&&ie()&&/apple/i.test(navigator.vendor)}function se(){return U&&navigator.platform.startsWith("Mac")&&!(U&&navigator.maxTouchPoints)}function le(e){return Boolean(e.currentTarget&&!Y(e.currentTarget,e.target))}function ce(e){return e.target===e.currentTarget}function ue(e,t){const n=new FocusEvent("blur",t),r=e.dispatchEvent(n),o=M(R({},t),{bubbles:!0});return e.dispatchEvent(new FocusEvent("focusout",o)),r}function de(e,t){const n=new MouseEvent("click",t);return e.dispatchEvent(n)}function fe(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Y(n,r)}function me(e,t,n){const r=requestAnimationFrame((()=>{e.removeEventListener(t,o,!0),n()})),o=()=>{cancelAnimationFrame(r),n()};return e.addEventListener(t,o,{once:!0,capture:!0}),r}function pe(e,t,n,r=window){const o=[];try{r.document.addEventListener(e,t,n);for(const i of Array.from(r.frames))o.push(pe(e,t,n,i))}catch(e){}return()=>{try{r.document.removeEventListener(e,t,n)}catch(e){}o.forEach((e=>e()))}}var he=x({},a),ge=he.useId,ve=(he.useDeferredValue,he.useInsertionEffect),be=U?r.useLayoutEffect:r.useEffect;function ye(e){const[t]=(0,r.useState)(e);return t}function xe(e){const t=(0,r.useRef)(e);return be((()=>{t.current=e})),t}function we(e){const t=(0,r.useRef)((()=>{throw new Error("Cannot call an event handler while rendering.")}));return ve?ve((()=>{t.current=e})):t.current=e,(0,r.useCallback)(((...e)=>{var n;return null==(n=t.current)?void 0:n.call(t,...e)}),[])}function Ee(...e){return(0,r.useMemo)((()=>{if(e.some(Boolean))return t=>{e.forEach((e=>H(e,t)))}}),e)}function _e(e){if(ge){const t=ge();return e||t}const[t,n]=(0,r.useState)(e);return be((()=>{if(e||t)return;const r=Math.random().toString(36).substr(2,6);n(`id-${r}`)}),[e,t]),e||t}function Se(e,t){const n=e=>{if("string"==typeof e)return e},[o,i]=(0,r.useState)((()=>n(t)));return be((()=>{const r=e&&"current"in e?e.current:e;i((null==r?void 0:r.tagName.toLowerCase())||n(t))}),[e,t]),o}function Ce(e,t){const n=(0,r.useRef)(!1);(0,r.useEffect)((()=>{if(n.current)return e();n.current=!0}),t),(0,r.useEffect)((()=>()=>{n.current=!1}),[])}Symbol("setNextState");function ke(){return(0,r.useReducer)((()=>[]),[])}function Pe(e){return we("function"==typeof e?e:()=>e)}function Te(e,t,n=[]){const o=(0,r.useCallback)((n=>(e.wrapElement&&(n=e.wrapElement(n)),t(n))),[...n,e.wrapElement]);return w(x({},e),{wrapElement:o})}function Ie(e=!1,t){const[n,o]=(0,r.useState)(null);return{portalRef:Ee(o,t),portalNode:n,domReady:!e||n}}function Re(e,t,n){const o=e.onLoadedMetadataCapture,i=(0,r.useMemo)((()=>Object.assign((()=>{}),w(x({},o),{[t]:n}))),[o,t,n]);return[null==o?void 0:o[t],{onLoadedMetadataCapture:i}]}function Me(){(0,r.useEffect)((()=>{pe("mousemove",Oe,!0),pe("mousedown",ze,!0),pe("mouseup",ze,!0),pe("keydown",ze,!0),pe("scroll",ze,!0)}),[]);return we((()=>Ne))}var Ne=!1,De=0,Ae=0;function Oe(e){(function(e){const t=e.movementX||e.screenX-De,n=e.movementY||e.screenY-Ae;return De=e.screenX,Ae=e.screenY,t||n||!1})(e)&&(Ne=!0)}function ze(){Ne=!1}var Le=o(4922);function Fe(e){return r.forwardRef(((t,n)=>e(x({ref:n},t))))}function Be(e){const t=Fe(e);return r.memo(t)}function je(e,t){const n=t,{as:o,wrapElement:i,render:a}=n,s=E(n,["as","wrapElement","render"]);let l;const c=Ee(t.ref,$(a));if(o&&"string"!=typeof o)l=(0,Le.jsx)(o,w(x({},s),{render:a}));else if(r.isValidElement(a)){const e=w(x({},a.props),{ref:c});l=r.cloneElement(a,function(e,t){const n=x({},e);for(const r in t){if(!O(t,r))continue;if("className"===r){const r="className";n[r]=e[r]?`${e[r]} ${t[r]}`:t[r];continue}if("style"===r){const r="style";n[r]=e[r]?x(x({},e[r]),t[r]):t[r];continue}const o=t[r];if("function"==typeof o&&r.startsWith("on")){const t=e[r];if("function"==typeof t){n[r]=(...e)=>{o(...e),t(...e)};continue}}n[r]=o}return n}(s,e))}else if(a)l=a(s);else if("function"==typeof t.children){0;const e=s,{children:n}=e,r=E(e,["children"]);l=t.children(r)}else l=o?(0,Le.jsx)(o,x({},s)):(0,Le.jsx)(e,x({},s));return i?i(l):l}function Ve(e){return(t={})=>{const n=e(t),r={};for(const e in n)O(n,e)&&void 0!==n[e]&&(r[e]=n[e]);return r}}function He(e=[],t=[]){const n=r.createContext(void 0),o=r.createContext(void 0),i=()=>r.useContext(n),a=t=>e.reduceRight(((e,n)=>(0,Le.jsx)(n,w(x({},t),{children:e}))),(0,Le.jsx)(n.Provider,x({},t)));return{context:n,scopedContext:o,useContext:i,useScopedContext:(e=!1)=>{const t=r.useContext(o),n=i();return e?t:t||n},useProviderContext:()=>{const e=r.useContext(o),t=i();if(!e||e!==t)return t},ContextProvider:a,ScopedContextProvider:e=>(0,Le.jsx)(a,w(x({},e),{children:t.reduceRight(((t,n)=>(0,Le.jsx)(n,w(x({},e),{children:t}))),(0,Le.jsx)(o.Provider,x({},e)))}))}}var $e="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function We(e){return!!J(e,$e)&&(!!Q(e)&&!ee(e,"[inert]"))}function Ue(e){if(!We(e))return!1;if(function(e){return parseInt(e.getAttribute("tabindex")||"0",10)<0}(e))return!1;if(!("form"in e))return!0;if(!e.form)return!0;if(e.checked)return!0;if("radio"!==e.type)return!0;const t=e.form.elements.namedItem(e.name);if(!t)return!0;if(!("length"in t))return!0;const n=q(e);return!n||(n===e||(!("form"in n)||(n.form!==e.form||n.name!==e.name)))}function Ge(e,t){const n=Array.from(e.querySelectorAll($e));t&&n.unshift(e);const r=n.filter(We);return r.forEach(((e,t)=>{if(K(e)&&e.contentDocument){const n=e.contentDocument.body;r.splice(t,1,...Ge(n))}})),r}function qe(e,t,n){const r=Array.from(e.querySelectorAll($e)),o=r.filter(Ue);return t&&Ue(e)&&o.unshift(e),o.forEach(((e,t)=>{if(K(e)&&e.contentDocument){const r=qe(e.contentDocument.body,!1,n);o.splice(t,1,...r)}})),!o.length&&n?r:o}function Ye(e,t,n){const[r]=qe(e,t,n);return r||null}function Ke(e,t){return function(e,t,n,r){const o=q(e),i=Ge(e,t),a=i.indexOf(o),s=i.slice(a+1);return s.find(Ue)||(n?i.find(Ue):null)||(r?s[0]:null)||null}(document.body,!1,e,t)}function Xe(e,t){return function(e,t,n,r){const o=q(e),i=Ge(e,t).reverse(),a=i.indexOf(o),s=i.slice(a+1);return s.find(Ue)||(n?i.find(Ue):null)||(r?s[0]:null)||null}(document.body,!1,e,t)}function Ze(e){const t=q(e);if(!t)return!1;if(t===e)return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&n===e.id}function Je(e){const t=q(e);if(!t)return!1;if(Y(e,t))return!0;const n=t.getAttribute("aria-activedescendant");return!!n&&("id"in e&&(n===e.id||!!e.querySelector(`#${CSS.escape(n)}`)))}function Qe(e){!Je(e)&&We(e)&&e.focus()}function et(e){var t;const n=null!=(t=e.getAttribute("tabindex"))?t:"";e.setAttribute("data-tabindex",n),e.setAttribute("tabindex","-1")}var tt=ae(),nt=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"];function rt(e){return!("input"!==e.tagName.toLowerCase()||!e.type)&&("radio"===e.type||"checkbox"===e.type)}function ot(e,t,n,r,o){return e?t?n&&!r?-1:void 0:n?o:o||0:o}function it(e,t){return we((n=>{null==e||e(n),n.defaultPrevented||t&&(n.stopPropagation(),n.preventDefault())}))}var at=!0;function st(e){const t=e.target;t&&"hasAttribute"in t&&(t.hasAttribute("data-focus-visible")||(at=!1))}function lt(e){e.metaKey||e.ctrlKey||e.altKey||(at=!0)}var ct=Ve((e=>{var t=e,{focusable:n=!0,accessibleWhenDisabled:o,autoFocus:i,onFocusVisible:a}=t,s=E(t,["focusable","accessibleWhenDisabled","autoFocus","onFocusVisible"]);const l=(0,r.useRef)(null);(0,r.useEffect)((()=>{n&&(pe("mousedown",st,!0),pe("keydown",lt,!0))}),[n]),tt&&(0,r.useEffect)((()=>{if(!n)return;const e=l.current;if(!e)return;if(!rt(e))return;const t=function(e){return"labels"in e?e.labels:null}(e);if(!t)return;const r=()=>queueMicrotask((()=>e.focus()));return t.forEach((e=>e.addEventListener("mouseup",r))),()=>{t.forEach((e=>e.removeEventListener("mouseup",r)))}}),[n]);const c=n&&j(s),u=!!c&&!o,[d,m]=(0,r.useState)(!1);(0,r.useEffect)((()=>{n&&u&&d&&m(!1)}),[n,u,d]),(0,r.useEffect)((()=>{if(!n)return;if(!d)return;const e=l.current;if(!e)return;if("undefined"==typeof IntersectionObserver)return;const t=new IntersectionObserver((()=>{We(e)||m(!1)}));return t.observe(e),()=>t.disconnect()}),[n,d]);const p=it(s.onKeyPressCapture,c),h=it(s.onMouseDownCapture,c),g=it(s.onClickCapture,c),v=s.onMouseDown,b=we((e=>{if(null==v||v(e),e.defaultPrevented)return;if(!n)return;const t=e.currentTarget;if(!tt)return;if(le(e))return;if(!X(t)&&!rt(t))return;let r=!1;const o=()=>{r=!0};t.addEventListener("focusin",o,{capture:!0,once:!0}),me(t,"mouseup",(()=>{t.removeEventListener("focusin",o,!0),r||Qe(t)}))})),y=(e,t)=>{if(t&&(e.currentTarget=t),!n)return;const r=e.currentTarget;r&&Ze(r)&&(null==a||a(e),e.defaultPrevented||m(!0))},_=s.onKeyDownCapture,S=we((e=>{if(null==_||_(e),e.defaultPrevented)return;if(!n)return;if(d)return;if(e.metaKey)return;if(e.altKey)return;if(e.ctrlKey)return;if(!ce(e))return;const t=e.currentTarget;queueMicrotask((()=>y(e,t)))})),C=s.onFocusCapture,k=we((e=>{if(null==C||C(e),e.defaultPrevented)return;if(!n)return;if(!ce(e))return void m(!1);const t=e.currentTarget,r=()=>y(e,t);at||function(e){const{tagName:t,readOnly:n,type:r}=e;return"TEXTAREA"===t&&!n||"SELECT"===t&&!n||("INPUT"!==t||n?!!e.isContentEditable:nt.includes(r))}(e.target)?queueMicrotask(r):!function(e){return"combobox"===e.getAttribute("role")&&!!e.dataset.name}(e.target)?m(!1):me(e.target,"focusout",r)})),P=s.onBlur,T=we((e=>{null==P||P(e),n&&fe(e)&&m(!1)})),I=(0,r.useContext)(f),R=we((e=>{n&&i&&e&&I&&queueMicrotask((()=>{Ze(e)||We(e)&&e.focus()}))})),M=Se(l,s.as),N=n&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e||"a"===e}(M),D=n&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e}(M),A=u?x({pointerEvents:"none"},s.style):s.style;return s=w(x({"data-focus-visible":n&&d?"":void 0,"data-autofocus":!!i||void 0,"aria-disabled":!!c||void 0},s),{ref:Ee(l,R,s.ref),style:A,tabIndex:ot(n,u,N,D,s.tabIndex),disabled:!(!D||!u)||void 0,contentEditable:c?void 0:s.contentEditable,onKeyPressCapture:p,onClickCapture:g,onMouseDownCapture:h,onMouseDown:b,onKeyDownCapture:S,onFocusCapture:k,onBlur:T})}));Fe((e=>je("div",e=ct(e))));function ut(e){if(!e.isTrusted)return!1;const t=e.currentTarget;return"Enter"===e.key?X(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(X(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}var dt=Symbol("command"),ft=Ve((e=>{var t=e,{clickOnEnter:n=!0,clickOnSpace:o=!0}=t,i=E(t,["clickOnEnter","clickOnSpace"]);const a=(0,r.useRef)(null),s=Se(a,i.as),l=i.type,[c,u]=(0,r.useState)((()=>!!s&&X({tagName:s,type:l})));(0,r.useEffect)((()=>{a.current&&u(X(a.current))}),[]);const[d,f]=(0,r.useState)(!1),m=(0,r.useRef)(!1),p=j(i),[h,g]=Re(i,dt,!0),v=i.onKeyDown,b=we((e=>{null==v||v(e);const t=e.currentTarget;if(e.defaultPrevented)return;if(h)return;if(p)return;if(!ce(e))return;if(te(t))return;if(t.isContentEditable)return;const r=n&&"Enter"===e.key,i=o&&" "===e.key,a="Enter"===e.key&&!n,s=" "===e.key&&!o;if(a||s)e.preventDefault();else if(r||i){const n=ut(e);if(r){if(!n){e.preventDefault();const n=e,{view:r}=n,o=E(n,["view"]),i=()=>de(t,o);U&&/firefox\//i.test(navigator.userAgent)?me(t,"keyup",i):queueMicrotask(i)}}else i&&(m.current=!0,n||(e.preventDefault(),f(!0)))}})),y=i.onKeyUp,_=we((e=>{if(null==y||y(e),e.defaultPrevented)return;if(h)return;if(p)return;if(e.metaKey)return;const t=o&&" "===e.key;if(m.current&&t&&(m.current=!1,!ut(e))){e.preventDefault(),f(!1);const t=e.currentTarget,n=e,{view:r}=n,o=E(n,["view"]);queueMicrotask((()=>de(t,o)))}}));return i=w(x(x({"data-active":d?"":void 0,type:c?"button":void 0},g),i),{ref:Ee(a,i.ref),onKeyDown:b,onKeyUp:_}),i=ct(i)}));Fe((e=>je("button",e=ft(e))));var mt=He(),pt=mt.useContext,ht=(mt.useScopedContext,mt.useProviderContext,mt.ContextProvider),gt=mt.ScopedContextProvider,vt=Ve((e=>{var t=e,{store:n,shouldRegisterItem:o=!0,getItem:i=L,element:a}=t,s=E(t,["store","shouldRegisterItem","getItem","element"]);const l=pt();n=n||l;const c=_e(s.id),u=(0,r.useRef)(a);return(0,r.useEffect)((()=>{const e=u.current;if(!c)return;if(!e)return;if(!o)return;const t=i({id:c,element:e});return null==n?void 0:n.renderItem(t)}),[c,o,i,n]),s=w(x({},s),{ref:Ee(u,s.ref)})}));Fe((e=>je("div",vt(e))));var bt={id:null};function yt(e,t){return t&&e.item(t)||null}var xt=Symbol("FOCUS_SILENTLY");function wt(e,t,n){if(!t)return!1;if(t===n)return!1;const r=e.item(t.id);return!!r&&(!n||r.element!==n)}var Et=He([ht],[gt]),_t=Et.useContext,St=(Et.useScopedContext,Et.useProviderContext),Ct=Et.ContextProvider,kt=Et.ScopedContextProvider,Pt=(0,r.createContext)(void 0),Tt=(0,r.createContext)(void 0);function It(e,t){const n=e.__unstableInternals;return F(n,"Invalid store"),n[t]}function Rt(e,...t){let n=e,r=n,o=Symbol(),i=D;const a=new Set,s=new Set,l=new Set,c=new Set,u=new Set,d=new WeakMap,f=new WeakMap,m=(e,t,n=c)=>(n.add(t),f.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),f.delete(t),n.delete(t)}),p=(e,i,a=!1)=>{if(!O(n,e))return;const l=A(i,n[e]);if(l===n[e])return;a||t.forEach((t=>{var n;null==(n=null==t?void 0:t.setState)||n.call(t,e,l)}));const m=n;n=M(R({},n),{[e]:l});const p=Symbol();o=p,s.add(e);const h=(t,r,o)=>{var i;const a=f.get(t);a&&!a.some((t=>o?o.has(t):t===e))||(null==(i=d.get(t))||i(),d.set(t,t(n,r)))};c.forEach((e=>{h(e,m)})),queueMicrotask((()=>{if(o!==p)return;const e=n;u.forEach((e=>{h(e,r,s)})),r=e,s.clear()}))},h={getState:()=>n,setState:p,__unstableInternals:{setup:e=>(l.add(e),()=>l.delete(e)),init:()=>{const e=a.size,r=Symbol();a.add(r);const o=()=>{a.delete(r),a.size||i()};if(e)return o;const s=(c=n,Object.keys(c)).map((e=>z(...t.map((t=>{var n;const r=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);if(r&&O(r,e))return At(t,[e],(t=>{p(e,t[e],!0)}))})))));var c;const u=[];l.forEach((e=>u.push(e())));const d=t.map(Nt);return i=z(...s,...u,...d),o},subscribe:(e,t)=>m(e,t),sync:(e,t)=>(d.set(t,t(n,n)),m(e,t)),batch:(e,t)=>(d.set(t,t(n,r)),m(e,t,u)),pick:e=>Rt(function(e,t){const n={};for(const r of t)O(e,r)&&(n[r]=e[r]);return n}(n,e),h),omit:e=>Rt(function(e,t){const n=R({},e);for(const e of t)O(n,e)&&delete n[e];return n}(n,e),h)}};return h}function Mt(e,...t){if(e)return It(e,"setup")(...t)}function Nt(e,...t){if(e)return It(e,"init")(...t)}function Dt(e,...t){if(e)return It(e,"subscribe")(...t)}function At(e,...t){if(e)return It(e,"sync")(...t)}function Ot(e,...t){if(e)return It(e,"batch")(...t)}function zt(e,...t){if(e)return It(e,"omit")(...t)}function Lt(...e){const t=e.reduce(((e,t)=>{var n;const r=null==(n=null==t?void 0:t.getState)?void 0:n.call(t);return r?R(R({},e),r):e}),{});return Rt(t,...e)}var Ft=o(422),{useSyncExternalStore:Bt}=Ft,jt=()=>()=>{};function Vt(e,t=L){const n=r.useCallback((t=>e?Dt(e,null,t):jt()),[e]),o=()=>{const n="string"==typeof t?t:null,r="function"==typeof t?t:null,o=null==e?void 0:e.getState();return r?r(o):o&&n&&O(o,n)?o[n]:void 0};return Bt(n,o,o)}function Ht(e,t,n,r){const o=O(t,n)?t[n]:void 0,i=r?t[r]:void 0,a=xe({value:o,setValue:i});be((()=>At(e,[n],((e,t)=>{const{value:r,setValue:o}=a.current;o&&e[n]!==t[n]&&e[n]!==r&&o(e[n])}))),[e,n]),be((()=>{if(void 0!==o)return e.setState(n,o),Ot(e,[n],(()=>{void 0!==o&&e.setState(n,o)}))}))}function $t(e,t){const[n,o]=r.useState((()=>e(t)));be((()=>Nt(n)),[n]);const i=r.useCallback((e=>Vt(n,e)),[n]);return[r.useMemo((()=>w(x({},n),{useState:i})),[n,i]),we((()=>{o((n=>e(x(x({},t),n.getState()))))}))]}function Wt(e,t=!1){const{top:n}=e.getBoundingClientRect();return t?n+e.clientHeight:n}function Ut(e,t,n,r=!1){var o;if(!t)return;if(!n)return;const{renderedItems:i}=t.getState(),a=oe(e);if(!a)return;const s=function(e,t=!1){const n=e.clientHeight,{top:r}=e.getBoundingClientRect(),o=1.5*Math.max(.875*n,n-40),i=t?n-o+r:o+r;return"HTML"===e.tagName?i+e.scrollTop:i}(a,r);let l,c;for(let e=0;e<i.length;e+=1){const i=l;if(l=n(e),!l)break;if(l===i)continue;const a=null==(o=yt(t,l))?void 0:o.element;if(!a)continue;const u=Wt(a,r)-s,d=Math.abs(u);if(r&&u<=0||!r&&u>=0){void 0!==c&&c<d&&(l=i);break}c=d}return l}var Gt=Ve((e=>{var t=e,{store:n,rowId:o,preventScrollOnKeyDown:i=!1,moveOnKeyPress:a=!0,tabbable:s=!1,getItem:l,"aria-setsize":c,"aria-posinset":u}=t,d=E(t,["store","rowId","preventScrollOnKeyDown","moveOnKeyPress","tabbable","getItem","aria-setsize","aria-posinset"]);const f=_t();n=n||f;const m=_e(d.id),p=(0,r.useRef)(null),h=(0,r.useContext)(Tt),g=Vt(n,(e=>o||(e&&(null==h?void 0:h.baseElement)&&h.baseElement===e.baseElement?h.id:void 0))),v=j(d)&&!d.accessibleWhenDisabled,b=(0,r.useCallback)((e=>{const t=w(x({},e),{id:m||e.id,rowId:g,disabled:!!v});return l?l(t):t}),[m,g,v,l]),y=d.onFocus,_=(0,r.useRef)(!1),S=we((e=>{if(null==y||y(e),e.defaultPrevented)return;if(le(e))return;if(!m)return;if(!n)return;const{activeId:t,virtualFocus:r,baseElement:o}=n.getState();if(function(e,t){return!ce(e)&&wt(t,e.target)}(e,n))return;if(t!==m&&n.setActiveId(m),!r)return;if(!ce(e))return;if((i=e.currentTarget).isContentEditable||te(i)||"INPUT"===i.tagName&&!X(i))return;var i;if(!(null==o?void 0:o.isConnected))return;_.current=!0;e.relatedTarget===o||wt(n,e.relatedTarget)?function(e){e[xt]=!0,e.focus({preventScroll:!0})}(o):o.focus()})),C=d.onBlurCapture,k=we((e=>{if(null==C||C(e),e.defaultPrevented)return;const t=null==n?void 0:n.getState();(null==t?void 0:t.virtualFocus)&&_.current&&(_.current=!1,e.preventDefault(),e.stopPropagation())})),P=d.onKeyDown,T=Pe(i),I=Pe(a),R=we((e=>{if(null==P||P(e),e.defaultPrevented)return;if(!ce(e))return;if(!n)return;const{currentTarget:t}=e,r=n.getState(),o=n.item(m),i=!!(null==o?void 0:o.rowId),a="horizontal"!==r.orientation,s="vertical"!==r.orientation,l=()=>!!i||(!!s||(!r.baseElement||!te(r.baseElement))),c={ArrowUp:(i||a)&&n.up,ArrowRight:(i||s)&&n.next,ArrowDown:(i||a)&&n.down,ArrowLeft:(i||s)&&n.previous,Home:()=>{if(l())return!i||e.ctrlKey?null==n?void 0:n.first():null==n?void 0:n.previous(-1)},End:()=>{if(l())return!i||e.ctrlKey?null==n?void 0:n.last():null==n?void 0:n.next(-1)},PageUp:()=>Ut(t,n,null==n?void 0:n.up,!0),PageDown:()=>Ut(t,n,null==n?void 0:n.down)}[e.key];if(c){const t=c();if(T(e)||void 0!==t){if(!I(e))return;e.preventDefault(),n.move(t)}}})),M=Vt(n,(e=>(null==e?void 0:e.baseElement)||void 0)),N=(0,r.useMemo)((()=>({id:m,baseElement:M})),[m,M]);d=Te(d,(e=>(0,Le.jsx)(Pt.Provider,{value:N,children:e})),[N]);const D=Vt(n,(e=>!!e&&e.activeId===m)),A=Vt(n,"virtualFocus"),O=function(e,t){const n=t.role,[o,i]=(0,r.useState)(n);return be((()=>{const t=e.current;t&&i(t.getAttribute("role")||n)}),[n]),o}(p,d);let z;D&&(!function(e){return"option"===e||"treeitem"===e}(O)?A&&function(e){return"option"===e||"tab"===e||"treeitem"===e||"gridcell"===e||"row"===e||"columnheader"===e||"rowheader"===e}(O)&&(z=!0):z=!0);const L=Vt(n,(e=>null!=c?c:e&&(null==h?void 0:h.ariaSetSize)&&h.baseElement===e.baseElement?h.ariaSetSize:void 0)),F=Vt(n,(e=>{if(null!=u)return u;if(!e)return;if(!(null==h?void 0:h.ariaPosInSet))return;if(h.baseElement!==e.baseElement)return;const t=e.renderedItems.filter((e=>e.rowId===g));return h.ariaPosInSet+t.findIndex((e=>e.id===m))})),B=Vt(n,(e=>!(null==e?void 0:e.renderedItems.length)||!e.virtualFocus&&(!!s||e.activeId===m)));return d=w(x({id:m,"aria-selected":z,"data-active-item":D?"":void 0},d),{ref:Ee(p,d.ref),tabIndex:B?d.tabIndex:-1,onFocus:S,onBlurCapture:k,onKeyDown:R}),d=ft(d),d=vt(w(x({store:n},d),{getItem:b,shouldRegisterItem:!!m&&d.shouldRegisterItem})),w(x({},d),{"aria-setsize":L,"aria-posinset":F})})),qt=Be((e=>je("button",Gt(e))));function Yt(e={}){const t=Lt(e.store,zt(e.disclosure,["contentElement","disclosureElement"])),n=null==t?void 0:t.getState(),r=V(e.open,null==n?void 0:n.open,e.defaultOpen,!1),o=V(e.animated,null==n?void 0:n.animated,!1),i=Rt({open:r,animated:o,animating:!!o&&r,mounted:r,contentElement:V(null==n?void 0:n.contentElement,null),disclosureElement:V(null==n?void 0:n.disclosureElement,null)},t);return Mt(i,(()=>At(i,["animated","animating"],(e=>{e.animated||i.setState("animating",!1)})))),Mt(i,(()=>Dt(i,["open"],(()=>{i.getState().animated&&i.setState("animating",!0)})))),Mt(i,(()=>At(i,["open","animating"],(e=>{i.setState("mounted",e.open||e.animating)})))),M(R({},i),{setOpen:e=>i.setState("open",e),show:()=>i.setState("open",!0),hide:()=>i.setState("open",!1),toggle:()=>i.setState("open",(e=>!e)),stopAnimation:()=>i.setState("animating",!1),setContentElement:e=>i.setState("contentElement",e),setDisclosureElement:e=>i.setState("disclosureElement",e)})}function Kt(e,t,n){return Ce(t,[n.store,n.disclosure]),Ht(e,n,"open","setOpen"),Ht(e,n,"mounted","setMounted"),Ht(e,n,"animated"),e}function Xt(e={}){const[t,n]=$t(Yt,e);return Kt(t,n,e)}function Zt(e={}){return Yt(e)}function Jt(e,t,n){return Kt(e,t,n)}function Qt(e,t,n){return Ce(t,[n.popover]),Ht(e=Jt(e,t,n),n,"placement"),e}function en(e,t,n){return Ht(e=Qt(e,t,n),n,"timeout"),Ht(e,n,"showTimeout"),Ht(e,n,"hideTimeout"),e}function tn(e={}){var t;const n=null==(t=e.store)?void 0:t.getState(),r=function(e={}){var t=e,{popover:n}=t,r=N(t,["popover"]);const o=Lt(r.store,zt(n,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"])),i=null==o?void 0:o.getState(),a=Zt(M(R({},r),{store:o})),s=V(r.placement,null==i?void 0:i.placement,"bottom"),l=Rt(M(R({},a.getState()),{placement:s,currentPlacement:s,anchorElement:V(null==i?void 0:i.anchorElement,null),popoverElement:V(null==i?void 0:i.popoverElement,null),arrowElement:V(null==i?void 0:i.arrowElement,null),rendered:Symbol("rendered")}),a,o);return M(R(R({},a),l),{setAnchorElement:e=>l.setState("anchorElement",e),setPopoverElement:e=>l.setState("popoverElement",e),setArrowElement:e=>l.setState("arrowElement",e),render:()=>l.setState("rendered",Symbol("rendered"))})}(M(R({},e),{placement:V(e.placement,null==n?void 0:n.placement,"bottom")})),o=V(e.timeout,null==n?void 0:n.timeout,500),i=Rt(M(R({},r.getState()),{timeout:o,showTimeout:V(e.showTimeout,null==n?void 0:n.showTimeout),hideTimeout:V(e.hideTimeout,null==n?void 0:n.hideTimeout),autoFocusOnShow:V(null==n?void 0:n.autoFocusOnShow,!1)}),r,e.store);return M(R(R({},r),i),{setAutoFocusOnShow:e=>i.setState("autoFocusOnShow",e)})}function nn(e={}){var t;const n=null==(t=e.store)?void 0:t.getState(),r=tn(M(R({},e),{placement:V(e.placement,null==n?void 0:n.placement,"top"),hideTimeout:V(e.hideTimeout,null==n?void 0:n.hideTimeout,0)})),o=Rt(M(R({},r.getState()),{type:V(e.type,null==n?void 0:n.type,"description"),skipTimeout:V(e.skipTimeout,null==n?void 0:n.skipTimeout,300)}),r,e.store);return R(R({},r),o)}function rn(e={}){const[t,n]=$t(nn,e);return function(e,t,n){return Ht(e=en(e,t,n),n,"type"),Ht(e,n,"skipTimeout"),e}(t,n,e)}Ve((e=>e));var on=Fe((e=>je("div",e)));Object.assign(on,["a","button","details","dialog","div","form","h1","h2","h3","h4","h5","h6","header","img","input","label","li","nav","ol","p","section","select","span","textarea","ul","svg"].reduce(((e,t)=>(e[t]=Fe((e=>je(t,e))),e)),{}));var an=He(),sn=(an.useContext,an.useScopedContext,an.useProviderContext),ln=He([an.ContextProvider],[an.ScopedContextProvider]),cn=(ln.useContext,ln.useScopedContext,ln.useProviderContext),un=ln.ContextProvider,dn=ln.ScopedContextProvider,fn=(0,r.createContext)(void 0),mn=(0,r.createContext)(void 0),pn=He([un],[dn]),hn=(pn.useContext,pn.useScopedContext,pn.useProviderContext),gn=pn.ContextProvider,vn=pn.ScopedContextProvider,bn=He([gn],[vn]),yn=(bn.useContext,bn.useScopedContext,bn.useProviderContext),xn=bn.ContextProvider,wn=bn.ScopedContextProvider,En=Ve((e=>{var t=e,{store:n,showOnHover:o=!0}=t,i=E(t,["store","showOnHover"]);const a=yn();F(n=n||a,!1);const s=j(i),l=(0,r.useRef)(0);(0,r.useEffect)((()=>()=>window.clearTimeout(l.current)),[]),(0,r.useEffect)((()=>pe("mouseleave",(e=>{if(!n)return;const{anchorElement:t}=n.getState();t&&e.target===t&&(window.clearTimeout(l.current),l.current=0)}),!0)),[n]);const c=i.onMouseMove,u=Pe(o),d=Me(),f=we((e=>{if(null==c||c(e),s)return;if(!n)return;if(e.defaultPrevented)return;if(l.current)return;if(!d())return;if(!u(e))return;const t=e.currentTarget;n.setAnchorElement(t),n.setDisclosureElement(t);const{showTimeout:r,timeout:o}=n.getState(),i=()=>{l.current=0,d()&&(null==n||n.setAnchorElement(t),null==n||n.show(),queueMicrotask((()=>{null==n||n.setDisclosureElement(t)})))},a=null!=r?r:o;0===a?i():l.current=window.setTimeout(i,a)})),m=(0,r.useCallback)((e=>{if(!n)return;const{anchorElement:t}=n.getState();(null==t?void 0:t.isConnected)||n.setAnchorElement(e)}),[n]);return i=w(x({},i),{ref:Ee(m,i.ref),onMouseMove:f}),i=ct(i)}));Fe((e=>je("a",En(e))));var _n=He([xn],[wn]),Sn=(_n.useContext,_n.useScopedContext,_n.useProviderContext),Cn=(_n.ContextProvider,_n.ScopedContextProvider),kn=Rt({activeStore:null}),Pn=Ve((e=>{var t=e,{store:n,showOnHover:o=!0}=t,i=E(t,["store","showOnHover"]);const a=Sn();F(n=n||a,!1);const s=(0,r.useRef)(!1);(0,r.useEffect)((()=>At(n,["mounted"],(e=>{e.mounted||(s.current=!1)}))),[n]),(0,r.useEffect)((()=>At(n,["mounted","skipTimeout"],(e=>{if(!n)return;if(e.mounted){const{activeStore:e}=kn.getState();return e!==n&&(null==e||e.hide()),kn.setState("activeStore",n)}const t=setTimeout((()=>{const{activeStore:e}=kn.getState();e===n&&kn.setState("activeStore",null)}),e.skipTimeout);return()=>clearTimeout(t)}))),[n]);const l=i.onMouseEnter,c=we((e=>{null==l||l(e),s.current=!0})),u=i.onFocusVisible,d=we((e=>{null==u||u(e),e.defaultPrevented||(null==n||n.setAnchorElement(e.currentTarget),null==n||n.show())})),f=i.onBlur,m=we((e=>{if(null==f||f(e),e.defaultPrevented)return;const{activeStore:t}=kn.getState();t===n&&kn.setState("activeStore",null)})),p=n.useState("type"),h=n.useState((e=>{var t;return null==(t=e.contentElement)?void 0:t.id}));return i=w(x({"aria-labelledby":"label"===p?h:void 0,"aria-describedby":"description"===p?h:void 0},i),{onMouseEnter:c,onFocusVisible:d,onBlur:m}),i=En(x({store:n,showOnHover:e=>{if(!s.current)return!1;if(B(o,e))return!1;const{activeStore:t}=kn.getState();return!t||(null==n||n.show(),!1)}},i))})),Tn=Fe((e=>je("div",Pn(e))));function In(e){return[e.clientX,e.clientY]}function Rn(e,t){const[n,r]=e;let o=!1;for(let e=t.length,i=0,a=e-1;i<e;a=i++){const[s,l]=t[i],[c,u]=t[a],[,d]=t[0===a?e-1:a-1]||[0,0],f=(l-u)*(n-s)-(s-c)*(r-l);if(u<l){if(r>=u&&r<l){if(0===f)return!0;f>0&&(r===u?r>d&&(o=!o):o=!o)}}else if(l<u){if(r>l&&r<=u){if(0===f)return!0;f<0&&(r===u?r<d&&(o=!o):o=!o)}}else if(r==l&&(n>=c&&n<=s||n>=s&&n<=c))return!0}return o}function Mn(e,t){const n=e.getBoundingClientRect(),{top:r,right:o,bottom:i,left:a}=n,[s,l]=function(e,t){const{top:n,right:r,bottom:o,left:i}=t,[a,s]=e;return[a<i?"left":a>r?"right":null,s<n?"top":s>o?"bottom":null]}(t,n),c=[t];return s?("top"!==l&&c.push(["left"===s?a:o,r]),c.push(["left"===s?o:a,r]),c.push(["left"===s?o:a,i]),"bottom"!==l&&c.push(["left"===s?a:o,i])):"top"===l?(c.push([a,r]),c.push([a,i]),c.push([o,i]),c.push([o,r])):(c.push([a,i]),c.push([a,r]),c.push([o,r]),c.push([o,i])),c}function Nn(e,...t){if(!e)return!1;const n=e.getAttribute("data-backdrop");return null!=n&&(""===n||("true"===n||(!t.length||t.some((e=>n===e)))))}var Dn=new WeakMap;function An(e,t,n){Dn.has(e)||Dn.set(e,new Map);const r=Dn.get(e),o=r.get(t);if(!o)return r.set(t,n()),()=>{var e;null==(e=r.get(t))||e(),r.delete(t)};const i=n(),a=()=>{i(),o(),r.delete(t)};return r.set(t,a),()=>{r.get(t)===a&&(i(),r.set(t,o))}}function On(e,t,n){return An(e,t,(()=>{const r=e.getAttribute(t);return e.setAttribute(t,n),()=>{null==r?e.removeAttribute(t):e.setAttribute(t,r)}}))}function zn(e,t,n){return An(e,t,(()=>{const r=t in e,o=e[t];return e[t]=n,()=>{r?e[t]=o:delete e[t]}}))}function Ln(e,t){if(!e)return()=>{};return An(e,"style",(()=>{const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}))}var Fn=["SCRIPT","STYLE"];function Bn(e){return`__ariakit-dialog-snapshot-${e}`}function jn(e,t,n){return!Fn.includes(t.tagName)&&(!!function(e,t){const n=G(t),r=Bn(e);if(!n.body[r])return!0;for(;;){if(t===n.body)return!1;if(t[r])return!0;if(!t.parentElement)return!1;t=t.parentElement}}(e,t)&&!n.some((e=>e&&Y(t,e))))}function Vn(e,t,n,r){for(let o of t){if(!(null==o?void 0:o.isConnected))continue;const i=t.some((e=>!!e&&(e!==o&&e.contains(o)))),a=G(o),s=o;for(;o.parentElement&&o!==a.body;){if(null==r||r(o.parentElement,s),!i)for(const r of o.parentElement.children)jn(e,r,t)&&n(r,s);o=o.parentElement}}}function Hn(e="",t=!1){return`__ariakit-dialog-${t?"ancestor":"outside"}${e?`-${e}`:""}`}function $n(e,t=""){return z(zn(e,Hn("",!0),!0),zn(e,Hn(t,!0),!0))}function Wn(e,t){if(e[Hn(t,!0)])return!0;const n=Hn(t);for(;;){if(e[n])return!0;if(!e.parentElement)return!1;e=e.parentElement}}function Un(e,t){const n=[],r=t.map((e=>null==e?void 0:e.id));Vn(e,t,(t=>{Nn(t,...r)||n.unshift(function(e,t=""){return z(zn(e,Hn(),!0),zn(e,Hn(t),!0))}(t,e))}),((t,r)=>{r.hasAttribute("data-dialog")&&r.id!==e||n.unshift($n(t,e))}));return()=>{n.forEach((e=>e()))}}function Gn(e,t){const n=setTimeout(t,e);return()=>clearTimeout(n)}function qn(...e){return e.join(", ").split(", ").reduce(((e,t)=>{const n=1e3*parseFloat(t||"0s");return n>e?n:e}),0)}function Yn(e,t,n){return!(n||!1===t||e&&!t)}var Kn=Ve((e=>{var t=e,{store:n,alwaysVisible:o}=t,i=E(t,["store","alwaysVisible"]);const a=sn();F(n=n||a,!1);const s=_e(i.id),[l,c]=(0,r.useState)(null),u=n.useState("open"),d=n.useState("mounted"),f=n.useState("animated"),m=n.useState("contentElement");be((()=>{if(f){if(null==m?void 0:m.isConnected)return function(e){let t=requestAnimationFrame((()=>{t=requestAnimationFrame(e)}));return()=>cancelAnimationFrame(t)}((()=>{c(u?"enter":"leave")}));c(null)}}),[f,m,u]),be((()=>{if(!n)return;if(!f)return;if(!m)return;if(!l)return;if("enter"===l&&!u)return;if("leave"===l&&u)return;if("number"==typeof f){return Gn(f,n.stopAnimation)}const{transitionDuration:e,animationDuration:t,transitionDelay:r,animationDelay:o}=getComputedStyle(m),i=qn(r,o)+qn(e,t);return i?Gn(i,n.stopAnimation):void 0}),[n,f,m,u,l]);const p=Yn(d,(i=Te(i,(e=>(0,Le.jsx)(dn,{value:n,children:e})),[n])).hidden,o),h=p?w(x({},i.style),{display:"none"}):i.style;return i=w(x({id:s,"data-enter":"enter"===l?"":void 0,"data-leave":"leave"===l?"":void 0,hidden:p},i),{ref:Ee(s?n.setContentElement:null,i.ref),style:h})})),Xn=Fe((e=>je("div",Kn(e)))),Zn=Fe((e=>{var t=e,{unmountOnHide:n}=t,r=E(t,["unmountOnHide"]);const o=sn();return!1===Vt(r.store||o,(e=>!n||(null==e?void 0:e.mounted)))?null:(0,Le.jsx)(Xn,x({},r))}));function Jn({store:e,backdrop:t,backdropProps:n,alwaysVisible:o,hidden:i}){const a=(0,r.useRef)(null),s=Xt({disclosure:e}),l=e.useState("contentElement");be((()=>{const e=a.current,t=l;e&&t&&(e.style.zIndex=getComputedStyle(t).zIndex)}),[l]),be((()=>{const e=null==l?void 0:l.id;if(!e)return;const t=a.current;return t?$n(t,e):void 0}),[l]),null!=i&&(n=w(x({},n),{hidden:i}));const c=Kn(w(x({store:s,role:"presentation","data-backdrop":(null==l?void 0:l.id)||"",alwaysVisible:o},n),{ref:Ee(null==n?void 0:n.ref,a),style:x({position:"fixed",top:0,right:0,bottom:0,left:0},null==n?void 0:n.style)}));if(!t)return null;if((0,r.isValidElement)(t))return(0,Le.jsx)(on,w(x({},c),{render:t}));const u="boolean"!=typeof t?t:"div";return(0,Le.jsx)(on,w(x({},c),{render:(0,Le.jsx)(u,{})}))}function Qn(e){return On(e,"aria-hidden","true")}function er(e,t){if(!("style"in e))return D;if("inert"in HTMLElement.prototype)return zn(e,"inert",!0);return z(...qe(e,!0).map((e=>(null==t?void 0:t.some((t=>t&&Y(t,e))))?D:On(e,"tabindex","-1"))),Qn(e),Ln(e,{pointerEvents:"none",userSelect:"none",cursor:"default"}))}const tr=window.ReactDOM;function nr(e,t,n){const o=function({attribute:e,contentId:t,contentElement:n,enabled:o}){const[i,a]=ke(),s=(0,r.useCallback)((()=>{if(!o)return!1;if(!n)return!1;const{body:r}=G(n),i=r.getAttribute(e);return!i||i===t}),[i,o,n,e,t]);return(0,r.useEffect)((()=>{if(!o)return;if(!t)return;if(!n)return;const{body:r}=G(n);if(s())return r.setAttribute(e,t),()=>r.removeAttribute(e);const i=new MutationObserver((()=>(0,tr.flushSync)(a)));return i.observe(r,{attributeFilter:[e]}),()=>i.disconnect()}),[i,o,t,n,s,e]),s}({attribute:"data-dialog-prevent-body-scroll",contentElement:e,contentId:t,enabled:n});(0,r.useEffect)((()=>{if(!o())return;if(!e)return;const t=G(e),n=function(e){return G(e).defaultView||window}(e),{documentElement:r,body:i}=t,a=r.style.getPropertyValue("--scrollbar-width"),s=a?parseInt(a):n.innerWidth-r.clientWidth,l=function(e){const t=e.getBoundingClientRect().left;return Math.round(t)+e.scrollLeft?"paddingLeft":"paddingRight"}(r),c=ie()&&!se();return z((d="--scrollbar-width",f=`${s}px`,(u=r)?An(u,d,(()=>{const e=u.style.getPropertyValue(d);return u.style.setProperty(d,f),()=>{e?u.style.setProperty(d,e):u.style.removeProperty(d)}})):()=>{}),c?(()=>{var e,t;const{scrollX:r,scrollY:o,visualViewport:a}=n,c=null!=(e=null==a?void 0:a.offsetLeft)?e:0,u=null!=(t=null==a?void 0:a.offsetTop)?t:0,d=Ln(i,{position:"fixed",overflow:"hidden",top:-(o-Math.floor(u))+"px",left:-(r-Math.floor(c))+"px",right:"0",[l]:`${s}px`});return()=>{d(),n.scrollTo(r,o)}})():Ln(i,{overflow:"hidden",[l]:`${s}px`}));var u,d,f}),[o,e])}var rr=(0,r.createContext)({});function or({store:e,type:t,listener:n,capture:o,domReady:i}){const a=we(n),s=e.useState("open"),l=(0,r.useRef)(!1);be((()=>{if(!s)return;if(!i)return;const{contentElement:t}=e.getState();if(!t)return;const n=()=>{l.current=!0};return t.addEventListener("focusin",n,!0),()=>t.removeEventListener("focusin",n,!0)}),[e,s,i]),(0,r.useEffect)((()=>{if(!s)return;return pe(t,(t=>{const{contentElement:n,disclosureElement:r}=e.getState(),o=t.target;if(!n)return;if(!o)return;if(!function(e){return"HTML"===e.tagName||Y(G(e).body,e)}(o))return;if(Y(n,o))return;if(function(e,t){if(!e)return!1;if(Y(e,t))return!0;const n=t.getAttribute("aria-activedescendant");if(n){const t=G(e).getElementById(n);if(t)return Y(e,t)}return!1}(r,o))return;if(o.hasAttribute("data-focus-trap"))return;if(function(e,t){if(!("clientY"in e))return!1;const n=t.getBoundingClientRect();return 0!==n.width&&0!==n.height&&n.top<=e.clientY&&e.clientY<=n.top+n.height&&n.left<=e.clientX&&e.clientX<=n.left+n.width}(t,n))return;l.current&&!Wn(o,n.id)||a(t)}),o)}),[s,o])}function ir(e,t){return"function"==typeof e?e(t):!!e}function ar(e,t,n){const o=function(e){const t=(0,r.useRef)();return(0,r.useEffect)((()=>{if(e)return pe("mousedown",(e=>{t.current=e.target}),!0);t.current=null}),[e]),t}(e.useState("open")),i={store:e,domReady:n,capture:!0};or(w(x({},i),{type:"click",listener:n=>{const{contentElement:r}=e.getState(),i=o.current;i&&Q(i)&&Wn(i,null==r?void 0:r.id)&&ir(t,n)&&e.hide()}})),or(w(x({},i),{type:"focusin",listener:n=>{const{contentElement:r}=e.getState();r&&n.target!==G(r)&&ir(t,n)&&e.hide()}})),or(w(x({},i),{type:"contextmenu",listener:n=>{ir(t,n)&&e.hide()}}))}var sr=Ve((e=>{var t=e,{autoFocusOnShow:n=!0}=t,r=E(t,["autoFocusOnShow"]);return r=Te(r,(e=>(0,Le.jsx)(f.Provider,{value:n,children:e})),[n])}));Fe((e=>je("div",sr(e))));var lr=(0,r.createContext)(0);function cr({level:e,children:t}){const n=(0,r.useContext)(lr),o=Math.max(Math.min(e||n+1,6),1);return(0,Le.jsx)(lr.Provider,{value:o,children:t})}var ur=Ve((e=>e=w(x({},e),{style:x({border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"},e.style)})));Fe((e=>je("span",ur(e))));var dr=Ve((e=>(e=w(x({"data-focus-trap":"",tabIndex:0,"aria-hidden":!0},e),{style:x({position:"fixed",top:0,left:0},e.style)}),e=ur(e)))),fr=Fe((e=>je("span",dr(e))));var mr=(0,r.createContext)(null);function pr(e){queueMicrotask((()=>{null==e||e.focus()}))}var hr=Ve((e=>{var t=e,{preserveTabOrder:n,preserveTabOrderAnchor:o,portalElement:i,portalRef:a,portal:s=!0}=t,l=E(t,["preserveTabOrder","preserveTabOrderAnchor","portalElement","portalRef","portal"]);const c=(0,r.useRef)(null),u=Ee(c,l.ref),d=(0,r.useContext)(mr),[f,m]=(0,r.useState)(null),[p,h]=(0,r.useState)(null),g=(0,r.useRef)(null),v=(0,r.useRef)(null),b=(0,r.useRef)(null),y=(0,r.useRef)(null);return be((()=>{const e=c.current;if(!e||!s)return void m(null);const t=function(e,t){return t?"function"==typeof t?t(e):t:G(e).createElement("div")}(e,i);if(!t)return void m(null);const n=t.isConnected;if(!n){const n=d||function(e){return G(e).body}(e);n.appendChild(t)}return t.id||(t.id=e.id?`portal/${e.id}`:function(e="id"){return`${e?`${e}-`:""}${Math.random().toString(36).substr(2,6)}`}()),m(t),H(a,t),n?void 0:()=>{t.remove(),H(a,null)}}),[s,i,d,a]),be((()=>{if(!n)return;if(!o)return;const e=G(o).createElement("span");return e.style.position="fixed",o.insertAdjacentElement("afterend",e),h(e),()=>{e.remove(),h(null)}}),[n,o]),(0,r.useEffect)((()=>{if(!f)return;if(!n)return;let e=0;const t=t=>{if(!fe(t))return;const n="focusin"===t.type;if(cancelAnimationFrame(e),n)return function(e){const t=e.querySelectorAll("[data-tabindex]"),n=e=>{const t=e.getAttribute("data-tabindex");e.removeAttribute("data-tabindex"),t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")};e.hasAttribute("data-tabindex")&&n(e),t.forEach(n)}(f);e=requestAnimationFrame((()=>{!function(e,t){qe(e,t).forEach(et)}(f,!0)}))};return f.addEventListener("focusin",t,!0),f.addEventListener("focusout",t,!0),()=>{cancelAnimationFrame(e),f.removeEventListener("focusin",t,!0),f.removeEventListener("focusout",t,!0)}}),[f,n]),l=Te(l,(e=>{if(e=(0,Le.jsx)(mr.Provider,{value:f||d,children:e}),!s)return e;if(!f)return(0,Le.jsx)("span",{ref:u,id:l.id,style:{position:"fixed"},hidden:!0});e=(0,Le.jsxs)(Le.Fragment,{children:[n&&f&&(0,Le.jsx)(fr,{ref:v,className:"__focus-trap-inner-before",onFocus:e=>{fe(e,f)?pr(Ke()):pr(g.current)}}),e,n&&f&&(0,Le.jsx)(fr,{ref:b,className:"__focus-trap-inner-after",onFocus:e=>{fe(e,f)?pr(Xe()):pr(y.current)}})]}),f&&(e=(0,tr.createPortal)(e,f));let t=(0,Le.jsxs)(Le.Fragment,{children:[n&&f&&(0,Le.jsx)(fr,{ref:g,className:"__focus-trap-outer-before",onFocus:e=>{!(e.relatedTarget===y.current)&&fe(e,f)?pr(v.current):pr(Xe())}}),n&&(0,Le.jsx)("span",{"aria-owns":null==f?void 0:f.id,style:{position:"fixed"}}),n&&f&&(0,Le.jsx)(fr,{ref:y,className:"__focus-trap-outer-after",onFocus:e=>{if(fe(e,f))pr(b.current);else{const e=Ke();if(e===v.current)return void requestAnimationFrame((()=>{var e;return null==(e=Ke())?void 0:e.focus()}));pr(e)}}})]});return p&&n&&(t=(0,tr.createPortal)(t,p)),(0,Le.jsxs)(Le.Fragment,{children:[t,e]})}),[f,d,s,l.id,n,p]),l=w(x({},l),{ref:u})}));Fe((e=>je("div",hr(e))));var gr=ae();function vr(e,t=!1){if(!e)return null;const n="current"in e?e.current:e;return n?t?We(n)?n:null:n:null}var br=Ve((e=>{var t=e,{store:n,open:o,onClose:i,focusable:a=!0,modal:s=!0,portal:l=!!s,backdrop:c=!!s,backdropProps:u,hideOnEscape:d=!0,hideOnInteractOutside:f=!0,getPersistentElements:m,preventBodyScroll:p=!!s,autoFocusOnShow:h=!0,autoFocusOnHide:g=!0,initialFocus:v,finalFocus:b,unmountOnHide:y}=t,_=E(t,["store","open","onClose","focusable","modal","portal","backdrop","backdropProps","hideOnEscape","hideOnInteractOutside","getPersistentElements","preventBodyScroll","autoFocusOnShow","autoFocusOnHide","initialFocus","finalFocus","unmountOnHide"]);const S=cn(),C=(0,r.useRef)(null),k=function(e={}){const[t,n]=$t(Zt,e);return Jt(t,n,e)}({store:n||S,open:o,setOpen(e){if(e)return;const t=C.current;if(!t)return;const n=new Event("close",{bubbles:!1,cancelable:!0});i&&t.addEventListener("close",i,{once:!0}),t.dispatchEvent(n),n.defaultPrevented&&k.setOpen(!0)}}),{portalRef:P,domReady:T}=Ie(l,_.portalRef),I=_.preserveTabOrder,R=k.useState((e=>I&&!s&&e.mounted)),M=_e(_.id),N=k.useState("open"),D=k.useState("mounted"),A=k.useState("contentElement"),O=Yn(D,_.hidden,_.alwaysVisible);nr(A,M,p&&!O),ar(k,f,T);const{wrapElement:L,nestedDialogs:F}=function(e){const t=(0,r.useContext)(rr),[n,o]=(0,r.useState)([]),i=(0,r.useCallback)((e=>{var n;return o((t=>[...t,e])),z(null==(n=t.add)?void 0:n.call(t,e),(()=>{o((t=>t.filter((t=>t!==e))))}))}),[t]);be((()=>At(e,["open","contentElement"],(n=>{var r;if(n.open&&n.contentElement)return null==(r=t.add)?void 0:r.call(t,e)}))),[e,t]);const a=(0,r.useMemo)((()=>({store:e,add:i})),[e,i]);return{wrapElement:(0,r.useCallback)((e=>(0,Le.jsx)(rr.Provider,{value:a,children:e})),[a]),nestedDialogs:n}}(k);_=Te(_,L,[L]),be((()=>{if(!N)return;const e=C.current,t=q(e,!0);t&&"BODY"!==t.tagName&&(e&&Y(e,t)||k.setDisclosureElement(t))}),[k,N]),gr&&(0,r.useEffect)((()=>{if(!D)return;const{disclosureElement:e}=k.getState();if(!e)return;if(!X(e))return;const t=()=>{let t=!1;const n=()=>{t=!0};e.addEventListener("focusin",n,{capture:!0,once:!0}),me(e,"mouseup",(()=>{e.removeEventListener("focusin",n,!0),t||Qe(e)}))};return e.addEventListener("mousedown",t),()=>{e.removeEventListener("mousedown",t)}}),[k,D]),(0,r.useEffect)((()=>{if(!s)return;if(!D)return;if(!T)return;const e=C.current;if(!e)return;return e.querySelector("[data-dialog-dismiss]")?void 0:function(e,t){const n=G(e).createElement("button");return n.type="button",n.tabIndex=-1,n.textContent="Dismiss popup",Object.assign(n.style,{border:"0px",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0px",position:"absolute",whiteSpace:"nowrap",width:"1px"}),n.addEventListener("click",t),e.prepend(n),()=>{n.removeEventListener("click",t),n.remove()}}(e,k.hide)}),[k,s,D,T]),be((()=>{if(N)return;if(!D)return;if(!T)return;const e=C.current;return e?er(e):void 0}),[N,D,T]);const B=N&&T;be((()=>{if(!M)return;if(!B)return;const e=C.current;return function(e,t){const{body:n}=G(t[0]),r=[];return Vn(e,t,(t=>{r.push(zn(t,Bn(e),!0))})),z(zn(n,Bn(e),!0),(()=>r.forEach((e=>e()))))}(M,[e])}),[M,B]);const j=we(m);be((()=>{if(!M)return;if(!B)return;const{disclosureElement:e}=k.getState(),t=[C.current,...j()||[],...F.map((e=>e.getState().contentElement))];return s?z(Un(M,t),function(e,t){const n=[],r=t.map((e=>null==e?void 0:e.id));return Vn(e,t,(e=>{Nn(e,...r)||n.unshift(er(e,t))})),()=>{n.forEach((e=>e()))}}(M,t)):Un(M,[e,...t])}),[M,k,B,j,F,s]);const V=!!h,H=Pe(h),[$,W]=(0,r.useState)(!1);(0,r.useEffect)((()=>{if(!N)return;if(!V)return;if(!T)return;if(!(null==A?void 0:A.isConnected))return;const e=vr(v,!0)||A.querySelector("[data-autofocus=true],[autofocus]")||Ye(A,!0,l&&R)||A,t=We(e);H(t?e:null)&&(W(!0),queueMicrotask((()=>{e.focus(),gr&&e.scrollIntoView({block:"nearest",inline:"nearest"})})))}),[N,V,T,A,v,l,R,H]);const U=!!g,K=Pe(g),[Z,J]=(0,r.useState)(!1);(0,r.useEffect)((()=>{if(N)return J(!0),()=>J(!1)}),[N]);const Q=(0,r.useCallback)(((e,t=!0)=>{const{disclosureElement:n}=k.getState();if(function(e){const t=q();return!(!t||e&&Y(e,t)||!We(t))}(e))return;let r=vr(b)||n;if(null==r?void 0:r.id){const e=G(r),t=`[aria-activedescendant="${r.id}"]`,n=e.querySelector(t);n&&(r=n)}if(r&&!We(r)){const e=ee(r,"[data-dialog]");if(e&&e.id){const t=G(e),n=`[aria-controls~="${e.id}"]`,o=t.querySelector(n);o&&(r=o)}}const o=r&&We(r);o||!t?K(o?r:null)&&o&&(null==r||r.focus()):requestAnimationFrame((()=>Q(e,!1)))}),[k,b,K]);be((()=>{if(N)return;if(!Z)return;if(!U)return;const e=C.current;Q(e)}),[N,Z,T,U,Q]),(0,r.useEffect)((()=>{if(!Z)return;if(!U)return;const e=C.current;return()=>Q(e)}),[Z,U,Q]);const te=Pe(d);(0,r.useEffect)((()=>{if(!T)return;if(!D)return;return pe("keydown",(e=>{if("Escape"!==e.key)return;if(e.defaultPrevented)return;const t=C.current;if(!t)return;if(Wn(t))return;const n=e.target;if(!n)return;const{disclosureElement:r}=k.getState();("BODY"===n.tagName||Y(t,n)||!r||Y(r,n))&&te(e)&&k.hide()}),!0)}),[k,T,D,te]);const ne=(_=Te(_,(e=>(0,Le.jsx)(cr,{level:s?1:void 0,children:e})),[s])).hidden,re=_.alwaysVisible;_=Te(_,(e=>c?(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsx)(Jn,{store:k,backdrop:c,backdropProps:u,hidden:ne,alwaysVisible:re}),e]}):e),[k,c,u,ne,re]);const[oe,ie]=(0,r.useState)(),[ae,se]=(0,r.useState)();return _=Te(_,(e=>(0,Le.jsx)(dn,{value:k,children:(0,Le.jsx)(fn.Provider,{value:ie,children:(0,Le.jsx)(mn.Provider,{value:se,children:e})})})),[k]),_=w(x({id:M,"data-dialog":"",role:"dialog",tabIndex:a?-1:void 0,"aria-labelledby":oe,"aria-describedby":ae},_),{ref:Ee(C,_.ref)}),_=sr(w(x({},_),{autoFocusOnShow:$})),_=Kn(x({store:k},_)),_=ct(w(x({},_),{focusable:a})),_=hr(w(x({portal:l},_),{portalRef:P,preserveTabOrder:R}))}));function yr(e,t=cn){return Fe((n=>{const r=t();return Vt(n.store||r,(e=>!n.unmountOnHide||(null==e?void 0:e.mounted)||!!n.open))?(0,Le.jsx)(e,x({},n)):null}))}yr(Fe((e=>je("div",br(e)))),cn);const xr=Math.min,wr=Math.max,Er=(Math.round,Math.floor,{left:"right",right:"left",bottom:"top",top:"bottom"}),_r={start:"end",end:"start"};function Sr(e,t,n){return wr(e,xr(t,n))}function Cr(e,t){return"function"==typeof e?e(t):e}function kr(e){return e.split("-")[0]}function Pr(e){return e.split("-")[1]}function Tr(e){return"x"===e?"y":"x"}function Ir(e){return"y"===e?"height":"width"}function Rr(e){return["top","bottom"].includes(kr(e))?"y":"x"}function Mr(e){return Tr(Rr(e))}function Nr(e){return e.replace(/start|end/g,(e=>_r[e]))}function Dr(e){return e.replace(/left|right|bottom|top/g,(e=>Er[e]))}function Ar(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Or(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function zr(e,t,n){let{reference:r,floating:o}=e;const i=Rr(t),a=Mr(t),s=Ir(a),l=kr(t),c="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[s]/2-o[s]/2;let m;switch(l){case"top":m={x:u,y:r.y-o.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:d};break;case"left":m={x:r.x-o.width,y:d};break;default:m={x:r.x,y:r.y}}switch(Pr(t)){case"start":m[a]-=f*(n&&c?-1:1);break;case"end":m[a]+=f*(n&&c?-1:1)}return m}async function Lr(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:m=0}=Cr(t,e),p=Ar(m),h=s[f?"floating"===d?"reference":"floating":d],g=Or(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{...a.floating,x:r,y:o}:a.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),y=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},x=Or(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:v,offsetParent:b,strategy:l}):v);return{top:(g.top-x.top+p.top)/y.y,bottom:(x.bottom-g.bottom+p.bottom)/y.y,left:(g.left-x.left+p.left)/y.x,right:(x.right-g.right+p.right)/y.x}}const Fr=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=kr(n),s=Pr(n),l="y"===Rr(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=Cr(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:p}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof p&&(m="end"===s?-1*p:p),l?{x:m*u,y:f*c}:{x:f*c,y:m*u}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}},Br=Math.min,jr=Math.max,Vr=Math.round,Hr=Math.floor,$r=e=>({x:e,y:e});function Wr(e){return qr(e)?(e.nodeName||"").toLowerCase():"#document"}function Ur(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Gr(e){var t;return null==(t=(qr(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function qr(e){return e instanceof Node||e instanceof Ur(e).Node}function Yr(e){return e instanceof Element||e instanceof Ur(e).Element}function Kr(e){return e instanceof HTMLElement||e instanceof Ur(e).HTMLElement}function Xr(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Ur(e).ShadowRoot)}function Zr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=no(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Jr(e){return["table","td","th"].includes(Wr(e))}function Qr(e){const t=eo(),n=no(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function eo(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function to(e){return["html","body","#document"].includes(Wr(e))}function no(e){return Ur(e).getComputedStyle(e)}function ro(e){return Yr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function oo(e){if("html"===Wr(e))return e;const t=e.assignedSlot||e.parentNode||Xr(e)&&e.host||Gr(e);return Xr(t)?t.host:t}function io(e){const t=oo(e);return to(t)?e.ownerDocument?e.ownerDocument.body:e.body:Kr(t)&&Zr(t)?t:io(t)}function ao(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=io(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=Ur(o);return i?t.concat(a,a.visualViewport||[],Zr(o)?o:[],a.frameElement&&n?ao(a.frameElement):[]):t.concat(o,ao(o,[],n))}function so(e){const t=no(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Kr(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Vr(n)!==i||Vr(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function lo(e){return Yr(e)?e:e.contextElement}function co(e){const t=lo(e);if(!Kr(t))return $r(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=so(t);let a=(i?Vr(n.width):n.width)/r,s=(i?Vr(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const uo=$r(0);function fo(e){const t=Ur(e);return eo()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:uo}function mo(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=lo(e);let a=$r(1);t&&(r?Yr(r)&&(a=co(r)):a=co(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Ur(e))&&t}(i,n,r)?fo(i):$r(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(i){const e=Ur(i),t=r&&Yr(r)?Ur(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=co(o),t=o.getBoundingClientRect(),r=no(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,n=Ur(o),o=n.frameElement}}return Or({width:u,height:d,x:l,y:c})}const po=[":popover-open",":modal"];function ho(e){return po.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function go(e){return mo(Gr(e)).left+ro(e).scrollLeft}function vo(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Ur(e),r=Gr(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=eo();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=Gr(e),n=ro(e),r=e.ownerDocument.body,o=jr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=jr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+go(e);const s=-n.scrollTop;return"rtl"===no(r).direction&&(a+=jr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Gr(e));else if(Yr(t))r=function(e,t){const n=mo(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Kr(e)?co(e):$r(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=fo(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Or(r)}function bo(e,t){const n=oo(e);return!(n===t||!Yr(n)||to(n))&&("fixed"===no(n).position||bo(n,t))}function yo(e,t,n){const r=Kr(t),o=Gr(t),i="fixed"===n,a=mo(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=$r(0);if(r||!r&&!i)if(("body"!==Wr(t)||Zr(o))&&(s=ro(t)),r){const e=mo(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=go(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function xo(e,t){return Kr(e)&&"fixed"!==no(e).position?t?t(e):e.offsetParent:null}function wo(e,t){const n=Ur(e);if(!Kr(e)||ho(e))return n;let r=xo(e,t);for(;r&&Jr(r)&&"static"===no(r).position;)r=xo(r,t);return r&&("html"===Wr(r)||"body"===Wr(r)&&"static"===no(r).position&&!Qr(r))?n:r||function(e){let t=oo(e);for(;Kr(t)&&!to(t);){if(Qr(t))return t;t=oo(t)}return null}(e)||n}const Eo={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Gr(r),s=!!t&&ho(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=$r(1);const u=$r(0),d=Kr(r);if((d||!d&&!i)&&(("body"!==Wr(r)||Zr(a))&&(l=ro(r)),Kr(r))){const e=mo(r);c=co(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}},getDocumentElement:Gr,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i="clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=ao(e,[],!1).filter((e=>Yr(e)&&"body"!==Wr(e))),o=null;const i="fixed"===no(e).position;let a=i?oo(e):e;for(;Yr(a)&&!to(a);){const t=no(a),n=Qr(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||Zr(a)&&!n&&bo(e,a))?r=r.filter((e=>e!==a)):o=t,a=oo(a)}return t.set(e,r),r}(t,this._c):[].concat(n),a=[...i,r],s=a[0],l=a.reduce(((e,n)=>{const r=vo(t,n,o);return e.top=jr(r.top,e.top),e.right=Br(r.right,e.right),e.bottom=Br(r.bottom,e.bottom),e.left=jr(r.left,e.left),e}),vo(t,s,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:wo,getElementRects:async function(e){const t=this.getOffsetParent||wo,n=this.getDimensions;return{reference:yo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=so(e);return{width:t,height:n}},getScale:co,isElement:Yr,isRTL:function(e){return"rtl"===no(e).direction}};function _o(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=lo(e),u=o||i?[...c?ao(c):[],...ao(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=c&&s?function(e,t){let n,r=null;const o=Gr(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const{left:c,top:u,width:d,height:f}=e.getBoundingClientRect();if(s||t(),!d||!f)return;const m={rootMargin:-Hr(u)+"px "+-Hr(o.clientWidth-(c+d))+"px "+-Hr(o.clientHeight-(u+f))+"px "+-Hr(c)+"px",threshold:jr(0,Br(1,l))||1};let p=!0;function h(e){const t=e[0].intersectionRatio;if(t!==l){if(!p)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7)}),100)}p=!1}try{r=new IntersectionObserver(h,{...m,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(h,m)}r.observe(e)}(!0),i}(c,n):null;let f,m=-1,p=null;a&&(p=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame((()=>{var e;null==(e=p)||e.observe(t)}))),n()})),c&&!l&&p.observe(c),p.observe(t));let h=l?mo(e):null;return l&&function t(){const r=mo(e);!h||r.x===h.x&&r.y===h.y&&r.width===h.width&&r.height===h.height||n();h=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=p)||e.disconnect(),p=null,l&&cancelAnimationFrame(f)}}const So=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Cr(e,t),c={x:n,y:r},u=await Lr(t,l),d=Rr(kr(o)),f=Tr(d);let m=c[f],p=c[d];if(i){const e="y"===f?"bottom":"right";m=Sr(m+u["y"===f?"top":"left"],m,m-u[e])}if(a){const e="y"===d?"bottom":"right";p=Sr(p+u["y"===d?"top":"left"],p,p-u[e])}const h=s.fn({...t,[f]:m,[d]:p});return{...h,data:{x:h.x-n,y:h.y-r}}}}},Co=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...g}=Cr(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=kr(o),b=kr(s)===s,y=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=f||(b||!h?[Dr(s)]:function(e){const t=Dr(e);return[Nr(e),t,Nr(t)]}(s));f||"none"===p||x.push(...function(e,t,n,r){const o=Pr(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(kr(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Nr)))),i}(s,h,p,y));const w=[s,...x],E=await Lr(t,g),_=[];let S=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&_.push(E[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=Pr(e),o=Mr(e),i=Ir(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Dr(a)),[a,Dr(a)]}(o,a,y);_.push(E[e[0]],E[e[1]])}if(S=[...S,{placement:o,overflows:_}],!_.every((e=>e<=0))){var C,k;const e=((null==(C=i.flip)?void 0:C.index)||0)+1,t=w[e];if(t)return{data:{index:e,overflows:S},reset:{placement:t}};let n=null==(k=S.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:k.placement;if(!n)switch(m){case"bestFit":{var P;const e=null==(P=S.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:P[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},ko=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:a=(()=>{}),...s}=Cr(e,t),l=await Lr(t,s),c=kr(n),u=Pr(n),d="y"===Rr(n),{width:f,height:m}=r.floating;let p,h;"top"===c||"bottom"===c?(p=c,h=u===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(h=c,p="end"===u?"top":"bottom");const g=m-l[p],v=f-l[h],b=!t.middlewareData.shift;let y=g,x=v;if(d){const e=f-l.left-l.right;x=u||b?xr(v,e):e}else{const e=m-l.top-l.bottom;y=u||b?xr(g,e):e}if(b&&!u){const e=wr(l.left,0),t=wr(l.right,0),n=wr(l.top,0),r=wr(l.bottom,0);d?x=f-2*(0!==e||0!==t?e+t:wr(l.left,l.right)):y=m-2*(0!==n||0!==r?n+r:wr(l.top,l.bottom))}await a({...t,availableWidth:x,availableHeight:y});const w=await o.getDimensions(i.floating);return f!==w.width||m!==w.height?{reset:{rects:!0}}:{}}}},Po=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=Cr(e,t)||{};if(null==c)return{};const d=Ar(u),f={x:n,y:r},m=Mr(o),p=Ir(m),h=await a.getDimensions(c),g="y"===m,v=g?"top":"left",b=g?"bottom":"right",y=g?"clientHeight":"clientWidth",x=i.reference[p]+i.reference[m]-f[m]-i.floating[p],w=f[m]-i.reference[m],E=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let _=E?E[y]:0;_&&await(null==a.isElement?void 0:a.isElement(E))||(_=s.floating[y]||i.floating[p]);const S=x/2-w/2,C=_/2-h[p]/2-1,k=xr(d[v],C),P=xr(d[b],C),T=k,I=_-h[p]-P,R=_/2-h[p]/2+S,M=Sr(T,R,I),N=!l.arrow&&null!=Pr(o)&&R!=M&&i.reference[p]/2-(R<T?k:P)-h[p]/2<0,D=N?R<T?R-T:R-I:0;return{[m]:f[m]+D,data:{[m]:M,centerOffset:R-M-D,...N&&{alignmentOffset:D}},reset:N}}}),To=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=Cr(e,t),u={x:n,y:r},d=Rr(o),f=Tr(d);let m=u[f],p=u[d];const h=Cr(s,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const e="y"===f?"height":"width",t=i.reference[f]-i.floating[e]+g.mainAxis,n=i.reference[f]+i.reference[e]-g.mainAxis;m<t?m=t:m>n&&(m=n)}if(c){var v,b;const e="y"===f?"width":"height",t=["top","left"].includes(kr(o)),n=i.reference[d]-i.floating[e]+(t&&(null==(v=a.offset)?void 0:v[d])||0)+(t?0:g.crossAxis),r=i.reference[d]+i.reference[e]+(t?0:(null==(b=a.offset)?void 0:b[d])||0)-(t?g.crossAxis:0);p<n?p=n:p>r&&(p=r)}return{[f]:m,[d]:p}}}},Io=(e,t,n)=>{const r=new Map,o={platform:Eo,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=zr(c,r,l),f=r,m={},p=0;for(let n=0;n<s.length;n++){const{name:i,fn:h}=s[n],{x:g,y:v,data:b,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=v?v:d,m={...m,[i]:{...m[i],...b}},y&&p<=50&&(p++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(c=!0===y.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):y.rects),({x:u,y:d}=zr(c,f,l))),n=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:m}})(e,t,{...o,platform:i})};function Ro(e=0,t=0,n=0,r=0){if("function"==typeof DOMRect)return new DOMRect(e,t,n,r);const o={x:e,y:t,width:n,height:r,top:t,right:e+n,bottom:t+r,left:e};return w(x({},o),{toJSON:()=>o})}function Mo(e,t){return{contextElement:e||void 0,getBoundingClientRect:()=>{const n=e,r=null==t?void 0:t(n);return r||!n?function(e){if(!e)return Ro();const{x:t,y:n,width:r,height:o}=e;return Ro(t,n,r,o)}(r):n.getBoundingClientRect()}}}function No(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}function Do(e){const t=window.devicePixelRatio||1;return Math.round(e*t)/t}function Ao(e,t){return Fr((({placement:n})=>{var r;const o=((null==e?void 0:e.clientHeight)||0)/2,i="number"==typeof t.gutter?t.gutter+o:null!=(r=t.gutter)?r:o;return{crossAxis:!!n.split("-")[1]?void 0:t.shift,mainAxis:i,alignmentAxis:t.shift}}))}function Oo(e){if(!1===e.flip)return;const t="string"==typeof e.flip?e.flip.split(" "):void 0;return F(!t||t.every(No),!1),Co({padding:e.overflowPadding,fallbackPlacements:t})}function zo(e){if(e.slide||e.overlap)return So({mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:To()})}function Lo(e){return ko({padding:e.overflowPadding,apply({elements:t,availableWidth:n,availableHeight:r,rects:o}){const i=t.floating,a=Math.round(o.reference.width);n=Math.floor(n),r=Math.floor(r),i.style.setProperty("--popover-anchor-width",`${a}px`),i.style.setProperty("--popover-available-width",`${n}px`),i.style.setProperty("--popover-available-height",`${r}px`),e.sameWidth&&(i.style.width=`${a}px`),e.fitViewport&&(i.style.maxWidth=`${n}px`,i.style.maxHeight=`${r}px`)}})}function Fo(e,t){if(e)return Po({element:e,padding:t.arrowPadding})}var Bo=Ve((e=>{var t=e,{store:n,modal:o=!1,portal:i=!!o,preserveTabOrder:a=!0,autoFocusOnShow:s=!0,wrapperProps:l,fixed:c=!1,flip:u=!0,shift:d=0,slide:f=!0,overlap:m=!1,sameWidth:p=!1,fitViewport:h=!1,gutter:g,arrowPadding:v=4,overflowPadding:b=8,getAnchorRect:y,updatePosition:_}=t,S=E(t,["store","modal","portal","preserveTabOrder","autoFocusOnShow","wrapperProps","fixed","flip","shift","slide","overlap","sameWidth","fitViewport","gutter","arrowPadding","overflowPadding","getAnchorRect","updatePosition"]);const C=hn();F(n=n||C,!1);const k=n.useState("arrowElement"),P=n.useState("anchorElement"),T=n.useState("disclosureElement"),I=n.useState("popoverElement"),R=n.useState("contentElement"),M=n.useState("placement"),N=n.useState("mounted"),D=n.useState("rendered"),[A,O]=(0,r.useState)(!1),{portalRef:z,domReady:L}=Ie(i,S.portalRef),B=we(y),j=we(_),V=!!_;be((()=>{if(!(null==I?void 0:I.isConnected))return;I.style.setProperty("--popover-overflow-padding",`${b}px`);const e=Mo(P,B),t=async()=>{if(!N)return;const t=[Ao(k,{gutter:g,shift:d}),Oo({flip:u,overflowPadding:b}),zo({slide:f,shift:d,overlap:m,overflowPadding:b}),Fo(k,{arrowPadding:v}),Lo({sameWidth:p,fitViewport:h,overflowPadding:b})],r=await Io(e,I,{placement:M,strategy:c?"fixed":"absolute",middleware:t});null==n||n.setState("currentPlacement",r.placement),O(!0);const o=Do(r.x),i=Do(r.y);if(Object.assign(I.style,{top:"0",left:"0",transform:`translate3d(${o}px,${i}px,0)`}),k&&r.middlewareData.arrow){const{x:e,y:t}=r.middlewareData.arrow,n=r.placement.split("-")[0];Object.assign(k.style,{left:null!=e?`${e}px`:"",top:null!=t?`${t}px`:"",[n]:"100%"})}},r=_o(e,I,(async()=>{V?(await j({updatePosition:t}),O(!0)):await t()}),{elementResize:"function"==typeof ResizeObserver});return()=>{O(!1),r()}}),[n,D,I,k,P,I,M,N,L,c,u,d,f,m,p,h,g,v,b,B,V,j]),be((()=>{if(!N)return;if(!L)return;if(!(null==I?void 0:I.isConnected))return;if(!(null==R?void 0:R.isConnected))return;const e=()=>{I.style.zIndex=getComputedStyle(R).zIndex};e();let t=requestAnimationFrame((()=>{t=requestAnimationFrame(e)}));return()=>cancelAnimationFrame(t)}),[N,L,I,R]);const H=c?"fixed":"absolute";return S=Te(S,(e=>(0,Le.jsx)("div",w(x({role:"presentation"},l),{style:x({position:H,top:0,left:0,width:"max-content"},null==l?void 0:l.style),ref:null==n?void 0:n.setPopoverElement,children:e}))),[n,H,l]),S=Te(S,(e=>(0,Le.jsx)(vn,{value:n,children:e})),[n]),S=w(x({"data-placing":A?void 0:""},S),{style:x({position:"relative"},S.style)}),S=br(w(x({store:n,modal:o,portal:i,preserveTabOrder:a,preserveTabOrderAnchor:T||P,autoFocusOnShow:A&&s},S),{portalRef:z}))}));yr(Fe((e=>je("div",Bo(e)))),hn);function jo(e,t,n,r){return!!Je(t)||!!e&&(!!Y(t,e)||(!(!n||!Y(n,e))||!!(null==r?void 0:r.some((t=>jo(e,t,n))))))}var Vo=(0,r.createContext)(null),Ho=Ve((e=>{var t=e,{store:n,modal:o=!1,portal:i=!!o,hideOnEscape:a=!0,hideOnHoverOutside:s=!0,disablePointerEventsOnApproach:l=!!s}=t,c=E(t,["store","modal","portal","hideOnEscape","hideOnHoverOutside","disablePointerEventsOnApproach"]);const u=yn();F(n=n||u,!1);const d=(0,r.useRef)(null),[f,m]=(0,r.useState)([]),p=(0,r.useRef)(0),h=(0,r.useRef)(null),{portalRef:g,domReady:v}=Ie(i,c.portalRef),b=!!s,y=Pe(s),_=!!l,S=Pe(l),C=n.useState("open"),k=n.useState("mounted");(0,r.useEffect)((()=>{if(!v)return;if(!k)return;if(!b&&!_)return;const e=d.current;if(!e)return;return z(pe("mousemove",(t=>{if(!n)return;const{anchorElement:r,hideTimeout:o,timeout:i}=n.getState(),a=h.current,[s]=t.composedPath(),l=r;if(jo(s,e,l,f))return h.current=s&&l&&Y(l,s)?In(t):null,window.clearTimeout(p.current),void(p.current=0);if(!p.current){if(a){const n=In(t);if(Rn(n,Mn(e,a))){if(h.current=n,!S(t))return;return t.preventDefault(),void t.stopPropagation()}}y(t)&&(p.current=window.setTimeout((()=>{p.current=0,null==n||n.hide()}),null!=o?o:i))}}),!0),(()=>clearTimeout(p.current)))}),[n,v,k,b,_,f,S,y]),(0,r.useEffect)((()=>{if(!v)return;if(!k)return;if(!_)return;const e=e=>{const t=d.current;if(!t)return;const n=h.current;if(!n)return;const r=Mn(t,n);if(Rn(In(e),r)){if(!S(e))return;e.preventDefault(),e.stopPropagation()}};return z(pe("mouseenter",e,!0),pe("mouseover",e,!0),pe("mouseout",e,!0),pe("mouseleave",e,!0))}),[v,k,_,S]),(0,r.useEffect)((()=>{v&&(C||null==n||n.setAutoFocusOnShow(!1))}),[n,v,C]);const P=xe(C);(0,r.useEffect)((()=>{if(v)return()=>{P.current||null==n||n.setAutoFocusOnShow(!1)}}),[n,v]);const T=(0,r.useContext)(Vo);be((()=>{if(o)return;if(!i)return;if(!k)return;if(!v)return;const e=d.current;return e?null==T?void 0:T(e):void 0}),[o,i,k,v]);const I=(0,r.useCallback)((e=>{m((t=>[...t,e]));const t=null==T?void 0:T(e);return()=>{m((t=>t.filter((t=>t!==e)))),null==t||t()}}),[T]);c=Te(c,(e=>(0,Le.jsx)(wn,{value:n,children:(0,Le.jsx)(Vo.Provider,{value:I,children:e})})),[n,I]),c=w(x({},c),{ref:Ee(d,c.ref)}),c=function(e){var t=e,{store:n}=t,o=E(t,["store"]);const[i,a]=(0,r.useState)(!1),s=n.useState("mounted");(0,r.useEffect)((()=>{s||a(!1)}),[s]);const l=o.onFocus,c=we((e=>{null==l||l(e),e.defaultPrevented||a(!0)})),u=(0,r.useRef)(null);return(0,r.useEffect)((()=>At(n,["anchorElement"],(e=>{u.current=e.anchorElement}))),[]),w(x({autoFocusOnHide:i,finalFocus:u},o),{onFocus:c})}(x({store:n},c));const R=n.useState((e=>o||e.autoFocusOnShow));return c=Bo(w(x({store:n,modal:o,portal:i,autoFocusOnShow:R},c),{portalRef:g,hideOnEscape:e=>!B(a,e)&&(requestAnimationFrame((()=>{requestAnimationFrame((()=>{null==n||n.hide()}))})),!0)}))}));yr(Fe((e=>je("div",Ho(e)))),yn);var $o=Ve((e=>{var t=e,{store:n,portal:r=!0,gutter:o=8,preserveTabOrder:i=!1,hideOnHoverOutside:a=!0,hideOnInteractOutside:s=!0}=t,l=E(t,["store","portal","gutter","preserveTabOrder","hideOnHoverOutside","hideOnInteractOutside"]);const c=Sn();F(n=n||c,!1),l=Te(l,(e=>(0,Le.jsx)(Cn,{value:n,children:e})),[n]);const u=n.useState((e=>"description"===e.type?"tooltip":"none"));return l=x({role:u},l),l=Ho(w(x({},l),{store:n,portal:r,gutter:o,preserveTabOrder:i,hideOnHoverOutside:e=>{if(B(a,e))return!1;const t=null==n?void 0:n.getState().anchorElement;return!t||!("focusVisible"in t.dataset)},hideOnInteractOutside:e=>{if(B(s,e))return!1;const t=null==n?void 0:n.getState().anchorElement;return!t||!Y(t,e.target)}}))})),Wo=yr(Fe((e=>je("div",$o(e)))),Sn);const Uo=window.wp.element,Go=window.wp.deprecated;var qo=o.n(Go);const Yo=function(e){const{shortcut:t,className:n}=e;if(!t)return null;let o,i;return"string"==typeof t&&(o=t),null!==t&&"object"==typeof t&&(o=t.display,i=t.ariaLabel),(0,r.createElement)("span",{className:n,"aria-label":i},o)},Ko={bottom:"bottom",top:"top","middle left":"left","middle right":"right","bottom left":"bottom-end","bottom center":"bottom","bottom right":"bottom-start","top left":"top-end","top center":"top","top right":"top-start","middle left left":"left","middle left right":"left","middle left bottom":"left-end","middle left top":"left-start","middle right left":"right","middle right right":"right","middle right bottom":"right-end","middle right top":"right-start","bottom left left":"bottom-end","bottom left right":"bottom-end","bottom left bottom":"bottom-end","bottom left top":"bottom-end","bottom center left":"bottom","bottom center right":"bottom","bottom center bottom":"bottom","bottom center top":"bottom","bottom right left":"bottom-start","bottom right right":"bottom-start","bottom right bottom":"bottom-start","bottom right top":"bottom-start","top left left":"top-end","top left right":"top-end","top left bottom":"top-end","top left top":"top-end","top center left":"top","top center right":"top","top center bottom":"top","top center top":"top","top right left":"top-start","top right right":"top-start","top right bottom":"top-start","top right top":"top-start",middle:"bottom","middle center":"bottom","middle center bottom":"bottom","middle center left":"bottom","middle center right":"bottom","middle center top":"bottom"},Xo=e=>{var t;return null!==(t=Ko[e])&&void 0!==t?t:"bottom"},Zo={top:{originX:.5,originY:1},"top-start":{originX:0,originY:1},"top-end":{originX:1,originY:1},right:{originX:0,originY:.5},"right-start":{originX:0,originY:0},"right-end":{originX:0,originY:1},bottom:{originX:.5,originY:0},"bottom-start":{originX:0,originY:0},"bottom-end":{originX:1,originY:0},left:{originX:1,originY:.5},"left-start":{originX:1,originY:0},"left-end":{originX:1,originY:1},overlay:{originX:.5,originY:.5}};const Jo=e=>null===e||Number.isNaN(e)?void 0:Math.round(e),Qo=(0,Uo.createContext)({isNestedInTooltip:!1}),ei=700,ti={isNestedInTooltip:!0};const ni=(0,Uo.forwardRef)((function(e,t){const{children:n,delay:o=ei,hideOnClick:i=!0,placement:a,position:s,shortcut:l,text:c,...u}=e,{isNestedInTooltip:f}=(0,Uo.useContext)(Qo),m=(0,d.useInstanceId)(ni,"tooltip"),p=c||l?m:void 0,h=1===Uo.Children.count(n);let g;void 0!==a?g=a:void 0!==s&&(g=Xo(s),qo()("`position` prop in wp.components.tooltip",{since:"6.4",alternative:"`placement` prop"})),g=g||"bottom";const v=rn({placement:g,showTimeout:o});return f?h?(0,r.createElement)(on,{...u,render:n}):n:(0,r.createElement)(Qo.Provider,{value:ti},(0,r.createElement)(Tn,{onClick:i?v.hide:void 0,store:v,render:h?n:void 0,ref:t},h?void 0:n),h&&(c||l)&&(0,r.createElement)(Wo,{...u,className:"components-tooltip",unmountOnHide:!0,gutter:4,id:p,overflowPadding:.5,store:v},c,l&&(0,r.createElement)(Yo,{className:c?"components-tooltip__shortcut":"",shortcut:l})))})),ri=ni;window.wp.warning;var oi=o(66),ii=o.n(oi),ai=o(7734),si=o.n(ai);
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function li(e){return"[object Object]"===Object.prototype.toString.call(e)}function ci(e){var t,n;return!1!==li(e)&&(void 0===(t=e.constructor)||!1!==li(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}const ui=function(e,t){const n=(0,Uo.useRef)(!1);(0,Uo.useEffect)((()=>{if(n.current)return e();n.current=!0}),t)},di=(0,Uo.createContext)({}),fi=()=>(0,Uo.useContext)(di);const mi=(0,Uo.memo)((({children:e,value:t})=>{const n=function({value:e}){const t=fi(),n=(0,Uo.useRef)(e);return ui((()=>{si()(n.current,e)&&n.current}),[e]),(0,Uo.useMemo)((()=>ii()(null!=t?t:{},null!=e?e:{},{isMergeableObject:ci})),[t,e])}({value:t});return(0,r.createElement)(di.Provider,{value:n},e)})),pi="data-wp-component",hi="data-wp-c16t",gi="__contextSystemKey__";var vi=function(){return vi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},vi.apply(this,arguments)};Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;function bi(e){return e.toLowerCase()}var yi=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],xi=/[^A-Z0-9]+/gi;function wi(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce((function(e,t){return e.replace(t,n)}),e)}function Ei(e,t){return void 0===t&&(t={}),function(e,t){void 0===t&&(t={});for(var n=t.splitRegexp,r=void 0===n?yi:n,o=t.stripRegexp,i=void 0===o?xi:o,a=t.transform,s=void 0===a?bi:a,l=t.delimiter,c=void 0===l?" ":l,u=wi(wi(e,r,"$1\0$2"),i,"\0"),d=0,f=u.length;"\0"===u.charAt(d);)d++;for(;"\0"===u.charAt(f-1);)f--;return u.slice(d,f).split("\0").map(s).join(c)}(e,vi({delimiter:"."},t))}function _i(e,t){return void 0===t&&(t={}),Ei(e,vi({delimiter:"-"},t))}function Si(e,t){var n,r,o=0;function i(){var i,a,s=n,l=arguments.length;e:for(;s;){if(s.args.length===arguments.length){for(a=0;a<l;a++)if(s.args[a]!==arguments[a]){s=s.next;continue e}return s!==n&&(s===r&&(r=s.prev),s.prev.next=s.next,s.next&&(s.next.prev=s.prev),s.next=n,s.prev=null,n.prev=s,n=s),s.val}s=s.next}for(i=new Array(l),a=0;a<l;a++)i[a]=arguments[a];return s={args:i,val:e.apply(null,i)},n?(n.prev=s,s.next=n):r=s,o===t.maxSize?(r=r.prev).next=null:o++,n=s,s.val}return t=t||{},i.clear=function(){n=null,r=null,o=0},i}const Ci=Si((function(e){return`components-${_i(e)}`}));var ki=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(t);try{n.insertRule(e,n.cssRules.length)}catch(e){0}}else t.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach((function(e){return e.parentNode&&e.parentNode.removeChild(e)})),this.tags=[],this.ctr=0},e}(),Pi=Math.abs,Ti=String.fromCharCode,Ii=Object.assign;function Ri(e){return e.trim()}function Mi(e,t,n){return e.replace(t,n)}function Ni(e,t){return e.indexOf(t)}function Di(e,t){return 0|e.charCodeAt(t)}function Ai(e,t,n){return e.slice(t,n)}function Oi(e){return e.length}function zi(e){return e.length}function Li(e,t){return t.push(e),e}var Fi=1,Bi=1,ji=0,Vi=0,Hi=0,$i="";function Wi(e,t,n,r,o,i,a){return{value:e,root:t,parent:n,type:r,props:o,children:i,line:Fi,column:Bi,length:a,return:""}}function Ui(e,t){return Ii(Wi("",null,null,"",null,null,0),e,{length:-e.length},t)}function Gi(){return Hi=Vi>0?Di($i,--Vi):0,Bi--,10===Hi&&(Bi=1,Fi--),Hi}function qi(){return Hi=Vi<ji?Di($i,Vi++):0,Bi++,10===Hi&&(Bi=1,Fi++),Hi}function Yi(){return Di($i,Vi)}function Ki(){return Vi}function Xi(e,t){return Ai($i,e,t)}function Zi(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Ji(e){return Fi=Bi=1,ji=Oi($i=e),Vi=0,[]}function Qi(e){return $i="",e}function ea(e){return Ri(Xi(Vi-1,ra(91===e?e+2:40===e?e+1:e)))}function ta(e){for(;(Hi=Yi())&&Hi<33;)qi();return Zi(e)>2||Zi(Hi)>3?"":" "}function na(e,t){for(;--t&&qi()&&!(Hi<48||Hi>102||Hi>57&&Hi<65||Hi>70&&Hi<97););return Xi(e,Ki()+(t<6&&32==Yi()&&32==qi()))}function ra(e){for(;qi();)switch(Hi){case e:return Vi;case 34:case 39:34!==e&&39!==e&&ra(Hi);break;case 40:41===e&&ra(e);break;case 92:qi()}return Vi}function oa(e,t){for(;qi()&&e+Hi!==57&&(e+Hi!==84||47!==Yi()););return"/*"+Xi(t,Vi-1)+"*"+Ti(47===e?e:qi())}function ia(e){for(;!Zi(Yi());)qi();return Xi(e,Vi)}var aa="-ms-",sa="-moz-",la="-webkit-",ca="comm",ua="rule",da="decl",fa="@keyframes";function ma(e,t){for(var n="",r=zi(e),o=0;o<r;o++)n+=t(e[o],o,e,t)||"";return n}function pa(e,t,n,r){switch(e.type){case"@import":case da:return e.return=e.return||e.value;case ca:return"";case fa:return e.return=e.value+"{"+ma(e.children,r)+"}";case ua:e.value=e.props.join(",")}return Oi(n=ma(e.children,r))?e.return=e.value+"{"+n+"}":""}function ha(e){return Qi(ga("",null,null,null,[""],e=Ji(e),0,[0],e))}function ga(e,t,n,r,o,i,a,s,l){for(var c=0,u=0,d=a,f=0,m=0,p=0,h=1,g=1,v=1,b=0,y="",x=o,w=i,E=r,_=y;g;)switch(p=b,b=qi()){case 40:if(108!=p&&58==Di(_,d-1)){-1!=Ni(_+=Mi(ea(b),"&","&\f"),"&\f")&&(v=-1);break}case 34:case 39:case 91:_+=ea(b);break;case 9:case 10:case 13:case 32:_+=ta(p);break;case 92:_+=na(Ki()-1,7);continue;case 47:switch(Yi()){case 42:case 47:Li(ba(oa(qi(),Ki()),t,n),l);break;default:_+="/"}break;case 123*h:s[c++]=Oi(_)*v;case 125*h:case 59:case 0:switch(b){case 0:case 125:g=0;case 59+u:m>0&&Oi(_)-d&&Li(m>32?ya(_+";",r,n,d-1):ya(Mi(_," ","")+";",r,n,d-2),l);break;case 59:_+=";";default:if(Li(E=va(_,t,n,c,u,o,s,y,x=[],w=[],d),i),123===b)if(0===u)ga(_,t,E,E,x,i,d,s,w);else switch(99===f&&110===Di(_,3)?100:f){case 100:case 109:case 115:ga(e,E,E,r&&Li(va(e,E,E,0,0,o,s,y,o,x=[],d),w),o,w,d,s,r?x:w);break;default:ga(_,E,E,E,[""],w,0,s,w)}}c=u=m=0,h=v=1,y=_="",d=a;break;case 58:d=1+Oi(_),m=p;default:if(h<1)if(123==b)--h;else if(125==b&&0==h++&&125==Gi())continue;switch(_+=Ti(b),b*h){case 38:v=u>0?1:(_+="\f",-1);break;case 44:s[c++]=(Oi(_)-1)*v,v=1;break;case 64:45===Yi()&&(_+=ea(qi())),f=Yi(),u=d=Oi(y=_+=ia(Ki())),b++;break;case 45:45===p&&2==Oi(_)&&(h=0)}}return i}function va(e,t,n,r,o,i,a,s,l,c,u){for(var d=o-1,f=0===o?i:[""],m=zi(f),p=0,h=0,g=0;p<r;++p)for(var v=0,b=Ai(e,d+1,d=Pi(h=a[p])),y=e;v<m;++v)(y=Ri(h>0?f[v]+" "+b:Mi(b,/&\f/g,f[v])))&&(l[g++]=y);return Wi(e,t,n,0===o?ua:s,l,c,u)}function ba(e,t,n){return Wi(e,t,n,ca,Ti(Hi),Ai(e,2,-2),0)}function ya(e,t,n,r){return Wi(e,t,n,da,Ai(e,0,r),Ai(e,r+1,-1),r)}var xa=function(e,t,n){for(var r=0,o=0;r=o,o=Yi(),38===r&&12===o&&(t[n]=1),!Zi(o);)qi();return Xi(e,Vi)},wa=function(e,t){return Qi(function(e,t){var n=-1,r=44;do{switch(Zi(r)){case 0:38===r&&12===Yi()&&(t[n]=1),e[n]+=xa(Vi-1,t,n);break;case 2:e[n]+=ea(r);break;case 4:if(44===r){e[++n]=58===Yi()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=Ti(r)}}while(r=qi());return e}(Ji(e),t))},Ea=new WeakMap,_a=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,r=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||Ea.get(n))&&!r){Ea.set(e,!0);for(var o=[],i=wa(t,o),a=n.props,s=0,l=0;s<i.length;s++)for(var c=0;c<a.length;c++,l++)e.props[l]=o[s]?i[s].replace(/&\f/g,a[c]):a[c]+" "+i[s]}}},Sa=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function Ca(e,t){switch(function(e,t){return 45^Di(e,0)?(((t<<2^Di(e,0))<<2^Di(e,1))<<2^Di(e,2))<<2^Di(e,3):0}(e,t)){case 5103:return la+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return la+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return la+e+sa+e+aa+e+e;case 6828:case 4268:return la+e+aa+e+e;case 6165:return la+e+aa+"flex-"+e+e;case 5187:return la+e+Mi(e,/(\w+).+(:[^]+)/,la+"box-$1$2"+aa+"flex-$1$2")+e;case 5443:return la+e+aa+"flex-item-"+Mi(e,/flex-|-self/,"")+e;case 4675:return la+e+aa+"flex-line-pack"+Mi(e,/align-content|flex-|-self/,"")+e;case 5548:return la+e+aa+Mi(e,"shrink","negative")+e;case 5292:return la+e+aa+Mi(e,"basis","preferred-size")+e;case 6060:return la+"box-"+Mi(e,"-grow","")+la+e+aa+Mi(e,"grow","positive")+e;case 4554:return la+Mi(e,/([^-])(transform)/g,"$1"+la+"$2")+e;case 6187:return Mi(Mi(Mi(e,/(zoom-|grab)/,la+"$1"),/(image-set)/,la+"$1"),e,"")+e;case 5495:case 3959:return Mi(e,/(image-set\([^]*)/,la+"$1$`$1");case 4968:return Mi(Mi(e,/(.+:)(flex-)?(.*)/,la+"box-pack:$3"+aa+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+la+e+e;case 4095:case 3583:case 4068:case 2532:return Mi(e,/(.+)-inline(.+)/,la+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Oi(e)-1-t>6)switch(Di(e,t+1)){case 109:if(45!==Di(e,t+4))break;case 102:return Mi(e,/(.+:)(.+)-([^]+)/,"$1"+la+"$2-$3$1"+sa+(108==Di(e,t+3)?"$3":"$2-$3"))+e;case 115:return~Ni(e,"stretch")?Ca(Mi(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==Di(e,t+1))break;case 6444:switch(Di(e,Oi(e)-3-(~Ni(e,"!important")&&10))){case 107:return Mi(e,":",":"+la)+e;case 101:return Mi(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+la+(45===Di(e,14)?"inline-":"")+"box$3$1"+la+"$2$3$1"+aa+"$2box$3")+e}break;case 5936:switch(Di(e,t+11)){case 114:return la+e+aa+Mi(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return la+e+aa+Mi(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return la+e+aa+Mi(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return la+e+aa+e+e}return e}var ka=[function(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case da:e.return=Ca(e.value,e.length);break;case fa:return ma([Ui(e,{value:Mi(e.value,"@","@"+la)})],r);case ua:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=t.exec(e))?e[0]:e}(t,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return ma([Ui(e,{props:[Mi(t,/:(read-\w+)/,":-moz-$1")]})],r);case"::placeholder":return ma([Ui(e,{props:[Mi(t,/:(plac\w+)/,":"+la+"input-$1")]}),Ui(e,{props:[Mi(t,/:(plac\w+)/,":-moz-$1")]}),Ui(e,{props:[Mi(t,/:(plac\w+)/,aa+"input-$1")]})],r)}return""}))}}];const Pa=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var r=e.stylisPlugins||ka;var o,i,a={},s=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)a[t[n]]=!0;s.push(e)}));var l,c,u,d,f=[pa,(d=function(e){l.insert(e)},function(e){e.root||(e=e.return)&&d(e)})],m=(c=[_a,Sa].concat(r,f),u=zi(c),function(e,t,n,r){for(var o="",i=0;i<u;i++)o+=c[i](e,t,n,r)||"";return o});i=function(e,t,n,r){l=n,function(e){ma(ha(e),m)}(e?e+"{"+t.styles+"}":t.styles),r&&(p.inserted[t.name]=!0)};var p={key:t,sheet:new ki({key:t,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:a,registered:{},insert:i};return p.sheet.hydrate(s),p};const Ta=function(e){for(var t,n=0,r=0,o=e.length;o>=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)};const Ia={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function Ra(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var Ma=/[A-Z]|^ms/g,Na=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Da=function(e){return 45===e.charCodeAt(1)},Aa=function(e){return null!=e&&"boolean"!=typeof e},Oa=Ra((function(e){return Da(e)?e:e.replace(Ma,"-$&").toLowerCase()})),za=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(Na,(function(e,t,n){return Fa={name:t,styles:n,next:Fa},t}))}return 1===Ia[e]||Da(e)||"number"!=typeof t||0===t?t:t+"px"};function La(e,t,n){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return Fa={name:n.name,styles:n.styles,next:Fa},n.name;if(void 0!==n.styles){var r=n.next;if(void 0!==r)for(;void 0!==r;)Fa={name:r.name,styles:r.styles,next:Fa},r=r.next;return n.styles+";"}return function(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o<n.length;o++)r+=La(e,t,n[o])+";";else for(var i in n){var a=n[i];if("object"!=typeof a)null!=t&&void 0!==t[a]?r+=i+"{"+t[a]+"}":Aa(a)&&(r+=Oa(i)+":"+za(i,a)+";");else if(!Array.isArray(a)||"string"!=typeof a[0]||null!=t&&void 0!==t[a[0]]){var s=La(e,t,a);switch(i){case"animation":case"animationName":r+=Oa(i)+":"+s+";";break;default:r+=i+"{"+s+"}"}}else for(var l=0;l<a.length;l++)Aa(a[l])&&(r+=Oa(i)+":"+za(i,a[l])+";")}return r}(e,t,n);case"function":if(void 0!==e){var o=Fa,i=n(e);return Fa=o,La(e,t,i)}}if(null==t)return n;var a=t[n];return void 0!==a?a:n}var Fa,Ba=/label:\s*([^\s;\n{]+)\s*(;|$)/g;var ja=function(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var r=!0,o="";Fa=void 0;var i=e[0];null==i||void 0===i.raw?(r=!1,o+=La(n,t,i)):o+=i[0];for(var a=1;a<e.length;a++)o+=La(n,t,e[a]),r&&(o+=i[a]);Ba.lastIndex=0;for(var s,l="";null!==(s=Ba.exec(o));)l+="-"+s[1];return{name:Ta(o)+l,styles:o,next:Fa}},Va=!!r.useInsertionEffect&&r.useInsertionEffect,Ha=Va||function(e){return e()},$a=(0,r.createContext)("undefined"!=typeof HTMLElement?Pa({key:"css"}):null);var Wa=$a.Provider,Ua=function(e){return(0,r.forwardRef)((function(t,n){var o=(0,r.useContext)($a);return e(t,o,n)}))},Ga=(0,r.createContext)({});function qa(e,t,n){var r="";return n.split(" ").forEach((function(n){void 0!==e[n]?t.push(e[n]+";"):r+=n+" "})),r}var Ya=function(e,t,n){var r=e.key+"-"+t.name;!1===n&&void 0===e.registered[r]&&(e.registered[r]=t.styles)},Ka=function(e,t,n){Ya(e,t,n);var r=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var o=t;do{e.insert(t===o?"."+r:"",o,e.sheet,!0);o=o.next}while(void 0!==o)}};function Xa(e,t){if(void 0===e.inserted[t.name])return e.insert("",t,e.sheet,!0)}function Za(e,t,n){var r=[],o=qa(e,r,n);return r.length<2?n:o+t(r)}var Ja=function e(t){for(var n="",r=0;r<t.length;r++){var o=t[r];if(null!=o){var i=void 0;switch(typeof o){case"boolean":break;case"object":if(Array.isArray(o))i=e(o);else for(var a in i="",o)o[a]&&a&&(i&&(i+=" "),i+=a);break;default:i=o}i&&(n&&(n+=" "),n+=i)}}return n};const Qa=function(e){var t=Pa(e);t.sheet.speedy=function(e){this.isSpeedy=e},t.compat=!0;var n=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=ja(n,t.registered,void 0);return Ka(t,o,!1),t.key+"-"+o.name};return{css:n,cx:function(){for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return Za(t.registered,n,Ja(r))},injectGlobal:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=ja(n,t.registered);Xa(t,o)},keyframes:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=ja(n,t.registered),i="animation-"+o.name;return Xa(t,{name:o.name,styles:"@keyframes "+i+"{"+o.styles+"}"}),i},hydrate:function(e){e.forEach((function(e){t.inserted[e]=!0}))},flush:function(){t.registered={},t.inserted={},t.sheet.flush()},sheet:t.sheet,cache:t,getRegisteredStyles:qa.bind(null,t.registered),merge:Za.bind(null,t.registered,n)}};var es=Qa({key:"css"}),ts=(es.flush,es.hydrate,es.cx);es.merge,es.getRegisteredStyles,es.injectGlobal,es.keyframes,es.css,es.sheet,es.cache;const ns=()=>{const e=(0,r.useContext)($a),t=(0,Uo.useCallback)(((...t)=>{if(null===e)throw new Error("The `useCx` hook should be only used within a valid Emotion Cache Context");return ts(...t.map((t=>(e=>null!=e&&["name","styles"].every((t=>void 0!==e[t])))(t)?(Ka(e,t,!1),`${e.key}-${t.name}`):t)))}),[e]);return t};function rs(e,t){const n=fi(),r=n?.[t]||{},o={[hi]:!0,...(i=t,{[pi]:i})};var i;const{_overrides:a,...s}=r,l=Object.entries(s).length?Object.assign({},s,e):e,c=ns()(Ci(t),e.className),u="function"==typeof l.renderChildren?l.renderChildren(l):l.children;for(const e in l)o[e]=l[e];for(const e in a)o[e]=a[e];return void 0!==u&&(o.children=u),o.className=c,o}function os(e,t){return as(e,t,{forwardsRef:!0})}function is(e,t){return as(e,t)}function as(e,t,n){const r=n?.forwardsRef?(0,Uo.forwardRef)(e):e;let o=r[gi]||[t];return Array.isArray(t)&&(o=[...o,...t]),"string"==typeof t&&(o=[...o,t]),Object.assign(r,{[gi]:[...new Set(o)],displayName:t,selector:`.${Ci(t)}`})}function ss(e){if(!e)return[];let t=[];return e[gi]&&(t=e[gi]),e.type&&e.type[gi]&&(t=e.type[gi]),t}function ls(e,t){return!!e&&("string"==typeof t?ss(e).includes(t):!!Array.isArray(t)&&t.some((t=>ss(e).includes(t))))}const cs={border:0,clip:"rect(1px, 1px, 1px, 1px)",WebkitClipPath:"inset( 50% )",clipPath:"inset( 50% )",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",wordWrap:"normal"};function us(){return us=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},us.apply(this,arguments)}function ds(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var fs=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,ms=ds((function(e){return fs.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91})),ps=function(e){return"theme"!==e},hs=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?ms:ps},gs=function(e,t,n){var r;if(t){var o=t.shouldForwardProp;r=e.__emotion_forwardProp&&o?function(t){return e.__emotion_forwardProp(t)&&o(t)}:o}return"function"!=typeof r&&n&&(r=e.__emotion_forwardProp),r},vs=function(e){var t=e.cache,n=e.serialized,r=e.isStringTag;Ya(t,n,r);Ha((function(){return Ka(t,n,r)}));return null};const bs=function e(t,n){var o,i,a=t.__emotion_real===t,s=a&&t.__emotion_base||t;void 0!==n&&(o=n.label,i=n.target);var l=gs(t,n,a),c=l||hs(s),u=!c("as");return function(){var d=arguments,f=a&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==o&&f.push("label:"+o+";"),null==d[0]||void 0===d[0].raw)f.push.apply(f,d);else{0,f.push(d[0][0]);for(var m=d.length,p=1;p<m;p++)f.push(d[p],d[0][p])}var h=Ua((function(e,t,n){var o=u&&e.as||s,a="",d=[],m=e;if(null==e.theme){for(var p in m={},e)m[p]=e[p];m.theme=(0,r.useContext)(Ga)}"string"==typeof e.className?a=qa(t.registered,d,e.className):null!=e.className&&(a=e.className+" ");var h=ja(f.concat(d),t.registered,m);a+=t.key+"-"+h.name,void 0!==i&&(a+=" "+i);var g=u&&void 0===l?hs(o):c,v={};for(var b in e)u&&"as"===b||g(b)&&(v[b]=e[b]);return v.className=a,v.ref=n,(0,r.createElement)(r.Fragment,null,(0,r.createElement)(vs,{cache:t,serialized:h,isStringTag:"string"==typeof o}),(0,r.createElement)(o,v))}));return h.displayName=void 0!==o?o:"Styled("+("string"==typeof s?s:s.displayName||s.name||"Component")+")",h.defaultProps=t.defaultProps,h.__emotion_real=h,h.__emotion_base=s,h.__emotion_styles=f,h.__emotion_forwardProp=l,Object.defineProperty(h,"toString",{value:function(){return"."+i}}),h.withComponent=function(t,r){return e(t,us({},n,r,{shouldForwardProp:gs(h,r,!0)})).apply(void 0,f)},h}},ys=bs("div",{target:"e19lxcc00"})("");ys.selector=".components-view",ys.displayName="View";const xs=ys;const ws=os((function(e,t){const{style:n,...o}=rs(e,"VisuallyHidden");return(0,r.createElement)(xs,{ref:t,...o,style:{...cs,...n||{}}})}),"VisuallyHidden"),Es=[["top left","top center","top right"],["center left","center center","center right"],["bottom left","bottom center","bottom right"]],_s={"top left":(0,u.__)("Top Left"),"top center":(0,u.__)("Top Center"),"top right":(0,u.__)("Top Right"),"center left":(0,u.__)("Center Left"),"center center":(0,u.__)("Center"),center:(0,u.__)("Center"),"center right":(0,u.__)("Center Right"),"bottom left":(0,u.__)("Bottom Left"),"bottom center":(0,u.__)("Bottom Center"),"bottom right":(0,u.__)("Bottom Right")},Ss=Es.flat();function Cs(e){const t="center"===e?"center center":e,n=t?.replace("-"," ");return Ss.includes(n)?n:void 0}function ks(e,t){const n=Cs(t);if(!n)return;return`${e}-${n.replace(" ","-")}`}o(1880);function Ps(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ja(t)}var Ts=function(){var e=Ps.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}};const Is="#fff",Rs={900:"#1e1e1e",800:"#2f2f2f",700:"#757575",600:"#949494",400:"#ccc",300:"#ddd",200:"#e0e0e0",100:"#f0f0f0"},Ms={accent:"var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9))",accentDarker10:"var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6))",accentDarker20:"var(--wp-components-color-accent-darker-20, var(--wp-admin-theme-color-darker-20, #183ad6))",accentInverted:`var(--wp-components-color-accent-inverted, ${Is})`,background:`var(--wp-components-color-background, ${Is})`,foreground:`var(--wp-components-color-foreground, ${Rs[900]})`,foregroundInverted:`var(--wp-components-color-foreground-inverted, ${Is})`,gray:{900:`var(--wp-components-color-foreground, ${Rs[900]})`,800:`var(--wp-components-color-gray-800, ${Rs[800]})`,700:`var(--wp-components-color-gray-700, ${Rs[700]})`,600:`var(--wp-components-color-gray-600, ${Rs[600]})`,400:`var(--wp-components-color-gray-400, ${Rs[400]})`,300:`var(--wp-components-color-gray-300, ${Rs[300]})`,200:`var(--wp-components-color-gray-200, ${Rs[200]})`,100:`var(--wp-components-color-gray-100, ${Rs[100]})`}},Ns={background:Ms.background,backgroundDisabled:Ms.gray[100],border:Ms.gray[600],borderHover:Ms.gray[700],borderFocus:Ms.accent,borderDisabled:Ms.gray[400],textDisabled:Ms.gray[600],darkGrayPlaceholder:`color-mix(in srgb, ${Ms.foreground}, transparent 38%)`,lightGrayPlaceholder:`color-mix(in srgb, ${Ms.background}, transparent 35%)`},Ds=Object.freeze({gray:Rs,white:Is,alert:{yellow:"#f0b849",red:"#d94f4f",green:"#4ab866"},theme:Ms,ui:Ns});function As(e="transition"){let t;switch(e){case"transition":t="transition-duration: 0ms;";break;case"animation":t="animation-duration: 1ms;";break;default:t="\n\t\t\t\tanimation-duration: 1ms;\n\t\t\t\ttransition-duration: 0ms;\n\t\t\t"}return`\n\t\t@media ( prefers-reduced-motion: reduce ) {\n\t\t\t${t};\n\t\t}\n\t`}var Os={name:"93uojk",styles:"border-radius:2px;box-sizing:border-box;direction:ltr;display:grid;grid-template-columns:repeat( 3, 1fr );outline:none"};const zs=()=>Os,Ls=bs("div",{target:"ecapk1j3"})(zs,";border:1px solid transparent;cursor:pointer;grid-template-columns:auto;",(({size:e=92})=>Ps("grid-template-rows:repeat( 3, calc( ",e,"px / 3 ) );width:",e,"px;","")),";"),Fs=bs("div",{target:"ecapk1j2"})({name:"1x5gbbj",styles:"box-sizing:border-box;display:grid;grid-template-columns:repeat( 3, 1fr )"}),Bs=e=>Ps("background:currentColor;box-sizing:border-box;display:grid;margin:auto;transition:all 120ms linear;",As("transition")," ",(({isActive:e})=>Ps("box-shadow:",e?`0 0 0 2px ${Ds.gray[900]}`:null,";color:",e?Ds.gray[900]:Ds.gray[400],";*:hover>&{color:",e?Ds.gray[900]:Ds.theme.accent,";}",""))(e),";",""),js=bs("span",{target:"ecapk1j1"})("height:6px;width:6px;",Bs,";"),Vs=bs("span",{target:"ecapk1j0"})({name:"rjf3ub",styles:"appearance:none;border:none;box-sizing:border-box;margin:0;display:flex;position:relative;outline:none;align-items:center;justify-content:center;padding:0"});function Hs({id:e,isActive:t=!1,value:n,...o}){const i=_s[n];return(0,r.createElement)(ri,{text:i},(0,r.createElement)(qt,{id:e,render:(0,r.createElement)(Vs,{...o,role:"gridcell"})},(0,r.createElement)(ws,null,n),(0,r.createElement)(js,{isActive:t,role:"presentation"})))}function $s(e,t,n){return Ce(t,[n.store]),Ht(e,n,"items","setItems"),e}function Ws(e){const t=e.map(((e,t)=>[t,e]));let n=!1;return t.sort((([e,t],[r,o])=>{const i=t.element,a=o.element;return i===a?0:i&&a?function(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}(i,a)?(e>r&&(n=!0),-1):(e<r&&(n=!0),1):0})),n?t.map((([e,t])=>t)):e}function Us(e={}){var t;e.store;const n=null==(t=e.store)?void 0:t.getState(),r=V(e.items,null==n?void 0:n.items,e.defaultItems,[]),o=new Map(r.map((e=>[e.id,e]))),i={items:r,renderedItems:V(null==n?void 0:n.renderedItems,[])},a=null==(s=e.store)?void 0:s.__unstablePrivateStore;var s;const l=Rt({items:r,renderedItems:i.renderedItems},a),c=Rt(i,e.store),u=e=>{const t=Ws(e);l.setState("renderedItems",t),c.setState("renderedItems",t)};Mt(c,(()=>Nt(l))),Mt(l,(()=>Ot(l,["items"],(e=>{c.setState("items",e.items)})))),Mt(l,(()=>Ot(l,["renderedItems"],(e=>{let t=!0,n=requestAnimationFrame((()=>{const{renderedItems:t}=c.getState();e.renderedItems!==t&&u(e.renderedItems)}));if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(n);const r=function(e){var t;const n=e.find((e=>!!e.element)),r=[...e].reverse().find((e=>!!e.element));let o=null==(t=null==n?void 0:n.element)?void 0:t.parentElement;for(;o&&(null==r?void 0:r.element);){if(r&&o.contains(r.element))return o;o=o.parentElement}return G(o).body}(e.renderedItems),o=new IntersectionObserver((()=>{t?t=!1:(cancelAnimationFrame(n),n=requestAnimationFrame((()=>u(e.renderedItems))))}),{root:r});for(const t of e.renderedItems)t.element&&o.observe(t.element);return()=>{cancelAnimationFrame(n),o.disconnect()}}))));const d=(e,t,n=!1)=>{let r;t((t=>{const n=t.findIndex((({id:t})=>t===e.id)),i=t.slice();if(-1!==n){r=t[n];const a=R(R({},r),e);i[n]=a,o.set(e.id,a)}else i.push(e),o.set(e.id,e);return i}));return()=>{t((t=>{if(!r)return n&&o.delete(e.id),t.filter((({id:t})=>t!==e.id));const i=t.findIndex((({id:t})=>t===e.id));if(-1===i)return t;const a=t.slice();return a[i]=r,o.set(e.id,r),a}))}},f=e=>d(e,(e=>l.setState("items",e)),!0);return M(R({},c),{registerItem:f,renderItem:e=>z(f(e),d(e,(e=>l.setState("renderedItems",e)))),item:e=>{if(!e)return null;let t=o.get(e);if(!t){const{items:n}=c.getState();t=n.find((t=>t.id===e)),t&&o.set(e,t)}return t||null},__unstablePrivateStore:l})}function Gs(e){const t=[];for(const n of e)t.push(...n);return t}function qs(e){return e.slice().reverse()}var Ys={id:null};function Ks(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}function Xs(e,t){return e.filter((e=>e.rowId===t))}function Zs(e){const t=[];for(const n of e){const e=t.find((e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId}));e?e.push(n):t.push([n])}return t}function Js(e){let t=0;for(const{length:n}of e)n>t&&(t=n);return t}function Qs(e,t,n){const r=Js(e);for(const o of e)for(let e=0;e<r;e+=1){const r=o[e];if(!r||n&&r.disabled){const r=0===e&&n?Ks(o):o[e-1];o[e]=r&&t!==r.id&&n?r:{id:"__EMPTY_ITEM__",disabled:!0,rowId:null==r?void 0:r.rowId}}}return e}function el(e){const t=Zs(e),n=Js(t),r=[];for(let e=0;e<n;e+=1)for(const n of t){const t=n[e];t&&r.push(M(R({},t),{rowId:t.rowId?`${e}`:void 0}))}return r}function tl(e={}){var t;const n=null==(t=e.store)?void 0:t.getState(),r=Us(e),o=V(e.activeId,null==n?void 0:n.activeId,e.defaultActiveId),i=Rt(M(R({},r.getState()),{activeId:o,baseElement:V(null==n?void 0:n.baseElement,null),includesBaseElement:V(e.includesBaseElement,null==n?void 0:n.includesBaseElement,null===o),moves:V(null==n?void 0:n.moves,0),orientation:V(e.orientation,null==n?void 0:n.orientation,"both"),rtl:V(e.rtl,null==n?void 0:n.rtl,!1),virtualFocus:V(e.virtualFocus,null==n?void 0:n.virtualFocus,!1),focusLoop:V(e.focusLoop,null==n?void 0:n.focusLoop,!1),focusWrap:V(e.focusWrap,null==n?void 0:n.focusWrap,!1),focusShift:V(e.focusShift,null==n?void 0:n.focusShift,!1)}),r,e.store);Mt(i,(()=>At(i,["renderedItems","activeId"],(e=>{i.setState("activeId",(t=>{var n;return void 0!==t?t:null==(n=Ks(e.renderedItems))?void 0:n.id}))}))));const a=(e,t,n,r)=>{var o,a;const{activeId:s,rtl:l,focusLoop:c,focusWrap:u,includesBaseElement:d}=i.getState(),f=l&&"vertical"!==t?qs(e):e;if(null==s)return null==(o=Ks(f))?void 0:o.id;const m=f.find((e=>e.id===s));if(!m)return null==(a=Ks(f))?void 0:a.id;const p=!!m.rowId,h=f.indexOf(m),g=f.slice(h+1),v=Xs(g,m.rowId);if(void 0!==r){const e=function(e,t){return e.filter((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(v,s),t=e.slice(r)[0]||e[e.length-1];return null==t?void 0:t.id}const b=function(e){return"vertical"===e?"horizontal":"horizontal"===e?"vertical":void 0}(p?t||"horizontal":t),y=c&&c!==b,x=p&&u&&u!==b;if(n=n||!p&&y&&d,y){const e=function(e,t,n=!1){const r=e.findIndex((e=>e.id===t));return[...e.slice(r+1),...n?[Ys]:[],...e.slice(0,r)]}(x&&!n?f:Xs(f,m.rowId),s,n),t=Ks(e,s);return null==t?void 0:t.id}if(x){const e=Ks(n?v:g,s);return n?(null==e?void 0:e.id)||null:null==e?void 0:e.id}const w=Ks(v,s);return!w&&n?null:null==w?void 0:w.id};return M(R(R({},r),i),{setBaseElement:e=>i.setState("baseElement",e),setActiveId:e=>i.setState("activeId",e),move:e=>{void 0!==e&&(i.setState("activeId",e),i.setState("moves",(e=>e+1)))},first:()=>{var e;return null==(e=Ks(i.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=Ks(qs(i.getState().renderedItems)))?void 0:e.id},next:e=>{const{renderedItems:t,orientation:n}=i.getState();return a(t,n,!1,e)},previous:e=>{var t;const{renderedItems:n,orientation:r,includesBaseElement:o}=i.getState(),s=!!!(null==(t=Ks(n))?void 0:t.rowId)&&o;return a(qs(n),r,s,e)},down:e=>{const{activeId:t,renderedItems:n,focusShift:r,focusLoop:o,includesBaseElement:s}=i.getState(),l=r&&!e,c=el(Gs(Qs(Zs(n),t,l)));return a(c,"vertical",o&&"horizontal"!==o&&s,e)},up:e=>{const{activeId:t,renderedItems:n,focusShift:r,includesBaseElement:o}=i.getState(),s=r&&!e,l=el(qs(Gs(Qs(Zs(n),t,s))));return a(l,"vertical",o,e)}})}function nl(e,t,n){return Ht(e=$s(e,t,n),n,"activeId","setActiveId"),Ht(e,n,"includesBaseElement"),Ht(e,n,"virtualFocus"),Ht(e,n,"orientation"),Ht(e,n,"rtl"),Ht(e,n,"focusLoop"),Ht(e,n,"focusWrap"),Ht(e,n,"focusShift"),e}function rl(e={}){const[t,n]=$t(tl,e);return nl(t,n,e)}function ol(e,t,n){return we((r=>{var o;if(null==t||t(r),r.defaultPrevented)return;if(r.isPropagationStopped())return;if(!ce(r))return;if(function(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}(r))return;if(function(e){const t=e.target;return!(t&&!te(t)||1!==e.key.length||e.ctrlKey||e.metaKey)}(r))return;const i=e.getState(),a=null==(o=yt(e,i.activeId))?void 0:o.element;if(!a)return;const s=r,{view:l}=s,c=E(s,["view"]);a!==(null==n?void 0:n.current)&&a.focus(),function(e,t,n){const r=new KeyboardEvent(t,n);return e.dispatchEvent(r)}(a,r.type,c)||r.preventDefault(),r.currentTarget.contains(a)&&r.stopPropagation()}))}var il=Ve((e=>{var t=e,{store:n,composite:o=!0,focusOnMove:i=o,moveOnKeyPress:a=!0}=t,s=E(t,["store","composite","focusOnMove","moveOnKeyPress"]);const l=St();F(n=n||l,!1);const c=(0,r.useRef)(null),u=function(e){const[t,n]=(0,r.useState)(!1),o=(0,r.useCallback)((()=>n(!0)),[]),i=e.useState((t=>yt(e,t.activeId)));return(0,r.useEffect)((()=>{const e=null==i?void 0:i.element;t&&e&&(n(!1),e.focus({preventScroll:!0}))}),[i,t]),o}(n),d=n.useState("moves");(0,r.useEffect)((()=>{var e;if(!n)return;if(!d)return;if(!o)return;if(!i)return;const{activeId:t}=n.getState(),r=null==(e=yt(n,t))?void 0:e.element;r&&function(e,t){"scrollIntoView"in e?(e.focus({preventScroll:!0}),e.scrollIntoView(R({block:"nearest",inline:"nearest"},t))):e.focus()}(r)}),[n,d,o,i]),be((()=>{if(!n)return;if(!d)return;if(!o)return;const{baseElement:e,activeId:t}=n.getState();if(!(null===t))return;if(!e)return;const r=c.current;c.current=null,r&&ue(r,{relatedTarget:e}),Ze(e)||e.focus()}),[n,d,o]);const f=n.useState("activeId"),m=n.useState("virtualFocus");be((()=>{var e;if(!n)return;if(!o)return;if(!m)return;const t=c.current;if(c.current=null,!t)return;const r=(null==(e=yt(n,f))?void 0:e.element)||q(t);r!==t&&ue(t,{relatedTarget:r})}),[n,f,m,o]);const p=ol(n,s.onKeyDownCapture,c),h=ol(n,s.onKeyUpCapture,c),g=s.onFocusCapture,v=we((e=>{if(null==g||g(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:t}=n.getState();if(!t)return;const r=e.relatedTarget,o=function(e){const t=e[xt];return delete e[xt],t}(e.currentTarget);ce(e)&&o&&(e.stopPropagation(),c.current=r)})),b=s.onFocus,y=we((e=>{if(null==b||b(e),e.defaultPrevented)return;if(!o)return;if(!n)return;const{relatedTarget:t}=e,{virtualFocus:r}=n.getState();r?ce(e)&&!wt(n,t)&&queueMicrotask(u):ce(e)&&n.setActiveId(null)})),_=s.onBlurCapture,S=we((e=>{var t;if(null==_||_(e),e.defaultPrevented)return;if(!n)return;const{virtualFocus:r,activeId:o}=n.getState();if(!r)return;const i=null==(t=yt(n,o))?void 0:t.element,a=e.relatedTarget,s=wt(n,a),l=c.current;if(c.current=null,ce(e)&&s)a===i?l&&l!==a&&ue(l,e):i?ue(i,e):l&&ue(l,e),e.stopPropagation();else{!wt(n,e.target)&&i&&ue(i,e)}})),C=s.onKeyDown,k=Pe(a),P=we((e=>{var t;if(null==C||C(e),e.defaultPrevented)return;if(!n)return;if(!ce(e))return;const{orientation:r,items:o,renderedItems:i,activeId:a}=n.getState(),s=yt(n,a);if(null==(t=null==s?void 0:s.element)?void 0:t.isConnected)return;const l="horizontal"!==r,c="vertical"!==r,u=function(e){return e.some((e=>!!e.rowId))}(i);if(("ArrowLeft"===e.key||"ArrowRight"===e.key||"Home"===e.key||"End"===e.key)&&te(e.currentTarget))return;const d={ArrowUp:(u||l)&&(()=>{if(u){const e=o&&function(e){return function(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(Gs(qs(function(e){const t=[];for(const n of e){const e=t.find((e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===n.rowId}));e?e.push(n):t.push([n])}return t}(e))))}(o);return null==e?void 0:e.id}return null==n?void 0:n.last()}),ArrowRight:(u||c)&&n.first,ArrowDown:(u||l)&&n.first,ArrowLeft:(u||c)&&n.last,Home:n.first,End:n.last,PageUp:n.first,PageDown:n.last},f=d[e.key];if(f){const t=f();if(void 0!==t){if(!k(e))return;e.preventDefault(),n.move(t)}}}));s=Te(s,(e=>(0,Le.jsx)(Ct,{value:n,children:e})),[n]);const T=n.useState((e=>{var t;if(n&&o&&e.virtualFocus)return null==(t=yt(n,e.activeId))?void 0:t.id}));s=w(x({"aria-activedescendant":T},s),{ref:Ee(o?n.setBaseElement:null,s.ref),onKeyDownCapture:p,onKeyUpCapture:h,onFocusCapture:v,onFocus:y,onBlurCapture:S,onKeyDown:P});const I=n.useState((e=>o&&(e.virtualFocus||null===e.activeId)));return s=ct(x({focusable:I},s))})),al=Fe((e=>je("div",il(e))));var sl=Ve((e=>{var t=e,{store:n,"aria-setsize":o,"aria-posinset":i}=t,a=E(t,["store","aria-setsize","aria-posinset"]);const s=_t();F(n=n||s,!1);const l=_e(a.id),c=n.useState((e=>e.baseElement||void 0)),u=(0,r.useMemo)((()=>({id:l,baseElement:c,ariaSetSize:o,ariaPosInSet:i})),[l,c,o,i]);return a=Te(a,(e=>(0,Le.jsx)(Tt.Provider,{value:u,children:e})),[u]),a=x({id:l},a)})),ll=Fe((e=>je("div",sl(e))));bs("div",{target:"erowt52"})({name:"ogl07i",styles:"box-sizing:border-box;padding:2px"});const cl=bs("div",{target:"erowt51"})("transform-origin:top left;height:100%;width:100%;",zs,";",(()=>Ps({gridTemplateRows:"repeat( 3, calc( 21px / 3))",padding:1.5,maxHeight:24,maxWidth:24},"","")),";",(({disablePointerEvents:e})=>Ps({pointerEvents:e?"none":void 0},"","")),";"),ul=bs("span",{target:"erowt50"})("height:2px;width:2px;",Bs,";",(({isActive:e})=>Ps("box-shadow:",e?"0 0 0 1px currentColor":null,";color:currentColor;*:hover>&{color:currentColor;}","")),";"),dl=Vs;const fl=function({className:e,disablePointerEvents:t=!0,size:n=24,style:o={},value:i="center",...a}){const s=function(e="center"){const t=Cs(e);if(!t)return;const n=Ss.indexOf(t);return n>-1?n:void 0}(i),l=(n/24).toFixed(2),u=c()("component-alignment-matrix-control-icon",e),d={...o,transform:`scale(${l})`};return(0,r.createElement)(cl,{...a,className:u,disablePointerEvents:t,role:"presentation",style:d},Ss.map(((e,t)=>{const n=s===t;return(0,r.createElement)(dl,{key:e},(0,r.createElement)(ul,{isActive:n}))})))};function ml({className:e,id:t,label:n=(0,u.__)("Alignment Matrix Control"),defaultValue:o="center center",value:i,onChange:a,width:s=92,...l}){const f=(0,d.useInstanceId)(ml,"alignment-matrix-control",t),m=rl({defaultActiveId:ks(f,o),activeId:ks(f,i),setActiveId:e=>{const t=function(e,t){const n=t?.replace(e+"-","");return Cs(n)}(f,e);t&&a?.(t)},rtl:(0,u.isRTL)()}),p=m.useState("activeId"),h=c()("component-alignment-matrix-control",e);return(0,r.createElement)(al,{store:m,render:(0,r.createElement)(Ls,{...l,"aria-label":n,className:h,id:f,role:"grid",size:s})},Es.map(((e,t)=>(0,r.createElement)(ll,{render:(0,r.createElement)(Fs,{role:"row"}),key:t},e.map((e=>{const t=ks(f,e),n=t===p;return(0,r.createElement)(Hs,{id:t,isActive:n,key:e,value:e})}))))))}ml.Icon=fl;const pl=ml;function hl(e){return"appear"===e?"top":"left"}function gl(e){if("loading"===e.type)return c()("components-animate__loading");const{type:t,origin:n=hl(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return c()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?c()("components-animate__slide-in","is-from-"+n):void 0}const vl=function({type:e,options:t={},children:n}){return n({className:gl({type:e,...t})})},bl=(0,r.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),yl=(0,r.createContext)({}),xl=(0,r.createContext)(null),wl="undefined"!=typeof document,El=wl?r.useLayoutEffect:r.useEffect,_l=(0,r.createContext)({strict:!1});function Sl(e){return"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function Cl(e){return"string"==typeof e||Array.isArray(e)}function kl(e){return"object"==typeof e&&"function"==typeof e.start}const Pl=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Tl=["initial",...Pl];function Il(e){return kl(e.animate)||Tl.some((t=>Cl(e[t])))}function Rl(e){return Boolean(Il(e)||e.variants)}function Ml(e){const{initial:t,animate:n}=function(e,t){if(Il(e)){const{initial:t,animate:n}=e;return{initial:!1===t||Cl(t)?t:void 0,animate:Cl(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,(0,r.useContext)(yl));return(0,r.useMemo)((()=>({initial:t,animate:n})),[Nl(t),Nl(n)])}function Nl(e){return Array.isArray(e)?e.join(" "):e}const Dl={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Al={};for(const e in Dl)Al[e]={isEnabled:t=>Dl[e].some((e=>!!t[e]))};const Ol=(0,r.createContext)({}),zl=(0,r.createContext)({}),Ll=Symbol.for("motionComponentSymbol");function Fl({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:o,Component:i}){e&&function(e){for(const t in e)Al[t]={...Al[t],...e[t]}}(e);const a=(0,r.forwardRef)((function(a,s){let l;const c={...(0,r.useContext)(bl),...a,layoutId:Bl(a)},{isStatic:u}=c,d=Ml(a),f=o(a,u);if(!u&&wl){d.visualElement=function(e,t,n,o){const{visualElement:i}=(0,r.useContext)(yl),a=(0,r.useContext)(_l),s=(0,r.useContext)(xl),l=(0,r.useContext)(bl).reducedMotion,c=(0,r.useRef)();o=o||a.renderer,!c.current&&o&&(c.current=o(e,{visualState:t,parent:i,props:n,presenceContext:s,blockInitialAnimation:!!s&&!1===s.initial,reducedMotionConfig:l}));const u=c.current;(0,r.useInsertionEffect)((()=>{u&&u.update(n,s)}));const d=(0,r.useRef)(Boolean(window.HandoffAppearAnimations));return El((()=>{u&&(u.render(),d.current&&u.animationState&&u.animationState.animateChanges())})),(0,r.useEffect)((()=>{u&&(u.updateFeatures(),!d.current&&u.animationState&&u.animationState.animateChanges(),window.HandoffAppearAnimations=void 0,d.current=!1)})),u}(i,f,c,t);const n=(0,r.useContext)(zl),o=(0,r.useContext)(_l).strict;d.visualElement&&(l=d.visualElement.loadFeatures(c,o,e,n))}return r.createElement(yl.Provider,{value:d},l&&d.visualElement?r.createElement(l,{visualElement:d.visualElement,...c}):null,n(i,a,function(e,t,n){return(0,r.useCallback)((r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&("function"==typeof n?n(r):Sl(n)&&(n.current=r))}),[t])}(f,d.visualElement,s),f,u,d.visualElement))}));return a[Ll]=i,a}function Bl({layoutId:e}){const t=(0,r.useContext)(Ol).id;return t&&void 0!==e?t+"-"+e:e}function jl(e){function t(t,n={}){return Fl(e(t,n))}if("undefined"==typeof Proxy)return t;const n=new Map;return new Proxy(t,{get:(e,r)=>(n.has(r)||n.set(r,t(r)),n.get(r))})}const Vl=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Hl(e){return"string"==typeof e&&!e.includes("-")&&!!(Vl.indexOf(e)>-1||/[A-Z]/.test(e))}const $l={};const Wl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ul=new Set(Wl);function Gl(e,{layout:t,layoutId:n}){return Ul.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!$l[e]||"opacity"===e)}const ql=e=>Boolean(e&&e.getVelocity),Yl={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Kl=Wl.length;const Xl=e=>t=>"string"==typeof t&&t.startsWith(e),Zl=Xl("--"),Jl=Xl("var(--"),Ql=(e,t)=>t&&"number"==typeof e?t.transform(e):e,ec=(e,t,n)=>Math.min(Math.max(n,e),t),tc={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},nc={...tc,transform:e=>ec(0,1,e)},rc={...tc,default:1},oc=e=>Math.round(1e5*e)/1e5,ic=/(-)?([\d]*\.?[\d])+/g,ac=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,sc=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function lc(e){return"string"==typeof e}const cc=e=>({test:t=>lc(t)&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),uc=cc("deg"),dc=cc("%"),fc=cc("px"),mc=cc("vh"),pc=cc("vw"),hc={...dc,parse:e=>dc.parse(e)/100,transform:e=>dc.transform(100*e)},gc={...tc,transform:Math.round},vc={borderWidth:fc,borderTopWidth:fc,borderRightWidth:fc,borderBottomWidth:fc,borderLeftWidth:fc,borderRadius:fc,radius:fc,borderTopLeftRadius:fc,borderTopRightRadius:fc,borderBottomRightRadius:fc,borderBottomLeftRadius:fc,width:fc,maxWidth:fc,height:fc,maxHeight:fc,size:fc,top:fc,right:fc,bottom:fc,left:fc,padding:fc,paddingTop:fc,paddingRight:fc,paddingBottom:fc,paddingLeft:fc,margin:fc,marginTop:fc,marginRight:fc,marginBottom:fc,marginLeft:fc,rotate:uc,rotateX:uc,rotateY:uc,rotateZ:uc,scale:rc,scaleX:rc,scaleY:rc,scaleZ:rc,skew:uc,skewX:uc,skewY:uc,distance:fc,translateX:fc,translateY:fc,translateZ:fc,x:fc,y:fc,z:fc,perspective:fc,transformPerspective:fc,opacity:nc,originX:hc,originY:hc,originZ:fc,zIndex:gc,fillOpacity:nc,strokeOpacity:nc,numOctaves:gc};function bc(e,t,n,r){const{style:o,vars:i,transform:a,transformOrigin:s}=e;let l=!1,c=!1,u=!0;for(const e in t){const n=t[e];if(Zl(e)){i[e]=n;continue}const r=vc[e],d=Ql(n,r);if(Ul.has(e)){if(l=!0,a[e]=d,!u)continue;n!==(r.default||0)&&(u=!1)}else e.startsWith("origin")?(c=!0,s[e]=d):o[e]=d}if(t.transform||(l||r?o.transform=function(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,o){let i="";for(let t=0;t<Kl;t++){const n=Wl[t];void 0!==e[n]&&(i+=`${Yl[n]||n}(${e[n]}) `)}return t&&!e.z&&(i+="translateZ(0)"),i=i.trim(),o?i=o(e,r?"":i):n&&r&&(i="none"),i}(e.transform,n,u,r):o.transform&&(o.transform="none")),c){const{originX:e="50%",originY:t="50%",originZ:n=0}=s;o.transformOrigin=`${e} ${t} ${n}`}}const yc=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function xc(e,t,n){for(const r in t)ql(t[r])||Gl(r,n)||(e[r]=t[r])}function wc(e,t,n){const o={};return xc(o,e.style||{},e),Object.assign(o,function({transformTemplate:e},t,n){return(0,r.useMemo)((()=>{const r=yc();return bc(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)}),[t])}(e,t,n)),e.transformValues?e.transformValues(o):o}function Ec(e,t,n){const r={},o=wc(e,t,n);return e.drag&&!1!==e.dragListener&&(r.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=o,r}const _c=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function Sc(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||_c.has(e)}let Cc=e=>!Sc(e);try{(kc=require("@emotion/is-prop-valid").default)&&(Cc=e=>e.startsWith("on")?!Sc(e):kc(e))}catch(W){}var kc;function Pc(e,t,n){return"string"==typeof e?e:fc.transform(t+n*e)}const Tc={offset:"stroke-dashoffset",array:"stroke-dasharray"},Ic={offset:"strokeDashoffset",array:"strokeDasharray"};function Rc(e,{attrX:t,attrY:n,attrScale:r,originX:o,originY:i,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...c},u,d,f){if(bc(e,c,u,f),d)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:m,style:p,dimensions:h}=e;m.transform&&(h&&(p.transform=m.transform),delete m.transform),h&&(void 0!==o||void 0!==i||p.transform)&&(p.transformOrigin=function(e,t,n){return`${Pc(t,e.x,e.width)} ${Pc(n,e.y,e.height)}`}(h,void 0!==o?o:.5,void 0!==i?i:.5)),void 0!==t&&(m.x=t),void 0!==n&&(m.y=n),void 0!==r&&(m.scale=r),void 0!==a&&function(e,t,n=1,r=0,o=!0){e.pathLength=1;const i=o?Tc:Ic;e[i.offset]=fc.transform(-r);const a=fc.transform(t),s=fc.transform(n);e[i.array]=`${a} ${s}`}(m,a,s,l,!1)}const Mc=()=>({...yc(),attrs:{}}),Nc=e=>"string"==typeof e&&"svg"===e.toLowerCase();function Dc(e,t,n,o){const i=(0,r.useMemo)((()=>{const n=Mc();return Rc(n,t,{enableHardwareAcceleration:!1},Nc(o),e.transformTemplate),{...n.attrs,style:{...n.style}}}),[t]);if(e.style){const t={};xc(t,e.style,e),i.style={...t,...i.style}}return i}function Ac(e=!1){return(t,n,o,{latestValues:i},a)=>{const s=(Hl(t)?Dc:Ec)(n,i,a,t),l=function(e,t,n){const r={};for(const o in e)"values"===o&&"object"==typeof e.values||(Cc(o)||!0===n&&Sc(o)||!t&&!Sc(o)||e.draggable&&o.startsWith("onDrag"))&&(r[o]=e[o]);return r}(n,"string"==typeof t,e),c={...l,...s,ref:o},{children:u}=n,d=(0,r.useMemo)((()=>ql(u)?u.get():u),[u]);return(0,r.createElement)(t,{...c,children:d})}}const Oc=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function zc(e,{style:t,vars:n},r,o){Object.assign(e.style,t,o&&o.getProjectionStyles(r));for(const t in n)e.style.setProperty(t,n[t])}const Lc=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Fc(e,t,n,r){zc(e,t,void 0,r);for(const n in t.attrs)e.setAttribute(Lc.has(n)?n:Oc(n),t.attrs[n])}function Bc(e,t){const{style:n}=e,r={};for(const o in n)(ql(n[o])||t.style&&ql(t.style[o])||Gl(o,e))&&(r[o]=n[o]);return r}function jc(e,t){const n=Bc(e,t);for(const r in e)if(ql(e[r])||ql(t[r])){n[-1!==Wl.indexOf(r)?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r]=e[r]}return n}function Vc(e,t,n,r={},o={}){return"function"==typeof t&&(t=t(void 0!==n?n:e.custom,r,o)),"string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t&&(t=t(void 0!==n?n:e.custom,r,o)),t}function Hc(e){const t=(0,r.useRef)(null);return null===t.current&&(t.current=e()),t.current}const $c=e=>Array.isArray(e),Wc=e=>Boolean(e&&"object"==typeof e&&e.mix&&e.toValue),Uc=e=>$c(e)?e[e.length-1]||0:e;function Gc(e){const t=ql(e)?e.get():e;return Wc(t)?t.toValue():t}const qc=e=>(t,n)=>{const o=(0,r.useContext)(yl),i=(0,r.useContext)(xl),a=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,o,i){const a={latestValues:Yc(r,o,i,e),renderState:t()};return n&&(a.mount=e=>n(r,e,a)),a}(e,t,o,i);return n?a():Hc(a)};function Yc(e,t,n,r){const o={},i=r(e,{});for(const e in i)o[e]=Gc(i[e]);let{initial:a,animate:s}=e;const l=Il(e),c=Rl(e);t&&c&&!l&&!1!==e.inherit&&(void 0===a&&(a=t.initial),void 0===s&&(s=t.animate));let u=!!n&&!1===n.initial;u=u||!1===a;const d=u?s:a;if(d&&"boolean"!=typeof d&&!kl(d)){(Array.isArray(d)?d:[d]).forEach((t=>{const n=Vc(e,t);if(!n)return;const{transitionEnd:r,transition:i,...a}=n;for(const e in a){let t=a[e];if(Array.isArray(t)){t=t[u?t.length-1:0]}null!==t&&(o[e]=t)}for(const e in r)o[e]=r[e]}))}return o}const Kc=e=>e;class Xc{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){const t=this.order.indexOf(e);-1!==t&&(this.order.splice(t,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}}const Zc=["prepare","read","update","preRender","render","postRender"];const{schedule:Jc,cancel:Qc,state:eu,steps:tu}=function(e,t){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},i=Zc.reduce(((e,t)=>(e[t]=function(e){let t=new Xc,n=new Xc,r=0,o=!1,i=!1;const a=new WeakSet,s={schedule:(e,i=!1,s=!1)=>{const l=s&&o,c=l?t:n;return i&&a.add(e),c.add(e)&&l&&o&&(r=t.order.length),e},cancel:e=>{n.remove(e),a.delete(e)},process:l=>{if(o)i=!0;else{if(o=!0,[t,n]=[n,t],n.clear(),r=t.order.length,r)for(let n=0;n<r;n++){const r=t.order[n];r(l),a.has(r)&&(s.schedule(r),e())}o=!1,i&&(i=!1,s.process(l))}}};return s}((()=>n=!0)),e)),{}),a=e=>i[e].process(o),s=()=>{const i=performance.now();n=!1,o.delta=r?1e3/60:Math.max(Math.min(i-o.timestamp,40),1),o.timestamp=i,o.isProcessing=!0,Zc.forEach(a),o.isProcessing=!1,n&&t&&(r=!1,e(s))};return{schedule:Zc.reduce(((t,a)=>{const l=i[a];return t[a]=(t,i=!1,a=!1)=>(n||(n=!0,r=!0,o.isProcessing||e(s)),l.schedule(t,i,a)),t}),{}),cancel:e=>Zc.forEach((t=>i[t].cancel(e))),state:o,steps:i}}("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:Kc,!0),nu={useVisualState:qc({scrapeMotionValuesFromProps:jc,createRenderState:Mc,onMount:(e,t,{renderState:n,latestValues:r})=>{Jc.read((()=>{try{n.dimensions="function"==typeof t.getBBox?t.getBBox():t.getBoundingClientRect()}catch(e){n.dimensions={x:0,y:0,width:0,height:0}}})),Jc.render((()=>{Rc(n,r,{enableHardwareAcceleration:!1},Nc(t.tagName),e.transformTemplate),Fc(t,n)}))}})},ru={useVisualState:qc({scrapeMotionValuesFromProps:Bc,createRenderState:yc})};function ou(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const iu=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function au(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const su=e=>t=>iu(t)&&e(t,au(t));function lu(e,t,n,r){return ou(e,t,su(n),r)}const cu=(e,t)=>n=>t(e(n)),uu=(...e)=>e.reduce(cu);function du(e){let t=null;return()=>{const n=()=>{t=null};return null===t&&(t=e,n)}}const fu=du("dragHorizontal"),mu=du("dragVertical");function pu(e){let t=!1;if("y"===e)t=mu();else if("x"===e)t=fu();else{const e=fu(),n=mu();e&&n?t=()=>{e(),n()}:(e&&e(),n&&n())}return t}function hu(){const e=pu(!0);return!e||(e(),!1)}class gu{constructor(e){this.isMounted=!1,this.node=e}update(){}}function vu(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End");return lu(e.current,n,((n,o)=>{if("touch"===n.type||hu())return;const i=e.getProps();e.animationState&&i.whileHover&&e.animationState.setActive("whileHover",t),i[r]&&Jc.update((()=>i[r](n,o)))}),{passive:!e.getProps()[r]})}const bu=(e,t)=>!!t&&(e===t||bu(e,t.parentElement));function yu(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,au(n))}const xu=new WeakMap,wu=new WeakMap,Eu=e=>{const t=xu.get(e.target);t&&t(e)},_u=e=>{e.forEach(Eu)};function Su(e,t,n){const r=function({root:e,...t}){const n=e||document;wu.has(n)||wu.set(n,{});const r=wu.get(n),o=JSON.stringify(t);return r[o]||(r[o]=new IntersectionObserver(_u,{root:e,...t})),r[o]}(t);return xu.set(e,n),r.observe(e),()=>{xu.delete(e),r.unobserve(e)}}const Cu={some:0,all:1};const ku={inView:{Feature:class extends gu{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r="some",once:o}=e,i={root:t?t.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:Cu[r]};return Su(this.node.current,i,(e=>{const{isIntersecting:t}=e;if(this.isInView===t)return;if(this.isInView=t,o&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),i=t?n:r;i&&i(e)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends gu{constructor(){super(...arguments),this.removeStartListeners=Kc,this.removeEndListeners=Kc,this.removeAccessibleListeners=Kc,this.startPointerPress=(e,t)=>{if(this.removeEndListeners(),this.isPressing)return;const n=this.node.getProps(),r=lu(window,"pointerup",((e,t)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:r}=this.node.getProps();Jc.update((()=>{bu(this.node.current,e.target)?n&&n(e,t):r&&r(e,t)}))}),{passive:!(n.onTap||n.onPointerUp)}),o=lu(window,"pointercancel",((e,t)=>this.cancelPress(e,t)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=uu(r,o),this.startPress(e,t)},this.startAccessiblePress=()=>{const e=ou(this.node.current,"keydown",(e=>{if("Enter"!==e.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=ou(this.node.current,"keyup",(e=>{"Enter"===e.key&&this.checkPressEnd()&&yu("up",((e,t)=>{const{onTap:n}=this.node.getProps();n&&Jc.update((()=>n(e,t)))}))})),yu("down",((e,t)=>{this.startPress(e,t)}))})),t=ou(this.node.current,"blur",(()=>{this.isPressing&&yu("cancel",((e,t)=>this.cancelPress(e,t)))}));this.removeAccessibleListeners=uu(e,t)}}startPress(e,t){this.isPressing=!0;const{onTapStart:n,whileTap:r}=this.node.getProps();r&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Jc.update((()=>n(e,t)))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!hu()}cancelPress(e,t){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Jc.update((()=>n(e,t)))}mount(){const e=this.node.getProps(),t=lu(this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=ou(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=uu(t,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends gu{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=uu(ou(this.node.current,"focus",(()=>this.onFocus())),ou(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends gu{mount(){this.unmount=uu(vu(this.node,!0),vu(this.node,!1))}unmount(){}}}};function Pu(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function Tu(e,t,n){const r=e.getProps();return Vc(r,t,void 0!==n?n:r.custom,function(e){const t={};return e.values.forEach(((e,n)=>t[n]=e.get())),t}(e),function(e){const t={};return e.values.forEach(((e,n)=>t[n]=e.getVelocity())),t}(e))}const Iu="data-"+Oc("framerAppearId");let Ru=Kc,Mu=Kc;const Nu=e=>1e3*e,Du=e=>e/1e3,Au=!1,Ou=e=>Array.isArray(e)&&"number"==typeof e[0];function zu(e){return Boolean(!e||"string"==typeof e&&Fu[e]||Ou(e)||Array.isArray(e)&&e.every(zu))}const Lu=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Fu={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Lu([0,.65,.55,1]),circOut:Lu([.55,0,1,.45]),backIn:Lu([.31,.01,.66,-.59]),backOut:Lu([.33,1.53,.69,.99])};function Bu(e){if(e)return Ou(e)?Lu(e):Array.isArray(e)?e.map(Bu):Fu[e]}const ju=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Vu=1e-7,Hu=12;function $u(e,t,n,r){if(e===t&&n===r)return Kc;const o=t=>function(e,t,n,r,o){let i,a,s=0;do{a=t+(n-t)/2,i=ju(a,r,o)-e,i>0?n=a:t=a}while(Math.abs(i)>Vu&&++s<Hu);return a}(t,0,1,e,n);return e=>0===e||1===e?e:ju(o(e),t,r)}const Wu=$u(.42,0,1,1),Uu=$u(0,0,.58,1),Gu=$u(.42,0,.58,1),qu=e=>Array.isArray(e)&&"number"!=typeof e[0],Yu=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ku=e=>t=>1-e(1-t),Xu=e=>1-Math.sin(Math.acos(e)),Zu=Ku(Xu),Ju=Yu(Zu),Qu=$u(.33,1.53,.69,.99),ed=Ku(Qu),td=Yu(ed),nd={linear:Kc,easeIn:Wu,easeInOut:Gu,easeOut:Uu,circIn:Xu,circInOut:Ju,circOut:Zu,backIn:ed,backInOut:td,backOut:Qu,anticipate:e=>(e*=2)<1?.5*ed(e):.5*(2-Math.pow(2,-10*(e-1)))},rd=e=>{if(Array.isArray(e)){Mu(4===e.length,"Cubic bezier arrays must contain four numerical values.");const[t,n,r,o]=e;return $u(t,n,r,o)}return"string"==typeof e?(Mu(void 0!==nd[e],`Invalid easing type '${e}'`),nd[e]):e},od=(e,t)=>n=>Boolean(lc(n)&&sc.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),id=(e,t,n)=>r=>{if(!lc(r))return r;const[o,i,a,s]=r.match(ic);return{[e]:parseFloat(o),[t]:parseFloat(i),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},ad={...tc,transform:e=>Math.round((e=>ec(0,255,e))(e))},sd={test:od("rgb","red"),parse:id("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+ad.transform(e)+", "+ad.transform(t)+", "+ad.transform(n)+", "+oc(nc.transform(r))+")"};const ld={test:od("#"),parse:function(e){let t="",n="",r="",o="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),o=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),o=e.substring(4,5),t+=t,n+=n,r+=r,o+=o),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:sd.transform},cd={test:od("hsl","hue"),parse:id("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+dc.transform(oc(t))+", "+dc.transform(oc(n))+", "+oc(nc.transform(r))+")"},ud={test:e=>sd.test(e)||ld.test(e)||cd.test(e),parse:e=>sd.test(e)?sd.parse(e):cd.test(e)?cd.parse(e):ld.parse(e),transform:e=>lc(e)?e:e.hasOwnProperty("red")?sd.transform(e):cd.transform(e)},dd=(e,t,n)=>-n*e+n*t+e;function fd(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}const md=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},pd=[ld,sd,cd];function hd(e){const t=(e=>pd.find((t=>t.test(e))))(e);Mu(Boolean(t),`'${e}' is not an animatable color. Use the equivalent color code instead.`);let n=t.parse(e);return t===cd&&(n=function({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,n/=100;let o=0,i=0,a=0;if(t/=100){const r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;o=fd(s,r,e+1/3),i=fd(s,r,e),a=fd(s,r,e-1/3)}else o=i=a=n;return{red:Math.round(255*o),green:Math.round(255*i),blue:Math.round(255*a),alpha:r}}(n)),n}const gd=(e,t)=>{const n=hd(e),r=hd(t),o={...n};return e=>(o.red=md(n.red,r.red,e),o.green=md(n.green,r.green,e),o.blue=md(n.blue,r.blue,e),o.alpha=dd(n.alpha,r.alpha,e),sd.transform(o))};const vd={regex:/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,countKey:"Vars",token:"${v}",parse:Kc},bd={regex:ac,countKey:"Colors",token:"${c}",parse:ud.parse},yd={regex:ic,countKey:"Numbers",token:"${n}",parse:tc.parse};function xd(e,{regex:t,countKey:n,token:r,parse:o}){const i=e.tokenised.match(t);i&&(e["num"+n]=i.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...i.map(o)))}function wd(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&xd(n,vd),xd(n,bd),xd(n,yd),n}function Ed(e){return wd(e).values}function _d(e){const{values:t,numColors:n,numVars:r,tokenised:o}=wd(e),i=t.length;return e=>{let t=o;for(let o=0;o<i;o++)t=o<r?t.replace(vd.token,e[o]):o<r+n?t.replace(bd.token,ud.transform(e[o])):t.replace(yd.token,oc(e[o]));return t}}const Sd=e=>"number"==typeof e?0:e;const Cd={test:function(e){var t,n;return isNaN(e)&&lc(e)&&((null===(t=e.match(ic))||void 0===t?void 0:t.length)||0)+((null===(n=e.match(ac))||void 0===n?void 0:n.length)||0)>0},parse:Ed,createTransformer:_d,getAnimatableNone:function(e){const t=Ed(e);return _d(e)(t.map(Sd))}},kd=(e,t)=>n=>`${n>0?t:e}`;function Pd(e,t){return"number"==typeof e?n=>dd(e,t,n):ud.test(e)?gd(e,t):e.startsWith("var(")?kd(e,t):Rd(e,t)}const Td=(e,t)=>{const n=[...e],r=n.length,o=e.map(((e,n)=>Pd(e,t[n])));return e=>{for(let t=0;t<r;t++)n[t]=o[t](e);return n}},Id=(e,t)=>{const n={...e,...t},r={};for(const o in n)void 0!==e[o]&&void 0!==t[o]&&(r[o]=Pd(e[o],t[o]));return e=>{for(const t in r)n[t]=r[t](e);return n}},Rd=(e,t)=>{const n=Cd.createTransformer(t),r=wd(e),o=wd(t);return r.numVars===o.numVars&&r.numColors===o.numColors&&r.numNumbers>=o.numNumbers?uu(Td(r.values,o.values),n):(Ru(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),kd(e,t))},Md=(e,t,n)=>{const r=t-e;return 0===r?1:(n-e)/r},Nd=(e,t)=>n=>dd(e,t,n);function Dd(e,t,n){const r=[],o=n||function(e){return"number"==typeof e?Nd:"string"==typeof e?ud.test(e)?gd:Rd:Array.isArray(e)?Td:"object"==typeof e?Id:Nd}(e[0]),i=e.length-1;for(let n=0;n<i;n++){let i=o(e[n],e[n+1]);if(t){const e=Array.isArray(t)?t[n]||Kc:t;i=uu(e,i)}r.push(i)}return r}function Ad(e,t,{clamp:n=!0,ease:r,mixer:o}={}){const i=e.length;if(Mu(i===t.length,"Both input and output ranges must be the same length"),1===i)return()=>t[0];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=Dd(t,r,o),s=a.length,l=t=>{let n=0;if(s>1)for(;n<e.length-2&&!(t<e[n+1]);n++);const r=Md(e[n],e[n+1],t);return a[n](r)};return n?t=>l(ec(e[0],e[i-1],t)):l}function Od(e){const t=[0];return function(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const o=Md(0,t,r);e.push(dd(n,1,o))}}(t,e.length-1),t}function zd({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const o=qu(r)?r.map(rd):rd(r),i={done:!1,value:t[0]},a=function(e,t){return e.map((e=>e*t))}(n&&n.length===t.length?n:Od(t),e),s=Ad(a,t,{ease:Array.isArray(o)?o:(l=t,c=o,l.map((()=>c||Gu)).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(i.value=s(t),i.done=t>=e,i)}}function Ld(e,t){return t?e*(1e3/t):0}const Fd=5;function Bd(e,t,n){const r=Math.max(t-Fd,0);return Ld(n-e(r),t-r)}const jd=.001,Vd=.01,Hd=10,$d=.05,Wd=1;function Ud({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let o,i;Ru(e<=Nu(Hd),"Spring duration must be 10 seconds or less");let a=1-t;a=ec($d,Wd,a),e=ec(Vd,Hd,Du(e)),a<1?(o=t=>{const r=t*a,o=r*e,i=r-n,s=qd(t,a),l=Math.exp(-o);return jd-i/s*l},i=t=>{const r=t*a*e,i=r*n+n,s=Math.pow(a,2)*Math.pow(t,2)*e,l=Math.exp(-r),c=qd(Math.pow(t,2),a);return(-o(t)+jd>0?-1:1)*((i-s)*l)/c}):(o=t=>Math.exp(-t*e)*((t-n)*e+1)-jd,i=t=>Math.exp(-t*e)*(e*e*(n-t)));const s=function(e,t,n){let r=n;for(let n=1;n<Gd;n++)r-=e(r)/t(r);return r}(o,i,5/e);if(e=Nu(e),isNaN(s))return{stiffness:100,damping:10,duration:e};{const t=Math.pow(s,2)*r;return{stiffness:t,damping:2*a*Math.sqrt(r*t),duration:e}}}const Gd=12;function qd(e,t){return e*Math.sqrt(1-t*t)}const Yd=["duration","bounce"],Kd=["stiffness","damping","mass"];function Xd(e,t){return t.some((t=>void 0!==e[t]))}function Zd({keyframes:e,restDelta:t,restSpeed:n,...r}){const o=e[0],i=e[e.length-1],a={done:!1,value:o},{stiffness:s,damping:l,mass:c,velocity:u,duration:d,isResolvedFromDuration:f}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!Xd(e,Kd)&&Xd(e,Yd)){const n=Ud(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}(r),m=u?-Du(u):0,p=l/(2*Math.sqrt(s*c)),h=i-o,g=Du(Math.sqrt(s/c)),v=Math.abs(h)<5;let b;if(n||(n=v?.01:2),t||(t=v?.005:.5),p<1){const e=qd(g,p);b=t=>{const n=Math.exp(-p*g*t);return i-n*((m+p*g*h)/e*Math.sin(e*t)+h*Math.cos(e*t))}}else if(1===p)b=e=>i-Math.exp(-g*e)*(h+(m+g*h)*e);else{const e=g*Math.sqrt(p*p-1);b=t=>{const n=Math.exp(-p*g*t),r=Math.min(e*t,300);return i-n*((m+p*g*h)*Math.sinh(r)+e*h*Math.cosh(r))/e}}return{calculatedDuration:f&&d||null,next:e=>{const r=b(e);if(f)a.done=e>=d;else{let o=m;0!==e&&(o=p<1?Bd(b,e,r):0);const s=Math.abs(o)<=n,l=Math.abs(i-r)<=t;a.done=s&&l}return a.value=a.done?i:r,a}}}function Jd({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:i=500,modifyTarget:a,min:s,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],f={done:!1,value:d},m=e=>void 0===s?l:void 0===l||Math.abs(s-e)<Math.abs(l-e)?s:l;let p=n*t;const h=d+p,g=void 0===a?h:a(h);g!==h&&(p=g-d);const v=e=>-p*Math.exp(-e/r),b=e=>g+v(e),y=e=>{const t=v(e),n=b(e);f.done=Math.abs(t)<=c,f.value=f.done?g:n};let x,w;const E=e=>{(e=>void 0!==s&&e<s||void 0!==l&&e>l)(f.value)&&(x=e,w=Zd({keyframes:[f.value,m(f.value)],velocity:Bd(b,e,f.value),damping:o,stiffness:i,restDelta:c,restSpeed:u}))};return E(0),{calculatedDuration:null,next:e=>{let t=!1;return w||void 0!==x||(t=!0,y(e),E(e)),void 0!==x&&e>x?w.next(e-x):(!t&&y(e),f)}}}const Qd=e=>{const t=({timestamp:t})=>e(t);return{start:()=>Jc.update(t,!0),stop:()=>Qc(t),now:()=>eu.isProcessing?eu.timestamp:performance.now()}},ef=2e4;function tf(e){let t=0;let n=e.next(t);for(;!n.done&&t<ef;)t+=50,n=e.next(t);return t>=ef?1/0:t}const nf={decay:Jd,inertia:Jd,tween:zd,keyframes:zd,spring:Zd};function rf({autoplay:e=!0,delay:t=0,driver:n=Qd,keyframes:r,type:o="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:s="loop",onPlay:l,onStop:c,onComplete:u,onUpdate:d,...f}){let m,p,h=1,g=!1;const v=()=>{p=new Promise((e=>{m=e}))};let b;v();const y=nf[o]||zd;let x;y!==zd&&"number"!=typeof r[0]&&(x=Ad([0,100],r,{clamp:!1}),r=[0,100]);const w=y({...f,keyframes:r});let E;"mirror"===s&&(E=y({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let _="idle",S=null,C=null,k=null;null===w.calculatedDuration&&i&&(w.calculatedDuration=tf(w));const{calculatedDuration:P}=w;let T=1/0,I=1/0;null!==P&&(T=P+a,I=T*(i+1)-a);let R=0;const M=e=>{if(null===C)return;h>0&&(C=Math.min(C,e)),h<0&&(C=Math.min(e-I/h,C)),R=null!==S?S:Math.round(e-C)*h;const n=R-t*(h>=0?1:-1),o=h>=0?n<0:n>I;R=Math.max(n,0),"finished"===_&&null===S&&(R=I);let l=R,c=w;if(i){const e=R/T;let t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),1===n&&t--,t=Math.min(t,i+1);const r=Boolean(t%2);r&&("reverse"===s?(n=1-n,a&&(n-=a/T)):"mirror"===s&&(c=E));let o=ec(0,1,n);R>I&&(o="reverse"===s&&r?1:0),l=o*T}const u=o?{done:!1,value:r[0]}:c.next(l);x&&(u.value=x(u.value));let{done:f}=u;o||null===P||(f=h>=0?R>=I:R<=0);const m=null===S&&("finished"===_||"running"===_&&f);return d&&d(u.value),m&&A(),u},N=()=>{b&&b.stop(),b=void 0},D=()=>{_="idle",N(),m(),v(),C=k=null},A=()=>{_="finished",u&&u(),N(),m()},O=()=>{if(g)return;b||(b=n(M));const e=b.now();l&&l(),null!==S?C=e-S:C&&"finished"!==_||(C=e),"finished"===_&&v(),k=C,S=null,_="running",b.start()};e&&O();const z={then:(e,t)=>p.then(e,t),get time(){return Du(R)},set time(e){e=Nu(e),R=e,null===S&&b&&0!==h?C=b.now()-e/h:S=e},get duration(){const e=null===w.calculatedDuration?tf(w):w.calculatedDuration;return Du(e)},get speed(){return h},set speed(e){e!==h&&b&&(h=e,z.time=Du(R))},get state(){return _},play:O,pause:()=>{_="paused",S=R},stop:()=>{g=!0,"idle"!==_&&(_="idle",c&&c(),D())},cancel:()=>{null!==k&&M(k),D()},complete:()=>{_="finished"},sample:e=>(C=0,M(e))};return z}const of=function(e){let t;return()=>(void 0===t&&(t=e()),t)}((()=>Object.hasOwnProperty.call(Element.prototype,"animate"))),af=new Set(["opacity","clipPath","filter","transform","backgroundColor"]);function sf(e,t,{onUpdate:n,onComplete:r,...o}){if(!(of()&&af.has(t)&&!o.repeatDelay&&"mirror"!==o.repeatType&&0!==o.damping&&"inertia"!==o.type))return!1;let i,a,s=!1;const l=()=>{a=new Promise((e=>{i=e}))};l();let{keyframes:c,duration:u=300,ease:d,times:f}=o;if(((e,t)=>"spring"===t.type||"backgroundColor"===e||!zu(t.ease))(t,o)){const e=rf({...o,repeat:0,delay:0});let t={done:!1,value:c[0]};const n=[];let r=0;for(;!t.done&&r<2e4;)t=e.sample(r),n.push(t.value),r+=10;f=void 0,c=n,u=r-10,d="linear"}const m=function(e,t,n,{delay:r=0,duration:o,repeat:i=0,repeatType:a="loop",ease:s,times:l}={}){const c={[t]:n};l&&(c.offset=l);const u=Bu(s);return Array.isArray(u)&&(c.easing=u),e.animate(c,{delay:r,duration:o,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"})}(e.owner.current,t,c,{...o,duration:u,ease:d,times:f});o.syncStart&&(m.startTime=eu.isProcessing?eu.timestamp:document.timeline?document.timeline.currentTime:performance.now());const p=()=>m.cancel(),h=()=>{Jc.update(p),i(),l()};m.onfinish=()=>{e.set(function(e,{repeat:t,repeatType:n="loop"}){return e[t&&"loop"!==n&&t%2==1?0:e.length-1]}(c,o)),r&&r(),h()};return{then:(e,t)=>a.then(e,t),attachTimeline:e=>(m.timeline=e,m.onfinish=null,Kc),get time(){return Du(m.currentTime||0)},set time(e){m.currentTime=Nu(e)},get speed(){return m.playbackRate},set speed(e){m.playbackRate=e},get duration(){return Du(u)},play:()=>{s||(m.play(),Qc(p))},pause:()=>m.pause(),stop:()=>{if(s=!0,"idle"===m.playState)return;const{currentTime:t}=m;if(t){const n=rf({...o,autoplay:!1});e.setWithVelocity(n.sample(t-10).value,n.sample(t).value,10)}h()},complete:()=>m.finish(),cancel:h}}const lf={type:"spring",stiffness:500,damping:25,restSpeed:10},cf={type:"keyframes",duration:.8},uf={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},df=(e,{keyframes:t})=>t.length>2?cf:Ul.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:lf:uf,ff=(e,t)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Cd.test(t)&&"0"!==t||t.startsWith("url("))),mf=new Set(["brightness","contrast","saturate","opacity"]);function pf(e){const[t,n]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[r]=n.match(ic)||[];if(!r)return e;const o=n.replace(r,"");let i=mf.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+o+")"}const hf=/([a-z-]*)\(.*?\)/g,gf={...Cd,getAnimatableNone:e=>{const t=e.match(hf);return t?t.map(pf).join(" "):e}},vf={...vc,color:ud,backgroundColor:ud,outlineColor:ud,fill:ud,stroke:ud,borderColor:ud,borderTopColor:ud,borderRightColor:ud,borderBottomColor:ud,borderLeftColor:ud,filter:gf,WebkitFilter:gf},bf=e=>vf[e];function yf(e,t){let n=bf(e);return n!==gf&&(n=Cd),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const xf=e=>/^0[^.\s]+$/.test(e);function wf(e){return"number"==typeof e?0===e:null!==e?"none"===e||"0"===e||xf(e):void 0}function Ef(e,t){return e[t]||e.default||e}const _f=(e,t,n,r={})=>o=>{const i=Ef(r,e)||{},a=i.delay||r.delay||0;let{elapsed:s=0}=r;s-=Nu(a);const l=function(e,t,n,r){const o=ff(t,n);let i;i=Array.isArray(n)?[...n]:[null,n];const a=void 0!==r.from?r.from:e.get();let s;const l=[];for(let e=0;e<i.length;e++)null===i[e]&&(i[e]=0===e?a:i[e-1]),wf(i[e])&&l.push(e),"string"==typeof i[e]&&"none"!==i[e]&&"0"!==i[e]&&(s=i[e]);if(o&&l.length&&s)for(let e=0;e<l.length;e++)i[l[e]]=yf(t,s);return i}(t,e,n,i),c=l[0],u=l[l.length-1],d=ff(e,c),f=ff(e,u);Ru(d===f,`You are trying to animate ${e} from "${c}" to "${u}". ${c} is not an animatable value - to enable this animation set ${c} to a value animatable to ${u} via the \`style\` property.`);let m={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...i,delay:-s,onUpdate:e=>{t.set(e),i.onUpdate&&i.onUpdate(e)},onComplete:()=>{o(),i.onComplete&&i.onComplete()}};if(function({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:i,repeatType:a,repeatDelay:s,from:l,elapsed:c,...u}){return!!Object.keys(u).length}(i)||(m={...m,...df(e,m)}),m.duration&&(m.duration=Nu(m.duration)),m.repeatDelay&&(m.repeatDelay=Nu(m.repeatDelay)),!d||!f||Au||!1===i.type)return function({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const o=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:Kc,pause:Kc,stop:Kc,then:e=>(e(),Promise.resolve()),cancel:Kc,complete:Kc});return t?rf({keyframes:[0,1],duration:0,delay:t,onComplete:o}):o()}(Au?{...m,delay:0}:m);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const n=sf(t,e,m);if(n)return n}return rf(m)};function Sf(e){return Boolean(ql(e)&&e.add)}const Cf=e=>/^\-?\d*\.?\d+$/.test(e);function kf(e,t){-1===e.indexOf(t)&&e.push(t)}function Pf(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Tf{constructor(){this.subscriptions=[]}add(e){return kf(this.subscriptions,e),()=>Pf(this.subscriptions,e)}notify(e,t,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](e,t,n);else for(let o=0;o<r;o++){const r=this.subscriptions[o];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const If={current:void 0};class Rf{constructor(e,t={}){var n;this.version="10.16.4",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(e,t=!0)=>{this.prev=this.current,this.current=e;const{delta:n,timestamp:r}=eu;this.lastUpdated!==r&&(this.timeDelta=n,this.lastUpdated=r,Jc.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),t&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>Jc.postRender(this.velocityCheck),this.velocityCheck=({timestamp:e})=>{e!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=(n=this.current,!isNaN(parseFloat(n))),this.owner=t.owner}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new Tf);const n=this.events[e].add(t);return"change"===e?()=>{n(),Jc.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){t&&this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e,t)}setWithVelocity(e,t,n){this.set(t),this.prev=e,this.timeDelta=n}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return If.current&&If.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?Ld(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise((t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Mf(e,t){return new Rf(e,t)}const Nf=e=>t=>t.test(e),Df=[tc,fc,dc,uc,pc,mc,{test:e=>"auto"===e,parse:e=>e}],Af=e=>Df.find(Nf(e)),Of=[...Df,ud,Cd],zf=e=>Of.find(Nf(e));function Lf(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Mf(n))}function Ff(e,t){const n=Tu(e,t);let{transitionEnd:r={},transition:o={},...i}=n?e.makeTargetAnimatable(n,!1):{};i={...i,...r};for(const t in i){Lf(e,t,Uc(i[t]))}}function Bf(e,t){if(!t)return;return(t[e]||t.default||t).from}function jf({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&!0!==t[n];return t[n]=!1,r}function Vf(e,t,{delay:n=0,transitionOverride:r,type:o}={}){let{transition:i=e.getDefaultTransition(),transitionEnd:a,...s}=e.makeTargetAnimatable(t);const l=e.getValue("willChange");r&&(i=r);const c=[],u=o&&e.animationState&&e.animationState.getState()[o];for(const t in s){const r=e.getValue(t),o=s[t];if(!r||void 0===o||u&&jf(u,t))continue;const a={delay:n,elapsed:0,...i};if(window.HandoffAppearAnimations&&!r.hasAnimated){const n=e.getProps()[Iu];n&&(a.elapsed=window.HandoffAppearAnimations(n,t,r,Jc),a.syncStart=!0)}r.start(_f(t,r,o,e.shouldReduceMotion&&Ul.has(t)?{type:!1}:a));const d=r.animation;Sf(l)&&(l.add(t),d.then((()=>l.remove(t)))),c.push(d)}return a&&Promise.all(c).then((()=>{a&&Ff(e,a)})),c}function Hf(e,t,n={}){const r=Tu(e,t,n.custom);let{transition:o=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(o=n.transitionOverride);const i=r?()=>Promise.all(Vf(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(r=0)=>{const{delayChildren:i=0,staggerChildren:a,staggerDirection:s}=o;return function(e,t,n=0,r=0,o=1,i){const a=[],s=(e.variantChildren.size-1)*r,l=1===o?(e=0)=>e*r:(e=0)=>s-e*r;return Array.from(e.variantChildren).sort($f).forEach(((e,r)=>{e.notify("AnimationStart",t),a.push(Hf(e,t,{...i,delay:n+l(r)}).then((()=>e.notify("AnimationComplete",t))))})),Promise.all(a)}(e,t,i+r,a,s,n)}:()=>Promise.resolve(),{when:s}=o;if(s){const[e,t]="beforeChildren"===s?[i,a]:[a,i];return e().then((()=>t()))}return Promise.all([i(),a(n.delay)])}function $f(e,t){return e.sortNodePosition(t)}const Wf=[...Pl].reverse(),Uf=Pl.length;function Gf(e){return t=>Promise.all(t.map((({animation:t,options:n})=>function(e,t,n={}){let r;if(e.notify("AnimationStart",t),Array.isArray(t)){const o=t.map((t=>Hf(e,t,n)));r=Promise.all(o)}else if("string"==typeof t)r=Hf(e,t,n);else{const o="function"==typeof t?Tu(e,t,n.custom):t;r=Promise.all(Vf(e,o,n))}return r.then((()=>e.notify("AnimationComplete",t)))}(e,t,n))))}function qf(e){let t=Gf(e);const n={animate:Kf(!0),whileInView:Kf(),whileHover:Kf(),whileTap:Kf(),whileDrag:Kf(),whileFocus:Kf(),exit:Kf()};let r=!0;const o=(t,n)=>{const r=Tu(e,n);if(r){const{transition:e,transitionEnd:n,...o}=r;t={...t,...o,...n}}return t};function i(i,a){const s=e.getProps(),l=e.getVariantContext(!0)||{},c=[],u=new Set;let d={},f=1/0;for(let t=0;t<Uf;t++){const m=Wf[t],p=n[m],h=void 0!==s[m]?s[m]:l[m],g=Cl(h),v=m===a?p.isActive:null;!1===v&&(f=t);let b=h===l[m]&&h!==s[m]&&g;if(b&&r&&e.manuallyAnimateOnMount&&(b=!1),p.protectedKeys={...d},!p.isActive&&null===v||!h&&!p.prevProp||kl(h)||"boolean"==typeof h)continue;const y=Yf(p.prevProp,h);let x=y||m===a&&p.isActive&&!b&&g||t>f&&g;const w=Array.isArray(h)?h:[h];let E=w.reduce(o,{});!1===v&&(E={});const{prevResolvedValues:_={}}=p,S={..._,...E},C=e=>{x=!0,u.delete(e),p.needsAnimating[e]=!0};for(const e in S){const t=E[e],n=_[e];d.hasOwnProperty(e)||(t!==n?$c(t)&&$c(n)?!Pu(t,n)||y?C(e):p.protectedKeys[e]=!0:void 0!==t?C(e):u.add(e):void 0!==t&&u.has(e)?C(e):p.protectedKeys[e]=!0)}p.prevProp=h,p.prevResolvedValues=E,p.isActive&&(d={...d,...E}),r&&e.blockInitialAnimation&&(x=!1),x&&!b&&c.push(...w.map((e=>({animation:e,options:{type:m,...i}}))))}if(u.size){const t={};u.forEach((n=>{const r=e.getBaseTarget(n);void 0!==r&&(t[n]=r)})),c.push({animation:t})}let m=Boolean(c.length);return r&&!1===s.initial&&!e.manuallyAnimateOnMount&&(m=!1),r=!1,m?t(c):Promise.resolve()}return{animateChanges:i,setActive:function(t,r,o){var a;if(n[t].isActive===r)return Promise.resolve();null===(a=e.variantChildren)||void 0===a||a.forEach((e=>{var n;return null===(n=e.animationState)||void 0===n?void 0:n.setActive(t,r)})),n[t].isActive=r;const s=i(o,t);for(const e in n)n[e].protectedKeys={};return s},setAnimateFunction:function(n){t=n(e)},getState:()=>n}}function Yf(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!Pu(t,e)}function Kf(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}let Xf=0;const Zf={animation:{Feature:class extends gu{constructor(e){super(e),e.animationState||(e.animationState=qf(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),kl(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){}}},exit:{Feature:class extends gu{constructor(){super(...arguments),this.id=Xf++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t,custom:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const o=this.node.animationState.setActive("exit",!e,{custom:null!=n?n:this.node.getProps().custom});t&&!e&&o.then((()=>t(this.id)))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}}},Jf=(e,t)=>Math.abs(e-t);class Qf{constructor(e,t,{transformPagePoint:n}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const e=nm(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,n=function(e,t){const n=Jf(e.x,t.x),r=Jf(e.y,t.y);return Math.sqrt(n**2+r**2)}(e.offset,{x:0,y:0})>=3;if(!t&&!n)return;const{point:r}=e,{timestamp:o}=eu;this.history.push({...r,timestamp:o});const{onStart:i,onMove:a}=this.handlers;t||(i&&i(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),a&&a(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=em(t,this.transformPagePoint),Jc.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{if(this.end(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const{onEnd:n,onSessionEnd:r}=this.handlers,o=nm("pointercancel"===e.type?this.lastMoveEventInfo:em(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,o),r&&r(e,o)},!iu(e))return;this.handlers=t,this.transformPagePoint=n;const r=em(au(e),this.transformPagePoint),{point:o}=r,{timestamp:i}=eu;this.history=[{...o,timestamp:i}];const{onSessionStart:a}=t;a&&a(e,nm(r,this.history)),this.removeListeners=uu(lu(window,"pointermove",this.handlePointerMove),lu(window,"pointerup",this.handlePointerUp),lu(window,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Qc(this.updatePoint)}}function em(e,t){return t?{point:t(e.point)}:e}function tm(e,t){return{x:e.x-t.x,y:e.y-t.y}}function nm({point:e},t){return{point:e,delta:tm(e,om(t)),offset:tm(e,rm(t)),velocity:im(t,.1)}}function rm(e){return e[0]}function om(e){return e[e.length-1]}function im(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=om(e);for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>Nu(t)));)n--;if(!r)return{x:0,y:0};const i=Du(o.timestamp-r.timestamp);if(0===i)return{x:0,y:0};const a={x:(o.x-r.x)/i,y:(o.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function am(e){return e.max-e.min}function sm(e,t=0,n=.01){return Math.abs(e-t)<=n}function lm(e,t,n,r=.5){e.origin=r,e.originPoint=dd(t.min,t.max,e.origin),e.scale=am(n)/am(t),(sm(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=dd(n.min,n.max,e.origin)-e.originPoint,(sm(e.translate)||isNaN(e.translate))&&(e.translate=0)}function cm(e,t,n,r){lm(e.x,t.x,n.x,r?r.originX:void 0),lm(e.y,t.y,n.y,r?r.originY:void 0)}function um(e,t,n){e.min=n.min+t.min,e.max=e.min+am(t)}function dm(e,t,n){e.min=t.min-n.min,e.max=e.min+am(t)}function fm(e,t,n){dm(e.x,t.x,n.x),dm(e.y,t.y,n.y)}function mm(e,t,n){return{min:void 0!==t?e.min+t:void 0,max:void 0!==n?e.max+n-(e.max-e.min):void 0}}function pm(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}const hm=.35;function gm(e,t,n){return{min:vm(e,t),max:vm(e,n)}}function vm(e,t){return"number"==typeof e?e:e[t]||0}const bm=()=>({x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}),ym=()=>({x:{min:0,max:0},y:{min:0,max:0}});function xm(e){return[e("x"),e("y")]}function wm({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function Em(e){return void 0===e||1===e}function _m({scale:e,scaleX:t,scaleY:n}){return!Em(e)||!Em(t)||!Em(n)}function Sm(e){return _m(e)||Cm(e)||e.z||e.rotate||e.rotateX||e.rotateY}function Cm(e){return km(e.x)||km(e.y)}function km(e){return e&&"0%"!==e}function Pm(e,t,n){return n+t*(e-n)}function Tm(e,t,n,r,o){return void 0!==o&&(e=Pm(e,o,r)),Pm(e,n,r)+t}function Im(e,t=0,n=1,r,o){e.min=Tm(e.min,t,n,r,o),e.max=Tm(e.max,t,n,r,o)}function Rm(e,{x:t,y:n}){Im(e.x,t.translate,t.scale,t.originPoint),Im(e.y,n.translate,n.scale,n.originPoint)}function Mm(e){return Number.isInteger(e)||e>1.0000000000001||e<.999999999999?e:1}function Nm(e,t){e.min=e.min+t,e.max=e.max+t}function Dm(e,t,[n,r,o]){const i=void 0!==t[o]?t[o]:.5,a=dd(e.min,e.max,i);Im(e,t[n],t[r],a,t.scale)}const Am=["x","scaleX","originX"],Om=["y","scaleY","originY"];function zm(e,t){Dm(e.x,t,Am),Dm(e.y,t,Om)}function Lm(e,t){return wm(function(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(e.getBoundingClientRect(),t))}const Fm=new WeakMap;class Bm{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ym(),this.visualElement=e}start(e,{snapToCursor:t=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;this.panSession=new Qf(e,{onSessionStart:e=>{this.stopAnimation(),t&&this.snapToCursor(au(e,"page").point)},onStart:(e,t)=>{const{drag:n,dragPropagation:r,onDragStart:o}=this.getProps();if(n&&!r&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=pu(n),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),xm((e=>{let t=this.getAxisMotionValue(e).get()||0;if(dc.test(t)){const{projection:n}=this.visualElement;if(n&&n.layout){const r=n.layout.layoutBox[e];if(r){t=am(r)*(parseFloat(t)/100)}}}this.originPoint[e]=t})),o&&Jc.update((()=>o(e,t)),!1,!0);const{animationState:i}=this.visualElement;i&&i.setActive("whileDrag",!0)},onMove:(e,t)=>{const{dragPropagation:n,dragDirectionLock:r,onDirectionLock:o,onDrag:i}=this.getProps();if(!n&&!this.openGlobalLock)return;const{offset:a}=t;if(r&&null===this.currentDirection)return this.currentDirection=function(e,t=10){let n=null;Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x");return n}(a),void(null!==this.currentDirection&&o&&o(this.currentDirection));this.updateAxis("x",t.point,a),this.updateAxis("y",t.point,a),this.visualElement.render(),i&&i(e,t)},onSessionEnd:(e,t)=>this.stop(e,t)},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(e,t){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:r}=t;this.startAnimation(r);const{onDragEnd:o}=this.getProps();o&&Jc.update((()=>o(e,t)))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,n){const{drag:r}=this.getProps();if(!n||!jm(e,r,this.currentDirection))return;const o=this.getAxisMotionValue(e);let i=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(i=function(e,{min:t,max:n},r){return void 0!==t&&e<t?e=r?dd(t,e,r.min):Math.max(e,t):void 0!==n&&e>n&&(e=r?dd(n,e,r.max):Math.min(e,n)),e}(i,this.constraints[e],this.elastic[e])),o.set(i)}resolveConstraints(){const{dragConstraints:e,dragElastic:t}=this.getProps(),{layout:n}=this.visualElement.projection||{},r=this.constraints;e&&Sl(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!n)&&function(e,{top:t,left:n,bottom:r,right:o}){return{x:mm(e.x,n,o),y:mm(e.y,t,r)}}(n.layoutBox,e),this.elastic=function(e=hm){return!1===e?e=0:!0===e&&(e=hm),{x:gm(e,"left","right"),y:gm(e,"top","bottom")}}(t),r!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&xm((e=>{this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const n={};return void 0!==t.min&&(n.min=t.min-e.min),void 0!==t.max&&(n.max=t.max-e.min),n}(n.layoutBox[e],this.constraints[e]))}))}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Sl(e))return!1;const n=e.current;Mu(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const o=function(e,t,n){const r=Lm(e,n),{scroll:o}=t;return o&&(Nm(r.x,o.offset.x),Nm(r.y,o.offset.y)),r}(n,r.root,this.visualElement.getTransformPagePoint());let i=function(e,t){return{x:pm(e.x,t.x),y:pm(e.y,t.y)}}(r.layout.layoutBox,o);if(t){const e=t(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(i));this.hasMutatedConstraints=!!e,e&&(i=wm(e))}return i}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:r,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),s=this.constraints||{},l=xm((a=>{if(!jm(a,t,this.currentDirection))return;let l=s&&s[a]||{};i&&(l={min:0,max:0});const c=r?200:1e6,u=r?40:1e7,d={type:"inertia",velocity:n?e[a]:0,bounceStiffness:c,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...o,...l};return this.startAxisValueAnimation(a,d)}));return Promise.all(l).then(a)}startAxisValueAnimation(e,t){const n=this.getAxisMotionValue(e);return n.start(_f(e,n,0,t))}stopAnimation(){xm((e=>this.getAxisMotionValue(e).stop()))}getAxisMotionValue(e){const t="_drag"+e.toUpperCase(),n=this.visualElement.getProps(),r=n[t];return r||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){xm((t=>{const{drag:n}=this.getProps();if(!jm(t,n,this.currentDirection))return;const{projection:r}=this.visualElement,o=this.getAxisMotionValue(t);if(r&&r.layout){const{min:n,max:i}=r.layout.layoutBox[t];o.set(e[t]-dd(n,i,.5))}}))}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!Sl(t)||!n||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};xm((e=>{const t=this.getAxisMotionValue(e);if(t){const n=t.get();r[e]=function(e,t){let n=.5;const r=am(e),o=am(t);return o>r?n=Md(t.min,t.max-r,e.min):r>o&&(n=Md(e.min,e.max-o,t.min)),ec(0,1,n)}({min:n,max:n},this.constraints[e])}}));const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),xm((t=>{if(!jm(t,e,null))return;const n=this.getAxisMotionValue(t),{min:o,max:i}=this.constraints[t];n.set(dd(o,i,r[t]))}))}addListeners(){if(!this.visualElement.current)return;Fm.set(this.visualElement,this);const e=lu(this.visualElement.current,"pointerdown",(e=>{const{drag:t,dragListener:n=!0}=this.getProps();t&&n&&this.start(e)})),t=()=>{const{dragConstraints:e}=this.getProps();Sl(e)&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,r=n.addEventListener("measure",t);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),t();const o=ou(window,"resize",(()=>this.scalePositionWithinConstraints())),i=n.addEventListener("didUpdate",(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(xm((t=>{const n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))})),this.visualElement.render())}));return()=>{o(),e(),r(),i&&i()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:o=!1,dragElastic:i=hm,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:o,dragElastic:i,dragMomentum:a}}}function jm(e,t,n){return!(!0!==t&&t!==e||null!==n&&n!==e)}const Vm=e=>(t,n)=>{e&&Jc.update((()=>e(t,n)))};const Hm={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function $m(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Wm={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e){if(!fc.test(e))return e;e=parseFloat(e)}return`${$m(e,t.target.x)}% ${$m(e,t.target.y)}%`}},Um={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,o=Cd.parse(e);if(o.length>5)return r;const i=Cd.createTransformer(e),a="number"!=typeof o[0]?1:0,s=n.x.scale*t.x,l=n.y.scale*t.y;o[0+a]/=s,o[1+a]/=l;const c=dd(s,l,.5);return"number"==typeof o[2+a]&&(o[2+a]/=c),"number"==typeof o[3+a]&&(o[3+a]/=c),i(o)}};class Gm extends r.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:o}=e;var i;i=Ym,Object.assign($l,i),o&&(t.group&&t.group.add(o),n&&n.register&&r&&n.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",(()=>{this.safeToRemove()})),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),Hm.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:n,drag:r,isPresent:o}=this.props,i=n.projection;return i?(i.isPresent=o,r||e.layoutDependency!==t||void 0===t?i.willUpdate():this.safeToRemove(),e.isPresent!==o&&(o?i.promote():i.relegate()||Jc.postRender((()=>{const e=i.getStack();e&&e.members.length||this.safeToRemove()}))),null):null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),queueMicrotask((()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()})))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function qm(e){const[t,n]=function(){const e=(0,r.useContext)(xl);if(null===e)return[!0,null];const{isPresent:t,onExitComplete:n,register:o}=e,i=(0,r.useId)();return(0,r.useEffect)((()=>o(i)),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}(),o=(0,r.useContext)(Ol);return r.createElement(Gm,{...e,layoutGroup:o,switchLayoutGroup:(0,r.useContext)(zl),isPresent:t,safeToRemove:n})}const Ym={borderRadius:{...Wm,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Wm,borderTopRightRadius:Wm,borderBottomLeftRadius:Wm,borderBottomRightRadius:Wm,boxShadow:Um},Km=["TopLeft","TopRight","BottomLeft","BottomRight"],Xm=Km.length,Zm=e=>"string"==typeof e?parseFloat(e):e,Jm=e=>"number"==typeof e||fc.test(e);function Qm(e,t){return void 0!==e[t]?e[t]:e.borderRadius}const ep=np(0,.5,Zu),tp=np(.5,.95,Kc);function np(e,t,n){return r=>r<e?0:r>t?1:n(Md(e,t,r))}function rp(e,t){e.min=t.min,e.max=t.max}function op(e,t){rp(e.x,t.x),rp(e.y,t.y)}function ip(e,t,n,r,o){return e=Pm(e-=t,1/n,r),void 0!==o&&(e=Pm(e,1/o,r)),e}function ap(e,t,[n,r,o],i,a){!function(e,t=0,n=1,r=.5,o,i=e,a=e){dc.test(t)&&(t=parseFloat(t),t=dd(a.min,a.max,t/100)-a.min);if("number"!=typeof t)return;let s=dd(i.min,i.max,r);e===i&&(s-=t),e.min=ip(e.min,t,n,s,o),e.max=ip(e.max,t,n,s,o)}(e,t[n],t[r],t[o],t.scale,i,a)}const sp=["x","scaleX","originX"],lp=["y","scaleY","originY"];function cp(e,t,n,r){ap(e.x,t,sp,n?n.x:void 0,r?r.x:void 0),ap(e.y,t,lp,n?n.y:void 0,r?r.y:void 0)}function up(e){return 0===e.translate&&1===e.scale}function dp(e){return up(e.x)&&up(e.y)}function fp(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function mp(e){return am(e.x)/am(e.y)}class pp{constructor(){this.members=[]}add(e){kf(this.members,e),e.scheduleRender()}remove(e){if(Pf(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){const t=this.members.findIndex((t=>e===t));if(0===t)return!1;let n;for(let e=t;e>=0;e--){const t=this.members[e];if(!1!==t.isPresent){n=t;break}}return!!n&&(this.promote(n),!0)}promote(e,t){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,t&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:r}=e.options;!1===r&&n.hide()}}exitAnimationComplete(){this.members.forEach((e=>{const{options:t,resumingFrom:n}=e;t.onExitComplete&&t.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()}))}scheduleRender(){this.members.forEach((e=>{e.instance&&e.scheduleRender(!1)}))}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function hp(e,t,n){let r="";const o=e.x.translate/t.x,i=e.y.translate/t.y;if((o||i)&&(r=`translate3d(${o}px, ${i}px, 0) `),1===t.x&&1===t.y||(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:e,rotateX:t,rotateY:o}=n;e&&(r+=`rotate(${e}deg) `),t&&(r+=`rotateX(${t}deg) `),o&&(r+=`rotateY(${o}deg) `)}const a=e.x.scale*t.x,s=e.y.scale*t.y;return 1===a&&1===s||(r+=`scale(${a}, ${s})`),r||"none"}const gp=(e,t)=>e.depth-t.depth;class vp{constructor(){this.children=[],this.isDirty=!1}add(e){kf(this.children,e),this.isDirty=!0}remove(e){Pf(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(gp),this.isDirty=!1,this.children.forEach(e)}}const bp=["","X","Y","Z"];let yp=0;const xp={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function wp({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(e={},n=(null==t?void 0:t())){this.id=yp++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{var e;xp.totalNodes=xp.resolvedTargetDeltas=xp.recalculatedProjection=0,this.nodes.forEach(Sp),this.nodes.forEach(Mp),this.nodes.forEach(Np),this.nodes.forEach(Cp),e=xp,window.MotionDebug&&window.MotionDebug.record(e)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new vp)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Tf),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){const n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t,n=this.root.hasTreeAnimated){if(this.instance)return;var r;this.isSVG=(r=t)instanceof SVGElement&&"svg"!==r.tagName,this.instance=t;const{layoutId:o,layout:i,visualElement:a}=this.options;if(a&&!a.current&&a.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),n&&(i||o)&&(this.isLayoutDirty=!0),e){let n;const r=()=>this.root.updateBlockedByResize=!1;e(t,(()=>{this.root.updateBlockedByResize=!0,n&&n(),n=function(e,t){const n=performance.now(),r=({timestamp:o})=>{const i=o-n;i>=t&&(Qc(r),e(i-t))};return Jc.read(r,!0),()=>Qc(r)}(r,250),Hm.hasAnimatedSinceResize&&(Hm.hasAnimatedSinceResize=!1,this.nodes.forEach(Rp))}))}o&&this.root.registerSharedNode(o,this),!1!==this.options.animate&&a&&(o||i)&&this.addEventListener("didUpdate",(({delta:e,hasLayoutChanged:t,hasRelativeTargetChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const o=this.options.transition||a.getDefaultTransition()||Fp,{onLayoutAnimationStart:i,onLayoutAnimationComplete:s}=a.getProps(),l=!this.targetLayout||!fp(this.targetLayout,r)||n,c=!t&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(e,c);const t={...Ef(o,"layout"),onPlay:i,onComplete:s};(a.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t)}else t||Rp(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Qc(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Dp),this.animationId++)}getTransformTemplate(){const{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){const t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}const{layoutId:t,layout:n}=this.options;if(void 0===t&&!n)return;const r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(Pp);this.isUpdating||this.nodes.forEach(Tp),this.isUpdating=!1,this.nodes.forEach(Ip),this.nodes.forEach(Ep),this.nodes.forEach(_p),this.clearAllSnapshots();const e=performance.now();eu.delta=ec(0,1e3/60,e-eu.timestamp),eu.timestamp=e,eu.isProcessing=!0,tu.update.process(eu),tu.preRender.process(eu),tu.render.process(eu),eu.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,queueMicrotask((()=>this.update())))}clearAllSnapshots(){this.nodes.forEach(kp),this.sharedNodes.forEach(Ap)}scheduleUpdateProjection(){Jc.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){Jc.postRender((()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++){this.path[e].updateScroll()}const e=this.layout;this.layout=this.measure(!1),this.layoutCorrected=ym(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=Boolean(this.options.layoutScroll&&this.instance);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&(this.scroll={animationId:this.root.animationId,phase:e,isRoot:r(this.instance),offset:n(this.instance)})}resetTransform(){if(!o)return;const e=this.isLayoutDirty||this.shouldResetTransform,t=this.projectionDelta&&!dp(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,""):void 0,i=r!==this.prevTransformTemplateValue;e&&(t||Sm(this.latestValues)||i)&&(o(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){const t=this.measurePageBox();let n=this.removeElementScroll(t);var r;return e&&(n=this.removeTransform(n)),Vp((r=n).x),Vp(r.y),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:e}=this.options;if(!e)return ym();const t=e.measureViewportBox(),{scroll:n}=this.root;return n&&(Nm(t.x,n.offset.x),Nm(t.y,n.offset.y)),t}removeElementScroll(e){const t=ym();op(t,e);for(let n=0;n<this.path.length;n++){const r=this.path[n],{scroll:o,options:i}=r;if(r!==this.root&&o&&i.layoutScroll){if(o.isRoot){op(t,e);const{scroll:n}=this.root;n&&(Nm(t.x,-n.offset.x),Nm(t.y,-n.offset.y))}Nm(t.x,o.offset.x),Nm(t.y,o.offset.y)}}return t}applyTransform(e,t=!1){const n=ym();op(n,e);for(let e=0;e<this.path.length;e++){const r=this.path[e];!t&&r.options.layoutScroll&&r.scroll&&r!==r.root&&zm(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),Sm(r.latestValues)&&zm(n,r.latestValues)}return Sm(this.latestValues)&&zm(n,this.latestValues),n}removeTransform(e){const t=ym();op(t,e);for(let e=0;e<this.path.length;e++){const n=this.path[e];if(!n.instance)continue;if(!Sm(n.latestValues))continue;_m(n.latestValues)&&n.updateSnapshot();const r=ym();op(r,n.measurePageBox()),cp(t,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return Sm(this.latestValues)&&cp(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==eu.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){var t;const n=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=n.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=n.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=n.isSharedProjectionDirty);const r=Boolean(this.resumingFrom)||this!==n;if(!(e||r&&this.isSharedProjectionDirty||this.isProjectionDirty||(null===(t=this.parent)||void 0===t?void 0:t.isProjectionDirty)||this.attemptToResolveRelativeTarget))return;const{layout:o,layoutId:i}=this.options;if(this.layout&&(o||i)){if(this.resolvedRelativeTargetAt=eu.timestamp,!this.targetDelta&&!this.relativeTarget){const e=this.getClosestProjectingParent();e&&e.layout&&1!==this.animationProgress?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ym(),this.relativeTargetOrigin=ym(),fm(this.relativeTargetOrigin,this.layout.layoutBox,e.layout.layoutBox),op(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){var a,s,l;if(this.target||(this.target=ym(),this.targetWithTransforms=ym()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),a=this.target,s=this.relativeTarget,l=this.relativeParent.target,um(a.x,s.x,l.x),um(a.y,s.y,l.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):op(this.target,this.layout.layoutBox),Rm(this.target,this.targetDelta)):op(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const e=this.getClosestProjectingParent();e&&Boolean(e.resumingFrom)===Boolean(this.resumingFrom)&&!e.options.layoutScroll&&e.target&&1!==this.animationProgress?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ym(),this.relativeTargetOrigin=ym(),fm(this.relativeTargetOrigin,this.target,e.target),op(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}xp.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(this.parent&&!_m(this.parent.latestValues)&&!Cm(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var e;const t=this.getLead(),n=Boolean(this.resumingFrom)||this!==t;let r=!0;if((this.isProjectionDirty||(null===(e=this.parent)||void 0===e?void 0:e.isProjectionDirty))&&(r=!1),n&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===eu.timestamp&&(r=!1),r)return;const{layout:o,layoutId:i}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!o&&!i)return;op(this.layoutCorrected,this.layout.layoutBox);const a=this.treeScale.x,s=this.treeScale.y;!function(e,t,n,r=!1){const o=n.length;if(!o)return;let i,a;t.x=t.y=1;for(let s=0;s<o;s++){i=n[s],a=i.projectionDelta;const o=i.instance;o&&o.style&&"contents"===o.style.display||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&zm(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),a&&(t.x*=a.x.scale,t.y*=a.y.scale,Rm(e,a)),r&&Sm(i.latestValues)&&zm(e,i.latestValues))}t.x=Mm(t.x),t.y=Mm(t.y)}(this.layoutCorrected,this.treeScale,this.path,n),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox);const{target:l}=t;if(!l)return void(this.projectionTransform&&(this.projectionDelta=bm(),this.projectionTransform="none",this.scheduleRender()));this.projectionDelta||(this.projectionDelta=bm(),this.projectionDeltaWithTransform=bm());const c=this.projectionTransform;cm(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.projectionTransform=hp(this.projectionDelta,this.treeScale),this.projectionTransform===c&&this.treeScale.x===a&&this.treeScale.y===s||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l)),xp.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(e,t=!1){const n=this.snapshot,r=n?n.latestValues:{},o={...this.latestValues},i=bm();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const a=ym(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),c=!l||l.members.length<=1,u=Boolean(s&&!c&&!0===this.options.crossfade&&!this.path.some(Lp));let d;this.animationProgress=0,this.mixTargetDelta=t=>{const n=t/1e3;Op(i.x,e.x,n),Op(i.y,e.y,n),this.setTargetDelta(i),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(fm(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox),function(e,t,n,r){zp(e.x,t.x,n.x,r),zp(e.y,t.y,n.y,r)}(this.relativeTarget,this.relativeTargetOrigin,a,n),d&&function(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||(d=ym()),op(d,this.relativeTarget)),s&&(this.animationValues=o,function(e,t,n,r,o,i){o?(e.opacity=dd(0,void 0!==n.opacity?n.opacity:1,ep(r)),e.opacityExit=dd(void 0!==t.opacity?t.opacity:1,0,tp(r))):i&&(e.opacity=dd(void 0!==t.opacity?t.opacity:1,void 0!==n.opacity?n.opacity:1,r));for(let o=0;o<Xm;o++){const i=`border${Km[o]}Radius`;let a=Qm(t,i),s=Qm(n,i);void 0===a&&void 0===s||(a||(a=0),s||(s=0),0===a||0===s||Jm(a)===Jm(s)?(e[i]=Math.max(dd(Zm(a),Zm(s),r),0),(dc.test(s)||dc.test(a))&&(e[i]+="%")):e[i]=s)}(t.rotate||n.rotate)&&(e.rotate=dd(t.rotate||0,n.rotate||0,r))}(o,r,this.latestValues,n,u,c)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Qc(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Jc.update((()=>{Hm.hasAnimatedSinceResize=!0,this.currentAnimation=function(e,t,n){const r=ql(e)?e:Mf(e);return r.start(_f("",r,t,n)),r.animation}(0,1e3,{...e,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let{targetWithTransforms:t,target:n,layout:r,latestValues:o}=e;if(t&&n&&r){if(this!==e&&this.layout&&r&&Hp(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||ym();const t=am(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;const r=am(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}op(t,n),zm(t,o),cm(this.projectionDeltaWithTransform,this.layoutCorrected,t,o)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new pp);this.sharedNodes.get(e).add(t);const n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){var e;const{layoutId:t}=this.options;return t&&(null===(e=this.getStack())||void 0===e?void 0:e.lead)||this}getPrevLead(){var e;const{layoutId:t}=this.options;return t?null===(e=this.getStack())||void 0===e?void 0:e.prevLead:void 0}getStack(){const{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){const r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetRotation(){const{visualElement:e}=this.options;if(!e)return;let t=!1;const{latestValues:n}=e;if((n.rotate||n.rotateX||n.rotateY||n.rotateZ)&&(t=!0),!t)return;const r={};for(let t=0;t<bp.length;t++){const o="rotate"+bp[t];n[o]&&(r[o]=n[o],e.setStaticValue(o,0))}e.render();for(const t in r)e.setStaticValue(t,r[t]);e.scheduleRender()}getProjectionStyles(e={}){var t,n;const r={};if(!this.instance||this.isSVG)return r;if(!this.isVisible)return{visibility:"hidden"};r.visibility="";const o=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,r.opacity="",r.pointerEvents=Gc(e.pointerEvents)||"",r.transform=o?o(this.latestValues,""):"none",r;const i=this.getLead();if(!this.projectionDelta||!this.layout||!i.target){const t={};return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=Gc(e.pointerEvents)||""),this.hasProjected&&!Sm(this.latestValues)&&(t.transform=o?o({},""):"none",this.hasProjected=!1),t}const a=i.animationValues||i.latestValues;this.applyTransformsToTarget(),r.transform=hp(this.projectionDeltaWithTransform,this.treeScale,a),o&&(r.transform=o(a,r.transform));const{x:s,y:l}=this.projectionDelta;r.transformOrigin=`${100*s.origin}% ${100*l.origin}% 0`,i.animationValues?r.opacity=i===this?null!==(n=null!==(t=a.opacity)&&void 0!==t?t:this.latestValues.opacity)&&void 0!==n?n:1:this.preserveOpacity?this.latestValues.opacity:a.opacityExit:r.opacity=i===this?void 0!==a.opacity?a.opacity:"":void 0!==a.opacityExit?a.opacityExit:0;for(const e in $l){if(void 0===a[e])continue;const{correct:t,applyTo:n}=$l[e],o="none"===r.transform?a[e]:t(a[e],i);if(n){const e=n.length;for(let t=0;t<e;t++)r[n[t]]=o}else r[e]=o}return this.options.layoutId&&(r.pointerEvents=i===this?Gc(e.pointerEvents)||"":"none"),r}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach((e=>{var t;return null===(t=e.currentAnimation)||void 0===t?void 0:t.stop()})),this.root.nodes.forEach(Pp),this.root.sharedNodes.clear()}}}function Ep(e){e.updateLayout()}function _p(e){var t;const n=(null===(t=e.resumeFrom)||void 0===t?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:t,measuredBox:r}=e.layout,{animationType:o}=e.options,i=n.source!==e.layout.source;"size"===o?xm((e=>{const r=i?n.measuredBox[e]:n.layoutBox[e],o=am(r);r.min=t[e].min,r.max=r.min+o})):Hp(o,n.layoutBox,t)&&xm((r=>{const o=i?n.measuredBox[r]:n.layoutBox[r],a=am(t[r]);o.max=o.min+a,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+a)}));const a=bm();cm(a,t,n.layoutBox);const s=bm();i?cm(s,e.applyTransform(r,!0),n.measuredBox):cm(s,t,n.layoutBox);const l=!dp(a);let c=!1;if(!e.resumeFrom){const r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){const{snapshot:o,layout:i}=r;if(o&&i){const a=ym();fm(a,n.layoutBox,o.layoutBox);const s=ym();fm(s,t,i.layoutBox),fp(a,s)||(c=!0),r.options.layoutRoot&&(e.relativeTarget=s,e.relativeTargetOrigin=a,e.relativeParent=r)}}}e.notifyListeners("didUpdate",{layout:t,snapshot:n,delta:s,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function Sp(e){xp.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Cp(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function kp(e){e.clearSnapshot()}function Pp(e){e.clearMeasurements()}function Tp(e){e.isLayoutDirty=!1}function Ip(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Rp(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Mp(e){e.resolveTargetDelta()}function Np(e){e.calcProjection()}function Dp(e){e.resetRotation()}function Ap(e){e.removeLeadSnapshot()}function Op(e,t,n){e.translate=dd(t.translate,0,n),e.scale=dd(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function zp(e,t,n,r){e.min=dd(t.min,n.min,r),e.max=dd(t.max,n.max,r)}function Lp(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}const Fp={duration:.45,ease:[.4,0,.1,1]},Bp=e=>"undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().includes(e),jp=Bp("applewebkit/")&&!Bp("chrome/")?Math.round:Kc;function Vp(e){e.min=jp(e.min),e.max=jp(e.max)}function Hp(e,t,n){return"position"===e||"preserve-aspect"===e&&!sm(mp(t),mp(n),.2)}const $p=wp({attachResizeListener:(e,t)=>ou(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Wp={current:void 0},Up=wp({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Wp.current){const e=new $p({});e.mount(window),e.setOptions({layoutScroll:!0}),Wp.current=e}return Wp.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),Gp={pan:{Feature:class extends gu{constructor(){super(...arguments),this.removePointerDownListener=Kc}onPointerDown(e){this.session=new Qf(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Vm(e),onStart:Vm(t),onMove:n,onEnd:(e,t)=>{delete this.session,r&&Jc.update((()=>r(e,t)))}}}mount(){this.removePointerDownListener=lu(this.node.current,"pointerdown",(e=>this.onPointerDown(e)))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends gu{constructor(e){super(e),this.removeGroupControls=Kc,this.removeListeners=Kc,this.controls=new Bm(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Kc}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:Up,MeasureLayout:qm}},qp=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;const Yp=4;function Kp(e,t,n=1){Mu(n<=Yp,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);const[r,o]=function(e){const t=qp.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const e=i.trim();return Cf(e)?parseFloat(e):e}return Jl(o)?Kp(o,t,n+1):o}const Xp=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Zp=e=>Xp.has(e),Jp=e=>e===tc||e===fc,Qp=(e,t)=>parseFloat(e.split(", ")[t]),eh=(e,t)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/);if(o)return Qp(o[1],t);{const t=r.match(/^matrix\((.+)\)$/);return t?Qp(t[1],e):0}},th=new Set(["x","y","z"]),nh=Wl.filter((e=>!th.has(e)));const rh={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:eh(4,13),y:eh(5,14)};rh.translateX=rh.x,rh.translateY=rh.y;const oh=(e,t,n={},r={})=>{t={...t},r={...r};const o=Object.keys(t).filter(Zp);let i=[],a=!1;const s=[];if(o.forEach((o=>{const l=e.getValue(o);if(!e.hasValue(o))return;let c=n[o],u=Af(c);const d=t[o];let f;if($c(d)){const e=d.length,t=null===d[0]?1:0;c=d[t],u=Af(c);for(let n=t;n<e&&null!==d[n];n++)f?Mu(Af(d[n])===f,"All keyframes must be of the same type"):(f=Af(d[n]),Mu(f===u||Jp(u)&&Jp(f),"Keyframes must be of the same dimension as the current value"))}else f=Af(d);if(u!==f)if(Jp(u)&&Jp(f)){const e=l.get();"string"==typeof e&&l.set(parseFloat(e)),"string"==typeof d?t[o]=parseFloat(d):Array.isArray(d)&&f===fc&&(t[o]=d.map(parseFloat))}else(null==u?void 0:u.transform)&&(null==f?void 0:f.transform)&&(0===c||0===d)?0===c?l.set(f.transform(c)):t[o]=u.transform(d):(a||(i=function(e){const t=[];return nh.forEach((n=>{const r=e.getValue(n);void 0!==r&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))})),t.length&&e.render(),t}(e),a=!0),s.push(o),r[o]=void 0!==r[o]?r[o]:t[o],l.jump(d))})),s.length){const n=s.indexOf("height")>=0?window.pageYOffset:null,o=((e,t,n)=>{const r=t.measureViewportBox(),o=t.current,i=getComputedStyle(o),{display:a}=i,s={};"none"===a&&t.setStaticValue("display",e.display||"block"),n.forEach((e=>{s[e]=rh[e](r,i)})),t.render();const l=t.measureViewportBox();return n.forEach((n=>{const r=t.getValue(n);r&&r.jump(s[n]),e[n]=rh[n](l,i)})),e})(t,e,s);return i.length&&i.forEach((([t,n])=>{e.getValue(t).set(n)})),e.render(),wl&&null!==n&&window.scrollTo({top:n}),{target:o,transitionEnd:r}}return{target:t,transitionEnd:r}};function ih(e,t,n,r){return(e=>Object.keys(e).some(Zp))(t)?oh(e,t,n,r):{target:t,transitionEnd:r}}const ah=(e,t,n,r)=>{const o=function(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach((e=>{const t=e.get();if(!Jl(t))return;const n=Kp(t,r);n&&e.set(n)}));for(const e in t){const o=t[e];if(!Jl(o))continue;const i=Kp(o,r);i&&(t[e]=i,n||(n={}),void 0===n[e]&&(n[e]=o))}return{target:t,transitionEnd:n}}(e,t,r);return ih(e,t=o.target,n,r=o.transitionEnd)},sh={current:null},lh={current:!1};function ch(){if(lh.current=!0,wl)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>sh.current=e.matches;e.addListener(t),t()}else sh.current=!1}const uh=new WeakMap,dh=Object.keys(Al),fh=dh.length,mh=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],ph=Tl.length;class hh{constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,visualState:o},i={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>Jc.render(this.render,!1,!0);const{latestValues:a,renderState:s}=o;this.latestValues=a,this.baseTarget={...a},this.initialValues=t.initial?{...a}:{},this.renderState=s,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=i,this.isControllingVariants=Il(t),this.isVariantNode=Rl(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:l,...c}=this.scrapeMotionValuesFromProps(t,{});for(const e in c){const t=c[e];void 0!==a[e]&&ql(t)&&(t.set(a[e],!1),Sf(l)&&l.add(e))}}scrapeMotionValuesFromProps(e,t){return{}}mount(e){this.current=e,uh.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((e,t)=>this.bindToMotionValue(t,e))),lh.current||ch(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||sh.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){uh.delete(this.current),this.projection&&this.projection.unmount(),Qc(this.notifyUpdate),Qc(this.render),this.valueSubscriptions.forEach((e=>e())),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,t){const n=Ul.has(e),r=t.on("change",(t=>{this.latestValues[e]=t,this.props.onUpdate&&Jc.update(this.notifyUpdate,!1,!0),n&&this.projection&&(this.projection.isTransformDirty=!0)})),o=t.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,(()=>{r(),o()}))}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}loadFeatures({children:e,...t},n,r,o){let i,a;for(let e=0;e<fh;e++){const n=dh[e],{isEnabled:r,Feature:o,ProjectionNode:s,MeasureLayout:l}=Al[n];s&&(i=s),r(t)&&(!this.features[n]&&o&&(this.features[n]=new o(this)),l&&(a=l))}if(!this.projection&&i){this.projection=new i(this.latestValues,this.parent&&this.parent.projection);const{layoutId:e,layout:n,drag:r,dragConstraints:a,layoutScroll:s,layoutRoot:l}=t;this.projection.setOptions({layoutId:e,layout:n,alwaysMeasureLayout:Boolean(r)||a&&Sl(a),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:"string"==typeof n?n:"both",initialPromotionConfig:o,layoutScroll:s,layoutRoot:l})}return a}updateFeatures(){for(const e in this.features){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ym()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}makeTargetAnimatable(e,t=!0){return this.makeTargetAnimatableFromInstance(e,this.props,t)}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<mh.length;t++){const n=mh[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=e["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(e,t,n){const{willChange:r}=t;for(const o in t){const i=t[o],a=n[o];if(ql(i))e.addValue(o,i),Sf(r)&&r.add(o);else if(ql(a))e.addValue(o,Mf(i,{owner:e})),Sf(r)&&r.remove(o);else if(a!==i)if(e.hasValue(o)){const t=e.getValue(o);!t.hasAnimated&&t.set(i)}else{const t=e.getStaticValue(o);e.addValue(o,Mf(void 0!==t?t:i,{owner:e}))}}for(const r in n)void 0===t[r]&&e.removeValue(r);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(e=!1){if(e)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const e=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(e.initial=this.props.initial),e}const t={};for(let e=0;e<ph;e++){const n=Tl[e],r=this.props[n];(Cl(r)||!1===r)&&(t[n]=r)}return t}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){t!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,t)),this.values.set(e,t),this.latestValues[e]=t.get()}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return void 0===n&&void 0!==t&&(n=Mf(t,{owner:this}),this.addValue(e,n)),n}readValue(e){var t;return void 0===this.latestValues[e]&&this.current?null!==(t=this.getBaseTargetFromProps(this.props,e))&&void 0!==t?t:this.readValueFromInstance(this.current,e,this.options):this.latestValues[e]}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:n}=this.props,r="string"==typeof n||"object"==typeof n?null===(t=Vc(this.props,n))||void 0===t?void 0:t[e]:void 0;if(n&&void 0!==r)return r;const o=this.getBaseTargetFromProps(this.props,e);return void 0===o||ql(o)?void 0!==this.initialValues[e]&&void 0===r?void 0:this.baseTarget[e]:o}on(e,t){return this.events[e]||(this.events[e]=new Tf),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class gh extends hh{sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:t,...n},{transformValues:r},o){let i=function(e,t,n){const r={};for(const o in e){const e=Bf(o,t);if(void 0!==e)r[o]=e;else{const e=n.getValue(o);e&&(r[o]=e.get())}}return r}(n,e||{},this);if(r&&(t&&(t=r(t)),n&&(n=r(n)),i&&(i=r(i))),o){!function(e,t,n){var r,o;const i=Object.keys(t).filter((t=>!e.hasValue(t))),a=i.length;if(a)for(let s=0;s<a;s++){const a=i[s],l=t[a];let c=null;Array.isArray(l)&&(c=l[0]),null===c&&(c=null!==(o=null!==(r=n[a])&&void 0!==r?r:e.readValue(a))&&void 0!==o?o:t[a]),null!=c&&("string"==typeof c&&(Cf(c)||xf(c))?c=parseFloat(c):!zf(c)&&Cd.test(l)&&(c=yf(a,l)),e.addValue(a,Mf(c,{owner:e})),void 0===n[a]&&(n[a]=c),null!==c&&e.setBaseTarget(a,c))}}(this,n,i);const e=ah(this,n,i,t);t=e.transitionEnd,n=e.target}return{transition:e,transitionEnd:t,...n}}}class vh extends gh{readValueFromInstance(e,t){if(Ul.has(t)){const e=bf(t);return e&&e.default||0}{const r=(n=e,window.getComputedStyle(n)),o=(Zl(t)?r.getPropertyValue(t):r[t])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(e,{transformPagePoint:t}){return Lm(e,t)}build(e,t,n,r){bc(e,t,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,t){return Bc(e,t)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;ql(e)&&(this.childSubscription=e.on("change",(e=>{this.current&&(this.current.textContent=`${e}`)})))}renderInstance(e,t,n,r){zc(e,t,n,r)}}class bh extends gh{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Ul.has(t)){const e=bf(t);return e&&e.default||0}return t=Lc.has(t)?t:Oc(t),e.getAttribute(t)}measureInstanceViewportBox(){return ym()}scrapeMotionValuesFromProps(e,t){return jc(e,t)}build(e,t,n,r){Rc(e,t,n,this.isSVGTag,r.transformTemplate)}renderInstance(e,t,n,r){Fc(e,t,0,r)}mount(e){this.isSVGTag=Nc(e.tagName),super.mount(e)}}const yh=(e,t)=>Hl(e)?new bh(t,{enableHardwareAcceleration:!1}):new vh(t,{enableHardwareAcceleration:!0}),xh={...Zf,...ku,...Gp,...{layout:{ProjectionNode:Up,MeasureLayout:qm}}},wh=jl(((e,t)=>function(e,{forwardMotionProps:t=!1},n,r){return{...Hl(e)?nu:ru,preloadedFeatures:n,useRender:Ac(t),createVisualElement:r,Component:e}}(e,t,xh,yh)));function Eh(){const e=(0,r.useRef)(!1);return El((()=>(e.current=!0,()=>{e.current=!1})),[]),e}function _h(){const e=Eh(),[t,n]=(0,r.useState)(0),o=(0,r.useCallback)((()=>{e.current&&n(t+1)}),[t]);return[(0,r.useCallback)((()=>Jc.postRender(o)),[o]),t]}class Sh extends r.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const e=this.props.sizeRef.current;e.height=t.offsetHeight||0,e.width=t.offsetWidth||0,e.top=t.offsetTop,e.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Ch({children:e,isPresent:t}){const n=(0,r.useId)(),o=(0,r.useRef)(null),i=(0,r.useRef)({width:0,height:0,top:0,left:0});return(0,r.useInsertionEffect)((()=>{const{width:e,height:r,top:a,left:s}=i.current;if(t||!o.current||!e||!r)return;o.current.dataset.motionPopId=n;const l=document.createElement("style");return document.head.appendChild(l),l.sheet&&l.sheet.insertRule(`\n [data-motion-pop-id="${n}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${r}px !important;\n top: ${a}px !important;\n left: ${s}px !important;\n }\n `),()=>{document.head.removeChild(l)}}),[t]),r.createElement(Sh,{isPresent:t,childRef:o,sizeRef:i},r.cloneElement(e,{ref:o}))}const kh=({children:e,initial:t,isPresent:n,onExitComplete:o,custom:i,presenceAffectsLayout:a,mode:s})=>{const l=Hc(Ph),c=(0,r.useId)(),u=(0,r.useMemo)((()=>({id:c,initial:t,isPresent:n,custom:i,onExitComplete:e=>{l.set(e,!0);for(const e of l.values())if(!e)return;o&&o()},register:e=>(l.set(e,!1),()=>l.delete(e))})),a?void 0:[n]);return(0,r.useMemo)((()=>{l.forEach(((e,t)=>l.set(t,!1)))}),[n]),r.useEffect((()=>{!n&&!l.size&&o&&o()}),[n]),"popLayout"===s&&(e=r.createElement(Ch,{isPresent:n},e)),r.createElement(xl.Provider,{value:u},e)};function Ph(){return new Map}const Th=e=>e.key||"";const Ih=({children:e,custom:t,initial:n=!0,onExitComplete:o,exitBeforeEnter:i,presenceAffectsLayout:a=!0,mode:s="sync"})=>{Mu(!i,"Replace exitBeforeEnter with mode='wait'");const l=(0,r.useContext)(Ol).forceRender||_h()[0],c=Eh(),u=function(e){const t=[];return r.Children.forEach(e,(e=>{(0,r.isValidElement)(e)&&t.push(e)})),t}(e);let d=u;const f=(0,r.useRef)(new Map).current,m=(0,r.useRef)(d),p=(0,r.useRef)(new Map).current,h=(0,r.useRef)(!0);var g;if(El((()=>{h.current=!1,function(e,t){e.forEach((e=>{const n=Th(e);t.set(n,e)}))}(u,p),m.current=d})),g=()=>{h.current=!0,p.clear(),f.clear()},(0,r.useEffect)((()=>()=>g()),[]),h.current)return r.createElement(r.Fragment,null,d.map((e=>r.createElement(kh,{key:Th(e),isPresent:!0,initial:!!n&&void 0,presenceAffectsLayout:a,mode:s},e))));d=[...d];const v=m.current.map(Th),b=u.map(Th),y=v.length;for(let e=0;e<y;e++){const t=v[e];-1!==b.indexOf(t)||f.has(t)||f.set(t,void 0)}return"wait"===s&&f.size&&(d=[]),f.forEach(((e,n)=>{if(-1!==b.indexOf(n))return;const i=p.get(n);if(!i)return;const h=v.indexOf(n);let g=e;if(!g){const e=()=>{p.delete(n),f.delete(n);const e=m.current.findIndex((e=>e.key===n));if(m.current.splice(e,1),!f.size){if(m.current=u,!1===c.current)return;l(),o&&o()}};g=r.createElement(kh,{key:Th(i),isPresent:!1,onExitComplete:e,custom:t,presenceAffectsLayout:a,mode:s},i),f.set(n,g)}d.splice(h,0,g)})),d=d.map((e=>{const t=e.key;return f.has(t)?e:r.createElement(kh,{key:Th(e),isPresent:!0,presenceAffectsLayout:a,mode:s},e)})),r.createElement(r.Fragment,null,f.size?d:d.map((e=>(0,r.cloneElement)(e))))},Rh=["40em","52em","64em"],Mh=(e={})=>{const{defaultIndex:t=0}=e;if("number"!=typeof t)throw new TypeError(`Default breakpoint index should be a number. Got: ${t}, ${typeof t}`);if(t<0||t>Rh.length-1)throw new RangeError(`Default breakpoint index out of range. Theme has ${Rh.length} breakpoints, got index ${t}`);const[n,r]=(0,Uo.useState)(t);return(0,Uo.useEffect)((()=>{const e=()=>{const e=Rh.filter((e=>"undefined"!=typeof window&&window.matchMedia(`screen and (min-width: ${e})`).matches)).length;n!==e&&r(e)};return e(),"undefined"!=typeof window&&window.addEventListener("resize",e),()=>{"undefined"!=typeof window&&window.removeEventListener("resize",e)}}),[n]),n};function Nh(e,t={}){const n=Mh(t);if(!Array.isArray(e)&&"function"!=typeof e)return e;const r=e||[];return r[n>=r.length?r.length-1:n]}const Dh="4px";function Ah(e){if(void 0===e)return;if(!e)return"0";const t="number"==typeof e?e:Number(e);return"undefined"!=typeof window&&window.CSS?.supports?.("margin",e.toString())||Number.isNaN(t)?e.toString():`calc(${Dh} * ${e})`}const Oh={name:"zjik7",styles:"display:flex"},zh={name:"qgaee5",styles:"display:block;max-height:100%;max-width:100%;min-height:0;min-width:0"},Lh={name:"82a6rk",styles:"flex:1"},Fh={name:"13nosa1",styles:">*{min-height:0;}"},Bh={name:"1pwxzk4",styles:">*{min-width:0;}"};function jh(e){const{align:t,className:n,direction:r="row",expanded:o=!0,gap:i=2,justify:a="space-between",wrap:s=!1,...l}=rs(function(e){const{isReversed:t,...n}=e;return void 0!==t?(qo()("Flex isReversed",{alternative:'Flex direction="row-reverse" or "column-reverse"',since:"5.9"}),{...n,direction:t?"row-reverse":"row"}):n}(e),"Flex"),c=Nh(Array.isArray(r)?r:[r]),u="string"==typeof c&&!!c.includes("column"),d=ns();return{...l,className:(0,Uo.useMemo)((()=>{const e=Ps({alignItems:null!=t?t:u?"normal":"center",flexDirection:c,flexWrap:s?"wrap":void 0,gap:Ah(i),justifyContent:a,height:u&&o?"100%":void 0,width:!u&&o?"100%":void 0},"","");return d(Oh,e,u?Fh:Bh,n)}),[t,n,d,c,o,i,u,a,s]),isColumn:u}}const Vh=(0,Uo.createContext)({flexItemDisplay:void 0}),Hh=()=>(0,Uo.useContext)(Vh);const $h=os((function(e,t){const{children:n,isColumn:o,...i}=jh(e);return(0,r.createElement)(Vh.Provider,{value:{flexItemDisplay:o?"block":void 0}},(0,r.createElement)(xs,{...i,ref:t},n))}),"Flex");function Wh(e){const{className:t,display:n,isBlock:r=!1,...o}=rs(e,"FlexItem"),i={},a=Hh().flexItemDisplay;i.Base=Ps({display:n||a},"","");return{...o,className:ns()(zh,i.Base,r&&Lh,t)}}const Uh=os((function(e,t){const n=function(e){return Wh({isBlock:!0,...rs(e,"FlexBlock")})}(e);return(0,r.createElement)(xs,{...n,ref:t})}),"FlexBlock"),Gh=new RegExp(/-left/g),qh=new RegExp(/-right/g),Yh=new RegExp(/Left/g),Kh=new RegExp(/Right/g);function Xh(e){return"left"===e?"right":"right"===e?"left":Gh.test(e)?e.replace(Gh,"-right"):qh.test(e)?e.replace(qh,"-left"):Yh.test(e)?e.replace(Yh,"Right"):Kh.test(e)?e.replace(Kh,"Left"):e}const Zh=(e={})=>Object.fromEntries(Object.entries(e).map((([e,t])=>[Xh(e),t])));function Jh(e={},t){return()=>t?(0,u.isRTL)()?Ps(t,""):Ps(e,""):(0,u.isRTL)()?Ps(Zh(e),""):Ps(e,"")}Jh.watch=()=>(0,u.isRTL)();const Qh=e=>null!=e;const eg=os((function(e,t){const n=function(e){const{className:t,margin:n,marginBottom:r=2,marginLeft:o,marginRight:i,marginTop:a,marginX:s,marginY:l,padding:c,paddingBottom:u,paddingLeft:d,paddingRight:f,paddingTop:m,paddingX:p,paddingY:h,...g}=rs(e,"Spacer");return{...g,className:ns()(Qh(n)&&Ps("margin:",Ah(n),";",""),Qh(l)&&Ps("margin-bottom:",Ah(l),";margin-top:",Ah(l),";",""),Qh(s)&&Ps("margin-left:",Ah(s),";margin-right:",Ah(s),";",""),Qh(a)&&Ps("margin-top:",Ah(a),";",""),Qh(r)&&Ps("margin-bottom:",Ah(r),";",""),Qh(o)&&Jh({marginLeft:Ah(o)})(),Qh(i)&&Jh({marginRight:Ah(i)})(),Qh(c)&&Ps("padding:",Ah(c),";",""),Qh(h)&&Ps("padding-bottom:",Ah(h),";padding-top:",Ah(h),";",""),Qh(p)&&Ps("padding-left:",Ah(p),";padding-right:",Ah(p),";",""),Qh(m)&&Ps("padding-top:",Ah(m),";",""),Qh(u)&&Ps("padding-bottom:",Ah(u),";",""),Qh(d)&&Jh({paddingLeft:Ah(d)})(),Qh(f)&&Jh({paddingRight:Ah(f)})(),t)}}(e);return(0,r.createElement)(xs,{...n,ref:t})}),"Spacer"),tg=eg,ng=(0,r.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(n.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})),rg=(0,r.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(n.Path,{d:"M7 11.5h10V13H7z"}));const og=os((function(e,t){const n=Wh(e);return(0,r.createElement)(xs,{...n,ref:t})}),"FlexItem");const ig={name:"hdknak",styles:"display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"};function ag(e){return null!=e}const sg=e=>"string"==typeof e?(e=>parseFloat(e))(e):e,lg="…",cg={auto:"auto",head:"head",middle:"middle",tail:"tail",none:"none"},ug={ellipsis:lg,ellipsizeMode:cg.auto,limit:0,numberOfLines:0};function dg(e="",t){const n={...ug,...t},{ellipsis:r,ellipsizeMode:o,limit:i}=n;if(o===cg.none)return e;let a,s;switch(o){case cg.head:a=0,s=i;break;case cg.middle:a=Math.floor(i/2),s=Math.floor(i/2);break;default:a=i,s=0}const l=o!==cg.auto?function(e,t,n,r){if("string"!=typeof e)return"";const o=e.length,i=~~t,a=~~n,s=ag(r)?r:lg;return 0===i&&0===a||i>=o||a>=o||i+a>=o?e:0===a?e.slice(0,i)+s:e.slice(0,i)+s+e.slice(o-a)}(e,a,s,r):e;return l}function fg(e){const{className:t,children:n,ellipsis:r=lg,ellipsizeMode:o=cg.auto,limit:i=0,numberOfLines:a=0,...s}=rs(e,"Truncate"),l=ns();let c;"string"==typeof n?c=n:"number"==typeof n&&(c=n.toString());const u=c?dg(c,{ellipsis:r,ellipsizeMode:o,limit:i,numberOfLines:a}):n,d=!!c&&o===cg.auto;return{...s,className:(0,Uo.useMemo)((()=>l(d&&!a&&ig,d&&!!a&&Ps("-webkit-box-orient:vertical;-webkit-line-clamp:",a,";display:-webkit-box;overflow:hidden;",""),t)),[t,l,a,d]),children:u}}var mg={grad:.9,turn:360,rad:360/(2*Math.PI)},pg=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},hg=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},gg=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e>t?e:t},vg=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},bg=function(e){return{r:gg(e.r,0,255),g:gg(e.g,0,255),b:gg(e.b,0,255),a:gg(e.a)}},yg=function(e){return{r:hg(e.r),g:hg(e.g),b:hg(e.b),a:hg(e.a,3)}},xg=/^#([0-9a-f]{3,8})$/i,wg=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Eg=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,i=Math.max(t,n,r),a=i-Math.min(t,n,r),s=a?i===t?(n-r)/a:i===n?2+(r-t)/a:4+(t-n)/a:0;return{h:60*(s<0?s+6:s),s:i?a/i*100:0,v:i/255*100,a:o}},_g=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var i=Math.floor(t),a=r*(1-n),s=r*(1-(t-i)*n),l=r*(1-(1-t+i)*n),c=i%6;return{r:255*[r,s,a,a,l,r][c],g:255*[l,r,r,s,a,a][c],b:255*[a,a,l,r,r,s][c],a:o}},Sg=function(e){return{h:vg(e.h),s:gg(e.s,0,100),l:gg(e.l,0,100),a:gg(e.a)}},Cg=function(e){return{h:hg(e.h),s:hg(e.s),l:hg(e.l),a:hg(e.a,3)}},kg=function(e){return _g((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},Pg=function(e){return{h:(t=Eg(e)).h,s:(o=(200-(n=t.s))*(r=t.v)/100)>0&&o<200?n*r/100/(o<=100?o:200-o)*100:0,l:o/2,a:t.a};var t,n,r,o},Tg=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ig=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Rg=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Mg=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ng={string:[[function(e){var t=xg.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?hg(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?hg(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=Rg.exec(e)||Mg.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:bg({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(e){var t=Tg.exec(e)||Ig.exec(e);if(!t)return null;var n,r,o=Sg({h:(n=t[1],r=t[2],void 0===r&&(r="deg"),Number(n)*(mg[r]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return kg(o)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,r=e.b,o=e.a,i=void 0===o?1:o;return pg(t)&&pg(n)&&pg(r)?bg({r:Number(t),g:Number(n),b:Number(r),a:Number(i)}):null},"rgb"],[function(e){var t=e.h,n=e.s,r=e.l,o=e.a,i=void 0===o?1:o;if(!pg(t)||!pg(n)||!pg(r))return null;var a=Sg({h:Number(t),s:Number(n),l:Number(r),a:Number(i)});return kg(a)},"hsl"],[function(e){var t=e.h,n=e.s,r=e.v,o=e.a,i=void 0===o?1:o;if(!pg(t)||!pg(n)||!pg(r))return null;var a=function(e){return{h:vg(e.h),s:gg(e.s,0,100),v:gg(e.v,0,100),a:gg(e.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(i)});return _g(a)},"hsv"]]},Dg=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},Ag=function(e){return"string"==typeof e?Dg(e.trim(),Ng.string):"object"==typeof e&&null!==e?Dg(e,Ng.object):[null,void 0]},Og=function(e,t){var n=Pg(e);return{h:n.h,s:gg(n.s+100*t,0,100),l:n.l,a:n.a}},zg=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Lg=function(e,t){var n=Pg(e);return{h:n.h,s:n.s,l:gg(n.l+100*t,0,100),a:n.a}},Fg=function(){function e(e){this.parsed=Ag(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return null!==this.parsed},e.prototype.brightness=function(){return hg(zg(this.rgba),2)},e.prototype.isDark=function(){return zg(this.rgba)<.5},e.prototype.isLight=function(){return zg(this.rgba)>=.5},e.prototype.toHex=function(){return t=(e=yg(this.rgba)).r,n=e.g,r=e.b,i=(o=e.a)<1?wg(hg(255*o)):"","#"+wg(t)+wg(n)+wg(r)+i;var e,t,n,r,o,i},e.prototype.toRgb=function(){return yg(this.rgba)},e.prototype.toRgbString=function(){return t=(e=yg(this.rgba)).r,n=e.g,r=e.b,(o=e.a)<1?"rgba("+t+", "+n+", "+r+", "+o+")":"rgb("+t+", "+n+", "+r+")";var e,t,n,r,o},e.prototype.toHsl=function(){return Cg(Pg(this.rgba))},e.prototype.toHslString=function(){return t=(e=Cg(Pg(this.rgba))).h,n=e.s,r=e.l,(o=e.a)<1?"hsla("+t+", "+n+"%, "+r+"%, "+o+")":"hsl("+t+", "+n+"%, "+r+"%)";var e,t,n,r,o},e.prototype.toHsv=function(){return e=Eg(this.rgba),{h:hg(e.h),s:hg(e.s),v:hg(e.v),a:hg(e.a,3)};var e},e.prototype.invert=function(){return Bg({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),Bg(Og(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Bg(Og(this.rgba,-e))},e.prototype.grayscale=function(){return Bg(Og(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Bg(Lg(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Bg(Lg(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?Bg({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):hg(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=Pg(this.rgba);return"number"==typeof e?Bg({h:e,s:t.s,l:t.l,a:t.a}):hg(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Bg(e).toHex()},e}(),Bg=function(e){return e instanceof Fg?e:new Fg(e)},jg=[],Vg=function(e){e.forEach((function(e){jg.indexOf(e)<0&&(e(Fg,Ng),jg.push(e))}))};function Hg(e,t){var n={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 o in n)r[n[o]]=o;var i={};e.prototype.toName=function(t){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,a,s=r[this.toHex()];if(s)return s;if(null==t?void 0:t.closest){var l=this.toRgb(),c=1/0,u="black";if(!i.length)for(var d in n)i[d]=new e(n[d]).toRgb();for(var f in n){var m=(o=l,a=i[f],Math.pow(o.r-a.r,2)+Math.pow(o.g-a.g,2)+Math.pow(o.b-a.b,2));m<c&&(c=m,u=f)}return u}},t.string.push([function(t){var r=t.toLowerCase(),o="transparent"===r?"#0000":n[r];return o?new e(o).toRgb():null},"name"])}let $g;Vg([Hg]);const Wg=Si((function(e){if("string"!=typeof e)return"";if("string"==typeof(t=e)&&Bg(t).isValid())return e;var t;if(!e.includes("var("))return"";if("undefined"==typeof document)return"";const n=function(){if("undefined"!=typeof document){if(!$g){const e=document.createElement("div");e.setAttribute("data-g2-color-computation-node",""),document.body.appendChild(e),$g=e}return $g}}();if(!n)return"";n.style.background=e;const r=window?.getComputedStyle(n).background;return n.style.background="",r||""}));function Ug(e){const t=function(e){const t=Wg(e);return Bg(t).isLight()?"#000000":"#ffffff"}(e);return"#000000"===t?"dark":"light"}const Gg="36px",qg="12px",Yg={controlSurfaceColor:Ds.white,controlTextActiveColor:Ds.theme.accent,controlPaddingX:qg,controlPaddingXLarge:`calc(${qg} * 1.3334)`,controlPaddingXSmall:`calc(${qg} / 1.3334)`,controlBackgroundColor:Ds.white,controlBorderRadius:"2px",controlBoxShadow:"transparent",controlBoxShadowFocus:`0 0 0 0.5px ${Ds.theme.accent}`,controlDestructiveBorderColor:Ds.alert.red,controlHeight:Gg,controlHeightXSmall:`calc( ${Gg} * 0.6 )`,controlHeightSmall:`calc( ${Gg} * 0.8 )`,controlHeightLarge:`calc( ${Gg} * 1.2 )`,controlHeightXLarge:`calc( ${Gg} * 1.4 )`},Kg={toggleGroupControlBackgroundColor:Yg.controlBackgroundColor,toggleGroupControlBorderColor:Ds.ui.border,toggleGroupControlBackdropBackgroundColor:Yg.controlSurfaceColor,toggleGroupControlBackdropBorderColor:Ds.ui.border,toggleGroupControlButtonColorActive:Yg.controlBackgroundColor},Xg=Object.assign({},Yg,Kg,{colorDivider:"rgba(0, 0, 0, 0.1)",colorScrollbarThumb:"rgba(0, 0, 0, 0.2)",colorScrollbarThumbHover:"rgba(0, 0, 0, 0.5)",colorScrollbarTrack:"rgba(0, 0, 0, 0.04)",elevationIntensity:1,radiusBlockUi:"2px",borderWidth:"1px",borderWidthFocus:"1.5px",borderWidthTab:"4px",spinnerSize:16,fontSize:"13px",fontSizeH1:"calc(2.44 * 13px)",fontSizeH2:"calc(1.95 * 13px)",fontSizeH3:"calc(1.56 * 13px)",fontSizeH4:"calc(1.25 * 13px)",fontSizeH5:"13px",fontSizeH6:"calc(0.8 * 13px)",fontSizeInputMobile:"16px",fontSizeMobile:"15px",fontSizeSmall:"calc(0.92 * 13px)",fontSizeXSmall:"calc(0.75 * 13px)",fontLineHeightBase:"1.2",fontWeight:"normal",fontWeightHeading:"600",gridBase:"4px",cardBorderRadius:"2px",cardPaddingXSmall:`${Ah(2)}`,cardPaddingSmall:`${Ah(4)}`,cardPaddingMedium:`${Ah(4)} ${Ah(6)}`,cardPaddingLarge:`${Ah(6)} ${Ah(8)}`,popoverShadow:"0 0.7px 1px rgba(0, 0, 0, 0.1), 0 1.2px 1.7px -0.2px rgba(0, 0, 0, 0.1), 0 2.3px 3.3px -0.5px rgba(0, 0, 0, 0.1)",surfaceBackgroundColor:Ds.white,surfaceBackgroundSubtleColor:"#F3F3F3",surfaceBackgroundTintColor:"#F5F5F5",surfaceBorderColor:"rgba(0, 0, 0, 0.1)",surfaceBorderBoldColor:"rgba(0, 0, 0, 0.15)",surfaceBorderSubtleColor:"rgba(0, 0, 0, 0.05)",surfaceBackgroundTertiaryColor:Ds.white,surfaceColor:Ds.white,transitionDuration:"200ms",transitionDurationFast:"160ms",transitionDurationFaster:"120ms",transitionDurationFastest:"100ms",transitionTimingFunction:"cubic-bezier(0.08, 0.52, 0.52, 1)",transitionTimingFunctionControl:"cubic-bezier(0.12, 0.8, 0.32, 1)"});const Zg=Ps("color:",Ds.gray[900],";line-height:",Xg.fontLineHeightBase,";margin:0;",""),Jg={name:"4zleql",styles:"display:block"},Qg=Ps("color:",Ds.alert.green,";",""),ev=Ps("color:",Ds.alert.red,";",""),tv=Ps("color:",Ds.gray[700],";",""),nv=Ps("mark{background:",Ds.alert.yellow,";border-radius:2px;box-shadow:0 0 0 1px rgba( 0, 0, 0, 0.05 ) inset,0 -1px 0 rgba( 0, 0, 0, 0.1 ) inset;}",""),rv={name:"50zrmy",styles:"text-transform:uppercase"};var ov=o(9664);const iv=Si((e=>{const t={};for(const n in e)t[n.toLowerCase()]=e[n];return t}));const av=13,sv={body:av,caption:10,footnote:11,largeTitle:28,subheadline:12,title:20},lv=[1,2,3,4,5,6].flatMap((e=>[e,e.toString()]));function cv(e=av){if(e in sv)return cv(sv[e]);if("number"!=typeof e){const t=parseFloat(e);if(Number.isNaN(t))return e;e=t}return`calc(${`(${e} / ${av})`} * ${Xg.fontSize})`}function uv(e=3){if(!lv.includes(e))return cv(e);return Xg[`fontSizeH${e}`]}var dv={name:"50zrmy",styles:"text-transform:uppercase"};function fv(t){const{adjustLineHeightForInnerControls:n,align:r,children:o,className:i,color:a,ellipsizeMode:s,isDestructive:l=!1,display:c,highlightEscape:u=!1,highlightCaseSensitive:d=!1,highlightWords:f,highlightSanitize:m,isBlock:p=!1,letterSpacing:h,lineHeight:g,optimizeReadabilityFor:v,size:b,truncate:y=!1,upperCase:x=!1,variant:w,weight:E=Xg.fontWeight,..._}=rs(t,"Text");let S=o;const C=Array.isArray(f),k="caption"===b;if(C){if("string"!=typeof o)throw new TypeError("`children` of `Text` must only be `string` types when `highlightWords` is defined");S=function({activeClassName:e="",activeIndex:t=-1,activeStyle:n,autoEscape:r,caseSensitive:o=!1,children:i,findChunks:a,highlightClassName:s="",highlightStyle:l={},highlightTag:c="mark",sanitize:u,searchWords:d=[],unhighlightClassName:f="",unhighlightStyle:m}){if(!i)return null;if("string"!=typeof i)return i;const p=i,h=(0,ov.findAll)({autoEscape:r,caseSensitive:o,findChunks:a,sanitize:u,searchWords:d,textToHighlight:p}),g=c;let v,b=-1,y="";const x=h.map(((r,i)=>{const a=p.substr(r.start,r.end-r.start);if(r.highlight){let r;b++,r="object"==typeof s?o?s[a]:(s=iv(s))[a.toLowerCase()]:s;const c=b===+t;y=`${r} ${c?e:""}`,v=!0===c&&null!==n?Object.assign({},l,n):l;const u={children:a,className:y,key:i,style:v};return"string"!=typeof g&&(u.highlightIndex=b),(0,Uo.createElement)(g,u)}return(0,Uo.createElement)("span",{children:a,className:f,key:i,style:m})}));return x}({autoEscape:u,children:o,caseSensitive:d,searchWords:f,sanitize:m})}const P=ns();let T;!0===y&&(T="auto"),!1===y&&(T="none");const I=fg({..._,className:(0,Uo.useMemo)((()=>{const t={},o=function(e,t){if(t)return t;if(!e)return;let n=`calc(${Xg.controlHeight} + ${Ah(2)})`;switch(e){case"large":n=`calc(${Xg.controlHeightLarge} + ${Ah(2)})`;break;case"small":n=`calc(${Xg.controlHeightSmall} + ${Ah(2)})`;break;case"xSmall":n=`calc(${Xg.controlHeightXSmall} + ${Ah(2)})`}return n}(n,g);if(t.Base=Ps({color:a,display:c,fontSize:cv(b),fontWeight:E,lineHeight:o,letterSpacing:h,textAlign:r},"",""),t.upperCase=dv,t.optimalTextColor=null,v){const e="dark"===Ug(v);t.optimalTextColor=Ps(e?{color:Ds.gray[900]}:{color:Ds.white},"","")}return P(Zg,t.Base,t.optimalTextColor,l&&ev,!!C&&nv,p&&Jg,k&&tv,w&&e[w],x&&t.upperCase,i)}),[n,r,i,a,P,c,p,k,l,C,h,g,v,b,x,w,E]),children:o,ellipsizeMode:s||T});return!y&&Array.isArray(o)&&(S=Uo.Children.map(o,(e=>{if("object"!=typeof e||null===e||!("props"in e))return e;return ls(e,["Link"])?(0,Uo.cloneElement)(e,{size:e.props.size||"inherit"}):e}))),{...I,children:y?I.children:S}}const mv=os((function(e,t){const n=fv(e);return(0,r.createElement)(xs,{as:"span",...n,ref:t})}),"Text");const pv={name:"9amh4a",styles:"font-size:11px;font-weight:500;line-height:1.4;text-transform:uppercase"};var hv={name:"1739oy8",styles:"z-index:1"};const gv=({isFocused:e})=>e?hv:"",vv=bs($h,{target:"em5sgkm7"})("box-sizing:border-box;position:relative;border-radius:2px;padding-top:0;",gv,";");var bv={name:"1d3w5wq",styles:"width:100%"};const yv=bs("div",{target:"em5sgkm6"})("align-items:center;box-sizing:border-box;border-radius:inherit;display:flex;flex:1;position:relative;",(({disabled:e})=>Ps({backgroundColor:e?Ds.ui.backgroundDisabled:Ds.ui.background},"",""))," ",(({__unstableInputWidth:e,labelPosition:t})=>e?"side"===t?"":Ps("edge"===t?{flex:`0 0 ${e}`}:{width:e},"",""):bv),";"),xv=({inputSize:e})=>{const t={default:"13px",small:"11px",compact:"13px","__unstable-large":"13px"},n=t[e]||t.default;return n?Ps("font-size:","16px",";@media ( min-width: 600px ){font-size:",n,";}",""):""},wv=({inputSize:e,__next40pxDefaultSize:t})=>{const n={default:{height:40,lineHeight:1,minHeight:40,paddingLeft:Ah(4),paddingRight:Ah(4)},small:{height:24,lineHeight:1,minHeight:24,paddingLeft:Ah(2),paddingRight:Ah(2)},compact:{height:32,lineHeight:1,minHeight:32,paddingLeft:Ah(2),paddingRight:Ah(2)},"__unstable-large":{height:40,lineHeight:1,minHeight:40,paddingLeft:Ah(4),paddingRight:Ah(4)}};return t||(n.default=n.compact),n[e]||n.default},Ev=bs("input",{target:"em5sgkm5"})("&&&{background-color:transparent;box-sizing:border-box;border:none;box-shadow:none!important;color:",Ds.theme.foreground,";display:block;font-family:inherit;margin:0;outline:none;width:100%;",(({isDragging:e,dragCursor:t})=>{let n,r;return e&&(n=Ps("cursor:",t,";user-select:none;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none!important;margin:0!important;}","")),e&&t&&(r=Ps("&:active{cursor:",t,";}","")),Ps(n," ",r,";","")})," ",(({disabled:e})=>e?Ps({color:Ds.ui.textDisabled},"",""):"")," ",xv," ",(e=>Ps(wv(e),"",""))," ",(({paddingInlineStart:e,paddingInlineEnd:t})=>Ps({paddingInlineStart:e,paddingInlineEnd:t},"",""))," &::-webkit-input-placeholder{line-height:normal;}}"),_v=bs(mv,{target:"em5sgkm4"})("&&&{",pv,";box-sizing:border-box;display:block;padding-top:0;padding-bottom:0;max-width:100%;z-index:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}"),Sv=e=>(0,r.createElement)(_v,{...e,as:"label"}),Cv=bs(og,{target:"em5sgkm3"})({name:"1b6uupn",styles:"max-width:calc( 100% - 10px )"}),kv=bs("div",{target:"em5sgkm2"})("&&&{box-sizing:border-box;border-radius:inherit;bottom:0;left:0;margin:0;padding:0;pointer-events:none;position:absolute;right:0;top:0;",(({disabled:e,isBorderless:t,isFocused:n})=>{let r,o,i,a=t?"transparent":Ds.ui.border;return n&&(a=Ds.ui.borderFocus,r=Xg.controlBoxShadowFocus,o="2px solid transparent",i="-2px"),e&&(a=t?"transparent":Ds.ui.borderDisabled),Ps({boxShadow:r,borderColor:a,borderStyle:"solid",borderWidth:1,outline:o,outlineOffset:i},"","")})," ",Jh({paddingLeft:2}),";}"),Pv=bs("span",{target:"em5sgkm1"})({name:"pvvbxf",styles:"box-sizing:border-box;display:block"}),Tv=bs("span",{target:"em5sgkm0"})({name:"jgf79h",styles:"align-items:center;align-self:stretch;box-sizing:border-box;display:flex"});const Iv=(0,Uo.memo)((function({disabled:e=!1,isBorderless:t=!1,isFocused:n=!1}){return(0,r.createElement)(kv,{"aria-hidden":"true",className:"components-input-control__backdrop",disabled:e,isBorderless:t,isFocused:n})})),Rv=Iv;function Mv({children:e,hideLabelFromVision:t,htmlFor:n,...o}){return e?t?(0,r.createElement)(ws,{as:"label",htmlFor:n},e):(0,r.createElement)(Cv,null,(0,r.createElement)(Sv,{htmlFor:n,...o},e)):null}function Nv(e){const{__next36pxDefaultSize:t,__next40pxDefaultSize:n,...r}=e;return{...r,__next40pxDefaultSize:null!=n?n:t}}function Dv(e){const t={};switch(e){case"top":t.direction="column",t.expanded=!1,t.gap=0;break;case"bottom":t.direction="column-reverse",t.expanded=!1,t.gap=0;break;case"edge":t.justify="space-between"}return t}function Av(e,t){const{__next40pxDefaultSize:n,__unstableInputWidth:o,children:i,className:a,disabled:s=!1,hideLabelFromVision:l=!1,labelPosition:c,id:u,isBorderless:f=!1,isFocused:m=!1,label:p,prefix:h,size:g="default",suffix:v,...b}=Nv(rs(e,"InputBase")),y=function(e){const t=(0,d.useInstanceId)(Av);return e||`input-base-control-${t}`}(u),x=l||!p,{paddingLeft:w,paddingRight:E}=wv({inputSize:g,__next40pxDefaultSize:n}),_=(0,Uo.useMemo)((()=>({InputControlPrefixWrapper:{paddingLeft:w},InputControlSuffixWrapper:{paddingRight:E}})),[w,E]);return(0,r.createElement)(vv,{...b,...Dv(c),className:a,gap:2,isFocused:m,labelPosition:c,ref:t},(0,r.createElement)(Mv,{className:"components-input-control__label",hideLabelFromVision:l,labelPosition:c,htmlFor:y},p),(0,r.createElement)(yv,{__unstableInputWidth:o,className:"components-input-control__container",disabled:s,hideLabel:x,labelPosition:c},(0,r.createElement)(mi,{value:_},h&&(0,r.createElement)(Pv,{className:"components-input-control__prefix"},h),i,v&&(0,r.createElement)(Tv,{className:"components-input-control__suffix"},v)),(0,r.createElement)(Rv,{disabled:s,isBorderless:f,isFocused:m})))}const Ov=os(Av,"InputBase");const zv={toVector:(e,t)=>(void 0===e&&(e=t),Array.isArray(e)?e:[e,e]),add:(e,t)=>[e[0]+t[0],e[1]+t[1]],sub:(e,t)=>[e[0]-t[0],e[1]-t[1]],addTo(e,t){e[0]+=t[0],e[1]+=t[1]},subTo(e,t){e[0]-=t[0],e[1]-=t[1]}};function Lv(e,t,n){return 0===t||Math.abs(t)===1/0?Math.pow(e,5*n):e*t*n/(t+n*e)}function Fv(e,t,n,r=.15){return 0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-Lv(t-e,n-t,r)+t:e>n?+Lv(e-n,n-t,r)+n:e}function Bv(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function jv(e,t,n){return(t=Bv(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vv(Object(n),!0).forEach((function(t){jv(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vv(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}const $v={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function Wv(e){return e?e[0].toUpperCase()+e.slice(1):""}const Uv=["enter","leave"];function Gv(e,t="",n=!1){const r=$v[e],o=r&&r[t]||t;return"on"+Wv(e)+Wv(o)+(function(e=!1,t){return e&&!Uv.includes(t)}(n,o)?"Capture":"")}const qv=["gotpointercapture","lostpointercapture"];function Yv(e){let t=e.substring(2).toLowerCase();const n=!!~t.indexOf("passive");n&&(t=t.replace("passive",""));const r=qv.includes(t)?"capturecapture":"capture",o=!!~t.indexOf(r);return o&&(t=t.replace("capture","")),{device:t,capture:o,passive:n}}function Kv(e){return"touches"in e}function Xv(e){return Kv(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function Zv(e){return Kv(e)?function(e){return"touchend"===e.type||"touchcancel"===e.type?e.changedTouches:e.targetTouches}(e)[0]:e}function Jv(e){return function(e){return Array.from(e.touches).filter((t=>{var n,r;return t.target===e.currentTarget||(null===(n=e.currentTarget)||void 0===n||null===(r=n.contains)||void 0===r?void 0:r.call(n,t.target))}))}(e).map((e=>e.identifier))}function Qv(e){const t=Zv(e);return Kv(e)?t.identifier:t.pointerId}function eb(e){const t=Zv(e);return[t.clientX,t.clientY]}function tb(e,...t){return"function"==typeof e?e(...t):e}function nb(){}function rb(...e){return 0===e.length?nb:1===e.length?e[0]:function(){let t;for(const n of e)t=n.apply(this,arguments)||t;return t}}function ob(e,t){return Object.assign({},t,e||{})}class ib{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:n,args:r}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=r,e.axis=void 0,e.memo=void 0,e.elapsedTime=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?tb(n.from,t):t.offset,t.offset=t.lastOffset),t.startTime=t.timeStamp=e.timeStamp}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:n,shared:r}=this;t.args=this.args;let o=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,r.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,r.locked=!!document.pointerLockElement,Object.assign(r,function(e){const t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){const{shiftKey:n,altKey:r,metaKey:o,ctrlKey:i}=e;Object.assign(t,{shiftKey:n,altKey:r,metaKey:o,ctrlKey:i})}return t}(e)),r.down=r.pressed=r.buttons%2==1||r.touches>0,o=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const e=t._delta.map(Math.abs);zv.addTo(t._distance,e)}this.axisIntent&&this.axisIntent(e);const[i,a]=t._movement,[s,l]=n.threshold,{_step:c,values:u}=t;if(n.hasCustomTransform?(!1===c[0]&&(c[0]=Math.abs(i)>=s&&u[0]),!1===c[1]&&(c[1]=Math.abs(a)>=l&&u[1])):(!1===c[0]&&(c[0]=Math.abs(i)>=s&&Math.sign(i)*s),!1===c[1]&&(c[1]=Math.abs(a)>=l&&Math.sign(a)*l)),t.intentional=!1!==c[0]||!1!==c[1],!t.intentional)return;const d=[0,0];if(n.hasCustomTransform){const[e,t]=u;d[0]=!1!==c[0]?e-c[0]:0,d[1]=!1!==c[1]?t-c[1]:0}else d[0]=!1!==c[0]?i-c[0]:0,d[1]=!1!==c[1]?a-c[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(d);const f=t.offset,m=t._active&&!t._blocked||t.active;m&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=r[this.ingKey]=t._active,e&&(t.first&&("bounds"in n&&(t._bounds=tb(n.bounds,t)),this.setup&&this.setup()),t.movement=d,this.computeOffset()));const[p,h]=t.offset,[[g,v],[b,y]]=t._bounds;t.overflow=[p<g?-1:p>v?1:0,h<b?-1:h>y?1:0],t._movementBound[0]=!!t.overflow[0]&&(!1===t._movementBound[0]?t._movement[0]:t._movementBound[0]),t._movementBound[1]=!!t.overflow[1]&&(!1===t._movementBound[1]?t._movement[1]:t._movementBound[1]);const x=t._active&&n.rubberband||[0,0];if(t.offset=function(e,[t,n],[r,o]){const[[i,a],[s,l]]=e;return[Fv(t,i,a,r),Fv(n,s,l,o)]}(t._bounds,t.offset,x),t.delta=zv.sub(t.offset,f),this.computeMovement(),m&&(!t.last||o>32)){t.delta=zv.sub(t.offset,f);const e=t.delta.map(Math.abs);zv.addTo(t.distance,e),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&o>0&&(t.velocity=[e[0]/o,e[1]/o])}}emit(){const e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const r=this.handler(Hv(Hv(Hv({},t),e),{},{[this.aliasKey]:e.values}));void 0!==r&&(e.memo=r)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}class ab extends ib{constructor(...e){super(...e),jv(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=zv.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=zv.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,n=this.config;if(!t.axis&&e){const r="object"==typeof n.axisThreshold?n.axisThreshold[Xv(e)]:n.axisThreshold;t.axis=function([e,t],n){const r=Math.abs(e),o=Math.abs(t);return r>o&&r>n?"x":o>r&&o>n?"y":void 0}(t._movement,r)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0}}}const sb=e=>e,lb={enabled:(e=!0)=>e,eventOptions:(e,t,n)=>Hv(Hv({},n.shared.eventOptions),e),preventDefault:(e=!1)=>e,triggerAllEvents:(e=!1)=>e,rubberband(e=0){switch(e){case!0:return[.15,.15];case!1:return[0,0];default:return zv.toVector(e)}},from:e=>"function"==typeof e?e:null!=e?zv.toVector(e):void 0,transform(e,t,n){const r=e||n.shared.transform;return this.hasCustomTransform=!!r,r||sb},threshold:e=>zv.toVector(e,0)};const cb=Hv(Hv({},lb),{},{axis(e,t,{axis:n}){if(this.lockDirection="lock"===n,!this.lockDirection)return n},axisThreshold:(e=0)=>e,bounds(e={}){if("function"==typeof e)return t=>cb.bounds(e(t));if("current"in e)return()=>e.current;if("function"==typeof HTMLElement&&e instanceof HTMLElement)return e;const{left:t=-1/0,right:n=1/0,top:r=-1/0,bottom:o=1/0}=e;return[[t,n],[r,o]]}}),ub={ArrowRight:(e,t=1)=>[e*t,0],ArrowLeft:(e,t=1)=>[-1*e*t,0],ArrowUp:(e,t=1)=>[0,-1*e*t],ArrowDown:(e,t=1)=>[0,e*t]};const db="undefined"!=typeof window&&window.document&&window.document.createElement;function fb(){return db&&"ontouchstart"in window||db&&window.navigator.maxTouchPoints>1}const mb={isBrowser:db,gesture:function(){try{return"constructor"in GestureEvent}catch(e){return!1}}(),touch:fb(),touchscreen:fb(),pointer:db&&"onpointerdown"in window,pointerLock:db&&"exitPointerLock"in window.document},pb={mouse:0,touch:0,pen:8},hb=Hv(Hv({},cb),{},{device(e,t,{pointer:{touch:n=!1,lock:r=!1,mouse:o=!1}={}}){return this.pointerLock=r&&mb.pointerLock,mb.touch&&n?"touch":this.pointerLock?"mouse":mb.pointer&&!o?"pointer":mb.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:n}){if(this.preventScrollDelay="number"==typeof n?n:n||void 0===n&&e?250:void 0,mb.touchscreen&&!1!==n)return e||(void 0!==n?"y":void 0)},pointerCapture(e,t,{pointer:{capture:n=!0,buttons:r=1,keys:o=!0}={}}){return this.pointerButtons=r,this.keys=o,!this.pointerLock&&"pointer"===this.device&&n},threshold(e,t,{filterTaps:n=!1,tapsThreshold:r=3,axis:o}){const i=zv.toVector(e,n?r:o?1:0);return this.filterTaps=n,this.tapsThreshold=r,i},swipe({velocity:e=.5,distance:t=50,duration:n=250}={}){return{velocity:this.transform(zv.toVector(e)),distance:this.transform(zv.toVector(t)),duration:n}},delay(e=0){switch(e){case!0:return 180;case!1:return 0;default:return e}},axisThreshold:e=>e?Hv(Hv({},pb),e):pb,keyboardDisplacement:(e=10)=>e});Hv(Hv({},lb),{},{device(e,t,{shared:n,pointer:{touch:r=!1}={}}){if(n.target&&!mb.touch&&mb.gesture)return"gesture";if(mb.touch&&r)return"touch";if(mb.touchscreen){if(mb.pointer)return"pointer";if(mb.touch)return"touch"}},bounds(e,t,{scaleBounds:n={},angleBounds:r={}}){const o=e=>{const t=ob(tb(n,e),{min:-1/0,max:1/0});return[t.min,t.max]},i=e=>{const t=ob(tb(r,e),{min:-1/0,max:1/0});return[t.min,t.max]};return"function"!=typeof n&&"function"!=typeof r?[o(),i()]:e=>[o(e),i(e)]},threshold(e,t,n){this.lockDirection="lock"===n.axis;return zv.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey:e=>void 0===e?"ctrlKey":e,pinchOnWheel:(e=!0)=>e});Hv(Hv({},cb),{},{mouseOnly:(e=!0)=>e});Hv(Hv({},cb),{},{mouseOnly:(e=!0)=>e});const gb=new Map,vb=new Map;const bb={key:"drag",engine:class extends ab{constructor(...e){super(...e),jv(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),r={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=cb.bounds(r)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout((()=>{this.compute(),this.emit()}),0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,n=this.state;if(null!=e.buttons&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):-1!==t.pointerButtons&&t.pointerButtons!==e.buttons))return;const r=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),r&&r.size>1&&n._pointerActive||(this.start(e),this.setupPointer(e),n._pointerId=Qv(e),n._pointerActive=!0,this.computeValues(eb(e)),this.computeInitial(),t.preventScrollAxis&&"mouse"!==Xv(e)?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,n=this.config;if(!t._pointerActive)return;if(t.type===e.type&&e.timeStamp===t.timeStamp)return;const r=Qv(e);if(void 0!==t._pointerId&&r!==t._pointerId)return;const o=eb(e);return document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=zv.sub(o,t._values),this.computeValues(o)),zv.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional?(this.timeoutStore.remove("dragDelay"),t.active=!1,void this.startPointerDrag(e)):n.preventScrollAxis&&!t._preventScroll?t.axis?t.axis===n.preventScrollAxis||"xy"===n.preventScrollAxis?(t._active=!1,void this.clean()):(this.timeoutStore.remove("startPointerDrag"),void this.startPointerDrag(e)):void 0:void this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch(e){0}const t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;const r=Qv(e);if(void 0!==t._pointerId&&r!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[o,i]=t._distance;if(t.tap=o<=n.tapsThreshold&&i<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{const[e,r]=t.direction,[o,i]=t.velocity,[a,s]=t.movement,[l,c]=n.swipe.velocity,[u,d]=n.swipe.distance,f=n.swipe.duration;t.elapsedTime<f&&(Math.abs(o)>l&&Math.abs(a)>u&&(t.swipe[0]=e),Math.abs(i)>c&&Math.abs(s)>d&&(t.swipe[1]=r))}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,n=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,function(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",(()=>{this.state._step=[0,0],this.startPointerDrag(e)}),this.config.delay)}keyDown(e){const t=ub[e.key];if(t){const n=this.state,r=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,r),n._keyboardActive=!0,zv.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in ub&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}},resolver:hb};function yb(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}const xb={target(e){if(e)return()=>"current"in e?e.current:e},enabled:(e=!0)=>e,window:(e=(mb.isBrowser?window:void 0))=>e,eventOptions:({passive:e=!0,capture:t=!1}={})=>({passive:e,capture:t}),transform:e=>e},wb=["target","eventOptions","window","enabled","transform"];function Eb(e={},t){const n={};for(const[r,o]of Object.entries(t))switch(typeof o){case"function":n[r]=o.call(n,e[r],r,e);break;case"object":n[r]=Eb(e[r],o);break;case"boolean":o&&(n[r]=e[r])}return n}class _b{constructor(e,t){jv(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,r,o){const i=this._listeners,a=function(e,t=""){const n=$v[e];return e+(n&&n[t]||t)}(t,n),s=Hv(Hv({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),o);e.addEventListener(a,r,s);const l=()=>{e.removeEventListener(a,r,s),i.delete(l)};return i.add(l),l}clean(){this._listeners.forEach((e=>e())),this._listeners.clear()}}class Sb{constructor(){jv(this,"_timeouts",new Map)}add(e,t,n=140,...r){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...r))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach((e=>{window.clearTimeout(e)})),this._timeouts.clear()}}class Cb{constructor(e){jv(this,"gestures",new Set),jv(this,"_targetEventStore",new _b(this)),jv(this,"gestureEventStores",{}),jv(this,"gestureTimeoutStores",{}),jv(this,"handlers",{}),jv(this,"config",{}),jv(this,"pointerIds",new Set),jv(this,"touchIds",new Set),jv(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),function(e,t){t.drag&&kb(e,"drag");t.wheel&&kb(e,"wheel");t.scroll&&kb(e,"scroll");t.move&&kb(e,"move");t.pinch&&kb(e,"pinch");t.hover&&kb(e,"hover")}(this,e)}setEventIds(e){return Kv(e)?(this.touchIds=new Set(Jv(e)),this.touchIds):"pointerId"in e?("pointerup"===e.type||"pointercancel"===e.type?this.pointerIds.delete(e.pointerId):"pointerdown"===e.type&&this.pointerIds.add(e.pointerId),this.pointerIds):void 0}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=function(e,t,n={}){const r=e,{target:o,eventOptions:i,window:a,enabled:s,transform:l}=r,c=yb(r,wb);if(n.shared=Eb({target:o,eventOptions:i,window:a,enabled:s,transform:l},xb),t){const e=vb.get(t);n[t]=Eb(Hv({shared:n.shared},c),e)}else for(const e in c){const t=vb.get(e);t&&(n[e]=Eb(Hv({shared:n.shared},c[e]),t))}return n}(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,n={};let r;if(!t.target||(r=t.target(),r)){if(t.enabled){for(const t of this.gestures){const o=this.config[t],i=Pb(n,o.eventOptions,!!r);if(o.enabled){new(gb.get(t))(this,e,t).bind(i)}}const o=Pb(n,t.eventOptions,!!r);for(const t in this.nativeHandlers)o(t,"",(n=>this.nativeHandlers[t](Hv(Hv({},this.state.shared),{},{event:n,args:e}))),void 0,!0)}for(const e in n)n[e]=rb(...n[e]);if(!r)return n;for(const e in n){const{device:t,capture:o,passive:i}=Yv(e);this._targetEventStore.add(r,t,"",n[e],{capture:o,passive:i})}}}}function kb(e,t){e.gestures.add(t),e.gestureEventStores[t]=new _b(e,t),e.gestureTimeoutStores[t]=new Sb}const Pb=(e,t,n)=>(r,o,i,a={},s=!1)=>{var l,c;const u=null!==(l=a.capture)&&void 0!==l?l:t.capture,d=null!==(c=a.passive)&&void 0!==c?c:t.passive;let f=s?r:Gv(r,o,u);n&&d&&(f+="Passive"),e[f]=e[f]||[],e[f].push(i)};function Tb(e,t={},n,r){const o=s().useMemo((()=>new Cb(e)),[]);if(o.applyHandlers(e,r),o.applyConfig(t,n),s().useEffect(o.effect.bind(o)),s().useEffect((()=>o.clean.bind(o)),[]),void 0===t.target)return o.bind.bind(o)}function Ib(e,t){var n;return n=bb,gb.set(n.key,n.engine),vb.set(n.key,n.resolver),Tb({drag:e},t||{},"drag")}const Rb=e=>e,Mb={error:null,initialValue:"",isDirty:!1,isDragEnabled:!1,isDragging:!1,isPressEnterToChange:!1,value:""},Nb="CHANGE",Db="COMMIT",Ab="CONTROL",Ob="DRAG_END",zb="DRAG_START",Lb="DRAG",Fb="INVALIDATE",Bb="PRESS_DOWN",jb="PRESS_ENTER",Vb="PRESS_UP",Hb="RESET";function $b(e=Rb,t=Mb,n){const[r,o]=(0,Uo.useReducer)((i=e,(e,t)=>{const n={...e};switch(t.type){case Ab:return n.value=t.payload.value,n.isDirty=!1,n._event=void 0,n;case Vb:case Bb:n.isDirty=!1;break;case zb:n.isDragging=!0;break;case Ob:n.isDragging=!1;break;case Nb:n.error=null,n.value=t.payload.value,e.isPressEnterToChange&&(n.isDirty=!0);break;case Db:n.value=t.payload.value,n.isDirty=!1;break;case Hb:n.error=null,n.isDirty=!1,n.value=t.payload.value||e.initialValue;break;case Fb:n.error=t.payload.error}return n._event=t.payload.event,i(n,t)}),function(e=Mb){const{value:t}=e;return{...Mb,...e,initialValue:t}}(t));var i;const a=e=>(t,n)=>{o({type:e,payload:{value:t,event:n}})},s=e=>t=>{o({type:e,payload:{event:t}})},l=e=>t=>{o({type:e,payload:t})},c=a(Nb),u=a(Hb),d=a(Db),f=l(zb),m=l(Lb),p=l(Ob),h=s(Vb),g=s(Bb),v=s(jb),b=(0,Uo.useRef)(r),y=(0,Uo.useRef)({value:t.value,onChangeHandler:n});return(0,Uo.useLayoutEffect)((()=>{b.current=r,y.current={value:t.value,onChangeHandler:n}})),(0,Uo.useLayoutEffect)((()=>{var e;void 0===b.current._event||r.value===y.current.value||r.isDirty||y.current.onChangeHandler(null!==(e=r.value)&&void 0!==e?e:"",{event:b.current._event})}),[r.value,r.isDirty]),(0,Uo.useLayoutEffect)((()=>{var e;t.value===b.current.value||b.current.isDirty||o({type:Ab,payload:{value:null!==(e=t.value)&&void 0!==e?e:""}})}),[t.value]),{change:c,commit:d,dispatch:o,drag:m,dragEnd:p,dragStart:f,invalidate:(e,t)=>o({type:Fb,payload:{error:e,event:t}}),pressDown:g,pressEnter:v,pressUp:h,reset:u,state:r}}const Wb=()=>{};const Ub=(0,Uo.forwardRef)((function({disabled:e=!1,dragDirection:t="n",dragThreshold:n=10,id:o,isDragEnabled:i=!1,isFocused:a,isPressEnterToChange:s=!1,onBlur:l=Wb,onChange:c=Wb,onDrag:u=Wb,onDragEnd:d=Wb,onDragStart:f=Wb,onFocus:m=Wb,onKeyDown:p=Wb,onValidate:h=Wb,size:g="default",setIsFocused:v,stateReducer:b=(e=>e),value:y,type:x,...w},E){const{state:_,change:S,commit:C,drag:k,dragEnd:P,dragStart:T,invalidate:I,pressDown:R,pressEnter:M,pressUp:N,reset:D}=$b(b,{isDragEnabled:i,value:y,isPressEnterToChange:s},c),{value:A,isDragging:O,isDirty:z}=_,L=(0,Uo.useRef)(!1),F=function(e,t){const n=function(e){let t="ns-resize";switch(e){case"n":case"s":t="ns-resize";break;case"e":case"w":t="ew-resize"}return t}(t);return(0,Uo.useEffect)((()=>{document.documentElement.style.cursor=e?n:null}),[e,n]),n}(O,t),B=e=>{const t=e.currentTarget.value;try{h(t),C(t,e)}catch(t){I(t,e)}},j=Ib((e=>{const{distance:t,dragging:n,event:r,target:o}=e;if(e.event={...e.event,target:o},t){if(r.stopPropagation(),!n)return d(e),void P(e);u(e),k(e),O||(f(e),T(e))}}),{axis:"e"===t||"w"===t?"x":"y",threshold:n,enabled:i,pointer:{capture:!1}}),V=i?j():{};let H;return"number"===x&&(H=e=>{w.onMouseDown?.(e),e.currentTarget!==e.currentTarget.ownerDocument.activeElement&&e.currentTarget.focus()}),(0,r.createElement)(Ev,{...w,...V,className:"components-input-control__input",disabled:e,dragCursor:F,isDragging:O,id:o,onBlur:e=>{l(e),v?.(!1),!z&&e.target.validity.valid||(L.current=!0,B(e))},onChange:e=>{const t=e.target.value;S(t,e)},onFocus:e=>{m(e),v?.(!0)},onKeyDown:e=>{const{key:t}=e;switch(p(e),t){case"ArrowUp":N(e);break;case"ArrowDown":R(e);break;case"Enter":M(e),s&&(e.preventDefault(),B(e));break;case"Escape":s&&z&&(e.preventDefault(),D(y,e))}},onMouseDown:H,ref:E,inputSize:g,value:null!=A?A:"",type:x})})),Gb=Ub,qb={"default.fontFamily":"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif","default.fontSize":"13px","helpText.fontSize":"12px",mobileTextMinFontSize:"16px"};function Yb(e){var t;return null!==(t=qb[e])&&void 0!==t?t:""}const Kb={name:"kv6lnz",styles:"box-sizing:border-box;*,*::before,*::after{box-sizing:inherit;}"};const Xb=bs("div",{target:"ej5x27r4"})("font-family:",Yb("default.fontFamily"),";font-size:",Yb("default.fontSize"),";",Kb,";"),Zb=bs("div",{target:"ej5x27r3"})((({__nextHasNoMarginBottom:e=!1})=>!e&&Ps("margin-bottom:",Ah(2),";",""))," .components-panel__row &{margin-bottom:inherit;}"),Jb=Ps(pv,";display:inline-block;margin-bottom:",Ah(2),";padding:0;",""),Qb=bs("label",{target:"ej5x27r2"})(Jb,";");var ey={name:"11yad0w",styles:"margin-bottom:revert"};const ty=bs("p",{target:"ej5x27r1"})("margin-top:",Ah(2),";margin-bottom:0;font-size:",Yb("helpText.fontSize"),";font-style:normal;color:",Ds.gray[700],";",(({__nextHasNoMarginBottom:e=!1})=>!e&&ey),";"),ny=bs("span",{target:"ej5x27r0"})(Jb,";"),ry=({className:e,children:t,...n})=>(0,r.createElement)(ny,{...n,className:c()("components-base-control__label",e)},t),oy=Object.assign(is((e=>{const{__nextHasNoMarginBottom:t=!1,id:n,label:o,hideLabelFromVision:i=!1,help:a,className:s,children:l}=rs(e,"BaseControl");return(0,r.createElement)(Xb,{className:s},(0,r.createElement)(Zb,{className:"components-base-control__field",__nextHasNoMarginBottom:t},o&&n&&(i?(0,r.createElement)(ws,{as:"label",htmlFor:n},o):(0,r.createElement)(Qb,{className:"components-base-control__label",htmlFor:n},o)),o&&!n&&(i?(0,r.createElement)(ws,{as:"label"},o):(0,r.createElement)(ry,null,o)),l),!!a&&(0,r.createElement)(ty,{id:n?n+"__help":void 0,className:"components-base-control__help",__nextHasNoMarginBottom:t},a))}),"BaseControl"),{VisualLabel:ry}),iy=oy,ay=()=>{};const sy=(0,Uo.forwardRef)((function(e,t){const{__next40pxDefaultSize:n,__unstableStateReducer:o=(e=>e),__unstableInputWidth:i,className:a,disabled:s=!1,help:l,hideLabelFromVision:u=!1,id:f,isPressEnterToChange:m=!1,label:p,labelPosition:h="top",onChange:g=ay,onValidate:v=ay,onKeyDown:b=ay,prefix:y,size:x="default",style:w,suffix:E,value:_,...S}=Nv(e),[C,k]=(0,Uo.useState)(!1),P=function(e){const t=(0,d.useInstanceId)(sy);return e||`inspector-input-control-${t}`}(f),T=c()("components-input-control",a),I=function(e){const t=(0,Uo.useRef)(e.value),[n,r]=(0,Uo.useState)({}),o=void 0!==n.value?n.value:e.value;return(0,Uo.useLayoutEffect)((()=>{const{current:o}=t;t.current=e.value,void 0===n.value||n.isStale?n.isStale&&e.value!==o&&r({}):r({...n,isStale:!0})}),[e.value,n]),{value:o,onBlur:t=>{r({}),e.onBlur?.(t)},onChange:(t,n)=>{r((e=>Object.assign(e,{value:t,isStale:!1}))),e.onChange(t,n)}}}({value:_,onBlur:S.onBlur,onChange:g}),R=l?{["string"==typeof l?"aria-describedby":"aria-details"]:`${P}__help`}:{};return(0,r.createElement)(iy,{className:T,help:l,id:P,__nextHasNoMarginBottom:!0},(0,r.createElement)(Ov,{__next40pxDefaultSize:n,__unstableInputWidth:i,disabled:s,gap:3,hideLabelFromVision:u,id:P,isFocused:C,justify:"left",label:p,labelPosition:h,prefix:y,size:x,style:w,suffix:E},(0,r.createElement)(Gb,{...S,...R,__next40pxDefaultSize:n,className:"components-input-control__input",disabled:s,id:P,isFocused:C,isPressEnterToChange:m,onKeyDown:b,onValidate:v,paddingInlineStart:y?Ah(2):void 0,paddingInlineEnd:E?Ah(2):void 0,ref:t,setIsFocused:k,size:x,stateReducer:o,...I})))})),ly=sy;const cy=function({icon:e,className:t,size:n=20,style:o={},...i}){const a=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" "),s={...20!=n?{fontSize:`${n}px`,width:`${n}px`,height:`${n}px`}:{},...o};return(0,r.createElement)("span",{className:a,style:s,...i})};const uy=function({icon:e=null,size:t=("string"==typeof e?20:24),...r}){if("string"==typeof e)return(0,Uo.createElement)(cy,{icon:e,size:t,...r});if((0,Uo.isValidElement)(e)&&cy===e.type)return(0,Uo.cloneElement)(e,{...r});if("function"==typeof e)return(0,Uo.createElement)(e,{size:t,...r});if(e&&("svg"===e.type||e.type===n.SVG)){const o={...e.props,width:t,height:t,...r};return(0,Uo.createElement)(n.SVG,{...o})}return(0,Uo.isValidElement)(e)?(0,Uo.cloneElement)(e,{size:t,...r}):e},dy=["onMouseDown","onClick"];const fy=(0,Uo.forwardRef)((function(e,t){const{__next40pxDefaultSize:n,isBusy:o,isDestructive:i,className:a,disabled:s,icon:l,iconPosition:u="left",iconSize:f,showTooltip:m,tooltipPosition:p,shortcut:h,label:g,children:v,size:b="default",text:y,variant:x,__experimentalIsFocusable:w,describedBy:E,..._}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,isPressed:i,isSmall:a,size:s,variant:l,...c}){let u=s,d=l;const f={"aria-pressed":i};var m,p,h,g,v,b;return a&&(null!==(m=u)&&void 0!==m||(u="small")),t&&(null!==(p=d)&&void 0!==p||(d="primary")),r&&(null!==(h=d)&&void 0!==h||(d="tertiary")),n&&(null!==(g=d)&&void 0!==g||(d="secondary")),e&&(qo()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"',version:"6.2"}),null!==(v=d)&&void 0!==v||(d="secondary")),o&&(null!==(b=d)&&void 0!==b||(d="link")),{...f,...c,size:u,variant:d}}(e),{href:S,target:C,"aria-checked":k,"aria-pressed":P,"aria-selected":T,...I}="href"in _?_:{href:void 0,target:void 0,..._},R=(0,d.useInstanceId)(fy,"components-button__description"),M="string"==typeof v&&!!v||Array.isArray(v)&&v?.[0]&&null!==v[0]&&"components-tooltip"!==v?.[0]?.props?.className,N=c()("components-button",a,{"is-next-40px-default-size":n,"is-secondary":"secondary"===x,"is-primary":"primary"===x,"is-small":"small"===b,"is-compact":"compact"===b,"is-tertiary":"tertiary"===x,"is-pressed":[!0,"true","mixed"].includes(P),"is-pressed-mixed":"mixed"===P,"is-busy":o,"is-link":"link"===x,"is-destructive":i,"has-text":!!l&&(M||y),"has-icon":!!l}),D=s&&!w,A=void 0===S||D?"button":"a",O="button"===A?{type:"button",disabled:D,"aria-checked":k,"aria-pressed":P,"aria-selected":T}:{},z="a"===A?{href:S,target:C}:{};if(s&&w){O["aria-disabled"]=!0,z["aria-disabled"]=!0;for(const e of dy)I[e]=e=>{e&&(e.stopPropagation(),e.preventDefault())}}const L=!D&&(m&&!!g||!!h||!!g&&!v?.length&&!1!==m),F=E?R:void 0,B=I["aria-describedby"]||F,j={className:N,"aria-label":I["aria-label"]||g,"aria-describedby":B,ref:t},V=(0,r.createElement)(r.Fragment,null,l&&"left"===u&&(0,r.createElement)(uy,{icon:l,size:f}),y&&(0,r.createElement)(r.Fragment,null,y),l&&"right"===u&&(0,r.createElement)(uy,{icon:l,size:f}),v),H="a"===A?(0,r.createElement)("a",{...z,...I,...j},V):(0,r.createElement)("button",{...O,...I,...j},V),$=L?{text:v?.length&&E?E:g,shortcut:h,placement:p&&Xo(p)}:{};return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(ri,{...$},H),E&&(0,r.createElement)(ws,null,(0,r.createElement)("span",{id:F},E)))})),my=fy;var py={name:"euqsgg",styles:"input[type='number']::-webkit-outer-spin-button,input[type='number']::-webkit-inner-spin-button{-webkit-appearance:none!important;margin:0!important;}input[type='number']{-moz-appearance:textfield;}"};const hy=({hideHTMLArrows:e})=>e?py:"",gy=bs(ly,{target:"ep09it41"})(hy,";"),vy=bs(my,{target:"ep09it40"})("&&&&&{color:",Ds.theme.accent,";}"),by={smallSpinButtons:Ps("width:",Ah(5),";min-width:",Ah(5),";height:",Ah(5),";","")};function yy(e){const t=Number(e);return isNaN(t)?0:t}function xy(...e){return e.reduce(((e,t)=>e+yy(t)),0)}function wy(e,t,n){const r=yy(e);return Math.max(t,Math.min(r,n))}function Ey(e=0,t=1/0,n=1/0,r=1){const o=yy(e),i=yy(r),a=function(e){const t=(e+"").split(".");return void 0!==t[1]?t[1].length:0}(r),s=wy(Math.round(o/i)*i,t,n);return a?yy(s.toFixed(a)):s}const _y={bottom:{align:"flex-end",justify:"center"},bottomLeft:{align:"flex-end",justify:"flex-start"},bottomRight:{align:"flex-end",justify:"flex-end"},center:{align:"center",justify:"center"},edge:{align:"center",justify:"space-between"},left:{align:"center",justify:"flex-start"},right:{align:"center",justify:"flex-end"},stretch:{align:"stretch"},top:{align:"flex-start",justify:"center"},topLeft:{align:"flex-start",justify:"flex-start"},topRight:{align:"flex-start",justify:"flex-end"}},Sy={bottom:{justify:"flex-end",align:"center"},bottomLeft:{justify:"flex-end",align:"flex-start"},bottomRight:{justify:"flex-end",align:"flex-end"},center:{justify:"center",align:"center"},edge:{justify:"space-between",align:"center"},left:{justify:"center",align:"flex-start"},right:{justify:"center",align:"flex-end"},stretch:{align:"stretch"},top:{justify:"flex-start",align:"center"},topLeft:{justify:"flex-start",align:"flex-start"},topRight:{justify:"flex-start",align:"flex-end"}};function Cy(e){return"string"==typeof e?[e]:Uo.Children.toArray(e).filter((e=>(0,Uo.isValidElement)(e)))}function ky(e){const{alignment:t="edge",children:n,direction:o,spacing:i=2,...a}=rs(e,"HStack"),s=function(e,t="row"){if(!ag(e))return{};const n="column"===t?Sy:_y;return e in n?n[e]:{align:e}}(t,o),l=Cy(n).map(((e,t)=>{if(ls(e,["Spacer"])){const n=e,o=n.key||`hstack-${t}`;return(0,r.createElement)(og,{isBlock:!0,key:o,...n.props})}return e}));return jh({children:l,direction:o,justify:"center",...s,...a,gap:i})}const Py=os((function(e,t){const n=ky(e);return(0,r.createElement)(xs,{...n,ref:t})}),"HStack"),Ty=()=>{};const Iy=(0,Uo.forwardRef)((function(e,t){const{__unstableStateReducer:n,className:o,dragDirection:i="n",hideHTMLArrows:a=!1,spinControls:s=(a?"none":"native"),isDragEnabled:l=!0,isShiftStepEnabled:f=!0,label:m,max:p=1/0,min:h=-1/0,required:g=!1,shiftStep:v=10,step:b=1,spinFactor:y=1,type:x="number",value:w,size:E="default",suffix:_,onChange:S=Ty,...C}=Nv(e);a&&qo()("wp.components.NumberControl hideHTMLArrows prop ",{alternative:'spinControls="none"',since:"6.2",version:"6.3"});const k=(0,Uo.useRef)(),P=(0,d.useMergeRefs)([k,t]),T="any"===b,I=T?1:sg(b),R=sg(y)*I,M=Ey(0,h,p,I),N=(e,t)=>T?""+Math.min(p,Math.max(h,sg(e))):""+Ey(e,h,p,null!=t?t:I),D="number"===x?"off":void 0,A=c()("components-number-control",o),O=ns()("small"===E&&by.smallSpinButtons),z=(e,t,n)=>{n?.preventDefault();const r=n?.shiftKey&&f,o=r?sg(v)*R:R;let i=function(e){const t=""===e;return!ag(e)||t}(e)?M:e;return"up"===t?i=xy(i,o):"down"===t&&(i=function(...e){return e.reduce(((e,t,n)=>{const r=yy(t);return 0===n?r:e-r}),0)}(i,o)),N(i,r?o:void 0)},L=e=>t=>S(String(z(w,e,t)),{event:{...t,target:k.current}});return(0,r.createElement)(gy,{autoComplete:D,inputMode:"numeric",...C,className:A,dragDirection:i,hideHTMLArrows:"native"!==s,isDragEnabled:l,label:m,max:p,min:h,ref:P,required:g,step:b,type:x,value:w,__unstableStateReducer:(e,t)=>{var r;const o=((e,t)=>{const n={...e},{type:r,payload:o}=t,a=o.event,s=n.value;if(r!==Vb&&r!==Bb||(n.value=z(s,r===Vb?"up":"down",a)),r===Lb&&l){const[e,t]=o.delta,r=o.shiftKey&&f,a=r?sg(v)*R:R;let l,c;switch(i){case"n":c=t,l=-1;break;case"e":c=e,l=(0,u.isRTL)()?-1:1;break;case"s":c=t,l=1;break;case"w":c=e,l=(0,u.isRTL)()?1:-1}if(0!==c){c=Math.ceil(Math.abs(c))*Math.sign(c);const e=c*a*l;n.value=N(xy(s,e),r?a:void 0)}}if(r===jb||r===Db){const e=!1===g&&""===s;n.value=e?s:N(s)}return n})(e,t);return null!==(r=n?.(o,t))&&void 0!==r?r:o},size:E,suffix:"custom"===s?(0,r.createElement)(r.Fragment,null,_,(0,r.createElement)(tg,{marginBottom:0,marginRight:2},(0,r.createElement)(Py,{spacing:1},(0,r.createElement)(vy,{className:O,icon:ng,size:"small",label:(0,u.__)("Increment"),onClick:L("up")}),(0,r.createElement)(vy,{className:O,icon:rg,size:"small",label:(0,u.__)("Decrement"),onClick:L("down")})))):_,onChange:S})})),Ry=Iy;const My=bs("div",{target:"eln3bjz3"})("border-radius:50%;border:",Xg.borderWidth," solid ",Ds.ui.border,";box-sizing:border-box;cursor:grab;height:",32,"px;overflow:hidden;width:",32,"px;:active{cursor:grabbing;}"),Ny=bs("div",{target:"eln3bjz2"})({name:"1r307gh",styles:"box-sizing:border-box;position:relative;width:100%;height:100%;:focus-visible{outline:none;}"}),Dy=bs("div",{target:"eln3bjz1"})("background:",Ds.theme.accent,";border-radius:50%;box-sizing:border-box;display:block;left:50%;top:4px;transform:translateX( -50% );position:absolute;width:",6,"px;height:",6,"px;"),Ay=bs(mv,{target:"eln3bjz0"})("color:",Ds.theme.accent,";margin-right:",Ah(3),";");const Oy=function({value:e,onChange:t,...n}){const o=(0,Uo.useRef)(null),i=(0,Uo.useRef)(),a=(0,Uo.useRef)(),s=e=>{if(void 0!==e&&(e.preventDefault(),e.target?.focus(),void 0!==i.current&&void 0!==t)){const{x:n,y:r}=i.current;t(function(e,t,n,r){const o=r-t,i=n-e,a=Math.atan2(o,i),s=Math.round(a*(180/Math.PI))+90;if(s<0)return 360+s;return s}(n,r,e.clientX,e.clientY))}},{startDrag:l,isDragging:c}=(0,d.__experimentalUseDragging)({onDragStart:e=>{(()=>{if(null===o.current)return;const e=o.current.getBoundingClientRect();i.current={x:e.x+e.width/2,y:e.y+e.height/2}})(),s(e)},onDragMove:s,onDragEnd:s});return(0,Uo.useEffect)((()=>{c?(void 0===a.current&&(a.current=document.body.style.cursor),document.body.style.cursor="grabbing"):(document.body.style.cursor=a.current||"",a.current=void 0)}),[c]),(0,r.createElement)(My,{ref:o,onMouseDown:l,className:"components-angle-picker-control__angle-circle",...n},(0,r.createElement)(Ny,{style:e?{transform:`rotate(${e}deg)`}:void 0,className:"components-angle-picker-control__angle-circle-indicator-wrapper",tabIndex:-1},(0,r.createElement)(Dy,{className:"components-angle-picker-control__angle-circle-indicator"})))};const zy=(0,Uo.forwardRef)((function(e,t){const{className:n,label:o=(0,u.__)("Angle"),onChange:i,value:a,...s}=e,l=c()("components-angle-picker-control",n),d=(0,r.createElement)(Ay,null,"°"),[f,m]=(0,u.isRTL)()?[d,null]:[null,d];return(0,r.createElement)($h,{...s,ref:t,className:l,gap:2},(0,r.createElement)(Uh,null,(0,r.createElement)(Ry,{label:o,className:"components-angle-picker-control__input-field",max:360,min:0,onChange:e=>{if(void 0===i)return;const t=void 0!==e&&""!==e?parseInt(e,10):0;i(t)},size:"__unstable-large",step:"1",value:a,spinControls:"none",prefix:f,suffix:m})),(0,r.createElement)(tg,{marginBottom:"1",marginTop:"auto"},(0,r.createElement)(Oy,{"aria-hidden":"true",value:a,onChange:i})))}));var Ly=o(9681),Fy=o.n(Ly);const By=window.wp.richText,jy=window.wp.a11y,Vy=window.wp.keycodes,Hy=new RegExp(`[${["-","~","","֊","־","᐀","᠆","‐","‑","‒","–","—","―","⁓","⁻","₋","−","⸗","⸺","⸻","〜","〰","゠","︱","︲","﹘","﹣","-"].join("")}]`,"g"),$y=e=>Fy()(e).toLocaleLowerCase().replace(Hy,"-");function Wy(e){var t;let n=null!==(t=e?.toString?.())&&void 0!==t?t:"";return n=n.replace(/['\u2019]/,""),_i(n,{splitRegexp:[/(?!(?:1ST|2ND|3RD|[4-9]TH)(?![a-z]))([a-z0-9])([A-Z])/g,/(?!(?:1st|2nd|3rd|[4-9]th)(?![a-z]))([0-9])([a-z])/g,/([A-Za-z])([0-9])/g,/([A-Z])([A-Z][a-z])/g]})}function Uy(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}function Gy(e){return t=>{const[n,r]=(0,Uo.useState)([]);return(0,Uo.useLayoutEffect)((()=>{const{options:n,isDebounced:o}=e,i=(0,d.debounce)((()=>{const o=Promise.resolve("function"==typeof n?n(t):n).then((n=>{if(o.canceled)return;const i=n.map(((t,n)=>({key:`${e.name}-${n}`,value:t,label:e.getOptionLabel(t),keywords:e.getOptionKeywords?e.getOptionKeywords(t):[],isDisabled:!!e.isOptionDisabled&&e.isOptionDisabled(t)}))),a=new RegExp("(?:\\b|\\s|^)"+Uy(t),"i");r(function(e,t=[],n=10){const r=[];for(let o=0;o<t.length;o++){const i=t[o];let{keywords:a=[]}=i;if("string"==typeof i.label&&(a=[...a,i.label]),a.some((t=>e.test(Fy()(t))))&&(r.push(i),r.length===n))break}return r}(a,i))}));return o}),o?250:0),a=i();return()=>{i.cancel(),a&&(a.canceled=!0)}}),[t]),[n]}}const qy=e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?Po({element:n.current,padding:r}).fn(t):{}:n?Po({element:n,padding:r}).fn(t):{};var o}});var Yy="undefined"!=typeof document?r.useLayoutEffect:r.useEffect;function Ky(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Ky(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Ky(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Xy(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Zy(e,t){const n=Xy(e);return Math.round(t*n)/n}function Jy(e){const t=r.useRef(e);return Yy((()=>{t.current=e})),t}function Qy(){!lh.current&&ch();const[e]=(0,r.useState)(sh.current);return e}const ex=(0,r.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(n.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"}));let tx=0;function nx(e){const t=document.scrollingElement||document.body;e&&(tx=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=tx)}let rx=0;const ox=function(){return(0,Uo.useEffect)((()=>(0===rx&&nx(!0),++rx,()=>{1===rx&&nx(!1),--rx})),[]),null},ix=Symbol(),ax=Symbol(),sx=Symbol();let lx=(e,t)=>new Proxy(e,t);const cx=Object.getPrototypeOf,ux=new WeakMap,dx=e=>e&&(ux.has(e)?ux.get(e):cx(e)===Object.prototype||cx(e)===Array.prototype),fx=e=>"object"==typeof e&&null!==e,mx=new WeakMap,px=e=>e[sx]||e,hx=(e,t,n)=>{if(!dx(e))return e;const r=px(e),o=(e=>Object.isFrozen(e)||Object.values(Object.getOwnPropertyDescriptors(e)).some((e=>!e.writable)))(r);let i=n&&n.get(r);return i&&i[1].f===o||(i=((e,t)=>{const n={f:t};let r=!1;const o=(t,o)=>{if(!r){let r=n.a.get(e);r||(r=new Set,n.a.set(e,r)),o&&r.has(ix)||r.add(t)}},i={get:(t,r)=>r===sx?e:(o(r),hx(t[r],n.a,n.c)),has:(t,i)=>i===ax?(r=!0,n.a.delete(e),!0):(o(i),i in t),getOwnPropertyDescriptor:(e,t)=>(o(t,!0),Object.getOwnPropertyDescriptor(e,t)),ownKeys:e=>(o(ix),Reflect.ownKeys(e))};return t&&(i.set=i.deleteProperty=()=>!1),[i,n]})(r,o),i[1].p=lx(o?(e=>{let t=mx.get(e);if(!t){if(Array.isArray(e))t=Array.from(e);else{const n=Object.getOwnPropertyDescriptors(e);Object.values(n).forEach((e=>{e.configurable=!0})),t=Object.create(cx(e),n)}mx.set(e,t)}return t})(r):r,i[0]),n&&n.set(r,i)),i[1].a=t,i[1].c=n,i[1].p},gx=(e,t)=>{const n=Reflect.ownKeys(e),r=Reflect.ownKeys(t);return n.length!==r.length||n.some(((e,t)=>e!==r[t]))},vx=(e,t,n,r)=>{if(Object.is(e,t))return!1;if(!fx(e)||!fx(t))return!0;const o=n.get(px(e));if(!o)return!0;if(r){const n=r.get(e);if(n&&n.n===t)return n.g;r.set(e,{n:t,g:!1})}let i=null;for(const a of o){const o=a===ix?gx(e,t):vx(e[a],t[a],n,r);if(!0!==o&&!1!==o||(i=o),i)break}return null===i&&(i=!0),r&&r.set(e,{n:t,g:i}),i},bx=(e,t=!0)=>{ux.set(e,t)},yx=e=>"object"==typeof e&&null!==e,xx=new WeakSet,wx=Symbol("VERSION"),Ex=Symbol("LISTENERS"),_x=Symbol("SNAPSHOT"),Sx=(e=Object.is,t=((e,t)=>new Proxy(e,t)),n=(e=>yx(e)&&!xx.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)),r=Symbol("PROMISE_RESULT"),o=Symbol("PROMISE_ERROR"),i=new WeakMap,a=((e,t,n)=>{const a=i.get(n);if((null==a?void 0:a[0])===e)return a[1];const s=Array.isArray(t)?[]:Object.create(Object.getPrototypeOf(t));return bx(s,!0),i.set(n,[e,s]),Reflect.ownKeys(t).forEach((e=>{const i=Reflect.get(t,e,n);if(xx.has(i))bx(i,!1),s[e]=i;else if(i instanceof Promise)if(r in i)s[e]=i[r];else{const t=i[o]||i;Object.defineProperty(s,e,{get(){if(r in i)return i[r];throw t}})}else(null==i?void 0:i[Ex])?s[e]=i[_x]:s[e]=i})),Object.freeze(s)}),s=new WeakMap,l=[1],c=(i=>{if(!yx(i))throw new Error("object required");const c=s.get(i);if(c)return c;let u=l[0];const d=new Set,f=(e,t=++l[0])=>{u!==t&&(u=t,d.forEach((n=>n(e,t))))},m=new Map,p=e=>{let t=m.get(e);return t||(t=(t,n)=>{const r=[...t];r[1]=[e,...r[1]],f(r,n)},m.set(e,t)),t},h=e=>{const t=m.get(e);return m.delete(e),t},g=Array.isArray(i)?[]:Object.create(Object.getPrototypeOf(i)),v={get:(e,t,n)=>t===wx?u:t===Ex?d:t===_x?a(u,e,n):Reflect.get(e,t,n),deleteProperty(e,t){const n=Reflect.get(e,t),r=null==n?void 0:n[Ex];r&&r.delete(h(t));const o=Reflect.deleteProperty(e,t);return o&&f(["delete",[t],n]),o},set(t,i,a,s){var l;const c=Reflect.has(t,i),u=Reflect.get(t,i,s);if(c&&e(u,a))return!0;const d=null==u?void 0:u[Ex];let m;return d&&d.delete(h(i)),yx(a)&&(a=(e=>dx(e)&&e[sx]||null)(a)||a),(null==(l=Object.getOwnPropertyDescriptor(t,i))?void 0:l.set)?m=a:a instanceof Promise?m=a.then((e=>(m[r]=e,f(["resolve",[i],e]),e))).catch((e=>{m[o]=e,f(["reject",[i],e])})):(null==a?void 0:a[Ex])?(m=a,m[Ex].add(p(i))):n(a)?(m=kx(a),m[Ex].add(p(i))):m=a,Reflect.set(t,i,m,s),f(["set",[i],a,u]),!0}},b=t(g,v);return s.set(i,b),Reflect.ownKeys(i).forEach((e=>{const t=Object.getOwnPropertyDescriptor(i,e);t.get||t.set?Object.defineProperty(g,e,t):b[e]=i[e]})),b}))=>[c,xx,wx,Ex,_x,e,t,n,r,o,i,a,s,l],[Cx]=Sx();function kx(e={}){return Cx(e)}function Px(e,t,n){let r;(null==e?void 0:e[Ex])||console.warn("Please use proxy object");const o=[],i=e=>{o.push(e),n?t(o.splice(0)):r||(r=Promise.resolve().then((()=>{r=void 0,t(o.splice(0))})))};return e[Ex].add(i),()=>{e[Ex].delete(i)}}function Tx(e){return(null==e?void 0:e[_x])||console.warn("Please use proxy object"),e[_x]}function Ix(e){return xx.add(e),e}const{useSyncExternalStore:Rx}=Ft,Mx=(e,t)=>{const n=(0,r.useRef)();(0,r.useEffect)((()=>{n.current=((e,t)=>{const n=[],r=new WeakSet,o=(e,i)=>{if(r.has(e))return;fx(e)&&r.add(e);const a=fx(e)&&t.get(px(e));a?a.forEach((t=>{o(e[t],i?[...i,t]:[t])})):i&&n.push(i)};return o(e),n})(e,t)})),(0,r.useDebugValue)(n.current)};function Nx(e,t){const n=null==t?void 0:t.sync,o=(0,r.useRef)(),i=(0,r.useRef)();let a=!0;const s=Rx((0,r.useCallback)((t=>{const r=Px(e,t,n);return t(),r}),[e,n]),(()=>{const t=Tx(e);try{if(!a&&o.current&&i.current&&!vx(o.current,t,i.current,new WeakMap))return o.current}catch(e){}return t}),(()=>Tx(e)));a=!1;const l=new WeakMap;(0,r.useEffect)((()=>{o.current=s,i.current=l})),Mx(s,l);const c=(0,r.useMemo)((()=>new WeakMap),[]);return hx(s,l,c)}Symbol();function Dx(e){const t=kx({data:Array.from(e||[]),has(e){return this.data.some((t=>t[0]===e))},set(e,t){const n=this.data.find((t=>t[0]===e));return n?n[1]=t:this.data.push([e,t]),this},get(e){var t;return null==(t=this.data.find((t=>t[0]===e)))?void 0:t[1]},delete(e){const t=this.data.findIndex((t=>t[0]===e));return-1!==t&&(this.data.splice(t,1),!0)},clear(){this.data.splice(0)},get size(){return this.data.length},toJSON:()=>({}),forEach(e){this.data.forEach((t=>{e(t[1],t[0],this)}))},keys(){return this.data.map((e=>e[0])).values()},values(){return this.data.map((e=>e[1])).values()},entries(){return new Map(this.data).entries()},get[Symbol.toStringTag](){return"Map"},[Symbol.iterator](){return this.entries()}});return Object.defineProperties(t,{data:{enumerable:!1},size:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(t),t}const Ax={slots:Dx(),fills:Dx(),registerSlot:()=>{},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},isDefault:!0},Ox=(0,Uo.createContext)(Ax);function zx(e){const t=(0,Uo.useContext)(Ox);return{...Nx(t.slots,{sync:!0}).get(e),...(0,Uo.useMemo)((()=>({updateSlot:n=>t.updateSlot(e,n),unregisterSlot:n=>t.unregisterSlot(e,n),registerFill:n=>t.registerFill(e,n),unregisterFill:n=>t.unregisterFill(e,n)})),[e,t])}}const Lx={registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>[],subscribe:()=>()=>{}},Fx=(0,Uo.createContext)(Lx),Bx=e=>{const{getSlot:t,subscribe:n}=(0,Uo.useContext)(Fx);return(0,Uo.useSyncExternalStore)(n,(()=>t(e)),(()=>t(e)))};function jx({name:e,children:t}){const{registerFill:n,unregisterFill:r}=(0,Uo.useContext)(Fx),o=Bx(e),i=(0,Uo.useRef)({name:e,children:t});return(0,Uo.useLayoutEffect)((()=>{const t=i.current;return n(e,t),()=>r(e,t)}),[]),(0,Uo.useLayoutEffect)((()=>{i.current.children=t,o&&o.forceUpdate()}),[t]),(0,Uo.useLayoutEffect)((()=>{e!==i.current.name&&(r(i.current.name,i.current),i.current.name=e,n(e,i.current))}),[e]),null}function Vx(e){return"function"==typeof e}class Hx extends Uo.Component{constructor(e){super(e),this.isUnmounted=!1}componentDidMount(){const{registerSlot:e}=this.props;this.isUnmounted=!1,e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:r}=this.props;e.name!==t&&(n(e.name,this),r(t,this))}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){var e;const{children:t,name:n,fillProps:o={},getFills:i}=this.props,a=(null!==(e=i(n,this))&&void 0!==e?e:[]).map((e=>{const t=Vx(e.children)?e.children(o):e.children;return Uo.Children.map(t,((e,t)=>{if(!e||"string"==typeof e)return e;let n=t;return"object"==typeof e&&"key"in e&&e?.key&&(n=e.key),(0,Uo.cloneElement)(e,{key:n})}))})).filter((e=>!(0,Uo.isEmptyElement)(e)));return(0,r.createElement)(r.Fragment,null,Vx(t)?t(a):a)}}const $x=e=>(0,r.createElement)(Fx.Consumer,null,(({registerSlot:t,unregisterSlot:n,getFills:o})=>(0,r.createElement)(Hx,{...e,registerSlot:t,unregisterSlot:n,getFills:o}))),Wx={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Ux;const Gx=new Uint8Array(16);function qx(){if(!Ux&&(Ux="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ux))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ux(Gx)}const Yx=[];for(let e=0;e<256;++e)Yx.push((e+256).toString(16).slice(1));function Kx(e,t=0){return Yx[e[t+0]]+Yx[e[t+1]]+Yx[e[t+2]]+Yx[e[t+3]]+"-"+Yx[e[t+4]]+Yx[e[t+5]]+"-"+Yx[e[t+6]]+Yx[e[t+7]]+"-"+Yx[e[t+8]]+Yx[e[t+9]]+"-"+Yx[e[t+10]]+Yx[e[t+11]]+Yx[e[t+12]]+Yx[e[t+13]]+Yx[e[t+14]]+Yx[e[t+15]]}const Xx=function(e,t,n){if(Wx.randomUUID&&!t&&!e)return Wx.randomUUID();const r=(e=e||{}).random||(e.rng||qx)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Kx(r)},Zx=new Set,Jx=new WeakMap;function Qx(e){const{children:t,document:n}=e;if(!n)return null;const o=(e=>{if(Jx.has(e))return Jx.get(e);let t=Xx().replace(/[0-9]/g,"");for(;Zx.has(t);)t=Xx().replace(/[0-9]/g,"");Zx.add(t);const n=Pa({container:e,key:t});return Jx.set(e,n),n})(n.head);return(0,r.createElement)(Wa,{value:o},t)}const ew=Qx;function tw(e){var t;const{name:n,children:o}=e,{registerFill:i,unregisterFill:a,...s}=zx(n),l=function(){const[,e]=(0,Uo.useState)({}),t=(0,Uo.useRef)(!0);return(0,Uo.useEffect)((()=>(t.current=!0,()=>{t.current=!1})),[]),()=>{t.current&&e({})}}(),c=(0,Uo.useRef)({rerender:l});if((0,Uo.useEffect)((()=>(i(c),()=>{a(c)})),[i,a]),!s.ref||!s.ref.current)return null;const u=(0,r.createElement)(ew,{document:s.ref.current.ownerDocument},"function"==typeof o?o(null!==(t=s.fillProps)&&void 0!==t?t:{}):o);return(0,Uo.createPortal)(u,s.ref.current)}const nw=(0,Uo.forwardRef)((function(e,t){const{name:n,fillProps:o={},as:i,children:a,...s}=e,{registerSlot:l,unregisterSlot:c,...u}=(0,Uo.useContext)(Ox),f=(0,Uo.useRef)(null);return(0,Uo.useLayoutEffect)((()=>(l(n,f,o),()=>{c(n,f)})),[l,c,n]),(0,Uo.useLayoutEffect)((()=>{u.updateSlot(n,o)})),(0,r.createElement)(xs,{as:i,ref:(0,d.useMergeRefs)([t,f]),...s})})),rw=window.wp.isShallowEqual;var ow=o.n(rw);function iw(){const e=Dx(),t=Dx();return{slots:e,fills:t,registerSlot:(t,n,r)=>{const o=e.get(t);e.set(t,Ix({...o,ref:n||o?.ref,fillProps:r||o?.fillProps||{}}))},updateSlot:(n,r)=>{const o=e.get(n);if(!o)return;if(ow()(o.fillProps,r))return;o.fillProps=r;const i=t.get(n);i&&i.forEach((e=>e.current.rerender()))},unregisterSlot:(t,n)=>{e.get(t)?.ref===n&&e.delete(t)},registerFill:(e,n)=>{t.set(e,Ix([...t.get(e)||[],n]))},unregisterFill:(e,n)=>{const r=t.get(e);r&&t.set(e,Ix(r.filter((e=>e!==n))))}}}function aw({children:e}){const t=(0,Uo.useMemo)(iw,[]);return(0,r.createElement)(Ox.Provider,{value:t},e)}function sw(){const e={},t={};let n=[];function r(t){return e[t]}function o(e){const t=r(e);t&&t.forceUpdate()}function i(){n.forEach((e=>e()))}return{registerSlot:function(t,n){const r=e[t];e[t]=n,i(),o(t),r&&r.forceUpdate()},unregisterSlot:function(t,n){e[t]===n&&(delete e[t],i())},registerFill:function(e,n){t[e]=[...t[e]||[],n],o(e)},unregisterFill:function(e,n){var r;t[e]=null!==(r=t[e]?.filter((e=>e!==n)))&&void 0!==r?r:[],o(e)},getSlot:r,getFills:function(n,r){return e[n]!==r?[]:t[n]},subscribe:function(e){return n.push(e),()=>{n=n.filter((t=>t!==e))}}}}const lw=function({children:e}){const t=(0,Uo.useMemo)(sw,[]);return(0,r.createElement)(Fx.Provider,{value:t},e)};function cw(e){return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(jx,{...e}),(0,r.createElement)(tw,{...e}))}const uw=(0,Uo.forwardRef)((function(e,t){const{bubblesVirtually:n,...o}=e;return n?(0,r.createElement)(nw,{...o,ref:t}):(0,r.createElement)($x,{...o})}));function dw({children:e,passthrough:t=!1}){return!(0,Uo.useContext)(Ox).isDefault&&t?(0,r.createElement)(r.Fragment,null,e):(0,r.createElement)(lw,null,(0,r.createElement)(aw,null,e))}function fw(e){const t="symbol"==typeof e?e.description:e,n=t=>(0,r.createElement)(cw,{name:e,...t});n.displayName=`${t}Fill`;const o=t=>(0,r.createElement)(uw,{name:e,...t});return o.displayName=`${t}Slot`,o.__unstableName=e,{Fill:n,Slot:o}}const mw="Popover",pw=()=>(0,r.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",className:"components-popover__triangle",role:"presentation"},(0,r.createElement)(n.Path,{className:"components-popover__triangle-bg",d:"M 0 0 L 50 50 L 100 0"}),(0,r.createElement)(n.Path,{className:"components-popover__triangle-border",d:"M 0 0 L 50 50 L 100 0",vectorEffect:"non-scaling-stroke"})),hw=(0,Uo.createContext)(void 0),gw="components-popover__fallback-container",vw=os(((e,t)=>{const{animate:n=!0,headerTitle:o,constrainTabbing:i,onClose:a,children:s,className:l,noArrow:u=!0,position:f,placement:m="bottom-start",offset:p=0,focusOnMount:h="firstElement",anchor:g,expandOnMobile:v,onFocusOutside:b,__unstableSlotName:y=mw,flip:x=!0,resize:w=!0,shift:E=!1,inline:_=!1,variant:S,__unstableForcePosition:C,anchorRef:k,anchorRect:P,getAnchorRect:T,isAlternate:I,...R}=rs(e,"Popover");let M=x,N=w;void 0!==C&&(qo()("`__unstableForcePosition` prop in wp.components.Popover",{since:"6.1",version:"6.3",alternative:"`flip={ false }` and `resize={ false }`"}),M=!C,N=!C),void 0!==k&&qo()("`anchorRef` prop in wp.components.Popover",{since:"6.1",alternative:"`anchor` prop"}),void 0!==P&&qo()("`anchorRect` prop in wp.components.Popover",{since:"6.1",alternative:"`anchor` prop"}),void 0!==T&&qo()("`getAnchorRect` prop in wp.components.Popover",{since:"6.1",alternative:"`anchor` prop"});const D=I?"toolbar":S;void 0!==I&&qo()("`isAlternate` prop in wp.components.Popover",{since:"6.2",alternative:"`variant` prop with the `'toolbar'` value"});const A=(0,Uo.useRef)(null),[O,z]=(0,Uo.useState)(null),L=(0,Uo.useCallback)((e=>{z(e)}),[]),F=(0,d.useViewportMatch)("medium","<"),B=v&&F,j=!B&&!u,V=f?Xo(f):m,H=[..."overlay"===m?[{name:"overlay",fn:({rects:e})=>e.reference},ko({apply({rects:e,elements:t}){var n;const{firstElementChild:r}=null!==(n=t.floating)&&void 0!==n?n:{};r instanceof HTMLElement&&Object.assign(r.style,{width:`${e.reference.width}px`,height:`${e.reference.height}px`})}})]:[],Fr(p),M&&Co(),N&&ko({apply(e){var t;const{firstElementChild:n}=null!==(t=X.floating.current)&&void 0!==t?t:{};n instanceof HTMLElement&&Object.assign(n.style,{maxHeight:`${e.availableHeight}px`,overflow:"auto"})}}),E&&So({crossAxis:!0,limiter:To(),padding:1}),qy({element:A})],$=(0,Uo.useContext)(hw)||y,W=zx($);let U;(a||b)&&(U=(e,t)=>{"focus-outside"===e&&b?b(t):a&&a()});const[G,q]=(0,d.__experimentalUseDialog)({constrainTabbing:i,focusOnMount:h,__unstableOnClose:U,onClose:U}),{x:Y,y:K,refs:X,strategy:Z,update:J,placement:Q,middlewareData:{arrow:ee}}=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:a,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=r.useState(o);Ky(m,o)||p(o);const[h,g]=r.useState(null),[v,b]=r.useState(null),y=r.useCallback((e=>{e!==_.current&&(_.current=e,g(e))}),[]),x=r.useCallback((e=>{e!==S.current&&(S.current=e,b(e))}),[]),w=a||h,E=s||v,_=r.useRef(null),S=r.useRef(null),C=r.useRef(d),k=null!=c,P=Jy(c),T=Jy(i),I=r.useCallback((()=>{if(!_.current||!S.current)return;const e={placement:t,strategy:n,middleware:m};T.current&&(e.platform=T.current),Io(_.current,S.current,e).then((e=>{const t={...e,isPositioned:!0};R.current&&!Ky(C.current,t)&&(C.current=t,tr.flushSync((()=>{f(t)})))}))}),[m,t,n,T]);Yy((()=>{!1===u&&C.current.isPositioned&&(C.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[u]);const R=r.useRef(!1);Yy((()=>(R.current=!0,()=>{R.current=!1})),[]),Yy((()=>{if(w&&(_.current=w),E&&(S.current=E),w&&E){if(P.current)return P.current(w,E,I);I()}}),[w,E,I,P,k]);const M=r.useMemo((()=>({reference:_,floating:S,setReference:y,setFloating:x})),[y,x]),N=r.useMemo((()=>({reference:w,floating:E})),[w,E]),D=r.useMemo((()=>{const e={position:n,left:0,top:0};if(!N.floating)return e;const t=Zy(N.floating,d.x),r=Zy(N.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+r+"px)",...Xy(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,l,N.floating,d.x,d.y]);return r.useMemo((()=>({...d,update:I,refs:M,elements:N,floatingStyles:D})),[d,I,M,N,D])}({placement:"overlay"===V?void 0:V,middleware:H,whileElementsMounted:(e,t,n)=>_o(e,t,n,{layoutShift:!1,animationFrame:!0})}),te=(0,Uo.useCallback)((e=>{A.current=e,J()}),[J]),ne=k?.top,re=k?.bottom,oe=k?.startContainer,ie=k?.current;(0,Uo.useLayoutEffect)((()=>{const e=(({anchor:e,anchorRef:t,anchorRect:n,getAnchorRect:r,fallbackReferenceElement:o})=>{var i;let a=null;return e?a=e:function(e){return!!e?.top}(t)?a={getBoundingClientRect(){const e=t.top.getBoundingClientRect(),n=t.bottom.getBoundingClientRect();return new window.DOMRect(e.x,e.y,e.width,n.bottom-e.top)}}:function(e){return!!e?.current}(t)?a=t.current:t?a=t:n?a={getBoundingClientRect:()=>n}:r?a={getBoundingClientRect(){var e,t,n,i;const a=r(o);return new window.DOMRect(null!==(e=a.x)&&void 0!==e?e:a.left,null!==(t=a.y)&&void 0!==t?t:a.top,null!==(n=a.width)&&void 0!==n?n:a.right-a.left,null!==(i=a.height)&&void 0!==i?i:a.bottom-a.top)}}:o&&(a=o.parentElement),null!==(i=a)&&void 0!==i?i:null})({anchor:g,anchorRef:k,anchorRect:P,getAnchorRect:T,fallbackReferenceElement:O});X.setReference(e)}),[g,k,ne,re,oe,ie,P,T,O,X]);const ae=(0,d.useMergeRefs)([X.setFloating,G,t]),se=B?void 0:{position:Z,top:0,left:0,x:Jo(Y),y:Jo(K)},le=Qy(),ce=n&&!B&&!le,[ue,de]=(0,Uo.useState)(!1),{style:fe,...me}=(0,Uo.useMemo)((()=>(e=>{const t=e.startsWith("top")||e.startsWith("bottom")?"translateY":"translateX",n=e.startsWith("top")||e.startsWith("left")?1:-1;return{style:Zo[e],initial:{opacity:0,scale:0,[t]:2*n+"em"},animate:{opacity:1,scale:1,[t]:0},transition:{duration:.1,ease:[0,0,.2,1]}}})(Q)),[Q]),pe=ce?{style:{...fe,...se},onAnimationComplete:()=>de(!0),...me}:{animate:!1,style:se},he=(!ce||ue)&&null!==Y&&null!==K,[ge,ve]=(0,Uo.useState)(!1),be=(0,Uo.useMemo)((()=>({ColorPicker:{onPickerDragStart(){ve(!0)},onPickerDragEnd(){ve(!1)}}})),[]);let ye=(0,r.createElement)(r.Fragment,null,ge&&(0,r.createElement)("div",{className:"components-popover-pointer-events-trap","aria-hidden":"true",onClick:()=>ve(!1)}),(0,r.createElement)(wh.div,{className:c()("components-popover",l,{"is-expanded":B,"is-positioned":he,[`is-${"toolbar"===D?"alternate":D}`]:D}),...pe,...R,ref:ae,...q,tabIndex:-1},B&&(0,r.createElement)(ox,null),B&&(0,r.createElement)("div",{className:"components-popover__header"},(0,r.createElement)("span",{className:"components-popover__header-title"},o),(0,r.createElement)(my,{className:"components-popover__close",icon:ex,onClick:a})),(0,r.createElement)("div",{className:"components-popover__content"},(0,r.createElement)(mi,{value:be},s)),j&&(0,r.createElement)("div",{ref:te,className:["components-popover__arrow",`is-${Q.split("-")[0]}`].join(" "),style:{left:void 0!==ee?.x&&Number.isFinite(ee.x)?`${ee.x}px`:"",top:void 0!==ee?.y&&Number.isFinite(ee.y)?`${ee.y}px`:""}},(0,r.createElement)(pw,null))));const xe=W.ref&&!_,we=k||P||g;return xe?ye=(0,r.createElement)(cw,{name:$},ye):_||(ye=(0,Uo.createPortal)((0,r.createElement)(Qx,{document},ye),(()=>{let e=document.body.querySelector("."+gw);return e||(e=document.createElement("div"),e.className=gw,document.body.append(e)),e})())),we?ye:(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{ref:L}),ye)}),"Popover");vw.Slot=(0,Uo.forwardRef)((function({name:e=mw},t){return(0,r.createElement)(uw,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})})),vw.__unstableSlotNameProvider=hw.Provider;const bw=vw;function yw(e){const t=e.useItems?e.useItems:Gy(e);return function({filterValue:e,instanceId:n,listBoxId:o,className:i,selectedIndex:a,onChangeOptions:s,onSelect:l,onReset:f,reset:m,contentRef:p}){const[h]=t(e),g=(0,By.useAnchor)({editableContentElement:p.current}),[v,b]=(0,Uo.useState)(!1),y=(0,Uo.useRef)(null),x=(0,d.useMergeRefs)([y,(0,d.useRefEffect)((e=>{p.current&&b(e.ownerDocument!==p.current.ownerDocument)}),[p])]);!function(e,t){(0,Uo.useEffect)((()=>{const n=n=>{e.current&&!e.current.contains(n.target)&&t(n)};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}}),[t])}(y,m);const w=(0,d.useDebounce)(jy.speak,500);if((0,Uo.useLayoutEffect)((()=>{s(h),function(t){w&&(t.length?w(e?(0,u.sprintf)((0,u._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",t.length),t.length):(0,u.sprintf)((0,u._n)("Initial %d result loaded. Type to filter all available results. Use up and down arrow keys to navigate.","Initial %d results loaded. Type to filter all available results. Use up and down arrow keys to navigate.",t.length),t.length),"assertive"):w((0,u.__)("No results."),"assertive"))}(h)}),[h]),0===h.length)return null;const E=({Component:e="div"})=>(0,r.createElement)(e,{id:o,role:"listbox",className:"components-autocomplete__results"},h.map(((e,t)=>(0,r.createElement)(my,{key:e.key,id:`components-autocomplete-item-${n}-${e.key}`,role:"option","aria-selected":t===a,disabled:e.isDisabled,className:c()("components-autocomplete__result",i,{"is-selected":t===a}),onClick:()=>l(e)},e.label))));return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(bw,{focusOnMount:!1,onClose:f,placement:"top-start",className:"components-autocomplete__popover",anchor:g,ref:x},(0,r.createElement)(E,null)),p.current&&v&&(0,tr.createPortal)((0,r.createElement)(E,{Component:ws}),p.current.ownerDocument.body))}}const xw=e=>{if(null===e)return"";switch(typeof e){case"string":case"number":return e.toString();case"boolean":default:return"";case"object":if(e instanceof Array)return e.map(xw).join("");if("props"in e)return xw(e.props.children)}return""},ww=[];function Ew({record:e,onChange:t,onReplace:n,completers:o,contentRef:i}){const a=(0,d.useInstanceId)(Ew),[s,l]=(0,Uo.useState)(0),[c,u]=(0,Uo.useState)(ww),[f,m]=(0,Uo.useState)(""),[p,h]=(0,Uo.useState)(null),[g,v]=(0,Uo.useState)(null),b=(0,Uo.useRef)(!1);function y(r){const{getOptionCompletion:o}=p||{};if(!r.isDisabled){if(o){const i=o(r.value,f),a=(e=>null!==e&&"object"==typeof e&&"action"in e&&void 0!==e.action&&"value"in e&&void 0!==e.value)(i)?i:{action:"insert-at-caret",value:i};if("replace"===a.action)return void n([a.value]);"insert-at-caret"===a.action&&function(n){if(null===p)return;const r=e.start,o=r-p.triggerPrefix.length-f.length,i=(0,By.create)({html:(0,Uo.renderToString)(n)});t((0,By.insert)(e,i,o,r))}(a.value)}x()}}function x(){l(0),u(ww),m(""),h(null),v(null)}const w=(0,Uo.useMemo)((()=>(0,By.isCollapsed)(e)?(0,By.getTextContent)((0,By.slice)(e,0)):""),[e]);(0,Uo.useEffect)((()=>{if(!w)return void(p&&x());const t=o.reduce(((e,t)=>w.lastIndexOf(t.triggerPrefix)>(null!==e?w.lastIndexOf(e.triggerPrefix):-1)?t:e),null);if(!t)return void(p&&x());const{allowContext:n,triggerPrefix:r}=t,i=w.lastIndexOf(r),a=w.slice(i+r.length);if(a.length>50)return;const s=0===c.length,l=a.split(/\s/),u=1===l.length,d=b.current&&l.length<=3;if(s&&!d&&!u)return void(p&&x());const f=(0,By.getTextContent)((0,By.slice)(e,void 0,(0,By.getTextContent)(e).length));if(n&&!n(w.slice(0,i),f))return void(p&&x());if(/^\s/.test(a)||/\s\s+$/.test(a))return void(p&&x());if(!/[\u0000-\uFFFF]*$/.test(a))return void(p&&x());const y=Uy(t.triggerPrefix),E=Fy()(w),_=E.slice(E.lastIndexOf(t.triggerPrefix)).match(new RegExp(`${y}([\0-]*)$`)),S=_&&_[1];h(t),v((()=>t!==p?yw(t):g)),m(null===S?"":S)}),[w]);const{key:E=""}=c[s]||{},{className:_}=p||{},S=!!p&&c.length>0,C=S?`components-autocomplete-listbox-${a}`:void 0;return{listBoxId:C,activeId:S?`components-autocomplete-item-${a}-${E}`:null,onKeyDown:function(e){if(b.current="Backspace"===e.key,p&&0!==c.length&&!e.defaultPrevented&&!e.isComposing&&229!==e.keyCode){switch(e.key){case"ArrowUp":{const e=(0===s?c.length:s)-1;l(e),(0,Vy.isAppleOS)()&&(0,jy.speak)(xw(c[e].label),"assertive");break}case"ArrowDown":{const e=(s+1)%c.length;l(e),(0,Vy.isAppleOS)()&&(0,jy.speak)(xw(c[e].label),"assertive");break}case"Escape":h(null),v(null),e.preventDefault();break;case"Enter":y(c[s]);break;case"ArrowLeft":case"ArrowRight":return void x();default:return}e.preventDefault()}},popover:void 0!==e.start&&g&&(0,r.createElement)(g,{className:_,filterValue:f,instanceId:a,listBoxId:C,selectedIndex:s,onChangeOptions:function(e){l(e.length===c.length?s:0),u(e)},onSelect:y,value:e,contentRef:i,reset:x})}}function _w(e){const t=(0,Uo.useRef)(null),n=(0,Uo.useRef)(),{record:r}=e,o=function(e){const t=(0,Uo.useRef)(new Set);return t.current.add(e),t.current.size>2&&t.current.delete(Array.from(t.current)[0]),Array.from(t.current)[0]}(r),{popover:i,listBoxId:a,activeId:s,onKeyDown:l}=Ew({...e,contentRef:t});n.current=l;const c=(0,d.useMergeRefs)([t,(0,d.useRefEffect)((e=>{function t(e){n.current?.(e)}return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[])]);return r.text!==o?.text?{ref:c,children:i,"aria-autocomplete":a?"list":void 0,"aria-owns":a,"aria-activedescendant":s}:{ref:c}}function Sw({children:e,isSelected:t,...n}){const{popover:o,...i}=Ew(n);return(0,r.createElement)(r.Fragment,null,e(i),t&&o)}function Cw(e){const{help:t,id:n,...r}=e,o=(0,d.useInstanceId)(iy,"wp-components-base-control",n);return{baseControlProps:{id:o,help:t,...r},controlProps:{id:o,...t?{["string"==typeof t?"aria-describedby":"aria-details"]:`${o}__help`}:{}}}}const kw=(0,r.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(n.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})),Pw=(0,r.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(n.Path,{d:"M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"}));const Tw=Ps("",""),Iw={name:"bjn8wh",styles:"position:relative"},Rw=e=>{const{color:t=Ds.gray[200],style:n="solid",width:r=Xg.borderWidth}=e||{};return`${t} ${!!r&&"0"!==r||!!t?n||"solid":n} ${r!==Xg.borderWidth?`clamp(1px, ${r}, 10px)`:r}`},Mw={name:"1nwbfnf",styles:"grid-column:span 2;margin:0 auto"};function Nw(e){const{className:t,size:n="default",...r}=rs(e,"BorderBoxControlLinkedButton"),o=ns();return{...r,className:(0,Uo.useMemo)((()=>o((e=>Ps("position:absolute;top:","__unstable-large"===e?"8px":"3px",";",Jh({right:0})()," line-height:0;",""))(n),t)),[t,o,n])}}const Dw=os(((e,t)=>{const{className:n,isLinked:o,...i}=Nw(e),a=o?(0,u.__)("Unlink sides"):(0,u.__)("Link sides");return(0,r.createElement)(ri,{text:a},(0,r.createElement)(xs,{className:n},(0,r.createElement)(my,{...i,size:"small",icon:o?kw:Pw,iconSize:24,"aria-label":a,ref:t})))}),"BorderBoxControlLinkedButton");function Aw(e){const{className:t,value:n,size:r="default",...o}=rs(e,"BorderBoxControlVisualizer"),i=ns(),a=(0,Uo.useMemo)((()=>i(((e,t)=>Ps("position:absolute;top:","__unstable-large"===t?"20px":"15px",";right:","__unstable-large"===t?"39px":"29px",";bottom:","__unstable-large"===t?"20px":"15px",";left:","__unstable-large"===t?"39px":"29px",";border-top:",Rw(e?.top),";border-bottom:",Rw(e?.bottom),";",Jh({borderLeft:Rw(e?.left)})()," ",Jh({borderRight:Rw(e?.right)})(),";",""))(n,r),t)),[i,t,n,r]);return{...o,className:a,value:n}}const Ow=os(((e,t)=>{const{value:n,...o}=Aw(e);return(0,r.createElement)(xs,{...o,ref:t})}),"BorderBoxControlVisualizer"),zw=(0,r.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(n.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"})),Lw=(0,r.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(n.Path,{d:"M5 11.25h14v1.5H5z"})),Fw=(0,r.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(n.Path,{fillRule:"evenodd",d:"M5 11.25h3v1.5H5v-1.5zm5.5 0h3v1.5h-3v-1.5zm8.5 0h-3v1.5h3v-1.5z",clipRule:"evenodd"})),Bw=(0,r.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(n.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"})),jw=(0,r.createContext)(null),Vw=e=>!e.isLayoutDirty&&e.willUpdate(!1);function Hw(){const e=new Set,t=new WeakMap,n=()=>e.forEach(Vw);return{add:r=>{e.add(r),t.set(r,r.addEventListener("willUpdate",n))},remove:r=>{e.delete(r);const o=t.get(r);o&&(o(),t.delete(r)),n()},dirty:n}}const $w=e=>!0===e,Ww=({children:e,id:t,inherit:n=!0})=>{const o=(0,r.useContext)(Ol),i=(0,r.useContext)(jw),[a,s]=_h(),l=(0,r.useRef)(null),c=o.id||i;null===l.current&&((e=>$w(!0===e)||"id"===e)(n)&&c&&(t=t?c+"-"+t:c),l.current={id:t,group:$w(n)&&o.group||Hw()});const u=(0,r.useMemo)((()=>({...l.current,forceRender:a})),[s]);return r.createElement(Ol.Provider,{value:u},e)};const Uw=e=>{const t=Ps("border-color:",Ds.ui.border,";","");return Ps(e&&t," &:hover{border-color:",Ds.ui.borderHover,";}&:focus-within{border-color:",Ds.ui.borderFocus,";box-shadow:",Xg.controlBoxShadowFocus,";z-index:1;outline:2px solid transparent;outline-offset:-2px;}","")};var Gw={name:"1aqh2c7",styles:"min-height:40px;padding:3px"},qw={name:"1ndywgm",styles:"min-height:36px;padding:2px"};const Yw=e=>({default:qw,"__unstable-large":Gw}[e]),Kw={name:"7whenc",styles:"display:flex;width:100%"},Xw=bs("div",{target:"eakva830"})({name:"zjik7",styles:"display:flex"});function Zw(e={}){var t,n=N(e,[]);const r=null==(t=n.store)?void 0:t.getState(),o=tl(M(R({},n),{focusLoop:V(n.focusLoop,null==r?void 0:r.focusLoop,!0)})),i=Rt(M(R({},o.getState()),{value:V(n.value,null==r?void 0:r.value,n.defaultValue,null)}),o,n.store);return M(R(R({},o),i),{setValue:e=>i.setState("value",e)})}function Jw(e={}){const[t,n]=$t(Zw,e);return function(e,t,n){return Ht(e=nl(e,t,n),n,"value","setValue"),e}(t,n,e)}var Qw=He([Ct],[kt]),eE=Qw.useContext,tE=(Qw.useScopedContext,Qw.useProviderContext),nE=(Qw.ContextProvider,Qw.ScopedContextProvider),rE=Ve((e=>{var t=e,{store:n}=t,r=E(t,["store"]);const o=tE();return F(n=n||o,!1),r=Te(r,(e=>(0,Le.jsx)(nE,{value:n,children:e})),[n]),r=x({role:"radiogroup"},r),r=il(x({store:n},r))})),oE=Fe((e=>je("div",rE(e))));const iE=(0,Uo.createContext)({}),aE=iE;function sE(e){const t=(0,Uo.useRef)(!0),n=(0,d.usePrevious)(e),r=(0,Uo.useRef)(!1);(0,Uo.useEffect)((()=>{t.current&&(t.current=!1)}),[]);const o=r.current||!t.current&&n!==e;return(0,Uo.useEffect)((()=>{r.current=o}),[o]),o?{value:null!=e?e:"",defaultValue:void 0}:{value:void 0,defaultValue:e}}const lE=(0,Uo.forwardRef)((function({children:e,isAdaptiveWidth:t,label:n,onChange:o,size:i,value:a,id:s,...l},c){const u=(0,d.useInstanceId)(lE,"toggle-group-control-as-radio-group"),f=s||u,{value:m,defaultValue:p}=sE(a),h=o?e=>{o(null!=e?e:void 0)}:void 0,g=Jw({defaultValue:p,value:m,setValue:h}),v=g.useState("value"),b=g.setValue,y=(0,Uo.useMemo)((()=>({baseId:f,isBlock:!t,size:i,value:v,setValue:b})),[f,t,i,v,b]);return(0,r.createElement)(aE.Provider,{value:y},(0,r.createElement)(oE,{store:g,"aria-label":n,render:(0,r.createElement)(xs,null),...l,id:f,ref:c},e))}));function cE({defaultValue:e,onChange:t,value:n}){const r=void 0!==n,o=r?n:e,[i,a]=(0,Uo.useState)(o);let s;return s=r&&"function"==typeof t?t:r||"function"!=typeof t?a:e=>{t(e),a(e)},[r?n:i,s]}const uE=(0,Uo.forwardRef)((function({children:e,isAdaptiveWidth:t,label:n,onChange:o,size:i,value:a,id:s,...l},c){const u=(0,d.useInstanceId)(uE,"toggle-group-control-as-button-group"),f=s||u,{value:m,defaultValue:p}=sE(a),[h,g]=cE({defaultValue:p,value:m,onChange:o}),v=(0,Uo.useMemo)((()=>({baseId:f,value:h,setValue:g,isBlock:!t,isDeselectable:!0,size:i})),[f,h,g,t,i]);return(0,r.createElement)(aE.Provider,{value:v},(0,r.createElement)(xs,{"aria-label":n,...l,ref:c,role:"group"},e))}));const dE=os((function(e,t){const{__nextHasNoMarginBottom:n=!1,__next40pxDefaultSize:o=!1,className:i,isAdaptiveWidth:a=!1,isBlock:s=!1,isDeselectable:l=!1,label:c,hideLabelFromVision:u=!1,help:f,onChange:m,size:p="default",value:h,children:g,...v}=rs(e,"ToggleGroupControl"),b=(0,d.useInstanceId)(dE,"toggle-group-control"),y=o&&"default"===p?"__unstable-large":p,x=ns(),w=(0,Uo.useMemo)((()=>x((({isBlock:e,isDeselectable:t,size:n})=>Ps("background:",Ds.ui.background,";border:1px solid transparent;border-radius:",Xg.controlBorderRadius,";display:inline-flex;min-width:0;position:relative;",Yw(n)," ",!t&&Uw(e),";",""))({isBlock:s,isDeselectable:l,size:y}),s&&Kw,i)),[i,x,s,l,y]),E=l?uE:lE;return(0,r.createElement)(iy,{help:f,__nextHasNoMarginBottom:n},!u&&(0,r.createElement)(Xw,null,(0,r.createElement)(iy.VisualLabel,null,c)),(0,r.createElement)(E,{...v,className:w,isAdaptiveWidth:a,label:c,onChange:m,ref:t,size:y,value:h},(0,r.createElement)(Ww,{id:b},g)))}),"ToggleGroupControl"),fE=dE;var mE=Ve((e=>{var t=e,{store:n,name:o,value:i,checked:a}=t,s=E(t,["store","name","value","checked"]);const l=eE();n=n||l;const c=_e(s.id),u=(0,r.useRef)(null),d=Vt(n,(e=>null!=a?a:function(e,t){if(void 0!==t)return null!=e&&null!=t?t===e:!!t}(i,null==e?void 0:e.value)));(0,r.useEffect)((()=>{if(!c)return;if(!d)return;(null==n?void 0:n.getState().activeId)===c||null==n||n.setActiveId(c)}),[n,d,c]);const f=s.onChange,m=function(e,t){return"input"===e&&(!t||"radio"===t)}(Se(u,s.as||"input"),s.type),p=j(s),[h,g]=ke();(0,r.useEffect)((()=>{const e=u.current;e&&(m||(void 0!==d&&(e.checked=d),void 0!==o&&(e.name=o),void 0!==i&&(e.value=`${i}`)))}),[h,m,d,o,i]);const v=we((e=>{if(p)return e.preventDefault(),void e.stopPropagation();m||(e.currentTarget.checked=!0,g()),null==f||f(e),e.defaultPrevented||null==n||n.setValue(i)})),b=s.onClick,y=we((e=>{null==b||b(e),e.defaultPrevented||m||v(e)})),_=s.onFocus,S=we((e=>{if(null==_||_(e),e.defaultPrevented)return;if(!m)return;if(!n)return;const{moves:t,activeId:r}=n.getState();t&&(c&&r!==c||v(e))}));return s=w(x({id:c,role:m?void 0:"radio",type:m?"radio":void 0,"aria-checked":d},s),{ref:Ee(u,s.ref),onChange:v,onClick:y,onFocus:S}),s=Gt(x({store:n,clickOnEnter:!m},s)),x({name:m?o:void 0,value:m?i:void 0,checked:d},s)})),pE=Be((e=>je("input",mE(e))));const hE=bs("div",{target:"et6ln9s1"})({name:"sln1fl",styles:"display:inline-flex;max-width:100%;min-width:0;position:relative"}),gE={name:"82a6rk",styles:"flex:1"},vE=({isDeselectable:e,isIcon:t,isPressed:n,size:r})=>Ps("align-items:center;appearance:none;background:transparent;border:none;border-radius:",Xg.controlBorderRadius,";color:",Ds.gray[700],";fill:currentColor;cursor:pointer;display:flex;font-family:inherit;height:100%;justify-content:center;line-height:100%;outline:none;padding:0 12px;position:relative;text-align:center;transition:background ",Xg.transitionDurationFast," linear,color ",Xg.transitionDurationFast," linear,font-weight 60ms linear;",As("transition")," user-select:none;width:100%;z-index:2;&::-moz-focus-inner{border:0;}&:active{background:",Xg.toggleGroupControlBackgroundColor,";}",e&&yE," ",t&&wE({size:r})," ",n&&bE,";",""),bE=Ps("color:",Ds.white,";&:active{background:transparent;}",""),yE=Ps("color:",Ds.gray[900],";&:focus{box-shadow:inset 0 0 0 1px ",Ds.white,",0 0 0 ",Xg.borderWidthFocus," ",Ds.theme.accent,";outline:2px solid transparent;}",""),xE=bs("div",{target:"et6ln9s0"})("display:flex;font-size:",Xg.fontSize,";line-height:1;"),wE=({size:e="default"})=>Ps("color:",Ds.gray[900],";height:",{default:"30px","__unstable-large":"32px"}[e],";aspect-ratio:1;padding-left:0;padding-right:0;",""),EE=Ps("background:",Ds.gray[900],";border-radius:",Xg.controlBorderRadius,";position:absolute;inset:0;z-index:1;outline:2px solid transparent;outline-offset:-3px;",""),{ButtonContentView:_E,LabelView:SE}=t,CE={duration:0},kE=({showTooltip:e,text:t,children:n})=>e&&t?(0,r.createElement)(ri,{text:t,placement:"top"},n):(0,r.createElement)(r.Fragment,null,n);const PE=os((function e(t,n){const o=Qy(),i=(0,Uo.useContext)(iE),a=rs({...t,id:(0,d.useInstanceId)(e,i.baseId||"toggle-group-control-option-base")},"ToggleGroupControlOptionBase"),{isBlock:s=!1,isDeselectable:l=!1,size:c="default"}=i,{className:u,isIcon:f=!1,value:m,children:p,showTooltip:h=!1,onFocus:g,...v}=a,b=i.value===m,y=ns(),x=(0,Uo.useMemo)((()=>y(s&&gE)),[y,s]),w=(0,Uo.useMemo)((()=>y(vE({isDeselectable:l,isIcon:f,isPressed:b,size:c}),u)),[y,l,f,b,c,u]),E=(0,Uo.useMemo)((()=>y(EE)),[y]),_={...v,className:w,"data-value":m,ref:n};return(0,r.createElement)(SE,{className:x},(0,r.createElement)(kE,{showTooltip:h,text:v["aria-label"]},l?(0,r.createElement)("button",{..._,onFocus:g,"aria-pressed":b,type:"button",onClick:()=>{l&&b?i.setValue(void 0):i.setValue(m)}},(0,r.createElement)(_E,null,p)):(0,r.createElement)(pE,{render:(0,r.createElement)("button",{type:"button",..._,onFocus:e=>{g?.(e),e.defaultPrevented||i.setValue(m)}}),value:m},(0,r.createElement)(_E,null,p))),b?(0,r.createElement)(wh.div,{className:E,transition:o?CE:void 0,role:"presentation",layoutId:"toggle-group-backdrop-shared-layout-id"}):null)}),"ToggleGroupControlOptionBase"),TE=PE;const IE=(0,Uo.forwardRef)((function(e,t){const{icon:n,label:o,...i}=e;return(0,r.createElement)(TE,{...i,isIcon:!0,"aria-label":o,showTooltip:!0,ref:t},(0,r.createElement)(uy,{icon:n}))})),RE=IE,ME=[{label:(0,u.__)("Solid"),icon:Lw,value:"solid"},{label:(0,u.__)("Dashed"),icon:Fw,value:"dashed"},{label:(0,u.__)("Dotted"),icon:Bw,value:"dotted"}];const NE=os((function({onChange:e,...t},n){return(0,r.createElement)(fE,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,ref:n,isDeselectable:!0,onChange:t=>{e?.(t)},...t},ME.map((e=>(0,r.createElement)(RE,{key:e.value,value:e.value,icon:e.icon,label:e.label}))))}),"BorderControlStylePicker");const DE=(0,Uo.forwardRef)((function(e,t){const{className:n,colorValue:o,...i}=e;return(0,r.createElement)("span",{className:c()("component-color-indicator",n),style:{background:o},ref:t,...i})}));var AE=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},OE=function(e){return.2126*AE(e.r)+.7152*AE(e.g)+.0722*AE(e.b)};function zE(e){e.prototype.luminance=function(){return e=OE(this.rgba),void 0===(t=2)&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n+0;var e,t,n},e.prototype.contrast=function(t){void 0===t&&(t="#FFF");var n,r,o,i,a,s,l,c=t instanceof e?t:new e(t);return i=this.rgba,a=c.toRgb(),n=(s=OE(i))>(l=OE(a))?(s+.05)/(l+.05):(l+.05)/(s+.05),void 0===(r=2)&&(r=0),void 0===o&&(o=Math.pow(10,r)),Math.floor(o*n)/o+0},e.prototype.isReadable=function(e,t){return void 0===e&&(e="#FFF"),void 0===t&&(t={}),this.contrast(e)>=(a=void 0===(i=(n=t).size)?"normal":i,"AAA"===(o=void 0===(r=n.level)?"AA":r)&&"normal"===a?7:"AA"===o&&"large"===a?3:4.5);var n,r,o,i,a}}const LE=os(((e,t)=>{const{renderContent:n,renderToggle:o,className:i,contentClassName:a,expandOnMobile:s,headerTitle:l,focusOnMount:u,popoverProps:f,onClose:m,onToggle:p,style:h,open:g,defaultOpen:v,position:b,variant:y}=rs(e,"Dropdown");void 0!==b&&qo()("`position` prop in wp.components.Dropdown",{since:"6.2",alternative:"`popoverProps.placement` prop",hint:"Note that the `position` prop will override any values passed through the `popoverProps.placement` prop."});const[x,w]=(0,Uo.useState)(null),E=(0,Uo.useRef)(),[_,S]=cE({defaultValue:v,value:g,onChange:p});function C(){m?.(),S(!1)}const k={isOpen:!!_,onToggle:()=>S(!_),onClose:C},P=!!(f?.anchor||f?.anchorRef||f?.getAnchorRect||f?.anchorRect);return(0,r.createElement)("div",{className:i,ref:(0,d.useMergeRefs)([E,t,w]),tabIndex:-1,style:h},o(k),_&&(0,r.createElement)(bw,{position:b,onClose:C,onFocusOutside:function(){if(!E.current)return;const{ownerDocument:e}=E.current,t=e?.activeElement?.closest('[role="dialog"]');E.current.contains(e.activeElement)||t&&!t.contains(E.current)||C()},expandOnMobile:s,headerTitle:l,focusOnMount:u,offset:13,anchor:P?void 0:x,variant:y,...f,className:c()("components-dropdown__content",f?.className,a)},n(k)))}),"Dropdown"),FE=LE;const BE=os((function(e,t){const n=rs(e,"InputControlSuffixWrapper");return(0,r.createElement)(tg,{marginBottom:0,...n,ref:t})}),"InputControlSuffixWrapper"),jE=bs("select",{target:"e1mv6sxx2"})("&&&{appearance:none;background:transparent;box-sizing:border-box;border:none;box-shadow:none!important;color:",Ds.gray[900],";display:block;font-family:inherit;margin:0;width:100%;max-width:none;cursor:pointer;white-space:nowrap;text-overflow:ellipsis;",(({disabled:e})=>e?Ps({color:Ds.ui.textDisabled},"",""):""),";",xv,";",(({__next40pxDefaultSize:e,multiple:t,selectSize:n="default"})=>{if(t)return;const r={default:{height:40,minHeight:40,paddingTop:0,paddingBottom:0},small:{height:24,minHeight:24,paddingTop:0,paddingBottom:0},compact:{height:32,minHeight:32,paddingTop:0,paddingBottom:0},"__unstable-large":{height:40,minHeight:40,paddingTop:0,paddingBottom:0}};e||(r.default=r.compact);return Ps(r[n]||r.default,"","")}),";",(({__next40pxDefaultSize:e,multiple:t,selectSize:n="default"})=>{const r={default:16,small:8,compact:8,"__unstable-large":16};e||(r.default=r.compact);const o=r[n]||r.default;return Jh({paddingLeft:o,paddingRight:o+18,...t?{paddingTop:o,paddingBottom:o}:{}})}),";",(({multiple:e})=>({overflow:e?"auto":"hidden"})),";}"),VE=bs("div",{target:"e1mv6sxx1"})("margin-inline-end:",Ah(-1),";line-height:0;"),HE=bs(BE,{target:"e1mv6sxx0"})("position:absolute;pointer-events:none;",Jh({right:0}),";");const $E=(0,Uo.forwardRef)((function({icon:e,size:t=24,...n},r){return(0,Uo.cloneElement)(e,{width:t,height:t,...n,ref:r})})),WE=(0,r.createElement)(n.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)(n.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),UE=()=>(0,r.createElement)(HE,null,(0,r.createElement)(VE,null,(0,r.createElement)($E,{icon:WE,size:18}))),GE=()=>{};const qE=(0,Uo.forwardRef)((function(e,t){const{className:n,disabled:o=!1,help:i,hideLabelFromVision:a,id:s,label:l,multiple:u=!1,onBlur:f=GE,onChange:m,onFocus:p=GE,options:h=[],size:g="default",value:v,labelPosition:b="top",children:y,prefix:x,suffix:w,__next40pxDefaultSize:E=!1,__nextHasNoMarginBottom:_=!1,...S}=Nv(e),[C,k]=(0,Uo.useState)(!1),P=function(e){const t=(0,d.useInstanceId)(qE);return e||`inspector-select-control-${t}`}(s),T=i?`${P}__help`:void 0;if(!h?.length&&!y)return null;const I=c()("components-select-control",n);return(0,r.createElement)(iy,{help:i,id:P,__nextHasNoMarginBottom:_},(0,r.createElement)(Ov,{className:I,disabled:o,hideLabelFromVision:a,id:P,isFocused:C,label:l,size:g,suffix:w||!u&&(0,r.createElement)(UE,null),prefix:x,labelPosition:b,__next40pxDefaultSize:E},(0,r.createElement)(jE,{...S,__next40pxDefaultSize:E,"aria-describedby":T,className:"components-select-control__input",disabled:o,id:P,multiple:u,onBlur:e=>{f(e),k(!1)},onChange:t=>{if(e.multiple){const n=Array.from(t.target.options).filter((({selected:e})=>e)).map((({value:e})=>e));e.onChange?.(n,{event:t})}else e.onChange?.(t.target.value,{event:t})},onFocus:e=>{p(e),k(!0)},ref:t,selectSize:g,value:v},y||h.map(((e,t)=>{const n=e.id||`${e.label}-${e.value}-${t}`;return(0,r.createElement)("option",{key:n,value:e.value,disabled:e.disabled,hidden:e.hidden},e.label)})))))})),YE=qE,KE={initial:void 0,fallback:""};const XE=function(e,t=KE){const{initial:n,fallback:r}={...KE,...t},[o,i]=(0,Uo.useState)(e),a=ag(e);return(0,Uo.useEffect)((()=>{a&&o&&i(void 0)}),[a,o]),[function(e=[],t){var n;return null!==(n=e.find(ag))&&void 0!==n?n:t}([e,o,n],r),(0,Uo.useCallback)((e=>{a||i(e)}),[a])]};function ZE(e,t,n){return"number"!=typeof e?null:parseFloat(`${wy(e,t,n)}`)}const JE=30,QE=()=>Ps({height:JE,minHeight:JE},"",""),e_=12,t_=bs("div",{target:"e1epgpqk14"})("-webkit-tap-highlight-color:transparent;align-items:center;display:flex;justify-content:flex-start;padding:0;position:relative;touch-action:none;width:100%;min-height:40px;",(({__next40pxDefaultSize:e})=>!e&&Ps({minHeight:JE},"","")),";"),n_=bs("div",{target:"e1epgpqk13"})("display:block;flex:1;position:relative;width:100%;",(({color:e=Ds.ui.borderFocus})=>Ps({color:e},"","")),";",QE,";",(({marks:e,__nextHasNoMarginBottom:t})=>t?"":Ps({marginBottom:e?16:void 0},"","")),";"),r_=bs("span",{target:"e1epgpqk12"})("display:flex;margin-top:",4,"px;",Jh({marginRight:6}),";"),o_=bs("span",{target:"e1epgpqk11"})("display:flex;margin-top:",4,"px;",Jh({marginLeft:6}),";"),i_=bs("span",{target:"e1epgpqk10"})("background-color:",Ds.gray[300],";left:0;pointer-events:none;right:0;display:block;height:",4,"px;position:absolute;margin-top:",13,"px;top:0;border-radius:",4,"px;",(({disabled:e,railColor:t})=>{let n=t||"";return e&&(n=Ds.ui.backgroundDisabled),Ps({background:n},"","")}),";"),a_=bs("span",{target:"e1epgpqk9"})("background-color:currentColor;border-radius:",4,"px;height:",4,"px;pointer-events:none;display:block;position:absolute;margin-top:",13,"px;top:0;",(({disabled:e,trackColor:t})=>{let n=t||"currentColor";return e&&(n=Ds.gray[400]),Ps({background:n},"","")}),";"),s_=bs("span",{target:"e1epgpqk8"})({name:"l7tjj5",styles:"display:block;pointer-events:none;position:relative;width:100%;user-select:none"}),l_=bs("span",{target:"e1epgpqk7"})("height:",e_,"px;left:0;position:absolute;top:-4px;width:1px;",(({disabled:e,isFilled:t})=>{let n=t?"currentColor":Ds.gray[300];return e&&(n=Ds.gray[400]),Ps({backgroundColor:n},"","")}),";"),c_=bs("span",{target:"e1epgpqk6"})("color:",Ds.gray[300],";left:0;font-size:11px;position:absolute;top:12px;transform:translateX( -50% );white-space:nowrap;",(({isFilled:e})=>Ps({color:e?Ds.gray[700]:Ds.gray[300]},"","")),";"),u_=({disabled:e})=>Ps("background-color:",e?Ds.gray[400]:Ds.theme.accent,";",""),d_=bs("span",{target:"e1epgpqk5"})("align-items:center;display:flex;height:",e_,"px;justify-content:center;margin-top:",9,"px;outline:0;pointer-events:none;position:absolute;top:0;user-select:none;width:",e_,"px;border-radius:50%;",u_,";",Jh({marginLeft:-10}),";",Jh({transform:"translateX( 4.5px )"},{transform:"translateX( -4.5px )"}),";"),f_=bs("span",{target:"e1epgpqk4"})("align-items:center;border-radius:50%;height:100%;outline:0;position:absolute;user-select:none;width:100%;",u_,";",(({isFocused:e})=>e?Ps("&::before{content:' ';position:absolute;background-color:",Ds.theme.accent,";opacity:0.4;border-radius:50%;height:",20,"px;width:",20,"px;top:-4px;left:-4px;}",""):""),";"),m_=bs("input",{target:"e1epgpqk3"})("box-sizing:border-box;cursor:pointer;display:block;height:100%;left:0;margin:0 -",6,"px;opacity:0;outline:none;position:absolute;right:0;top:0;width:calc( 100% + ",e_,"px );");var p_={name:"1cypxip",styles:"top:-80%"},h_={name:"1lr98c4",styles:"bottom:-80%"};const g_=bs("span",{target:"e1epgpqk2"})("background:rgba( 0, 0, 0, 0.8 );border-radius:2px;color:white;display:inline-block;font-size:12px;min-width:32px;opacity:0;padding:4px 8px;pointer-events:none;position:absolute;text-align:center;transition:opacity 120ms ease;user-select:none;line-height:1.4;",(({show:e})=>Ps({opacity:e?1:0},"","")),";",(({position:e})=>"bottom"===e?h_:p_),";",As("transition"),";",Jh({transform:"translateX(-50%)"},{transform:"translateX(50%)"}),";"),v_=bs(Ry,{target:"e1epgpqk1"})("display:inline-block;font-size:13px;margin-top:0;input[type='number']&{",QE,";}",Jh({marginLeft:`${Ah(4)} !important`}),";"),b_=bs("span",{target:"e1epgpqk0"})("display:block;margin-top:0;button,button.is-small{margin-left:0;",QE,";}",Jh({marginLeft:8}),";");const y_=(0,Uo.forwardRef)((function(e,t){const{describedBy:n,label:o,value:i,...a}=e;return(0,r.createElement)(m_,{...a,"aria-describedby":n,"aria-label":o,"aria-hidden":!1,ref:t,tabIndex:0,type:"range",value:i})}));function x_(e){const{className:t,isFilled:n=!1,label:o,style:i={},...a}=e,s=c()("components-range-control__mark",n&&"is-filled",t),l=c()("components-range-control__mark-label",n&&"is-filled");return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(l_,{...a,"aria-hidden":"true",className:s,isFilled:n,style:i}),o&&(0,r.createElement)(c_,{"aria-hidden":"true",className:l,isFilled:n,style:i},o))}function w_(e){const{disabled:t=!1,marks:n=!1,min:o=0,max:i=100,step:a=1,value:s=0,...l}=e;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i_,{disabled:t,...l}),n&&(0,r.createElement)(E_,{disabled:t,marks:n,min:o,max:i,step:a,value:s}))}function E_(e){const{disabled:t=!1,marks:n=!1,min:o=0,max:i=100,step:a=1,value:s=0}=e,l=function({marks:e,min:t=0,max:n=100,step:r=1,value:o=0}){if(!e)return[];const i=n-t;if(!Array.isArray(e)){e=[];const n=1+Math.round(i/r);for(;n>e.push({value:r*e.length+t}););}const a=[];return e.forEach(((e,r)=>{if(e.value<t||e.value>n)return;const s=`mark-${r}`,l=e.value<=o,c=(e.value-t)/i*100+"%",d={[(0,u.isRTL)()?"right":"left"]:c};a.push({...e,isFilled:l,key:s,style:d})})),a}({marks:n,min:o,max:i,step:"any"===a?1:a,value:s});return(0,r.createElement)(s_,{"aria-hidden":"true",className:"components-range-control__marks"},l.map((e=>(0,r.createElement)(x_,{...e,key:e.key,"aria-hidden":"true",disabled:t}))))}function __(e){const{className:t,inputRef:n,tooltipPosition:o,show:i=!1,style:a={},value:s=0,renderTooltipContent:l=(e=>e),zIndex:u=100,...d}=e,f=function({inputRef:e,tooltipPosition:t}){const[n,r]=(0,Uo.useState)(),o=(0,Uo.useCallback)((()=>{e&&e.current&&r(t)}),[t,e]);return(0,Uo.useEffect)((()=>{o()}),[o]),(0,Uo.useEffect)((()=>(window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}))),n}({inputRef:n,tooltipPosition:o}),m=c()("components-simple-tooltip",t),p={...a,zIndex:u};return(0,r.createElement)(g_,{...d,"aria-hidden":i,className:m,position:f,show:i,role:"tooltip",style:p},l(s))}const S_=()=>{};const C_=(0,Uo.forwardRef)((function e(t,n){const{__nextHasNoMarginBottom:o=!1,afterIcon:i,allowReset:a=!1,beforeIcon:s,className:l,color:f=Ds.theme.accent,currentInput:m,disabled:p=!1,help:h,hideLabelFromVision:g=!1,initialPosition:v,isShiftStepEnabled:b=!0,label:y,marks:x=!1,max:w=100,min:E=0,onBlur:_=S_,onChange:S=S_,onFocus:C=S_,onMouseLeave:k=S_,onMouseMove:P=S_,railColor:T,renderTooltipContent:I=(e=>e),resetFallbackValue:R,__next40pxDefaultSize:M=!1,shiftStep:N=10,showTooltip:D,step:A=1,trackColor:O,value:z,withInputField:L=!0,...F}=t,[B,j]=function(e){const{min:t,max:n,value:r,initial:o}=e,[i,a]=XE(ZE(r,t,n),{initial:ZE(null!=o?o:null,t,n),fallback:null});return[i,(0,Uo.useCallback)((e=>{a(null===e?null:ZE(e,t,n))}),[t,n,a])]}({min:E,max:w,value:null!=z?z:null,initial:v}),V=(0,Uo.useRef)(!1);let H=D,$=L;"any"===A&&(H=!1,$=!1);const[W,U]=(0,Uo.useState)(H),[G,q]=(0,Uo.useState)(!1),Y=(0,Uo.useRef)(),K=Y.current?.matches(":focus"),X=!p&&G,Z=null===B,J=Z?"":void 0!==B?B:m,Q=Z?(w-E)/2+E:B,ee=`${wy(Z?50:(B-E)/(w-E)*100,0,100)}%`,te=c()("components-range-control",l),ne=c()("components-range-control__wrapper",!!x&&"is-marked"),re=(0,d.useInstanceId)(e,"inspector-range-control"),oe=h?`${re}__help`:void 0,ie=!1!==H&&Number.isFinite(B),ae=()=>{let e=parseFloat(`${R}`),t=e;isNaN(e)&&(e=null,t=void 0),j(e),S(t)},se={[(0,u.isRTL)()?"right":"left"]:ee};return(0,r.createElement)(iy,{__nextHasNoMarginBottom:o,className:te,label:y,hideLabelFromVision:g,id:`${re}`,help:h},(0,r.createElement)(t_,{className:"components-range-control__root",__next40pxDefaultSize:M},s&&(0,r.createElement)(r_,null,(0,r.createElement)(uy,{icon:s})),(0,r.createElement)(n_,{__nextHasNoMarginBottom:o,className:ne,color:f,marks:!!x},(0,r.createElement)(y_,{...F,className:"components-range-control__slider",describedBy:oe,disabled:p,id:`${re}`,label:y,max:w,min:E,onBlur:e=>{_(e),q(!1),U(!1)},onChange:e=>{const t=parseFloat(e.target.value);j(t),S(t)},onFocus:e=>{C(e),q(!0),U(!0)},onMouseMove:P,onMouseLeave:k,ref:(0,d.useMergeRefs)([Y,n]),step:A,value:null!=J?J:void 0}),(0,r.createElement)(w_,{"aria-hidden":!0,disabled:p,marks:x,max:w,min:E,railColor:T,step:A,value:Q}),(0,r.createElement)(a_,{"aria-hidden":!0,className:"components-range-control__track",disabled:p,style:{width:ee},trackColor:O}),(0,r.createElement)(d_,{className:"components-range-control__thumb-wrapper",style:se,disabled:p},(0,r.createElement)(f_,{"aria-hidden":!0,isFocused:X,disabled:p})),ie&&(0,r.createElement)(__,{className:"components-range-control__tooltip",inputRef:Y,tooltipPosition:"bottom",renderTooltipContent:I,show:K||W,style:se,value:B})),i&&(0,r.createElement)(o_,null,(0,r.createElement)(uy,{icon:i})),$&&(0,r.createElement)(v_,{"aria-label":y,className:"components-range-control__number",disabled:p,inputMode:"decimal",isShiftStepEnabled:b,max:w,min:E,onBlur:()=>{V.current&&(ae(),V.current=!1)},onChange:e=>{let t=parseFloat(e);j(t),isNaN(t)?a&&(V.current=!0):((t<E||t>w)&&(t=ZE(t,E,w)),S(t),V.current=!1)},shiftStep:N,size:M?"__unstable-large":"default",__unstableInputWidth:Ah(M?20:16),step:A,value:J}),a&&(0,r.createElement)(b_,null,(0,r.createElement)(my,{className:"components-range-control__reset",disabled:p||void 0===B,variant:"secondary",size:"small",onClick:ae},(0,u.__)("Reset")))))})),k_=C_,P_=bs(Ry,{target:"ez9hsf47"})(yv,"{width:",Ah(24),";}"),T_=bs(YE,{target:"ez9hsf46"})("margin-left:",Ah(-2),";width:5em;select:not( :focus )~",kv,kv,kv,"{border-color:transparent;}"),I_=bs(k_,{target:"ez9hsf45"})("flex:1;margin-right:",Ah(2),";"),R_=`\n.react-colorful__interactive {\n\twidth: calc( 100% - ${Ah(2)} );\n\tmargin-left: ${Ah(1)};\n}`,M_=bs("div",{target:"ez9hsf44"})("padding-top:",Ah(2),";padding-right:0;padding-left:0;padding-bottom:0;"),N_=bs(Py,{target:"ez9hsf43"})("padding-left:",Ah(4),";padding-right:",Ah(4),";"),D_=bs($h,{target:"ez9hsf42"})("padding-top:",Ah(4),";padding-left:",Ah(4),";padding-right:",Ah(3),";padding-bottom:",Ah(5),";"),A_=bs("div",{target:"ez9hsf41"})(Kb,";width:216px;.react-colorful{display:flex;flex-direction:column;align-items:center;width:216px;height:auto;}.react-colorful__saturation{width:100%;border-radius:0;height:216px;margin-bottom:",Ah(4),";border-bottom:none;}.react-colorful__hue,.react-colorful__alpha{width:184px;height:16px;border-radius:16px;margin-bottom:",Ah(2),";}.react-colorful__pointer{height:16px;width:16px;border:none;box-shadow:0 0 2px 0 rgba( 0, 0, 0, 0.25 );outline:2px solid transparent;}.react-colorful__pointer-fill{box-shadow:inset 0 0 0 ",Xg.borderWidthFocus," #fff;}",R_,";"),O_=bs(my,{target:"ez9hsf40"})("&&&&&{min-width:",Ah(6),";padding:0;>svg{margin-right:0;}}"),z_=(0,r.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(n.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"})),L_=e=>{const{color:t,colorType:n}=e,[o,i]=(0,Uo.useState)(null),a=(0,Uo.useRef)(),s=(0,d.useCopyToClipboard)((()=>{switch(n){case"hsl":return t.toHslString();case"rgb":return t.toRgbString();default:return t.toHex()}}),(()=>{a.current&&clearTimeout(a.current),i(t.toHex()),a.current=setTimeout((()=>{i(null),a.current=void 0}),3e3)}));return(0,Uo.useEffect)((()=>()=>{a.current&&clearTimeout(a.current)}),[]),(0,r.createElement)(ri,{delay:0,hideOnClick:!1,text:o===t.toHex()?(0,u.__)("Copied!"):(0,u.__)("Copy")},(0,r.createElement)(O_,{size:"small",ref:s,icon:z_,showTooltip:!1}))},F_=({min:e,max:t,label:n,abbreviation:o,onChange:i,value:a})=>(0,r.createElement)(Py,{spacing:4},(0,r.createElement)(P_,{min:e,max:t,label:n,hideLabelFromVision:!0,value:a,onChange:e=>{i(e?"string"!=typeof e?e:parseInt(e,10):0)},prefix:(0,r.createElement)(tg,{as:mv,paddingLeft:Ah(4),color:Ds.theme.accent,lineHeight:1},o),spinControls:"none",size:"__unstable-large"}),(0,r.createElement)(I_,{__nextHasNoMarginBottom:!0,label:n,hideLabelFromVision:!0,min:e,max:t,value:a,onChange:i,withInputField:!1})),B_=({color:e,onChange:t,enableAlpha:n})=>{const{r:o,g:i,b:a,a:s}=e.toRgb();return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(F_,{min:0,max:255,label:"Red",abbreviation:"R",value:o,onChange:e=>t(Bg({r:e,g:i,b:a,a:s}))}),(0,r.createElement)(F_,{min:0,max:255,label:"Green",abbreviation:"G",value:i,onChange:e=>t(Bg({r:o,g:e,b:a,a:s}))}),(0,r.createElement)(F_,{min:0,max:255,label:"Blue",abbreviation:"B",value:a,onChange:e=>t(Bg({r:o,g:i,b:e,a:s}))}),n&&(0,r.createElement)(F_,{min:0,max:100,label:"Alpha",abbreviation:"A",value:Math.trunc(100*s),onChange:e=>t(Bg({r:o,g:i,b:a,a:e/100}))}))},j_=({color:e,onChange:t,enableAlpha:n})=>{const o=(0,Uo.useMemo)((()=>e.toHsl()),[e]),[i,a]=(0,Uo.useState)({...o}),s=e.isEqual(Bg(i));(0,Uo.useEffect)((()=>{s||a(o)}),[o,s]);const l=s?i:o,c=n=>{const r=Bg({...l,...n});e.isEqual(r)?a((e=>({...e,...n}))):t(r)};return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(F_,{min:0,max:359,label:"Hue",abbreviation:"H",value:l.h,onChange:e=>{c({h:e})}}),(0,r.createElement)(F_,{min:0,max:100,label:"Saturation",abbreviation:"S",value:l.s,onChange:e=>{c({s:e})}}),(0,r.createElement)(F_,{min:0,max:100,label:"Lightness",abbreviation:"L",value:l.l,onChange:e=>{c({l:e})}}),n&&(0,r.createElement)(F_,{min:0,max:100,label:"Alpha",abbreviation:"A",value:Math.trunc(100*l.a),onChange:e=>{c({a:e/100})}}))},V_=({color:e,onChange:t,enableAlpha:n})=>(0,r.createElement)(sy,{prefix:(0,r.createElement)(tg,{as:mv,marginLeft:Ah(4),color:Ds.theme.accent,lineHeight:1},"#"),value:e.toHex().slice(1).toUpperCase(),onChange:e=>{if(!e)return;const n=e.startsWith("#")?e:"#"+e;t(Bg(n))},maxLength:n?9:7,label:(0,u.__)("Hex color"),hideLabelFromVision:!0,size:"__unstable-large",__unstableStateReducer:(e,t)=>{const n=t.payload?.event?.nativeEvent;if("insertFromPaste"!==n?.inputType)return{...e};const r=e.value?.startsWith("#")?e.value.slice(1).toUpperCase():e.value?.toUpperCase();return{...e,value:r}},__unstableInputWidth:"9em"}),H_=({colorType:e,color:t,onChange:n,enableAlpha:o})=>{const i={color:t,onChange:n,enableAlpha:o};switch(e){case"hsl":return(0,r.createElement)(j_,{...i});case"rgb":return(0,r.createElement)(B_,{...i});default:return(0,r.createElement)(V_,{...i})}};function $_(){return($_=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function W_(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}function U_(e){var t=(0,r.useRef)(e),n=(0,r.useRef)((function(e){t.current&&t.current(e)}));return t.current=e,n.current}var G_=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),e>n?n:e<t?t:e},q_=function(e){return"touches"in e},Y_=function(e){return e&&e.ownerDocument.defaultView||self},K_=function(e,t,n){var r=e.getBoundingClientRect(),o=q_(t)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return e[0]}(t.touches,n):t;return{left:G_((o.pageX-(r.left+Y_(e).pageXOffset))/r.width),top:G_((o.pageY-(r.top+Y_(e).pageYOffset))/r.height)}},X_=function(e){!q_(e)&&e.preventDefault()},Z_=r.memo((function(e){var t=e.onMove,n=e.onKey,o=W_(e,["onMove","onKey"]),i=(0,r.useRef)(null),a=U_(t),s=U_(n),l=(0,r.useRef)(null),c=(0,r.useRef)(!1),u=(0,r.useMemo)((function(){var e=function(e){X_(e),(q_(e)?e.touches.length>0:e.buttons>0)&&i.current?a(K_(i.current,e,l.current)):n(!1)},t=function(){return n(!1)};function n(n){var r=c.current,o=Y_(i.current),a=n?o.addEventListener:o.removeEventListener;a(r?"touchmove":"mousemove",e),a(r?"touchend":"mouseup",t)}return[function(e){var t=e.nativeEvent,r=i.current;if(r&&(X_(t),!function(e,t){return t&&!q_(e)}(t,c.current)&&r)){if(q_(t)){c.current=!0;var o=t.changedTouches||[];o.length&&(l.current=o[0].identifier)}r.focus(),a(K_(r,t,l.current)),n(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),s({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},n]}),[s,a]),d=u[0],f=u[1],m=u[2];return(0,r.useEffect)((function(){return m}),[m]),r.createElement("div",$_({},o,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:i,onKeyDown:f,tabIndex:0,role:"slider"}))})),J_=function(e){return e.filter(Boolean).join(" ")},Q_=function(e){var t=e.color,n=e.left,o=e.top,i=void 0===o?.5:o,a=J_(["react-colorful__pointer",e.className]);return r.createElement("div",{className:a,style:{top:100*i+"%",left:100*n+"%"}},r.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},eS=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*e)/n},tS=(Math.PI,function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:eS(e.h),s:eS(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:eS(o/2),a:eS(r,2)}}),nS=function(e){var t=tS(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},rS=function(e){var t=tS(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},oS=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var i=Math.floor(t),a=r*(1-n),s=r*(1-(t-i)*n),l=r*(1-(1-t+i)*n),c=i%6;return{r:eS(255*[r,s,a,a,l,r][c]),g:eS(255*[l,r,r,s,a,a][c]),b:eS(255*[a,a,l,r,r,s][c]),a:eS(o,2)}},iS=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?sS({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)}):{h:0,s:0,v:0,a:1}},aS=iS,sS=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,i=Math.max(t,n,r),a=i-Math.min(t,n,r),s=a?i===t?(n-r)/a:i===n?2+(r-t)/a:4+(t-n)/a:0;return{h:eS(60*(s<0?s+6:s)),s:eS(i?a/i*100:0),v:eS(i/255*100),a:o}},lS=r.memo((function(e){var t=e.hue,n=e.onChange,o=J_(["react-colorful__hue",e.className]);return r.createElement("div",{className:o},r.createElement(Z_,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:G_(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":eS(t),"aria-valuemax":"360","aria-valuemin":"0"},r.createElement(Q_,{className:"react-colorful__hue-pointer",left:t/360,color:nS({h:t,s:100,v:100,a:1})})))})),cS=r.memo((function(e){var t=e.hsva,n=e.onChange,o={backgroundColor:nS({h:t.h,s:100,v:100,a:1})};return r.createElement("div",{className:"react-colorful__saturation",style:o},r.createElement(Z_,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:G_(t.s+100*e.left,0,100),v:G_(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+eS(t.s)+"%, Brightness "+eS(t.v)+"%"},r.createElement(Q_,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:nS(t)})))})),uS=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},dS=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function fS(e,t,n){var o=U_(n),i=(0,r.useState)((function(){return e.toHsva(t)})),a=i[0],s=i[1],l=(0,r.useRef)({color:t,hsva:a});(0,r.useEffect)((function(){if(!e.equal(t,l.current.color)){var n=e.toHsva(t);l.current={hsva:n,color:t},s(n)}}),[t,e]),(0,r.useEffect)((function(){var t;uS(a,l.current.hsva)||e.equal(t=e.fromHsva(a),l.current.color)||(l.current={hsva:a,color:t},o(t))}),[a,e,o]);var c=(0,r.useCallback)((function(e){s((function(t){return Object.assign({},t,e)}))}),[]);return[a,c]}var mS,pS="undefined"!=typeof window?r.useLayoutEffect:r.useEffect,hS=new Map,gS=function(e){pS((function(){var t=e.current?e.current.ownerDocument:document;if(void 0!==t&&!hS.has(t)){var n=t.createElement("style");n.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',hS.set(t,n);var r=mS||o.nc;r&&n.setAttribute("nonce",r),t.head.appendChild(n)}}),[])},vS=function(e){var t=e.className,n=e.colorModel,o=e.color,i=void 0===o?n.defaultColor:o,a=e.onChange,s=W_(e,["className","colorModel","color","onChange"]),l=(0,r.useRef)(null);gS(l);var c=fS(n,i,a),u=c[0],d=c[1],f=J_(["react-colorful",t]);return r.createElement("div",$_({},s,{ref:l,className:f}),r.createElement(cS,{hsva:u,onChange:d}),r.createElement(lS,{hue:u.h,onChange:d,className:"react-colorful__last-control"}))},bS=function(e){var t=e.className,n=e.hsva,o=e.onChange,i={backgroundImage:"linear-gradient(90deg, "+rS(Object.assign({},n,{a:0}))+", "+rS(Object.assign({},n,{a:1}))+")"},a=J_(["react-colorful__alpha",t]),s=eS(100*n.a);return r.createElement("div",{className:a},r.createElement("div",{className:"react-colorful__alpha-gradient",style:i}),r.createElement(Z_,{onMove:function(e){o({a:e.left})},onKey:function(e){o({a:G_(n.a+e.left)})},"aria-label":"Alpha","aria-valuetext":s+"%","aria-valuenow":s,"aria-valuemin":"0","aria-valuemax":"100"},r.createElement(Q_,{className:"react-colorful__alpha-pointer",left:n.a,color:rS(n)})))},yS=function(e){var t=e.className,n=e.colorModel,o=e.color,i=void 0===o?n.defaultColor:o,a=e.onChange,s=W_(e,["className","colorModel","color","onChange"]),l=(0,r.useRef)(null);gS(l);var c=fS(n,i,a),u=c[0],d=c[1],f=J_(["react-colorful",t]);return r.createElement("div",$_({},s,{ref:l,className:f}),r.createElement(cS,{hsva:u,onChange:d}),r.createElement(lS,{hue:u.h,onChange:d}),r.createElement(bS,{hsva:u,onChange:d,className:"react-colorful__last-control"}))},xS={defaultColor:"rgba(0, 0, 0, 1)",toHsva:iS,fromHsva:function(e){var t=oS(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:dS},wS=function(e){return r.createElement(yS,$_({},e,{colorModel:xS}))},ES={defaultColor:"rgb(0, 0, 0)",toHsva:aS,fromHsva:function(e){var t=oS(e);return"rgb("+t.r+", "+t.g+", "+t.b+")"},equal:dS},_S=function(e){return r.createElement(vS,$_({},e,{colorModel:ES}))};const SS=({color:e,enableAlpha:t,onChange:n,onDragStart:o,onDragEnd:i,containerEl:a})=>{const s=t?wS:_S,l=(0,Uo.useMemo)((()=>e.toRgbString()),[e]);return(({containerEl:e,onDragStart:t,onDragEnd:n})=>{const r=(0,Uo.useRef)(!1),o=(0,Uo.useRef)(!1);(0,Uo.useEffect)((()=>{if(!e||!t&&!n)return;const i=[e.querySelector(".react-colorful__saturation"),e.querySelector(".react-colorful__hue"),e.querySelector(".react-colorful__alpha")].filter((e=>!!e));if(0===i.length)return;const a=e.ownerDocument,s=e=>{r.current=!1,o.current=!1,n?.(e)},l=e=>{r.current=!0,t?.(e)},c=e=>{const t=0===e.buttons;o.current&&t&&s(e)};return i.forEach((e=>e.addEventListener("pointerdown",l))),a.addEventListener("pointerup",s),a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",(()=>{o.current=r.current})),()=>{i.forEach((e=>e.removeEventListener("pointerdown",l))),a.removeEventListener("pointerup",s),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",s)}}),[t,n,e])})({containerEl:a,onDragStart:o,onDragEnd:i}),(0,r.createElement)(s,{color:l,onChange:e=>{n(Bg(e))}})};Vg([Hg]);const CS=[{label:"RGB",value:"rgb"},{label:"HSL",value:"hsl"},{label:"Hex",value:"hex"}],kS=os(((e,t)=>{const{enableAlpha:n=!1,color:o,onChange:i,defaultValue:a="#fff",copyFormat:s,onPickerDragStart:l,onPickerDragEnd:c,...f}=rs(e,"ColorPicker"),[m,p]=(0,Uo.useState)(null),[h,g]=cE({onChange:i,value:o,defaultValue:a}),v=(0,Uo.useMemo)((()=>Bg(h||"")),[h]),b=(0,d.useDebounce)(g),y=(0,Uo.useCallback)((e=>{b(e.toHex())}),[b]),[x,w]=(0,Uo.useState)(s||"hex");return(0,r.createElement)(A_,{ref:(0,d.useMergeRefs)([e=>{p(e)},t]),...f},(0,r.createElement)(SS,{containerEl:m,onChange:y,color:v,enableAlpha:n,onDragStart:l,onDragEnd:c}),(0,r.createElement)(M_,null,(0,r.createElement)(N_,{justify:"space-between"},(0,r.createElement)(T_,{__nextHasNoMarginBottom:!0,options:CS,value:x,onChange:e=>w(e),label:(0,u.__)("Color format"),hideLabelFromVision:!0}),(0,r.createElement)(L_,{color:v,colorType:s||x})),(0,r.createElement)(D_,{direction:"column",gap:2},(0,r.createElement)(H_,{colorType:x,color:v,onChange:y,enableAlpha:n}))))}),"ColorPicker"),PS=kS;function TS(e){if(void 0!==e)return"string"==typeof e?e:e.hex?e.hex:void 0}const IS=Si((e=>{const t=Bg(e),n=t.toHex(),r=t.toRgb(),o=t.toHsv(),i=t.toHsl();return{hex:n,rgb:r,hsv:o,hsl:i,source:"hex",oldHue:i.h}}));function RS(e){const{onChangeComplete:t}=e,n=(0,Uo.useCallback)((e=>{t(IS(e))}),[t]);return function(e){return void 0!==e.onChangeComplete||void 0!==e.disableAlpha||"string"==typeof e.color?.hex}(e)?{color:TS(e.color),enableAlpha:!e.disableAlpha,onChange:n}:{...e,color:e.color,enableAlpha:e.enableAlpha,onChange:e.onChange}}const MS=e=>(0,r.createElement)(PS,{...RS(e)}),NS=(0,Uo.createContext)({}),DS=(0,r.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(n.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}));const AS=(0,Uo.forwardRef)((function(e,t){const{isPressed:n,...o}=e;return(0,r.createElement)(my,{...o,"aria-pressed":n,ref:t})}));const OS=(0,Uo.forwardRef)((function(e,t){const{id:n,isSelected:o,compositeStore:i,...a}=e,s=i.useState("activeId");return o&&!s&&i.setActiveId(n),(0,r.createElement)(qt,{render:(0,r.createElement)(my,{...a,role:"option","aria-selected":!!o,ref:t}),store:i,id:n})}));function zS(e){const{actions:t,options:n,baseId:o,className:i,loop:a=!0,children:s,...l}=e,c=rl({focusLoop:a,rtl:(0,u.isRTL)()}),d={baseId:o,compositeStore:c};return(0,r.createElement)("div",{className:i},(0,r.createElement)(NS.Provider,{value:d},(0,r.createElement)(al,{...l,id:o,store:c,role:"listbox"},n),s,t))}function LS(e){const{actions:t,options:n,children:o,baseId:i,...a}=e;return(0,r.createElement)("div",{...a,id:i},(0,r.createElement)(NS.Provider,{value:{baseId:i}},n,o,t))}function FS(e){const{asButtons:t,actions:n,options:o,children:i,className:a,...s}=e,l=(0,d.useInstanceId)(FS,"components-circular-option-picker",s.id),u=t?LS:zS,f=n?(0,r.createElement)("div",{className:"components-circular-option-picker__custom-clear-wrapper"},n):void 0,m=(0,r.createElement)("div",{className:"components-circular-option-picker__swatches"},o);return(0,r.createElement)(u,{...s,baseId:l,className:c()("components-circular-option-picker",a),actions:f,options:m},i)}FS.Option=function e({className:t,isSelected:n,selectedIconProps:o={},tooltipText:i,...a}){const{baseId:s,compositeStore:l}=(0,Uo.useContext)(NS),u={id:(0,d.useInstanceId)(e,s||"components-circular-option-picker__option"),className:"components-circular-option-picker__option",...a},f=l?(0,r.createElement)(OS,{...u,compositeStore:l,isSelected:n}):(0,r.createElement)(AS,{...u,isPressed:n});return(0,r.createElement)("div",{className:c()(t,"components-circular-option-picker__option-wrapper")},i?(0,r.createElement)(ri,{text:i},f):f,n&&(0,r.createElement)($E,{icon:DS,...o}))},FS.OptionGroup=function({className:e,options:t,...n}){const o="aria-label"in n||"aria-labelledby"in n?"group":void 0;return(0,r.createElement)("div",{...n,role:o,className:c()("components-circular-option-picker__option-group","components-circular-option-picker__swatches",e)},t)},FS.ButtonAction=function({className:e,children:t,...n}){return(0,r.createElement)(my,{className:c()("components-circular-option-picker__clear",e),variant:"tertiary",...n},t)},FS.DropdownLinkAction=function({buttonProps:e,className:t,dropdownProps:n,linkText:o}){return(0,r.createElement)(FE,{className:c()("components-circular-option-picker__dropdown-link-action",t),renderToggle:({isOpen:t,onToggle:n})=>(0,r.createElement)(my,{"aria-expanded":t,"aria-haspopup":"true",onClick:n,variant:"link",...e},o),...n})};const BS=FS;const jS=os((function(e,t){const n=function(e){const{expanded:t=!1,alignment:n="stretch",...r}=rs(e,"VStack");return ky({direction:"column",expanded:t,alignment:n,...r})}(e);return(0,r.createElement)(xs,{...n,ref:t})}),"VStack");const VS=os((function(e,t){const n=fg(e);return(0,r.createElement)(xs,{as:"span",...n,ref:t})}),"Truncate");const HS=os((function(e,t){const n=function(e){const{as:t,level:n=2,color:r=Ds.gray[900],isBlock:o=!0,weight:i=Xg.fontWeightHeading,...a}=rs(e,"Heading"),s=t||`h${n}`,l={};return"string"==typeof s&&"h"!==s[0]&&(l.role="heading",l["aria-level"]="string"==typeof n?parseInt(n):n),{...fv({color:r,isBlock:o,weight:i,size:uv(n),...a}),...l,as:s}}(e);return(0,r.createElement)(xs,{...n,ref:t})}),"Heading"),$S=HS;const WS=bs($S,{target:"ev9wop70"})({name:"13lxv2o",styles:"text-transform:uppercase;line-height:24px;font-weight:500;&&&{font-size:11px;margin-bottom:0;}"}),US=bs("div",{target:"eovvns30"})("margin-left:",Ah(-2),";margin-right:",Ah(-2),";&:first-of-type{margin-top:",Ah(-2),";}&:last-of-type{margin-bottom:",Ah(-2),";}",(({paddingSize:e="small"})=>{if("none"===e)return;const t={small:Ah(2),medium:Ah(4)};return Ps("padding:",t[e]||t.small,";","")}),";");const GS=os((function(e,t){const{paddingSize:n="small",...o}=rs(e,"DropdownContentWrapper");return(0,r.createElement)(US,{...o,paddingSize:n,ref:t})}),"DropdownContentWrapper");Vg([Hg,zE]);const qS=e=>e.length>0&&e.every((e=>{return t=e,Array.isArray(t.colors)&&!("color"in t);var t}));function YS({className:e,clearColor:t,colors:n,onChange:o,value:i,...a}){const s=(0,Uo.useMemo)((()=>n.map((({color:e,name:n},a)=>{const s=Bg(e),l=i===e;return(0,r.createElement)(BS.Option,{key:`${e}-${a}`,isSelected:l,selectedIconProps:l?{fill:s.contrast()>s.contrast("#000")?"#fff":"#000"}:{},tooltipText:n||(0,u.sprintf)((0,u.__)("Color code: %s"),e),style:{backgroundColor:e,color:e},onClick:l?t:()=>o(e,a),"aria-label":n?(0,u.sprintf)((0,u.__)("Color: %s"),n):(0,u.sprintf)((0,u.__)("Color code: %s"),e)})}))),[n,i,o,t]);return(0,r.createElement)(BS.OptionGroup,{className:e,options:s,...a})}function KS({className:e,clearColor:t,colors:n,onChange:o,value:i,headingLevel:a}){const s=(0,d.useInstanceId)(KS,"color-palette");return 0===n.length?null:(0,r.createElement)(jS,{spacing:3,className:e},n.map((({name:e,colors:n},l)=>{const c=`${s}-${l}`;return(0,r.createElement)(jS,{spacing:2,key:l},(0,r.createElement)(WS,{id:c,level:a},e),(0,r.createElement)(YS,{clearColor:t,colors:n,onChange:e=>o(e,l),value:i,"aria-labelledby":c}))})))}function XS({isRenderedInSidebar:e,popoverProps:t,...n}){const o=(0,Uo.useMemo)((()=>({shift:!0,resize:!1,...e?{placement:"left-start",offset:34}:{placement:"bottom",offset:8},...t})),[e,t]);return(0,r.createElement)(FE,{contentClassName:"components-color-palette__custom-color-dropdown-content",popoverProps:o,...n})}Vg([Hg,zE]);const ZS=(0,Uo.forwardRef)((function(e,t){const{asButtons:n,loop:o,clearable:i=!0,colors:a=[],disableCustomColors:s=!1,enableAlpha:l=!1,onChange:d,value:f,__experimentalIsRenderedInSidebar:m=!1,headingLevel:p=2,"aria-label":h,"aria-labelledby":g,...v}=e,[b,y]=(0,Uo.useState)(f),x=(0,Uo.useCallback)((()=>d(void 0)),[d]),w=(0,Uo.useCallback)((e=>{y(((e,t)=>{if(!/^var\(/.test(null!=e?e:"")||null===t)return e;const{ownerDocument:n}=t,{defaultView:r}=n,o=r?.getComputedStyle(t).backgroundColor;return o?Bg(o).toHex():e})(f,e))}),[f]),E=qS(a),_=(0,Uo.useMemo)((()=>((e,t=[],n=!1)=>{if(!e)return"";const r=/^var\(/.test(e),o=r?e:Bg(e).toHex(),i=n?t:[{colors:t}];for(const{colors:e}of i)for(const{name:t,color:n}of e)if(o===(r?n:Bg(n).toHex()))return t;return(0,u.__)("Custom")})(f,a,E)),[f,a,E]),S=f?.startsWith("#"),C=f?.replace(/^var\((.+)\)$/,"$1"),k=C?(0,u.sprintf)((0,u.__)('Custom color picker. The currently selected color is called "%1$s" and has a value of "%2$s".'),_,C):(0,u.__)("Custom color picker."),P={clearColor:x,onChange:d,value:f},T=!!i&&(0,r.createElement)(BS.ButtonAction,{onClick:x},(0,u.__)("Clear"));let I;if(n)I={asButtons:!0};else{const e={asButtons:!1,loop:o};I=h?{...e,"aria-label":h}:g?{...e,"aria-labelledby":g}:{...e,"aria-label":(0,u.__)("Custom color picker.")}}return(0,r.createElement)(jS,{spacing:3,ref:t,...v},!s&&(0,r.createElement)(XS,{isRenderedInSidebar:m,renderContent:()=>(0,r.createElement)(GS,{paddingSize:"none"},(0,r.createElement)(MS,{color:b,onChange:e=>d(e),enableAlpha:l})),renderToggle:({isOpen:e,onToggle:t})=>(0,r.createElement)(jS,{className:"components-color-palette__custom-color-wrapper",spacing:0},(0,r.createElement)("button",{ref:w,className:"components-color-palette__custom-color-button","aria-expanded":e,"aria-haspopup":"true",onClick:t,"aria-label":k,style:{background:f},type:"button"}),(0,r.createElement)(jS,{className:"components-color-palette__custom-color-text-wrapper",spacing:.5},(0,r.createElement)(VS,{className:"components-color-palette__custom-color-name"},f?_:(0,u.__)("No color selected")),(0,r.createElement)(VS,{className:c()("components-color-palette__custom-color-value",{"components-color-palette__custom-color-value--is-hex":S})},C)))}),(0,r.createElement)(BS,{...I,actions:T,options:E?(0,r.createElement)(KS,{...P,headingLevel:p,colors:a,value:f}):(0,r.createElement)(YS,{...P,colors:a,value:f})}))})),JS=ZS,QS=bs(Ry,{target:"e1bagdl32"})("&&&{input{display:block;width:100%;}",kv,"{transition:box-shadow 0.1s linear;}}"),eC=({selectSize:e})=>({small:Ps("box-sizing:border-box;padding:2px 1px;width:20px;color:",Ds.gray[800],";font-size:8px;line-height:1;letter-spacing:-0.5px;text-transform:uppercase;text-align-last:center;",""),default:Ps("box-sizing:border-box;min-width:24px;max-width:48px;height:24px;margin-inline-end:",Ah(2),";padding:",Ah(1),";color:",Ds.theme.accent,";font-size:13px;line-height:1;text-align-last:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;","")}[e]),tC=bs("div",{target:"e1bagdl31"})("&&&{pointer-events:none;",eC,";color:",Ds.gray[900],";}"),nC=bs("select",{target:"e1bagdl30"})("&&&{appearance:none;background:transparent;border-radius:2px;border:none;display:block;outline:none;margin:0;min-height:auto;font-family:inherit;",eC,";",(({selectSize:e="default"})=>({small:Ps("height:100%;border:1px solid transparent;transition:box-shadow 0.1s linear,border 0.1s linear;",Jh({borderTopLeftRadius:0,borderBottomLeftRadius:0})()," &:not(:disabled):hover{background-color:",Ds.gray[100],";}&:focus{border:1px solid ",Ds.ui.borderFocus,";box-shadow:inset 0 0 0 ",Xg.borderWidth+" "+Ds.ui.borderFocus,";outline-offset:0;outline:2px solid transparent;z-index:1;}",""),default:Ps("display:flex;justify-content:center;align-items:center;&:hover{color:",Ds.ui.borderFocus,";box-shadow:inset 0 0 0 ",Xg.borderWidth+" "+Ds.ui.borderFocus,";outline:",Xg.borderWidth," solid transparent;}&:focus{box-shadow:0 0 0 ",Xg.borderWidthFocus+" "+Ds.ui.borderFocus,";outline:",Xg.borderWidthFocus," solid transparent;}","")}[e])),";&:not( :disabled ){cursor:pointer;}}");const rC={name:"f3vz0n",styles:"font-weight:500"},oC=Ps("box-shadow:inset ",Xg.controlBoxShadowFocus,";",""),iC=Ps("border:0;padding:0;margin:0;",Kb,";",""),aC=Ps(QS,"{flex:0 0 auto;}",""),sC=Ps("background:#fff;&&>button{aspect-ratio:1;padding:0;display:flex;align-items:center;justify-content:center;",Jh({borderRadius:"2px 0 0 2px"},{borderRadius:"0 2px 2px 0"})()," border:",Xg.borderWidth," solid ",Ds.ui.border,";&:focus,&:hover:not( :disabled ){",oC," border-color:",Ds.ui.borderFocus,";z-index:1;position:relative;}}",""),lC=(e,t)=>{const{style:n}=e||{};return Ps("border-radius:9999px;border:2px solid transparent;",n?(e=>{const{color:t,style:n}=e||{},r=n&&"none"!==n?Ds.gray[300]:void 0;return Ps("border-style:","none"===n?"solid":n,";border-color:",t||r,";","")})(e):void 0," width:","__unstable-large"===t?"24px":"22px",";height:","__unstable-large"===t?"24px":"22px",";padding:","__unstable-large"===t?"2px":"1px",";&>span{height:",Ah(4),";width:",Ah(4),";background:linear-gradient(\n\t\t\t\t-45deg,\n\t\t\t\ttransparent 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 52%,\n\t\t\t\ttransparent 52%\n\t\t\t);}","")},cC=Ps("width:",228,"px;>div:first-of-type>",Qb,"{margin-bottom:0;",rC,";}&& ",Qb,"+button:not( .has-text ){min-width:24px;padding:0;}",""),uC=Ps("",""),dC=Ps("",""),fC=Ps("justify-content:center;width:100%;&&{border-top:",Xg.borderWidth," solid ",Ds.gray[400],";border-top-left-radius:0;border-top-right-radius:0;height:40px;}",""),mC="web"===Uo.Platform.OS,pC={px:{value:"px",label:mC?"px":(0,u.__)("Pixels (px)"),a11yLabel:(0,u.__)("Pixels (px)"),step:1},"%":{value:"%",label:mC?"%":(0,u.__)("Percentage (%)"),a11yLabel:(0,u.__)("Percent (%)"),step:.1},em:{value:"em",label:mC?"em":(0,u.__)("Relative to parent font size (em)"),a11yLabel:(0,u._x)("ems","Relative to parent font size (em)"),step:.01},rem:{value:"rem",label:mC?"rem":(0,u.__)("Relative to root font size (rem)"),a11yLabel:(0,u._x)("rems","Relative to root font size (rem)"),step:.01},vw:{value:"vw",label:mC?"vw":(0,u.__)("Viewport width (vw)"),a11yLabel:(0,u.__)("Viewport width (vw)"),step:.1},vh:{value:"vh",label:mC?"vh":(0,u.__)("Viewport height (vh)"),a11yLabel:(0,u.__)("Viewport height (vh)"),step:.1},vmin:{value:"vmin",label:mC?"vmin":(0,u.__)("Viewport smallest dimension (vmin)"),a11yLabel:(0,u.__)("Viewport smallest dimension (vmin)"),step:.1},vmax:{value:"vmax",label:mC?"vmax":(0,u.__)("Viewport largest dimension (vmax)"),a11yLabel:(0,u.__)("Viewport largest dimension (vmax)"),step:.1},ch:{value:"ch",label:mC?"ch":(0,u.__)("Width of the zero (0) character (ch)"),a11yLabel:(0,u.__)("Width of the zero (0) character (ch)"),step:.01},ex:{value:"ex",label:mC?"ex":(0,u.__)("x-height of the font (ex)"),a11yLabel:(0,u.__)("x-height of the font (ex)"),step:.01},cm:{value:"cm",label:mC?"cm":(0,u.__)("Centimeters (cm)"),a11yLabel:(0,u.__)("Centimeters (cm)"),step:.001},mm:{value:"mm",label:mC?"mm":(0,u.__)("Millimeters (mm)"),a11yLabel:(0,u.__)("Millimeters (mm)"),step:.1},in:{value:"in",label:mC?"in":(0,u.__)("Inches (in)"),a11yLabel:(0,u.__)("Inches (in)"),step:.001},pc:{value:"pc",label:mC?"pc":(0,u.__)("Picas (pc)"),a11yLabel:(0,u.__)("Picas (pc)"),step:1},pt:{value:"pt",label:mC?"pt":(0,u.__)("Points (pt)"),a11yLabel:(0,u.__)("Points (pt)"),step:1},svw:{value:"svw",label:mC?"svw":(0,u.__)("Small viewport width (svw)"),a11yLabel:(0,u.__)("Small viewport width (svw)"),step:.1},svh:{value:"svh",label:mC?"svh":(0,u.__)("Small viewport height (svh)"),a11yLabel:(0,u.__)("Small viewport height (svh)"),step:.1},svi:{value:"svi",label:mC?"svi":(0,u.__)("Viewport smallest size in the inline direction (svi)"),a11yLabel:(0,u.__)("Small viewport width or height (svi)"),step:.1},svb:{value:"svb",label:mC?"svb":(0,u.__)("Viewport smallest size in the block direction (svb)"),a11yLabel:(0,u.__)("Small viewport width or height (svb)"),step:.1},svmin:{value:"svmin",label:mC?"svmin":(0,u.__)("Small viewport smallest dimension (svmin)"),a11yLabel:(0,u.__)("Small viewport smallest dimension (svmin)"),step:.1},lvw:{value:"lvw",label:mC?"lvw":(0,u.__)("Large viewport width (lvw)"),a11yLabel:(0,u.__)("Large viewport width (lvw)"),step:.1},lvh:{value:"lvh",label:mC?"lvh":(0,u.__)("Large viewport height (lvh)"),a11yLabel:(0,u.__)("Large viewport height (lvh)"),step:.1},lvi:{value:"lvi",label:mC?"lvi":(0,u.__)("Large viewport width or height (lvi)"),a11yLabel:(0,u.__)("